case 4: return new VKApiSignatureException($error); case 5: return new VKApiAuthException($error); case 6: return new VKApiTooManyException($error); case 7: return new VKApiPermissionException($error); case 8: return new VKApiRequestException($error); case 9: return new VKApiFloodException($error); case 10: return new VKApiServerException($error); case 11: return new VKApiEnabledInTestException($error); case 14: return new VKApiCaptchaException($error); case 15:
$body = $response->getBody(); $decode_body = $this->decodeBody($body); if (isset($decode_body[static::KEY_ERROR])) { $error = $decode_body[static::KEY_ERROR]; $api_error = new VKApiError($error); throw ExceptionMapper::parse($api_error); } if (isset($decode_body[static::KEY_RESPONSE])) { return $decode_body[static::KEY_RESPONSE]; } else { return $decode_body;
try { $response = $this->http_client->post($url, $params); } catch (TransportRequestException $e) { throw new VKClientException($e); } return $this->parseResponse($response); } /** * Uploads data by its path to the given url. * * @param string $upload_url
* @throws VKApiException in case of API error * @throws VKApiBlockedException Content blocked * @throws VKApiUserDeletedException User was deleted or banned * */ public function get(string $access_token, array $params = array()) { return $this->request->post('wall.get', $access_token, $params); } /** * Allows to search posts on user or community walls. * * @param $access_token string
* @throws \VK\Exceptions\VKClientException */ public function getByWallAndPhotos($params = []) { return $this->vk ->wall() ->get(getenv('VK_SERVICE_GROUP_KEY'), ['owner_id' => getenv('VK_GROUP_ID'), 'domain' => 'kuzovoff'], $params); } }
public $layout = '//other'; public function actionIndex() { $page = Pages::find()->where(['slug' => 'works', 'is_active' => true])->one(); $wallPhotos = \Yii::$app->vk->getByWallAndPhotos(['filter' => 'owner', 'count' => 100]); $photos = ArrayHelper::getValue($wallPhotos, 'items', []); return $this->render('index',[ 'photos' => $photos, 'page' => $page ]);
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
defined('YII_ENV') or define('YII_ENV', env('YII_ENV')); require_once __DIR__ . '/Yii.php'; $config = require __DIR__ . '/../protected/config/main.php'; try { $app = new WebApplication($config); $app->run(); } catch (\yii\base\InvalidConfigException $e) { $message = $e->getMessage(); require_once dirname(__DIR__, 1). '/errors/500.php'; }