public function compileTemplateSource()
    {
        if (!$this->source->recompiled) {
            $this->properties['file_dependency'] = array();
            if ($this->source->components) {
                // for the extends resource the compiler will fill it
                // uses real resource for file dependency
                // $source = end($this->source->components);
                // $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type);
            } else {
                $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $this->source->type);
            }
        }
        // compile locking
        if ($this->smarty->compile_locking && !$this->source->recompiled) {
            if ($saved_timestamp = $this->compiled->timestamp) {
                touch($this->compiled->filepath);
            }
        }
        // call compiler
        try {
            $code = $this->compiler->compileTemplate($this);
        }
        catch (Exception $e) {
            // restore old timestamp in case of error
            if ($this->smarty->compile_locking && !$this->source->recompiled && $saved_timestamp) {
                touch($this->compiled->filepath, $saved_timestamp);
            }
            throw $e;
        }
        // compiling succeded
        if (!$this->source->recompiled && $this->compiler->write_compiled_code) {
            // write compiled template
            $_filepath = $this->compiled->filepath;
            if ($_filepath === false) {
                throw new SmartyException('getCompiledFilepath() did not return a destination to save the compiled template to');
            }
            Smarty_Internal_Write_File::writeFile($_filepath, $code, $this->smarty);
            $this->compiled->exists = true;
            $this->compiled->isCompiled = true;
        }
        // release compiler object to free memory
        unset($this->compiler);
    }
public function compileTemplateSource()
    {
        if (!$this->source->recompiled) {
            $this->properties['file_dependency'] = array();
            if ($this->source->components) {
                // for the extends resource the compiler will fill it
                // uses real resource for file dependency
                // $source = end($this->source->components);
                // $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type);
            } else {
                $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $this->source->type);
            }
        }
        // compile locking
        if ($this->smarty->compile_locking && !$this->source->recompiled) {
            if ($saved_timestamp = $this->compiled->timestamp) {
                touch($this->compiled->filepath);
            }
        }
        // call compiler
        try {
            $code = $this->compiler->compileTemplate($this);
        }
        catch (Exception $e) {
            // restore old timestamp in case of error
            if ($this->smarty->compile_locking && !$this->source->recompiled && $saved_timestamp) {
                touch($this->compiled->filepath, $saved_timestamp);
            }
            throw $e;
        }
        // compiling succeded
        if (!$this->source->recompiled && $this->compiler->write_compiled_code) {
            // write compiled template
            $_filepath = $this->compiled->filepath;
            if ($_filepath === false) {
                throw new SmartyException('getCompiledFilepath() did not return a destination to save the compiled template to');
            }
            Smarty_Internal_Write_File::writeFile($_filepath, $code, $this->smarty);
            $this->compiled->exists = true;
            $this->compiled->isCompiled = true;
        }
        // release compiler object to free memory
        unset($this->compiler);
    }
public function compileTemplateSource ( ) { if ( ! $ this -> source -> recompiled ) { $ this -> properties [ 'file_dependency' ] = array ( ) ; if ( $ this -> source -> components ) { // for the extends resource the compiler will fill it // uses real resource for file dependency // $source = end($this->source->components); // $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type); } else { $ this -> properties [ 'file_dependency' ] [ $ this -> source -> uid ] = array ( $ this -> source -> filepath , $ this -> source -> timestamp , $ this -> source -> type ) ; } } // compile locking if ( $ this -> smarty -> compile_locking && ! $ this -> source -> recompiled ) { if ( $ saved_timestamp = $ this -> compiled -> timestamp ) { touch ( $ this -> compiled -> filepath ) ; } } // call compiler try { $ code = $ this -> compiler -> compileTemplate ( $ this ) ; } catch ( Exception $ e ) { // restore old timestamp in case of error if ( $ this -> smarty -> compile_locking && ! $ this -> source -> recompiled && $ saved_timestamp ) { touch ( $ this -> compiled -> filepath , $ saved_timestamp ) ; } throw $ e ; } // compiling succeded if ( ! $ this -> source -> recompiled && $ this -> compiler -> write_compiled_code ) { // write compiled template $ _filepath = $ this -> compiled -> filepath ; if ( $ _filepath === false ) { throw new SmartyException ( 'getCompiledFilepath() did not return a destination to save the compiled template to' ) ; } Smarty_Internal_Write_File :: writeFile ( $ _filepath , $ code , $ this -> smarty ) ; $ this -> compiled -> exists = true ; $ this -> compiled -> isCompiled = true ; } // release compiler object to free memory unset ( $ this -> compiler ) ; }
Compiles the template
If the template is not evaluated the compiled template is saved on disk
Compiles the template If the template is not evaluated the compiled template is saved on disk