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); } } }
<?php if (jfPortableDevice::getConfig('displayLinkToClassicTheme') && !jfPortableDevice::isNativeApp()) { $url = $sf_data->getRaw('sf_request')->getUri(); $url = jfPortableDevice::cleanUrl($url, true); $url = htmlspecialchars($url); echo link_to(__('Switch to classic theme', null, 'jfPortableDevice'), $url, array('data-ajax' => 'false', 'class' => 'jfPD_classicTheme')); } ?> <div data-role="footer" class="jfPD_footer"<?php if (jfPortableDevice::getConfig('fixedFooter')) { ?> data-position="fixed" data-tap-toggle="false"<?php } if (jfPortableDevice::getConfig('jQueryUIThemeFooter')) { ?> data-theme="<?php echo jfPortableDevice::getConfig('jQueryUIThemeFooter'); ?> "<?php } ?> > <?php include_partial('jfPortableDevice/tabBar'); ?> </div>
<?php include_metas(); include_component('jfPortableDevice', 'includeAssetsForApp'); $theme = jfPortableDevice::getConfig('jfPDTheme'); ?> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1" /> <link rel="apple-touch-icon" href="<?php echo $theme; ?> /img/icon.png" /> <link rel="apple-touch-startup-image" href="<?php echo $theme; ?> /img/startup.png" /> <link rel="canonical" href="<?php echo htmlspecialchars(jfPortableDevice::cleanUrl($sf_data->getRaw('sf_request')->getUri())); ?> " /> <?php include_component('jfPortableDevice', 'initialize'); ?> <?php } ?> </head> <body> <?php $pageAttributes = jfPortableDevice::getConfig('pageAttributes', array()); $pageAttributesAsString = ''; foreach ($pageAttributes as $key => $value) { $pageAttributesAsString .= ' ' . $key . '="' . $value . '"';