diff options
author | Christian Schneider | 2021-02-03 10:30:22 +0100 |
---|---|---|
committer | Christian Schneider | 2021-02-03 10:30:22 +0100 |
commit | 21ccdefc4aea4c2439f7d41ece7d8216d8ba8b40 (patch) | |
tree | 3cb6969d9e34580fb0b2eaa64016850e048afb56 /auto_prepend.php | |
parent | 039792e13581ebfd0ddc05bb115bc5f6bfa9cf46 (diff) | |
download | itools-21ccdefc4aea4c2439f7d41ece7d8216d8ba8b40.tar.gz itools-21ccdefc4aea4c2439f7d41ece7d8216d8ba8b40.tar.bz2 itools-21ccdefc4aea4c2439f7d41ece7d8216d8ba8b40.zip |
Code cleanup: Switch to new style varargs
Diffstat (limited to 'auto_prepend.php')
-rw-r--r-- | auto_prepend.php | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/auto_prepend.php b/auto_prepend.php index 0aa70ef..f05a4c2 100644 --- a/auto_prepend.php +++ b/auto_prepend.php @@ -5,18 +5,16 @@ /** * Return string containing names and values of all arguments */ -function D() +function D(...$args) { - $args = func_get_args(); return it_debug::dump($args); } /** * Echo string containing names and values of all arguments */ -function ED() +function ED(...$args) { - $args = func_get_args(); if (ob_get_level() == 0 && $_SERVER['REMOTE_ADDR']) ob_start(); # prevent later 'headers already sent' error $GLOBALS['debug_noredir'] = 1; @@ -28,15 +26,12 @@ function ED() * Same as ED(), but if first argument is foo then $GLOBALS['debug_foo'] must be set for output * @return boolean indicating whether $GLOBALS['debug_foo'] was set */ -function EDC($var) +function EDC($var, ...$args) { $GLOBALS['ULTRADEBUGVARS'][$var] = 1; if (($result = $GLOBALS["debug_$var"])) { - $args = func_get_args(); - array_shift($args); # remove $var - if ($args) { if (ob_get_level() == 0 && $_SERVER['REMOTE_ADDR']) @@ -54,9 +49,8 @@ function EDC($var) /** * Echo string containing names and values of all arguments, then exit */ -function EDX() +function EDX(...$args) { - $args = func_get_args(); if ($_SERVER['REMOTE_ADDR'] && !headers_sent()) header("Content-Type: text/html"); # Not going to be e.g. a valid gif anyway @@ -155,10 +149,9 @@ function T_exists($label, $language = null) /** * Build an url */ -function U(/* ... */) +function U(...$args) { - $args = func_get_args(); - return call_user_func_array(array(is_a($o = $GLOBALS['it_html'], 'it_html') ? $o : 'it_html', 'U'), $args); + return is_a($obj = $GLOBALS['it_html'], 'it_html') ? $obj->U(...$args) : it_html::U(...$args); } |