Advanced Sidebar Menu - Version 7.0.1

Version Description

Download this release

Release Info

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

Code changes from version 7.0.0 to 7.0.1

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.0.0
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.0.0' );
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.0.1
8
  Author URI: https://matlipe.com
9
  Text Domain: advanced-sidebar-menu
10
  */
14
  return;
15
  }
16
 
17
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.0.1' );
18
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
19
 
20
  if( !function_exists( 'advanced_sidebar_menu_load' ) ){
readme.txt CHANGED
@@ -4,8 +4,8 @@ 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.0
8
- Stable tag: 7.0.0
9
 
10
  == Description ==
11
 
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.1
8
+ Stable tag: 7.0.1
9
 
10
  == Description ==
11
 
src/Core.php CHANGED
@@ -21,6 +21,26 @@ class Advanced_Sidebar_Menu_Core {
21
  }
22
 
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  /**
25
  * Retrieve a template file from either the theme's 'advanced-sidebar-menu' directory
26
  * or this plugins views folder if one does not exist
@@ -28,17 +48,10 @@ class Advanced_Sidebar_Menu_Core {
28
  * @since 6.0.0
29
  *
30
  * @param string $file_name
31
- * @param bool $include_once
32
  *
33
  * @return string
34
  */
35
- public function get_template_part( $file_name, $include_once = false ){
36
- static $included = array();
37
- if( $include_once && isset( $included[ $file_name ] ) ){
38
- return '';
39
- }
40
- $included[ $file_name ] = true;
41
-
42
  $file = locate_template( 'advanced-sidebar-menu/' . $file_name );
43
  if( empty( $file ) ){
44
  $file = ADVANCED_SIDEBAR_DIR . 'views/' . $file_name;
21
  }
22
 
23
 
24
+ /**
25
+ * The plugin styles are universal
26
+ * This ensures that we only include them once on a single request
27
+ *
28
+ * @return void
29
+ */
30
+ public function include_plugin_styles() {
31
+ static $included;
32
+ if( $included ){
33
+ return;
34
+ }
35
+ $included = true;
36
+
37
+ ?>
38
+ <style>
39
+ <?php include $this->get_template_part( 'sidebar-menu.css' ); ?>
40
+ </style>
41
+ <?php
42
+ }
43
+
44
  /**
45
  * Retrieve a template file from either the theme's 'advanced-sidebar-menu' directory
46
  * or this plugins views folder if one does not exist
48
  * @since 6.0.0
49
  *
50
  * @param string $file_name
 
51
  *
52
  * @return string
53
  */
54
+ public function get_template_part( $file_name ){
 
 
 
 
 
 
55
  $file = locate_template( 'advanced-sidebar-menu/' . $file_name );
56
  if( empty( $file ) ){
57
  $file = ADVANCED_SIDEBAR_DIR . 'views/' . $file_name;
src/Menus/Category.php CHANGED
@@ -451,11 +451,7 @@ class Advanced_Sidebar_Menu_Menus_Category extends Advanced_Sidebar_Menu_Menus_A
451
  //must remain in the loop vs the template
452
  $this->title();
453
  if( $this->checked( self::USE_PLUGIN_STYLES ) ){
454
- ?>
455
- <style>
456
- <?php include Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'sidebar-menu.css', true ); ?>
457
- </style>
458
- <?php
459
  }
460
 
461
  $menu_open = true;
451
  //must remain in the loop vs the template
452
  $this->title();
453
  if( $this->checked( self::USE_PLUGIN_STYLES ) ){
454
+ Advanced_Sidebar_Menu_Core::instance()->include_plugin_styles();
 
 
 
 
455
  }
456
 
457
  $menu_open = true;
src/Menus/Page.php CHANGED
@@ -175,12 +175,9 @@ class Advanced_Sidebar_Menu_Menus_Page extends Advanced_Sidebar_Menu_Menus_Abstr
175
  do_action( 'advanced-sidebar-menu/menus/page/render', $this );
176
 
177
  if( $this->checked( self::USE_PLUGIN_STYLES ) ){
178
- ?>
179
- <style>
180
- <?php include Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'sidebar-menu.css', true ); ?>
181
- </style>
182
- <?php
183
  }
 
184
  $output = require Advanced_Sidebar_Menu_Core::instance()->get_template_part( 'page_list.php' );
185
  echo apply_filters( 'advanced_sidebar_menu_page_widget_output', $output, $this->get_current_post(), $this->args, $this->instance, $this );
186
 
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