Started depreciating front and admin debug features.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 6 Sep 2017 16:19:33 +0000 (12:19 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 6 Sep 2017 16:19:33 +0000 (12:19 -0400)
Removed debug settings from Management Menu
Commented out code used to add content to debug data from plugin support.
Keeping code for now to purge any remainting data from WordPress options where it stored.
If no issues come up, will do a final purge of this code and all calls to save debug information form all other code.
All changes are marked as "Depreciating Debug..."

classes/data/settings/dataSettingsGeneral.php
classes/glmPluginSupport.php
config.php
controllers/admin.php
index.php
uninstall.php
views/admin/management/index.html

index d42854e..b897983 100644 (file)
@@ -118,7 +118,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract
             /*
              * Debug Options
              */
-
+/* Depreciating debug system
             // Admin Debug
             'admin_debug' => array(
                 'field' => 'admin_debug',
@@ -146,7 +146,8 @@ class GlmDataSettingsGeneral extends GlmDataAbstract
                 'type' => 'checkbox',
                 'use' => 'a'
             ),
-
+*/
+            
             /*
              * Misc Settings
              */
index f7fe4f8..dc93715 100644 (file)
@@ -42,59 +42,12 @@ class GlmPluginSupport
     public static function addNotice ($message, $type = false, $title = false)
     {
 
-        update_option('glmMembersAdminHaveNotices', true);
-
-        switch($type) {
-
-            case 'Alert';
-                $alerts = get_option('glmMembersAdminNoticeAlerts');
-                $alerts[] = $message;
-                update_option('glmMembersAdminNoticeAlerts', $alerts);
-                break;
-
-            case 'Process';
-                $process = get_option('glmMembersAdminNoticeProcess');
-                $process[] = $message;
-                update_option('glmMembersAdminNoticeProcess', $process);
-                break;
-
-            case 'DataBlock';
-                $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
-                $dataBlocks[] = array('data' => $message, 'title' => $title);
-                update_option('glmMembersAdminNoticeDataBlocks', $dataBlocks);
-                break;
-
-            case 'AdminNotice':
-                echo '
-                    <div class="updated">
-                        <p>'.$message.'</p>
-                    </div>
-                ';
-                break;
-
-            case 'AdminError':
-                echo '
-                    <div class="error">
-                        <p>'.$message.'</p>
-                    </div>
-                ';
-                break;
-
-            case 'AdminNag':
-                echo '
-                    <div class="update-nag">
-                        <p>'.$message.'</p>
-                    </div>
-                ';
-                break;
-
-            default;
-                $notices = get_option('glmMembersAdminNotices');
-                $notices[] = $message;
-                update_option('glmMembersAdminNotices', $notices);
-                break;
-
-        }
+        // Depreciating debug system - Make sure all notices are cleared
+        // Will delete this method after all references are purged.
+        
+        $this->clearNotices();
+        
+        return;
 
     }
 
@@ -137,19 +90,21 @@ class GlmPluginSupport
             sleep(1);
 
             // if we have pending messages, display those
+            // Depreciating debug system
+            /*
             if (get_option('glmMembersAdminNotices')) {
 
                 glmMembersAdminNotices();
 
             // Otherwise, there must have been some other error.
             } else {
-
+            */
                 $installErrors = get_option('glmMembersInstallErrors');
                 echo 'There has been an unknown error with the Gaslight Media Members Database plugin.<p>'.$installErrors;
                 delete_option('glmMembersInstallErrors');
 
 
-            }
+            // }
 
             // Quit here so Wordpress doesn't mark plugin as activated or deactivated
             return true;
@@ -372,7 +327,9 @@ return; // Off for now ** Need to make this switchable in management
  */
 function glmMembersAdminNotices($windowed = true)
 {
-
+    // Depreciating debug system
+    return;
+/*
     $output  = '';
 
     // If windowed for debug, also include HTML header and stylesheet
@@ -474,7 +431,7 @@ function glmMembersAdminNotices($windowed = true)
     delete_option('glmMembersAdminNotices');
     delete_option('glmMembersAdminNoticeProcess');
     delete_option('glmMembersAdminNoticeDataBlocks');
-
+*/
 }
 
 /**
index 22c2502..5c61c0f 100644 (file)
@@ -34,10 +34,17 @@ if ($glmMembersDatabaseDbVersion) {
     $config['terms'] = $terms;
 
     // Add Debug defines - These can't go into the defines.php file - Guess why.
+    // Depreciating debug system
+    define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', false);
+    define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', false);
+    define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', false);
+    define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', false);
+    /*
     define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', $settings['admin_debug']);
     define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', $settings['admin_debug_verbose']);
     define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', $settings['front_debug']);
     define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', $settings['front_debug_verbose']);
+    */
 }
 
 // Check for config value replacements in the current theme
