* @link http://dev.gaslightmedia.com/
*/
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
// Load glmPluginSupport class
require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
// This line is for dropping the currrent database version for testing
// delete_option('glmMembersDatabaseDbVersion');
+ // Check if there was an error and WP is calling us again
+ if ($this->checkErrorScrape()) {
+ exit;
+ }
+
// Make sure the current user has this capability
if (! current_user_can('activate_plugins')) {
$this->addNotice("Interesting, you don't have permission to activate plugins.");
if (!$noDatabaseCheck) {
- $this->checkErrorScrape();
-
// Check the database and permit installation of a new database if it doesn't exist;
if (!$this->checkDatabase('install')) {
} else {
$installErrors = get_option('glmMembersInstallErrors');
- echo 'There has been an unknown error installing the Gaslight Media Members Database plugin.<p>'.$installErrors;
+ echo 'There has been an unknown error with the Gaslight Media Members Database plugin.<p>'.$installErrors;
+ delete_option('glmMembersInstallErrors');
+
}
// Quit here so Wordpress doesn't mark plugin as activated or deactivated
- exit;
+ return true;
}
+ return false;
+
}
/*
public function checkDatabase ($option = false)
{
-
$dbVersion = get_option('glmMembersDatabaseDbVersion');
$db_setup_status = false;
$existingTables = $this->wpdb->get_var("
SELECT COUNT(*)
FROM information_schema.tables
- WHERE table_name like '".GLM_MEMBERS_PLUGIN_DB_PREFIX."%';
+ WHERE table_schema = 'explorewesternup'
+ AND table_name like '".GLM_MEMBERS_PLUGIN_DB_PREFIX."%';
");
// If there's no tables, just assume we need to install all new ones.
// If glmMembersDatabaseDbVersion is not set, install current version
if (!$dbVersion) {
-
+echo "111";
// If $option is not 'install', then don't do it;
if ($option != 'install') {
return false;
// Otherwise, check if we need to update the database
} elseif ($dbVersion != GLM_MEMBERS_PLUGIN_DB_VERSION) {
-
+echo "222";
// Include an admin message that we're updating the database
$this->addNotice('<b>The '.GLM_MEMBERS_PLUGIN_NAME.' database tables require updating...</b>');
}
} else {
-// $this->addNotice('The '.GLM_MEMBERS_PLUGIN_NAME.' has been reactivated using the existing database tables.');
-// $db_setup_status = true;
+ $this->addNotice('The '.GLM_MEMBERS_PLUGIN_NAME.' has been reactivated using the existing database tables.');
+ $db_setup_status = true;
}
return $db_setup_status;
require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
// Load Smarty Template Support
-require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
/**
* Admin Controller Class
// Load glmPluginSupport class
require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
+// Load Smarty Template Support
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
+
/*
* This class controls which models are use for front-end functionality
* of this plugin.
*/
// Load Smarty Template support
- require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
$smarty = new smartyTemplateSupport();
// Add standard parameters
* @link http://dev.gaslightmedia.com/
*/
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
// Load glmPluginSupport class
require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
die();
}
+ // Check if there was an error and WP is calling us again
+ if ($this->checkErrorScrape()) {
+ exit;
+ }
+
+
// Save WordPress Database object
$this->wpdb = $wpdb;
$urlParts = parse_url(get_bloginfo('url'));
$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only
-$adminURL = admin_url('admin.php');
$WPUploadDir = wp_upload_dir();
// URLs
-define('GLM_MEMBERS_SITE_BASE_URL', $pageProtocol.'://'.$urlParts['host'].$urlParts['path'].'/');
-define('GLM_MEMBERS_PLUGIN_ADMIN_URL', $adminURL);
+define('GLM_MEMBERS_SITE_BASE_URL', home_url('/') );
define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__));
+define('GLM_MEMBERS_PLUGIN_ADMIN_URL', admin_url('admin.php'));
define('GLM_MEMBERS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PLUGIN_DIR);
define('GLM_MEMBERS_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
define('GLM_MEMBERS_PLUGIN_MEDIA_URL', $WPUploadDir['baseurl'].'/'.GLM_MEMBERS_PLUGIN_DIR);
* ********************************************************************************
*/
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
/*
* Some initial setup and tests
*/
* new smartyTemplateSupport();
*
*/
+
class smartyTemplateSupport {
/**
* @link http://dev.gaslightmedia.com/
*/
-// Get setup and configuration
-require_once('defines.php');
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
//if uninstall not called from WordPress exit
-if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
- exit();
+if (!defined('WP_UNINSTALL_PLUGIN')) {
+ die("Sorry, uninstall must be called by WordPress!");
+}
+
+// Get setup and configuration
+require_once('defines.php');
// Delete options
delete_option('glmMembersDatabasePluginVersion');