Astra Widgets - Version 1.2.9

Version Description

  • Improvement: WordPress 5.8 compatibility.
  • Fix: Handled PHP notice in customizer with Astra Social Profiles Widget.
Download this release

Release Info

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

Code changes from version 1.2.8 to 1.2.9

assets/css/minified/astra-widgets-admin.min.css CHANGED
@@ -1 +1 @@
1
- .wp-core-ui .next-field-image .next-select-image{padding:4px 0;width:100%;text-align:center;height:auto}.astra-repeater-field{cursor:move;border-bottom:1px solid #eee}.astra-repeater-field:last-child{border-bottom:none}.astra-repeater-field .dashicons{font-size:1rem;height:1rem;width:1rem;color:#c1c1c1}.astra-repeater-field .dashicons-admin-page.clone{margin-right:.3em}.astra-repeater-container{margin-bottom:1em}.astra-repeater-field label{margin-bottom:.5em;display:inline-block}.astra-repeater .markukp p{margin:1em 0}.astra-repeater .add-new{margin-bottom:1em}.astra-repeater-field .clone,.astra-repeater-field .remove{cursor:pointer}.astra-repeater-field .actions{padding:10px;background:#fafafa;text-align:right}.astra-repeater-field .markukp{display:none}.astra-repeater-field .actions .dashicons-move,.astra-repeater-field .actions .title{float:left}.astra-repeater-field .actions .title{margin-left:.5em}.astra-repeater-field .index{display:none}.astra-repeater-field span.title:before{font-size:.9em;margin-right:.5em}.astra-field-image .astra-remove-image{position:absolute;background:0 0;border:none;box-shadow:none;top:.6em;left:4em;color:#a00;font-size:13px;text-decoration:underline;transition:all .25s ease}.astra-field-image .astra-remove-image:hover{outline:0;background:0 0;box-shadow:none;color:#dc3232}.astra-field-image-preview{position:relative}.astra-field-image{-js-display:flex;display:flex}.astra-field-image-preview img{border-width:1px 0 1px 1px;border-color:#bbb;border-style:solid;line-height:0;box-shadow:0 1px 1px #fff;width:40px;height:40px;padding:5.5px;box-shadow:inset 0 1px 3px rgba(0,0,0,.2)}.astra-field-image-preview{background:#f9f9f9;background:-o-linear-gradient(#f9f9f9,#f2f2f2);box-shadow:0 1px 2px rgba(0,0,0,.1);-moz-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;border-bottom-left-radius:3px;line-height:10px}.astra-field-image img{max-width:100%}.astra-field-image-title{margin-bottom:1em}.astra-icons-list-wrap{display:none}.astra-selected-icon{display:inline-block}.astra-icons-list-wrap .search-icon{width:100%;margin-top:1em;margin-bottom:1em}.astra-widget-icons-list .astra-widget-icon{-js-display:flex;display:flex;align-items:center;justify-content:center;float:left;cursor:pointer;padding:1em;width:30px;line-height:1em;font-size:1em;border:1px solid #f1f1f1;margin:0;text-align:center}.astra-widget-icons-list{display:inline-block;margin:1em 0 0 0;padding:0;max-height:250px;overflow:auto}.astra-widget-icon-selector{margin:1em 0}.astra-widget-field{margin:1em 0}.astra-widget-field label,.astra-widget-field+p label{margin-bottom:.5em;display:block}.astra-widget-field .wp-picker-input-wrap label{display:inline-block}.astra-widget-field-checkbox label{display:inline-block}.astra-widget-field-heading label{font-weight:700}.astra-widget-field .wp-picker-input-wrap .wp-picker-clear{min-height:30px;margin-left:6px}.astra-widget-field-color .wp-color-result{margin-bottom:0!important}.astra-widget-icon svg{width:20px;height:20px}.astra-selected-icon svg{width:15px;height:15px;vertical-align:middle;margin-top:-1px}.astra-widget-icon.selected{background:#5897fb}.astra-widget-icon.selected svg{fill:#fff}.astra-widget-unit-field .widefat{width:91%}.astra-widgets-unit{margin-left:5px}.astra-repeater-field .markukp{padding:10px;border-top:1px solid #e5e5e5}.astra-repeater-sortable .astra-repeater-field{border:1px solid #e5e5e5;background:#fff;margin-bottom:5px}.astra-repeater-field.field-open .actions .toggle-arrow:before{content:"\f142"}.astra-repeater-field .actions .toggle-arrow:before{content:"\f140"}.astra-repeater-field .actions .toggle-arrow{display:inline-block;margin-top:-3px;font-size:1.6rem;width:1.6rem;color:silver}.astra-repeater-field title{line-height:1.4em}
1
+ .wp-core-ui .next-field-image .next-select-image{padding:4px 0;width:100%;text-align:center;height:auto}.astra-repeater-field{cursor:move;border-bottom:1px solid #eee}.astra-repeater-field:last-child{border-bottom:none}.astra-repeater-field .dashicons{font-size:1rem;height:1rem;width:1rem;color:#c1c1c1}.astra-repeater-field .dashicons-admin-page.clone{margin-right:.3em}.astra-repeater-container{margin-bottom:1em}.astra-repeater-field label{margin-bottom:.5em;display:inline-block}.astra-repeater .markukp p{margin:1em 0}.astra-repeater .add-new{margin-bottom:1em}.astra-repeater-field .clone,.astra-repeater-field .remove{cursor:pointer}.astra-repeater-field .actions{padding:10px;background:#fafafa;text-align:right}.astra-repeater-field .markukp{display:none}.astra-repeater-field .actions .dashicons-move,.astra-repeater-field .actions .title{float:left}.astra-repeater-field .actions .title{margin-left:.5em}.astra-repeater-field .index{display:none}.astra-repeater-field span.title:before{font-size:.9em;margin-right:.5em}.astra-field-image .astra-remove-image{position:absolute;background:0 0;border:none;box-shadow:none;top:.6em;left:4em;color:#a00;font-size:13px;text-decoration:underline;transition:all .25s ease}.astra-field-image .astra-remove-image:hover{outline:0;background:0 0;box-shadow:none;color:#dc3232}.astra-field-image-preview{position:relative}.astra-field-image{-js-display:flex;display:flex}.astra-field-image-preview img{border-width:1px 0 1px 1px;border-color:#bbb;border-style:solid;line-height:0;box-shadow:0 1px 1px #fff;width:40px;height:40px;padding:5.5px;box-shadow:inset 0 1px 3px rgba(0,0,0,.2)}.astra-field-image-preview{background:#f9f9f9;background:-o-linear-gradient(#f9f9f9,#f2f2f2);box-shadow:0 1px 2px rgba(0,0,0,.1);-moz-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;border-bottom-left-radius:3px;line-height:10px}.astra-field-image img{max-width:100%}.astra-field-image-title{margin-bottom:1em}.astra-icons-list-wrap{display:none}.astra-selected-icon{display:inline-block}.astra-icons-list-wrap .search-icon{width:100%;margin-top:1em;margin-bottom:1em}.astra-widget-icons-list .astra-widget-icon{-js-display:flex;display:flex;align-items:center;justify-content:center;float:left;cursor:pointer;padding:1em;box-sizing:content-box;width:30px;line-height:1em;font-size:1em;border:1px solid #f1f1f1;margin:0;text-align:center}.block-editor-block-list__block .astra-widget-icons-list .astra-widget-icon{width:20px}.astra-widget-icons-list{display:inline-block;margin:1em 0 0 0;padding:0;max-height:250px;overflow:auto}.astra-widget-icon-selector{margin:1em 0}.astra-widget-field{margin:1em 0}.astra-widget-field label,.astra-widget-field+p label{margin-bottom:.5em;display:block}.astra-widget-field .wp-picker-input-wrap label{display:inline-block}.astra-widget-field-checkbox label{display:inline-block}.astra-widget-field-heading label{font-weight:700}.astra-widget-field .wp-picker-input-wrap .wp-picker-clear{min-height:30px;margin-left:6px}.astra-widget-field-color .wp-color-result{margin-bottom:0!important}.astra-widget-icon svg{width:20px;height:20px}.astra-selected-icon svg{width:15px;height:15px;vertical-align:middle;margin-top:-1px}.astra-widget-icon.selected{background:#5897fb}.astra-widget-icon.selected svg{fill:#fff}.astra-widget-unit-field .widefat{width:91%}.astra-widgets-unit{margin-left:5px}.astra-repeater-field .markukp{padding:10px;border-top:1px solid #e5e5e5}.astra-repeater-sortable .astra-repeater-field{border:1px solid #e5e5e5;background:#fff;margin-bottom:5px}.astra-repeater-field.field-open .actions .toggle-arrow:before{content:"\f142"}.astra-repeater-field .actions .toggle-arrow:before{content:"\f140"}.astra-repeater-field .actions .toggle-arrow{display:inline-block;margin-top:-3px;font-size:1.6rem;width:1.6rem;color:silver}.astra-repeater-field title{line-height:1.4em}
assets/css/unminified/astra-widgets-admin-rtl.css CHANGED
@@ -160,6 +160,7 @@
160
  float: right;
161
  cursor: pointer;
162
  padding: 1em;
 
163
  width: 30px;
164
  line-height: 1em;
165
  font-size: 1em;
@@ -167,6 +168,9 @@
167
  margin: 0;
168
  text-align: center;
169
  }
 
 
 
170
  .astra-widget-icons-list {
171
  display: inline-block;
172
  margin: 1em 0 0 0;
@@ -233,7 +237,7 @@
233
  }
234
 
235
  .astra-widget-icon.selected svg {
236
- fill: #fff;
237
  }
238
 
239
  .astra-widget-unit-field .widefat {
@@ -273,4 +277,4 @@
273
 
274
  .astra-repeater-field title {
275
  line-height: 1.4em;
276
- }
160
  float: right;
161
  cursor: pointer;
162
  padding: 1em;
163
+ box-sizing: content-box;
164
  width: 30px;
165
  line-height: 1em;
166
  font-size: 1em;
168
  margin: 0;
169
  text-align: center;
170
  }
171
+ .block-editor-block-list__block .astra-widget-icons-list .astra-widget-icon {
172
+ width: 20px;
173
+ }
174
  .astra-widget-icons-list {
175
  display: inline-block;
176
  margin: 1em 0 0 0;
237
  }
238
 
239
  .astra-widget-icon.selected svg {
240
+ fill: #fff;
241
  }
242
 
243
  .astra-widget-unit-field .widefat {
277
 
278
  .astra-repeater-field title {
279
  line-height: 1.4em;
280
+ }
assets/css/unminified/astra-widgets-admin.css CHANGED
@@ -160,6 +160,7 @@
160
  float: left;
161
  cursor: pointer;
162
  padding: 1em;
 
163
  width: 30px;
164
  line-height: 1em;
165
  font-size: 1em;
@@ -167,6 +168,9 @@
167
  margin: 0;
168
  text-align: center;
169
  }
 
 
 
170
  .astra-widget-icons-list {
171
  display: inline-block;
172
  margin: 1em 0 0 0;
@@ -233,7 +237,7 @@
233
  }
234
 
235
  .astra-widget-icon.selected svg {
236
- fill: #fff;
237
  }
238
 
239
  .astra-widget-unit-field .widefat {
@@ -273,4 +277,4 @@
273
 
274
  .astra-repeater-field title {
275
  line-height: 1.4em;
276
- }
160
  float: left;
161
  cursor: pointer;
162
  padding: 1em;
163
+ box-sizing: content-box;
164
  width: 30px;
165
  line-height: 1em;
166
  font-size: 1em;
168
  margin: 0;
169
  text-align: center;
170
  }
171
+ .block-editor-block-list__block .astra-widget-icons-list .astra-widget-icon {
172
+ width: 20px;
173
+ }
174
  .astra-widget-icons-list {
175
  display: inline-block;
176
  margin: 1em 0 0 0;
237
  }
238
 
239
  .astra-widget-icon.selected svg {
240
+ fill: #fff;
241
  }
242
 
243
  .astra-widget-unit-field .widefat {
277
 
278
  .astra-repeater-field title {
279
  line-height: 1.4em;
280
+ }
assets/js/minified/astra-widget-list-icons.min.js CHANGED
@@ -1 +1 @@
1
- !function(a){AstraWidgetListIcons={init:function(){this._bind(),this._init_toggle_settings()},_bind:function(){a(document).on("widget-updated widget-added",AstraWidgetListIcons._init_toggle_settings),a(document).on("change",".astra-widget-list-icons-fields .astra-widget-field-imageoricon",AstraWidgetListIcons._toggle_settings),a(document).on("click",".astra-widget-list-icons-fields .astra-repeater-container .actions",AstraWidgetListIcons._init_toggle_settings),a(document).on("change",".astra-widget-list-icons-fields .astra-widget-field-divider",AstraWidgetListIcons._toggle_divider_settings)},_init_toggle_settings:function(){a(".astra-widget-list-icons-fields .astra-repeater-sortable .astra-repeater-field").each(function(i,e){var t=a(e),d=t.find(".astra-widget-field-imageoricon").find("option:selected").val()||"",s=t.find(".astra-widget-field-divider").find("option:selected").val()||"";"image"===d?(t.find(".astra-field-image-wrapper").show(),t.find(".astra-widget-icon-selector").hide()):(t.find(".astra-widget-icon-selector").show(),t.find(".astra-field-image-wrapper").hide()),"yes"===s?(t.find(".astra-widget-field-divider_weight").show(),t.find(".astra-widget-field-divider_style").show(),t.find(".astra-widget-field-divider_color").show()):(t.find(".astra-widget-field-divider_weight").hide(),t.find(".astra-widget-field-divider_style").hide(),t.find(".astra-widget-field-divider_color").hide())})},_toggle_settings:function(){var i=a(this).find("option:selected").val()||"",e=a(this).closest(".astra-widget-list-icons-fields");"image"===i?(e.find(".astra-field-image-wrapper").show(),e.find(".astra-widget-icon-selector").hide()):(e.find(".astra-widget-icon-selector").show(),e.find(".astra-field-image-wrapper").hide())},_toggle_divider_settings:function(){var i=a(this).find("option:selected").val()||"",e=a(this).closest(".astra-widget-list-icons-fields");"yes"===i?(e.find(".astra-widget-field-divider_weight").show(),e.find(".astra-widget-field-divider_style").show(),e.find(".astra-widget-field-divider_color").show()):(e.find(".astra-widget-field-divider_weight").hide(),e.find(".astra-widget-field-divider_style").hide(),e.find(".astra-widget-field-divider_color").hide())}},a(function(){AstraWidgetListIcons.init()})}(jQuery);
1
+ !function(s){AstraWidgetListIcons={init:function(){this._bind(),this._init_toggle_settings()},_bind:function(){s(document).on("widget-updated widget-added",AstraWidgetListIcons._init_toggle_settings),s(document).on("change",".astra-widget-list-icons-fields .astra-widget-field-imageoricon",AstraWidgetListIcons._toggle_settings),s(document).on("click",".astra-widget-list-icons-fields .astra-repeater-container .actions",AstraWidgetListIcons._init_toggle_settings),s(document).on("change",".astra-widget-list-icons-fields .astra-widget-field-divider",AstraWidgetListIcons._toggle_divider_settings)},_init_toggle_settings:function(){s(".astra-widget-list-icons-fields .astra-repeater-sortable .astra-repeater-field").each(function(i,e){var t=s(e),d=t.find(".astra-widget-field-imageoricon").find("option:selected").val()||"",e=t.find(".astra-widget-field-divider").find("option:selected").val()||"";"image"===d?(t.find(".astra-field-image-wrapper").show(),t.find(".astra-widget-icon-selector").hide()):(t.find(".astra-widget-icon-selector").show(),t.find(".astra-field-image-wrapper").hide()),"yes"===e?(t.find(".astra-widget-field-divider_weight").show(),t.find(".astra-widget-field-divider_style").show(),t.find(".astra-widget-field-divider_color").show()):(t.find(".astra-widget-field-divider_weight").hide(),t.find(".astra-widget-field-divider_style").hide(),t.find(".astra-widget-field-divider_color").hide())})},_toggle_settings:function(){var i=s(this).find("option:selected").val()||"",e=s(this).closest(".astra-widget-list-icons-fields");"image"===i?(e.find(".astra-field-image-wrapper").show(),e.find(".astra-widget-icon-selector").hide()):(e.find(".astra-widget-icon-selector").show(),e.find(".astra-field-image-wrapper").hide())},_toggle_divider_settings:function(){var i=s(this).find("option:selected").val()||"",e=s(this).closest(".astra-widget-list-icons-fields");"yes"===i?(e.find(".astra-widget-field-divider_weight").show(),e.find(".astra-widget-field-divider_style").show(),e.find(".astra-widget-field-divider_color").show()):(e.find(".astra-widget-field-divider_weight").hide(),e.find(".astra-widget-field-divider_style").hide(),e.find(".astra-widget-field-divider_color").hide())}},s(function(){AstraWidgetListIcons.init()})}(jQuery);
assets/js/minified/astra-widget-social-profiles.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){AstraWidgetSocialProfiles={init:function(){this._init_toggle_settings(),this._bind()},_bind:function(){t(document).on("widget-updated widget-added",AstraWidgetSocialProfiles._init_toggle_settings),t(document).on("change",".astra-widget-social-profiles-fields .astra-widget-field-icon-style",AstraWidgetSocialProfiles._toggle_settings),t(document).on("change",".astra-widget-social-profiles-fields .astra-widget-field-color-type",AstraWidgetSocialProfiles._toggle_settings)},_init_toggle_settings:function(){t(".astra-widget-social-profiles-fields").each(function(i,e){var o=t(e),d=o.find(".astra-widget-field-icon-style").find("option:selected").val()||"";"official-color"===(o.find(".astra-widget-field-color-type").find("option:selected").val()||"")?(o.find(".astra-widget-field-icon-color").hide(),o.find(".astra-widget-field-icon-hover-color").hide(),o.find(".astra-widget-field-bg-hover-color").hide(),o.find(".astra-widget-field-bg-color").hide()):(o.find(".astra-widget-field-icon-color").show(),o.find(".astra-widget-field-icon-hover-color").show(),o.find(".astra-widget-field-bg-hover-color").show(),o.find(".astra-widget-field-bg-color").show(),"simple"===d?(o.find(".astra-widget-field-bg-hover-color").hide(),o.find(".astra-widget-field-bg-color").hide()):(o.find(".astra-widget-field-bg-hover-color").show(),o.find(".astra-widget-field-bg-color").show()))})},_toggle_settings:function(){var i=t(this).find("option:selected").val()||"",e=t(this).closest(".astra-widget-social-profiles-fields");"official-color"===(e.find(".astra-widget-field-color-type").find("option:selected").val()||"")?(e.find(".astra-widget-field-icon-color").hide(),e.find(".astra-widget-field-icon-hover-color").hide(),e.find(".astra-widget-field-bg-hover-color").hide(),e.find(".astra-widget-field-bg-color").hide()):(e.find(".astra-widget-field-icon-color").show(),e.find(".astra-widget-field-icon-hover-color").show(),e.find(".astra-widget-field-bg-hover-color").show(),e.find(".astra-widget-field-bg-color").show(),"simple"===i?(e.find(".astra-widget-field-bg-hover-color").hide(),e.find(".astra-widget-field-bg-color").hide()):(e.find(".astra-widget-field-bg-hover-color").show(),e.find(".astra-widget-field-bg-color").show()))}},t(function(){AstraWidgetSocialProfiles.init()})}(jQuery);
1
+ !function(d){AstraWidgetSocialProfiles={init:function(){this._init_toggle_settings(),this._bind()},_bind:function(){d(document).on("widget-updated widget-added",AstraWidgetSocialProfiles._init_toggle_settings),d(document).on("change",".astra-widget-social-profiles-fields .astra-widget-field-icon-style",AstraWidgetSocialProfiles._toggle_settings),d(document).on("change",".astra-widget-social-profiles-fields .astra-widget-field-color-type",AstraWidgetSocialProfiles._toggle_settings)},_init_toggle_settings:function(){d(".astra-widget-social-profiles-fields").each(function(i,e){var o=d(e),e=o.find(".astra-widget-field-icon-style").find("option:selected").val()||"";"official-color"===(o.find(".astra-widget-field-color-type").find("option:selected").val()||"")?(o.find(".astra-widget-field-icon-color").hide(),o.find(".astra-widget-field-icon-hover-color").hide(),o.find(".astra-widget-field-bg-hover-color").hide(),o.find(".astra-widget-field-bg-color").hide()):(o.find(".astra-widget-field-icon-color").show(),o.find(".astra-widget-field-icon-hover-color").show(),o.find(".astra-widget-field-bg-hover-color").show(),o.find(".astra-widget-field-bg-color").show(),"simple"===e?(o.find(".astra-widget-field-bg-hover-color").hide(),o.find(".astra-widget-field-bg-color").hide()):(o.find(".astra-widget-field-bg-hover-color").show(),o.find(".astra-widget-field-bg-color").show()))})},_toggle_settings:function(){var i=d(this).find("option:selected").val()||"",e=d(this).closest(".astra-widget-social-profiles-fields");"official-color"===(e.find(".astra-widget-field-color-type").find("option:selected").val()||"")?(e.find(".astra-widget-field-icon-color").hide(),e.find(".astra-widget-field-icon-hover-color").hide(),e.find(".astra-widget-field-bg-hover-color").hide(),e.find(".astra-widget-field-bg-color").hide()):(e.find(".astra-widget-field-icon-color").show(),e.find(".astra-widget-field-icon-hover-color").show(),e.find(".astra-widget-field-bg-hover-color").show(),e.find(".astra-widget-field-bg-color").show(),"simple"===i?(e.find(".astra-widget-field-bg-hover-color").hide(),e.find(".astra-widget-field-bg-color").hide()):(e.find(".astra-widget-field-bg-hover-color").show(),e.find(".astra-widget-field-bg-color").show()))}},d(function(){AstraWidgetSocialProfiles.init()})}(jQuery);
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],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);
1
+ !function(l){AstraWidgets={init:function(){this._init_colorpicker(),this._init_repeater(),this._getMarkup(),this._bind()},_init_colorpicker:function(){l(".astra-widget-field-color input").not('[id*="__i__"]').wpColorPicker({change:function(e,t){l(e.target).val(t.color.toString()),l(e.target).trigger("change")}})},_bind:function(){l(document).on("widget-updated widget-added",AstraWidgets._reinit_controls),l(document).on("click",".astra-select-icon",AstraWidgets._icon_selector),l(document).on("click",".astra-widget-icon",AstraWidgets._set_icon),l(document).on("click",".astra-repeater-sortable .clone",AstraWidgets._repeater_clone),l(document).on("click",".astra-repeater-sortable .remove",AstraWidgets._repeater_remove),l(document).on("click",".astra-repeater-field .actions",AstraWidgets._repeater_toggle_open),l(document).on("click",".astra-repeater .add-new-btn",AstraWidgets._add_new),l(document).on("click",".widget-control-save",AstraWidgets._repeater_reinit),l(document).on("click",".astra-repeater-field .astra-select-image",AstraWidgets._repeater_add_image_field),l(document).on("click",".astra-repeater-field .astra-remove-image",AstraWidgets._repeater_remove_image_field),l(document).on("input",'.astra-repeater-field [data-field-id="title"]',AstraWidgets._repeater_set_title),l(document).on("keyup",".astra-repeater-field .search-icon",AstraWidgets._searchFuntionality),l(document).on("click",".astra-repeater-field .astra-select-icon",AstraWidgets._showIconsMarkup)},_reinit_controls:function(){AstraWidgets._init_colorpicker(),AstraWidgets._init_repeater()},_getMarkup:function(){var e,t,a,s,i,r=fontAwesomeIcons.font_awesome,n='<input type="search" placeholder="Search icon..." class="search-icon">';for(e in n+='<ul class="astra-widget-icons-list">',r)r.hasOwnProperty(e)&&(i=((t=r[e]).svg.hasOwnProperty("brands")?t.svg.brands:t.svg.solid).viewBox,a=(t.svg.hasOwnProperty("brands")?t.svg.brands:t.svg.solid).path,s=i.join(" "),i=t.search.terms.join(" "),t.search.terms.push(e),t.search.terms.push(t.styles[0]),n+='<li class="astra-widget-icon '+e+'" data-search-terms="'+i+'" data-font="'+e+'" data-viewbox="'+s+'" data-path="'+a+'">',n+='<svg xmlns="http://www.w3.org/2000/svg" viewBox="'+s+'"><path d="'+a+'"></path></svg>',n+="</li>");return n+="</ul>"},_showIconsMarkup:function(){font_awesome_markup=AstraWidgets._getMarkup(),l(this).hasClass("open")?l(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").append(font_awesome_markup):(l(this).parents(".astra-widget-icon-selector").find(".astra-widget-icons-list").remove(),l(this).parents(".astra-widget-icon-selector").find(".search-icon").remove())},_icon_selector:function(e){l(this).parents(".astra-widget-icon-selector").find(".astra-icons-list-wrap").slideToggle(),l(this).toggleClass("open")},_set_icon:function(e){var t=l(this).parents(".astra-widget-icon-selector"),a=l(this).attr("data-font")||"",s=t.find(".astra-widget-icon."+a),i=t.find(".astra-selected-icon"),r=t.find(".selected-icon"),n=l(this).attr("data-path"),d=l(this).attr("data-viewbox"),o=s.html();i.html(o),t.find(".astra-widget-icons-list .astra-widget-icon").removeClass("selected"),s.addClass("selected"),"yes"===l(this).closest(".astra-repeater-field").find(".selected-icon").data("icon-visible")&&(l(this).closest(".astra-repeater-field").find(".title").attr("class","title"),l(this).closest(".astra-repeater-field").find(".title").addClass(a)),iconObj={name:a,path:n,viewbox:d};d=JSON.stringify(iconObj);r.val(d),t.find(".selected-icon").trigger("change")},_searchFuntionality:function(){var e,t,a=this.value.toUpperCase(),s=l(this).parents(".astra-icons-list-wrap").find(".astra-widget-icons-list")[0];setTimeout(function(){for(e=s.getElementsByTagName("li"),t=0;t<e.length;t++)search=l(e[t]).data("search-terms"),search&&(-1<search.toUpperCase().indexOf(a)?e[t].style.display="":e[t].style.display="none")},300)},_repeater_remove_image_field:function(e){var t;confirm("Do you want to remove this image?")&&((t=l(this).parents(".astra-repeater-field")).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=l(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,t=s.state().get("selection").toJSON();l.isEmptyObject(t)||(e=(t[0].sizes.hasOwnProperty("medium")?t[0].sizes.medium:t[0].sizes.hasOwnProperty("thumbnail")?t[0].sizes.thumbnail:t[0].sizes.full).url,0<a.find(".astra-remove-image").length?a.find(".astra-field-image-preview img").attr("src",e):a.find(".astra-field-image-preview").append('<img src="'+e+'" /><span class="astra-remove-image button">Remove</span>'),a.find(".astra-image-url").val(t[0].url),a.find(".astra-image-alt").val(t[0].alt),a.find(".astra-image-title").val(t[0].title),a.find(".astra-field-image-preview-id").val(t[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="";return 24<e.length&&(t=".."),e=e.substring(0,24)+t},_repeater_set_title:function(e){var t=l(this).val()||"",t=AstraWidgets._get_sub_string(t);l(this).closest(".astra-repeater-field").find(".title").text(t)},_repeater_reinit:function(e){l(".astra-repeater-sortable").sortable()},_add_new:function(e){e.preventDefault();var t=l(this).closest(".astra-repeater"),a=l(".astra-repeater-field").length||0,s=t.find(".astra-repeater-fields").html(),i=t.find(".astra-repeater-fields").attr("title")||"",e=(t.find(".astra-repeater-fields").attr("data-id"),'<div class="astra-repeater-field">');e+='\t<div class="actions">',e+='\t<span class="index">'+a+"</span>",e+='\t\t<span class="dashicons dashicons-move"></span>',e+='\t<span class="title">'+i+"</span>",e+='\t\t<span class="dashicons dashicons-admin-page clone"></span>',e+='\t\t<span class="dashicons dashicons-trash remove"></span>',e+='\t\t<span class="dashicons toggle-arrow"></span>',e+="\t</div>",e+='\t<div class="markukp">',e+=s=s.replace("][][","]["+a+"]["),e+="\t</div>",e+="</div>",t.find(".astra-repeater-sortable").append(e),AstraWidgets._set_repeater_names()},_set_repeater_names:function(){l(".astra-repeater").each(function(e,t){var r=l(t).find(".astra-repeater-fields").attr("data-id")||"";l(t).find(".astra-repeater-sortable").find(".astra-repeater-field").each(function(s,i){l(i).find(":input").each(function(e,t){var a=l(t).attr("data-field-id")||"",a=r+"["+s+"]["+a+"]";l(i).find(".index").text(s),l(t).attr("name",a)})})})},_repeater_toggle_open:function(e){e.preventDefault(),(e.target===this||l(e.target).hasClass("title")||l(e.target).hasClass("dashicons-move"))&&(l(this).parents(".astra-repeater-field").toggleClass("field-open"),l(this).parents(".astra-repeater-field").find(".markukp").slideToggle())},_repeater_clone:function(e){e.preventDefault();var t=l(this),e=t.closest(".astra-repeater");e.find(".astra-repeater-fields").html();l(t).closest(".astra-repeater-field").clone().insertAfter(t.closest(".astra-repeater-field")),l(".astra-repeater-sortable").sortable(),e.find("input").trigger("change"),AstraWidgets._set_repeater_names()},_repeater_remove:function(e){e.preventDefault();var t=l(this),a=t.closest(".astra-repeater"),s=t.parent().find(".title").html(),e="",e=0<s.length?s:"this field";confirm("Are you sure you want to delete "+e+"?")&&t.closest(".astra-repeater-field").remove(),AstraWidgets._set_repeater_names(),a.find("input").trigger("change")},_init_repeater:function(){l(".astra-repeater-sortable").sortable({cursor:"move",stop:function(e,t){AstraWidgets._set_repeater_names(),t.item.find("input").trigger("change")}}),AstraWidgets._set_repeater_names(),l(".astra-repeater-field").length&&l(".astra-repeater-field").each(function(e,t){var a=l(t).find('[data-field-id="title"]').val()||"",s=l(t).find('[data-field-id="icon"]').val()||"",a=AstraWidgets._get_sub_string(a);l(t).find(".title").text(a),"yes"===l(t).find(".selected-icon").data("icon-visible")&&l(t).find(".title").addClass(s)})}},l(function(){AstraWidgets.init()})}(jQuery);
assets/js/unminified/astra-widgets-backend.js CHANGED
@@ -20,7 +20,7 @@
20
  }
21
  });
22
  },
