From b24eada1473f25a1c99e9f549556ec9d22550f64 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Sun, 6 Jan 2013 19:22:48 +0000 Subject: [PATCH] - Allow '://' URL syntax in template names of stream resources (Issue #129) --- change_log.txt | 3 + .../smarty_internal_resource_stream.php | 80 ++++++++++--------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/change_log.txt b/change_log.txt index ca757ccf..518bcaf0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +06.01.2013 +- Allow '://' URL syntax in template names of stream resources (Issue #129) + 27.11.2012 - bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) diff --git a/libs/sysplugins/smarty_internal_resource_stream.php b/libs/sysplugins/smarty_internal_resource_stream.php index 85698c23..58086c17 100644 --- a/libs/sysplugins/smarty_internal_resource_stream.php +++ b/libs/sysplugins/smarty_internal_resource_stream.php @@ -1,36 +1,40 @@ filepath = str_replace(':', '://', $source->resource); + if(strpos($source->resource, '://') !== false) { + $source->filepath = $source->resource; + } else { + $source->filepath = str_replace(':', '://', $source->resource); + } $source->uid = false; $source->content = $this->getContent($source); $source->timestamp = false; @@ -38,12 +42,12 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled { } /** - * Load template's source from stream into current template object - * - * @param Smarty_Template_Source $source source object - * @return string template source - * @throws SmartyException if source cannot be loaded - */ + * Load template's source from stream into current template object + * + * @param Smarty_Template_Source $source source object + * @return string template source + * @throws SmartyException if source cannot be loaded + */ public function getContent(Smarty_Template_Source $source) { $t = ''; @@ -59,18 +63,16 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled { return false; } } - + /** - * modify resource_name according to resource handlers specifications - * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @return string unique resource name - */ + * modify resource_name according to resource handlers specifications + * + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @return string unique resource name + */ protected function buildUniqueResourceName(Smarty $smarty, $resource_name) { return get_class($this) . '#' . $resource_name; } } - -?> \ No newline at end of file