Plugin Directory

Changeset 462557


Ignore:
Timestamp:
11/14/2011 05:50:11 AM (14 years ago)
Author:
Gecka
Message:

0.6

Location:
gecka-submenu/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • gecka-submenu/trunk/gecka-submenu.class.php

    r315553 r462557  
    177177                $('#gecka_submenu_notice').hide('slow');
    178178            });
    179             }
     179            };
    180180        });
    181181        </script>
  • gecka-submenu/trunk/gecka-submenu.php

    r315553 r462557  
    33Plugin Name: Gecka Submenu
    44Plugin URI: http://gecka-apps.com/wordpress-plugins/geka-submenu/
    5 Description: Enhances the worpdress nav menu system
    6 Version: 0.5.3
    7 Author: Gecka
     5Description: Enhances the worpdress nav menu system, autopopulate with children pages
     6Version: 0.6
     7Author: Gecka Apps
    88Author URI: http://gecka-apps.com
    99Licence: GPL2
  • gecka-submenu/trunk/javascripts/admin-nav-menu-edit.js

    r311323 r462557  
    88    gk_toggle_autopopulate_posttype_options = function (id) {
    99   
    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        }
    1415   
    1516       
  • gecka-submenu/trunk/models/NavMenuHacks.php

    r311323 r462557  
    4545                    case 'subpages':
    4646                       
    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')) );
    4848                       
    4949                        $this->setup_posts ('post', &$item, &$pages, &$items, &$order);
     
    117117        $_item->menu_order = $order;
    118118        $_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               
    121131        $_item->db_id =  $pseudo_id;
    122132       
  • gecka-submenu/trunk/models/Shortcodes.php

    r315553 r462557  
    22
    33class Gecka_Submenu_Shortcodes {
     4
     5    static $cache = array ();
    46   
    57    public function __construct()  {
     
    1315    public function menu ($Attributes) {
    1416
     17        $key = serialize($Attributes);
     18        if( isset( self::$cache[$key] ) ) return self::$cache[$key];
     19       
    1520        $Menu = new Gecka_Submenu_Submenu();
    16         return $Menu->Get($Attributes);
     21        return self::$cache[$key] = $Menu->Get($Attributes);
    1722       
    1823    }
  • gecka-submenu/trunk/models/Submenu.php

    r337729 r462557  
    127127        if(!$menu || !is_nav_menu($menu)) return;
    128128       
     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        /* */       
    129142        $menu_items = wp_get_nav_menu_items($menu);
    130143       
     
    143156           
    144157            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;
    147160            }
    148161           
     
    171184            $this->top_level_item = $submenu_item;
    172185       
    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);
    175188            $GKSM_ID = $submenu_id; $GKSM_MENUID = $menu_object->term_id;
    176189        }
     
    236249   
    237250    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;
    239253        $_menu_items = array();
    240254
     
    245259            }
    246260        }
    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 
    248291        return $_menu_items; 
    249     }   
     292       
     293    }
    250294   
    251295    /**
     
    273317    }
    274318}
     319
  • gecka-submenu/trunk/readme.txt

    r315553 r462557  
    11=== Gecka Submenu ===
    2 Contributors: Laurent Dinclaux, Gecka
    3 Tags: nav menu, 3.0, submenu, sub-menu, child, child men
     2Contributors: Gecka
     3Tags: nav menu, 3.0, submenu, sub-menu, child, child men, subpages, subpage, dynamic menu, dynamic subpages, dynamic submenu
    44Requires at least: 3.0
    5 Tested up to: 3.0.1
    6 Stable tag: 0.5.3
     5Tested up to: 3.1
     6Stable tag: 0.6
    77Donate link: http://gecka-apps.com/wordpress-plugins/gecka-submenu-pro/
    88
     
    1919
    2020Languages available: english, french 
     21
     22**Contribute:** [This plugin is on GitHub](https://github.com/Gecka-Apps/Wordpress_Gecka_Submenu) !
    2123 
    22 Check out the [Gecka Submenu video](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): 
    2325 
    2426http://www.youtube.com/watch?v=DHjMfD-k2Mo 
    2527 
    26 [Discover the pro version](http://gecka-apps.com/wordpress-plugins/gecka-submenu-pro/ "Discover the pro version")
    27 
    2828== Installation ==
    2929
     
    34341.  [Read the documentation](http://gecka-apps.com/documentation/geka-submenu-pro/)
    3535
     36**Contribute:** [This plugin is on GitHub](https://github.com/Gecka-Apps/Wordpress_Gecka_Submenu) !
     37
    3638== Screenshots ==
    3739
     
    4143== Changelog ==
    4244
     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
    4352= 0.5.3 =
    44 * add mennu item description positioning
     53* add menu item description positioning
    4554* fix template action
    4655* fix start_from parameter that wasn't used
Note: See TracChangeset for help on using the changeset viewer.