23
-
24
  /**
25
  * Binds events
26
  */
@@ -74,8 +74,8 @@
74
  if( $(this).hasClass( 'open' ) ) {
75
  $(this).parents('.astra-widget-icon-selector').find('.astra-icons-list-wrap').append( font_awesome_markup );
76
  } else {
77
- $(this).parents('.astra-widget-icon-selector').find('.astra-widget-icons-list').remove();
78
- $(this).parents('.astra-widget-icon-selector').find('.search-icon').remove();
79
  }
80
 
81
  },
@@ -98,7 +98,7 @@
98
  // current_icon_preview.removeClass();
99
 
100
  current_icon_preview.html( icon_selector_svg );
101
-
102
  parent.find('.astra-widget-icons-list .astra-widget-icon').removeClass( 'selected' );
103
  icon_selector.addClass( 'selected' );
104
 
@@ -146,7 +146,7 @@
146
 
147
  /**
148
  * Repeater remove image field.
149
- *
150
  * @param {[type]} event [description]
151
  * @return {[type]} [description]
152
  */
@@ -167,7 +167,7 @@
167
 
168
  /**
169
  * Repeater add image field
170
- *
171
  * @param {[type]} event [description]
172
  * @return {[type]} [description]
173
  */
@@ -228,7 +228,7 @@
228
 
