From: Chuck Scott Date: Mon, 9 Mar 2015 16:35:29 +0000 (-0400) Subject: Cleaned up some initialization parameters and ini file parsing issues. X-Git-Tag: v1.0.0~62 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e6d76835eb66cb7e62df7849d334bcaa1fc98786;p=WP-Plugins%2Fglm-member-db.git Cleaned up some initialization parameters and ini file parsing issues. --- diff --git a/config/plugin.ini b/config/plugin.ini index 910160dc..dd5477d0 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -34,6 +34,12 @@ thumb['crop'] = false [common] +; Debug Options +admin_debug = false +admin_debug_verbose = false +front_debug = false +front_debug_verbose = false + ; ; Google Maps Browser API Key ; Account: cscott.glm@gmail.com @@ -230,5 +236,6 @@ phrase['phrase_test'] = 'test' [chuck:common] +;admin_debug = true diff --git a/defines.php b/defines.php index 5476cd65..8879abd3 100644 --- a/defines.php +++ b/defines.php @@ -8,11 +8,12 @@ define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database'); define('GLM_MEMBERS_PLUGIN_DIR', 'glm-member-db'); -// Debug Options -define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true); -define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', true); -define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', true); -define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', true); +// Determine which system we're running on - If not provided, assume PRODUCTION +$host = getenv('GLM_HOST_ID'); +if (trim($host) == '') { + $host = 'PRODUCTION'; +} +define('GLM_MEMBER_PLUGIN_HOST', $host); // Determine current http/https protocol $pageProtocol = 'http'; diff --git a/index.php b/index.php index 0a5aec20..703c4875 100644 --- a/index.php +++ b/index.php @@ -39,12 +39,33 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +$startupNotices = ''; + // Get standard defined parameters require_once('defines.php'); -// Get plugin configuration - Just use common section for now, we'll deal with others later +// 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 .= + '

Bad configuration file section name or section not found: '. $hostSection + .'
See plugin '.GLM_MEMBERS_PLUGIN_PATH.'config/plugin.ini file.' + .'
Also check that the server "GLM_HOST_ID" environment parameter exists and matches a section in the above ini file.

' + ; +} + +// Add Debug defines +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 @@ -355,11 +376,36 @@ function glmMembersAdminNotices($windowed = false) } } -// Check if there's admin notices for output + +/* + * 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 '

'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Warning

'.$startupNotices.'

'; +} +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 diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index 8badaf86..7d97fcb6 100644 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -200,7 +200,7 @@ Click and drag anywhere else on the map to move to another area.

(map loads here)
- position: Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon} + Selected Position: Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon}