Zikula_Core
[ class tree: Zikula_Core ] [ index: Zikula_Core ] [ all elements ]

Source for file pnRender.class.php

Documentation is available at pnRender.class.php

  1. <?php
  2. /**
  3.  * $Id: pnRender.class.php 24339 2008-06-05 18:06:52Z markwest $
  4.  *
  5.  * * pnRender *
  6.  *
  7.  * Zikula wrapper class for Smarty
  8.  *
  9.  * * License *
  10.  *
  11.  * This program is free software; you can redistribute it and/or
  12.  * modify it under the terms of the GNU General Public License (GPL)
  13.  * as published by the Free Software Foundation; either version 2
  14.  * of the License, or (at your option) any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * @author      Zikula development team
  22.  * @version     .7/.8
  23.  * @link        http://www.post-nuke.net              Zikula home page
  24.  * @link        http://smarty.php.net                 Smarty home page
  25.  * @license     http://www.gnu.org/copyleft/gpl.html  GNU General Public License
  26.  * @package     Zikula_Core
  27.  * @subpackage  pnAPI
  28.  */
  29.  
  30. // keeping track if Smarty is loaded somewhere else!
  31. if (!class_exists('Smarty')) {
  32.     /**
  33.      * The directory of Smarty
  34.      */
  35.     define('SMARTY_DIR''includes/classes/Smarty/');
  36.     Loader::requireOnce(SMARTY_DIR 'Smarty.class.php');
  37. }
  38.  
  39. /**
  40.  * Our class
  41.  *
  42.  * @package     Zikula_Core
  43.  * @subpackage  pnAPI
  44.  */
  45. class pnRender extends Smarty {
  46.     /**
  47.      * The module in  which the current template will be located
  48.      */
  49.     var $module;
  50.  
  51.     /**
  52.      * The primary module for this page
  53.      */
  54.     var $toplevelmodule;
  55.  
  56.     /**
  57.      * The full module info for wich the object is for
  58.      */
  59.     var $modinfo;
  60.  
  61.     /**
  62.      * The current theme used by the site/user
  63.      */
  64.     var $theme;
  65.  
  66.     /**
  67.      * The full theme info for the theme used by the site/user
  68.      */
  69.     var $themeinfo;
  70.  
  71.     /**
  72.      * The current language used by the site/user
  73.      */
  74.     var $language;
  75.  
  76.     /**
  77.      * The base URL of the site
  78.      */
  79.     var $baseurl;
  80.  
  81.     /**
  82.      * The base URI of the site
  83.      */
  84.     var $baseuri;
  85.  
  86.     /**
  87.      * The cache ID of the object
  88.      */
  89.     var $cache_id;
  90.  
  91.     /**
  92.      * Set if Xanthia is an active module and templates stored in database
  93.      */
  94.     var $userdb;
  95.  
  96.     /**
  97.      * true if admins wants to expose the template folder, needs admin rights for pnRender too
  98.      */
  99.     var $expose_template;
  100.  
  101.     /**
  102.      * The class constructor.
  103.      *
  104.      * @param   string   $module   The module for which this object is for
  105.      * @param   bool     $caching  (optional) Value for the caching class var -
  106.      *                               default is void (i.e. use admin configured value
  107.      */
  108.     function pnRender($module ''$caching null)
  109.     {
  110.         // first, get a native Smarty object
  111.         $this->Smarty();
  112.  
  113.         // set the error reporting level
  114.         $this->error_reporting = isset($GLOBALS['PNConfig']['Debug']['error_reporting']$GLOBALS['PNConfig']['Debug']['error_reporting'E_ALL;
  115.  
  116.         // Initialize the module property with the name of
  117.         // the topmost module. Foor Hooks, Blocks, API Functions and others
  118.         // you need to set this property to the name of the respective module!
  119.         $this->toplevelmodule = pnModGetName();
  120.         if (!$module{
  121.             $module $this->toplevelmodule;
  122.         }
  123.         $this->module = array($module => pnModGetInfo(pnModGetIDFromName($module)));
  124.  
  125.         // initialise other PN environment vars
  126.         $this->language = pnUserGetLang();
  127.         $this->baseurl = pnGetBaseURL();
  128.         $this->baseuri = pnGetBaseURI();
  129.  
  130.         // begin holder tag (be nice to others)
  131.         $this->left_delimiter = '<!--[';
  132.         // end holder tag
  133.         $this->right_delimiter = ']-->';
  134.  
  135.         //---- Plugins handling -----------------------------------------------
  136.         // add plugin paths
  137.         $this->theme = $theme $this->themeinfo['directory'];
  138.  
  139.         //$this->modinfo = $modinfo = pnModGetInfo(pnModGetIDFromName($module));
  140.         $modpath ($this->module[$module]['type'== 3'system' 'modules';
  141.         // plugin paths are ordered so that we find the vast majority of plugins with as few path
  142.         // searches as possible
  143.         $pluginpaths array('system/pnRender/plugins',
  144.                              'system/Theme/plugins',
  145.                              'config/plugins',
  146.                              "themes/$theme/templates/modules/$module/plugins",
  147.                              "themes/$theme/plugins",
  148.                              "$modpath/$this->module[$module]['directory'."/pntemplates/plugins");
  149.         foreach ($pluginpaths as $pluginpath{
  150.             if (file_exists($pluginpath)) {
  151.                 array_push($this->plugins_dir$pluginpath);
  152.             }
  153.         }
  154.  
  155.         // check if the recent 'type' parameter in the URL is admin and if yes,
  156.         // include (modules|system)/Admin/pntemplates/plugins to the plugins_dir array
  157.         $type FormUtil::getPassedValue('type'null'GETPOST');
  158.         if ($type==='admin'{
  159.             array_push($this->plugins_dir'system/Admin/pntemplates/plugins');
  160.             $this->load_filter('output''admintitle');
  161.         }
  162.  
  163.         /* // add the plugin directory for all available modules
  164.         // TODO evaluate performance issues
  165.         $modules = pnModGetAllMods();
  166.         foreach ($modules as $module) {
  167.             if ($module['type'] == 3) {
  168.                 array_push($this->plugins_dir, "system/$module[directory]/pntemplates/plugins");
  169.             } else {
  170.                 array_push($this->plugins_dir, "modules/$module[directory]/pntemplates/plugins");
  171.             }
  172.         }*/
  173.         // build the path to the config file for usemodules needed later
  174.         $usemod_conf "$modpath/".$this->module[$module]['directory']."/pntemplates/config/usemodules";
  175.         // load the config file
  176.         if (file_exists($usemod_conf&& is_readable($usemod_conf)) {
  177.             $additionalmodules file($usemod_conf);
  178.             if (is_array($additionalmodules)) {
  179.                 foreach ($additionalmodules as $addmod{
  180.                     $this->_add_plugins_dir(trim($addmod));
  181.                 }
  182.             }
  183.         }
  184.  
  185.         //---- Cache handling -------------------------------------------------
  186.         // use HTML cache system?
  187.         if (isset($caching&& is_bool($caching)) {
  188.             $this->caching = $caching;
  189.         else {
  190.             $this->caching = pnModGetVar('pnRender''cache');
  191.         }
  192.         $this->cache_lifetime = pnModGetVar('pnRender''lifetime');
  193.  
  194.         // HTML cache directory
  195.         $this->cache_dir = pnConfigGetVar('temp''/pnRender_cache';
  196.  
  197.         //---- Compilation handling -------------------------------------------
  198.         // check for updated templates?
  199.         $this->compile_check = pnModGetVar('pnRender''compile_check');
  200.  
  201.         // force compile template always?
  202.         $this->force_compile = pnModGetVar('pnRender''force_compile');
  203.  
  204.         // don't use subdirectories when creating compiled/cached templates
  205.         // this works better in a hosted environment
  206.         $this->use_sub_dirs = false;
  207.  
  208.         // cache directory (compiled templates)
  209.         $this->compile_dir = pnConfigGetVar('temp''/pnRender_compiled';
  210.  
  211.         // compile id
  212.         $this->compile_id = $this->toplevelmodule . '|' $theme '|' pnUserGetLang();
  213.  
  214.         // initialize the cache ID
  215.         $this->cache_id = '';
  216.  
  217.         // expose templates
  218.         $this->expose_template = (pnModGetVar('pnRender''expose_template'== truetrue false;
  219.  
  220.         $this->register_block('nocache''pnRender_block_nocache'false);
  221.  
  222.         // register resource type 'pn'
  223.         // this defines the way templates are searched during
  224.         // <!--[ include file='my_template.html' ]-->
  225.         // this enables us to store selected module templates in the
  226.         // theme while others can be kept in the module itself.
  227.         $this->register_resource('pn'array('pn_get_template',
  228.                                              'pn_get_timestamp',
  229.                                              'pn_get_secure',
  230.                                              'pn_get_trusted'));
  231.  
  232.         // set 'pn' as default resource type
  233.         $this->default_resource_type = 'pn';
  234.  
  235.         // For ajax requests we use the short urls filter to 'fix' relative paths
  236.         if (($GLOBALS['loadstages'PN_CORE_AJAX&& pnConfigGetVar('shorturls')) {
  237.             $this->load_filter('output''shorturls');
  238.         }
  239.  
  240.         // Assign some useful theme settings
  241.         // firstly all theme variables
  242.         $this->assign(ThemeUtil::getVar());
  243.         // secondly the base paths
  244.         $this->assign('baseurl'$this->baseurl);
  245.         $this->assign('baseuri'$this->baseuri);
  246.         // lastly the theme paths
  247.         $this->assign('themepath',     $this->baseurl . 'themes/' $theme);
  248.         $this->assign('stylepath',     $this->baseurl . 'themes/' $theme '/style');
  249.         $this->assign('scriptpath',    $this->baseurl . 'themes/' $theme '/javascript');
  250.         $this->assign('imagepath',     $this->baseurl . 'themes/' $theme '/images');
  251.         $this->assign('imagelangpath'$this->baseurl . 'themes/' $theme '/images/' $this->language);
  252.     }
  253.  
  254.     /**
  255.     * setup the current instance of the pnRender class and return it back to the module
  256.     */
  257.      function getInstance($module null$caching null$cache_id null$add_core_data false)
  258.     {
  259.         /**
  260.         * static variable to hold the instance of this object when called in a singleton pattern
  261.         */
  262.         static $instance;
  263.         if (!isset($instance)) {
  264.             $instance new pnRender($module$caching);
  265.         }
  266.         if (!is_null($caching)) {
  267.             $instance->caching $caching;
  268.         }
  269.         if (!is_null($cache_id)) {
  270.             $instance->cache_id $cache_id;
  271.         }
  272.         if ($module === null{
  273.             $module $instance->toplevelmodule;
  274.         }
  275.         if (!array_key_exists($module$instance->module)) {
  276.             $instance->module[$modulepnModGetInfo(pnModGetIDFromName($module));
  277.             //$instance->modinfo = pnModGetInfo(pnModGetIDFromName($module));
  278.             $instance->_add_plugins_dir($module);
  279.         }
  280.         if ($add_core_data{
  281.             $instance->add_core_data();
  282.         }
  283.         return $instance;
  284.     }
  285.  
  286.     /**
  287.      * Checks whether requested template exists.
  288.      *
  289.      * @param string $template 
  290.      */
  291.     function template_exists($template)
  292.     {
  293.         return (bool)$this->get_template_path($template);
  294.     }
  295.  
  296.     /**
  297.      * Checks which path to use for required template
  298.      *
  299.      * @param string $template 
  300.      */
  301.     function get_template_path($template)
  302.     {
  303.         static $cache array();
  304.  
  305.         if (isset($cache[$template])) {
  306.             return $cache[$template];
  307.         }
  308.  
  309.         // the current module
  310.         $pnmodgetname pnModGetName();
  311.         
  312.         foreach ($this->module as $module => $modinfo{
  313.             // prepare the values for OS
  314.             $os_pnmodgetname DataUtil::formatForOS($pnmodgetname);
  315.             $os_module       DataUtil::formatForOS($module);
  316.             $os_modpath      DataUtil::formatForOS($modinfo['directory']);
  317.             $os_theme        DataUtil::formatForOS($this->theme);
  318.     
  319.             // Define the locations in which we will look for templates
  320.             // (in this order)
  321.             // Note: Paths 1, 3, 5 and 7 - This allows for the hook or block functions
  322.             // (such as ratings and comments) to use different templates depending
  323.             // on the top level module. e.g. the comments dialog can be different
  324.             // for news  and polls...
  325.             // They are only evaluated when the calling module is not the current one.
  326.             //
  327.             // 1. The top level module directory in the requested module folder
  328.             // in the theme directory.
  329.             $themehookpath "themes/$os_theme/templates/modules/$os_module/$os_pnmodgetname";
  330.             // 2. The module directory in the current theme.
  331.             $themepath "themes/$os_theme/templates/modules/$os_module";
  332.             // 3. The global template directory for the current top level module
  333.             $globalhookpath "config/templates/$os_module/$os_pnmodgetname";
  334.             // 4. The global template directory
  335.             $globalpath "config/templates/$os_module";
  336.             // 5. The top level module directory in the requested module folder
  337.             // in the modules sub folder.
  338.             $modhookpath "modules/$os_module/pntemplates/$os_pnmodgetname";
  339.             // 6. The module directory in the modules sub folder.
  340.             $modpath "modules/$os_module/pntemplates";
  341.             // 7. The top level module directory in the requested module folder
  342.             // in the system sub folder.
  343.             $syshookpath "system/$os_module/pntemplates/$os_pnmodgetname";
  344.             // 8. The module directory in the system sub folder.
  345.             $syspath "system/$os_module/pntemplates";
  346.     
  347.             $ostemplate DataUtil::formatForOS($template)//.'.htm';
  348.     
  349.             // check the module for which we're looking for a template is the
  350.             // same as the top level mods. This limits the places to look for
  351.             // templates.
  352.             if ($module == $pnmodgetname{
  353.                 $search_path array($themepath,
  354.                                      $globalpath,
  355.                                      $modpath,
  356.                                      $syspath);
  357.             else {
  358.                 $search_path array($themehookpath,
  359.                                      $themepath,
  360.                                      $globalhookpath,
  361.                                      $globalpath,
  362.                                      $modhookpath,
  363.                                      $modpath,
  364.                                      $syshookpath,
  365.                                      $syspath);
  366.             }
  367.     
  368.             foreach ($search_path as $path{
  369.                 if (file_exists("$path/$ostemplate"&& is_readable("$path/$ostemplate")) {
  370.                     $cache[$template$path;
  371.                     return $path;
  372.                 }
  373.             }
  374.         }
  375.  
  376.         // when we arrive here, no path was found
  377.         return false;
  378.     }
  379.  
  380.     /**
  381.      * executes & returns the template results
  382.      *
  383.      * This returns the template output instead of displaying it.
  384.      * Supply a valid template name.
  385.      * As an optional second parameter, you can pass a cache id.
  386.      * As an optional third parameter, you can pass a compile id.
  387.      *
  388.      * @param   string   $template    the name of the template
  389.      * @param   string   $cache_id    (optional) the cache ID
  390.      * @param   string   $compile_id  (optional) the compile ID
  391.      * @param   boolean  $display 
  392.      * @param   boolean  $reset (optional) reset singleton defaults
  393.      * @return  string   the template output
  394.      */
  395.     function fetch($template$cache_id=null$compile_id=null$display false$reset true)
  396.     {
  397.         $this->_setup_template($template);
  398.  
  399.         if (!is_null($cache_id)) {
  400.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $cache_id;
  401.         else {
  402.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $this->cache_id;
  403.         }
  404.  
  405.         $output parent::fetch($template$cache_id$compile_id$display);
  406.  
  407.         if ($this->expose_template == true{
  408.             $template DataUtil::formatForDisplay($template);
  409.             $output "\n<!-- Start ".$this->template_dir."/$template -->\n"
  410.                       . $output
  411.                       . "\n<!-- End ".$this->template_dir."/$template -->\n";
  412.         }
  413.  
  414.         // now we've got our output from this module reset our instance
  415.         if ($reset{
  416. //             $this->module = $this->toplevelmodule;
  417.         }
  418.  
  419.         return $output;
  420.     }
  421.  
  422.     /**
  423.      * executes & displays the template results
  424.      *
  425.      * This displays the template.
  426.      * Supply a valid template name.
  427.      * As an optional second parameter, you can pass a cache id.
  428.      * As an optional third parameter, you can pass a compile id.
  429.      *
  430.      * @param   string   $template    the name of the template
  431.      * @param   string   $cache_id    (optional) the cache ID
  432.      * @param   string   $compile_id  (optional) the compile ID
  433.      * @return  void 
  434.      */
  435.     function display($template$cache_id=null$compile_id=null)
  436.     {
  437.         echo $this->fetch($template$cache_id$compile_id);
  438.     }
  439.  
  440.     /**
  441.      * finds out if a template is already cached
  442.      *
  443.      * This returns true if there is a valid cache for this template.
  444.      * Right now, we are just passing it to the original Smarty function.
  445.      * We might introduce a function to decide if the cache is in need
  446.      * to be refreshed...
  447.      *
  448.      * @param   string   $template    the name of the template
  449.      * @param   string   $cache_id    (optional) the cache ID
  450.      * @return  boolean 
  451.      */
  452.     function is_cached($template$cache_id=null$compile_id=null)
  453.     {
  454.         // insert the condition to check the cache here!
  455.         // if (functioncheckdb($this -> module)) {
  456.         //        return parent :: clear_cache($template, $this -> cache_id);
  457.         //}
  458.         $this->_setup_template($template);
  459.  
  460.         if ($cache_id{
  461.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $cache_id;
  462.         else {
  463.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $this->cache_id;
  464.         }
  465.  
  466.         if (!isset($compile_id)) {
  467.             $compile_id $this->compile_id;
  468.         }
  469.  
  470.         return parent::is_cached($template$cache_id$compile_id);
  471.     }
  472.  
  473.     /**
  474.      * clears the cache for a specific template
  475.      *
  476.      * This returns true if there is a valid cache for this template.
  477.      * Right now, we are just passing it to the original Smarty function.
  478.      * We might introduce a function to decide if the cache is in need
  479.      * to be refreshed...
  480.      *
  481.      * @param   string   $template    the name of the template
  482.      * @param   string   $cache_id    (optional) the cache ID
  483.      * @param   string   $compile_id  (optional) the compile ID
  484.      * @param   string   $expire      (optional) minimum age in sec. the cache file must be before it will get cleared.
  485.      * @return  boolean 
  486.      */
  487.     function clear_cache($template=null$cache_id=null$compile_id=null$expire=null)
  488.     {
  489.         if ($cache_id{
  490.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $cache_id;
  491.         else {
  492.             $cache_id $this->baseurl '|' $this->toplevelmodule '|' $this->cache_id;
  493.         }
  494.  
  495.         return parent::clear_cache($template$cache_id$compile_id$expire);
  496.     }
  497.  
  498.     /**
  499.      * clear the entire contents of cache (all templates)
  500.      *
  501.      * Smarty's original clear_all_cache function calls the subclasse's
  502.      * clear_cache function. As we always prepend the module name, this
  503.      * doesn't work here...
  504.      *
  505.      * @param string $exp_time expire time
  506.      * @return boolean results of {@link smarty_core_rm_auto()}
  507.      */
  508.     function clear_all_cache($exp_time null)
  509.     {
  510.         $res parent::clear_cache(nullnullnull$exp_time);
  511.         // recreate index.html file
  512.         fclose(fopen($this->cache_dir '/index.html''w'));
  513.         return $res;
  514.     }
  515.  
  516.     /**
  517.      * set up paths for the template
  518.      *
  519.      * This function sets the template and the config path according
  520.      * to where the template is found (Theme or Module directory)
  521.      *
  522.      * @param   string   $template   the template name
  523.      * @access  private
  524.      */
  525.     function _setup_template($template)
  526.     {
  527.         // default directory for templates
  528.         $this->template_dir $this->get_template_path($template);
  529.         //echo $this->template_dir . '<br>';
  530.         $this->config_dir   $this->template_dir '/config';
  531.     }
  532.  
  533.     /**
  534.      * add a plugins dir to _plugin_dir array
  535.      *
  536.      * This function takes  module name and adds two path two the plugins_dir array
  537.      * when existing
  538.      *
  539.      * @param   string   $module    well known module name
  540.      * @access  private
  541.      */
  542.     function _add_plugins_dir($module)
  543.     {
  544.         $modinfo pnModGetInfo(pnModGetIDFromName($module));
  545.         $modpath ($modinfo['type'== 3'system' 'modules';
  546.         $mod_plugs "$modpath/$modinfo[directory]/pntemplates/plugins";
  547.         if (file_exists($mod_plugs)) {
  548.             array_push($this->plugins_dir$mod_plugs);
  549.         }
  550.     }
  551.  
  552.     /**
  553.      * add core data to the template
  554.      *
  555.      * This function adds some basic data to the template depending on the
  556.      * current user and the PN settings.
  557.      *
  558.      * @param   list of module names. all mod vars of these modules will be included too
  559.      *           The mod vars of the current module will always be included
  560.      * @return  boolean true if ok, otherwise false
  561.      * @access  public
  562.      */
  563.     function add_core_data()
  564.     {
  565.         $pncore array();
  566.         $pncore['version_num'PN_VERSION_NUM;
  567.         $pncore['version_id'PN_VERSION_ID;
  568.         $pncore['version_sub'PN_VERSION_SUB;
  569.         $pncore['logged_in'pnUserLoggedIn();
  570.         $pncore['language'$this->language;
  571.         $pncore['themeinfo'$this->themeinfo;
  572.  
  573.         // add userdata
  574.         $pncore['user'pnUserGetVars(SessionUtil::getVar('uid'));
  575.  
  576.         // add modvars of current modules
  577.         foreach ($this->module as $module => $dummy{
  578.             $pncore[$modulepnModGetVar($module);
  579.         }
  580.  
  581.         // add mod vars of all modules supplied as parameter
  582.         $modulenames func_get_args();
  583.         foreach ($modulenames as $modulename{
  584.             // if the modulename is empty do nothing
  585.             if (!empty($modulename&& !is_array($modulename&& !array_key_exists($modulename$this->module)) {
  586.                 // check if user wants to have /PNConfig
  587.                 if ($modulename==PN_CONFIG_MODULE{
  588.                     $pnconfig pnModGetVar(PN_CONFIG_MODULE);
  589.                     foreach($pnconfig as $key => $value{
  590.                         // gather all config vars
  591.                         $pncore['pnconfig'][$key$value;
  592.                     }
  593.                 else {
  594.                     $pncore[$modulenamepnModGetVar($modulename);
  595.                 }
  596.             }
  597.         }
  598.  
  599.         // Module vars
  600.         $this->assign('pncore'$pncore);
  601.         return true;
  602.     }
  603. }
  604.  
  605. /**
  606.  * Smarty block function to prevent template parts from being cached
  607.  *
  608.  * @param $param 
  609.  * @param $content 
  610.  * @param $smarty 
  611.  * @return string 
  612.  ***/
  613. function pnRender_block_nocache($param$content&$smarty)
  614. {
  615.     return $content;
  616. }
  617.  
  618. /**
  619.  * Smarty resource function to determine correct path for template inclusion
  620.  *
  621.  * For more information about parameters see http://smarty.php.net/manual/en/template.resources.php
  622.  *
  623.  * @access  private
  624.  */
  625. function pn_get_template($tpl_name&$tpl_source&$smarty)
  626. {
  627.     // determine the template path and store the template source
  628.     // in $tpl_source
  629.  
  630.     // get path, checks also if tpl_name file_exists and is_readable
  631.     $tpl_path $smarty->get_template_path($tpl_name);
  632.  
  633.     if ($tpl_path !== false{
  634.         $tpl_source file_get_contents(DataUtil::formatForOS($tpl_path '/' $tpl_name));
  635.         if ($tpl_source !== false {
  636.             return true;
  637.         }
  638.     }
  639.     LogUtil::registerError(pnML('_TEMPLATENOTAVAILABLE'array('m' => $smarty->module't' => $tpl_name)true));
  640.     return false;
  641. }
  642.  
  643. function pn_get_timestamp($tpl_name&$tpl_timestamp&$smarty)
  644. {
  645.     // get the timestamp of the last change of the $tpl_name file
  646.  
  647.     // get path, checks also if tpl_name file_exists and is_readable
  648.     $tpl_path $smarty->get_template_path($tpl_name);
  649.  
  650.     if ($tpl_path !== false{
  651.         $tpl_timestamp filemtime(DataUtil::formatForOS($tpl_path '/' $tpl_name));
  652.         if ($tpl_timestamp !== false{
  653.             return true;
  654.         }
  655.     }
  656.     return false;
  657. }
  658.  
  659. function pn_get_secure($tpl_name&$smarty)
  660. {
  661.     // assume all templates are secure
  662.     return true;
  663. }
  664.  
  665. function pn_get_trusted($tpl_name&$smarty)
  666. {
  667.     // not used for templates
  668.     return;
  669. }

Documentation generated on Fri, 18 Jul 2008 21:54:10 +0200 by phpDocumentor 1.4.1