229
  /**
230
  * Return substring.
231
- *
232
  * @param {[type]} e [description]
233
  * @return {[type]} [description]
234
  */
@@ -246,7 +246,7 @@
246
 
247
  /**
248
  * Repeater set title.
249
- *
250
  * @param {[type]} e [description]
251
  * @return {[type]} [description]
252
  */
@@ -259,7 +259,7 @@
259
 
260
  /**
261
  * Repeater reinit
262
- *
263
  * @param {[type]} e [description]
264
  * @return {[type]} [description]
265
  */
@@ -269,7 +269,7 @@
269
 
270
  /**
271
  * Repeater add new
272
- *
273
  * @param {[type]} e [description]
274
  */
275
  _add_new: function( e ) {
@@ -318,7 +318,7 @@
318
 
319
  // Show index.
320
  $(repeaterFieldEl).find('.index').text( repeaterFieldIndex );
321
-
322
  // Set new name.
323
  $(currentEl).attr('name', field_name);
324
  });
@@ -328,7 +328,7 @@
328
 
329
  /**
330
  * Repeater Toggle Open
331
- *
332
  * @param {[type]} e [description]
333
  * @return {[type]} [description]
334
  */
@@ -344,7 +344,7 @@
344
 
345
  /**
346
  * Repeater clone
347
- *
348
  * @param {[type]} e [description]
349
  * @return {[type]} [description]
350
  */
