Speed Booster Pack - Version 3.8.5.1

Version Description

Release Date: 29 February 2020

  • Added: You can now exclude assets from lazy loading.
  • Added: More "default" exclude rules added for the JS optimization feature.
  • Fixed: An "empty needle" warning regarding replace functions.
  • Updated: Updated lazyload.js to 12.5.1.
  • Removed: Unnecessary jQuery UI slider script in the options screen.
Download this release

Release Info

Developer optimocha
Plugin Icon 128x128 Speed Booster Pack
Version 3.8.5.1
Comparing to
See all releases

Code changes from version 3.8.5 to 3.8.5.1

css/style.css CHANGED
@@ -3,13 +3,6 @@ html {
3
  box-sizing: border-box;
4
  }
5
 
6
- :target:before {
7
- content:"";
8
- display:block;
9
- height:90px;
10
- margin-top:-90px;
11
- }
12
-
13
  *,
14
  *:before,
15
  *:after {
@@ -374,6 +367,10 @@ margin-top:-90px;
374
  display: inline-block;
375
  }
376
 
 
 
 
 
377
  .sb-pack-tab .tooltip-right {
378
  display:inline-block;
379
  vertical-align: middle;
3
  box-sizing: border-box;
4
  }
5
 
 
 
 
 
 
 
 
6
  *,
7
  *:before,
8
  *:after {
367
  display: inline-block;
368
  }
369
 
370
+ .sb-pack-tab {
371
+ scroll-margin-top: 5rem;
372
+ }
373
+
374
  .sb-pack-tab .tooltip-right {
375
  display:inline-block;
376
  vertical-align: middle;
inc/core.php CHANGED
@@ -223,12 +223,12 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
223
  No Query String builders lst (TODO: find themify and x theme/cornerstone)
224
  */
225
  $page_builders = [
226
- "sbp_disable" => "1", // speed booster pack
227
  "fb-edit" => "1", // fusion builder
228
  "et_fb" => "1", // divi builder
229
  "PageSpeed" => "off", // mod_pagespeed
230
- "ao_noptimize" => "1", // autoptimize compat
231
- "ao_noptirocket" => "1", // autoptimize & wp rocket compat
 
232
  "fl_builder" => null, // beaver builder 1
233
  "bt-beaverbuildertheme" => "show", // beaver builder 2
234
  "ct_builder" => "true", // oxygen builder
@@ -237,7 +237,7 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
237
  "customize_changeset_uuid" => null, // wordpress core customizer
238
  "action" => "elementor", // elementor
239
  "ai-debug-blocks" => "1", // ad inserter
240
- "tipi_builder" => "1", // tipi builder
241
  "vc_action" => "vc_inline", // wpbakery page builder
242
  "brizy" => "edit", // brizy builder
243
  "siteorigin_panels_live_editor" => null, // siteorigin page builder
@@ -251,10 +251,6 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
251
  }
252
  }
253
 
254
- if ( @$sbp_options['sbp_disable_temporarily'] == true ) {
255
- return false;
256
- }
257
-
258
  return true;
259
  }
260
 
@@ -493,7 +489,7 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
493
  } // END function sbp_move_scripts_to_footer
494
 
495
  public function sbp_move_scripts_to_footer() {
496
- ob_start( [ $this, 'sbp_move_scripts_to_footer_worker' ] );
497
  }
498
 
499
  public function sbp_move_scripts_to_footer_worker( $html ) {
@@ -513,6 +509,7 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
513
 
514
  private function sbp_get_scripts_to_move( $html ) {
515
  global $sbp_js_footer_exceptions;
 
516
  preg_match_all( '/<!--[\s\S]*?-->|<script[\s\S]*?>[\s\S]*?<\/script>/im', $html, $result );
517
  $scripts = $result[0];
518
  $includedScripts = [];
@@ -540,16 +537,12 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
540
  $src = $result[1];
541
 
542
  $src = str_replace( [ '\r', '\n' ], '', $src );
543
-
544
  foreach ( $sbp_js_footer_exceptions as $exception ) {
545
  if ( strpos( $src, $exception ) !== false ) {
546
  unset( $includedScripts[ $i ] );
547
  }
548
  }
549
 
550
- // if ( in_array( $src, $sbp_js_footer_exceptions ) ) {
551
- // unset( $includedScripts[ $i ] );
552
- // }
553
  }
554
  unset( $result );
555
  preg_match( '/<script[\s\S]*?>(.*?)<\/script>/ims', $script, $result );
@@ -622,9 +615,6 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
622
  echo '<script type="text/javascript" src="' . esc_attr( $script_src ) . '"></script>';
623
  }
624
 
625
- // deregister & dequeue the script
626
- //wp_deregister_script( 'jquery-core' );
627
- //wp_dequeue_script( 'jquery-core' );
628
  $wp_scripts->registered['jquery-core']->src = null;
629
  }
630
 
@@ -1030,7 +1020,7 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
1030
  ---------------------------------*/
1031
 
1032
  function sbp_lazy_load_script() {
1033
- wp_enqueue_script( 'sbp-lazy-load', plugins_url( 'js/lazyload.js', __FILE__ ), false, '12.4', true );
1034
  wp_add_inline_script( 'sbp-lazy-load',
1035
  '
1036
  (function() {
@@ -1047,14 +1037,54 @@ if ( ! class_exists( 'Speed_Booster_Pack_Core' ) ) {
1047
  }
1048
 
1049
  function sbp_lazy_loader( $html ) {
 
 
 
1050
  $placeholder = 'data:image/svg+xml,%3Csvg%20xmlns%3D%27http://www.w3.org/2000/svg%27%20viewBox%3D%270%200%203%202%27%3E%3C/svg%3E';
1051
- $html = preg_replace( "/<(img|source|iframe)(.*?) (src=)(.*?)>/is",
1052
- '<$1$2 $3"' . $placeholder . '" data-$3$4>',
1053
- $html );
1054
- $html = preg_replace( "/<(img|source|iframe)(.*?) (srcset=)(.*?)>/is",
1055
- '<$1$2 $3"' . $placeholder . '" data-$3$4>',
1056
- $html );
1057
- $html = preg_replace( "/<(img|source|iframe)(.*?) ?(\/?)>/is", '<$1$2 loading="lazy" $3>', $html );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
 
1059
  return $html;
1060
  }
223
  No Query String builders lst (TODO: find themify and x theme/cornerstone)
224
  */
225
  $page_builders = [
 
226
  "fb-edit" => "1", // fusion builder
227
  "et_fb" => "1", // divi builder
228
  "PageSpeed" => "off", // mod_pagespeed
229
+ "ao_noptimize" => "1", // autoptimize
230
+ "ao_noptirocket" => "1", // autoptimize & wp rocket
231
+ "sbp_disable" => "1", // speed booster pack
232
  "fl_builder" => null, // beaver builder 1
233
  "bt-beaverbuildertheme" => "show", // beaver builder 2
234
  "ct_builder" => "true", // oxygen builder
237
  "customize_changeset_uuid" => null, // wordpress core customizer
238
  "action" => "elementor", // elementor
239
  "ai-debug-blocks" => "1", // ad inserter
240
+ "tipi_builder" => "1", // tipi builder?
241
  "vc_action" => "vc_inline", // wpbakery page builder
242
  "brizy" => "edit", // brizy builder
243
  "siteorigin_panels_live_editor" => null, // siteorigin page builder
251
  }
252
  }
253
 
 
 
 
 
254
  return true;
255
  }
256
 
489
  } // END function sbp_move_scripts_to_footer
490
 
491
  public function sbp_move_scripts_to_footer() {
492
+ ob_start( [ $this, 'sbp_move_scripts_to_footer_worker' ] );
493
  }
494
 
495
  public function sbp_move_scripts_to_footer_worker( $html ) {
509
 
510
  private function sbp_get_scripts_to_move( $html ) {
511
  global $sbp_js_footer_exceptions;
512
+ $sbp_js_footer_exceptions = array_filter($sbp_js_footer_exceptions);
513
  preg_match_all( '/<!--[\s\S]*?-->|<script[\s\S]*?>[\s\S]*?<\/script>/im', $html, $result );
514
  $scripts = $result[0];
515
  $includedScripts = [];
537
  $src = $result[1];
538
 
539
  $src = str_replace( [ '\r', '\n' ], '', $src );
 
540
  foreach ( $sbp_js_footer_exceptions as $exception ) {
541
  if ( strpos( $src, $exception ) !== false ) {
542
  unset( $includedScripts[ $i ] );
543
  }
544
  }
545
 
 
 
 
546
  }
547
  unset( $result );
548
  preg_match( '/<script[\s\S]*?>(.*?)<\/script>/ims', $script, $result );
615
  echo '<script type="text/javascript" src="' . esc_attr( $script_src ) . '"></script>';
616
  }
617
 
 
 
 
618
  $wp_scripts->registered['jquery-core']->src = null;
619
  }
620
 
1020
  ---------------------------------*/
1021
 
