/** * Executes the execute method of an action. * * @param sfAction $actionInstance An sfAction instance * * @return string The view type */ protected function executeAction($actionInstance) { $response = $actionInstance->getResponse(); // Set X-Frame-Options by default. Can be overridden by actions $response->setHttpHeader("X-Frame-Options", "DENY"); // execute the action $viewName = parent::executeAction($actionInstance); // Add form js and stylesheets to response if ($viewName != sfView::NONE) { $response->setHttpHeader('Expires', '0'); $response->setHttpHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0, max-age=0"); $response->setHttpHeader("Cache-Control", "private", false); $actionVars = $actionInstance->getVarHolder()->getAll(); foreach ($actionVars as $var) { if ($var instanceof sfForm) { foreach ($var->getStylesheets() as $file => $media) { $response->addStylesheet($file, '', array('media' => $media)); } foreach ($var->getJavascripts() as $file) { $response->addJavascript($file); } } } } return $viewName; }
protected function handleAction($filterChain, $actionInstance) { $moduleName = $actionInstance->getModuleName(); $actionName = $actionInstance->getActionName(); $request = $actionInstance->getRequest(); if ($request->needToRedirectToSoftBankGateway()) { $request->redirectToSoftBankGateway(); } $this->handleSsl($actionInstance); $dispatcher = sfContext::getInstance()->getEventDispatcher(); // sfDoctrinePlugin needs to notify this event for enabling i18n $dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => sfContext::getInstance()->getUser()->getCulture()))); self::notifyPreExecuteActionEvent($this, $dispatcher, $actionInstance); Doctrine::getTable('SnsTerm')->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app')); if (sfConfig::has('op_is_use_captcha')) { sfConfig::set('op_is_use_captcha', opConfig::get('is_use_captcha')); } try { $result = parent::handleAction($filterChain, $actionInstance); } catch (opRuntimeException $e) { $this->forwardToErrorAction(); } catch (sfValidatorErrorSchema $e) { if (isset($e['_csrf_token'])) { $this->forwardToCSRFErrorAction(); } throw $e; } self::notifyPostExecuteActionEvent($this, $dispatcher, $actionInstance, $result); return $result; }
/** * Executes the execute method of an action. * * @param sfAction $actionInstance An sfAction instance * * @return string The view type */ protected function executeAction($actionInstance) { // execute the action $viewName = parent::executeAction($actionInstance); // Add form js and stylesheets to response if ($viewName != sfView::NONE) { $response = $actionInstance->getResponse(); $actionVars = $actionInstance->getVarHolder()->getAll(); foreach ($actionVars as $var) { if ($var instanceof sfForm) { foreach ($var->getStylesheets() as $file => $media) { $response->addStylesheet($file, '', array('media' => $media)); } foreach ($var->getJavascripts() as $file) { $response->addJavascript($file); } } } } return $viewName; }
protected function handleAction($filterChain, $actionInstance) { $moduleName = $actionInstance->getModuleName(); $actionName = $actionInstance->getActionName(); $dispatcher = sfContext::getInstance()->getEventDispatcher(); // sfDoctrinePlugin needs to notify this event for enabling i18n $dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => sfContext::getInstance()->getUser()->getCulture()))); $dispatcher->notify(new sfEvent($this, 'op_action.pre_execute_' . $moduleName . '_' . $actionName, array('moduleName' => $moduleName, 'actionName' => $actionName, 'actionInstance' => $actionInstance))); Doctrine::getTable('SnsTerm')->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app')); try { $result = parent::handleAction($filterChain, $actionInstance); } catch (opRuntimeException $e) { $this->forwardToErrorAction(); } catch (sfValidatorErrorSchema $e) { if (isset($e['_csrf_token'])) { $this->forwardToCSRFErrorAction(); } throw $e; } $dispatcher->notify(new sfEvent($this, 'op_action.post_execute_' . $moduleName . '_' . $actionName, array('moduleName' => $moduleName, 'actionName' => $actionName, 'actionInstance' => $actionInstance, 'result' => $result))); return $result; }