Creating data classes and database sql files.
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Email Messages
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataEmailMessages class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataPlugins extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ public $postStats = false;
+ public $postSent = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'plugins';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Name
+ 'name' => array (
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Latest Version
+ 'latest_version' => array (
+ 'field' => 'latest_version',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Name
+ 'notes' => array (
+ 'field' => 'notes',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ );
+
+ }
+
+ /**
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+
+}
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Email Messages
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataEmailMessages class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataServers extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ public $postStats = false;
+ public $postSent = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'servers';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Location
+ 'location' => array (
+ 'field' => 'location',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // PHP Version
+ 'php_version' => array (
+ 'field' => 'php_version',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Mysql Version
+ 'mysql_version' => array (
+ 'field' => 'mysql_version',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ );
+
+ }
+
+ /**
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+
+}
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Email Messages
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataEmailMessages class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataSites extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ public $postStats = false;
+ public $postSent = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'sites';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Production Server
+ 'prod_server' => array (
+ 'field' => 'prod_server',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'servers',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'required' => true,
+ 'force_list' => true,
+ 'use' => 'a'
+ ),
+
+ // Develepment Server
+ 'dev_server' => array (
+ 'field' => 'dev_server',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'servers',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'required' => true,
+ 'force_list' => true,
+ 'use' => 'a'
+ ),
+ // Name
+ 'name' => array (
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Production URL
+ 'prod_url' => array (
+ 'field' => 'prod_url',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Development URL
+ 'dev_url' => array (
+ 'field' => 'dev_url',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Map Key
+ 'map_key' => array (
+ 'field' => 'map_key',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ );
+
+ }
+
+ /**
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ if ( $this->postStats ) {
+ // get number of queued emails for this message.
+ $queued = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT max( queue_date )
+ FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "email_queue
+ WHERE message_id = %d",
+ $r['id']
+ )
+ );
+ $r['stats'] = ( $queued ) ? strtotime( $queued ) : '';
+ }
+ if ( $this->postSent ) {
+ // get number of queued emails for this message.
+ $queued = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT max( send_date )
+ FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "email_logs
+ WHERE message_id = %d",
+ $r['id']
+ )
+ );
+ $r['sent'] = ( $queued ) ? strtotime( $queued ) : '';
+ }
+ return $r;
+ }
+
+
+}
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Members data abstract
+// require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataEmailMessages.php';
+// require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataEmailTemplates.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_plugins_index // extends GlmDataEmailMessages
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ( $wpdb, $config )
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ // parent::__construct( false, false );
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ( $actionData = false )
+ {
+ $view = 'index';
+ $success = true;
+ $option = '';
+ $option2 = false;
+ $viewPath = 'admin/plugins/';
+
+ if ( isset( $_REQUEST['option'] ) ) {
+ $option = $_REQUEST['option'];
+ }
+
+ if ( isset( $_REQUEST['option2'] ) ) {
+ $option2 = $_REQUEST['option2'];
+ }
+
+ $tData = array();
+ $templateData = array(
+ 'newEntry' => false,
+ 'thisOption' => $option,
+ );
+
+ switch ( $option ) {
+
+ default:
+ break;
+ }
+
+ $templateData = array_merge( $templateData, $tData );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => $viewPath . $view . '.html',
+ 'data' => $templateData
+ );
+
+ }
+
+}
* is named the same as the "glm_action" parameter.
*
*/
-
+add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Plugin Manager',
+ 'Plugin Manager',
+ 'glm_members_members',
+ 'glm-members-admin-menu-plugins',
+ function() {
+ $this->controller( 'plugins' );
+ }
+);
--- /dev/null
+-- Gaslight Media Plugins Database
+-- File Created: 6/13/19
+-- Database Version: 0.0.1
+-- Database Creation Script - Messages Add-On
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Servers
+CREATE TABLE {prefix}servers (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL,
+ location TINYTEXT NULL,
+ php_version TINYTEXT NULL,
+ mysql_version TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Plugins
+CREATE TABLE {prefix}plugins (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL,
+ latest_version TINYTEXT NOT NULL,
+ notes TEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Sites
+CREATE TABLE {prefix}server (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL,
+ prod_url TINYTEXT NULL,
+ dev_url TINYTEXT NULL,
+ prod_server INT NULL,
+ dev_server INT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Site Plugins
+CREATE TABLE {prefix}site_plugins (
+ id INT NOT NULL AUTO_INCREMENT,
+ site INT NOT NULL,
+ plugin INT NOT NULL,
+ prod_version TINYTEXT NULL,
+ dev_version TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Messages DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$glmMemberPluginsDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 4, 'date' => '06/13/2019'),
+);
+
$glmMemberPluginsAddOnValidActions = array(
'adminActions' => array(
+ 'plugins' => array(
+ 'index' => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
+ ),
),
'frontActions' => array(
)
);
-?>
\ No newline at end of file
+?>
--- /dev/null
+
+ </div> <!-- / admin content area -->
+
+ <div class="glm-copyright">
+ {$glmPluginName}<br>
+ Copyright © 2014-{$thisYear} Gaslight Media - All Rights Reserved<br>
+ Phone: 231-487-0692 - E-Mail: info@gaslightmedia.com<br>
+ <a href="http://www.gaslightmedia.com">http://www.gaslightmedia.com</a>
+ </div>
+
+
+</div> <!-- / wrap -->
--- /dev/null
+<div class="wrap" id="glm-member-db-messages-app">
+ <h2>Plugin Manager</h2>
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisUrl}?page={$thisPage}&option=plugins" class="nav-tab{if $thisOption==plugins} nav-tab-active{/if}">Plugins</a>
+ <a href="{$thisUrl}?page={$thisPage}&option=sites" class="nav-tab{if $thisOption==sites} nav-tab-active{/if}">Sites</a>
+ <a href="{$thisUrl}?page={$thisPage}&option=servers" class="nav-tab{if $thisOption==servers} nav-tab-active{/if}">Servers</a>
+ </h2>
+ <div id="glm-admin-content-container" style="width: 1024px;">
--- /dev/null
+{include file='admin/header.html'}
+
+<h2>Plugins Dashboard</h2>
+
+<div class="glma-row">
+ <div class="glma-small-4 glma-columns">
+ <div class="glma-row">
+ <div class="glma-small-5 glma-columns">
+ <a href="{$thisUrl}?page={$thisPage}&option=editServer" class="button button-primary">Add Server</a>
+ </div>
+ <div class="glma-small-5 glma-columns">
+ <a href="{$thisUrl}?page={$thisPage}&option=editSite" class="button button-primary">Add Site</a>
+ </div>
+ <div class="glma-small-5 glma-columns">
+ <a href="{$thisUrl}?page={$thisPage}&option=editPlugin" class="button button-primary">Add Plugin</a>
+ </div>
+ </div>
+ </div>
+</div>
+
+{include file='admin/footer.html'}