本文整理汇总了PHP中Controller::afterFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::afterFilter方法的具体用法?PHP Controller::afterFilter怎么用?PHP Controller::afterFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::afterFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeRender
public function beforeRender()
{
parent::afterFilter();
unset($this->viewVars['_serialize']);
foreach ($this->viewVars as $key => $var) {
$this->viewVars['_serialize'][] = $key;
}
}
示例2: afterFilter
public function afterFilter()
{
parent::afterFilter();
if (substr($this->params['action'], 0, 4) == 'app_' && !empty($this->data)) {
$this->layout = 'app';
$this->render('/Pages/app');
}
}
示例3: afterFilter
function afterFilter()
{
//log degli errori smtp
if (!empty($this->Email->smtpError)) {
$this->log($this->Email->smtpError, 'smtp-errors');
}
return parent::afterFilter();
}
示例4: _outputMessage
/**
* Generate the response using the controller object.
*
* @param string $template The template to render.
* @return void
*/
protected function _outputMessage($template)
{
try {
$this->controller->render($template);
$this->controller->afterFilter();
$this->controller->response->send();
} catch (Exception $e) {
$this->_outputMessageSafe('error500');
}
}
示例5: afterFilter
function afterFilter()
{
parent::afterFilter();
/**
* 出力文字コードの変換
*/
if (!empty($this->params['prefix']) && $this->params['prefix'] === 'm') {
$this->output = mb_convert_kana($this->output, "rak", "UTF-8");
//$this->output = mb_convert_encoding($this->output, "SJIS", "UTF-8");
$this->output = mb_convert_encoding($this->output, "SJIS-win", "UTF-8");
}
}
示例6: _outputMessage
/**
* Generate the response using the controller object.
*
* @param string $template The template to render.
* @return void
*/
protected function _outputMessage($template) {
try {
$this->controller->render($template);
$this->controller->afterFilter();
$this->controller->response->send();
} catch (MissingViewException $e) {
$attributes = $e->getAttributes();
if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
$this->_outputMessageSafe('error500');
} else {
$this->_outputMessage('error500');
}
} catch (Exception $e) {
$this->_outputMessageSafe('error500');
}
}
示例7: _outputMessage
/**
* Generate the response using the controller object.
*
* @param string $template The template to render.
* @return void
*/
protected function _outputMessage($template)
{
$this->controller->render($template);
$this->controller->afterFilter();
$this->controller->response->send();
}
示例8: afterFilter
public function afterFilter()
{
parent::afterFilter();
// Output compression on all requests
$parser = \WyriHaximus\HtmlCompress\Factory::construct();
$compressedHtml = $parser->compress($this->response->body());
//$this->response->compress();
$this->response->body($compressedHtml);
}
示例9: _output
/**
* Outputs the content of a scaffold method passing it through the Controller::afterFilter()
*
* @return void
*/
protected function _output()
{
$this->controller->afterFilter();
$this->controller->getResponse()->send();
}
示例10: afterFilter
/**
* Called after every controller action, and after rendering is complete.
* This is the last controller method to run.
*
* @return void
*/
public function afterFilter()
{
parent::afterFilter();
}
示例11: afterFilter
/**
* afterFilter callback
* Disable debug mode on JSON pages to prevent the script execution time to be appended to the page
*
* @see http://croogo.lighthouseapp.com/projects/32818/tickets/216
* @return void
*/
public function afterFilter()
{
parent::afterFilter();
if (!empty($this->params['url']['ext']) && $this->params['url']['ext'] === 'json') {
Configure::write('debug', 0);
}
}
示例12: afterFilter
function afterFilter()
{
parent::afterFilter();
if (isset($_SERVER['HTTP_SF_AJAX_HEADER']) && $_SERVER['HTTP_SF_AJAX_HEADER'] == 'sfDialog') {
unset($this->viewVars['controller']);
$scripts = isset($this->jsResponse['script']) ? $this->jsResponse['script'] : array();
$this->jsResponse = array();
$this->jsResponse['id_display']['sfDialogModel_title'] = isset($this->viewVars['title']) ? $this->viewVars['title'] : '';
$this->jsResponse['id_display']['sfDialogModel_body'] = $this->render();
$this->jsResponse['script'][] = '$("#sfDialogModel").modal("show")';
$this->jsResponse['script'][] = '$("#sfDialogModel").scrollTop(0);';
foreach ($scripts as $script) {
$this->jsResponse['script'][] = $script;
}
$this->renderJsResponse();
} elseif (count($this->jsResponse) > 0) {
$this->renderJsResponse();
}
}
示例13: afterFilter
function afterFilter()
{
parent::afterFilter();
$this->wildflowerCallback();
}
示例14: afterFilter
public function afterFilter()
{
return parent::afterFilter();
}
示例15: afterFilter
public function afterFilter()
{
parent::afterFilter();
// sql logging to chrome console
if (class_exists('ConnectionManager') && Configure::read('debug') >= 2) {
App::import('Vendor', 'ChromePhp/ChromePhp');
$sources = ConnectionManager::sourceList();
$logs = array();
foreach ($sources as $source) {
$db = ConnectionManager::getDataSource($source);
$logs[$source] = $db->getLog();
}
foreach ($logs as $source => $logInfo) {
$text = $logInfo['count'] > 1 ? 'queries' : 'query';
ChromePhp::info('------- SQL: ' . sprintf('(%s) %s %s took %s ms', $source, count($logInfo['log']), $text, $logInfo['time']) . ' -------');
ChromePhp::info('------- REQUEST: ' . $this->request->params['controller'] . '/' . $this->request->params['action'] . ' -------');
foreach ($logInfo['log'] as $k => $i) {
$i += array('error' => '');
if (!empty($i['params']) && is_array($i['params'])) {
$bindParam = $bindType = null;
if (preg_match('/.+ :.+/', $i['query'])) {
$bindType = true;
}
foreach ($i['params'] as $bindKey => $bindVal) {
if ($bindType === true) {
$bindParam .= h($bindKey) . " => " . h($bindVal) . ", ";
} else {
$bindParam .= h($bindVal) . ", ";
}
}
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
}
$error = !empty($i['error']) ? "\nError: " . $i['error'] : "\n";
$logStr = $i['query'] . $error . "\nAffected: " . $i['affected'] . "\nNum. Rows: " . $i['numRows'] . "\nTook(ms): " . $i['took'] . "\n\n";
if (!empty($i['error'])) {
ChromePhp::error($logStr);
} else {
if ($i['took'] >= 100) {
ChromePhp::warn($logStr);
} else {
ChromePhp::info($logStr);
}
}
}
}
}
}