@@ -369,13 +369,13 @@
369
 
370
  /**
371
  * Repeater remove
372
- *
373
  * @param {[type]} e [description]
374
  * @return {[type]} [description]
375
  */
376
  _repeater_remove: function( e ) {
377
  e.preventDefault();
378
-
379
  var $item = $( this );
380
  var parent = $item.closest('.astra-repeater');
381
  var title = $item.parent().find('.title').html();
@@ -386,11 +386,11 @@
386
  } else {
387
  str = 'this field';
388
  }
389
-
390
  if( confirm( 'Are you sure you want to delete ' + str + '?' ) ) {
391
  $item.closest('.astra-repeater-field').remove();
392
  }
393
-
394
  // Set repeater fields names.
395
  AstraWidgets._set_repeater_names();
396
 
@@ -400,7 +400,7 @@
400
 
401
  /**
402
  * Repeater init
403
- *
404
  * @return {[type]} [description]
405
  */
406
  _init_repeater: function()
@@ -423,11 +423,11 @@
423
  $('.astra-repeater-field').each(function(index, el) {
424
  var title = $( el ).find('[data-field-id="title"]' ).val() || '';
425
  var icon = $( el ).find('[data-field-id="icon"]' ).val() || '';
426
-
427
  title = AstraWidgets._get_sub_string( title );
428
-
429
  $(el).find('.title').text( title );
430
-
431
  if( $(el).find('.selected-icon').data('icon-visible') === 'yes' ) {
432
  $(el).find('.title').addClass( icon );
433
  }
@@ -444,4 +444,4 @@
444
  AstraWidgets.init();
445
  });