1022
  function sbp_lazy_load_script() {
1023
+ wp_enqueue_script( 'sbp-lazy-load', plugins_url( 'js/lazyload.js', __FILE__ ), false, '12.5.1', true );
1024
  wp_add_inline_script( 'sbp-lazy-load',
1025
  '
1026
  (function() {
1037
  }
1038
 
1039
  function sbp_lazy_loader( $html ) {
1040
+ $lazyload_exclusions = array_filter( explode( PHP_EOL, get_option( 'sbp_lazyload_exclusions' ) ) );
1041
+ $lazyload_exclusions[] = 'data-no-lazy';
1042
+ $lazyload_exclusions[] = 'data-skip-lazy';
1043
  $placeholder = 'data:image/svg+xml,%3Csvg%20xmlns%3D%27http://www.w3.org/2000/svg%27%20viewBox%3D%270%200%203%202%27%3E%3C/svg%3E';
1044
+
1045
+ // Find all images
1046
+ preg_match_all( '/<(img|source|iframe)(.*?) (src=)[\'|"](.*?)[\'|"](.*?)>/is', $html, $source_elements );
1047
+
1048
+ // If no exclusions exists, don't waste time to determine what to exclude. Go to else block and preg_replace all the content
1049
+
1050
+ $elements_to_be_changed = [];
1051
+
1052
+ // Determine which images will be changed
1053
+ foreach ( $source_elements[0] as $element ) {
1054
+ $exclude_element = false;
1055
+ if (count($lazyload_exclusions) > 0) {
1056
+ foreach ( $lazyload_exclusions as $exclusion ) {
1057
+ $exclusion = trim( $exclusion );
1058
+ if ( false !== strpos( $element, $exclusion ) ) {
1059
+ $exclude_element = true;
1060
+ }
1061
+ }
1062
+ }
1063
+
1064
+ // If not excluded element, put it into the to be changed list.
1065
+ if ( false === $exclude_element ) {
1066
+ $elements_to_be_changed[] = $element;
1067
+ }
1068
+ }
1069
+
1070
+ // Clean the possible repeated elements
1071
+ $elements_to_be_changed = array_unique( $elements_to_be_changed );
1072
+
1073
+ // Process all elements marked as to be changed
1074
+ foreach ( $elements_to_be_changed as $element ) {
1075
+ $newElement = preg_replace( "/<(img|source|iframe)(.*?) (src=)(.*?)>/is",
1076
+ '<$1$2 $3"' . $placeholder . '" data-$3$4>',
1077
+ $element );
1078
+ $newElement = preg_replace( "/<(img|source|iframe)(.*?) (srcset=)(.*?)>/is",
1079
+ '<$1$2 $3"' . $placeholder . '" data-$3$4>',
1080
+ $newElement );
1081
+ $newElement = preg_replace( "/<(img|source|iframe)(.*?) ?(\/?)>/is",
1082
+ '<$1$2 loading="lazy" $3>',
1083
+ $newElement );
1084
+
1085
+ $html = str_replace( $element, $newElement, $html );
1086
+ }
1087
+
1088
 
1089
  return $html;
1090
  }
inc/js/lazyload.js CHANGED
@@ -1,4 +1,4 @@
1
- /* lazyload.js - v12.4.0
2
  * https://github.com/verlok/lazyload
3
- * Copyright (c) 2019 Andrea Verlicchi; Licensed MIT */
4
- function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n=t&&"IntersectionObserver"in window,r=t&&"classList"in document.createElement("p"),o={elements_selector:"img",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_poster:"poster",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,auto_unobserve:!0,callback_enter:null,callback_exit:null,callback_reveal:null,callback_loaded:null,callback_error:null,callback_finish:null,use_native:!1},a=function(t,e){var n,r=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:r}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:r})}window.dispatchEvent(n)};var i=function(t,e){return t.getAttribute("data-"+e)},s=function(t,e,n){var r="data-"+e;null!==n?t.setAttribute(r,n):t.removeAttribute(r)},c=function(t){return"true"===i(t,"was-processed")},l=function(t,e){return s(t,"ll-timeout",e)},u=function(t){return i(t,"ll-timeout")},d=function(t,e,n,r){t&&(void 0===r?void 0===n?t(e):t(e,n):t(e,n,r))},f=function(t,e){t._loadingCount+=e,0===t._elements.length&&0===t._loadingCount&&d(t._settings.callback_finish,t)},_=function(t){for(var e,n=[],r=0;e=t.children[r];r+=1)"SOURCE"===e.tagName&&n.push(e);return n},v=function(t,e,n){n&&t.setAttribute(e,n)},b=function(t,e){v(t,"sizes",i(t,e.data_sizes)),v(t,"srcset",i(t,e.data_srcset)),v(t,"src",i(t,e.data_src))},m={IMG:function(t,e){var n=t.parentNode;n&&"PICTURE"===n.tagName&&_(n).forEach(function(t){b(t,e)});b(t,e)},IFRAME:function(t,e){v(t,"src",i(t,e.data_src))},VIDEO:function(t,e){_(t).forEach(function(t){v(t,"src",i(t,e.data_src))}),v(t,"poster",i(t,e.data_poster)),v(t,"src",i(t,e.data_src)),t.load()}},p=function(t,e){var n,r,o=e._settings,a=t.tagName,s=m[a];if(s)return s(t,o),f(e,1),void(e._elements=(n=e._elements,r=t,n.filter(function(t){return t!==r})));!function(t,e){var n=i(t,e.data_src),r=i(t,e.data_bg);n&&(t.style.backgroundImage='url("'.concat(n,'")')),r&&(t.style.backgroundImage=r)}(t,o)},g=function(t,e){r?t.classList.add(e):t.className+=(t.className?" ":"")+e},y=function(t,e){r?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},h=function(t,e,n){t.addEventListener(e,n)},E=function(t,e,n){t.removeEventListener(e,n)},w=function(t,e,n){E(t,"load",e),E(t,"loadeddata",e),E(t,"error",n)},A=function(t,e,n){var r=n._settings,o=e?r.class_loaded:r.class_error,a=e?r.callback_loaded:r.callback_error,i=t.target;y(i,r.class_loading),g(i,o),d(a,i,n),f(n,-1)},I=function(t,e){var n=function n(o){A(o,!0,e),w(t,n,r)},r=function r(o){A(o,!1,e),w(t,n,r)};!function(t,e,n){h(t,"load",e),h(t,"loadeddata",e),h(t,"error",n)}(t,n,r)},k=["IMG","IFRAME","VIDEO"],L=function(t,e){var n=e._observer;S(t,e),n&&e._settings.auto_unobserve&&n.unobserve(t)},O=function(t){var e=u(t);e&&(clearTimeout(e),l(t,null))},x=function(t,e){var n=e._settings.load_delay,r=u(t);r||(r=setTimeout(function(){L(t,e),O(t)},n),l(t,r))},S=function(t,e,n){var r=e._settings;!n&&c(t)||(k.indexOf(t.tagName)>-1&&(I(t,e),g(t,r.class_loading)),p(t,e),function(t){s(t,"was-processed","true")}(t),d(r.callback_reveal,t,e),d(r.callback_set,t,e))},z=function(t){return!!n&&(t._observer=new IntersectionObserver(function(e){e.forEach(function(e){return function(t){return t.isIntersecting||t.intersectionRatio>0}(e)?function(t,e,n){var r=n._settings;d(r.callback_enter,t,e,n),r.load_delay?x(t,n):L(t,n)}(e.target,e,t):function(t,e,n){var r=n._settings;d(r.callback_exit,t,e,n),r.load_delay&&O(t)}(e.target,e,t)})},{root:(e=t._settings).container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),!0);var e},C=["IMG","IFRAME"],N=function(t,e){return function(t){return t.filter(function(t){return!c(t)})}((n=t||function(t){return t.container.querySelectorAll(t.elements_selector)}(e),Array.prototype.slice.call(n)));var n},M=function(t){var e=t._settings;_toConsumableArray(e.container.querySelectorAll("."+e.class_error)).forEach(function(t){y(t,e.class_error),function(t){s(t,"was-processed",null)}(t)}),t.update()},R=function(e,n){var r;this._settings=function(t){return _extends({},o,t)}(e),this._loadingCount=0,z(this),this.update(n),r=this,t&&window.addEventListener("online",function(t){M(r)})};return R.prototype={update:function(t){var n,r=this,o=this._settings;(this._elements=N(t,o),!e&&this._observer)?(function(t){return t.use_native&&"loading"in HTMLImageElement.prototype}(o)&&((n=this)._elements.forEach(function(t){-1!==C.indexOf(t.tagName)&&(t.setAttribute("loading","lazy"),S(t,n))}),this._elements=N(t,o)),this._elements.forEach(function(t){r._observer.observe(t)})):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){S(t,this,e)},loadAll:function(){var t=this;this._elements.forEach(function(e){L(e,t)})}},t&&function(t,e){if(e)if(e.length)for(var n,r=0;n=e[r];r+=1)a(t,n);else a(t,e)}(R,window.lazyLoadOptions),R});
1
+ /* lazyload.js - v12.5.1
2
  * https://github.com/verlok/lazyload
3
+ * Copyright (c) 2020 Andrea Verlicchi; Licensed MIT */
4
+ function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).LazyLoad=e()}(this,function(){"use strict";var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n=t&&"IntersectionObserver"in window,o=t&&"classList"in document.createElement("p"),r={elements_selector:"img",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_poster:"poster",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,auto_unobserve:!0,callback_enter:null,callback_exit:null,callback_reveal:null,callback_loaded:null,callback_error:null,callback_finish:null,use_native:!1},a=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)};var s=function(t,e){return t.getAttribute("data-"+e)},i=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},c=function(t){return"true"===s(t,"was-processed")},l=function(t,e){return i(t,"ll-timeout",e)},u=function(t){return s(t,"ll-timeout")},d=function(t,e,n,o){t&&(void 0===o?void 0===n?t(e):t(e,n):t(e,n,o))},f=function(t,e){t.loadingCount+=e,0===t._elements.length&&0===t.loadingCount&&d(t._settings.callback_finish,t)},_=function(t){for(var e,n=[],o=0;e=t.children[o];o+=1)"SOURCE"===e.tagName&&n.push(e);return n},v=function(t,e,n){n&&t.setAttribute(e,n)},g=function(t,e){v(t,"sizes",s(t,e.data_sizes)),v(t,"srcset",s(t,e.data_srcset)),v(t,"src",s(t,e.data_src))},m={IMG:function(t,e){var n=t.parentNode;n&&"PICTURE"===n.tagName&&_(n).forEach(function(t){g(t,e)});g(t,e)},IFRAME:function(t,e){v(t,"src",s(t,e.data_src))},VIDEO:function(t,e){_(t).forEach(function(t){v(t,"src",s(t,e.data_src))}),v(t,"poster",s(t,e.data_poster)),v(t,"src",s(t,e.data_src)),t.load()}},h=function(t,e){var n,o,r=e._settings,a=t.tagName,i=m[a];if(i)return i(t,r),f(e,1),void(e._elements=(n=e._elements,o=t,n.filter(function(t){return t!==o})));!function(t,e){var n=s(t,e.data_src),o=s(t,e.data_bg);n&&(t.style.backgroundImage='url("'.concat(n,'")')),o&&(t.style.backgroundImage=o)}(t,r)},p=function(t,e){o?t.classList.add(e):t.className+=(t.className?" ":"")+e},b=function(t,e){o?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},y=function(t,e,n){t.addEventListener(e,n)},E=function(t,e,n){t.removeEventListener(e,n)},w=function(t,e,n){E(t,"load",e),E(t,"loadeddata",e),E(t,"error",n)},I=function(t,e,n){var o=n._settings,r=e?o.class_loaded:o.class_error,a=e?o.callback_loaded:o.callback_error,s=t.target;b(s,o.class_loading),p(s,r),d(a,s,n),f(n,-1)},k=function(t,e){var n=function n(r){I(r,!0,e),w(t,n,o)},o=function o(r){I(r,!1,e),w(t,n,o)};!function(t,e,n){y(t,"load",e),y(t,"loadeddata",e),y(t,"error",n)}(t,n,o)},A=["IMG","IFRAME","VIDEO"],L=function(t,e){var n=e._observer;O(t,e),n&&e._settings.auto_unobserve&&n.unobserve(t)},x=function(t){var e=u(t);e&&(clearTimeout(e),l(t,null))},z=function(t,e){var n=e._settings.load_delay,o=u(t);o||(o=setTimeout(function(){L(t,e),x(t)},n),l(t,o))},O=function(t,e,n){var o=e._settings;!n&&c(t)||(A.indexOf(t.tagName)>-1&&(k(t,e),p(t,o.class_loading)),h(t,e),function(t){i(t,"was-processed","true")}(t),d(o.callback_reveal,t,e),d(o.callback_set,t,e))},N=function(t){return!!n&&(t._observer=new IntersectionObserver(function(e){e.forEach(function(e){return function(t){return t.isIntersecting||t.intersectionRatio>0}(e)?function(t,e,n){var o=n._settings;d(o.callback_enter,t,e,n),o.load_delay?z(t,n):L(t,n)}(e.target,e,t):function(t,e,n){var o=n._settings;d(o.callback_exit,t,e,n),o.load_delay&&x(t)}(e.target,e,t)})},{root:(e=t._settings).container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),!0);var e},C=["IMG","IFRAME"],M=function(t,e){return function(t){return t.filter(function(t){return!c(t)})}((n=t||function(t){return t.container.querySelectorAll(t.elements_selector)}(e),Array.prototype.slice.call(n)));var n},S=function(t){var e=t._settings;e.container.querySelectorAll("."+e.class_error).forEach(function(t){b(t,e.class_error),function(t){i(t,"was-processed",null)}(t)}),t.update()},R=function(e,n){var o;this._settings=function(t){return _extends({},r,t)}(e),this.loadingCount=0,N(this),this.update(n),o=this,t&&window.addEventListener("online",function(t){S(o)})};return R.prototype={update:function(t){var n,o=this,r=this._settings;(this._elements=M(t,r),!e&&this._observer)?(function(t){return t.use_native&&"loading"in HTMLImageElement.prototype}(r)&&((n=this)._elements.forEach(function(t){-1!==C.indexOf(t.tagName)&&(t.setAttribute("loading","lazy"),O(t,n))}),this._elements=M(t,r)),this._elements.forEach(function(t){o._observer.observe(t)})):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){O(t,this,e)},loadAll:function(){var t=this;this._elements.forEach(function(e){L(e,t)})}},t&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)a(t,n);else a(t,e)}(R,window.lazyLoadOptions),R});
inc/settings.php CHANGED
@@ -11,70 +11,73 @@ if ( ! class_exists( 'Speed_Booster_Pack_Options' ) ) {
11
 
12
  private $sbp_options;
13
  private $exclude_from_move = [
14
- 'html5.js',
15
- 'show_ads.js',
16
- 'histats.com/js',
17
- 'ws.amazon.com/widgets',
18
- '/ads/',
19
- 'intensedebate.com',
20
- 'scripts.chitika.net/',
21
- 'jotform.com/',
22
- 'gist.github.com',
23
- 'forms.aweber.com',
24
- 'video.unrulymedia.com',
25
- 'stats.wp.com',
26
- 'stats.wordpress.com',
27
- 'widget.rafflecopter.com',
28
- 'widget-prime.rafflecopter.com',
29
- 'releases.flowplayer.org',
30
- 'c.ad6media.fr',
31
- 'cdn.stickyadstv.com',
32
- 'www.smava.de',
33
- 'contextual.media.net',
34
- 'app.getresponse.com',
35
- 'adserver.reklamstore.com',
36
- 's0.wp.com',
37
- 'wprp.zemanta.com',
38
- 'files.bannersnack.com',
39
- 'smarticon.geotrust.com',
40
- 'js.gleam.io',
41
- 'ir-na.amazon-adsystem.com',
42
- 'web.ventunotech.com',
43
- 'verify.authorize.net',
44
- 'ads.themoneytizer.com',
45
- 'embed.finanzcheck.de',
46
- 'imagesrv.adition.com',
47
- 'js.juicyads.com',
48
- 'form.jotformeu.com',
49
- 'speakerdeck.com',
50
- 'content.jwplatform.com',
51
- 'ads.investingchannel.com',
52
- 'app.ecwid.com',
53
- 'www.industriejobs.de',
54
- 's.gravatar.com',
55
- 'googlesyndication.com',
56
- 'a.optmstr.com',
57
- 'a.optmnstr.com',
58
- 'a.opmnstr.com',
59
- 'adthrive.com',
60
- 'mediavine.com',
61
- 'js.hsforms.net',
62
- 'googleadservices.com',
63
- 'f.convertkit.com',
64
- 'recaptcha/api.js',
65
- 'mailmunch.co',
66
- 'apps.shareaholic.com',
67
- 'dsms0mj1bbhn4.cloudfront.net',
68
- 'nutrifox.com',
69
- 'code.tidio.co',
70
- 'www.uplaunch.com',
71
- 'widget.reviewability.com',
72
- 'embed-cdn.gettyimages.com/widgets.js',
73
- 'app.mailerlite.com',
74
- 'ck.page',
75
- 'window.adsbygoogle',
76
- 'google_ad_client',
77
- 'googletag.display',
 
 
 
78
  ];
79
 
80
  /*--------------------------------------------------------------------------------------------------------
@@ -104,6 +107,7 @@ if ( ! class_exists( 'Speed_Booster_Pack_Options' ) ) {
104
  register_setting( 'speed_booster_settings_group', 'sbp_settings' );
105
  register_setting( 'speed_booster_settings_group', 'sbp_css_exceptions' );
106
  register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions' );
 
107
 
108
  } // END public function admin_init
109
 
@@ -184,6 +188,8 @@ if ( ! class_exists( 'Speed_Booster_Pack_Options' ) ) {
184
  $js_footer_exceptions3 = get_option( 'sbp_js_footer_exceptions3' );
185
  $js_footer_exceptions4 = get_option( 'sbp_js_footer_exceptions4' );
186
 
 
 
187
 
188
  /*--------------------------------------------------------------------------------------------------------*/
189
 
11
 
12
  private $sbp_options;
13
  private $exclude_from_move = [
14
+ 'html5.js',
15
+ 'show_ads.js',
16
+ 'histats.com/js',
17
+ 'ws.amazon.com/widgets',
18
+ '/ads/',
19
+ 'intensedebate.com',
20
+ 'scripts.chitika.net/',
21
+ 'jotform.com/',
22
+ 'gist.github.com',
23
+ 'forms.aweber.com',
24
+ 'video.unrulymedia.com',
25
+ 'stats.wp.com',
26
+ 'stats.wordpress.com',
27
+ 'widget.rafflecopter.com',
28
+ 'widget-prime.rafflecopter.com',
29
+ 'releases.flowplayer.org',
30
+ 'c.ad6media.fr',
31
+ 'cdn.stickyadstv.com',
32
+ 'www.smava.de',
33
+ 'contextual.media.net',
34
+ 'app.getresponse.com',
35
+ 'adserver.reklamstore.com',
36
+ 's0.wp.com',
37
+ 'wprp.zemanta.com',
38
+ 'files.bannersnack.com',
39
+ 'smarticon.geotrust.com',
40
+ 'js.gleam.io',
41
+ 'ir-na.amazon-adsystem.com',
42
+ 'web.ventunotech.com',
43
+ 'verify.authorize.net',
44
+ 'ads.themoneytizer.com',
45
+ 'embed.finanzcheck.de',
46
+ 'imagesrv.adition.com',
47
+ 'js.juicyads.com',
48
+ 'form.jotformeu.com',
49
+ 'speakerdeck.com',
50
+ 'content.jwplatform.com',
51
+ 'ads.investingchannel.com',
52
+ 'app.ecwid.com',
53
+ 'www.industriejobs.de',
54
+ 's.gravatar.com',
55
+ 'googlesyndication.com',
56
+ 'a.optmstr.com',
57
+ 'a.optmnstr.com',
58
+ 'a.opmnstr.com',
59
+ 'adthrive.com',
60
+ 'mediavine.com',
61
+ 'js.hsforms.net',
62
+ 'googleadservices.com',
63
+ 'f.convertkit.com',
64
+ 'recaptcha/api.js',
65
+ 'mailmunch.co',
66
+ 'apps.shareaholic.com',
67
+ 'dsms0mj1bbhn4.cloudfront.net',
68
+ 'nutrifox.com',
69
+ 'code.tidio.co',
70
+ 'www.uplaunch.com',
71
+ 'widget.reviewability.com',
72
+ 'embed-cdn.gettyimages.com/widgets.js',
73
+ 'app.mailerlite.com',
74
+ 'ck.page',
75
+ 'window.adsbygoogle',
76
+ 'google_ad_client',
77
+ 'googletag.display',
78
+ 'document.write',
79
+ 'google_ad',
80
+ 'adsbygoogle',
81
  ];
82
 
83
  /*--------------------------------------------------------------------------------------------------------
107
  register_setting( 'speed_booster_settings_group', 'sbp_settings' );
108
  register_setting( 'speed_booster_settings_group', 'sbp_css_exceptions' );
109
  register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions' );
110
+ register_setting( 'speed_booster_settings_group', 'sbp_lazyload_exclusions' );
111
 
112
  } // END public function admin_init
113
 
188
  $js_footer_exceptions3 = get_option( 'sbp_js_footer_exceptions3' );
189
  $js_footer_exceptions4 = get_option( 'sbp_js_footer_exceptions4' );
190
 
191
+ $lazyload_exclusions = get_option( 'sbp_lazyload_exclusions' );
192
+
193
 
194
  /*--------------------------------------------------------------------------------------------------------*/
195
 
inc/template/options.php CHANGED
@@ -20,6 +20,13 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
20
  $closed_defer = true;
21
  }
