Advanced Sidebar Menu - Version 8.3.4

Version Description

  • Support widget fields with array values.
  • Minimum required version for PRO 8.4.0.
Download this release

Release Info

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

Code changes from version 8.3.3 to 8.3.4

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
- * Version: 8.3.3
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
@@ -19,7 +19,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
19
  return;
20
  }
21
 
22
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.3.3' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.2.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
+ * Version: 8.3.4
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
19
  return;
20
  }
21
 
22
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.3.4' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.2.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: menus, sidebar menu, hierarchy, category menu, pages menu, dynamic
6
  Requires at least: 5.2.0
7
  Tested up to: 5.7.2
8
  Requires PHP: 5.6.0
9
- Stable tag: 8.3.3
10
 
11
  == Description ==
12
 
@@ -155,9 +155,12 @@ Yes. Based on whatever page, post, or category you are on, the menu will change
155
 
156
 
157
  == Changelog ==
 
 
 
 
158
  = 8.3.3 =
159
  * Introduce `data-level` on all menu levels for specific targeting.
160
- * Minimum required version for PRO 8.4.0.
161
  * Tested to WordPress 5.7.2.
162
 
163
  = 8.3.2 =
@@ -246,7 +249,7 @@ Major version update. See <a href="https://onpointplugins.com/advanced-sidebar-m
246
  * Bump required PHP version to 5.4.4.
247
 
248
  == Upgrade Notice ==
249
- = 8.3.3 =
250
  Update to support PRO version 8.4.0.
251
 
252
  = 8.2.0 =
6
  Requires at least: 5.2.0
7
  Tested up to: 5.7.2
8
  Requires PHP: 5.6.0
9
+ Stable tag: 8.3.4
10
 
11
  == Description ==
12
 
155
 
156
 
157
  == Changelog ==
158
+ = 8.3.4 =
159
+ * Support widget fields with array values.
160
+ * Minimum required version for PRO 8.4.0.
161
+
162
  = 8.3.3 =
163
  * Introduce `data-level` on all menu levels for specific targeting.
 
164
  * Tested to WordPress 5.7.2.
165
 
166
  = 8.3.2 =
249
  * Bump required PHP version to 5.4.4.
250
 
251
  == Upgrade Notice ==
252
+ = 8.3.4 =
253
  Update to support PRO version 8.4.0.
254
 
255
  = 8.2.0 =
src/Widget/Widget_Abstract.php CHANGED
@@ -5,8 +5,6 @@ namespace Advanced_Sidebar_Menu\Widget;
5
  * Base class for this plugin's widgets.
6
  *
7
  * @author OnPoint Plugins
8
- *
9
- * @since 7.2.0
10
  */
