+++ /dev/null
-<?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__)
-);
* @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()
}
}
- 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()
}
}
- 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',
);
}
- 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;
__($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'
);
);
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;
}
* @release Release: (0.1)
* @link <>
*/
-class QuickSite_Front_controller
+class Glmclientinfo_Front_controller
{
/**
* Plugin Path
- *
+ *
* @var type String
*/
public $path;
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');
}
}
--- /dev/null
+<?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__)
+);
--- /dev/null
+<?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;
+ }
+
+}
+++ /dev/null
-<?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;
- }
-
-}
-<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
-<input type="text" name="glmQuickSite_settings[<?php echo $fieldName;?>]"
+<input type="text" name="glmclientinfo_settings[<?php echo $fieldName;?>]"
value="<?php echo str_replace('"', '"e;', $options[$fieldName]); ?>">
\ No newline at end of file
-<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