Changeset 470762
- Timestamp:
- 12/04/2011 05:00:24 AM (14 years ago)
- Location:
- tm-lunch-menu
- Files:
-
- 4 edited
- 8 copied
-
tags/1.0.1 (copied) (copied from tm-lunch-menu/trunk)
-
tags/1.0.1/css (copied) (copied from tm-lunch-menu/trunk/css)
-
tags/1.0.1/images (copied) (copied from tm-lunch-menu/trunk/images)
-
tags/1.0.1/inc (copied) (copied from tm-lunch-menu/trunk/inc)
-
tags/1.0.1/inc/meta_box.php (modified) (5 diffs)
-
tags/1.0.1/index.php (copied) (copied from tm-lunch-menu/trunk/index.php) (3 diffs)
-
tags/1.0.1/js (copied) (copied from tm-lunch-menu/trunk/js)
-
tags/1.0.1/license.txt (copied) (copied from tm-lunch-menu/trunk/license.txt)
-
tags/1.0.1/readme.txt (copied) (copied from tm-lunch-menu/trunk/readme.txt) (2 diffs)
-
trunk/inc/meta_box.php (modified) (5 diffs)
-
trunk/index.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tm-lunch-menu/tags/1.0.1/inc/meta_box.php
r470619 r470762 1 1 <?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 */ 2 12 3 13 if( !class_exists('wordpress_meta_box') ){ 4 14 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 */ 5 23 class wordpress_meta_box { 6 24 7 25 private $id, // HTML id for meta box 8 $title, // Title for meta box9 $content_path, // Path to the file containing the meta box content10 $data = array(), // Array containing the names of data values to be saved11 $post_type = 'post', // Post type that displays meta box12 $context = 'advanced', // Location on page: normal, advanced, side13 $priority = 'default', // Priority on page: high, core, default, low14 $callback_args = array(), // Array of arguments to pass to callback function15 $user_capability = 'edit_post', // User capability required to save meta data16 $nonce_name = '_wpnonce', // Nonce name used to save meta data17 $nonce_action = '-1', // Value used to add context to the nonce18 $errors = array(); // A collection of meta names and error codes26 $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 19 37 20 38 function __construct( $id, $title, $content_path, $args = array() ){ … … 75 93 $data = $this->data; 76 94 // 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 85 104 // Save meta data 86 105 foreach( $data as $name=>$value ){ … … 97 116 if ( empty( $value ) ){ 98 117 delete_post_meta( $post_id, $name ); 99 // Otherwise, update the meta118 // Otherwise, update the meta 100 119 } else { 101 120 update_post_meta( $post_id, $name, $value ); 102 121 } 103 // Validation is enabled and meta value is invalid122 // Validation is enabled and meta value is invalid 104 123 } else { 105 124 // Store general error if not already done … … 120 139 function validate_post_meta( $name, $value ){ 121 140 $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 ); 123 142 return $validation; 124 143 } … … 135 154 } 136 155 } 137 138 156 } 139 140 157 } -
tm-lunch-menu/tags/1.0.1/index.php
r470619 r470762 3 3 Plugin Name: TM Lunch Menu 4 4 Plugin URI: 5 Description: Designed for easy display, editing, & scheduling of lunch menus or other similar lists using a widget.6 Version: 1.0 5 Description: 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 7 7 Author: David Wood 8 8 Author URI: http://iamdavidwood.com … … 136 136 $id = 'tm_lunch_menu_meta_box', 137 137 $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'), 139 139 'post_type' => 'tm_lunch_menu', 140 140 'context' => 'normal', … … 143 143 ) 144 144 ); 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); 146 146 } 147 147 -
tm-lunch-menu/tags/1.0.1/readme.txt
r470619 r470762 9 9 Requires at least: 3.0 10 10 Tested up to: 3.3 11 Stable tag: 1.0 12 Version: 1.0 11 Stable tag: 1.0.1 12 Version: 1.0.1 13 13 14 14 == Description == 15 15 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. 16 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! 16 18 17 19 == Installation == … … 22 24 23 25 == Upgrade Notice == 26 = 1.0.1 = 27 Fixed show-stopping bug where widget may not display 24 28 = 1.0 = 25 29 Initial plugin release! 26 30 27 31 == Screenshots == 32 Coming soon! 28 33 29 34 == Changelog == 35 = 1.0.1 = 36 * Fixed show-stopping bug where widget may not display 30 37 = 1.0 = 31 38 * Plugin released! -
tm-lunch-menu/trunk/inc/meta_box.php
r470619 r470762 1 1 <?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 */ 2 12 3 13 if( !class_exists('wordpress_meta_box') ){ 4 14 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 */ 5 23 class wordpress_meta_box { 6 24 7 25 private $id, // HTML id for meta box 8 $title, // Title for meta box9 $content_path, // Path to the file containing the meta box content10 $data = array(), // Array containing the names of data values to be saved11 $post_type = 'post', // Post type that displays meta box12 $context = 'advanced', // Location on page: normal, advanced, side13 $priority = 'default', // Priority on page: high, core, default, low14 $callback_args = array(), // Array of arguments to pass to callback function15 $user_capability = 'edit_post', // User capability required to save meta data16 $nonce_name = '_wpnonce', // Nonce name used to save meta data17 $nonce_action = '-1', // Value used to add context to the nonce18 $errors = array(); // A collection of meta names and error codes26 $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 19 37 20 38 function __construct( $id, $title, $content_path, $args = array() ){ … … 75 93 $data = $this->data; 76 94 // 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 85 104 // Save meta data 86 105 foreach( $data as $name=>$value ){ … … 97 116 if ( empty( $value ) ){ 98 117 delete_post_meta( $post_id, $name ); 99 // Otherwise, update the meta118 // Otherwise, update the meta 100 119 } else { 101 120 update_post_meta( $post_id, $name, $value ); 102 121 } 103 // Validation is enabled and meta value is invalid122 // Validation is enabled and meta value is invalid 104 123 } else { 105 124 // Store general error if not already done … … 120 139 function validate_post_meta( $name, $value ){ 121 140 $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 ); 123 142 return $validation; 124 143 } … … 135 154 } 136 155 } 137 138 156 } 139 140 157 } -
tm-lunch-menu/trunk/index.php
r470619 r470762 3 3 Plugin Name: TM Lunch Menu 4 4 Plugin URI: 5 Description: Designed for easy display, editing, & scheduling of lunch menus or other similar lists using a widget.6 Version: 1.0 5 Description: 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 7 7 Author: David Wood 8 8 Author URI: http://iamdavidwood.com … … 136 136 $id = 'tm_lunch_menu_meta_box', 137 137 $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'), 139 139 'post_type' => 'tm_lunch_menu', 140 140 'context' => 'normal', … … 143 143 ) 144 144 ); 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); 146 146 } 147 147 -
tm-lunch-menu/trunk/readme.txt
r470619 r470762 9 9 Requires at least: 3.0 10 10 Tested up to: 3.3 11 Stable tag: 1.0 12 Version: 1.0 11 Stable tag: 1.0.1 12 Version: 1.0.1 13 13 14 14 == Description == 15 15 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. 16 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! 16 18 17 19 == Installation == … … 22 24 23 25 == Upgrade Notice == 26 = 1.0.1 = 27 Fixed show-stopping bug where widget may not display 24 28 = 1.0 = 25 29 Initial plugin release! 26 30 27 31 == Screenshots == 32 Coming soon! 28 33 29 34 == Changelog == 35 = 1.0.1 = 36 * Fixed show-stopping bug where widget may not display 30 37 = 1.0 = 31 38 * Plugin released!
Note: See TracChangeset
for help on using the changeset viewer.