From 16bf4ac2dec51b811d93056e62a3090f947aa3d9 Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Mon, 29 Nov 2021 12:08:34 +0100 Subject: [PATCH] revert global changes --- global.php | 197 +++++++++++++++++++++++++---------------------------- 1 file changed, 93 insertions(+), 104 deletions(-) diff --git a/global.php b/global.php index 189b679..3a2ad0e 100644 --- a/global.php +++ b/global.php @@ -1,35 +1,35 @@ "; -const CRAYON_NL = "\r\n"; -const CRAYON_BL = CRAYON_BR . CRAYON_NL; -const CRAYON_DASH = "=============================================================================="; -const CRAYON_LINE = "------------------------------------------------------------------------------"; +define('CRAYON_BR', "
"); +define('CRAYON_NL', "\r\n"); +define('CRAYON_BL', CRAYON_BR . CRAYON_NL); +define('CRAYON_DASH', "=============================================================================="); +define('CRAYON_LINE', "------------------------------------------------------------------------------"); // Load utilities -require_once(CRAYON_UTIL_PHP); -require_once(CRAYON_TIMER_PHP); -require_once(CRAYON_LOG_PHP); +require_once (CRAYON_UTIL_PHP); +require_once (CRAYON_TIMER_PHP); +require_once (CRAYON_LOG_PHP); // Turn on the error & exception handlers //crayon_handler_on(); // GLOBAL FUNCTIONS -// Check for forward slash/backslash in folder path to structure paths -function crayon_s($url = '') -{ +// Check for forwardslash/backslash in folder path to structure paths +function crayon_s($url = '') { $url = strval($url); if (!empty($url) && !preg_match('#(\\\\|/)$#', $url)) { return $url . '/'; @@ -151,8 +152,7 @@ function crayon_s($url = '') } // Returns path using forward slashes, slash added at the end -function crayon_pf($url, $slash = TRUE) -{ +function crayon_pf($url, $slash = TRUE) { $url = trim(strval($url)); if ($slash) { $url = crayon_s($url); @@ -161,14 +161,12 @@ function crayon_pf($url, $slash = TRUE) } // Returns path using back slashes -function crayon_pb($url) -{ +function crayon_pb($url) { return str_replace('/', '\\', crayon_s(trim(strval($url)))); } // Get/Set plugin information -function crayon_set_info($info_array) -{ +function crayon_set_info($info_array) { global $CRAYON_VERSION, $CRAYON_DATE, $CRAYON_AUTHOR, $CRAYON_WEBSITE; if (!is_array($info_array)) { return; @@ -179,53 +177,45 @@ function crayon_set_info($info_array) crayon_set_info_key('PluginURI', $info_array, $CRAYON_WEBSITE); } -function crayon_set_info_key($key, $array, &$info) -{ +function crayon_set_info_key($key, $array, &$info) { if (array_key_exists($key, $array)) { $info = $array[$key]; - return true; } else { return FALSE; } } -function crayon_vargs(&$var, $default) -{ +function crayon_vargs(&$var, $default) { $var = isset($var) ? $var : $default; } // Checks if the input is a valid PHP file and matches the $valid filename -function crayon_is_php_file($filepath, $valid) -{ +function crayon_is_php_file($filepath, $valid) { $path = pathinfo(crayon_pf($filepath)); return is_file($filepath) && $path['extension'] === 'php' && $path['filename'] === $valid; } // Stops the script if crayon_is_php_file() returns false or a remote path is given -function crayon_die_if_not_php($filepath, $valid) -{ +function crayon_die_if_not_php($filepath, $valid) { if (!crayon_is_php_file($filepath, $valid) || crayon_is_path_url($filepath)) { die("[ERROR] '$filepath' is not a valid PHP file for '$valid'"); } } -function crayon_is_path_url($path) -{ +function crayon_is_path_url($path) { $parts = parse_url($path); return isset($parts['scheme']) && strlen($parts['scheme']) > 1; } // LANGUAGE TRANSLATION FUNCTIONS -function crayon_load_plugin_textdomain() -{ +function crayon_load_plugin_textdomain() { if (function_exists('load_plugin_textdomain')) { load_plugin_textdomain(CRAYON_DOMAIN, false, CRAYON_DIR . CRAYON_TRANS_DIR); } } -function crayon__($text) -{ +function crayon__($text) { if (function_exists('__')) { return __($text, CRAYON_DOMAIN); } else { @@ -233,8 +223,7 @@ function crayon__($text) } } -function crayon_e($text) -{ +function crayon_e($text) { if (function_exists('_e')) { _e($text, CRAYON_DOMAIN); } else { @@ -242,8 +231,7 @@ function crayon_e($text) } } -function crayon_n($singular, $plural, $count) -{ +function crayon_n($singular, $plural, $count) { if (function_exists('_n')) { return _n($singular, $plural, $count, CRAYON_DOMAIN); } else { @@ -251,11 +239,12 @@ function crayon_n($singular, $plural, $count) } } -function crayon_x($text, $context) -{ +function crayon_x($text, $context) { if (function_exists('_x')) { return _x($text, $context, CRAYON_DOMAIN); } else { return $text; } } + +?> \ No newline at end of file