switching name
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 3 Nov 2014 18:10:31 +0000 (13:10 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 3 Nov 2014 18:10:31 +0000 (13:10 -0500)
GlmQuickSite.php [deleted file]
controllers/Admin.php
controllers/Front.php
glm-client-info.php [new file with mode: 0644]
models/Glmclientinfo_Widget.php [new file with mode: 0644]
models/QuickSite_Widget.php [deleted file]
views/stateSelect.php
views/text.php
views/textArea.php

diff --git a/GlmQuickSite.php b/GlmQuickSite.php
deleted file mode 100644 (file)
index 9dedfce..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Plugin Name: QuickSite Options
- * Description: Option Setting for the name address and phone numbers for the * quicksite
- * Version: 1.0
- * Author: Steve Sutton
- * Author URI: http://www.gaslightmedia.com
- * License: All right reserved
- */
-define('GLM_NEW_CAPABILITY', 'glmquicksite_edit_client');
-define('BUILT_IN_CAPABILITY', 'edit_posts');
-
-// call the Admin Controller to setup the Admin of the plugin
-require_once 'controllers/Admin.php';
-$adminController = new QuickSite_Admin_Controller(
-    plugin_dir_path(__FILE__)
-);
-
-// call the Front Controller to setup the widget
-require_once 'controllers/Front.php';
-$frontController = new QuickSite_Front_controller(
-    plugin_dir_path(__FILE__)
-);
index d074919..3aeccbb 100644 (file)
  * @release   Release: (0.1)
  * @link      <>
  */
-class QuickSite_Admin_Controller
+class Glmclientinfo_Admin_Controller
 {
     public $path;
 
     public function __construct($path)
     {
         $this->path = $path;
-        add_action('admin_menu', array($this, 'glmQuickSite_add_admin_menu'));
-        add_action('admin_init', array($this, 'glmQuickSite_settings_init'));
-        register_activation_hook(__FILE__, array($this, 'glmQuickSite_install_plugin_data'));
-        register_deactivation_hook(__FILE__, array($this, 'glmQuickSite_remove_plugin_data'));
+        add_action('admin_menu', array($this, 'glmclientinfo_add_admin_menu'));
+        add_action('admin_init', array($this, 'glmclientinfo_settings_init'));
+        register_activation_hook(__FILE__, array($this, 'glmclientinfo_install_plugin_data'));
+        register_deactivation_hook(__FILE__, array($this, 'glmclientinfo_remove_plugin_data'));
+        register_uninstall_hook(__FILE__, array('Glmclientinfo_Admin_Controller', 'glmclientinfo_uninstall'));
     }
 
     public function add_capability()
@@ -60,10 +61,16 @@ class QuickSite_Admin_Controller
         }
     }
 
-    public function glmQuickSite_install_plugin_data()
+    static public function glmclientinfo_uninstall()
+    {
+        delete_option('glmquicksite_settings');
+        delete_option('glmquicksite_states');
+    }
+
+    public function glmclientinfo_install_plugin_data()
     {
         add_capability();
-        glm_add_state_list_option();
+        $this->glm_add_state_list_option();
     }
 
     public function glm_add_state_list_option()
@@ -154,18 +161,12 @@ class QuickSite_Admin_Controller
         }
     }
 
-    public function glmQuickSite_remove_plugin_data()
+    public function glmclientinfo_remove_plugin_data()
     {
         remove_capability();
     }
 
-    public function glmQuickSite_uninstall()
-    {
-        delete_option('glmquicksite_settings');
-        delete_option('glmquicksite_states');
-    }
-
-    public function glmQuickSite_add_admin_menu()
+    public function glmclientinfo_add_admin_menu()
     {
         add_menu_page(
             'Gaslight Client Info',
@@ -177,24 +178,24 @@ class QuickSite_Admin_Controller
         );
     }
 
-    public function glmQuickSite_settings_exist()
+    public function glmclientinfo_settings_exist()
     {
         if (false == get_option('glmquicksite_settings')) {
             add_option('glmquicksite_settings');
         }
     }
 
-    public function glmQuickSiteAddSettingTextField($name, $label, $type)
+    public function glmclientinfoAddSettingTextField($name, $label, $type)
     {
         switch ($type) {
             case 'text':
-                $callback = 'glmQuickSiteRenderText';
+                $callback = 'glmclientinfoRenderText';
                 break;
             case 'textarea':
-                $callback = 'glmQuickSiteRenderTextArea';
+                $callback = 'glmclientinfoRenderTextArea';
                 break;
             case 'state':
-                $callback = 'glmQuickSiteRenderStateSelect';
+                $callback = 'glmclientinfoRenderStateSelect';
                 break;
             default:
                 return false;
@@ -205,21 +206,21 @@ class QuickSite_Admin_Controller
             __($label, 'wordpress'),
             array($this, $callback),
             'pluginPage',
-            'glmQuickSite_pluginPage_section',
+            'glmclientinfo_pluginPage_section',
             $name
         );
     }
 
-    public function glmQuickSite_settings_init()
+    public function glmclientinfo_settings_init()
     {
-        register_setting('pluginPage', 'glmQuickSite_settings');
+        register_setting('pluginPage', 'glmclientinfo_settings');
         add_filter('option_page_capability_pluginPage',
-                   'glmQuickSite_option_page_capability');
+                   'glmclientinfo_option_page_capability');
 
         add_settings_section(
-            'glmQuickSite_pluginPage_section',
+            'glmclientinfo_pluginPage_section',
             __('Edit your Client Info', 'wordpress'),
-            array($this, 'glmQuickSite_settings_section_callback'),
+            array($this, 'glmclientinfo_settings_section_callback'),
             'pluginPage'
         );
 
