Advanced Sidebar Menu - Version 5.0.2

Version Description

Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Advanced Sidebar Menu
Version 5.0.2
Comparing to
See all releases

Code changes from version 5.0.1 to 5.0.2

advanced-sidebar-menu.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Advanced Sidebar Menu
4
  Plugin URI: http://matlipe.com/advanced-sidebar-menu/
5
  Description: Creates dynamic menu based on child/parent relationship.
6
  Author: Mat Lipe
7
- Version: 5.0.1
8
  Author URI: http://matlipe.com
9
  */
10
 
11
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.0.1' );
12
 
13
 
14
  #-- Define Constants
4
  Plugin URI: http://matlipe.com/advanced-sidebar-menu/
5
  Description: Creates dynamic menu based on child/parent relationship.
6
  Author: Mat Lipe
7
+ Version: 5.0.2
8
  Author URI: http://matlipe.com
9
  */
10
 
11
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '5.0.2' );
12
 
13
 
14
  #-- Define Constants
classes/Advanced_Sidebar_Menu_List_Pages.php CHANGED
@@ -82,12 +82,20 @@ class Advanced_Sidebar_Menu_List_Pages{
82
  *
83
  * Used in the view
84
  *
85
- * @param array $child_pages - array if page_ids
86
- * @param array $args - see $this->fill_class_vars
87
  */
88
- public function __construct( $parent_id, $args ){
89
 
90
  $this->top_parent_id = $parent_id;
 
 
 
 
 
 
 
 
91
  $this->fill_class_vars( $args );
92
 
93
  }
@@ -116,8 +124,6 @@ class Advanced_Sidebar_Menu_List_Pages{
116
  * @return void
117
  */
118
  private function fill_class_vars( $args ){
119
- global $wp_query;
120
-
121
  $defaults = array(
122
  'depth' => 1,
123
  'exclude' => '',
@@ -127,7 +133,8 @@ class Advanced_Sidebar_Menu_List_Pages{
127
  'hierarchical' => 0,
128
  'link_before' => '',
129
  'link_after' => '',
130
- 'title_li' => ''
 
131
  );
132
 
133
  $args = wp_parse_args( $args, $defaults );
@@ -189,8 +196,6 @@ class Advanced_Sidebar_Menu_List_Pages{
189
  * @return string
190
  */
191
  private function list_grandchild_pages( $parent_page_id ){
192
- $content = '';
193
-
194
  if( !$this->current_page_ancestor( $parent_page_id ) ){
195
  return '';
196
  }
@@ -199,22 +204,28 @@ class Advanced_Sidebar_Menu_List_Pages{
199
  return '';
200
  }
201
 
202
- foreach( $pages as $page ){
203
- $content .= walk_page_tree( array( $page ), 1, $this->current_page_id, $this->args );
 
 
 
204
 
205
- $content .= $this->list_grandchild_pages( $page->ID );
 
206
 
207
- $content .= "</li>\n";
 
 
 
208
 
209
  }
210
 
211
- if( '' == $content ){
212
- return $content;
213
  }
214
 
215
- $this->level++;
216
 
217
- return sprintf( '<ul class="grandchild-sidebar-menu level-%s children">', $this->level ) . $content . "</ul>\n";
218
  }
219
 
220
 
82
  *
83
  * Used in the view
84
  *
85
+ * @param int $parent_id - $asm->top_id
86
+ * @param advancedSidebarMenu $class
87
  */
88
+ public function __construct( $parent_id, $class ){
89
 
90
  $this->top_parent_id = $parent_id;
91
+
92
+ $args = array(
93
+ 'post_type' => $class->post_type,
94
+ 'sort_column' => $class->order_by,
95
+ 'exclude' => $class->exclude,
96
+ 'levels' => $class->levels
97
+ );
98
+
99
  $this->fill_class_vars( $args );
100
 
101
  }
124
  * @return void
125
  */
126
  private function fill_class_vars( $args ){
 
 
127
  $defaults = array(
128
  'depth' => 1,
129
  'exclude' => '',
133
  'hierarchical' => 0,
134
  'link_before' => '',
135
  'link_after' => '',
136
+ 'title_li' => '',
137
+ 'levels' => 100
138
  );
139
 
140
  $args = wp_parse_args( $args, $defaults );
196
  * @return string
197
  */
198
  private function list_grandchild_pages( $parent_page_id ){
 
 
199
  if( !$this->current_page_ancestor( $parent_page_id ) ){
200
  return '';
201
  }
204
  return '';
205
  }
206
 
207
+ if( $this->level == $this->args[ 'levels' ] ){
208
+ return '';
209
+ }
210
+
211
+ $this->level++;
212
 
213
+ $content = sprintf( '<ul class="grandchild-sidebar-menu level-%s children">', $this->level );
214
+ $inside = '';
215
 
216
+ foreach( $pages as $page ){
217
+ $inside .= walk_page_tree( array( $page ), 1, $this->current_page_id, $this->args );
218
+ $inside .= $this->list_grandchild_pages( $page->ID );
219
+ $inside .= "</li>\n";
220
 
221
  }
222
 
223
+ if( '' == $inside ){
224
+ return '';
225
  }
226
 
 
227
 
228
+ return $content . $inside . "</ul>\n";
229
  }
230
 
231
 
classes/advancedSidebarMenu.php CHANGED
@@ -18,6 +18,7 @@ class advancedSidebarMenu extends Advanced_Sidebar_Menu_Deprecated {
18
  var $order_by;
19
  var $taxonomy; //For filters to override the taxonomy
20
  var $current_term; //Current category or taxonomy
 
21
 
22
 
23
  /**
18
  var $order_by;
19
  var $taxonomy; //For filters to override the taxonomy
20
  var $current_term; //Current category or taxonomy
21
+ public $levels = 100;
22
 
23
 
24
  /**
languages/advanced-sidebar-menu.pot CHANGED
@@ -1,109 +1,109 @@
1
- # Copyright (C) 2013 Advanced Sidebar Menu
2
- # This file is distributed under the same license as the Advanced Sidebar Menu package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Advanced Sidebar Menu 4.7.0\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-sidebar-menu\n"
7
- "POT-Creation-Date: 2013-12-12 17:08:18+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #: advanced-sidebar-menu.php:55
16
- msgid "Want More Options"
17
- msgstr ""
18
-
19
- #: advanced-sidebar-menu.php:57
20
- msgid "Go Pro"
21
- msgstr ""
22
-
23
- #: widgets/category.widget.php:63 widgets/page.widget.php:56
24
- msgid "Title"
25
- msgstr ""
26
-
27
- #: widgets/category.widget.php:68
28
- msgid "Include Parent Category"
29
- msgstr ""
30
-
31
- #: widgets/category.widget.php:73 widgets/page.widget.php:65
32
- msgid "Include Parent Even With No Children"
33
- msgstr ""
34
-
35
- #: widgets/category.widget.php:77
36
- msgid "Use this plugins styling"
37
- msgstr ""
38
-
39
- #: widgets/category.widget.php:81
40
- msgid "Display Categories on Single Posts"
41
- msgstr ""
42
-
43
- #: widgets/category.widget.php:92
44
- msgid "Display Each Single Post's Category"
45
- msgstr ""
46
-
47
- #: widgets/category.widget.php:110
48
- msgid "Categories to Exclude, Comma Separated"
49
- msgstr ""
50
-
51
- #: widgets/category.widget.php:114 widgets/page.widget.php:95
52
- msgid "Legacy Mode: (use pre 4.0 structure and css)"
53
- msgstr ""
54
-
55
- #: widgets/category.widget.php:120
56
- msgid "Always Display Child Categories"
57
- msgstr ""
58
-
59
- #: widgets/category.widget.php:131 widgets/page.widget.php:111
60
- msgid "Levels to Display"
61
- msgstr ""
62
-
63
- #: widgets/page.widget.php:34
64
- msgid "Creates a menu of all the pages using the child/parent relationship"
65
- msgstr ""
66
-
67
- #: widgets/page.widget.php:38
68
- msgid "Advanced Sidebar Pages Menu"
69
- msgstr ""
70
-
71
- #: widgets/page.widget.php:60
72
- msgid "Include Parent Page"
73
- msgstr ""
74
-
75
- #: widgets/page.widget.php:70
76
- msgid "Order By"
77
- msgstr ""
78
-
79
- #: widgets/page.widget.php:88
80
- msgid "Use this Plugin's Styling"
81
- msgstr ""
82
-
83
- #: widgets/page.widget.php:92
84
- msgid "Pages to Exclude, Comma Separated"
85
- msgstr ""
86
-
87
- #: widgets/page.widget.php:100
88
- msgid "Always Display Child Pages"
89
- msgstr ""
90
-
91
- #. Plugin Name of the plugin/theme
92
- msgid "Advanced Sidebar Menu"
93
- msgstr ""
94
-
95
- #. Plugin URI of the plugin/theme
96
- msgid "http://matlipe.com/advanced-sidebar-menu/"
97
- msgstr ""
98
-
99
- #. Description of the plugin/theme
100
- msgid "Creates dynamic menu based on child/parent relationship."
101
- msgstr ""
102
-
103
- #. Author of the plugin/theme
104
- msgid "Mat Lipe"
105
- msgstr ""
106
-
107
- #. Author URI of the plugin/theme
108
- msgid "http://matlipe.com"
109
- msgstr ""
1
+ # Copyright (C) 2013 Advanced Sidebar Menu
2
+ # This file is distributed under the same license as the Advanced Sidebar Menu package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Advanced Sidebar Menu 4.7.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/advanced-sidebar-menu\n"
7
+ "POT-Creation-Date: 2013-12-12 17:08:18+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: advanced-sidebar-menu.php:55
16
+ msgid "Want More Options"
17
+ msgstr ""
18
+
19
+ #: advanced-sidebar-menu.php:57
20
+ msgid "Go Pro"
21
+ msgstr ""
22
+
23
+ #: widgets/category.widget.php:63 widgets/page.widget.php:56
24
+ msgid "Title"
25
+ msgstr ""
26
+
27
+ #: widgets/category.widget.php:68
28
+ msgid "Include Parent Category"
29
+ msgstr ""
30
+
31
+ #: widgets/category.widget.php:73 widgets/page.widget.php:65
32
+ msgid "Include Parent Even With No Children"
33
+ msgstr ""
34
+
35
+ #: widgets/category.widget.php:77
36
+ msgid "Use this plugins styling"
37
+ msgstr ""
38
+
39
+ #: widgets/category.widget.php:81
40
+ msgid "Display Categories on Single Posts"
41
+ msgstr ""
42
+
43
+ #: widgets/category.widget.php:92
44
+ msgid "Display Each Single Post's Category"
45
+ msgstr ""
46
+
47
+ #: widgets/category.widget.php:110
48
+ msgid "Categories to Exclude, Comma Separated"
49
+ msgstr ""
50
+
51
+ #: widgets/category.widget.php:114 widgets/page.widget.php:95
52
+ msgid "Legacy Mode: (use pre 4.0 structure and css)"
53
+ msgstr ""
54
+
55
+ #: widgets/category.widget.php:120
56
+ msgid "Always Display Child Categories"
57
+ msgstr ""
58
+
59
+ #: widgets/category.widget.php:131 widgets/page.widget.php:111
60
+ msgid "Levels to Display"
61
+ msgstr ""
62
+
63
+ #: widgets/page.widget.php:34
64
+ msgid "Creates a menu of all the pages using the child/parent relationship"
65
+ msgstr ""
66
+
67
+ #: widgets/page.widget.php:38
68
+ msgid "Advanced Sidebar Pages Menu"
69
+ msgstr ""
70
+
71
+ #: widgets/page.widget.php:60
72
+ msgid "Include Parent Page"
73
+ msgstr ""
74
+
75
+ #: widgets/page.widget.php:70
76
+ msgid "Order By"
77
+ msgstr ""
78
+
79
+ #: widgets/page.widget.php:88
80
+ msgid "Use this Plugin's Styling"
81
+ msgstr ""
82
+
83
+ #: widgets/page.widget.php:92
84
+ msgid "Pages to Exclude, Comma Separated"
85
+ msgstr ""
86
+
87
+ #: widgets/page.widget.php:100
88
+ msgid "Always Display Child Pages"
89
+ msgstr ""
90
+
91
+ #. Plugin Name of the plugin/theme
92
+ msgid "Advanced Sidebar Menu"
93
+ msgstr ""
94
+
95
+ #. Plugin URI of the plugin/theme
96
+ msgid "http://matlipe.com/advanced-sidebar-menu/"
97
+ msgstr ""
98
+
99
+ #. Description of the plugin/theme
100
+ msgid "Creates dynamic menu based on child/parent relationship."
101
+ msgstr ""
102
+
103
+ #. Author of the plugin/theme
104
+ msgid "Mat Lipe"
105
+ msgstr ""
106
+
107
+ #. Author URI of the plugin/theme
108
+ msgid "http://matlipe.com"
109
+ msgstr ""
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: Mat Lipe
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
5
  Tags: menus, sidebar menu, heirchy, category menu, pages menu
6
  Requires at least: 3.8.0
7
- Tested up to: 4.0.0
8
- Stable tag: 5.0.1
9
 
10
  Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
11
 
@@ -51,12 +51,15 @@ Many built in filters for altering the way the widgets function.
51
  Developer Docs may be found here
52
  <a href="http://matlipe.com/advanced-sidebar-menu/developer-docs/">http://matlipe.com/advanced-sidebar-menu/developer-docs/</a>
53
 
 
 
 
54
 
55
  == Installation ==
56
 
57
- This section describes how to install the plugin and get it working.
58
 
59
- e.g.
60
 
61
  1. Upload the `advanced-sidbebar-menu` folder to the `/wp-content/plugins/` directory
62
  1. Activate the plugin through the 'Plugins' menu in WordPress
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Advanced%20Sidebar%20Menu&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
5
  Tags: menus, sidebar menu, heirchy, category menu, pages menu
6
  Requires at least: 3.8.0
7
+ Tested up to: 4.0.1
8
+ Stable tag: 5.0.2
9
 
10
  Creates a widget for both page and categories that will display the current page/category and all child pages or categories.
11
 
51
  Developer Docs may be found here
52
  <a href="http://matlipe.com/advanced-sidebar-menu/developer-docs/">http://matlipe.com/advanced-sidebar-menu/developer-docs/</a>
53
 
54
+ To contribute send pull requests:
55
+ <a href="https://github.com/lipemat/advanced-sidebar-menu">GitHub Repo</a>
56
+
57
 
58
  == Installation ==
59
 
60
+ Use the standard WordPress plugins search and install feature.
61
 
62
+ Manual Installation
63
 
64
  1. Upload the `advanced-sidbebar-menu` folder to the `/wp-content/plugins/` directory
65
  1. Activate the plugin through the 'Plugins' menu in WordPress
views/page_list.php CHANGED
@@ -30,13 +30,7 @@ if( $child_pages ){
30
 
31
  } else {
32
 
33
- $args = array(
34
- 'post_type' => $post_type,
35
- 'sort_column' => $order_by,
36
- 'exclude' => $asm->exclude
37
- );
38
-
39
- $menu = new Advanced_Sidebar_Menu_List_Pages( $top_parent, $args );
40
  $content .= $menu->list_pages();
41
 
42
  }
30
 
31
  } else {
32
 
33
+ $menu = new Advanced_Sidebar_Menu_List_Pages( $asm->top_id, $asm );
 
 
 
 
 
 
34
  $content .= $menu->list_pages();
35
 
36
  }
widgets/page.widget.php CHANGED
@@ -170,8 +170,7 @@ class advanced_sidebar_menu_page extends WP_Widget {
170
  * apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance );
171
  * apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
172
  *
173
- *
174
- * @since 11.4.13
175
  *
176
  * @see Geansai - pointed out a notice level error. Thanks Geansai!!
177
  */
@@ -179,9 +178,12 @@ class advanced_sidebar_menu_page extends WP_Widget {
179
  global $wpdb, $post, $table_prefix;
180
 
181
  $asm = new advancedSidebarMenu();
182
-
183
  $asm->instance = $instance;
184
  $asm->args = $args;
 
 
 
 
185
 
186
  do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
187
 
170
  * apply_filters('advanced_sidebar_menu_top_parent', $top_parent, $post, $args, $instance );
171
  * apply_filters('advanced_sidebar_menu_post_type', 'page', $args, $instance );
172
  *
173
+ *
 
174
  *
175
  * @see Geansai - pointed out a notice level error. Thanks Geansai!!
176
  */
178
  global $wpdb, $post, $table_prefix;
179
 
180
  $asm = new advancedSidebarMenu();
 
181
  $asm->instance = $instance;
182
  $asm->args = $args;
183
+
184
+ if( isset( $args[ 'level_limit' ] ) ){
185
+ $asm->levels = $args[ 'level_limit' ];
186
+ }
187
 
188
  do_action( 'advanced_sidebar_menu_widget_pre_render', $asm, $this );
189