當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Smarty_Internal_Write_File類代碼示例

本文整理匯總了PHP中Smarty_Internal_Write_File的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Write_File類的具體用法?PHP Smarty_Internal_Write_File怎麽用?PHP Smarty_Internal_Write_File使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Smarty_Internal_Write_File類的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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。