]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
Code from inc/language.php moved to function loadLanguageFile(), the include is now...
[mailer.git] / inc / wrapper-functions.php
index 7cc9c9ec6b37bde0e5951792cd4354b8917d15e7..738b5b6e3d9be42f16008593b602f50c0e65d2eb 100644 (file)
@@ -132,7 +132,7 @@ function loadIncludeOnce ($INC) {
        // Is it not loaded?
        if (!isset($GLOBALS['load_once'][$INC])) {
                // Mark it as loaded
-               $GLOBALS['load_once'][$INC] = "loaded";
+               $GLOBALS['load_once'][$INC] = 'loaded';
 
                // Then try to load it
                loadInclude($INC);
@@ -180,21 +180,19 @@ function decodeEntities ($str) {
 // Merges an array together but only if both are arrays
 function merge_array ($array1, $array2) {
        // Are both an array?
-       if ((is_array($array1)) && (is_array($array2))) {
-               // Merge all together
-               return array_merge($array1, $array2);
-       } elseif (is_array($array1)) {
-               // Return left array
-               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
-               return $array1;
-       } elseif (is_array($array2)) {
-               // Return right array
-               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
-               return $array2;
+       if ((!is_array($array1)) && (!is_array($array2))) {
+               // Both are not arrays
+               debug_report_bug(__FUNCTION__ . ': No arrays provided!');
+       } elseif (!is_array($array1)) {
+               // Left one is not an array
+               debug_report_bug(__FUNCTION__, sprintf("array1 is not an array. array != %s", gettype($array1)));
+       } elseif (!is_array($array2)) {
+               // Right one is not an array
+               debug_report_bug(__FUNCTION__, sprintf("array2 is not an array. array != %s", gettype($array2)));
        }
 
-       // Both are not arrays
-       debug_report_bug(__FUNCTION__.": No arrays provided!");
+       // Merge all together
+       return array_merge($array1, $array2);
 }
 
 // Check if given FQFN is a readable file
@@ -434,7 +432,7 @@ function isNicknameUsed ($userid) {
                $isUsed = $GLOBALS['cache_probe_nicknames'][$userid];
        } else {
                // Determine it
-               $isUsed = ((EXT_IS_ACTIVE('nickname')) && ((''.round($userid).'') != $userid));
+               $isUsed = ((EXT_IS_ACTIVE('nickname')) && (('' . round($userid) . '') != $userid));
 
                // And write it to the cache
                $GLOBALS['cache_probe_nicknames'][$userid] = $isUsed;
@@ -476,7 +474,7 @@ function setWhatFromConfig ($configEntry) {
 // Checks wether what is set and optionally aborts on miss
 function isWhatSet ($abortOnMiss =  false) {
        // Check for it
-       $isset = (!empty($GLOBALS['what']));
+       $isset = (isset($GLOBALS['what']));
 
        // Should we abort here?
        if (($abortOnMiss === true) && ($isset === false)) {
@@ -511,7 +509,7 @@ function setAction ($newAction) {
 // Checks wether action is set and optionally aborts on miss
 function isActionSet ($abortOnMiss =  false) {
        // Check for it
-       $isset = (!empty($GLOBALS['action']));
+       $isset = (isset($GLOBALS['action']));
 
        // Should we abort here?
        if (($abortOnMiss === true) && ($isset === false)) {
@@ -593,5 +591,22 @@ function isOutputModeSet ($abortOnMiss =  false) {
        return $isset;
 }
 
+// Enables block-mode
+function enableBlockMode ($enabled = true) {
+       $GLOBALS['block_mode'] = $enabled;
+}
+
+// Checks wether block-mode is enabled
+function isBlockModeEnabled () {
+       // Abort if not set
+       if (!isset($GLOBALS['block_mode'])) {
+               // Needs to be fixed
+               debug_report_bug(__FUNCTION__ . ': block_mode is not set.');
+       } // END - if
+
+       // Return it
+       return $GLOBALS['block_mode'];
+}
+
 // [EOF]
 ?>