22
 
 
 
 
 
 
 
 
23
  ?>
24
 
25
  <div class="wrap">
@@ -49,30 +56,36 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
49
  <?php settings_fields( 'speed_booster_settings_group' ); ?>
50
 
51
  <?php
52
- $is_using_new_version = ! ( get_option( 'sbp_js_footer_exceptions1' ) || get_option( 'sbp_js_footer_exceptions2' ) || get_option( 'sbp_js_footer_exceptions3' ) || get_option( 'sbp_js_footer_exceptions4' ) );
53
-
54
- if ( ! $is_using_new_version ) {
55
- $exception_inputs = [
56
- 'sbp_js_footer_exceptions1' => [
57
- 'type' => 'text',
58
- ],
59
- 'sbp_js_footer_exceptions2' => [
60
- 'type' => 'text',
61
  ],
62
- 'sbp_js_footer_exceptions3' => [
63
- 'type' => 'text',
 
 
 
64
  ],
65
- 'sbp_js_footer_exceptions4' => [
 
 
 
 
 
 
66
  'type' => 'text',
67
- ],
68
- ];
69
  } else {
70
- $exception_inputs = [
71
- 'sbp_js_footer_exceptions' => [
72
- 'label' => __( 'Each line will be taken as a separate exclusion rule; you can exclude URLs, parts of URLs or parts of inline scripts. DON\'T enter whole blocks of inline scripts!', 'speed-booster-pack' ),
73
- 'type' => 'textarea',
74
- 'name' => 'js_footer_exceptions',
75
- ],
76
  ];
77
  }
78
 
