Added Smarty debgug window to output when admin verbose debug enabled.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 26 Jan 2018 15:31:35 +0000 (10:31 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 26 Jan 2018 15:31:35 +0000 (10:31 -0500)
controllers/admin.php
controllers/front.php
views/admin/members/list.html
views/admin/smartyDebug.html [new file with mode: 0644]

index 3aeb976..54792e8 100644 (file)
@@ -122,11 +122,11 @@ class glmMembersAdmin extends GlmPluginSupport
      */
     public function __construct ($wpdb, $config)
     {
-        
+
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         // Save WordPress Database object
         $this->wpdb = $wpdb;
 
@@ -233,11 +233,11 @@ class glmMembersAdmin extends GlmPluginSupport
             }
 
         }
-        
+
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
     }
 
     /**
@@ -257,7 +257,7 @@ class glmMembersAdmin extends GlmPluginSupport
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         // Get the model action
         if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') {
             $glmAction = sanitize_text_field($_REQUEST['glm_action']);
@@ -379,11 +379,11 @@ class glmMembersAdmin extends GlmPluginSupport
 
         // Generate output from model data and view
         $smarty->template->display($viewFile);
-        
+
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         exit;   // Need to test if this is here for a reason!
         wp_die();
 
@@ -694,7 +694,7 @@ class glmMembersAdmin extends GlmPluginSupport
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         // Enque admin scripts and css here so that only happens when we're doing something
         $this->glmMembersAdminScripts();
 
@@ -820,7 +820,7 @@ class glmMembersAdmin extends GlmPluginSupport
             $className = 'GlmMembersAdmin_' . $menuItem . '_' . $action;
             $loopTracking .= "<p>Loop: $loopCheck<br>Model: $modelName<br>Class: $className</p>";
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                trigger_error("Notice: Model: ".$modelName, E_USER_NOTICE);
+                trigger_error("Model: ".$modelName, E_USER_NOTICE);
             }
 
             // Create hook to add page tabs by add-on plugins
@@ -898,7 +898,7 @@ class glmMembersAdmin extends GlmPluginSupport
                     $badView = false;
                     if ($view) {
                         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                            trigger_error("Notice: View: ".$view, E_USER_NOTICE);
+                            trigger_error("View: ".$view, E_USER_NOTICE);
                         }
 
                         // Get the specified view file - check theme first
@@ -1009,13 +1009,6 @@ class glmMembersAdmin extends GlmPluginSupport
             $smarty->templateAssign('errorMsg', $errorMsg);
         }
 
-        // If view debug has been requested
-        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-
-            $x = $smarty->template->getTemplateVars();
-
-        }
-
         // Update the Smarty view path - *** NEEED TO FIX THIS TO SUPPORT THEME VIEWS SOMEHOW ****
         $smarty->template->addTemplateDir($viewPath);
 
@@ -1031,8 +1024,9 @@ class glmMembersAdmin extends GlmPluginSupport
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
+            $smarty->template->display( 'admin/smartyDebug.html');
         }
-        
+
         if ( $returnOutput ) {
             return $output;
         }
index 97ffbd6..4e3e702 100644 (file)
@@ -43,7 +43,7 @@ class glmMembersFront extends GlmPluginSupport
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         // Save WordPress Database object
         $this->wpdb = $wpdb;
 
@@ -101,11 +101,11 @@ class glmMembersFront extends GlmPluginSupport
         // Add filters for use anywhere else (apply_filter). Will have to add this to index.php eventually
         add_filter('glmMembersFrontScriptsFilter',array($this,'glmMembersFrontScripts'));
         add_action('glmMembersFrontCSSFilter',array($this,'glmMembersFrontCSS'));
-        
+
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
     }
 
     /**
@@ -287,7 +287,7 @@ class glmMembersFront extends GlmPluginSupport
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         // Start with no cache_code - This prevents caching for subordinate controller hits
         $cache_code = false;
 
@@ -672,7 +672,7 @@ class glmMembersFront extends GlmPluginSupport
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
         }
-        
+
         return $out;
 
     }
index 3d70b16..a2d0af6 100644 (file)
@@ -1,3 +1,4 @@
+{debug}
 {include file='admin/members/header.html'}
 <div class="glm-admin-table-inner glm-admin-table">
     <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm">
diff --git a/views/admin/smartyDebug.html b/views/admin/smartyDebug.html
new file mode 100644 (file)
index 0000000..0f2bdc1
--- /dev/null
@@ -0,0 +1 @@
+{debug}<!-- Used to generate debug output for Smarty - Called by Controller after main output -->
\ No newline at end of file