當前位置: 首頁>>代碼示例>>PHP>>正文


PHP base\Action類代碼示例

本文整理匯總了PHP中yii\base\Action的典型用法代碼示例。如果您正苦於以下問題:PHP Action類的具體用法?PHP Action怎麽用?PHP Action使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Action類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isActive

 /**
  * Returns a value indicating whether the filer is active for the given action.
  * @param \yii\base\Action $action the action being filtered
  * @return boolean whether the filer is active for the given action.
  */
 protected function isActive($action)
 {
     if ($action->getUniqueId() === Yii::$app->getErrorHandler()->errorAction) {
         return false;
     }
     return parent::isActive($action);
 }
開發者ID:apurey,項目名稱:cmf,代碼行數:12,代碼來源:AccessControl.php

示例2: matchActionAccess

 /**
  * check the permission, if we rewrite and controller, the controller id and module id is not changed
  * @param \yii\base\Action $action
  * @param \yii\web\User $user
  * @param \yii\web\Request $request
  * @return bool
  */
 public function matchActionAccess($action, $user, $request)
 {
     if ($user->getIsGuest()) {
         return false;
     }
     /** @var \core\auth\Module $authModule */
     $authModule = \Yii::$app->getModule('core_auth');
     foreach ($authModule->getAdmins() as $key => $admin) {
         if ($user->getIdentity()->username == $admin['username']) {
             return true;
         }
     }
     if ($action->controller->module instanceof Application) {
         $key = 'default' . '_' . $action->controller->id . '_' . $action->id;
     } else {
         $key = $action->getUniqueId();
         $key = explode('/', $key);
         array_shift($key);
         $key = implode('_', $key);
     }
     $key = lcfirst(implode('', array_map(function ($k) {
         return ucfirst($k);
     }, explode('-', $key))));
     return $user->can($key, $this->params);
 }
開發者ID:yinheark,項目名稱:yincart2,代碼行數:32,代碼來源:ActionAccessRule.php

示例3: init

 public function init()
 {
     //csrf狀態
     Yii::$app->request->enableCsrfValidation = $this->csrf;
     Yii::$app->request->enableCookieValidation = $this->csrf;
     //當前目錄
     $this->currentPath = dirname(__FILE__);
     return parent::init();
 }
開發者ID:lxpgw,項目名稱:yii2-ueditor-widget,代碼行數:9,代碼來源:Upload.php

示例4: description

 /**
  * Returns description for method
  * @return string
  */
 public function description()
 {
     if (method_exists($this->action, 'description')) {
         return $this->action->description();
     }
     return $this->docBlock ? $this->docBlock->getShortDescription() : '';
 }
開發者ID:VictorGub,項目名稱:yii2-swagger,代碼行數:11,代碼來源:ActionAdapter.php

示例5: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!empty($this->data)) {
         $this->data = call_user_func($this->data);
     }
 }
開發者ID:anli,項目名稱:yii2-helper,代碼行數:10,代碼來源:EnvelopeAction.php

示例6: init

 public function init()
 {
     parent::init();
     if (!$this->model) {
         throw new InvalidParamException('model不能為null');
     }
 }
開發者ID:chenkby,項目名稱:yii2-region,代碼行數:7,代碼來源:RegionAction.php

示例7: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->callable)) {
         throw new InvalidParamException('Param "callable" can not be empty.');
     }
 }
開發者ID:voskobovich,項目名稱:yii2-liqpay,代碼行數:10,代碼來源:CallbackAction.php

示例8: init

 public function init()
 {
     //close csrf
     Yii::$app->request->enableCsrfValidation = false;
     //默認設置
     // $this->php_path =  dirname(__FILE__) . '/';
     $this->php_path = $_SERVER['DOCUMENT_ROOT'] . '/';
     $this->php_url = '/';
     //根目錄路徑,可以指定絕對路徑,比如 /var/www/attached/
     $this->root_path = $this->php_path . 'upload/';
     //根目錄URL,可以指定絕對路徑,比如 http://www.yoursite.com/attached/
     $this->root_url = $this->php_url . 'upload/';
     //圖片擴展名
     //            $ext_arr = ['gif', 'jpg', 'jpeg', 'png', 'bmp'],
     //文件保存目錄路徑
     $this->save_path = $this->php_path . 'upload/';
     //文件保存目錄URL
     $this->save_url = $this->php_url . 'upload/';
     //定義允許上傳的文件擴展名
     //            $ext_arr = array(
     //                'image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp'),
     //                'flash' => array('swf', 'flv'),
     //                'media' => array('swf', 'flv', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'),
     //                'file' => array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'),
     //            ),
     //最大文件大小
     $this->max_size = 1000000;
     $this->save_path = realpath($this->save_path) . '/';
     //load config file
     parent::init();
 }
開發者ID:pjkui,項目名稱:kindeditor,代碼行數:31,代碼來源:KindEditorAction.php

示例9: init

 /**
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (!is_callable($this->outputFunction)) {
         throw new InvalidConfigException('outputFunction must be callable');
     }
 }
開發者ID:AleksandrChernyavenko,項目名稱:yii2-widget-depdrop,代碼行數:10,代碼來源:DepDropAction.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->modelClass)) {
         throw new InvalidConfigException('The "modelClass" property must be set.');
     }
 }
開發者ID:ramialcheikh,項目名稱:quickforms,代碼行數:10,代碼來源:DeleteMultipleAction.php

示例11: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->modelClass == null) {
         throw new InvalidConfigException('Param "modelClass" must be contain model name with namespace.');
     }
 }
開發者ID:heartshare,項目名稱:yii2-recovery-password-toolkit,代碼行數:10,代碼來源:CompleteAction.php

示例12: init

 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!isset($this->ownerLinkTable, $this->className)) {
         throw new InvalidConfigException('"ownerLinkTable" and "className" attributes cannot be null');
     }
     parent::init();
 }
開發者ID:2amigos,項目名稱:yii2-file-upload-widget,代碼行數:11,代碼來源:FileDeleteAction.php

示例13: init

 /**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->modelClass === null) {
         throw new InvalidConfigException('"modelClass" cannot be empty.');
     }
     parent::init();
 }
開發者ID:2amigos,項目名稱:yii2-grid-view-library,代碼行數:11,代碼來源:ToggleAction.php

示例14: init

 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!isset($this->ownerRelation, $this->ownerTable, $this->searchClass, $this->view)) {
         throw new InvalidConfigException('"searchClass", "ownerRelation", "ownerTable" and "view" attributes cannot be null');
     }
     parent::init();
 }
開發者ID:2amigos,項目名稱:yii2-file-upload-widget,代碼行數:11,代碼來源:FileListAction.php

示例15: beforeRun

 /**
  * @return bool
  */
 public function beforeRun()
 {
     Yii::$app->view->title = 'Update Record';
     Yii::$app->view->params['breadcrumbs'][] = ['label' => 'Review Errors', 'url' => ['review-errors', 'id' => Yii::$app->request->get('id')]];
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return parent::beforeRun();
 }
開發者ID:webtoolsnz,項目名稱:yii2-importer,代碼行數:10,代碼來源:UpdateRecordAction.php


注:本文中的yii\base\Action類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。