function content_5467bc02e6f7f7_87226601($_smarty_tpl) { $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); ?> test<?php }
function _display($output = '') { parent::_display($output); if (class_exists('CI_Controller') && class_exists('Smarty_Internal_Debug') && (config_item('smarty_debug') || $this->enable_profiler)) { $CI =& get_instance(); $smarty_debug = new Smarty_Internal_Debug(); $smarty_debug->display_debug($CI->ci_smarty); } }
public function _display($output = '') { parent::_display($output); // If Smarty is active - NOTE: $this->output->enable_profiler(TRUE) active Smarty debug to simplify if (class_exists('CI_Controller') && class_exists('Smarty_Internal_Debug') && (config_item('smarty_debug') || $this->enable_profiler)) { $CI =& get_instance(); Smarty_Internal_Debug::display_debug($CI->smarty); } }
/** * fetches a rendered Smarty template * * @param string $template the resource handle of the template file or template object * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $parent next higher level of Smarty variables * @param bool $display true: display, false: fetch * @param bool $merge_tpl_vars if true parent template variables merged in to local scope * @param bool $no_output_filter if true do not run output filter * @return string rendered template output */ public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if ($template === null && $this instanceof $this->template_class) { $template = $this; } if (!empty($cache_id) && is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } if ($parent === null && ($this instanceof Smarty || is_string($template))) { $parent = $this; } // create template object if necessary $_template = $template instanceof $this->template_class ? $template : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false); // if called by Smarty object make sure we use current caching status if ($this instanceof Smarty) { $_template->caching = $this->caching; } // merge all variable scopes into template if ($merge_tpl_vars) { // save local variables $save_tpl_vars = $_template->tpl_vars; $save_config_vars = $_template->config_vars; $ptr_array = array($_template); $ptr = $_template; while (isset($ptr->parent)) { $ptr_array[] = $ptr = $ptr->parent; } $ptr_array = array_reverse($ptr_array); $parent_ptr = reset($ptr_array); $tpl_vars = $parent_ptr->tpl_vars; $config_vars = $parent_ptr->config_vars; while ($parent_ptr = next($ptr_array)) { if (!empty($parent_ptr->tpl_vars)) { $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars); } if (!empty($parent_ptr->config_vars)) { $config_vars = array_merge($config_vars, $parent_ptr->config_vars); } } if (!empty(Smarty::$global_tpl_vars)) { $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars); } $_template->tpl_vars = $tpl_vars; $_template->config_vars = $config_vars; } // dummy local smarty variable if (!isset($_template->tpl_vars['smarty'])) { $_template->tpl_vars['smarty'] = new Smarty_Variable(); } if (isset($this->smarty->error_reporting)) { $_smarty_old_error_level = error_reporting($this->smarty->error_reporting); } // check URL debugging control if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) { if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) { // enable debugging for this browser session setcookie('SMARTY_DEBUG', true); $this->smarty->debugging = true; } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) { // disable debugging for this browser session setcookie('SMARTY_DEBUG', false); $this->smarty->debugging = false; } else { // enable debugging for this page $this->smarty->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { $this->smarty->debugging = true; } } } // must reset merge template date $_template->smarty->merged_templates_func = array(); // get rendered template // disable caching for evaluated code if ($_template->source->recompiled) { $_template->caching = false; } // checks if template exists if (!$_template->source->exists) { if ($_template->parent instanceof Smarty_Internal_Template) { $parent_resource = " in '{$_template->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); } // read from cache or render if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) { // render template (not loaded and not in cache) if (!$_template->source->uncompiled) { $_smarty_tpl = $_template; if ($_template->source->recompiled) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_compile($_template); } $code = $_template->compiler->compileTemplate($_template); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_compile($_template); } if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); eval("?>" . $code); unset($code); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { if (!$_template->compiled->exists || $_template->smarty->force_compile && !$_template->compiled->isCompiled) { $_template->compileTemplateSource(); } if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } if (!$_template->compiled->loaded) { include $_template->compiled->filepath; if ($_template->mustCompile) { // recompile and load again $_template->compileTemplateSource(); include $_template->compiled->filepath; } $_template->compiled->loaded = true; } else { $_template->decodeProperties($_template->compiled->_properties, false); } try { ob_start(); if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) { throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'"); } array_unshift($_template->_capture_stack, array()); // // render compiled template // $_template->properties['unifunc']($_template); // any unclosed {capture} tags ? if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); } catch (Exception $e) { ob_get_clean(); throw $e; } } } else { if ($_template->source->uncompiled) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); $_template->source->renderUncompiled($_template); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { throw new SmartyException("Resource '{$_template->source}->type' must have 'renderUncompiled' method"); } } $_output = ob_get_clean(); if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) { $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type); } if ($_template->parent instanceof Smarty_Internal_Template) { $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']); foreach ($_template->required_plugins as $code => $tmp1) { foreach ($tmp1 as $name => $tmp) { foreach ($tmp as $type => $data) { $_template->parent->required_plugins[$code][$name][$type] = $data; } } } } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($_template); } // write to cache when nessecary if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } $_template->properties['has_nocache_code'] = false; // get text between non-cached items $cache_split = preg_split("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output); // get non-cached items preg_match_all("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output, $cache_parts); $output = ''; // loop over items, stitch back together foreach ($cache_split as $curr_idx => $curr_split) { // escape PHP tags in template content $output .= preg_replace('/(<%|%>|<\\?php|<\\?|\\?>)/', '<?php echo \'$1\'; ?>', $curr_split); if (isset($cache_parts[0][$curr_idx])) { $_template->properties['has_nocache_code'] = true; // remove nocache tags from cache output $output .= preg_replace("!/\\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!", '', $cache_parts[0][$curr_idx]); } } if (!$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template); } // rendering (must be done before writing cache file because of {function} nocache handling) $_smarty_tpl = $_template; try { ob_start(); eval("?>" . $output); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } // write cache file content $_template->writeCachedContent($output); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } else { // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output); if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) { // replace nocache_hash $_output = preg_replace("/{$_template->properties['nocache_hash']}/", $_template->parent->properties['nocache_hash'], $_output); $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code; } } } else { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } try { ob_start(); array_unshift($_template->_capture_stack, array()); // // render cached template // $_template->properties['unifunc']($_template); // any unclosed {capture} tags ? if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } if ((!$this->caching || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template); } if (isset($this->error_reporting)) { error_reporting($_smarty_old_error_level); } // display or fetch if ($display) { if ($this->caching && $this->cache_modified_check) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) { switch (PHP_SAPI) { case 'cgi': // php-cgi < 5.3 // php-cgi < 5.3 case 'cgi-fcgi': // php-cgi >= 5.3 // php-cgi >= 5.3 case 'fpm-fcgi': // php-fpm >= 5.3.3 header('Status: 304 Not Modified'); break; case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified'; } break; default: header('HTTP/1.1 304 Not Modified'); break; } } else { switch (PHP_SAPI) { case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'; } break; default: header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'); break; } echo $_output; } } else { echo $_output; } // debug output if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($this); } if ($merge_tpl_vars) { // restore local variables $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } return; } else { if ($merge_tpl_vars) { // restore local variables $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } // return fetched content return $_output; } }
function content_5658c1ca58b0a9_07432000($_smarty_tpl) { $_smarty_tpl->properties['nocache_hash'] = '139795658c1ca453b72_59622192'; $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); echo $_smarty_tpl->getSubTemplate("head.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0); ?> <!--<nav> <ul> <?php $_from = $_smarty_tpl->tpl_vars['items']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['item']->_loop = false; foreach ($_from as $_smarty_tpl->tpl_vars['item']->value) { $_smarty_tpl->tpl_vars['item']->_loop = true; $foreach_item_Sav = $_smarty_tpl->tpl_vars['item']; ?> <li><a href="<?php echo $_smarty_tpl->tpl_vars['item']->value['lien']; ?> "><?php echo $_smarty_tpl->tpl_vars['item']->value['texte']; ?> </a></li> <?php $_smarty_tpl->tpl_vars['item'] = $foreach_item_Sav; } ?> </ul> </nav> --> <?php $_smarty_tpl->properties['nocache_hash'] = '139795658c1ca453b72_59622192'; ?> <form action="validation.php" method = "POST"> <p>Un seul vote par jour et par IP.</p> <label for="categorie">Catégorie du vote :</label> <select name="categorie" required> <option></option> <?php $_from = $_smarty_tpl->tpl_vars['categories']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['categorie'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['categorie']->_loop = false; foreach ($_from as $_smarty_tpl->tpl_vars['categorie']->value) { $_smarty_tpl->tpl_vars['categorie']->_loop = true; $foreach_categorie_Sav = $_smarty_tpl->tpl_vars['categorie']; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['categorie']->value; ?> "><?php echo $_smarty_tpl->tpl_vars['categorie']->value; ?> </option> <?php $_smarty_tpl->tpl_vars['categorie'] = $foreach_categorie_Sav; } ?> </select> <br /> <label for="positif" required>Vote :</label> <select name="positif"> <option></option> <?php $_from = $_smarty_tpl->tpl_vars['matieres']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['matiere'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['matiere']->_loop = false; foreach ($_from as $_smarty_tpl->tpl_vars['matiere']->value) { $_smarty_tpl->tpl_vars['matiere']->_loop = true; $foreach_matiere_Sav = $_smarty_tpl->tpl_vars['matiere']; ?> <optgroup label="<?php echo $_smarty_tpl->tpl_vars['matiere']->value; ?> "> <?php $_from = $_smarty_tpl->tpl_vars['profs']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['prof'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['prof']->_loop = false; foreach ($_from as $_smarty_tpl->tpl_vars['prof']->value) { $_smarty_tpl->tpl_vars['prof']->_loop = true; $foreach_prof_Sav = $_smarty_tpl->tpl_vars['prof']; ?> <?php ob_start(); echo $_smarty_tpl->tpl_vars['prof']->value['matiere']; $_tmp1 = ob_get_clean(); ob_start(); echo $_smarty_tpl->tpl_vars['matiere']->value; $_tmp2 = ob_get_clean(); if ($_tmp1 == $_tmp2) { ?> <option value="<?php echo $_smarty_tpl->tpl_vars['prof']->value['id']; ?> "><?php echo $_smarty_tpl->tpl_vars['prof']->value['nom']; ?> </option> <?php } ?> <?php $_smarty_tpl->tpl_vars['prof'] = $foreach_prof_Sav; } ?> </optgroup> <?php $_smarty_tpl->tpl_vars['matiere'] = $foreach_matiere_Sav; } ?> </select> <input type="submit" /> </form> <?php echo $_smarty_tpl->getSubTemplate("footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0); }
function content_55a67939f0d3f3_94272057($_smarty_tpl) { ?> <?php $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); ?> <!--<?php if (!function_exists('smarty_template_function_displayReservation')) { function smarty_template_function_displayReservation($_smarty_tpl, $params) { $saved_tpl_vars = $_smarty_tpl->tpl_vars; foreach ($_smarty_tpl->smarty->template_functions['displayReservation']['parameter'] as $key => $value) { $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value); } foreach ($params as $key => $value) { $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value); } ?> <tr class="reservation" > <td colspan="5"><?php echo ($tmp = @$_smarty_tpl->tpl_vars['reservation']->value->Title) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['DefaultTitle']->value : $tmp; ?> </td> </tr> <tr class="reservation" id="<?php echo $_smarty_tpl->tpl_vars['reservation']->value->ReferenceNumber; ?> "> <td style="min-width: 250px;"><?php echo ($tmp = @$_smarty_tpl->tpl_vars['reservation']->value->Title) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['DefaultTitle']->value : $tmp; ?> </td> <td style="min-width:150px;"><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['fullname'][0][0]->DisplayFullName(array('first' => $_smarty_tpl->tpl_vars['reservation']->value->FirstName, 'last' => $_smarty_tpl->tpl_vars['reservation']->value->LastName, 'ignorePrivacy' => $_smarty_tpl->tpl_vars['reservation']->value->IsUserOwner($_smarty_tpl->tpl_vars['UserId']->value)), $_smarty_tpl); ?> <?php if (!$_smarty_tpl->tpl_vars['reservation']->value->IsUserOwner($_smarty_tpl->tpl_vars['UserId']->value)) { echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['html_image'][0][0]->PrintImage(array('src' => "users.png", 'altKey' => 'Participant'), $_smarty_tpl); } ?> </td> <td width="200px"><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['formatdate'][0][0]->FormatDate(array('date' => $_smarty_tpl->tpl_vars['reservation']->value->StartDate->ToTimezone($_smarty_tpl->tpl_vars['Timezone']->value), 'key' => 'dashboard'), $_smarty_tpl); ?> </td> <td width="200px"><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['formatdate'][0][0]->FormatDate(array('date' => $_smarty_tpl->tpl_vars['reservation']->value->EndDate->ToTimezone($_smarty_tpl->tpl_vars['Timezone']->value), 'key' => 'dashboard'), $_smarty_tpl); ?> </td> <td style="min-width: 150px; max-width: 250px;"><?php echo $_smarty_tpl->tpl_vars['reservation']->value->ResourceName; ?> </td> </tr> <?php $_smarty_tpl->tpl_vars = $saved_tpl_vars; foreach (Smarty::$global_tpl_vars as $key => $value) { if (!isset($_smarty_tpl->tpl_vars[$key])) { $_smarty_tpl->tpl_vars[$key] = $value; } } } } ?> --> <?php if (!function_exists('smarty_template_function_displayReservation')) { function smarty_template_function_displayReservation($_smarty_tpl, $params) { $saved_tpl_vars = $_smarty_tpl->tpl_vars; foreach ($_smarty_tpl->smarty->template_functions['displayReservation']['parameter'] as $key => $value) { $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value); } foreach ($params as $key => $value) { $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value); } ?> <?php $_smarty_tpl->tpl_vars = $saved_tpl_vars; foreach (Smarty::$global_tpl_vars as $key => $value) { if (!isset($_smarty_tpl->tpl_vars[$key])) { $_smarty_tpl->tpl_vars[$key] = $value; } } } } ?> <div class="dashboard upcomingReservationsDashboard" id="upcomingReservationsDashboard"> <div class="dashboardHeader"> <a href="javascript:void(0);" title="<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['translate'][0][0]->SmartyTranslate(array('key' => 'ShowHide'), $_smarty_tpl); ?> "><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['translate'][0][0]->SmartyTranslate(array('key' => "UpcomingReservations"), $_smarty_tpl); ?> </a> (<?php echo $_smarty_tpl->tpl_vars['Total']->value; ?> ) </div> <div class="dashboardContents"> <?php if ($_smarty_tpl->tpl_vars['Total']->value > 0) { ?> <?php $_smarty_tpl->tpl_vars['reservation'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['reservation']->_loop = false; $_from = $_smarty_tpl->tpl_vars['newReservations']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['reservation']->key => $_smarty_tpl->tpl_vars['reservation']->value) { $_smarty_tpl->tpl_vars['reservation']->_loop = true; ?> <div id="event"> <div id="leftWrapper" class="left"> <div id="titleLeft"> <a href="#"><?php echo ($tmp = @$_smarty_tpl->tpl_vars['reservation']->value->Title) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['DefaultTitle']->value : $tmp; ?> </a> </div> <!--<div id="enterLink" class="right"><a href="#">Enter</a></div>--> <div><?php echo $_smarty_tpl->tpl_vars['reservation']->value->ResourceName; ?> </div> </div> <div class="reservationInfo" id="<?php echo $_smarty_tpl->tpl_vars['reservation']->value->ReferenceNumber; ?> " class="right"> <div style="display:inline"> <div id="hostName" class="left">Host:</div> <div><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['fullname'][0][0]->DisplayFullName(array('first' => $_smarty_tpl->tpl_vars['reservation']->value->FirstName, 'last' => $_smarty_tpl->tpl_vars['reservation']->value->LastName, 'ignorePrivacy' => $_smarty_tpl->tpl_vars['reservation']->value->IsUserOwner($_smarty_tpl->tpl_vars['UserId']->value)), $_smarty_tpl); ?> <?php if (!$_smarty_tpl->tpl_vars['reservation']->value->IsUserOwner($_smarty_tpl->tpl_vars['UserId']->value)) { echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['html_image'][0][0]->PrintImage(array('src' => "users.png", 'altKey' => 'Participant'), $_smarty_tpl); } ?> </div> </div> <div style="display:inline"> <div id="start" class="left">Start:</div> <div><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['formatdate'][0][0]->FormatDate(array('date' => $_smarty_tpl->tpl_vars['reservation']->value->StartDate->ToTimezone($_smarty_tpl->tpl_vars['Timezone']->value), 'key' => 'dashboard'), $_smarty_tpl); ?> </div> </div style="display:inline"> <div id="end" class="left">End:</div> <div><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['formatdate'][0][0]->FormatDate(array('date' => $_smarty_tpl->tpl_vars['reservation']->value->EndDate->ToTimezone($_smarty_tpl->tpl_vars['Timezone']->value), 'key' => 'dashboard'), $_smarty_tpl); ?> </div> </div> </div> </div> <?php } ?> <?php } else { ?> <div class="noresults"><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['translate'][0][0]->SmartyTranslate(array('key' => "NoUpcomingReservations"), $_smarty_tpl); ?> </div> <?php } ?> </div> </div><?php }
/** * fetches a rendered Smarty template * * @param string $template the resource handle of the template file or template object * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $ |null $parent next higher level of Smarty variables * @return string rendered template output */ public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false) { if (is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } if ($parent === null) { // get default Smarty data object $parent = $this; } array_push($this->block_data_stack, $this->block_data); $this->block_data = array(); // create template object if necessary $template instanceof $this->template_class ? $_template = $template : ($_template = $this->createTemplate($template, $cache_id, $compile_id, $parent)); $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) ? $this->error_reporting : error_reporting() & ~E_NOTICE); // obtain data for cache modified check if ($this->cache_modified_check && $this->caching && $display) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; if ($_isCached) { $_gmt_mtime = gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT'; } else { $_gmt_mtime = ''; } } // return redered template if (isset($this->autoload_filters['output']) || isset($this->registered_filters['output'])) { $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $this, $_template); } else { $_output = $_template->getRenderedTemplate(); } $_template->rendered_content = null; error_reporting($_smarty_old_error_level); // display or fetch if ($display) { if ($this->caching && $this->cache_modified_check) { $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); if ($_isCached && $_gmt_mtime == $_last_modified_date) { if (php_sapi_name() == 'cgi') { header('Status: 304 Not Modified'); } else { header('HTTP/1.1 304 Not Modified'); } } else { header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT'); echo $_output; } } else { echo $_output; } // debug output if ($this->debugging) { Smarty_Internal_Debug::display_debug($this); } $this->block_data = array_pop($this->block_data_stack); return; } else { // return fetched content $this->block_data = array_pop($this->block_data_stack); return $_output; } }
/** * fetches a rendered Smarty template * * @param string $template the resource handle of the template file or template object * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $parent next higher level of Smarty variables * @param bool $display true: display, false: fetch * @param bool $merge_tpl_vars if true parent template variables merged in to local scope * @param bool $no_output_filter if true do not run output filter * * @throws Exception * @throws SmartyException * @return string rendered template output */ public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if ($template === null && $this instanceof $this->template_class) { $template = $this; } if ($cache_id !== null && is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } if ($parent === null && ($this instanceof Smarty || is_string($template))) { $parent = $this; } // create template object if necessary $_template = $template instanceof $this->template_class ? $template : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false); // if called by Smarty object make sure we use current caching status if ($this instanceof Smarty) { $_template->caching = $this->caching; } // merge all variable scopes into template if ($merge_tpl_vars) { // save local variables $save_tpl_vars = $_template->tpl_vars; $save_config_vars = $_template->config_vars; $ptr_array = array($_template); $ptr = $_template; while (isset($ptr->parent)) { $ptr_array[] = $ptr = $ptr->parent; } $ptr_array = array_reverse($ptr_array); $parent_ptr = reset($ptr_array); $tpl_vars = $parent_ptr->tpl_vars; $config_vars = $parent_ptr->config_vars; while ($parent_ptr = next($ptr_array)) { if (!empty($parent_ptr->tpl_vars)) { $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars); } if (!empty($parent_ptr->config_vars)) { $config_vars = array_merge($config_vars, $parent_ptr->config_vars); } } if (!empty(Smarty::$global_tpl_vars)) { $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars); } $_template->tpl_vars = $tpl_vars; $_template->config_vars = $config_vars; } // dummy local smarty variable if (!isset($_template->tpl_vars['smarty'])) { $_template->tpl_vars['smarty'] = new Smarty_Variable(); } if (isset($this->smarty->error_reporting)) { $_smarty_old_error_level = error_reporting($this->smarty->error_reporting); } // check URL debugging control if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) { if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) { // enable debugging for this browser session setcookie('SMARTY_DEBUG', true); $this->smarty->debugging = true; } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) { // disable debugging for this browser session setcookie('SMARTY_DEBUG', false); $this->smarty->debugging = false; } else { // enable debugging for this page $this->smarty->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { $this->smarty->debugging = true; } } } // must reset merge template date $_template->smarty->merged_templates_func = array(); // get rendered template // disable caching for evaluated code if ($_template->source->recompiled) { $_template->caching = false; } // checks if template exists if (!$_template->source->exists) { if ($_template->parent instanceof Smarty_Internal_Template) { $parent_resource = " in '{$_template->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); } // read from cache or render if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) { // render template (not loaded and not in cache) if (!$_template->source->uncompiled) { /** @var Smarty_Internal_Template $_smarty_tpl * used in evaluated code */ $_smarty_tpl = $_template; if ($_template->source->recompiled) { $code = $_template->compiler->compileTemplate($_template); if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); /// dark edit \Dark\SmartyView\SmartyEngine::integrateViewComposers($_template); /// end edit eval("?>" . $code); unset($code); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { if (!$_template->compiled->exists || $_template->smarty->force_compile && !$_template->compiled->isCompiled) { $_template->compileTemplateSource(); $code = file_get_contents($_template->compiled->filepath); eval("?>" . $code); unset($code); $_template->compiled->loaded = true; $_template->compiled->isCompiled = true; } if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } if (!$_template->compiled->loaded) { include $_template->compiled->filepath; if ($_template->mustCompile) { // recompile and load again $_template->compileTemplateSource(); $code = file_get_contents($_template->compiled->filepath); eval("?>" . $code); unset($code); $_template->compiled->isCompiled = true; } $_template->compiled->loaded = true; } else { $_template->decodeProperties($_template->compiled->_properties, false); } try { ob_start(); if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) { throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'"); } array_unshift($_template->_capture_stack, array()); /// dark edit \Dark\SmartyView\SmartyEngine::integrateViewComposers($_template); /// end edit // // render compiled template // $_template->properties['unifunc']($_template); // any unclosed {capture} tags ? if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); } catch (Exception $e) { ob_get_clean(); throw $e; } } } else { if ($_template->source->uncompiled) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); /// dark edit \Dark\SmartyView\SmartyEngine::integrateViewComposers($_template); /// end edit $_template->source->renderUncompiled($_template); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { throw new SmartyException("Resource '{$_template->source}->type' must have 'renderUncompiled' method"); } } $_output = ob_get_clean(); if ($_template->template_resource == './_footer.html' && empty($_template->tpl_vars['navs']->value)) { $_output = preg_replace('/<a href="' . str_replace("/", "\\/", $_template->tpl_vars['site_url']->value) . '"( target="_blank")?( )?>首页<\\/a>( )?\\|([\\s]+)?(<br \\/>)?(<br>)?/is', "", $_output); $_output = preg_replace('/<a href="' . str_replace("/", "\\/", $_template->tpl_vars['site_url']->value) . '"( target="_blank")?( )?>Home<\\/a>( )?\\|([\\s]+)?(<br \\/>)?(<br>)?/is', "", $_output); } //===调用交互服务器接口文件中js,加载访问统计=== /** * 获取域名->获取ip * 根据IP和域名获取数据库信息(交互服务器上) * ->判断ip是否登录过 * */ // if ($_template->template_resource == './_footer.html') { // $postFun = new CommonController; // $domain = $_SERVER['HTTP_HOST'] ? 'http://' . $_SERVER['HTTP_HOST'] : ''; // $ip_address = ($_SERVER['REMOTE_ADDR']); // $today = date('Y-m-d'); //// $param['domain'] = $domain; //// $param['ip_address'] = $ip_address; // $flag = true; //// $stats_log_info = DB::table('stats_log')->where('ip_address', $ip_address)->where('pc_domain', $domain)->orWhere('mobile_domain', $domain)->first(); // $data = array( // 'pc_domain' => $domain, // 'mobile_domain' => $domain, // ); // $stats_log_info = $postFun->postsend("http://swap.5067.org/stats.php?key=get_stats_log",$data); //获取交互服务器上访问日志 // $stats_log_info= json_decode($stats_log_info); // if (empty($stats_log_info) || $stats_log_info == 'null') {//新增 //// echo '1---<br>'; // $data = array( // 'pc_domain' => $customer_info->pc_domain ? $customer_info->pc_domain : $domain, // 'mobile_domain' => $customer_info->mobile_domain ? $customer_info->mobile_domain : $domain, // ); //// $customer_info = DB::table('customer_info')->where('pc_domain', $domain)->orWhere('mobile_domain', $domain)->select('cus_id', 'pc_domain', 'mobile_domain')->first(); // $customer_info = $postFun->postsend("http://swap.5067.org/stats.php?key=get_customer_info", $data); //获取客户信息 // $customer_info = json_decode($customer_info); // $data = array( // 'pc_domain' => $customer_info->pc_domain ? $customer_info->pc_domain : $domain, // 'mobile_domain' => $customer_info->mobile_domain ? $customer_info->mobile_domain : $domain, // ); //// $stats_log_id = DB::table('stats_log')->insertGetId($data); // $stats_log_id = $postFun->postsend("http://swap.5067.org/stats.php?key=insert_stats_log", $data); //添加用户登录日志 // } else {//判断单日是否已经登录过 //// echo '2---<br>'; // if ($stats_log_info->lasttime != $today) {//不是当日更新为今天日期、并且计数+1 // $stats_log_id = $stats_log_info->id; // $data = array( // 'id' => $stats_log_id, // ); //// DB::table('stats_log')->where('id', $stats_log_info->id)->update($data); // $res = $postFun->postsend("http://swap.5067.org/stats.php?key=update_stats_log", $data); //更新用户登录日志 // } else {//当日已登录 // $flag = FALSE; //不做操作 // } // } // if (!$flag) { //// $stats_info = DB::table('stats')->where('cus_id', $customer_info->cus_id)->first(); // $data = array( // 'cus_id' => $customer_info->cus_id, // ); // $stats_info = $postFun->postsend("http://swap.5067.org/stats.php?key=get_stats", $data); //获取客户访问统计信息 // $stats_info = json_decode($stats_info); // if (empty($stats_info) || $stats_info == 'null') {//统计为空,新增数据 //// echo '2---1---<br>'; // $data3 = array( // 'cus_id' => $customer_info->cus_id, // 'pc_domain' => $customer_info->pc_domain ? $customer_info->pc_domain : $domain, // 'mobile_domain' => $customer_info->mobile_domain ? $customer_info->mobile_domain : $domain, // ); // $stats_id = $postFun->postsend("http://swap.5067.org/stats.php?key=insert_stats", $data3); //添加客户访问统计信息 // $data2 = array( // 'id' => $stats_id, // 'page_count_num' => 1, // 'page_today_num' => 1, // ); // } else {//统计不为空,累加数据 //// echo '2---2---<br>'; // $stats_id = $stats_info->id; // if ($stats_info->lasttime != $today) {//查看lasttime是否为今天,不是今天更新lasttime,并重新统计当日访问数 // $data2 = array( // 'id' => $stats_id, // 'page_count_num' => $stats_info->page_count_num + 1, // 'page_today_num' => 1, // 'lasttime' => 1 // ); // } else {//是当日,累加访问数 // $data2 = array( // 'id' => $stats_id, // 'page_count_num' => $stats_info->page_count_num + 1, // 'page_today_num' => $stats_info->page_today_num + 1 // ); // } // } // $resa = $postFun->postsend("http://swap.5067.org/stats.php?key=update_stats", $data2); //更新客户访问统计信息 // } // } if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) { $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type); } if ($_template->parent instanceof Smarty_Internal_Template) { $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']); foreach ($_template->required_plugins as $code => $tmp1) { foreach ($tmp1 as $name => $tmp) { foreach ($tmp as $type => $data) { $_template->parent->required_plugins[$code][$name][$type] = $data; } } } } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($_template); } // write to cache when nessecary if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } $_template->properties['has_nocache_code'] = false; // get text between non-cached items $cache_split = preg_split("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output); // get non-cached items preg_match_all("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output, $cache_parts); $output = ''; // loop over items, stitch back together foreach ($cache_split as $curr_idx => $curr_split) { // escape PHP tags in template content $output .= preg_replace('/(<%|%>|<\\?php|<\\?|\\?>)/', "<?php echo '\$1'; ?>\n", $curr_split); if (isset($cache_parts[0][$curr_idx])) { $_template->properties['has_nocache_code'] = true; // remove nocache tags from cache output $output .= preg_replace("!/\\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!", '', $cache_parts[0][$curr_idx]); } } if (!$no_output_filter && !$_template->has_nocache_code && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template); } // rendering (must be done before writing cache file because of {function} nocache handling) /** @var Smarty_Internal_Template $_smarty_tpl * used in evaluated code */ $_smarty_tpl = $_template; try { ob_start(); /// dark edit \Dark\SmartyView\SmartyEngine::integrateViewComposers($_template); /// end edit eval("?>" . $output); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } // write cache file content $_template->writeCachedContent($output); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } else { // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output); if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) { // replace nocache_hash $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output); $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code; } } } else { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } try { ob_start(); /// dark edit \Dark\SmartyView\SmartyEngine::integrateViewComposers($_template); /// end edit array_unshift($_template->_capture_stack, array()); // // render cached template // $_template->properties['unifunc']($_template); // any unclosed {capture} tags ? if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } if ((!$this->caching || $_template->has_nocache_code || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template); } if (isset($this->error_reporting)) { error_reporting($_smarty_old_error_level); } // display or fetch if ($display) { if ($this->caching && $this->cache_modified_check) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) { switch (PHP_SAPI) { case 'cgi': // php-cgi < 5.3 // php-cgi < 5.3 case 'cgi-fcgi': // php-cgi >= 5.3 // php-cgi >= 5.3 case 'fpm-fcgi': // php-fpm >= 5.3.3 header('Status: 304 Not Modified'); break; case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified'; } break; default: header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); break; } } else { switch (PHP_SAPI) { case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'; } break; default: header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'); break; } echo $_output; } } else { echo $_output; } // debug output if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($_template); } if ($merge_tpl_vars) { // restore local variables $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } return; } else { if ($merge_tpl_vars) { // restore local variables $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } // return fetched content return $_output; } }
/** * Same as flush() but with optional debugging. * @see Template::flush() */ function p() { $this->flush(); if ($this->smarty->debugging) { global $t2; $this->smarty->assign(array('AAAA_DEBUG_TOTAL_TIME__' => get_elapsed_time($t2, get_moment()))); Smarty_Internal_Debug::display_debug($this->smarty); } }
/** * displays a Smarty template * * @param string $ |object $template the resource handle of the template file or template object * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $parent next higher level of Smarty variables */ public function display($template, $cache_id = null, $compile_id = null, $parent = null) { // display template echo $this->fetch($template, $cache_id, $compile_id, $parent); // debug output if ($this->debugging) { Smarty_Internal_Debug::display_debug($this); } return true; }
/** * render template * * @param bool $display true: display, false: fetch * @param bool $isSubTemplate * @param bool $runOutputFilter * @param null|\Smarty_Internal_Context $_contextObjIn optional buffer object * * @return string * @throws \SmartyException */ public function render($display = false, $isSubTemplate = false, $runOutputFilter = true, Smarty_Internal_Context $_contextObjIn = null) { $level = ob_get_level(); try { if (!isset($this->source)) { $this->source = Smarty_Template_Source::load($this); } // checks if template exists if (!$this->source->exists) { if ($this->parent instanceof Smarty_Internal_Template) { $parent_resource = " in '{$this->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}"); } if ($this->smarty->debugging) { Smarty_Internal_Debug::start_template($this); } $this->context = $_contextObjIn === null ? new Smarty_Internal_Context() : $_contextObjIn; // merge all variable scopes into template if (!$isSubTemplate) { $savedErrorLevel = isset($this->smarty->error_reporting) ? error_reporting($this->smarty->error_reporting) : null; // save local variables $savedTplVars = $this->tpl_vars; $savedConfigVars = $this->config_vars; $ptr_array = array($this); $ptr = $this; while (isset($ptr->parent)) { $ptr_array[] = $ptr = $ptr->parent; } $ptr_array = array_reverse($ptr_array); $parent_ptr = reset($ptr_array); $tpl_vars = $parent_ptr->tpl_vars; $config_vars = $parent_ptr->config_vars; while ($parent_ptr = next($ptr_array)) { if (!empty($parent_ptr->tpl_vars)) { $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars); } if (!empty($parent_ptr->config_vars)) { $config_vars = array_merge($config_vars, $parent_ptr->config_vars); } } if (!empty(Smarty::$global_tpl_vars)) { $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars); } $this->tpl_vars = $tpl_vars; $this->config_vars = $config_vars; } else { $savedTplVars = null; $savedConfigVars = null; $savedErrorLevel = null; } // dummy local smarty variable if (!isset($this->tpl_vars['smarty'])) { $this->tpl_vars['smarty'] = new Smarty_Variable(); } // disable caching for evaluated code if ($this->source->recompiled) { $this->caching = false; } $_caching = $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED; // read from cache or render if ($_caching && !isset($this->cached)) { $this->cached = Smarty_Template_Cached::load($this); } if (!$_caching || !$this->cached->valid) { // render template (not loaded and not in cache) if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($this, null); } if (isset($this->cached)) { $_savedContext = $this->context; $this->context = new Smarty_Internal_Context(true); } if (!$this->source->uncompiled) { // render compiled code if (!isset($this->compiled)) { $this->compiled = Smarty_Template_Compiled::load($this); } $this->compiled->render($this); } else { $this->source->renderUncompiled($this); } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($this, null); } // write to cache when necessary if ($_caching && !$this->source->recompiled) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($this); } // write cache file content if ($runOutputFilter && !$this->context->hasNocacheCode && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $this->cached->writeCachedContent($this, $this->context, Smarty_Internal_Filter_Handler::runFilter('output', $this->context->getContent(), $this)); } else { $this->cached->writeCachedContent($this, $this->context); } $this->context = $_savedContext; $compile_check = $this->smarty->compile_check; $this->smarty->compile_check = false; if (!$this->cached->processed) { $this->cached->process($this); } $this->smarty->compile_check = $compile_check; $this->cached->compiledTplObj->getRenderedTemplateCode($this); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); } } } else { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($this); } $this->cached->render($this); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); } } if ($runOutputFilter && (!$this->caching || $this->context->hasNocacheCode || $this->source->recompiled) && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $this->context->flushBuffer(); $this->context->content = Smarty_Internal_Filter_Handler::runFilter('output', $this->context->content, $this); } // display or fetch if ($display) { $this->context->endBuffer(); if ($this->caching && $this->smarty->cache_modified_check) { $this->cached->cacheModifiedCheck($this, $this->context->content); } else { echo $this->context->content; } $this->context = null; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_template($this); } if ($display) { // debug output if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($this, true); } } if (!$isSubTemplate) { // restore local variables $this->tpl_vars = $savedTplVars; $this->config_vars = $savedConfigVars; if (isset($savedErrorLevel)) { error_reporting($savedErrorLevel); } } } catch (Exception $e) { while (ob_get_level() > $level) { ob_end_clean(); } throw $e; } if (!$display && $_contextObjIn === null) { // return fetched content $this->context->endBuffer(); $output = $this->context->content; $this->context = null; return $output; } $this->context = null; return ''; }
function content_562260dc87f239_09371670($_smarty_tpl) { if (!is_callable('smarty_function_counter')) { include 'D:\\Documents\\Desktop\\Code\\PSD1507\\9_Smarty\\day1017\\smarty\\plugins\\function.counter.php'; } if (!is_callable('smarty_function_cycle')) { include 'D:\\Documents\\Desktop\\Code\\PSD1507\\9_Smarty\\day1017\\smarty\\plugins\\function.cycle.php'; } if (!is_callable('smarty_function_html_image')) { include 'D:\\Documents\\Desktop\\Code\\PSD1507\\9_Smarty\\day1017\\smarty\\plugins\\function.html_image.php'; } $_config = new Smarty_Internal_Config('config.conf', $_smarty_tpl->smarty, $_smarty_tpl); $_config->loadConfigVars(null, 'local'); ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>test1</title> </head> <body> hello world3 <?php $_smarty_tpl->tpl_vars["name"] = new Smarty_variable("Lee", null, 0); ?> <?php echo $_smarty_tpl->tpl_vars['name']->value; ?> <?php echo $_smarty_tpl->tpl_vars['username']->value; ?> <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array('start' => 4, 'skip' => 2), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array('start' => 18), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array('print' => false), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array('direction' => 'down'), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <?php echo smarty_function_counter(array(), $_smarty_tpl); ?> | <!-- 交替循环 --> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <p style="background:<?php echo smarty_function_cycle(array('values' => 'red,green,blue,yellow'), $_smarty_tpl); ?> ;">1</p> <!-- <?php $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); ?> <?php echo smarty_function_html_image(array('file' => "http://www.baidu.com/images/logo.jpg", 'alt' => "百度", 'href' => "http://www.baidu.com"), $_smarty_tpl); ?> --> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->getConfigVariable('webname'), $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> <!----> </body> </html><?php }
function content_5592225f175194_79397738($_smarty_tpl) { $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <!-- <link rel="icon" href="../../favicon.ico"> --><title>我的课程</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/common.css" rel="stylesheet"> </head> <body> <?php echo $_smarty_tpl->getSubTemplate("header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('session_username' => $_smarty_tpl->tpl_vars['session_username']->value), 0); ?> <!-- <nav class="navbar navbar-fixed-top navbar-inverse"> <div class="container"> <div class="collapse navbar-collapse pull-left"> <ul class="nav navbar-nav"> <li><a href="#" class="active">首页</a></li> <li><a href="#">教学实验</a></li> <li><a href="#">科研合作</a></li> <li><a href="#">就业实习</a></li> <li><a href="#">关于我们</a></li> </ul> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav pull-right"> <div id="user"> <img src="img/user.png" class="user-img"> <div class="user-center hidden"> <ul> <li><a href="#">个人中心</a></li> <li><a href="#">退出</a></li> </ul> </div> </div> </ul> </div> </div> </nav> --> <div class="container"> <div class="row"> <ul class="breadcrumb"> <li><a href="#">个人中心</a> <span class="divider"></span></li> <li><a href="#">我的课程</a></li> </ul> </div> <div class="row"> <div class="col-xs-12 col-sm-9"> <!-- 课程详情导航条 --> <div class="row"> <div class="col-xs-12 horizon"> <ul class="nav navbar-nav" id="s-nav"> <li><a href="#s-part1" class="s-chosen">全部课程</a></li> <li><a href="#s-part2">公开课</a></li> <li><a href="#s-part3">校内课</a></li> </ul> </div> </div> <!-- 4部分内容 --> <!-- s-part1 --> <div> <div class="row" id="s-part1"> <?php $_smarty_tpl->tpl_vars['course'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['course']->_loop = false; $_from = $_smarty_tpl->tpl_vars['courses']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['course']->key => $_smarty_tpl->tpl_vars['course']->value) { $_smarty_tpl->tpl_vars['course']->_loop = true; ?> <div class="col-sm-5 col-md-3"> <div class="thumbnail"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><img src="img/subject.png" alt="课程"></a> <div class="caption"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><h3><?php echo $_smarty_tpl->tpl_vars['course']->value['name']; ?> </h3></a> <p><?php echo $_smarty_tpl->tpl_vars['course']->value['info']; ?> </p> <p><!-- <a href="#" class="btn btn-primary" role="开始学习">开始学习</a> --><a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> " class="btn btn-info" role="开始学习">开始学习</a></p> </div> </div> </div> <?php } ?> </div> <div class="row hidden" id="s-part2"> <?php $_smarty_tpl->tpl_vars['course'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['course']->_loop = false; $_from = $_smarty_tpl->tpl_vars['courses']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['course']->key => $_smarty_tpl->tpl_vars['course']->value) { $_smarty_tpl->tpl_vars['course']->_loop = true; ?> <?php if ($_smarty_tpl->tpl_vars['course']->value['type'] == '公开课') { ?> <div class="col-sm-5 col-md-3"> <div class="thumbnail"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><img src="img/subject.png" alt="课程"></a> <div class="caption"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><h3><?php echo $_smarty_tpl->tpl_vars['course']->value['name']; ?> </h3></a> <p><?php echo $_smarty_tpl->tpl_vars['course']->value['info']; ?> </p> <p><!-- <a href="#" class="btn btn-primary" role="开始学习">开始学习</a> --><a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> " class="btn btn-info" role="开始学习">开始学习</a></p> </div> </div> </div> <?php } ?> <?php } ?> </div> <div class="row hidden" id="s-part3"> <?php $_smarty_tpl->tpl_vars['course'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['course']->_loop = false; $_from = $_smarty_tpl->tpl_vars['courses']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['course']->key => $_smarty_tpl->tpl_vars['course']->value) { $_smarty_tpl->tpl_vars['course']->_loop = true; ?> <?php if ($_smarty_tpl->tpl_vars['course']->value['type'] == '计划内') { ?> <div class="col-sm-5 col-md-3"> <div class="thumbnail"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><img src="img/subject.png" alt="课程"></a> <div class="caption"> <a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> "><h3><?php echo $_smarty_tpl->tpl_vars['course']->value['name']; ?> </h3></a> <p><?php echo $_smarty_tpl->tpl_vars['course']->value['info']; ?> </p> <p><!-- <a href="#" class="btn btn-primary" role="开始学习">开始学习</a> --><a href="course_info.php?course_id=<?php echo $_smarty_tpl->tpl_vars['course']->value['id']; ?> " class="btn btn-info" role="开始学习">开始学习</a></p> </div> </div> </div> <?php } ?> <?php } ?> </div> </div> </div> <!-- 右侧推送 --> <?php echo $_smarty_tpl->getSubTemplate("majorpush.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('courses_new_list' => $_smarty_tpl->tpl_vars['courses_new_list']->value, 'internships_new_list' => $_smarty_tpl->tpl_vars['internships_new_list']->value), 0); ?> <!-- <div class="col-xs-6 col-sm-3 pull-right" style="padding: 10px; margin-top: -10px;"> <dl> <dt>最新课程</dt> <dd>javascript高级程序设计</dd> <dd>javascript高级程序设计</dd> <dd>javascript高级程序设计</dd> <dd>javascript高级程序设计</dd> <dd>javascript高级程序设计</dd> <dd>HTML5秘籍</dd> </dl> <dl> <dt>最新实习</dt> <dd>百度前端实习</dd> <dd>百度前端实习</dd> <dd>百度前端实习</dd> <dd>百度前端实习</dd> <dd>百度前端实习</dd> <dd>百度前端实习</dd> <dd>百度前端实习</dd> </dl> </div> </div> </div> --> <?php echo $_smarty_tpl->getSubTemplate("footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0); ?> <!-- <div class="footer"> <div class="footer-text"> <p> <span>关于我们</span> <span>诚征英才</span> <span>联系我们</span> <span>服务协议</span> <span>京ICP备15011063号</span> </p> <p> Copyright 2015 GPX All Rights Reserved 极派客公司 版权所有 </p> </div> </div> --> <?php echo '<script'; ?> src="js/jquery-1.11.1.js"><?php echo '</script'; ?> > <?php echo '<script'; ?> src="js/bootstrap.min.js"><?php echo '</script'; ?> > <?php echo '<script'; ?> src="js/common.js"><?php echo '</script'; ?> > </body> </html> <?php }
public function smarty($file, $vars = array(), $testing = false) { global $bp, $ci, $page; $debug = !$testing && is_admin(2) && $ci->session->enable_profiler ? true : false; if ($debug) { $memory = memory_get_usage(); $start = microtime(true); $time = $start - $ci->benchmark->marker['total_execution_time_start']; } static $smarty = null; if (is_null($smarty)) { $functions = array('preg_replace', 'number_format', 'implode', 'explode', 'array_keys', 'array_values', 'array_flip', 'array_reverse', 'array_shift', 'array_unshift', 'array_pop', 'array_push', 'array_combine', 'array_merge'); if ($testing || $this->controller == '#post#') { $functions = array_merge(array('is_user', 'is_admin', 'in_group'), $functions); } $smarty = $page->plugin('Smarty', 'class'); $smarty->setCompileDir($smarty->getCompileDir() . $page->get('domain')); $smarty->assign(array('bp' => new BootstrapClone($bp), 'page' => new PageClone($page, $this->controller == '#post#' ? 'post' : 'blog'))); $security = new Smarty_Security($smarty); $security->php_functions = array_merge(array('isset', 'empty', 'count', 'in_array', 'is_array', 'time', 'nl2br'), $functions); // Smarty defaults $security->allow_super_globals = false; $security->allow_constants = false; $smarty->enableSecurity($security); } unset($vars['bp'], $vars['page']); $vars['blog'] = $this->blog; $smarty->assign($vars); $smarty->setTemplateDir(dirname($file) . '/'); try { $html = $smarty->fetch(basename($file)); if ($debug) { $smarty->loadPlugin('Smarty_Internal_Debug'); $debug = Smarty_Internal_Debug::display_debug($smarty); if (!is_callable('smarty_modifier_debug_print_var')) { include SMARTY_PLUGINS_DIR . 'modifier.debug_print_var.php'; } foreach ($debug['vars'] as $key => $obj) { if (strtolower($obj->scope) == 'global') { unset($debug['vars'][$key]); } else { $debug['vars'][$key] = smarty_modifier_debug_print_var($obj->value, 0, 80); } } $page->save('Smarty', array('memory' => $memory, 'file' => $file, 'start' => $time, 'time' => microtime(true) - $start, 'vars' => $debug['vars'])); } if (!empty($vars)) { $smarty->clearAssign(array_keys($vars)); } } catch (Exception $e) { $error = $e->getMessage(); if ($testing) { return htmlspecialchars_decode($error); } $html = '<p>' . $error . '</p>'; } return $testing ? true : $html; }
/** * render template * * @param bool $merge_tpl_vars if true parent template variables merged in to local scope * @param bool $no_output_filter if true do not run output filter * @param bool $display true: display, false: fetch null: subtemplate * * @throws Exception * @throws SmartyException * @return string rendered template output */ public function render($merge_tpl_vars = false, $no_output_filter = true, $display = null) { $parentIsTpl = $this->parent instanceof Smarty_Internal_Template; if ($this->smarty->debugging) { Smarty_Internal_Debug::start_template($this, $display); } $save_tpl_vars = null; $save_config_vars = null; // merge all variable scopes into template if ($merge_tpl_vars) { // save local variables $save_tpl_vars = $this->tpl_vars; $save_config_vars = $this->config_vars; $ptr_array = [$this]; $ptr = $this; while (isset($ptr->parent)) { $ptr_array[] = $ptr = $ptr->parent; } $ptr_array = array_reverse($ptr_array); $parent_ptr = reset($ptr_array); $tpl_vars = $parent_ptr->tpl_vars; $config_vars = $parent_ptr->config_vars; while ($parent_ptr = next($ptr_array)) { if (!empty($parent_ptr->tpl_vars)) { $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars); } if (!empty($parent_ptr->config_vars)) { $config_vars = array_merge($config_vars, $parent_ptr->config_vars); } } if (!empty(Smarty::$global_tpl_vars)) { $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars); } $this->tpl_vars = $tpl_vars; $this->config_vars = $config_vars; } // dummy local smarty variable if (!isset($this->tpl_vars['smarty'])) { $this->tpl_vars['smarty'] = new Smarty_Variable(); } $_smarty_old_error_level = isset($this->smarty->error_reporting) ? error_reporting($this->smarty->error_reporting) : null; // check URL debugging control if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { Smarty_Internal_Debug::debugUrl($this); } if (!isset($this->source)) { $this->loadSource(); } // checks if template exists if (!$this->source->exists) { if ($parentIsTpl) { $parent_resource = " in '{$this->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}"); } // disable caching for evaluated code if ($this->source->recompiled) { $this->caching = false; } // read from cache or render $isCacheTpl = $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED; if ($isCacheTpl) { if (!isset($this->cached)) { $this->loadCached(); } $this->cached->isCached($this); } if (!$isCacheTpl || !$this->cached->valid) { if ($isCacheTpl) { $this->properties['tpl_function'] = []; } // render template (not loaded and not in cache) if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($this); } if (!$this->source->uncompiled) { // render compiled code if (!isset($this->compiled)) { $this->loadCompiled(); } $content = $this->compiled->render($this); } else { $content = $this->source->renderUncompiled($this); } if (!$this->source->recompiled && empty($this->properties['file_dependency'][$this->source->uid])) { $this->properties['file_dependency'][$this->source->uid] = [$this->source->filepath, $this->source->timestamp, $this->source->type]; } if ($parentIsTpl) { $this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']); //$this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']); } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($this); } // write to cache when necessary if (!$this->source->recompiled && $isCacheTpl) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($this); } $this->cached->updateCache($this, $content, $no_output_filter); $compile_check = $this->smarty->compile_check; $this->smarty->compile_check = false; if ($parentIsTpl) { $this->properties['tpl_function'] = $this->parent->properties['tpl_function']; } if (!$this->cached->processed) { $this->cached->process($this); } $this->smarty->compile_check = $compile_check; $content = $this->getRenderedTemplateCode(); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); } } else { if (!empty($this->properties['nocache_hash']) && !empty($this->parent->properties['nocache_hash'])) { // replace nocache_hash $content = str_replace("{$this->properties['nocache_hash']}", $this->parent->properties['nocache_hash'], $content); $this->parent->has_nocache_code = $this->parent->has_nocache_code || $this->has_nocache_code; } } } else { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($this); } $content = $this->cached->render($this); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); } } if ((!$this->caching || $this->has_nocache_code || $this->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $content = Smarty_Internal_Filter_Handler::runFilter('output', $content, $this); } if (isset($_smarty_old_error_level)) { error_reporting($_smarty_old_error_level); } // display or fetch if ($display) { if ($this->caching && $this->smarty->cache_modified_check) { $this->cached->cacheModifiedCheck($this, $content); } else { echo $content; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_template($this); } // debug output if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($this, true); } if ($merge_tpl_vars) { // restore local variables $this->tpl_vars = $save_tpl_vars; $this->config_vars = $save_config_vars; } return ''; } else { if ($merge_tpl_vars) { // restore local variables $this->tpl_vars = $save_tpl_vars; $this->config_vars = $save_config_vars; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_template($this); } if ($this->smarty->debugging == 2 and $display === false) { if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($this, true); } } if ($parentIsTpl) { $this->parent->properties['tpl_function'] = array_merge($this->parent->properties['tpl_function'], $this->properties['tpl_function']); foreach ($this->required_plugins as $code => $tmp1) { foreach ($tmp1 as $name => $tmp) { foreach ($tmp as $type => $data) { $this->parent->required_plugins[$code][$name][$type] = $data; } } } } // return cache content return $content; } }
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if ($template === null && $this instanceof $this->template_class) { $template = $this; } if ($cache_id !== null && is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } if ($parent === null && ($this instanceof Smarty || is_string($template))) { $parent = $this; } $_template = $template instanceof $this->template_class ? $template : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false); if ($this instanceof Smarty) { $_template->caching = $this->caching; } if ($merge_tpl_vars) { $save_tpl_vars = $_template->tpl_vars; $save_config_vars = $_template->config_vars; $ptr_array = array($_template); $ptr = $_template; while (isset($ptr->parent)) { $ptr_array[] = $ptr = $ptr->parent; } $ptr_array = array_reverse($ptr_array); $parent_ptr = reset($ptr_array); $tpl_vars = $parent_ptr->tpl_vars; $config_vars = $parent_ptr->config_vars; while ($parent_ptr = next($ptr_array)) { if (!empty($parent_ptr->tpl_vars)) { $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars); } if (!empty($parent_ptr->config_vars)) { $config_vars = array_merge($config_vars, $parent_ptr->config_vars); } } if (!empty(Smarty::$global_tpl_vars)) { $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars); } $_template->tpl_vars = $tpl_vars; $_template->config_vars = $config_vars; } if (!isset($_template->tpl_vars['smarty'])) { $_template->tpl_vars['smarty'] = new Smarty_Variable(); } if (isset($this->smarty->error_reporting)) { $_smarty_old_error_level = error_reporting($this->smarty->error_reporting); } if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) { if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) { setcookie('SMARTY_DEBUG', true); $this->smarty->debugging = true; } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) { setcookie('SMARTY_DEBUG', false); $this->smarty->debugging = false; } else { $this->smarty->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { $this->smarty->debugging = true; } } } $_template->smarty->merged_templates_func = array(); if ($_template->source->recompiled) { $_template->caching = false; } if (!$_template->source->exists) { if ($_template->parent instanceof Smarty_Internal_Template) { $parent_resource = " in '{$_template->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); } if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) { if (!$_template->source->uncompiled) { $_smarty_tpl = $_template; if ($_template->source->recompiled) { $code = $_template->compiler->compileTemplate($_template); if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); eval('?>' . $code); unset($code); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { if (!$_template->compiled->exists || $_template->smarty->force_compile && !$_template->compiled->isCompiled) { $_template->compileTemplateSource(); $code = file_get_contents($_template->compiled->filepath); eval('?>' . $code); unset($code); $_template->compiled->loaded = true; $_template->compiled->isCompiled = true; } if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } if (!$_template->compiled->loaded) { include $_template->compiled->filepath; if ($_template->mustCompile) { $_template->compileTemplateSource(); $code = file_get_contents($_template->compiled->filepath); eval('?>' . $code); unset($code); $_template->compiled->isCompiled = true; } $_template->compiled->loaded = true; } else { $_template->decodeProperties($_template->compiled->_properties, false); } try { ob_start(); if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) { throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'"); } array_unshift($_template->_capture_stack, array()); $_template->properties['unifunc']($_template); if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); } catch (Exception $e) { ob_get_clean(); throw $e; } } } else { if ($_template->source->uncompiled) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_render($_template); } try { ob_start(); $_template->source->renderUncompiled($_template); } catch (Exception $e) { ob_get_clean(); throw $e; } } else { throw new SmartyException("Resource '{$_template->source}->type' must have 'renderUncompiled' method"); } } $_output = ob_get_clean(); if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) { $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type); } if ($_template->parent instanceof Smarty_Internal_Template) { $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']); foreach ($_template->required_plugins as $code => $tmp1) { foreach ($tmp1 as $name => $tmp) { foreach ($tmp as $type => $data) { $_template->parent->required_plugins[$code][$name][$type] = $data; } } } } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($_template); } if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } $_template->properties['has_nocache_code'] = false; $cache_split = preg_split("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output); preg_match_all("!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s", $_output, $cache_parts); $output = ''; foreach ($cache_split as $curr_idx => $curr_split) { $output .= preg_replace('/(<%|%>|<\\?php|<\\?|\\?>)/', "<?php echo '\$1'; ?>\n", $curr_split); if (isset($cache_parts[0][$curr_idx])) { $_template->properties['has_nocache_code'] = true; $output .= preg_replace("!/\\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!", '', $cache_parts[0][$curr_idx]); } } if (!$no_output_filter && !$_template->has_nocache_code && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template); } $_smarty_tpl = $_template; try { ob_start(); eval('?>' . $output); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } $_template->writeCachedContent($output); if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } else { if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) { $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash'], $_output); $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code; } } } else { if ($this->smarty->debugging) { Smarty_Internal_Debug::start_cache($_template); } try { ob_start(); array_unshift($_template->_capture_stack, array()); $_template->properties['unifunc']($_template); if (isset($_template->_capture_stack[0][0])) { $_template->capture_error(); } array_shift($_template->_capture_stack); $_output = ob_get_clean(); } catch (Exception $e) { ob_get_clean(); throw $e; } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($_template); } } if ((!$this->caching || $_template->has_nocache_code || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) { $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template); } if (isset($this->error_reporting)) { error_reporting($_smarty_old_error_level); } if ($display) { if ($this->caching && $this->cache_modified_check) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) { switch (PHP_SAPI) { case 'cgi': case 'cgi-fcgi': case 'fpm-fcgi': header('Status: 304 Not Modified'); break; case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified'; } break; default: header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); break; } } else { switch (PHP_SAPI) { case 'cli': if (!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])) { $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'; } break; default: header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT'); break; } echo $_output; } } else { echo $_output; } if ($this->smarty->debugging) { Smarty_Internal_Debug::display_debug($_template); } if ($merge_tpl_vars) { $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } return; } else { if ($merge_tpl_vars) { $_template->tpl_vars = $save_tpl_vars; $_template->config_vars = $save_config_vars; } return $_output; } }
/** * fetches a rendered Smarty template * * @param string $template the resource handle of the template file or template object * @param mixed $cache_id cache id to be used with this template * @param mixed $compile_id compile id to be used with this template * @param object $ |null $parent next higher level of Smarty variables * @return string rendered template output */ public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false) { if (!empty($cache_id) && is_object($cache_id)) { $parent = $cache_id; $cache_id = null; } if ($parent === null) { // get default Smarty data object $parent = $this; } // create template object if necessary $template instanceof $this->template_class ? $_template = $template : ($_template = $this->createTemplate($template, $cache_id, $compile_id, $parent, false)); if (isset($this->error_reporting)) { $_smarty_old_error_level = error_reporting($this->error_reporting); } // check URL debugging control if (!$this->debugging && $this->debugging_ctrl == 'URL') { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } if (false !== strpos($_query_string, $this->smarty_debug_id)) { if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) { // enable debugging for this browser session setcookie('SMARTY_DEBUG', true); $this->debugging = true; } elseif (false !== strpos($_query_string, $this->smarty_debug_id . '=off')) { // disable debugging for this browser session setcookie('SMARTY_DEBUG', false); $this->debugging = false; } else { // enable debugging for this page $this->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { $this->debugging = true; } } } // obtain data for cache modified check if ($this->cache_modified_check && $this->caching && $display) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; if ($_isCached) { $_gmt_mtime = gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT'; } else { $_gmt_mtime = ''; } } // return rendered template if ((!$this->caching || $_template->resource_object->isEvaluated) && (isset($this->autoload_filters['output']) || isset($this->registered_filters['output']))) { $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $_template); } else { $_output = $_template->getRenderedTemplate(); } $_template->rendered_content = null; if (isset($this->error_reporting)) { error_reporting($_smarty_old_error_level); } // display or fetch if ($display) { if ($this->caching && $this->cache_modified_check) { $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); if ($_isCached && $_gmt_mtime == $_last_modified_date) { if (php_sapi_name() == 'cgi') { header('Status: 304 Not Modified'); } else { header('HTTP/1.1 304 Not Modified'); } } else { header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->getCachedTimestamp()) . ' GMT'); echo $_output; } } else { echo $_output; } // debug output if ($this->debugging) { Smarty_Internal_Debug::display_debug($this); } return; } else { // return fetched content return $_output; } }
function content_562254f4e13313_32136400($_smarty_tpl) { $_config = new Smarty_Internal_Config('config.conf', $_smarty_tpl->smarty, $_smarty_tpl); $_config->loadConfigVars(null, 'local'); ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>test1</title> </head> <body> hello world2 <?php echo $_smarty_tpl->tpl_vars['name']->value; ?> <?php echo $_smarty_tpl->tpl_vars['title']->value; ?> <?php echo $_smarty_tpl->tpl_vars['array']->value[0]; ?> <?php echo $_smarty_tpl->tpl_vars['array']->value[1]; ?> <?php echo $_smarty_tpl->tpl_vars['array1']->value['baidu']; ?> <?php echo $_smarty_tpl->tpl_vars['array1']->value['alibaba']; ?> <?php echo $_smarty_tpl->tpl_vars['array2']->value[0][1]; ?> <?php echo $_smarty_tpl->tpl_vars['array2']->value[1][1]; ?> <?php echo $_smarty_tpl->tpl_vars['array2']->value[2][0]; ?> <?php echo $_smarty_tpl->tpl_vars['array3']->value['qihu'][0]; ?> <?php echo $_smarty_tpl->tpl_vars['array3']->value['alibaba'][1]; ?> 传递的一个类,方法一样也是调用其中的方法和属性 <?php echo $_smarty_tpl->tpl_vars['computer']->value->name; ?> <?php echo $_smarty_tpl->tpl_vars['computer']->value->run(); ?> 模板进行运算 <?php echo $_smarty_tpl->tpl_vars['x']->value + $_smarty_tpl->tpl_vars['y']->value; ?> 使用配置文件中的键值对 <?php echo $_smarty_tpl->getConfigVariable('webname'); ?> <?php echo $_smarty_tpl->getConfigVariable('weburl'); ?> <?php echo $_GET['id']; ?> <?php echo $_GET['name']; ?> <?php echo $_SERVER['REMOTE_ADDR']; ?> <?php echo $_SERVER['HTTP_HOST']; ?> <?php echo @constant('PI'); ?> <?php echo time(); ?> <?php $_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug($_smarty_tpl); ?> </body> </html><?php }