summaryrefslogtreecommitdiff
path: root/lib/smarty3/sysplugins/smarty_resource_custom.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_resource_custom.php')
-rw-r--r--lib/smarty3/sysplugins/smarty_resource_custom.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/smarty3/sysplugins/smarty_resource_custom.php b/lib/smarty3/sysplugins/smarty_resource_custom.php
index 619f2d6..8d66be3 100644
--- a/lib/smarty3/sysplugins/smarty_resource_custom.php
+++ b/lib/smarty3/sysplugins/smarty_resource_custom.php
@@ -30,7 +30,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
* {@internal implementing this method is optional.
* Only implement it if modification times can be accessed faster than loading the complete template source.}}
*
- * @param string $name template name
+ * @param string $name template name
*
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
@@ -47,9 +47,8 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
*/
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
- $source->filepath = $source->type . ':' . $source->name;
+ $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25);
$source->uid = sha1($source->type . ':' . $source->name);
-
$mtime = $this->fetchTimestamp($source->name);
if ($mtime !== null) {
$source->timestamp = $mtime;
@@ -66,7 +65,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
/**
* Load template's source into current template object
*
- * @param Smarty_Template_Source $source source object
+ * @param Smarty_Template_Source $source source object
*
* @return string template source
* @throws SmartyException if source cannot be loaded
@@ -77,19 +76,18 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
if (isset($content)) {
return $content;
}
-
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
/**
* Determine basename for compiled filename
*
- * @param Smarty_Template_Source $source source object
+ * @param Smarty_Template_Source $source source object
*
* @return string resource's basename
*/
public function getBasename(Smarty_Template_Source $source)
{
- return basename($source->name);
+ return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25));
}
}