* @package glmMembersDatabase
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @release activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
* @link http://dev.gaslightmedia.com/
*/
--- /dev/null
+<?php
+/**
+ * Plugin Name: GLM Members Database
+ * Plugin URI: http://www.gaslightmedia.com/
+ * Description: Gaslight Media Members Database.
+ * Version: 1.0
+ * Author: Chuck Scott
+ * Author URI: http://www.gaslightmedia.com/
+ * License: GPL2
+ */
+
+/**
+ * Gaslight Media Members Database
+ * Index
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 1.0
+ */
+
+/*
+ * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+$startupNotices = '';
+
+// Get standard defined parameters
+require_once('defines.php');
+
+// Get plugin configuration
+$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true);
+$config = $configData['common'];
+// Override parameters according to GLM_HOST_ID
+$hostSection = strtolower(GLM_MEMBER_PLUGIN_HOST).':common';
+if (isset($configData[$hostSection])) {
+ $config = array_replace($config, $configData[strtolower(GLM_MEMBER_PLUGIN_HOST).':common']);
+} else {
+ $startupNotices .=
+ '<p><b>Bad configuration file section name or section not found:</b> '. $hostSection
+ .'<br>See plugin '.GLM_MEMBERS_PLUGIN_PATH.'config/plugin.ini file.'
+ .'<br>Also check that the server "GLM_HOST_ID" environment parameter exists and matches a section in the above ini file.</p>'
+ ;
+}
+
+// Add Debug defines - These can't go into the defines.php file - Guess why.
+define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', $config['admin_debug']);
+define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', $config['admin_debug_verbose']);
+define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', $config['front_debug']);
+define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', $config['front_debug_verbose']);
+
+// Also get image sizes array from the plugin.ini - uses separate ini section.
+$config['imageSizes'] = $configData['imageSizes'];
+
+// Get additional configuration data
+$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/states.ini');
+$config['states'] = $stateData['states'];
+$countryData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/countries.ini');
+$config['countries'] = $countryData['countries'];
+
+// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
+add_option('glmMembersDatabaseDbVersion', false);
+
+// Custom plugin post type (for wp_post entries)
+// define('GLM_MEMBERS_PLUGIN_POST_TYPE', '');
+
+
+/**
+ * *******************************************************************************
+ *
+ * *** Directory and File Structure ***
+ *
+ * index.php
+ *
+ * Index file for this plugin. All plugin processing starts here. (See
+ * "Process Flow" below.)
+ *
+ * controllers
+ *
+ * Directory containing any controllers. Typically there
+ * would be admin and front controllers in this directory.
+ * These controllers do the general setup for the plugin,
+ * determine and call the appropriate model, determine the
+ * appropriate view, then merge any data returned by the model
+ * with the view and output the result as appropriate.
+ *
+ * When executed, a model may determine that it cannot handle
+ * the current request and return such a notice to the controller
+ * possibly with a suggested model to execute. Models may also
+ * return a desired view back to the controller based on the
+ * result of processing, but should do so in a generic way so
+ * as to permit multi-lingual output and use of multiple "skins"
+ * (but not to the exception of appropriate use of WordPress
+ * Themes).
+ *
+ * css
+ *
+ * Directory containing any css files specific to this plugin.
+ * The use of additional styling should be kept to a minimum
+ * so as to not interfere with the application of WordPress
+ * default styling and Themes.
+ *
+ * js
+ *
+ * Directory containing any JAVAscript files specific to this
+ * Plugin. This directory should be reserved for general script
+ * files that provide functionality that can be used in various
+ * views. Any JAVAscript that is specific to a view should be
+ * located along with the associated view as it is logically
+ * part of the view.
+ *
+ * lib
+ *
+ * Directory containing any class or function libraries that
+ * are used generally by this plugin. Any class or other code
+ * that is specific to a particular model should be located
+ * in, or along with, that model since it is logically
+ * associated only with that model.
+ *
+ * misc
+ *
+ * Directory containing ancillary directories and files. This
+ * might be used for things like cach directories. An example
+ * might be the "smarty" directory for Smaarty Templates.
+ *
+ * models
+ *
+ * Directory containing model files that execute a specific
+ * process in this plugin. If this is a simple plugin, then
+ * the model files can be placed directly in this directory.
+ * If it's a more complex plugin, then there should be sub-
+ * directories for various groupings of related model files.
+ *
+ * An individual model may consist of a grouping of files,
+ * such as additional class files, that are specific only to
+ * that model. In that case, these should be located in a
+ * subdirectory under where the model file called by the
+ * controller is located and that directory should be named
+ * so as to be obviously associated with that model.
+ *
+ * There are three special files in the models directory. These
+ * are activate.php, deactivate.php, and uninstall.php. These
+ * are called via hooks setup in this file and should always
+ * be here. If they do not provide any real functionality, they
+ * should at least be a shell that can be called for those
+ * situations.
+ *
+ * views
+ *
+ * Directory containing view files for producing output upon
+ * request of a model file in the models directory. If this
+ * is a simply plugin, then the view files can be placed
+ * directly in this directory. If it's a more complex plugin,
+ * then there should be sub-directories for the various
+ * groupings of related view files. If using sub-directories,
+ * those should generally match the associated model directories.
+ * It may also be wise to use separate front and admin
+ * directories under views to keep things organized.
+ *
+ * Additionally, views may be grouped in such a way that they
+ * support the selection of various "skins" that output in
+ * different ways, although any styling should be provided by
+ * WordPress Themes or use default WordPress styling.
+ *
+ * *** Process Flow ***
+ *
+ * WordPress calls the plugin index file. All plugin processing starts here.
+ *
+ * The plugin index file performs the following operations ...
+ * - Sets-up any required plugin-wide defines and data
+ * - Instatiates any plugin-wide classes and objects
+ * - Sets-up any plugin-wide WordPress hooks
+ * - Determines which controller is to be executed
+ * - Executes the selected controller
+ *
+ * The selected controller performs the following operations ...
+ * - Sets-up any controller specific defines and data
+ * - Instatiates any controller specific classes and objects
+ * - Sets-up any controller specific WordPress hooks
+ * - Determines which model process is to be executed
+ * - Executes the selected model
+ *
+ * The selected model performs the following operations ...
+ * - Sets-up any model specific defines and data
+ * - Instatiates any model specific classes and objects
+ * - Sets-up any model specific WordPress hooks
+ * - Performs any specific processing required of the model
+ * - Determines which view is to be used to generate output
+ * - Generates output based on model data and the selected view
+ *
+ * WordPress wraps everything up
+ *
+ * ********************************************************************************
+ */
+
+/*
+ *
+ * Activate, Deactivate, Uninstall hooks
+ *
+ */
+
+// Activate
+function glmMembersPluginActivate ()
+{
+ global $wpdb, $config;
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
+ new glmMembersPluginActivate($wpdb, $config);
+}
+register_activation_hook(__FILE__, 'glmMembersPluginActivate');
+
+// Deactivate
+function glmMembersPluginDeactivate ()
+{
+ global $wpdb, $config;
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
+ $x = new glmMembersPluginDeactivate($wpdb, $config);
+ return false;
+}
+register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate');
+
+// Uninstall - Not using. Using "uninstall.php" in the root directory of this plugin.
+
+/*
+ *
+ * Load any other common files needed
+ *
+ */
+
+// Load data abstract
+require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
+
+/*
+ *
+ * Determine which controller to load
+ *
+ * The first is for displaying notices in another window, possibly for debug output.
+ *
+ */
+if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
+ glmMembersAdminNotices(true);
+ exit;
+} elseif (is_admin()) {
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php');
+ new glmMembersAdmin($wpdb, $config);
+} else {
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php');
+ new glmMembersFront($wpdb, $config);
+}
+
+
+/*
+ * Function to display admin notices.
+ *
+ * This function is only called using the add_action('admin_notices','...') function
+ * in the code below this function.
+ *
+ * @return void
+ * @access public
+ */
+function glmMembersAdminNotices($windowed = false)
+{
+
+ $output = '';
+
+ // If windowed for debug, also include HTML header and stylesheet
+ if ($windowed) {
+
+ $output .= '
+ <html>
+ <head>
+ <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
+ <head>
+ <body>
+ <a name="top"></a>
+ <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
+ <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
+ ';
+
+ // Display alerts
+ $alerts = get_option('glmMembersAdminNoticeAlerts');
+ if(is_array($alerts)) {
+ $output .= '<div id="glm-debug-alerts" class="glm-error"><h2>Alerts</h2>';
+ foreach($alerts as $a) {
+ $output .= $a.'<br>';
+ }
+ } else {
+ $output .= '<div id="glm-debug-alerts"><h2>Alerts</h2>';
+ }
+ $output .= '</div><hr>';
+ delete_option('glmMembersAdminNoticeAlerts');
+
+ // Display process messages
+ $process = get_option('glmMembersAdminNoticeProcess');
+ $output .= '<div id="glm-debug-process"><h2>Processing</h2>';
+ if(is_array($process)) {
+ foreach($process as $p) {
+ $output .= $p.'<br>';
+ }
+ }
+ $output .= '</div><hr>';
+ delete_option('glmMembersAdminNoticeProcess');
+
+ // Display data blocks table of contents then the data blocks
+ $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
+ $output .= '<div id="glm-debug-contents"><h2>Data Blocks</h2><ul>';
+ $n = 0;
+ if (is_array($dataBlocks)) {
+ foreach($dataBlocks as $d) {
+ $output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
+ }
+ }
+ $output .= '</ul></div><hr>';
+ if (is_array($dataBlocks)) {
+ reset($dataBlocks);
+ $n = 0;
+ foreach($dataBlocks as $d) {
+ $output .= '
+ <div style="margin-top: 2em;">
+ <div style="float: right;"><a href="#top">[Top]</a></div>
+ <div class="glm-debug-section-title"><a name="'.++$n.'"><h4>'.$d['title'].'</h4></a></div>
+ <div class="glm-debug-section-body"><pre>'.print_r($d['data'],1).'</pre></div>
+ </div>
+ ';
+ }
+ }
+ delete_option('glmMembersAdminNoticeDataBlocks');
+
+ echo $output.'
+ </body>
+ </html>
+ ';
+
+ // Otherwise we're outputting data to the message block in the WordPress admin area
+ } else {
+
+ // Start with div class to output in standard admin notice block
+ $output .= '<div class="updated"><p>';
+
+ // Get the notice texts
+ $notices = get_option('glmMembersAdminNotices');
+
+ if (is_array($notices) && count($notices) > 0) {
+
+ // For each notice retrieved
+ $br = '';
+ foreach($notices as $n) {
+
+ // Add the notice to the output
+ $output .= $br.$n;
+ $br = '<br>';
+ }
+
+ }
+
+ echo $output.'</p></div>';
+
+ // Delete the option containing the notices to indicate they have been sent
+ delete_option('glmMembersAdminNotices');
+
+ }
+
+}
+
+/*
+ * Check if there's any startup notices in this file. (stuff that happens before we get all setup)
+ *
+ * If there is, have the message displayed at the top of the wp-admin content area.
+ */
+function glmMembersStartupNotices() {
+ global $startupNotices;
+ echo '<div class="updated"><h3>'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Warning</h3><p>'.$startupNotices.'</p></div>';
+}
+if ($startupNotices != '') {
+ add_action('admin_notices','glmMembersStartupNotices');
+}
+
+/*
+ * Check if there's any debug information or other notices that need to be displayed
+ *
+ * If there is, display as a separate window.
+ *
+ * NOTE: Need to break out notices that should be displayed in the wp-admin content area. To
+ * do that I need to modify the glmMembersAdminNotices function above and the
+ * addNotice() function in the classes/glmPluginSupport.php file. Should have addNotice()
+ * function be able to add to another option specifically for doing this.
+ */
+$notices = get_option('glmMembersAdminNotices');
+if (is_admin() && $notices && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+
+ // Add action to output the notices
+ add_action('admin_notices','glmMembersAdminNotices');
+
+}
+
+?>
\ No newline at end of file
<?php
-/**
- * Plugin Name: GLM Members Database
- * Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
- * Version: 1.0
- * Author: Chuck Scott
- * Author URI: http://www.gaslightmedia.com/
- * License: GPL2
- */
-
-/**
- * Gaslight Media Members Database
- * Index
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0
- */
-
-/*
- * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-$startupNotices = '';
-
-// Get standard defined parameters
-require_once('defines.php');
-
-// Get plugin configuration
-$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true);
-$config = $configData['common'];
-// Override parameters according to GLM_HOST_ID
-$hostSection = strtolower(GLM_MEMBER_PLUGIN_HOST).':common';
-if (isset($configData[$hostSection])) {
- $config = array_replace($config, $configData[strtolower(GLM_MEMBER_PLUGIN_HOST).':common']);
-} else {
- $startupNotices .=
- '<p><b>Bad configuration file section name or section not found:</b> '. $hostSection
- .'<br>See plugin '.GLM_MEMBERS_PLUGIN_PATH.'config/plugin.ini file.'
- .'<br>Also check that the server "GLM_HOST_ID" environment parameter exists and matches a section in the above ini file.</p>'
- ;
-}
-
-// Add Debug defines - These can't go into the defines.php file - Guess why.
-define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', $config['admin_debug']);
-define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', $config['admin_debug_verbose']);
-define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', $config['front_debug']);
-define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', $config['front_debug_verbose']);
-
-// Also get image sizes array from the plugin.ini - uses separate ini section.
-$config['imageSizes'] = $configData['imageSizes'];
-
-// Get additional configuration data
-$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/states.ini');
-$config['states'] = $stateData['states'];
-$countryData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/countries.ini');
-$config['countries'] = $countryData['countries'];
-
-// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
-add_option('glmMembersDatabaseDbVersion', false);
-
-// Custom plugin post type (for wp_post entries)
-// define('GLM_MEMBERS_PLUGIN_POST_TYPE', '');
-
-
-/**
- * *******************************************************************************
- *
- * *** Directory and File Structure ***
- *
- * index.php
- *
- * Index file for this plugin. All plugin processing starts here. (See
- * "Process Flow" below.)
- *
- * controllers
- *
- * Directory containing any controllers. Typically there
- * would be admin and front controllers in this directory.
- * These controllers do the general setup for the plugin,
- * determine and call the appropriate model, determine the
- * appropriate view, then merge any data returned by the model
- * with the view and output the result as appropriate.
- *
- * When executed, a model may determine that it cannot handle
- * the current request and return such a notice to the controller
- * possibly with a suggested model to execute. Models may also
- * return a desired view back to the controller based on the
- * result of processing, but should do so in a generic way so
- * as to permit multi-lingual output and use of multiple "skins"
- * (but not to the exception of appropriate use of WordPress
- * Themes).
- *
- * css
- *
- * Directory containing any css files specific to this plugin.
- * The use of additional styling should be kept to a minimum
- * so as to not interfere with the application of WordPress
- * default styling and Themes.
- *
- * js
- *
- * Directory containing any JAVAscript files specific to this
- * Plugin. This directory should be reserved for general script
- * files that provide functionality that can be used in various
- * views. Any JAVAscript that is specific to a view should be
- * located along with the associated view as it is logically
- * part of the view.
- *
- * lib
- *
- * Directory containing any class or function libraries that
- * are used generally by this plugin. Any class or other code
- * that is specific to a particular model should be located
- * in, or along with, that model since it is logically
- * associated only with that model.
- *
- * misc
- *
- * Directory containing ancillary directories and files. This
- * might be used for things like cach directories. An example
- * might be the "smarty" directory for Smaarty Templates.
- *
- * models
- *
- * Directory containing model files that execute a specific
- * process in this plugin. If this is a simple plugin, then
- * the model files can be placed directly in this directory.
- * If it's a more complex plugin, then there should be sub-
- * directories for various groupings of related model files.
- *
- * An individual model may consist of a grouping of files,
- * such as additional class files, that are specific only to
- * that model. In that case, these should be located in a
- * subdirectory under where the model file called by the
- * controller is located and that directory should be named
- * so as to be obviously associated with that model.
- *
- * There are three special files in the models directory. These
- * are activate.php, deactivate.php, and uninstall.php. These
- * are called via hooks setup in this file and should always
- * be here. If they do not provide any real functionality, they
- * should at least be a shell that can be called for those
- * situations.
- *
- * views
- *
- * Directory containing view files for producing output upon
- * request of a model file in the models directory. If this
- * is a simply plugin, then the view files can be placed
- * directly in this directory. If it's a more complex plugin,
- * then there should be sub-directories for the various
- * groupings of related view files. If using sub-directories,
- * those should generally match the associated model directories.
- * It may also be wise to use separate front and admin
- * directories under views to keep things organized.
- *
- * Additionally, views may be grouped in such a way that they
- * support the selection of various "skins" that output in
- * different ways, although any styling should be provided by
- * WordPress Themes or use default WordPress styling.
- *
- * *** Process Flow ***
- *
- * WordPress calls the plugin index file. All plugin processing starts here.
- *
- * The plugin index file performs the following operations ...
- * - Sets-up any required plugin-wide defines and data
- * - Instatiates any plugin-wide classes and objects
- * - Sets-up any plugin-wide WordPress hooks
- * - Determines which controller is to be executed
- * - Executes the selected controller
- *
- * The selected controller performs the following operations ...
- * - Sets-up any controller specific defines and data
- * - Instatiates any controller specific classes and objects
- * - Sets-up any controller specific WordPress hooks
- * - Determines which model process is to be executed
- * - Executes the selected model
- *
- * The selected model performs the following operations ...
- * - Sets-up any model specific defines and data
- * - Instatiates any model specific classes and objects
- * - Sets-up any model specific WordPress hooks
- * - Performs any specific processing required of the model
- * - Determines which view is to be used to generate output
- * - Generates output based on model data and the selected view
- *
- * WordPress wraps everything up
- *
- * ********************************************************************************
- */
-
-/*
- *
- * Activate, Deactivate, Uninstall hooks
- *
- */
-
-// Activate
-function glmMembersPluginActivate ()
-{
- global $wpdb, $config;
- require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
- new glmMembersPluginActivate($wpdb, $config);
-}
-register_activation_hook(__FILE__, 'glmMembersPluginActivate');
-
-// Deactivate
-function glmMembersPluginDeactivate ()
-{
- global $wpdb, $config;
- require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
- $x = new glmMembersPluginDeactivate($wpdb, $config);
- return false;
-}
-register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate');
-
-// Uninstall - Not using. Using "uninstall.php" in the root directory of this plugin.
-
-/*
- *
- * Load any other common files needed
- *
- */
-
-// Load data abstract
-require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
-
-/*
- *
- * Determine which controller to load
- *
- * The first is for displaying notices in another window, possibly for debug output.
- *
- */
-if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
- glmMembersAdminNotices(true);
- exit;
-} elseif (is_admin()) {
- require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php');
- new glmMembersAdmin($wpdb, $config);
-} else {
- require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php');
- new glmMembersFront($wpdb, $config);
-}
-
-
-/*
- * Function to display admin notices.
- *
- * This function is only called using the add_action('admin_notices','...') function
- * in the code below this function.
- *
- * @return void
- * @access public
- */
-function glmMembersAdminNotices($windowed = false)
-{
-
- $output = '';
-
- // If windowed for debug, also include HTML header and stylesheet
- if ($windowed) {
-
- $output .= '
- <html>
- <head>
- <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
- <head>
- <body>
- <a name="top"></a>
- <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
- <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
- ';
-
- // Display alerts
- $alerts = get_option('glmMembersAdminNoticeAlerts');
- if(is_array($alerts)) {
- $output .= '<div id="glm-debug-alerts" class="glm-error"><h2>Alerts</h2>';
- foreach($alerts as $a) {
- $output .= $a.'<br>';
- }
- } else {
- $output .= '<div id="glm-debug-alerts"><h2>Alerts</h2>';
- }
- $output .= '</div><hr>';
- delete_option('glmMembersAdminNoticeAlerts');
-
- // Display process messages
- $process = get_option('glmMembersAdminNoticeProcess');
- $output .= '<div id="glm-debug-process"><h2>Processing</h2>';
- if(is_array($process)) {
- foreach($process as $p) {
- $output .= $p.'<br>';
- }
- }
- $output .= '</div><hr>';
- delete_option('glmMembersAdminNoticeProcess');
-
- // Display data blocks table of contents then the data blocks
- $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
- $output .= '<div id="glm-debug-contents"><h2>Data Blocks</h2><ul>';
- $n = 0;
- if (is_array($dataBlocks)) {
- foreach($dataBlocks as $d) {
- $output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
- }
- }
- $output .= '</ul></div><hr>';
- if (is_array($dataBlocks)) {
- reset($dataBlocks);
- $n = 0;
- foreach($dataBlocks as $d) {
- $output .= '
- <div style="margin-top: 2em;">
- <div style="float: right;"><a href="#top">[Top]</a></div>
- <div class="glm-debug-section-title"><a name="'.++$n.'"><h4>'.$d['title'].'</h4></a></div>
- <div class="glm-debug-section-body"><pre>'.print_r($d['data'],1).'</pre></div>
- </div>
- ';
- }
- }
- delete_option('glmMembersAdminNoticeDataBlocks');
-
- echo $output.'
- </body>
- </html>
- ';
-
- // Otherwise we're outputting data to the message block in the WordPress admin area
- } else {
-
- // Start with div class to output in standard admin notice block
- $output .= '<div class="updated"><p>';
-
- // Get the notice texts
- $notices = get_option('glmMembersAdminNotices');
-
- if (is_array($notices) && count($notices) > 0) {
-
- // For each notice retrieved
- $br = '';
- foreach($notices as $n) {
-
- // Add the notice to the output
- $output .= $br.$n;
- $br = '<br>';
- }
-
- }
-
- echo $output.'</p></div>';
-
- // Delete the option containing the notices to indicate they have been sent
- delete_option('glmMembersAdminNotices');
-
- }
-
-}
-
-/*
- * Check if there's any startup notices in this file. (stuff that happens before we get all setup)
- *
- * If there is, have the message displayed at the top of the wp-admin content area.
- */
-function glmMembersStartupNotices() {
- global $startupNotices;
- echo '<div class="updated"><h3>'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Warning</h3><p>'.$startupNotices.'</p></div>';
-}
-if ($startupNotices != '') {
- add_action('admin_notices','glmMembersStartupNotices');
-}
-
-/*
- * Check if there's any debug information or other notices that need to be displayed
- *
- * If there is, display as a separate window.
- *
- * NOTE: Need to break out notices that should be displayed in the wp-admin content area. To
- * do that I need to modify the glmMembersAdminNotices function above and the
- * addNotice() function in the classes/glmPluginSupport.php file. Should have addNotice()
- * function be able to add to another option specifically for doing this.
- */
-$notices = get_option('glmMembersAdminNotices');
-if (is_admin() && $notices && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-
- // Add action to output the notices
- add_action('admin_notices','glmMembersAdminNotices');
-
-}
-
-?>
\ No newline at end of file
+// Silence is golden.
\ No newline at end of file