446
 
447
- })(jQuery);
20
  }
21
  });
22
  },
23
+
24
  /**
25
  * Binds events
26
  */
74
  if( $(this).hasClass( 'open' ) ) {
75
  $(this).parents('.astra-widget-icon-selector').find('.astra-icons-list-wrap').append( font_awesome_markup );
76
  } else {
77
+ $(this).parents('.astra-widget-icon-selector').find('.astra-widget-icons-list').remove();
78
+ $(this).parents('.astra-widget-icon-selector').find('.search-icon').remove();
79
  }
80
 
81
  },
98
  // current_icon_preview.removeClass();
99
 
100
  current_icon_preview.html( icon_selector_svg );
101
+
102
  parent.find('.astra-widget-icons-list .astra-widget-icon').removeClass( 'selected' );
103
  icon_selector.addClass( 'selected' );
104
 
146
 
147
  /**
148
  * Repeater remove image field.
149
+ *
150
  * @param {[type]} event [description]
151
  * @return {[type]} [description]
152
  */
167
 
168
  /**
169
  * Repeater add image field
170
+ *
171
  * @param {[type]} event [description]
172
  * @return {[type]} [description]
173
  */
228
 
229
  /**
230
  * Return substring.
231
+ *
232
  * @param {[type]} e [description]
233
  * @return {[type]} [description]
234
  */
246
 
247
  /**
248
  * Repeater set title.
249
+ *
250
  * @param {[type]} e [description]
251
  * @return {[type]} [description]
252
  */
259
 
260
  /**
261
  * Repeater reinit
262
+ *
263
  * @param {[type]} e [description]
264
  * @return {[type]} [description]
265
  */
269
 
270
  /**
271
  * Repeater add new
272
+ *
273
  * @param {[type]} e [description]
274
  */
275
  _add_new: function( e ) {
318
 
319
  // Show index.
320
  $(repeaterFieldEl).find('.index').text( repeaterFieldIndex );
321
+
322
  // Set new name.
323
  $(currentEl).attr('name', field_name);
324
  });
328
 
329
  /**
330
  * Repeater Toggle Open
331
+ *
332
  * @param {[type]} e [description]
333
  * @return {[type]} [description]
334
  */
344
 
345
  /**
346
  * Repeater clone
347
+ *
348
  * @param {[type]} e [description]
349
  * @return {[type]} [description]
350
  */
369
 
370
  /**
371
  * Repeater remove
372
+ *
373
  * @param {[type]} e [description]
374
  * @return {[type]} [description]
375
  */
376
  _repeater_remove: function( e ) {
377
  e.preventDefault();
378
+
379
  var $item = $( this );
380
  var parent = $item.closest('.astra-repeater');
381
  var title = $item.parent().find('.title').html();
386
  } else {
387
  str = 'this field';
388
  }
389
+
390
  if( confirm( 'Are you sure you want to delete ' + str + '?' ) ) {
391
  $item.closest('.astra-repeater-field').remove();
392
  }
393
+
394
  // Set repeater fields names.
395
  AstraWidgets._set_repeater_names();
396
 
400
 
401
  /**
402
  * Repeater init
403
+ *
404
  * @return {[type]} [description]
405
  */
406
  _init_repeater: function()
423
  $('.astra-repeater-field').each(function(index, el) {
424
  var title = $( el ).find('[data-field-id="title"]' ).val() || '';
425
  var icon = $( el ).find('[data-field-id="icon"]' ).val() || '';
426
+
427
  title = AstraWidgets._get_sub_string( title );
428
+
429
  $(el).find('.title').text( title );
430
+
431
  if( $(el).find('.selected-icon').data('icon-visible') === 'yes' ) {
432
  $(el).find('.title').addClass( icon );
433
  }
444
  AstraWidgets.init();
445
  });
446
 
447
+ })(jQuery);
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.8
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.8' );
29
  define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
30
 
31
  require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
@@ -35,7 +35,7 @@ if ( is_admin() ) {
35
  /**
36
  * Admin Notice Library Settings
37
  */
38
- require_once ASTRA_WIDGETS_DIR . 'lib/notices/class-astra-notices.php';
39
  }
40
 
41
  // BSF Analytics library.
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.9
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.9' );
29
  define( 'ASTRA_WIDGETS_TEMPLATE_DEBUG_MODE', false );
30
 
31
  require_once ASTRA_WIDGETS_DIR . 'classes/class-astra-widgets.php';
35
  /**
36
  * Admin Notice Library Settings
37
  */
38
+ require_once ASTRA_WIDGETS_DIR . 'lib/astra-notices/class-astra-notices.php';
39
  }
40
 
41
  // BSF Analytics library.
classes/class-astra-widgets-helper.php CHANGED
@@ -402,7 +402,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
402
  <?php } ?>
403
 
