WordPress.org

Plugin Directory

Changeset 475697


Ignore:
Timestamp:
12/15/11 04:48:23 (2 years ago)
Author:
MZAWeb
Message:
  • Added an optional collapsable table in the widget showing the working hours for all weekdays.
  • Fixed the mess of different names (working hours, open hours, etc) in favour of Business Hours.
  • Added support email
  • WordPress 3.3 compatible.
Location:
business-hours-plugin/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • business-hours-plugin/trunk/README.txt

    r467232 r475697  
    44Tags: working hours, working, business hours, business, hours 
    55Requires at least: 3.1 
    6 Tested up to: 3.2.1 
    7 Stable tag: 1.1 
     6Tested up to: 3.3 
     7Stable tag: 1.2 
    88 
    9 The Business Hours Plugin allows you to post your daily working hours and show it to your visitors in a configurable and templatable widget. 
     9The Business Hours Plugin allows you to post your daily working hours and show it to your visitors in a bunch of different ways. 
    1010 
    1111== Description == 
    12 The Business Hours Plugin allows you to post your daily working hours and show it to your visitors in a configurable and templatable widget. 
     12The Business Hours Plugin allows you to post your daily working hours and show it to your visitors: 
     13* In a configurable and templatable widget. 
     14* In a page / post using a shortcode 
     15 
     16Also you can choose to show the business hours for today (using your time zone), or the business hours of all weekdays. 
    1317 
    1418It is a great plugin for themes that want to display a restaurants or brick and mortar stores current daily hours. The plugin uses template tags that you can format to show them the way you want. 
     
    3943== Changelog == 
    4044 
     45= 1.2 = 
     46* Added an optional collapsable table in the widget showing the working hours for all weekdays. 
     47* Fixed the mess of different names (working hours, open hours, etc) in favour of Business Hours. 
     48* Added support email 
     49* WordPress 3.3 compatible. 
     50 
     51= 1.1 = 
     52* Some minor bug fixes 
     53 
    4154= 1.0.2 = 
    4255* Fixed screenshots 
  • business-hours-plugin/trunk/lib/MZAFormBuilder.php

    r467201 r475697  
    157157        } 
    158158 
     159        protected function do_field_support($name, $field){ 
     160            echo '<a href="mailto:'.esc_attr(isset($field["email"]) ? $field["email"] : "").'">'.esc_attr(isset($field["email"]) ? $field["email"] : "").'</a>'; 
     161         } 
    159162    } 
    160163} 
  • business-hours-plugin/trunk/widget.php

    r467201 r475697  
    1010        function WorkingHoursWidget() { 
    1111 
    12             $widget_ops = array( 'classname' => 'workinghourswidget', 'description' => 'Shows your working hours by day' ); 
     12            $widget_ops = array( 'classname' => 'workinghourswidget', 'description' => 'Shows your business hours by day' ); 
    1313 
    1414            $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'workinghourswidget' ); 
    1515 
    16             $this->WP_Widget( 'workinghourswidget', 'Working Hours by Day', $widget_ops, $control_ops ); 
     16            $this->WP_Widget( 'workinghourswidget', 'Business Hours by Day', $widget_ops, $control_ops ); 
    1717 
    18             if ( is_active_widget(false, false, $this->id_base) ) 
    19                 add_action( 'wp_enqueue_scripts', array(&$this, 'jquery') ); 
     18            if ( is_active_widget(false, false, $this->id_base) ){ 
     19                add_action( 'wp_enqueue_scripts', array(&$this, 'scripts') ); 
     20            } 
    2021 
    2122        } 
    2223 
    23         function jquery(){ 
     24 
     25        function scripts(){ 
    2426            wp_enqueue_script( 'jquery' ); 
     27 
     28            wp_register_script('BusinessHoursScript', plugins_url('script.js', __FILE__), array('jquery')); 
     29            wp_enqueue_script('BusinessHoursScript'); 
     30 
     31            wp_register_style('BusinessHoursStyle', plugins_url('style.css', __FILE__)); 
     32            wp_enqueue_style('BusinessHoursStyle'); 
    2533        } 
    2634 
     
    6371            echo $template; 
    6472 
     73            if ($instance['allweek'] == "1"){ 
     74                 
     75                echo '<a class="business_hours_collapsable_handler" href="#">[Show all days]</a>'; 
     76                echo '<div class="business_hours_collapsable">'; 
     77 
     78                $timestamp = strtotime('next Sunday'); 
     79                $days = array(); 
     80                for ($i = 0; $i < 7; $i++) { 
     81                    $days[] = strftime('%A', $timestamp); 
     82                    $timestamp = strtotime('+1 day', $timestamp); 
     83                } 
     84 
     85                echo "<table width='100%'>"; 
     86                echo "<tr><th>Day</th><th>Open</th><th>Close</th></tr>"; 
     87                foreach ($days as $day){ 
     88                    $day = strtolower($day); 
     89                    $open = $workinghours->settings->get_setting($day,"open"); 
     90                    $close = $workinghours->settings->get_setting($day,"close"); 
     91                    $working = $workinghours->settings->get_setting($day,"working"); 
     92 
     93                    echo "<tr>"; 
     94                    echo "<td class='business_hours_table_day'>". ucwords($day) ."</td>"; 
     95                    if ($working == "true"){ 
     96                        echo "<td class='business_hours_table_open'>". ucwords($open) ."</td>"; 
     97                        echo "<td class='business_hours_table_close'>". ucwords($close) ."</td>"; 
     98                    }else{ 
     99                        echo "<td class='business_hours_table_closed' colspan='2' align='center'>Closed</td>"; 
     100                    } 
     101 
     102 
     103                    echo "</tr>"; 
     104                } 
     105                echo "</table>"; 
     106                echo '</div>'; 
     107 
     108            } 
     109 
    65110            echo $after_widget; 
    66111             
     
    74119            $instance['template_hours'] = $new_instance['template_hours']; 
    75120            $instance['template_closed'] = $new_instance['template_closed']; 
     121            $instance['allweek'] = $new_instance['allweek']; 
    76122 
    77123            return $instance; 
     
    82128                   
    83129            $defaults = array( 
    84                 'title' => "Open Hours", 
    85                 'template_today' => "<div class='working_hours_title'>Working hours on {{Day}}:</div>", 
     130                'title' => "Business Hours", 
     131                'template_today' => "<div class='working_hours_title'>Business hours on {{Day}}:</div>", 
    86132                'template_hours' => "<span class='working_hours_open'>{{Open}}</span> - <span class='working_hours_close'>{{Close}}</span>", 
    87                 'template_closed' => "<div class='working_hours_closed'>Closed</div>" 
     133                'template_closed' => "<div class='working_hours_closed'>Closed</div>", 
     134                'allweek' => 0 
    88135            ); 
    89136 
     
    91138            ?> 
    92139            <p> 
    93                 <small>Click <a href="<?php echo admin_url("options-general.php?page=working-hours-settings"); ?>">here</a> to setup your working hours.</small> 
     140                <small>Click <a href="<?php echo admin_url("options-general.php?page=working-hours-settings"); ?>">here</a> to setup your business hours or get support.</small> 
    94141            </p> 
    95142            <p> 
     
    113160            </p> 
    114161 
     162             <p> 
     163                <label for="<?php echo $this->get_field_id( 'allweek' ); ?>">Show also a collapsable list with the business hours for each weekday: </label> 
     164                <input type="checkbox" id="<?php echo $this->get_field_id( 'allweek' ); ?>" value="1" <?php checked($instance["allweek"] == "1");  ?> name="<?php echo $this->get_field_name( 'allweek' ); ?>"/> 
     165             </p> 
     166 
    115167 
    116168 
  • business-hours-plugin/trunk/working-hours.class.php

    r467201 r475697  
    4444                    ) 
    4545            ); 
     46 
    4647        } 
    4748 
     49        $sections["support"] = array( 
     50           "title" => __("Support","Working Hours"), 
     51               "fields" => array( 
     52                   "mzaweb" => array( 
     53                       "title" => "Bugs? Questions? Suggestions?", 
     54                       "type" => "support", 
     55                       "email" => "support@mzaweb.com" 
     56                   ) 
     57               ) 
     58        ); 
     59 
    4860        $this->settings = new MZASettings("working-hours", 'options-general.php', $sections); 
    49         $this->settings->settingsPageTitle = __("Working Hours Settings", "Working Hours"); 
    50         $this->settings->settingsLinkTitle = __("Working Hours", "Working Hours"); 
     61        $this->settings->settingsPageTitle = __("Business Hours Settings", "Working Hours"); 
     62        $this->settings->settingsLinkTitle = __("Business Hours", "Working Hours"); 
    5163 
    5264        $this->settings->customJS .= "jQuery('#working-hours_settings_form input:checkbox').each(function() { 
  • business-hours-plugin/trunk/working-hours.php

    r467234 r475697  
    11<?php 
    22/* 
    3 Plugin Name: Working Hours 
     3Plugin Name: Business Hours 
    44Plugin URI: http://mzaweb.com/en 
    5 Description: Creates a widget that will show your visitors the working hours each day 
     5Description: Creates a widget that will show your visitors the business hours each day 
    66Author: MZAWeb 
    77Author URI: http://mzaweb.com/en 
    8 Version: 1.1 
     8Version: 1.2 
    99*/ 
    1010 
Note: See TracChangeset for help on using the changeset viewer.