Changeset 536937
- Timestamp:
- 04/26/2012 07:10:59 PM (14 years ago)
- Location:
- menu-rules
- Files:
-
- 99 added
- 6 edited
-
tags/1.0 (added)
-
tags/1.0/admin (added)
-
tags/1.0/admin/admin.php (added)
-
tags/1.0/admin/meta-box.php (added)
-
tags/1.0/assets (added)
-
tags/1.0/assets/css (added)
-
tags/1.0/assets/css/admin.css (added)
-
tags/1.0/includes (added)
-
tags/1.0/includes/menu-rules-handler.php (added)
-
tags/1.0/languages (added)
-
tags/1.0/languages/menu-rules-en_GB.mo (added)
-
tags/1.0/languages/menu-rules-en_GB.po (added)
-
tags/1.0/libs (added)
-
tags/1.0/libs/pb-framework (added)
-
tags/1.0/libs/pb-framework/assets (added)
-
tags/1.0/libs/pb-framework/assets/css (added)
-
tags/1.0/libs/pb-framework/assets/css/chosen.css (added)
-
tags/1.0/libs/pb-framework/assets/img (added)
-
tags/1.0/libs/pb-framework/assets/img/chosen-sprite.png (added)
-
tags/1.0/libs/pb-framework/assets/js (added)
-
tags/1.0/libs/pb-framework/assets/js/chosen.jquery.js (added)
-
tags/1.0/libs/pb-framework/assets/js/chosen.jquery.min.js (added)
-
tags/1.0/libs/pb-framework/assets/js/script.js (added)
-
tags/1.0/libs/pb-framework/forms.php (added)
-
tags/1.0/libs/pb-framework/load.php (added)
-
tags/1.0/libs/pb-framework/meta-box.php (added)
-
tags/1.0/libs/scb-framework (added)
-
tags/1.0/libs/scb-framework/example.php (added)
-
tags/1.0/libs/scb-framework/plugin.php (added)
-
tags/1.0/libs/scb-framework/readme.txt (added)
-
tags/1.0/libs/scb-framework/scb (added)
-
tags/1.0/libs/scb-framework/scb-debug.php (added)
-
tags/1.0/libs/scb-framework/scb-info.php (added)
-
tags/1.0/libs/scb-framework/scb-load.php (added)
-
tags/1.0/libs/scb-framework/scb/AdminPage.php (added)
-
tags/1.0/libs/scb-framework/scb/BoxesPage.php (added)
-
tags/1.0/libs/scb-framework/scb/Cron.php (added)
-
tags/1.0/libs/scb-framework/scb/Forms.php (added)
-
tags/1.0/libs/scb-framework/scb/Hooks.php (added)
-
tags/1.0/libs/scb-framework/scb/Options.php (added)
-
tags/1.0/libs/scb-framework/scb/Table.php (added)
-
tags/1.0/libs/scb-framework/scb/Util.php (added)
-
tags/1.0/libs/scb-framework/scb/Widget.php (added)
-
tags/1.0/libs/scb-framework/scb/load.php (added)
-
tags/1.0/menu-rules.php (added)
-
tags/1.0/readme.txt (added)
-
tags/1.0/rules (added)
-
tags/1.0/rules/active-parent.php (added)
-
tags/1.0/rules/child-page.php (added)
-
tags/1.1 (added)
-
tags/1.1/admin (added)
-
tags/1.1/admin/admin.php (added)
-
tags/1.1/admin/meta-box.php (added)
-
tags/1.1/assets (added)
-
tags/1.1/assets/css (added)
-
tags/1.1/assets/css/admin.css (added)
-
tags/1.1/includes (added)
-
tags/1.1/includes/menu-rules-handler.php (added)
-
tags/1.1/languages (added)
-
tags/1.1/languages/menu-rules-en_GB.mo (added)
-
tags/1.1/languages/menu-rules-en_GB.po (added)
-
tags/1.1/libs (added)
-
tags/1.1/libs/pb-framework (added)
-
tags/1.1/libs/pb-framework/assets (added)
-
tags/1.1/libs/pb-framework/assets/css (added)
-
tags/1.1/libs/pb-framework/assets/css/chosen.css (added)
-
tags/1.1/libs/pb-framework/assets/img (added)
-
tags/1.1/libs/pb-framework/assets/img/chosen-sprite.png (added)
-
tags/1.1/libs/pb-framework/assets/js (added)
-
tags/1.1/libs/pb-framework/assets/js/chosen.jquery.js (added)
-
tags/1.1/libs/pb-framework/assets/js/chosen.jquery.min.js (added)
-
tags/1.1/libs/pb-framework/assets/js/script.js (added)
-
tags/1.1/libs/pb-framework/forms.php (added)
-
tags/1.1/libs/pb-framework/load.php (added)
-
tags/1.1/libs/pb-framework/meta-box.php (added)
-
tags/1.1/libs/scb-framework (added)
-
tags/1.1/libs/scb-framework/example.php (added)
-
tags/1.1/libs/scb-framework/plugin.php (added)
-
tags/1.1/libs/scb-framework/readme.txt (added)
-
tags/1.1/libs/scb-framework/scb (added)
-
tags/1.1/libs/scb-framework/scb-debug.php (added)
-
tags/1.1/libs/scb-framework/scb-info.php (added)
-
tags/1.1/libs/scb-framework/scb-load.php (added)
-
tags/1.1/libs/scb-framework/scb/AdminPage.php (added)
-
tags/1.1/libs/scb-framework/scb/BoxesPage.php (added)
-
tags/1.1/libs/scb-framework/scb/Cron.php (added)
-
tags/1.1/libs/scb-framework/scb/Forms.php (added)
-
tags/1.1/libs/scb-framework/scb/Hooks.php (added)
-
tags/1.1/libs/scb-framework/scb/Options.php (added)
-
tags/1.1/libs/scb-framework/scb/Table.php (added)
-
tags/1.1/libs/scb-framework/scb/Util.php (added)
-
tags/1.1/libs/scb-framework/scb/Widget.php (added)
-
tags/1.1/libs/scb-framework/scb/load.php (added)
-
tags/1.1/menu-rules.php (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/rules (added)
-
tags/1.1/rules/active-parent.php (added)
-
tags/1.1/rules/child-page.php (added)
-
tags/1.1/rules/inactive-parent.php (added)
-
trunk/admin/meta-box.php (modified) (4 diffs)
-
trunk/libs/pb-framework/forms.php (modified) (2 diffs)
-
trunk/libs/pb-framework/meta-box.php (modified) (1 diff)
-
trunk/menu-rules.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/rules/active-parent.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
menu-rules/trunk/admin/meta-box.php
r522118 r536937 33 33 // Condition fields 34 34 $fields['conditions_adv'] = array( 35 array(35 'menu-rules-conditional-exp' => array( 36 36 'title' => __('When these conditions match:', 'menu-rules'), 37 37 'type' => 'textarea', … … 48 48 // Rules 49 49 $fields['rules'] = array( 50 array(51 'title' => __( 'Apply th ese rules:' , 'menu-rules'),52 'type' => ' checkbox',50 'menu-rules-rules' => array( 51 'title' => __( 'Apply this rule:' , 'menu-rules'), 52 'type' => 'radio', 53 53 'name' => 'menu-rules-rules', 54 'text' => __( 'Choose rules' , 'menu-rules'),55 54 'value' => array_combine( 56 55 array_keys( Menu_Rules::get_var( 'rules_handlers' ) ), … … 62 61 // Nav menus 63 62 $fields['nav_menus'] = array( 64 array(63 'menu-rules-menu-items' => array( 65 64 'title' => __( 'To these menu items:' , 'menu-rules'), 66 65 'type' => 'select', … … 92 91 echo PB_Forms::table( $this->get_fields( 'conditions_adv' ), $postmeta ); 93 92 echo PB_Forms::table( $this->get_fields( 'rules' ), $postmeta ); 93 94 // Backward compatibility notice for 1.0 - 1.1 upgrades 95 if ( count( $postmeta['menu-rules-rules'] ) > 1 ) { 96 echo '<div class="error">'; 97 98 echo '<p>' . __( 'We've changed the behaviour of Menu Rules so you can only select one rule per Menu Rule item. You have the following rules selected:', 'menu-rules' ) . '</p>'; 99 100 echo '<ul>'; 101 $menu_rules_rules_field = $this->get_field_def( 'menu-rules-rules' ); 102 foreach ( $postmeta['menu-rules-rules'] as $rule_value ) { 103 echo '<li>' . $menu_rules_rules_field['value'][$rule_value] . '</li>'; 104 } 105 echo '</ul>'; 106 107 echo '<p>' . sprintf( 108 _n( 109 'Please apply 1 of these rules to this item. %sThen create another menu rule%s, copy these conditions and menu items and apply the other rule.', 110 'Please apply 1 of these rules to this item. %sThen create more menu rules%s, copy these conditions and menu items and apply the other rules.', 111 count( $postmeta['menu-rules-rules'] ) - 1, 112 'menu-rules' 113 ), 114 '<a href="' . admin_url( 'post-new.php?post_type=menu_rule' ) . '">', 115 '</a>' 116 ) . '</p>'; 117 118 echo '</div>'; 119 } 120 94 121 echo PB_Forms::table( $this->get_fields( 'nav_menus' ), $postmeta ); 95 122 echo '<p>' . sprintf( __('A full list of conditonal tags can be %sfound on the WordPress.org codex%s. Do not include an if statement or a semicolon.', 'menu-rules'), '<a href="http://codex.wordpress.org/Conditional_Tags" target="_blank">', '</a>' ) . '</p>'; -
menu-rules/trunk/libs/pb-framework/forms.php
r521950 r536937 217 217 218 218 $opts = ''; 219 $counter = 0; 219 220 foreach ( $values as $value => $title ) { 221 if ( $counter > 0 ) $opts .= '<br/>'; 222 220 223 if ( empty( $value ) || empty( $title ) ) 221 224 continue; 222 225 223 226 $checkbox_args = array( 224 227 'type' => 'radio', 225 228 'value' => $value, 226 'checked' => ( (string) $value == (string) $selected ), 229 'checked' => is_array( $selected ) 230 ? in_array( $value, $selected ) 231 : ( (string) $value == (string) $selected ), 227 232 'desc' => $title, 228 233 'desc_pos' => 'after' … … 230 235 if ( isset( $extra ) ) $checkbox_args['extra'] = $extra; 231 236 $opts .= self::_checkbox( $checkbox_args ); 237 238 $counter++; 232 239 } 233 240 -
menu-rules/trunk/libs/pb-framework/meta-box.php
r521961 r536937 84 84 return $this->fields_flat = $fields; 85 85 } 86 87 // Get a specific field definition data 88 protected function get_field_def( $name ) { 89 $all_fields = $this->get_fields_flat(); 90 //print_r($all_fields); 91 return isset( $all_fields[$name] ) ? $all_fields[$name] : false; 92 } 86 93 } -
menu-rules/trunk/menu-rules.php
r521955 r536937 42 42 // Setup built-in rules handers 43 43 require_once dirname( __FILE__ ) . '/rules/active-parent.php'; 44 require_once dirname( __FILE__ ) . '/rules/inactive-parent.php'; 44 45 require_once dirname( __FILE__ ) . '/rules/child-page.php'; 45 46 -
menu-rules/trunk/readme.txt
r521950 r536937 4 4 Tags: menus, menu, context, rules, parent menu, active menu 5 5 Requires at least: 3.2 6 Tested up to: 3.3 7 Stable tag: 1. 06 Tested up to: 3.3.2 7 Stable tag: 1.1 8 8 9 9 An extension of the menu system with context-based rules and a flexible framework to write your own. … … 44 44 1. Open the 'Appearance' menu item and click the 'Menu Rules' link 45 45 1. Add a new menu rule and click ok. 46 47 == Changelog == 48 49 = 1.1 = 50 * Added new 'force inactive parent' rule 51 * Changed behaviour to one rule per item 52 * Minor enhancements to PB Framework 53 * Cleaned some unused code -
menu-rules/trunk/rules/active-parent.php
r521955 r536937 57 57 } 58 58 59 protected function setup_parent_classes( $menu_item ) {60 }61 62 59 protected function setup_ancestor_classes( &$menu_items, $active_ancestor_item_ids ) { 63 60 $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) );
Note: See TracChangeset
for help on using the changeset viewer.