public function execute($filterChain)
 {
     if (jfPortableDevice::isPortableDevice()) {
         self::disable();
     }
     return parent::execute($filterChain);
 }
 public function execute($filterChain)
 {
     $context = $this->getContext();
     $request = $context->getRequest();
     if (jfPortableDevice::isPortableDevice()) {
         $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', $request->getUri());
     }
     $filterChain->execute();
     if (jfPortableDevice::isPortableDevice()) {
         if (jfPortableDevice::getConfig('lazyLoadImages')) {
             $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 executeIndex()
 {
     $request = $this->getContext()->getRequest();
     //symfony 1.0 compatibility
     jfPortableDevice::setPageAttribute('data-jfPDExtImageGallery', 'true');
     $this->jsOptions = sfConfig::get('mod_jfportabledeviceextimagegallery_jsOptions', array());
     //jfPortableDevice::setConfig('fixedToolbars', false);
 }
 public function executeManifest()
 {
     $request = sfContext::getInstance()->getRequest();
     //symfony 1.0 compatibility
     if (method_exists($context, 'getConfiguration') && method_exists($context->getConfiguration(), 'loadHelpers')) {
         $context->getConfiguration()->loadHelpers('Url');
     } else {
         if (method_exists('sfLoader', 'loadHelpers')) {
             sfLoader::loadHelpers('Url');
             //maintain compatibility to symfony versions prior to 1.3
         }
     }
     sfConfig::set('sf_web_debug', false);
     $this->setLayout(false);
     $this->getResponse()->setContentType('text/cache-manifest');
     $this->files = array(jfPortableDevice::extendUrl(url_for(jfPortableDevice::getConfig('startUrl'))));
     //		$this->files = $this->getCacheManifestFilesForConfig(jfPortableDevice::getConfig('includeJavascriptsForApp'), 'javascript_path');
     //		$this->files = $this->getCacheManifestFilesForConfig(jfPortableDevice::getConfig('includeStylesheetsForApp'), 'stylesheet_path', $this->files);
     //		$this->files = $this->getCacheManifestFilesForDirectory(sfConfig::get('sf_web_dir').jfPortableDevice::getConfig('jfPDTheme'), $this->files);
 }
Esempio n. 5
0
<?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>
 protected function getJsConfig(sfWebRequest $request)
 {
     $context = $this->getContext();
     // compatibility with symfony 1.0:
     if (method_exists($context, 'getConfiguration') && method_exists($context->getConfiguration(), 'loadHelpers')) {
         $context->getConfiguration()->loadHelpers('Url');
     } else {
         if (method_exists('sfLoader', 'loadHelpers')) {
             sfLoader::loadHelpers('Url');
             //maintain compatibility to symfony versions prior to 1.3
         }
     }
     $config = array();
     $config['displayErrors'] = sfConfig::get('sf_environment') === 'dev';
     $config['appVersion'] = jfPortableDevice::getConfig('appVersion', 1);
     $config['startUrl'] = url_for(jfPortableDevice::getConfig('startUrl'));
     $config['messages'] = jfPortableDevice::getConfig('messages', array());
     $config['environment'] = jfPortableDevice::getConfig('environment', array());
     try {
         $i18n = sfContext::getInstance()->getI18N();
         foreach ($config['messages'] as $key => $value) {
             $config['messages'][$key] = $i18n->__($value, null, 'jfPortableDevice');
         }
     } catch (sfConfigurationException $e) {
         //i18n not enabled. That'S OK. We'll simply use the english message.
     }
     $config['refreshTimeout'] = jfPortableDevice::getConfig('refreshTimeout', 0);
     $config['refreshUrls'] = array_map('url_for', jfPortableDevice::getConfig('refreshUrls', array()));
     return $config;
 }
 public static function setDeviceSize($value)
 {
     self::$deviceSize = intval($value);
 }
    $pageAttributesAsString .= ' ' . $key . '="' . $value . '"';
}
?>
<div <?php 
echo $pageAttributesAsString;
?>
 class="<?php 
if (has_slot('jfPD_bodyCssClass')) {
    ?>
 <?php 
    include_slot('jfPD_bodyCssClass');
}
?>
">
<?php 
if (!jfPortableDevice::isNativeApp() || !$initialRequest) {
    ?>
	<?php 
    include_slot('page_assets');
    ?>
  <?php 
    include_partial('jfPortableDevice/header');
    ?>
  <div data-role="content" >
    <?php 
    echo $sf_content;
    ?>
  </div>
  <?php 
    include_partial('jfPortableDevice/footer');
    ?>
Esempio n. 9
0
<script>
<?php 
if (jfPortableDevice::isNativeApp() && !$sf_request->isXmlHttpRequest()) {
    ?>
  jfPD.appType = 'native';
<?php 
}
?>
jfPD.init(<?php 
echo $sf_data->getRaw('config');
?>
);
</script>
Esempio n. 10
0
<div data-role="header"<?php 
if (jfPortableDevice::getConfig('fixedHeader')) {
    ?>
 data-position="fixed" data-tap-toggle="false"<?php 
}
if (jfPortableDevice::getConfig('jQueryUIThemeHeader')) {
    ?>
 data-theme="<?php 
    echo jfPortableDevice::getConfig('jQueryUIThemeHeader');
    ?>
"<?php 
}
?>
>
	<?php 
include_partial('jfPortableDevice/topBar');
?>
</div>
 protected function getJsConfig(sfWebRequest $request)
 {
     $context = $this->getContext();
     // compatibility with symfony 1.0:
     if (method_exists($context, 'getConfiguration') && method_exists($context->getConfiguration(), 'loadHelpers')) {
         $context->getConfiguration()->loadHelpers('Url');
     } else {
         if (method_exists('sfLoader', 'loadHelpers')) {
             sfLoader::loadHelpers('Url');
             //maintain compatibility to symfony versions prior to 1.3
         }
     }
     $config = array();
     $config['displayErrors'] = sfConfig::get('sf_environment') === 'dev';
     $config['startUrl'] = url_for(jfPortableDevice::getConfig('startUrl'));
     $config['environment'] = jfPortableDevice::getConfig('environment', array());
     $config['refreshTimeout'] = jfPortableDevice::getConfig('refreshTimeout', 0);
     $config['refreshUrls'] = array_map('url_for', jfPortableDevice::getConfig('refreshUrls', array()));
     return $config;
 }
Esempio n. 12
0
<?php

if (jfPortableDevice::getConfig('useTabBar')) {
    ?>
	<?php 
    $activeTab = jfPortableDevice::getActiveTab();
    $activeClass = 'ui-btn-active  ui-state-persist';
    ?>
	<div data-role="navbar">
		<ul>
	    <li><?php 
    echo link_to(__('Home', null, 'jfPortableDevice'), jfPortableDevice::getConfig('startUrl'), array('class' => $activeTab === 'home' ? $activeClass : null));
    ?>
</li>
			<li><a href="http://jnotes.jonasfischer.net">jNotes</a></li>
	    <li><a href="http://www.jonasfischer.net">Jonas Fischer</a></li>
	  </ul>
	</div>
<?php 
}