This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function rules() | |
{ | |
return [ | |
// the name, email, subject and body attributes are required | |
[['name', 'email', 'subject', 'body'], 'required'], | |
// the email attribute should be a valid email address | |
['email', 'email'], | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function rules() | |
{ | |
return [ | |
['username', 'required'], | |
['username', 'unique', 'message' => 'This username has already been taken.'], | |
['username', 'string', 'min' => 2, 'max' => 255], | |
['email', 'required'], | |
['email', 'email'], | |
['email', 'unique', 'message' => 'This email address has already been taken.'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$transes = (new \yii\db\Query()) | |
->select('DATE_FORMAT(FROM_UNIXTIME(`created`), "%M %Y") as `dates`, SUM(amount) AS amount, SUM(fee) AS fee, SUM(net) AS net, SUM(IF(`amount`< 0, `amount`, 0 )) AS pay_out') | |
->from('tbl_transaction_newest') | |
->groupBy('`dates`') | |
->limit(1000) | |
->orderBy('created') | |
->all(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$accordian = [ | |
'General Configuration' => [ | |
'Timezone' => 'If you plan on using the Facebook Direct (easy) export option you should <a href="' . Yii::$app->urlManager->createUrl('setting/update') . '">specify your timezone</a> in Postradamus so your posts get scheduled to Facebook at the correct times.', | |
'Time and Date Format' => 'You can setup your own <a href="' . Yii::$app->urlManager->createUrl('setting/update') . '">time and date format</a> for Postradamus to use any time it displays a time or date. Right now, your times and dates will look like this: <i>' . date(Yii::$app->postradamus->get_user_date_format()) . '</i>', | |
], | |
'Working with Content' => [ | |
'Ways to Find Content' => [ | |
'Find on Web' => [ | |
'Facebook' => [ | |
'My Pages' => 'Find content on the Facebook pages you manage. This can be really useful if you want to find fan content.', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$accordian = [ | |
'General Configuration|This is a description that would show before the accordion group below.' => [ | |
'Timezone' => 'Example here', | |
'Time and Date Format' => 'Example here', | |
], | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Searches pinterest (screen scrape) for photos */ | |
public function search($search_params) | |
{ | |
try { | |
$url = 'http://www.pinterest.com/search/pins/?q=' . urlencode($search_params['search_keywords']); | |
$html = file_get_contents($url); | |
} catch (\Exception $e) { | |
$this->message->set_message("Could not load the Pinterest search page. Please try again later." . "\n\n". $e->getMessage(), Message::MSG_TYPE_ERROR); | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if ( !$session->validate() ) { | |
$session = null; | |
} | |
} catch ( Exception $e ) { | |
// catch any exceptions | |
$session = null; | |
echo $e->getMessage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Test { | |
private $_testMethodArray; | |
public function testDeleteFromMethodArray() | |
{ | |
$this->testMethodArray(); | |
unset($this->testMethodArray()[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use yii\helpers\Html; | |
use yii\widgets\DetailView; | |
/** | |
* @var yii\web\View $this | |
* @var common\models\cList $model | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
'class' => 'btn btn-danger', | |
'data' => [ | |
'confirm' => 'Are you sure you want to delete this item?', | |
'method' => 'post', | |
], | |
]) ?> |