Advanced Sidebar Menu - Version 7.1.2

Version Description

Update to support PRO version 3.1.0

Download this release

Release Info

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

Code changes from version 7.1.1 to 7.1.2

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Advanced Sidebar Menu
4
  Plugin URI: https://matlipe.com/advanced-sidebar-menu/
5
  Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  Author: Mat Lipe
7
- Version: 7.1.1
8
  Author URI: https://matlipe.com
9
  Text Domain: advanced-sidebar-menu
10
  */
@@ -14,7 +14,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
14
  return;
15
  }
16
 
17
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.1.1' );
18
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
19
 
20
  if ( ! function_exists( 'advanced_sidebar_menu_load' ) ) {
4
  Plugin URI: https://matlipe.com/advanced-sidebar-menu/
5
  Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  Author: Mat Lipe
7
+ Version: 7.1.2
8
  Author URI: https://matlipe.com
9
  Text Domain: advanced-sidebar-menu
10
  */
14
  return;
15
  }
16
 
17
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.1.2' );
18
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
19
 
20
  if ( ! function_exists( 'advanced_sidebar_menu_load' ) ) {
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: Mat Lipe
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%2ecom&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, hierarchy, category menu, pages menu
6
  Requires at least: 4.6.0
7
- Tested up to: 4.9.2
8
  Requires PHP: 5.2.4
9
- Stable tag: 7.1.1
10
 
11
  == Description ==
12
 
@@ -16,18 +16,18 @@ Keeps the menu clean and usable. Only related items display so you don't have to
16
 
17
  <strong>Check out <a href="https://matlipe.com/product/advanced-sidebar-menu-pro/">Advanced Sidebar Menu Pro</a> for more features including priority support, the ability to customize the look and feel, custom link text, excluding of pages, category ordering, accordions, custom post types, custom taxonomies, and so much more!</strong>
18
 
19
- <blockquote><a href="https://matlipe.com/product/advanced-sidebar-menu-pro/" target="_blank">Pro version 3.0.0</a> just dropped with lots of great new stuff!</blockquote>
20
 
21
  <h4>Features</h4>
22
- * Page and Category widgets
23
- * Option to display or not display the highest level parent page or category
24
- * Option to display the menu when there is only the highest level parent
25
- * Ability to order pages by (date, title, page order)
26
- * Exclude pages or categories by entering a comma separated list of ids
27
- * Option to always display child pages or categories
28
- * Option to select the levels of pages or categories to display when always display child is used
29
- * Option to display or not display categories on single posts
30
- * Ability to display each single post's category in a new widget or in same list
31
 
32
  <h4>Page Widget Options</h4>
33
  * Add a title to the widget
@@ -51,27 +51,32 @@ Keeps the menu clean and usable. Only related items display so you don't have to
51
  * Levels of Categories to display when always display child categories is checked
52
 
53
  <h4>Pro Features</h4>
54
- * Priority support
55
- * Ability to customize each page links text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  * Option to display the current page's parents and grandparents only
57
- * Number of levels of pages to show when always displayed child pages is not checked
58
- * Click and drag styling for both the page and category widgets
59
- * Styling options for links including color, background color, size, and font weight
60
- * Styling options for different levels of links
61
- * Styling options for the current page or category
62
- * Styling options for the parent of the current page or category
63
- * Block styling options including borders and border colors
64
- * Bullet style selection from 7 styles or select none to have no bullets
65
- * Accordion menu support for pages
66
- * Accordion menu support for categories
67
- * Accordion icon selection from 4 styles of icons
68
- * Accordion icon color selection
69
- * Accordion option to keep all sections closed until clicked
70
- * Accordion option to include highest level parent in accordion
71
- * Ability to exclude a page from all menus using a simple checkbox
72
- * Link ordering for the category widget
73
- * Ability to select and display custom post types **NEW**
74
- * Ability to select and display custom taxonomies **NEW**
75
 
76
  <h4>Currently ships with the following languages</h4>
77
  * English (US)
@@ -212,6 +217,9 @@ Yes. Based on whatever page, post, or category you are on, the menu will change
212
 
213
 
214
  == Upgrade Notice ==
 
 
 
215
  = 7.0.0 =
216
  The templates have been improved drastically. While the old version 6 templates will work for now they have been deprecated and will one day stop working. If you are using custom templates please being converting them to the new structure.
217
 
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40matlipe%2ecom&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, hierarchy, category menu, pages menu
6
  Requires at least: 4.6.0
7
+ Tested up to: 4.9.4
8
  Requires PHP: 5.2.4
9
+ Stable tag: 7.1.2
10
 
11
  == Description ==
12
 
16
 
17
  <strong>Check out <a href="https://matlipe.com/product/advanced-sidebar-menu-pro/">Advanced Sidebar Menu Pro</a> for more features including priority support, the ability to customize the look and feel, custom link text, excluding of pages, category ordering, accordions, custom post types, custom taxonomies, and so much more!</strong>
18
 
19
+ <blockquote><a href="https://matlipe.com/product/advanced-sidebar-menu-pro/" target="_blank">Pro version 3.1.0</a> just dropped with lots of great new stuff!</blockquote>
20
 
21
  <h4>Features</h4>
22
+ * Page and Category widgets.
23
+ * Option to display or not display the highest level parent page or category.
24
+ * Option to display the menu when there is only the highest level parent.
25
+ * Ability to order pages by (date, title, page order).
26
+ * Exclude pages or categories by entering a comma separated list of ids.
27
+ * Option to always display child pages or categories.
28
+ * Option to select the levels of pages or categories to display when always display child is used.
29
+ * Option to display or not display categories on single posts.
30
+ * Ability to display each single post's category in a new widget or in same list.
31
 
32
  <h4>Page Widget Options</h4>
33
  * Add a title to the widget
51
  * Levels of Categories to display when always display child categories is checked
52
 
53
  <h4>Pro Features</h4>
54
+ * Priority support.
55
+ * Ability to customize each page links text.
56
+ * Number of levels of pages to show when always displayed child pages is not checked.
57
+ * Click and drag styling for both the page and category widgets.
58
+ * Styling options for links including color, background color, size, and font weight.
59
+ * Styling options for different levels of links.
60
+ * Styling options for the current page or category.
61
+ * Styling options for the parent of the current page or category.
62
+ * Block styling options including borders and border colors.
63
+ * Bullet style selection from 7 styles or select none to have no bullets.
64
+ * Accordion menu support for pages.
65
+ * Accordion menu support for categories.
66
+ * Accordion icon selection from 4 styles of icons.
67
+ * Accordion icon color selection.
68
+ * Accordion option to keep all sections closed until clicked.
69
+ * Accordion option to include highest level parent in accordion.
70
+ * Ability to exclude a page from all menus using a simple checkbox.
71
+ * Link ordering for the category widget.
72
+ * Ability to select and display custom post types.
73
+ * Ability to select and display custom taxonomies.
74
  * Option to display the current page's parents and grandparents only
75
+ * Option to display child page siblings when on a child page **NEW**
76
+ * Option to display child page siblings when on a child page with no grandchild pages **NEW**
77
+ * Ability to display the widgets everywhere the sidebar display **NEW**
78
+ * Ability to select the parent page/category when using the display widget everywhere option **NEW**
79
+ * Access to members only support area.
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  <h4>Currently ships with the following languages</h4>
82
  * English (US)
217
 
218
 
219
  == Upgrade Notice ==
220
+ = 7.1.2 =
221
+ Update to support PRO version 3.1.0
222
+
223
  = 7.0.0 =
224
  The templates have been improved drastically. While the old version 6 templates will work for now they have been deprecated and will one day stop working. If you are using custom templates please being converting them to the new structure.
225
 
src/List_Pages.php CHANGED
@@ -329,8 +329,7 @@ class Advanced_Sidebar_Menu_List_Pages {
329
  //we only filter the first level with this filter for backward pro compatibility
330
  if ( $is_first_level ) {
331
  if ( has_filter( 'advanced_sidebar_menu_child_pages' ) ) {
332
- //@todo uncomment deprecated hook notice once pro 3.0.0 is released
333
- //_deprecated_hook( 'advanced_sidebar_menu_child_pages', '7.1.0', 'advanced-sidebar-menu/list-pages/first-level-child-pages' );
334
  $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $this->current_page, $this->menu->instance, $this->menu->args, $this->menu );
335
  }
336
 
329
  //we only filter the first level with this filter for backward pro compatibility
330
  if ( $is_first_level ) {
331
  if ( has_filter( 'advanced_sidebar_menu_child_pages' ) ) {
332
+ _deprecated_hook( 'advanced_sidebar_menu_child_pages', '7.1.0', 'advanced-sidebar-menu/list-pages/first-level-child-pages' );
 
333
  $child_pages = apply_filters( 'advanced_sidebar_menu_child_pages', $child_pages, $this->current_page, $this->menu->instance, $this->menu->args, $this->menu );
334
  }
335
 
src/Menus/Page.php CHANGED
@@ -37,13 +37,13 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
37
 
38
  /**
39
  * Gets the current queried post unless it
40
- * has been set explicitly.
41
  *
42
  * @return \WP_Post
43
  */
44
  public function get_current_post() {
45
- if( null === $this->post ){
46
- if( is_page() || is_singular() ){
47
  $this->post = get_queried_object();
48
  }
49
  }
@@ -64,10 +64,10 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
64
 
65
  public function get_top_parent_id() {
66
  $ancestors = get_post_ancestors( $this->get_current_post() );
67
- if( !empty( $ancestors ) ){
68
  $top_id = end( $ancestors );
69
  } else {
70
- $top_id = $this->get_current_post()->ID;
71
  }
72
 
73
  //$this->top_id is deprecated since 7.0.0
@@ -79,29 +79,27 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
79
 
80
 
81
  public function is_displayed() {
82
- $display = false;
83
  $post_type = $this->get_post_type();
84
- if( is_page() || ( is_single() && $post_type === $this->get_current_post()->post_type ) ){
85
  //if we are on the correct post type
86
- if( $post_type === get_post_type( $this->get_top_parent_id() ) ){
87
  //if we have children
88
- if( $this->has_pages() ){
89
  $display = true;
90
  //no children + not excluded + include parent +include childless parent
91
- } elseif( $this->checked( self::INCLUDE_CHILDLESS_PARENT )
92
- && $this->checked( self::INCLUDE_PARENT )
93
- && !$this->is_excluded( $this->get_top_parent_id() ) ) {
94
  $display = true;
95
  }
96
  }
97
  }
98
 
99
- if( has_filter( 'advanced_sidebar_menu_proper_single' ) ){
100
  _deprecated_hook( 'advanced_sidebar_menu_proper_single', '7.0.0', 'advanced-sidebar-menu/menus/page/is-displayed' );
101
- $display = !apply_filters( 'advanced_sidebar_menu_proper_single', !$display, $this->args, $this->instance, $this );
102
  }
103
 
104
- return apply_filters( 'advanced-sidebar-menu/menus/page/is-displayed', $display );
105
 
106
  }
107
 
@@ -116,9 +114,9 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
116
  */
117
  public function has_pages() {
118
  $list_pages = Advanced_Sidebar_Menu_List_Pages::factory( $this );
119
- $children = $list_pages->get_child_pages( $this->get_top_parent_id(), true );
120
 
121
- return !empty( $children );
122
  }
123
 
124
 
@@ -151,7 +149,7 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
151
 
152
  public function get_excluded_ids() {
153
  $excluded = parent::get_excluded_ids();
154
- if( !empty( $this->exclude ) ){
155
  //backward compatibility for PRO version
156
  $excluded = array_merge( $excluded, $this->exclude );
157
  }
@@ -166,22 +164,24 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
166
  * @return void
167
  */
168
  public function render() {
169
- if( !$this->is_displayed() ){
170
  return;
171
  }
172
 
173
- echo $this->args[ 'before_widget' ];
 
174
 
175
  do_action( 'advanced-sidebar-menu/menus/page/render', $this );
176
 
177
- if( $this->checked( self::USE_PLUGIN_STYLES ) ){
178
  Advanced_Sidebar_Menu_Core::instance()->include_plugin_styles();
179
  }
180
 
181
  $output = require Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'page_list.php' );
182
  echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $output, $this->get_current_post(), $this->args, $this->instance, $this );
183
 
184
- echo $this->args[ 'after_widget' ];
 
185
  }
186
 
187
 
@@ -199,4 +199,4 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
199
  public static function factory( array $widget_instance, array $widget_args ) {
200
  return parent::_factory( __CLASS__, $widget_instance, $widget_args );
201
  }
202
- }
37
 
38
  /**
39
  * Gets the current queried post unless it
40
+ * has been set explicitly.
41
  *
42
  * @return \WP_Post
43
  */
44
  public function get_current_post() {
45
+ if ( null === $this->post ) {
46
+ if ( is_page() || is_singular() ) {
47
  $this->post = get_queried_object();
48
  }
49
  }
64
 
65
  public function get_top_parent_id() {
66
  $ancestors = get_post_ancestors( $this->get_current_post() );
67
+ if ( ! empty( $ancestors ) ) {
68
  $top_id = end( $ancestors );
69
  } else {
70
+ $top_id = $this->get_current_post()->ID;
71
  }
72
 
73
  //$this->top_id is deprecated since 7.0.0
79
 
80
 
81
  public function is_displayed() {
82
+ $display = false;
83
  $post_type = $this->get_post_type();
84
+ if ( is_page() || ( is_single() && $post_type === $this->get_current_post()->post_type ) ) {
85
  //if we are on the correct post type
86
+ if ( get_post_type( $this->get_top_parent_id() ) === $post_type ) {
87
  //if we have children
88
+ if ( $this->has_pages() ) {
89
  $display = true;
90
  //no children + not excluded + include parent +include childless parent
91
+ } elseif ( $this->checked( self::INCLUDE_CHILDLESS_PARENT ) && $this->checked( self::INCLUDE_PARENT ) && ! $this->is_excluded( $this->get_top_parent_id() ) ) {
 
 
92
  $display = true;
93
  }
94
  }
95
  }
96
 
97
+ if ( has_filter( 'advanced_sidebar_menu_proper_single' ) ) {
98
  _deprecated_hook( 'advanced_sidebar_menu_proper_single', '7.0.0', 'advanced-sidebar-menu/menus/page/is-displayed' );
99
+ $display = ! apply_filters( 'advanced_sidebar_menu_proper_single', ! $display, $this->args, $this->instance, $this );
100
  }
101
 
102
+ return apply_filters( 'advanced-sidebar-menu/menus/page/is-displayed', $display, $this->args, $this->instance, $this );
103
 
104
  }
105
 
114
  */
115
  public function has_pages() {
116
  $list_pages = Advanced_Sidebar_Menu_List_Pages::factory( $this );
117
+ $children = $list_pages->get_child_pages( $this->get_top_parent_id(), true );
118
 
119
+ return ! empty( $children );
120
  }
121
 
122
 
149
 
150
  public function get_excluded_ids() {
151
  $excluded = parent::get_excluded_ids();
152
+ if ( ! empty( $this->exclude ) ) {
153
  //backward compatibility for PRO version
154
  $excluded = array_merge( $excluded, $this->exclude );
155
  }
164
  * @return void
165
  */
166
  public function render() {
167
+ if ( ! $this->is_displayed() ) {
168
  return;
169
  }
170
 
171
+ // phpcs:disable
172
+ echo $this->args['before_widget'];
173
 
174
  do_action( 'advanced-sidebar-menu/menus/page/render', $this );
175
 
176
+ if ( $this->checked( self::USE_PLUGIN_STYLES ) ) {
177
  Advanced_Sidebar_Menu_Core::instance()->include_plugin_styles();
178
  }
179
 
180
  $output = require Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'page_list.php' );
181
  echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $output, $this->get_current_post(), $this->args, $this->instance, $this );
182
 
183
+ echo $this->args['after_widget'];
184
+ // phpcs:enable
185
  }
186
 
187
 
199
  public static function factory( array $widget_instance, array $widget_args ) {
200
  return parent::_factory( __CLASS__, $widget_instance, $widget_args );
201
  }
202
+ }
src/Widget/Category.php CHANGED
@@ -82,7 +82,7 @@ class Advanced_Sidebar_Menu_Widget_Category extends WP_Widget {
82
  <?php echo $instance[ self::INCLUDE_CHILDLESS_PARENT ]; ?>/>
83
  </p>
84
 
85
- <p> <?php _e( 'Use this plugins styling', 'advanced-sidebar-menu' ); ?>
86
  <input id="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>"
87
  name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
88
  <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
82
  <?php echo $instance[ self::INCLUDE_CHILDLESS_PARENT ]; ?>/>
83
  </p>
84
 
85
+ <p> <?php _e( "Use this plugin's default styling", 'advanced-sidebar-menu' ); ?>
86
  <input id="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>"
87
  name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
88
  <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
src/Widget/Page.php CHANGED
@@ -100,7 +100,7 @@ class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
100
  </select>
101
  </p>
102
 
103
- <p> <?php _e( "Use this Plugin's Styling", 'advanced-sidebar-menu' ); ?>:
104
  <input id="<?php echo $this->get_field_id( self::USE_PLUGIN_STYLES ); ?>"
105
  name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
106
  <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
@@ -185,4 +185,4 @@ class Advanced_Sidebar_Menu_Widget_Page extends WP_Widget {
185
  $asm->render();
186
 
187
  }
188
- }
100
  </select>
101
  </p>
102
 
103
+ <p> <?php _e( "Use this plugin's default styling", 'advanced-sidebar-menu' ); ?>:
104
  <input id="<?php echo $this->get_field_id( self::USE_PLUGIN_STYLES ); ?>"
105
  name="<?php echo $this->get_field_name( self::USE_PLUGIN_STYLES ); ?>" type="checkbox" value="checked"
106
  <?php echo $instance[ self::USE_PLUGIN_STYLES ]; ?>/>
185
  $asm->render();
186
 
187
  }
188
+ }