Advanced Sidebar Menu - Version 7.4.8

Version Description

Download this release

Release Info

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

Code changes from version 7.4.7 to 7.4.8

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@
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.4.7
8
* Author URI: https://matlipe.com
9
* Text Domain: advanced-sidebar-menu
10
*
@@ -15,7 +15,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
15
return;
16
}
17
18
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.4.7' );
19
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
20
21
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.4.8
8
* Author URI: https://matlipe.com
9
* Text Domain: advanced-sidebar-menu
10
*
15
return;
16
}
17
18
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '7.4.8' );
19
define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
20
21
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.7.0
7
- Tested up to: 5.0.3
8
Requires PHP: 5.2.4
9
- Stable tag: 7.4.7
10
11
== Description ==
12
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.7.0
7
+ Tested up to: 5.1.0
8
Requires PHP: 5.2.4
9
+ Stable tag: 7.4.8
10
11
== Description ==
12
src/Debug.php CHANGED
@@ -1,28 +1,52 @@
1
<?php
2
3
-
4
/**
5
* Advanced_Sidebar_Menu_Debug
6
*
7
* @author Mat Lipe
8
* @since 6.3.1
9
- *
10
*/
11
class Advanced_Sidebar_Menu_Debug {
12
const DEBUG_PARAM = 'asm_debug';
13
14
15
protected function hook() {
16
- if ( ! empty( $_GET[ self::DEBUG_PARAM ] ) ) {
17
add_action( 'advanced_sidebar_menu_widget_pre_render', array( $this, 'print_instance' ), 1, 2 );
18
}
19
}
20
21
22
/**
23
*
24
- * @param Advanced_Sidebar_Menu_Menu $asm
25
- * @param Advanced_Sidebar_Menu_Widget_Page $widget
26
*
27
* @return void
28
*/
@@ -52,11 +76,11 @@ class Advanced_Sidebar_Menu_Debug {
52
}
53
}
54
55
- //********** SINGLETON **********/
56
-
57
58
/**
59
* Instance of this class for use as singleton
60
*/
61
private static $instance;
62
1
<?php
2
3
/**
4
* Advanced_Sidebar_Menu_Debug
5
*
6
* @author Mat Lipe
7
* @since 6.3.1
8
+ * @since 7.4.8 - Use URL arguments to test different configurations.
9
*/
10
class Advanced_Sidebar_Menu_Debug {
11
const DEBUG_PARAM = 'asm_debug';
12
13
14
+ /**
15
+ * Add actions and filters.
16
+ *
17
+ * @return void
18
+ */
19
protected function hook() {
20
+ if ( ! empty( $_GET[ self::DEBUG_PARAM ] ) ) { //phpcs:ignore
21
add_action( 'advanced_sidebar_menu_widget_pre_render', array( $this, 'print_instance' ), 1, 2 );
22
+
23
+ if ( is_array( $_GET[ self::DEBUG_PARAM ] ) ) { //phpcs:ignore
24
+ add_filter( 'advanced-sidebar-menu/menus/widget-instance', array( $this, 'adjust_widget_settings' ) );
25
+ }
26
}
27
}
28
29
30
/**
31
+ * Adjust widget settings using the URL.
32
*
33
+ * @param array $instance - Widget settings.
34
+ *
35
+ * @return array
36
+ */
37
+ public function adjust_widget_settings( array $instance ) {
38
+ //phpcs:ignore
39
+ $overrides = array_map( 'sanitize_text_field', (array) $_GET[ self::DEBUG_PARAM ] );
40
+
41
+ return wp_parse_args( $overrides, $instance );
42
+ }
43
+
44
+
45
+ /**
46
+ * Print the widget settings as a js variable.
47
+ *
48
+ * @param Advanced_Sidebar_Menu_Menus_Abstract $asm - Menu class.
49
+ * @param Advanced_Sidebar_Menu_Widget_Page $widget - Widget class.
50
*
51
* @return void
52
*/
76
}
77
}
78
79
80
/**
81
* Instance of this class for use as singleton
82
+ *
83
+ * @var Advanced_Sidebar_Menu_Debug
84
*/
85
private static $instance;
86
src/Menus/Abstract.php CHANGED
@@ -76,7 +76,7 @@ abstract class Advanced_Sidebar_Menu_Menus_Abstract {
76
77
78
public function __construct( array $widget_instance, array $widget_args ) {
79
- $this->instance = $widget_instance;
80
$this->args = $widget_args;
81
}
82
76
77
78
public function __construct( array $widget_instance, array $widget_args ) {
79
+ $this->instance = apply_filters( 'advanced-sidebar-menu/menus/widget-instance', $widget_instance, $widget_args, $this );
80
$this->args = $widget_args;
81
}
82