All important sample names, titles, parameters, and defines are now replaceable parameters
that the setup script will replace with strings requested by script input.
--- /dev/null
+#!/bin/bash
+#
+# New Add-On Setup Script
+#
+
+# Make sure this script is only run from the directory where it resides.
+THISDIR=`dirname $0`
+if [ "$THISDIR" != "." ] ; then
+ echo "This script MUST be run from the directory where it resides. - Exiting..."
+fi
+
+:'
+
+ Strings that are replaced
+
+ Replaceable String Example of text that might go here
+ ----------------------- ---------------------------------------------------------------
+ {descrName} Gaslight Media Members Database Sample Add-On Plugin
+ {shortName} Sample
+ {descrString} Gaslight Media Members Database Sample
+ {slugString} glm-member-db-sample
+ {definedPrefix} GLM_MEMBERS_SAMPLE
+ {camelcasePrefix} glmMembersSample Also use for database prefix
+ {databaseEnable} (Used to enable database tables by removing comment slashes)
+
+'
+
+okToProceed=""
+
+while [ "$okToProceed" != "Yes" ] ; do
+
+ while [ "$descrName" = "" ] || \
+ [ "$shortName" = "" ] || \
+ [ "$descrString" = "" ] || \
+ [ "$slugString" = "" ] || \
+ [ "$definedPrefix" = "" ] || \
+ [ "$camelcasePrefix" = "" ] || \
+ [ "$databaseEnable" = "" ] || \
+ [ "$okToProceed" != "" ] \
+ ; do
+
+ okToProceed=""
+ clear
+ echo "
+New GLM Associate Add-On Setup
+------------------------------
+"
+ read -e -i "$descrName" -p "Descriptive name (eg Gaslight Media Members Database Sample) : " descrName
+ read -e -i "$shortName" -p "Short name (eg Sample) : " shortName
+ read -e -i "$descrString" -p "Description (eg Gaslight Media Members Database Sample) : " descrString
+ read -e -i "$slugString" -p "Slug string (eg glm-member-db-sample) : " slugString
+ read -e -i "$definedPrefix" -p "Defined param prefix (eg GLM_MEMBERS_SAMPLE) : " definedPrefix
+ read -e -i "$camelcasePrefix" -p "CamelCase prefix (eg glmMembersSample) : " camelcasePrefix
+ read -e -i "$databaseEnable" -p "Enable Add-On DB tables (Yes/No) : " databaseEnable
+ done
+
+ echo "
+ Descriptive name...................: $descrName
+ Short name.........................: $shortName
+ Description........................: $descrString
+ Slug string........................: $slugString
+ Defined param prefix...............: $definedPrefix
+ CamelCase prefix...................: $camelcasePrefix
+ Add-on will have Database tables...: $databaseEnable
+
+ "
+ read -p "Is this all OK? (Yes/No): " okToProceed
+
+done
+
+echo "
+Running setup script with the above parameters
+----------------------------------------------"
+
+if [ -d ".git" ] ; then
+ echo "Git directory exists, removing to disconnect from repository ..."
+ rm -Rf .git
+else
+ echo "No Git directory detected ..."
+fi
+
+echo "Replace {descrName} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{descrName}/$descrName/g" {} \;
+
+echo "Replace {shortName} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{shortName}/$shortName/g" {} \;
+
+echo "Replace {descrString} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{descrString}/$descrString/g" {} \;
+
+echo "Replace {slugString} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{slugString}/$slugString/g" {} \;
+
+echo "Replace {definedPrefix} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{definedPrefix}/$definedPrefix/g" {} \;
+
+echo "Replace {camelcasePrefix} ..."
+find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{camelcasePrefix}/$camelcasePrefix/g" {} \;
+
+# If add-on is contributing database tables
+if [ "$databaseEnable" = "Yes" ] ; then
+ echo "Enabling database support for this add-on ..."
+ sed -i "s/{databaseEnable}//g" index.php
+else
+ echo "Dissabling database support for this add-on ..."
+ sed -i "s|{databaseEnable}|//|g" index.php
+fi
+
+echo "Removing other sample code and extraneous files ..."
+rm -Rf setup/databaseScripts/*
+rm -f classes/data/dataSample.php
+rm -Rf models/admin/info
+rm -Rf models/admin/members
+rm -Rf models/admin/sample
+rm -Rf views/admin/info
+rm -Rf views/admin/members
+rm -Rf views/admin/sample
+
+echo "Setup is complete, now removing this script ..."
+rm SETUP_SCRIPT
+
+echo "Done!
+"
<?php
/**
- * Gaslight Media Members Database Sample Add-On Plugin
+ * {descrName}
* Activate Plugin Tasks
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabaseSample
+ * @package {camelcasePrefix}
* @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/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file activates this add-on. Other than replacing the various
- * versions of the work "Sample", this code should not need editing.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
// Check that we're being called by WordPress.
if (!defined('ABSPATH')) {
die("Please do not call this code directly!");
* Currently the only actions are to add role capability to display and modify
* prototypes.
*/
-class glmMembersSamplePluginActivate
+class {camelcasePrefix}PluginActivate
{
/**
$this->config = $config;
// Set current plugin version
- update_option('glmMembersDatabaseSamplePluginVersion', GLM_MEMBERS_SAMPLE_PLUGIN_VERSION);
+ update_option('{camelcasePrefix}PluginVersion', {definedPrefix}_PLUGIN_VERSION);
// Set Roles and Capabilities for this plugin
- require_once GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php';
+ require_once {definedPrefix}_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php';
}
/*
--- /dev/null
+General class libraries developed specifically for this add-on should be placed in this directory.
+
+The lib directory should be considered instead for any standard class libraries not specifically developed for this add-on.
\ No newline at end of file
;
; Main Configuration File
-; Gaslight Media Members Database Sample Add-On Plugin
+; {descrName}
;
; Place any static configuration parameters here.
;
<?php
/**
- * Gaslight Media Members Database Sample Add-On Plugin
+ * {descrName}
* Deactivate Plugin Tasks
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabaseSample
+ * @package {camelcasePrefix}
* @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/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file deactivates this add-on. Other than replacing the various
- * versions of the work "Sample", this code should not need editing.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
// 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 glmMembersSamplePluginDeactivate
+class {camelcasePrefix}PluginDeactivate
{
/**
$this->config = $config;
// Delete our version from WordPress Options
- delete_option('glmMembersDatabaseSamplePluginVersion');
+ delete_option('{camelcasePrefix}PluginVersion');
}
}
<?php
/**
- * Gaslight Media Members Database Sample Child Plugin
+ * {DescrName}
*
* Set standard defined parameters
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
-
// NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
-define('GLM_MEMBERS_SAMPLE_PLUGIN_NAME', 'Gaslight Media Members Database Sample (sample)');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_SHORT_NAME', 'Sample');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_SLUG', 'glm-member-db-sample');
+define('{definedPrefix}_PLUGIN_NAME', '{descrName}');
+define('{definedPrefix}_PLUGIN_SHORT_NAME', '{shortName}');
+define('{definedPrefix}_PLUGIN_SLUG', '{slugString}');
// Database table prefixes - change if using add-on tables
global $wpdb;
-define('GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersSample_');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersSampleDbVersion');
+define('{definedPrefix}_PLUGIN_DB_PREFIX', $wpdb->prefix.'{camelcasePrefix}');
+define('{definedPrefix}_PLUGIN_ACTIVE_DB_OPTION', '{camelcasePrefix}DbVersion');
// 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_SAMPLE_PLUGIN_HOST', $host);
+define('{definedPrefix}_PLUGIN_HOST', $host);
// Determine current http/https protocol
$pageProtocol = 'http';
if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
$pageProtocol = 'https';
}
-define('GLM_MEMBERS_SAMPLE_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+define('{definedPrefix}_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
// Get various pieces of the URL
$urlParts = parse_url(get_bloginfo('url'));
* Create a copy of the plugin slug that can be used as a variable prefix used to keep
* global instances from clashing with instances in other plugins.
*/
-$vprefix = str_replace('-', '_', GLM_MEMBERS_SAMPLE_PLUGIN_SLUG);
-define('GLM_MEMBERS_SAMPLE_PLUGIN_PREFIX', $vprefix.'_');
+$vprefix = str_replace('-', '_', {definedPrefix}_PLUGIN_SLUG);
+define('{definedPrefix}_PLUGIN_PREFIX', $vprefix.'_');
// URLs
-define('GLM_MEMBERS_SAMPLE_SITE_BASE_URL', home_url('/') );
-define('GLM_MEMBERS_SAMPLE_PLUGIN_URL', plugin_dir_url(__FILE__));
-define('GLM_MEMBERS_SAMPLE_PLUGIN_ADMIN_URL', admin_url('admin.php'));
-define('GLM_MEMBERS_SAMPLE_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG);
-define('GLM_MEMBERS_SAMPLE_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
+define('{definedPrefix}_SITE_BASE_URL', home_url('/') );
+define('{definedPrefix}_PLUGIN_URL', plugin_dir_url(__FILE__));
+define('{definedPrefix}_PLUGIN_ADMIN_URL', admin_url('admin.php'));
+define('{definedPrefix}_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.{definedPrefix}_PLUGIN_SLUG);
+define('{definedPrefix}_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
// Directories
-define('GLM_MEMBERS_SAMPLE_PLUGIN_PATH', dirname(__FILE__));
-define('GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH', GLM_MEMBERS_SAMPLE_PLUGIN_PATH.'/setup');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS', GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/databaseScripts');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_CLASS_PATH', GLM_MEMBERS_SAMPLE_PLUGIN_PATH.'/classes');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_CONFIG_PATH', GLM_MEMBERS_SAMPLE_PLUGIN_PATH.'/config');
+define('{definedPrefix}_PLUGIN_PATH', dirname(__FILE__));
+define('{definedPrefix}_PLUGIN_SETUP_PATH', {definedPrefix}_PLUGIN_PATH.'/setup');
+define('{definedPrefix}_PLUGIN_DB_SCRIPTS', {definedPrefix}_PLUGIN_SETUP_PATH.'/databaseScripts');
+define('{definedPrefix}_PLUGIN_CLASS_PATH', {definedPrefix}_PLUGIN_PATH.'/classes');
+define('{definedPrefix}_PLUGIN_CONFIG_PATH', {definedPrefix}_PLUGIN_PATH.'/config');
// 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_SAMPLE_PLUGIN_SLUG, '', GLM_MEMBERS_SAMPLE_PLUGIN_PATH);
-define('GLM_MEMBERS_SAMPLE_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
-define('GLM_MEMBERS_SAMPLE_PLUGIN_LIB_PATH', GLM_MEMBERS_SAMPLE_MAIN_PLUGIN_PATH.'/lib');
+$pluginsPath = str_replace({definedPrefix}_PLUGIN_SLUG, '', {definedPrefix}_PLUGIN_PATH);
+define('{definedPrefix}_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
+define('{definedPrefix}_PLUGIN_LIB_PATH', {definedPrefix}_MAIN_PLUGIN_PATH.'/lib');
<?php
/**
- * Plugin Name: GLM Members Database Sample
+ * Plugin Name: {descrName}
* Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
- * Version: 0.0.7
+ * Description: {descrString}
+ * Version: 0.0.1
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This is the main file for this add-on. It is the file called by
- * WordPress to run aspects of this add-on.
- *
- * NOTE: Versions in this file must be reset as appropriate when
- * creating a new add-on. Be sure to preserve the versions listed
- * for "...MIN_MEMBERS_REQUIRED_VERSION".
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/**
- * Gaslight Media Members Database Sample Add-On
+ * {descrName}
* Index
*
* PHP version 5.5
*
* @category glmWordPressPluginChild
- * @package glmMembersDatabaseSampleAddOn
+ * @package {camelcasePrefix}AddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.1.1
+ * @version 0.0.1
*/
/*
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_SAMPLE_PLUGIN_VERSION', '0.0.7');
-// define('GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION', '0.0.1');
+define('{definedPrefix}_PLUGIN_VERSION', '0.0.1');
+{databaseEnable}define('{definedPrefix}_PLUGIN_DB_VERSION', '0.0.1');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.57');
+define('{definedPrefix}_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
// Check if plugin version is not current in WordPress option and if needed updated it
-if (GLM_MEMBERS_SAMPLE_PLUGIN_VERSION != get_option('glmMembersDatabaseSamplePluginVersion')) {
- update_option('glmMembersDatabaseSamplePluginVersion', GLM_MEMBERS_SAMPLE_PLUGIN_VERSION);
+if ({definedPrefix}_PLUGIN_VERSION != get_option('{camelcasePrefix}PluginVersion')) {
+ update_option('{camelcasePrefix}PluginVersion', {definedPrefix}_PLUGIN_VERSION);
}
/*
*/
// Check if database version should be defined and it isn't - This would be a plugin/add-on setup issue
-if (is_file(GLM_MEMBERS_SAMPLE_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION')) {
+if (is_file({definedPrefix}_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('{definedPrefix}_PLUGIN_DB_VERSION')) {
die('You have database scripts but have not defined a current database version at the top of index.php for this plugin/add-on!');
}
*/
// Check for main plugin and that it's active
-function glmMembersSamplePluginRequired() {
+function {camelcasePrefix}PluginRequired() {
echo '
<div class="error">
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' plugin has been de-activated.</p>
+ <p>The '.{definedPrefix}_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
+ <p>The '.{definedPrefix}_PLUGIN_NAME.' plugin has been de-activated.</p>
</div>
';
}
$plugin_name = 'glm-member-db/index.php';
$is_active = is_plugin_active($plugin_name);
if ($is_active != '1') {
- add_action( 'admin_notices', 'glmMembersSamplePluginRequired' );
- deactivate_plugins('/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'/index.php');
+ add_action( 'admin_notices', '{camelcasePrefix}PluginRequired' );
+ deactivate_plugins('/'.{definedPrefix}_PLUGIN_SLUG.'/index.php');
}
// Check for Minimum DB version for main Member DB
-function glmMembersPluginSampleMinVerRequired() {
+function {camelcasePrefix}MinVerRequired() {
echo '
<div class="error">
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
- .GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!<br>
- '.GLM_MEMBERS_SAMPLE_MIN_VERSION_NOTE.'</p>
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' plugin has been de-activated.</p>
+ <p>The '.{definedPrefix}_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
+ .{definedPrefix}_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!<br>
+ '.{definedPrefix}_MIN_VERSION_NOTE.'</p>
+ <p>The '.{definedPrefix}_PLUGIN_NAME.' plugin has been de-activated.</p>
</div>
';
}
$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
-if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
- define('GLM_MEMBERS_SAMPLE_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, Sample Requires: ".GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION);
- add_action( 'admin_notices', 'glmMembersPluginSampleMinVerRequired');
- deactivate_plugins('/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'.php');
+if (version_compare($glmMembersDatabasePluginVersion, {definedPrefix}_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
+ define('{definedPrefix}_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, {shortName} Requires: ".{definedPrefix}_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION);
+ add_action( 'admin_notices', '{camelcasePrefix}MinVerRequired');
+ deactivate_plugins('/'.{definedPrefix}_PLUGIN_SLUG.'/'.{definedPrefix}_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_SAMPLE_PLUGIN_SETUP_PATH.'/validActions.php';
-require_once GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/shortcodes.php';
-if (is_file(GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
- require_once GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS.'/dbVersions.php';
+require_once {definedPrefix}_PLUGIN_SETUP_PATH.'/validActions.php';
+require_once {definedPrefix}_PLUGIN_SETUP_PATH.'/shortcodes.php';
+if (is_file({definedPrefix}_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
+ require_once {definedPrefix}_PLUGIN_DB_SCRIPTS.'/dbVersions.php';
}
-// Load Sample Management Settings data
+// Load Add-On Management Settings data
/* None - Need to figure out a smooth way to do this.
-$sampleManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
-unset($sampleManagementSettings['id']);
+${camelcasePrefix}ManagementSettings = $wpdb->get_row( "SELECT * FROM ".{definedPrefix}_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
+unset(${camelcasePrefix}ManagementSettings['id']);
*/
-function glmMembersRegisterSample($addOns) {
+function {camelcasePrefix}RegisterAddOn($addOns) {
// Add this add-on to the add-ons array
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG] = array(
- 'dir' => GLM_MEMBERS_SAMPLE_PLUGIN_PATH,
- 'name' => GLM_MEMBERS_SAMPLE_PLUGIN_NAME,
- 'short_name' => GLM_MEMBERS_SAMPLE_PLUGIN_SHORT_NAME,
- 'slug' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- 'actions' => $GLOBALS['glmMembersSampleAddOnValidActions'],
+ $addOns[{definedPrefix}_PLUGIN_SLUG] = array(
+ 'dir' => {definedPrefix}_PLUGIN_PATH,
+ 'name' => {definedPrefix}_PLUGIN_NAME,
+ 'short_name' => {definedPrefix}_PLUGIN_SHORT_NAME,
+ 'slug' => {definedPrefix}_PLUGIN_SLUG,
+ 'actions' => $GLOBALS['{camelcasePrefix}AddOnValidActions'],
'config' => array(
),
- 'shortcodes' => $GLOBALS['glmMembersSampleShortcodes'],
- 'shortcodesDescription' => $GLOBALS['glmMembersSampleShortcodesDescription']
+ 'shortcodes' => $GLOBALS['{camelcasePrefix}Shortcodes'],
+ 'shortcodesDescription' => $GLOBALS['{camelcasePrefix}ShortcodesDescription']
);
// If we have database tables for this plugin/addon, provide that data also
- if (isset($GLOBALS['glmMembersSampleDbVersions'])) {
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG]['database'] = array(
- 'dbPrefix' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX,
- 'dbCurrentVersion' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION,
- 'dbActiveVersionOption' => GLM_MEMBERS_SAMPLE_PLUGIN_ACTIVE_DB_OPTION,
- 'dbScriptPath' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS,
- 'dbVersions' => $GLOBALS['glmMembersSampleDbVersions']
+ if (isset($GLOBALS['{camelcasePrefix}DbVersions'])) {
+ $addOns[{definedPrefix}_PLUGIN_SLUG]['database'] = array(
+ 'dbPrefix' => {definedPrefix}_PLUGIN_DB_PREFIX,
+ 'dbCurrentVersion' => {definedPrefix}_PLUGIN_DB_VERSION,
+ 'dbActiveVersionOption' => {definedPrefix}_PLUGIN_ACTIVE_DB_OPTION,
+ 'dbScriptPath' => {definedPrefix}_PLUGIN_DB_SCRIPTS,
+ 'dbVersions' => $GLOBALS['{camelcasePrefix}DbVersions']
);
} else {
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG]['database'] = false;
+ $addOns[{definedPrefix}_PLUGIN_SLUG]['database'] = false;
}
// Return the array with our data added
return $addOns;
}
-add_filter('glm-member-db-register-addon','glmMembersRegisterSample', 10, 1);
+add_filter('glm-member-db-register-addon','{camelcasePrefix}RegisterAddOn', 10, 1);
/*
* Plugin Update Support - uses Gaslight Media update server
*/
/* Not functional yet - Need to resolve JavaScript conflicts with this feature in other plugins
-require GLM_MEMBERS_SAMPLE_PLUGIN_LIB_PATH.'/opentools-update-checker/opentools-update-checker.php';
-${GLM_MEMBERS_SAMPLE_PLUGIN_PREFIX."updateChecker"} = new OpenToolsPluginUpdateChecker(
- 'http://www.gaslightmedia.com/update_server/?action=get_metadata&slug='.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
+require {definedPrefix}_PLUGIN_LIB_PATH.'/opentools-update-checker/opentools-update-checker.php';
+${{definedPrefix}_PLUGIN_PREFIX."updateChecker"} = new OpenToolsPluginUpdateChecker(
+ 'http://www.gaslightmedia.com/update_server/?action=get_metadata&slug='.{definedPrefix}_PLUGIN_SLUG,
__FILE__,
- GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
+ {definedPrefix}_PLUGIN_SLUG
);
-${GLM_MEMBERS_SAMPLE_PLUGIN_PREFIX."updateChecker"}->declareCredentials(array(
+${{definedPrefix}_PLUGIN_PREFIX."updateChecker"}->declareCredentials(array(
'license_key' => __('License Key:')
));
*/
*/
// Activate
- function glmMembersSamplePluginActivate ()
+ function {camelcasePrefix}PluginActivate ()
{
global $wpdb, $config;
- require_once GLM_MEMBERS_SAMPLE_PLUGIN_PATH . '/activate.php';
- new glmMembersSamplePluginActivate($wpdb, $config);
+ require_once {definedPrefix}_PLUGIN_PATH . '/activate.php';
+ new {camelcasePrefix}PluginActivate($wpdb, $config);
}
- register_activation_hook(__FILE__, 'glmMembersSamplePluginActivate');
+ register_activation_hook(__FILE__, '{camelcasePrefix}PluginActivate');
// Deactivate
- function glmMembersSamplePluginDeactivate ()
+ function {camelcasePrefix}PluginDeactivate ()
{
global $wpdb, $config;
- require_once GLM_MEMBERS_SAMPLE_PLUGIN_PATH . '/deactivate.php';
- $x = new glmMembersSamplePluginDeactivate($wpdb, $config);
+ require_once {definedPrefix}_PLUGIN_PATH . '/deactivate.php';
+ $x = new {camelcasePrefix}PluginDeactivate($wpdb, $config);
return false;
}
- register_deactivation_hook(__FILE__, 'glmMembersSamplePluginDeactivate');
+ register_deactivation_hook(__FILE__, '{camelcasePrefix}PluginDeactivate');
/*
* Hooks for testing capabilities provided by this add-on
*/
-require_once GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/permissions.php';
+require_once {definedPrefix}_PLUGIN_SETUP_PATH.'/permissions.php';
--- /dev/null
+Standard class libraries not specifically developed for this add-on should be placed here.
+
+The classes directory should be considered instead for class libraries developed specifically for this add-on.
* Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name}
-* Rename glm-member-db-sample.php to glm-member-db-{addon name}.php
-
-* Review all files and change references to "sample" (any case) to the new add-on name.
- - Read the information in the "NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED" and
- do anything recommended there.
- - Remove all of the "NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED" blocks.
+* From a bash prompt, run "SETUP_SCRIPT"
* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git
-=== Gaslight Media Member Database Sample Child Plugin ===
+=== {descrName} ===
Contributors: cscott@gaslightmedia.com
Donate link: http://www.gaslightmedia.com
-Tags: Gaslight Media,Plugin,Members Sample
+Tags: Gaslight Media,Plugin,{shortName}
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 Sample Child Plugin.
+This is the {descrName}.
== Description ==
-The Gaslight Media Members Database Sample Child Plugin is an add-on to the Gaslight Media Members Database,
+The {descrName} is an add-on to the Gaslight Media Members Database,
which is required to install and run this plugin
== Installation ==
<?php
/**
- * Gaslight Media Members Database
+ * {descrName}
* GLM Members Misc Admin Hooks and Filters
*
* PHP version 5.5
* @link http://dev.gaslightmedia.com/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to create hooks into the main plugin or other
- * add-ons. If no such hooks are needed, this file may be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Place Misc Hooks and Filters here. If this file exists, it will be included
* by the add-on main plugin script.
<?php
/**
- * Gaslight Media Members Database
- * GLM Members DB - Sample Add-on - Admin Menus
+ * {descrName}
+ * GLM Members DB - {shortName} - Admin Menus
*
* PHP version 5.5
*
* @link http://dev.gaslightmedia.com/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to add main menus or sub-menus to the admin
- * area. If this add-on does not create additional menus, this file
- * should be omitted.
- *
- * If adding a main menu, use "add_menu_page()" WordPress function
- * instead and note any differences.
- *
- * The menu slug should be constructed as
- * "glm-members-admin-{page}-{action}"
- * The default action for a page is usually "index".
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Added menus or sub-menus examples
*
*
*/
-// Add a main menu item
-add_menu_page(
- 'GLM Sample', // Page Title
- 'GLM Sample', // Menu Title
- 'glm-members-members', // Capability
- 'glm-members-admin-menu-sample', // Menu Slug
- function() {$this->controller('sample');}, // Called function
- false, // Icon URL
- '92' // Menu Position
-);
-
-add_submenu_page(
- 'glm-members-admin-menu-sample', // Parent slug
- 'Sample', // Page title
- 'Sample', // Menu Title
- 'glm_members_members', // Capability required
- 'glm-members-admin-menu-sample-sample', // Menu slug
- function() {$this->controller('sample');}
-);
-
-add_submenu_page(
- 'glm-members-admin-menu-sample', // Parent slug
- 'Info', // Page title
- 'Info', // Menu Title
- 'glm_members_members', // Capability required
- 'glm-members-admin-menu-sample-info', // Menu slug
- function() {$this->controller('info');}
-);
<?php
/**
- * Gaslight Media Members Database
- * GLM Members DB - Sample Add-on - Admin Tabs
+ * {descrName}
+ * GLM Members DB - {shortName} - Admin Tabs
*
* PHP version 5.5
*
* @link http://dev.gaslightmedia.com/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to add tabs to existing admin pages in the main
- * plugin or other add-ons. If this add-on does not create additional
- * tabs, this file should be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* To add a new tab to an existing Member DB page use a block
* like this and replace the {} parameters.
*
*/
-add_filter('glm-member-db-add-tab-for-members',
- function($addOnTabs) {
- $newTabs = array(
- array(
- 'text' => 'Sample',
- 'menu' => 'members',
- 'action' => 'sample'
- )
- );
- $addOnTabs = array_merge($addOnTabs, $newTabs);
- return $addOnTabs;
- }
-);
-
<?php
/**
- * Gaslight Media Members Database
- * GLM Members Sample Add-On Misc Hooks and Filters
+ * {descrName}
+ * Misc Hooks and Filters
*
* PHP version 5.5
*
* @link http://dev.gaslightmedia.com/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to create hooks into the main plugin or other
- * add-ons. If no such hooks are needed, this file may be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Place Misc Hooks and Filters here. If this file exists, it will be included
* by the add-on main plugin script.
-<!-- Hooks Help from glm-member-db-sample Add-On -->
-
-
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to document hooks provided by this add-on. Content
- * here will be displayed in the "Management" page "Hooks" tab. If
- * there is no content for this page, this file should be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
+<!-- Hooks Help for {descrName} with Example
<tr><th colspan="3" class="glm-notice"><p>Sample Add-On</p></th></tr>
<tr><th colspan="3">User Permission Hooks</td></tr>
<tr>
- <td>glm_members_permit_admin_members_sample_tab</td>
- <td>Filter</td>
- <td></td>
- <td>
- Returns boolean answer to "Is current user permitted to see multi-member Sample tab?"
- </td>
- </tr>
- <tr>
- <td>glm_members_permit_admin_members_Sample_add_sample</td>
- <td>Filter</td>
- <td></td>
- <td>
- Returns boolean answer to "Is current user permitted to add a new multi-member sample?"
- </td>
- </tr>
- <tr>
- <td>glm_members_permit_admin_members_Sample_edit_sample</td>
- <td>Filter</td>
- <td></td>
- <td>
- Returns boolean answer to "Is current user permitted to edit a multi-member sample?"
- </td>
- </tr>
- <tr>
- <td>glm_members_permit_admin_member_sample_tab</td>
- <td>Filter</td>
- <td></td>
- <td>
- Returns boolean answer to "Is current user permitted to see the member Sample tab?"
- </td>
- </tr>
- <tr>
- <td>glm_members_permit_admin_member_Sample_add_sample</td>
- <td>Filter</td>
- <td></td>
- <td>
- Returns boolean answer to "Is current user permitted to add a new Member sample?"
- </td>
- </tr>
- <tr>
- <td>glm_members_permit_admin_member_Sample_edit_sample</td>
- <td>Filter</td>
+ <td>some_hook_name</td>
+ <td>FILTER or ACTION</td>
<td></td>
<td>
- Returns boolean answer to "Is current user permitted to edit a member sample?"
+ What this hook does.
</td>
</tr>
+-->
\ No newline at end of file
<?php
/**
- * Gaslight Media Members Database
- * GLM Members DB - Sample Add-on - Permissions
+ * {descrName
+ * Permissions
*
* PHP version 5.5
*
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to add permission checks that can be used throught
- * the main plugin and add-ons. If no such permissions are needed by
- * this add-on, this file should be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Below are permission checks for various specific things in this add-on and
* elsewhere in the Member DB main plugin and add-ons.
<?php
/**
- * Gaslight Media Members Database
- * GLM Members DB - Sample Add-on - Roles & Capabilities
+ * {descrName}
+ * Roles & Capabilities
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabase
+ * @package {camelcasePrefix}
* @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 IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to add roles and capability. If none are required,
- * this file should be omitted.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/**
* NOTE: This file is only included in the activate.php process.
* It is not regularly used during operation.
<?php
/**
- * Gaslight Media Members Database
- * GLM Members Sample Add-On Short Codes
+ * {descrName}
+ * Short Codes
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabase
+ * @package {camelcasePrefix}
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
* @release shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
* @link http://dev.gaslightmedia.com/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to define shortcodes that will be handled by this
- * add-0n.
- *
- * DO NOT DELETE THIS FILE EVEN IF THERE ARE NOT SHORTCODES
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Array of short-code
*
* </tr>
*/
-$glmMembersSampleShortcodes = array(
+${camelcasePrefix}Shortcodes = array(
);
-$glmMembersSampleShortcodesDescription = '';
+${camelcasePrefix}ShortcodesDescription = '';
<?php
/**
- * Gaslight Media Members Database
- * GLM Members Sample Add-On Valid Actions
+ * {descrName}
+ * Valid Actions
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabase
+ * @package {camelcasePrefix}
* @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/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file is used to define valid actions for both admin and
- * front-end pages.
- *
- * DO NOT DELETE THIS FILE EVEN IF THERE ARE NO ACTIONS
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/*
* Array of valid menu items and actions.
*
*
* This array is integrated into the valid actions array in the main GLM Member
* DB plugin when this plugin registers itself.
+ *
+ * EXAMPLE
+ *
+ * ${camelcasePrefix}AddOnValidActions = array(
+ * 'adminActions' => array(
+ * 'members' => array(
+ * 'sample' => {definedPrefix}_PLUGIN_SLUG,
+ * ),
+ * 'sample' => array(
+ * 'index' => {definedPrefix}_PLUGIN_SLUG,
+ * 'more' => {definedPrefix}_PLUGIN_SLUG,
+ * ),
+ * 'info' => array(
+ * 'index' => {definedPrefix}_PLUGIN_SLUG
+ * )
+ * ),
+ * 'frontActions' => array(
+ * 'sample' => array(
+ * 'list' => {definedPrefix}_PLUGIN_SLUG,
+ * 'detail' => {definedPrefix}_PLUGIN_SLUG
+ * )
+ * )
+ * );
+ *
+ *
+ *
+ *
*/
-$glmMembersSampleAddOnValidActions = array(
+${camelcasePrefix}AddOnValidActions = array(
'adminActions' => array(
- 'members' => array(
- 'sample' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- ),
- 'sample' => array(
- 'index' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- 'more' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- ),
- 'info' => array(
- 'index' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
- )
),
'frontActions' => array(
-/*
- 'sample' => array(
- 'list' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- 'detail' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
- )
-*/
)
);
die('uninstall not configured - See plugin uninstall.php script!');
/**
- * Gaslight Media Members Database Sample Child Plugin
+ * {descrName}
* Uninstall Plugin
*
* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabaseSample
+ * @package {camelcasePrefix}
* @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/
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
// Check that we're being called by WordPress.
if (!defined('ABSPATH')) {
die("Please do not call this code directly!");