initial commit
authorChuck Scott <cscott@gaslightmedia.com>
Sun, 29 Nov 2015 22:29:48 +0000 (17:29 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Sun, 29 Nov 2015 22:29:48 +0000 (17:29 -0500)
17 files changed:
activate.php [new file with mode: 0644]
config/plugin.ini [new file with mode: 0644]
deactivate.php [new file with mode: 0644]
defines.php [new file with mode: 0644]
glm-member-db-packaging.php [new file with mode: 0644]
index.php [new file with mode: 0644]
misc/documentation/CreateNewAddOn.txt [new file with mode: 0644]
models/admin/sample/index.php [new file with mode: 0644]
readme.txt [new file with mode: 0644]
setup/adminMenus.php [new file with mode: 0644]
setup/adminTabs.php [new file with mode: 0644]
setup/permissions.php [new file with mode: 0644]
setup/rolesAndCapabilities.php [new file with mode: 0644]
setup/validActions.php [new file with mode: 0644]
uninstall.php [new file with mode: 0644]
views/admin/sample/header.html [new file with mode: 0644]
views/admin/sample/index.html [new file with mode: 0644]

diff --git a/activate.php b/activate.php
new file mode 100644 (file)
index 0000000..ccc381b
--- /dev/null
@@ -0,0 +1,155 @@
+<?php
+
+/**
+ * Gaslight Media Members Database Packaging Add-On Plugin
+ * Activate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabasePackaging
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is activated.
+ *
+ * Currently the only actions are to add role capability to display and modify
+ * prototypes.
+ */
+class glmMembersPackagingPluginActivate
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * Note that the $noDatabaseCheck is used to access the database versions
+     * without triggering a database check.
+     *
+     * Performs all the work for this model
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // 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.");
+            die();
+        }
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Set current plugin version
+        update_option('glmMembersDatabasePackagingPluginVersion', GLM_MEMBERS_PACKAGING_PLUGIN_VERSION);
+
+        // Set Roles and Capabilities for this plugin
+        require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php');
+    }
+
+    /*
+     * Add a capability to all current roles
+     *
+     * @param string $capability Name of capability to add
+     * @param array $default Whether capability should be on by default
+     *           array(
+     *               'author' => false,
+     *               'contributor' => false,
+     *               'editor' => false,
+     *               'subscriber' => false
+     *           )
+     *
+     * @return void
+     * @access private
+     */
+    private function addRoleCapability($capability, $default)
+    {
+        // Get list of role objects
+        $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+        // Get list of roles we can edit
+        $roles = get_editable_roles();
+
+        // For each role object
+        foreach ($roleObjects as $key => $role) {
+
+            // Check if the role exists in list of editable roles and
+            // the capability does not exist
+            if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
+
+                // Check if a default value has been specified in the $default array
+                $enabled = false;
+                if (isset($default[$role->name])) {
+
+                    // It has, so use that
+                    $enabled = $default[$role->name];
+
+                }
+
+                // Add the role
+                $role->add_cap($capability, $enabled);
+
+            }
+        }
+    }
+
+
+    /*
+     * Delete a capability from all current roles
+     *
+     * @param string $capability Name of capability to add
+     *
+     * @return void
+     * @access private
+     */
+    private function deleteRoleCapability($capability)
+    {
+        // Get list of role objects
+        $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+        // Get list of roles we can edit
+        $roles = get_editable_roles();
+
+        // For each role object
+        foreach ($roleObjects as $key => $role) {
+
+            if ( isset($role->capabilities[$capability])) {
+                $role->remove_cap($capability);
+            }
+
+        }
+
+    }
+
+
+
+}
+
+?>
diff --git a/config/plugin.ini b/config/plugin.ini
new file mode 100644 (file)
index 0000000..8fdb6a8
--- /dev/null
@@ -0,0 +1,6 @@
+;
+; Main Configuration File
+; Gaslight Media Members Database Packaging Add-On Plugin 
+;
+
+[common]
diff --git a/deactivate.php b/deactivate.php
new file mode 100644 (file)
index 0000000..ad35600
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Gaslight Media Members Database Packaging Add-On Plugin
+ * Deactivate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabasePackaging
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is deactivated.
+ */
+class glmMembersPackagingPluginDeactivate
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * Performs all the work for this model
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Delete our version from WordPress Options
+        delete_option('glmMembersDatabasePackagingPluginVersion');
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/defines.php b/defines.php
new file mode 100644 (file)
index 0000000..312406f
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Gaslight Media Members Database Packaging Child Plugin
+ *
+ * Set standard defined parameters
+ */
+
+// NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
+
+define('GLM_MEMBERS_PACKAGING_PLUGIN_NAME', 'Gaslight Media Members Database Packaging Add-OIn');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_SHORT_NAME', 'Packaging');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_SLUG', 'glm-member-db-packaging');
+
+// 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_PACKAGING_PLUGIN_HOST', $host);
+
+// Determine current http/https protocol
+$pageProtocol = 'http';
+if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
+    $pageProtocol = 'https';
+}
+define('GLM_MEMBERS_PACKAGING_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+
+// Get various pieces of the URL
+$urlParts = parse_url(get_bloginfo('url'));
+$pageUri = explode('?', $_SERVER['REQUEST_URI']);               // Bust this up to access URL path and script name only
+
+$WPUploadDir = wp_upload_dir();
+
+// URLs
+define('GLM_MEMBERS_PACKAGING_SITE_BASE_URL', home_url('/') );
+define('GLM_MEMBERS_PACKAGING_PLUGIN_URL', plugin_dir_url(__FILE__));
+define('GLM_MEMBERS_PACKAGING_PLUGIN_ADMIN_URL', admin_url('admin.php'));
+define('GLM_MEMBERS_PACKAGING_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG);
+define('GLM_MEMBERS_PACKAGING_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
+define('GLM_MEMBERS_PACKAGING_PLUGIN_MEDIA_URL', $WPUploadDir['baseurl'].'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG);
+
+// Directories
+define('GLM_MEMBERS_PACKAGING_PLUGIN_PATH', dirname(__FILE__));
+define('GLM_MEMBERS_PACKAGING_PLUGIN_DB_SCRIPTS', dirname(__FILE__).'/misc/databaseScripts');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH', GLM_MEMBERS_PACKAGING_PLUGIN_PATH.'/classes');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_CONFIG_PATH', GLM_MEMBERS_PACKAGING_PLUGIN_PATH.'/config');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH', GLM_MEMBERS_PACKAGING_PLUGIN_PATH.'/setup');
+
+// Database table prefixes
+global $wpdb;
+define('GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_members_');
+
+
+// Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin
+$pluginsPath = str_replace(GLM_MEMBERS_PACKAGING_PLUGIN_SLUG, '', GLM_MEMBERS_PACKAGING_PLUGIN_PATH);
+define('GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_LIB_PATH', GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH.'/lib');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_MEDIA_PATH', $WPUploadDir['basedir'].'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG);
+define('GLM_MEMBERS_PACKAGING_PLUGIN_IMAGES_PATH', GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH.'/images');
+
+?>
diff --git a/glm-member-db-packaging.php b/glm-member-db-packaging.php
new file mode 100644 (file)
index 0000000..4f83c29
--- /dev/null
@@ -0,0 +1,174 @@
+<?php
+/**
+ * Plugin Name: GLM Members Database Packaging Add-on
+ * Plugin URI: http://www.gaslightmedia.com/
+ * Description: Gaslight Media Members Database.
+ * Version: 0.0.0
+ * Author: Chuck Scott
+ * Author URI: http://www.gaslightmedia.com/
+ * License: GPL2
+ */
+
+/**
+ * Gaslight Media Members Database Packaging Add-On
+ * Index
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPluginChild
+ * @package glmMembersDatabasePackagingAddOn
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.0.0
+ */
+
+/*
+ *  Plugin and Database Versions
+ *
+ *  Note that the database version matches the version of the last
+ *  plugin version where there was a change in the database.
+ *
+ *  Updates to checkDatabase() in glmPluginSupport.php must be
+ *  made together with the DB_VERSION below. ONLY bump the DB
+ *  version when there's a change in the database!! Use the
+ *  version nunmber of that release for the DB version.
+ */
+define('GLM_MEMBERS_PACKAGING_PLUGIN_VERSION', '0.0.0');
+
+// This is the minimum version of the GLM Members DB plugin require for this plugin.
+define('GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.43');
+
+/*
+ * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+* Some initial setup and tests
+*/
+
+$startupNotices = '';
+
+// Get standard defined parameters
+require_once('defines.php');
+
+// Required to be able to get user capabilities when being called as a filter from the main plugin
+require_once(ABSPATH . 'wp-includes/pluggable.php');
+
+/*
+ * Do some checks to make sure the main GLM Member DB is active and of a recceint enough version
+ */
+
+// Function to generate message regarding main GLM Member DB plugin not installed and active
+function glmMembersPackagingPluginRequired() {
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
+            <p>The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+
+/*
+ * Check installation, activation, and version of main Member DB plugin
+ */
+include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
+$plugin_name = 'glm-member-db/glm-member-db.php';
+$is_active = is_plugin_active($plugin_name);
+
+// If it's not active, then warn user and deactivate this add-on plugin
+if ($is_active != '1') {
+    add_action( 'admin_notices', 'glmMembersPackagingPluginRequired' );
+    deactivate_plugins('/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'.php');
+}
+
+// Function to generate message regarding main GLM Member DB plugin version is not receint enought to run this add-on
+function glmMembersPluginMinVerRequired() {
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
+                    .GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!</p>
+            <p>The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+
+/*
+ * Check for Minimum DB version for main Member DB
+ */
+$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
+if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
+    add_action( 'admin_notices', 'glmMembersPluginMinVerRequired');
+    deactivate_plugins('/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'.php');
+}
+
+/*
+ * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
+ */
+require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/validActions.php');
+function glmMembersRegisterPackaging($addOns) {
+
+    // Add this add-on to the add-ons array
+    $addOns[GLM_MEMBERS_PACKAGING_PLUGIN_SLUG] =  array(
+            'dir' => GLM_MEMBERS_PACKAGING_PLUGIN_PATH,
+            'name' =>  GLM_MEMBERS_PACKAGING_PLUGIN_NAME,
+            'short_name' => GLM_MEMBERS_PACKAGING_PLUGIN_SHORT_NAME,
+            'slug' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG,
+            'actions' => $GLOBALS['glmMembersAddOnValidActions']
+    );
+
+    // Return the array with our data added
+    return $addOns;
+}
+add_filter('glm-member-db-register-addon','glmMembersRegisterPackaging', 10, 1);
+
+ /*
+  *
+  * Activate and Deactivate hooks
+  *
+ */
+
+ // Activate
+ function glmMembersPackagingPluginActivate ()
+ {
+     global $wpdb, $config;
+     require_once (GLM_MEMBERS_PACKAGING_PLUGIN_PATH . '/activate.php');
+     new glmMembersPackagingPluginActivate($wpdb, $config);
+ }
+ register_activation_hook(__FILE__, 'glmMembersPackagingPluginActivate');
+
+ // Deactivate
+ function glmMembersPackagingPluginDeactivate ()
+ {
+     global $wpdb, $config;
+     require_once (GLM_MEMBERS_PACKAGING_PLUGIN_PATH . '/deactivate.php');
+     $x = new glmMembersPackagingPluginDeactivate($wpdb, $config);
+     return false;
+ }
+ register_deactivation_hook(__FILE__, 'glmMembersPackagingPluginDeactivate');
+
+/*
+ * Hooks for testing capabilities provided by this add-on
+ */
+require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/permissions.php');
+
+
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..4e6c07c
--- /dev/null
+++ b/index.php
@@ -0,0 +1,3 @@
+<?php
+// Silence is golden.
+?>
\ No newline at end of file
diff --git a/misc/documentation/CreateNewAddOn.txt b/misc/documentation/CreateNewAddOn.txt
new file mode 100644 (file)
index 0000000..98089a9
--- /dev/null
@@ -0,0 +1,22 @@
+Proceedure to create a new GLM Members add-on plugin
+----------------------------------------------------
+
+* Checkout glm-member-db-blank and rename directory to glm-member-db-{addon name}
+
+* Rename glm-member-db-blank.php to glm-member-db-{addon name}.php
+
+* Search for an update any "GLM_MEMBERS_BLANK_" defines and references
+
+* Update defines.php and replace references to "blank"
+
+* deactivate.php - update "delete_option" at the bottom to reflect correct name
+
+* Change references to "glmMembersBlankPluginMinVerRequired"
+
+* Update all remaining references to the "blank" add-on name
+
+* Reset version number to 0.0.0
+
+* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git
+
\ No newline at end of file
diff --git a/models/admin/sample/index.php b/models/admin/sample/index.php
new file mode 100644 (file)
index 0000000..4a64cd6
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Sample Index Model
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_sample_index
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+    public function modelAction($actionData = false) {
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/sample/index.html',
+                'data' => false
+        );
+
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
new file mode 100644 (file)
index 0000000..b541db5
--- /dev/null
@@ -0,0 +1,27 @@
+=== Gaslight Media Member Database Packaging Child Plugin ===
+Contributors: cscott@gaslightmedia.com
+Donate link: http://www.gaslightmedia.com
+Tags: Gaslight Media,Plugin,Members Packaging
+Requires at least: 3.0.1
+Tested up to: 3.4
+Stable tag: 4.3
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+This is the Gaslight Media Members Database Packaging Child Plugin.
+
+== Description ==
+
+The Gaslight Media Members Database Packaging Child Plugin is an add-on to the Gaslight Media Members Database,
+which is required to install and run this plugin
+
+== Installation ==
+
+This section describes how to install the plugin and get it working.
+
+e.g.
+
+1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
+1. Activate the plugin through the 'Plugins' menu in WordPress
+
+
diff --git a/setup/adminMenus.php b/setup/adminMenus.php
new file mode 100644 (file)
index 0000000..d23d5c2
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Admin Menus
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Added menus or sub-menus examples
+ *
+ * add_submenu_page(
+ *     'glm-members-admin-menu-members',                   // Parent slug
+ *     'Sample',                                           // Page title
+ *     'Sample',                                           // Menu Title
+ *     'glm_members_edit',                                 // Capability required
+ *     'glm-members-admin-menu-sample',                    // Menu slug
+ *     function() {$this->controller('sample');}
+ * );
+ *
+ * If creating a main menu item with add_menu_page(), please document
+ * that structure here.
+ *
+ */
+
+
+?>
diff --git a/setup/adminTabs.php b/setup/adminTabs.php
new file mode 100644 (file)
index 0000000..a420b34
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Admin Tabs
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * To add a new tab to an existing Member DB page use a blick
+ * like this and replace the {} parameters.
+ *
+ * add_filter('glm-member-db-add-tab-for-{menu name}',
+ *     function($addOnTabs) {
+ *         $newTabs = array(
+ *             array(
+ *                 'text' => '{text for display on tab}',
+ *                 'menu' => '{menu name}',
+ *                 'action' => '{action to perform}'
+ *             )
+ *         );
+ *         $addOnTabs = array_merge($addOnTabs, $newTabs);
+ *         return $addOnTabs;
+ *     }
+ * );
+ *
+ */
+
+?>
\ No newline at end of file
diff --git a/setup/permissions.php b/setup/permissions.php
new file mode 100644 (file)
index 0000000..048444d
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Permissions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  permissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Below are permission checks for various specific things in this add-on and
+ * elsewhere in the Member DB main plugin and add-ons.
+ *
+ * Each location where a permission might be required has an apply_filters()
+ * hook with a tag name that includes the plugin or add-on name, the menu,
+ * the action, and a name for the specific thing that needs permissions.
+ *
+ * This can be included in code or in a Smarty template used in these plugins.
+ * For example, to check permissions for the main Members menu and it's "index"
+ * action to see if a member search is permitted, the template includes the
+ * following code...
+ *
+ * {if $membersList && apply_filters('glm_members_permit_admin_members_index_member_search', true)}
+ *      --- some template output ---
+ * {/if}
+ *
+ * In the case above, it's also checking to see if the members list even exists
+ * before checking the permissions. The default value of "true" in the hook ensures
+ * that the permission is granted if nothing has linked into the hook to say otherwise.
+ *
+ * Note that each add_filter() below first checks if the permission has already
+ * been retracted by prior hook. This requires all that are attached to the hook
+ * to permit the action.
+ *
+ * Of course any of these may test more than one capability if that's desired.
+ */
+
+?>
\ No newline at end of file
diff --git a/setup/rolesAndCapabilities.php b/setup/rolesAndCapabilities.php
new file mode 100644 (file)
index 0000000..9c3dc82
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Roles & Capabilities
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  rolesAndPermissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/**
+ * NOTE: This file is only included in the activate.php process.
+ *       It is not regularly used during operation.
+ */
+
+?>
\ No newline at end of file
diff --git a/setup/validActions.php b/setup/validActions.php
new file mode 100644 (file)
index 0000000..a766289
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Packaging Add-On Valid Actions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Array of valid menu items and actions.
+ *
+ * The higher level elements are valid menu items. These correlate to
+ * actual menu or sub menu items that are hooks back to this controller
+ * class.
+ *
+ * The lower level items below each menu item are actions that may be specified
+ * by a "glmMembersAction" form field.
+ *
+ * The string after the action is the slug of the plugin where the model/view
+ * is to perform that action.
+ *
+ * This array is integrated into the valid actions array in the main GLM Member
+ * DB plugin when this plugin registers itself.
+ */
+
+$glmMembersAddOnValidActions = array(
+    'adminActions' => array(
+        'sample' => array(
+            'index' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG
+        )
+    ),
+    'frontActions' => array(
+    )
+);
+
+
+?>
\ No newline at end of file
diff --git a/uninstall.php b/uninstall.php
new file mode 100644 (file)
index 0000000..b6f8124
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+die('uninstall not configured - See plugin uninstall.php script!');
+/**
+ * Gaslight Media Members Database Packaging Child Plugin
+ * Uninstall Plugin
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabasePackaging
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// 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')) {
+    die("Sorry, uninstall must be called by WordPress!");
+}
+
+
+?>
diff --git a/views/admin/sample/header.html b/views/admin/sample/header.html
new file mode 100644 (file)
index 0000000..f9fdb91
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="wrap">
+       
+    <h2>{$glmPluginName}</h2>
+    
+  
\ No newline at end of file
diff --git a/views/admin/sample/index.html b/views/admin/sample/index.html
new file mode 100644 (file)
index 0000000..6159f5d
--- /dev/null
@@ -0,0 +1,7 @@
+{include file='admin/sample/header.html'}
+
+    <h2>A Sample Add-On Menu</h2>
+
+    This is a test
+
+{include file='admin/footer.html'}