Created
April 26, 2012 06:50
-
-
Save chadaustin/2496896 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class functions { | |
public static function make_callback($function) { | |
if (is_array($function) || strpos($function,'::') === false) { | |
if (! is_callable($function)) { | |
if (tep_in_sandbox()) { | |
tep_die_deprecated("Called nonexistent function '$function' in functions::make_callback"); | |
} else { | |
dusty_record_value("bad_function_calls", $function); | |
} | |
} | |
return $function; | |
} else { | |
list($class, $method) = explode('::', $function); | |
if (! method_exists(new $class, $method)) { | |
if (tep_in_sandbox()) { | |
tep_die_deprecated("Called nonexistent method '$method' in functions::make_callback"); | |
} else { | |
dusty_record_value("bad_function_calls", $method); | |
} | |
} | |
return array($class, $method); | |
} | |
} | |
public static function make_callback_without_import($function) { | |
if (is_array($function) || strpos($function,'::') === false) { | |
return $function; | |
} else { | |
list($class, $method) = explode('::',$function); | |
return array($class, $method); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment