%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yii\filters;
use Yii;
use yii\base\ActionFilter;
use yii\web\BadRequestHttpException;
use yii\web\Request;
/**
* AjaxFilter allow to limit access only for ajax requests.
*
* ```php
* public function behaviors()
* {
* return [
* [
* 'class' => 'yii\filters\AjaxFilter',
* 'only' => ['index']
* ],
* ];
* }
* ```
*
* @author Dmitry Dorogin <dmirogin@ya.ru>
* @since 2.0.13
*/
class AjaxFilter extends ActionFilter
{
/**
* @var string the message to be displayed when request isn't ajax
*/
public $errorMessage = 'Request must be XMLHttpRequest.';
/**
* @var Request|null the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
* {@inheritdoc}
*/
public function init()
{
if ($this->request === null) {
$this->request = Yii::$app->getRequest();
}
}
/**
* {@inheritdoc}
*/
public function beforeAction($action)
{
if ($this->request->getIsAjax()) {
return true;
}
throw new BadRequestHttpException($this->errorMessage);
}
}