@@ -83,84 +96,72 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
83
  'sections' => [
84
  [
85
  'type' => 'section',
86
- 'label' => __( 'Safe Optimizations' ),
87
  'items' => [
88
  'query_strings' => [
89
  'type' => 'checkbox',
90
  'label' => __( 'Remove query strings', 'speed-booster-pack' ),
91
- 'tooltip' => __( 'Since most proxies do not cache resources with a ? in their URL, this option allows you to remove any query strings (version numbers) from static resources like CSS & JS files, thus improving your speed scores in services like GTmetrix, PageSpeed, YSlow and Pingdom.',
92
- 'speed-booster-pack' ),
93
  'options_group' => 'sbp_settings',
94
  ],
95
  'remove_emojis' => [
96
  'type' => 'checkbox',
97
  'label' => __( 'Remove WordPress Emoji scripts', 'speed-booster-pack' ),
98
- 'tooltip' => __( 'Emojis are fun and all, but if you are aren’t using them they actually load a JavaScript file (wp-emoji-release.min.js) on every page of your website. For a lot of businesses, this is not needed and simply adds load time to your site. So we recommend disabling this.',
99
- 'speed-booster-pack' ),
100
  'options_group' => 'sbp_settings',
101
  ],
102
  'remove_wsl' => [
103
  'type' => 'checkbox',
104
  'label' => __( 'Remove WordPress Shortlink', 'speed-booster-pack' ),
105
- 'tooltip' => __( 'WordPress URL shortening is sometimes useful, but it automatically adds an ugly code in your header, so you can remove it.',
106
- 'speed-booster-pack' ),
107
  'options_group' => 'sbp_settings',
108
  ],
109
  'remove_adjacent' => [
110
  'type' => 'checkbox',
111
  'label' => __( 'Remove Adjacent Posts Links', 'speed-booster-pack' ),
112
- 'tooltip' => __( 'WordPress incorrectly implements this feature that supposedly should fix a pagination issues but it messes up, so there is no reason to keep these around. However, some browsers may use Adjacent Posts Links to navigate your site, although you can remove it if you run a well designed theme.',
113
- 'speed-booster-pack' ),
114
  'options_group' => 'sbp_settings',
115
  ],
116
  'wml_link' => [
117
  'type' => 'checkbox',
118
- 'label' => __( 'Remove Windows Live Writer Manifest',
119
- 'speed-booster-pack' ),
120
- 'tooltip' => __( 'Windows Live Writer (WLW) is a Microsoft application for composing and managing blog posts offline and publish them later. If you are not using Windows Live Writer application, you can remove it from the WP head.',
121
- 'speed-booster-pack' ),
122
  'options_group' => 'sbp_settings',
123
  ],
124
  'wp_generator' => [
125
  'type' => 'checkbox',
126
  'label' => __( 'Remove WordPress Version', 'speed-booster-pack' ),
127
- 'tooltip' => __( 'Remove the META tag that reveals the WordPress version you use. Not exactly a speed-related matter, but you should consider it as an important security measure.',
128
- 'speed-booster-pack' ),
129
  'options_group' => 'sbp_settings',
130
  ],
131
  'disable_self_pingbacks' => [
132
  'type' => 'checkbox',
133
  'label' => __( 'Disable Self Pingbacks', 'speed-booster-pack' ),
134
- 'tooltip' => __( 'A pingback is a special type of comment that’s created when you link to another blog post, as long as the other blog is set to accept pingbacks.',
135
- 'speed-booster-pack' ),
136
  'options_group' => 'sbp_settings',
137
  ],
138
  'remove_jquery_migrate' => [
139
  'type' => 'checkbox',
140
  'label' => __( 'Remove jQuery Migrate', 'speed-booster-pack' ),
141
- 'tooltip' => __( 'Remove the jquery-migrate.js script that helps older jQuery plugins to be compatible with new jQuery versions. You safely turn this setting on if your jQuery plugins are all new.',
142
- 'speed-booster-pack' ),
143
  'options_group' => 'sbp_settings',
144
  ],
145
  'disable_dashicons' => [
146
  'type' => 'checkbox',
147
  'label' => __( 'Remove Dashicons', 'speed-booster-pack' ),
148
- 'tooltip' => __( 'Remove Dashicons from front end.',
149
- 'speed-booster-pack' ),
150
  'options_group' => 'sbp_settings',
151
  ],
152
  'disable_heartbeat' => [
153
  'type' => 'checkbox',
154
  'label' => __( 'Disable Heartbeat', 'speed-booster-pack' ),
155
- 'tooltip' => __( 'Disable heartbeat everywhere ( used for autosaving and revision tracking ).',
156
- 'speed-booster-pack' ),
157
  'options_group' => 'sbp_settings',
158
  ],
159
  'heartbeat_frequency' => [
160
  'type' => 'select',
161
  'label' => __( 'Heartbeat frequency', 'speed-booster-pack' ),
162
- 'tooltip' => __( 'Controls how often the WordPress Heartbeat API is allowed to run. ',
163
- 'speed-booster-pack' ),
164
  'options' => [
165
  '15' => '15',
166
  '30' => '30',
@@ -172,8 +173,7 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
172
  'limit_post_revisions' => [
173
  'type' => 'select',
174
  'label' => __( 'Limit Post Revisions', 'speed-booster-pack' ),
175
- 'tooltip' => __( 'Controls how many revisions WordPress will save ',
176
- 'speed-booster-pack' ),
177
  'options' => [
178
  '1' => '1',
179
  '2' => '2',
@@ -192,8 +192,7 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
192
  'autosave_interval' => [
193
  'type' => 'select',
194
  'label' => __( 'Autosave interval', 'speed-booster-pack' ),
195
- 'tooltip' => __( 'Controls how WordPress will autosave posts and pages while editing.',
196
- 'speed-booster-pack' ),
197
  'options' => [
198
  '1' => __( '1 minute', 'speed-booster-pack' ),
199
  '2' => __( '2 minutes', 'speed-booster-pack' ),
@@ -216,165 +215,110 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
216
  'items' => [
217
  'sbp_optimize_fonts' => [
218
  'type' => 'checkbox',
219
- 'label' => __( 'Optimize Google Fonts', 'speed-booster-pack' ),
220
- 'tooltip' => __( 'This feature effectively gathers all the Google Font URLs in your pages together, combines all of them in one URL and adds the famous "font-display:swap" CSS feature.',
221
- 'speed-booster-pack' ),
222
  // TODO: Tooltip will be changed
223
  'options_group' => 'sbp_settings',
224
  ],
225
- 'sbp_enable_lazy_load' => [
226
- 'type' => 'checkbox',
227
- 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'Enable lazy loader', 'speed-booster-pack' ),
228
- 'tooltip' => __( 'Check this option if you want to enable native lazy loading with fallback.',
229
- 'speed-booster-pack' ),
230
- 'options_group' => 'sbp_settings',
231
- ],
232
  'enable_instant_page' => [
233
  'type' => 'checkbox',
234
  'label' => __( 'Enable instant.page', 'speed-booster-pack' ),
235
- 'tooltip' => __( 'Check this option if you want to use the instant.page link preloader. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.',
236
- 'speed-booster-pack' ),
237
  'options_group' => 'sbp_settings',
238
  ],
239
  'disable_cart_fragments' => [
240
  'type' => 'checkbox',
241
- 'label' => __( 'WooCommerce: Disable cart fragments',
242
- 'speed-booster-pack' ),
243
- 'tooltip' => __( 'Check this option to disable WooCommerce&#39;s &quot;cart fragments&quot; script, which overrides all caching function to update cart totals on each page load in your theme header. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.',
244
- 'speed-booster-pack' ),
245
  'options_group' => 'sbp_settings',
246
  ],
247
  'dequeue_wc_scripts' => [
248
  'type' => 'checkbox',
249
- 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'Remove WooCommerce scripts in non-WC pages',
250
- 'speed-booster-pack' ),
251
- 'tooltip' => __( 'Check this option if you want to remove WooCommerce scripts in non-WooCommerce pages. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.',
252
- 'speed-booster-pack' ),
253
  'options_group' => 'sbp_settings',
254
  ],
255
  'disable_password_strength_meter' => [
256
  'type' => 'checkbox',
257
- 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'WooCommerce: Disable password strength meter',
258
- 'speed-booster-pack' ),
259
- 'tooltip' => __( 'Check this option if you want to disable WooCommerce password strength meter. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.',
260
- 'speed-booster-pack' ),
261
  'options_group' => 'sbp_settings',
262
  ],
263
  'disable_google_maps' => [
264
  'type' => 'checkbox',
265
  'label' => __( 'Remove Google Maps', 'speed-booster-pack' ),
266
- 'tooltip' => __( 'Remove Google Maps from front end. ',
267
- 'speed-booster-pack' ),
268
  'options_group' => 'sbp_settings',
269
  ],
270
  'remove_rest_api_links' => [
271
  'type' => 'checkbox',
272
  'label' => __( 'Remove REST API Links', 'speed-booster-pack' ),
273
- 'tooltip' => __( 'The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects.',
274
- 'speed-booster-pack' ),
275
  'options_group' => 'sbp_settings',
276
  ],
277
  'remove_all_feeds' => [
278
  'type' => 'checkbox',
279
  'label' => __( 'Remove all RSS feed links', 'speed-booster-pack' ),
280
- 'tooltip' => __( 'This option will remove all RSS feed links to cleanup your WordPress header. It is also useful on Unicorn – The W3C Markup Validation Service to get rid out the “feed does not validate” error.',
281
- 'speed-booster-pack' ),
282
  'options_group' => 'sbp_settings',
283
  ],
284
  'minify_html_js' => [
285
  'type' => 'checkbox',
286
  'label' => __( 'Minify HTML', 'speed-booster-pack' ),
287
- 'tooltip' => __( 'Activate this option only if you don’t want to use other minify plugins or other speed optimization plugin that has minify option included. If something goes wrong, simply uncheck this option and save the settings.',
288
- 'speed-booster-pack' ),
289
  'options_group' => 'sbp_settings',
290
  ],
291
  ],
292
  ],
293
  [
294
  'type' => 'section',
295
- 'label' => __( 'JavaScript Optimization', 'speed-booster-pack' ),
296
  'items' => [
297
- 'break_warning' => [
298
- 'type' => 'warning',
299
- 'text' => __( 'This feature has the MOST potential to break your site! Please use with caution and test your website after enabling this option. Excluding inline scripts and/or JavaScript file URLs below might help fix the issues you might encounter.',
300
- 'speed-booster-pack' ),
301
- ],
302
- 'jquery_to_footer' => [
303
  'type' => 'checkbox',
304
- 'label' => __( 'Move scripts to footer', 'speed-booster-pack' ),
305
- 'tooltip' => __( 'This option move all scripts to the footer while keeping stylesheets in the header to improve page loading speed and get a higher score on the major speed testing sites such as GTmetrix or other website speed testing tools',
306
- 'speed-booster-pack' ),
307
  'options_group' => 'sbp_settings',
308
  ],
 
 
 
 
 
 
309
  ],
310
  ],
311
- [
312
- 'type' => 'section',
313
- 'label' => __( 'Exclude scripts from being moved to the footer',
314
- 'speed-booster-pack' ),
315
- 'description' => __( 'Enter one JS handle per text field. Read more <a href="https://optimocha.com/speed-booster-pack-documentation/#exclude-scripts-from-being-moved-to-the-footer-50">detailed instructions</a> on this option on plugin documentation.',
316
- 'speed-booster-pack' ),
317
- 'items' => $exception_inputs,
318
- ],
319
  [
320
  'type' => 'section',
321
  'label' => __( 'CSS Optimization', 'speed-booster-pack' ),
322
  'items' => [
323
- 'sbp_css_async' => [
324
  'type' => 'checkbox',
325
  'label' => __( 'Inline all CSS', 'speed-booster-pack' ),
326
- 'tooltip' => __( 'Checking this option will inline the contents of all your stylesheets. This helps with the annoying render blocking error Google Page Speed Insights displays.',
327
- 'speed-booster-pack' ),
328
  'options_group' => 'sbp_settings',
329
  ],
330
- 'sbp_css_minify' => [
331
  'type' => 'checkbox',
332
- 'label' => __( 'Minify all (previously) inlined CSS',
333
- 'speed-booster-pack' ),
334
- 'tooltip' => __( 'Minifying all inlined CSS styles will optimize the CSS delivery and will eliminate the annoying message on Google Page Speed regarding to render-blocking css.',
335
- 'speed-booster-pack' ),
336
  'options_group' => 'sbp_settings',
337
  ],
338
- 'sbp_footer_css' => [
339
  'type' => 'checkbox',
340
- 'label' => __( 'Move all inlined CSS into the footer',
341
- 'speed-booster-pack' ),
342
- 'tooltip' => __( 'Inserting all CSS styles inline to the footer is a sensitive option that will eliminate render-blocking CSS warning in Google Page Speed test. If there is something broken after activation, you need to disable this option. Please note that before enabling this sensitive option, it is strongly recommended that you also enable the “ Move scripts to the footer” option.',
343
- 'speed-booster-pack' ),
344
  'options_group' => 'sbp_settings',
345
  ],
346
- ],
347
- ],
348
- //other options section
349
- [
350
- 'type' => 'section',
351
- 'label' => __( 'Exclude CSS', 'speed-booster-pack' ),
352
- 'items' => [
353
  'sbp_css_exceptions' => [
354
  'type' => 'textarea',
355
  'name' => 'css_exceptions',
356
- 'label' => __( 'Exclude styles from being inlined and/or minified option: ',
357
- 'speed-booster-pack' ),
358
- 'description' => __( 'Enter one by line, the handles of CSS files or the final part of the style URL.',
359
- 'speed-booster-pack' ),
360
  ],
361
  ],
362
  ],
363
- // [
364
- // 'type' => 'section',
365
- // 'label' => __( 'Debug', 'speed-booster-pack' ), // TODO: Check section title
366
- // 'items' => [
367
- // 'sbp_disable_temporarily' => [
368
- // 'type' => 'checkbox',
369
- // 'label' => __( 'Disable Temporarily', 'speed-booster-pack' ),
370
- // // TODO: Change setting label
371
- // 'tooltip' => __( 'This option disable Speed Booster Pack plugin features temporarily. If you want to do some bugfix or debug, it could be really useful. Don\'t forget to disable this option after you use it.',
372
- // 'speed-booster-pack' ),
373
- // // TODO: Change setting tooltip
374
- // 'options_group' => 'sbp_settings',
375
- // ],
376
- // ],
377
- // ],
378
  ],
379
  ],
380
  'cdn-options' => [
@@ -382,36 +326,31 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
382
  [
383
  'type' => 'section',
384
  'label' => __( 'CDN', 'speed-booster-pack' ),
385
- 'description' => __( 'CDN options that allow you to rewrite your site URLs with your CDN URLs.',
386
- 'speed-booster-pack' ),
387
  'items' => [
388
  'sbp_enable_cdn' => [
389
  'type' => 'checkbox',
390
  'label' => __( 'Enable CDN Rewrite', 'speed-booster-pack' ),
391
- 'tooltip' => __( 'Enables rewriting of your site URLs with your CDN URLs',
392
- 'speed-booster-pack' ),
393
  'options_group' => 'sbp_settings',
394
  ],
395
  'sbp_cdn_url' => [
396
  'type' => 'text',
397
  'label' => __( 'CDN URL', 'speed-booster-pack' ),
398
- 'tooltip' => __( 'Enter your CDN URL without the trailing slash. Example: https://cdn.example.com',
399
- 'speed-booster-pack' ),
400
  'options_group' => 'sbp_settings',
401
  ],
402
  'sbp_cdn_included_directories' => [
403
  'type' => 'text',
404
  'label' => __( 'Included Directories', 'speed-booster-pack' ),
405
- 'tooltip' => __( 'Enter any directories you would like to be included in CDN rewriting, separated by commas (,). Default: wp-content,wp-includes',
406
- 'speed-booster-pack' ),
407
  'options_group' => 'sbp_settings',
408
  'default' => 'wp-content,wp-includes',
409
  ],
410
  'sbp_cdn_exclusions' => [
411
  'type' => 'text',
412
  'label' => __( 'CDN Exclusions', 'speed-booster-pack' ),
413
- 'tooltip' => __( 'Enter any directories or file extensions you would like to be excluded from CDN rewriting, separated by commas (,). Default: .php',
414
- 'speed-booster-pack' ),
415
  'options_group' => 'sbp_settings',
416
  'default' => '.php',
417
  ],
@@ -424,28 +363,24 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
424
  [
425
  'type' => 'section',
426
  'label' => __( 'Google Analytics', 'speed-booster-pack' ),
427
- 'description' => __( 'Optimization options for Google Analytics.',
428
- 'speed-booster-pack' ),
429
  'items' => [
430
  'sbp_enable_local_analytics' => [
431
  'type' => 'checkbox',
432
  'label' => __( 'Enable Local Analytics', 'speed-booster-pack' ),
433
- 'tooltip' => __( 'Enable syncing of the Google Analytics script to your own server.',
434
- 'speed-booster-pack' ),
435
  'options_group' => 'sbp_settings',
436
  ],
437
  'sbp_ga_tracking_id' => [
438
  'type' => 'text',
439
  'label' => __( 'Tracking ID', 'speed-booster-pack' ),
440
- 'tooltip' => __( 'Enter your Google Analytics tracking ID',
441
- 'speed-booster-pack' ),
442
  'options_group' => 'sbp_settings',
443
  ],
444
  'sbp_tracking_position' => [
445
  'type' => 'select',
446
  'label' => __( 'Tracking code position', 'speed-booster-pack' ),
447
- 'tooltip' => __( 'Load your GA script in the header or footer of the site. Default - header',
448
- 'speed-booster-pack' ),
449
  'options_group' => 'sbp_settings',
450
  'options' => [
451
  'header' => 'Header (default)',
@@ -455,36 +390,31 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
455
  'sbp_disable_display_features' => [
456
  'type' => 'checkbox',
457
  'label' => __( 'Disable Display Features', 'speed-booster-pack' ),
458
- 'tooltip' => __( 'Disable marketing and advertising which generates a 2nd HTTP request',
459
- 'speed-booster-pack' ),
460
  'options_group' => 'sbp_settings',
461
  ],
462
  'sbp_anonymize_ip' => [
463
  'type' => 'checkbox',
464
  'label' => __( 'Anonymize IP', 'speed-booster-pack' ),
465
- 'tooltip' => __( 'Shorten visitor IP to comply with privacy restrictions in some countries.',
466
- 'speed-booster-pack' ),
467
  'options_group' => 'sbp_settings',
468
  ],
469
  'sbp_track_loggedin_admins' => [
470
  'type' => 'checkbox',
471
  'label' => __( 'Track Admins', 'speed-booster-pack' ),
472
- 'tooltip' => __( 'Include logged in WordPress admins in your GA report.',
473
- 'speed-booster-pack' ),
474
  'options_group' => 'sbp_settings',
475
  ],
476
  'sbp_bounce_rate' => [
477
  'type' => 'text',
478
  'label' => __( 'Adjust Bounce Rate', 'speed-booster-pack' ),
479
- 'tooltip' => __( 'Set a timeout limit in seconds to better evaluate the quality of your traffic (1 - 100)',
480
- 'speed-booster-pack' ),
481
  'options_group' => 'sbp_settings',
482
  ],
483
  'sbp_monsterinsights' => [
484
  'type' => 'checkbox',
485
  'label' => __( 'MonsterInsights Integration', 'speed-booster-pack' ),
486
- 'tooltip' => __( 'Allows MonsterInsights to manage your Google Analytics while still using the locally hosted analytics.js generated by Speed Booster Pack',
487
- 'speed-booster-pack' ),
488
  'options_group' => 'sbp_settings',
489
  ],
490
  ],
@@ -493,35 +423,10 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
493
  ],
494
  ];
495
 
496
- $sbp_alert_box = '<div class="sbp-static-notice bg-red"><span class="dashicons dashicons-warning"></span> ' . __( 'Activating these settings might cause conflicts with other plugins or your theme, resulting in broken styles or scripts. Use with caution!',
497
- 'speed-booster-pack' ) . '</div>';
498
-
499
- $sbp_deprecated_js_footer_alert_box = '<div class="sbp-static-notice bg-yellow"><span class="dashicons dashicons-warning"></span> ' . __( 'We recoded the feature that moves all inline scripts and JavaScript files to footer. The old code is deprecated now and will be removed in the new versions. Right now, you\'re using the old feature and it\'s still working, but you need to migrate to the new feature as soon as possible. And make sure that you jot down the current JS optimization exclusion settings!',
500
- 'speed-booster-pack' ) . '<br /><br /><button type="submit" form="migrate_js_mover_form" class="button button-primary">' . __( 'Migrate to the new feature now!',
501
- 'speed-booster-pack' ) . '</button></div>';
502
 
503
  ?>
504
-
505
- <?php /*
506
- <div id="sbp-dashboard" class="sb-pack-tab">
507
-
508
- <div class="feature-box postbox">
509
- <div class="inside clearfix">
510
- <img class="feature-box-left feature-box-image"
511
- src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/optimocha.png" alt="Optimocha"/>
512
- <div class="feature-box-right">
513
- <h2 class="feature-box-title"><?php _e( 'Dashboard', 'speed-booster-pack' ) ?></h2>
514
- <p class="feature-box-description"><?php _e( 'Optimocha is a tailored speed optimization service where you can get your website optimized by a speed optimization expert. With a one-time "investment", your website will be taken care of real people. <strong>A significant speed improvement is guaranteed</strong>, so can be sure that your investment will return to you with a faster website!',
515
- 'speed-booster-pack' ); ?></p>
516
- <p class="feature-box-description"><?php _e( 'Or, if you\'d like to have someone maintain your website speed, keep everything up-to-date and ensure your website is secure all the time; you can purchase Optimocha\'s monthly optimization &amp; maintenance packages. <strong>Annual payments have more and more benefits</strong>, be sure to check them out!',
517
- 'speed-booster-pack' ); ?></p>
518
- </p>
519
- </div>
520
- </div>
521
- </div>
522
-
523
- </div><!--#optimize-more-->
524
- */ ?>
525
 
526
  <?php
527
 
@@ -575,22 +480,14 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
575
 
576
  <div class="onoffswitch">
577
  <div class="epsilon-toggle">
578
- <input class="epsilon-toggle__input" type="checkbox"
579
- id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
580
- name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
581
- value="1" <?php checked( 1,
582
- isset( $sbp_options[ $item ] ) ); ?> >
583
  <div class="epsilon-toggle__items">
584
  <span class="epsilon-toggle__track"></span>
585
  <span class="epsilon-toggle__thumb"></span>
586
- <svg class="epsilon-toggle__off" width="6" height="6"
587
- aria-hidden="true" role="img" focusable="false"
588
- viewBox="0 0 6 6">
589
  <path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path>
590
  </svg>
591
- <svg class="epsilon-toggle__on" width="2" height="6"
592
- aria-hidden="true" role="img" focusable="false"
593
- viewBox="0 0 2 6">
594
  <path d="M0 0h2v6H0z"></path>
595
  </svg>
596
  </div>
@@ -602,21 +499,18 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
602
  if ( 'select' == $item_value['type'] ) { ?>
603
  <p>
604
  <?php if ( isset( $item_value['tooltip'] ) ) { ?>
605
- <span class="tooltip-right"
606
- data-tooltip="<?php echo $item_value['tooltip']; ?>">
607
- <i class="dashicons dashicons-editor-help"></i>
608
- </span>
609
  <?php } ?>
610
- <label for="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
611
- class="<?php echo ( isset( $item_value['label'] ) ) ? 'label-text' : ''; ?>"><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></label>
612
- <select id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
613
- name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>">
614
  <?php
615
  foreach ( $item_value['options'] as $option_k => $op_v ) {
616
  ?>
617
- <option value="<?php echo $option_k; ?>" <?php selected( $option_k,
 
618
  $sbp_options[ $item ],
619
- true ); ?> ><?php echo $op_v; ?></option>
 
620
  <?php
621
  }
622
  ?>
@@ -626,8 +520,7 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
626
 
627
  if ( 'link' == $item_value['type'] ) { ?>
628
  <p>
629
- <a href="<?php echo $item_value['url']; ?>"
630
- class="button <?php echo $item_value['class']; ?>"><?php echo $item_value['text']; ?></a>
631
  </p>
632
  <?php }
633
 
@@ -643,38 +536,38 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
643
 
644
  ?>
645
  <?php if ( isset( $item_value['tooltip'] ) ) { ?>
646
- <span class="tooltip-right"
647
- data-tooltip="<?php echo $item_value['tooltip']; ?>">
648
- <i class="dashicons dashicons-editor-help"></i>
649
- </span>
650
  <?php } ?>
651
- <label for="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
652
- class="<?php echo ( isset( $item_value['label'] ) ) ? 'label-text' : ''; ?>"><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></label>
653
 
654
- <input id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
655
- name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
656
- type="text" value="<?php echo esc_attr( $op_text ); ?>"/>
 
 
 
 
 
 
 
 
657
  </p>
658
  <?php }
659
 
660
  if ( 'textarea' === $item_value['type'] && 'css_exceptions' === $item_value['name'] ) { ?>
661
  <h4><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></h4>
662
  <p>
663
- <textarea cols="50" rows="3"
664
- name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
665
- id="<?php echo $item; ?>"><?php echo wp_kses_post( $css_exceptions ); ?></textarea>
666
  </p>
667
  <p class="description">
668
  <?php echo isset( $item_value['description'] ) ? $item_value['description'] : ''; ?>
669
  </p>
670
  <?php }
671
 
672
- if ( 'textarea' === $item_value['type'] && 'js_footer_exceptions' === $item_value['name'] ) { ?>
673
  <h4><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></h4>
674
  <p>
675
- <textarea cols="50" rows="3"
676
- name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>"
677
- id="<?php echo $item; ?>"><?php echo wp_kses_post( $js_footer_exceptions ); ?></textarea>
678
  </p>
679
  <p class="description">
680
  <?php echo isset( $item_value['description'] ) ? $item_value['description'] : ''; ?>
@@ -684,41 +577,33 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
684
  if ( 'warning' == $item_value['type'] ) {
685
  ?>
686
  <div class="sbp-warning <?php echo isset( $item_value['background'] ) ? $item_value['background'] : 'bg-red' ?>">
687
- <?php if ( isset( $item_value['icon'] ) ): ?><span
688
- class="dashicons <?php echo $item_value['icon'] ?>"></span><?php endif; ?>
 
689
  <?php echo $item_value['text']; ?>
690
  </div>
691
  <?php
692
  }
693
-
694
  }
695
-
696
  ?>
697
  </div>
698
  </div>
699
  <?php
700
-
701
  }
702
  ?>
703
  </div> <!-- Tab sections -->
704
  <?php } ?>
705
 
706
  <div id="optimize-more" class="sb-pack-tab">
707
-
708
  <div class="feature-box postbox">
709
  <div class="inside clearfix">
710
- <img class="feature-box-left feature-box-image"
711
- src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/optimocha.png" alt="Optimocha"/>
712
  <div class="feature-box-right">
713
- <h2 class="feature-box-title"><?php _e( 'Speed up your website with Optimocha',
714
- 'speed-booster-pack' ) ?></h2>
715
- <p class="feature-box-description"><?php _e( 'Optimocha is a tailored speed optimization service where you can get your website optimized by a speed optimization expert. With a one-time "investment", your website will be taken care of real people. <strong>A significant speed improvement is guaranteed</strong>, so can be sure that your investment will return to you with a faster website!',
716
- 'speed-booster-pack' ); ?></p>
717
- <p class="feature-box-description"><?php _e( 'Or, if you\'d like to have someone maintain your website speed, keep everything up-to-date and ensure your website is secure all the time; you can purchase Optimocha\'s monthly optimization &amp; maintenance packages. <strong>Annual payments have more and more benefits</strong>, be sure to check them out!',
718
- 'speed-booster-pack' ); ?></p>
719
- <p class="feature-box-button"><a href="https://optimocha.com/?ref=sbp" target="_blank"
720
- class="button button-primary button-large"><?php _e( "Speed Up Your Website!",
721
- 'speed-booster-pack' ); ?></a>
722
  </p>
723
  </div>
724
  </div>
@@ -726,17 +611,12 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
726
 
727
  <div class="feature-box postbox">
728
  <div class="inside clearfix">
729
- <img class="feature-box-left feature-box-image"
730
- src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/shortpixel.png" alt="ShortPixel"/>
731
  <div class="feature-box-right">
732
- <h2 class="feature-box-title"><?php _e( 'Optimize your images with ShortPixel',
733
- 'speed-booster-pack' ) ?></h2>
734
- <p class="feature-box-description"><?php _e( 'Image optimization is essential for all websites - especially for sites with lots of images! ShortPixel Image Optimizer is probably the best image optimization plugin you can use in the WordPress ecosystem. By clicking the link below, <strong>you will get 50% more image optimization credits for the same price</strong>! The image optimization credits are good for unlimited websites and do not expire, so you can use your API key in all your websites, anytime you want.',
735
- 'speed-booster-pack' ); ?></p>
736
- <p class="feature-box-button"><a href="https://optimocha.com/go/shortpixel"
737
- target="_blank"
738
- class="button button-primary button-large"><?php _e( "Optimize Your Images!",
739
- 'speed-booster-pack' ); ?></a>
740
  </p>
741
  </div>
742
  </div>
@@ -744,17 +624,12 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
744
 
745
  <div class="feature-box postbox">
746
  <div class="inside clearfix">
747
- <img class="feature-box-left feature-box-image"
748
- src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/wp-engine.png" alt="WP Engine"/>
749
  <div class="feature-box-right">
750
- <h2 class="feature-box-title"><?php _e( 'Get better hosting at WP Engine',
751
- 'speed-booster-pack' ) ?></h2>
752
- <p class="feature-box-description"><?php _e( 'Choosing a good web hosting company make such a big difference, but often overlooked. It\'s understandable that people like to try cheap hosting packages in very large hosting companies, but if you\'re looking for a WordPress-centric hosting company with servers specially optimized for WordPress websites, be sure to check out WP Engine. Clicking the link below, <strong>you can get up to three months for free on annual payments!</strong>',
753
- 'speed-booster-pack' ); ?></p>
754
- <p class="feature-box-button"><a href="https://optimocha.com/go/wpengine"
755
- target="_blank"
756
- class="button button-primary button-large"><?php _e( "Get Better Hosting!",
757
- 'speed-booster-pack' ); ?></a>
758
  </p>
759
  </div>
760
  </div>
@@ -763,10 +638,7 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
763
  </div><!--#optimize-more-->
764
 
765
  <div>
766
- <?php submit_button( __( 'Save Changes', 'speed-booster-pack' ),
767
- 'primary large',
768
- 'submit',
769
- false ); ?>
770
  </div>
771
 
772
  </form>
@@ -778,13 +650,10 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
778
  <div class="postbox">
779
  <h3 class="hndle"><?php _e( 'Invest in More Speed!', 'speed-booster-pack' ); ?></h3>
780
  <div class="inside">
781
- <p><?php _e( 'People abandon pages that take more than a few seconds to load, which means slow pages lose you visitors (and money). You don’t want that to happen, do you?',
782
- 'speed-booster-pack' ) ?></p>
783
- <p><?php _e( 'If you’re ready to <em>invest</em> in speeding up your website, click below for our professional, tailored speed optimization services!',
784
- 'speed-booster-pack' ); ?></a></p>
785
- <p style="text-align:center"><a href="https://optimocha.com/?ref=sbp" target="_blank"
786
- class="button button-primary button-large"><?php _e( "Speed Up Your Website!",
787
- 'speed-booster-pack' ); ?></a>
788
  </p>
789
  </div>
790
  </div>
@@ -792,16 +661,9 @@ if ( is_array( $option_arr ) && in_array( 'defer-from-footer', $option_arr ) ) {
792
  <div class="postbox">
793
  <h3 class="hndle"><?php _e( 'Test Your Website', 'speed-booster-pack' ); ?></h3>
794
  <div class="inside">
795
- <p><?php _e( 'It\'s always a good idea to keep testing your website so you can track your website\'s speed. Click the buttons below to see how well your website performs in various speed test tools!',
796
- 'speed-booster-pack' ) ?></p>
797
- <p style="text-align:center"><a href="https://gtmetrix.com/?url=<?php echo home_url( '/' ); ?>"
798
- target="_blank"
799
- class="button button-secondary"><?php _e( "Test on GTmetrix",
800
- 'speed-booster-pack' ); ?></a>&nbsp;<a
801
- href="https://developers.google.com/speed/pagespeed/insights/?url=<?php echo home_url( '/' ); ?>"
802
- target="_blank"
803
- class="button button-secondary"><?php _e( "Test on Google PageSpeed",
804
- 'speed-booster-pack' ); ?></a>
805
  </p>
806
  </div>
807
  </div>
20
  $closed_defer = true;
21
  }
22
 
23
+ if ( isset( $_POST['migrate_js_mover'] ) ) {
24
+ for ( $i = 1; $i <= 4; $i ++ ) {
25
+ unregister_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions' . $i );
26
+ delete_option( 'sbp_js_footer_exceptions' . $i );
27
+ }
28
+ }
29
+
30
  ?>
31
 
32
  <div class="wrap">
56
  <?php settings_fields( 'speed_booster_settings_group' ); ?>
57
 
58
  <?php
59
+ $is_using_new_version = ! ( get_option( 'sbp_js_footer_exceptions1' ) || get_option('sbp_js_footer_exceptions2') || get_option( 'sbp_js_footer_exceptions3' ) || get_option( 'sbp_js_footer_exceptions4' ) );
60
+ $jquery_exceptions = [
61
+ 'type' => 'section',
62
+ 'label' => __( 'JavaScript Optimization', 'speed-booster-pack' ),
63
+ 'items' => [
64
+ 'break_warning' => [
65
+ 'type' => 'warning',
66
+ 'text' => __( 'This feature has the MOST potential to break your site! Please use with caution and test your website after enabling this option. Excluding inline scripts and/or JavaScript file URLs below might help fix the issues you might encounter.', 'speed-booster-pack' ),
 
67
  ],
68
+ 'jquery_to_footer' => [
69
+ 'type' => 'checkbox',
70
+ 'label' => __( 'Move scripts to footer', 'speed-booster-pack' ),
71
+ 'tooltip' => __( 'This option move all scripts to the footer while keeping stylesheets in the header to improve page loading speed and get a higher score on the major speed testing sites such as GTmetrix or other website speed testing tools', 'speed-booster-pack' ),
72
+ 'options_group' => 'sbp_settings',
73
  ],
74
+ ],
75
+ ];
76
+
77
+ if ( ! $is_using_new_version ) {
78
+ for ( $i = 1; $i < 5; $i ++ ) {
79
+ $jquery_exceptions['items']["sbp_js_footer_exceptions$i"] = [
80
+ 'name' => "sbp_js_footer_exceptions$i",
81
  'type' => 'text',
82
+ ];
83
+ }
84
  } else {
85
+ $jquery_exceptions['items']['sbp_js_footer_exceptions'] = [
86
+ 'label' => __( 'Each line will be taken as a separate exclusion rule; you can exclude URLs, parts of URLs or parts of inline scripts. DON\'T enter whole blocks of inline scripts!', 'speed-booster-pack' ),
87
+ 'type' => 'textarea',
88
+ 'name' => 'sbp_js_footer_exceptions'
 
 
89
  ];
90
  }
91
 
96
  'sections' => [
97
  [
98
  'type' => 'section',
99
+ 'label' => __( 'Safe Optimizations', 'speed-booster-pack' ),
100
  'items' => [
101
  'query_strings' => [
102
  'type' => 'checkbox',
103
  'label' => __( 'Remove query strings', 'speed-booster-pack' ),
104
+ 'tooltip' => __( 'Since most proxies do not cache resources with a ? in their URL, this option allows you to remove any query strings (version numbers) from static resources like CSS & JS files, thus improving your speed scores in services like GTmetrix, PageSpeed, YSlow and Pingdom.', 'speed-booster-pack' ),
 
105
  'options_group' => 'sbp_settings',
106
  ],
107
  'remove_emojis' => [
108
  'type' => 'checkbox',
109
  'label' => __( 'Remove WordPress Emoji scripts', 'speed-booster-pack' ),
110
+ 'tooltip' => __( 'Emojis are fun and all, but if you are aren’t using them they actually load a JavaScript file (wp-emoji-release.min.js) on every page of your website. For a lot of businesses, this is not needed and simply adds load time to your site. So we recommend disabling this.', 'speed-booster-pack' ),
 
111
  'options_group' => 'sbp_settings',
112
  ],
113
  'remove_wsl' => [
114
  'type' => 'checkbox',
115
  'label' => __( 'Remove WordPress Shortlink', 'speed-booster-pack' ),
116
+ 'tooltip' => __( 'WordPress URL shortening is sometimes useful, but it automatically adds an ugly code in your header, so you can remove it.', 'speed-booster-pack' ),
 
117
  'options_group' => 'sbp_settings',
118
  ],
119
  'remove_adjacent' => [
120
  'type' => 'checkbox',
121
  'label' => __( 'Remove Adjacent Posts Links', 'speed-booster-pack' ),
122
+ 'tooltip' => __( 'WordPress incorrectly implements this feature that supposedly should fix a pagination issues but it messes up, so there is no reason to keep these around. However, some browsers may use Adjacent Posts Links to navigate your site, although you can remove it if you run a well designed theme.', 'speed-booster-pack' ),
 
123
  'options_group' => 'sbp_settings',
124
  ],
125
  'wml_link' => [
126
  'type' => 'checkbox',
127
+ 'label' => __( 'Remove Windows Live Writer Manifest', 'speed-booster-pack' ),
128
+ 'tooltip' => __( 'Windows Live Writer (WLW) is a Microsoft application for composing and managing blog posts offline and publish them later. If you are not using Windows Live Writer application, you can remove it from the WP head.', 'speed-booster-pack' ),
 
 
129
  'options_group' => 'sbp_settings',
130
  ],
131
  'wp_generator' => [
132
  'type' => 'checkbox',
133
  'label' => __( 'Remove WordPress Version', 'speed-booster-pack' ),
134
+ 'tooltip' => __( 'Remove the META tag that reveals the WordPress version you use. Not exactly a speed-related matter, but you should consider it as an important security measure.', 'speed-booster-pack' ),
 
135
  'options_group' => 'sbp_settings',
136
  ],
137
  'disable_self_pingbacks' => [
138
  'type' => 'checkbox',
139
  'label' => __( 'Disable Self Pingbacks', 'speed-booster-pack' ),
140
+ 'tooltip' => __( 'A pingback is a special type of comment that’s created when you link to another blog post, as long as the other blog is set to accept pingbacks.', 'speed-booster-pack' ),
 
141
  'options_group' => 'sbp_settings',
142
  ],
143
  'remove_jquery_migrate' => [
144
  'type' => 'checkbox',
145
  'label' => __( 'Remove jQuery Migrate', 'speed-booster-pack' ),
146
+ 'tooltip' => __( 'Remove the jquery-migrate.js script that helps older jQuery plugins to be compatible with new jQuery versions. You safely turn this setting on if your jQuery plugins are all new.', 'speed-booster-pack' ),
 
147
  'options_group' => 'sbp_settings',
148
  ],
149
  'disable_dashicons' => [
150
  'type' => 'checkbox',
151
  'label' => __( 'Remove Dashicons', 'speed-booster-pack' ),
152
+ 'tooltip' => __( 'Remove Dashicons from front end.', 'speed-booster-pack' ),
 
153
  'options_group' => 'sbp_settings',
154
  ],
155
  'disable_heartbeat' => [
156
  'type' => 'checkbox',
157
  'label' => __( 'Disable Heartbeat', 'speed-booster-pack' ),
158
+ 'tooltip' => __( 'Disable heartbeat everywhere ( used for autosaving and revision tracking ).', 'speed-booster-pack' ),
 
159
  'options_group' => 'sbp_settings',
160
  ],
161
  'heartbeat_frequency' => [
162
  'type' => 'select',
163
  'label' => __( 'Heartbeat frequency', 'speed-booster-pack' ),
164
+ 'tooltip' => __( 'Controls how often the WordPress Heartbeat API is allowed to run. ', 'speed-booster-pack' ),
 
165
  'options' => [
166
  '15' => '15',
167
  '30' => '30',
173
  'limit_post_revisions' => [
174
  'type' => 'select',
175
  'label' => __( 'Limit Post Revisions', 'speed-booster-pack' ),
176
+ 'tooltip' => __( 'Controls how many revisions WordPress will save ', 'speed-booster-pack' ),
 
177
  'options' => [
178
  '1' => '1',
179
  '2' => '2',
192
  'autosave_interval' => [
193
  'type' => 'select',
194
  'label' => __( 'Autosave interval', 'speed-booster-pack' ),
195
+ 'tooltip' => __( 'Controls how WordPress will autosave posts and pages while editing.', 'speed-booster-pack' ),
 
196
  'options' => [
197
  '1' => __( '1 minute', 'speed-booster-pack' ),
198
  '2' => __( '2 minutes', 'speed-booster-pack' ),
215
  'items' => [
216
  'sbp_optimize_fonts' => [
217
  'type' => 'checkbox',
218
+ 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'Optimize Google Fonts', 'speed-booster-pack' ),
219
+ 'tooltip' => __( 'This feature effectively gathers all the Google Font URLs in your pages together, combines all of them in one URL and adds the famous "font-display:swap" CSS feature.', 'speed-booster-pack' ),
 
220
  // TODO: Tooltip will be changed
221
  'options_group' => 'sbp_settings',
222
  ],
 
 
 
 
 
 
 
223
  'enable_instant_page' => [
224
  'type' => 'checkbox',
225
  'label' => __( 'Enable instant.page', 'speed-booster-pack' ),
226
+ 'tooltip' => __( 'Check this option if you want to use the instant.page link preloader. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.', 'speed-booster-pack' ),
 
227
  'options_group' => 'sbp_settings',
228
  ],
229
  'disable_cart_fragments' => [
230
  'type' => 'checkbox',
231
+ 'label' => __( 'WooCommerce: Disable cart fragments', 'speed-booster-pack' ),
232
+ 'tooltip' => __( 'Check this option to disable WooCommerce&#39;s &quot;cart fragments&quot; script, which overrides all caching function to update cart totals on each page load in your theme header. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.', 'speed-booster-pack' ),
 
 
233
  'options_group' => 'sbp_settings',
234
  ],
235
  'dequeue_wc_scripts' => [
236
  'type' => 'checkbox',
237
+ 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'Remove WooCommerce scripts in non-WC pages', 'speed-booster-pack' ),
238
+ 'tooltip' => __( 'Check this option if you want to remove WooCommerce scripts in non-WooCommerce pages. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.', 'speed-booster-pack' ),
 
 
239
  'options_group' => 'sbp_settings',
240
  ],
241
  'disable_password_strength_meter' => [
242
  'type' => 'checkbox',
243
+ 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'WooCommerce: Disable password strength meter', 'speed-booster-pack' ),
244
+ 'tooltip' => __( 'Check this option if you want to disable WooCommerce password strength meter. This is a new and experimental feature; use with caution. If something goes wrong, simply uncheck this option and save the settings.', 'speed-booster-pack' ),
 
 
245
  'options_group' => 'sbp_settings',
246
  ],
247
  'disable_google_maps' => [
248
  'type' => 'checkbox',
249
  'label' => __( 'Remove Google Maps', 'speed-booster-pack' ),
250
+ 'tooltip' => __( 'Remove Google Maps from front end. ', 'speed-booster-pack' ),
 
251
  'options_group' => 'sbp_settings',
252
  ],
253
  'remove_rest_api_links' => [
254
  'type' => 'checkbox',
255
  'label' => __( 'Remove REST API Links', 'speed-booster-pack' ),
256
+ 'tooltip' => __( 'The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects.', 'speed-booster-pack' ),
 
257
  'options_group' => 'sbp_settings',
258
  ],
259
  'remove_all_feeds' => [
260
  'type' => 'checkbox',
261
  'label' => __( 'Remove all RSS feed links', 'speed-booster-pack' ),
262
+ 'tooltip' => __( 'This option will remove all RSS feed links to cleanup your WordPress header. It is also useful on Unicorn – The W3C Markup Validation Service to get rid out the “feed does not validate” error.', 'speed-booster-pack' ),
 
263
  'options_group' => 'sbp_settings',
264
  ],
265
  'minify_html_js' => [
266
  'type' => 'checkbox',
267
  'label' => __( 'Minify HTML', 'speed-booster-pack' ),
268
+ 'tooltip' => __( 'Activate this option only if you don’t want to use other minify plugins or other speed optimization plugin that has minify option included. If something goes wrong, simply uncheck this option and save the settings.', 'speed-booster-pack' ),
 
269
  'options_group' => 'sbp_settings',
270
  ],
271
  ],
272
  ],
273
  [
274
  'type' => 'section',
275
+ 'label' => __( 'Lazy Load', 'speed-booster-pack' ),
276
  'items' => [
277
+ 'sbp_enable_lazy_load' => [
 
 
 
 
 
278
  'type' => 'checkbox',
279
+ 'label' => __( '(BETA)', 'speed-booster-pack' ) . ' ' . __( 'Enable lazy loading of images, videos and iframes', 'speed-booster-pack' ),
280
+ 'tooltip' => __( 'Check this option if you want to enable native lazy loading with fallback.', 'speed-booster-pack' ),
 
281
  'options_group' => 'sbp_settings',
282
  ],
283
+ 'sbp_lazyload_exclusions' => [
284
+ 'type' => 'textarea',
285
+ 'name' => 'lazyload_exclusions',
286
+ 'label' => __( 'Exclude assets from lazy load', 'speed-booster-pack' ),
287
+ 'description' => __( 'Exclude assets from being lazy loaded by id, class, src or srcset.', 'speed-booster-pack' ),
288
+ ],
289
  ],
290
  ],
291
+ $jquery_exceptions,
 
 
 
 
 
 
 
292
  [
293
  'type' => 'section',
294
  'label' => __( 'CSS Optimization', 'speed-booster-pack' ),
295
  'items' => [
296
+ 'sbp_css_async' => [
297
  'type' => 'checkbox',
298
  'label' => __( 'Inline all CSS', 'speed-booster-pack' ),
299
+ 'tooltip' => __( 'Checking this option will inline the contents of all your stylesheets. This helps with the annoying render blocking error Google Page Speed Insights displays.', 'speed-booster-pack' ),
 
300
  'options_group' => 'sbp_settings',
301
  ],
302
+ 'sbp_css_minify' => [
303
  'type' => 'checkbox',
304
+ 'label' => __( 'Minify all (previously) inlined CSS', 'speed-booster-pack' ),
305
+ 'tooltip' => __( 'Minifying all inlined CSS styles will optimize the CSS delivery and will eliminate the annoying message on Google Page Speed regarding to render-blocking css.', 'speed-booster-pack' ),
 
 
306
  'options_group' => 'sbp_settings',
307
  ],
308
+ 'sbp_footer_css' => [
309
  'type' => 'checkbox',
310
+ 'label' => __( 'Move all inlined CSS into the footer', 'speed-booster-pack' ),
311
+ 'tooltip' => __( 'Inserting all CSS styles inline to the footer is a sensitive option that will eliminate render-blocking CSS warning in Google Page Speed test. If there is something broken after activation, you need to disable this option. Please note that before enabling this sensitive option, it is strongly recommended that you also enable the “ Move scripts to the footer” option.', 'speed-booster-pack' ),
 
 
312
  'options_group' => 'sbp_settings',
313
  ],
 
 
 
 
 
 
 
314
  'sbp_css_exceptions' => [
315
  'type' => 'textarea',
316
  'name' => 'css_exceptions',
317
+ 'label' => __( 'Exclude styles from being inlined and/or minified option: ', 'speed-booster-pack' ),
318
+ 'description' => __( 'Enter one by line, the handles of CSS files or the final part of the style URL.', 'speed-booster-pack' ),
 
 
319
  ],
320
  ],
321
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  ],
323
  ],
324
  'cdn-options' => [
326
  [
327
  'type' => 'section',
328
  'label' => __( 'CDN', 'speed-booster-pack' ),
329
+ 'description' => __( 'CDN options that allow you to rewrite your site URLs with your CDN URLs.', 'speed-booster-pack' ),
 
330
  'items' => [
331
  'sbp_enable_cdn' => [
332
  'type' => 'checkbox',
333
  'label' => __( 'Enable CDN Rewrite', 'speed-booster-pack' ),
334
+ 'tooltip' => __( 'Enables rewriting of your site URLs with your CDN URLs', 'speed-booster-pack' ),
 
335
  'options_group' => 'sbp_settings',
336
  ],
337
  'sbp_cdn_url' => [
338
  'type' => 'text',
339
  'label' => __( 'CDN URL', 'speed-booster-pack' ),
340
+ 'tooltip' => __( 'Enter your CDN URL without the trailing slash. Example: https://cdn.example.com', 'speed-booster-pack' ),
 
341
  'options_group' => 'sbp_settings',
342
  ],
343
  'sbp_cdn_included_directories' => [
344
  'type' => 'text',
345
  'label' => __( 'Included Directories', 'speed-booster-pack' ),
346
+ 'tooltip' => __( 'Enter any directories you would like to be included in CDN rewriting, separated by commas (,). Default: wp-content,wp-includes', 'speed-booster-pack' ),
 
347
  'options_group' => 'sbp_settings',
348
  'default' => 'wp-content,wp-includes',
349
  ],
350
  'sbp_cdn_exclusions' => [
351
  'type' => 'text',
352
  'label' => __( 'CDN Exclusions', 'speed-booster-pack' ),
353
+ 'tooltip' => __( 'Enter any directories or file extensions you would like to be excluded from CDN rewriting, separated by commas (,). Default: .php', 'speed-booster-pack' ),
 
354
  'options_group' => 'sbp_settings',
355
  'default' => '.php',
356
  ],
363
  [
364
  'type' => 'section',
365
  'label' => __( 'Google Analytics', 'speed-booster-pack' ),
366
+ 'description' => __( 'Optimization options for Google Analytics.', 'speed-booster-pack' ),
 
367
  'items' => [
368
  'sbp_enable_local_analytics' => [
369
  'type' => 'checkbox',
370
  'label' => __( 'Enable Local Analytics', 'speed-booster-pack' ),
371
+ 'tooltip' => __( 'Enable syncing of the Google Analytics script to your own server.', 'speed-booster-pack' ),
 
372
  'options_group' => 'sbp_settings',
373
  ],
374
  'sbp_ga_tracking_id' => [
375
  'type' => 'text',
376
  'label' => __( 'Tracking ID', 'speed-booster-pack' ),
377
+ 'tooltip' => __( 'Enter your Google Analytics tracking ID', 'speed-booster-pack' ),
 
378
  'options_group' => 'sbp_settings',
379
  ],
380
  'sbp_tracking_position' => [
381
  'type' => 'select',
382
  'label' => __( 'Tracking code position', 'speed-booster-pack' ),
383
+ 'tooltip' => __( 'Load your GA script in the header or footer of the site. Default - header', 'speed-booster-pack' ),
 
384
  'options_group' => 'sbp_settings',
385
  'options' => [
386
  'header' => 'Header (default)',
390
  'sbp_disable_display_features' => [
391
  'type' => 'checkbox',
392
  'label' => __( 'Disable Display Features', 'speed-booster-pack' ),
393
+ 'tooltip' => __( 'Disable marketing and advertising which generates a 2nd HTTP request', 'speed-booster-pack' ),
 
394
  'options_group' => 'sbp_settings',
395
  ],
396
  'sbp_anonymize_ip' => [
397
  'type' => 'checkbox',
398
  'label' => __( 'Anonymize IP', 'speed-booster-pack' ),
399
+ 'tooltip' => __( 'Shorten visitor IP to comply with privacy restrictions in some countries.', 'speed-booster-pack' ),
 
400
  'options_group' => 'sbp_settings',
401
  ],
402
  'sbp_track_loggedin_admins' => [
403
  'type' => 'checkbox',
404
  'label' => __( 'Track Admins', 'speed-booster-pack' ),
405
+ 'tooltip' => __( 'Include logged in WordPress admins in your GA report.', 'speed-booster-pack' ),
 
406
  'options_group' => 'sbp_settings',
407
  ],
408
  'sbp_bounce_rate' => [
409
  'type' => 'text',
410
  'label' => __( 'Adjust Bounce Rate', 'speed-booster-pack' ),
411
+ 'tooltip' => __( 'Set a timeout limit in seconds to better evaluate the quality of your traffic (1 - 100)', 'speed-booster-pack' ),
 
412
  'options_group' => 'sbp_settings',
413
  ],
414
  'sbp_monsterinsights' => [
415
  'type' => 'checkbox',
416
  'label' => __( 'MonsterInsights Integration', 'speed-booster-pack' ),
417
+ 'tooltip' => __( 'Allows MonsterInsights to manage your Google Analytics while still using the locally hosted analytics.js generated by Speed Booster Pack', 'speed-booster-pack' ),
 
418
  'options_group' => 'sbp_settings',
419
  ],
420
  ],
423
  ],
424
  ];
425
 
426
+ $sbp_alert_box = '<div class="sbp-static-notice bg-red"><span class="dashicons dashicons-warning"></span> ' . __( 'Activating these settings might cause conflicts with other plugins or your theme, resulting in broken styles or scripts. Use with caution!', 'speed-booster-pack' ) . '</div>';
427
+ $sbp_deprecated_js_footer_alert_box = '<div class="sbp-static-notice bg-yellow"><span class="dashicons dashicons-warning"></span> ' . __( 'We recoded the feature that moves all inline scripts and JavaScript files to footer. The old code is deprecated now and will be removed in the new versions. Right now, you\'re using the old feature and it\'s still working, but you need to migrate to the new feature as soon as possible. And make sure that you jot down the current JS optimization exclusion settings!', 'speed-booster-pack' ) . '<br /><br /><button type="submit" form="migrate_js_mover_form" class="button button-primary">' . __( 'Migrate to the new feature now!', 'speed-booster-pack' ) . '</button></div>';
 
 
 
 
428
 
429
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
 
431
  <?php
432
 
480
 
481
  <div class="onoffswitch">
482
  <div class="epsilon-toggle">
483
+ <input class="epsilon-toggle__input" type="checkbox" id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" value="1" <?php checked( 1, isset( $sbp_options[ $item ] ) ); ?> >
 
 
 
 
484
  <div class="epsilon-toggle__items">
485
  <span class="epsilon-toggle__track"></span>
486
  <span class="epsilon-toggle__thumb"></span>
487
+ <svg class="epsilon-toggle__off" width="6" height="6" aria-hidden="true" role="img" focusable="false" viewBox="0 0 6 6">
 
 
488
  <path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path>
489
  </svg>
490
+ <svg class="epsilon-toggle__on" width="2" height="6" aria-hidden="true" role="img" focusable="false" viewBox="0 0 2 6">
 
 
491
  <path d="M0 0h2v6H0z"></path>
492
  </svg>
493
  </div>
499
  if ( 'select' == $item_value['type'] ) { ?>
500
  <p>
501
  <?php if ( isset( $item_value['tooltip'] ) ) { ?>
502
+ <span class="tooltip-right" data-tooltip="<?php echo $item_value['tooltip']; ?>"><i class="dashicons dashicons-editor-help"></i></span>
 
 
 
503
  <?php } ?>
504
+ <label for="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" class="<?php echo ( isset( $item_value['label'] ) ) ? 'label-text' : ''; ?>"><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></label>
505
+ <select id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>">
 
 
506
  <?php
507
  foreach ( $item_value['options'] as $option_k => $op_v ) {
508
  ?>
509
+ <option value="<?php echo $option_k; ?>" <?php selected(
510
+ $option_k,
511
  $sbp_options[ $item ],
512
+ true
513
+ ); ?> ><?php echo $op_v; ?></option>
514
  <?php
515
  }
516
  ?>
520
 
521
  if ( 'link' == $item_value['type'] ) { ?>
522
  <p>
523
+ <a href="<?php echo $item_value['url']; ?>" class="button <?php echo $item_value['class']; ?>"><?php echo $item_value['text']; ?></a>
 
524
  </p>
525
  <?php }
526
 
536
 
537
  ?>
538
  <?php if ( isset( $item_value['tooltip'] ) ) { ?>
539
+ <span class="tooltip-right" data-tooltip="<?php echo $item_value['tooltip']; ?>"><i class="dashicons dashicons-editor-help"></i></span>
 
 
 
540
  <?php } ?>
541
+ <label for="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" class="<?php echo ( isset( $item_value['label'] ) ) ? 'label-text' : ''; ?>"><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></label>
 
542
 
543
+ <input id="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" type="text" value="<?php echo esc_attr( $op_text ); ?>"/>
544
+ </p>
545
+ <?php }
546
+
547
+ if ( 'textarea' === $item_value['type'] && 'lazyload_exclusions' === $item_value['name'] ) { ?>
548
+ <h4><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></h4>
549
+ <p>
550
+ <textarea cols="50" rows="3" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" id="<?php echo $item; ?>"><?php echo wp_kses_post( $lazyload_exclusions ); ?></textarea>
551
+ </p>
552
+ <p class="description">
553
+ <?php echo isset( $item_value['description'] ) ? $item_value['description'] : ''; ?>
554
  </p>
555
  <?php }
556
 
557
  if ( 'textarea' === $item_value['type'] && 'css_exceptions' === $item_value['name'] ) { ?>
558
  <h4><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></h4>
559
  <p>
560
+ <textarea cols="50" rows="3" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" id="<?php echo $item; ?>"><?php echo wp_kses_post( $css_exceptions ); ?></textarea>
 
 
561
  </p>
562
  <p class="description">
563
  <?php echo isset( $item_value['description'] ) ? $item_value['description'] : ''; ?>
564
  </p>
565
  <?php }
566
 
567
+ if ( 'textarea' === $item_value['type'] && 'sbp_js_footer_exceptions' === $item_value['name'] ) { ?>
568
  <h4><?php echo ( isset( $item_value['label'] ) ) ? $item_value['label'] : ''; ?></h4>
569
  <p>
570
+ <textarea cols="50" rows="3" name="<?php echo ( isset( $item_value['options_group'] ) ) ? $item_value['options_group'] . '[' . $item . ']' : $item; ?>" id="<?php echo $item; ?>"><?php echo wp_kses_post( $js_footer_exceptions ); ?></textarea>
 
 
571
  </p>
572
  <p class="description">
573
  <?php echo isset( $item_value['description'] ) ? $item_value['description'] : ''; ?>
577
  if ( 'warning' == $item_value['type'] ) {
578
  ?>
579
  <div class="sbp-warning <?php echo isset( $item_value['background'] ) ? $item_value['background'] : 'bg-red' ?>">
580
+ <?php if ( isset( $item_value['icon'] ) ): ?>
581
+ <span class="dashicons <?php echo $item_value['icon'] ?>"></span>
582
+ <?php endif; ?>
583
  <?php echo $item_value['text']; ?>
584
  </div>
585
  <?php
586
  }
 
587
  }
 
588
  ?>
589
  </div>
590
  </div>
591
  <?php
 
592
  }
593
  ?>
594
  </div> <!-- Tab sections -->
595
  <?php } ?>
596
 
597
  <div id="optimize-more" class="sb-pack-tab">
 
598
  <div class="feature-box postbox">
599
  <div class="inside clearfix">
600
+ <img class="feature-box-left feature-box-image" src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/optimocha.png" alt="Optimocha"/>
 
601
  <div class="feature-box-right">
602
+ <h2 class="feature-box-title"><?php _e( 'Speed up your website with Optimocha', 'speed-booster-pack' ) ?></h2>
603
+ <p class="feature-box-description"><?php _e( 'Optimocha is a tailored speed optimization service where you can get your website optimized by a speed optimization expert. With a one-time "investment", your website will be taken care of real people. <strong>A significant speed improvement is guaranteed</strong>, so can be sure that your investment will return to you with a faster website!', 'speed-booster-pack' ); ?></p>
604
+ <p class="feature-box-description"><?php _e( 'Or, if you\'d like to have someone maintain your website speed, keep everything up-to-date and ensure your website is secure all the time; you can purchase Optimocha\'s monthly optimization &amp; maintenance packages. <strong>Annual payments have more and more benefits</strong>, be sure to check them out!', 'speed-booster-pack' ); ?></p>
605
+ <p class="feature-box-button">
606
+ <a href="https://optimocha.com/?ref=sbp" target="_blank" class="button button-primary button-large"><?php _e( "Speed Up Your Website!", 'speed-booster-pack' ); ?></a>
 
 
 
 
607
  </p>
608
  </div>
609
  </div>
611
 
612
  <div class="feature-box postbox">
613
  <div class="inside clearfix">
614
+ <img class="feature-box-left feature-box-image" src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/shortpixel.png" alt="ShortPixel"/>
 
615
  <div class="feature-box-right">
616
+ <h2 class="feature-box-title"><?php _e( 'Optimize your images with ShortPixel', 'speed-booster-pack' ) ?></h2>
617
+ <p class="feature-box-description"><?php _e( 'Image optimization is essential for all websites - especially for sites with lots of images! ShortPixel Image Optimizer is probably the best image optimization plugin you can use in the WordPress ecosystem. By clicking the link below, <strong>you will get 50% more image optimization credits for the same price</strong>! The image optimization credits are good for unlimited websites and do not expire, so you can use your API key in all your websites, anytime you want.', 'speed-booster-pack' ); ?></p>
618
+ <p class="feature-box-button">
619
+ <a href="https://optimocha.com/go/shortpixel" target="_blank" class="button button-primary button-large"><?php _e( "Optimize Your Images!", 'speed-booster-pack' ); ?></a>
 
 
 
 
620
  </p>
621
  </div>
622
  </div>
624
 
625
  <div class="feature-box postbox">
626
  <div class="inside clearfix">
627
+ <img class="feature-box-left feature-box-image" src="<?php echo SPEED_BOOSTER_PACK_URL ?>inc/images/wp-engine.png" alt="WP Engine"/>
 
628
  <div class="feature-box-right">
629
+ <h2 class="feature-box-title"><?php _e( 'Get better hosting at WP Engine', 'speed-booster-pack' ) ?></h2>
630
+ <p class="feature-box-description"><?php _e( 'Choosing a good web hosting company make such a big difference, but often overlooked. It\'s understandable that people like to try cheap hosting packages in very large hosting companies, but if you\'re looking for a WordPress-centric hosting company with servers specially optimized for WordPress websites, be sure to check out WP Engine. Clicking the link below, <strong>you can get up to three months for free on annual payments!</strong>', 'speed-booster-pack' ); ?></p>
631
+ <p class="feature-box-button">
632
+ <a href="https://optimocha.com/go/wpengine" target="_blank" class="button button-primary button-large"><?php _e( "Get Better Hosting!", 'speed-booster-pack' ); ?></a>
 
 
 
 
633
  </p>
634
  </div>
635
  </div>
638
  </div><!--#optimize-more-->
639
 
640
  <div>
641
+ <?php submit_button( __( 'Save Changes', 'speed-booster-pack' ), 'primary large', 'submit', false ); ?>
 
 
 
642
  </div>
643
 
644
  </form>
650
  <div class="postbox">
651
  <h3 class="hndle"><?php _e( 'Invest in More Speed!', 'speed-booster-pack' ); ?></h3>
652
  <div class="inside">
653
+ <p><?php _e( 'People abandon pages that take more than a few seconds to load, which means slow pages lose you visitors (and money). You don’t want that to happen, do you?', 'speed-booster-pack' ) ?></p>
654
+ <p><?php _e( 'If you’re ready to <em>invest</em> in speeding up your website, click below for our professional, tailored speed optimization services!', 'speed-booster-pack' ); ?></a></p>
655
+ <p style="text-align:center">
656
+ <a href="https://optimocha.com/?ref=sbp" target="_blank" class="button button-primary button-large"><?php _e( "Speed Up Your Website!", 'speed-booster-pack' ); ?></a>
 
 
 
657
  </p>
658
  </div>
659
  </div>
661
  <div class="postbox">
662
  <h3 class="hndle"><?php _e( 'Test Your Website', 'speed-booster-pack' ); ?></h3>
663
  <div class="inside">
664
+ <p><?php _e( 'It\'s always a good idea to keep testing your website so you can track your website\'s speed. Click the buttons below to see how well your website performs in various speed test tools!', 'speed-booster-pack' ) ?></p>
665
+ <p style="text-align:center">
666
+ <a href="https://gtmetrix.com/?url=<?php echo home_url( '/' ); ?>" target="_blank" class="button button-secondary"><?php _e( "Test on GTmetrix", 'speed-booster-pack' ); ?></a>&nbsp;<a href="https://developers.google.com/speed/pagespeed/insights/?url=<?php echo home_url( '/' ); ?>" target="_blank" class="button button-secondary"><?php _e( "Test on Google PageSpeed", 'speed-booster-pack' ); ?></a>
 
 
 
 
 
 
 
667
  </p>
668
  </div>
669
  </div>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: speed, pagespeed, optimization, performance, page speed
5
  Requires at least: 4.6
6
  Tested up to: 5.3.2
7
  Requires PHP: 5.6
8
- Stable tag: 3.8.5
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -95,9 +95,19 @@ All the time! We're always looking for new ways to get this plugin to a better s
95
 
96
  == Changelog ==
97
 
 
 
 
 
 
 
 
 
 
 
98
  = 3.8.5 =
99
 
100
- *Release Date: 13 February 2020*
101
 
102
  * **Added**: New feature - Optimize Google Fonts!
103
  * **Updated**: Rewrote the whole JavaScript optimization feature! Hopefully it will work even better than our previous version. We also added a simple migration notice to not break current configurations, so be sure to migrate!
@@ -373,4 +383,4 @@ All the time! We're always looking for new ways to get this plugin to a better s
373
  * Modified Readme file
374
 
375
  = 1.0 =
376
- * Initial release
5
  Requires at least: 4.6
6
  Tested up to: 5.3.2
7
  Requires PHP: 5.6
8
+ Stable tag: 3.8.5.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
95
 
96
  == Changelog ==
97
 
98
+ = 3.8.5.1 =
99
+
100
+ *Release Date: 29 February 2020*
101
+
102
+ * **Added**: You can now exclude assets from lazy loading.
103
+ * **Added**: More "default" exclude rules added for the JS optimization feature.
104
+ * **Fixed**: An "empty needle" warning regarding replace functions.
105
+ * **Updated**: Updated `lazyload.js` to 12.5.1.
106
+ * **Removed**: Unnecessary jQuery UI slider script in the options screen.
107
+
108
  = 3.8.5 =
109
 
110
+ *Release Date: 15 February 2020*
111
 
112
  * **Added**: New feature - Optimize Google Fonts!
113
  * **Updated**: Rewrote the whole JavaScript optimization feature! Hopefully it will work even better than our previous version. We also added a simple migration notice to not break current configurations, so be sure to migrate!
383
  * Modified Readme file
384
 
385
  = 1.0 =
386
+ * Initial release
speed-booster-pack.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wordpress.org/plugins/speed-booster-pack/
5
  * Description: Speed optimization is vital for SEO. Optimize your PageSpeed scores today!
6
  * Author: Optimocha
7
- * Version: 3.8.5
8
  * Author URI: https://optimocha.com/
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -33,202 +33,200 @@
33
 
34
  // Security control for vulnerability attempts
35
  if ( ! defined( 'ABSPATH' ) ) {
36
- die;
37
  }
38
 
39
  /*----------------------------------------------------------------------------------------------------------
40
- Define some useful plugin constants
41
  -----------------------------------------------------------------------------------------------------------*/
42
 
43
  define( 'SPEED_BOOSTER_PACK_PATH', plugin_dir_path( __FILE__ ) );
44
  define( 'SPEED_BOOSTER_PACK_URL', preg_replace( '#^https?:#', '', plugin_dir_url( __FILE__ ) ) );
45
- define( 'SPEED_BOOSTER_PACK_VERSION', '3.8.5' );
46
 
47
  /*----------------------------------------------------------------------------------------------------------
48
- Global Variables
49
  -----------------------------------------------------------------------------------------------------------*/
50
 
51
  $sbp_options = get_option( 'sbp_settings' ); // retrieve the plugin settings from the options table
52
 
53
  /*----------------------------------------------------------------------------------------------------------
54
- Main Plugin Class
55
  -----------------------------------------------------------------------------------------------------------*/
56
 
57
  if ( ! class_exists( 'Speed_Booster_Pack' ) ) {
58
- class Speed_Booster_Pack {
59
 
60
- /*----------------------------------------------------------------------------------------------------------
61
- Function Construct
62
- -----------------------------------------------------------------------------------------------------------*/
63
 
64
- public function __construct() {
65
- global $sbp_options;
66
 
67
- // Enqueue admin scripts
68
- add_action( 'admin_enqueue_scripts', [ $this, 'sbp_admin_enqueue_scripts' ] );
69
 
70
- // load plugin textdomain
71
- add_action( 'plugins_loaded',
72
- function () {
73
- load_plugin_textdomain( 'speed-booster-pack' );
74
- } );
75
 
76
- // Display & dismiss notices
77
- add_action( 'admin_notices', [ &$this, 'sbp_display_notices' ] );
78
- add_action( 'wp_ajax_sbp_dismiss_notices', [ &$this, 'sbp_dismiss_notices' ] );
79
 
80
- // Migrate to new JS Footer Mover function
81
- add_action('admin_init', [$this, 'sbp_migrate_js_to_footer']);
82
 
83
- // Load plugin settings page
84
- require_once( SPEED_BOOSTER_PACK_PATH . 'inc/settings.php' );
85
- $Speed_Booster_Pack_Options = new Speed_Booster_Pack_Options();
86
 
87
- // Load main plugin functions
88
- require_once( SPEED_BOOSTER_PACK_PATH . 'inc/core.php' );
89
- $Speed_Booster_Pack_Core = new Speed_Booster_Pack_Core();
90
 
91
- // Enqueue admin style
92
- add_action( 'admin_enqueue_scripts', [ $this, 'sbp_enqueue_styles' ] );
93
 
94
- // Filters
95
- $this->path = plugin_basename( __FILE__ );
96
- add_filter( "plugin_action_links_$this->path", [ $this, 'sbp_settings_link' ] );
97
 
98
 
99
- } // END public function __construct
100
 
101
- /*----------------------------------------------------------------------------------------------------------
102
- Display/dismiss admin notices if needed
103
- -----------------------------------------------------------------------------------------------------------*/
104
 
105
- function sbp_display_notices() {
106
- $is_using_new_version = ! ( get_option( 'sbp_js_footer_exceptions1' ) || get_option( 'sbp_js_footer_exceptions2' ) || get_option( 'sbp_js_footer_exceptions3' ) || get_option( 'sbp_js_footer_exceptions4' ) );
107
 
108
- if ( ! $is_using_new_version ) {
109
- include_once( SPEED_BOOSTER_PACK_PATH . 'inc/template/notices/migrate_js_to_footer.php' );
110
- }
111
 
112
- if ( ! get_option( 'sbp_news' ) ) {
113
- global $sbp_settings_page;
114
- $screen = get_current_screen();
115
- if ( $screen->id != $sbp_settings_page ) {
116
- require_once( SPEED_BOOSTER_PACK_PATH . 'inc/template/notice.php' );
117
- }
118
- }
119
- }
120
 
121
- function sbp_dismiss_notices() {
122
- update_option( 'sbp_news', true );
123
 
124
- return json_encode( [ "Status" => 0 ] );
125
- }
126
 
127
- /*----------------------------------------------------------------------------------------------------------
128
- Activate the plugin
129
- -----------------------------------------------------------------------------------------------------------*/
130
 
131
- public static function sbp_activate() {
132
 
133
- add_option( 'sbp_js_footer_exceptions', '/js/jquery/jquery.js' );
134
 
135
- } // END public static function sb_activate
136
 
137
 
138
- /*----------------------------------------------------------------------------------------------------------
139
- Deactivate the plugin
140
- -----------------------------------------------------------------------------------------------------------*/
141
 
142
- public static function sbp_deactivate() {
143
- }
144
 
145
 
146
- /*----------------------------------------------------------------------------------------------------------
147
- CSS style of the plugin options page
148
- -----------------------------------------------------------------------------------------------------------*/
149
 
150
- function sbp_enqueue_styles( $hook ) {
151
 
152
- // load stylesheet only on plugin options page
153
- global $sbp_settings_page;
154
- if ( $hook != $sbp_settings_page ) {
155
- return;
156
- }
157
- wp_enqueue_style( 'sbp-styles',
158
- plugin_dir_url( __FILE__ ) . 'css/style.css',
159
- null,
160
- SPEED_BOOSTER_PACK_VERSION );
161
 
162
- }
163
 
164
 
165
- /*----------------------------------------------------------------------------------------------------------
166
- Enqueue admin scripts to plugin options page
167
- -----------------------------------------------------------------------------------------------------------*/
168
 
169
- public function sbp_admin_enqueue_scripts( $hook_sbp ) {
170
- // load scripts only on plugin options page
171
- global $sbp_settings_page;
172
- if ( $hook_sbp != $sbp_settings_page ) {
173
- return;
174
- }
175
- wp_enqueue_script( 'jquery-ui-slider' );
176
- wp_enqueue_script( 'postbox' );
177
 
178
- wp_enqueue_script( 'sbp-admin-scripts',
179
- plugins_url( 'inc/js/admin-scripts.js', __FILE__ ),
180
- [
181
- 'jquery',
182
- 'postbox',
183
- 'jquery-ui-slider',
184
- ],
185
- SPEED_BOOSTER_PACK_VERSION,
186
- true );
187
 
188
- wp_enqueue_script( 'sbp-plugin-install',
189
- plugins_url( 'inc/js/plugin-install.js', __FILE__ ),
190
- [
191
- 'jquery',
192
- 'updates',
193
- ],
194
- SPEED_BOOSTER_PACK_VERSION,
195
- true );
196
 
197
- }
198
 
199
 
200
- /*----------------------------------------------------------------------------------------------------------
201
- Add settings link on plugins page
202
- -----------------------------------------------------------------------------------------------------------*/
203
 
204
- function sbp_settings_link( $links ) {
205
- $pro_link = ' <a href="https://optimocha.com/?ref=sbp" target="_blank">Pro Help</a > ';
206
- $settings_link = ' <a href="admin.php?page=sbp-options">Settings</a > ';
207
- array_unshift( $links, $settings_link );
208
- array_unshift( $links, $pro_link );
209
-
210
- return $links;
211
 
212
- } // End function sbp_settings_link
213
-
214
- public function sbp_migrate_js_to_footer() {
215
- if ( isset( $_POST['migrate_js_mover'] ) ) {
216
- for ( $i = 1; $i <= 4; $i ++ ) {
217
- unregister_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions' . $i );
218
- delete_option( 'sbp_js_footer_exceptions' . $i );
219
- }
220
- }
221
- }
222
- }// End class Speed_Booster_Pack
223
- } // End if (!class_exists("Speed_Booster_Pack")) (1)
 
 
224
 
225
  if ( class_exists( 'Speed_Booster_Pack' ) ) {
226
 
227
- // Installation and uninstallation hooks
228
- register_activation_hook( __FILE__, [ 'Speed_Booster_Pack', 'sbp_activate' ] );
229
- register_deactivation_hook( __FILE__, [ 'Speed_Booster_Pack', 'sbp_deactivate' ] );
230
 
231
- // instantiate the plugin class
232
- $speed_booster_pack = new Speed_Booster_Pack();
233
 
234
  }
4
  * Plugin URI: https://wordpress.org/plugins/speed-booster-pack/
5
  * Description: Speed optimization is vital for SEO. Optimize your PageSpeed scores today!
6
  * Author: Optimocha
7
+ * Version: 3.8.5.1
8
  * Author URI: https://optimocha.com/
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
33
 
34
  // Security control for vulnerability attempts
35
  if ( ! defined( 'ABSPATH' ) ) {
36
+ die;
37
  }
38
 
39
  /*----------------------------------------------------------------------------------------------------------
40
+ Define some useful plugin constants
41
  -----------------------------------------------------------------------------------------------------------*/
42
 
43
  define( 'SPEED_BOOSTER_PACK_PATH', plugin_dir_path( __FILE__ ) );
44
  define( 'SPEED_BOOSTER_PACK_URL', preg_replace( '#^https?:#', '', plugin_dir_url( __FILE__ ) ) );
45
+ define( 'SPEED_BOOSTER_PACK_VERSION', '3.8.5.1' );
46
 
47
  /*----------------------------------------------------------------------------------------------------------
48
+ Global Variables
49
  -----------------------------------------------------------------------------------------------------------*/
50
 
51
  $sbp_options = get_option( 'sbp_settings' ); // retrieve the plugin settings from the options table
52
 
53
  /*----------------------------------------------------------------------------------------------------------
54
+ Main Plugin Class
55
  -----------------------------------------------------------------------------------------------------------*/
56
 
57
  if ( ! class_exists( 'Speed_Booster_Pack' ) ) {
58
+ class Speed_Booster_Pack {
59
 
60
+ /*----------------------------------------------------------------------------------------------------------
61
+ Function Construct
62
+ -----------------------------------------------------------------------------------------------------------*/
63
 
64
+ public function __construct() {
65
+ global $sbp_options;
66
 
67
+ // Enqueue admin scripts
68
+ add_action( 'admin_enqueue_scripts', [ $this, 'sbp_admin_enqueue_scripts' ] );
69
 
70
+ // load plugin textdomain
71
+ add_action( 'plugins_loaded',
72
+ function () {
73
+ load_plugin_textdomain( 'speed-booster-pack' );
74
+ } );
75
 
76
+ // Display & dismiss notices
77
+ add_action( 'admin_notices', [ &$this, 'sbp_display_notices' ] );
78
+ add_action( 'wp_ajax_sbp_dismiss_notices', [ &$this, 'sbp_dismiss_notices' ] );
79
 
80
+ // Migrate to new JS Footer Mover function
81
+ add_action( 'admin_init', [ $this, 'sbp_migrate_js_to_footer' ] );
82
 
83
+ // Load plugin settings page
84
+ require_once( SPEED_BOOSTER_PACK_PATH . 'inc/settings.php' );
85
+ $Speed_Booster_Pack_Options = new Speed_Booster_Pack_Options();
86
 
87
+ // Load main plugin functions
88
+ require_once( SPEED_BOOSTER_PACK_PATH . 'inc/core.php' );
89
+ $Speed_Booster_Pack_Core = new Speed_Booster_Pack_Core();
90
 
91
+ // Enqueue admin style
92
+ add_action( 'admin_enqueue_scripts', [ $this, 'sbp_enqueue_styles' ] );
93
 
94
+ // Filters
95
+ $this->path = plugin_basename( __FILE__ );
96
+ add_filter( "plugin_action_links_$this->path", [ $this, 'sbp_settings_link' ] );
97
 
98
 
99
+ } // END public function __construct
100
 
101
+ /*----------------------------------------------------------------------------------------------------------
102
+ Display/dismiss admin notices if needed
103
+ -----------------------------------------------------------------------------------------------------------*/
104
 
105
+ function sbp_display_notices() {
106
+ $is_using_new_version = ! ( get_option( 'sbp_js_footer_exceptions1' ) || get_option( 'sbp_js_footer_exceptions2' ) || get_option( 'sbp_js_footer_exceptions3' ) || get_option( 'sbp_js_footer_exceptions4' ) );
107
 
108
+ if ( ! $is_using_new_version ) {
109
+ include_once( SPEED_BOOSTER_PACK_PATH . 'inc/template/notices/migrate_js_to_footer.php' );
110
+ }
111
 
112
+ if ( ! get_option( 'sbp_news' ) ) {
113
+ global $sbp_settings_page;
114
+ $screen = get_current_screen();
115
+ if ( $screen->id != $sbp_settings_page ) {
116
+ require_once( SPEED_BOOSTER_PACK_PATH . 'inc/template/notice.php' );
117
+ }
118
+ }
119
+ }
120
 
121
+ function sbp_dismiss_notices() {
122
+ update_option( 'sbp_news', true );
123
 
124
+ return json_encode( [ "Status" => 0 ] );
125
+ }
126
 
127
+ /*----------------------------------------------------------------------------------------------------------
128
+ Activate the plugin
129
+ -----------------------------------------------------------------------------------------------------------*/
130
 
131
+ public static function sbp_activate() {
132
 
133
+ add_option( 'sbp_js_footer_exceptions', '/js/jquery/jquery.js' );
134
 
135
+ } // END public static function sb_activate
136
 
137
 
138
+ /*----------------------------------------------------------------------------------------------------------
139
+ Deactivate the plugin
140
+ -----------------------------------------------------------------------------------------------------------*/
141
 
142
+ public static function sbp_deactivate() {
143
+ }
144
 
145
 
146
+ /*----------------------------------------------------------------------------------------------------------
147
+ CSS style of the plugin options page
148
+ -----------------------------------------------------------------------------------------------------------*/
149
 
150
+ function sbp_enqueue_styles( $hook ) {
151
 
152
+ // load stylesheet only on plugin options page
153
+ global $sbp_settings_page;
154
+ if ( $hook != $sbp_settings_page ) {
155
+ return;
156
+ }
157
+ wp_enqueue_style( 'sbp-styles',
158
+ plugin_dir_url( __FILE__ ) . 'css/style.css',
159
+ null,
160
+ SPEED_BOOSTER_PACK_VERSION );
161
 
162
+ }
163
 
164
 
165
+ /*----------------------------------------------------------------------------------------------------------
166
+ Enqueue admin scripts to plugin options page
167
+ -----------------------------------------------------------------------------------------------------------*/
168
 
169
+ public function sbp_admin_enqueue_scripts( $hook_sbp ) {
170
+ // load scripts only on plugin options page
171
+ global $sbp_settings_page;
172
+ if ( $hook_sbp != $sbp_settings_page ) {
173
+ return;
174
+ }
175
+ wp_enqueue_script( 'postbox' );
 
176
 
177
+ wp_enqueue_script( 'sbp-admin-scripts',
178
+ plugins_url( 'inc/js/admin-scripts.js', __FILE__ ),
179
+ [
180
+ 'jquery',
181
+ 'postbox',
182
+ ],
183
+ SPEED_BOOSTER_PACK_VERSION,
184
+ true );
 
185
 
186
+ wp_enqueue_script( 'sbp-plugin-install',
187
+ plugins_url( 'inc/js/plugin-install.js', __FILE__ ),
188
+ [
189
+ 'jquery',
190
+ 'updates',
191
+ ],
192
+ SPEED_BOOSTER_PACK_VERSION,
193
+ true );
194
 
195
+ }
196
 
197
 
198
+ /*----------------------------------------------------------------------------------------------------------
199
+ Add settings link on plugins page
200
+ -----------------------------------------------------------------------------------------------------------*/
201
 
202
+ function sbp_settings_link( $links ) {
203
+ $pro_link = ' <a href="https://optimocha.com/?ref=sbp" target="_blank">Pro Help</a > ';
204
+ $settings_link = ' <a href="admin.php?page=sbp-options">Settings</a > ';
205
+ array_unshift( $links, $settings_link );
206
+ array_unshift( $links, $pro_link );
 
 
207
 
208
+ return $links;
209
+
210
+ } // End function sbp_settings_link
211
+
212
+ public function sbp_migrate_js_to_footer() {
213
+ if ( isset( $_POST['migrate_js_mover'] ) ) {
214
+ for ( $i = 1; $i <= 4; $i ++ ) {
215
+ unregister_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions' . $i );
216
+ delete_option( 'sbp_js_footer_exceptions' . $i );
217
+ }
218
+ }
219
+ }
220
+ }// End class Speed_Booster_Pack
221
+ } // End if (!class_exists("Speed_Booster_Pack")) (1)
222
 
223
  if ( class_exists( 'Speed_Booster_Pack' ) ) {
224
 
225
+ // Installation and uninstallation hooks
226
+ register_activation_hook( __FILE__, [ 'Speed_Booster_Pack', 'sbp_activate' ] );
227
+ register_deactivation_hook( __FILE__, [ 'Speed_Booster_Pack', 'sbp_deactivate' ] );
228
 
229
+ // instantiate the plugin class
230
+ $speed_booster_pack = new Speed_Booster_Pack();
231
 
232
  }
uninstall.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
9
  }
10
 
11
  // Database Tables and Options name Configrations
12
- $option_names = [ 'sbp_settings', 'sbp_news', 'sbp_js_footer_exceptions', 'sbp_css_exceptions' ];
13
 
14
  if ( ! is_array( $option_names ) ) {
15
  $option_names = [ $option_names ];
9
  }
10
 
11
  // Database Tables and Options name Configrations
12
+ $option_names = [ 'sbp_settings', 'sbp_news', 'sbp_js_footer_exceptions', 'sbp_css_exceptions', 'sbp_lazyload_exclusions' ];
13
 
14
  if ( ! is_array( $option_names ) ) {
15
  $option_names = [ $option_names ];