Version Description
- Improvement: Hardened the security of plugin
Download this release
Release Info
Developer | brainstormworg |
Plugin | Astra Widgets |
Version | 1.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 1.2.6
assets/js/minified/astra-widgets-backend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(c){AstraWidgets={init:function(){this._init_colorpicker(),this._init_repeater(),this._getMarkup(),this._bind()},_init_colorpicker:function(){c(".astra-widget-field-color input").not('[id*="__i__"]').wpColorPicker({change:function(e,t){c(e.target).val(t.color.toString()),c(e.target).trigger("change")}})},_bind:function(){c(document).on("widget-updated widget-added",AstraWidgets._reinit_controls),c(document).on("click",".astra-select-icon",AstraWidgets._icon_selector),c(document).on("click",".astra-widget-icon",AstraWidgets._set_icon),c(document).on("click",".astra-repeater-sortable .clone",AstraWidgets._repeater_clone),c(document).on("click",".astra-repeater-sortable .remove",AstraWidgets._repeater_remove),c(document).on("click",".astra-repeater-field .actions",AstraWidgets._repeater_toggle_open),c(document).on("click",".astra-repeater .add-new-btn",AstraWidgets._add_new),c(document).on("click",".widget-control-save",AstraWidgets._repeater_reinit),c(document).on("click",".astra-repeater-field .astra-select-image",AstraWidgets._repeater_add_image_field),c(document).on("click",".astra-repeater-field .astra-remove-image",AstraWidgets._repeater_remove_image_field),c(document).on("input",'.astra-repeater-field [data-field-id="title"]',AstraWidgets._repeater_set_title),c(document).on("keyup",".astra-repeater-field .search-icon",AstraWidgets._searchFuntionality),c(document).on("click",".astra-repeater-field .astra-select-icon",AstraWidgets._showIconsMarkup)},_reinit_controls:function(){AstraWidgets._init_colorpicker(),AstraWidgets._init_repeater()},_getMarkup:function(){var e=fontAwesomeIcons.font_awesome,t='<input type="search" placeholder="Search icon..." class="search-icon">';for(var a in t+='<ul class="astra-widget-icons-list">',e)if(e.hasOwnProperty(a)){var s=e[a],i=s.svg.hasOwnProperty("brands")?s.svg.brands.viewBox:s.svg.solid.viewBox,r=s.svg.hasOwnProperty("brands")?s.svg.brands.path:s.svg.solid.path,n=i.join(" "),o=s.search.terms.join(" ");s.search.terms.push(a),s.search.terms.push(s.styles[0]),t+='<li class="astra-widget-icon '+a+'" data-search-terms="'+o+'" data-font="'+a+'" data-viewbox="'+n+'" data-path="'+r+'">',t+='<svg xmlns="http://www.w3.org/2000/svg" viewBox="'+n+'"><path d="'+r+'"></path></svg>',t+="</li>"}return t+="</ul>"},_showIconsMarkup:function(){font_awesome_markup=AstraWidgets._getMarkup(),c(this).hasClass("open")?c(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").append(font_awesome_markup):(c(this).parents(".astra-widget-icon-selector").find(".astra-widget-icons-list").remove(),c(this).parents(".astra-widget-icon-selector").find(".search-icon").remove())},_icon_selector:function(e){c(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").slideToggle(),c(this).toggleClass("open")},_set_icon:function(e){var t=c(this).parents(".astra-widget-icon-selector"),a=c(this).attr("data-font")||"",s=t.find(".astra-widget-icon."+a),i=t.find(".astra-selected-icon"),r=t.find(".selected-icon"),n=c(this).attr("data-path"),o=c(this).attr("data-viewbox"),d=s.html();i.html(d),t.find(".astra-widget-icons-list .astra-widget-icon").removeClass("selected"),s.addClass("selected"),"yes"===c(this).closest(".astra-repeater-field").find(".selected-icon").data("icon-visible")&&(c(this).closest(".astra-repeater-field").find(".title").attr("class","title"),c(this).closest(".astra-repeater-field").find(".title").addClass(a)),iconObj={name:a,path:n,viewbox:o};var l=JSON.stringify(iconObj);r.val(l),t.find(".selected-icon").trigger("change")},_searchFuntionality:function(){var e,t,a,s;e=this.value.toUpperCase(),t=c(this).parents(".astra-icons-list-wrap").find(".astra-widget-icons-list")[0],
|
1 |
+
!function(c){AstraWidgets={init:function(){this._init_colorpicker(),this._init_repeater(),this._getMarkup(),this._bind()},_init_colorpicker:function(){c(".astra-widget-field-color input").not('[id*="__i__"]').wpColorPicker({change:function(e,t){c(e.target).val(t.color.toString()),c(e.target).trigger("change")}})},_bind:function(){c(document).on("widget-updated widget-added",AstraWidgets._reinit_controls),c(document).on("click",".astra-select-icon",AstraWidgets._icon_selector),c(document).on("click",".astra-widget-icon",AstraWidgets._set_icon),c(document).on("click",".astra-repeater-sortable .clone",AstraWidgets._repeater_clone),c(document).on("click",".astra-repeater-sortable .remove",AstraWidgets._repeater_remove),c(document).on("click",".astra-repeater-field .actions",AstraWidgets._repeater_toggle_open),c(document).on("click",".astra-repeater .add-new-btn",AstraWidgets._add_new),c(document).on("click",".widget-control-save",AstraWidgets._repeater_reinit),c(document).on("click",".astra-repeater-field .astra-select-image",AstraWidgets._repeater_add_image_field),c(document).on("click",".astra-repeater-field .astra-remove-image",AstraWidgets._repeater_remove_image_field),c(document).on("input",'.astra-repeater-field [data-field-id="title"]',AstraWidgets._repeater_set_title),c(document).on("keyup",".astra-repeater-field .search-icon",AstraWidgets._searchFuntionality),c(document).on("click",".astra-repeater-field .astra-select-icon",AstraWidgets._showIconsMarkup)},_reinit_controls:function(){AstraWidgets._init_colorpicker(),AstraWidgets._init_repeater()},_getMarkup:function(){var e=fontAwesomeIcons.font_awesome,t='<input type="search" placeholder="Search icon..." class="search-icon">';for(var a in t+='<ul class="astra-widget-icons-list">',e)if(e.hasOwnProperty(a)){var s=e[a],i=s.svg.hasOwnProperty("brands")?s.svg.brands.viewBox:s.svg.solid.viewBox,r=s.svg.hasOwnProperty("brands")?s.svg.brands.path:s.svg.solid.path,n=i.join(" "),o=s.search.terms.join(" ");s.search.terms.push(a),s.search.terms.push(s.styles[0]),t+='<li class="astra-widget-icon '+a+'" data-search-terms="'+o+'" data-font="'+a+'" data-viewbox="'+n+'" data-path="'+r+'">',t+='<svg xmlns="http://www.w3.org/2000/svg" viewBox="'+n+'"><path d="'+r+'"></path></svg>',t+="</li>"}return t+="</ul>"},_showIconsMarkup:function(){font_awesome_markup=AstraWidgets._getMarkup(),c(this).hasClass("open")?c(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").append(font_awesome_markup):(c(this).parents(".astra-widget-icon-selector").find(".astra-widget-icons-list").remove(),c(this).parents(".astra-widget-icon-selector").find(".search-icon").remove())},_icon_selector:function(e){c(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").slideToggle(),c(this).toggleClass("open")},_set_icon:function(e){var t=c(this).parents(".astra-widget-icon-selector"),a=c(this).attr("data-font")||"",s=t.find(".astra-widget-icon."+a),i=t.find(".astra-selected-icon"),r=t.find(".selected-icon"),n=c(this).attr("data-path"),o=c(this).attr("data-viewbox"),d=s.html();i.html(d),t.find(".astra-widget-icons-list .astra-widget-icon").removeClass("selected"),s.addClass("selected"),"yes"===c(this).closest(".astra-repeater-field").find(".selected-icon").data("icon-visible")&&(c(this).closest(".astra-repeater-field").find(".title").attr("class","title"),c(this).closest(".astra-repeater-field").find(".title").addClass(a)),iconObj={name:a,path:n,viewbox:o};var l=JSON.stringify(iconObj);r.val(l),t.find(".selected-icon").trigger("change")},_searchFuntionality:function(){var e,t,a,s;e=this.value.toUpperCase(),t=c(this).parents(".astra-icons-list-wrap").find(".astra-widget-icons-list")[0],setTimeout(function(){for(a=t.getElementsByTagName("li"),s=0;s<a.length;s++)search=c(a[s]).data("search-terms"),search&&(-1<search.toUpperCase().indexOf(e)?a[s].style.display="":a[s].style.display="none")},300)},_repeater_remove_image_field:function(e){if(confirm("Do you want to remove this image?")){var t=c(this).parents(".astra-repeater-field");t.find(".astra-field-image-preview").html(""),t.find(".astra-field-image-preview img").attr("src",""),t.find(".astra-field-image-preview-id").val(""),t.find(".astra-image-url").val(""),t.find(".astra-image-alt").val(""),t.find(".astra-image-title").val(""),t.find(".astra-image-size-select, .astra-image-width").hide(),t.find(".astra-select-image.button").css("display","inline-block")}},_repeater_add_image_field:function(e){var a=c(this).parents(".astra-repeater-field"),s=wp.media({title:"Select or Upload Image",button:{text:"Choose Image"},library:{type:"image"},multiple:!1});return s.on("close",function(){var e=s.state().get("selection").toJSON();if(!c.isEmptyObject(e)){if(e[0].sizes.hasOwnProperty("medium"))var t=e[0].sizes.medium.url;else if(e[0].sizes.hasOwnProperty("thumbnail"))t=e[0].sizes.thumbnail.url;else t=e[0].sizes.full.url;0<a.find(".astra-remove-image").length?a.find(".astra-field-image-preview img").attr("src",t):a.find(".astra-field-image-preview").append('<img src="'+t+'" /><span class="astra-remove-image button">Remove</span>'),a.find(".astra-image-url").val(e[0].url),a.find(".astra-image-alt").val(e[0].alt),a.find(".astra-image-title").val(e[0].title),a.find(".astra-field-image-preview-id").val(e[0].id),a.find(".astra-select-image.button").css("display","none"),a.find(".astra-image-size-select, .astra-image-width").show(),a.find("input").trigger("change")}}),s.open(),!1},_get_sub_string:function(e){var t="";if(24<e.length)t="..";return e=e.substring(0,24)+t},_repeater_set_title:function(e){var t=c(this).val()||"";t=AstraWidgets._get_sub_string(t),c(this).closest(".astra-repeater-field").find(".title").text(t)},_repeater_reinit:function(e){c(".astra-repeater-sortable").sortable()},_add_new:function(e){e.preventDefault();var t=c(this).closest(".astra-repeater"),a=c(".astra-repeater-field").length||0,s=t.find(".astra-repeater-fields").html(),i=t.find(".astra-repeater-fields").attr("title")||"",r=(t.find(".astra-repeater-fields").attr("data-id"),'<div class="astra-repeater-field">');r+='\t<div class="actions">',r+='\t<span class="index">'+a+"</span>",r+='\t\t<span class="dashicons dashicons-move"></span>',r+='\t<span class="title">'+i+"</span>",r+='\t\t<span class="dashicons dashicons-admin-page clone"></span>',r+='\t\t<span class="dashicons dashicons-trash remove"></span>',r+='\t\t<span class="dashicons toggle-arrow"></span>',r+="\t</div>",r+='\t<div class="markukp">',r+=s=s.replace("][][","]["+a+"]["),r+="\t</div>",r+="</div>",t.find(".astra-repeater-sortable").append(r),AstraWidgets._set_repeater_names()},_set_repeater_names:function(){c(".astra-repeater").each(function(e,t){var n=c(t).find(".astra-repeater-fields").attr("data-id")||"";c(t).find(".astra-repeater-sortable").find(".astra-repeater-field").each(function(i,r){c(r).find(":input").each(function(e,t){var a=c(t).attr("data-field-id")||"",s=n+"["+i+"]["+a+"]";c(r).find(".index").text(i),c(t).attr("name",s)})})})},_repeater_toggle_open:function(e){e.preventDefault(),(e.target===this||c(e.target).hasClass("title")||c(e.target).hasClass("dashicons-move"))&&(c(this).parents(".astra-repeater-field").toggleClass("field-open"),c(this).parents(".astra-repeater-field").find(".markukp").slideToggle())},_repeater_clone:function(e){e.preventDefault();var t=c(this),a=t.closest(".astra-repeater");a.find(".astra-repeater-fields").html();c(t).closest(".astra-repeater-field").clone().insertAfter(t.closest(".astra-repeater-field")),c(".astra-repeater-sortable").sortable(),a.find("input").trigger("change"),AstraWidgets._set_repeater_names()},_repeater_remove:function(e){e.preventDefault();var t=c(this),a=t.closest(".astra-repeater"),s=t.parent().find(".title").html(),i="";i=0<s.length?s:"this field",confirm("Are you sure you want to delete "+i+"?")&&t.closest(".astra-repeater-field").remove(),AstraWidgets._set_repeater_names(),a.find("input").trigger("change")},_init_repeater:function(){c(".astra-repeater-sortable").sortable({cursor:"move",stop:function(e,t){AstraWidgets._set_repeater_names(),t.item.find("input").trigger("change")}}),AstraWidgets._set_repeater_names(),c(".astra-repeater-field").length&&c(".astra-repeater-field").each(function(e,t){var a=c(t).find('[data-field-id="title"]').val()||"",s=c(t).find('[data-field-id="icon"]').val()||"";a=AstraWidgets._get_sub_string(a),c(t).find(".title").text(a),"yes"===c(t).find(".selected-icon").data("icon-visible")&&c(t).find(".title").addClass(s)})}},c(function(){AstraWidgets.init()})}(jQuery);
|
assets/js/unminified/astra-widgets-backend.js
CHANGED
@@ -127,7 +127,6 @@
|
|
127 |
input = this;
|
128 |
filter = input.value.toUpperCase();
|
129 |
ul = $(this).parents('.astra-icons-list-wrap').find(".astra-widget-icons-list")[0];
|
130 |
-
console.log( ul );
|
131 |
setTimeout( function() {
|
132 |
li = ul.getElementsByTagName('li');
|
133 |
|
127 |
input = this;
|
128 |
filter = input.value.toUpperCase();
|
129 |
ul = $(this).parents('.astra-icons-list-wrap').find(".astra-widget-icons-list")[0];
|
|
|
130 |
setTimeout( function() {
|
131 |
li = ul.getElementsByTagName('li');
|
132 |
|
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.
|
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.
|
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.6
|
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.6' );
|
29 |
define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
|
30 |
|
31 |
require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
|
classes/widgets/class-astra-widget-address.php
CHANGED
@@ -224,6 +224,8 @@ if ( ! class_exists( 'Astra_Widget_Address' ) ) :
|
|
224 |
*/
|
225 |
$instance['display-icons'] = isset( $new_instance['display-icons'] ) ? (bool) $new_instance['display-icons'] : false;
|
226 |
|
|
|
|
|
227 |
return $instance;
|
228 |
}
|
229 |
|
224 |
*/
|
225 |
$instance['display-icons'] = isset( $new_instance['display-icons'] ) ? (bool) $new_instance['display-icons'] : false;
|
226 |
|
227 |
+
$instance = array_map( 'sanitize_text_field', $instance );
|
228 |
+
|
229 |
return $instance;
|
230 |
}
|
231 |
|
classes/widgets/class-astra-widget-list-icons.php
CHANGED
@@ -239,7 +239,20 @@ if ( ! class_exists( 'Astra_Widget_List_Icons' ) ) :
|
|
239 |
* @return array Merged updated instance.
|
240 |
*/
|
241 |
public function update( $new_instance, $old_instance ) {
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
}
|
244 |
|
245 |
/**
|
239 |
* @return array Merged updated instance.
|
240 |
*/
|
241 |
public function update( $new_instance, $old_instance ) {
|
242 |
+
|
243 |
+
$instance = wp_parse_args( $new_instance, $old_instance );
|
244 |
+
|
245 |
+
foreach ( $instance as $icon_key => $icon_value ) {
|
246 |
+
|
247 |
+
if ( 'list' !== $icon_key ) {
|
248 |
+
$instance[ $icon_key ] = sanitize_text_field( $icon_value );
|
249 |
+
} else {
|
250 |
+
foreach ( $instance['list'] as $key => $value ) {
|
251 |
+
$instance['list'][ $key ] = array_map( 'sanitize_text_field', $value );
|
252 |
+
}
|
253 |
+
}
|
254 |
+
}
|
255 |
+
return $instance;
|
256 |
}
|
257 |
|
258 |
/**
|
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: 5.5
|
7 |
Requires PHP: 5.2
|
8 |
-
Stable tag: 1.2.
|
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.5 =
|
80 |
- Fix: Fixed compatibility with other plugins with respect to the admin notice.
|
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: 5.5.1
|
7 |
Requires PHP: 5.2
|
8 |
+
Stable tag: 1.2.6
|
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.6 =
|
80 |
+
- Improvement: Hardened the security of plugin
|
81 |
+
|
82 |
= 1.2.5 =
|
83 |
- Fix: Fixed compatibility with other plugins with respect to the admin notice.
|
84 |
|