fixing previous commit

This commit is contained in:
rodneyrehm
2011-10-14 16:22:00 +00:00
parent 8a82d84861
commit ef32ed830c
2 changed files with 4 additions and 2 deletions

View File

@@ -1203,8 +1203,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
public function loadPlugin($plugin_name, $check = true) public function loadPlugin($plugin_name, $check = true)
{ {
// if function or class exists, exit silently (already loaded) // if function or class exists, exit silently (already loaded)
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
return true; return true;
}
// Plugin name is expected to be: Smarty_[Type]_[Name] // Plugin name is expected to be: Smarty_[Type]_[Name]
$_name_parts = explode('_', $plugin_name, 3); $_name_parts = explode('_', $plugin_name, 3);
// class name must have three parts to be valid plugin // class name must have three parts to be valid plugin
@@ -1225,6 +1226,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
} }
// plugin filename is expected to be: [type].[name].php // plugin filename is expected to be: [type].[name].php
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php"; $_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
// loop through plugin dirs and find the plugin // loop through plugin dirs and find the plugin
foreach($this->getPluginsDir() as $_plugin_dir) { foreach($this->getPluginsDir() as $_plugin_dir) {
$names = array( $names = array(

View File

@@ -199,7 +199,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
$mtime = $this->fetchTimestamp($id, $name, null, null); $mtime = $this->fetchTimestamp($id, $name, null, null);
if ($mtime === null) { if ($mtime === null) {
$this->fetch($id, $name, null, null, &$content, &$mtime); $this->fetch($id, $name, null, null, $content, $mtime);
} }
return $mtime && time() - $mtime < $smarty->locking_timeout; return $mtime && time() - $mtime < $smarty->locking_timeout;