00001 <?php 00014 if (!function_exists('is_callable')) { 00015 function is_callable($var, $syntax_only=false) 00016 { 00017 if ($syntax_only) 00018 { 00019 /* from The Manual: 00020 * If the syntax_only argument is TRUE the function only verifies 00021 * that var might be a function or method. It will only reject simple 00022 * variables that are not strings, or an array that does not have a 00023 * valid structure to be used as a callback. The valid ones are 00024 * supposed to have only 2 entries, the first of which is an object 00025 * or a string, and the second a string 00026 */ 00027 return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); 00028 } 00029 else 00030 { 00031 if (is_string($var)) 00032 { 00033 return function_exists($var); 00034 } 00035 else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) 00036 { 00037 $obj = reset($var); 00038 if (is_string($obj)) 00039 { 00040 $methods = get_class_methods($obj); 00041 return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); 00042 } 00043 else if (is_object($obj)) 00044 { 00045 return method_exists($obj, $method); 00046 } 00047 } 00048 return false; 00049 } 00050 } 00051 } 00052 00053 ?>
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|