404
  <div class="astra-widget-icon-selector-actions">
405
- <div class="astra-select-icon button">
406
  <div class="astra-selected-icon">
407
  <?php if ( ! empty( $decoded_icon_data->viewbox ) && ! empty( $decoded_icon_data->path ) ) { ?>
408
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="<?php echo ( isset( $decoded_icon_data->viewbox ) ) ? esc_attr( $decoded_icon_data->viewbox ) : ''; ?>"><path d="<?php echo ( isset( $decoded_icon_data->path ) ) ? esc_attr( $decoded_icon_data->path ) : ''; ?>"></path></svg>
@@ -438,7 +438,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
438
  ?>
439
  <div class="astra-widget-field astra-widget-field-checkbox">
440
  <input class="checkbox" type="checkbox"
441
- <?php checked( $value['default'] ); ?>
442
  name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" />
443
  <label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
444
  </div>
@@ -481,7 +481,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
481
  <label for="<?php echo esc_attr( $field_id ); ?>">
482
  <?php echo esc_html( $value['name'] ); ?>
483
  </label>
484
- <input class="widefat" type="text"
485
  name="<?php echo esc_attr( $field_name ); ?>"
486
  value="<?php echo esc_attr( $value['default'] ); ?>"
487
  data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
@@ -524,7 +524,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
524
  <?php } ?>
525
  </div>
526
  <input
527
- class="astra-field-image-preview-id"
528
  name="<?php echo esc_attr( $field_name ); ?>"
529
  type="hidden"
530
  value="<?php echo esc_attr( $value['default'] ); ?>"
@@ -624,7 +624,7 @@ if ( ! class_exists( 'Astra_Widgets_Helper' ) ) :
624
 
625
  case 'number':
626
  ?>
627
- <div class="astra-widget-field astra-widget-field-number astra-widget-field-<?php echo esc_attr( $value['id'] ); ?> <?php echo esc_attr( $class ); ?> <?php echo isset( $value['unit'] ) ? 'astra-widgets-number-unit' : ''; ?> <?php echo( isset( $value['unit'] ) ) ? ' astra-widget-unit-field' : ''; ?>">
628
  <label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
629
  <input class="widefat" type="number" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/><span class="astra-widgets-unit"> <?php echo ( isset( $value['unit'] ) ) ? esc_html( $value['unit'] ) : ''; ?> </span>
630
  </div>
402
  <?php } ?>
403
 
404
  <div class="astra-widget-icon-selector-actions">
405
+ <div class="astra-select-icon button">
406
  <div class="astra-selected-icon">
407
  <?php if ( ! empty( $decoded_icon_data->viewbox ) && ! empty( $decoded_icon_data->path ) ) { ?>
408
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="<?php echo ( isset( $decoded_icon_data->viewbox ) ) ? esc_attr( $decoded_icon_data->viewbox ) : ''; ?>"><path d="<?php echo ( isset( $decoded_icon_data->path ) ) ? esc_attr( $decoded_icon_data->path ) : ''; ?>"></path></svg>
438
  ?>
439
  <div class="astra-widget-field astra-widget-field-checkbox">
440
  <input class="checkbox" type="checkbox"
441
+ <?php checked( $value['default'] ); ?>
442
  name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" />
443
  <label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
444
  </div>
481
  <label for="<?php echo esc_attr( $field_id ); ?>">
482
  <?php echo esc_html( $value['name'] ); ?>
483
  </label>
484
+ <input class="widefat" type="text"
485
  name="<?php echo esc_attr( $field_name ); ?>"
486
  value="<?php echo esc_attr( $value['default'] ); ?>"
487
  data-field-id="<?php echo esc_attr( $value['id'] ); ?>"
524
  <?php } ?>
525
  </div>
526
  <input
527
+ class="astra-field-image-preview-id"
528
  name="<?php echo esc_attr( $field_name ); ?>"
529
  type="hidden"
530
  value="<?php echo esc_attr( $value['default'] ); ?>"
624
 
625
  case 'number':
626
  ?>
627
+ <div class="astra-widget-field astra-widget-field-number astra-widget-field-<?php echo esc_attr( $value['id'] ); ?> <?php echo esc_attr( $class ); ?> <?php echo isset( $value['unit'] ) ? 'astra-widgets-number-unit' : ''; ?> <?php echo( isset( $value['unit'] ) ) ? ' astra-widget-unit-field' : ''; ?>">
628
  <label for="<?php echo esc_attr( $self->get_field_id( $value['id'] ) ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
629
  <input class="widefat" type="number" name="<?php echo esc_attr( $self->get_field_name( $value['id'] ) ); ?>" value="<?php echo esc_attr( $value['default'] ); ?>"/><span class="astra-widgets-unit"> <?php echo ( isset( $value['unit'] ) ) ? esc_html( $value['unit'] ) : ''; ?> </span>
630
  </div>
classes/widgets/class-astra-widget-social-profiles.php CHANGED
@@ -196,7 +196,7 @@ if ( ! class_exists( 'Astra_Widget_Social_Profiles' ) ) :
196
  if ( ! empty( $list ) ) {
197
  foreach ( $list as $index => $list ) {
198
  $list_data = json_decode( $list['icon'] );
199
- $uniqueue_icon[] = $list_data->name;
200
  }
201
  }
