Plugin Directory

Changeset 470762


Ignore:
Timestamp:
12/04/2011 05:00:24 AM (14 years ago)
Author:
technical_mastermind
Message:

Fixed bug, updated to 1.0.1

Location:
tm-lunch-menu
Files:
4 edited
8 copied

Legend:

Unmodified
Added
Removed
  • tm-lunch-menu/tags/1.0.1/inc/meta_box.php

    r470619 r470762  
    11<?php
     2/*
     3 * WordPress Meta Box
     4 *
     5 * Contains the wordpress_meta_box class. Requires PHP version 5+ and WordPress version 2.9 or greater.
     6 *
     7 * @version 1.0.1
     8 * @author Micah Wood
     9 * @copyright Copyright (c) 2011 - Micah Wood
     10 * @license GPL 3 - http://www.gnu.org/licenses/gpl.txt
     11 */
    212
    313if( !class_exists('wordpress_meta_box') ){
    414
     15    /*
     16    * WordPress Meta Box Class
     17    *
     18    * A class that handles the registration of WordPress meta boxes and takes care of all the
     19    * dirty work for you.
     20    *
     21    * @package WordPress Meta Box
     22    */
    523    class wordpress_meta_box {
    624
    725        private $id,                            // HTML id for meta box
    8                 $title,                         // Title for meta box
    9                 $content_path,                  // Path to the file containing the meta box content
    10                 $data = array(),                // Array containing the names of data values to be saved
    11                 $post_type = 'post',            // Post type that displays meta box
    12                 $context = 'advanced',          // Location on page: normal, advanced, side
    13                 $priority = 'default',          // Priority on page: high, core, default, low
    14                 $callback_args = array(),       // Array of arguments to pass to callback function
    15                 $user_capability = 'edit_post', // User capability required to save meta data
    16                 $nonce_name = '_wpnonce',       // Nonce name used to save meta data
    17                 $nonce_action = '-1',           // Value used to add context to the nonce
    18                 $errors = array();              // A collection of meta names and error codes
     26            $title,                         // Title for meta box
     27            $content_path,                  // Path to the file containing the meta box content
     28            $data = array(),                // Array containing the names of data values to be saved
     29            $post_type = 'post',            // Post type that displays meta box
     30            $context = 'advanced',          // Location on page: normal, advanced, side
     31            $priority = 'default',          // Priority on page: high, core, default, low
     32            $callback_args = array(),       // Array of arguments to pass to callback function
     33            $user_capability = 'edit_post', // User capability required to save meta data
     34            $nonce_name = '_wpnonce',       // Nonce name used to save meta data
     35            $nonce_action = '-1',           // Value used to add context to the nonce
     36            $errors = array();              // A collection of meta names and error codes
    1937
    2038        function __construct( $id, $title, $content_path, $args = array() ){
     
    7593            $data = $this->data;
    7694            // Use this filter to add post meta to save for this meta box
    77             $data = apply_filters( $this->post_type . '-save_meta_data', $data );
    78            // Construct array of meta data
    79                         $new_data = array();
    80                         foreach($data as $meta) {
    81                                 $new_data[$meta] = $_POST[$meta];
    82                         }
    83                         // Open editing of results
    84                         $data = apply_filters( $this->post_type . '-edit_meta_data', $new_data);
     95            $data = apply_filters( 'save_meta_box-' . $this->id, $data );
     96            // Construct array of meta data
     97            $new_data = array();
     98            foreach($data as $meta) {
     99                $new_data[$meta] = $_POST[$meta];
     100            }
     101            // Open editing of results
     102            $data = apply_filters( 'edit_meta_box-' . $this->id, $new_data);
     103
    85104            // Save meta data
    86105            foreach( $data as $name=>$value ){
     
    97116                    if ( empty( $value ) ){
    98117                        delete_post_meta( $post_id, $name );
    99                     // Otherwise, update the meta
     118                        // Otherwise, update the meta
    100119                    } else {
    101120                        update_post_meta( $post_id, $name, $value );
    102121                    }
    103                 // Validation is enabled and meta value is invalid
     122                    // Validation is enabled and meta value is invalid
    104123                } else {
    105124                    // Store general error if not already done
     
    120139        function validate_post_meta( $name, $value ){
    121140            $validation = array( 'valid' => true, 'code' => 1 );
    122             $validation = apply_filters( $this->post_type . '-validate_meta_data', $validation, $name, $value );
     141            $validation = apply_filters( 'validate_meta_box-' . $this->id, $validation, $name, $value );
    123142            return $validation;
    124143        }
     
    135154            }
    136155        }
    137 
    138156    }
    139 
    140157}
  • tm-lunch-menu/tags/1.0.1/index.php

    r470619 r470762  
    33Plugin Name: TM Lunch Menu
    44Plugin URI:
    5 Description: Designed for easy display, editing, & scheduling of lunch menus or other similar lists using a widget.
    6 Version: 1.0
     5Description: 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!
     6Version: 1.0.1
    77Author: David Wood
    88Author URI: http://iamdavidwood.com
     
    136136            $id = 'tm_lunch_menu_meta_box',
    137137            $title = 'Menu Details',
    138             $content_path = TM_LM_PATH . '/inc/meta-boxes/lunch-details.php',                $args = array('data' => array('_tm_lunch_date', '_tm_lunch_menu_day'),
     138            $content_path = TM_LM_PATH . '/inc/meta-boxes/lunch-details.php', $args = array('data' => array('_tm_lunch_date', '_tm_lunch_menu_day'),
    139139                'post_type' => 'tm_lunch_menu',
    140140                'context' => 'normal',
     
    143143            )
    144144        );
    145         add_filter('tm_lunch_menu-edit_meta_data', array($this, 'meta_process'), 10, 3);
     145        add_filter('edit_meta_box-tm_lunch_menu_meta_box', array($this, 'meta_process'), 10, 3);
    146146    }
    147147
  • tm-lunch-menu/tags/1.0.1/readme.txt

    r470619 r470762  
    99Requires at least: 3.0
    1010Tested up to:      3.3
    11 Stable tag:        1.0
    12 Version:           1.0
     11Stable tag:        1.0.1
     12Version:           1.0.1
    1313
    1414== Description ==
    1515Designed 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.
     16
     17If 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!
    1618
    1719== Installation ==
     
    2224
    2325== Upgrade Notice ==
     26= 1.0.1 =
     27Fixed show-stopping bug where widget may not display
    2428= 1.0 =
    2529Initial plugin release!
    2630
    2731== Screenshots ==
     32Coming soon!
    2833
    2934== Changelog ==
     35= 1.0.1 =
     36* Fixed show-stopping bug where widget may not display
    3037= 1.0 =
    3138* Plugin released!
  • tm-lunch-menu/trunk/inc/meta_box.php

    r470619 r470762  
    11<?php
     2/*
     3 * WordPress Meta Box
     4 *
     5 * Contains the wordpress_meta_box class. Requires PHP version 5+ and WordPress version 2.9 or greater.
     6 *
     7 * @version 1.0.1
     8 * @author Micah Wood
     9 * @copyright Copyright (c) 2011 - Micah Wood
     10 * @license GPL 3 - http://www.gnu.org/licenses/gpl.txt
     11 */
    212
    313if( !class_exists('wordpress_meta_box') ){
    414
     15    /*
     16    * WordPress Meta Box Class
     17    *
     18    * A class that handles the registration of WordPress meta boxes and takes care of all the
     19    * dirty work for you.
     20    *
     21    * @package WordPress Meta Box
     22    */
    523    class wordpress_meta_box {
    624
    725        private $id,                            // HTML id for meta box
    8                 $title,                         // Title for meta box
    9                 $content_path,                  // Path to the file containing the meta box content
    10                 $data = array(),                // Array containing the names of data values to be saved
    11                 $post_type = 'post',            // Post type that displays meta box
    12                 $context = 'advanced',          // Location on page: normal, advanced, side
    13                 $priority = 'default',          // Priority on page: high, core, default, low
    14                 $callback_args = array(),       // Array of arguments to pass to callback function
    15                 $user_capability = 'edit_post', // User capability required to save meta data
    16                 $nonce_name = '_wpnonce',       // Nonce name used to save meta data
    17                 $nonce_action = '-1',           // Value used to add context to the nonce
    18                 $errors = array();              // A collection of meta names and error codes
     26            $title,                         // Title for meta box
     27            $content_path,                  // Path to the file containing the meta box content
     28            $data = array(),                // Array containing the names of data values to be saved
     29            $post_type = 'post',            // Post type that displays meta box
     30            $context = 'advanced',          // Location on page: normal, advanced, side
     31            $priority = 'default',          // Priority on page: high, core, default, low
     32            $callback_args = array(),       // Array of arguments to pass to callback function
     33            $user_capability = 'edit_post', // User capability required to save meta data
     34            $nonce_name = '_wpnonce',       // Nonce name used to save meta data
     35            $nonce_action = '-1',           // Value used to add context to the nonce
     36            $errors = array();              // A collection of meta names and error codes
    1937
    2038        function __construct( $id, $title, $content_path, $args = array() ){
     
    7593            $data = $this->data;
    7694            // Use this filter to add post meta to save for this meta box
    77             $data = apply_filters( $this->post_type . '-save_meta_data', $data );
    78            // Construct array of meta data
    79                         $new_data = array();
    80                         foreach($data as $meta) {
    81                                 $new_data[$meta] = $_POST[$meta];
    82                         }
    83                         // Open editing of results
    84                         $data = apply_filters( $this->post_type . '-edit_meta_data', $new_data);
     95            $data = apply_filters( 'save_meta_box-' . $this->id, $data );
     96            // Construct array of meta data
     97            $new_data = array();
     98            foreach($data as $meta) {
     99                $new_data[$meta] = $_POST[$meta];
     100            }
     101            // Open editing of results
     102            $data = apply_filters( 'edit_meta_box-' . $this->id, $new_data);
     103
    85104            // Save meta data
    86105            foreach( $data as $name=>$value ){
     
    97116                    if ( empty( $value ) ){
    98117                        delete_post_meta( $post_id, $name );
    99                     // Otherwise, update the meta
     118                        // Otherwise, update the meta
    100119                    } else {
    101120                        update_post_meta( $post_id, $name, $value );
    102121                    }
    103                 // Validation is enabled and meta value is invalid
     122                    // Validation is enabled and meta value is invalid
    104123                } else {
    105124                    // Store general error if not already done
     
    120139        function validate_post_meta( $name, $value ){
    121140            $validation = array( 'valid' => true, 'code' => 1 );
    122             $validation = apply_filters( $this->post_type . '-validate_meta_data', $validation, $name, $value );
     141            $validation = apply_filters( 'validate_meta_box-' . $this->id, $validation, $name, $value );
    123142            return $validation;
    124143        }
     
    135154            }
    136155        }
    137 
    138156    }
    139 
    140157}
  • tm-lunch-menu/trunk/index.php

    r470619 r470762  
    33Plugin Name: TM Lunch Menu
    44Plugin URI:
    5 Description: Designed for easy display, editing, & scheduling of lunch menus or other similar lists using a widget.
    6 Version: 1.0
     5Description: 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!
     6Version: 1.0.1
    77Author: David Wood
    88Author URI: http://iamdavidwood.com
     
    136136            $id = 'tm_lunch_menu_meta_box',
    137137            $title = 'Menu Details',
    138             $content_path = TM_LM_PATH . '/inc/meta-boxes/lunch-details.php',                $args = array('data' => array('_tm_lunch_date', '_tm_lunch_menu_day'),
     138            $content_path = TM_LM_PATH . '/inc/meta-boxes/lunch-details.php', $args = array('data' => array('_tm_lunch_date', '_tm_lunch_menu_day'),
    139139                'post_type' => 'tm_lunch_menu',
    140140                'context' => 'normal',
     
    143143            )
    144144        );
    145         add_filter('tm_lunch_menu-edit_meta_data', array($this, 'meta_process'), 10, 3);
     145        add_filter('edit_meta_box-tm_lunch_menu_meta_box', array($this, 'meta_process'), 10, 3);
    146146    }
    147147
  • tm-lunch-menu/trunk/readme.txt

    r470619 r470762  
    99Requires at least: 3.0
    1010Tested up to:      3.3
    11 Stable tag:        1.0
    12 Version:           1.0
     11Stable tag:        1.0.1
     12Version:           1.0.1
    1313
    1414== Description ==
    1515Designed 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.
     16
     17If 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!
    1618
    1719== Installation ==
     
    2224
    2325== Upgrade Notice ==
     26= 1.0.1 =
     27Fixed show-stopping bug where widget may not display
    2428= 1.0 =
    2529Initial plugin release!
    2630
    2731== Screenshots ==
     32Coming soon!
    2833
    2934== Changelog ==
     35= 1.0.1 =
     36* Fixed show-stopping bug where widget may not display
    3037= 1.0 =
    3138* Plugin released!
Note: See TracChangeset for help on using the changeset viewer.