$cached = $this->wpdb->get_results($sql, ARRAY_A);
if (count($cached) == 1) {
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Using Cached Result: cache code = $cache_code", E_USER_NOTICE);
+ }
+
// Currently cached - Return cached content
return $cached[0]['html'];
$defaultTimeZone = date_default_timezone_get();
date_default_timezone_set($this->config['settings']['time_zone']);
- $errorMsg = '';
+ $controlError = false;
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
-
// Also turn on SQL error messages
$this->wpdb->show_errors();
-
- // Get all defiend constants then if not VERBOSE select out only user contstants
- $consts = get_defined_constants(true);
- if (!GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
- $consts = $consts['user'];
- }
-
- } else {
- $this->clearNotices();
}
/*
}
} else {
- $errorMsg .= '<b>Missing shortcode default values table entry in table '.$shortcodeData['table'].'</b><br>';
+ $controlError = true;
}
}
)
);
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Executing Shortcode: $shortcode", E_USER_NOTICE);
+ }
+
} else {
- $errorMsg .= "<b>Provided short-code is not valid: </b>$shortcode<br>";
+ $controlError = true;
+
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Shortcode Not Valid: $shortcode", E_USER_NOTICE);
+ }
+
}
// If there's been no error so far, try to process the supplied action
- if($errorMsg == '') {
+ if(!$controlError) {
/*
* Processing loop - Loop till we have a final action
// Verify that we have the requested menu item in the valid actions
if (! isset($this->config['validActions']['frontActions'][$menuItem])) {
- $errorMsg .= "<b>Model doesn't exist:</b> " . $modelName;
+ $controlError = true;
}
// Verify Menu item and action as valid action
if (! isset($this->config['validActions']['frontActions']) ||
! isset($action,
$this->config['validActions']['frontActions'][$menuItem])) {
- $errorMsg = '<b>Invalid action requested:</br> '.$action;
+ $controlError = true;
}
/*
$modelName = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/models/front/$menuItem/$action.php";
$className = 'GlmMembersFront_' . $menuItem . '_' . $action;
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Model: $modelName", E_USER_NOTICE);
+ }
+
// If model file doesn't exist - we have an error
if (!file_exists($modelName)) {
- $errorMsg .= "<b>Model doesn't exist:</b> " . $modelName;
+ $controlError = true;
// Otherwise, load and run the model
} else {
// check for an invalid model class name
if (! class_exists($className)) {
- $errorMsg .= "<b>Model class doesn't exist:</b> ".$className;
+ $controlError = true;
} else {
// Set the new model action
$action = $results['modelRedirect'];
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Model Redirect: ".$results['modelRedirect'], E_USER_NOTICE);
+ }
+
// Check if there's also a menu item change
if ($results['menuItemRedirect']) {
$menuItem = $results['menuItemRedirect'];
$viewFile = $view;
// If the view is not found in the theme, fall back to views in the plugin
+ $inTheme = ' (In Theme)';
if (!is_file($viewPath.'/'.$viewFile)) {
+
// Next try the plugin/add-on
$viewPath = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/views";
$viewFile = $view;
if (!is_file($viewPath.'/'.$viewFile)) {
// No matching view file found
- $errorMsg .= "<b>Bad or missing view file:</b> $viewPath/$viewFile";
+ $controlError = true;
+
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("Bad or missing view file: $viewPath/$viewFile", E_USER_NOTICE);
+ }
}
+
+ $inTheme = '';
+ }
+
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ trigger_error("View$inTheme: $viewPath", E_USER_NOTICE);
}
}
} // if errorMsg
- // If there was an error
- if ($errorMsg != '' && isset($_SERVER['HTTP_REFERER'])) {
- $mailMsg =
-"
-An error occurred while running the request below.
-
-Error Msg: $errorMsg
-Server: ".$_SERVER['SERVER_NAME']."
-Method: ".$_SERVER['REQUEST_METHOD']."
-Time: ".date('r', $_SERVER['REQUEST_TIME'])."
-Query: ".$_SERVER['QUERY_STRING']."
-Referrer: ".$_SERVER['HTTP_REFERER']."
-User Agent: ".$_SERVER['HTTP_USER_AGENT']."
-Remote Addr: ".$_SERVER['REMOTE_ADDR']."
-Filename: ".$_SERVER['SCRIPT_FILENAME']."
-URL: http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."
-Request Data: ".print_r($_REQUEST,1)."
-";
- mail (
- 'errors@gaslightmedia.com',
- 'Front-End GLM Associate Error',
- $mailMsg
- );
-// $viewPath = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.GLM_MEMBERS_PLUGIN_SLUG.'/views';
-// $viewFile = 'front/error/index.html';
+ // If there was a controller error - show error page
+ if ($controlError != '' && isset($_SERVER['HTTP_REFERER'])) {
require_once GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.GLM_MEMBERS_PLUGIN_SLUG.'/models/front/error/index.php';
$model = new GlmMembersFront_error_index($this->wpdb, $this->config);
$results = $model->modelAction($actionData);
// Generate output from model data and view
$out = $smarty->template->fetch($viewFile);
- // If debug is requested, create debug window
- if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
- echo "
- <script>
- window.open('".admin_url()."admin.php?page=glm-members-admin-menu-members&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
- </script>
- ";
- }
-
// Restore timezone that was set before our code was called
date_default_timezone_set($defaultTimeZone);
<!-- 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>
+ <td colspan="2">
+ These settings now enabling "trigger_error()" output where that's available. This is replacing the legacy
+ debug output that used a separate debug window. So far only Front Controller has debug tests included.
+ </td>
<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>
- -->
+ <p> </p>
<!-- Required Pages -->
<!-- Member information displayed in map bubbles -->
{foreach $mapItems as $m}
<div id="map_info_{$m.id}" class="glm-hidden">
- {apply_filters('glm-member-db-front-members-list-mapBubbleTop', '', $m.member_pointer)}
+ {apply_filters('glm-member-db-front-members-list-mapBubbleTop', '', $m.member)}
{if $m.logo && $settings.list_map_show_logo}
<div class="glm-member-list-image">
<img src="{$glmPluginMediaUrl}/images/{$settings.list_map_logo_size}/{$m.logo}">
</div>
{/if}
</div>
- {apply_filters('glm-member-db-front-members-list-mapBubbleBottom', '', $m.member_pointer)}
+ {apply_filters('glm-member-db-front-members-list-mapBubbleBottom', '', $m.member)}
</div> <!-- End of information displayed in map bubbles -->
{/foreach}
position: new google.maps.LatLng({$m.lat}, {$m.lon}),
draggable: false,
animation: google.maps.Animation.DROP,
- title: '{$m.member|escape}',
+ title: '{$m.name|escape:quotes}',
descr: $('#map_info_' + {$m.id}).html(),
memberID: {$m.member}
});