From b0a04dab2757b6d3ff20f82ac8215c161a6eb030 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 6 Aug 2008 11:37:40 +0000 Subject: Update: Created phpBB3 plugin Subscription File Also started on the plugin's update library, currently uses a function identical to the library's. May want to change it so that it does more post-object work than the foreign function has to. Refs #7 --- .../trunk/root/includes/xmlrpc/is_callable.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 update/plugin/phpBB3/trunk/root/includes/xmlrpc/is_callable.php (limited to 'update/plugin/phpBB3/trunk/root/includes/xmlrpc/is_callable.php') diff --git a/update/plugin/phpBB3/trunk/root/includes/xmlrpc/is_callable.php b/update/plugin/phpBB3/trunk/root/includes/xmlrpc/is_callable.php new file mode 100644 index 0000000..b769c41 --- /dev/null +++ b/update/plugin/phpBB3/trunk/root/includes/xmlrpc/is_callable.php @@ -0,0 +1,53 @@ + + * @version $Id: is_callable.php,v 1.3 2006/08/21 14:03:15 ggiunta Exp $ + * @since PHP 4.0.6 + * @require PHP 4.0.0 (true, false, etc...) + * @todo add the 3rd parameter syntax... + */ +if (!function_exists('is_callable')) { + function is_callable($var, $syntax_only=false) + { + if ($syntax_only) + { + /* from The Manual: + * If the syntax_only argument is TRUE the function only verifies + * that var might be a function or method. It will only reject simple + * variables that are not strings, or an array that does not have a + * valid structure to be used as a callback. The valid ones are + * supposed to have only 2 entries, the first of which is an object + * or a string, and the second a string + */ + return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); + } + else + { + if (is_string($var)) + { + return function_exists($var); + } + else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) + { + $obj = reset($var); + if (is_string($obj)) + { + $methods = get_class_methods($obj); + return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); + } + else if (is_object($obj)) + { + return method_exists($obj, $method); + } + } + return false; + } + } +} + +?> \ No newline at end of file -- cgit 1.4.1