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 | |
$secret = 'secret key'; | |
list($hashAlgo, $signature) = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE']); | |
$payload = $HTTP_RAW_POST_DATA ?: file_get_contents('php://input'); | |
$compute = hash_hmac($hashAlgo, $payload, $secret); | |
$valid = hash_equals($compute, $signature); | |
if ($valid === false) { |
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 | |
$url = 'https://flespi.io/gw/channels/{channels}/messages'; | |
$channels = implode(',', [136]); | |
$url = str_replace('{channels}', $channels, $url); | |
// $data = ['timeout' => 10]; | |
// $data = json_encode($data); | |
// $url .= '?' . http_build_query(['data' => $data]); |
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 | |
// backend/controllers/SiteController.php | |
namespace backend\controllers; | |
class SiteController extends Controller | |
{ | |
public function actionIndex() | |
{ | |
Yii::$app->frontendUrlManager |
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 | |
namespace api\modules\v0; | |
use Yii; | |
class Module extends \yii\base\Module | |
{ | |
public function init() | |
{ | |
parent::init(); |
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 | |
// opcache.validate_timestamps = Off | |
opcache_reset(); |
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 | |
namespace common\models; | |
use yii\db\ActiveRecord; | |
class Category extends ActiveRecord | |
{ | |
/** | |
* @return array |
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
#!/usr/bin/env php | |
<?php | |
/** | |
* Using | |
* ~$ php speechkit.php book.txt | |
* | |
* @see https://tech.yandex.ru/speechkit/cloud/doc/guide/concepts/tts-http-request-docpage/ | |
*/ | |
$apiUrl = 'https://tts.voicetech.yandex.net/generate'; |
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 DownloadJob implements \yii\queue\JobInterface | |
{ | |
public $url; | |
public $file; | |
public function execute($queue) | |
{ | |
file_put_contents($this->file, file_get_contents($this->url)); |
OlderNewer