mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- Allow '://' URL syntax in template names of stream resources (Issue #129)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
@@ -1,36 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Resource Stream
|
||||
*
|
||||
* Implements the streams as resource for Smarty template
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
* Smarty Internal Plugin Resource Stream
|
||||
*
|
||||
* Implements the streams as resource for Smarty template
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Resource Stream
|
||||
*
|
||||
* Implements the streams as resource for Smarty template
|
||||
*
|
||||
* @link http://php.net/streams
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
*/
|
||||
* Smarty Internal Plugin Resource Stream
|
||||
*
|
||||
* Implements the streams as resource for Smarty template
|
||||
*
|
||||
* @link http://php.net/streams
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
*/
|
||||
class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled {
|
||||
|
||||
/**
|
||||
* populate Source Object with meta data from Resource
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
* @return void
|
||||
*/
|
||||
* populate Source Object with meta data from Resource
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
* @return void
|
||||
*/
|
||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
|
||||
{
|
||||
$source->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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user