From: Chuck Scott Date: Thu, 1 Oct 2015 14:44:09 +0000 (-0400) Subject: Working on Settigns X-Git-Tag: v1.0.28^2~2^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=31c81fa628339299b39e23d36c6a5e3ff1724f40;p=WP-Plugins%2Fglm-member-db.git Working on Settigns --- diff --git a/config.php b/config.php new file mode 100644 index 00000000..069ff2ed --- /dev/null +++ b/config.php @@ -0,0 +1,62 @@ +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 - 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 States and Countries arrays +$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']; + +// Read in Settings and Terms from database +$settings = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_general WHERE id = 1;", ARRAY_A); +unset($settings['id']); +$terms = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_terms WHERE id = 1;", ARRAY_A); +unset($terms['id']); +$config = array_merge($config, $settings, $terms); + +echo "
".print_r($config,1)."
"; +exit; + + +// Check for config value replacements in the current theme +$currentThemeDirectory = get_template_directory(); +if (file_exists($currentThemeDirectory.'/glm-member-db/plugin.ini')) { + + // Read in the ini file from the theme + $themeIni = parse_ini_file($currentThemeDirectory.'/glm-member-db/plugin.ini'); + + // Replace parameters that are in the theme ini file + $config = array_replace($config, $themeIni); + +} + +?> diff --git a/glm-member-db.php b/glm-member-db.php index 722dcae8..d634d360 100644 --- a/glm-member-db.php +++ b/glm-member-db.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Members Database * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.0.10 + * Version: 1.0.20 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -19,7 +19,7 @@ * @package glmMembersDatabase * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.0.10 + * @version 1.0.20 */ /* @@ -44,68 +44,12 @@ $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 .= - '

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 - 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']; - -// Check for config value replacements in the current theme -$currentThemeDirectory = get_template_directory(); -if (file_exists($currentThemeDirectory.'/glm-member-db/plugin.ini')) { - - // Read in the ini file from the theme - $themeIni = parse_ini_file($currentThemeDirectory.'/glm-member-db/plugin.ini'); - - // Replace parameters that are in the theme ini file - $config = array_replace($config, $themeIni); - -} - -// Add General Settings and Terms from the database to $config -$setGeneral = $wpdb->get_row( - 'SELECT * FROM '.GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general WHERE id = 1;', - ARRAY_A -); -unset($setGeneral['id']); -$setTerms = $wpdb->get_row( - 'SELECT * FROM '.GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_terms WHERE id = 1;', - ARRAY_A -); -unset($setTerms['id']); -$config = array_merge($config, $setGeneral, $setTerms); +// Get configuration +require_once('config.php'); // 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', ''); - /** * ******************************************************************************* * @@ -261,6 +205,15 @@ 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