11
  abstract class Widget_Abstract extends \WP_Widget {
12
  /**
@@ -27,8 +25,6 @@ abstract class Widget_Abstract extends \WP_Widget {
27
  *
28
  * @see \WP_Widget::form_callback()
29
  *
30
- * @since 7.2.0
31
- *
32
  * @return array
33
  */
34
  protected function set_instance( array $instance, array $defaults ) {
@@ -41,15 +37,20 @@ abstract class Widget_Abstract extends \WP_Widget {
41
  /**
42
  * Checks if a widget's checkbox is checked.
43
  *
44
- * Checks first for a value then verifies the value = checked
45
  *
46
- * @param string $name - name of checkbox.
47
- *
48
- * @since 7.2.0
49
  *
50
  * @return bool
51
  */
52
  public function checked( $name ) {
 
 
 
 
 
 
 
53
  return isset( $this->widget_settings[ $name ] ) && 'checked' === $this->widget_settings[ $name ];
54
  }
55
 
@@ -65,9 +66,6 @@ abstract class Widget_Abstract extends \WP_Widget {
65
  *
66
  * @todo Convert all uses of this method to supply the $element_key
67
  *
68
- * @since 7.2.0
69
- * @since 7.2.2 Added the `element_key` argument.
70
- *
71
  * @return void
72
  */
73
  public function hide_element( $controlling_checkbox, $element_key = null, $reverse = false ) {
@@ -91,12 +89,10 @@ abstract class Widget_Abstract extends \WP_Widget {
91
 
92
 
93
  /**
94
- * Outputs a <input type="checkbox" with id and name filled
95
- *
96
- * @param string $name - name of field.
97
- * @param string|null $element_to_reveal - element to reveal/hide when box is checked/unchecked.
98
  *
99
- * @since 7.2.0
 
100
  */
101
  public function checkbox( $name, $element_to_reveal = null ) {
102
  if ( empty( $this->widget_settings[ $name ] ) ) {
@@ -111,7 +107,7 @@ abstract class Widget_Abstract extends \WP_Widget {
111
  value="checked"
112
  data-js="advanced-sidebar-menu/widget/<?php echo esc_attr( $this->id_base ); ?>/<?php echo esc_attr( $name ); ?>"
113
  <?php echo ( null !== $element_to_reveal ) ? 'onclick="asm_reveal_element( \'' . esc_attr( $this->get_field_id( $element_to_reveal ) ) . '\')"' : ''; ?>
114
- <?php echo esc_html( $this->widget_settings[ $name ] ); ?>
115
  />
116
  <?php
117
  }
5
  * Base class for this plugin's widgets.
6
  *
7
  * @author OnPoint Plugins
 
 
8
  */
9
  abstract class Widget_Abstract extends \WP_Widget {
10
  /**
25
  *
26
  * @see \WP_Widget::form_callback()
27
  *
 
 
28
  * @return array
29
  */
30
  protected function set_instance( array $instance, array $defaults ) {
37
  /**
38
  * Checks if a widget's checkbox is checked.
39
  *
40
+ * Checks first for a value then verifies the value = 'checked'.
41
  *
42
+ * @param string $name - Name of checkbox.
 
 
43
  *
44
  * @return bool
45
  */
46
  public function checked( $name ) {
47
+ // Handle array type names (e.g. open-links[all]).
48
+ preg_match( '/(?<field>\S*?)\[(?<key>\S*?)]/', $name, $array );
49
+ if ( ! empty( $array['field'] ) && ! empty( $array['key'] ) ) {
50
+ return isset( $this->widget_settings[ $array['field'] ][ $array['key'] ] ) && 'checked' === $this->widget_settings[ $array['field'] ][ $array['key'] ];
51
+ }
52
+
53
+ // Standard non array names.
54
  return isset( $this->widget_settings[ $name ] ) && 'checked' === $this->widget_settings[ $name ];
55
  }
56
 
66
  *
67
  * @todo Convert all uses of this method to supply the $element_key
68
  *
 
 
 
69
  * @return void
70
  */
71
  public function hide_element( $controlling_checkbox, $element_key = null, $reverse = false ) {
89
 
90
 
91
  /**
92
+ * Outputs a <input type="checkbox"> with id and name filled.
 
 
 
93
  *
94
+ * @param string $name - Name of field.
95
+ * @param string|null $element_to_reveal - Element to reveal/hide when box is checked/unchecked.
96
  */
97
  public function checkbox( $name, $element_to_reveal = null ) {
98
  if ( empty( $this->widget_settings[ $name ] ) ) {
107
  value="checked"
108
  data-js="advanced-sidebar-menu/widget/<?php echo esc_attr( $this->id_base ); ?>/<?php echo esc_attr( $name ); ?>"
109
  <?php echo ( null !== $element_to_reveal ) ? 'onclick="asm_reveal_element( \'' . esc_attr( $this->get_field_id( $element_to_reveal ) ) . '\')"' : ''; ?>
110
+ <?php echo $this->checked( $name ) ? 'checked' : ''; ?>
111
  />
112
  <?php
113
  }