Exemplo n.º 1
0
 function _smarty_include($params)
 {
     if (isset($params['smarty_include_tpl_file'])) {
         $params['smarty_include_tpl_file'] = Engine::getInstance()->Plugin_GetDelegate('template', $params['smarty_include_tpl_file']);
     }
     parent::_smarty_include($params);
 }
Exemplo n.º 2
0
	function _smarty_include($params)
	{
		$theme_locations = Zend_Registry::get('theme_locations');
		if ($this->_tpl_vars['isAdminController'])
		{
			$theme_global = $theme_locations['admin']['current_theme']['path'];
			$default_global = $theme_locations['admin']['default_theme']['path'];
		}
		else
		{
			$theme_global = $theme_locations['frontend']['current_theme']['path'];
			$default_global = $theme_locations['frontend']['default_theme']['path'];
		}
		$file = substr( $params['smarty_include_tpl_file'], strlen("file:"));
		if (!file_exists($file))
		{
			$params['smarty_include_tpl_file'] = str_replace($theme_global, $default_global, $params['smarty_include_tpl_file']);
		}
		$file = substr( $params['smarty_include_tpl_file'], strlen("file:"));
		if (!file_exists($file))
		{
			throw new Exception("MISSING_TEMPLATE - The template file does not exist: " . $file);
		}
		return parent::_smarty_include($params);
	}
Exemplo n.º 3
0
 public function _smarty_include($params)
 {
     $info = pathinfo($params["smarty_include_tpl_file"]);
     if ($info['extension'] != 'tpl') {
         return;
     }
     parent::_smarty_include($params);
 }
Exemplo n.º 4
0
 function _smarty_include($params)
 {
     global $language;
     $langfile = substr($_smarty_tpl_file, 0, -4) . '.' . $language . '.tpl';
     if (is_file($this->template_dir . "/" . $langfile)) {
         $params['smarty_include_tpl_file'] = $langfile;
     }
     return parent::_smarty_include($params);
 }
Exemplo n.º 5
0
 function _smarty_include($params)
 {
     global $style_base, $tikidomain;
     if (isset($style_base)) {
         if ($tikidomain and file_exists("templates/{$tikidomain}/styles/{$style_base}/" . $params['smarty_include_tpl_file'])) {
             $params['smarty_include_tpl_file'] = "{$tikidomain}/styles/{$style_base}/" . $params['smarty_include_tpl_file'];
         } elseif ($tikidomain and file_exists("templates/{$tikidomain}/" . $params['smarty_include_tpl_file'])) {
             $params['smarty_include_tpl_file'] = "{$tikidomain}/" . $params['smarty_include_tpl_file'];
         } elseif (file_exists("templates/styles/{$style_base}/" . $params['smarty_include_tpl_file'])) {
             $params['smarty_include_tpl_file'] = "styles/{$style_base}/" . $params['smarty_include_tpl_file'];
         }
     }
     return parent::_smarty_include($params);
 }
Exemplo n.º 6
0
/**
 * 处理分页导航模板
 * 
 * 输出的模板变量
 * $pagenav {array}
 * {{$pagenav.~}}
 * 
 * nums: {array} 页码列表
 * currpage: {int} 当前页面
 * recordcount: {int} 记录数
 * pagecount: {int} 总页数
 * query: {array} 页面传递参数
 * next: {int} 下一页的页码
 * prev: {int} 前一页页码
 * 
 * @param array $params
 *      currpage:当前分页
 *      recordcount: 记录总数
 *      pagecount: 分页总数
 *      template: 模板文件
 *      numcount: 分页数字的个数
 *      url: 跳转url
 *      query: 页面跳转传递的参数
 * @param Smarty $smarty
 * @return void
 */
function smarty_function_pagenavigator($params, &$smarty)
{
    if (empty($params['template'])) {
        $smarty->trigger_error('Undefined pagenavigator template file');
    }
    if (!isset($params['recordcount'])) {
        //$smarty->trigger_error('Undefined recordcount');
        return;
    }
    if (!isset($params['pagecount'])) {
        //$smarty->trigger_error('Undefined pagecount');
        return;
    }
    $currpage = max(1, (int) @$params['currpage']);
    $pagecount = (int) $params['pagecount'];
    $recordcount = (int) $params['recordcount'];
    $numcount = (int) @$params['numcount'];
    // 模板变量
    $tplvar = array('pagecount' => $pagecount, 'recordcount' => $recordcount, 'currpage' => $currpage, 'next' => $currpage < $pagecount ? $currpage + 1 : null, 'prev' => $currpage > 1 ? $currpage - 1 : null, 'url' => empty($params['url']) ? $_SERVER['SCRIPT_NAME'] : $params['url'], 'jsfunc' => @$params['jsfunc']);
    // 输出页码
    if ($numcount > 0) {
        $lbound = $currpage > intval($numcount / 2) ? $currpage - intval($numcount / 2) : 1;
        $ubound = $lbound + $numcount - 1 > $pagecount ? $pagecount : $lbound + $numcount - 1;
        $nums = array();
        for ($i = $lbound; $i <= $ubound; $i++) {
            $nums[] = $i;
        }
        $tplvar['nums'] = $nums;
    }
    if (!empty($params['query']) && is_array($params['query'])) {
        $tplvar['query'] = $params['query'];
    }
    $array = array('smarty_include_vars' => array('pagenav' => $tplvar), 'smarty_include_tpl_file' => $params['template']);
    $smarty->register_function('page_url', 'smarty_function_pagenavigator_buildurl');
    $smarty->register_function('page_jsfunc', 'smarty_function_pagenavigator_buildjsfunc');
    $smarty->_smarty_include($array);
}
 /**
  * Override the Smarty {include ...} function to allow hooks to be
  * called.
  */
 function _smarty_include($params)
 {
     if (!HookRegistry::call('TemplateManager::include', array(&$this, &$params))) {
         return parent::_smarty_include($params);
     }
     return false;
 }
