--- /dev/null
+<?php
+
+/**
+ * admin.php
+ *
+ * PHP version 5.3
+ *
+ * @category Toolkit
+ * @package Package
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @version SVN: (0.1)
+ * @link <>
+ */
+
+/**
+ * Gaslight Members Admin Controller
+ *
+ * Controller for all admin
+ *
+ * @category Toolkit
+ * @package Package
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @release Release: (0.1)
+ * @link <>
+ */
+class admin
+{
+ public $wpdb;
+
+ public function __construct($wpdb)
+ {
+ $this->wpdb = $wpdb;
+ }
+}
<?php
/*
-Plugin Name: Members
+Plugin Name: Gaslight Media Members
Plugin URI:
Description: Gaslight Media Members Database Plugin
Version: 1.0.0
License: Gaslght Media All Rights Reserved
*/
+define('GLM_MEMBERS_VERSION', '1.0');
+define('GLM_MEMBERS_VRS_OPTION_NAME', 'glm_member_db_version');
+define('GLM_MEMBERS_MEMBER_TABLE', 'members');
+define('GLM_MEMBERS_LOCATION_TABLE', 'locations');
+define('GLM_MEMBERS_CONTACT_TABLE', 'contacts');
+define('GLM_MEMBERS_REGION_TABLE', 'regions');
+define('GLM_MEMBERS_COUNTY_TABLE', 'counties');
+define('GLM_MEMBERS_CITY_TABLE', 'cities');
+define('GLM_MEMBERS_PLUGIN_FILE_PATH', __FILE__);
+
+require_once 'models/database.php';
+$glm_member_db = new glm_members_models_database($GLOBALS['wpdb']);
--- /dev/null
+<?php
+
+/**
+ * database.php
+ *
+ * PHP version 5.3
+ *
+ * @category Toolkit
+ * @package Package
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @version SVN: (0.1)
+ * @link <>
+ */
+
+/**
+ * Toolkit_Package_database
+ *
+ * Description of database
+ *
+ * @category Toolkit
+ * @package Package
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @release Release: (0.1)
+ * @link <>
+ */
+class glm_members_models_database
+{
+ public $wpdb;
+ public $membersTable;
+ public $locationTable;
+ public $contactTable;
+ public $regionTable;
+ public $countyTable;
+ public $cityTable;
+
+ public function __construct($wpdb)
+ {
+ $this->wpdb = $wpdb;
+ register_activation_hook(
+ GLM_MEMBERS_PLUGIN_FILE_PATH,
+ array($this, 'install')
+ );
+ register_uninstall_hook(
+ GLM_MEMBERS_PLUGIN_FILE_PATH,
+ array($this, 'delete')
+ );
+ add_action('plugins_loaded', array($this, 'glm_members_update_db_check'));
+
+ $this->membersTable = $this->wpdb->prefix . GLM_MEMBERS_MEMBER_TABLE;
+ $this->locationTable = $this->wpdb->prefix . GLM_MEMBERS_LOCATION_TABLE;
+ $this->contactTable = $this->wpdb->prefix . GLM_MEMBERS_CONTACT_TABLE;
+ $this->regionTable = $this->wpdb->prefix . GLM_MEMBERS_REGION_TABLE;
+ $this->countyTable = $this->wpdb->prefix . GLM_MEMBERS_COUNTY_TABLE;
+ $this->cityTable = $this->wpdb->prefix . GLM_MEMBERS_CITY_TABLE;
+ }
+
+ public function install()
+ {
+
+
+ $charset_collate = $this->wpdb->get_charset_collate();
+
+ $sql = "CREATE TABLE {$this->membersTable} (
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
+ create_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ name text NOT NULL,
+ url text DEFAULT '' NOT NULL,
+ join_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ phone text DEFAULT '' NOT NULL,
+ logo text DEFAULT '' NOT NULL,
+ UNIQUE KEY id (id)
+ ) {$charset_collate}";
+ include ABSPATH . 'wp-admin/includes/upgrade.php';
+ dbDelta($sql);
+
+ update_option(GLM_MEMBERS_VRS_OPTION_NAME, GLM_MEMBERS_VERSION);
+ }
+
+ public function glm_members_update_db_check()
+ {
+ if (GLM_MEMBERS_VERSION != get_option(GLM_MEMBERS_VRS_OPTION_NAME)) {
+ $this->install();
+ }
+ }
+
+ public function delete()
+ {
+ $sql = "
+ DROP TABLE IF EXISTS {$this->membersTable} ";
+ $this->wpdb->query($sql);
+ delete_option(GLM_MEMBERS_VRS_OPTION_NAME);
+ }
+
+}