Initial commit for this new plugin.
authorLaury GvR <laury@gaslightmedia.com>
Fri, 17 Feb 2017 22:07:48 +0000 (17:07 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 17 Feb 2017 22:07:48 +0000 (17:07 -0500)
The basic functionality should be in place. It will need to use
front-end functions to display its fields. This is basically
the glm-client-info but with an active checkbox.

13 files changed:
controllers/Admin.php
controllers/Front.php
glm-client-info.php [deleted file]
glm-simple-messageboard.php [new file with mode: 0644]
models/Glmclientinfo_Widget.php [deleted file]
models/Glmsimplemessageboard_Widget.php [new file with mode: 0644]
views/checkbox.php [new file with mode: 0644]
views/messageBoard.php [new file with mode: 0644]
views/optionsPage.php
views/stateSelect.php [deleted file]
views/text.php
views/textArea.php
views/vCard.php [deleted file]

index f88149d..302eae1 100644 (file)
  * @release   Release: (0.1)
  * @link      <>
  */
-class Glmclientinfo_Admin_Controller
+class Glmsimplemessageboard_Admin_Controller
 {
     public $path;
 
     public function __construct($path)
     {
         $this->path = $path;
-        add_action('admin_menu', array($this, 'glmclientinfo_add_admin_menu'));
-        add_action('admin_init', array($this, 'glmclientinfo_settings_init'));
+        add_action('admin_menu', array($this, 'glmsimplemessageboard_add_admin_menu'));
+        add_action('admin_init', array($this, 'glmsimplemessageboard_settings_init'));
         add_action('wp_enqueue_scripts', array($this, 'load_stylesheet'));
         add_action('wp_enqueue_scripts', array($this, 'load_script'));
 
@@ -43,13 +43,12 @@ class Glmclientinfo_Admin_Controller
 
     static public function activate_plugin()
     {
-        Glmclientinfo_Admin_Controller::add_capability();
-        Glmclientinfo_Admin_Controller::glm_add_state_list_option();
+        Glmsimplemessageboard_Admin_Controller::add_capability();
     }
 
     static public function deactivate_plugin()
     {
-        Glmclientinfo_Admin_Controller::remove_capability();
+        Glmsimplemessageboard_Admin_Controller::remove_capability();
     }
 
     static public function add_capability()
@@ -72,133 +71,41 @@ class Glmclientinfo_Admin_Controller
         }
     }
 
-    static public function glmclientinfo_uninstall()
+    static public function glmsimplemessageboard_uninstall()
     {
-        delete_option(GLM_CLIENTINFO_SETTINGS);
-        delete_option(GLM_CLEINTINFO_STATES);
+        delete_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS);
     }
 
