/** * Process theliaModule template inclusion function * * This function accepts two parameters: * * - location : this is the location in the admin template. Example: folder-edit'. The function will search for * AdminIncludes/<location>.html file, and fetch it as a Smarty template. * - countvar : this is the name of a template variable where the number of found modules includes will be assigned. * * @param array $params * @param \Smarty_Internal_Template $template * @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty * * @return string */ public function theliaModule($params, \Smarty_Internal_Template $template) { $content = null; $count = 0; if (false !== ($location = $this->getParam($params, 'location', false))) { if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) { echo sprintf('<div style="background-color: #C82D26; color: #fff; border-color: #000000; border: solid;">%s</div>', $location); } $moduleLimit = $this->getParam($params, 'module', null); $modules = ModuleQuery::getActivated(); /** @var \Thelia\Model\Module $module */ foreach ($modules as $module) { if (null !== $moduleLimit && $moduleLimit != $module->getCode()) { continue; } $file = $module->getAbsoluteAdminIncludesPath() . DS . $location . '.html'; if (file_exists($file)) { $output = trim(file_get_contents($file)); if (!empty($output)) { $content .= $output; $count++; } } } } if (false !== ($countvarname = $this->getParam($params, 'countvar', false))) { $template->assign($countvarname, $count); } if (!empty($content)) { return $template->fetch(sprintf("string:%s", $content)); } return ""; }
/** * Plugin for Smarty * * @param array $aParams * @param Smarty_Internal_Template $oSmartyTemplate * * @return string|null */ function smarty_function_widget_template($aParams, $oSmartyTemplate) { if (!isset($aParams['name'])) { trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING); return null; } $sWidgetName = $aParams['name']; $aWidgetParams = isset($aParams['params']) ? $aParams['params'] : array(); $oEngine = Engine::getInstance(); // Проверяем делигирование $sTemplate = E::ModulePlugin()->GetDelegate('template', $sWidgetName); if ($sTemplate) { if ($aWidgetParams) { foreach ($aWidgetParams as $sKey => $sVal) { $oSmartyTemplate->assign($sKey, $sVal); } if (!isset($aWidgetParams['params'])) { /* LS-compatible */ $oSmartyTemplate->assign('params', $aWidgetParams); } $oSmartyTemplate->assign('aWidgetParams', $aWidgetParams); } $sResult = $oSmartyTemplate->fetch($sTemplate); } else { $sResult = null; } return $sResult; }
/** * Close list table and submit button */ public function displayListFooter() { if (!isset($this->list_id)) { $this->list_id = $this->table; } $this->footer_tpl->assign(array_merge($this->tpl_vars, array('current' => $this->currentIndex, 'list_id' => $this->list_id))); return $this->footer_tpl->fetch(); }
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if ($this->source->type == 'extends') { $templates = explode('|', $this->source->name); // foreach($templates as $thisTemplate) // echo "\nexternal template = {$thisTemplate}<br>\n"; } return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter); }
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if (!is_null($template)) { $tpl = $template->template_resource; } else { $tpl = $this->template_resource; } return "\n<!-- begin {$tpl} -->\n" . parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter) . "\n<!-- end {$tpl} -->\n"; }
/** * Language forms * * @package application.helper.smarty * @author Integry Systems * * @package application.helper.smarty */ function smarty_block_language($params, $content, Smarty_Internal_Template $smarty, &$repeat) { //$smarty = $smarty->smarty; $app = $smarty->smarty->getApplication(); if (!$app->getLanguageSetArray()) { return false; } if ($repeat) { $app->languageBlock = $app->getLanguageSetArray(); $smarty->assign('languageBlock', $app->languageBlock); $smarty->assign('lang', array_shift($app->languageBlock)); $app->langHeadDisplayed = false; $user = SessionUser::getUser(); foreach ($app->getLanguageSetArray() as $lang) { $userPref = $user->getPreference('tab_lang_' . $lang['ID']); $isHidden = is_null($userPref) ? !empty($params['hidden']) : $userPref == 'false'; $classNames[$lang['ID']] = $isHidden ? 'hidden' : ''; } $app->langClassNames = $classNames; } else { if (!trim($content)) { $repeat = false; return false; } if ($app->languageBlock) { $repeat = true; } $contentLang = $smarty->getTemplateVars('lang'); $content = '<tab class="lang_' . $contentLang['ID'] . '" heading="' . $contentLang['originalName'] . '">' . $content . '</tab>'; if (!$app->langHeadDisplayed) { $smarty->assign('classNames', $app->langClassNames); $content = $smarty->fetch('block/backend/langFormHead.tpl') . $content; $app->langHeadDisplayed = true; } $smarty->assign('lang', array_shift($app->languageBlock)); // form footer if (!$repeat) { $content .= $smarty->fetch('block/backend/langFormFoot.tpl'); } return $content; } }
/** * Paginate layout printing function. * * @param array $params Specified params. * @param Smarty_Internal_Template $template Instance of Smarty template class. * * @uses Core\Config() * * @return string Rendered pagination template. */ function smarty_function_pagination(array $params, Smarty_Internal_Template $template) { $viewsPaths = Core\Config()->paths('views'); $params['range'] = isset($params['range']) ? abs($params['range']) : 2; $_path_to_templates = $viewsPaths['templates'] . '_shared' . DIRECTORY_SEPARATOR; $_template = isset($params['template']) ? $_path_to_templates . $params['template'] . '.html.tpl' : null; $params['template'] = file_exists($_template) ? $_template : $_path_to_templates . 'pagination' . DIRECTORY_SEPARATOR . 'default.html.tpl'; $paginator = $params['paginator']; $pages_range = $paginator->range($params['range']); $range = array(); $range['start'] = isset($pages_range['first']->pageNumber) ? $pages_range['first']->pageNumber : 0; $range['end'] = isset($pages_range['last']->pageNumber) ? $pages_range['last']->pageNumber : 0; $template->assign('pagination', array('current' => $paginator->current(), 'first' => $paginator->first(), 'last' => $paginator->last(), 'prev' => $paginator->prev(), 'next' => $paginator->next(), 'boundaries' => isset($params['boundaries']) ? !!$params['boundaries'] : false, 'range' => $params['range'], 'pages' => range($range['start'], $range['end']))); return $template->fetch($params['template']); }
function content_52ccccc197c241_31222556($_smarty_tpl) { ?> <table class="ow_automargin ow_std_margin"> <tr> <td style="text-align: right;"> <span style="font-size: 9px;line-height:9px;">advertisement</span> <div style="text-align: center;"><?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['code']->value, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </div> </td> </tr> </table> <?php }
/** * Generates pagination block * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_paginate($params, Smarty_Internal_Template $smarty) { $interval = 2; if (isset($params['interval'])) { $interval = $params['interval']; } // determine which page numbers will be displayed $count = ceil($params['count'] / $params['perPage']); $pages = range(max(1, $params['current'] - $interval), min($count, $params['current'] + $interval)); if (array_search(1, $pages) === false) { array_unshift($pages, 1); } if (array_search($count, $pages) === false) { $pages[] = $count; } // check for any 1-page sized interval breaks $pr = 0; foreach ($pages as $k) { if ($k - 2 == $pr) { $pages[] = $k - 1; } $pr = $k; } sort($pages); // generate output $out = array(); $application = $smarty->getApplication(); // get variable to replace - _page_ if defined, otherwise 0 $replace = strpos($params['url'], '_000_') ? '_000_' : 0; $render = array(); if ($params['current'] > 1) { $urls['previous'] = str_replace($replace, $params['current'] - 1, $params['url']); } foreach ($pages as $k) { $urls[$k] = str_replace($replace, $k, $params['url']); } if ($params['current'] < $count) { $urls['next'] = str_replace($replace, $params['current'] + 1, $params['url']); } $smarty->assign('urls', $urls); $smarty->assign('pages', $pages); $smarty->assign('current', $params['current']); return $smarty->fetch($smarty->getApplication()->getRenderer()->getTemplatePath('block/box/paginate.tpl')); return implode(' ', $out); }
} /** * Start logging of render time * * @param object $template */ public static function start_render($template) { $key = self::get_key($template); self::$template_data[$key]['start_time'] = microtime(true); } /** * End logging of compile time * * @param object $template */ public static function end_render($template) { $key = self::get_key($template); self::$template_data[$key]['render_time'] += microtime(true) - self::$template_data[$key]['start_time']; } /** * Start logging of cache time * * @param object $template cached template */ public static function start_cache($template) { $key = self::get_key($template); self::$template_data[$key]['start_time'] = microtime(true); } /** * End logging of cache time * * @param object $template cached template */ public static function end_cache($template) { $key = self::get_key($template); self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];
function content_51f3c0072b99d5_49193744($_smarty_tpl) { echo $_smarty_tpl->tpl_vars['fb_form_header']->value; ?> <?php if ($_smarty_tpl->tpl_vars['fb_form_done']->value == 1) { ?> <?php if (isset($_smarty_tpl->tpl_vars['fb_submission_error']->value) && $_smarty_tpl->tpl_vars['fb_submission_error']->value) { ?> <div class="error_message"><?php echo $_smarty_tpl->tpl_vars['fb_submission_error']->value; ?> </div> <?php if (isset($_smarty_tpl->tpl_vars['fb_show_submission_errors']->value) && $_smarty_tpl->tpl_vars['fb_show_submission_errors']->value) { ?> <div class="error"> <ul> <?php $_smarty_tpl->tpl_vars['thisErr'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['thisErr']->_loop = false; $_from = $_smarty_tpl->tpl_vars['fb_submission_error_list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['thisErr']->key => $_smarty_tpl->tpl_vars['thisErr']->value) { $_smarty_tpl->tpl_vars['thisErr']->_loop = true; ?> <li><?php echo $_smarty_tpl->tpl_vars['thisErr']->value; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php } } else { ?> <?php if (isset($_smarty_tpl->tpl_vars['fb_form_has_validation_errors']->value) && $_smarty_tpl->tpl_vars['fb_form_has_validation_errors']->value) { ?> <div class="error_message"> <ul> <?php $_smarty_tpl->tpl_vars['thisErr'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['thisErr']->_loop = false; $_from = $_smarty_tpl->tpl_vars['fb_form_validation_errors']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['thisErr']->key => $_smarty_tpl->tpl_vars['thisErr']->value) { $_smarty_tpl->tpl_vars['thisErr']->_loop = true; ?> <li><?php echo $_smarty_tpl->tpl_vars['thisErr']->value; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['captcha_error']->value) && $_smarty_tpl->tpl_vars['captcha_error']->value) { ?> <div class="error_message"><?php echo $_smarty_tpl->tpl_vars['captcha_error']->value; ?> </div> <?php } ?> <?php echo $_smarty_tpl->tpl_vars['fb_form_start']->value; ?> <div><?php echo $_smarty_tpl->tpl_vars['fb_hidden']->value; ?> </div> <div<?php if ($_smarty_tpl->tpl_vars['css_class']->value != '') { ?> class="<?php echo $_smarty_tpl->tpl_vars['css_class']->value; ?> "<?php } ?> > <?php if ($_smarty_tpl->tpl_vars['total_pages']->value > 1) { ?> <span><?php echo $_smarty_tpl->tpl_vars['title_page_x_of_y']->value; ?> </span><?php } ?> <?php $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['entry']->_loop = false; $_from = $_smarty_tpl->tpl_vars['fields']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) { $_smarty_tpl->tpl_vars['entry']->_loop = true; ?> <?php if ($_smarty_tpl->tpl_vars['entry']->value->display == 1) { ?> <?php if ($_smarty_tpl->tpl_vars['entry']->value->needs_div == 1) { ?> <div<?php if ($_smarty_tpl->tpl_vars['entry']->value->required == 1 || $_smarty_tpl->tpl_vars['entry']->value->css_class != '' || $_smarty_tpl->tpl_vars['entry']->value->valid == 0) { ?> class="<?php if ($_smarty_tpl->tpl_vars['entry']->value->required == 1) { ?> required<?php } if ($_smarty_tpl->tpl_vars['entry']->value->css_class != '') { ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->css_class; } if ($_smarty_tpl->tpl_vars['entry']->value->valid == 0) { ?> fb_invalid<?php } ?> "<?php } ?> ><?php } if ($_smarty_tpl->tpl_vars['entry']->value->hide_name == 0) { ?> <label<?php if ($_smarty_tpl->tpl_vars['entry']->value->multiple_parts != 1) { ?> for="<?php echo $_smarty_tpl->tpl_vars['entry']->value->input_id; ?> "<?php } ?> ><?php echo $_smarty_tpl->tpl_vars['entry']->value->name; if ($_smarty_tpl->tpl_vars['entry']->value->required_symbol != '') { echo $_smarty_tpl->tpl_vars['entry']->value->required_symbol; } ?> </label><br /><?php } if ($_smarty_tpl->tpl_vars['entry']->value->multiple_parts == 1) { if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop'])) { unset($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']); } $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['name'] = 'numloop'; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['loop'] = is_array($_loop = $_smarty_tpl->tpl_vars['entry']->value->input) ? count($_loop) : max(0, (int) $_loop); unset($_loop); $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['show'] = true; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['loop']; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['step'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['loop'] - 1; if ($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['show']) { $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['loop']; if ($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['total'] == 0) { $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['show'] = false; } } else { $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['total'] = 0; } if ($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['show']) { for ($_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['total']; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration']++) { $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration']; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['step']; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['step']; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['first'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration'] == 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['last'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['numloop']['total']; if ($_smarty_tpl->tpl_vars['entry']->value->label_parts == 1) { ?> <div><?php echo $_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty')->value['section']['numloop']['index']]->input; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty')->value['section']['numloop']['index']]->name; ?> </div><?php } else { echo $_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty')->value['section']['numloop']['index']]->input; } if (isset($_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty', null, true, false)->value['section']['numloop']['index']]->op) && $_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty')->value['section']['numloop']['index']]->op) { echo $_smarty_tpl->tpl_vars['entry']->value->input[$_smarty_tpl->getVariable('smarty')->value['section']['numloop']['index']]->op; } } } } else { if ($_smarty_tpl->tpl_vars['entry']->value->smarty_eval == '1') { $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->input, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); } else { echo $_smarty_tpl->tpl_vars['entry']->value->input; } } if ($_smarty_tpl->tpl_vars['entry']->value->valid == 0) { ?> <--- <?php echo $_smarty_tpl->tpl_vars['entry']->value->error; } if ($_smarty_tpl->tpl_vars['entry']->value->needs_div == 1) { ?> </div><?php } ?> <?php } ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['has_captcha']->value == 1) { ?> <div class="captcha"><?php echo $_smarty_tpl->tpl_vars['graphic_captcha']->value; echo $_smarty_tpl->tpl_vars['title_captcha']->value; ?> <br /><?php echo $_smarty_tpl->tpl_vars['input_captcha']->value; ?> </div> <?php } ?> <div class="submit"><?php echo $_smarty_tpl->tpl_vars['prev']->value; echo $_smarty_tpl->tpl_vars['submit']->value; ?> </div> </div> <?php echo $_smarty_tpl->tpl_vars['fb_form_end']->value; ?> <?php } echo $_smarty_tpl->tpl_vars['fb_form_footer']->value; }
/** * Draw Pager * * @param $id * @param $visualPagesCount * @param $exclude * @param $additionalParams * @param $linkClass * @return string */ function smarty_function_draw_pager($params, Smarty_Internal_Template &$smarty) { $id = null; $visualPagesCount = null; $excludedGetsArray = array(); extract($params); if (empty($visualPagesCount)) { $visualPagesCount = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->defaultVisualPagesCount; } if (empty($id)) { $id = null; } if (isset($exclude) and !empty($exclude)) { $excludedGetsArray = explode(",", str_replace(" ", "", $exclude)); } $pager = Pager::getPager($id); if ($pager instanceof Pager) { if (isset($baseLink) and !empty($baseLink)) { // Remove heading slash if present $link = ltrim($baseLink, "/"); $link = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link); } else { $link = getCurrentUrl(array_merge(array($pager->getUrlParam()), $excludedGetsArray)); } if (isset($additionalParams) and !empty($additionalParams)) { RewriteURL::ensureLastSlash($additionalParams); $urlParam = $additionalParams . $pager->getUrlParam(); } else { $urlParam = $pager->getUrlParam(); } $currentPageNumber = $pager->getCurrentPageNumber(); $pagesCount = $pager->getTotalPagesCount(); if ($pagesCount > 1) { $pageNumStart = $currentPageNumber - floor($visualPagesCount / 2); if ($pageNumStart < 1) { $pageNumStart = 1; } $pageNumEnd = $pageNumStart + $visualPagesCount - 1; if ($pageNumEnd > $pagesCount) { $pageNumEnd = $pagesCount; $pageNumStart = $pageNumEnd - $visualPagesCount + 1; if ($pageNumStart < 1) { $pageNumStart = 1; } } if ($pageNumStart > 1) { $pagerFirstPageLink = $link . $urlParam . ':1'; $smarty->assign('pagerFirstPageLink', $pagerFirstPageLink); } if ($pageNumEnd < $pagesCount) { $pagerLastPageLink = $link . $urlParam . ':' . $pagesCount; $smarty->assign('pagerLastPageLink', $pagerLastPageLink); } if ($currentPageNumber > 1) { $prevPageLink = $link . $urlParam . ':' . ($currentPageNumber - 1); $smarty->assign('pagerPreviousPageLink', $prevPageLink); } $pagerNumbersArray = array(); for ($pgNum = $pageNumStart; $pgNum <= $pageNumEnd; $pgNum++) { $isCurrent = false; if ($pgNum == $currentPageNumber) { $isCurrent = true; } $pageLink = $link . $urlParam . ':' . $pgNum; array_push($pagerNumbersArray, array("pageNum" => $pgNum, "pageLink" => $pageLink, "isCurrent" => $isCurrent)); } if ($currentPageNumber < $pagesCount) { $nextPageLink = $link . $urlParam . ':' . ($currentPageNumber + 1); $smarty->assign('pagerNextPageLink', $nextPageLink); } if (isset($linkClass) and !empty($linkClass)) { $smarty->assign("linkClass", $linkClass); } $smarty->assign("pagerPageNumStart", $pageNumStart); $smarty->assign("pagerPageNumEnd", $pageNumEnd); $smarty->assign("pagerCurrentPageNumber", $currentPageNumber); $smarty->assign("pagerTotalPagesCount", $pagesCount); $smarty->assign("pagerNumbersArray", $pagerNumbersArray); } if (isset($tplChunkFile)) { $pagerChunkFileName = $tplChunkFile; } else { $pagerChunkFileName = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->pagerChunkFileName; } return $smarty->fetch($smarty->getChunkPath($pagerChunkFileName)); } }
function content_51f3ccbeb469c8_36382916($_smarty_tpl) { if (!is_callable('smarty_modifier_cms_escape')) { include '/homepages/26/d480780604/htdocs/plugins/modifier.cms_escape.php'; } if (!is_callable('smarty_cms_modifier_cms_date_format')) { include '/homepages/26/d480780604/htdocs/plugins/modifier.cms_date_format.php'; } if (isset($_smarty_tpl->tpl_vars['entry']->value->canonical)) { ?> <?php if (isset($_smarty_tpl->tpl_vars['canonical'])) { $_smarty_tpl->tpl_vars['canonical'] = clone $_smarty_tpl->tpl_vars['canonical']; $_smarty_tpl->tpl_vars['canonical']->value = $_smarty_tpl->tpl_vars['entry']->value->canonical; $_smarty_tpl->tpl_vars['canonical']->nocache = null; $_smarty_tpl->tpl_vars['canonical']->scope = 0; } else { $_smarty_tpl->tpl_vars['canonical'] = new Smarty_variable($_smarty_tpl->tpl_vars['entry']->value->canonical, null, 0); } } ?> <h2><?php echo smarty_modifier_cms_escape($_smarty_tpl->tpl_vars['entry']->value->title, 'htmlall'); ?> </h2> <?php if ($_smarty_tpl->tpl_vars['entry']->value->summary) { ?> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->summary, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); } ?> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->content, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); if ($_smarty_tpl->tpl_vars['entry']->value->extra) { ?> <?php echo $_smarty_tpl->tpl_vars['extra_label']->value; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->extra; ?> <?php } if ($_smarty_tpl->tpl_vars['return_url']->value != '') { ?> <br /> <span class='back'>← <?php echo $_smarty_tpl->tpl_vars['return_url']->value; if ($_smarty_tpl->tpl_vars['category_name']->value != '') { ?> - <?php echo $_smarty_tpl->tpl_vars['category_link']->value; } ?> </span> <?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['entry']->value->fields)) { ?> <?php $_smarty_tpl->tpl_vars['field'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['field']->_loop = false; $_from = $_smarty_tpl->tpl_vars['entry']->value->fields; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['field']->key => $_smarty_tpl->tpl_vars['field']->value) { $_smarty_tpl->tpl_vars['field']->_loop = true; ?> <div> <?php if ($_smarty_tpl->tpl_vars['field']->value->type == 'file') { ?> <img src='<?php echo $_smarty_tpl->tpl_vars['entry']->value->file_location; ?> /<?php echo $_smarty_tpl->tpl_vars['field']->value->value; ?> ' alt='' /> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['field']->value->name; ?> : <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['field']->value->value, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> <?php } ?> </div> <?php } } ?> <footer class='news-meta'> <?php if ($_smarty_tpl->tpl_vars['entry']->value->postdate) { ?> <?php echo smarty_cms_modifier_cms_date_format($_smarty_tpl->tpl_vars['entry']->value->postdate); ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['entry']->value->category) { ?> <strong><?php echo $_smarty_tpl->tpl_vars['category_label']->value; ?> </strong> <?php echo $_smarty_tpl->tpl_vars['entry']->value->category; ?> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['entry']->value->author) { ?> <strong><?php echo $_smarty_tpl->tpl_vars['author_label']->value; ?> </strong> <?php echo $_smarty_tpl->tpl_vars['entry']->value->author; ?> <?php } ?> </footer><?php }
function content_56b3277d479a84_47767512($_smarty_tpl) { if (!is_callable('smarty_function_repeat')) { include 'C:\\xampp\\htdocs\\projects\\usse\\plugins\\function.repeat.php'; } if (!is_callable('smarty_modifier_cms_date_format')) { include 'C:\\xampp\\htdocs\\projects\\usse\\plugins\\modifier.cms_date_format.php'; } if (!is_callable('smarty_modifier_cms_escape')) { include 'C:\\xampp\\htdocs\\projects\\usse\\plugins\\modifier.cms_escape.php'; } ?> <!-- Start News Display Template --> <ul class="list1"> <?php $_smarty_tpl->tpl_vars['node'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['node']->_loop = false; $_from = $_smarty_tpl->tpl_vars['cats']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['node']->key => $_smarty_tpl->tpl_vars['node']->value) { $_smarty_tpl->tpl_vars['node']->_loop = true; if ($_smarty_tpl->tpl_vars['node']->value['depth'] > $_smarty_tpl->tpl_vars['node']->value['prevdepth']) { echo smarty_function_repeat(array('string' => "<ul>", 'times' => $_smarty_tpl->tpl_vars['node']->value['depth'] - $_smarty_tpl->tpl_vars['node']->value['prevdepth']), $_smarty_tpl); ?> <?php } elseif ($_smarty_tpl->tpl_vars['node']->value['depth'] < $_smarty_tpl->tpl_vars['node']->value['prevdepth']) { echo smarty_function_repeat(array('string' => "</li></ul>", 'times' => $_smarty_tpl->tpl_vars['node']->value['prevdepth'] - $_smarty_tpl->tpl_vars['node']->value['depth']), $_smarty_tpl); ?> </li> <?php } elseif ($_smarty_tpl->tpl_vars['node']->value['index'] > 0) { ?> </li> <?php } ?> <li<?php if ($_smarty_tpl->tpl_vars['node']->value['index'] == 0) { ?> class="firstnewscat"<?php } ?> > <?php if ($_smarty_tpl->tpl_vars['node']->value['count'] > 0) { ?> <a href="<?php echo $_smarty_tpl->tpl_vars['node']->value['url']; ?> "><?php echo $_smarty_tpl->tpl_vars['node']->value['news_category_name']; ?> </a><?php } else { ?> <span><?php echo $_smarty_tpl->tpl_vars['node']->value['news_category_name']; ?> </span><?php } } echo smarty_function_repeat(array('string' => "</li></ul>", 'times' => $_smarty_tpl->tpl_vars['node']->value['depth'] - 1), $_smarty_tpl); ?> </li> </ul> <?php if ($_smarty_tpl->tpl_vars['category_name']->value) { ?> <h1><?php echo $_smarty_tpl->tpl_vars['category_name']->value; ?> </h1> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['pagecount']->value > 1) { ?> <p> <?php if ($_smarty_tpl->tpl_vars['pagenumber']->value > 1) { echo $_smarty_tpl->tpl_vars['firstpage']->value; ?> <?php echo $_smarty_tpl->tpl_vars['prevpage']->value; ?> <?php } echo $_smarty_tpl->tpl_vars['pagetext']->value; ?> <?php echo $_smarty_tpl->tpl_vars['pagenumber']->value; ?> <?php echo $_smarty_tpl->tpl_vars['oftext']->value; ?> <?php echo $_smarty_tpl->tpl_vars['pagecount']->value; ?> <?php if ($_smarty_tpl->tpl_vars['pagenumber']->value < $_smarty_tpl->tpl_vars['pagecount']->value) { ?> <?php echo $_smarty_tpl->tpl_vars['nextpage']->value; ?> <?php echo $_smarty_tpl->tpl_vars['lastpage']->value; ?> <?php } ?> </p> <?php } $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['entry']->_loop = false; $_from = $_smarty_tpl->tpl_vars['items']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) { $_smarty_tpl->tpl_vars['entry']->_loop = true; ?> <div class="NewsSummary"> <?php if ($_smarty_tpl->tpl_vars['entry']->value->postdate) { ?> <div class="NewsSummaryPostdate"> <?php echo smarty_modifier_cms_date_format($_smarty_tpl->tpl_vars['entry']->value->postdate); ?> </div> <?php } ?> <div class="NewsSummaryLink"> <a href="<?php echo $_smarty_tpl->tpl_vars['entry']->value->moreurl; ?> " title="<?php echo smarty_modifier_cms_escape($_smarty_tpl->tpl_vars['entry']->value->title, 'htmlall'); ?> "><?php echo smarty_modifier_cms_escape($_smarty_tpl->tpl_vars['entry']->value->title); ?> </a> </div> <div class="NewsSummaryCategory"> <?php echo $_smarty_tpl->tpl_vars['category_label']->value; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->category; ?> </div> <?php if ($_smarty_tpl->tpl_vars['entry']->value->author) { ?> <div class="NewsSummaryAuthor"> <?php echo $_smarty_tpl->tpl_vars['author_label']->value; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->author; ?> </div> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['entry']->value->summary) { ?> <div class="NewsSummarySummary"> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->summary, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </div> <div class="NewsSummaryMorelink"> [<?php echo $_smarty_tpl->tpl_vars['entry']->value->morelink; ?> ] </div> <?php } elseif ($_smarty_tpl->tpl_vars['entry']->value->content) { ?> <div class="NewsSummaryContent"> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->content, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </div> <?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['entry']->value->extra)) { ?> <div class="NewsSummaryExtra"> <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['entry']->value->extra, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </div> <?php } if (isset($_smarty_tpl->tpl_vars['entry']->value->fields)) { ?> <?php $_smarty_tpl->tpl_vars['field'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['field']->_loop = false; $_from = $_smarty_tpl->tpl_vars['entry']->value->fields; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['field']->key => $_smarty_tpl->tpl_vars['field']->value) { $_smarty_tpl->tpl_vars['field']->_loop = true; ?> <div class="NewsSummaryField"> <?php if ($_smarty_tpl->tpl_vars['field']->value->type == 'file') { ?> <img src="<?php echo $_smarty_tpl->tpl_vars['entry']->value->file_location; ?> /<?php echo $_smarty_tpl->tpl_vars['field']->value->value; ?> "/> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['field']->value->name; ?> : <?php $_template = new Smarty_Internal_Template('eval:' . $_smarty_tpl->tpl_vars['field']->value->value, $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> <?php } ?> </div> <?php } } ?> </div> <?php } ?> <!-- End News Display Template --> <?php }
public static function ia_blocks(array $params, Smarty_Internal_Template &$smarty) { if (!isset($params['block'])) { return ''; } $directCall = isset($params[self::DIRECT_CALL_MARKER]); $position = $params['block']; // return immediately if position's content is already rendered if (!$directCall && isset(self::$_positionsContent[$position])) { // NULL will be an empty content marker return is_null(self::$_positionsContent[$position]) ? '' : self::$_positionsContent[$position]; } // mark that we were here self::$_positionsContent[$position] = null; $iaView = iaCore::instance()->iaView; $blocks = $iaView->blocks; $blocks = isset($blocks[$position]) ? $blocks[$position] : null; if ($blocks || $iaView->manageMode) { // define if this position should be movable in visual mode $smarty->assign('position', $position); $smarty->assign('blocks', $blocks); $output = $smarty->fetch('render-blocks' . iaView::TEMPLATE_FILENAME_EXT, $position . mt_rand(1000, 9999)); if (trim($output)) { self::$_positionsContent[$position] = $output; } } return $directCall ? null : self::$_positionsContent[$position]; }
/** * Opens a window for the Smarty Debugging Console and display the data * * @param Smarty_Internal_Template|Smarty $obj object to debug * @param bool $full */ public static function display_debug($obj, $full = false) { if (!$full) { self::$offset++; $savedIndex = self::$index; self::$index = 9999; } // prepare information of assigned variables $ptr = self::get_debug_vars($obj); if ($obj instanceof Smarty) { $smarty = clone $obj; } else { $smarty = clone $obj->smarty; } $debugging = $smarty->debugging; $_assigned_vars = $ptr->tpl_vars; ksort($_assigned_vars); $_config_vars = $ptr->config_vars; ksort($_config_vars); $smarty->registered_filters = array(); $smarty->autoload_filters = array(); $smarty->default_modifiers = array(); $smarty->force_compile = false; $smarty->left_delimiter = '{'; $smarty->right_delimiter = '}'; $smarty->debugging = false; $smarty->debugging_ctrl = 'NONE'; $smarty->force_compile = false; $_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty); $_template->caching = false; $_template->smarty->disableSecurity(); $_template->cache_id = null; $_template->compile_id = null; if ($obj instanceof Smarty_Internal_Template) { $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); } if ($obj instanceof Smarty || $full) { $_template->assign('template_data', self::$template_data[self::$index]); } else { $_template->assign('template_data', null); } $_template->assign('assigned_vars', $_assigned_vars); $_template->assign('config_vars', $_config_vars); $_template->assign('execution_time', microtime(true) - $smarty->start_time); $_template->assign('display_mode', $debugging == 2 || !$full); $_template->assign('offset', self::$offset * 50); echo $_template->fetch(); if (isset($full)) { self::$index--; } if (!$full) { self::$index = $savedIndex; } }
function content_51f3bfcf7fdbd2_55275424($_smarty_tpl) { if (!is_callable('smarty_function_repeat')) { include '/homepages/26/d480780604/htdocs/plugins/function.repeat.php'; } if (!is_callable('smarty_modifier_cms_escape')) { include '/homepages/26/d480780604/htdocs/plugins/modifier.cms_escape.php'; } if (!is_callable('smarty_modifier_date_format')) { include '/homepages/26/d480780604/htdocs/lib/smarty/plugins/modifier.date_format.php'; } ?> <!-- .news-summary wrapper --><article class='news-summary'><ul class='category-list cf'><?php $_smarty_tpl->tpl_vars['node'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['node']->_loop = false; $_from = $_smarty_tpl->tpl_vars['cats']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['node']->key => $_smarty_tpl->tpl_vars['node']->value) { $_smarty_tpl->tpl_vars['node']->_loop = true; if ($_smarty_tpl->tpl_vars['node']->value['depth'] > $_smarty_tpl->tpl_vars['node']->value['prevdepth']) { echo smarty_function_repeat(array('string' => '<ul>', 'times' => $_smarty_tpl->tpl_vars['node']->value['depth'] - $_smarty_tpl->tpl_vars['node']->value['prevdepth']), $_smarty_tpl); } elseif ($_smarty_tpl->tpl_vars['node']->value['depth'] < $_smarty_tpl->tpl_vars['node']->value['prevdepth']) { echo smarty_function_repeat(array('string' => '</li></ul>', 'times' => $_smarty_tpl->tpl_vars['node']->value['prevdepth'] - $_smarty_tpl->tpl_vars['node']->value['depth']), $_smarty_tpl); ?> </li><?php } elseif ($_smarty_tpl->tpl_vars['node']->value['index'] > 0) { ?> </li><?php } ?> <li<?php if ($_smarty_tpl->tpl_vars['node']->value['index'] == 0) { ?> class='first'<?php } ?> ><?php if ($_smarty_tpl->tpl_vars['node']->value['count'] > 0) { ?> <a href='<?php echo $_smarty_tpl->tpl_vars['node']->value['url']; ?> '><?php echo $_smarty_tpl->tpl_vars['node']->value['news_category_name']; ?> </a><?php } else { ?> <span><?php echo $_smarty_tpl->tpl_vars['node']->value['news_category_name']; ?> </span><?php } } echo smarty_function_repeat(array('string' => '</li></ul>', 'times' => $_smarty_tpl->tpl_vars['node']->value['depth'] - 1), $_smarty_tpl); ?> </li></ul><?php $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['entry']->_loop = false; $_from = $_smarty_tpl->tpl_vars['items']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) { $_smarty_tpl->tpl_vars['entry']->_loop = true; ?> <!-- .news-article (wrapping each article) --><section class='news-article'><header><h2><a href='<?php echo $_smarty_tpl->tpl_vars['entry']->value->moreurl; ?> ' title='<?php echo smarty_modifier_cms_escape($_smarty_tpl->tpl_vars['entry']->value->title, 'htmlall'); ?> '><?php echo smarty_modifier_cms_escape($_smarty_tpl->tpl_vars['entry']->value->title); ?> </a></h2><div class='meta cf'><time class='date' datetime='<?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['entry']->value->postdate, '%Y-%m-%d'); ?> '><span class='day'> <?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['entry']->value->postdate, '%d'); ?> </span><span class='month'> <?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['entry']->value->postdate, '%b'); ?> </span></time><span class='author'> <?php echo $_smarty_tpl->tpl_vars['author_label']->value; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->author; ?> </span><span class='category'> <?php echo $_smarty_tpl->tpl_vars['category_label']->value; ?> <?php echo $_smarty_tpl->tpl_vars['entry']->value->category; ?> </span></div></header><?php if ($_smarty_tpl->tpl_vars['entry']->value->summary) { ?> <p><?php $_template = new Smarty_Internal_Template('eval:' . preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['entry']->value->summary), $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </p><span class='more'><?php echo $_smarty_tpl->tpl_vars['entry']->value->morelink; ?> →</span><?php } elseif ($_smarty_tpl->tpl_vars['entry']->value->content) { ?> <p><?php $_template = new Smarty_Internal_Template('eval:' . preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['entry']->value->content), $_smarty_tpl->smarty, $_smarty_tpl); echo $_template->fetch(); ?> </p><?php } ?> </section><!-- .news-article //--><?php } ?> <!-- news pagination --><?php if ($_smarty_tpl->tpl_vars['pagecount']->value > 1) { ?> <span class='paginate'><?php if ($_smarty_tpl->tpl_vars['pagenumber']->value > 1) { echo $_smarty_tpl->tpl_vars['firstpage']->value; ?> <?php echo $_smarty_tpl->tpl_vars['prevpage']->value; } echo $_smarty_tpl->tpl_vars['pagetext']->value; ?> <?php echo $_smarty_tpl->tpl_vars['pagenumber']->value; ?> <?php echo $_smarty_tpl->tpl_vars['oftext']->value; ?> <?php echo $_smarty_tpl->tpl_vars['pagecount']->value; if ($_smarty_tpl->tpl_vars['pagenumber']->value < $_smarty_tpl->tpl_vars['pagecount']->value) { echo $_smarty_tpl->tpl_vars['nextpage']->value; ?> <?php echo $_smarty_tpl->tpl_vars['lastpage']->value; } ?> </span><?php } ?> </article><!-- .news-summary //--><?php }
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 }
/** * Opens a window for the Smarty Debugging Console and display the data * * @param Smarty_Internal_Template|Smarty $obj object to debug * @param bool $full */ public function display_debug($obj, $full = false) { if (!$full) { $this->offset++; $savedIndex = $this->index; $this->index = 9999; } if ($obj->_objType == 1) { $smarty = $obj; } else { $smarty = $obj->smarty; } // create fresh instance of smarty for displaying the debug console // to avoid problems if the application did overload the Smarty class $debObj = new Smarty(); // copy the working dirs from application $debObj->setCompileDir($smarty->getCompileDir()); // init properties by hand as user may have edited the original Smarty class $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); $debObj->force_compile = false; $debObj->compile_check = true; $debObj->left_delimiter = '{'; $debObj->right_delimiter = '}'; $debObj->security_policy = null; $debObj->debugging = false; $debObj->debugging_ctrl = 'NONE'; $debObj->error_reporting = E_ALL & ~E_NOTICE; $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl'; $debObj->registered_plugins = array(); $debObj->registered_resources = array(); $debObj->registered_filters = array(); $debObj->autoload_filters = array(); $debObj->default_modifiers = array(); $debObj->escape_html = true; $debObj->caching = false; $debObj->compile_id = null; $debObj->cache_id = null; // prepare information of assigned variables $ptr = $this->get_debug_vars($obj); $_assigned_vars = $ptr->tpl_vars; ksort($_assigned_vars); $_config_vars = $ptr->config_vars; ksort($_config_vars); $debugging = $smarty->debugging; $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj); if ($obj->_objType == 2) { $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); } if ($obj->_objType == 1 || $full) { $_template->assign('template_data', $this->template_data[$this->index]); } else { $_template->assign('template_data', null); } $_template->assign('assigned_vars', $_assigned_vars); $_template->assign('config_vars', $_config_vars); $_template->assign('execution_time', microtime(true) - $smarty->start_time); $_template->assign('display_mode', $debugging == 2 || !$full); $_template->assign('offset', $this->offset * 50); echo $_template->fetch(); if (isset($full)) { $this->index--; } if (!$full) { $this->index = $savedIndex; } }
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if ($this->smarty->caching) { $tpl = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter); if (property_exists($this, 'cached')) { $filepath = str_replace($this->smarty->getCacheDir(), '', $this->cached->filepath); if ($this->smarty->is_in_lazy_cache($this->template_resource, $this->cache_id, $this->compile_id) != $filepath) { $this->smarty->update_filepath($filepath, $this->template_resource, $this->cache_id, $this->compile_id); } } return $tpl; } else { return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter); } }
/** * Draw Pager * * @param $id * @param $visualPagesCount * @param $exclude * @return string */ function smarty_function_draw_pager($params, Smarty_Internal_Template &$smarty) { $id = null; $visualPagesCount = null; $excludedGetsArray = array(); extract($params); if (empty($visualPagesCount)) { $visualPagesCount = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->defaultVidualPagesCount; } if (empty($id)) { $id = null; } if (isset($exclude) and !empty($exclude)) { $excludedGetsArray = explode(",", str_replace(" ", "", $exclude)); } $pager = Pager::getPager($id); if ($pager instanceof Pager) { if (isset($baseLink) and !empty($baseLink)) { // Remove heading slash if present and ensure last slash $link = RewriteURL::ensureSourceLastDelimiter(ltrim($baseLink, "/")); } else { $link = RewriteURL::generateCleanBaseLink(Reg::get('nav')->module, Reg::get('nav')->page, ConfigManager::getConfig("SiteNavigation")->AuxConfig->firstLevelDefaultValue) . get_all_get_params(array_merge(array($pager->getUrlParam()), $excludedGetsArray)); } $urlParam = $pager->getUrlParam(); $currentPageNumber = $pager->getCurrentPageNumber(); $pagesCount = $pager->getTotalPagesCount(); if ($pagesCount > 1) { $pageNumStart = $currentPageNumber - floor($visualPagesCount / 2); if ($pageNumStart < 1) { $pageNumStart = 1; } $pageNumEnd = $pageNumStart + $visualPagesCount - 1; if ($pageNumEnd > $pagesCount) { $pageNumEnd = $pagesCount; $pageNumStart = $pageNumEnd - $visualPagesCount + 1; if ($pageNumStart < 1) { $pageNumStart = 1; } } if ($currentPageNumber > 1) { $prevPageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . ($currentPageNumber - 1)); $smarty->assign('pagerPreviousPageLink', $prevPageLink); } $pagerNumbersArray = array(); for ($pgNum = $pageNumStart; $pgNum <= $pageNumEnd; $pgNum++) { $isCurrent = false; if ($pgNum == $currentPageNumber) { $isCurrent = true; } $pageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . $pgNum); array_push($pagerNumbersArray, array("pageNum" => $pgNum, "pageLink" => $pageLink, "isCurrent" => $isCurrent)); } if ($currentPageNumber < $pagesCount) { $nextPageLink = Reg::get(ConfigManager::getConfig("RewriteURL")->Objects->rewriteURL)->glink($link . $pager->getUrlParam() . ':' . ($currentPageNumber + 1)); $smarty->assign('pagerNextPageLink', $nextPageLink); } $smarty->assign("pagerPageNumStart", $pageNumStart); $smarty->assign("pagerPageNumEnd", $pageNumEnd); $smarty->assign("pagerCurrentPageNumber", $currentPageNumber); $smarty->assign("pagerTotalPagesCount", $pagesCount); $smarty->assign("pagerNumbersArray", $pagerNumbersArray); } if (isset($tplSnippetFile)) { $pagerSnippetFileName = $tplSnippetFile; } else { $pagerSnippetFileName = ConfigManager::getConfig("Pager", "Pager")->AuxConfig->pagerSnippetFileName; } return $smarty->fetch(Reg::get('smarty')->getFilePathFromTemplate(Reg::get('smarty')->snippetsPath . $pagerSnippetFileName)); } }
/** * Plugin for Smarty * * @param array $aParams * @param Smarty_Internal_Template $oSmartyTemplate * * @return string|null */ function smarty_function_widget_exec($aParams, $oSmartyTemplate) { if (!isset($aParams['name'])) { trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING); return null; } $sWidgetName = $aParams['name']; $aWidgetParams = isset($aParams['params']) ? $aParams['params'] : array(); foreach ($aParams as $sKey => $xValue) { if ($sKey != 'name' && $sKey != 'params') { $aWidgetParams[$sKey] = $xValue; } } $sWidget = ucfirst(basename($sWidgetName)); $sTemplate = ''; $sDelegatedClass = E::ModulePlugin()->GetDelegate('widget', $sWidget); if ($sDelegatedClass == $sWidget) { // Пробуем получить делегата по старинке, для совместимости с LS // * LS-compatible * // $sDelegatedClass = E::ModulePlugin()->GetDelegate('block', $sWidget); } // Если делегатов нет, то определаем класс виджета if ($sDelegatedClass == $sWidget) { if (isset($aParams['params']) && isset($aParams['params']['plugin'])) { $sPlugin = $aParams['params']['plugin']; } else { $sPlugin = ''; } // Проверяем наличие класса виджета штатными средствами $sWidgetClass = E::ModuleWidget()->FileClassExists($sWidget, $sPlugin, true); if ($sWidgetClass) { // Проверяем делегирование найденного класса $sWidgetClass = E::ModulePlugin()->GetDelegate('widget', $sWidgetClass); if ($sPlugin) { $sPluginTplDir = Plugin::GetTemplateDir($sPlugin); $sTemplate = $sPluginTplDir . 'tpls/widgets/widget.' . $sWidgetName . '.tpl'; if ($sFound = F::File_Exists('/widgets/widget.' . $sWidgetName . '.tpl', array($sPluginTplDir . 'tpls/', $sPluginTplDir))) { $sTemplate = $sFound; } else { // * LS-compatible * // $sLsTemplate = Plugin::GetTemplateDir($aParams['params']['plugin']) . '/blocks/block.' . $sWidgetName . '.tpl'; if (F::File_Exists($sLsTemplate)) { $sTemplate = $sLsTemplate; } } } else { $sTemplate = E::ModulePlugin()->GetDelegate('template', 'widgets/widget.' . $sWidgetName . '.tpl'); $sTemplate = F::File_Exists($sTemplate, $oSmartyTemplate->getTemplateDir()); if (!$sTemplate) { // * LS-compatible * // $sLsTemplate = E::ModulePlugin()->GetDelegate('template', 'blocks/block.' . $sWidgetName . '.tpl'); if (F::File_Exists($sLsTemplate, $oSmartyTemplate->getTemplateDir())) { $sTemplate = $sLsTemplate; } } } } else { // * LS-compatible * // // Класс не найден if ($sPlugin) { // Если класс виджета не найден, то пытаемся по старинке задать класс "LS-блока" $sWidgetClass = 'Plugin' . ucfirst($aParams['params']['plugin']) . '_Block' . $sWidget; } else { // Если класс виджета не найден, то пытаемся по старинке задать класс "LS-блока" $sWidgetClass = 'Block' . $sWidget; } // Проверяем делигирование найденного класса $sWidgetClass = E::ModulePlugin()->GetDelegate('block', $sWidgetClass); if (!$sTemplate) { $sLsTemplate = E::ModulePlugin()->GetDelegate('template', 'blocks/block.' . $sWidgetName . '.tpl'); if (F::File_Exists($sLsTemplate, $oSmartyTemplate->getTemplateDir())) { $sTemplate = $sLsTemplate; } } } } else { $sWidgetClass = $sDelegatedClass; } // * Подключаем необходимый обработчик $oWidgetHandler = new $sWidgetClass($aWidgetParams); // * Запускаем обработчик $sResult = $oWidgetHandler->Exec(); // Если обработчик ничего не вернул, то рендерим шаблон if (!$sResult && $sTemplate) { if ($aWidgetParams) { $oSmartyTemplate->assign('aWidgetParams', $aWidgetParams); } $sResult = $oSmartyTemplate->fetch($sTemplate); } return $sResult; }