Changeset 462557
- Timestamp:
- 11/14/2011 05:50:11 AM (14 years ago)
- Location:
- gecka-submenu/trunk
- Files:
-
- 7 edited
-
gecka-submenu.class.php (modified) (1 diff)
-
gecka-submenu.php (modified) (1 diff)
-
javascripts/admin-nav-menu-edit.js (modified) (1 diff)
-
models/NavMenuHacks.php (modified) (2 diffs)
-
models/Shortcodes.php (modified) (2 diffs)
-
models/Submenu.php (modified) (6 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gecka-submenu/trunk/gecka-submenu.class.php
r315553 r462557 177 177 $('#gecka_submenu_notice').hide('slow'); 178 178 }); 179 } 179 }; 180 180 }); 181 181 </script> -
gecka-submenu/trunk/gecka-submenu.php
r315553 r462557 3 3 Plugin Name: Gecka Submenu 4 4 Plugin URI: http://gecka-apps.com/wordpress-plugins/geka-submenu/ 5 Description: Enhances the worpdress nav menu system 6 Version: 0. 5.37 Author: Gecka 5 Description: Enhances the worpdress nav menu system, autopopulate with children pages 6 Version: 0.6 7 Author: Gecka Apps 8 8 Author URI: http://gecka-apps.com 9 9 Licence: GPL2 -
gecka-submenu/trunk/javascripts/admin-nav-menu-edit.js
r311323 r462557 8 8 gk_toggle_autopopulate_posttype_options = function (id) { 9 9 10 var value = $('input:radio[name=menu-item-autopopulate_type['+id+']]:checked').val(); 11 12 if(value=='posttype') $('.edit-menu-item-autopopulate-posttype-options-'+id).show(); 13 else $('.edit-menu-item-autopopulate-posttype-options-'+id).hide(); 10 var value = $('#edit-menu-item-autopopulate_type-'+id+'-posttype:checked').val(); 11 if(value=='posttype') { 12 $('.edit-menu-item-autopopulate-posttype-options-'+id).show(); 13 gk_autopopulate_posttype_taxonomies (id, $('#edit-menu-item-autopopulate_posttype-'+id)); 14 } 14 15 15 16 -
gecka-submenu/trunk/models/NavMenuHacks.php
r311323 r462557 45 45 case 'subpages': 46 46 47 $pages = get_pages( array('child_of' => $item->object_id, 'sort_column' => 'menu_order'));47 $pages = get_pages( apply_filters('gecka-submenu-get_pages', array('child_of' => $item->object_id, 'sort_column' => 'menu_order, post_title')) ); 48 48 49 49 $this->setup_posts ('post', &$item, &$pages, &$items, &$order); … … 117 117 $_item->menu_order = $order; 118 118 $_item->description = $_item->post_excerpt; 119 wp_setup_nav_menu_item($_item); 120 119 120 $object = get_post_type_object( $post->post_type ); 121 $_item->object = $object->name; 122 $_item->type_label = $object->labels->singular_name; 123 124 $_item->url = get_permalink( $post->ID ); 125 $_item->title = $post->post_title; 126 $_item->target = ''; 127 $_item->attr_title = ''; 128 $_item->classes = array ( 0 => ''); 129 $_item->xfn = ''; 130 121 131 $_item->db_id = $pseudo_id; 122 132 -
gecka-submenu/trunk/models/Shortcodes.php
r315553 r462557 2 2 3 3 class Gecka_Submenu_Shortcodes { 4 5 static $cache = array (); 4 6 5 7 public function __construct() { … … 13 15 public function menu ($Attributes) { 14 16 17 $key = serialize($Attributes); 18 if( isset( self::$cache[$key] ) ) return self::$cache[$key]; 19 15 20 $Menu = new Gecka_Submenu_Submenu(); 16 return $Menu->Get($Attributes);21 return self::$cache[$key] = $Menu->Get($Attributes); 17 22 18 23 } -
gecka-submenu/trunk/models/Submenu.php
r337729 r462557 127 127 if(!$menu || !is_nav_menu($menu)) return; 128 128 129 /* WPML support */ 130 if( function_exists('icl_object_id') ) { 131 132 global $sitepress; 133 134 /* not default language */ 135 if(ICL_LANGUAGE_CODE !== $sitepress->get_default_language() ) { 136 $translated_menu_id = icl_object_id($menu, 'nav_menu'); 137 $menu = $translated_menu_id ? $translated_menu_id : $menu; 138 } 139 } 140 141 /* */ 129 142 $menu_items = wp_get_nav_menu_items($menu); 130 143 … … 143 156 144 157 if( is_a($post, 'stdClass') && (int)$post->ID ) { 145 $submenu = $this->get_top_ancestor ($wp_query->get_queried_object_id(), &$menu_items, $_type);146 $submenu = $submenu->ID;158 if( $submenu = $this->get_top_ancestor ($wp_query->get_queried_object_id(), &$menu_items, $_type) ) 159 $submenu = $submenu->ID; 147 160 } 148 161 … … 171 184 $this->top_level_item = $submenu_item; 172 185 173 global $GKSM_ID, $GKSM_MENUID;174 $menu_object = wp_get_nav_menu_object($menu);186 global $GKSM_ID, $GKSM_MENUID; 187 $menu_object = wp_get_nav_menu_object($menu); 175 188 $GKSM_ID = $submenu_id; $GKSM_MENUID = $menu_object->term_id; 176 189 } … … 236 249 237 250 function get_associated_nav_menu_items( $object_id, &$menu_items, $object_type = 'post_type') { 238 $object_id = (int) $object_id; 251 252 $object_id = (int) $object_id; 239 253 $_menu_items = array(); 240 254 … … 245 259 } 246 260 } 247 261 262 if( !empty($_menu_items) || $object_type !== 'post_type' ) return $_menu_items; 263 264 // no associated 'post_type' menu item found, looking for associated 'taxonomy' menu item 265 return $this->get_associated_nav_menu_terms_items ( $object_id, &$menu_items ); 266 267 } 268 269 function get_associated_nav_menu_terms_items ( $object_id, &$menu_items ) { 270 271 $post = get_post($object_id); 272 273 if(!$post) return array(); 274 275 $_menu_items = array(); 276 $taxonomies = get_object_taxonomies($post->post_type); 277 278 279 foreach ($taxonomies as $taxonomy) { 280 281 if( !$terms = get_the_terms( $object_id, $taxonomy ) ) continue; 282 283 foreach ($terms as $term) { 284 285 $_menu_items = $this->get_associated_nav_menu_items($term->term_id, &$menu_items, 'taxonomy'); 286 if( !empty($_menu_items) ) return $_menu_items; 287 288 } 289 } 290 248 291 return $_menu_items; 249 } 292 293 } 250 294 251 295 /** … … 273 317 } 274 318 } 319 -
gecka-submenu/trunk/readme.txt
r315553 r462557 1 1 === Gecka Submenu === 2 Contributors: Laurent Dinclaux, Gecka3 Tags: nav menu, 3.0, submenu, sub-menu, child, child men 2 Contributors: Gecka 3 Tags: nav menu, 3.0, submenu, sub-menu, child, child men, subpages, subpage, dynamic menu, dynamic subpages, dynamic submenu 4 4 Requires at least: 3.0 5 Tested up to: 3. 0.16 Stable tag: 0. 5.35 Tested up to: 3.1 6 Stable tag: 0.6 7 7 Donate link: http://gecka-apps.com/wordpress-plugins/gecka-submenu-pro/ 8 8 … … 19 19 20 20 Languages available: english, french 21 22 **Contribute:** [This plugin is on GitHub](https://github.com/Gecka-Apps/Wordpress_Gecka_Submenu) ! 21 23 22 Check out the [Gecka Submenuvideo](http://www.youtube.com/watch?v=DHjMfD-k2Mo):24 [Discover the pro version](http://gecka-apps.com/wordpress-plugins/gecka-submenu-pro/ "Discover the pro version") by checking out the [Gecka Submenu Pro video](http://www.youtube.com/watch?v=DHjMfD-k2Mo): 23 25 24 26 http://www.youtube.com/watch?v=DHjMfD-k2Mo 25 27 26 [Discover the pro version](http://gecka-apps.com/wordpress-plugins/gecka-submenu-pro/ "Discover the pro version")27 28 28 == Installation == 29 29 … … 34 34 1. [Read the documentation](http://gecka-apps.com/documentation/geka-submenu-pro/) 35 35 36 **Contribute:** [This plugin is on GitHub](https://github.com/Gecka-Apps/Wordpress_Gecka_Submenu) ! 37 36 38 == Screenshots == 37 39 … … 41 43 == Changelog == 42 44 45 = 0.6 = 46 * shortcodes caching 47 * performances improvement 48 * fix: show categories submenus when viewing posts or archives 49 * WPML support 50 * more fixes 51 43 52 = 0.5.3 = 44 * add men nu item description positioning53 * add menu item description positioning 45 54 * fix template action 46 55 * fix start_from parameter that wasn't used
Note: See TracChangeset
for help on using the changeset viewer.