-    static public function glm_add_state_list_option()
-    {
-        //echo 'called glm_add_state_list_option';
-        if (get_option(GLM_CLEINTINFO_STATES)) {
-            delete_option(GLM_CLEINTINFO_STATES);
-        }
-        // [status_US] array of states and their abbr.
-        $states_US['']   = '-- Select --'; // {{{
-        $states_US['AL'] = 'Alabama';
-        $states_US['AK'] = 'Alaska';
-        $states_US['AZ'] = 'Arizona';
-        $states_US['AR'] = 'Arkansas';
-        $states_US['CA'] = 'California';
-        $states_US['CO'] = 'Colorado';
-        $states_US['CT'] = 'Connecticut';
-        $states_US['DE'] = 'Delaware';
-        $states_US['DC'] = 'District of Columbia';
-        $states_US['FL'] = 'Florida';
-        $states_US['GA'] = 'Georgia';
-        $states_US['HI'] = 'Hawaii';
-        $states_US['ID'] = 'Idaho';
-        $states_US['IL'] = 'Illinois';
-        $states_US['IN'] = 'Indiana';
-        $states_US['IA'] = 'Iowa';
-        $states_US['KS'] = 'Kansas';
-        $states_US['KY'] = 'Kentucky';
-        $states_US['LA'] = 'Louisiana';
-        $states_US['ME'] = 'Maine';
-        $states_US['MD'] = 'Maryland';
-        $states_US['MA'] = 'Massachusetts';
-        $states_US['MI'] = 'Michigan';
-        $states_US['MN'] = 'Minnesota';
-        $states_US['MS'] = 'Mississippi';
-        $states_US['MO'] = 'Missouri';
-        $states_US['MT'] = 'Montana';
-        $states_US['NE'] = 'Nebraska';
-        $states_US['NV'] = 'Nevada';
-        $states_US['NH'] = 'New Hampshire';
-        $states_US['NJ'] = 'New Jersey';
-        $states_US['NM'] = 'New Mexico';
-        $states_US['NY'] = 'New York';
-        $states_US['NC'] = 'North Carolina';
-        $states_US['ND'] = 'North Dakota';
-        $states_US['OH'] = 'Ohio';
-        $states_US['OK'] = 'Oklahoma';
-        $states_US['OR'] = 'Oregon';
-        $states_US['PA'] = 'Pennsylvania';
-        $states_US['RI'] = 'Rhode Island';
-        $states_US['SC'] = 'South Carolina';
-        $states_US['SD'] = 'South Dakota';
-        $states_US['TN'] = 'Tennessee';
-        $states_US['TX'] = 'Texas';
-        $states_US['UT'] = 'Utah';
-        $states_US['VT'] = 'Vermont';
-        $states_US['VA'] = 'Virginia';
-        $states_US['WA'] = 'Washington';
-        $states_US['WV'] = 'West Virginia';
-        $states_US['WI'] = 'Wisconsin';
-        $states_US['WY'] = 'Wyoming'; // }}}
-        // [states] extended states array
-        $states['AB']    = 'Alberta'; // {{{
-        $states['AS']    = 'American Samoa';
-        $states['BC']    = 'British Columbia';
-        $states['DC']    = 'District of Columbia';
-        $states['FM']    = 'Federated States of Micronesia';
-        $states['GU']    = 'Guam';
-        $states['MB']    = 'Manitoba';
-        $states['MH']    = 'Marshall Islands';
-        $states['NB']    = 'New Brunswick';
-        $states['NF']    = 'Newfoundland';
-        $states['MP']    = 'Northern Mariana Islands';
-        $states['NT']    = 'Northwest Territories';
-        $states['NS']    = 'Nova Scotia';
-        $states['ON']    = 'Ontario';
-        $states['PW']    = 'Palau';
-        $states['PE']    = 'Prince Edward Island';
-        $states['PR']    = 'Puerto Rico';
-        $states['QC']    = 'Quebec';
-        $states['SK']    = 'Saskatchewan';
-        $states['VI']    = 'Virgin Islands';
-        $states['YT']    = 'Yukon'; // }}}
-        //  Merge the 50 US states together with some of the extended
-        //  provinces / territories and then sort them on their keys
-        //  Then add the remaining countries and areas at the end
-        //  of the array.
-        $states          = $states_US + $states;
-        ksort($states);
-        add_option(GLM_CLEINTINFO_STATES, $states);
-        //echo 'called add_option';
-    }
-
-    public function glmclientinfo_add_admin_menu()
+    public function glmsimplemessageboard_add_admin_menu()
     {
         add_menu_page(
-            'Gaslight Client Info',
-            'GLM Client Info',
+            'Gaslight Simple Messageboard',
+            'GLM Simple Messageboard',
             GLM_NEW_CAPABILITY,
-            'glmclientinfo',
-            array($this, 'glmclientinfo_options_page'),
+            'glmsimplemessageboard',
+            array($this, 'glmsimplemessageboard_options_page'),
             'dashicons-id'
         );
     }
 
-    public function glmclientinfo_settings_exist()
+    public function glmsimplemessageboard_settings_exist()
     {
-        if (false == get_option(GLM_CLIENTINFO_SETTINGS)) {
-            add_option(GLM_CLIENTINFO_SETTINGS);
+        if (false == get_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS)) {
+            add_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS);
         }
     }
 
