cvs: smarty /libs/core core.display_debug_console.php core.process_cached_inserts.php core.process_compiled_include.php core.run_insert_handler.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1056931708@cvsserver>
messju		Sun Jun 29 20:08:28 2003 EDT

  Modified files:              
    /smarty/libs/core	core.display_debug_console.php 
                     	core.process_cached_inserts.php 
                     	core.process_compiled_include.php 
                     	core.run_insert_handler.php 
  Log:
  extincting $this out of smarty_core_*-functions

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
messju-20030629200828.txt (text/plain, 10.8 KB)
Index: smarty/libs/core/core.display_debug_console.php
diff -u smarty/libs/core/core.display_debug_console.php:1.4 smarty/libs/core/core.display_debug_console.php:1.5
--- smarty/libs/core/core.display_debug_console.php:1.4	Fri Jun 20 16:01:10 2003
+++ smarty/libs/core/core.display_debug_console.php	Sun Jun 29 20:08:28 2003
@@ -14,43 +14,43 @@
  * @param array Format: null
  * @param Smarty
  */
-function smarty_core_display_debug_console($params, &$this)
+function smarty_core_display_debug_console($params, &$smarty)
 {
 	// we must force compile the debug template in case the environment
 	// changed between separate applications.
 
-	if(empty($this->debug_tpl)) {
+	if(empty($smarty->debug_tpl)) {
 		// set path to debug template from SMARTY_DIR
-		$this->debug_tpl = SMARTY_DIR . 'debug.tpl';
-		if($this->security && is_file($this->debug_tpl)) {
-    		$this->secure_dir[] = $this->debug_tpl;
+		$smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
+		if($smarty->security && is_file($smarty->debug_tpl)) {
+    		$smarty->secure_dir[] = dirname(realpath($smarty->debug_tpl));
 		}
 	}
 
-	$_ldelim_orig = $this->left_delimiter;
-	$_rdelim_orig = $this->right_delimiter;    
+	$_ldelim_orig = $smarty->left_delimiter;
+	$_rdelim_orig = $smarty->right_delimiter;    
 
-	$this->left_delimiter = '{';
-	$this->right_delimiter = '}';
+	$smarty->left_delimiter = '{';
+	$smarty->right_delimiter = '}';
 
-	$_compile_id_orig = $this->_compile_id;
-	$this->_compile_id = null;
+	$_compile_id_orig = $smarty->_compile_id;
+	$smarty->_compile_id = null;
 
-	$_compile_path = $this->_get_compile_path($this->debug_tpl);
-	if ($this->_compile_resource($this->debug_tpl, $_compile_path))
+	$_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
+	if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
 	{
 		ob_start();
-		include($_compile_path);
+		$smarty->smarty_include($_compile_path);
 		$_results = ob_get_contents();
 		ob_end_clean();
 	} else {
 		$_results = '';
 	}
 	
-	$this->_compile_id = $_compile_id_orig;
+	$smarty->_compile_id = $_compile_id_orig;
 
-	$this->left_delimiter = $_ldelim_orig;
-	$this->right_delimiter = $_rdelim_orig;
+	$smarty->left_delimiter = $_ldelim_orig;
+	$smarty->right_delimiter = $_rdelim_orig;
 
 	return $_results;
 }
Index: smarty/libs/core/core.process_cached_inserts.php
diff -u smarty/libs/core/core.process_cached_inserts.php:1.3 smarty/libs/core/core.process_cached_inserts.php:1.4
--- smarty/libs/core/core.process_cached_inserts.php:1.3	Sat Jun 21 13:35:15 2003
+++ smarty/libs/core/core.process_cached_inserts.php	Sun Jun 29 20:08:28 2003
@@ -11,26 +11,26 @@
  * @param string $results
  * @return string
  */    
-function smarty_core_process_cached_inserts($params, &$this)
+function smarty_core_process_cached_inserts($params, &$smarty)
 {
-    preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
+    preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
                    $params['results'], $match);
     list($cached_inserts, $insert_args) = $match;
 
     for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
-        if ($this->debugging) {
+        if ($smarty->debugging) {
 			$_params = array();
 			require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
-            $debug_start_time = smarty_core_get_microtime($_params, $this);
+            $debug_start_time = smarty_core_get_microtime($_params, $smarty);
         }
 
         $args = unserialize($insert_args[$i]);
         $name = $args['name'];
 
         if (isset($args['script'])) {
-			$_params = array('resource_name' => $this->_dequote($args['script']));
+			$_params = array('resource_name' => $smarty->_dequote($args['script']));
 			require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');
-			if(!smarty_core_get_php_resource($_params, $this)) {
+			if(!smarty_core_get_php_resource($_params, $smarty)) {
 				return false;
 			}
 			$resource_type = $_params['resource_type'];
@@ -38,23 +38,23 @@
 
 
             if ($resource_type == 'file') {
-                include_once($php_resource);
+                $smarty->smarty_include($php_resource, true);
             } else {
-                eval($php_resource);
+                $smarty->smarty_eval($php_resource);
             }
         }
 
-        $function_name = $this->_plugins['insert'][$name][0];
-        $replace = $function_name($args, $this);
+        $function_name = $smarty->_plugins['insert'][$name][0];
+        $replace = $function_name($args, $smarty);
 
         $params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']);
-        if ($this->debugging) {
+        if ($smarty->debugging) {
 			$_params = array();
 			require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
-            $this->_smarty_debug_info[] = array('type'      => 'insert',
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
                                                 'filename'  => 'insert_'.$name,
-                                                'depth'     => $this->_inclusion_depth,
-                                                'exec_time' => smarty_core_get_microtime($_params, $this) - $debug_start_time);
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
         }
     }
 
Index: smarty/libs/core/core.process_compiled_include.php
diff -u smarty/libs/core/core.process_compiled_include.php:1.1 smarty/libs/core/core.process_compiled_include.php:1.2
--- smarty/libs/core/core.process_compiled_include.php:1.1	Wed Jun 18 19:01:42 2003
+++ smarty/libs/core/core.process_compiled_include.php	Sun Jun 29 20:08:28 2003
@@ -14,13 +14,13 @@
  * @return string
  */
  
-function smarty_core_process_compiled_include($params, &$this)
+function smarty_core_process_compiled_include($params, &$smarty)
 {
     $_return = $params['results'];
-    foreach ($this->_cache_serials as $_include_file_path=>$_cache_serial) {
-        include_once($_include_file_path);
+    foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) {
+        $smarty->smarty_include($_include_file_path, true);
         $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
-                                         array(&$this, '_process_compiled_include_callback'),
+                                         array(&$smarty, '_process_compiled_include_callback'),
                                          $_return);
     }
     return $_return;
Index: smarty/libs/core/core.run_insert_handler.php
diff -u smarty/libs/core/core.run_insert_handler.php:1.3 smarty/libs/core/core.run_insert_handler.php:1.4
--- smarty/libs/core/core.run_insert_handler.php:1.3	Sat Jun 21 13:35:15 2003
+++ smarty/libs/core/core.run_insert_handler.php	Sun Jun 29 20:08:28 2003
@@ -11,55 +11,55 @@
  * @param array $args
  * @return string
  */    
-function smarty_core_run_insert_handler($params, &$this)
+function smarty_core_run_insert_handler($params, &$smarty)
 {
 	
 	require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
-    if ($this->debugging) {
+    if ($smarty->debugging) {
 		$_params = array();
-        $_debug_start_time = smarty_core_get_microtime($_params, $this);
+        $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
     }
 
-    if ($this->caching) {
+    if ($smarty->caching) {
         $_arg_string = serialize($params['args']);
         $_name = $params['args']['name'];
-        if (!isset($this->_cache_info['insert_tags'][$_name])) {
-            $this->_cache_info['insert_tags'][$_name] = array('insert',
+        if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
+            $smarty->_cache_info['insert_tags'][$_name] = array('insert',
                                                              $_name,
-                                                             $this->_plugins['insert'][$_name][1],
-                                                             $this->_plugins['insert'][$_name][2],
+                                                             $smarty->_plugins['insert'][$_name][1],
+                                                             $smarty->_plugins['insert'][$_name][2],
                                                              !empty($params['args']['script']) ? true : false);
         }
-        return $this->_smarty_md5."{insert_cache $_arg_string}".$this->_smarty_md5;
+        return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
     } else {
         if (isset($params['args']['script'])) {				
-			$_params = array('resource_name' => $this->_dequote($params['args']['script']));
+			$_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
 			require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');
-			if(!smarty_core_get_php_resource($_params, $this)) {
+			if(!smarty_core_get_php_resource($_params, $smarty)) {
 				return false;
 			}
 
             if ($_params['resource_type'] == 'file') {
-                include_once($_params['php_resource']);
+                $smarty->smarty_include_once($_params['php_resource']);
             } else {
-                eval($_params['php_resource']);
+                $smarty->smarty_eval($_params['php_resource']);
             }
             unset($params['args']['script']);
         }
 
-        $_funcname = $this->_plugins['insert'][$params['args']['name']][0];
-        $_content = $_funcname($params['args'], $this);
-        if ($this->debugging) {
+        $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
+        $_content = $_funcname($params['args'], $smarty);
+        if ($smarty->debugging) {
 			$_params = array();
 			require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
-            $this->_smarty_debug_info[] = array('type'      => 'insert',
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
                                                 'filename'  => 'insert_'.$params['args']['name'],
-                                                'depth'     => $this->_inclusion_depth,
-                                                'exec_time' => smarty_core_get_microtime($_params, $this) - $_debug_start_time);
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
         }
 
         if (!empty($params['args']["assign"])) {
-            $this->assign($params['args']["assign"], $_content);
+            $smarty->assign($params['args']["assign"], $_content);
         } else {
             return $_content;
         }
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.