From: Chuck Scott Date: Tue, 10 Sep 2019 16:45:26 +0000 (-0400) Subject: Added code to only show debug status when not an AJAX call. X-Git-Tag: v4.0.0^2~5^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=3129899ab904d5f2f2dbeb5800477759b5204b7c;p=WP-Plugins%2Fglm-serverstats.git Added code to only show debug status when not an AJAX call. --- diff --git a/defines.php b/defines.php index 6661ba5..46361b6 100755 --- a/defines.php +++ b/defines.php @@ -6,7 +6,7 @@ */ // Set to true to add more debug messages to the error log -define('GLM_SERVERSTATS_PLUGIN_DEBUG', false); +define('GLM_SERVERSTATS_PLUGIN_DEBUG', true); // Database Connection define('GLM_SERVERSTATS_DATABASE_NAME', 'bandwidth'); diff --git a/index.php b/index.php index 4dfc05b..4ba66b6 100755 --- a/index.php +++ b/index.php @@ -194,7 +194,7 @@ if ($websiteSettings['show_cookie_popup'] && !is_admin()) { */ function glmServerStatsAjax() { - + $glmAjaxActionCalled = true; $glmAction = false; // Get the requested model @@ -204,7 +204,7 @@ function glmServerStatsAjax() // Call controller to handle AJAX request - Ajax models should not return to controller if ($glmAction && $glmAction != '') { - serverStatsController($glmAction); + serverStatsController($glmAction, true); } } @@ -217,7 +217,7 @@ function glmServerStatsAjax() * model and the view. * */ -function serverStatsController($model) +function serverStatsController($model, $isAjax = false) { if (GLM_SERVERSTATS_PLUGIN_DEBUG) { @@ -225,6 +225,10 @@ function serverStatsController($model) trigger_error("GLM Usage Controller Start: Model = $model", E_USER_NOTICE ); } + if (GLM_SERVERSTATS_PLUGIN_DEBUG && !$isAjax) { + trigger_error("GLM Usage Plugin Debug Enabled: *** Turn off for production *** - See defines.php", E_USER_NOTICE ); + } + // Enque admin scripts and css here so that only happens when we're doing something glmServerJqueryScipts(); glmServerStatsScripts();