Ejemplo n.º 1
0
 public function testCallHooks()
 {
     // Make a mock that registers to all hooks and check required context keys.
     $hooks = array('beforeParse' => array('code', 'template_basedir', 'template_filepath', 'conf'), 'afterParse' => array('code', 'template_basedir', 'template_filepath', 'conf'));
     // init mock plugin
     $methods = array_keys($hooks);
     $plugin = $this->getMock('Rain\\Tpl\\IPlugin', array_merge(array('declareHooks', 'setOptions'), $methods));
     $plugin->expects($this->once())->method('declareHooks')->will($this->returnValue($methods));
     foreach ($hooks as $method => $required) {
         $contstrains = array();
         foreach ($required as $key) {
             $contstrains[] = $this->arrayHasKey($key);
         }
         $plugin->expects($this->once())->method($method)->with(call_user_func_array(array($this, 'logicalAnd'), $contstrains));
     }
     // register plugin and draw template
     Rain\Tpl::registerPlugin($plugin);
     $this->engine->draw('template', true);
 }
Ejemplo n.º 2
0
Archivo: index.php Proyecto: kvox/TVSS
    print $hascache;
} else {
    @ob_start();
    if (!Session::has('theme')) {
        $theme = $app['settings']->getSetting("theme");
        if (!count($theme)) {
            $theme = 'svarog';
        } else {
            $theme = $theme->theme;
        }
    } else {
        $theme = Session::get('theme');
    }
    Rain\Tpl::configure(['base_url' => $baseurl . '/', 'tpl_dir' => $basepath . '/templates/' . $theme . '/', 'cache_dir' => $basepath . '/cachefiles/' . $theme . '/', 'cache_path' => 'cachefiles/' . $theme . '/', 'remove_comments' => false, 'debug' => false, 'path_replace' => false, 'auto_escape' => false]);
    $app['tpl_compress'] = $container->create('Rain\\Tpl\\Plugin\\Compress');
    Rain\Tpl::registerPlugin($app['tpl_compress']);
    $app['tpl'] = $container->create('Rain\\Tpl');
    $app['global']['templatepath'] = $baseurl . '/templates/' . $theme;
    $app['global']['cachekey_plain'] = $cachekey_plain;
    if (Session::has('fb_justregistered')) {
        $app['global']['facebook_promo'] = 1;
        Session::forget('fb_justregistered');
    }
    $pages = $app['page']->getPagesMenu($language);
    $global_settings = $app['settings']->getMultiSettings(array("tv_guide", "captchas", "listing_style", "adfly", "analytics", "seo_links", "facebook", "smart_bar", "smartbar_size", "smartbar_rows", "maxtvperpage", "maxmoviesperpage", "countdown_free", "countdown_user"), true);
    /* SEO links */
    if (!isset($global_settings['seo_links']) || !in_array($global_settings['seo_links'], array(0, 1))) {
        $global_settings['seo_links'] = 1;
    }
    if (!isset($global_settings['captchas']) || !$global_settings['captchas']) {
        $global_settings['captchas'] = false;