202
  if ( ! empty( $uniqueue_icon ) ) {
196
  if ( ! empty( $list ) ) {
197
  foreach ( $list as $index => $list ) {
198
  $list_data = json_decode( $list['icon'] );
199
+ $uniqueue_icon[] = isset( $list_data->name ) ? $list_data->name : '';
200
  }
201
  }
202
  if ( ! empty( $uniqueue_icon ) ) {
lib/{notices → astra-notices}/class-astra-notices.php RENAMED
@@ -1,18 +1,11 @@
1
  <?php
2
  /**
3
- * Astra Sites Notices
4
  *
5
- * Closing notice on click on `astra-notice-close` class.
6
  *
7
- * If notice has the data attribute `data-repeat-notice-after="%2$s"` then notice close for that SPECIFIC TIME.
8
- * If notice has NO data attribute `data-repeat-notice-after="%2$s"` then notice close for the CURRENT USER FOREVER.
9
- *
10
- * > Create custom close notice link in the notice markup. E.g.
11
- * `<a href="#" data-repeat-notice-after="<?php echo MONTH_IN_SECONDS; ?>" class="astra-notice-close">`
12
- * It close the notice for 30 days.
13
- *
14
- * @package Astra Sites
15
- * @since 1.2.4
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
@@ -24,7 +17,7 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
24
  /**
25
  * Astra_Notices
26
  *
27
- * @since 1.2.4
28
  */
29
  class Astra_Notices {
30
 
@@ -33,16 +26,16 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
33
  *
34
  * @access private
35
  * @var array Notices.
36
- * @since 1.2.4
37
  */
38
- private static $version = '1.1.5';
39
 
40
  /**
41
  * Notices
42
  *
43
  * @access private
44
  * @var array Notices.
45
- * @since 1.2.4
46
  */
47
  private static $notices = array();
48
 
@@ -51,14 +44,14 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
51
  *
52
  * @access private
53
  * @var object Class object.
54
- * @since 1.2.4
55
  */
56
  private static $instance;
57
 
58
  /**
59
  * Initiator
60
  *
61
- * @since 1.2.4
62
  * @return object initialized object of class.
63
  */
64
  public static function get_instance() {
@@ -71,7 +64,7 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
71
  /**
72
  * Constructor
73
  *
74
- * @since 1.2.4
75
  */
76
  public function __construct() {
77
  add_action( 'admin_notices', array( $this, 'show_notices' ), 30 );
@@ -83,10 +76,10 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
83
  /**
84
  * Filters and Returns a list of allowed tags and attributes for a given context.
85
  *
86
- * @param Array $allowedposttags Array of allowed tags.
87
- * @param String $context Context type (explicit).
88
- * @since 1.2.4
89
- * @return Array
90
  */
91
  public function add_data_attributes( $allowedposttags, $context ) {
92
  $allowedposttags['a']['data-repeat-notice-after'] = true;
@@ -97,7 +90,7 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
97
  /**
98
  * Add Notice.
99
  *
100
- * @since 1.2.4
101
  * @param array $args Notice arguments.
102
  * @return void
103
  */
@@ -108,21 +101,22 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
108
  /**
109
  * Dismiss Notice.
110
  *
111
- * @since 1.2.4
112
  * @return void
113
  */
114
  public function dismiss_notice() {
115
-
116
- if ( ! apply_filters( 'astra_notices_user_cap_check', current_user_can( 'manage_options' ) ) ) {
117
- return;
118
- }
119
-
120
  $notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
121
  $repeat_notice_after = ( isset( $_POST['repeat_notice_after'] ) ) ? absint( $_POST['repeat_notice_after'] ) : '';
122
  $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
 
 
 
 
 
 
123
 
124
  if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) {
125
- wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra-widgets' ) );
126
  }
127
 
128
  // Valid inputs?
@@ -143,11 +137,11 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
143
  /**
144
  * Enqueue Scripts.
145
  *
146
- * @since 1.2.4
147
  * @return void
148
  */
149
  public function enqueue_scripts() {
150
- wp_register_script( 'astra-notices', self::_get_uri() . 'notices.js', array( 'jquery' ), self::$version, true );
151
  wp_localize_script(
152
  'astra-notices',
153
  'astraNotices',
@@ -158,32 +152,67 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
158
  }
159
 
160
  /**
161
- * Rating priority sort
 
162
  *
163
  * @since 1.5.2
164
- * @param array $array1 array one.
165
- * @param array $array2 array two.
166
  * @return array
167
  */
168
- public function sort_notices( $array1, $array2 ) {
169
- if ( ! isset( $array1['priority'] ) ) {
170
- $array1['priority'] = 10;
171
  }
172
- if ( ! isset( $array2['priority'] ) ) {
173
- $array2['priority'] = 10;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
 
176
- return $array1['priority'] - $array2['priority'];
 
 
 
 
 
 
 
 
177
  }
178
 
179
  /**
180
- * Notice Types
181
  *
182
- * @since 1.2.4
183
  * @return void
184
  */
185
  public function show_notices() {
186
-
187
  $defaults = array(
188
  'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`.
189
  'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error].
@@ -195,20 +224,22 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
195
  'priority' => 10, // Priority of the notice.
196
  'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices.
197
  'is_dismissible' => true,
 
198
  );
199
 
200
  // Count for the notices that are rendered.
201
  $notices_displayed = 0;
 
202
 
203
- // sort the array with priority.
204
- usort( self::$notices, array( $this, 'sort_notices' ) );
205
-
206
- foreach ( self::$notices as $key => $notice ) {
207
-
208
  $notice = wp_parse_args( $notice, $defaults );
209
 
210
- $notice['id'] = self::get_notice_id( $notice, $key );
 
 
 
211
 
 
212
  $notice['classes'] = self::get_wrap_classes( $notice );
213
 
214
  // Notices visible after transient expire.
@@ -230,14 +261,13 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
230
  }
231
 
232
  /**
233
- * Markup Notice.
234
  *
235
- * @since 1.2.4
236
  * @param array $notice Notice markup.
237
  * @return void
238
  */
239
  public static function markup( $notice = array() ) {
240
-
241
  wp_enqueue_script( 'astra-notices' );
242
 
243
  do_action( 'astra_notice_before_markup' );
@@ -256,13 +286,12 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
256
  do_action( "astra_notice_after_markup_{$notice['id']}" );
257
 
258
  do_action( 'astra_notice_after_markup' );
259
-
260
  }
261
 
262
  /**
263
- * Notice classes.
264
  *
265
- * @since 1.2.4
266
  *
267
  * @param array $notice Notice arguments.
268
  * @return array Notice wrapper classes.
@@ -283,13 +312,13 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
283
  }
284
 
285
  /**
286
- * Get Notice ID.
287
  *
288
- * @since 1.2.4
289
  *
290
  * @param array $notice Notice arguments.
291
- * @param int $key Notice array index.
292
- * @return string Notice id.
293
  */
294
  private static function get_notice_id( $notice, $key ) {
295
  if ( isset( $notice['id'] ) && ! empty( $notice['id'] ) ) {
@@ -300,9 +329,9 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
300
  }
301
 
302
  /**
303
- * Is notice expired?
304
  *
305
- * @since 1.2.4
306
  *
307
  * @param array $notice Notice arguments.
308
  * @return boolean
@@ -335,24 +364,19 @@ if ( ! class_exists( 'Astra_Notices' ) ) :
335
  }
336
 
337
  /**
338
- * Get URI
339
  *
340
  * @return mixed URL.
341
  */
342
- public static function _get_uri() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
343
- $path = wp_normalize_path( dirname( __FILE__ ) );
344
- $theme_dir = wp_normalize_path( get_template_directory() );
345
- $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
346
 
347
  if ( strpos( $path, $theme_dir ) !== false ) {
348
  return trailingslashit( get_template_directory_uri() . str_replace( $theme_dir, '', $path ) );
349
- } elseif ( strpos( $path, $plugin_dir ) !== false ) {
350
- return plugin_dir_url( __FILE__ );
351
- } elseif ( strpos( $path, dirname( plugin_basename( __FILE__ ) ) ) !== false ) {
352
  return plugin_dir_url( __FILE__ );
353
  }
354
-
355
- return; // phpcs:ignore Squiz.PHP.NonExecutableCode.ReturnNotRequired
356
  }
357
 
358
  }
1
  <?php
2
  /**
3
+ * Astra Notices
4
  *
5
+ * An easy to use PHP Library to add dismissible admin notices in the WordPress admin.
6
  *
7
+ * @package Astra Notices
8
+ * @since 1.0.0
 
 
 
 
 
 
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) {
17
  /**
18
  * Astra_Notices
19
  *
20
+ * @since 1.0.0
21
  */
22
  class Astra_Notices {
23
 
26
  *
27
  * @access private
28
  * @var array Notices.
29
+ * @since 1.0.0
30
  */
31
+ private static $version = '1.1.8';
32
 
33
  /**
34
  * Notices
35
  *
36
  * @access private
37
  * @var array Notices.
38
+ * @since 1.0.0
39
  */
40
  private static $notices = array();
41
 
44
  *
45
  * @access private
46
  * @var object Class object.
47
+ * @since 1.0.0
48
  */
49
  private static $instance;
50
 
51
  /**
52
  * Initiator
53
  *
54
+ * @since 1.0.0
55
  * @return object initialized object of class.
56
  */
57
  public static function get_instance() {
64
  /**
65
  * Constructor
66
  *
67
+ * @since 1.0.0
68
  */
69
  public function __construct() {
70
  add_action( 'admin_notices', array( $this, 'show_notices' ), 30 );
76
  /**
77
  * Filters and Returns a list of allowed tags and attributes for a given context.
78
  *
79
+ * @param array $allowedposttags array of allowed tags.
80
+ * @param string $context Context type (explicit).
81
+ * @since 1.0.0
82
+ * @return array
83
  */
84
  public function add_data_attributes( $allowedposttags, $context ) {
85
  $allowedposttags['a']['data-repeat-notice-after'] = true;
90
  /**
91
  * Add Notice.
92
  *
93
+ * @since 1.0.0
94
  * @param array $args Notice arguments.
95
  * @return void
96
  */
101
  /**
102
  * Dismiss Notice.
103
  *
104
+ * @since 1.0.0
105
  * @return void
106
  */
107
  public function dismiss_notice() {
 
 
 
 
 
108
  $notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
109
  $repeat_notice_after = ( isset( $_POST['repeat_notice_after'] ) ) ? absint( $_POST['repeat_notice_after'] ) : '';
110
  $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
111
+ $notice = $this->get_notice_by_id( $notice_id );
112
+ $capability = isset( $notice['capability'] ) ? $notice['capability'] : 'manage_options';
113
+
114
+ if ( ! apply_filters( 'astra_notices_user_cap_check', current_user_can( $capability ) ) ) {
115
+ return;
116
+ }
117
 
118
  if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) {
119
+ wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.' ) );
120
  }
121
 
122
  // Valid inputs?
137
  /**
138
  * Enqueue Scripts.
139
  *
140
+ * @since 1.0.0
141
  * @return void
142
  */
143
  public function enqueue_scripts() {
144
+ wp_register_script( 'astra-notices', self::get_url() . 'notices.js', array( 'jquery' ), self::$version, true );
145
  wp_localize_script(
146
  'astra-notices',
147
  'astraNotices',
152
  }
153
 
154
  /**
155
+ * Sort the notices based on the given priority of the notice.
156
+ * This function is called from usort()
157
  *
158
  * @since 1.5.2
159
+ * @param array $notice_1 First notice.
160
+ * @param array $notice_2 Second Notice.
161
  * @return array
162
  */
163
+ public function sort_notices( $notice_1, $notice_2 ) {
164
+ if ( ! isset( $notice_1['priority'] ) ) {
165
+ $notice_1['priority'] = 10;
166
  }
167
+ if ( ! isset( $notice_2['priority'] ) ) {
168
+ $notice_2['priority'] = 10;
169
+ }
170
+
171
+ return $notice_1['priority'] - $notice_2['priority'];
172
+ }
173
+
174
+ /**
175
+ * Get all registered notices.
176
+ * Since v1.1.8 it is recommended to register the notices on
177
+ *
178
+ * @return array|null
179
+ */
180
+ private function get_notices() {
181
+ usort( self::$notices, array( $this, 'sort_notices' ) );
182
+
183
+ return self::$notices;
184
+ }
185
+
186
+ /**
187
+ * Get notice by notice_id
188
+ *
189
+ * @param string $notice_id Notice id.
190
+ *
191
+ * @return array notice based on the notice id.
192
+ */
193
+ private function get_notice_by_id( $notice_id ) {
194
+ if ( empty( $notice_id ) ) {
195
+ return array();
196
  }
197
 
198
+ $notices = $this->get_notices();
199
+ $notice = wp_list_filter(
200
+ $notices,
201
+ array(
202
+ 'id' => $notice_id,
203
+ )
204
+ );
205
+
206
+ return ! empty( $notice ) ? $notice[0] : array();
207
  }
208
 
209
  /**
210
+ * Display the notices in the WordPress admin.
211
  *
212
+ * @since 1.0.0
213
  * @return void
214
  */
215
  public function show_notices() {
 
216
  $defaults = array(
217
  'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`.
218
  'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error].
224
  'priority' => 10, // Priority of the notice.
225
  'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices.
226
  'is_dismissible' => true,
227
+ 'capability' => 'manage_options', // User capability - This capability is required for the current user to see this notice.
228
  );
229
 
230
  // Count for the notices that are rendered.
231
  $notices_displayed = 0;
232
+ $notices = $this->get_notices();
233
 
234
+ foreach ( $notices as $key => $notice ) {
 
 
 
 
235
  $notice = wp_parse_args( $notice, $defaults );
236
 
237
+ // Show notices only for users with `manage_options` cap.
238
+ if ( ! current_user_can( $notice['capability'] ) ) {
239
+ continue;
240
+ }
241
 
242
+ $notice['id'] = self::get_notice_id( $notice, $key );
243
  $notice['classes'] = self::get_wrap_classes( $notice );
244
 
245
  // Notices visible after transient expire.
261
  }
262
 
263
  /**
264
+ * Render a notice.
265
  *
266
+ * @since 1.0.0
267
  * @param array $notice Notice markup.
268
  * @return void
269
  */
270
  public static function markup( $notice = array() ) {
 
271
  wp_enqueue_script( 'astra-notices' );
272
 
273
  do_action( 'astra_notice_before_markup' );
286
  do_action( "astra_notice_after_markup_{$notice['id']}" );
287
 
288
  do_action( 'astra_notice_after_markup' );
 
289
  }
290
 
291
  /**
292
+ * Get wrapper classes for a notice.
293
  *
294
+ * @since 1.0.0
295
  *
296
  * @param array $notice Notice arguments.
297
  * @return array Notice wrapper classes.
312
  }
313
 
314
  /**
315
+ * Get HTML ID for a given notice.
316
  *
317
+ * @since 1.0.0
318
  *
319
  * @param array $notice Notice arguments.
320
+ * @param int $key Notice array index.
321
+ * @return string HTML if for the notice.
322
  */
323
  private static function get_notice_id( $notice, $key ) {
324
  if ( isset( $notice['id'] ) && ! empty( $notice['id'] ) ) {
329
  }
330
 
331
  /**
332
+ * Check if the notice is expires.
333
  *
334
+ * @since 1.0.0
335
  *
336
  * @param array $notice Notice arguments.
337
  * @return boolean
364
  }
365
 
366
  /**
367
+ * Get base URL for the astra-notices.
368
  *
369
  * @return mixed URL.
370
  */
371
+ public static function get_url() {
372
+ $path = wp_normalize_path( dirname( __FILE__ ) );
373
+ $theme_dir = wp_normalize_path( get_template_directory() );
 
374
 
375
  if ( strpos( $path, $theme_dir ) !== false ) {
376
  return trailingslashit( get_template_directory_uri() . str_replace( $theme_dir, '', $path ) );
377
+ } else {
 
 
378
  return plugin_dir_url( __FILE__ );
379
  }
 
 
380
  }
381
 
382
  }
lib/{notices → astra-notices}/notices.js RENAMED
@@ -4,12 +4,12 @@
4
  * @package Astra
5
  */
6
 
7
- ( function( $ ) {
8
 
9
  /**
10
  * Helper class for the main Customizer interface.
11
  *
12
- * @since 1.2.4
13
  * @class ASTCustomizer
14
  */
15
  AstraNotices = {
@@ -17,7 +17,7 @@
17
  /**
18
  * Initializes our custom logic for the Customizer.
19
  *
20
- * @since 1.2.4
21
  * @method init
22
  */
23
  init: function()
@@ -28,7 +28,7 @@
28
  /**
29
  * Binds events for the Astra Portfolio.
30
  *
31
- * @since 1.2.4
32
  * @access private
33
  * @method _bind
34
  */
@@ -70,7 +70,7 @@
70
  },
71
 
72
  _ajax: function( notice_id, repeat_notice_after ) {
73
-
74
  if( '' === notice_id ) {
75
  return;
76
  }
@@ -92,4 +92,4 @@
92
  $( function() {
93
  AstraNotices.init();
94
  } );
95
- } )( jQuery );
4
  * @package Astra
5
  */
6
 
7
+ ( function( $ ) {
8
 
9
  /**
10
  * Helper class for the main Customizer interface.
11
  *
12
+ * @since 1.0.0
13
  * @class ASTCustomizer
14
  */
15
  AstraNotices = {
17
  /**
18
  * Initializes our custom logic for the Customizer.
19
  *
20
+ * @since 1.0.0
21
  * @method init
22
  */
23
  init: function()
28
  /**
29
  * Binds events for the Astra Portfolio.
30
  *
31
+ * @since 1.0.0
32
  * @access private
33
  * @method _bind
34
  */
70
  },
71
 
72
  _ajax: function( notice_id, repeat_notice_after ) {
73
+
74
  if( '' === notice_id ) {
75
  return;
76
  }
92
  $( function() {
93
  AstraNotices.init();
94
  } );
95
+ } )( jQuery );
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.7
7
  Requires PHP: 5.2
8
- Stable tag: 1.2.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -76,6 +76,10 @@ In your WordPress admin dashboard go to Appearance -> Widgets, drag the Astra :
76
 
77
  == Changelog ==
78
 
 
 
 
 
79
  = 1.2.8 =
80
  - Fix: Handled PHP notice in customizer with Astra Address Widget.
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.9
7
  Requires PHP: 5.2
8
+ Stable tag: 1.2.9
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.9 =
80
+ - Improvement: WordPress 5.8 compatibility.
81
+ - Fix: Handled PHP notice in customizer with Astra Social Profiles Widget.
82
+
83
  = 1.2.8 =
84
  - Fix: Handled PHP notice in customizer with Astra Address Widget.
85