@@ -287,41 +288,44 @@ class QuickSite_Admin_Controller
         );
 
         foreach ($fieldNames as $field) {
-            $this->glmQuickSiteAddSettingTextField($field['name'], $field['label'],
-                                            $field['type']);
+            $this->glmclientinfoAddSettingTextField(
+                $field['name'],
+                $field['label'],
+                $field['type']
+            );
         }
     }
 
-    public function glmQuickSiteRenderText($fieldName)
+    public function glmclientinfoRenderText($fieldName)
     {
         static $options;
         if (!$options) {
-            $options = get_option('glmQuickSite_settings');
+            $options = get_option('glmclientinfo_settings');
         }
         include $this->path . 'views/text.php';
     }
 
-    public function glmQuickSiteRenderTextArea($fieldName)
+    public function glmclientinfoRenderTextArea($fieldName)
     {
         static $options;
-        $options = get_option('glmQuickSite_settings');
+        $options = get_option('glmclientinfo_settings');
         include $this->path . 'views/textArea.php';
     }
 
-    public function glmQuickSiteRenderStateSelect($fieldName)
+    public function glmclientinfoRenderStateSelect($fieldName)
     {
         static $options;
-        $options = get_option('glmQuickSite_settings');
-        $states  = get_option('glmQuickSite_states');
+        $options = get_option('glmclientinfo_settings');
+        $states  = get_option('glmclientinfo_states');
         include $this->path . 'views/stateSelect.php';
     }
 
-    public function glmQuickSite_settings_section_callback()
+    public function glmclientinfo_settings_section_callback()
     {
         echo __('Business Name, Address and phone numbers', 'wordpress');
     }
 
-    public function glmQuickSite_option_page_capability($capability)
+    public function glmclientinfo_option_page_capability($capability)
     {
         return GLM_NEW_CAPABILITY;
     }
index a180138..e7b51f4 100644 (file)
  * @release   Release: (0.1)
  * @link      <>
  */
-class QuickSite_Front_controller
+class Glmclientinfo_Front_controller
 {
 
     /**
      * Plugin Path
-     * 
+     *
      * @var type String
      */
     public $path;
@@ -45,16 +45,16 @@ class QuickSite_Front_controller
     function __construct($path)
     {
         $this->path = $path;
-        add_action('widgets_init', array($this, 'glmQuickSite_register_widget'));
+        add_action('widgets_init', array($this, 'glmclientinfo_register_widget'));
     }
 
     /**
      * Register the QuickSite Widget with WordPress
      */
-    function glmQuickSite_register_widget()
+    function glmclientinfo_register_widget()
     {
-        include $this->path . 'models/QuickSite_Widget.php';
-        register_widget('QuickSite_Widget');
+        include $this->path . 'models/Glmclientinfo_Widget.php';
+        register_widget('Glmclientinfo_Widget');
     }
 
 }
diff --git a/glm-client-info.php b/glm-client-info.php
new file mode 100644 (file)
index 0000000..95e57ed
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Plugin Name: GLM Client Info
+ * Description: Option Setting for the name address and phone numbers
+ * Version: 1.1
+ * Author: Steve Sutton
+ * Author URI: http://www.gaslightmedia.com
+ * License: All right reserved
+ */
+define('GLM_NEW_CAPABILITY', 'glmclientinfo_edit_client');
+define('BUILT_IN_CAPABILITY', 'edit_posts');
+
+// 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/models/Glmclientinfo_Widget.php b/models/Glmclientinfo_Widget.php
new file mode 100644 (file)
index 0000000..2d0bc80
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * QuickSite_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(
+            'QuickSite_Widget',
+            __('QuickSite 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_quicksite_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/QuickSite_Widget.php b/models/QuickSite_Widget.php
deleted file mode 100644 (file)
index 4a634da..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * QuickSite_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 QuickSite_Widget
-    extends WP_widget
-{
-
-    private $pluginDirPath;
-
-    /**
-     * Class Initializer
-     */
-    public function __construct()
-    {
-        parent::__construct(
-            'QuickSite_Widget',
-            __('QuickSite 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_quicksite_option($name)
-    {
-        $settings = get_option('glmQuickSite_settings');
-        $states   = get_option('glmQuickSite_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;
-    }
-
-}
index c561bd6..c0a0ca5 100644 (file)
@@ -1,9 +1,9 @@
-<select name="glmQuickSite_settings[<?php echo $fieldName; ?>]">
-    <?php foreach ($states as $stateAbbr => $stateName) : ?>
+<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; ?>
+<?php endforeach; endif;?>
 </select>
\ No newline at end of file
index 61473f8..a00fba9 100644 (file)
@@ -1,2 +1,2 @@
-<input type="text" name="glmQuickSite_settings[<?php echo $fieldName;?>]"
+<input type="text" name="glmclientinfo_settings[<?php echo $fieldName;?>]"
            value="<?php echo str_replace('"', '&quote;', $options[$fieldName]); ?>">
\ No newline at end of file
index cb8ba6a..1f58fef 100644 (file)
@@ -1 +1 @@
-<textarea cols="40" rows="5" name="glmQuickSite_settings[<?php echo $fieldName;?>]"><?php echo htmlspecialchars($options[$fieldName]); ?></textarea>
\ No newline at end of file
+<textarea cols="40" rows="5" name="glmclientinfo_settings[<?php echo $fieldName;?>]"><?php echo htmlspecialchars($options[$fieldName]); ?></textarea>
\ No newline at end of file