function __construct($path)
{
$this->path = $path;
- add_action('widgets_init', array($this, 'prestonclientinfo_register_widget'));
+
}
/**
* Register the Client Info Widget with WordPress
*/
- function prestonclientinfo_register_widget()
+ function locations()
{
- include $this->path . 'models/PrestonInfoWidget.php';
- register_widget('PrestonInfoWidget');
+ echo 'done';
+ include $this->path . 'models/Preston_Feather_Locations.php';
+ $locations = new Preston_Feather_Locations($this->path);
+ $locations->toHtml();
}
}
$adminController = new Preston_Info_Admin_Controller(
plugin_dir_path(__FILE__)
);
+} else {
+ function preston_feather_get_locations()
+ {
+ include 'models/Preston_Feather_Locations.php';
+ $locations = new Preston_Feather_Locations(plugin_dir_path(__FILE__));
+ $locations->toHtml();
+ }
}
-
-// call the Front Controller to setup the widget
-require_once 'controllers/Front.php';
-$frontController = new Preston_Info_Front_controller(
- plugin_dir_path(__FILE__)
-);
+++ /dev/null
-<?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 PrestonInfoWidget
- extends WP_widget
-{
-
- private $pluginDirPath;
-
- /**
- * Class Initializer
- */
- public function __construct()
- {
- parent::__construct(
- 'PrestonInfoWidget',
- __('Locations Info Widget', 'text_domain'),
- array('description' => __('Locations 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 show_option($name, $key)
- {
- $settings = get_option('prestonclientinfo_settings');
- $states = get_option('prestonclientinfo_states');
- if ($key) {
- return ($settings[$name][$key])
- ? $settings[$name][$key]
- : null;
- } else {
- return ($settings && $settings[$name])
- ? $settings[$name]
- : null;
- }
-
- }
-
-}
--- /dev/null
+<?php
+
+/**
+ * Preston_Feather_Locations.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 <>
+ */
+
+/**
+ * Preston_Feather_Locations
+ *
+ * Output the Locations.
+ *
+ * @category Toolkit
+ * @package Package
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license Gaslight Media
+ * @release Release: (0.1)
+ * @link <>
+ */
+class Preston_Feather_Locations
+{
+
+ private $pluginDirPath;
+
+ /**
+ * Class Initializer
+ */
+ public function __construct($path)
+ {
+ $this->pluginDirPath = $path;
+ }
+
+ /**
+ * Output Locations
+ *
+ * Includes the template file for the widget.
+ * Template file is plain old php for your fastest template engine yet!
+ *
+ * @return string
+ */
+ public function toHtml()
+ {
+ include $this->pluginDirPath . 'views/locations.php';
+ }
+
+ /**
+ * Return the locations option for the given key
+ *
+ * @param string $name Name of the quicksite option to return
+ * @param string $key Sub key for the value
+ *
+ * @return string Option
+ */
+ function show_option($name, $key = null)
+ {
+ $settings = get_option('prestonclientinfo_settings');
+ if ($key) {
+ return ($settings[$name][$key])
+ ? $settings[$name][$key]
+ : null;
+ } else {
+ return ($settings && $settings[$name])
+ ? $settings[$name]
+ : null;
+ }
+
+ }
+
+}
--- /dev/null
+<?php for ($i = 1; $i <= 4; ++$i):?>
+<div class="small-12 medium-3 columns">
+ <div class="center">
+ <h3><?php echo $this->show_option('location' . $i);?></h3>
+ <p><?php echo $this->show_option('address' . $i);?></p>
+ <p><?php echo $this->show_option('city' . $i);?>, <?php echo $this->show_option('state' . $i);?> <?php echo $this->show_option('zip' . $i);?></p>
+ <p><?php echo $this->show_option('phone' . $i);?>
+ <?php if($this->show_option('tfree' . $i)):?>⋅ <?php echo $this->show_option('tfree' . $i);?><?php endif;?></p>
+ <?php if ($this->show_option('hours' . $i . 'a', 'days')):?>
+ <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'a', 'days'));?></p>
+ <?php endif;?>
+ <?php if ($this->show_option('hours' . $i . 'a', 'times')):?>
+ <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'a', 'times'));?></p>
+ <?php endif;?>
+ <?php if ($this->show_option('hours' . $i . 'b', 'days')):?>
+ <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'b', 'days'));?></p>
+ <?php endif;?>
+ <?php if ($this->show_option('hours' . $i . 'b', 'times')):?>
+ <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'b', 'times'));?></p>
+ <?php endif;?>
+ <?php if ($this->show_option('hours' . $i . 'c', 'days')):?>
+ <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'c', 'days'));?></p>
+ <?php endif;?>
+ <?php if ($this->show_option('hours' . $i . 'c', 'times')):?>
+ <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'c', 'times'));?></p>
+ <?php endif;?>
+ </div>
+</div>
+<?php endfor;?>
+++ /dev/null
-<?php for ($i = 1; $i <= 4; ++$i):?>
-<div class="small-12 medium-3 columns">
- <div class="center">
- <h3><?php echo $this->show_option('location' . $i);?></h3>
- <p><?php echo $this->show_option('address' . $i);?></p>
- <p><?php echo $this->show_option('city' . $i);?>, <?php echo $this->show_option('state' . $i);?> <?php echo $this->show_option('zip' . $i);?></p>
- <p><?php echo $this->show_option('phone' . $i);?>
- <?php if($this->show_option('tfree' . $i)):?>⋅ <?php echo $this->show_option('tfree' . $i);?><?php endif;?></p>
- <?php if ($this->show_option('hours' . $i . 'a', 'days')):?>
- <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'a', 'days'));?></p>
- <?php endif;?>
- <?php if ($this->show_option('hours' . $i . 'a', 'times')):?>
- <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'a', 'times'));?></p>
- <?php endif;?>
- <?php if ($this->show_option('hours' . $i . 'b', 'days')):?>
- <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'b', 'days'));?></p>
- <?php endif;?>
- <?php if ($this->show_option('hours' . $i . 'b', 'times')):?>
- <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'b', 'times'));?></p>
- <?php endif;?>
- <?php if ($this->show_option('hours' . $i . 'c', 'days')):?>
- <p class="day"><?php echo nl2br($this->show_option('hours' . $i . 'c', 'days'));?></p>
- <?php endif;?>
- <?php if ($this->show_option('hours' . $i . 'c', 'times')):?>
- <p class="time"><?php echo nl2br($this->show_option('hours' . $i . 'c', 'times'));?></p>
- <?php endif;?>
- </div>
-</div>
-<?php endfor;?>