diff --git a/core/Object.php b/core/Object.php index 3c5480a47..b4251d2db 100755 --- a/core/Object.php +++ b/core/Object.php @@ -470,12 +470,21 @@ abstract class Object { } /** - * Return TRUE if a class has a specified extension - * - * @param string $requiredExtension the class name of the extension to check for. + * Return TRUE if a class has a specified extension. + * This supports backwards-compatible format (static Object::has_extension($requiredExtension)) and new format ($object->has_extension($class, $requiredExtension)) + * @param string $classOrExtension if 1 argument supplied, the class name of the extension to check for; if 2 supplied, the class name to test + * @param string $requiredExtension used only if 2 arguments supplied */ - public static function has_extension($requiredExtension) { - $class = get_called_class(); + public static function has_extension($classOrExtension, $requiredExtension = null) { + //BC support + if(func_num_args() > 1){ + $class = $classOrExtension; + $requiredExtension = $requiredExtension; + } + else { + $class = get_called_class(); + $requiredExtension = $classOrExtension; + } $requiredExtension = strtolower($requiredExtension); $extensions = Config::inst()->get($class, 'extensions');