当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Write_File::writeFile方法代码示例

本文整理汇总了PHP中Smarty_Internal_Write_File::writeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Write_File::writeFile方法的具体用法?PHP Smarty_Internal_Write_File::writeFile怎么用?PHP Smarty_Internal_Write_File::writeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty_Internal_Write_File的用法示例。


在下文中一共展示了Smarty_Internal_Write_File::writeFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeCachedContent

 /**
  * Writes the rendered template output to cache file
  * 
  * @param object $template current template
  * @return boolean status
  */
 public function writeCachedContent($template, $content)
 {
     if (!$template->isEvaluated()) {
         return Smarty_Internal_Write_File::writeFile($template->getCachedFilepath(), $content, $this->smarty);
     } else {
         return false;
     }
 }
开发者ID:k9lis,项目名称:cms,代码行数:14,代码来源:smarty_internal_cacheresource_file.php

示例2: compileConfigSource

 public function compileConfigSource()
 {
     if (!is_object($this->compiler_object)) {
         $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);
     }
     if ($this->smarty->compile_locking) {
         if ($saved_timestamp = $this->getCompiledTimestamp()) {
             touch($this->getCompiledFilepath());
         }
     }
     try {
         $this->compiler_object->compileSource($this);
     } catch (Exception $e) {
         if ($this->smarty->compile_locking && $saved_timestamp) {
             touch($this->getCompiledFilepath(), $saved_timestamp);
         }
         throw $e;
     }
     Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:20,代码来源:smarty_internal_config.php

示例3: compileTemplateSource

 public function compileTemplateSource()
 {
     if (!$this->source->recompiled) {
         $this->properties['file_dependency'] = array();
         if ($this->source->components) {
             $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);
         }
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_compile($this);
     }
     if ($this->smarty->compile_locking && !$this->source->recompiled) {
         if ($saved_timestamp = $this->compiled->timestamp) {
             touch($this->compiled->filepath);
         }
     }
     try {
         $code = $this->compiler->compileTemplate($this);
     } catch (Exception $e) {
         if ($this->smarty->compile_locking && !$this->source->recompiled && $saved_timestamp) {
             touch($this->compiled->filepath, $saved_timestamp);
         }
         throw $e;
     }
     if (!$this->source->recompiled && $this->compiler->write_compiled_code) {
         $_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;
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_compile($this);
     }
     unset($this->compiler);
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:41,代码来源:smarty_internal_template.php

示例4: compileTemplateSource

 /**
  * Compiles the template
  *
  * If the template is not evaluated the compiled template is saved on disk
  */
 public function compileTemplateSource()
 {
     if (!$this->source->recompiled) {
         $this->properties['file_dependency'] = array();
         if ($this->source->components) {
             // 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);
         }
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_compile($this);
     }
     // 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;
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_compile($this);
     }
     // release compiler object to free memory
     unset($this->compiler);
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:53,代码来源:smarty_internal_template.php

示例5: writeCachedContent

 /**
  * Writes the rendered template output to cache file
  *
  * @param object $_template current template
  * @return boolean status
  */
 public function writeCachedContent($_template, $content)
 {
     if (!$_template->resource_object->isEvaluated) {
         if (Smarty_Internal_Write_File::writeFile($_template->getCachedFilepath(), $content, $this->smarty) === true) {
             $_template->cached_timestamp = filemtime($_template->getCachedFilepath());
             return true;
         }
     }
     return false;
 }
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:16,代码来源:smarty_internal_cacheresource_file.php

示例6: compileTemplateSource

 /**
  * Compiles the template
  * 
  * If the template is not evaluated the compiled template is saved on disk
  */
 public function compileTemplateSource()
 {
     if (!$this->resource_object->isEvaluated) {
         $this->properties['file_dependency'] = array();
         $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp(), $this->resource_type);
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_compile($this);
     }
     // compile template
     if (!is_object($this->compiler_object)) {
         // load compiler
         $this->smarty->loadPlugin($this->resource_object->compiler_class);
         $this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty);
     }
     // compile locking
     if ($this->smarty->compile_locking && !$this->resource_object->isEvaluated) {
         if ($saved_timestamp = $this->getCompiledTimestamp()) {
             touch($this->getCompiledFilepath());
         }
     }
     // call compiler
     try {
         $this->compiler_object->compileTemplate($this);
     } catch (Exception $e) {
         // restore old timestamp in case of error
         if ($this->smarty->compile_locking && !$this->resource_object->isEvaluated && $saved_timestamp) {
             touch($this->getCompiledFilepath(), $saved_timestamp);
         }
         throw $e;
     }
     // compiling succeded
     if (!$this->resource_object->isEvaluated && $this->write_compiled_code) {
         // write compiled template
         Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty);
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_compile($this);
     }
     // release objects to free memory
     Smarty_Internal_TemplateCompilerBase::$_tag_objects = array();
     unset($this->compiler_object->parser->root_buffer, $this->compiler_object->parser->current_buffer, $this->compiler_object->parser, $this->compiler_object->lex, $this->compiler_object->template, $this->compiler_object);
 }
