cvs: smarty /libs Smarty.class.php /libs/core core.assemble_auto_filename.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1063546635@cvsserver> |
messju Sun Sep 14 09:37:15 2003 EDT
Removed files:
/smarty/libs/core core.assemble_auto_filename.php
Modified files:
/smarty/libs Smarty.class.php
Log:
removed auto-filenames from path-cache. merged assemble_auto_filename
back into Smarty::_get_auto_filename()
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.445 smarty/libs/Smarty.class.php:1.446
--- smarty/libs/Smarty.class.php:1.445 Fri Sep 12 09:40:53 2003
+++ smarty/libs/Smarty.class.php Sun Sep 14 09:37:14 2003
@@ -43,7 +43,7 @@
* @version 2.6.0-RC1-cvs
*/
-/* $Id: Smarty.class.php,v 1.445 2003/09/12 13:40:53 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.446 2003/09/14 13:37:14 messju Exp $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -1853,26 +1853,39 @@
* @return string
* @staticvar string|null
* @staticvar string|null
- */
+ */
function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
{
- $_cache_paths_key = $auto_base . '/' . $auto_source . '/' . $auto_id;
- if (isset($this->_cache_paths['auto_file'][$_cache_paths_key])) {
- return $this->_cache_paths['auto_file'][$_cache_paths_key];
- }
+ $_compile_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
- $_params = array('auto_base' => $auto_base, 'auto_source' => $auto_source, 'auto_id' => $auto_id);
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.assemble_auto_filename.php');
- $_return = smarty_core_assemble_auto_filename($_params, $this);
+ if(@is_dir($auto_base)) {
+ $_return = $auto_base . DIRECTORY_SEPARATOR;
+ } else {
+ // auto_base not found, try include_path
+ $_params = array('file_path' => $auto_base);
+ require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');
+ smarty_core_get_include_path($_params, $smarty);
+ $_return = isset($_params['new_file_path']) ? $_params['new_file_path'] . DIRECTORY_SEPARATOR : null;
+ }
+
+ if(isset($auto_id)) {
+ // make auto_id safe for directory names
+ $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
+ // split into separate directories
+ $_return .= $auto_id . $_compile_dir_sep;
+ }
+
+ if(isset($auto_source)) {
+ // make source name safe for filename
+ $_filename = urlencode(basename($auto_source));
+ $_crc32 = crc32($auto_source) . $_compile_dir_sep;
+ // prepend %% to avoid name conflicts with
+ // with $params['auto_id'] names
+ $_crc32 = '%%' . substr($_crc32,0,3) . $_compile_dir_sep . '%%' . $_crc32;
+ $_return .= $_crc32 . $_filename;
+ }
- if($_return !== false) {
- $this->_cache_paths['auto_file'][$_cache_paths_key] = $_return;
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_cache_paths_file.php');
- smarty_core_write_cache_paths_file(null, $this);
- return $_return;
- }
-
- return false;
+ return $_return;
}
/**
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php