"Fossies" - the Fresh Open Source Software Archive

Member "smarty-3.1.34/libs/sysplugins/smarty_internal_method_mustcompile.php" (28 Feb 2019, 1769 Bytes) of package /linux/www/smarty-3.1.34.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "smarty_internal_method_mustcompile.php" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.1.32_vs_3.1.33.

    1 <?php
    2 
    3 /**
    4  * Smarty Method MustCompile
    5  *
    6  * Smarty_Internal_Template::mustCompile() method
    7  *
    8  * @package    Smarty
    9  * @subpackage PluginsInternal
   10  * @author     Uwe Tews
   11  */
   12 class Smarty_Internal_Method_MustCompile
   13 {
   14     /**
   15      * Valid for template object
   16      *
   17      * @var int
   18      */
   19     public $objMap = 2;
   20 
   21     /**
   22      * Returns if the current template must be compiled by the Smarty compiler
   23      * It does compare the timestamps of template source and the compiled templates and checks the force compile
   24      * configuration
   25      *
   26      * @param \Smarty_Internal_Template $_template
   27      *
   28      * @return bool
   29      * @throws \SmartyException
   30      */
   31     public function mustCompile(Smarty_Internal_Template $_template)
   32     {
   33         if (!$_template->source->exists) {
   34             if ($_template->_isSubTpl()) {
   35                 $parent_resource = " in '$_template->parent->template_resource}'";
   36             } else {
   37                 $parent_resource = '';
   38             }
   39             throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
   40         }
   41         if ($_template->mustCompile === null) {
   42             $_template->mustCompile = (!$_template->source->handler->uncompiled &&
   43                                        ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
   44                                         !$_template->compiled->exists || ($_template->compile_check &&
   45                                                                           $_template->compiled->getTimeStamp() <
   46                                                                           $_template->source->getTimeStamp())));
   47         }
   48         return $_template->mustCompile;
   49     }
   50 }