PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.5.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.5.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / js / send-command-3-5-0.min.js

send-command-3-5-0.min.js in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.5.0, at js/send-command-3-5-0.min.js

1 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function wpo_parse_json(e){if("object"==typeof e)return e;try{var o=JSON.parse(e);return o}catch(t){console.log("WPO: Exception when trying to parse JSON (1) - will attempt to fix/re-parse"),console.log(e)}var r=e.indexOf("{"),i=e.lastIndexOf("}");if(r>-1&&i>-1){var n=e.slice(r,i+1);try{var s=JSON.parse(n);return s}catch(t){console.log("WPO: Exception when trying to parse JSON (2) - will attempt to fix/re-parse based upon bracket counting");for(var c=r,a=0,p="",d=!1;(a>0||c==r)&&c<=i;){var u=e.charAt(c);d||"{"!=u?d||"}"!=u?'"'==u&&"\\"!=p&&(d=!d):a--:a++,p=u,c++}console.log("Started at cursor="+r+", ended at cursor="+c+" with result following:"),console.log(e.substring(r,c));try{var s=JSON.parse(e.substring(r,c));return s}catch(t){throw t}}}throw"WPO: could not parse the JSON"}var wp_optimize=window.wp_optimize||{};wp_optimize.send_command=function(e,o,t,r,i){r="undefined"==typeof r||r,o||(o={}),o.hasOwnProperty("include_ui_elements")||(o.include_ui_elements=!0);var n={action:"wp_optimize_ajax",subaction:e,nonce:wp_optimize_send_command_data.nonce,data:o},s={type:"post",data:n,success:function(e){if(r){try{var o=wpo_parse_json(e)}catch(i){return console.log(i),console.log(e),void alert(wpoptimize.error_unexpected_response)}if(!o.result&&o.hasOwnProperty("error_code")&&o.error_code)return void wp_optimize.notices.show_notice(o.error_code,o.error_message);"function"==typeof t&&t(o)}else{if(!e.result&&e.hasOwnProperty("error_code")&&e.error_code)return void wp_optimize.notices.show_notice(e.error_code,e.error_message);"function"==typeof t&&t(e)}}};return"object"==typeof i&&(i.hasOwnProperty("timeout")&&(s.timeout=i.timeout),i.hasOwnProperty("error")&&"function"==typeof i.error&&(s.error=i.error)),jQuery.ajax(ajaxurl,s)},wp_optimize.notices={errors:[],show_notice:function(e,o){jQuery("#wp-optimize-wrap").length?(this.notice||this.add_notice(),this.notice.show(),this.errors[e]||(this.errors[e]=jQuery("<p/>").html(o).appendTo(this.notice).data("error_code",e))):window.wp&&wp.hasOwnProperty("data")?wp.data.dispatch("core/notices").createNotice("error","WP-Optimize: "+o,{isDismissible:!0}):alert("WP-Optimize: "+o)},add_notice:function(){this.notice_container=jQuery('<div class="wpo-main-error-notice"></div>').prependTo("#wp-optimize-wrap"),this.notice=jQuery('<div class="notice notice-error wpo-notice is-dismissible"><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+commonL10n.dismiss+"</span></button></div>"),this.notice.appendTo(this.notice_container),this.notice.on("click",".notice-dismiss",function(e){this.notice.hide().find("p").remove(),this.errors=[]}.bind(this))}};