本文整理汇总了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());
}
}