/** * Render a list page * * @param string $page_title * The page title (displayed in the top bar) * * @param array|null $album_stats * The album stats, if this is a list of songs from an album * * @param array $list_items * The list of items to display * * @return string * The HTML of the rendered page */ public static function render($page_title, $previous, $shuffle, $allsongs, $list) { // instantiate the template engine $parser = new Rain\Tpl(); // assign the values to the template parser $parser->assign(array('page_title' => $page_title, 'list' => $list, 'previous' => $previous, 'shuffle' => $shuffle, 'all_songs' => $allsongs, 'now_playing' => Music::isPlayingOrPaused(), 'album_stats' => $album_stats, 'include_all_songs' => $include_all_songs, 'base_uri' => static::$base_uri, 'object_type' => $type)); // return the HTML return $parser->draw("list-page", true); }
/** * Render a list page * * @param Song $song * The song that is currently playing * * @return string * The HTML of the rendered page */ public static function render($song, $previous) { // instantiate the template engine $parser = new Rain\Tpl(); // get the image data for the song $image_data = Song::getImageData($song['Artist'], $song['Album'], 320); // assign the values to the template parser $parser->assign(array('image' => $image_data, 'song' => $song, 'volume' => Music::getVolume(), 'previous' => $previous)); // return the HTML return $parser->draw("now-playing-page", true); }
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); }
<?php require_once "config.php"; require_once "Rain/tpl.php"; $link = base64_decode($_REQUEST["video"]); $tpl = new Rain\Tpl(); $tpl->configure(array('production' => PRODUCTION)); $tpl->assign("title", $link); $tpl->draw("play"); unset($tpl);
<?php // bootstrap configuration // initialize the template folder Rain\Tpl::configure('tpl_dir', Config::get('app.template-path')); Rain\Tpl::configure('tpl_ext', 'tpl'); Rain\Tpl::configure('cache_dir', Config::get('app.template-cache-path'));
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;
<?php require_once "config.php"; require_once "Rain/tpl.php"; $cat = isset($_REQUEST["cat"]) ? $_REQUEST["cat"] : "Category_1"; $tpl = new Rain\Tpl(); $tpl->configure(array('production' => PRODUCTION)); $tpl->assign("cat", $cat); $tpl->assign("cat_list", $video_cat_list); $tpl->draw("videos/views/view_all"); unset($tpl);