cvs: smarty /libs Smarty.class.php Smarty_Compiler.class.php /libs/internals core.write_compiled_include.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1096644405@cvsserver>
messju		Fri Oct  1 11:26:45 2004 EDT

  Modified files:              
    /smarty/libs	Smarty.class.php Smarty_Compiler.class.php 
    /smarty/libs/internals	core.write_compiled_include.php 
  Log:
  - better header for compiled includes (more in line with compiled
  templates)
  
  - reuse cache_serials if a file is compiled more than once in one
    process (force_compile)
  
  - don't print nocache-delimiters wenn already inside
  process_cached_inserts()
  
  
  
http://cvs.php.net/diff.php/smarty/libs/Smarty.class.php?r1=1.503&r2=1.504&ty=u
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.503 smarty/libs/Smarty.class.php:1.504
--- smarty/libs/Smarty.class.php:1.503	Wed Sep 29 03:23:45 2004
+++ smarty/libs/Smarty.class.php	Fri Oct  1 11:26:44 2004
@@ -30,7 +30,7 @@
  * @version 2.6.6-dev
  */
 
-/* $Id: Smarty.class.php,v 1.503 2004/09/29 07:23:45 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.504 2004/10/01 15:26:44 messju Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -1419,7 +1419,7 @@
             // if a _cache_serial was set, we also have to write an include-file:
             if ($this->_cache_include_info) {
                 require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
-                smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content)),  $this);
+                smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)),  $this);
             }
 
             $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
@@ -1476,7 +1476,9 @@
         $smarty_compiler->_config            = $this->_config;
         $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;
 
-        $smarty_compiler->_cache_serial = null;
+        if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
+            $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
+        }
         $smarty_compiler->_cache_include = $cache_include_path;
 
 
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.349&r2=1.350&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.349 smarty/libs/Smarty_Compiler.class.php:1.350
--- smarty/libs/Smarty_Compiler.class.php:1.349	Wed Sep 29 03:16:17 2004
+++ smarty/libs/Smarty_Compiler.class.php	Fri Oct  1 11:26:44 2004
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.349 2004/09/29 07:16:17 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.350 2004/10/01 15:26:44 messju Exp $ */
 
 /**
  * Template compiling class
@@ -2161,7 +2161,7 @@
         if ($_cacheable
             || 0<$this->_cacheable_state++) return '';
         if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty'));
-        $_ret = 'if ($this->caching) { echo \'{nocache:'
+        $_ret = 'if ($this->caching && !$this->_cache_including) { echo \'{nocache:'
             . $this->_cache_serial . '#' . $this->_nocache_count
             . '}\';}';
         return $_ret;
@@ -2178,7 +2178,7 @@
         $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
         if ($_cacheable
             || --$this->_cacheable_state>0) return '';
-        return 'if ($this->caching) { echo \'{/nocache:'
+        return 'if ($this->caching && !$this->_cache_including) { echo \'{/nocache:'
             . $this->_cache_serial . '#' . ($this->_nocache_count++)
             . '}\';}';
     }
http://cvs.php.net/diff.php/smarty/libs/internals/core.write_compiled_include.php?r1=1.2&r2=1.3&ty=u
Index: smarty/libs/internals/core.write_compiled_include.php
diff -u smarty/libs/internals/core.write_compiled_include.php:1.2 smarty/libs/internals/core.write_compiled_include.php:1.3
--- smarty/libs/internals/core.write_compiled_include.php:1.2	Fri Sep 17 22:09:35 2004
+++ smarty/libs/internals/core.write_compiled_include.php	Fri Oct  1 11:26:44 2004
@@ -15,8 +15,8 @@
 
 function smarty_core_write_compiled_include($params, &$smarty)
 {
-    $_tag_start = 'if \(\$this->caching\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\';\}';
-    $_tag_end   = 'if \(\$this->caching\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\';\}';
+    $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\';\}';
+    $_tag_end   = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\';\}';
 
     preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
                    $params['compiled_content'], $_match_source, PREG_SET_ORDER);
@@ -25,7 +25,8 @@
     if (count($_match_source)==0) return;
 
     // convert the matched php-code to functions
-    $_include_compiled = "<?php /* funky header here */\n\n";
+    $_include_compiled =  "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
+    $_include_compiled .= "         compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n";
 
     $_compile_path = $params['include_file_path'];
 

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.