-    public function glmclientinfoAddSettingTextField($name, $label, $type, $clientInfoSection)
+    public function glmsimplemessageboardAddSettingField($name, $label, $type, $simpleMessageboardSection)
     {
         switch ($type) {
             case 'text':
-                $callback = 'glmclientinfoRenderText';
+                $callback = 'glmsimplemessageboardRenderText';
                 break;
             case 'textarea':
-                $callback = 'glmclientinfoRenderTextArea';
+                $callback = 'glmsimplemessageboardRenderTextArea';
                 break;
-            case 'state':
-                $callback = 'glmclientinfoRenderStateSelect';
+            case 'checkbox':
+                $callback = 'glmsimplemessageboardRenderCheckbox';
                 break;
             default:
                 return false;
@@ -208,223 +115,89 @@ class Glmclientinfo_Admin_Controller
             $name,
             __($label, 'wordpress'),
             array($this, $callback),
-            $clientInfoSection,
-            'glmclientinfo_clientInfoPrimary_section',
+            $simpleMessageboardSection,
+            'glmsimplemessageboard_simpleMessageboardPrimary_section',
             $name
         );
     }
 
-    public function glmclientinfo_settings_init()
+    public function glmsimplemessageboard_settings_init()
     {
-        register_setting('clientInfoPrimary', 'glmclientinfo_settings');
-        add_filter(
-            'option_page_capability_clientInfoPrimary',
-            array($this, 'glmclientinfo_option_page_capability')
-        );
-        register_setting('clientInfoSecondary', 'glmclientinfo_settings');
-        add_filter(
-            'option_page_capability_clientInfoPrimary',
-            array($this, 'glmclientinfo_option_page_capability')
-        );
-        register_setting('clientBusinessName', 'glmclientinfo_settings');
+        register_setting('simpleMessageboardPrimary', 'glmsimplemessageboard_settings');
         add_filter(
-            'option_page_capability_clientInfoPrimary',
-            array($this, 'glmclientinfo_option_page_capability')
+            'option_page_capability_simpleMessageboardPrimary',
+            array($this, 'glmsimplemessageboard_option_page_capability')
         );
 
         add_settings_section(
-            'glmclientinfo_clientInfoPrimary_section',
-            __('Edit Primary Client Info', 'wordpress'),
-            array($this, 'glmclientinfo_settings_section_callback'),
-            'clientInfoPrimary'
-        );
-        add_settings_section(
-            'glmclientinfo_clientInfoPrimary_section',
-            __('Edit Secondary Client Info', 'wordpress'),
-            array($this, 'glmclientinfo_settings_section_callback'),
-            'clientInfoSecondary'
+            'glmsimplemessageboard_simpleMessageboardPrimary_section',
+            __('Edit Simple Messageboard', 'wordpress'),
+            array($this, 'glmsimplemessageboard_settings_section_callback'),
+            'simpleMessageboardPrimary'
         );
-        add_settings_section(
-            'glmclientinfo_clientInfoPrimary_section',
-            __('Edit Client Business Name', 'wordpress'),
-            array($this, 'glmclientinfo_settings_section_callback'),
-            'clientBusinessName'
-        );
-        $businessName = array(
-            'name'  => 'businessName',
-            'label' => 'Business Name',
-            'type'  => 'text'
-        );
-        
         $fieldNames = array(
             array(
-                'name'  => 'address',
-                'label' => 'Address',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'city',
-                'label' => 'City',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'state',
-                'label' => 'State',
-                'type'  => 'state'
-            ),
-            array(
-                'name'  => 'zip',
-                'label' => 'Zip',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'email',
-                'label' => 'Email',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'phone',
-                'label' => 'Phone',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'fax',
-                'label' => 'Fax',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'tollfree',
-                'label' => 'Toll Free',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'gpslat',
-                'label' => 'GPS Lat.',
-                'type'  => 'text'
+                'name'  => 'active',
+                'label' => 'Active',
+                'type'  => 'checkbox'
             ),
             array(
-                'name'  => 'gpslon',
-                'label' => 'GPS Lon.',
+                'name'  => 'title',
+                'label' => 'Title',
                 'type'  => 'text'
             ),
             array(
-                'name'  => 'extra',
-                'label' => 'Extra Content',
+                'name'  => 'message',
+                'label' => 'Message',
                 'type'  => 'textarea'
             ),
         );
-        $fieldNames2 = array(
-            array(
-                'name'  => 'address2',
-                'label' => 'Secondary Address',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'city2',
-                'label' => 'Secondary City',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'state2',
-                'label' => 'Secondary State',
-                'type'  => 'state'
-            ),
-            array(
-                'name'  => 'zip2',
-                'label' => 'Secondary Zip',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'email2',
-                'label' => 'Secondary Email',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'phone2',
-                'label' => 'Secondary Phone',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'fax2',
-                'label' => 'Secondary Fax',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'tollfree2',
-                'label' => 'Secondary Toll Free',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'gpslat2',
-                'label' => 'Secondary GPS Lat.',
-                'type'  => 'text'
-            ),
-            array(
-                'name'  => 'gpslon2',
-                'label' => 'Secondary GPS Lon.',
-                'type'  => 'text'
-            ),
-        );
         
-        $this->glmclientinfoAddSettingTextField(
-            $businessName['name'],
-            $businessName['label'],
-            $businessName['type'],
-                "clientBusinessName"
-        );
         foreach ($fieldNames as $field) {
-            $this->glmclientinfoAddSettingTextField(
-                $field['name'],
-                $field['label'],
-                $field['type'],
-                "clientInfoPrimary"
-            );
-        }
-        foreach ($fieldNames2 as $field) {
-            $this->glmclientinfoAddSettingTextField(
+            
+            $this->glmsimplemessageboardAddSettingField(
                 $field['name'],
                 $field['label'],
                 $field['type'],
-                "clientInfoSecondary"
+                "simpleMessageboardPrimary"
             );
         }
     }
 
-    public function glmclientinfoRenderText($fieldName)
+    public function glmsimplemessageboardRenderText($fieldName)
     {
         static $options;
         if (!$options) {
-            $options = get_option(GLM_CLIENTINFO_SETTINGS);
+            $options = get_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS);
         }
         include $this->path . 'views/text.php';
     }
 
