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


PHP PageController::beforeAction方法代碼示例

本文整理匯總了PHP中PageController::beforeAction方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageController::beforeAction方法的具體用法?PHP PageController::beforeAction怎麽用?PHP PageController::beforeAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PageController的用法示例。


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

示例1: beforeAction

 /**
  * Before any action is taken do some basic setup
  * Look for out of bounds file uploads
  * Crate a navigation instance
  * Create the default layout varialbes so the layout doesn't have to guess if they are available
  * @return null
  */
 protected function beforeAction()
 {
     parent::beforeAction();
     /*
      When the php post_max_size attribute is exceed the POST array is blanked.
      So a check has to be done using the CONTENT_LENGTH superglobal against the post_max_size value on every request
     */
     if (!empty($_SERVER['CONTENT_LENGTH'])) {
         $max = \Foundation\Utility::convertIniShorthandValue(\ini_get('post_max_size'));
         if ($_SERVER['CONTENT_LENGTH'] > $max) {
             $this->addMessage('error', 'Your input has exceeded the maximum allowed size.  If you are trying to upload a file it is too large.  Please reduce your file size and try again');
         }
     }
     //add jquery
     $this->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
     $this->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js');
     $this->addScript($this->path('resource/foundation/scripts/jquery.json.js'));
     $this->addScript($this->path('resource/foundation/scripts/jquery.cookie.js'));
     $this->addScript($this->path('resource/foundation/scripts/jquery.qtip.js'));
     $this->addScript($this->path('resource/foundation/scripts/anytime.js'));
     $this->addCss($this->path('resource/foundation/styles/jquery.qtip.css'));
     //add the Services javascript class
     $this->addScript($this->path('resource/scripts/classes/Services.class.js'));
     if ($this->_config->getBroadcastMessage()) {
         $this->addMessage('info', $this->_config->getBroadcastMessage());
     }
 }
開發者ID:Jazzee,項目名稱:Jazzee,代碼行數:34,代碼來源:JazzeeController.php


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