public function beforeRender()
 {
     parent::afterFilter();
     unset($this->viewVars['_serialize']);
     foreach ($this->viewVars as $key => $var) {
         $this->viewVars['_serialize'][] = $key;
     }
 }
Example #2
0
 public function afterFilter()
 {
     parent::afterFilter();
     if (substr($this->params['action'], 0, 4) == 'app_' && !empty($this->data)) {
         $this->layout = 'app';
         $this->render('/Pages/app');
     }
 }
 function afterFilter()
 {
     //log degli errori smtp
     if (!empty($this->Email->smtpError)) {
         $this->log($this->Email->smtpError, 'smtp-errors');
     }
     return parent::afterFilter();
 }
 /**
  * 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');
     }
 }
 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");
     }
 }
Example #6
0
/**
 * 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');
		}
	}
 /**
  * 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();
 }
Example #8
0
 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);
 }
 /**
  * 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();
 }
 /**
  * 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();
 }
 /**
  * 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);
     }
 }
Example #12
0
 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();
     }
 }
Example #13
0
 function afterFilter()
 {
     parent::afterFilter();
     $this->wildflowerCallback();
 }
Example #14
0
 public function afterFilter()
 {
     return parent::afterFilter();
 }
Example #15
0
 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);
                     }
                 }
             }
         }
     }
 }
Example #16
0
 /**
  * Output message
  *
  * @access protected
  */
 function _outputMessage($template)
 {
     $this->controller->render($template);
     $this->controller->afterFilter();
     echo $this->controller->output;
 }
Example #17
0
 /**
  * Outputs the content of a scaffold method passing it through the Controller::afterFilter()
  *
  * @return void
  * @access protected
  */
 function _output()
 {
     $this->controller->afterFilter();
     echo $this->controller->output;
 }
 public function afterFilter()
 {
     parent::afterFilter();
     if (Configure::read('LogRequests')) {
         $this->log_request_tail();
     }
 }