From: Roland Häder Date: Thu, 11 Mar 2010 12:23:46 +0000 (+0000) Subject: Yet another wrapper function 'cached' X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8cf27a4147da16cabc4917f313235021cf4c4e01;p=mailer.git Yet another wrapper function 'cached' --- diff --git a/inc/functions.php b/inc/functions.php index d45f5e5663..9a1f4e1cd9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2721,11 +2721,12 @@ function isUrlValidSimple ($url) { $pattern['d1g12'] = $http . $domain1 . $getstring1; $pattern['d2g12'] = $http . $domain2 . $getstring1; $pattern['ipg12'] = $http . $ip . $getstring1; + // Test all patterns $reg = false; foreach ($pattern as $key => $pat) { // Debug regex? - if (isDebugRegExpressionEnabled()) { + if (isDebugRegularExpressionEnabled()) { // @TODO Are these convertions still required? $pat = str_replace('.', "\.", $pat); $pat = str_replace('@', "\@", $pat); @@ -2733,7 +2734,7 @@ function isUrlValidSimple ($url) { } // END - if // Check if expression matches - $reg = ($reg || preg_match(('^' . $pat.'^'), $url)); + $reg = ($reg || preg_match(('^' . $pat . '^'), $url)); // Does it match? if ($reg === true) break; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c81d9d09d3..e7ef273e79 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -356,11 +356,18 @@ function isDebugModeEnabled () { // Checks wether SQL debugging is enabled function isSqlDebuggingEnabled () { - return ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + // Is cache set? + if (!isset($GLOBALS['is_sql_debug_enabled'])) { + // Determine if SQL debugging is enabled + $GLOBALS['is_sql_debug_enabled'] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_sql_debug_enabled']; } // Checks wether we shall debug regular expressions -function isDebugRegExpressionEnabled () { +function isDebugRegularExpressionEnabled () { // Simply check it return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y')); }