-    public function glmclientinfoRenderTextArea($fieldName)
+    public function glmsimplemessageboardRenderTextArea($fieldName)
     {
         static $options;
-        $options = get_option(GLM_CLIENTINFO_SETTINGS);
+        $options = get_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS);
         include $this->path . 'views/textArea.php';
     }
 
-    public function glmclientinfoRenderStateSelect($fieldName)
+    public function glmsimplemessageboardRenderCheckbox($fieldName)
     {
         static $options;
-        $options = get_option(GLM_CLIENTINFO_SETTINGS);
-        $states  = get_option(GLM_CLEINTINFO_STATES);
-        include $this->path . 'views/stateSelect.php';
+        $options = get_option(GLM_SIMPLEMESSAGEBOARD_SETTINGS);
+        include $this->path . 'views/checkbox.php';
     }
 
-    public function glmclientinfo_settings_section_callback()
+    public function glmsimplemessageboard_settings_section_callback()
     {
 //        echo __('Business Name, Address and phone numbers', 'wordpress');
     }
 
-    public function glmclientinfo_option_page_capability($capability)
+    public function glmsimplemessageboard_option_page_capability($capability)
     {
         return GLM_NEW_CAPABILITY;
     }
 
-    public function glmclientinfo_options_page()
+    public function glmsimplemessageboard_options_page()
     {
         if (current_user_can(GLM_NEW_CAPABILITY)) {
             include $this->path . 'views/optionsPage.php';
@@ -435,18 +208,18 @@ class Glmclientinfo_Admin_Controller
 
     public function load_stylesheet()
     {
-        wp_enqueue_style('client-admin-css',plugins_url('glm-client-info/css/admin/admin.css' , $this->pluginDirName));
+        wp_enqueue_style('messageboard-admin-css',plugins_url('glm-simple-messageboard/css/admin/admin.css' , $this->pluginDirName));
     }
     public function load_script()
     {        
         wp_register_script(
-            'client-info-admin-js',
-            plugins_url('glm-client-info/js/admin/admin.js' , $this->pluginDirName),
+            'simple-messageboard-admin-js',
+            plugins_url('glm-simple-messageboard/js/admin/admin.js' , $this->pluginDirName),
             array(),
             '0.0.1',
             'all'
         );
-        wp_enqueue_script('client-info-admin-js');
+        wp_enqueue_script('simple-messageboard-admin-js');
 
     }
 }
index 5cff1a7..8950a54 100644 (file)
@@ -27,7 +27,7 @@
  * @release   Release: (0.1)
  * @link      <>
  */
-class Glmclientinfo_Front_controller
+class Glmsimplemessageboard_Front_controller
 {
 
     /**
@@ -45,16 +45,16 @@ class Glmclientinfo_Front_controller
     function __construct($path)
     {
         $this->path = $path;
-        add_action('widgets_init', array($this, 'glmclientinfo_register_widget'));
+        add_action('widgets_init', array($this, 'glmsimplemessageboard_register_widget'));
     }
 
     /**
      * Register the Client Info Widget with WordPress
      */
-    function glmclientinfo_register_widget()
+    function glmsimplemessageboard_register_widget()
     {
-        include $this->path . 'models/Glmclientinfo_Widget.php';
-        register_widget('Glmclientinfo_Widget');
+        include $this->path . 'models/Glmsimplemessageboard_Widget.php';
+        register_widget('Glmsimplemessageboard_Widget');
     }
 
 }
diff --git a/glm-client-info.php b/glm-client-info.php
deleted file mode 100644 (file)
index 17b1efb..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Plugin Name: GLM Client Info
- * Description: Option Setting for the name address and phone numbers. Includes Widget
- * Version: 1.0.4
- * Author: Steve Sutton
- * Author URI: http://www.gaslightmedia.com
- * License: All right reserved
- */
-define('GLM_CLIENTINFO_SETTINGS', 'glmclientinfo_settings');
-define('GLM_CLEINTINFO_STATES', 'glmclientinfo_states');
-define('GLM_NEW_CAPABILITY', 'glmclientinfo_edit_client');
-define('BUILT_IN_CAPABILITY', 'edit_posts');
-
-register_activation_hook(__FILE__, array('Glmclientinfo_Admin_Controller', 'activate_plugin'));
-register_deactivation_hook(__FILE__, array('Glmclientinfo_Admin_Controller', 'deactivate_plugin'));
-register_uninstall_hook(__FILE__, array('Glmclientinfo_Admin_Controller', 'glmclientinfo_uninstall'));
-
-if (is_admin()) {
-    // call the Admin Controller to setup the Admin of the plugin
-    require_once 'controllers/Admin.php';
-    $adminController = new Glmclientinfo_Admin_Controller(
-        plugin_dir_path(__FILE__)
-    );
-}
-
-// call the Front Controller to setup the widget
-require_once 'controllers/Front.php';
-$frontController = new Glmclientinfo_Front_controller(
-    plugin_dir_path(__FILE__)
-);
diff --git a/glm-simple-messageboard.php b/glm-simple-messageboard.php
new file mode 100644 (file)
index 0000000..f5ef0a2
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Plugin Name: GLM Simple Messageboard
+ * Description: Option Setting for the name address and phone numbers. Includes Widget
+ * Version: 1.0.0
+ * Author: Gaslight Media
+ * Author URI: http://www.gaslightmedia.com
+ * License: All right reserved
+ */
+define('GLM_SIMPLEMESSAGEBOARD_SETTINGS', 'glmsimplemessageboard_settings');
+define('GLM_NEW_CAPABILITY', 'glmsimplemessageboard_edit_messageboard');
+define('BUILT_IN_CAPABILITY', 'edit_posts');
+
+register_activation_hook(__FILE__, array('Glmsimplemessageboard_Admin_Controller', 'activate_plugin'));
+register_deactivation_hook(__FILE__, array('Glmsimplemessageboard_Admin_Controller', 'deactivate_plugin'));
+register_uninstall_hook(__FILE__, array('Glmsimplemessageboard_Admin_Controller', 'glmsimplemessageboard_uninstall'));
+
+if (is_admin()) {
+    // call the Admin Controller to setup the Admin of the plugin
+    require_once 'controllers/Admin.php';
+    $adminController = new Glmsimplemessageboard_Admin_Controller(
+        plugin_dir_path(__FILE__)
+    );
+}
+
+// call the Front Controller to setup the widget
+require_once 'controllers/Front.php';
+$frontController = new Glmsimplemessageboard_Front_controller(
+    plugin_dir_path(__FILE__)
+);
diff --git a/models/Glmclientinfo_Widget.php b/models/Glmclientinfo_Widget.php
deleted file mode 100644 (file)
index 9d748e7..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * Glmclientinfo_Widget.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_QuickSite_Widget
- *
- * Description of QuickSite_Widget
- *
- * @category  Toolkit
- * @package   Package
- * @author    Steve Sutton <steve@gaslightmedia.com>
- * @copyright 2013 Gaslight Media
- * @license   Gaslight Media
- * @release   Release: (0.1)
- * @link      <>
- */
-class Glmclientinfo_Widget
-    extends WP_widget
-{
-
-    private $pluginDirPath;
-
-    /**
-     * Class Initializer
-     */
-    public function __construct()
-    {
-        parent::__construct(
-            'GlmClientInfo_Widget',
-            __('Client Info Widget', 'text_domain'),
-            array('description' => __('A Gaslight Widget', 'text_domain'))
-        );
-    }
-
-    /**
-     * Output widget
-     *
-     * Includes the template file for the widget.
-     * Template file is plain old php for your fastest template engine yet!
-     *
-     * @param type $args     Widget Args
-     * @param type $instance Widget Instance
-     *
-     * @return string
-     */
-    public function widget($args, $instance)
-    {
-        $path = plugin_dir_path(__FILE__);
-        include $path . '../views/vCard.php';
-    }
-
-    /**
-     * Return the quicksite option for the given key
-     *
-     * @param type $name Name of the quicksite option to return
-     *
-     * @return string Option
-     */
-    function glm_get_clientinfo_option($name)
-    {
-        $settings = get_option('glmclientinfo_settings');
-        $states   = get_option('glmclientinfo_states');
-        if ($name == 'stateFull' && $settings['state']) {
-            return $states[$settings['state']];
-        }
-        if ($name == 'state2Full' && $settings['state2']) {
-            return $states[$settings['state2']];
-        }
-        return ($settings && $settings[$name])
-            ? $settings[$name]
-            : null;
-    }
-
-}
diff --git a/models/Glmsimplemessageboard_Widget.php b/models/Glmsimplemessageboard_Widget.php
new file mode 100644 (file)
index 0000000..c62db1e
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * Glmsimplemessageboard_Widget.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_QuickSite_Widget
+ *
+ * Description of QuickSite_Widget
+ *
+ * @category  Toolkit
+ * @package   Package
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class Glmsimplemessageboard_Widget
+    extends WP_widget
+{
+
+    private $pluginDirPath;
+
+    /**
+     * Class Initializer
+     */
+    public function __construct()
+    {
+        parent::__construct(
+            'GlmSimpleMessageboard_Widget',
+            __('Simple Messageboard Widget', 'text_domain'),
+            array('description' => __('A Gaslight Messageboard Widget', 'text_domain'))
+        );
+    }
+
+    /**
+     * Output widget
+     *
+     * Includes the template file for the widget.
+     * Template file is plain old php for your fastest template engine yet!
+     *
+     * @param type $args     Widget Args
+     * @param type $instance Widget Instance
+     *
+     * @return string
+     */
+    public function widget($args, $instance)
+    {
+        $path = plugin_dir_path(__FILE__);
+        include $path . '../views/messageBoard.php';
+    }
+
+    /**
+     * Return the quicksite option for the given key
+     *
+     * @param type $name Name of the quicksite option to return
+     *
+     * @return string Option
+     */
+    function glm_get_simple_messageboard_option($name)
+    {
+        $settings = get_option('glmsimplemessageboard_settings');
+        return ($settings && $settings[$name])
+            ? $settings[$name]
+            : null;
+    }
+
+}
diff --git a/views/checkbox.php b/views/checkbox.php
new file mode 100644 (file)
index 0000000..0095629
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+    if (array_key_exists( "active", $options ) ) {
+        $html = '<input type="checkbox" id="active" name="glmsimplemessageboard_settings[active]" value="1" checked/>';
+    } else {
+        $html = '<input type="checkbox" id="active" name="glmsimplemessageboard_settings[active]" value="1"/>';
+    }
+    
+    echo $html;
+?>
+
diff --git a/views/messageBoard.php b/views/messageBoard.php
new file mode 100644 (file)
index 0000000..4b65aad
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="messageboard">
+    <?php if ($this->glm_get_simplemessageboard_option('name')):?>
+    <p class="tel">
+        <span class="type">name</span>:
+        <span class="value"><?php echo $this->glm_get_simplemessageboard_option('name');?></span>
+    </p>
+    <?php endif;?>
+    <?php if ($this->glm_get_simplemessageboard_option('message')):?>
+    <p class="tel">
+        <span class="type">message</span>:
+        <span class="value"><?php echo $this->glm_get_simplemessageboard_option('message');?></span>
+    </p>
+    <?php endif;?>
+    <?php if ($this->glm_get_simplemessageboard_option('active')):?>
+    <p class="tel">
+        <span class="type">active</span>:
+        <span class="value"><?php echo $this->glm_get_simplemessageboard_option('active');?></span>
+    </p>
+    <?php endif;?>
+</div><!-- /#vcard -->
index 7106eb8..5337a3b 100644 (file)
@@ -5,21 +5,10 @@
             <?php submit_button();?>
         </div>
         <div id="glm-client-info-wrapper" class="row">
-            <?php
-                settings_fields('clientBusinessName');
-                do_settings_sections('clientBusinessName');
-            ?>
             <div id="glm-client-info-primary" class="glm-client-info-section"><br>
                 <?php
-                    settings_fields('clientInfoPrimary');
-                    do_settings_sections('clientInfoPrimary');
-                ?>
-            </div>
-            <input id="showSecondaryInfo" name="showSecondaryInfo" type="checkbox"><label for="showSecondaryInfo">Show Secondary Info</label>
-            <div id="glm-client-info-secondary" class="glm-client-info-section">
-                <?php
-                    settings_fields('clientInfoSecondary');
-                    do_settings_sections('clientInfoSecondary');
+                    settings_fields('simpleMessageboardPrimary');
+                    do_settings_sections('simpleMessageboardPrimary');
                 ?>
             </div>
             <div style="clear: both; text-align: center;">
 </div>
 <script>
     jQuery( document ).ready(function() { 
-        if (jQuery( window ).width() > 640) {
-            jQuery('.glm-client-info-section').width('50%').css("float","left");
-        } else {
-            jQuery('.glm-client-info-section').width('100%');
-        }
-        jQuery( window ).resize(function() {
-            if (jQuery( window ).width() > 640) {
-                jQuery('.glm-client-info-section').width('50%').css("float","left");
-            } else {
-                jQuery('.glm-client-info-section').width('100%');
-            }
-        });
-        if (jQuery('#showSecondaryInfo').is(':checked')) {
-            jQuery("#glm-client-info-secondary").show();
-            
-        } else {
-            jQuery("#glm-client-info-secondary").hide();
-        }
-        jQuery('#showSecondaryInfo').change(function(){
-            if (this.checked) {
-                jQuery("#glm-client-info-secondary").show();
-            } else {
-                jQuery("#glm-client-info-secondary").hide();
-            }
-        });
+//        if (jQuery( window ).width() > 640) {
+//            jQuery('.glm-client-info-section').width('50%').css("float","left");
+//        } else {
+//            jQuery('.glm-client-info-section').width('100%');
+//        }
+//        jQuery( window ).resize(function() {
+//            if (jQuery( window ).width() > 640) {
+//                jQuery('.glm-client-info-section').width('50%').css("float","left");
+//            } else {
+//                jQuery('.glm-client-info-section').width('100%');
+//            }
+//        });
+//        if (jQuery('#showSecondaryInfo').is(':checked')) {
+//            jQuery("#glm-client-info-secondary").show();
+//            
+//        } else {
+//            jQuery("#glm-client-info-secondary").hide();
+//        }
+//        jQuery('#showSecondaryInfo').change(function(){
+//            if (this.checked) {
+//                jQuery("#glm-client-info-secondary").show();
+//            } else {
+//                jQuery("#glm-client-info-secondary").hide();
+//            }
+//        });
     });
 </script>
\ No newline at end of file
diff --git a/views/stateSelect.php b/views/stateSelect.php
deleted file mode 100644 (file)
index c0a0ca5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<select name="glmclientinfo_settings[<?php echo $fieldName; ?>]">
-    <?php if (!empty($states)) : foreach ($states as $stateAbbr => $stateName) : ?>
-        <option value="<?php echo $stateAbbr; ?>"<?php if ($options[$fieldName] == $stateAbbr) {
-        echo ' selected';
-    }; ?>>
-        <?php echo $stateName; ?>
-        </option>
-<?php endforeach; endif;?>
-</select>
\ No newline at end of file
index a00fba9..d58813c 100644 (file)
@@ -1,2 +1,3 @@
-<input type="text" name="glmclientinfo_settings[<?php echo $fieldName;?>]"
-           value="<?php echo str_replace('"', '&quote;', $options[$fieldName]); ?>">
\ No newline at end of file
+<input type="text" name="glmsimplemessageboard_settings[<?php echo $fieldName;?>]"
+    value="<?php echo str_replace('"', '&quote;', $options[$fieldName]); ?>">
+<?php 
\ No newline at end of file
index 1f58fef..ff5a791 100644 (file)
@@ -1 +1 @@
-<textarea cols="40" rows="5" name="glmclientinfo_settings[<?php echo $fieldName;?>]"><?php echo htmlspecialchars($options[$fieldName]); ?></textarea>
\ No newline at end of file
+<textarea cols="40" rows="5" name="glmsimplemessageboard_settings[<?php echo $fieldName;?>]"><?php echo htmlspecialchars($options[$fieldName]); ?></textarea>
\ No newline at end of file
diff --git a/views/vCard.php b/views/vCard.php
deleted file mode 100644 (file)
index 7160c18..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<div class="vcard">
-    <h2 class="fn org"><?php echo $this->glm_get_clientinfo_option('businessName');?></h2>
-    <p class="street-address"><?php echo $this->glm_get_clientinfo_option('address');?></p>
-    <p>
-        <span flexy:if="city" class="locality"><?php echo $this->glm_get_clientinfo_option('city');?>,</span>
-        <abbr class="region" title="<?php echo $this->glm_get_clientinfo_option('stateFull');?>"><?php echo $this->glm_get_clientinfo_option('state');?></abbr>
-        <span class="postal-code"><?php echo $this->glm_get_clientinfo_option('zip');?></span>
-    </p>
-
-    <?php if ($this->glm_get_clientinfo_option('address2')):?>
-    <p class="street-address"><?php echo $this->glm_get_clientinfo_option('address2');?></p>
-    <p>
-        <span flexy:if="city" class="locality"><?php echo $this->glm_get_clientinfo_option('city2');?>,</span>
-        <abbr class="region" title="<?php echo $this->glm_get_clientinfo_option('state2Full');?>"><?php echo $this->glm_get_clientinfo_option('state2');?></abbr>
-        <span class="postal-code"><?php echo $this->glm_get_clientinfo_option('zip2');?></span>
-    </p>
-    <?php endif;?>
-
-    <?php if ($this->glm_get_clientinfo_option('phone')):?>
-    <p class="tel">
-        <span class="type">phone</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('phone');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('phone2')):?>
-    <p class="tel">
-        <span class="type">phone 2</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('phone2');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('tollfree')):?>
-    <p class="tel">
-        <span class="type">tollfree</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('tollfree');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('tollfree2')):?>
-    <p class="tel">
-        <span class="type">tollfree 2</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('tollfree2');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('fax')):?>
-    <p class="tel">
-        <span class="type">fax</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('fax');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('fax2')):?>
-    <p class="tel">
-        <span class="type">fax 2</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('fax2');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('gpslat')):?>
-    <p class="tel">
-        <span class="type">gpslat</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('gpslat');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('gpslon')):?>
-    <p class="tel">
-        <span class="type">gpslon</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('gpslon');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('gpslat2')):?>
-    <p class="tel">
-        <span class="type">gpslat 2</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('gpslat2');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('gpslon2')):?>
-    <p class="tel">
-        <span class="type">gpslon 2</span>:
-        <span class="value"><?php echo $this->glm_get_clientinfo_option('gpslon2');?></span>
-    </p>
-    <?php endif;?>
-    <?php if ($this->glm_get_clientinfo_option('extra')):?>
-        <?php echo $this->glm_get_clientinfo_option('extra');?>
-    <?php endif;?>
-</div><!-- /#vcard -->