Plugin Directory

Changeset 525874


Ignore:
Timestamp:
04/01/2012 08:25:49 PM (14 years ago)
Author:
technical_mastermind
Message:

Preparing for update to 1.0.2

Location:
tm-lunch-menu/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • tm-lunch-menu/trunk/inc/meta-boxes/admin-settings.php

    r470619 r525874  
    1111    $settings['no_menu_msg'] = esc_attr($_POST['msg']);
    1212    $settings['weeks'] = esc_attr($_POST['weeks']);
     13    $settings['format'] = esc_attr($_POST['date-format']);
    1314    $save_data = esc_attr($_POST['tm_lunch_menu_save_data']);
    1415    update_option('tm_lunch_menu_settings', $settings);
     
    2122}
    2223
     24if(!is_array($settings['days']))
     25    $settings['days'] = array(1,2,3,4,5);
     26
    2327// Shortcut variables
    2428$selected = ' selected="selected"';
    2529$checked = ' checked="checked"';
     30
     31global $tm_lunch_menu_days, $tm_lunch_menu_months;
    2632?>
    27 <div class="wrap"><h2>Lunch Menu Settings</h2>
     33<div class="wrap"><h2><?php _e('Lunch Menu Settings', 'tm-lunch-menu'); ?></h2>
    2834    <form action="" method="post">
    29         <p><label>Days to include in menus:</label><br>
    30             <input type="checkbox" value="0" name="days[]"<?php if(is_array($settings['days']) && in_array(0, $settings['days'])) echo $checked; ?> /> Sunday<br>
    31             <input type="checkbox" value="1" name="days[]"<?php if(is_array($settings['days']) && in_array(1, $settings['days'])) echo $checked; ?> /> Monday<br>
    32             <input type="checkbox" value="2" name="days[]"<?php if(is_array($settings['days']) && in_array(2, $settings['days'])) echo $checked; ?> /> Tuesday<br>
    33             <input type="checkbox" value="3" name="days[]"<?php if(is_array($settings['days']) && in_array(3, $settings['days'])) echo $checked; ?> /> Wednesday<br>
    34             <input type="checkbox" value="4" name="days[]"<?php if(is_array($settings['days']) && in_array(4, $settings['days'])) echo $checked; ?> /> Thursday<br>
    35             <input type="checkbox" value="5" name="days[]"<?php if(is_array($settings['days']) && in_array(5, $settings['days'])) echo $checked; ?> /> Friday<br>
    36             <input type="checkbox" value="6" name="days[]"<?php if(is_array($settings['days']) && in_array(6, $settings['days'])) echo $checked; ?> /> Saturday</p>
    37         <p><label>Action to take when there is no current menu:</label><br>
    38             <select name="action">
    39                 <option value="hide"<?php if(isset($settings['no_menu']) && $settings['no_menu'] == 'hide') echo $selected; ?>>Hide widget</option>
    40                 <option value="display"<?php if(isset($settings['no_menu']) && $settings['no_menu'] == 'display') echo $selected; ?>>Display custom message (see below)</option>
     35        <p><label><?php _e('Days to include in menus', 'tm-lunch-menu'); ?>:</label><br>
     36            <?php
     37            foreach($tm_lunch_menu_days as $key=>$day) {
     38                echo '<input type="checkbox" value="'.$key.'" name="days[]" id="days-'.$key.'"';
     39                echo (in_array($key, $settings['days']))?' '.$checked:'';
     40                echo ' /> <label for="days-'.$key.'">'.$day.'</label><br/>';
     41            }
     42            ?>
     43        <p><label for="tm-action"><?php _e('Action to take when there is no current menu', 'tm-lunch-menu'); ?>:</label><br>
     44            <select name="action" id="tm-action">
     45                <option value="hide"<?php if(isset($settings['no_menu']) && $settings['no_menu'] == 'hide') echo $selected; ?>><?php _e('Hide widget', 'tm-lunch-menu'); ?></option>
     46                <option value="display"<?php if(isset($settings['no_menu']) && $settings['no_menu'] == 'display') echo $selected; ?>><?php _e('Display custom message (see below)', 'tm-lunch-menu'); ?></option>
    4147            </select>
    4248        </p>
    43         <p><label>Custom display message:</label> <input type="text" name="msg" value="<?php if(isset($settings['no_menu_msg'])) echo stripslashes($settings['no_menu_msg']); ?>" /></p>
    44         <p><label>Maximum number of weeks into the future to pull menus from:</label>
    45         <select name="weeks">
     49        <p><label for="tm-msg"><?php _e('Custom display message', 'tm-lunch-menu'); ?>:</label> <input type="text" name="msg" id="tm-msg" value="<?php if(isset($settings['no_menu_msg'])) echo stripslashes($settings['no_menu_msg']); ?>" /></p>
     50        <p><label for="tm-weeks"><?php _e('Maximum number of weeks into the future to pull menus from', 'tm-lunch-menu'); ?>:</label>
     51        <select name="weeks" id="tm-weeks">
    4652            <?php
    4753            $x = 0; $y = 10;
     
    5258                echo '>'.$x.'</option>';
    5359            } ?>
    54         </select> weeks
     60        </select> <?php _e('weeks', 'tm-lunch-menu'); ?>
    5561        </p>
    5662       
    5763        <p>
    58             <input type="checkbox" name="tm_lunch_menu_save_data" value="delete"<?php if($save_data == 'delete') echo $checked; ?> /> <label>Delete all data when plugin is deactivated</label>
     64            <label for="date-format"><?php _e('Date display format', 'tm-lunch-menu'); ?>:</label>
     65            <select name="date-format" id="date-format">
     66                <?php
     67                $formats = array(
     68                    '%D, %M %d',
     69                    '%D, %F %d',
     70                    '%l, %M %d',
     71                    '%l, %F %d',
     72                    '%F %d, %l',
     73                    '%F %d, %D',
     74                    '%M %d, %l',
     75                    '%M %d, %D',
     76                    '%M %d',
     77                    '%F %d',
     78                    '%D, %d',
     79                    '%l, %d',
     80                    '%D',
     81                    '%l',
     82                );
     83                foreach($formats as $format) {
     84                    $tmp = str_replace('%F', $tm_lunch_menu_months[1], $format);
     85                    $tmp = str_replace('%M', substr($tm_lunch_menu_months[1], 0, 3), $tmp);
     86                    $tmp = str_replace('%l', $tm_lunch_menu_days[1], $tmp);
     87                    $tmp = str_replace('%D', substr($tm_lunch_menu_days[1], 0, 3), $tmp);
     88                    $tmp = str_replace('%d', '21', $tmp);
     89                    echo '<option value="'.$format.'"';
     90                    echo ($format == $settings['format'])?' '.$selected:'';
     91                    echo '>'.$tmp.'</option>';
     92                }
     93                ?>
     94            </select>
     95        </p>
     96       
     97        <p>
     98            <input type="checkbox" name="tm_lunch_menu_save_data" id="tm_lunch_menu_save_data" value="delete"<?php if($save_data == 'delete') echo $checked; ?> />
     99            <label for="tm_lunch_menu_save_data"><?php _e('Delete all data when plugin is deactivated', 'tm-lunch-menu'); ?></label>
    59100        </p>
    60101
    61         <p><input type="submit" class="button-primary" name="tm_settings_update" value="Update Settings" />
    62             <input type="submit" class="button-primary" name="tm_settings_reset" value="Reset to defaults" /></p>
     102        <p><input type="submit" class="button-primary" name="tm_settings_update" value="<?php _e('Update Settings', 'tm-lunch-menu'); ?>" />
     103            <input type="submit" class="button-primary" name="tm_settings_reset" value="<?php _e('Reset to defaults', 'tm-lunch-menu'); ?>" /></p>
    63104    </form>
    64105</div>
  • tm-lunch-menu/trunk/inc/meta-boxes/widget-options.php

    r470619 r525874  
    66?>
    77<p>
    8     <label  for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>
    9     <input  id="<?php echo $this->get_field_id('title'); ?>"
     8    <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'tm-lunch-menu'); ?>:</label>
     9    <input id="<?php echo $this->get_field_id('title'); ?>"
    1010    name="<?php echo $this->get_field_name('title'); ?>"
    1111    type="text"
    12     value="<?php echo $instance['title']; ?>" /></label>
     12    value="<?php echo $instance['title']; ?>" />
    1313</p>
    1414<p>
    15     <label  for="<?php echo $this->get_field_id('numberposts'); ?>"><?php _e('Max number of menus to show at one time:'); ?><br />
    16     <select  id="<?php echo $this->get_field_id('numberposts'); ?>"
     15    <label for="<?php echo $this->get_field_id('numberposts'); ?>"><?php _e('Max number of menus to show at one time', 'tm-lunch-menu'); ?>:</label><br />
     16    <select id="<?php echo $this->get_field_id('numberposts'); ?>"
    1717    name="<?php echo $this->get_field_name('numberposts'); ?>">
    1818        <?php
     
    2525        }
    2626        ?>
    27     </select></label>
     27    </select>
    2828</p>
    2929<p>
    30     <label  for="<?php echo $this->get_field_id('show_partial'); ?>"><?php _e('Remove individual menu items after their date has passed?'); ?><br />
    31     <select  id="<?php echo $this->get_field_id('show_partial'); ?>"
     30    <label for="<?php echo $this->get_field_id('show_partial'); ?>"><?php _e('Remove individual menu items after their date has passed?', 'tm-lunch-menu'); ?></label><br />
     31    <select id="<?php echo $this->get_field_id('show_partial'); ?>"
    3232    name="<?php echo $this->get_field_name('show_partial'); ?>">
    33         <option value="0" <?php if($instance['show_partial'] == 0) echo $selected; ?>>No</option>
    34         <option value="1" <?php if($instance['show_partial'] == 1) echo $selected; ?>>Yes</option>
    35     </select></label>
     33        <option value="0" <?php if($instance['show_partial'] == 0) echo $selected; ?>><?php _e('No', 'tm-lunch-menu'); ?></option>
     34        <option value="1" <?php if($instance['show_partial'] == 1) echo $selected; ?>><?php _e('Yes', 'tm-lunch-menu'); ?></option>
     35    </select>
    3636</p>
  • tm-lunch-menu/trunk/index.php

    r470762 r525874  
    44Plugin URI:
    55Description: Designed for easy display, editing, & scheduling of lunch menus or other similar lists, TM Lunch Menu uses a custom widget to display your menu on any page of your site. This plugin allows you to easily add a daily menu by simply filling in the meal for any day (and any number of days) of the week, set a menu start date and hit publish. Once published it will automatically show up in the custom "Lunch Menu" widget when its time comes. After a menu (or menu item) has expired it will automatically remove itself from the widget display. An integrated calendar style date-picker makes it even easier to select your menu's start date and the date is always shown next to every menu item so there is no confusion about what day the menu is for. NOTE: If you find something that does not work, please post in the WordPress.org forums and tag it with "tm-lunch-menu" so I can fix it!
    6 Version: 1.0.1
     6Version: 1.0.2
    77Author: David Wood
    8 Author URI: http://iamdavidwood.com
     8Author URI: http://technicalmastermind.com/about-david-wood/
     9Text Domain: tm-lunch-menu
    910============================================================================================================
    1011This software is provided "as is" and any express or implied warranties, including, but not limited to, the
     
    2930require(TM_LM_PATH . '/inc/meta_box.php'); // Custom meta box registration class
    3031
     32global $tm_lunch_menu_days, $tm_lunch_menu_months;
     33$tm_lunch_menu_days = array(
     34    __('Sunday', 'tm-lunch-menu'),
     35    __('Monday', 'tm-lunch-menu'),
     36    __('Tuesday', 'tm-lunch-menu'),
     37    __('Wednesday', 'tm-lunch-menu'),
     38    __('Thursday', 'tm-lunch-menu'),
     39    __('Friday', 'tm-lunch-menu'),
     40    __('Saturday', 'tm-lunch-menu'),
     41);
     42$tm_lunch_menu_months = array(
     43    '',
     44    __('January', 'tm-lunch-menu'),
     45    __('February', 'tm-lunch-menu'),
     46    __('March', 'tm-lunch-menu'),
     47    __('April', 'tm-lunch-menu'),
     48    __('May', 'tm-lunch-menu'),
     49    __('June', 'tm-lunch-menu'),
     50    __('July', 'tm-lunch-menu'),
     51    __('August', 'tm-lunch-menu'),
     52    __('September', 'tm-lunch-menu'),
     53    __('October', 'tm-lunch-menu'),
     54    __('November', 'tm-lunch-menu'),
     55    __('December', 'tm-lunch-menu'),
     56);
     57
     58
    3159if(!class_exists('tm_lunch_menu')):
    3260class tm_lunch_menu {
    33     private $version = '1.0',
     61    private $version = '1.0.2',
    3462        $default_settings = array(
    3563            'days' => array(1,2,3,4,5), // Stored as numbers
     
    6694    }
    6795
    68     function admin_enqueue_scripts(){
    69         wp_register_script('jquery-datepicker', plugins_url('/js/jquery.ui.datepicker.min.js', TM_LM_FILE), array('jquery-ui-core'), $this->version);
    70         wp_enqueue_script('tm-date-time', plugins_url('/js/date-time.js', TM_LM_FILE), array('jquery-datepicker'), $this->version);
    71         wp_enqueue_script('tm-lunchmenu-save', plugins_url('/js/tm_lunch_menusave.js', TM_LM_FILE), array('tm-date-time'), $this->version);
    72         wp_localize_script('tm-date-time', 'tmDateTime', array('pluginURL' => TM_LM_URL));
     96    function admin_enqueue_scripts($hook){
     97        if($hook == 'post.php' || ($hook == 'post-new.php' && $_REQUEST['post_type'] == 'tm_lunch_menu')) {
     98            wp_register_script('jquery-datepicker', plugins_url('/js/jquery.ui.datepicker.min.js', TM_LM_FILE), array('jquery-ui-core'), $this->version);
     99            wp_enqueue_script('tm-date-time', plugins_url('/js/date-time.js', TM_LM_FILE), array('jquery-datepicker'), $this->version);
     100            wp_enqueue_script('tm-lunchmenu-save', plugins_url('/js/tm_lunch_menusave.js', TM_LM_FILE), array('tm-date-time'), $this->version);
     101            wp_localize_script('tm-date-time', 'tmDateTime', array('pluginURL' => TM_LM_URL));
     102        }
    73103    }
    74104
     
    78108
    79109    function add_admin_page() {
    80         $this->tm_help = add_submenu_page('edit.php?post_type=tm_lunch_menu', 'Lunch Menu Settings', 'Settings', 'manage_options', 'tm_lunch_menu_settings', array($this, 'admin_settings'));
     110        $this->tm_help = add_submenu_page('edit.php?post_type=tm_lunch_menu', __('Lunch Menu Settings', 'tm-lunch-menu'), __('Settings', 'tm-lunch-menu'), 'manage_options', 'tm_lunch_menu_settings', array($this, 'admin_settings'));
    81111    }
    82112
    83113    function admin_settings() {
    84114        if(!current_user_can('manage_options'))
    85             wp_die('You do not have permission to view this page!');
     115            wp_die(__('You do not have permission to view this page!', 'tm-lunch-menu'));
    86116        // Page and functionality
    87117        require(TM_LM_PATH.'/inc/meta-boxes/admin-settings.php');
     
    92122            // Add Lunch Menu post type
    93123            new wordpress_custom_post_type('tm_lunch_menu', array(
    94                 'singular' => __('Lunch Menu', 'lunch-menu'),
    95                 'plural' => __('Lunch Menus', 'lunch-menu'),
    96                 'textdomain' => 'lunch-menu',
     124                'singular' => __('Lunch Menu', 'tm-lunch-menu'),
     125                'plural' => __('Lunch Menus', 'tm-lunch-menu'),
     126                'textdomain' => 'tm-lunch-menu',
    97127                'args' => array(
    98128                    'labels' => array(
    99                         'name' => __('Lunch Menus', 'lunch-menu'),
    100                         'singular_name' => __('Lunch Menu', 'lunch-menu'),
    101                         'add_new' => __('Add Lunch Menu', 'lunch-menu'),
    102                         'add_new_item' => __('Add New Lunch Menu', 'lunch-menu'),
    103                         'edit_item' => __('Edit Lunch Menu', 'lunch-menu'),
    104                         'new_item' => __('New Lunch Menu', 'lunch-menu'),
    105                         'view_item' => __('View Lunch Menu', 'lunch-menu'),
    106                         'search_items' => __('Search Lunch Menus', 'lunch-menu'),
    107                         'not_found' => __('No lunch menus found', 'lunch-menu'),
    108                         'not_found_in_trash' => __('No lunch menus found in trash', 'lunch-menu')
     129                        'name' => __('Lunch Menus', 'tm-lunch-menu'),
     130                        'singular_name' => __('Lunch Menu', 'tm-lunch-menu'),
     131                        'add_new' => __('Add Lunch Menu', 'tm-lunch-menu'),
     132                        'add_new_item' => __('Add New Lunch Menu', 'tm-lunch-menu'),
     133                        'edit_item' => __('Edit Lunch Menu', 'tm-lunch-menu'),
     134                        'new_item' => __('New Lunch Menu', 'tm-lunch-menu'),
     135                        'view_item' => __('View Lunch Menu', 'tm-lunch-menu'),
     136                        'search_items' => __('Search Lunch Menus', 'tm-lunch-menu'),
     137                        'not_found' => __('No lunch menus found', 'tm-lunch-menu'),
     138                        'not_found_in_trash' => __('No lunch menus found in trash', 'tm-lunch-menu')
    109139                    ),
    110140                    'supports' => array(''),
    111141                    'public' => false,
    112142                    'show_ui' => true,
    113                     /*'capability_type' => 's8_opportunity',
    114                     'capabilities' => array(
    115                         'edit_post' => 'edit_s8_opportunity',
    116                         'edit_posts' => 'edit_s8_opportunities',
    117                         'edit_published_posts' => 'edit_published_s8_opportunities',
    118                         'edit_others_posts' => 'edit_others_s8_opportunities',
    119                         'publish_posts' => 'publish_s8_opportunities',
    120                         'read_post' => 'read_s8_opportunity',
    121                         'read_private_posts' => 'read_private_s8_opportunities',
    122                         'delete_post' => 'delete_s8_opportunity',
    123                         'delete_posts' => 'delete_s8_opportunities',
    124                         'delete_published_posts' => 'delete_published_s8_opportunities',
    125                         'delete_others_posts' => 'delete_others_s8_opportunities'
    126                     ),
    127                     'map_meta_cap' => true*/
    128143                )
    129144            ) );
     
    135150        new wordpress_meta_box(
    136151            $id = 'tm_lunch_menu_meta_box',
    137             $title = 'Menu Details',
     152            $title = __('Menu Details', 'tm-lunch-menu'),
    138153            $content_path = TM_LM_PATH . '/inc/meta-boxes/lunch-details.php', $args = array('data' => array('_tm_lunch_date', '_tm_lunch_menu_day'),
    139154                'post_type' => 'tm_lunch_menu',
     
    163178            if($key == 'title'){
    164179                $tmp[$key] = $column;
    165                 $tmp['tm_menu_start'] = 'Menu Start Date';
     180                $tmp['tm_menu_start'] = __('Menu Start Date', 'tm-lunch-menu');
    166181            }
    167182            elseif($key == 'date') continue;
     
    177192        if( $column_name == 'tm_menu_start' ) {
    178193            $timestamp = get_post_meta($post->ID, '_tm_lunch_timestamp', true);
    179             echo (is_numeric($timestamp))? date('m/d/Y', $timestamp): 'An error occurred!';
     194            echo (is_numeric($timestamp))? date('m/d/Y', $timestamp): __('An error occurred!', 'tm-lunch-menu');
    180195        }
    181196    }
     
    198213    function update() {
    199214        // Store default settings in the database
    200         update_option('tm_lunch_menu_settings', $this->default_settings);
    201         update_option('tm_lunch_menu_save_data', '');
    202215        update_option('tm_lunch_menu_ver', $this->version);
    203216    }
     
    228241class tm_lunch_menu_widget extends WP_Widget {
    229242    function tm_lunch_menu_widget() {
    230         $name = __('Lunch Menu'); // The widget name as users will see it
    231         $description = __('Displays current and upcoming menus from the Lunch Menu plugin.'); // The widget description as users will see it
     243        $name = __('Lunch Menu', 'tm-lunch-menu'); // The widget name as users will see it
     244        $description = __('Displays current and upcoming menus from the Lunch Menu plugin.', 'tm-lunch-menu'); // The widget description as users will see it
    232245        $this->WP_Widget(
    233246            $id_base = false,
     
    252265    function widget($args, $instance) {
    253266        // Setup widget display elements
     267        global $tm_lunch_menu_days, $tm_lunch_menu_months;
    254268        $before_widget = $after_widget = $before_title = $after_title = '';
    255269        extract($args, EXTR_IF_EXISTS);
     
    290304                        if((in_array($start_day, $settings['days']) && !empty($items[$start_day])))
    291305                        if(($instance['show_partial'] == 1 && ($today <= ($timestamp + (86400 * $x)))) || $instance['show_partial'] == 0) {
    292                             echo '<strong>'.date('l, M j', $timestamp + (86400 * $x)).'</strong><br />';
     306                            if(!$settings['format']) $settings['format'] = '%l, %M %d';
     307                            $week_day = date('w', $timestamp + (86400 * $x));
     308                            $month = date('n', $timestamp + (86400 * $x));
     309                            $day = date('j', $timestamp + (86400 * $x));
     310                            $tmp = str_replace('%F', $tm_lunch_menu_months[$month], $settings['format']);
     311                            $tmp = str_replace('%M', substr($tm_lunch_menu_months[$month], 0, 3), $tmp);
     312                            $tmp = str_replace('%l', $tm_lunch_menu_days[$week_day], $tmp);
     313                            $tmp = str_replace('%D', substr($tm_lunch_menu_days[$week_day], 0, 3), $tmp);
     314                            $tmp = str_replace('%d', $day, $tmp);
     315                            echo '<strong>'.$tmp.'</strong><br />';
    293316                            echo $items[$start_day].'<br/>';
    294317                        }
  • tm-lunch-menu/trunk/readme.txt

    r470762 r525874  
    44Plugin URI:        http://technicalmastermind.com/plugins/tm-lunch-menu/
    55Tags:              lunch menu, lunch, menu, technical mastermind, tm, daily menu, daily meal, daily list
    6 Author URI:        http://iamdavidwood.com/
     6Author URI:        http://technicalmastermind.com/about-david-wood/
    77Author:            David Wood
    88Donate link:       http://technicalmastermind.com/donate/
    99Requires at least: 3.0
    10 Tested up to:      3.3
     10Tested up to:      3.3.1
    1111Stable tag:        1.0.1
    12 Version:           1.0.1
     12
     13Allows for easy widgetized display of simple lunch menus (or other day based lists).
    1314
    1415== Description ==
    1516Designed for easy display, editing, & scheduling of lunch menus or other similar lists, TM Lunch Menu uses a custom widget to display your menu on any page of your site. This plugin allows you to easily add a daily menu by simply filling in the meal for any day (and any number of days) of the week, set a menu start date and hit publish. Once published it will automatically show up in the custom "Lunch Menu" widget when its time comes. After a menu (or menu item) has expired it will automatically remove itself from the widget display. An integrated calendar style date-picker makes it even easier to select your menu's start date and the date is always shown next to every menu item so there is no confusion about what day the menu is for.
    1617
    17 If you find something that does not work, please post in the WordPress.org forums and tag it with "tm-lunch-menu" so I can fix it!
     18= A word on support and additional features =
     19While every attempt is made to ensure there are no bugs, if any are found or you would like to request that additional features be added, please let me know! In an effort to help others looking for similar answers and to help build the WordPress.org community I ask that all requests for support and features be made through the [WordPress.org forums](http://wordpress.org/tags/tm-lunch-menu?forum_id=10#postform).
    1820
    1921== Installation ==
     
    2426
    2527== Upgrade Notice ==
     28= 1.0.2 =
     29Internationalized everything and added ability to change date display format.
    2630= 1.0.1 =
    2731Fixed show-stopping bug where widget may not display
     
    3034
    3135== Screenshots ==
    32 Coming soon!
     361. An example of a simple menu
    3337
    3438== Changelog ==
     39= 1.0.2 =
     40* Added complete internationalization support
     41* Added option to change the date display format
     42* Other various improvments
    3543= 1.0.1 =
    3644* Fixed show-stopping bug where widget may not display
Note: See TracChangeset for help on using the changeset viewer.