Exemplo n.º 8
0
 function _smarty_include($params)
 {
     $filename = '/app/views/' . $params['smarty_include_tpl_file'] . '.html';
     $filename = str_replace(array('//', '.html.html'), array('/', '.html'), $filename);
     if (file_exists(ROOT_DIR . $filename)) {
         $params['smarty_include_tpl_file'] = ROOT_DIR . $filename;
     } else {
         if (file_exists(BASE_DIR . $filename)) {
             $params['smarty_include_tpl_file'] = BASE_DIR . $filename;
         } else {
             if (file_exists(ROOT_DIR . 'page/' . $filename)) {
                 $params['smarty_include_tpl_file'] = ROOT_DIR . 'page/' . $filename;
             } else {
                 if (file_exists(BASE_DIR . 'page/' . $filename)) {
                     $params['smarty_include_tpl_file'] = BASE_DIR . 'page/' . $filename;
                 }
             }
         }
     }
     parent::_smarty_include($params);
 }
Exemplo n.º 9
0
 /**
  * called for included templates
  *
  * @param array $params Smarty parameters
  *
  * @return void
  */
 function _smarty_include($params)
 {
     $tpl_file = $params["smarty_include_tpl_file"];
     $vars = $params["smarty_include_vars"];
     $skip_files = array("login.tpl", "common.tpl", "header.tpl", "footer.tpl", "tabbox.tpl", "ajax_errors.tpl");
     // Only at debug time
     if (!CAppUI::pref("showTemplateSpans") || isset($params["smarty_include_vars"]['nodebug']) || in_array(basename($tpl_file), $skip_files)) {
         parent::_smarty_include($params);
         return;
     }
     $this->showDebugSpans($tpl_file, $params);
     echo "\n<!-- Start include: {$tpl_file} -->\n";
     parent::_smarty_include($params);
     echo "\n<!-- Stop include: {$tpl_file} -->\n";
 }
Exemplo n.º 10
0
 public function _smarty_include($params)
 {
     // strip custom:
     $path = substr($params['smarty_include_tpl_file'], 7);
     ob_start();
     parent::_smarty_include($params);
     $output = ob_get_contents();
     ob_end_clean();
     echo $this->application->getRenderer()->applyLayoutModifications($path, $output);
 }
 function _smarty_include($params)
 {
     global $ars_hooks;
     $pre = $post = $replace = array();
     $orig_file = $params['smarty_include_tpl_file'];
     $bench_id = cw_bench_open_tag($orig_file, 'tpl');
     if (is_array($ars_hooks['tpl'][$orig_file]) && !$params['smarty_include_vars']['disable_hooks']) {
         foreach ($ars_hooks['tpl'][$orig_file] as $type => $files) {
             foreach ($files as $file) {
                 if ($orig_file == $file[0]) {
                     continue;
                 }
                 // skip loop in hooks
                 $file[2] = $type;
                 $file[0] = $file[0];
                 if (!isset($file[1]) || $this->_tpl_vars[$file[1]] || function_exists($file[1]) && cw_call($file[1], array(&$params['smarty_include_vars'])) || strpos($file[1], '.tpl') !== false && $this->_tpl_vars['_current_compiled_file'] == $file[1]) {
                     switch ($type) {
                         case 'replace':
                             $replace[] = $file;
                             break;
                         case 'pre':
                             $pre[] = $file;
                             break;
                         case 'post':
                             $post[] = $file;
                             break;
                     }
                 }
             }
         }
     }
     if (empty($replace)) {
         $replace[] = array($orig_file, '', 'original');
     }
     $include_files = array_merge($pre, $replace, $post);
     foreach ($include_files as $file) {
         if (in_array($file[2], array('pre', 'post', 'replace'))) {
             $params['smarty_include_tpl_file'] = $file[0];
             $this->_smarty_include($params);
         } elseif ($file[2] == 'original') {
             $params['smarty_include_tpl_file'] = $file[0];
             if (!$this->template_exists($params['smarty_include_tpl_file'])) {
                 continue;
             }
             // skip non-existent tpl if it has hooks
             parent::_smarty_include($params);
         }
     }
     cw_bench_close_tag($bench_id);
 }
Exemplo n.º 12
0
 /**
  * Переопределение функции _smarty_include для собтсвенных нужд
  * @param array $params массив параметров
  * @return mixed если возвращает
  */
 public function _smarty_include($params)
 {
     $this->prefetch($params['smarty_include_tpl_file']);
     $r = parent::_smarty_include($params);
     $this->postfetch($params['smarty_include_tpl_file']);
     return $r;
 }
Exemplo n.º 13
0
 function _smarty_include($params)
 {
     if (isset($params['smarty_include_tpl_file'])) {
         $params['smarty_include_tpl_file'] = $this->getLocalOverride($params['smarty_include_tpl_file'], false);
         // Change resource_name to absolute path so that Smarty caching must take into account the theme directory
         $params['smarty_include_tpl_file'] = $this->convertToAbsolutePath($params['smarty_include_tpl_file']);
     }
     return parent::_smarty_include($params);
 }
Exemplo n.º 14
0
	function _smarty_include($params){
		$tpl_inc = $params['smarty_include_tpl_file'];
		if(!file_exists($this->template_dir.$tpl_inc)){
            $tpl_name=JPATH_COMPONENT_SITE.DS.'templates'.DS.'default'.DS.$tpl_inc;
    		$params['smarty_include_tpl_file'] = $tpl_name;
        }
		parent::_smarty_include($params);
	}