index f517856..84b1454 100644 (file)
@@ -768,6 +768,8 @@ class glmMembersAdmin extends GlmPluginSupport
                     $this->addNotice('<b>Error in Admin Controller:</b> Menu Item not included in validActions.php!', 'Alert');
                 }
 
+                trigger_error('Error in Admin Controller: Menu Item not included in validActions.php!', E_USER_NOTICE);
+                
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
@@ -784,6 +786,8 @@ class glmMembersAdmin extends GlmPluginSupport
                     $this->addNotice('<b>Error in Admin Controller:</b> Requested Menu Item is invalid! - '.$menuItem, 'Alert');
                 }
 
+                trigger_error('Error in Admin Controller: Requested Menu Item is invalid! - '.$menuItem, E_USER_NOTICE);
+                
                 $menuItem = 'error';
                 $action = 'badAction';
 
@@ -817,6 +821,8 @@ class glmMembersAdmin extends GlmPluginSupport
                     $this->addNotice("<b>Error in Admin Controller:</b> Model file doesn't exist - ".$modelName, 'Alert');
                 }
 
+                trigger_error("Error in Admin Controller: Model file doesn't exist - ".$modelName, E_USER_NOTICE);
+                
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
@@ -837,6 +843,8 @@ class glmMembersAdmin extends GlmPluginSupport
                         $this->addNotice("<b>Error in Admin Controller:</b> Invalid Model Class Name - ".$className, 'Alert');
                     }
 
+                    trigger_error("Error in Admin Controller: Invalid Model Class Name - ".$className, E_USER_NOTICE);
+                    
                     $modelRedirect = true;
                     $menuItem = 'error';
                     $action = 'index';
@@ -895,6 +903,8 @@ class glmMembersAdmin extends GlmPluginSupport
                             $viewFile = $view;
                             if (!is_file($viewPath.'/'.$viewFile)) {
 
+                                trigger_error("Bad or missing view file: $viewPath/$view", E_USER_NOTICE);
+                                
                                 // No matching view file found
                                 $errorMsg .= "<b>Bad or missing view file:</b> $viewPath/$view";
                                 $badView = true;
@@ -912,6 +922,8 @@ class glmMembersAdmin extends GlmPluginSupport
                             $this->addNotice("<b>Error in Admin Controller:</b> Requested View file doesn't exist - ".$viewPath.'/'.$viewFile, 'Alert');
                         }
 
+                        trigger_error("Error in Admin Controller: Requested View file doesn't exist - ".$viewPath.'/'.$viewFile, E_USER_NOTICE);
+                        
                         $modelRedirect = true;
                         $menuItem = 'error';
                         $action = 'index';
