cvs: smarty / NEWS /libs Smarty.class.php Smarty_Compiler.class.php /libs/core core.get_php_resource.php core.load_plugins.php core.load_resource_plugin.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1063374054@cvsserver> |
messju Fri Sep 12 09:40:54 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty.class.php Smarty_Compiler.class.php
/smarty/libs/core core.get_php_resource.php core.load_plugins.php
core.load_resource_plugin.php
Log:
remove Smarty::_plugin_implementation_exists() - use php's native
is_callable()
Index: smarty/NEWS
diff -u smarty/NEWS:1.394 smarty/NEWS:1.395
--- smarty/NEWS:1.394 Tue Sep 2 06:29:49 2003
+++ smarty/NEWS Fri Sep 12 09:40:52 2003
@@ -1,3 +1,4 @@
+ - remove Smarty::_plugin_implementation_exists() - use is_callable() (messju)
- ignore {strip}/{/strip) inside {strip}-blocks (messju)
- fixed removal of leading/trailing newlines in {strip}-blocks (messju)
- fixed proper escaping of " and ' with escape:javascript (messju)
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.444 smarty/libs/Smarty.class.php:1.445
--- smarty/libs/Smarty.class.php:1.444 Thu Sep 11 03:25:32 2003
+++ smarty/libs/Smarty.class.php Fri Sep 12 09:40:53 2003
@@ -43,7 +43,7 @@
* @version 2.6.0-RC1-cvs
*/
-/* $Id: Smarty.class.php,v 1.444 2003/09/11 07:25:32 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.445 2003/09/12 13:40:53 messju Exp $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -1667,7 +1667,7 @@
if (!$_return) {
// see if we can get a template with the default template handler
if (!empty($this->default_template_handler_func)) {
- if (!$this->_plugin_implementation_exists($this->default_template_handler_func)) {
+ if (!is_callable($this->default_template_handler_func)) {
$this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
} else {
$_return = call_user_func_array(
@@ -1932,16 +1932,6 @@
} else {
trigger_error("Smarty error: $error_msg$info", $error_type);
}
- }
-
- /**
- * check if the function or method exists
- * @return bool
- */
- function _plugin_implementation_exists($function)
- {
- return (is_array($function)) ?
- method_exists($function[0], $function[1]) || (in_array(strtolower($function[1]), (array)get_class_methods($function[0]))) : function_exists($function);
}
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.281 smarty/libs/Smarty_Compiler.class.php:1.282
--- smarty/libs/Smarty_Compiler.class.php:1.281 Tue Sep 2 06:29:50 2003
+++ smarty/libs/Smarty_Compiler.class.php Fri Sep 12 09:40:53 2003
@@ -39,7 +39,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.281 2003/09/02 10:29:50 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.282 2003/09/12 13:40:53 messju Exp $ */
/**
* Template compiling class
@@ -250,7 +250,7 @@
if (count($this->_plugins['prefilter']) > 0) {
foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
if ($prefilter === false) continue;
- if ($prefilter[3] || $this->_plugin_implementation_exists($prefilter[0])) {
+ if ($prefilter[3] || is_callable($prefilter[0])) {
$source_content = call_user_func_array($prefilter[0],
array($source_content, &$this));
$this->_plugins['prefilter'][$filter_name][3] = true;
@@ -360,7 +360,7 @@
if (count($this->_plugins['postfilter']) > 0) {
foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
if ($postfilter === false) continue;
- if ($postfilter[3] || $this->_plugin_implementation_exists($postfilter[0])) {
+ if ($postfilter[3] || is_callable($postfilter[0])) {
$compiled_content = call_user_func_array($postfilter[0],
array($compiled_content, &$this));
$this->_plugins['postfilter'][$filter_name][3] = true;
@@ -571,7 +571,7 @@
if (isset($this->_plugins['compiler'][$tag_command])) {
$found = true;
$plugin_func = $this->_plugins['compiler'][$tag_command][0];
- if (!$this->_plugin_implementation_exists($plugin_func)) {
+ if (!is_callable($plugin_func)) {
$message = "compiler function '$tag_command' is not implemented";
$have_function = false;
}
@@ -586,7 +586,7 @@
include_once $plugin_file;
$plugin_func = 'smarty_compiler_' . $tag_command;
- if (!$this->_plugin_implementation_exists($plugin_func)) {
+ if (!is_callable($plugin_func)) {
$message = "plugin function $plugin_func() not found in $plugin_file\n";
$have_function = false;
} else {
@@ -646,7 +646,7 @@
if (isset($this->_plugins['block'][$tag_command])) {
$found = true;
$plugin_func = $this->_plugins['block'][$tag_command][0];
- if (!$this->_plugin_implementation_exists($plugin_func)) {
+ if (!is_callable($plugin_func)) {
$message = "block function '$tag_command' is not implemented";
$have_function = false;
}
Index: smarty/libs/core/core.get_php_resource.php
diff -u smarty/libs/core/core.get_php_resource.php:1.5 smarty/libs/core/core.get_php_resource.php:1.6
--- smarty/libs/core/core.get_php_resource.php:1.5 Wed Jul 23 12:14:47 2003
+++ smarty/libs/core/core.get_php_resource.php Fri Sep 12 09:40:53 2003
@@ -40,7 +40,7 @@
}
} else if ($params['resource_type'] != 'file') {
$_template_source = null;
- $_readable = $smarty->_plugin_implementation_exists($smarty->_plugins['resource'][$params['resource_type']][0][0])
+ $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
&& call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
array($params['resource_name'], &$_template_source, &$smarty));
}
Index: smarty/libs/core/core.load_plugins.php
diff -u smarty/libs/core/core.load_plugins.php:1.5 smarty/libs/core/core.load_plugins.php:1.6
--- smarty/libs/core/core.load_plugins.php:1.5 Tue Aug 5 14:27:14 2003
+++ smarty/libs/core/core.load_plugins.php Fri Sep 12 09:40:53 2003
@@ -32,7 +32,7 @@
*/
if (isset($_plugin)) {
if (empty($_plugin[3])) {
- if (!$smarty->_plugin_implementation_exists($_plugin[0])) {
+ if (!is_callable($_plugin[0])) {
$smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
} else {
$_plugin[1] = $_tpl_file;
Index: smarty/libs/core/core.load_resource_plugin.php
diff -u smarty/libs/core/core.load_resource_plugin.php:1.3 smarty/libs/core/core.load_resource_plugin.php:1.4
--- smarty/libs/core/core.load_resource_plugin.php:1.3 Sun Jun 29 08:25:03 2003
+++ smarty/libs/core/core.load_resource_plugin.php Fri Sep 12 09:40:53 2003
@@ -27,7 +27,7 @@
if (!$_plugin[1] && count($_plugin[0])) {
$_plugin[1] = true;
foreach ($_plugin[0] as $_plugin_func) {
- if (!$smarty->_plugin_implementation_exists($_plugin_func)) {
+ if (!is_callable($_plugin_func)) {
$_plugin[1] = false;
break;
}
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php