开发者ID:jiatower,项目名称:php,代码行数:48,代码来源:smarty_internal_template.php

示例7: compileConfigSource

 /**
  * Compiles the config files
  *
  * @throws Exception
  */
 public function compileConfigSource()
 {
     // compile template
     if (!is_object($this->compiler_object)) {
         // load compiler
         $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);
     }
     // compile locking
     if ($this->smarty->compile_locking) {
         if ($saved_timestamp = $this->getCompiledTimestamp()) {
             touch($this->getCompiledFilepath());
         }
     }
     // call compiler
     try {
         $this->compiler_object->compileSource($this);
     } catch (Exception $e) {
         // restore old timestamp in case of error
         if ($this->smarty->compile_locking && $saved_timestamp) {
             touch($this->getCompiledFilepath(), $saved_timestamp);
         }
         throw $e;
     }
     // compiling succeeded
     // write compiled template
     Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);
 }
开发者ID:huwenshu,项目名称:dding,代码行数:32,代码来源:smarty_internal_config.php

示例8: writeCachedContent

 /**
  * Write the rendered template output to cache
  *
  * @param Smarty_Internal_Template $_template template object
  * @param string                   $content   content to cache
  *
  * @return boolean success
  */
 public function writeCachedContent(Smarty_Internal_Template $_template, $content)
 {
     $obj = new Smarty_Internal_Write_File();
     if ($obj->writeFile($_template->cached->filepath, $content, $_template->smarty) === true) {
         if (function_exists('opcache_invalidate')) {
             opcache_invalidate($_template->cached->filepath);
         }
         $cached = $_template->cached;
         $cached->timestamp = $cached->exists = is_file($cached->filepath);
         if ($cached->exists) {
             $cached->timestamp = filemtime($cached->filepath);
             return true;
         }
     }
     return false;
 }
开发者ID:JimChenAnother,项目名称:notebook,代码行数:24,代码来源:smarty_internal_cacheresource_file.php

示例9: write

 /**
  * Write compiled code by handler
  * @param Smarty_Internal_Template $_template template object
  * @param string $code compiled code
  * @return boolean success
  */
 public function write(Smarty_Internal_Template $_template, $code)
 {
     if (!$_template->source->recompiled) {
         $obj = new Smarty_Internal_Write_File();
         if ($obj->writeFile($this->filepath, $code, $_template->smarty) === TRUE) {
             $this->timestamp = $this->exists = is_file($this->filepath);
             if ($this->exists) {
                 $this->timestamp = @filemtime($this->filepath);
                 return TRUE;
             }
         }
         return FALSE;
     } else {
         $this->code = $code;
     }
     $this->timestamp = time();
     $this->exists = TRUE;
     return TRUE;
 }
开发者ID:rendix2,项目名称:QW_MVS,代码行数:25,代码来源:smarty_template_compiled.php

示例10: write

 /**
  * Write compiled code by handler
  *
  * @param Smarty_Internal_Template $_template template object
  * @param string                   $code      compiled code
  *
  * @return boolean success
  */
 public function write(Smarty_Internal_Template $_template, $code)
 {
     if (!$_template->source->recompiled) {
         if (Smarty_Internal_Write_File::writeFile($this->filepath, $code, $_template->smarty) === true) {
             $this->timestamp = @filemtime($this->filepath);
             $this->exists = !!$this->timestamp;
             if ($this->exists) {
                 return true;
             }
         }
         return false;
     } else {
         $this->code = $code;
     }
     $this->timestamp = time();
     $this->exists = true;
     return true;
 }
开发者ID:Tramp1357,项目名称:wood,代码行数:26,代码来源:smarty_template_compiled.php

示例11: compileTemplateSource

 /**
  * Compiles the template
  * 
  * If the template is not evaluated the compiled template is saved on disk
  */
 public function compileTemplateSource()
 {
     if (!$this->resource_object->isEvaluated) {
         $this->properties['file_dependency'] = array();
         $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp());
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_compile($this);
     }
     // compile template
     if (!is_object($this->compiler_object)) {
         // load compiler
         $this->smarty->loadPlugin($this->resource_object->compiler_class);
         $this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty);
     }
     // call compiler
     if ($this->compiler_object->compileTemplate($this)) {
         // compiling succeded
         if (!$this->resource_object->isEvaluated) {
             // write compiled template
             Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty);
         }
     } else {
         // error compiling template
         throw new Exception("Error compiling template {$this->getTemplateFilepath()}");
         return false;
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_compile($this);
     }
 }
