public function execute($filterChain)
 {
     $context = $this->getContext();
     $request = $context->getRequest();
     if ($request->getParameter('jfPD_device') === 'portable') {
         jfPortableDevice::setIsPortableDevice(true);
         $layout = isset(self::$_layout) ? self::$_layout : $this->getParameter('layout');
         $context->getActionStack()->getFirstEntry()->getActionInstance()->setLayout($layout);
         if (class_exists('sfWidgetFormSchema')) {
             // compatibility with symfony 1.0
             sfWidgetFormSchema::setDefaultFormFormatterName($this->getParameter('defaultFormFormatterName', 'jfPD'));
         }
         jfPortableDevice::setPageAttribute('data-url', htmlspecialchars($request->getUri()));
         jfPortableDevice::setPageAttribute('data-clean-url', htmlspecialchars(jfPortableDevice::cleanUrl($request->getUri())));
     }
     $filterChain->execute();
     if (jfPortableDevice::isPortableDevice()) {
         if (jfPortableDevice::getConfig('lazyLoadImages') && $request->isXmlHttpRequest()) {
             $response = $context->getResponse();
             $content = $response->getContent();
             $content = preg_replace('/(<img.*)(src=)([\'|\\"].*>)/', '$1data-jfPD-src=$3', $content);
             $response->setContent($content);
         }
         if (jfPortableDevice::isNativeApp()) {
             sfConfig::set('sf_web_debug', false);
         }
     }
 }
 public function executeRedirect()
 {
     $request = sfContext::getInstance()->getRequest();
     //symfony 1.0 compatibility
     jfPortableDevice::setIsPortableDevice(true);
     jfPortableDevice::setAppType('web');
     jfPortableDevice::setDeviceSize($this->getDeviceSize());
     $redirectUrl = $request->getParameter('redirectUrl', $this->getController()->genUrl(jfPortableDevice::getConfig('startUrl'), true));
     $redirectUrl = jfPortableDevice::extendUrl($redirectUrl);
     $this->redirect($redirectUrl, 302);
     throw new sfStopException();
 }
 public function executeRedirect()
 {
     $request = sfContext::getInstance()->getRequest();
     //symfony 1.0 compatibility
     jfPortableDevice::setIsPortableDevice(true);
     jfPortableDevice::setAppType('web');
     jfPortableDevice::setDeviceSize($this->getDeviceSize());
     $redirectUrl = $request->getParameter('redirectUrl', $this->getController()->genUrl(jfPortableDevice::getConfig('startUrl')));
     if ($redirectUrl[0] !== '/') {
         throw new jfPortableDeviceSecurityException('redirectUrl ' . $redirectUrl . ' rejected: only URLs starting with "/" allowed.');
     }
     $redirectUrl = $request->getUriPrefix() . $redirectUrl;
     $redirectUrl = jfPortableDevice::extendUrl($redirectUrl);
     $this->redirect($redirectUrl, 302);
     throw new sfStopException();
 }