Shortcodes Ultimate - Version 5.12.1

Version Description

Download this release

Release Info

Developer gn_themes
Plugin Icon 128x128 Shortcodes Ultimate
Version 5.12.1
Comparing to
See all releases

Code changes from version 5.12.0 to 5.12.1

changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  ### 5.11.2
2
 
3
  **Fixed**
1
+ ### 5.12.0
2
+
3
+ **What's new**
4
+
5
+ - New options `class` and `class_single` for the *Posts* shortcode. Use new options to specify custom CSS classes for the container and for a single post item respectively.
6
+ - Tested compatibility with WordPress 5.9
7
+
8
+
9
  ### 5.11.2
10
 
11
  **Fixed**
inc/core/generator.php CHANGED
@@ -249,6 +249,7 @@ class Su_Generator {
249
  <input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php echo plugins_url( '', SU_PLUGIN_FILE ); ?>" />
250
  <input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php echo su_get_shortcode_prefix(); ?>" />
251
  <input type="hidden" name="su-generator-option-skip" id="su-generator-option-skip" value="<?php echo esc_attr( get_option( 'su_option_skip', '' ) ); ?>" />
 
252
  <div id="su-generator-result" style="display:none"></div>
253
  </div>
254
  </div>
@@ -438,11 +439,21 @@ class Su_Generator {
438
  if ( empty( $_POST['name'] ) ) return;
439
  if ( empty( $_POST['settings'] ) ) return;
440
  if ( empty( $_POST['shortcode'] ) ) return;
 
 
 
 
 
 
 
 
441
  // Clean-up incoming data
442
  $id = sanitize_key( $_POST['id'] );
443
  $name = sanitize_text_field( $_POST['name'] );
444
- $settings = ( is_array( $_POST['settings'] ) ) ? stripslashes_deep( $_POST['settings'] ) : array();
445
  $shortcode = sanitize_key( $_POST['shortcode'] );
 
 
 
446
  // Prepare option name
447
  $option = 'su_presets_' . $shortcode;
448
  // Get the existing presets
@@ -467,6 +478,14 @@ class Su_Generator {
467
  // Check incoming data
468
  if ( empty( $_POST['id'] ) ) return;
469
  if ( empty( $_POST['shortcode'] ) ) return;
 
 
 
 
 
 
 
 
470
  // Clean-up incoming data
471
  $id = sanitize_key( $_POST['id'] );
472
  $shortcode = sanitize_key( $_POST['shortcode'] );
@@ -489,6 +508,14 @@ class Su_Generator {
489
  // Check incoming data
490
  if ( empty( $_GET['id'] ) ) return;
491
  if ( empty( $_GET['shortcode'] ) ) return;
 
 
 
 
 
 
 
 
492
  // Clean-up incoming data
493
  $id = sanitize_key( $_GET['id'] );
494
  $shortcode = sanitize_key( $_GET['shortcode'] );
249
  <input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php echo plugins_url( '', SU_PLUGIN_FILE ); ?>" />
250
  <input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php echo su_get_shortcode_prefix(); ?>" />
251
  <input type="hidden" name="su-generator-option-skip" id="su-generator-option-skip" value="<?php echo esc_attr( get_option( 'su_option_skip', '' ) ); ?>" />
252
+ <?php wp_nonce_field( 'su_generator_preset', 'su_generator_presets_nonce' ); ?>
253
  <div id="su-generator-result" style="display:none"></div>
254
  </div>
255
  </div>
439
  if ( empty( $_POST['name'] ) ) return;
440
  if ( empty( $_POST['settings'] ) ) return;
441
  if ( empty( $_POST['shortcode'] ) ) return;
442
+ // Check Nonce
443
+ if (
444
+ empty( $_POST['nonce'] ) ||
445
+ ! is_string( $_POST['nonce'] ) ||
446
+ ! wp_verify_nonce( $_POST['nonce'], 'su_generator_preset' )
447
+ ) {
448
+ return;
449
+ }
450
  // Clean-up incoming data
451
  $id = sanitize_key( $_POST['id'] );
452
  $name = sanitize_text_field( $_POST['name'] );
 
453
  $shortcode = sanitize_key( $_POST['shortcode'] );
454
+ // Validate and sanitize settings
455
+ $settings = is_array( $_POST['settings'] ) ? stripslashes_deep( $_POST['settings'] ) : array();
456
+ $settings = array_map( 'wp_kses_post', $settings );
457
  // Prepare option name
458
  $option = 'su_presets_' . $shortcode;
459
  // Get the existing presets
478
  // Check incoming data
479
  if ( empty( $_POST['id'] ) ) return;
480
  if ( empty( $_POST['shortcode'] ) ) return;
481
+ // Check Nonce
482
+ if (
483
+ empty( $_POST['nonce'] ) ||
484
+ ! is_string( $_POST['nonce'] ) ||
485
+ ! wp_verify_nonce( $_POST['nonce'], 'su_generator_preset' )
486
+ ) {
487
+ return;
488
+ }
489
  // Clean-up incoming data
490
  $id = sanitize_key( $_POST['id'] );
491
  $shortcode = sanitize_key( $_POST['shortcode'] );
508
  // Check incoming data
509
  if ( empty( $_GET['id'] ) ) return;
510
  if ( empty( $_GET['shortcode'] ) ) return;
511
+ // Check Nonce
512
+ if (
513
+ empty( $_POST['nonce'] ) ||
514
+ ! is_string( $_POST['nonce'] ) ||
515
+ ! wp_verify_nonce( $_POST['nonce'], 'su_generator_preset' )
516
+ ) {
517
+ return;
518
+ }
519
  // Clean-up incoming data
520
  $id = sanitize_key( $_GET['id'] );
521
  $shortcode = sanitize_key( $_GET['shortcode'] );
includes/js/generator/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function n(a,s,o){function i(t,e){if(!s[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(u)return u(t,!0);throw(r=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",r}r=s[t]={exports:{}},a[t][0].call(r.exports,function(e){return i(a[t][1][e]||e)},r,r.exports,n,a,s,o)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e<o.length;e++)i(o[e]);return i}({1:[function(e,t,r){"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var p,n,o,i,u,c,l,g,d,a,f,h;window.SUG={},window.SUG.App=(p=jQuery,n=p("#su-generator"),o=p("#su-generator-search"),i=p("#su-generator-filter"),u=i.children("a"),c=p("#su-generator-choices"),l=c.find("span"),g=p("#su-generator-settings"),d=p("#su-compatibility-mode-prefix"),a=p("#su-generator-result"),f=p("#su-generator-selected"),(h={state:{mceSelection:"",target:"",wpActiveEditor:null,context:"",insertArgs:"",preview:{timer:null,request:null}}}).el={body:p("body")},h.init=function(){var a;u.click(function(e){var t,r=p(this).data("filter");"all"===r?l.css({opacity:1}).removeClass("su-generator-choice-first"):(t=new RegExp(r,"gi"),l.css({opacity:.2}),l.each(function(){null!==p(this).data("group").match(t)&&p(this).css({opacity:1}).removeClass("su-generator-choice-first")})),e.preventDefault()}),p("#su-generator").on("click",".su-generator-home",function(e){o.val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),i.show(),c.show(),l.show(),h.state.mceSelection="",o.focus(),e.preventDefault()}),p("#su-generator").on("click",".su-generator-close",function(e){p.magnificPopup.close(),e.preventDefault()}),o.on({focus:function(){p(this).val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),c.show(),l.css({opacity:1}).removeClass("su-generator-choice-first"),i.show()},blur:function(){},keyup:function(e){var t=p(".su-generator-choice-first:first"),r=p(this).val(),n=new RegExp(r,"gi"),a=0;13===e.keyCode&&0<t.length&&(e.preventDefault(),p(this).val("").blur(),t.trigger("click")),l.css({opacity:.2}).removeClass("su-generator-choice-first"),l.each(function(){var e=p(this).data(),t=e.shortcode,e=[t,e.name,e.desc,e.group].join(" ").match(n);null!==e&&(p(this).css({opacity:1}),r===t?(l.removeClass("su-generator-choice-first"),p(this).addClass("su-generator-choice-first"),a=999):e.length>a&&(l.removeClass("su-generator-choice-first"),p(this).addClass("su-generator-choice-first"),a=e.length))}),""===r&&l.removeClass("su-generator-choice-first")}}),l.on("click",function(e){var t=p(this).data("shortcode");p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_settings",shortcode:t},beforeSend:function(){p("#su-generator-preview").hide(),c.hide(),g.addClass("su-generator-loading").show(),n.addClass("su-generator-narrow"),i.hide()},success:function(e){g.removeClass("su-generator-loading"),g.html(e);e=p("#su-generator-content");void 0!==h.state.mceSelection&&""!==h.state.mceSelection&&"hidden"!==e.attr("type")&&e.val(h.state.mceSelection),p(".su-generator-range-picker").each(function(e){var t=p(this).find("input"),r=t.attr("min"),n=t.attr("max"),a=t.attr("step");t.simpleSlider({snap:!0,step:a,range:[r,n]}),t.show(),t.on("keyup blur",function(e){t.simpleSlider("setValue",t.val())})}),p(".su-generator-select-color").each(function(e){p(this).find(".su-generator-select-color-wheel").filter(":first").farbtastic(".su-generator-select-color-value:eq("+e+")"),p(this).find(".su-generator-select-color-value").focus(function(){p(".su-generator-select-color-wheel:eq("+e+")").show()}),p(this).find(".su-generator-select-color-value").blur(function(){p(".su-generator-select-color-wheel:eq("+e+")").hide()})}),p(".su-generator-isp").each(function(){function n(){var t,e,r,n="none",a="",s=o.val();"media"===s?(t=[],i.find("span").each(function(e){t[e]=p(this).data("id")}),0<t.length&&(a=t.join(","))):"category"===s?0<(r=u.val()||[]).length&&(a=r.join(",")):"taxonomy"===s?(e=c.val()||"",r=l.val()||[],"0"!==e&&0<r.length&&(n="taxonomy: "+e+"/"+r.join(","))):n="0"===s?"none":s,g.val(n=""!==a?s+": "+a:n).trigger("change")}var t,r=p(this),o=r.find(".su-generator-isp-sources"),a=r.find(".su-generator-isp-source"),e=r.find(".su-generator-isp-add-media"),i=r.find(".su-generator-isp-images"),u=r.find(".su-generator-isp-categories"),c=r.find(".su-generator-isp-taxonomies"),l=p(".su-generator-isp-terms"),g=r.find(".su-generator-attr");o.on("change",function(e){var t=p(this).val();e.preventDefault(),a.removeClass("su-generator-isp-source-open"),-1===t.indexOf(":")&&r.find(".su-generator-isp-source-"+t).addClass("su-generator-isp-source-open"),n()}),i.on("click","span i",function(){p(this).parent("span").css("border-color","#f03").fadeOut(300,function(){p(this).remove(),n()})}),e.click(function(e){e.preventDefault(),void 0!==t&&t.close(),(t=wp.media.frames.su_media_frame_1=wp.media({title:SUGL10n.isp_media_title,library:{type:"image"},button:{text:SUGL10n.isp_media_insert},multiple:!0})).on("open",function(){p(".mfp-wrap").addClass("hidden")}),t.on("close",function(){p(".mfp-wrap").removeClass("hidden")}),t.on("select",function(){var e=t.state().get("selection").toJSON();i.find("em").remove(),p.each(e,function(e){i.append('<span data-id="'+this.id+'" title="'+this.title+'"><img src="'+this.url+'" alt="" /><i class="sui sui-times"></i></span>')}),n()}).open()}),i.sortable({revert:200,containment:r,tolerance:"pointer",stop:function(){n()}}),u.on("change",n),l.on("change",n),c.on("change",function(){var e,t=p(this).parents(".su-generator-isp-source"),r=p(this).val();l.hide().find("option").remove(),n(),"0"===r||(e=p.ajax({url:ajaxurl,type:"post",dataType:"html",data:{action:"su_generator_get_terms",tax:r,class:"su-generator-isp-terms",multiple:!0,size:10},beforeSend:function(){"object"===s(e)&&e.abort(),l.html("").attr("disabled",!0).hide(),t.addClass("su-generator-loading")},success:function(e){l.html(e).attr("disabled",!1).show(),t.removeClass("su-generator-loading")}}))})}),p(".su-generator-upload-button").each(function(){var t,e=p(this),r=p(this).parents(".su-generator-attr-container").find("input:text");e.on("click",function(e){e.preventDefault(),e.stopPropagation(),void 0!==t&&t.close(),(t=wp.media.frames.su_media_frame_2=wp.media({title:SUGL10n.upload_title,button:{text:SUGL10n.upload_insert},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();r.val(e.url).trigger("change")}),t.on("open",function(){p(".mfp-wrap").addClass("hidden")}),t.on("close",function(){p(".mfp-wrap").removeClass("hidden")}),t.open()})}),p(".su-generator-icon-picker-button").each(function(){var e=p(this),t=p(this).parents(".su-generator-attr-container"),n=t.find(".su-generator-attr"),a=t.find(".su-generator-icon-picker"),s=a.find("input:text");e.click(function(e){a.toggleClass("su-generator-icon-picker-visible"),s.val("").trigger("keyup"),a.hasClass("su-generator-icon-picker-loaded")||(p.ajax({type:"post",url:ajaxurl,data:{action:"su_generator_get_icons"},dataType:"html",beforeSend:function(){a.addClass("su-generator-loading"),a.addClass("su-generator-icon-picker-loaded")},success:function(e){a.append(e);var r=a.children("i");r.click(function(e){n.val("icon: "+p(this).attr("title")),a.removeClass("su-generator-icon-picker-visible"),n.trigger("change"),e.preventDefault()}),s.on({keyup:function(){var e=p(this).val(),t=new RegExp(e,"gi");r.hide(),r.each(function(){null!==p(this).attr("title").match(t)&&p(this).show()})},focus:function(){p(this).val(""),r.show()}}),a.removeClass("su-generator-loading")}}),e.preventDefault())})}),p(".su-generator-switch").click(function(e){var t=p(this).parent().children("input");("yes"===t.val()?t.val("no"):t.val("yes")).trigger("change"),e.preventDefault()}),p(".su-generator-switch-value").on("change",function(){var e=p(this),t=e.parent().children(".su-generator-switch"),e=e.val();"yes"===e?t.removeClass("su-generator-switch-no").addClass("su-generator-switch-yes"):"no"===e&&t.removeClass("su-generator-switch-yes").addClass("su-generator-switch-no")}),p("select#su-generator-attr-taxonomy").on("change",function(){var e=p(this).val(),t=p("select#su-generator-attr-tax_term");window.su_generator_get_terms=p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_get_terms",tax:e,noselect:!0},dataType:"html",beforeSend:function(){"object"===s(window.su_generator_get_terms)&&window.su_generator_get_terms.abort(),t.parent().addClass("su-generator-loading")},success:function(e){t.find("option").remove(),t.append(e),t.parent().removeClass("su-generator-loading")}})}),p(".su-generator-shadow-picker").each(function(e){var t=p(this),r=t.find(".su-generator-shadow-picker-field input"),n=t.find(".su-generator-sp-hoff"),a=t.find(".su-generator-sp-voff"),s=t.find(".su-generator-sp-blur"),o={cnt:t.find(".su-generator-shadow-picker-color"),value:t.find(".su-generator-shadow-picker-color-value"),wheel:t.find(".su-generator-shadow-picker-color-wheel")},i=t.find(".su-generator-attr");o.wheel.farbtastic(o.value),o.value.focus(function(){o.wheel.show()}),o.value.blur(function(){o.wheel.hide()}),r.on("change blur keyup",function(){i.val(n.val()+"px "+a.val()+"px "+s.val()+"px "+o.value.val()).trigger("change")}),i.on("keyup",function(){var e=p(this).val().split(" ");4===e.length&&(n.val(e[0].replace("px","")),a.val(e[1].replace("px","")),s.val(e[2].replace("px","")),o.value.val(e[3]),r.trigger("keyup"))})}),p(".su-generator-border-picker").each(function(e){var t=p(this),r=t.find(".su-generator-border-picker-field input, .su-generator-border-picker-field select"),n=t.find(".su-generator-bp-width"),a=t.find(".su-generator-bp-style"),s={cnt:t.find(".su-generator-border-picker-color"),value:t.find(".su-generator-border-picker-color-value"),wheel:t.find(".su-generator-border-picker-color-wheel")},o=t.find(".su-generator-attr");s.wheel.farbtastic(s.value),s.value.focus(function(){s.wheel.show()}),s.value.blur(function(){s.wheel.hide()}),r.on("change blur keyup",function(){o.val(n.val()+"px "+a.val()+" "+s.value.val()).trigger("change")}),o.on("keyup",function(){var e=p(this).val().split(" ");3===e.length&&(n.val(e[0].replace("px","")),a.val(e[1]),s.value.val(e[2]),r.trigger("keyup"))})}),g.find(".su-generator-attr").on("change keyup blur",function(){var e=p(this).parents(".su-generator-attr-container"),t=e.data("default");p(this).val()!=t?e.removeClass("su-generator-skip"):e.addClass("su-generator-skip")}),p(".su-generator-set-value").click(function(e){p(this).parents(".su-generator-attr-container").find("input").val(p(this).text()).trigger("change")}),f.val(t),p.ajax({type:"GET",url:ajaxurl,data:{action:"su_generator_get_preset",id:"last_used",shortcode:t},beforeSend:function(){},success:function(e){h.setSettings(e);e=p("#su-generator-content");void 0!==h.state.mceSelection&&""!==h.state.mceSelection&&"hidden"!==e.attr("type")&&e.val(h.state.mceSelection)},dataType:"json"})},dataType:"html"})}),p("#su-generator").on("click",".su-generator-insert",h.insertShortcode),p("#su-generator").on("click",".su-generator-toggle-preview",function(e){var t=p("#su-generator-preview");p(this).hide(),t.addClass("su-generator-loading").show(),g.find("input, textarea, select").on("change keyup blur",function(){h.updatePreview()}),h.updatePreview(!0),e.preventDefault()}),p("#su-generator").on("mouseenter click",".su-generator-presets",function(){clearTimeout(a),p(".su-gp-popup").show()}),p("#su-generator").on("mouseleave",".su-generator-presets",function(){a=window.setTimeout(function(){p(".su-gp-popup").fadeOut(200)},600)}),p("#su-generator").on("click",".su-gp-new",function(e){p(this).parents(".su-generator-presets");var t=p(".su-gp-list"),r=(new Date).getTime(),n=prompt(SUGL10n.presets_prompt_msg,SUGL10n.presets_prompt_value);""!==n&&null!==n&&(t.find("b").hide(),t.append('<span data-id="'+r+'"><em>'+n+'</em><i class="sui sui-times"></i></span>'),h.addPreset(r,n))}),p("#su-generator").on("click",".su-gp-list span",function(e){var t=p(".su-generator-presets").data("shortcode"),r=p(this).data("id"),n=p(".su-generator-insert");p(".su-gp-popup").hide(),clearTimeout(a),p.ajax({type:"GET",url:ajaxurl,data:{action:"su_generator_get_preset",id:r,shortcode:t},beforeSend:function(){n.addClass("button-primary-disabled").attr("disabled",!0)},success:function(e){n.removeClass("button-primary-disabled").attr("disabled",!1),h.setSettings(e)},dataType:"json"}),e.preventDefault(),e.stopPropagation()}),p("#su-generator").on("click",".su-gp-list i",function(e){var t=p(this).parents(".su-gp-list"),r=p(this).parent("span"),n=r.data("id");r.remove(),t.find("span").length<1&&t.find("b").show(),h.removePreset(n),e.stopPropagation(),e.preventDefault()})},h.addPreset=function(e,t){var r=p(".su-generator-presets").data("shortcode"),n=h.getSettings();p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_add_preset",id:e,name:t,shortcode:r,settings:n}})},h.removePreset=function(e){var t=p(".su-generator-presets").data("shortcode");p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_remove_preset",id:e,shortcode:t}})},h.parseSettings=function(){var e="on"===p("#su-generator-option-skip").val()?"#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr":"#su-generator-settings .su-generator-attr-container .su-generator-attr",t=f.val(),r=d.val(),n=p(e),e=p("textarea#su-generator-content"),e=e.length?e.val():"false",a=new String("");return a+="["+r+t,n.each(function(){var e=p(this),t="";null==(t=(e.is("select")?e.find("option:selected"):e).val())?t="":"array"==typeof t&&(t=t.join(",")),""!==t&&(a+=" "+p(this).attr("name")+'="'+p(this).val().toString().replace(/"/gi,"'")+'"')}),a+="]","false"!=e&&(a+=e+"[/"+r+t+"]"),a},h.getSettings=function(){f.val();var e=p("#su-generator-settings .su-generator-attr"),t=p("textarea#su-generator-content"),t=t.length?t.val():"false",a={};return e.each(function(e){var t=p(this),r="",n=t.attr("name"),r=(t.is("select")?t.find("option:selected"):t).val();a[n]=r=null==r?"":r}),a.content=t.toString(),a},h.setSettings=function(r){var e=p("#su-generator-settings .su-generator-attr"),t=p("#su-generator-content");e.each(function(){var e=p(this),t=e.attr("name");r.hasOwnProperty(t)&&(e.val(r[t]),e.trigger("keyup").trigger("change").trigger("blur"))}),r.hasOwnProperty("content")&&t.val(r.content).trigger("keyup").trigger("change").trigger("blur"),h.updatePreview()},h.updatePreview=function(e){var t=p("#su-generator-preview"),r=h.parseSettings(),n=a.text();e=e||!1,t.is(":visible")&&(r===n&&!e||(window.clearTimeout(h.state.preview.timer),h.state.preview.timer=window.setTimeout(function(){h.state.preview.request=p.ajax({type:"POST",url:ajaxurl,cache:!1,data:{action:"su_generator_preview",shortcode:r},beforeSend:function(){h.state.preview.request&&h.state.preview.request.abort(),t.addClass("su-generator-loading").html("")},success:function(e){t.html(e).removeClass("su-generator-loading")},dataType:"html"})},300),a.text(r)))},h.insert=function(e,t){var r;"string"==typeof e&&"object"===s(t)&&(h.state.context=e,r=(h.state.insertArgs=t).shortcode||"",(t={type:"inline",alignTop:!0,closeOnBgClick:!1,mainClass:"su-generator-mfp",items:{src:"#su-generator"},callbacks:{}}).callbacks.open=function(){r?l.filter('[data-shortcode="'.concat(r,'"]')).trigger("click"):window.setTimeout(function(){return o.focus()},200),"undefined"!=typeof tinyMCE&&null!=tinyMCE.activeEditor&&tinyMCE.activeEditor.hasOwnProperty("selection")&&(h.state.mceSelection=tinyMCE.activeEditor.selection.getContent({format:"text"}))},t.callbacks.close=function(){o.val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),i.show(),c.show(),l.show(),h.state.mceSelection=""},p.magnificPopup.open(t))},h.insertShortcode=function(){var e,t,r=h.parseSettings();h.addPreset("last_used",SUGL10n.last_used),p.magnificPopup.close(),a.text(r),"html"===h.state.context&&(t=document.getElementById(h.state.insertArgs.editorID),h.insertAtCaret(t,r)),"classic"===h.state.context&&window.wp.media.editor.insert(r),"block"===h.state.context&&((e=h.state.insertArgs.props).attributes.hasOwnProperty("content")?e.setAttributes({content:e.attributes.content+r}):"core/shortcode"===e.name&&(t=e.attributes.hasOwnProperty("text")?e.attributes.text:"",e.setAttributes({text:t+r})))},h.insertAtCaret=function(e,t){var r=e.selectionStart;e.value=e.value.substring(0,r)+t+e.value.substring(r),e.focus(),e.selectionStart=r+t.length},{init:h.init,insert:h.insert}),jQuery(document).ready(window.SUG.App.init)},{}]},{},[1]);
2
  //# sourceMappingURL=index.js.map
1
+ !function n(a,s,o){function i(t,e){if(!s[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(u)return u(t,!0);throw(r=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",r}r=s[t]={exports:{}},a[t][0].call(r.exports,function(e){return i(a[t][1][e]||e)},r,r.exports,n,a,s,o)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e<o.length;e++)i(o[e]);return i}({1:[function(e,t,r){"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var p,n,o,i,u,c,l,g,d,a,f,h;window.SUG={},window.SUG.App=(p=jQuery,n=p("#su-generator"),o=p("#su-generator-search"),i=p("#su-generator-filter"),u=i.children("a"),c=p("#su-generator-choices"),l=c.find("span"),g=p("#su-generator-settings"),d=p("#su-compatibility-mode-prefix"),a=p("#su-generator-result"),f=p("#su-generator-selected"),(h={state:{mceSelection:"",target:"",wpActiveEditor:null,context:"",insertArgs:"",preview:{timer:null,request:null}}}).el={body:p("body")},h.init=function(){var a;u.click(function(e){var t,r=p(this).data("filter");"all"===r?l.css({opacity:1}).removeClass("su-generator-choice-first"):(t=new RegExp(r,"gi"),l.css({opacity:.2}),l.each(function(){null!==p(this).data("group").match(t)&&p(this).css({opacity:1}).removeClass("su-generator-choice-first")})),e.preventDefault()}),p("#su-generator").on("click",".su-generator-home",function(e){o.val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),i.show(),c.show(),l.show(),h.state.mceSelection="",o.focus(),e.preventDefault()}),p("#su-generator").on("click",".su-generator-close",function(e){p.magnificPopup.close(),e.preventDefault()}),o.on({focus:function(){p(this).val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),c.show(),l.css({opacity:1}).removeClass("su-generator-choice-first"),i.show()},blur:function(){},keyup:function(e){var t=p(".su-generator-choice-first:first"),r=p(this).val(),n=new RegExp(r,"gi"),a=0;13===e.keyCode&&0<t.length&&(e.preventDefault(),p(this).val("").blur(),t.trigger("click")),l.css({opacity:.2}).removeClass("su-generator-choice-first"),l.each(function(){var e=p(this).data(),t=e.shortcode,e=[t,e.name,e.desc,e.group].join(" ").match(n);null!==e&&(p(this).css({opacity:1}),r===t?(l.removeClass("su-generator-choice-first"),p(this).addClass("su-generator-choice-first"),a=999):e.length>a&&(l.removeClass("su-generator-choice-first"),p(this).addClass("su-generator-choice-first"),a=e.length))}),""===r&&l.removeClass("su-generator-choice-first")}}),l.on("click",function(e){var t=p(this).data("shortcode");p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_settings",shortcode:t},beforeSend:function(){p("#su-generator-preview").hide(),c.hide(),g.addClass("su-generator-loading").show(),n.addClass("su-generator-narrow"),i.hide()},success:function(e){g.removeClass("su-generator-loading"),g.html(e);e=p("#su-generator-content");void 0!==h.state.mceSelection&&""!==h.state.mceSelection&&"hidden"!==e.attr("type")&&e.val(h.state.mceSelection),p(".su-generator-range-picker").each(function(e){var t=p(this).find("input"),r=t.attr("min"),n=t.attr("max"),a=t.attr("step");t.simpleSlider({snap:!0,step:a,range:[r,n]}),t.show(),t.on("keyup blur",function(e){t.simpleSlider("setValue",t.val())})}),p(".su-generator-select-color").each(function(e){p(this).find(".su-generator-select-color-wheel").filter(":first").farbtastic(".su-generator-select-color-value:eq("+e+")"),p(this).find(".su-generator-select-color-value").focus(function(){p(".su-generator-select-color-wheel:eq("+e+")").show()}),p(this).find(".su-generator-select-color-value").blur(function(){p(".su-generator-select-color-wheel:eq("+e+")").hide()})}),p(".su-generator-isp").each(function(){function n(){var t,e,r,n="none",a="",s=o.val();"media"===s?(t=[],i.find("span").each(function(e){t[e]=p(this).data("id")}),0<t.length&&(a=t.join(","))):"category"===s?0<(r=u.val()||[]).length&&(a=r.join(",")):"taxonomy"===s?(e=c.val()||"",r=l.val()||[],"0"!==e&&0<r.length&&(n="taxonomy: "+e+"/"+r.join(","))):n="0"===s?"none":s,g.val(n=""!==a?s+": "+a:n).trigger("change")}var t,r=p(this),o=r.find(".su-generator-isp-sources"),a=r.find(".su-generator-isp-source"),e=r.find(".su-generator-isp-add-media"),i=r.find(".su-generator-isp-images"),u=r.find(".su-generator-isp-categories"),c=r.find(".su-generator-isp-taxonomies"),l=p(".su-generator-isp-terms"),g=r.find(".su-generator-attr");o.on("change",function(e){var t=p(this).val();e.preventDefault(),a.removeClass("su-generator-isp-source-open"),-1===t.indexOf(":")&&r.find(".su-generator-isp-source-"+t).addClass("su-generator-isp-source-open"),n()}),i.on("click","span i",function(){p(this).parent("span").css("border-color","#f03").fadeOut(300,function(){p(this).remove(),n()})}),e.click(function(e){e.preventDefault(),void 0!==t&&t.close(),(t=wp.media.frames.su_media_frame_1=wp.media({title:SUGL10n.isp_media_title,library:{type:"image"},button:{text:SUGL10n.isp_media_insert},multiple:!0})).on("open",function(){p(".mfp-wrap").addClass("hidden")}),t.on("close",function(){p(".mfp-wrap").removeClass("hidden")}),t.on("select",function(){var e=t.state().get("selection").toJSON();i.find("em").remove(),p.each(e,function(e){i.append('<span data-id="'+this.id+'" title="'+this.title+'"><img src="'+this.url+'" alt="" /><i class="sui sui-times"></i></span>')}),n()}).open()}),i.sortable({revert:200,containment:r,tolerance:"pointer",stop:function(){n()}}),u.on("change",n),l.on("change",n),c.on("change",function(){var e,t=p(this).parents(".su-generator-isp-source"),r=p(this).val();l.hide().find("option").remove(),n(),"0"===r||(e=p.ajax({url:ajaxurl,type:"post",dataType:"html",data:{action:"su_generator_get_terms",tax:r,class:"su-generator-isp-terms",multiple:!0,size:10},beforeSend:function(){"object"===s(e)&&e.abort(),l.html("").attr("disabled",!0).hide(),t.addClass("su-generator-loading")},success:function(e){l.html(e).attr("disabled",!1).show(),t.removeClass("su-generator-loading")}}))})}),p(".su-generator-upload-button").each(function(){var t,e=p(this),r=p(this).parents(".su-generator-attr-container").find("input:text");e.on("click",function(e){e.preventDefault(),e.stopPropagation(),void 0!==t&&t.close(),(t=wp.media.frames.su_media_frame_2=wp.media({title:SUGL10n.upload_title,button:{text:SUGL10n.upload_insert},multiple:!1})).on("select",function(){var e=t.state().get("selection").first().toJSON();r.val(e.url).trigger("change")}),t.on("open",function(){p(".mfp-wrap").addClass("hidden")}),t.on("close",function(){p(".mfp-wrap").removeClass("hidden")}),t.open()})}),p(".su-generator-icon-picker-button").each(function(){var e=p(this),t=p(this).parents(".su-generator-attr-container"),n=t.find(".su-generator-attr"),a=t.find(".su-generator-icon-picker"),s=a.find("input:text");e.click(function(e){a.toggleClass("su-generator-icon-picker-visible"),s.val("").trigger("keyup"),a.hasClass("su-generator-icon-picker-loaded")||(p.ajax({type:"post",url:ajaxurl,data:{action:"su_generator_get_icons"},dataType:"html",beforeSend:function(){a.addClass("su-generator-loading"),a.addClass("su-generator-icon-picker-loaded")},success:function(e){a.append(e);var r=a.children("i");r.click(function(e){n.val("icon: "+p(this).attr("title")),a.removeClass("su-generator-icon-picker-visible"),n.trigger("change"),e.preventDefault()}),s.on({keyup:function(){var e=p(this).val(),t=new RegExp(e,"gi");r.hide(),r.each(function(){null!==p(this).attr("title").match(t)&&p(this).show()})},focus:function(){p(this).val(""),r.show()}}),a.removeClass("su-generator-loading")}}),e.preventDefault())})}),p(".su-generator-switch").click(function(e){var t=p(this).parent().children("input");("yes"===t.val()?t.val("no"):t.val("yes")).trigger("change"),e.preventDefault()}),p(".su-generator-switch-value").on("change",function(){var e=p(this),t=e.parent().children(".su-generator-switch"),e=e.val();"yes"===e?t.removeClass("su-generator-switch-no").addClass("su-generator-switch-yes"):"no"===e&&t.removeClass("su-generator-switch-yes").addClass("su-generator-switch-no")}),p("select#su-generator-attr-taxonomy").on("change",function(){var e=p(this).val(),t=p("select#su-generator-attr-tax_term");window.su_generator_get_terms=p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_get_terms",tax:e,noselect:!0},dataType:"html",beforeSend:function(){"object"===s(window.su_generator_get_terms)&&window.su_generator_get_terms.abort(),t.parent().addClass("su-generator-loading")},success:function(e){t.find("option").remove(),t.append(e),t.parent().removeClass("su-generator-loading")}})}),p(".su-generator-shadow-picker").each(function(e){var t=p(this),r=t.find(".su-generator-shadow-picker-field input"),n=t.find(".su-generator-sp-hoff"),a=t.find(".su-generator-sp-voff"),s=t.find(".su-generator-sp-blur"),o={cnt:t.find(".su-generator-shadow-picker-color"),value:t.find(".su-generator-shadow-picker-color-value"),wheel:t.find(".su-generator-shadow-picker-color-wheel")},i=t.find(".su-generator-attr");o.wheel.farbtastic(o.value),o.value.focus(function(){o.wheel.show()}),o.value.blur(function(){o.wheel.hide()}),r.on("change blur keyup",function(){i.val(n.val()+"px "+a.val()+"px "+s.val()+"px "+o.value.val()).trigger("change")}),i.on("keyup",function(){var e=p(this).val().split(" ");4===e.length&&(n.val(e[0].replace("px","")),a.val(e[1].replace("px","")),s.val(e[2].replace("px","")),o.value.val(e[3]),r.trigger("keyup"))})}),p(".su-generator-border-picker").each(function(e){var t=p(this),r=t.find(".su-generator-border-picker-field input, .su-generator-border-picker-field select"),n=t.find(".su-generator-bp-width"),a=t.find(".su-generator-bp-style"),s={cnt:t.find(".su-generator-border-picker-color"),value:t.find(".su-generator-border-picker-color-value"),wheel:t.find(".su-generator-border-picker-color-wheel")},o=t.find(".su-generator-attr");s.wheel.farbtastic(s.value),s.value.focus(function(){s.wheel.show()}),s.value.blur(function(){s.wheel.hide()}),r.on("change blur keyup",function(){o.val(n.val()+"px "+a.val()+" "+s.value.val()).trigger("change")}),o.on("keyup",function(){var e=p(this).val().split(" ");3===e.length&&(n.val(e[0].replace("px","")),a.val(e[1]),s.value.val(e[2]),r.trigger("keyup"))})}),g.find(".su-generator-attr").on("change keyup blur",function(){var e=p(this).parents(".su-generator-attr-container"),t=e.data("default");p(this).val()!=t?e.removeClass("su-generator-skip"):e.addClass("su-generator-skip")}),p(".su-generator-set-value").click(function(e){p(this).parents(".su-generator-attr-container").find("input").val(p(this).text()).trigger("change")}),f.val(t),p.ajax({type:"GET",url:ajaxurl,data:{action:"su_generator_get_preset",id:"last_used",shortcode:t,nonce:p("#su_generator_presets_nonce").val()},beforeSend:function(){},success:function(e){h.setSettings(e);e=p("#su-generator-content");void 0!==h.state.mceSelection&&""!==h.state.mceSelection&&"hidden"!==e.attr("type")&&e.val(h.state.mceSelection)},dataType:"json"})},dataType:"html"})}),p("#su-generator").on("click",".su-generator-insert",h.insertShortcode),p("#su-generator").on("click",".su-generator-toggle-preview",function(e){var t=p("#su-generator-preview");p(this).hide(),t.addClass("su-generator-loading").show(),g.find("input, textarea, select").on("change keyup blur",function(){h.updatePreview()}),h.updatePreview(!0),e.preventDefault()}),p("#su-generator").on("mouseenter click",".su-generator-presets",function(){clearTimeout(a),p(".su-gp-popup").show()}),p("#su-generator").on("mouseleave",".su-generator-presets",function(){a=window.setTimeout(function(){p(".su-gp-popup").fadeOut(200)},600)}),p("#su-generator").on("click",".su-gp-new",function(e){p(this).parents(".su-generator-presets");var t=p(".su-gp-list"),r=(new Date).getTime(),n=prompt(SUGL10n.presets_prompt_msg,SUGL10n.presets_prompt_value);""!==n&&null!==n&&(t.find("b").hide(),t.append('<span data-id="'+r+'"><em>'+n+'</em><i class="sui sui-times"></i></span>'),h.addPreset(r,n))}),p("#su-generator").on("click",".su-gp-list span",function(e){var t=p(".su-generator-presets").data("shortcode"),r=p(this).data("id"),n=p(".su-generator-insert");p(".su-gp-popup").hide(),clearTimeout(a),p.ajax({type:"GET",url:ajaxurl,data:{action:"su_generator_get_preset",id:r,shortcode:t,nonce:p("#su_generator_presets_nonce").val()},beforeSend:function(){n.addClass("button-primary-disabled").attr("disabled",!0)},success:function(e){n.removeClass("button-primary-disabled").attr("disabled",!1),h.setSettings(e)},dataType:"json"}),e.preventDefault(),e.stopPropagation()}),p("#su-generator").on("click",".su-gp-list i",function(e){var t=p(this).parents(".su-gp-list"),r=p(this).parent("span"),n=r.data("id");r.remove(),t.find("span").length<1&&t.find("b").show(),h.removePreset(n),e.stopPropagation(),e.preventDefault()})},h.addPreset=function(e,t){var r=p(".su-generator-presets").data("shortcode"),n=h.getSettings();p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_add_preset",id:e,name:t,shortcode:r,settings:n,nonce:p("#su_generator_presets_nonce").val()}})},h.removePreset=function(e){var t=p(".su-generator-presets").data("shortcode");p.ajax({type:"POST",url:ajaxurl,data:{action:"su_generator_remove_preset",id:e,shortcode:t,nonce:p("#su_generator_presets_nonce").val()}})},h.parseSettings=function(){var e="on"===p("#su-generator-option-skip").val()?"#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr":"#su-generator-settings .su-generator-attr-container .su-generator-attr",t=f.val(),r=d.val(),n=p(e),e=p("textarea#su-generator-content"),e=e.length?e.val():"false",a=new String("");return a+="["+r+t,n.each(function(){var e=p(this),t="";null==(t=(e.is("select")?e.find("option:selected"):e).val())?t="":"array"==typeof t&&(t=t.join(",")),""!==t&&(a+=" "+p(this).attr("name")+'="'+p(this).val().toString().replace(/"/gi,"'")+'"')}),a+="]","false"!=e&&(a+=e+"[/"+r+t+"]"),a},h.getSettings=function(){f.val();var e=p("#su-generator-settings .su-generator-attr"),t=p("textarea#su-generator-content"),t=t.length?t.val():"false",a={};return e.each(function(e){var t=p(this),r="",n=t.attr("name"),r=(t.is("select")?t.find("option:selected"):t).val();a[n]=r=null==r?"":r}),a.content=t.toString(),a},h.setSettings=function(r){var e=p("#su-generator-settings .su-generator-attr"),t=p("#su-generator-content");e.each(function(){var e=p(this),t=e.attr("name");r.hasOwnProperty(t)&&(e.val(r[t]),e.trigger("keyup").trigger("change").trigger("blur"))}),r.hasOwnProperty("content")&&t.val(r.content).trigger("keyup").trigger("change").trigger("blur"),h.updatePreview()},h.updatePreview=function(e){var t=p("#su-generator-preview"),r=h.parseSettings(),n=a.text();e=e||!1,t.is(":visible")&&(r===n&&!e||(window.clearTimeout(h.state.preview.timer),h.state.preview.timer=window.setTimeout(function(){h.state.preview.request=p.ajax({type:"POST",url:ajaxurl,cache:!1,data:{action:"su_generator_preview",shortcode:r},beforeSend:function(){h.state.preview.request&&h.state.preview.request.abort(),t.addClass("su-generator-loading").html("")},success:function(e){t.html(e).removeClass("su-generator-loading")},dataType:"html"})},300),a.text(r)))},h.insert=function(e,t){var r;"string"==typeof e&&"object"===s(t)&&(h.state.context=e,r=(h.state.insertArgs=t).shortcode||"",(t={type:"inline",alignTop:!0,closeOnBgClick:!1,mainClass:"su-generator-mfp",items:{src:"#su-generator"},callbacks:{}}).callbacks.open=function(){r?l.filter('[data-shortcode="'.concat(r,'"]')).trigger("click"):window.setTimeout(function(){return o.focus()},200),"undefined"!=typeof tinyMCE&&null!=tinyMCE.activeEditor&&tinyMCE.activeEditor.hasOwnProperty("selection")&&(h.state.mceSelection=tinyMCE.activeEditor.selection.getContent({format:"text"}))},t.callbacks.close=function(){o.val(""),g.html("").hide(),n.removeClass("su-generator-narrow"),i.show(),c.show(),l.show(),h.state.mceSelection=""},p.magnificPopup.open(t))},h.insertShortcode=function(){var e,t,r=h.parseSettings();h.addPreset("last_used",SUGL10n.last_used),p.magnificPopup.close(),a.text(r),"html"===h.state.context&&(t=document.getElementById(h.state.insertArgs.editorID),h.insertAtCaret(t,r)),"classic"===h.state.context&&window.wp.media.editor.insert(r),"block"===h.state.context&&((e=h.state.insertArgs.props).attributes.hasOwnProperty("content")?e.setAttributes({content:e.attributes.content+r}):"core/shortcode"===e.name&&(t=e.attributes.hasOwnProperty("text")?e.attributes.text:"",e.setAttributes({text:t+r})))},h.insertAtCaret=function(e,t){var r=e.selectionStart;e.value=e.value.substring(0,r)+t+e.value.substring(r),e.focus(),e.selectionStart=r+t.length},{init:h.init,insert:h.insert}),jQuery(document).ready(window.SUG.App.init)},{}]},{},[1]);
2
  //# sourceMappingURL=index.js.map
includes/js/generator/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["includes/js/generator/node_modules/browser-pack/_prelude.js","includes/js/generator/includes/js/generator/src/index.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","$","$generator","$search","$filter","$filters","$choices","$choice","$settings","$prefix","$result","$selected","self","window","SUG","App","jQuery","children","find","state","mceSelection","target","wpActiveEditor","context","insertArgs","preview","timer","request","el","body","init","gp_hover_timer","click","regex","filter","this","data","css","opacity","removeClass","RegExp","each","match","preventDefault","on","val","html","hide","show","focus","magnificPopup","close","blur","keyup","$first","best","keyCode","trigger","id","shortcode","matches","name","desc","group","join","addClass","ajax","type","url","ajaxurl","action","beforeSend","success","$content","attr","index","$val","min","max","step","simpleSlider","snap","range","farbtastic","update","images","tax","terms","ids","source","$sources","$images","categories","$cats","$taxes","$terms","frame","$picker","$source","$addMedia","indexOf","parent","fadeOut","remove","wp","media","frames","su_media_frame_1","title","SUGL10n","isp_media_title","library","button","text","isp_media_insert","multiple","files","get","toJSON","append","open","sortable","revert","containment","tolerance","stop","ajaxTermSelect","$cont","parents","dataType","class","size","_typeof","abort","file","$button","stopPropagation","su_media_frame_2","upload_title","upload_insert","attachment","first","$field","toggleClass","hasClass","$icons","$value","$switch","value","su_generator_get_terms","noselect","$fields","$hoff","$voff","$blur","$color","cnt","wheel","split","replace","$width","$style","$cnt","_default","setSettings","insertShortcode","$preview","updatePreview","clearTimeout","setTimeout","$list","Date","getTime","prompt","presets_prompt_msg","presets_prompt_value","addPreset","$insert","$preset","removePreset","settings","getSettings","parseSettings","settingsSelector","query","prefix","content","result","String","$this","is","toString","hasOwnProperty","forced","previous","cache","insert","args","preSelectedShortcode","mfpOptions","alignTop","closeOnBgClick","mainClass","items","src","callbacks","concat","tinyMCE","activeEditor","selection","getContent","format","props","originalText","last_used","HTMLEditor","document","getElementById","editorID","insertAtCaret","editor","attributes","setAttributes","field","start","selectionStart","substring","ready"],"mappings":"CAAA,SAAAA,EAAAC,EAAAC,EAAAC,GAAA,SAAAC,EAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,IAAAE,EAAA,mBAAAC,SAAAA,QAAA,IAAAF,GAAAC,EAAA,OAAAA,EAAAF,GAAA,GAAA,GAAAI,EAAA,OAAAA,EAAAJ,GAAA,GAAA,MAAAK,EAAA,IAAAC,MAAA,uBAAAN,EAAA,MAAAO,KAAA,mBAAAF,EAAAG,EAAAX,EAAAG,GAAA,CAAAS,QAAA,IAAAb,EAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,OAAAI,EAAAH,EAAAI,GAAA,GAAAL,IAAAA,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,OAAAD,EAAAG,GAAAS,QAAA,IAAA,IAAAL,EAAA,mBAAAD,SAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAa,OAAAX,IAAAD,EAAAD,EAAAE,IAAA,OAAAD,EAAA,CAAA,CAAAa,EAAA,CAAA,SAAAT,EAAAU,EAAAJ,gB,qOCIkB,IAACK,EACbC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEAC,EAdNC,OAAOC,IAAM,GAEbD,OAAOC,IAAIC,KAAQd,EA2sChBe,OA1sCGd,EAAaD,EAAE,iBACfE,EAAUF,EAAE,wBACZG,EAAUH,EAAE,wBACZI,EAAWD,EAAQa,SAAS,KAC5BX,EAAWL,EAAE,yBACbM,EAAUD,EAASY,KAAK,QACxBV,EAAYP,EAAE,0BACdQ,EAAUR,EAAE,iCACZS,EAAUT,EAAE,wBACZ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9M,EAAK+M,cAAcJ,EAAY5J,IAGN,YAAvB/C,EAAKO,MAAMI,SACbV,OAAO2F,GAAGC,MAAMmH,OAAOxB,OAAOzI,GAGL,UAAvB/C,EAAKO,MAAMI,WACT6L,EAAQxM,EAAKO,MAAMK,WAAW4L,OAExBS,WAAW7B,eAAe,WAClCoB,EAAMU,cAAc,CAAEpC,QAAS0B,EAAMS,WAAWnC,QAAU/H,IAClC,mBAAfyJ,EAAMvJ,OACXwJ,EAAeD,EAAMS,WAAW7B,eAAe,QAC/CoB,EAAMS,WAAW5G,KACjB,GAEJmG,EAAMU,cAAc,CAAE7G,KAAMoG,EAAe1J,OAKjD/C,EAAK+M,cAAgB,SAACI,EAAO9G,GAC3B,IAAI+G,EAAQD,EAAME,eAClBF,EAAM3E,MAAQ2E,EAAM3E,MAAM8E,UAAU,EAAGF,GAAS/G,EAAO8G,EAAM3E,MAAM8E,UAAUF,GAC7ED,EAAM9K,QACN8K,EAAME,eAAiBD,EAAQ/G,EAAKnH,QAG/B,CACLgC,KAAMlB,EAAKkB,KACXsK,OAAQxL,EAAKwL,SAIjBpL,OAAOwM,UAAUW,MAAMtN,OAAOC,IAAIC,IAAIe","file":"index.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/* global jQuery, wp, ajaxurl, SUGL10n */\n\nwindow.SUG = {}\n\nwindow.SUG.App = (($) => {\n var $generator = $('#su-generator')\n var $search = $('#su-generator-search')\n var $filter = $('#su-generator-filter')\n var $filters = $filter.children('a')\n var $choices = $('#su-generator-choices')\n var $choice = $choices.find('span')\n var $settings = $('#su-generator-settings')\n var $prefix = $('#su-compatibility-mode-prefix')\n var $result = $('#su-generator-result')\n var $selected = $('#su-generator-selected')\n\n var self = {}\n\n self.state = {\n mceSelection: '',\n target: '',\n wpActiveEditor: null,\n context: '',\n insertArgs: '',\n preview: {\n timer: null,\n request: null\n }\n }\n\n self.el = {\n body: $('body')\n }\n\n self.init = () => {\n $filters.click(\n function (e) {\n // Prepare data\n var filter = $(this).data('filter')\n // If filter All, show all choices\n if (filter === 'all') {\n $choice.css(\n {\n opacity: 1\n }\n ).removeClass('su-generator-choice-first')\n } else { // Else run search\n var regex = new RegExp(filter, 'gi')\n // Hide all choices\n $choice.css({ opacity: 0.2 })\n // Find searched choices and show\n $choice.each(\n function () {\n // Get shortcode name\n var group = $(this).data('group')\n // Show choice if matched\n if (group.match(regex) !== null) {\n $(this)\n .css({ opacity: 1 })\n .removeClass('su-generator-choice-first')\n }\n }\n )\n }\n e.preventDefault()\n }\n )\n // Go to home link\n $('#su-generator').on(\n 'click',\n '.su-generator-home',\n function (e) {\n // Clear search field\n $search.val('')\n // Hide settings\n $settings.html('').hide()\n // Remove narrow class\n $generator.removeClass('su-generator-narrow')\n // Show filters\n $filter.show()\n // Show choices panel\n $choices.show()\n $choice.show()\n // Clear selection\n self.state.mceSelection = ''\n // Focus search field\n $search.focus()\n e.preventDefault()\n }\n )\n // Generator close button\n $('#su-generator').on(\n 'click',\n '.su-generator-close',\n function (e) {\n // Close popup\n $.magnificPopup.close()\n // Prevent default action\n e.preventDefault()\n }\n )\n // Search field\n $search.on(\n {\n focus: function () {\n // Clear field\n $(this).val('')\n // Hide settings\n $settings.html('').hide()\n // Remove narrow class\n $generator.removeClass('su-generator-narrow')\n // Show choices panel\n $choices.show()\n $choice.css(\n {\n opacity: 1\n }\n ).removeClass('su-generator-choice-first')\n // Show filters\n $filter.show()\n },\n blur: function () {},\n keyup: function (e) {\n // Prepare vars\n var $first = $('.su-generator-choice-first:first')\n var val = $(this).val()\n var regex = new RegExp(val, 'gi')\n var best = 0\n // Hotkey action\n if (e.keyCode === 13 && $first.length > 0) {\n e.preventDefault()\n $(this).val('').blur()\n $first.trigger('click')\n }\n // Hide all choices\n $choice.css(\n {\n opacity: 0.2\n }\n ).removeClass('su-generator-choice-first')\n // Loop and highlight choices\n $choice.each(\n function () {\n // Get choice data\n var data = $(this).data()\n var id = data.shortcode\n var name = data.name\n var desc = data.desc\n var group = data.group\n var matches = ([id, name, desc, group].join(' ')).match(regex)\n // Highlight choice if matched\n if (matches !== null) {\n // Highlight current choice\n $(this).css(\n {\n opacity: 1\n }\n )\n // Check for exact match\n if (val === id) {\n // Remove primary class from all choices\n $choice.removeClass('su-generator-choice-first')\n // Add primary class to the current choice\n $(this).addClass('su-generator-choice-first')\n // Prevent selecting by matches number\n best = 999\n } else if (matches.length > best) { // Check matches length\n // Remove primary class from all choices\n $choice.removeClass('su-generator-choice-first')\n // Add primary class to the current choice\n $(this).addClass('su-generator-choice-first')\n // Save the score\n best = matches.length\n }\n }\n }\n )\n // Remove primary class if search field is empty\n if (val === '') {\n $choice.removeClass('su-generator-choice-first')\n }\n }\n }\n )\n // Click on shortcode choice\n $choice.on(\n 'click',\n function (e) {\n // Prepare data\n var shortcode = $(this).data('shortcode')\n // Load shortcode options\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_settings',\n shortcode: shortcode\n },\n beforeSend: function () {\n // Hide preview box\n $('#su-generator-preview').hide()\n // Hide choices panel\n $choices.hide()\n // Show loading animation\n $settings.addClass('su-generator-loading').show()\n // Add narrow class\n $generator.addClass('su-generator-narrow')\n // Hide filters\n $filter.hide()\n },\n success: function (data) {\n // Hide loading animation\n $settings.removeClass('su-generator-loading')\n // Insert new HTML\n $settings.html(data)\n // Apply selected text to the content field\n var $content = $('#su-generator-content')\n if (typeof self.state.mceSelection !== 'undefined' && self.state.mceSelection !== '' && $content.attr('type') !== 'hidden') {\n $content.val(self.state.mceSelection)\n }\n // Init range pickers\n $('.su-generator-range-picker').each(\n function (index) {\n var $picker = $(this)\n var $val = $picker.find('input')\n var min = $val.attr('min')\n var max = $val.attr('max')\n var step = $val.attr('step')\n // Apply noUIslider\n $val.simpleSlider(\n {\n snap: true,\n step: step,\n range: [min, max]\n }\n )\n $val.show()\n $val.on(\n 'keyup blur',\n function (e) {\n $val.simpleSlider('setValue', $val.val())\n }\n )\n }\n )\n // Init color pickers\n $('.su-generator-select-color').each(\n function (index) {\n $(this).find('.su-generator-select-color-wheel').filter(':first').farbtastic('.su-generator-select-color-value:eq(' + index + ')')\n $(this).find('.su-generator-select-color-value').focus(\n function () {\n $('.su-generator-select-color-wheel:eq(' + index + ')').show()\n }\n )\n $(this).find('.su-generator-select-color-value').blur(\n function () {\n $('.su-generator-select-color-wheel:eq(' + index + ')').hide()\n }\n )\n }\n )\n // Init image sourse pickers\n $('.su-generator-isp').each(\n function () {\n var $picker = $(this)\n var $sources = $picker.find('.su-generator-isp-sources')\n var $source = $picker.find('.su-generator-isp-source')\n var $addMedia = $picker.find('.su-generator-isp-add-media')\n var $images = $picker.find('.su-generator-isp-images')\n var $cats = $picker.find('.su-generator-isp-categories')\n var $taxes = $picker.find('.su-generator-isp-taxonomies')\n var $terms = $('.su-generator-isp-terms')\n var $val = $picker.find('.su-generator-attr')\n var frame\n // Update hidden value\n var update = function () {\n var val = 'none'\n var ids = ''\n var source = $sources.val()\n // Media library\n if (source === 'media') {\n var images = []\n $images.find('span').each(\n function (i) {\n images[i] = $(this).data('id')\n }\n )\n if (images.length > 0) {\n ids = images.join(',')\n }\n }\n // Category\n else if (source === 'category') {\n var categories = $cats.val() || []\n if (categories.length > 0) {\n ids = categories.join(',')\n }\n }\n // Taxonomy\n else if (source === 'taxonomy') {\n var tax = $taxes.val() || ''\n var terms = $terms.val() || []\n if (tax !== '0' && terms.length > 0) {\n val = 'taxonomy: ' + tax + '/' + terms.join(',')\n }\n }\n // Deselect\n else if (source === '0') {\n val = 'none'\n }\n // Other options\n else {\n val = source\n }\n if (ids !== '') {\n val = source + ': ' + ids\n }\n $val.val(val).trigger('change')\n }\n // Switch source\n $sources.on(\n 'change',\n function (e) {\n var source = $(this).val()\n e.preventDefault()\n $source.removeClass('su-generator-isp-source-open')\n if (source.indexOf(':') === -1) {\n $picker.find('.su-generator-isp-source-' + source).addClass('su-generator-isp-source-open')\n }\n update()\n }\n )\n // Remove image\n $images.on(\n 'click',\n 'span i',\n function () {\n $(this).parent('span').css('border-color', '#f03').fadeOut(\n 300,\n function () {\n $(this).remove()\n update()\n }\n )\n }\n )\n // Add image\n $addMedia.click(\n function (e) {\n e.preventDefault()\n if (typeof (frame) !== 'undefined') {\n frame.close()\n }\n frame = wp.media.frames.su_media_frame_1 = wp.media(\n {\n title: SUGL10n.isp_media_title,\n library: {\n type: 'image'\n },\n button: {\n text: SUGL10n.isp_media_insert\n },\n multiple: true\n }\n )\n frame.on('open', function () {\n $('.mfp-wrap').addClass('hidden')\n })\n frame.on('close', function () {\n $('.mfp-wrap').removeClass('hidden')\n })\n frame.on(\n 'select',\n function () {\n var files = frame.state().get('selection').toJSON()\n $images.find('em').remove()\n $.each(\n files,\n function (i) {\n $images.append('<span data-id=\"' + this.id + '\" title=\"' + this.title + '\"><img src=\"' + this.url + '\" alt=\"\" /><i class=\"sui sui-times\"></i></span>')\n }\n )\n update()\n }\n ).open()\n }\n )\n // Sort images\n $images.sortable(\n {\n revert: 200,\n containment: $picker,\n tolerance: 'pointer',\n stop: function () {\n update()\n }\n }\n )\n // Select categories and terms\n $cats.on('change', update)\n $terms.on('change', update)\n // Select taxonomy\n $taxes.on(\n 'change',\n function () {\n var $cont = $(this).parents('.su-generator-isp-source')\n var tax = $(this).val()\n // Remove terms\n $terms.hide().find('option').remove()\n update()\n // Taxonomy is not selected\n if (tax === '0') {\n\n } else { // Taxonomy selected\n var ajaxTermSelect = $.ajax(\n {\n url: ajaxurl,\n type: 'post',\n dataType: 'html',\n data: {\n action: 'su_generator_get_terms',\n tax: tax,\n class: 'su-generator-isp-terms',\n multiple: true,\n size: 10\n },\n beforeSend: function () {\n if (typeof ajaxTermSelect === 'object') {\n ajaxTermSelect.abort()\n }\n $terms.html('').attr('disabled', true).hide()\n $cont.addClass('su-generator-loading')\n },\n success: function (data) {\n $terms.html(data).attr('disabled', false).show()\n $cont.removeClass('su-generator-loading')\n }\n }\n )\n }\n }\n )\n }\n )\n // Init media buttons\n $('.su-generator-upload-button').each(\n function () {\n var $button = $(this)\n var $val = $(this).parents('.su-generator-attr-container').find('input:text')\n var file\n $button.on(\n 'click',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // If the frame already exists, reopen it\n if (typeof (file) !== 'undefined') {\n file.close()\n }\n // Create WP media frame.\n file = wp.media.frames.su_media_frame_2 = wp.media(\n {\n // Title of media manager frame\n title: SUGL10n.upload_title,\n button: {\n // Button text\n text: SUGL10n.upload_insert\n },\n // Do not allow multiple files, if you want multiple, set true\n multiple: false\n }\n )\n // callback for selected image\n file.on(\n 'select',\n function () {\n var attachment = file.state().get('selection').first().toJSON()\n $val.val(attachment.url).trigger('change')\n }\n )\n file.on('open', function () {\n $('.mfp-wrap').addClass('hidden')\n })\n file.on('close', function () {\n $('.mfp-wrap').removeClass('hidden')\n })\n // Open modal\n file.open()\n }\n )\n }\n )\n // Init icon pickers\n $('.su-generator-icon-picker-button').each(\n function () {\n var $button = $(this)\n var $field = $(this).parents('.su-generator-attr-container')\n var $val = $field.find('.su-generator-attr')\n var $picker = $field.find('.su-generator-icon-picker')\n var $filter = $picker.find('input:text')\n $button.click(\n function (e) {\n $picker.toggleClass('su-generator-icon-picker-visible')\n $filter.val('').trigger('keyup')\n if ($picker.hasClass('su-generator-icon-picker-loaded')) {\n return\n }\n // Load icons\n $.ajax(\n {\n type: 'post',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_icons'\n },\n dataType: 'html',\n beforeSend: function () {\n // Show loading animation\n $picker.addClass('su-generator-loading')\n // Add loaded class\n $picker.addClass('su-generator-icon-picker-loaded')\n },\n success: function (data) {\n $picker.append(data)\n var $icons = $picker.children('i')\n $icons.click(\n function (e) {\n $val.val('icon: ' + $(this).attr('title'))\n $picker.removeClass('su-generator-icon-picker-visible')\n $val.trigger('change')\n e.preventDefault()\n }\n )\n $filter.on(\n {\n keyup: function () {\n var val = $(this).val()\n var regex = new RegExp(val, 'gi')\n // Hide all choices\n $icons.hide()\n // Find searched choices and show\n $icons.each(\n function () {\n // Get shortcode name\n var name = $(this).attr('title')\n // Show choice if matched\n if (name.match(regex) !== null) {\n $(this).show()\n }\n }\n )\n },\n focus: function () {\n $(this).val('')\n $icons.show()\n }\n }\n )\n $picker.removeClass('su-generator-loading')\n }\n }\n )\n e.preventDefault()\n }\n )\n }\n )\n // Init switches\n $('.su-generator-switch').click(\n function (e) {\n // Prepare data\n var $switch = $(this)\n var $value = $switch.parent().children('input')\n var isOn = $value.val() === 'yes'\n // Disable\n if (isOn) {\n // Change value\n $value.val('no').trigger('change')\n } else { // Enable\n // Change value\n $value.val('yes').trigger('change')\n }\n e.preventDefault()\n }\n )\n $('.su-generator-switch-value').on(\n 'change',\n function () {\n // Prepare data\n var $value = $(this)\n var $switch = $value.parent().children('.su-generator-switch')\n var value = $value.val()\n // Disable\n if (value === 'yes') {\n $switch.removeClass('su-generator-switch-no').addClass('su-generator-switch-yes')\n } else if (value === 'no') { // Enable\n $switch.removeClass('su-generator-switch-yes').addClass('su-generator-switch-no')\n }\n }\n )\n // Init tax_term selects\n $('select#su-generator-attr-taxonomy').on(\n 'change',\n function () {\n var $taxonomy = $(this)\n var tax = $taxonomy.val()\n var $terms = $('select#su-generator-attr-tax_term')\n // Load new options\n window.su_generator_get_terms = $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_terms',\n tax: tax,\n noselect: true\n },\n dataType: 'html',\n beforeSend: function () {\n // Check previous requests\n if (typeof window.su_generator_get_terms === 'object') {\n window.su_generator_get_terms.abort()\n }\n // Show loading animation\n $terms.parent().addClass('su-generator-loading')\n },\n success: function (data) {\n // Remove previous options\n $terms.find('option').remove()\n // Append new options\n $terms.append(data)\n // Hide loading animation\n $terms.parent().removeClass('su-generator-loading')\n }\n }\n )\n }\n )\n // Init shadow pickers\n $('.su-generator-shadow-picker').each(\n function (index) {\n var $picker = $(this)\n var $fields = $picker.find('.su-generator-shadow-picker-field input')\n var $hoff = $picker.find('.su-generator-sp-hoff')\n var $voff = $picker.find('.su-generator-sp-voff')\n var $blur = $picker.find('.su-generator-sp-blur')\n var $color = {\n cnt: $picker.find('.su-generator-shadow-picker-color'),\n value: $picker.find('.su-generator-shadow-picker-color-value'),\n wheel: $picker.find('.su-generator-shadow-picker-color-wheel')\n }\n var $val = $picker.find('.su-generator-attr')\n // Init color picker\n $color.wheel.farbtastic($color.value)\n $color.value.focus(\n function () {\n $color.wheel.show()\n }\n )\n $color.value.blur(\n function () {\n $color.wheel.hide()\n }\n )\n // Handle text fields\n $fields.on(\n 'change blur keyup',\n function () {\n $val.val($hoff.val() + 'px ' + $voff.val() + 'px ' + $blur.val() + 'px ' + $color.value.val()).trigger('change')\n }\n )\n $val.on(\n 'keyup',\n function () {\n var value = $(this).val().split(' ')\n // Value is correct\n if (value.length === 4) {\n $hoff.val(value[0].replace('px', ''))\n $voff.val(value[1].replace('px', ''))\n $blur.val(value[2].replace('px', ''))\n $color.value.val(value[3])\n $fields.trigger('keyup')\n }\n }\n )\n }\n )\n // Init border pickers\n $('.su-generator-border-picker').each(\n function (index) {\n var $picker = $(this)\n var $fields = $picker.find('.su-generator-border-picker-field input, .su-generator-border-picker-field select')\n var $width = $picker.find('.su-generator-bp-width')\n var $style = $picker.find('.su-generator-bp-style')\n var $color = {\n cnt: $picker.find('.su-generator-border-picker-color'),\n value: $picker.find('.su-generator-border-picker-color-value'),\n wheel: $picker.find('.su-generator-border-picker-color-wheel')\n }\n var $val = $picker.find('.su-generator-attr')\n // Init color picker\n $color.wheel.farbtastic($color.value)\n $color.value.focus(\n function () {\n $color.wheel.show()\n }\n )\n $color.value.blur(\n function () {\n $color.wheel.hide()\n }\n )\n // Handle text fields\n $fields.on(\n 'change blur keyup',\n function () {\n $val.val($width.val() + 'px ' + $style.val() + ' ' + $color.value.val()).trigger('change')\n }\n )\n $val.on(\n 'keyup',\n function () {\n var value = $(this).val().split(' ')\n // Value is correct\n if (value.length === 3) {\n $width.val(value[0].replace('px', ''))\n $style.val(value[1])\n $color.value.val(value[2])\n $fields.trigger('keyup')\n }\n }\n )\n }\n )\n // Remove skip class when setting is changed\n $settings.find('.su-generator-attr').on(\n 'change keyup blur',\n function () {\n var $cnt = $(this).parents('.su-generator-attr-container')\n var _default = $cnt.data('default')\n var val = $(this).val()\n // Value is changed\n if (val != _default) {\n $cnt.removeClass('su-generator-skip')\n } else {\n $cnt.addClass('su-generator-skip')\n }\n }\n )\n // Init value setters\n $('.su-generator-set-value').click(\n function (e) {\n $(this).parents('.su-generator-attr-container').find('input').val($(this).text()).trigger('change')\n }\n )\n // Save selected value\n $selected.val(shortcode)\n // Load last used preset\n $.ajax(\n {\n type: 'GET',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_preset',\n id: 'last_used',\n shortcode: shortcode\n },\n beforeSend: function () {\n // Show loading animation\n // $settings.addClass('su-generator-loading');\n },\n success: function (data) {\n // Remove loading animation\n // $settings.removeClass('su-generator-loading');\n // Set new settings\n self.setSettings(data)\n // Apply selected text to the content field\n var $content = $('#su-generator-content')\n if (typeof self.state.mceSelection !== 'undefined' && self.state.mceSelection !== '' && $content.attr('type') !== 'hidden') {\n $content.val(self.state.mceSelection)\n }\n },\n dataType: 'json'\n }\n )\n },\n dataType: 'html'\n }\n )\n }\n )\n // Insert shortcode\n $('#su-generator').on('click', '.su-generator-insert', self.insertShortcode)\n // Preview shortcode\n $('#su-generator').on(\n 'click',\n '.su-generator-toggle-preview',\n function (e) {\n // Prepare data\n var $preview = $('#su-generator-preview')\n var $button = $(this)\n // Hide button\n $button.hide()\n // Show preview box\n $preview.addClass('su-generator-loading').show()\n // Bind updating on settings changes\n $settings.find('input, textarea, select').on(\n 'change keyup blur',\n function () {\n self.updatePreview()\n }\n )\n // Update preview box\n self.updatePreview(true)\n // Prevent default action\n e.preventDefault()\n }\n )\n var gp_hover_timer\n // Presets manager - mouseenter\n $('#su-generator').on(\n 'mouseenter click',\n '.su-generator-presets',\n function () {\n clearTimeout(gp_hover_timer)\n $('.su-gp-popup').show()\n }\n )\n // Presets manager - mouseleave\n $('#su-generator').on(\n 'mouseleave',\n '.su-generator-presets',\n function () {\n gp_hover_timer = window.setTimeout(\n function () {\n $('.su-gp-popup').fadeOut(200)\n },\n 600\n )\n }\n )\n // Presets manager - add new preset\n $('#su-generator').on(\n 'click',\n '.su-gp-new',\n function (e) {\n // Prepare data\n var $container = $(this).parents('.su-generator-presets')\n var $list = $('.su-gp-list')\n var id = new Date().getTime()\n // Ask for preset name\n var name = prompt(SUGL10n.presets_prompt_msg, SUGL10n.presets_prompt_value)\n // Name is entered\n if (name !== '' && name !== null) {\n // Hide default text\n $list.find('b').hide()\n // Add new option\n $list.append('<span data-id=\"' + id + '\"><em>' + name + '</em><i class=\"sui sui-times\"></i></span>')\n // Perform AJAX request\n self.addPreset(id, name)\n }\n }\n )\n // Presets manager - load preset\n $('#su-generator').on(\n 'click',\n '.su-gp-list span',\n function (e) {\n // Prepare data\n var shortcode = $('.su-generator-presets').data('shortcode')\n var id = $(this).data('id')\n var $insert = $('.su-generator-insert')\n // Hide popup\n $('.su-gp-popup').hide()\n // Disable hover timer\n clearTimeout(gp_hover_timer)\n // Get the preset\n $.ajax(\n {\n type: 'GET',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_preset',\n id: id,\n shortcode: shortcode\n },\n beforeSend: function () {\n // Disable insert button\n $insert.addClass('button-primary-disabled').attr('disabled', true)\n },\n success: function (data) {\n // Enable insert button\n $insert.removeClass('button-primary-disabled').attr('disabled', false)\n // Set new settings\n self.setSettings(data)\n },\n dataType: 'json'\n }\n )\n // Prevent default action\n e.preventDefault()\n e.stopPropagation()\n }\n )\n // Presets manager - remove preset\n $('#su-generator').on(\n 'click',\n '.su-gp-list i',\n function (e) {\n // Prepare data\n var $list = $(this).parents('.su-gp-list')\n var $preset = $(this).parent('span')\n var id = $preset.data('id')\n // Remove DOM element\n $preset.remove()\n // Show default text if last preset was removed\n if ($list.find('span').length < 1) {\n $list.find('b').show()\n }\n // Perform ajax request\n self.removePreset(id)\n // Prevent <span> action\n e.stopPropagation()\n // Prevent default action\n e.preventDefault()\n }\n )\n }\n\n /**\n\t * Create new preset with specified name from current settings\n\t */\n self.addPreset = function (id, name) {\n // Prepare shortcode name and current settings\n var shortcode = $('.su-generator-presets').data('shortcode')\n var settings = self.getSettings()\n // Perform AJAX request\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_add_preset',\n id: id,\n name: name,\n shortcode: shortcode,\n settings: settings\n }\n }\n )\n }\n /**\n\t * Remove preset by ID\n\t */\n self.removePreset = function (id) {\n // Get current shortcode name\n var shortcode = $('.su-generator-presets').data('shortcode')\n // Perform AJAX request\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_remove_preset',\n id: id,\n shortcode: shortcode\n }\n }\n )\n }\n\n self.parseSettings = function () {\n var settingsSelector = $('#su-generator-option-skip').val() === 'on'\n ? '#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr'\n : '#su-generator-settings .su-generator-attr-container .su-generator-attr'\n // Prepare data\n var query = $selected.val()\n var prefix = $prefix.val()\n var $settings = $(settingsSelector)\n var $content = $('textarea#su-generator-content')\n var content = $content.length ? $content.val() : 'false'\n var result = new String('')\n // Open shortcode\n result += '[' + prefix + query\n // Add shortcode attributes\n $settings.each(\n function () {\n // Prepare field and value\n var $this = $(this)\n var value = ''\n // Selects\n if ($this.is('select')) {\n value = $this.find('option:selected').val()\n }\n // Other fields\n else {\n value = $this.val()\n }\n // Check that value is not empty\n if (value == null) {\n value = ''\n } else if (typeof value === 'array') {\n value = value.join(',')\n }\n // Add attribute\n if (value !== '') {\n result += ' ' + $(this).attr('name') + '=\"' + $(this).val().toString().replace(/\"/gi, \"'\") + '\"'\n }\n }\n )\n // End of opening tag\n result += ']'\n // Wrap shortcode if content presented\n if (content != 'false') {\n result += content + '[/' + prefix + query + ']'\n }\n // Return result\n return result\n }\n\n self.getSettings = function () {\n // Prepare data\n var query = $selected.val()\n var $settings = $('#su-generator-settings .su-generator-attr')\n var $content = $('textarea#su-generator-content')\n var content = $content.length ? $content.val() : 'false'\n var data = {}\n // Add shortcode attributes\n $settings.each(\n function (i) {\n // Prepare field and value\n var $this = $(this)\n var value = ''\n var name = $this.attr('name')\n // Selects\n if ($this.is('select')) {\n value = $this.find('option:selected').val()\n }\n // Other fields\n else {\n value = $this.val()\n }\n // Check that value is not empty\n if (value == null) {\n value = ''\n }\n // Save value\n data[name] = value\n }\n )\n // Add content\n data.content = content.toString()\n // Return data\n return data\n }\n\n self.setSettings = function (data) {\n // Prepare data\n var $settings = $('#su-generator-settings .su-generator-attr')\n var $content = $('#su-generator-content')\n // Loop through settings\n $settings.each(\n function () {\n var $this = $(this)\n var name = $this.attr('name')\n // Data contains value for this field\n if (data.hasOwnProperty(name)) {\n // Set new value\n $this.val(data[name])\n $this.trigger('keyup').trigger('change').trigger('blur')\n }\n }\n )\n // Set content\n if (data.hasOwnProperty('content')) {\n $content.val(data.content).trigger('keyup').trigger('change').trigger('blur')\n }\n // Update preview\n self.updatePreview()\n }\n\n self.updatePreview = function (forced) {\n // Prepare data\n var $preview = $('#su-generator-preview')\n var shortcode = self.parseSettings()\n var previous = $result.text()\n // Check forced mode\n forced = forced || false\n // Break if preview box is hidden (preview isn't enabled)\n if (!$preview.is(':visible')) {\n return\n }\n // Check shortcode is changed is this is not a forced mode\n if (shortcode === previous && !forced) {\n return\n }\n // Run timer to filter often calls\n window.clearTimeout(self.state.preview.timer)\n self.state.preview.timer = window.setTimeout(\n function () {\n self.state.preview.request = $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n cache: false,\n data: {\n action: 'su_generator_preview',\n shortcode: shortcode\n },\n beforeSend: function () {\n // Abort previous requests\n if (self.state.preview.request) {\n self.state.preview.request.abort()\n }\n // Show loading animation\n $preview.addClass('su-generator-loading').html('')\n },\n success: function (data) {\n // Hide loading animation and set new HTML\n $preview.html(data).removeClass('su-generator-loading')\n },\n dataType: 'html'\n }\n )\n },\n 300\n )\n // Save shortcode to div\n $result.text(shortcode)\n }\n\n self.insert = function (context, args) {\n if (typeof context !== 'string' || typeof args !== 'object') {\n return\n }\n\n self.state.context = context\n self.state.insertArgs = args\n\n var preSelectedShortcode = args.shortcode || ''\n\n var mfpOptions = {\n type: 'inline',\n alignTop: true,\n closeOnBgClick: false,\n mainClass: 'su-generator-mfp',\n items: {\n src: '#su-generator'\n },\n callbacks: {}\n }\n\n mfpOptions.callbacks.open = () => {\n if (preSelectedShortcode) {\n $choice.filter(`[data-shortcode=\"${preSelectedShortcode}\"]`).trigger('click')\n } else {\n window.setTimeout(() => $search.focus(), 200)\n }\n\n // self.el.body.addClass( 'su-mfp-shown' );\n\n if (\n typeof tinyMCE !== 'undefined' &&\n\t\t\t\ttinyMCE.activeEditor != null &&\n\t\t\t\ttinyMCE.activeEditor.hasOwnProperty('selection')\n ) {\n self.state.mceSelection = tinyMCE.activeEditor.selection.getContent({ format: 'text' })\n }\n }\n\n mfpOptions.callbacks.close = () => {\n $search.val('')\n $settings.html('').hide()\n $generator.removeClass('su-generator-narrow')\n $filter.show()\n $choices.show()\n $choice.show()\n\n self.state.mceSelection = ''\n\n // self.el.body.removeClass( 'su-mfp-shown' );\n }\n\n $.magnificPopup.open(mfpOptions)\n }\n\n self.insertShortcode = function () {\n var shortcode = self.parseSettings()\n\n self.addPreset('last_used', SUGL10n.last_used)\n\n $.magnificPopup.close()\n\n $result.text(shortcode)\n\n if (self.state.context === 'html') {\n var HTMLEditor = document.getElementById(self.state.insertArgs.editorID)\n self.insertAtCaret(HTMLEditor, shortcode)\n }\n\n if (self.state.context === 'classic') {\n window.wp.media.editor.insert(shortcode)\n }\n\n if (self.state.context === 'block') {\n var props = self.state.insertArgs.props\n\n if (props.attributes.hasOwnProperty('content')) {\n props.setAttributes({ content: props.attributes.content + shortcode })\n } else if (props.name === 'core/shortcode') {\n var originalText = props.attributes.hasOwnProperty('text')\n ? props.attributes.text\n : ''\n\n props.setAttributes({ text: originalText + shortcode })\n }\n }\n }\n\n self.insertAtCaret = (field, text) => {\n var start = field.selectionStart\n field.value = field.value.substring(0, start) + text + field.value.substring(start)\n field.focus()\n field.selectionStart = start + text.length\n }\n\n return {\n init: self.init,\n insert: self.insert\n }\n})(jQuery)\n\njQuery(document).ready(window.SUG.App.init)\n"]}
1
+ {"version":3,"sources":["includes/js/generator/node_modules/browser-pack/_prelude.js","includes/js/generator/includes/js/generator/src/index.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","$","$generator","$search","$filter","$filters","$choices","$choice","$settings","$prefix","$result","$selected","self","window","SUG","App","jQuery","children","find","state","mceSelection","target","wpActiveEditor","context","insertArgs","preview","timer","request","el","body","init","gp_hover_timer","click","regex","filter","this","data","css","opacity","removeClass","RegExp","each","match","preventDefault","on","val","html","hide","show","focus","magnificPopup","close","blur","keyup","$first","best","keyCode","trigger","id","shortcode","matches","name","desc","group","join","addClass","ajax","type","url","ajaxurl","action","beforeSend","success","$content","attr","index","$val","min","max","step","simpleSlider","snap","range","farbtastic","update","images","tax","terms","ids","source","$sources","$images","categories","$cats","$taxes","$terms","frame","$picker","$source","$addMedia","indexOf","parent","fadeOut","remove","wp","media","frames","su_media_frame_1","title","SUGL10n","isp_media_title","library","button","text","isp_media_insert","multiple","files","get","toJSON","append","open","sortable","revert","containment","tolerance","stop","ajaxTermSelect","$cont","parents","dataType","class","size","_typeof","abort","file","$button","stopPropagation","su_media_frame_2","upload_title","upload_insert","attachment","first","$field","toggleClass","hasClass","$icons","$value","$switch","value","su_generator_get_terms","noselect","$fields","$hoff","$voff","$blur","$color","cnt","wheel","split","replace","$width","$style","$cnt","_default","nonce","setSettings","insertShortcode","$preview","updatePreview","clearTimeout","setTimeout","$list","Date","getTime","prompt","presets_prompt_msg","presets_prompt_value","addPreset","$insert","$preset","removePreset","settings","getSettings","parseSettings","settingsSelector","query","prefix","content","result","String","$this","is","toString","hasOwnProperty","forced","previous","cache","insert","args","preSelectedShortcode","mfpOptions","alignTop","closeOnBgClick","mainClass","items","src","callbacks","concat","tinyMCE","activeEditor","selection","getContent","format","props","originalText","last_used","HTMLEditor","document","getElementById","editorID","insertAtCaret","editor","attributes","setAttributes","field","start","selectionStart","substring","ready"],"mappings":"CAAA,SAAAA,EAAAC,EAAAC,EAAAC,GAAA,SAAAC,EAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,IAAAE,EAAA,mBAAAC,SAAAA,QAAA,IAAAF,GAAAC,EAAA,OAAAA,EAAAF,GAAA,GAAA,GAAAI,EAAA,OAAAA,EAAAJ,GAAA,GAAA,MAAAK,EAAA,IAAAC,MAAA,uBAAAN,EAAA,MAAAO,KAAA,mBAAAF,EAAAG,EAAAX,EAAAG,GAAA,CAAAS,QAAA,IAAAb,EAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,OAAAI,EAAAH,EAAAI,GAAA,GAAAL,IAAAA,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,OAAAD,EAAAG,GAAAS,QAAA,IAAA,IAAAL,EAAA,mBAAAD,SAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAa,OAAAX,IAAAD,EAAAD,EAAAE,IAAA,OAAAD,EAAA,CAAA,CAAAa,EAAA,CAAA,SAAAT,EAAAU,EAAAJ,gB,qOCIkB,IAACK,EACbC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEAC,EAdNC,OAAOC,IAAM,GAEbD,OAAOC,IAA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ACvBnC,EAAQ4C,OACR1C,EAAS0C,OACTzC,EAAQyC,OAERpC,EAAKO,MAAMC,aAAe,IAK5BnB,EAAEiD,cAAcsE,KAAKgF,KAGvB5L,EAAK0J,gBAAkB,WACrB,IAkBM+C,EAKEC,EAvBJ3J,EAAY/C,EAAK2K,gBAErB3K,EAAKqK,UAAU,YAAapE,QAAQ0G,WAEpCtN,EAAEiD,cAAcC,QAEhBzC,EAAQuG,KAAKtD,GAEc,SAAvB/C,EAAKO,MAAMI,UACTiM,EAAaC,SAASC,eAAe9M,EAAKO,MAAMK,WAAWmM,UAC/D/M,EAAKgN,cAAcJ,EAAY7J,IAGN,YAAvB/C,EAAKO,MAAMI,SACbV,OAAO2F,GAAGC,MAAMoH,OAAOxB,OAAO1I,GAGL,UAAvB/C,EAAKO,MAAMI,WACT8L,EAAQzM,EAAKO,MAAMK,WAAW6L,OAExBS,WAAW7B,eAAe,WAClCoB,EAAMU,cAAc,CAAEpC,QAAS0B,EAAMS,WAAWnC,QAAUhI,IAClC,mBAAf0J,EAAMxJ,OACXyJ,EAAeD,EAAMS,WAAW7B,eAAe,QAC/CoB,EAAMS,WAAW7G,KACjB,GAEJoG,EAAMU,cAAc,CAAE9G,KAAMqG,EAAe3J,OAKjD/C,EAAKgN,cAAgB,SAACI,EAAO/G,GAC3B,IAAIgH,EAAQD,EAAME,eAClBF,EAAM5E,MAAQ4E,EAAM5E,MAAM+E,UAAU,EAAGF,GAAShH,EAAO+G,EAAM5E,MAAM+E,UAAUF,GAC7ED,EAAM/K,QACN+K,EAAME,eAAiBD,EAAQhH,EAAKnH,QAG/B,CACLgC,KAAMlB,EAAKkB,KACXuK,OAAQzL,EAAKyL,SAIjBrL,OAAOyM,UAAUW,MAAMvN,OAAOC,IAAIC,IAAIe","file":"index.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/* global jQuery, wp, ajaxurl, SUGL10n */\n\nwindow.SUG = {}\n\nwindow.SUG.App = (($) => {\n var $generator = $('#su-generator')\n var $search = $('#su-generator-search')\n var $filter = $('#su-generator-filter')\n var $filters = $filter.children('a')\n var $choices = $('#su-generator-choices')\n var $choice = $choices.find('span')\n var $settings = $('#su-generator-settings')\n var $prefix = $('#su-compatibility-mode-prefix')\n var $result = $('#su-generator-result')\n var $selected = $('#su-generator-selected')\n\n var self = {}\n\n self.state = {\n mceSelection: '',\n target: '',\n wpActiveEditor: null,\n context: '',\n insertArgs: '',\n preview: {\n timer: null,\n request: null\n }\n }\n\n self.el = {\n body: $('body')\n }\n\n self.init = () => {\n $filters.click(\n function (e) {\n // Prepare data\n var filter = $(this).data('filter')\n // If filter All, show all choices\n if (filter === 'all') {\n $choice.css(\n {\n opacity: 1\n }\n ).removeClass('su-generator-choice-first')\n } else { // Else run search\n var regex = new RegExp(filter, 'gi')\n // Hide all choices\n $choice.css({ opacity: 0.2 })\n // Find searched choices and show\n $choice.each(\n function () {\n // Get shortcode name\n var group = $(this).data('group')\n // Show choice if matched\n if (group.match(regex) !== null) {\n $(this)\n .css({ opacity: 1 })\n .removeClass('su-generator-choice-first')\n }\n }\n )\n }\n e.preventDefault()\n }\n )\n // Go to home link\n $('#su-generator').on(\n 'click',\n '.su-generator-home',\n function (e) {\n // Clear search field\n $search.val('')\n // Hide settings\n $settings.html('').hide()\n // Remove narrow class\n $generator.removeClass('su-generator-narrow')\n // Show filters\n $filter.show()\n // Show choices panel\n $choices.show()\n $choice.show()\n // Clear selection\n self.state.mceSelection = ''\n // Focus search field\n $search.focus()\n e.preventDefault()\n }\n )\n // Generator close button\n $('#su-generator').on(\n 'click',\n '.su-generator-close',\n function (e) {\n // Close popup\n $.magnificPopup.close()\n // Prevent default action\n e.preventDefault()\n }\n )\n // Search field\n $search.on(\n {\n focus: function () {\n // Clear field\n $(this).val('')\n // Hide settings\n $settings.html('').hide()\n // Remove narrow class\n $generator.removeClass('su-generator-narrow')\n // Show choices panel\n $choices.show()\n $choice.css(\n {\n opacity: 1\n }\n ).removeClass('su-generator-choice-first')\n // Show filters\n $filter.show()\n },\n blur: function () {},\n keyup: function (e) {\n // Prepare vars\n var $first = $('.su-generator-choice-first:first')\n var val = $(this).val()\n var regex = new RegExp(val, 'gi')\n var best = 0\n // Hotkey action\n if (e.keyCode === 13 && $first.length > 0) {\n e.preventDefault()\n $(this).val('').blur()\n $first.trigger('click')\n }\n // Hide all choices\n $choice.css(\n {\n opacity: 0.2\n }\n ).removeClass('su-generator-choice-first')\n // Loop and highlight choices\n $choice.each(\n function () {\n // Get choice data\n var data = $(this).data()\n var id = data.shortcode\n var name = data.name\n var desc = data.desc\n var group = data.group\n var matches = ([id, name, desc, group].join(' ')).match(regex)\n // Highlight choice if matched\n if (matches !== null) {\n // Highlight current choice\n $(this).css(\n {\n opacity: 1\n }\n )\n // Check for exact match\n if (val === id) {\n // Remove primary class from all choices\n $choice.removeClass('su-generator-choice-first')\n // Add primary class to the current choice\n $(this).addClass('su-generator-choice-first')\n // Prevent selecting by matches number\n best = 999\n } else if (matches.length > best) { // Check matches length\n // Remove primary class from all choices\n $choice.removeClass('su-generator-choice-first')\n // Add primary class to the current choice\n $(this).addClass('su-generator-choice-first')\n // Save the score\n best = matches.length\n }\n }\n }\n )\n // Remove primary class if search field is empty\n if (val === '') {\n $choice.removeClass('su-generator-choice-first')\n }\n }\n }\n )\n // Click on shortcode choice\n $choice.on(\n 'click',\n function (e) {\n // Prepare data\n var shortcode = $(this).data('shortcode')\n // Load shortcode options\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_settings',\n shortcode: shortcode\n },\n beforeSend: function () {\n // Hide preview box\n $('#su-generator-preview').hide()\n // Hide choices panel\n $choices.hide()\n // Show loading animation\n $settings.addClass('su-generator-loading').show()\n // Add narrow class\n $generator.addClass('su-generator-narrow')\n // Hide filters\n $filter.hide()\n },\n success: function (data) {\n // Hide loading animation\n $settings.removeClass('su-generator-loading')\n // Insert new HTML\n $settings.html(data)\n // Apply selected text to the content field\n var $content = $('#su-generator-content')\n if (typeof self.state.mceSelection !== 'undefined' && self.state.mceSelection !== '' && $content.attr('type') !== 'hidden') {\n $content.val(self.state.mceSelection)\n }\n // Init range pickers\n $('.su-generator-range-picker').each(\n function (index) {\n var $picker = $(this)\n var $val = $picker.find('input')\n var min = $val.attr('min')\n var max = $val.attr('max')\n var step = $val.attr('step')\n // Apply noUIslider\n $val.simpleSlider(\n {\n snap: true,\n step: step,\n range: [min, max]\n }\n )\n $val.show()\n $val.on(\n 'keyup blur',\n function (e) {\n $val.simpleSlider('setValue', $val.val())\n }\n )\n }\n )\n // Init color pickers\n $('.su-generator-select-color').each(\n function (index) {\n $(this).find('.su-generator-select-color-wheel').filter(':first').farbtastic('.su-generator-select-color-value:eq(' + index + ')')\n $(this).find('.su-generator-select-color-value').focus(\n function () {\n $('.su-generator-select-color-wheel:eq(' + index + ')').show()\n }\n )\n $(this).find('.su-generator-select-color-value').blur(\n function () {\n $('.su-generator-select-color-wheel:eq(' + index + ')').hide()\n }\n )\n }\n )\n // Init image sourse pickers\n $('.su-generator-isp').each(\n function () {\n var $picker = $(this)\n var $sources = $picker.find('.su-generator-isp-sources')\n var $source = $picker.find('.su-generator-isp-source')\n var $addMedia = $picker.find('.su-generator-isp-add-media')\n var $images = $picker.find('.su-generator-isp-images')\n var $cats = $picker.find('.su-generator-isp-categories')\n var $taxes = $picker.find('.su-generator-isp-taxonomies')\n var $terms = $('.su-generator-isp-terms')\n var $val = $picker.find('.su-generator-attr')\n var frame\n // Update hidden value\n var update = function () {\n var val = 'none'\n var ids = ''\n var source = $sources.val()\n // Media library\n if (source === 'media') {\n var images = []\n $images.find('span').each(\n function (i) {\n images[i] = $(this).data('id')\n }\n )\n if (images.length > 0) {\n ids = images.join(',')\n }\n }\n // Category\n else if (source === 'category') {\n var categories = $cats.val() || []\n if (categories.length > 0) {\n ids = categories.join(',')\n }\n }\n // Taxonomy\n else if (source === 'taxonomy') {\n var tax = $taxes.val() || ''\n var terms = $terms.val() || []\n if (tax !== '0' && terms.length > 0) {\n val = 'taxonomy: ' + tax + '/' + terms.join(',')\n }\n }\n // Deselect\n else if (source === '0') {\n val = 'none'\n }\n // Other options\n else {\n val = source\n }\n if (ids !== '') {\n val = source + ': ' + ids\n }\n $val.val(val).trigger('change')\n }\n // Switch source\n $sources.on(\n 'change',\n function (e) {\n var source = $(this).val()\n e.preventDefault()\n $source.removeClass('su-generator-isp-source-open')\n if (source.indexOf(':') === -1) {\n $picker.find('.su-generator-isp-source-' + source).addClass('su-generator-isp-source-open')\n }\n update()\n }\n )\n // Remove image\n $images.on(\n 'click',\n 'span i',\n function () {\n $(this).parent('span').css('border-color', '#f03').fadeOut(\n 300,\n function () {\n $(this).remove()\n update()\n }\n )\n }\n )\n // Add image\n $addMedia.click(\n function (e) {\n e.preventDefault()\n if (typeof (frame) !== 'undefined') {\n frame.close()\n }\n frame = wp.media.frames.su_media_frame_1 = wp.media(\n {\n title: SUGL10n.isp_media_title,\n library: {\n type: 'image'\n },\n button: {\n text: SUGL10n.isp_media_insert\n },\n multiple: true\n }\n )\n frame.on('open', function () {\n $('.mfp-wrap').addClass('hidden')\n })\n frame.on('close', function () {\n $('.mfp-wrap').removeClass('hidden')\n })\n frame.on(\n 'select',\n function () {\n var files = frame.state().get('selection').toJSON()\n $images.find('em').remove()\n $.each(\n files,\n function (i) {\n $images.append('<span data-id=\"' + this.id + '\" title=\"' + this.title + '\"><img src=\"' + this.url + '\" alt=\"\" /><i class=\"sui sui-times\"></i></span>')\n }\n )\n update()\n }\n ).open()\n }\n )\n // Sort images\n $images.sortable(\n {\n revert: 200,\n containment: $picker,\n tolerance: 'pointer',\n stop: function () {\n update()\n }\n }\n )\n // Select categories and terms\n $cats.on('change', update)\n $terms.on('change', update)\n // Select taxonomy\n $taxes.on(\n 'change',\n function () {\n var $cont = $(this).parents('.su-generator-isp-source')\n var tax = $(this).val()\n // Remove terms\n $terms.hide().find('option').remove()\n update()\n // Taxonomy is not selected\n if (tax === '0') {\n\n } else { // Taxonomy selected\n var ajaxTermSelect = $.ajax(\n {\n url: ajaxurl,\n type: 'post',\n dataType: 'html',\n data: {\n action: 'su_generator_get_terms',\n tax: tax,\n class: 'su-generator-isp-terms',\n multiple: true,\n size: 10\n },\n beforeSend: function () {\n if (typeof ajaxTermSelect === 'object') {\n ajaxTermSelect.abort()\n }\n $terms.html('').attr('disabled', true).hide()\n $cont.addClass('su-generator-loading')\n },\n success: function (data) {\n $terms.html(data).attr('disabled', false).show()\n $cont.removeClass('su-generator-loading')\n }\n }\n )\n }\n }\n )\n }\n )\n // Init media buttons\n $('.su-generator-upload-button').each(\n function () {\n var $button = $(this)\n var $val = $(this).parents('.su-generator-attr-container').find('input:text')\n var file\n $button.on(\n 'click',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // If the frame already exists, reopen it\n if (typeof (file) !== 'undefined') {\n file.close()\n }\n // Create WP media frame.\n file = wp.media.frames.su_media_frame_2 = wp.media(\n {\n // Title of media manager frame\n title: SUGL10n.upload_title,\n button: {\n // Button text\n text: SUGL10n.upload_insert\n },\n // Do not allow multiple files, if you want multiple, set true\n multiple: false\n }\n )\n // callback for selected image\n file.on(\n 'select',\n function () {\n var attachment = file.state().get('selection').first().toJSON()\n $val.val(attachment.url).trigger('change')\n }\n )\n file.on('open', function () {\n $('.mfp-wrap').addClass('hidden')\n })\n file.on('close', function () {\n $('.mfp-wrap').removeClass('hidden')\n })\n // Open modal\n file.open()\n }\n )\n }\n )\n // Init icon pickers\n $('.su-generator-icon-picker-button').each(\n function () {\n var $button = $(this)\n var $field = $(this).parents('.su-generator-attr-container')\n var $val = $field.find('.su-generator-attr')\n var $picker = $field.find('.su-generator-icon-picker')\n var $filter = $picker.find('input:text')\n $button.click(\n function (e) {\n $picker.toggleClass('su-generator-icon-picker-visible')\n $filter.val('').trigger('keyup')\n if ($picker.hasClass('su-generator-icon-picker-loaded')) {\n return\n }\n // Load icons\n $.ajax(\n {\n type: 'post',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_icons'\n },\n dataType: 'html',\n beforeSend: function () {\n // Show loading animation\n $picker.addClass('su-generator-loading')\n // Add loaded class\n $picker.addClass('su-generator-icon-picker-loaded')\n },\n success: function (data) {\n $picker.append(data)\n var $icons = $picker.children('i')\n $icons.click(\n function (e) {\n $val.val('icon: ' + $(this).attr('title'))\n $picker.removeClass('su-generator-icon-picker-visible')\n $val.trigger('change')\n e.preventDefault()\n }\n )\n $filter.on(\n {\n keyup: function () {\n var val = $(this).val()\n var regex = new RegExp(val, 'gi')\n // Hide all choices\n $icons.hide()\n // Find searched choices and show\n $icons.each(\n function () {\n // Get shortcode name\n var name = $(this).attr('title')\n // Show choice if matched\n if (name.match(regex) !== null) {\n $(this).show()\n }\n }\n )\n },\n focus: function () {\n $(this).val('')\n $icons.show()\n }\n }\n )\n $picker.removeClass('su-generator-loading')\n }\n }\n )\n e.preventDefault()\n }\n )\n }\n )\n // Init switches\n $('.su-generator-switch').click(\n function (e) {\n // Prepare data\n var $switch = $(this)\n var $value = $switch.parent().children('input')\n var isOn = $value.val() === 'yes'\n // Disable\n if (isOn) {\n // Change value\n $value.val('no').trigger('change')\n } else { // Enable\n // Change value\n $value.val('yes').trigger('change')\n }\n e.preventDefault()\n }\n )\n $('.su-generator-switch-value').on(\n 'change',\n function () {\n // Prepare data\n var $value = $(this)\n var $switch = $value.parent().children('.su-generator-switch')\n var value = $value.val()\n // Disable\n if (value === 'yes') {\n $switch.removeClass('su-generator-switch-no').addClass('su-generator-switch-yes')\n } else if (value === 'no') { // Enable\n $switch.removeClass('su-generator-switch-yes').addClass('su-generator-switch-no')\n }\n }\n )\n // Init tax_term selects\n $('select#su-generator-attr-taxonomy').on(\n 'change',\n function () {\n var $taxonomy = $(this)\n var tax = $taxonomy.val()\n var $terms = $('select#su-generator-attr-tax_term')\n // Load new options\n window.su_generator_get_terms = $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_terms',\n tax: tax,\n noselect: true\n },\n dataType: 'html',\n beforeSend: function () {\n // Check previous requests\n if (typeof window.su_generator_get_terms === 'object') {\n window.su_generator_get_terms.abort()\n }\n // Show loading animation\n $terms.parent().addClass('su-generator-loading')\n },\n success: function (data) {\n // Remove previous options\n $terms.find('option').remove()\n // Append new options\n $terms.append(data)\n // Hide loading animation\n $terms.parent().removeClass('su-generator-loading')\n }\n }\n )\n }\n )\n // Init shadow pickers\n $('.su-generator-shadow-picker').each(\n function (index) {\n var $picker = $(this)\n var $fields = $picker.find('.su-generator-shadow-picker-field input')\n var $hoff = $picker.find('.su-generator-sp-hoff')\n var $voff = $picker.find('.su-generator-sp-voff')\n var $blur = $picker.find('.su-generator-sp-blur')\n var $color = {\n cnt: $picker.find('.su-generator-shadow-picker-color'),\n value: $picker.find('.su-generator-shadow-picker-color-value'),\n wheel: $picker.find('.su-generator-shadow-picker-color-wheel')\n }\n var $val = $picker.find('.su-generator-attr')\n // Init color picker\n $color.wheel.farbtastic($color.value)\n $color.value.focus(\n function () {\n $color.wheel.show()\n }\n )\n $color.value.blur(\n function () {\n $color.wheel.hide()\n }\n )\n // Handle text fields\n $fields.on(\n 'change blur keyup',\n function () {\n $val.val($hoff.val() + 'px ' + $voff.val() + 'px ' + $blur.val() + 'px ' + $color.value.val()).trigger('change')\n }\n )\n $val.on(\n 'keyup',\n function () {\n var value = $(this).val().split(' ')\n // Value is correct\n if (value.length === 4) {\n $hoff.val(value[0].replace('px', ''))\n $voff.val(value[1].replace('px', ''))\n $blur.val(value[2].replace('px', ''))\n $color.value.val(value[3])\n $fields.trigger('keyup')\n }\n }\n )\n }\n )\n // Init border pickers\n $('.su-generator-border-picker').each(\n function (index) {\n var $picker = $(this)\n var $fields = $picker.find('.su-generator-border-picker-field input, .su-generator-border-picker-field select')\n var $width = $picker.find('.su-generator-bp-width')\n var $style = $picker.find('.su-generator-bp-style')\n var $color = {\n cnt: $picker.find('.su-generator-border-picker-color'),\n value: $picker.find('.su-generator-border-picker-color-value'),\n wheel: $picker.find('.su-generator-border-picker-color-wheel')\n }\n var $val = $picker.find('.su-generator-attr')\n // Init color picker\n $color.wheel.farbtastic($color.value)\n $color.value.focus(\n function () {\n $color.wheel.show()\n }\n )\n $color.value.blur(\n function () {\n $color.wheel.hide()\n }\n )\n // Handle text fields\n $fields.on(\n 'change blur keyup',\n function () {\n $val.val($width.val() + 'px ' + $style.val() + ' ' + $color.value.val()).trigger('change')\n }\n )\n $val.on(\n 'keyup',\n function () {\n var value = $(this).val().split(' ')\n // Value is correct\n if (value.length === 3) {\n $width.val(value[0].replace('px', ''))\n $style.val(value[1])\n $color.value.val(value[2])\n $fields.trigger('keyup')\n }\n }\n )\n }\n )\n // Remove skip class when setting is changed\n $settings.find('.su-generator-attr').on(\n 'change keyup blur',\n function () {\n var $cnt = $(this).parents('.su-generator-attr-container')\n var _default = $cnt.data('default')\n var val = $(this).val()\n // Value is changed\n if (val != _default) {\n $cnt.removeClass('su-generator-skip')\n } else {\n $cnt.addClass('su-generator-skip')\n }\n }\n )\n // Init value setters\n $('.su-generator-set-value').click(\n function (e) {\n $(this).parents('.su-generator-attr-container').find('input').val($(this).text()).trigger('change')\n }\n )\n // Save selected value\n $selected.val(shortcode)\n // Load last used preset\n $.ajax(\n {\n type: 'GET',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_preset',\n id: 'last_used',\n shortcode: shortcode,\n nonce: $('#su_generator_presets_nonce').val()\n },\n beforeSend: function () {\n // Show loading animation\n // $settings.addClass('su-generator-loading');\n },\n success: function (data) {\n // Remove loading animation\n // $settings.removeClass('su-generator-loading');\n // Set new settings\n self.setSettings(data)\n // Apply selected text to the content field\n var $content = $('#su-generator-content')\n if (typeof self.state.mceSelection !== 'undefined' && self.state.mceSelection !== '' && $content.attr('type') !== 'hidden') {\n $content.val(self.state.mceSelection)\n }\n },\n dataType: 'json'\n }\n )\n },\n dataType: 'html'\n }\n )\n }\n )\n // Insert shortcode\n $('#su-generator').on('click', '.su-generator-insert', self.insertShortcode)\n // Preview shortcode\n $('#su-generator').on(\n 'click',\n '.su-generator-toggle-preview',\n function (e) {\n // Prepare data\n var $preview = $('#su-generator-preview')\n var $button = $(this)\n // Hide button\n $button.hide()\n // Show preview box\n $preview.addClass('su-generator-loading').show()\n // Bind updating on settings changes\n $settings.find('input, textarea, select').on(\n 'change keyup blur',\n function () {\n self.updatePreview()\n }\n )\n // Update preview box\n self.updatePreview(true)\n // Prevent default action\n e.preventDefault()\n }\n )\n var gp_hover_timer\n // Presets manager - mouseenter\n $('#su-generator').on(\n 'mouseenter click',\n '.su-generator-presets',\n function () {\n clearTimeout(gp_hover_timer)\n $('.su-gp-popup').show()\n }\n )\n // Presets manager - mouseleave\n $('#su-generator').on(\n 'mouseleave',\n '.su-generator-presets',\n function () {\n gp_hover_timer = window.setTimeout(\n function () {\n $('.su-gp-popup').fadeOut(200)\n },\n 600\n )\n }\n )\n // Presets manager - add new preset\n $('#su-generator').on(\n 'click',\n '.su-gp-new',\n function (e) {\n // Prepare data\n var $container = $(this).parents('.su-generator-presets')\n var $list = $('.su-gp-list')\n var id = new Date().getTime()\n // Ask for preset name\n var name = prompt(SUGL10n.presets_prompt_msg, SUGL10n.presets_prompt_value)\n // Name is entered\n if (name !== '' && name !== null) {\n // Hide default text\n $list.find('b').hide()\n // Add new option\n $list.append('<span data-id=\"' + id + '\"><em>' + name + '</em><i class=\"sui sui-times\"></i></span>')\n // Perform AJAX request\n self.addPreset(id, name)\n }\n }\n )\n // Presets manager - load preset\n $('#su-generator').on(\n 'click',\n '.su-gp-list span',\n function (e) {\n // Prepare data\n var shortcode = $('.su-generator-presets').data('shortcode')\n var id = $(this).data('id')\n var $insert = $('.su-generator-insert')\n // Hide popup\n $('.su-gp-popup').hide()\n // Disable hover timer\n clearTimeout(gp_hover_timer)\n // Get the preset\n $.ajax(\n {\n type: 'GET',\n url: ajaxurl,\n data: {\n action: 'su_generator_get_preset',\n id: id,\n shortcode: shortcode,\n nonce: $('#su_generator_presets_nonce').val()\n },\n beforeSend: function () {\n // Disable insert button\n $insert.addClass('button-primary-disabled').attr('disabled', true)\n },\n success: function (data) {\n // Enable insert button\n $insert.removeClass('button-primary-disabled').attr('disabled', false)\n // Set new settings\n self.setSettings(data)\n },\n dataType: 'json'\n }\n )\n // Prevent default action\n e.preventDefault()\n e.stopPropagation()\n }\n )\n // Presets manager - remove preset\n $('#su-generator').on(\n 'click',\n '.su-gp-list i',\n function (e) {\n // Prepare data\n var $list = $(this).parents('.su-gp-list')\n var $preset = $(this).parent('span')\n var id = $preset.data('id')\n // Remove DOM element\n $preset.remove()\n // Show default text if last preset was removed\n if ($list.find('span').length < 1) {\n $list.find('b').show()\n }\n // Perform ajax request\n self.removePreset(id)\n // Prevent <span> action\n e.stopPropagation()\n // Prevent default action\n e.preventDefault()\n }\n )\n }\n\n /**\n\t * Create new preset with specified name from current settings\n\t */\n self.addPreset = function (id, name) {\n // Prepare shortcode name and current settings\n var shortcode = $('.su-generator-presets').data('shortcode')\n var settings = self.getSettings()\n // Perform AJAX request\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_add_preset',\n id: id,\n name: name,\n shortcode: shortcode,\n settings: settings,\n nonce: $('#su_generator_presets_nonce').val()\n }\n }\n )\n }\n /**\n\t * Remove preset by ID\n\t */\n self.removePreset = function (id) {\n // Get current shortcode name\n var shortcode = $('.su-generator-presets').data('shortcode')\n // Perform AJAX request\n $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n data: {\n action: 'su_generator_remove_preset',\n id: id,\n shortcode: shortcode,\n nonce: $('#su_generator_presets_nonce').val()\n }\n }\n )\n }\n\n self.parseSettings = function () {\n var settingsSelector = $('#su-generator-option-skip').val() === 'on'\n ? '#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr'\n : '#su-generator-settings .su-generator-attr-container .su-generator-attr'\n // Prepare data\n var query = $selected.val()\n var prefix = $prefix.val()\n var $settings = $(settingsSelector)\n var $content = $('textarea#su-generator-content')\n var content = $content.length ? $content.val() : 'false'\n var result = new String('')\n // Open shortcode\n result += '[' + prefix + query\n // Add shortcode attributes\n $settings.each(\n function () {\n // Prepare field and value\n var $this = $(this)\n var value = ''\n // Selects\n if ($this.is('select')) {\n value = $this.find('option:selected').val()\n }\n // Other fields\n else {\n value = $this.val()\n }\n // Check that value is not empty\n if (value == null) {\n value = ''\n } else if (typeof value === 'array') {\n value = value.join(',')\n }\n // Add attribute\n if (value !== '') {\n result += ' ' + $(this).attr('name') + '=\"' + $(this).val().toString().replace(/\"/gi, \"'\") + '\"'\n }\n }\n )\n // End of opening tag\n result += ']'\n // Wrap shortcode if content presented\n if (content != 'false') {\n result += content + '[/' + prefix + query + ']'\n }\n // Return result\n return result\n }\n\n self.getSettings = function () {\n // Prepare data\n var query = $selected.val()\n var $settings = $('#su-generator-settings .su-generator-attr')\n var $content = $('textarea#su-generator-content')\n var content = $content.length ? $content.val() : 'false'\n var data = {}\n // Add shortcode attributes\n $settings.each(\n function (i) {\n // Prepare field and value\n var $this = $(this)\n var value = ''\n var name = $this.attr('name')\n // Selects\n if ($this.is('select')) {\n value = $this.find('option:selected').val()\n }\n // Other fields\n else {\n value = $this.val()\n }\n // Check that value is not empty\n if (value == null) {\n value = ''\n }\n // Save value\n data[name] = value\n }\n )\n // Add content\n data.content = content.toString()\n // Return data\n return data\n }\n\n self.setSettings = function (data) {\n // Prepare data\n var $settings = $('#su-generator-settings .su-generator-attr')\n var $content = $('#su-generator-content')\n // Loop through settings\n $settings.each(\n function () {\n var $this = $(this)\n var name = $this.attr('name')\n // Data contains value for this field\n if (data.hasOwnProperty(name)) {\n // Set new value\n $this.val(data[name])\n $this.trigger('keyup').trigger('change').trigger('blur')\n }\n }\n )\n // Set content\n if (data.hasOwnProperty('content')) {\n $content.val(data.content).trigger('keyup').trigger('change').trigger('blur')\n }\n // Update preview\n self.updatePreview()\n }\n\n self.updatePreview = function (forced) {\n // Prepare data\n var $preview = $('#su-generator-preview')\n var shortcode = self.parseSettings()\n var previous = $result.text()\n // Check forced mode\n forced = forced || false\n // Break if preview box is hidden (preview isn't enabled)\n if (!$preview.is(':visible')) {\n return\n }\n // Check shortcode is changed is this is not a forced mode\n if (shortcode === previous && !forced) {\n return\n }\n // Run timer to filter often calls\n window.clearTimeout(self.state.preview.timer)\n self.state.preview.timer = window.setTimeout(\n function () {\n self.state.preview.request = $.ajax(\n {\n type: 'POST',\n url: ajaxurl,\n cache: false,\n data: {\n action: 'su_generator_preview',\n shortcode: shortcode\n },\n beforeSend: function () {\n // Abort previous requests\n if (self.state.preview.request) {\n self.state.preview.request.abort()\n }\n // Show loading animation\n $preview.addClass('su-generator-loading').html('')\n },\n success: function (data) {\n // Hide loading animation and set new HTML\n $preview.html(data).removeClass('su-generator-loading')\n },\n dataType: 'html'\n }\n )\n },\n 300\n )\n // Save shortcode to div\n $result.text(shortcode)\n }\n\n self.insert = function (context, args) {\n if (typeof context !== 'string' || typeof args !== 'object') {\n return\n }\n\n self.state.context = context\n self.state.insertArgs = args\n\n var preSelectedShortcode = args.shortcode || ''\n\n var mfpOptions = {\n type: 'inline',\n alignTop: true,\n closeOnBgClick: false,\n mainClass: 'su-generator-mfp',\n items: {\n src: '#su-generator'\n },\n callbacks: {}\n }\n\n mfpOptions.callbacks.open = () => {\n if (preSelectedShortcode) {\n $choice.filter(`[data-shortcode=\"${preSelectedShortcode}\"]`).trigger('click')\n } else {\n window.setTimeout(() => $search.focus(), 200)\n }\n\n // self.el.body.addClass( 'su-mfp-shown' );\n\n if (\n typeof tinyMCE !== 'undefined' &&\n\t\t\t\ttinyMCE.activeEditor != null &&\n\t\t\t\ttinyMCE.activeEditor.hasOwnProperty('selection')\n ) {\n self.state.mceSelection = tinyMCE.activeEditor.selection.getContent({ format: 'text' })\n }\n }\n\n mfpOptions.callbacks.close = () => {\n $search.val('')\n $settings.html('').hide()\n $generator.removeClass('su-generator-narrow')\n $filter.show()\n $choices.show()\n $choice.show()\n\n self.state.mceSelection = ''\n\n // self.el.body.removeClass( 'su-mfp-shown' );\n }\n\n $.magnificPopup.open(mfpOptions)\n }\n\n self.insertShortcode = function () {\n var shortcode = self.parseSettings()\n\n self.addPreset('last_used', SUGL10n.last_used)\n\n $.magnificPopup.close()\n\n $result.text(shortcode)\n\n if (self.state.context === 'html') {\n var HTMLEditor = document.getElementById(self.state.insertArgs.editorID)\n self.insertAtCaret(HTMLEditor, shortcode)\n }\n\n if (self.state.context === 'classic') {\n window.wp.media.editor.insert(shortcode)\n }\n\n if (self.state.context === 'block') {\n var props = self.state.insertArgs.props\n\n if (props.attributes.hasOwnProperty('content')) {\n props.setAttributes({ content: props.attributes.content + shortcode })\n } else if (props.name === 'core/shortcode') {\n var originalText = props.attributes.hasOwnProperty('text')\n ? props.attributes.text\n : ''\n\n props.setAttributes({ text: originalText + shortcode })\n }\n }\n }\n\n self.insertAtCaret = (field, text) => {\n var start = field.selectionStart\n field.value = field.value.substring(0, start) + text + field.value.substring(start)\n field.focus()\n field.selectionStart = start + text.length\n }\n\n return {\n init: self.init,\n insert: self.insert\n }\n})(jQuery)\n\njQuery(document).ready(window.SUG.App.init)\n"]}
includes/shortcodes/display-posts.php CHANGED
@@ -247,8 +247,6 @@ function su_shortcode_display_posts( $atts = null, $content = null ) {
247
  )
248
  );
249
 
250
- // TODO: sanitize everything if possible (0) [!]
251
-
252
  $atts['quality'] = sanitize_key( $atts['quality'] );
253
 
254
  $atts['template'] = su_shortcode_display_posts_locate_template( $atts['template'] );
247
  )
248
  );
249
 
 
 
250
  $atts['quality'] = sanitize_key( $atts['quality'] );
251
 
252
  $atts['template'] = su_shortcode_display_posts_locate_template( $atts['template'] );
languages/shortcodes-ultimate.pot CHANGED
@@ -375,7 +375,7 @@ msgstr ""
375
  msgid "Select taxonomy and it's terms.<br>You can select multiple terms with Ctrl (Cmd) key"
376
  msgstr ""
377
 
378
- #: inc/core/generator.php:56, inc/core/generator.php:124, inc/core/generator.php:152, inc/core/generator.php:279
379
  msgid "Insert shortcode"
380
  msgstr ""
381
 
@@ -407,47 +407,47 @@ msgstr ""
407
  msgid "Filter by type"
408
  msgstr ""
409
 
410
- #: inc/core/generator.php:264
411
  msgid "Shortcode not specified"
412
  msgstr ""
413
 
414
- #: inc/core/generator.php:280
415
  msgid "Live preview"
416
  msgstr ""
417
 
418
- #: inc/core/generator.php:284, admin/partials/pro-features/generator.php:2
419
  msgid "Click to return to the shortcodes list"
420
  msgstr ""
421
 
422
- #: inc/core/generator.php:284, admin/partials/pro-features/generator.php:2
423
  msgid "All shortcodes"
424
  msgstr ""
425
 
426
- #: inc/core/generator.php:308
427
  msgid "Click to set this value"
428
  msgstr ""
429
 
430
- #: inc/core/generator.php:326, includes/config/groups.php:7
431
  msgid "Content"
432
  msgstr ""
433
 
434
- #: inc/core/generator.php:343
435
  msgid "Preview"
436
  msgstr ""
437
 
438
- #: inc/core/generator.php:351
439
  msgid "Access denied"
440
  msgstr ""
441
 
442
- #: inc/core/generator.php:396
443
  msgid "Presets"
444
  msgstr ""
445
 
446
- #: inc/core/generator.php:399
447
  msgid "Save current settings as preset"
448
  msgstr ""
449
 
450
- #: inc/core/generator.php:431, inc/core/generator.php:428
451
  msgid "Presets not found"
452
  msgstr ""
453
 
@@ -1711,7 +1711,7 @@ msgstr ""
1711
  msgid "Custom posts query with customizable template"
1712
  msgstr ""
1713
 
1714
- #: includes/shortcodes/display-posts.php:260, includes/shortcodes/posts.php:397, includes/shortcodes/template.php:33
1715
  msgid "invalid template name"
1716
  msgstr ""
1717
 
375
  msgid "Select taxonomy and it's terms.<br>You can select multiple terms with Ctrl (Cmd) key"
376
  msgstr ""
377
 
378
+ #: inc/core/generator.php:56, inc/core/generator.php:124, inc/core/generator.php:152, inc/core/generator.php:280
379
  msgid "Insert shortcode"
380
  msgstr ""
381
 
407
  msgid "Filter by type"
408
  msgstr ""
409
 
410
+ #: inc/core/generator.php:265
411
  msgid "Shortcode not specified"
412
  msgstr ""
413
 
414
+ #: inc/core/generator.php:281
415
  msgid "Live preview"
416
  msgstr ""
417
 
418
+ #: inc/core/generator.php:285, admin/partials/pro-features/generator.php:2
419
  msgid "Click to return to the shortcodes list"
420
  msgstr ""
421
 
422
+ #: inc/core/generator.php:285, admin/partials/pro-features/generator.php:2
423
  msgid "All shortcodes"
424
  msgstr ""
425
 
426
+ #: inc/core/generator.php:309
427
  msgid "Click to set this value"
428
  msgstr ""
429
 
430
+ #: inc/core/generator.php:327, includes/config/groups.php:7
431
  msgid "Content"
432
  msgstr ""
433
 
434
+ #: inc/core/generator.php:344
435
  msgid "Preview"
436
  msgstr ""
437
 
438
+ #: inc/core/generator.php:352
439
  msgid "Access denied"
440
  msgstr ""
441
 
442
+ #: inc/core/generator.php:397
443
  msgid "Presets"
444
  msgstr ""
445
 
446
+ #: inc/core/generator.php:400
447
  msgid "Save current settings as preset"
448
  msgstr ""
449
 
450
+ #: inc/core/generator.php:432, inc/core/generator.php:429
451
  msgid "Presets not found"
452
  msgstr ""
453
 
1711
  msgid "Custom posts query with customizable template"
1712
  msgstr ""
1713
 
1714
+ #: includes/shortcodes/display-posts.php:258, includes/shortcodes/posts.php:397, includes/shortcodes/template.php:33
1715
  msgid "invalid template name"
1716
  msgstr ""
1717
 
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: gn_themes
3
  License: GPLv3
4
  Donate link: https://paypal.me/anovladimir
5
  Tags: shortcode, toggle, columns, button, slider
6
- Stable tag: 5.12.0
7
  Requires PHP: 5.4
8
  Requires at least: 4.6
9
- Tested up to: 5.9
10
 
11
 
12
  A comprehensive collection of visual components for your site
@@ -35,20 +35,11 @@ A comprehensive collection of visual components for your site
35
  ### Links
36
 
37
  - [Available Shortcodes](https://getshortcodes.com/docs-category/shortcodes/?utm_campaign=wporg&utm_source=readme&utm_medium=available-shortcodes)
38
- - [Add-ons](https://getshortcodes.com/add-ons/?utm_campaign=wporg&utm_source=readme&utm_medium=add-ons)
39
  - [Documentation](https://getshortcodes.com/docs/?utm_campaign=wporg&utm_source=readme&utm_medium=docs)
40
  - [Support Forum](https://wordpress.org/support/plugin/shortcodes-ultimate)
41
  - [Premium Support](https://getshortcodes.com/support/?utm_campaign=wporg&utm_source=readme&utm_medium=support)
42
 
43
 
44
- ### Check out premium add-ons!
45
-
46
- - [Extra Shortcodes](https://getshortcodes.com/add-ons/extra-shortcodes/?utm_campaign=wporg&utm_source=readme&utm_medium=extra-shortcodes) - 15+ additional shortcodes
47
- - [Additional Skins](https://getshortcodes.com/add-ons/additional-skins/?utm_campaign=wporg&utm_source=readme&utm_medium=additional-skins) - 60+ additional skins
48
- - [Shortcode Creator](https://getshortcodes.com/add-ons/shortcode-creator/?utm_campaign=wporg&utm_source=readme&utm_medium=shortcode-creator) - create your own custom shortcodes
49
- - **[Add-ons Bundle](https://getshortcodes.com/add-ons/add-ons-bundle/?utm_campaign=wporg&utm_source=readme&utm_medium=add-ons-bundle)** - All-in-one!
50
-
51
-
52
  ### Available Shortcodes
53
 
54
  `
@@ -121,7 +112,6 @@ Yes, you can remove default shortcodes using 'su/data/shortcodes' filter. Tutori
121
  ### Can I create custom shortcodes?
122
 
123
  Yes, you can create custom shortcodes using 'su/data/shortcodes' filter. Tutorial: [How to add custom shortcodes](https://getshortcodes.com/docs/registering-custom-shortcodes/).
124
- Alternatively, you can use [Shortcode Creator add-on](https://getshortcodes.com/add-ons/shortcode-creator/).
125
 
126
 
127
  ### Can I use shortcodes in template files?
@@ -141,18 +131,18 @@ Yes! Shortcodes Ultimate is designed to work with any theme, but your theme must
141
 
142
  ### Where can I get help?
143
 
144
- First, visit the [Help Center](https://getshortcodes.com/support/). If you get stuck, ask for help at the [community support forum](https://wordpress.org/support/plugin/shortcodes-ultimate). Also, you can get personal support from the developer by purchasing any of the [premium add-ons](https://getshortcodes.com/add-ons/).
145
 
146
 
147
  ## Changelog
148
 
149
 
150
- ### 5.12.0
 
 
151
 
152
- **What's new**
153
 
154
- - New options `class` and `class_single` for the *Posts* shortcode. Use new options to specify custom CSS classes for the container and for a single post item respectively.
155
- - Tested compatibility with WordPress 5.9
156
 
157
  ---
158
  [Version history →](https://plugins.trac.wordpress.org/browser/shortcodes-ultimate/trunk/changelog.txt)
3
  License: GPLv3
4
  Donate link: https://paypal.me/anovladimir
5
  Tags: shortcode, toggle, columns, button, slider
6
+ Stable tag: 5.12.1
7
  Requires PHP: 5.4
8
  Requires at least: 4.6
9
+ Tested up to: 6.0
10
 
11
 
12
  A comprehensive collection of visual components for your site
35
  ### Links
36
 
37
  - [Available Shortcodes](https://getshortcodes.com/docs-category/shortcodes/?utm_campaign=wporg&utm_source=readme&utm_medium=available-shortcodes)
 
38
  - [Documentation](https://getshortcodes.com/docs/?utm_campaign=wporg&utm_source=readme&utm_medium=docs)
39
  - [Support Forum](https://wordpress.org/support/plugin/shortcodes-ultimate)
40
  - [Premium Support](https://getshortcodes.com/support/?utm_campaign=wporg&utm_source=readme&utm_medium=support)
41
 
42
 
 
 
 
 
 
 
 
 
43
  ### Available Shortcodes
44
 
45
  `
112
  ### Can I create custom shortcodes?
113
 
114
  Yes, you can create custom shortcodes using 'su/data/shortcodes' filter. Tutorial: [How to add custom shortcodes](https://getshortcodes.com/docs/registering-custom-shortcodes/).
 
115
 
116
 
117
  ### Can I use shortcodes in template files?
131
 
132
  ### Where can I get help?
133
 
134
+ First, visit the [Help Center](https://getshortcodes.com/support/). If you get stuck, ask for help at the [community support forum](https://wordpress.org/support/plugin/shortcodes-ultimate).
135
 
136
 
137
  ## Changelog
138
 
139
 
140
+ ### 5.12.1
141
+
142
+ **Security release**
143
 
144
+ This update fixes a security vulnerability in the shortcode generator. Thanks to Dave John for discovering it.
145
 
 
 
146
 
147
  ---
148
  [Version history →](https://plugins.trac.wordpress.org/browser/shortcodes-ultimate/trunk/changelog.txt)
shortcodes-ultimate.php CHANGED
@@ -7,13 +7,13 @@
7
  * Description: A comprehensive collection of visual components for WordPress
8
  * Text Domain: shortcodes-ultimate
9
  * License: GPLv3
10
- * Version: 5.12.0
11
  * Requires PHP: 5.4
12
  * Requires at least: 4.6
13
- * Tested up to: 5.9
14
  */
15
 
16
  define( 'SU_PLUGIN_FILE', __FILE__ );
17
- define( 'SU_PLUGIN_VERSION', '5.12.0' );
18
 
19
  require_once dirname( __FILE__ ) . '/plugin.php';
7
  * Description: A comprehensive collection of visual components for WordPress
8
  * Text Domain: shortcodes-ultimate
9
  * License: GPLv3
10
+ * Version: 5.12.1
11
  * Requires PHP: 5.4
12
  * Requires at least: 4.6
13
+ * Tested up to: 6.0
14
  */
15
 
16
  define( 'SU_PLUGIN_FILE', __FILE__ );
17
+ define( 'SU_PLUGIN_VERSION', '5.12.1' );
18
 
19
  require_once dirname( __FILE__ ) . '/plugin.php';