开发者ID:purna89,项目名称:TrellisDesk,代码行数:36,代码来源:smarty_internal_template.php

示例12: write

 /**
  * Write compiled code by handler
  *
  * @param Smarty_Internal_Template $_template template object
  * @param string                   $code      compiled code
  *
  * @return boolean success
  */
 public function write(Smarty_Internal_Template $_template, $code)
 {
     if (!$_template->source->handler->recompiled) {
         $obj = new Smarty_Internal_Write_File();
         if ($obj->writeFile($this->filepath, $code, $_template->smarty) === true) {
             $this->timestamp = $this->exists = is_file($this->filepath);
             if ($this->exists) {
                 $this->timestamp = filemtime($this->filepath);
                 return true;
             }
         }
         return false;
     } else {
         $this->content = $code;
     }
     $this->timestamp = time();
     $this->exists = true;
     return true;
 }
开发者ID:smart-com,项目名称:bike-cms,代码行数:27,代码来源:smarty_template_compiled.php

示例13: writeCachedContent

 /**
  * Write the rendered template output to cache
  * @param Smarty_Internal_Template $_template template object
  * @param string $content content to cache
  * @return boolean success
  */
 public function writeCachedContent(Smarty_Internal_Template $_template, $content)
 {
     $obj = new Smarty_Internal_Write_File();
     if ($obj->writeFile($_template->cached->filepath, $content, $_template->smarty) === TRUE) {
         $cached = $_template->cached;
         $cached->timestamp = $cached->exists = is_file($cached->filepath);
         if ($cached->exists) {
             $cached->timestamp = filemtime($cached->filepath);
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:rendix2,项目名称:QW_MVS,代码行数:19,代码来源:smarty_internal_cacheresource_file.php

示例14: compileConfigSource

 /**
  * Compiles the config files
  */
 public function compileConfigSource()
 {
     // compile template
     if (!is_object($this->compiler_object)) {
         // load compiler
         $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);
     }
     // call compiler
     if ($this->compiler_object->compileSource($this)) {
         // compiling succeded
         // write compiled template
         Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);
         // make template and compiled file timestamp match
         touch($this->getCompiledFilepath(), $this->getTimestamp());
     } else {
         // error compiling template
         throw new Exception("Error compiling template {$this->getConfigFilepath()}");
         return false;
     }
 }
开发者ID:k9lis,项目名称:cms,代码行数:23,代码来源:smarty_internal_config.php

示例15: compileTemplateSource

 /**
  * Compiles the template
  * 
  * If the template is not evaluated the compiled template is saved on disk
  */
 public function compileTemplateSource()
 {
     if (!$this->isEvaluated) {
         $this->properties['file_dependency']['F' . abs(crc32($this->getTemplateFilepath()))] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp());
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::start_compile($this);
     }
     // compile template
     if (!is_object($this->compiler_object)) {
         // load compiler
         $this->smarty->loadPlugin($this->resource_object->compiler_class);
         $this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty);
         // load cacher
         if ($this->caching) {
             $this->smarty->loadPlugin($this->cacher_class);
             $this->cacher_object = new $this->cacher_class($this->smarty);
         }
     }
     // call compiler
     if ($this->compiler_object->compileTemplate($this)) {
         // compiling succeded
         if (!$this->isEvaluated()) {
             // write compiled template
             Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty);
             // make template and compiled file timestamp match
             /**
                             $this->compiled_timestamp = null;
                             touch($this->getCompiledFilepath(), $this->getTemplateTimestamp()); 
                             // daylight saving time problem on windows
                             if ($this->template_timestamp != $this->getCompiledTimestamp()) {
                                 touch($this->getCompiledFilepath(), 2 * $this->template_timestamp - $this->compiled_timestamp);
                             }
             **/
         }
     } else {
         // error compiling template
         throw new Exception("Error compiling template {$this->getTemplateFilepath()}");
         return false;
     }
     if ($this->smarty->debugging) {
         Smarty_Internal_Debug::end_compile($this);
     }
 }
开发者ID:k9lis,项目名称:cms,代码行数:49,代码来源:smarty_internal_template.php


注:本文中的Smarty_Internal_Write_File::writeFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。