Astra Widgets - Version 1.2.12

Version Description

  • Fix: Astra Social Profile and List Icons: Repeater field not showing in Customizer widget block editor. ( https://wpastra.com/docs/resolving-repeater-fields-not-working-in-widget-block-editor/ )
Download this release

Release Info

Developer brainstormworg
Plugin Icon Astra Widgets
Version 1.2.12
Comparing to
See all releases

Code changes from version 1.2.11 to 1.2.12

astra-widgets.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Astra Widgets
4
  * Plugin URI: https://wpastra.com/
5
  * Description: The Fastest Way to Add More Widgets into Your WordPress Website.
6
- * Version: 1.2.11
7
  * Author: Brainstorm Force
8
  * Author URI: https://www.brainstormforce.com
9
  * Text Domain: astra-widgets
@@ -25,7 +25,7 @@ define( 'ASTRA_WIDGETS_FILE', __FILE__ );
25
  define( 'ASTRA_WIDGETS_BASE', plugin_basename( ASTRA_WIDGETS_FILE ) );
26
  define( 'ASTRA_WIDGETS_DIR', plugin_dir_path( ASTRA_WIDGETS_FILE ) );
27
  define( 'ASTRA_WIDGETS_URI', plugins_url( '/', ASTRA_WIDGETS_FILE ) );
28
- define( 'ASTRA_WIDGETS_VER', '1.2.11' );
29
  define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
30
 
31
  require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
3
  * Plugin Name: Astra Widgets
4
  * Plugin URI: https://wpastra.com/
5
  * Description: The Fastest Way to Add More Widgets into Your WordPress Website.
6
+ * Version: 1.2.12
7
  * Author: Brainstorm Force
8
  * Author URI: https://www.brainstormforce.com
9
  * Text Domain: astra-widgets
25
  define( 'ASTRA_WIDGETS_BASE', plugin_basename( ASTRA_WIDGETS_FILE ) );
26
  define( 'ASTRA_WIDGETS_DIR', plugin_dir_path( ASTRA_WIDGETS_FILE ) );
27
  define( 'ASTRA_WIDGETS_URI', plugins_url( '/', ASTRA_WIDGETS_FILE ) );
28
+ define( 'ASTRA_WIDGETS_VER', '1.2.12' );
29
  define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
30
 
31
  require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
classes/class-astra-widgets-helper.php CHANGED
@@ -55,6 +55,75 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
55
  */
56
  public function __construct() {
57
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  /**
55
  */
56
  public function __construct() {
57
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
58
+ add_filter( 'customize_save_response', array( $this, 'update_customize_save_response' ), 10, 2 );
59
+ }
60
+
61
+ /**
62
+ * Called by the customize_save_after action to refresh
63
+ * the cached CSS when Customizer settings are saved.
64
+ *
65
+ * @param array $response Additional information passed back to the 'saved' event on `wp.customize`.
66
+ * @param WP_Customize_Manager $instance WP_Customize_Manager instance.
67
+ *
68
+ * @since 1.2.12
69
+ * @return array
70
+ */
71
+ public function update_customize_save_response( $response, $instance ) {
72
+ if ( $this->is_widget_block_editor() && ! empty( $response['setting_validities'] ) ) {
73
+
74
+ $astra_widgets_data_keys = array_keys( $response['setting_validities'] );
75
+ $astra_widgets_data = array(
76
+ 'widget_astra-widget-social-profiles' => array(),
77
+ 'widget_astra-widget-list-icons' => array(),
78
+ );
79
+ foreach ( $astra_widgets_data_keys as $value ) {
80
+ if ( strpos( $value, 'widget_astra-widget-' ) !== false ) {
81
+ $key = substr_replace( $value, '', -1 );
82
+ $separated_data = explode( '[', $key );
83
+
84
+ if ( 'widget_astra-widget-list-icons' === $separated_data[0] ) {
85
+ $astra_widgets_data['widget_astra-widget-list-icons'][] = absint( $separated_data[1] );
86
+ } elseif ( 'widget_astra-widget-social-profiles' === $separated_data[0] ) {
87
+ $astra_widgets_data['widget_astra-widget-social-profiles'][] = absint( $separated_data[1] );
88
+ }
89
+ }
90
+ }
91
+
92
+ $this->update_widget_id_data( $astra_widgets_data );
93
+ }
94
+
95
+ return $response;
96
+ }
97
+
98
+ /**
99
+ * Fragment out customizer saved Astra widgets.
100
+ *
101
+ * @param array $astra_widgets_data Astra widgets saved customizer data.
102
+ *
103
+ * @since 1.2.12
104
+ * @return void
105
+ */
106
+ public function update_widget_id_data( $astra_widgets_data ) {
107
+
108
+ if ( ! empty( $astra_widgets_data['widget_astra-widget-social-profiles'] ) ) {
109
+ $social_profiles_db_data = get_option( 'widget_astra-widget-social-profiles' );
110
+
111
+ foreach ( $astra_widgets_data['widget_astra-widget-social-profiles'] as $key ) {
112
+ if ( $social_profiles_db_data[ $key ]['widget_unique_id'] !== $key ) {
113
+ $social_profiles_db_data[ $key ]['widget_unique_id'] = $key;
114
+ update_option( 'widget_astra-widget-social-profiles', $social_profiles_db_data );
115
+ }
116
+ }
117
+ }
118
+ if ( ! empty( $astra_widgets_data['widget_astra-widget-list-icons'] ) ) {
119
+ $list_icon_db_data = get_option( 'widget_astra-widget-list-icons' );
120
+ foreach ( $astra_widgets_data['widget_astra-widget-list-icons'] as $key ) {
121
+ if ( $list_icon_db_data[ $key ]['widget_unique_id'] !== $key ) {
122
+ $list_icon_db_data[ $key ]['widget_unique_id'] = $key;
123
+ update_option( 'widget_astra-widget-list-icons', $list_icon_db_data );
124
+ }
125
+ }
126
+ }
127
  }
128
 
129
  /**
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: brainstormforce
3
  Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: Address widget, Social profile widget, List icon widget, Social media, Add widget
5
  Requires at least: 4.7
6
- Tested up to: 6.0
7
  Requires PHP: 5.2
8
- Stable tag: 1.2.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -76,6 +76,9 @@ In your WordPress admin dashboard go to Appearance -> Widgets, drag the Astra :
76
 
77
  == Changelog ==
78
 
 
 
 
79
  = 1.2.11 =
80
  - Fix: Keep the format of Address widget's textarea text as it is. (Props - https://github.com/caveman99)
81
 
3
  Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: Address widget, Social profile widget, List icon widget, Social media, Add widget
5
  Requires at least: 4.7
6
+ Tested up to: 6.1
7
  Requires PHP: 5.2
8
+ Stable tag: 1.2.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
76
 
77
  == Changelog ==
78
 
79
+ = 1.2.12 =
80
+ - Fix: Astra Social Profile and List Icons: Repeater field not showing in Customizer widget block editor. ( https://wpastra.com/docs/resolving-repeater-fields-not-working-in-widget-block-editor/ )
81
+
82
  = 1.2.11 =
83
  - Fix: Keep the format of Address widget's textarea text as it is. (Props - https://github.com/caveman99)
84