@@ -925,6 +937,9 @@ class glmMembersAdmin extends GlmPluginSupport
 
             // This is just a sanity check on this loop to keep it from getting out of control
             if (++$loopCheck > 5) {
+                
+                trigger_error('Serious failure looping on model load!', E_USER_NOTICE);
+                
                 die('
                     <h1>Serious failure looping on model load in "controllers/admin.php".</h1>
                     <div class="glm-item-container">
index dbfde6f..9f85ab3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -424,10 +424,13 @@ if (function_exists('is_user_logged_in')) {
  */
 
 // If the call to this code is to display a separate debug window
+// Depreciating debug feature
+/*
 if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
     glmMembersAdminNotices(true);
     exit;
 }
+*/
 
 // If no database version was set at the top, this was an initial activation, so don't run controllers
 if ($glmMembersDatabaseDbVersion) {
@@ -460,12 +463,15 @@ if ($startupNotices != '') {
 }
 
 // If not doing debug, then clear all of the debug messages that might have been saved
+// Depreciating debug feature
+/*
 if (defined('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG') && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
     delete_option('glmMembersAdminNoticeAlerts');
     delete_option('glmMembersAdminNotices');
     delete_option('glmMembersAdminNoticeProcess');
     delete_option('glmMembersAdminNoticeDataBlocks');
 }
+*/
 
 /*
  * Check if database is installed and if it matches the current version
index 306fa64..65d872c 100644 (file)
@@ -31,12 +31,14 @@ require_once 'defines.php';
 // Delete options
 delete_option('glmMembersDatabasePluginVersion');
 delete_option('glmMembersDatabaseDbVersion');
-delete_option('glmMembersAdminNotices');
+// Depreciating debug system
+//delete_option('glmMembersAdminNotices');
 
 // Same for Multi-site
 delete_site_option('glmMembersDatabasePluginVersion');
 delete_site_option('glmMembersDatabaseDbVersion');
-delete_site_option('glmMembersAdminNotices');
+// Depreciating debug system
+//delete_site_option('glmMembersAdminNotices');
 
 /*
  * Drop database tables
index 0c9eb36..fa207e9 100644 (file)
@@ -6,8 +6,8 @@
         <input type="hidden" name="option" value="submit">
 
         <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
-            <a id="glm-settings-debug" data-show-table="glm-table-debug" class="glm-settings-tab nav-tab nav-tab-active">Debug Settings</a>
-            <a id="glm-settings-misc" data-show-table="glm-table-misc" class="glm-settings-tab nav-tab">Misc. Settings</a>
+<!-- Depreciating Debug System           <a id="glm-settings-debug" data-show-table="glm-table-debug" class="glm-settings-tab nav-tab nav-tab-active">Debug Settings</a>  --> 
+            <a id="glm-settings-misc" data-show-table="glm-table-misc" class="glm-settings-tab nav-tab nav-tab-active">Misc. Settings</a>
             <a id="glm-settings-list" data-show-table="glm-table-list" class="glm-settings-tab nav-tab">Member List Options</a>
             <a id="glm-settings-detail" data-show-table="glm-table-detail" class="glm-settings-tab nav-tab">Member Detail Options</a>
             <a id="glm-settings-required-page" data-show-table="glm-table-required-page" class="glm-settings-tab nav-tab">Required Pages</a>
 
 
             <!-- Debug Settings -->
-
+<!-- Depreciating Debug System
         <table id="glm-table-debug" class="glm-admin-table glm-settings-table">
             <tr><td colspan="2"><h2>Debug Settings</h2></td></tr>
             <tr>
                 <th>Admin Debug Information:</th>
                 <td>
-                    <input type="checkbox" name="admin_debug"{if $genSettings.fieldData.admin_debug.value} checked="checked"{/if}>
+                    <input type="checkbox" name="admin_debug"{ if $genSettings.fieldData.admin_debug.value } checked="checked"{ /if }>
                 </td>
             </tr>
             <tr>
                 <th>Admin Debug Verbose:</th>
                 <td>
-                    <input type="checkbox" name="admin_debug_verbose"{if $genSettings.fieldData.admin_debug_verbose.value} checked="checked"{/if}>
+                    <input type="checkbox" name="admin_debug_verbose"{ if $genSettings.fieldData.admin_debug_verbose.value } checked="checked"{ /if }>
                 </td>
             </tr>
             <tr>
                 <th>Front-End Debug Information:</th>
                 <td>
-                    <input type="checkbox" name="front_debug"{if $genSettings.fieldData.front_debug.value} checked="checked"{/if}>
+                    <input type="checkbox" name="front_debug"{ if $genSettings.fieldData.front_debug.value} checked="checked"{ /if}>
                 </td>
             </tr>
             <tr>
                 <th>Front-End Debug Verbose:</th>
                 <td>
-                    <input type="checkbox" name="front_debug_verbose"{if $genSettings.fieldData.front_debug_verbose.value} checked="checked"{/if}>
+                    <input type="checkbox" name="front_debug_verbose"{ if $genSettings.fieldData.front_debug_verbose.value} checked="checked"{ /if}>
                 </td>
             </tr>
         </table>
-
+ -->
         <!-- Required Pages -->
 
         <table id="glm-table-required-page" class="glm-admin-table glm-settings-table glm-hidden">
@@ -90,7 +91,7 @@
 
             <!-- Misc Settings -->
 
-        <table id="glm-table-misc" class="glm-admin-table glm-settings-table glm-hidden">
+        <table id="glm-table-misc" class="glm-admin-table glm-settings-table">
             <tr><td colspan="2"><h2>Members Related Settings</h2></td></tr>
             <tr>
                 <th>Enable Members:</th>
         </table>
                         <!-- Members Only Settings -->
 
-        <table id="glm-table-members-only" class="glm-admin-table glm-settings-table">
+        <table id="glm-table-members-only" class="glm-admin-table glm-settings-table glm-hidden">
             <tr><td colspan="2"><h2>Members Only Settings</h2></td></tr>
             <tr>
                 <th>Member Login Form Support Email:</th>