WP Reset – Fastest WordPress Reset Plugin - Version 1.81

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP Reset – Fastest WordPress Reset Plugin
Version 1.81
Comparing to
See all releases

Code changes from version 1.80 to 1.81

css/tooltipster.bundle.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .tooltipster-fall,.tooltipster-grow.tooltipster-show{-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1);-moz-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);-ms-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);-o-transition-timing-function:cubic-bezier(.175,.885,.32,1.15)}.tooltipster-base{display:flex;pointer-events:none;position:absolute}.tooltipster-box{flex:1 1 auto}.tooltipster-content{box-sizing:border-box;max-height:100%;max-width:100%;overflow:auto}.tooltipster-ruler{bottom:0;left:0;overflow:hidden;position:fixed;right:0;top:0;visibility:hidden}.tooltipster-fade{opacity:0;-webkit-transition-property:opacity;-moz-transition-property:opacity;-o-transition-property:opacity;-ms-transition-property:opacity;transition-property:opacity}.tooltipster-fade.tooltipster-show{opacity:1}.tooltipster-grow{-webkit-transform:scale(0,0);-moz-transform:scale(0,0);-o-transform:scale(0,0);-ms-transform:scale(0,0);transform:scale(0,0);-webkit-transition-property:-webkit-transform;-moz-transition-property:-moz-transform;-o-transition-property:-o-transform;-ms-transition-property:-ms-transform;transition-property:transform;-webkit-backface-visibility:hidden}.tooltipster-grow.tooltipster-show{-webkit-transform:scale(1,1);-moz-transform:scale(1,1);-o-transform:scale(1,1);-ms-transform:scale(1,1);transform:scale(1,1);-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);transition-timing-function:cubic-bezier(.175,.885,.32,1.15)}.tooltipster-swing{opacity:0;-webkit-transform:rotateZ(4deg);-moz-transform:rotateZ(4deg);-o-transform:rotateZ(4deg);-ms-transform:rotateZ(4deg);transform:rotateZ(4deg);-webkit-transition-property:-webkit-transform,opacity;-moz-transition-property:-moz-transform;-o-transition-property:-o-transform;-ms-transition-property:-ms-transform;transition-property:transform}.tooltipster-swing.tooltipster-show{opacity:1;-webkit-transform:rotateZ(0);-moz-transform:rotateZ(0);-o-transform:rotateZ(0);-ms-transform:rotateZ(0);transform:rotateZ(0);-webkit-transition-timing-function:cubic-bezier(.23,.635,.495,1);-webkit-transition-timing-function:cubic-bezier(.23,.635,.495,2.4);-moz-transition-timing-function:cubic-bezier(.23,.635,.495,2.4);-ms-transition-timing-function:cubic-bezier(.23,.635,.495,2.4);-o-transition-timing-function:cubic-bezier(.23,.635,.495,2.4);transition-timing-function:cubic-bezier(.23,.635,.495,2.4)}.tooltipster-fall{-webkit-transition-property:top;-moz-transition-property:top;-o-transition-property:top;-ms-transition-property:top;transition-property:top;-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);transition-timing-function:cubic-bezier(.175,.885,.32,1.15)}.tooltipster-fall.tooltipster-initial{top:0!important}.tooltipster-fall.tooltipster-dying{-webkit-transition-property:all;-moz-transition-property:all;-o-transition-property:all;-ms-transition-property:all;transition-property:all;top:0!important;opacity:0}.tooltipster-slide{-webkit-transition-property:left;-moz-transition-property:left;-o-transition-property:left;-ms-transition-property:left;transition-property:left;-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1);-webkit-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);-moz-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);-ms-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);-o-transition-timing-function:cubic-bezier(.175,.885,.32,1.15);transition-timing-function:cubic-bezier(.175,.885,.32,1.15)}.tooltipster-slide.tooltipster-initial{left:-40px!important}.tooltipster-slide.tooltipster-dying{-webkit-transition-property:all;-moz-transition-property:all;-o-transition-property:all;-ms-transition-property:all;transition-property:all;left:0!important;opacity:0}@keyframes tooltipster-fading{0%{opacity:0}100%{opacity:1}}.tooltipster-update-fade{animation:tooltipster-fading .4s}@keyframes tooltipster-rotating{25%{transform:rotate(-2deg)}75%{transform:rotate(2deg)}100%{transform:rotate(0)}}.tooltipster-update-rotate{animation:tooltipster-rotating .6s}@keyframes tooltipster-scaling{50%{transform:scale(1.1)}100%{transform:scale(1)}}.tooltipster-update-scale{animation:tooltipster-scaling .6s}.tooltipster-sidetip .tooltipster-box{background:#565656;border:2px solid #000;border-radius:4px}.tooltipster-sidetip.tooltipster-bottom .tooltipster-box{margin-top:8px}.tooltipster-sidetip.tooltipster-left .tooltipster-box{margin-right:8px}.tooltipster-sidetip.tooltipster-right .tooltipster-box{margin-left:8px}.tooltipster-sidetip.tooltipster-top .tooltipster-box{margin-bottom:8px}.tooltipster-sidetip .tooltipster-content{color:#fff;line-height:18px;padding:6px 14px}.tooltipster-sidetip .tooltipster-arrow{overflow:hidden;position:absolute}.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow{height:10px;margin-left:-10px;top:0;width:20px}.tooltipster-sidetip.tooltipster-left .tooltipster-arrow{height:20px;margin-top:-10px;right:0;top:0;width:10px}.tooltipster-sidetip.tooltipster-right .tooltipster-arrow{height:20px;margin-top:-10px;left:0;top:0;width:10px}.tooltipster-sidetip.tooltipster-top .tooltipster-arrow{bottom:0;height:10px;margin-left:-10px;width:20px}.tooltipster-sidetip .tooltipster-arrow-background,.tooltipster-sidetip .tooltipster-arrow-border{height:0;position:absolute;width:0}.tooltipster-sidetip .tooltipster-arrow-background{border:10px solid transparent}.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-background{border-bottom-color:#565656;left:0;top:3px}.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-background{border-left-color:#565656;left:-3px;top:0}.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-background{border-right-color:#565656;left:3px;top:0}.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-background{border-top-color:#565656;left:0;top:-3px}.tooltipster-sidetip .tooltipster-arrow-border{border:10px solid transparent;left:0;top:0}.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-border{border-bottom-color:#000}.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-border{border-left-color:#000}.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-border{border-right-color:#000}.tooltipster-sidetip.tooltipster-top .tooltipster-arrow-border{border-top-color:#000}.tooltipster-sidetip .tooltipster-arrow-uncropped{position:relative}.tooltipster-sidetip.tooltipster-bottom .tooltipster-arrow-uncropped{top:-10px}.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-uncropped{left:-10px}
css/wp-reset.css CHANGED
@@ -84,6 +84,17 @@ body.tools_page_wp-reset {
84
  color: #ffb900;
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
87
  .tools_page_wp-reset .dropdown {
88
  position: relative;
89
  display: inline-block;
@@ -91,7 +102,7 @@ body.tools_page_wp-reset {
91
  }
92
 
93
  .tools_page_wp-reset .button.dropdown-toggle::after {
94
- content: "\f140";
95
  font-family: dashicons;
96
  display: inline-block;
97
  line-height: 1;
@@ -592,11 +603,7 @@ body.tools_page_wp-reset {
592
  }
593
 
594
  .tools_page_wp-reset .ui-tabs .ui-tabs-nav li a,
595
- .tools_page_wp-reset
596
- .ui-tabs.ui-tabs-collapsible
597
- .ui-tabs-nav
598
- li.ui-tabs-selected
599
- a {
600
  cursor: pointer;
601
  }
602
 
@@ -625,7 +632,7 @@ body.tools_page_wp-reset {
625
  }
626
 
627
  .tools_page_wp-reset .ui-tabs-nav:after {
628
- content: "";
629
  clear: both;
630
  display: block;
631
  }
@@ -1070,13 +1077,11 @@ li .pro-feature {
1070
 
1071
  /* Fontello */
1072
  @font-face {
1073
- font-family: "fontello";
1074
- src: url("./font/fontello.eot?91671913");
1075
- src: url("./font/fontello.eot?91671913#iefix") format("embedded-opentype"),
1076
- url("./font/fontello.woff2?91671913") format("woff2"),
1077
- url("./font/fontello.woff?91671913") format("woff"),
1078
- url("./font/fontello.ttf?91671913") format("truetype"),
1079
- url("./font/fontello.svg?91671913#fontello") format("svg");
1080
  font-weight: normal;
1081
  font-style: normal;
1082
  }
@@ -1091,9 +1096,9 @@ li .pro-feature {
1091
  }
1092
  */
1093
 
1094
- [class^="icon-"]:before,
1095
- [class*=" icon-"]:before {
1096
- font-family: "fontello";
1097
  font-style: normal;
1098
  font-weight: normal;
1099
  display: inline-block;
@@ -1126,10 +1131,10 @@ li .pro-feature {
1126
  }
1127
 
1128
  .icon-doc-text-inv:before {
1129
- content: "\f15c";
1130
  } /* '' */
1131
  .icon-database:before {
1132
- content: "\f1c0";
1133
  } /* '' */
1134
 
1135
  .wpr-collections-installer {
@@ -1196,7 +1201,7 @@ li .pro-feature {
1196
  }
1197
 
1198
  .wpr-collections-installer-loading .dashicons:before {
1199
- content: "\f463";
1200
  }
1201
 
1202
  .wpr-collections-installer-loading .dashicons {
@@ -1210,12 +1215,12 @@ li .pro-feature {
1210
  }
1211
 
1212
  .wpr-collections-installer-success .dashicons:before {
1213
- content: "\f12a";
1214
  color: #1e232a;
1215
  }
1216
 
1217
  .wpr-collections-installer-error .dashicons:before {
1218
- content: "\f153";
1219
  color: #dd3036;
1220
  }
1221
 
84
  color: #ffb900;
85
  }
86
 
87
+ .tooltipster-sidetip.tooltipster-punk.tooltipster-wpr .tooltipster-box {
88
+ border-radius: 5px;
89
+ border: none;
90
+ border-bottom: 3px solid #5d5d5d;
91
+ background: #5d5d5d;
92
+ }
93
+
94
+ .tooltipster-sidetip.tooltipster-punk.tooltipster-wpr.tooltipster-top .tooltipster-arrow-border {
95
+ border-top-color: #5d5d5d;
96
+ }
97
+
98
  .tools_page_wp-reset .dropdown {
99
  position: relative;
100
  display: inline-block;
102
  }
103
 
104
  .tools_page_wp-reset .button.dropdown-toggle::after {
105
+ content: '\f140';
106
  font-family: dashicons;
107
  display: inline-block;
108
  line-height: 1;
603
  }
604
 
605
  .tools_page_wp-reset .ui-tabs .ui-tabs-nav li a,
606
+ .tools_page_wp-reset .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
 
 
 
 
607
  cursor: pointer;
608
  }
609
 
632
  }
633
 
634
  .tools_page_wp-reset .ui-tabs-nav:after {
635
+ content: '';
636
  clear: both;
637
  display: block;
638
  }
1077
 
1078
  /* Fontello */
1079
  @font-face {
1080
+ font-family: 'fontello';
1081
+ src: url('./font/fontello.eot?91671913');
1082
+ src: url('./font/fontello.eot?91671913#iefix') format('embedded-opentype'),
1083
+ url('./font/fontello.woff2?91671913') format('woff2'), url('./font/fontello.woff?91671913') format('woff'),
1084
+ url('./font/fontello.ttf?91671913') format('truetype'), url('./font/fontello.svg?91671913#fontello') format('svg');
 
 
1085
  font-weight: normal;
1086
  font-style: normal;
1087
  }
1096
  }
1097
  */
1098
 
1099
+ [class^='icon-']:before,
1100
+ [class*=' icon-']:before {
1101
+ font-family: 'fontello';
1102
  font-style: normal;
1103
  font-weight: normal;
1104
  display: inline-block;
1131
  }
1132
 
1133
  .icon-doc-text-inv:before {
1134
+ content: '\f15c';
1135
  } /* '' */
1136
  .icon-database:before {
1137
+ content: '\f1c0';
1138
  } /* '' */
1139
 
1140
  .wpr-collections-installer {
1201
  }
1202
 
1203
  .wpr-collections-installer-loading .dashicons:before {
1204
+ content: '\f463';
1205
  }
1206
 
1207
  .wpr-collections-installer-loading .dashicons {
1215
  }
1216
 
1217
  .wpr-collections-installer-success .dashicons:before {
1218
+ content: '\f12a';
1219
  color: #1e232a;
1220
  }
1221
 
1222
  .wpr-collections-installer-error .dashicons:before {
1223
+ content: '\f153';
1224
  color: #dd3036;
1225
  }
1226
 
js/wp-reset-libs.min.js CHANGED
@@ -17,3 +17,6 @@
17
 
18
  /*! js-cookie v2.2.1 | MIT */
19
  !function(a){var b;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(a){return a.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function c(d){function e(){}function f(b,c,f){if("undefined"!=typeof document){f=a({path:"/"},e.defaults,f),"number"==typeof f.expires&&(f.expires=new Date(1*new Date+864e5*f.expires)),f.expires=f.expires?f.expires.toUTCString():"";try{var g=JSON.stringify(c);/^[\{\[]/.test(g)&&(c=g)}catch(j){}c=d.write?d.write(c,b):encodeURIComponent(c+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+"").replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var h="";for(var i in f)f[i]&&(h+="; "+i,!0!==f[i]&&(h+="="+f[i].split(";")[0]));return document.cookie=b+"="+c+h}}function g(a,c){if("undefined"!=typeof document){for(var e={},f=document.cookie?document.cookie.split("; "):[],g=0;g<f.length;g++){var h=f[g].split("="),i=h.slice(1).join("=");c||'"'!==i.charAt(0)||(i=i.slice(1,-1));try{var j=b(h[0]);if(i=(d.read||d)(i,j)||b(i),c)try{i=JSON.parse(i)}catch(k){}if(e[j]=i,a===j)break}catch(k){}}return a?e[a]:e}}return e.set=f,e.get=function(a){return g(a,!1)},e.getJSON=function(a){return g(a,!0)},e.remove=function(b,c){f(b,"",a(c,{expires:-1}))},e.defaults={},e.withConverter=c,e}return c(function(){})});
 
 
 
17
 
18
  /*! js-cookie v2.2.1 | MIT */
19
  !function(a){var b;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(a){return a.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function c(d){function e(){}function f(b,c,f){if("undefined"!=typeof document){f=a({path:"/"},e.defaults,f),"number"==typeof f.expires&&(f.expires=new Date(1*new Date+864e5*f.expires)),f.expires=f.expires?f.expires.toUTCString():"";try{var g=JSON.stringify(c);/^[\{\[]/.test(g)&&(c=g)}catch(j){}c=d.write?d.write(c,b):encodeURIComponent(c+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+"").replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var h="";for(var i in f)f[i]&&(h+="; "+i,!0!==f[i]&&(h+="="+f[i].split(";")[0]));return document.cookie=b+"="+c+h}}function g(a,c){if("undefined"!=typeof document){for(var e={},f=document.cookie?document.cookie.split("; "):[],g=0;g<f.length;g++){var h=f[g].split("="),i=h.slice(1).join("=");c||'"'!==i.charAt(0)||(i=i.slice(1,-1));try{var j=b(h[0]);if(i=(d.read||d)(i,j)||b(i),c)try{i=JSON.parse(i)}catch(k){}if(e[j]=i,a===j)break}catch(k){}}return a?e[a]:e}}return e.set=f,e.get=function(a){return g(a,!1)},e.getJSON=function(a){return g(a,!0)},e.remove=function(b,c){f(b,"",a(c,{expires:-1}))},e.defaults={},e.withConverter=c,e}return c(function(){})});
20
+
21
+ /*! tooltipster v4.2.8 */!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){function b(a){this.$container,this.constraints=null,this.__$tooltip,this.__init(a)}function c(b,c){var d=!0;return a.each(b,function(a,e){return void 0===c[a]||b[a]!==c[a]?(d=!1,!1):void 0}),d}function d(b){var c=b.attr("id"),d=c?h.window.document.getElementById(c):null;return d?d===b[0]:a.contains(h.window.document.body,b[0])}function e(){if(!g)return!1;var a=g.document.body||g.document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e<d.length;e++)if("string"==typeof b[d[e]+c])return!0;return!1}var f={animation:"fade",animationDuration:350,content:null,contentAsHTML:!1,contentCloning:!1,debug:!0,delay:300,delayTouch:[300,500],functionInit:null,functionBefore:null,functionReady:null,functionAfter:null,functionFormat:null,IEmin:6,interactive:!1,multiple:!1,parent:null,plugins:["sideTip"],repositionOnScroll:!1,restoration:"none",selfDestruction:!0,theme:[],timer:0,trackerInterval:500,trackOrigin:!1,trackTooltip:!1,trigger:"hover",triggerClose:{click:!1,mouseleave:!1,originClick:!1,scroll:!1,tap:!1,touchleave:!1},triggerOpen:{click:!1,mouseenter:!1,tap:!1,touchstart:!1},updateAnimation:"rotate",zIndex:9999999},g="undefined"!=typeof window?window:null,h={hasTouchCapability:!(!g||!("ontouchstart"in g||g.DocumentTouch&&g.document instanceof g.DocumentTouch||g.navigator.maxTouchPoints)),hasTransitions:e(),IE:!1,semVer:"4.2.8",window:g},i=function(){this.__$emitterPrivate=a({}),this.__$emitterPublic=a({}),this.__instancesLatestArr=[],this.__plugins={},this._env=h};i.prototype={__bridge:function(b,c,d){if(!c[d]){var e=function(){};e.prototype=b;var g=new e;g.__init&&g.__init(c),a.each(b,function(a,b){0!=a.indexOf("__")&&(c[a]?f.debug&&console.log("The "+a+" method of the "+d+" plugin conflicts with another plugin or native methods"):(c[a]=function(){return g[a].apply(g,Array.prototype.slice.apply(arguments))},c[a].bridged=g))}),c[d]=g}return this},__setWindow:function(a){return h.window=a,this},_getRuler:function(a){return new b(a)},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_plugin:function(b){var c=this;if("string"==typeof b){var d=b,e=null;return d.indexOf(".")>0?e=c.__plugins[d]:a.each(c.__plugins,function(a,b){return b.name.substring(b.name.length-d.length-1)=="."+d?(e=b,!1):void 0}),e}if(b.name.indexOf(".")<0)throw new Error("Plugins must be namespaced");return c.__plugins[b.name]=b,b.core&&c.__bridge(b.core,c,b.name),this},_trigger:function(){var a=Array.prototype.slice.apply(arguments);return"string"==typeof a[0]&&(a[0]={type:a[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,a),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,a),this},instances:function(b){var c=[],d=b||".tooltipstered";return a(d).each(function(){var b=a(this),d=b.data("tooltipster-ns");d&&a.each(d,function(a,d){c.push(b.data(d))})}),c},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(b){var c=b?b+" ":"";return a(c+".tooltipstered").toArray()},setDefaults:function(b){return a.extend(f,b),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.tooltipster=new i,a.Tooltipster=function(b,c){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__$emitterPrivate=a({}),this.__$emitterPublic=a({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace="tooltipster-"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state="closed",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(b,c)},a.Tooltipster.prototype={__init:function(b,c){var d=this;if(d._$origin=a(b),d.__options=a.extend(!0,{},f,c),d.__optionsFormat(),!h.IE||h.IE>=d.__options.IEmin){var e=null;if(void 0===d._$origin.data("tooltipster-initialTitle")&&(e=d._$origin.attr("title"),void 0===e&&(e=null),d._$origin.data("tooltipster-initialTitle",e)),null!==d.__options.content)d.__contentSet(d.__options.content);else{var g,i=d._$origin.attr("data-tooltip-content");i&&(g=a(i)),g&&g[0]?d.__contentSet(g.first()):d.__contentSet(e)}d._$origin.removeAttr("title").addClass("tooltipstered"),d.__prepareOrigin(),d.__prepareGC(),a.each(d.__options.plugins,function(a,b){d._plug(b)}),h.hasTouchCapability&&a(h.window.document.body).on("touchmove."+d.__namespace+"-triggerOpen",function(a){d._touchRecordEvent(a)}),d._on("created",function(){d.__prepareTooltip()})._on("repositioned",function(a){d.__lastPosition=a.position})}else d.__options.disabled=!0},__contentInsert:function(){var a=this,b=a._$tooltip.find(".tooltipster-content"),c=a.__Content,d=function(a){c=a};return a._trigger({type:"format",content:a.__Content,format:d}),a.__options.functionFormat&&(c=a.__options.functionFormat.call(a,a,{origin:a._$origin[0]},a.__Content)),"string"!=typeof c||a.__options.contentAsHTML?b.empty().append(c):b.text(c),a},__contentSet:function(b){return b instanceof a&&this.__options.contentCloning&&(b=b.clone(!0)),this.__Content=b,this._trigger({type:"updated",content:b}),this},__destroyError:function(){throw new Error("This tooltip has been destroyed and cannot execute your method call.")},__geometry:function(){var b=this,c=b._$origin,d=b._$origin.is("area");if(d){var e=b._$origin.parent().attr("name");c=a('img[usemap="#'+e+'"]')}var f=c[0].getBoundingClientRect(),g=a(h.window.document),i=a(h.window),j=c,k={available:{document:null,window:null},document:{size:{height:g.height(),width:g.width()}},window:{scroll:{left:h.window.scrollX||h.window.document.documentElement.scrollLeft,top:h.window.scrollY||h.window.document.documentElement.scrollTop},size:{height:i.height(),width:i.width()}},origin:{fixedLineage:!1,offset:{},size:{height:f.bottom-f.top,width:f.right-f.left},usemapImage:d?c[0]:null,windowOffset:{bottom:f.bottom,left:f.left,right:f.right,top:f.top}}};if(d){var l=b._$origin.attr("shape"),m=b._$origin.attr("coords");if(m&&(m=m.split(","),a.map(m,function(a,b){m[b]=parseInt(a)})),"default"!=l)switch(l){case"circle":var n=m[0],o=m[1],p=m[2],q=o-p,r=n-p;k.origin.size.height=2*p,k.origin.size.width=k.origin.size.height,k.origin.windowOffset.left+=r,k.origin.windowOffset.top+=q;break;case"rect":var s=m[0],t=m[1],u=m[2],v=m[3];k.origin.size.height=v-t,k.origin.size.width=u-s,k.origin.windowOffset.left+=s,k.origin.windowOffset.top+=t;break;case"poly":for(var w=0,x=0,y=0,z=0,A="even",B=0;B<m.length;B++){var C=m[B];"even"==A?(C>y&&(y=C,0===B&&(w=y)),w>C&&(w=C),A="odd"):(C>z&&(z=C,1==B&&(x=z)),x>C&&(x=C),A="even")}k.origin.size.height=z-x,k.origin.size.width=y-w,k.origin.windowOffset.left+=w,k.origin.windowOffset.top+=x}}var D=function(a){k.origin.size.height=a.height,k.origin.windowOffset.left=a.left,k.origin.windowOffset.top=a.top,k.origin.size.width=a.width};for(b._trigger({type:"geometry",edit:D,geometry:{height:k.origin.size.height,left:k.origin.windowOffset.left,top:k.origin.windowOffset.top,width:k.origin.size.width}}),k.origin.windowOffset.right=k.origin.windowOffset.left+k.origin.size.width,k.origin.windowOffset.bottom=k.origin.windowOffset.top+k.origin.size.height,k.origin.offset.left=k.origin.windowOffset.left+k.window.scroll.left,k.origin.offset.top=k.origin.windowOffset.top+k.window.scroll.top,k.origin.offset.bottom=k.origin.offset.top+k.origin.size.height,k.origin.offset.right=k.origin.offset.left+k.origin.size.width,k.available.document={bottom:{height:k.document.size.height-k.origin.offset.bottom,width:k.document.size.width},left:{height:k.document.size.height,width:k.origin.offset.left},right:{height:k.document.size.height,width:k.document.size.width-k.origin.offset.right},top:{height:k.origin.offset.top,width:k.document.size.width}},k.available.window={bottom:{height:Math.max(k.window.size.height-Math.max(k.origin.windowOffset.bottom,0),0),width:k.window.size.width},left:{height:k.window.size.height,width:Math.max(k.origin.windowOffset.left,0)},right:{height:k.window.size.height,width:Math.max(k.window.size.width-Math.max(k.origin.windowOffset.right,0),0)},top:{height:Math.max(k.origin.windowOffset.top,0),width:k.window.size.width}};"html"!=j[0].tagName.toLowerCase();){if("fixed"==j.css("position")){k.origin.fixedLineage=!0;break}j=j.parent()}return k},__optionsFormat:function(){return"number"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),"number"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),"number"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),"string"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),null===this.__options.parent?this.__options.parent=a(h.window.document.body):"string"==typeof this.__options.parent&&(this.__options.parent=a(this.__options.parent)),"hover"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):"click"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger("options"),this},__prepareGC:function(){var b=this;return b.__options.selfDestruction?b.__garbageCollector=setInterval(function(){var c=(new Date).getTime();b.__touchEvents=a.grep(b.__touchEvents,function(a,b){return c-a.time>6e4}),d(b._$origin)||b.close(function(){b.destroy()})},2e4):clearInterval(b.__garbageCollector),b},__prepareOrigin:function(){var a=this;if(a._$origin.off("."+a.__namespace+"-triggerOpen"),h.hasTouchCapability&&a._$origin.on("touchstart."+a.__namespace+"-triggerOpen touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen",function(b){a._touchRecordEvent(b)}),a.__options.triggerOpen.click||a.__options.triggerOpen.tap&&h.hasTouchCapability){var b="";a.__options.triggerOpen.click&&(b+="click."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.tap&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&a._open(b)})}if(a.__options.triggerOpen.mouseenter||a.__options.triggerOpen.touchstart&&h.hasTouchCapability){var b="";a.__options.triggerOpen.mouseenter&&(b+="mouseenter."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.touchstart&&h.hasTouchCapability&&(b+="touchstart."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){!a._touchIsTouchEvent(b)&&a._touchIsEmulatedEvent(b)||(a.__pointerIsOverOrigin=!0,a._openShortly(b))})}if(a.__options.triggerClose.mouseleave||a.__options.triggerClose.touchleave&&h.hasTouchCapability){var b="";a.__options.triggerClose.mouseleave&&(b+="mouseleave."+a.__namespace+"-triggerOpen "),a.__options.triggerClose.touchleave&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&(a.__pointerIsOverOrigin=!1)})}return a},__prepareTooltip:function(){var b=this,c=b.__options.interactive?"auto":"";return b._$tooltip.attr("id",b.__namespace).css({"pointer-events":c,zIndex:b.__options.zIndex}),a.each(b.__previousThemes,function(a,c){b._$tooltip.removeClass(c)}),a.each(b.__options.theme,function(a,c){b._$tooltip.addClass(c)}),b.__previousThemes=a.merge([],b.__options.theme),b},__scrollHandler:function(b){var c=this;if(c.__options.triggerClose.scroll)c._close(b);else if(d(c._$origin)&&d(c._$tooltip)){var e=null;if(b.target===h.window.document)c.__Geometry.origin.fixedLineage||c.__options.repositionOnScroll&&c.reposition(b);else{e=c.__geometry();var f=!1;if("fixed"!=c._$origin.css("position")&&c.__$originParents.each(function(b,c){var d=a(c),g=d.css("overflow-x"),h=d.css("overflow-y");if("visible"!=g||"visible"!=h){var i=c.getBoundingClientRect();if("visible"!=g&&(e.origin.windowOffset.left<i.left||e.origin.windowOffset.right>i.right))return f=!0,!1;if("visible"!=h&&(e.origin.windowOffset.top<i.top||e.origin.windowOffset.bottom>i.bottom))return f=!0,!1}return"fixed"==d.css("position")?!1:void 0}),f)c._$tooltip.css("visibility","hidden");else if(c._$tooltip.css("visibility","visible"),c.__options.repositionOnScroll)c.reposition(b);else{var g=e.origin.offset.left-c.__Geometry.origin.offset.left,i=e.origin.offset.top-c.__Geometry.origin.offset.top;c._$tooltip.css({left:c.__lastPosition.coord.left+g,top:c.__lastPosition.coord.top+i})}}c._trigger({type:"scroll",event:b,geo:e})}return c},__stateSet:function(a){return this.__state=a,this._trigger({type:"state",state:a}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,a.each(this.__timeouts.close,function(a,b){clearTimeout(b)}),this.__timeouts.close=[],this},__trackerStart:function(){var a=this,b=a._$tooltip.find(".tooltipster-content");return a.__options.trackTooltip&&(a.__contentBcr=b[0].getBoundingClientRect()),a.__tracker=setInterval(function(){if(d(a._$origin)&&d(a._$tooltip)){if(a.__options.trackOrigin){var e=a.__geometry(),f=!1;c(e.origin.size,a.__Geometry.origin.size)&&(a.__Geometry.origin.fixedLineage?c(e.origin.windowOffset,a.__Geometry.origin.windowOffset)&&(f=!0):c(e.origin.offset,a.__Geometry.origin.offset)&&(f=!0)),f||(a.__options.triggerClose.mouseleave?a._close():a.reposition())}if(a.__options.trackTooltip){var g=b[0].getBoundingClientRect();g.height===a.__contentBcr.height&&g.width===a.__contentBcr.width||(a.reposition(),a.__contentBcr=g)}}else a._close()},a.__options.trackerInterval),a},_close:function(b,c,d){var e=this,f=!0;if(e._trigger({type:"close",event:b,stop:function(){f=!1}}),f||d){c&&e.__callbacks.close.push(c),e.__callbacks.open=[],e.__timeoutsClear();var g=function(){a.each(e.__callbacks.close,function(a,c){c.call(e,e,{event:b,origin:e._$origin[0]})}),e.__callbacks.close=[]};if("closed"!=e.__state){var i=!0,j=new Date,k=j.getTime(),l=k+e.__options.animationDuration[1];if("disappearing"==e.__state&&l>e.__closingTime&&e.__options.animationDuration[1]>0&&(i=!1),i){e.__closingTime=l,"disappearing"!=e.__state&&e.__stateSet("disappearing");var m=function(){clearInterval(e.__tracker),e._trigger({type:"closing",event:b}),e._$tooltip.off("."+e.__namespace+"-triggerClose").removeClass("tooltipster-dying"),a(h.window).off("."+e.__namespace+"-triggerClose"),e.__$originParents.each(function(b,c){a(c).off("scroll."+e.__namespace+"-triggerClose")}),e.__$originParents=null,a(h.window.document.body).off("."+e.__namespace+"-triggerClose"),e._$origin.off("."+e.__namespace+"-triggerClose"),e._off("dismissable"),e.__stateSet("closed"),e._trigger({type:"after",event:b}),e.__options.functionAfter&&e.__options.functionAfter.call(e,e,{event:b,origin:e._$origin[0]}),g()};h.hasTransitions?(e._$tooltip.css({"-moz-animation-duration":e.__options.animationDuration[1]+"ms","-ms-animation-duration":e.__options.animationDuration[1]+"ms","-o-animation-duration":e.__options.animationDuration[1]+"ms","-webkit-animation-duration":e.__options.animationDuration[1]+"ms","animation-duration":e.__options.animationDuration[1]+"ms","transition-duration":e.__options.animationDuration[1]+"ms"}),e._$tooltip.clearQueue().removeClass("tooltipster-show").addClass("tooltipster-dying"),e.__options.animationDuration[1]>0&&e._$tooltip.delay(e.__options.animationDuration[1]),e._$tooltip.queue(m)):e._$tooltip.stop().fadeOut(e.__options.animationDuration[1],m)}}else g()}return e},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(b,c){var e=this;if(!e.__destroying&&d(e._$origin)&&e.__enabled){var f=!0;if("closed"==e.__state&&(e._trigger({type:"before",event:b,stop:function(){f=!1}}),f&&e.__options.functionBefore&&(f=e.__options.functionBefore.call(e,e,{event:b,origin:e._$origin[0]}))),f!==!1&&null!==e.__Content){c&&e.__callbacks.open.push(c),e.__callbacks.close=[],e.__timeoutsClear();var g,i=function(){"stable"!=e.__state&&e.__stateSet("stable"),a.each(e.__callbacks.open,function(a,b){b.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}),e.__callbacks.open=[]};if("closed"!==e.__state)g=0,"disappearing"===e.__state?(e.__stateSet("appearing"),h.hasTransitions?(e._$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-show"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i)):e._$tooltip.stop().fadeIn(i)):"stable"==e.__state&&i();else{if(e.__stateSet("appearing"),g=e.__options.animationDuration[0],e.__contentInsert(),e.reposition(b,!0),h.hasTransitions?(e._$tooltip.addClass("tooltipster-"+e.__options.animation).addClass("tooltipster-initial").css({"-moz-animation-duration":e.__options.animationDuration[0]+"ms","-ms-animation-duration":e.__options.animationDuration[0]+"ms","-o-animation-duration":e.__options.animationDuration[0]+"ms","-webkit-animation-duration":e.__options.animationDuration[0]+"ms","animation-duration":e.__options.animationDuration[0]+"ms","transition-duration":e.__options.animationDuration[0]+"ms"}),setTimeout(function(){"closed"!=e.__state&&(e._$tooltip.addClass("tooltipster-show").removeClass("tooltipster-initial"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i))},0)):e._$tooltip.css("display","none").fadeIn(e.__options.animationDuration[0],i),e.__trackerStart(),a(h.window).on("resize."+e.__namespace+"-triggerClose",function(b){var c=a(document.activeElement);(c.is("input")||c.is("textarea"))&&a.contains(e._$tooltip[0],c[0])||e.reposition(b)}).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)}),e.__$originParents=e._$origin.parents(),e.__$originParents.each(function(b,c){a(c).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)})}),e.__options.triggerClose.mouseleave||e.__options.triggerClose.touchleave&&h.hasTouchCapability){e._on("dismissable",function(a){a.dismissable?a.delay?(m=setTimeout(function(){e._close(a.event)},a.delay),e.__timeouts.close.push(m)):e._close(a):clearTimeout(m)});var j=e._$origin,k="",l="",m=null;e.__options.interactive&&(j=j.add(e._$tooltip)),e.__options.triggerClose.mouseleave&&(k+="mouseenter."+e.__namespace+"-triggerClose ",l+="mouseleave."+e.__namespace+"-triggerClose "),e.__options.triggerClose.touchleave&&h.hasTouchCapability&&(k+="touchstart."+e.__namespace+"-triggerClose",l+="touchend."+e.__namespace+"-triggerClose touchcancel."+e.__namespace+"-triggerClose"),j.on(l,function(a){if(e._touchIsTouchEvent(a)||!e._touchIsEmulatedEvent(a)){var b="mouseleave"==a.type?e.__options.delay:e.__options.delayTouch;e._trigger({delay:b[1],dismissable:!0,event:a,type:"dismissable"})}}).on(k,function(a){!e._touchIsTouchEvent(a)&&e._touchIsEmulatedEvent(a)||e._trigger({dismissable:!1,event:a,type:"dismissable"})})}e.__options.triggerClose.originClick&&e._$origin.on("click."+e.__namespace+"-triggerClose",function(a){e._touchIsTouchEvent(a)||e._touchIsEmulatedEvent(a)||e._close(a)}),(e.__options.triggerClose.click||e.__options.triggerClose.tap&&h.hasTouchCapability)&&setTimeout(function(){if("closed"!=e.__state){var b="",c=a(h.window.document.body);e.__options.triggerClose.click&&(b+="click."+e.__namespace+"-triggerClose "),e.__options.triggerClose.tap&&h.hasTouchCapability&&(b+="touchend."+e.__namespace+"-triggerClose"),c.on(b,function(b){e._touchIsMeaningfulEvent(b)&&(e._touchRecordEvent(b),e.__options.interactive&&a.contains(e._$tooltip[0],b.target)||e._close(b))}),e.__options.triggerClose.tap&&h.hasTouchCapability&&c.on("touchstart."+e.__namespace+"-triggerClose",function(a){e._touchRecordEvent(a)})}},0),e._trigger("ready"),e.__options.functionReady&&e.__options.functionReady.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}if(e.__options.timer>0){var m=setTimeout(function(){e._close()},e.__options.timer+g);e.__timeouts.close.push(m)}}}return e},_openShortly:function(a){var b=this,c=!0;if("stable"!=b.__state&&"appearing"!=b.__state&&!b.__timeouts.open&&(b._trigger({type:"start",event:a,stop:function(){c=!1}}),c)){var d=0==a.type.indexOf("touch")?b.__options.delayTouch:b.__options.delay;d[0]?b.__timeouts.open=setTimeout(function(){b.__timeouts.open=null,b.__pointerIsOverOrigin&&b._touchIsMeaningfulEvent(a)?(b._trigger("startend"),b._open(a)):b._trigger("startcancel")},d[0]):(b._trigger("startend"),b._open(a))}return b},_optionsExtract:function(b,c){var d=this,e=a.extend(!0,{},c),f=d.__options[b];return f||(f={},a.each(c,function(a,b){var c=d.__options[a];void 0!==c&&(f[a]=c)})),a.each(e,function(b,c){void 0!==f[b]&&("object"!=typeof c||c instanceof Array||null==c||"object"!=typeof f[b]||f[b]instanceof Array||null==f[b]?e[b]=f[b]:a.extend(e[b],f[b]))}),e},_plug:function(b){var c=a.tooltipster._plugin(b);if(!c)throw new Error('The "'+b+'" plugin is not defined');return c.instance&&a.tooltipster.__bridge(c.instance,this,c.name),this},_touchIsEmulatedEvent:function(a){for(var b=!1,c=(new Date).getTime(),d=this.__touchEvents.length-1;d>=0;d--){var e=this.__touchEvents[d];if(!(c-e.time<500))break;e.target===a.target&&(b=!0)}return b},_touchIsMeaningfulEvent:function(a){return this._touchIsTouchEvent(a)&&!this._touchSwiped(a.target)||!this._touchIsTouchEvent(a)&&!this._touchIsEmulatedEvent(a)},_touchIsTouchEvent:function(a){return 0==a.type.indexOf("touch")},_touchRecordEvent:function(a){return this._touchIsTouchEvent(a)&&(a.time=(new Date).getTime(),this.__touchEvents.push(a)),this},_touchSwiped:function(a){for(var b=!1,c=this.__touchEvents.length-1;c>=0;c--){var d=this.__touchEvents[c];if("touchmove"==d.type){b=!0;break}if("touchstart"==d.type&&a===d.target)break}return b},_trigger:function(){var b=Array.prototype.slice.apply(arguments);return"string"==typeof b[0]&&(b[0]={type:b[0]}),b[0].instance=this,b[0].origin=this._$origin?this._$origin[0]:null,b[0].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,b),a.tooltipster._trigger.apply(a.tooltipster,b),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,b),this},_unplug:function(b){var c=this;if(c[b]){var d=a.tooltipster._plugin(b);d.instance&&a.each(d.instance,function(a,d){c[a]&&c[a].bridged===c[b]&&delete c[a]}),c[b].__destroy&&c[b].__destroy(),delete c[b]}return c},close:function(a){return this.__destroyed?this.__destroyError():this._close(null,a),this},content:function(a){var b=this;if(void 0===a)return b.__Content;if(b.__destroyed)b.__destroyError();else if(b.__contentSet(a),null!==b.__Content){if("closed"!==b.__state&&(b.__contentInsert(),b.reposition(),b.__options.updateAnimation))if(h.hasTransitions){var c=b.__options.updateAnimation;b._$tooltip.addClass("tooltipster-update-"+c),setTimeout(function(){"closed"!=b.__state&&b._$tooltip.removeClass("tooltipster-update-"+c)},1e3)}else b._$tooltip.fadeTo(200,.5,function(){"closed"!=b.__state&&b._$tooltip.fadeTo(200,1)})}else b._close();return b},destroy:function(){var b=this;if(b.__destroyed)b.__destroyError();else{"closed"!=b.__state?b.option("animationDuration",0)._close(null,null,!0):b.__timeoutsClear(),b._trigger("destroy"),b.__destroyed=!0,b._$origin.removeData(b.__namespace).off("."+b.__namespace+"-triggerOpen"),a(h.window.document.body).off("."+b.__namespace+"-triggerOpen");var c=b._$origin.data("tooltipster-ns");if(c)if(1===c.length){var d=null;"previous"==b.__options.restoration?d=b._$origin.data("tooltipster-initialTitle"):"current"==b.__options.restoration&&(d="string"==typeof b.__Content?b.__Content:a("<div></div>").append(b.__Content).html()),d&&b._$origin.attr("title",d),b._$origin.removeClass("tooltipstered"),b._$origin.removeData("tooltipster-ns").removeData("tooltipster-initialTitle")}else c=a.grep(c,function(a,c){return a!==b.__namespace}),b._$origin.data("tooltipster-ns",c);b._trigger("destroyed"),b._off(),b.off(),b.__Content=null,b.__$emitterPrivate=null,b.__$emitterPublic=null,b.__options.parent=null,b._$origin=null,b._$tooltip=null,a.tooltipster.__instancesLatestArr=a.grep(a.tooltipster.__instancesLatestArr,function(a,c){return b!==a}),clearInterval(b.__garbageCollector)}return b},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){return this.__destroyed?void this.__destroyError():this._$origin[0]},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(a){return this.close(a)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(a){return this.__destroyed?this.__destroyError():this._open(null,a),this},option:function(b,c){return void 0===c?this.__options[b]:(this.__destroyed?this.__destroyError():(this.__options[b]=c,this.__optionsFormat(),a.inArray(b,["trigger","triggerClose","triggerOpen"])>=0&&this.__prepareOrigin(),"selfDestruction"===b&&this.__prepareGC()),this)},reposition:function(a,b){var c=this;return c.__destroyed?c.__destroyError():"closed"!=c.__state&&d(c._$origin)&&(b||d(c._$tooltip))&&(b||c._$tooltip.detach(),c.__Geometry=c.__geometry(),c._trigger({type:"reposition",event:a,helper:{geo:c.__Geometry}})),c},show:function(a){return this.open(a)},status:function(){return{destroyed:this.__destroyed,enabled:this.__enabled,open:"closed"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.fn.tooltipster=function(){var b=Array.prototype.slice.apply(arguments),c="You are using a single HTML element as content for several tooltips. You probably want to set the contentCloning option to TRUE.";if(0===this.length)return this;if("string"==typeof b[0]){var d="#*$~&";return this.each(function(){var e=a(this).data("tooltipster-ns"),f=e?a(this).data(e[0]):null;if(!f)throw new Error("You called Tooltipster's \""+b[0]+'" method on an uninitialized element');if("function"!=typeof f[b[0]])throw new Error('Unknown method "'+b[0]+'"');this.length>1&&"content"==b[0]&&(b[1]instanceof a||"object"==typeof b[1]&&null!=b[1]&&b[1].tagName)&&!f.__options.contentCloning&&f.__options.debug&&console.log(c);var g=f[b[0]](b[1],b[2]);return g!==f||"instance"===b[0]?(d=g,!1):void 0}),"#*$~&"!==d?d:this}a.tooltipster.__instancesLatestArr=[];var e=b[0]&&void 0!==b[0].multiple,g=e&&b[0].multiple||!e&&f.multiple,h=b[0]&&void 0!==b[0].content,i=h&&b[0].content||!h&&f.content,j=b[0]&&void 0!==b[0].contentCloning,k=j&&b[0].contentCloning||!j&&f.contentCloning,l=b[0]&&void 0!==b[0].debug,m=l&&b[0].debug||!l&&f.debug;return this.length>1&&(i instanceof a||"object"==typeof i&&null!=i&&i.tagName)&&!k&&m&&console.log(c),this.each(function(){var c=!1,d=a(this),e=d.data("tooltipster-ns"),f=null;e?g?c=!0:m&&(console.log("Tooltipster: one or more tooltips are already attached to the element below. Ignoring."),console.log(this)):c=!0,c&&(f=new a.Tooltipster(this,b[0]),e||(e=[]),e.push(f.__namespace),d.data("tooltipster-ns",e),d.data(f.__namespace,f),f.__options.functionInit&&f.__options.functionInit.call(f,f,{origin:this}),f._trigger("init")),a.tooltipster.__instancesLatestArr.push(f)}),this},b.prototype={__init:function(b){this.__$tooltip=b,this.__$tooltip.css({left:0,overflow:"hidden",position:"absolute",top:0}).find(".tooltipster-content").css("overflow","auto"),this.$container=a('<div class="tooltipster-ruler"></div>').append(this.__$tooltip).appendTo(h.window.document.body)},__forceRedraw:function(){var a=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(a)},constrain:function(a,b){return this.constraints={width:a,height:b},this.__$tooltip.css({display:"block",height:"",overflow:"auto",width:a}),this},destroy:function(){this.__$tooltip.detach().find(".tooltipster-content").css({display:"",overflow:""}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:"",height:"",overflow:"visible",width:""}),this},measure:function(){this.__forceRedraw();var a=this.__$tooltip[0].getBoundingClientRect(),b={size:{height:a.height||a.bottom-a.top,width:a.width||a.right-a.left}};if(this.constraints){var c=this.__$tooltip.find(".tooltipster-content"),d=this.__$tooltip.outerHeight(),e=c[0].getBoundingClientRect(),f={height:d<=this.constraints.height,width:a.width<=this.constraints.width&&e.width>=c[0].scrollWidth-1};b.fits=f.height&&f.width}return h.IE&&h.IE<=11&&b.size.width!==h.window.document.documentElement.clientWidth&&(b.size.width=Math.ceil(b.size.width)+1),b}};var j=navigator.userAgent.toLowerCase();-1!=j.indexOf("msie")?h.IE=parseInt(j.split("msie")[1]):-1!==j.toLowerCase().indexOf("trident")&&-1!==j.indexOf(" rv:11")?h.IE=11:-1!=j.toLowerCase().indexOf("edge/")&&(h.IE=parseInt(j.toLowerCase().split("edge/")[1]));var k="tooltipster.sideTip";return a.tooltipster._plugin({name:k,instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:"top",viewportAware:!0}},__init:function(a){var b=this;b.__instance=a,b.__namespace="tooltipster-sideTip-"+Math.round(1e6*Math.random()),b.__previousState="closed",b.__options,b.__optionsFormat(),b.__instance._on("state."+b.__namespace,function(a){"closed"==a.state?b.__close():"appearing"==a.state&&"closed"==b.__previousState&&b.__create(),b.__previousState=a.state}),b.__instance._on("options."+b.__namespace,function(){b.__optionsFormat()}),b.__instance._on("reposition."+b.__namespace,function(a){b.__reposition(a.event,a.helper)})},__close:function(){this.__instance.content()instanceof a&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var b=a('<div class="tooltipster-base tooltipster-sidetip"><div class="tooltipster-box"><div class="tooltipster-content"></div></div><div class="tooltipster-arrow"><div class="tooltipster-arrow-uncropped"><div class="tooltipster-arrow-border"></div><div class="tooltipster-arrow-background"></div></div></div></div>');this.__options.arrow||b.find(".tooltipster-box").css("margin",0).end().find(".tooltipster-arrow").hide(),this.__options.minWidth&&b.css("min-width",this.__options.minWidth+"px"),this.__options.maxWidth&&b.css("max-width",this.__options.maxWidth+"px"),
22
+ this.__instance._$tooltip=b,this.__instance._trigger("created")},__destroy:function(){this.__instance._off("."+self.__namespace)},__optionsFormat:function(){var b=this;if(b.__options=b.__instance._optionsExtract(k,b.__defaults()),b.__options.position&&(b.__options.side=b.__options.position),"object"!=typeof b.__options.distance&&(b.__options.distance=[b.__options.distance]),b.__options.distance.length<4&&(void 0===b.__options.distance[1]&&(b.__options.distance[1]=b.__options.distance[0]),void 0===b.__options.distance[2]&&(b.__options.distance[2]=b.__options.distance[0]),void 0===b.__options.distance[3]&&(b.__options.distance[3]=b.__options.distance[1])),b.__options.distance={top:b.__options.distance[0],right:b.__options.distance[1],bottom:b.__options.distance[2],left:b.__options.distance[3]},"string"==typeof b.__options.side){var c={top:"bottom",right:"left",bottom:"top",left:"right"};b.__options.side=[b.__options.side,c[b.__options.side]],"left"==b.__options.side[0]||"right"==b.__options.side[0]?b.__options.side.push("top","bottom"):b.__options.side.push("right","left")}6===a.tooltipster._env.IE&&b.__options.arrow!==!0&&(b.__options.arrow=!1)},__reposition:function(b,c){var d,e=this,f=e.__targetFind(c),g=[];e.__instance._$tooltip.detach();var h=e.__instance._$tooltip.clone(),i=a.tooltipster._getRuler(h),j=!1,k=e.__instance.option("animation");switch(k&&h.removeClass("tooltipster-"+k),a.each(["window","document"],function(d,k){var l=null;if(e.__instance._trigger({container:k,helper:c,satisfied:j,takeTest:function(a){l=a},results:g,type:"positionTest"}),1==l||0!=l&&0==j&&("window"!=k||e.__options.viewportAware))for(var d=0;d<e.__options.side.length;d++){var m={horizontal:0,vertical:0},n=e.__options.side[d];"top"==n||"bottom"==n?m.vertical=e.__options.distance[n]:m.horizontal=e.__options.distance[n],e.__sideChange(h,n),a.each(["natural","constrained"],function(a,d){if(l=null,e.__instance._trigger({container:k,event:b,helper:c,mode:d,results:g,satisfied:j,side:n,takeTest:function(a){l=a},type:"positionTest"}),1==l||0!=l&&0==j){var h={container:k,distance:m,fits:null,mode:d,outerSize:null,side:n,size:null,target:f[n],whole:null},o="natural"==d?i.free():i.constrain(c.geo.available[k][n].width-m.horizontal,c.geo.available[k][n].height-m.vertical),p=o.measure();if(h.size=p.size,h.outerSize={height:p.size.height+m.vertical,width:p.size.width+m.horizontal},"natural"==d?c.geo.available[k][n].width>=h.outerSize.width&&c.geo.available[k][n].height>=h.outerSize.height?h.fits=!0:h.fits=!1:h.fits=p.fits,"window"==k&&(h.fits?"top"==n||"bottom"==n?h.whole=c.geo.origin.windowOffset.right>=e.__options.minIntersection&&c.geo.window.size.width-c.geo.origin.windowOffset.left>=e.__options.minIntersection:h.whole=c.geo.origin.windowOffset.bottom>=e.__options.minIntersection&&c.geo.window.size.height-c.geo.origin.windowOffset.top>=e.__options.minIntersection:h.whole=!1),g.push(h),h.whole)j=!0;else if("natural"==h.mode&&(h.fits||h.size.width<=c.geo.available[k][n].width))return!1}})}}),e.__instance._trigger({edit:function(a){g=a},event:b,helper:c,results:g,type:"positionTested"}),g.sort(function(a,b){if(a.whole&&!b.whole)return-1;if(!a.whole&&b.whole)return 1;if(a.whole&&b.whole){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}if(a.fits&&!b.fits)return-1;if(!a.fits&&b.fits)return 1;if(a.fits&&b.fits){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}return"document"==a.container&&"bottom"==a.side&&"natural"==a.mode?-1:1}),d=g[0],d.coord={},d.side){case"left":case"right":d.coord.top=Math.floor(d.target-d.size.height/2);break;case"bottom":case"top":d.coord.left=Math.floor(d.target-d.size.width/2)}switch(d.side){case"left":d.coord.left=c.geo.origin.windowOffset.left-d.outerSize.width;break;case"right":d.coord.left=c.geo.origin.windowOffset.right+d.distance.horizontal;break;case"top":d.coord.top=c.geo.origin.windowOffset.top-d.outerSize.height;break;case"bottom":d.coord.top=c.geo.origin.windowOffset.bottom+d.distance.vertical}"window"==d.container?"top"==d.side||"bottom"==d.side?d.coord.left<0?c.geo.origin.windowOffset.right-this.__options.minIntersection>=0?d.coord.left=0:d.coord.left=c.geo.origin.windowOffset.right-this.__options.minIntersection-1:d.coord.left>c.geo.window.size.width-d.size.width&&(c.geo.origin.windowOffset.left+this.__options.minIntersection<=c.geo.window.size.width?d.coord.left=c.geo.window.size.width-d.size.width:d.coord.left=c.geo.origin.windowOffset.left+this.__options.minIntersection+1-d.size.width):d.coord.top<0?c.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?d.coord.top=0:d.coord.top=c.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:d.coord.top>c.geo.window.size.height-d.size.height&&(c.geo.origin.windowOffset.top+this.__options.minIntersection<=c.geo.window.size.height?d.coord.top=c.geo.window.size.height-d.size.height:d.coord.top=c.geo.origin.windowOffset.top+this.__options.minIntersection+1-d.size.height):(d.coord.left>c.geo.window.size.width-d.size.width&&(d.coord.left=c.geo.window.size.width-d.size.width),d.coord.left<0&&(d.coord.left=0)),e.__sideChange(h,d.side),c.tooltipClone=h[0],c.tooltipParent=e.__instance.option("parent").parent[0],c.mode=d.mode,c.whole=d.whole,c.origin=e.__instance._$origin[0],c.tooltip=e.__instance._$tooltip[0],delete d.container,delete d.fits,delete d.mode,delete d.outerSize,delete d.whole,d.distance=d.distance.horizontal||d.distance.vertical;var l=a.extend(!0,{},d);if(e.__instance._trigger({edit:function(a){d=a},event:b,helper:c,position:l,type:"position"}),e.__options.functionPosition){var m=e.__options.functionPosition.call(e,e.__instance,c,l);m&&(d=m)}i.destroy();var n,o;"top"==d.side||"bottom"==d.side?(n={prop:"left",val:d.target-d.coord.left},o=d.size.width-this.__options.minIntersection):(n={prop:"top",val:d.target-d.coord.top},o=d.size.height-this.__options.minIntersection),n.val<this.__options.minIntersection?n.val=this.__options.minIntersection:n.val>o&&(n.val=o);var p;p=c.geo.origin.fixedLineage?c.geo.origin.windowOffset:{left:c.geo.origin.windowOffset.left+c.geo.window.scroll.left,top:c.geo.origin.windowOffset.top+c.geo.window.scroll.top},d.coord={left:p.left+(d.coord.left-c.geo.origin.windowOffset.left),top:p.top+(d.coord.top-c.geo.origin.windowOffset.top)},e.__sideChange(e.__instance._$tooltip,d.side),c.geo.origin.fixedLineage?e.__instance._$tooltip.css("position","fixed"):e.__instance._$tooltip.css("position",""),e.__instance._$tooltip.css({left:d.coord.left,top:d.coord.top,height:d.size.height,width:d.size.width}).find(".tooltipster-arrow").css({left:"",top:""}).css(n.prop,n.val),e.__instance._$tooltip.appendTo(e.__instance.option("parent")),e.__instance._trigger({type:"repositioned",event:b,position:d})},__sideChange:function(a,b){a.removeClass("tooltipster-bottom").removeClass("tooltipster-left").removeClass("tooltipster-right").removeClass("tooltipster-top").addClass("tooltipster-"+b)},__targetFind:function(a){var b={},c=this.__instance._$origin[0].getClientRects();if(c.length>1){var d=this.__instance._$origin.css("opacity");1==d&&(this.__instance._$origin.css("opacity",.99),c=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1))}if(c.length<2)b.top=Math.floor(a.geo.origin.windowOffset.left+a.geo.origin.size.width/2),b.bottom=b.top,b.left=Math.floor(a.geo.origin.windowOffset.top+a.geo.origin.size.height/2),b.right=b.left;else{var e=c[0];b.top=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil(c.length/2)-1]:c[0],b.right=Math.floor(e.top+(e.bottom-e.top)/2),e=c[c.length-1],b.bottom=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil((c.length+1)/2)-1]:c[c.length-1],b.left=Math.floor(e.top+(e.bottom-e.top)/2)}return b}}}),a});
js/wp-reset.js CHANGED
@@ -6,45 +6,48 @@
6
 
7
  jQuery(document).ready(function ($) {
8
  // init tabs
9
- $("#wp-reset-tabs")
10
  .tabs({
11
  create: function () {
12
- $("#loading-tabs").remove();
13
  },
14
  activate: function (event, ui) {
15
- localStorage.setItem(
16
- "wp-reset-tabs",
17
- $("#wp-reset-tabs").tabs("option", "active")
18
- );
19
  },
20
- active: localStorage.getItem("wp-reset-tabs") || 0,
21
  })
22
  .show();
23
 
24
  // helper for swithcing tabs & linking anchors in different tabs
25
- $(".tools_page_wp-reset").on("click", ".change-tab", function (e) {
26
  e.preventDefault();
27
 
28
- $("#wp-reset-tabs").tabs("option", "active", $(this).data("tab"));
29
 
30
  // get the link anchor and scroll to it
31
- target = this.href.split("#")[1];
32
  if (target) {
33
- $.scrollTo("#" + target, 500, { offset: { top: -50, left: 0 } });
34
  }
35
 
36
  $(this).blur();
37
  return false;
38
  }); // jump to tab/anchor helper
39
 
 
 
 
 
 
 
40
  // helper for scrolling to anchor
41
- $(".tools_page_wp-reset").on("click", ".scrollto", function (e) {
42
  e.preventDefault();
43
 
44
  // get the link anchor and scroll to it
45
- target = this.href.split("#")[1];
46
  if (target) {
47
- $.scrollTo("#" + target, 500, { offset: { top: -50, left: 0 } });
48
  }
49
 
50
  $(this).blur();
@@ -52,93 +55,86 @@ jQuery(document).ready(function ($) {
52
  }); // scroll to anchor helper
53
 
54
  // toggle button dropdown menu
55
- $(".tools_page_wp-reset").on("click", ".button.dropdown-toggle", function (
56
- e
57
- ) {
58
  e.preventDefault();
59
 
60
- parent_dropdown = $(this).parent(".dropdown");
61
- sibling_menu = $(this).siblings(".dropdown-menu");
62
 
63
- $(".dropdown").not(parent_dropdown).removeClass("show");
64
- $(".dropdown-menu").not(sibling_menu).removeClass("show");
65
 
66
- $(parent_dropdown).toggleClass("show");
67
- $(sibling_menu).toggleClass("show");
68
 
69
  return false;
70
  }); // toggle button dropdown menu
71
 
72
- $(document).on(
73
- "click",
74
- ":not(.dropdown-toggle), .dropdown-item",
75
- function () {
76
- wpr_close_dropdowns();
77
- }
78
- );
79
 
80
  // delete transients
81
- $(".tools_page_wp-reset").on("click", "#delete-transients", function (e) {
82
  e.preventDefault();
83
 
84
- run_tool(this, "delete_transients");
85
 
86
  return false;
87
  }); // delete transients
88
 
89
  // purge cache
90
- $(".tools_page_wp-reset").on("click", "#purge-cache", function (e) {
91
  e.preventDefault();
92
 
93
- run_tool(this, "purge_cache");
94
 
95
  return false;
96
  }); // purge cache
97
 
98
  // delete uploads
99
- $(".tools_page_wp-reset").on("click", "#delete-uploads", function (e) {
100
  e.preventDefault();
101
 
102
- run_tool(this, "delete_uploads");
103
 
104
  return false;
105
  }); // delete uploads
106
 
107
  // reset theme options (mods)
108
- $(".tools_page_wp-reset").on("click", "#reset-theme-options", function (e) {
109
  e.preventDefault();
110
 
111
- run_tool(this, "reset_theme_options");
112
 
113
  return false;
114
  }); // reset theme options
115
 
116
  // delete themes
117
- $(".tools_page_wp-reset").on("click", "#delete-themes", function (e) {
118
  e.preventDefault();
119
 
120
- run_tool(this, "delete_themes");
121
 
122
  return false;
123
  }); // delete themes
124
 
125
  // delete plugins
126
- $(".tools_page_wp-reset").on("click", "#delete-plugins", function (e) {
127
  e.preventDefault();
128
 
129
  var button = this;
130
- var confirm_title =
131
- $(button).data("confirm-title") || wp_reset.confirm_title;
132
 
133
  var tools = [
134
  {
135
- tool: "deactivate_plugins",
136
- description: "Deactivating plugins.",
137
  extra_data: { keep_default_theme: 0, keep_current_theme: 0 },
138
  },
139
  {
140
- tool: "delete_plugins",
141
- description: "Deleting plugins.",
142
  extra_data: {
143
  keep_wp_reset: 1,
144
  silent_deactivate: 0,
@@ -149,8 +145,8 @@ jQuery(document).ready(function ($) {
149
 
150
  confirm_action(
151
  confirm_title,
152
- $(button).data("text-confirm"),
153
- $(button).data("btn-confirm") || $(button).text(),
154
  wp_reset.cancel_button
155
  ).then((result) => {
156
  if (!result.value) {
@@ -158,8 +154,8 @@ jQuery(document).ready(function ($) {
158
  }
159
 
160
  wpr_swal.fire({
161
- title: $(button).data("text-wait"),
162
- text: " ",
163
  type: false,
164
  allowOutsideClick: false,
165
  allowEscapeKey: false,
@@ -167,11 +163,11 @@ jQuery(document).ready(function ($) {
167
  showConfirmButton: false,
168
  imageUrl: wp_reset.icon_url,
169
  onOpen: () => {
170
- $(wpr_swal.getImage()).addClass("wpr_rotating");
171
  },
172
  imageWidth: 100,
173
  imageHeight: 100,
174
- imageAlt: $(button).data("text-wait"),
175
  });
176
 
177
  var failed = false;
@@ -180,11 +176,11 @@ jQuery(document).ready(function ($) {
180
  if (failed) {
181
  return false;
182
  }
183
- wpr_swal.getContent().querySelector("#swal2-content").textContent =
184
- i + 1 + "/" + tools.length + " - " + data.description;
185
  return $.ajax({
186
  data: {
187
- action: "wp_reset_run_tool",
188
  _ajax_nonce: wp_reset.nonce_run_tool,
189
  tool: data.tool,
190
  extra_data: data.extra_data,
@@ -196,20 +192,18 @@ jQuery(document).ready(function ($) {
196
  failed = false;
197
  if (i == tools.length - 1) {
198
  if (response.data == 1) {
199
- msg = $(button).data("text-done-singular");
200
  } else {
201
- msg = $(button)
202
- .data("text-done")
203
- .replace("%n", response.data);
204
  }
205
- wpr_swal_params = { icon: "success", title: msg };
206
 
207
  wpr_swal.fire(wpr_swal_params);
208
  }
209
  } else {
210
  wpr_swal.close();
211
  wpr_swal.fire({
212
- icon: "error",
213
  title: wp_reset.documented_error,
214
  text: response.data,
215
  });
@@ -220,7 +214,7 @@ jQuery(document).ready(function ($) {
220
  .error(function (response) {
221
  wpr_swal.close();
222
  wpr_swal.fire({
223
- icon: "error",
224
  title: wp_reset.undocumented_error,
225
  });
226
  failed = true;
@@ -234,54 +228,51 @@ jQuery(document).ready(function ($) {
234
  }); // delete plugins
235
 
236
  // drop custom tables
237
- $(".tools_page_wp-reset").on("click", "#drop-custom-tables", function (e) {
238
  e.preventDefault();
239
 
240
- run_tool(this, "drop_custom_tables");
241
 
242
  return false;
243
  }); // drop custom tables
244
 
245
  // truncate custom tables
246
- $(".tools_page_wp-reset").on("click", "#truncate-custom-tables", function (
247
- e
248
- ) {
249
  e.preventDefault();
250
 
251
- run_tool(this, "truncate_custom_tables");
252
 
253
  return false;
254
  }); // truncate custom tables
255
 
256
  // delete htaccess file
257
- $(".tools_page_wp-reset").on("click", "#delete-htaccess", function (e) {
258
  e.preventDefault();
259
 
260
- run_tool(this, "delete_htaccess");
261
 
262
  return false;
263
  }); // delete htaccess file
264
 
265
  // delete auth cookies
266
- $(".tools_page_wp-reset").on("click", "#delete-wp-cookies", function (e) {
267
  e.preventDefault();
268
 
269
- run_tool(this, "delete_wp_cookies");
270
 
271
  return false;
272
  }); // delete auth cookies
273
 
274
  // delete local data
275
- $(".tools_page_wp-reset").on("click", "#delete-local-data", function (e) {
276
  e.preventDefault();
277
  var button = this;
278
- var confirm_title =
279
- $(button).data("confirm-title") || wp_reset.confirm_title;
280
 
281
  confirm_action(
282
  confirm_title,
283
- $(button).data("text-confirm"),
284
- $(button).data("btn-confirm"),
285
  wp_reset.cancel_button
286
  ).then((result) => {
287
  if (!result.value) {
@@ -290,29 +281,29 @@ jQuery(document).ready(function ($) {
290
 
291
  cnt = wpr_clear_local(true, true);
292
  if (cnt == 1) {
293
- msg = $(button).data("text-done-singular");
294
  } else {
295
- msg = $(button).data("text-done").replace("%n", cnt);
296
  }
297
- wpr_swal.fire({ icon: "success", title: msg });
298
  });
299
 
300
  return false;
301
  }); // delete local data
302
 
303
  // compare snapshot
304
- $("#wpr-snapshots").on("click", ".compare-snapshot", "click", function (e) {
305
  e.preventDefault();
306
- uid = $(this).data("ss-uid");
307
  button = $(this);
308
 
309
- block_ui($(button).data("wait-msg"));
310
  $.get({
311
  url: ajaxurl,
312
  data: {
313
- action: "wp_reset_run_tool",
314
  _ajax_nonce: wp_reset.nonce_run_tool,
315
- tool: "compare_snapshots",
316
  extra_data: uid,
317
  },
318
  })
@@ -321,54 +312,54 @@ jQuery(document).ready(function ($) {
321
  })
322
  .done(function (data) {
323
  if (data.success) {
324
- msg = $(button).data("title").replace("%s", $(button).data("name"));
325
  wpr_swal.fire({
326
- width: "90%",
327
  title: msg,
328
  html: data.data,
329
  showConfirmButton: false,
330
  allowEnterKey: false,
331
  focusConfirm: false,
332
  showCloseButton: true,
333
- customClass: "compare-snapshots",
334
  });
335
  } else {
336
  wpr_swal.fire({
337
- icon: "error",
338
- title: wp_reset.documented_error + " " + data.data,
339
  });
340
  }
341
  })
342
  .fail(function (data) {
343
- wpr_swal.fire({ icon: "error", title: wp_reset.undocumented_error });
344
  });
345
 
346
  return false;
347
  }); // compare snapshot
348
 
349
  // restore snapshot
350
- $("#wpr-snapshots").on("click", ".restore-snapshot", "click", function (e) {
351
  e.preventDefault();
352
- uid = $(this).data("ss-uid");
353
 
354
- run_tool(this, "restore_snapshot", uid);
355
 
356
  return false;
357
  }); // restore snapshot
358
 
359
  // download snapshot
360
- $("#wpr-snapshots").on("click", ".download-snapshot", "click", function (e) {
361
  e.preventDefault();
362
- uid = $(this).data("ss-uid");
363
  button = this;
364
 
365
- block_ui($(this).data("wait-msg"));
366
  $.get({
367
  url: ajaxurl,
368
  data: {
369
- action: "wp_reset_run_tool",
370
  _ajax_nonce: wp_reset.nonce_run_tool,
371
- tool: "download_snapshot",
372
  extra_data: uid,
373
  },
374
  })
@@ -377,44 +368,44 @@ jQuery(document).ready(function ($) {
377
  })
378
  .done(function (data) {
379
  if (data.success) {
380
- msg = $(button).data("success-msg").replace("%s", data.data);
381
- wpr_swal.fire({ icon: "success", title: msg });
382
  } else {
383
  wpr_swal.fire({
384
- icon: "error",
385
- title: wp_reset.documented_error + " " + data.data,
386
  });
387
  }
388
  })
389
  .fail(function (data) {
390
- wpr_swal.fire({ icon: "error", title: wp_reset.undocumented_error });
391
  });
392
 
393
  return false;
394
  }); // download snapshot
395
 
396
  // delete snapshot
397
- $("#wpr-snapshots").on("click", ".delete-snapshot", "click", function (e) {
398
  e.preventDefault();
399
- uid = $(this).data("ss-uid");
400
 
401
- run_tool(this, "delete_snapshot", uid);
402
 
403
  return false;
404
  }); // delete snapshot
405
 
406
  // create snapshot
407
- $(".tools_page_wp-reset").on("click", ".create-new-snapshot", function (e) {
408
  e.preventDefault();
409
 
410
- description = $(this).data("description") || "";
411
 
412
  wpr_swal
413
  .fire({
414
  title: wp_reset.snapshot_title,
415
- icon: "question",
416
  text: wp_reset.snapshot_text,
417
- input: "text",
418
  inputValue: description,
419
  inputPlaceholder: wp_reset.snapshot_placeholder,
420
  showCancelButton: true,
@@ -424,14 +415,14 @@ jQuery(document).ready(function ($) {
424
  width: 600,
425
  })
426
  .then((result) => {
427
- if (typeof result.value != "undefined") {
428
  block = block_ui(wp_reset.snapshot_wait);
429
  $.get({
430
  url: ajaxurl,
431
  data: {
432
- action: "wp_reset_run_tool",
433
  _ajax_nonce: wp_reset.nonce_run_tool,
434
- tool: "create_snapshot",
435
  extra_data: result.value,
436
  },
437
  })
@@ -442,7 +433,7 @@ jQuery(document).ready(function ($) {
442
  if (data.success) {
443
  wpr_swal
444
  .fire({
445
- icon: "success",
446
  title: wp_reset.snapshot_success,
447
  timer: 2500,
448
  timerProgressBar: true,
@@ -453,14 +444,14 @@ jQuery(document).ready(function ($) {
453
  });
454
  } else {
455
  wpr_swal.fire({
456
- icon: "error",
457
- title: wp_reset.documented_error + " " + data.data,
458
  });
459
  }
460
  })
461
  .fail(function (data) {
462
  wpr_swal.fire({
463
- icon: "error",
464
  title: wp_reset.undocumented_error,
465
  });
466
  });
@@ -471,38 +462,35 @@ jQuery(document).ready(function ($) {
471
  }); // create snapshot
472
 
473
  // show/hide extra table info in snapshot diff
474
- $("body.tools_page_wp-reset").on("click", ".header-row", function (e) {
475
  e.preventDefault();
476
 
477
- parent = $(this).parents("div.wpr-table-container > table > tbody");
478
- $(" > tr:not(.header-row)", parent).toggleClass("hidden");
479
 
480
- $("span.dashicons", parent)
481
- .toggleClass("dashicons-arrow-down-alt2")
482
- .toggleClass("dashicons-arrow-up-alt2");
483
 
484
  return false;
485
  }); // show hide extra info in diff
486
 
487
  // standard way of running a tool, with confirmation, loading and success message
488
  function run_tool(button, tool_name, extra_data) {
489
- var confirm_title =
490
- $(button).data("confirm-title") || wp_reset.confirm_title;
491
 
492
  wpr_close_dropdowns();
493
 
494
  confirm_action(
495
  confirm_title,
496
- $(button).data("text-confirm"),
497
- $(button).data("btn-confirm"),
498
  wp_reset.cancel_button
499
  ).then((result) => {
500
  if (result.value) {
501
- block = block_ui($(button).data("text-wait"));
502
  $.get({
503
  url: ajaxurl,
504
  data: {
505
- action: "wp_reset_run_tool",
506
  _ajax_nonce: wp_reset.nonce_run_tool,
507
  tool: tool_name,
508
  extra_data: extra_data,
@@ -514,39 +502,39 @@ jQuery(document).ready(function ($) {
514
  .done(function (data) {
515
  if (data.success) {
516
  if (data.data == 1) {
517
- msg = $(button).data("text-done-singular");
518
  } else {
519
- msg = $(button).data("text-done").replace("%n", data.data);
520
  }
521
  wpr_swal
522
  .fire({
523
- icon: "success",
524
  title: msg,
525
  timer: 2500,
526
  timerProgressBar: true,
527
  })
528
  .then(() => {
529
- if (tool_name == "restore_snapshot") {
530
  location.reload();
531
  }
532
  });
533
- if (tool_name == "delete_snapshot") {
534
- $("#wpr-ss-" + extra_data).remove();
535
- if ($("#wpr-snapshots tr").length <= 1) {
536
- $("#wpr-snapshots").hide();
537
- $("#ss-no-snapshots").show();
538
  }
539
  }
540
  } else {
541
  wpr_swal.fire({
542
- icon: "error",
543
- title: wp_reset.documented_error + " " + data.data,
544
  });
545
  }
546
  })
547
  .fail(function (data) {
548
  wpr_swal.fire({
549
- icon: "error",
550
  title: wp_reset.undocumented_error,
551
  });
552
  });
@@ -561,7 +549,7 @@ jQuery(document).ready(function ($) {
561
  type: false,
562
  imageUrl: wp_reset.icon_url,
563
  onOpen: () => {
564
- $(wpr_swal.getImage()).addClass("rotating");
565
  },
566
  imageWidth: 100,
567
  imageHeight: 100,
@@ -579,37 +567,37 @@ jQuery(document).ready(function ($) {
579
  function confirm_action(title, question, btn_confirm, btn_cancel) {
580
  tmp = wpr_swal.fire({
581
  title: title,
582
- icon: "question",
583
  html: question,
584
  showCancelButton: true,
585
  focusConfirm: false,
586
  focusCancel: true,
587
  confirmButtonText: btn_confirm,
588
  cancelButtonText: btn_cancel,
589
- confirmButtonColor: "#dd3036",
590
  width: 650,
591
  });
592
 
593
  return tmp;
594
  } // confirm_action
595
 
596
- $("#wp_reset_form").on("submit", function (e, confirmed) {
597
  if (!confirmed) {
598
- $("#wp_reset_submit").trigger("click");
599
  e.preventDefault();
600
  return false;
601
  }
602
 
603
- $(this).off("submit").submit();
604
  return true;
605
  }); // bypass default submit behaviour
606
 
607
- $("#wp_reset_submit").click(function (e) {
608
- if ($("#wp_reset_confirm").val() !== "reset") {
609
  wpr_swal.fire({
610
  title: wp_reset.invalid_confirmation_title,
611
  text: wp_reset.invalid_confirmation,
612
- icon: "error",
613
  confirmButtonText: wp_reset.ok_button,
614
  });
615
 
@@ -617,24 +605,24 @@ jQuery(document).ready(function ($) {
617
  return false;
618
  } // wrong confirmation code
619
 
620
- message = wp_reset.confirm1 + "<br>" + wp_reset.confirm2;
621
  wpr_swal
622
  .fire({
623
  title: wp_reset.confirm_title_reset,
624
- icon: "question",
625
  html: message,
626
  showCancelButton: true,
627
  focusConfirm: false,
628
  focusCancel: true,
629
  confirmButtonText: wp_reset.confirm_button,
630
  cancelButtonText: wp_reset.cancel_button,
631
- confirmButtonColor: "#dd3036",
632
  width: 600,
633
  })
634
  .then((result) => {
635
  if (result.value === true) {
636
  block_ui(wp_reset.doing_reset);
637
- $("#wp_reset_form").trigger("submit", true);
638
  }
639
  });
640
 
@@ -643,90 +631,82 @@ jQuery(document).ready(function ($) {
643
  }); // reset submit
644
 
645
  // collapse / expand card
646
- $(".tools_page_wp-reset").on("click", ".toggle-card", function (
647
- e,
648
- skip_anim
649
- ) {
650
  e.preventDefault();
651
 
652
- card = $(this).parents(".card").toggleClass("collapsed");
653
- $(".dashicons", this)
654
- .toggleClass("dashicons-arrow-up-alt2")
655
- .toggleClass("dashicons-arrow-down-alt2");
656
  $(this).blur();
657
 
658
- if (typeof skip_anim != "undefined" && skip_anim) {
659
- $(card).find(".card-body").toggle();
660
  } else {
661
- $(card).find(".card-body").slideToggle(500);
662
  }
663
 
664
- cards = localStorage.getItem("wp-reset-cards");
665
  if (cards == null) {
666
  cards = new Object();
667
  } else {
668
  cards = JSON.parse(cards);
669
  }
670
 
671
- card_id = card.attr("id") || $("h4", card).attr("id") || "";
672
 
673
- if (card.hasClass("collapsed")) {
674
- cards[card_id] = "collapsed";
675
  } else {
676
- cards[card_id] = "expanded";
677
  }
678
- localStorage.setItem("wp-reset-cards", JSON.stringify(cards));
679
 
680
  return false;
681
  }); // toggle-card
682
 
683
  // handle saved and preset cards' state
684
- cards_state = localStorage.getItem("wp-reset-cards");
685
  if (cards_state != null) {
686
  cards_state = JSON.parse(cards_state);
687
  } else {
688
  cards_state = new Object();
689
  }
690
 
691
- cards = $(".card");
692
  $.each(cards, function (index, card) {
693
- card_name = $("h4", card).attr("id");
694
  if (!card_name) {
695
  return;
696
  }
697
 
698
- if (
699
- typeof cards_state == "object" &&
700
- cards_state.hasOwnProperty(card_name)
701
- ) {
702
- if (cards_state[card_name] == "collapsed") {
703
- $("a.toggle-card", card).trigger("click", true);
704
  }
705
  } else {
706
- if ($(card).hasClass("default-collapsed")) {
707
- $("a.toggle-card", card).trigger("click", true);
708
  }
709
  }
710
  });
711
 
712
  // dismiss notice / pointer
713
- $(".wpr-dismiss-notice").on("click", function (e) {
714
- notice_name = $(this).data("notice");
715
  if (!notice_name) {
716
  return true;
717
  }
718
 
719
- if ($(this).data("survey")) {
720
- $("#survey-dialog").dialog("close");
721
  }
722
 
723
  $.get(ajaxurl, {
724
  notice_name: notice_name,
725
  _ajax_nonce: wp_reset.nonce_dismiss_notice,
726
- action: "wp_reset_dismiss_notice",
727
  });
728
 
729
- $(this).parents(".notice-wrapper").fadeOut();
730
 
731
  e.preventDefault();
732
  return false;
@@ -734,14 +714,14 @@ jQuery(document).ready(function ($) {
734
 
735
  // maybe init survey dialog
736
  if (wp_reset.open_survey) {
737
- $("#survey-dialog").dialog({
738
- dialogClass: "wp-dialog wpr-dialog wpr-survey-dialog",
739
  modal: 1,
740
  resizable: false,
741
  width: 800,
742
- height: "auto",
743
- show: "fade",
744
- hide: "fade",
745
  close: function (event, ui) {},
746
  open: function (event, ui) {
747
  wpr_fix_dialog_close(event, ui);
@@ -752,18 +732,18 @@ jQuery(document).ready(function ($) {
752
  }
753
 
754
  // turn questions into checkboxes
755
- $(".question-wrapper").on("click", function (e) {
756
- if ($(this).hasClass("selected")) {
757
- $(this).removeClass("selected");
758
  } else {
759
- if ($(".question-wrapper.selected").length >= 2) {
760
  wpr_swal.fire({
761
- icon: "error",
762
  allowOutsideClick: false,
763
- text: "You can choose only up to 2 features at a time.",
764
  });
765
  } else {
766
- $(this).addClass("selected");
767
  }
768
  }
769
 
@@ -772,229 +752,208 @@ jQuery(document).ready(function ($) {
772
  });
773
 
774
  // submit and hide survey
775
- $(".submit-survey").on("click", function (e) {
776
- if (
777
- $(".question-wrapper.selected").length != 2 &&
778
- $(".question-wrapper.selected").length != 1
779
- ) {
780
  wpr_swal.fire({
781
- icon: "error",
782
  allowOutsideClick: false,
783
- text: "Please choose 1 or 2 features you would like us to build next.",
784
  });
785
  return false;
786
  }
787
 
788
  if (
789
- $("#survey-dialog .custom-input").val() == "" &&
790
- $("#survey-dialog .custom-input")
791
- .parents("div.question-wrapper")
792
- .hasClass("selected")
793
  ) {
794
  wpr_swal.fire({
795
- icon: "error",
796
  allowOutsideClick: false,
797
- text: "Please describe the custom feature you need.",
798
  });
799
  return false;
800
  }
801
 
802
- answers = "";
803
- $(".question-wrapper.selected").each(function (i, el) {
804
- answers += $(el).data("value") + ",";
805
  });
806
 
807
  $.post(ajaxurl, {
808
- survey: "features",
809
  answers: answers,
810
- emailme: $("#survey-dialog #emailme:checked").val(),
811
- custom_answer: $("#survey-dialog .custom-input").val(),
812
  _ajax_nonce: wp_reset.nonce_submit_survey,
813
- action: "wp_reset_submit_survey",
814
  });
815
 
816
- $("#survey-dialog").dialog("close");
817
  wpr_swal.fire({
818
- icon: "success",
819
- text: "Thank you for your time! We appriciate your input!",
820
  });
821
 
822
  e.preventDefault();
823
  return false;
824
  });
825
 
826
- $(".tools_page_wp-reset").on("click", ".open-webhooks-dialog", function (e) {
827
  $(this).blur();
828
- $("#webhooks-dialog").dialog("open");
829
 
830
  e.preventDefault();
831
  return false;
832
  });
833
 
834
  // webhooks dialog init
835
- $("#webhooks-dialog").dialog({
836
- dialogClass: "wp-dialog wpr-dialog webhooks-dialog",
837
  modal: 1,
838
  resizable: false,
839
- title: "WP Webhooks - Connect WordPress to any 3rd party system",
840
  width: 550,
841
- height: "auto",
842
- show: "fade",
843
- hide: "fade",
844
  open: function (event, ui) {
845
  wpr_fix_dialog_close(event, ui);
846
- $(this)
847
- .siblings()
848
- .find("span.ui-dialog-title")
849
- .html(wp_reset.webhooks_dialog_title);
850
  },
851
  close: function (event, ui) {},
852
  autoOpen: false,
853
  closeOnEscape: true,
854
  });
855
  $(window).resize(function (e) {
856
- $("#webhooks-dialog").dialog("option", "position", {
857
- my: "center",
858
- at: "center",
859
  of: window,
860
  });
861
  });
862
 
863
- jQuery("#install-webhooks").on("click", function (e) {
864
- $("#webhooks-dialog").dialog("close");
865
- jQuery("body").append(
866
  '<div style="width:550px;height:450px; position:fixed;top:10%;left:50%;margin-left:-275px; color:#444; background-color: #fbfbfb;border:1px solid #DDD; border-radius:4px;box-shadow: 0px 0px 0px 4000px rgba(0, 0, 0, 0.85);z-index: 9999999;"><iframe src="' +
867
  wp_reset.webhooks_install_url +
868
  '" style="width:100%;height:100%;border:none;" /></div>'
869
  );
870
- jQuery("#wpwrap").css("pointer-events", "none");
871
  e.preventDefault();
872
  return false;
873
  });
874
 
875
  // todo: not finished
876
- $(".tools_page_wp-reset").on(
877
- "click",
878
- ".button-pro-feature, .pro-feature",
879
- function (e) {
880
- e.preventDefault();
881
- this.blur();
882
-
883
- tool_id =
884
- $(this).data("feature") || $(".pro-feature", this).data("feature");
885
- if (!tool_id) {
886
- $("#wp-reset-tabs").tabs("option", "active", 5);
887
- $.scrollTo($("#pro-pricing"), 500, { offset: { top: -50, left: 0 } });
888
- return;
889
- }
890
-
891
- details = $("#pro-feature-details-" + tool_id);
892
- if (details.length != 1) {
893
- $("#wp-reset-tabs").tabs("option", "active", 5);
894
- $.scrollTo($("#pro-pricing"), 500, { offset: { top: -50, left: 0 } });
895
- return;
896
- }
897
 
898
- wpr_swal
899
- .fire({
900
- title: tool_id,
901
- html: "Dialog content",
902
- footer:
903
- 'See everything WP Reset PRO offers on &nbsp;<a target="_blank" href="https://wpreset.com">wpreset.com</a>',
904
- icon: "",
905
- showCloseButton: true,
906
- focusConfirm: true,
907
- confirmButtonText: "Grab the 30% discount",
908
- })
909
- .then((result) => {
910
- if (result.value) {
911
- $("#wp-reset-tabs").tabs("option", "active", 5);
912
- $.scrollTo($("#pro-pricing"), 500, {
913
- offset: { top: -50, left: 0 },
914
- });
915
- }
916
- });
917
 
918
- return false;
 
 
 
 
919
  }
920
- );
921
 
922
- $("#show-table-details").on("click", function (e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  e.preventDefault();
924
 
925
  $.get({
926
  url: ajaxurl,
927
  data: {
928
- action: "wp_reset_run_tool",
929
  _ajax_nonce: wp_reset.nonce_run_tool,
930
- tool: "get_table_details",
931
  },
932
  })
933
  .done(function (data) {
934
  if (data.success) {
935
- $("#wpr-table-details").html(data.data);
936
  } else {
937
  wpr_swal.fire({
938
- type: "error",
939
- title: wp_reset.documented_error + " " + data.data,
940
  });
941
  }
942
  })
943
  .fail(function (data) {
944
- wpr_swal.fire({ type: "error", title: wp_reset.undocumented_error });
945
  });
946
 
947
  return false;
948
  }); // show table details
949
 
950
- $("#wpr-save-license").on("click", function (e) {
951
  e.preventDefault();
952
 
953
  button = this;
954
  safe_refresh = true;
955
 
956
- block = block_ui($(button).data("text-wait"));
957
- wf_licensing_verify_licence_ajax(
958
- "wpr",
959
- $("#wpr-license-key").val(),
960
- button
961
- );
962
 
963
  return;
964
  }); // license activation button
965
 
966
- $("#wpr-keyless-activation").on("click", function (e) {
967
  e.preventDefault();
968
 
969
  button = this;
970
  safe_refresh = true;
971
 
972
- block = block_ui($(button).data("text-wait"));
973
- wf_licensing_verify_licence_ajax("wpr", "keyless", button);
974
 
975
  return;
976
  }); // keyless license activation button
977
 
978
- $("#wpr-deactivate-license").on("click", function (e) {
979
  e.preventDefault();
980
 
981
  button = this;
982
  safe_refresh = true;
983
 
984
- block = block_ui($(button).data("text-wait"));
985
- wf_licensing_deactivate_licence_ajax(
986
- "wpr",
987
- $("#wpr-license-key").val(),
988
- button
989
- );
990
 
991
  return;
992
  }); // deactivate license button
993
 
994
- $("#wpr-license-key").on("keypress", function (e) {
995
  if (e.keyCode == 13) {
996
  e.preventDefault();
997
- $("#wpr-save-license").trigger("click");
998
  }
999
  }); // trigger license save on enter
1000
 
@@ -1008,95 +967,92 @@ jQuery(document).ready(function ($) {
1008
  wp_reset.collections = [];
1009
  wp_reset.collections[1] = {
1010
  id: 1,
1011
- name: "Must-have WordPress Plugins",
1012
- created: "2020-04-01",
1013
  items: [],
1014
  };
1015
  wp_reset.collections[1].items[10] = {
1016
- id: "10",
1017
- type: "plugin",
1018
- source: "repo",
1019
- note: "",
1020
- slug: "eps-301-redirects",
1021
- name: "301 Redirects",
1022
- version: "0.4",
1023
  };
1024
 
1025
  wp_reset.collections[1].items[11] = {
1026
- id: "11",
1027
- type: "plugin",
1028
- source: "repo",
1029
- note: "",
1030
- slug: "classic-editor",
1031
- name: "Classic Editor",
1032
- version: "0.4",
1033
  };
1034
 
1035
  wp_reset.collections[1].items[12] = {
1036
- id: "12",
1037
- type: "plugin",
1038
- source: "repo",
1039
- note: "",
1040
- slug: "simple-author-box",
1041
- name: "Simple Author Box",
1042
- version: "0.4",
1043
  };
1044
 
1045
  wp_reset.collections[1].items[13] = {
1046
- id: "13",
1047
- type: "plugin",
1048
- source: "repo",
1049
- note: "",
1050
- slug: "sticky-menu-or-anything-on-scroll",
1051
- name: "Sticky Menu (or Anything!) on Scroll",
1052
- version: "0.4",
1053
  };
1054
 
1055
  wp_reset.collections[1].items[14] = {
1056
- id: "14",
1057
- type: "plugin",
1058
- source: "repo",
1059
- note: "",
1060
- slug: "under-construction-page",
1061
- name: "UnderConstructionPage",
1062
- version: "0.4",
1063
  };
1064
 
1065
  wp_reset.collections[1].items[15] = {
1066
- id: "15",
1067
- type: "plugin",
1068
- source: "repo",
1069
- note: "",
1070
- slug: "wp-external-links",
1071
- name: "WP External Links",
1072
- version: "0.4",
1073
  };
1074
 
1075
- $(document).on("click", ".install-collection", function (e) {
1076
- do_delete = $(this).data("delete");
1077
- do_activate = $(this).data("activate");
1078
- collection_id = $(this).parents(".card").data("collection-id");
1079
  show_install_collection(collection_id, do_delete, do_activate);
1080
  });
1081
 
1082
  // install collection item
1083
- $(".tools_page_wp-reset").on("click", ".install-collection-item", function (
1084
- e
1085
- ) {
1086
  e.preventDefault();
1087
 
1088
  wpr_close_dropdowns();
1089
 
1090
- collection_id = $(this).parents(".card").data("collection-id");
1091
- collection_item_id = $(this).parents("tr").data("collection-item-id");
1092
- do_activate = $(this).data("activate");
1093
 
1094
- item_data =
1095
- wp_reset.collections[collection_id]["items"][collection_item_id];
1096
 
1097
  wpr_swal
1098
  .fire({
1099
- title: "Installing <br />" + item_data["name"],
1100
  html: '<div class="wpr-collections-installer"></div>',
1101
  width: 600,
1102
  onRender: function () {
@@ -1108,31 +1064,31 @@ jQuery(document).ready(function ($) {
1108
  collection_id: collection_id,
1109
  collection_item_id: collection_item_id,
1110
  },
1111
- action: "install_" + item_data.type,
1112
  });
1113
  collections_ajax_queue.push({
1114
  slug: item_data.slug,
1115
  name: item_data.name,
1116
- action: "check_install_" + item_data.type,
1117
  });
1118
 
1119
- $(".wpr-collections-installer").append(
1120
  '<div class="wpr-collections-installer-message" data-action="' +
1121
  item_data.slug +
1122
- "_install_" +
1123
  item_data.type +
1124
  '"><span class="dashicons"></span>' +
1125
  wp_reset.installing +
1126
- " " +
1127
  item_data.name +
1128
- "</div>"
1129
  );
1130
 
1131
  if (do_activate) {
1132
  collections_ajax_queue.push({
1133
  slug: item_data.slug,
1134
  name: item_data.name,
1135
- action: "activate_" + item_data.type,
1136
  extra_data: {
1137
  source: item_data.source,
1138
  collection_id: collection_id,
@@ -1142,19 +1098,19 @@ jQuery(document).ready(function ($) {
1142
  collections_ajax_queue.push({
1143
  slug: item_data.slug,
1144
  name: item_data.name,
1145
- action: "check_activate_" + item_data.type,
1146
  });
1147
 
1148
- $(".wpr-collections-installer").append(
1149
  '<div class="wpr-collections-installer-message" data-action="' +
1150
  item_data.slug +
1151
- "_activate_" +
1152
  item_data.type +
1153
  '"><span class="dashicons"></span>' +
1154
  wp_reset.activating +
1155
- " " +
1156
  item_data.name +
1157
- "</div>"
1158
  );
1159
  }
1160
  collections_do_ajax();
@@ -1163,7 +1119,7 @@ jQuery(document).ready(function ($) {
1163
  allowEscapeKey: false,
1164
  allowEnterKey: false,
1165
  showCancelButton: true,
1166
- confirmButtonText: "OK",
1167
  })
1168
  .then((result) => {
1169
  collections_ajax_queue = [];
@@ -1176,9 +1132,7 @@ jQuery(document).ready(function ($) {
1176
  function show_install_collection(collection_id, do_delete, do_activate) {
1177
  wpr_swal
1178
  .fire({
1179
- title:
1180
- "Installing collection<br />" +
1181
- wp_reset.collections[collection_id]["name"],
1182
  html: '<div class="wpr-collections-installer"></div>',
1183
  width: 600,
1184
  onRender: function () {
@@ -1189,7 +1143,7 @@ jQuery(document).ready(function ($) {
1189
  allowEnterKey: false,
1190
  showCancelButton: true,
1191
  showConfirmButton: false,
1192
- confirmButtonText: "OK",
1193
  })
1194
  .then((result) => {
1195
  collections_ajax_queue = [];
@@ -1205,8 +1159,8 @@ jQuery(document).ready(function ($) {
1205
 
1206
  console.log(wp_reset.collections[collection_id]);
1207
 
1208
- for (item in wp_reset.collections[collection_id]["items"]) {
1209
- item_data = wp_reset.collections[collection_id]["items"][item];
1210
  collections_ajax_queue.push({
1211
  slug: item_data.slug,
1212
  name: item_data.name,
@@ -1215,19 +1169,19 @@ jQuery(document).ready(function ($) {
1215
  collection_id: collection_id,
1216
  collection_item_id: item_data.id,
1217
  },
1218
- action: "install_" + item_data.type,
1219
  });
1220
  collections_ajax_queue.push({
1221
  slug: item_data.slug,
1222
  name: item_data.name,
1223
- action: "check_install_" + item_data.type,
1224
  });
1225
 
1226
  if (do_activate) {
1227
  collections_ajax_queue.push({
1228
  slug: item_data.slug,
1229
  name: item_data.name,
1230
- action: "activate_" + item_data.type,
1231
  extra_data: {
1232
  source: item_data.source,
1233
  collection_id: collection_id,
@@ -1237,7 +1191,7 @@ jQuery(document).ready(function ($) {
1237
  collections_ajax_queue.push({
1238
  slug: item_data.slug,
1239
  name: item_data.name,
1240
- action: "check_activate_" + item_data.type,
1241
  });
1242
  }
1243
  }
@@ -1247,38 +1201,38 @@ jQuery(document).ready(function ($) {
1247
  collections_ajax_queue_count++;
1248
 
1249
  switch (collections_ajax_queue[ci].action) {
1250
- case "deactivate_plugin":
1251
  message = wp_reset.deactivating;
1252
  break;
1253
- case "delete_plugin":
1254
- case "delete_theme":
1255
  message = wp_reset.deleting;
1256
  break;
1257
- case "install_plugin":
1258
- case "install_theme":
1259
  message = wp_reset.installing;
1260
  break;
1261
- case "activate_plugin":
1262
- case "activate_theme":
1263
  message = wp_reset.activating;
1264
  break;
1265
- case "activate_license_plugin":
1266
- case "activate_license_theme":
1267
  message = wp_reset.activating_license;
1268
  break;
1269
  }
1270
 
1271
  if (message !== false) {
1272
- $(".wpr-collections-installer").append(
1273
  '<div class="wpr-collections-installer-message" data-action="' +
1274
  collections_ajax_queue[ci].slug +
1275
- "_" +
1276
  collections_ajax_queue[ci].action +
1277
  '"><span class="dashicons"></span> ' +
1278
  message +
1279
- " " +
1280
  collections_ajax_queue[ci].name +
1281
- "</div>"
1282
  );
1283
  }
1284
  }
@@ -1290,60 +1244,57 @@ jQuery(document).ready(function ($) {
1290
  // run collection ajax
1291
  function collections_do_ajax() {
1292
  collection_item = collections_ajax_queue[collections_ajax_queue_index];
1293
- message_id =
1294
- collection_item.slug + "_" + collection_item.action.replace("check_", "");
1295
 
1296
- $('[data-action="' + message_id + '"]').addClass(
1297
- "wpr-collections-installer-loading"
1298
- );
1299
 
1300
- var query_data_type = "text";
1301
  if (
1302
- collection_item.action == "check_deactivate_plugin" ||
1303
- collection_item.action == "check_delete_plugin" ||
1304
- collection_item.action == "check_install_plugin" ||
1305
- collection_item.action == "check_activate_plugin" ||
1306
- collection_item.action == "check_install_theme" ||
1307
- collection_item.action == "check_activate_theme" ||
1308
- collection_item.action == "check_delete_theme" ||
1309
- collection_item.action == "check_activate_license_plugin" ||
1310
- collection_item.action == "check_activate_license_theme"
1311
  ) {
1312
- query_data_type = "json";
1313
  }
1314
 
1315
- if (!("extra_data" in collection_item)) {
1316
  collection_item.extra_data = {};
1317
  }
1318
 
1319
  $.ajax({
1320
  url: ajaxurl,
1321
- type: "get",
1322
  dataType: query_data_type,
1323
  data: {
1324
- action: "wp_reset_run_tool",
1325
  _ajax_nonce: wp_reset.nonce_run_tool,
1326
  tool: collection_item.action,
1327
  slug: collection_item.slug,
1328
  extra_data: collection_item.extra_data,
1329
  },
1330
  complete: function (data) {
1331
- if (typeof data.responseJSON == "undefined") {
1332
  data = false;
1333
  } else {
1334
  data = data.responseJSON;
1335
  }
1336
  var do_next_called = false;
1337
  if (
1338
- collection_item.action == "check_deactivate_plugin" ||
1339
- collection_item.action == "check_delete_plugin" ||
1340
- collection_item.action == "check_install_plugin" ||
1341
- collection_item.action == "check_activate_plugin" ||
1342
- collection_item.action == "check_install_theme" ||
1343
- collection_item.action == "check_activate_theme" ||
1344
- collection_item.action == "check_delete_theme" ||
1345
- collection_item.action == "check_activate_license_plugin" ||
1346
- collection_item.action == "check_activate_license_theme"
1347
  ) {
1348
  if (data == false && collections_retried == false) {
1349
  collections_retried = true;
@@ -1351,67 +1302,47 @@ jQuery(document).ready(function ($) {
1351
  return false;
1352
  }
1353
  if (
1354
- (collection_item.action == "check_deactivate_plugin" &&
1355
- data.data == "inactive") ||
1356
- (collection_item.action == "check_delete_plugin" &&
1357
- data.data == "deleted") ||
1358
- (collection_item.action == "check_install_plugin" &&
1359
- (data.data == "inactive" || data.data == "active")) ||
1360
- (collection_item.action == "check_activate_plugin" &&
1361
- data.data == "active") ||
1362
- (collection_item.action == "check_install_theme" &&
1363
- (data.data == "inactive" || data.data == "active")) ||
1364
- (collection_item.action == "check_activate_theme" &&
1365
- data.data == "active") ||
1366
- (collection_item.action == "check_delete_theme" &&
1367
- data.data == "deleted") ||
1368
- (collection_item.action == "check_activate_license_plugin" &&
1369
- data.data == "license_active") ||
1370
- (collection_item.action == "check_activate_license_theme" &&
1371
- data.data == "license_active")
1372
  ) {
1373
- $('[data-action="' + message_id + '"]').addClass(
1374
- "wpr-collections-installer-success"
1375
- );
1376
  } else {
1377
  var error = false;
1378
  switch (collection_item.action) {
1379
- case "check_deactivate_plugin":
1380
- error = wp_reset.deactivate_failed + " " + collection_item.name;
1381
  break;
1382
- case "check_delete_plugin":
1383
- case "check_delete_theme":
1384
- error = wp_reset.delete_failed + " " + collection_item.name;
1385
  break;
1386
- case "check_install_plugin":
1387
- case "check_install_theme":
1388
- if (data.data == "active") {
1389
- error =
1390
- collection_item.name +
1391
- " " +
1392
- wp_reset.install_failed_existing;
1393
- } else if (data.data == "deleted") {
1394
- error = wp_reset.install_failed + " " + collection_item.name;
1395
  } else {
1396
  error = data.data;
1397
  }
1398
  break;
1399
- case "check_activate_plugin":
1400
- case "check_activate_theme":
1401
- error = wp_reset.activate_failed + " " + collection_item.name;
1402
  break;
1403
- case "check_activate_license_plugin":
1404
- case "check_activate_license_theme":
1405
- if (data.data == "unknown") {
1406
- error =
1407
- wp_reset.activating_license_unknown +
1408
- " " +
1409
- collection_item.name;
1410
  } else {
1411
- error =
1412
- wp_reset.activating_license_failed +
1413
- " " +
1414
- collection_item.name;
1415
  }
1416
  break;
1417
  default:
@@ -1419,23 +1350,15 @@ jQuery(document).ready(function ($) {
1419
  }
1420
 
1421
  if (error != false) {
1422
- $('[data-action="' + message_id + '"]').append(
1423
- '<div class="wpr-collections-error">' + error + "</div>"
1424
- );
1425
  collections_errors.push(error);
1426
  }
1427
 
1428
- $('[data-action="' + message_id + '"]').addClass(
1429
- "wpr-collections-installer-error"
1430
- );
1431
  }
1432
 
1433
- $('[data-action="' + message_id + '"]').removeClass(
1434
- "wpr-collections-installer-loading"
1435
- );
1436
- $('[data-action="' + message_id + '"]').addClass(
1437
- "wpr-collections-installer-done"
1438
- );
1439
  }
1440
 
1441
  collections_retried = false;
@@ -1446,56 +1369,38 @@ jQuery(document).ready(function ($) {
1446
  return false;
1447
  }
1448
 
1449
- if (
1450
- do_next_called == false &&
1451
- typeof collections_ajax_queue[collections_ajax_queue_index] !==
1452
- "undefined"
1453
- ) {
1454
- if (
1455
- typeof $(
1456
- ".wpr-collections-installer div.wpr-collections-installer-done:last"
1457
- ).offset() !== "undefined"
1458
- ) {
1459
  var scroll_top =
1460
- $(
1461
- ".wpr-collections-installer div.wpr-collections-installer-done:last"
1462
- ).offset().top -
1463
- $(".wpr-collections-installer").offset().top +
1464
- $(".wpr-collections-installer").scrollTop() -
1465
  60;
1466
- $(".wpr-collections-installer").animate(
1467
- { scrollTop: scroll_top },
1468
- 600,
1469
- function () {
1470
- collections_do_ajax();
1471
- }
1472
- );
1473
  } else {
1474
  collections_do_ajax();
1475
  }
1476
  } else {
1477
  wpr_swal.close();
1478
 
1479
- $(".wpr-collections-installer").css("padding", "0px 40px");
1480
- $(".wpr-collections-installer").css("height", "236px");
1481
 
1482
  if (collections_errors.length > 0) {
1483
- var errors_html = "";
1484
  for (e in collections_errors) {
1485
  errors_html +=
1486
  '<div class="wpr-collections-installer-message wpr-collections-installer-error"><span class="dashicons"></span> ' +
1487
  collections_errors[e] +
1488
- "</div>";
1489
  }
1490
  wpr_swal
1491
  .fire({
1492
- icon: "error",
1493
- title:
1494
- "Collection was installed, but the following errors occured!",
1495
- html:
1496
- '<div class="wpr-collections-installer-errors">' +
1497
- errors_html +
1498
- "</div>",
1499
  showConfirmButton: true,
1500
  })
1501
  .then((result) => {
@@ -1504,8 +1409,8 @@ jQuery(document).ready(function ($) {
1504
  } else {
1505
  wpr_swal
1506
  .fire({
1507
- icon: "success",
1508
- title: "Collection was installed successfully!",
1509
  showConfirmButton: true,
1510
  timer: 2500,
1511
  timerProgressBar: true,
@@ -1521,8 +1426,8 @@ jQuery(document).ready(function ($) {
1521
  }); // onload
1522
 
1523
  function wpr_fix_dialog_close(event, ui) {
1524
- jQuery(".ui-widget-overlay").bind("click", function () {
1525
- jQuery("#" + event.target.id).dialog("close");
1526
  });
1527
  } // wpr_fix_dialog_close
1528
 
@@ -1547,6 +1452,6 @@ function wpr_clear_local(clear_cookies, clear_storage) {
1547
  } // wpr_clear_local
1548
 
1549
  function wpr_close_dropdowns() {
1550
- jQuery(".dropdown").removeClass("show");
1551
- jQuery(".dropdown-menu").removeClass("show");
1552
  } // wpr_close_dropdowns
6
 
7
  jQuery(document).ready(function ($) {
8
  // init tabs
9
+ $('#wp-reset-tabs')
10
  .tabs({
11
  create: function () {
12
+ $('#loading-tabs').remove();
13
  },
14
  activate: function (event, ui) {
15
+ localStorage.setItem('wp-reset-tabs', $('#wp-reset-tabs').tabs('option', 'active'));
 
 
 
16
  },
17
+ active: localStorage.getItem('wp-reset-tabs') || 0,
18
  })
19
  .show();
20
 
21
  // helper for swithcing tabs & linking anchors in different tabs
22
+ $('.tools_page_wp-reset').on('click', '.change-tab', function (e) {
23
  e.preventDefault();
24
 
25
+ $('#wp-reset-tabs').tabs('option', 'active', $(this).data('tab'));
26
 
27
  // get the link anchor and scroll to it
28
+ target = this.href.split('#')[1];
29
  if (target) {
30
+ $.scrollTo('#' + target, 500, { offset: { top: -50, left: 0 } });
31
  }
32
 
33
  $(this).blur();
34
  return false;
35
  }); // jump to tab/anchor helper
36
 
37
+ // init tooltips
38
+ $('.tooltip').tooltipster({
39
+ theme: ['tooltipster-punk', 'tooltipster-wpr'],
40
+ delay: 0,
41
+ });
42
+
43
  // helper for scrolling to anchor
44
+ $('.tools_page_wp-reset').on('click', '.scrollto', function (e) {
45
  e.preventDefault();
46
 
47
  // get the link anchor and scroll to it
48
+ target = this.href.split('#')[1];
49
  if (target) {
50
+ $.scrollTo('#' + target, 500, { offset: { top: -50, left: 0 } });
51
  }
52
 
53
  $(this).blur();
55
  }); // scroll to anchor helper
56
 
57
  // toggle button dropdown menu
58
+ $('.tools_page_wp-reset').on('click', '.button.dropdown-toggle', function (e) {
 
 
59
  e.preventDefault();
60
 
61
+ parent_dropdown = $(this).parent('.dropdown');
62
+ sibling_menu = $(this).siblings('.dropdown-menu');
63
 
64
+ $('.dropdown').not(parent_dropdown).removeClass('show');
65
+ $('.dropdown-menu').not(sibling_menu).removeClass('show');
66
 
67
+ $(parent_dropdown).toggleClass('show');
68
+ $(sibling_menu).toggleClass('show');
69
 
70
  return false;
71
  }); // toggle button dropdown menu
72
 
73
+ $(document).on('click', ':not(.dropdown-toggle), .dropdown-item', function () {
74
+ wpr_close_dropdowns();
75
+ });
 
 
 
 
76
 
77
  // delete transients
78
+ $('.tools_page_wp-reset').on('click', '#delete-transients', function (e) {
79
  e.preventDefault();
80
 
81
+ run_tool(this, 'delete_transients');
82
 
83
  return false;
84
  }); // delete transients
85
 
86
  // purge cache
87
+ $('.tools_page_wp-reset').on('click', '#purge-cache', function (e) {
88
  e.preventDefault();
89
 
90
+ run_tool(this, 'purge_cache');
91
 
92
  return false;
93
  }); // purge cache
94
 
95
  // delete uploads
96
+ $('.tools_page_wp-reset').on('click', '#delete-uploads', function (e) {
97
  e.preventDefault();
98
 
99
+ run_tool(this, 'delete_uploads');
100
 
101
  return false;
102
  }); // delete uploads
103
 
104
  // reset theme options (mods)
105
+ $('.tools_page_wp-reset').on('click', '#reset-theme-options', function (e) {
106
  e.preventDefault();
107
 
108
+ run_tool(this, 'reset_theme_options');
109
 
110
  return false;
111
  }); // reset theme options
112
 
113
  // delete themes
114
+ $('.tools_page_wp-reset').on('click', '#delete-themes', function (e) {
115
  e.preventDefault();
116
 
117
+ run_tool(this, 'delete_themes');
118
 
119
  return false;
120
  }); // delete themes
121
 
122
  // delete plugins
123
+ $('.tools_page_wp-reset').on('click', '#delete-plugins', function (e) {
124
  e.preventDefault();
125
 
126
  var button = this;
127
+ var confirm_title = $(button).data('confirm-title') || wp_reset.confirm_title;
 
128
 
129
  var tools = [
130
  {
131
+ tool: 'deactivate_plugins',
132
+ description: 'Deactivating plugins.',
133
  extra_data: { keep_default_theme: 0, keep_current_theme: 0 },
134
  },
135
  {
136
+ tool: 'delete_plugins',
137
+ description: 'Deleting plugins.',
138
  extra_data: {
139
  keep_wp_reset: 1,
140
  silent_deactivate: 0,
145
 
146
  confirm_action(
147
  confirm_title,
148
+ $(button).data('text-confirm'),
149
+ $(button).data('btn-confirm') || $(button).text(),
150
  wp_reset.cancel_button
151
  ).then((result) => {
152
  if (!result.value) {
154
  }
155
 
156
  wpr_swal.fire({
157
+ title: $(button).data('text-wait'),
158
+ text: ' ',
159
  type: false,
160
  allowOutsideClick: false,
161
  allowEscapeKey: false,
163
  showConfirmButton: false,
164
  imageUrl: wp_reset.icon_url,
165
  onOpen: () => {
166
+ $(wpr_swal.getImage()).addClass('wpr_rotating');
167
  },
168
  imageWidth: 100,
169
  imageHeight: 100,
170
+ imageAlt: $(button).data('text-wait'),
171
  });
172
 
173
  var failed = false;
176
  if (failed) {
177
  return false;
178
  }
179
+ wpr_swal.getContent().querySelector('#swal2-content').textContent =
180
+ i + 1 + '/' + tools.length + ' - ' + data.description;
181
  return $.ajax({
182
  data: {
183
+ action: 'wp_reset_run_tool',
184
  _ajax_nonce: wp_reset.nonce_run_tool,
185
  tool: data.tool,
186
  extra_data: data.extra_data,
192
  failed = false;
193
  if (i == tools.length - 1) {
194
  if (response.data == 1) {
195
+ msg = $(button).data('text-done-singular');
196
  } else {
197
+ msg = $(button).data('text-done').replace('%n', response.data);
 
 
198
  }
199
+ wpr_swal_params = { icon: 'success', title: msg };
200
 
201
  wpr_swal.fire(wpr_swal_params);
202
  }
203
  } else {
204
  wpr_swal.close();
205
  wpr_swal.fire({
206
+ icon: 'error',
207
  title: wp_reset.documented_error,
208
  text: response.data,
209
  });
214
  .error(function (response) {
215
  wpr_swal.close();
216
  wpr_swal.fire({
217
+ icon: 'error',
218
  title: wp_reset.undocumented_error,
219
  });
220
  failed = true;
228
  }); // delete plugins
229
 
230
  // drop custom tables
231
+ $('.tools_page_wp-reset').on('click', '#drop-custom-tables', function (e) {
232
  e.preventDefault();
233
 
234
+ run_tool(this, 'drop_custom_tables');
235
 
236
  return false;
237
  }); // drop custom tables
238
 
239
  // truncate custom tables
240
+ $('.tools_page_wp-reset').on('click', '#truncate-custom-tables', function (e) {
 
 
241
  e.preventDefault();
242
 
243
+ run_tool(this, 'truncate_custom_tables');
244
 
245
  return false;
246
  }); // truncate custom tables
247
 
248
  // delete htaccess file
249
+ $('.tools_page_wp-reset').on('click', '#delete-htaccess', function (e) {
250
  e.preventDefault();
251
 
252
+ run_tool(this, 'delete_htaccess');
253
 
254
  return false;
255
  }); // delete htaccess file
256
 
257
  // delete auth cookies
258
+ $('.tools_page_wp-reset').on('click', '#delete-wp-cookies', function (e) {
259
  e.preventDefault();
260
 
261
+ run_tool(this, 'delete_wp_cookies');
262
 
263
  return false;
264
  }); // delete auth cookies
265
 
266
  // delete local data
267
+ $('.tools_page_wp-reset').on('click', '#delete-local-data', function (e) {
268
  e.preventDefault();
269
  var button = this;
270
+ var confirm_title = $(button).data('confirm-title') || wp_reset.confirm_title;
 
271
 
272
  confirm_action(
273
  confirm_title,
274
+ $(button).data('text-confirm'),
275
+ $(button).data('btn-confirm'),
276
  wp_reset.cancel_button
277
  ).then((result) => {
278
  if (!result.value) {
281
 
282
  cnt = wpr_clear_local(true, true);
283
  if (cnt == 1) {
284
+ msg = $(button).data('text-done-singular');
285
  } else {
286
+ msg = $(button).data('text-done').replace('%n', cnt);
287
  }
288
+ wpr_swal.fire({ icon: 'success', title: msg });
289
  });
290
 
291
  return false;
292
  }); // delete local data
293
 
294
  // compare snapshot
295
+ $('#wpr-snapshots').on('click', '.compare-snapshot', 'click', function (e) {
296
  e.preventDefault();
297
+ uid = $(this).data('ss-uid');
298
  button = $(this);
299
 
300
+ block_ui($(button).data('wait-msg'));
301
  $.get({
302
  url: ajaxurl,
303
  data: {
304
+ action: 'wp_reset_run_tool',
305
  _ajax_nonce: wp_reset.nonce_run_tool,
306
+ tool: 'compare_snapshots',
307
  extra_data: uid,
308
  },
309
  })
312
  })
313
  .done(function (data) {
314
  if (data.success) {
315
+ msg = $(button).data('title').replace('%s', $(button).data('name'));
316
  wpr_swal.fire({
317
+ width: '90%',
318
  title: msg,
319
  html: data.data,
320
  showConfirmButton: false,
321
  allowEnterKey: false,
322
  focusConfirm: false,
323
  showCloseButton: true,
324
+ customClass: 'compare-snapshots',
325
  });
326
  } else {
327
  wpr_swal.fire({
328
+ icon: 'error',
329
+ title: wp_reset.documented_error + ' ' + data.data,
330
  });
331
  }
332
  })
333
  .fail(function (data) {
334
+ wpr_swal.fire({ icon: 'error', title: wp_reset.undocumented_error });
335
  });
336
 
337
  return false;
338
  }); // compare snapshot
339
 
340
  // restore snapshot
341
+ $('#wpr-snapshots').on('click', '.restore-snapshot', 'click', function (e) {
342
  e.preventDefault();
343
+ uid = $(this).data('ss-uid');
344
 
345
+ run_tool(this, 'restore_snapshot', uid);
346
 
347
  return false;
348
  }); // restore snapshot
349
 
350
  // download snapshot
351
+ $('#wpr-snapshots').on('click', '.download-snapshot', 'click', function (e) {
352
  e.preventDefault();
353
+ uid = $(this).data('ss-uid');
354
  button = this;
355
 
356
+ block_ui($(this).data('wait-msg'));
357
  $.get({
358
  url: ajaxurl,
359
  data: {
360
+ action: 'wp_reset_run_tool',
361
  _ajax_nonce: wp_reset.nonce_run_tool,
362
+ tool: 'download_snapshot',
363
  extra_data: uid,
364
  },
365
  })
368
  })
369
  .done(function (data) {
370
  if (data.success) {
371
+ msg = $(button).data('success-msg').replace('%s', data.data);
372
+ wpr_swal.fire({ icon: 'success', title: msg });
373
  } else {
374
  wpr_swal.fire({
375
+ icon: 'error',
376
+ title: wp_reset.documented_error + ' ' + data.data,
377
  });
378
  }
379
  })
380
  .fail(function (data) {
381
+ wpr_swal.fire({ icon: 'error', title: wp_reset.undocumented_error });
382
  });
383
 
384
  return false;
385
  }); // download snapshot
386
 
387
  // delete snapshot
388
+ $('#wpr-snapshots').on('click', '.delete-snapshot', 'click', function (e) {
389
  e.preventDefault();
390
+ uid = $(this).data('ss-uid');
391
 
392
+ run_tool(this, 'delete_snapshot', uid);
393
 
394
  return false;
395
  }); // delete snapshot
396
 
397
  // create snapshot
398
+ $('.tools_page_wp-reset').on('click', '.create-new-snapshot', function (e) {
399
  e.preventDefault();
400
 
401
+ description = $(this).data('description') || '';
402
 
403
  wpr_swal
404
  .fire({
405
  title: wp_reset.snapshot_title,
406
+ icon: 'question',
407
  text: wp_reset.snapshot_text,
408
+ input: 'text',
409
  inputValue: description,
410
  inputPlaceholder: wp_reset.snapshot_placeholder,
411
  showCancelButton: true,
415
  width: 600,
416
  })
417
  .then((result) => {
418
+ if (typeof result.value != 'undefined') {
419
  block = block_ui(wp_reset.snapshot_wait);
420
  $.get({
421
  url: ajaxurl,
422
  data: {
423
+ action: 'wp_reset_run_tool',
424
  _ajax_nonce: wp_reset.nonce_run_tool,
425
+ tool: 'create_snapshot',
426
  extra_data: result.value,
427
  },
428
  })
433
  if (data.success) {
434
  wpr_swal
435
  .fire({
436
+ icon: 'success',
437
  title: wp_reset.snapshot_success,
438
  timer: 2500,
439
  timerProgressBar: true,
444
  });
445
  } else {
446
  wpr_swal.fire({
447
+ icon: 'error',
448
+ title: wp_reset.documented_error + ' ' + data.data,
449
  });
450
  }
451
  })
452
  .fail(function (data) {
453
  wpr_swal.fire({
454
+ icon: 'error',
455
  title: wp_reset.undocumented_error,
456
  });
457
  });
462
  }); // create snapshot
463
 
464
  // show/hide extra table info in snapshot diff
465
+ $('body.tools_page_wp-reset').on('click', '.header-row', function (e) {
466
  e.preventDefault();
467
 
468
+ parent = $(this).parents('div.wpr-table-container > table > tbody');
469
+ $(' > tr:not(.header-row)', parent).toggleClass('hidden');
470
 
471
+ $('span.dashicons', parent).toggleClass('dashicons-arrow-down-alt2').toggleClass('dashicons-arrow-up-alt2');
 
 
472
 
473
  return false;
474
  }); // show hide extra info in diff
475
 
476
  // standard way of running a tool, with confirmation, loading and success message
477
  function run_tool(button, tool_name, extra_data) {
478
+ var confirm_title = $(button).data('confirm-title') || wp_reset.confirm_title;
 
479
 
480
  wpr_close_dropdowns();
481
 
482
  confirm_action(
483
  confirm_title,
484
+ $(button).data('text-confirm'),
485
+ $(button).data('btn-confirm'),
486
  wp_reset.cancel_button
487
  ).then((result) => {
488
  if (result.value) {
489
+ block = block_ui($(button).data('text-wait'));
490
  $.get({
491
  url: ajaxurl,
492
  data: {
493
+ action: 'wp_reset_run_tool',
494
  _ajax_nonce: wp_reset.nonce_run_tool,
495
  tool: tool_name,
496
  extra_data: extra_data,
502
  .done(function (data) {
503
  if (data.success) {
504
  if (data.data == 1) {
505
+ msg = $(button).data('text-done-singular');
506
  } else {
507
+ msg = $(button).data('text-done').replace('%n', data.data);
508
  }
509
  wpr_swal
510
  .fire({
511
+ icon: 'success',
512
  title: msg,
513
  timer: 2500,
514
  timerProgressBar: true,
515
  })
516
  .then(() => {
517
+ if (tool_name == 'restore_snapshot') {
518
  location.reload();
519
  }
520
  });
521
+ if (tool_name == 'delete_snapshot') {
522
+ $('#wpr-ss-' + extra_data).remove();
523
+ if ($('#wpr-snapshots tr').length <= 1) {
524
+ $('#wpr-snapshots').hide();
525
+ $('#ss-no-snapshots').show();
526
  }
527
  }
528
  } else {
529
  wpr_swal.fire({
530
+ icon: 'error',
531
+ title: wp_reset.documented_error + ' ' + data.data,
532
  });
533
  }
534
  })
535
  .fail(function (data) {
536
  wpr_swal.fire({
537
+ icon: 'error',
538
  title: wp_reset.undocumented_error,
539
  });
540
  });
549
  type: false,
550
  imageUrl: wp_reset.icon_url,
551
  onOpen: () => {
552
+ $(wpr_swal.getImage()).addClass('rotating');
553
  },
554
  imageWidth: 100,
555
  imageHeight: 100,
567
  function confirm_action(title, question, btn_confirm, btn_cancel) {
568
  tmp = wpr_swal.fire({
569
  title: title,
570
+ icon: 'question',
571
  html: question,
572
  showCancelButton: true,
573
  focusConfirm: false,
574
  focusCancel: true,
575
  confirmButtonText: btn_confirm,
576
  cancelButtonText: btn_cancel,
577
+ confirmButtonColor: '#dd3036',
578
  width: 650,
579
  });
580
 
581
  return tmp;
582
  } // confirm_action
583
 
584
+ $('#wp_reset_form').on('submit', function (e, confirmed) {
585
  if (!confirmed) {
586
+ $('#wp_reset_submit').trigger('click');
587
  e.preventDefault();
588
  return false;
589
  }
590
 
591
+ $(this).off('submit').submit();
592
  return true;
593
  }); // bypass default submit behaviour
594
 
595
+ $('#wp_reset_submit').click(function (e) {
596
+ if ($('#wp_reset_confirm').val() !== 'reset') {
597
  wpr_swal.fire({
598
  title: wp_reset.invalid_confirmation_title,
599
  text: wp_reset.invalid_confirmation,
600
+ icon: 'error',
601
  confirmButtonText: wp_reset.ok_button,
602
  });
603
 
605
  return false;
606
  } // wrong confirmation code
607
 
608
+ message = wp_reset.confirm1 + '<br>' + wp_reset.confirm2;
609
  wpr_swal
610
  .fire({
611
  title: wp_reset.confirm_title_reset,
612
+ icon: 'question',
613
  html: message,
614
  showCancelButton: true,
615
  focusConfirm: false,
616
  focusCancel: true,
617
  confirmButtonText: wp_reset.confirm_button,
618
  cancelButtonText: wp_reset.cancel_button,
619
+ confirmButtonColor: '#dd3036',
620
  width: 600,
621
  })
622
  .then((result) => {
623
  if (result.value === true) {
624
  block_ui(wp_reset.doing_reset);
625
+ $('#wp_reset_form').trigger('submit', true);
626
  }
627
  });
628
 
631
  }); // reset submit
632
 
633
  // collapse / expand card
634
+ $('.tools_page_wp-reset').on('click', '.toggle-card', function (e, skip_anim) {
 
 
 
635
  e.preventDefault();
636
 
637
+ card = $(this).parents('.card').toggleClass('collapsed');
638
+ $('.dashicons', this).toggleClass('dashicons-arrow-up-alt2').toggleClass('dashicons-arrow-down-alt2');
 
 
639
  $(this).blur();
640
 
641
+ if (typeof skip_anim != 'undefined' && skip_anim) {
642
+ $(card).find('.card-body').toggle();
643
  } else {
644
+ $(card).find('.card-body').slideToggle(500);
645
  }
646
 
647
+ cards = localStorage.getItem('wp-reset-cards');
648
  if (cards == null) {
649
  cards = new Object();
650
  } else {
651
  cards = JSON.parse(cards);
652
  }
653
 
654
+ card_id = card.attr('id') || $('h4', card).attr('id') || '';
655
 
656
+ if (card.hasClass('collapsed')) {
657
+ cards[card_id] = 'collapsed';
658
  } else {
659
+ cards[card_id] = 'expanded';
660
  }
661
+ localStorage.setItem('wp-reset-cards', JSON.stringify(cards));
662
 
663
  return false;
664
  }); // toggle-card
665
 
666
  // handle saved and preset cards' state
667
+ cards_state = localStorage.getItem('wp-reset-cards');
668
  if (cards_state != null) {
669
  cards_state = JSON.parse(cards_state);
670
  } else {
671
  cards_state = new Object();
672
  }
673
 
674
+ cards = $('.card');
675
  $.each(cards, function (index, card) {
676
+ card_name = $('h4', card).attr('id');
677
  if (!card_name) {
678
  return;
679
  }
680
 
681
+ if (typeof cards_state == 'object' && cards_state.hasOwnProperty(card_name)) {
682
+ if (cards_state[card_name] == 'collapsed') {
683
+ $('a.toggle-card', card).trigger('click', true);
 
 
 
684
  }
685
  } else {
686
+ if ($(card).hasClass('default-collapsed')) {
687
+ $('a.toggle-card', card).trigger('click', true);
688
  }
689
  }
690
  });
691
 
692
  // dismiss notice / pointer
693
+ $('.wpr-dismiss-notice').on('click', function (e) {
694
+ notice_name = $(this).data('notice');
695
  if (!notice_name) {
696
  return true;
697
  }
698
 
699
+ if ($(this).data('survey')) {
700
+ $('#survey-dialog').dialog('close');
701
  }
702
 
703
  $.get(ajaxurl, {
704
  notice_name: notice_name,
705
  _ajax_nonce: wp_reset.nonce_dismiss_notice,
706
+ action: 'wp_reset_dismiss_notice',
707
  });
708
 
709
+ $(this).parents('.notice-wrapper').fadeOut();
710
 
711
  e.preventDefault();
712
  return false;
714
 
715
  // maybe init survey dialog
716
  if (wp_reset.open_survey) {
717
+ $('#survey-dialog').dialog({
718
+ dialogClass: 'wp-dialog wpr-dialog wpr-survey-dialog',
719
  modal: 1,
720
  resizable: false,
721
  width: 800,
722
+ height: 'auto',
723
+ show: 'fade',
724
+ hide: 'fade',
725
  close: function (event, ui) {},
726
  open: function (event, ui) {
727
  wpr_fix_dialog_close(event, ui);
732
  }
733
 
734
  // turn questions into checkboxes
735
+ $('.question-wrapper').on('click', function (e) {
736
+ if ($(this).hasClass('selected')) {
737
+ $(this).removeClass('selected');
738
  } else {
739
+ if ($('.question-wrapper.selected').length >= 2) {
740
  wpr_swal.fire({
741
+ icon: 'error',
742
  allowOutsideClick: false,
743
+ text: 'You can choose only up to 2 features at a time.',
744
  });
745
  } else {
746
+ $(this).addClass('selected');
747
  }
748
  }
749
 
752
  });
753
 
754
  // submit and hide survey
755
+ $('.submit-survey').on('click', function (e) {
756
+ if ($('.question-wrapper.selected').length != 2 && $('.question-wrapper.selected').length != 1) {
 
 
 
757
  wpr_swal.fire({
758
+ icon: 'error',
759
  allowOutsideClick: false,
760
+ text: 'Please choose 1 or 2 features you would like us to build next.',
761
  });
762
  return false;
763
  }
764
 
765
  if (
766
+ $('#survey-dialog .custom-input').val() == '' &&
767
+ $('#survey-dialog .custom-input').parents('div.question-wrapper').hasClass('selected')
 
 
768
  ) {
769
  wpr_swal.fire({
770
+ icon: 'error',
771
  allowOutsideClick: false,
772
+ text: 'Please describe the custom feature you need.',
773
  });
774
  return false;
775
  }
776
 
777
+ answers = '';
778
+ $('.question-wrapper.selected').each(function (i, el) {
779
+ answers += $(el).data('value') + ',';
780
  });
781
 
782
  $.post(ajaxurl, {
783
+ survey: 'features',
784
  answers: answers,
785
+ emailme: $('#survey-dialog #emailme:checked').val(),
786
+ custom_answer: $('#survey-dialog .custom-input').val(),
787
  _ajax_nonce: wp_reset.nonce_submit_survey,
788
+ action: 'wp_reset_submit_survey',
789
  });
790
 
791
+ $('#survey-dialog').dialog('close');
792
  wpr_swal.fire({
793
+ icon: 'success',
794
+ text: 'Thank you for your time! We appriciate your input!',
795
  });
796
 
797
  e.preventDefault();
798
  return false;
799
  });
800
 
801
+ $('.tools_page_wp-reset').on('click', '.open-webhooks-dialog', function (e) {
802
  $(this).blur();
803
+ $('#webhooks-dialog').dialog('open');
804
 
805
  e.preventDefault();
806
  return false;
807
  });
808
 
809
  // webhooks dialog init
810
+ $('#webhooks-dialog').dialog({
811
+ dialogClass: 'wp-dialog wpr-dialog webhooks-dialog',
812
  modal: 1,
813
  resizable: false,
814
+ title: 'WP Webhooks - Connect WordPress to any 3rd party system',
815
  width: 550,
816
+ height: 'auto',
817
+ show: 'fade',
818
+ hide: 'fade',
819
  open: function (event, ui) {
820
  wpr_fix_dialog_close(event, ui);
821
+ $(this).siblings().find('span.ui-dialog-title').html(wp_reset.webhooks_dialog_title);
 
 
 
822
  },
823
  close: function (event, ui) {},
824
  autoOpen: false,
825
  closeOnEscape: true,
826
  });
827
  $(window).resize(function (e) {
828
+ $('#webhooks-dialog').dialog('option', 'position', {
829
+ my: 'center',
830
+ at: 'center',
831
  of: window,
832
  });
833
  });
834
 
835
+ jQuery('#install-webhooks').on('click', function (e) {
836
+ $('#webhooks-dialog').dialog('close');
837
+ jQuery('body').append(
838
  '<div style="width:550px;height:450px; position:fixed;top:10%;left:50%;margin-left:-275px; color:#444; background-color: #fbfbfb;border:1px solid #DDD; border-radius:4px;box-shadow: 0px 0px 0px 4000px rgba(0, 0, 0, 0.85);z-index: 9999999;"><iframe src="' +
839
  wp_reset.webhooks_install_url +
840
  '" style="width:100%;height:100%;border:none;" /></div>'
841
  );
842
+ jQuery('#wpwrap').css('pointer-events', 'none');
843
  e.preventDefault();
844
  return false;
845
  });
846
 
847
  // todo: not finished
848
+ $('.tools_page_wp-reset').on('click', '.button-pro-feature, .pro-feature', function (e) {
849
+ e.preventDefault();
850
+ this.blur();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
 
852
+ tool_id = $(this).data('feature') || $('.pro-feature', this).data('feature');
853
+ if (!tool_id) {
854
+ $('#wp-reset-tabs').tabs('option', 'active', 5);
855
+ $.scrollTo($('#pro-pricing'), 500, { offset: { top: -50, left: 0 } });
856
+ return;
857
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
858
 
859
+ details = $('#pro-feature-details-' + tool_id);
860
+ if (details.length != 1) {
861
+ $('#wp-reset-tabs').tabs('option', 'active', 5);
862
+ $.scrollTo($('#pro-pricing'), 500, { offset: { top: -50, left: 0 } });
863
+ return;
864
  }
 
865
 
866
+ wpr_swal
867
+ .fire({
868
+ title: tool_id,
869
+ html: 'Dialog content',
870
+ footer:
871
+ 'See everything WP Reset PRO offers on &nbsp;<a target="_blank" href="https://wpreset.com">wpreset.com</a>',
872
+ icon: '',
873
+ showCloseButton: true,
874
+ focusConfirm: true,
875
+ confirmButtonText: 'Grab the 30% discount',
876
+ })
877
+ .then((result) => {
878
+ if (result.value) {
879
+ $('#wp-reset-tabs').tabs('option', 'active', 5);
880
+ $.scrollTo($('#pro-pricing'), 500, {
881
+ offset: { top: -50, left: 0 },
882
+ });
883
+ }
884
+ });
885
+
886
+ return false;
887
+ });
888
+
889
+ $('#show-table-details').on('click', function (e) {
890
  e.preventDefault();
891
 
892
  $.get({
893
  url: ajaxurl,
894
  data: {
895
+ action: 'wp_reset_run_tool',
896
  _ajax_nonce: wp_reset.nonce_run_tool,
897
+ tool: 'get_table_details',
898
  },
899
  })
900
  .done(function (data) {
901
  if (data.success) {
902
+ $('#wpr-table-details').html(data.data);
903
  } else {
904
  wpr_swal.fire({
905
+ type: 'error',
906
+ title: wp_reset.documented_error + ' ' + data.data,
907
  });
908
  }
909
  })
910
  .fail(function (data) {
911
+ wpr_swal.fire({ type: 'error', title: wp_reset.undocumented_error });
912
  });
913
 
914
  return false;
915
  }); // show table details
916
 
917
+ $('#wpr-save-license').on('click', function (e) {
918
  e.preventDefault();
919
 
920
  button = this;
921
  safe_refresh = true;
922
 
923
+ block = block_ui($(button).data('text-wait'));
924
+ wf_licensing_verify_licence_ajax('wpr', $('#wpr-license-key').val(), button);
 
 
 
 
925
 
926
  return;
927
  }); // license activation button
928
 
929
+ $('#wpr-keyless-activation').on('click', function (e) {
930
  e.preventDefault();
931
 
932
  button = this;
933
  safe_refresh = true;
934
 
935
+ block = block_ui($(button).data('text-wait'));
936
+ wf_licensing_verify_licence_ajax('wpr', 'keyless', button);
937
 
938
  return;
939
  }); // keyless license activation button
940
 
941
+ $('#wpr-deactivate-license').on('click', function (e) {
942
  e.preventDefault();
943
 
944
  button = this;
945
  safe_refresh = true;
946
 
947
+ block = block_ui($(button).data('text-wait'));
948
+ wf_licensing_deactivate_licence_ajax('wpr', $('#wpr-license-key').val(), button);
 
 
 
 
949
 
950
  return;
951
  }); // deactivate license button
952
 
953
+ $('#wpr-license-key').on('keypress', function (e) {
954
  if (e.keyCode == 13) {
955
  e.preventDefault();
956
+ $('#wpr-save-license').trigger('click');
957
  }
958
  }); // trigger license save on enter
959
 
967
  wp_reset.collections = [];
968
  wp_reset.collections[1] = {
969
  id: 1,
970
+ name: 'Must-have WordPress Plugins',
971
+ created: '2020-04-01',
972
  items: [],
973
  };
974
  wp_reset.collections[1].items[10] = {
975
+ id: '10',
976
+ type: 'plugin',
977
+ source: 'repo',
978
+ note: '',
979
+ slug: 'eps-301-redirects',
980
+ name: '301 Redirects',
981
+ version: '0.4',
982
  };
983
 
984
  wp_reset.collections[1].items[11] = {
985
+ id: '11',
986
+ type: 'plugin',
987
+ source: 'repo',
988
+ note: '',
989
+ slug: 'classic-editor',
990
+ name: 'Classic Editor',
991
+ version: '0.4',
992
  };
993
 
994
  wp_reset.collections[1].items[12] = {
995
+ id: '12',
996
+ type: 'plugin',
997
+ source: 'repo',
998
+ note: '',
999
+ slug: 'simple-author-box',
1000
+ name: 'Simple Author Box',
1001
+ version: '0.4',
1002
  };
1003
 
1004
  wp_reset.collections[1].items[13] = {
1005
+ id: '13',
1006
+ type: 'plugin',
1007
+ source: 'repo',
1008
+ note: '',
1009
+ slug: 'sticky-menu-or-anything-on-scroll',
1010
+ name: 'Sticky Menu (or Anything!) on Scroll',
1011
+ version: '0.4',
1012
  };
1013
 
1014
  wp_reset.collections[1].items[14] = {
1015
+ id: '14',
1016
+ type: 'plugin',
1017
+ source: 'repo',
1018
+ note: '',
1019
+ slug: 'under-construction-page',
1020
+ name: 'UnderConstructionPage',
1021
+ version: '0.4',
1022
  };
1023
 
1024
  wp_reset.collections[1].items[15] = {
1025
+ id: '15',
1026
+ type: 'plugin',
1027
+ source: 'repo',
1028
+ note: '',
1029
+ slug: 'wp-external-links',
1030
+ name: 'WP External Links',
1031
+ version: '0.4',
1032
  };
1033
 
1034
+ $(document).on('click', '.install-collection', function (e) {
1035
+ do_delete = $(this).data('delete');
1036
+ do_activate = $(this).data('activate');
1037
+ collection_id = $(this).parents('.card').data('collection-id');
1038
  show_install_collection(collection_id, do_delete, do_activate);
1039
  });
1040
 
1041
  // install collection item
1042
+ $('.tools_page_wp-reset').on('click', '.install-collection-item', function (e) {
 
 
1043
  e.preventDefault();
1044
 
1045
  wpr_close_dropdowns();
1046
 
1047
+ collection_id = $(this).parents('.card').data('collection-id');
1048
+ collection_item_id = $(this).parents('tr').data('collection-item-id');
1049
+ do_activate = $(this).data('activate');
1050
 
1051
+ item_data = wp_reset.collections[collection_id]['items'][collection_item_id];
 
1052
 
1053
  wpr_swal
1054
  .fire({
1055
+ title: 'Installing <br />' + item_data['name'],
1056
  html: '<div class="wpr-collections-installer"></div>',
1057
  width: 600,
1058
  onRender: function () {
1064
  collection_id: collection_id,
1065
  collection_item_id: collection_item_id,
1066
  },
1067
+ action: 'install_' + item_data.type,
1068
  });
1069
  collections_ajax_queue.push({
1070
  slug: item_data.slug,
1071
  name: item_data.name,
1072
+ action: 'check_install_' + item_data.type,
1073
  });
1074
 
1075
+ $('.wpr-collections-installer').append(
1076
  '<div class="wpr-collections-installer-message" data-action="' +
1077
  item_data.slug +
1078
+ '_install_' +
1079
  item_data.type +
1080
  '"><span class="dashicons"></span>' +
1081
  wp_reset.installing +
1082
+ ' ' +
1083
  item_data.name +
1084
+ '</div>'
1085
  );
1086
 
1087
  if (do_activate) {
1088
  collections_ajax_queue.push({
1089
  slug: item_data.slug,
1090
  name: item_data.name,
1091
+ action: 'activate_' + item_data.type,
1092
  extra_data: {
1093
  source: item_data.source,
1094
  collection_id: collection_id,
1098
  collections_ajax_queue.push({
1099
  slug: item_data.slug,
1100
  name: item_data.name,
1101
+ action: 'check_activate_' + item_data.type,
1102
  });
1103
 
1104
+ $('.wpr-collections-installer').append(
1105
  '<div class="wpr-collections-installer-message" data-action="' +
1106
  item_data.slug +
1107
+ '_activate_' +
1108
  item_data.type +
1109
  '"><span class="dashicons"></span>' +
1110
  wp_reset.activating +
1111
+ ' ' +
1112
  item_data.name +
1113
+ '</div>'
1114
  );
1115
  }
1116
  collections_do_ajax();
1119
  allowEscapeKey: false,
1120
  allowEnterKey: false,
1121
  showCancelButton: true,
1122
+ confirmButtonText: 'OK',
1123
  })
1124
  .then((result) => {
1125
  collections_ajax_queue = [];
1132
  function show_install_collection(collection_id, do_delete, do_activate) {
1133
  wpr_swal
1134
  .fire({
1135
+ title: 'Installing collection<br />' + wp_reset.collections[collection_id]['name'],
 
 
1136
  html: '<div class="wpr-collections-installer"></div>',
1137
  width: 600,
1138
  onRender: function () {
1143
  allowEnterKey: false,
1144
  showCancelButton: true,
1145
  showConfirmButton: false,
1146
+ confirmButtonText: 'OK',
1147
  })
1148
  .then((result) => {
1149
  collections_ajax_queue = [];
1159
 
1160
  console.log(wp_reset.collections[collection_id]);
1161
 
1162
+ for (item in wp_reset.collections[collection_id]['items']) {
1163
+ item_data = wp_reset.collections[collection_id]['items'][item];
1164
  collections_ajax_queue.push({
1165
  slug: item_data.slug,
1166
  name: item_data.name,
1169
  collection_id: collection_id,
1170
  collection_item_id: item_data.id,
1171
  },
1172
+ action: 'install_' + item_data.type,
1173
  });
1174
  collections_ajax_queue.push({
1175
  slug: item_data.slug,
1176
  name: item_data.name,
1177
+ action: 'check_install_' + item_data.type,
1178
  });
1179
 
1180
  if (do_activate) {
1181
  collections_ajax_queue.push({
1182
  slug: item_data.slug,
1183
  name: item_data.name,
1184
+ action: 'activate_' + item_data.type,
1185
  extra_data: {
1186
  source: item_data.source,
1187
  collection_id: collection_id,
1191
  collections_ajax_queue.push({
1192
  slug: item_data.slug,
1193
  name: item_data.name,
1194
+ action: 'check_activate_' + item_data.type,
1195
  });
1196
  }
1197
  }
1201
  collections_ajax_queue_count++;
1202
 
1203
  switch (collections_ajax_queue[ci].action) {
1204
+ case 'deactivate_plugin':
1205
  message = wp_reset.deactivating;
1206
  break;
1207
+ case 'delete_plugin':
1208
+ case 'delete_theme':
1209
  message = wp_reset.deleting;
1210
  break;
1211
+ case 'install_plugin':
1212
+ case 'install_theme':
1213
  message = wp_reset.installing;
1214
  break;
1215
+ case 'activate_plugin':
1216
+ case 'activate_theme':
1217
  message = wp_reset.activating;
1218
  break;
1219
+ case 'activate_license_plugin':
1220
+ case 'activate_license_theme':
1221
  message = wp_reset.activating_license;
1222
  break;
1223
  }
1224
 
1225
  if (message !== false) {
1226
+ $('.wpr-collections-installer').append(
1227
  '<div class="wpr-collections-installer-message" data-action="' +
1228
  collections_ajax_queue[ci].slug +
1229
+ '_' +
1230
  collections_ajax_queue[ci].action +
1231
  '"><span class="dashicons"></span> ' +
1232
  message +
1233
+ ' ' +
1234
  collections_ajax_queue[ci].name +
1235
+ '</div>'
1236
  );
1237
  }
1238
  }
1244
  // run collection ajax
1245
  function collections_do_ajax() {
1246
  collection_item = collections_ajax_queue[collections_ajax_queue_index];
1247
+ message_id = collection_item.slug + '_' + collection_item.action.replace('check_', '');
 
1248
 
1249
+ $('[data-action="' + message_id + '"]').addClass('wpr-collections-installer-loading');
 
 
1250
 
1251
+ var query_data_type = 'text';
1252
  if (
1253
+ collection_item.action == 'check_deactivate_plugin' ||
1254
+ collection_item.action == 'check_delete_plugin' ||
1255
+ collection_item.action == 'check_install_plugin' ||
1256
+ collection_item.action == 'check_activate_plugin' ||
1257
+ collection_item.action == 'check_install_theme' ||
1258
+ collection_item.action == 'check_activate_theme' ||
1259
+ collection_item.action == 'check_delete_theme' ||
1260
+ collection_item.action == 'check_activate_license_plugin' ||
1261
+ collection_item.action == 'check_activate_license_theme'
1262
  ) {
1263
+ query_data_type = 'json';
1264
  }
1265
 
1266
+ if (!('extra_data' in collection_item)) {
1267
  collection_item.extra_data = {};
1268
  }
1269
 
1270
  $.ajax({
1271
  url: ajaxurl,
1272
+ type: 'get',
1273
  dataType: query_data_type,
1274
  data: {
1275
+ action: 'wp_reset_run_tool',
1276
  _ajax_nonce: wp_reset.nonce_run_tool,
1277
  tool: collection_item.action,
1278
  slug: collection_item.slug,
1279
  extra_data: collection_item.extra_data,
1280
  },
1281
  complete: function (data) {
1282
+ if (typeof data.responseJSON == 'undefined') {
1283
  data = false;
1284
  } else {
1285
  data = data.responseJSON;
1286
  }
1287
  var do_next_called = false;
1288
  if (
1289
+ collection_item.action == 'check_deactivate_plugin' ||
1290
+ collection_item.action == 'check_delete_plugin' ||
1291
+ collection_item.action == 'check_install_plugin' ||
1292
+ collection_item.action == 'check_activate_plugin' ||
1293
+ collection_item.action == 'check_install_theme' ||
1294
+ collection_item.action == 'check_activate_theme' ||
1295
+ collection_item.action == 'check_delete_theme' ||
1296
+ collection_item.action == 'check_activate_license_plugin' ||
1297
+ collection_item.action == 'check_activate_license_theme'
1298
  ) {
1299
  if (data == false && collections_retried == false) {
1300
  collections_retried = true;
1302
  return false;
1303
  }
1304
  if (
1305
+ (collection_item.action == 'check_deactivate_plugin' && data.data == 'inactive') ||
1306
+ (collection_item.action == 'check_delete_plugin' && data.data == 'deleted') ||
1307
+ (collection_item.action == 'check_install_plugin' && (data.data == 'inactive' || data.data == 'active')) ||
1308
+ (collection_item.action == 'check_activate_plugin' && data.data == 'active') ||
1309
+ (collection_item.action == 'check_install_theme' && (data.data == 'inactive' || data.data == 'active')) ||
1310
+ (collection_item.action == 'check_activate_theme' && data.data == 'active') ||
1311
+ (collection_item.action == 'check_delete_theme' && data.data == 'deleted') ||
1312
+ (collection_item.action == 'check_activate_license_plugin' && data.data == 'license_active') ||
1313
+ (collection_item.action == 'check_activate_license_theme' && data.data == 'license_active')
 
 
 
 
 
 
 
 
 
1314
  ) {
1315
+ $('[data-action="' + message_id + '"]').addClass('wpr-collections-installer-success');
 
 
1316
  } else {
1317
  var error = false;
1318
  switch (collection_item.action) {
1319
+ case 'check_deactivate_plugin':
1320
+ error = wp_reset.deactivate_failed + ' ' + collection_item.name;
1321
  break;
1322
+ case 'check_delete_plugin':
1323
+ case 'check_delete_theme':
1324
+ error = wp_reset.delete_failed + ' ' + collection_item.name;
1325
  break;
1326
+ case 'check_install_plugin':
1327
+ case 'check_install_theme':
1328
+ if (data.data == 'active') {
1329
+ error = collection_item.name + ' ' + wp_reset.install_failed_existing;
1330
+ } else if (data.data == 'deleted') {
1331
+ error = wp_reset.install_failed + ' ' + collection_item.name;
 
 
 
1332
  } else {
1333
  error = data.data;
1334
  }
1335
  break;
1336
+ case 'check_activate_plugin':
1337
+ case 'check_activate_theme':
1338
+ error = wp_reset.activate_failed + ' ' + collection_item.name;
1339
  break;
1340
+ case 'check_activate_license_plugin':
1341
+ case 'check_activate_license_theme':
1342
+ if (data.data == 'unknown') {
1343
+ error = wp_reset.activating_license_unknown + ' ' + collection_item.name;
 
 
 
1344
  } else {
1345
+ error = wp_reset.activating_license_failed + ' ' + collection_item.name;
 
 
 
1346
  }
1347
  break;
1348
  default:
1350
  }
1351
 
1352
  if (error != false) {
1353
+ $('[data-action="' + message_id + '"]').append('<div class="wpr-collections-error">' + error + '</div>');
 
 
1354
  collections_errors.push(error);
1355
  }
1356
 
1357
+ $('[data-action="' + message_id + '"]').addClass('wpr-collections-installer-error');
 
 
1358
  }
1359
 
1360
+ $('[data-action="' + message_id + '"]').removeClass('wpr-collections-installer-loading');
1361
+ $('[data-action="' + message_id + '"]').addClass('wpr-collections-installer-done');
 
 
 
 
1362
  }
1363
 
1364
  collections_retried = false;
1369
  return false;
1370
  }
1371
 
1372
+ if (do_next_called == false && typeof collections_ajax_queue[collections_ajax_queue_index] !== 'undefined') {
1373
+ if (typeof $('.wpr-collections-installer div.wpr-collections-installer-done:last').offset() !== 'undefined') {
 
 
 
 
 
 
 
 
1374
  var scroll_top =
1375
+ $('.wpr-collections-installer div.wpr-collections-installer-done:last').offset().top -
1376
+ $('.wpr-collections-installer').offset().top +
1377
+ $('.wpr-collections-installer').scrollTop() -
 
 
1378
  60;
1379
+ $('.wpr-collections-installer').animate({ scrollTop: scroll_top }, 600, function () {
1380
+ collections_do_ajax();
1381
+ });
 
 
 
 
1382
  } else {
1383
  collections_do_ajax();
1384
  }
1385
  } else {
1386
  wpr_swal.close();
1387
 
1388
+ $('.wpr-collections-installer').css('padding', '0px 40px');
1389
+ $('.wpr-collections-installer').css('height', '236px');
1390
 
1391
  if (collections_errors.length > 0) {
1392
+ var errors_html = '';
1393
  for (e in collections_errors) {
1394
  errors_html +=
1395
  '<div class="wpr-collections-installer-message wpr-collections-installer-error"><span class="dashicons"></span> ' +
1396
  collections_errors[e] +
1397
+ '</div>';
1398
  }
1399
  wpr_swal
1400
  .fire({
1401
+ icon: 'error',
1402
+ title: 'Collection was installed, but the following errors occured!',
1403
+ html: '<div class="wpr-collections-installer-errors">' + errors_html + '</div>',
 
 
 
 
1404
  showConfirmButton: true,
1405
  })
1406
  .then((result) => {
1409
  } else {
1410
  wpr_swal
1411
  .fire({
1412
+ icon: 'success',
1413
+ title: 'Collection was installed successfully!',
1414
  showConfirmButton: true,
1415
  timer: 2500,
1416
  timerProgressBar: true,
1426
  }); // onload
1427
 
1428
  function wpr_fix_dialog_close(event, ui) {
1429
+ jQuery('.ui-widget-overlay').bind('click', function () {
1430
+ jQuery('#' + event.target.id).dialog('close');
1431
  });
1432
  } // wpr_fix_dialog_close
1433
 
1452
  } // wpr_clear_local
1453
 
1454
  function wpr_close_dropdowns() {
1455
+ jQuery('.dropdown').removeClass('show');
1456
+ jQuery('.dropdown-menu').removeClass('show');
1457
  } // wpr_close_dropdowns
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Reset - Most Advanced WordPress Reset Tool ===
2
  Tags: wordpress reset, reset database, reset wordpress database, reset, advanced wordpress reset, restart wordpress, clean wordpress, default wp, default wordpress, reset wp, wp reset, developer, wp-cli, backup, database backup
3
- Contributors: WebFactory, wpreset, googlemapswidget, underconstructionpage
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
- Tested up to: 5.4
7
- Stable tag: 1.80
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -115,6 +115,11 @@ Or if needed, upload manually;
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
118
  = v1.80 =
119
  * 2020/04/17
120
  * new tool: Purge Cache
1
  === WP Reset - Most Advanced WordPress Reset Tool ===
2
  Tags: wordpress reset, reset database, reset wordpress database, reset, advanced wordpress reset, restart wordpress, clean wordpress, default wp, default wordpress, reset wp, wp reset, developer, wp-cli, backup, database backup
3
+ Contributors: WebFactory
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
+ Tested up to: 5.5
7
+ Stable tag: 1.81
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
115
 
116
  == Changelog ==
117
 
118
+ = v1.81 =
119
+ * 2020/10/07
120
+ * started adding better tooltips to all objects
121
+ * added promo campaign for WP 301 Redirects
122
+
123
  = v1.80 =
124
  * 2020/04/17
125
  * new tool: Purge Cache
wp-reset.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
- Version: 1.80
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: wp-reset
@@ -35,6 +35,9 @@ define('WP_RESET_FILE', __FILE__);
35
  require_once dirname(__FILE__) . '/wp-reset-utility.php';
36
  require_once dirname(__FILE__) . '/wp-reset-licensing.php';
37
 
 
 
 
38
  // load WP-CLI commands, if needed
39
  if (defined('WP_CLI') && WP_CLI) {
40
  require_once dirname(__FILE__) . '/wp-reset-cli.php';
@@ -416,6 +419,7 @@ class WP_Reset
416
  wp_enqueue_style('wp-jquery-ui-dialog');
417
  wp_enqueue_style('wp-reset', $this->plugin_url . 'css/wp-reset.css', array(), $this->version);
418
  wp_enqueue_style('wp-reset-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
 
419
 
420
  wp_enqueue_script('plugin-install');
421
  wp_enqueue_script('jquery-ui-dialog');
@@ -1160,7 +1164,7 @@ class WP_Reset
1160
  // Plugin is already installed
1161
  wp_send_json_success();
1162
  } else {
1163
- // Install Plugin
1164
  $skin = new WP_Ajax_Upgrader_Skin();
1165
  $upgrader = new Plugin_Upgrader($skin);
1166
  $upgrader->install('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
@@ -1223,6 +1227,7 @@ class WP_Reset
1223
  $siteurl = get_option('siteurl');
1224
  $home = get_option('home');
1225
  $snapshots = $this->get_snapshots();
 
1226
 
1227
  $active_plugins = get_option('active_plugins');
1228
  $active_theme = wp_get_theme();
@@ -1262,6 +1267,7 @@ class WP_Reset
1262
  update_option('home', $home);
1263
  update_option('wp-reset', $this->options);
1264
  update_option('wp-reset-snapshots', $snapshots);
 
1265
 
1266
  // remove password nag
1267
  if (get_user_meta($user_id, 'default_password_nag')) {
@@ -1409,7 +1415,7 @@ class WP_Reset
1409
  {
1410
  $current_screen = get_current_screen();
1411
 
1412
- if ($current_screen->id == 'tools_page_wp-reset') {
1413
  return true;
1414
  } else {
1415
  return false;
@@ -1515,21 +1521,21 @@ class WP_Reset
1515
  $out = '';
1516
  $out .= '<h4 id="' . $card_id . '"><span class="card-name">' . htmlspecialchars($title);
1517
  if ($params['pro']) {
1518
- $out .= ' - <a data-feature="' . $card_id . '" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a>';
1519
  }
1520
  $out .= '</span>';
1521
  $out .= '<div class="card-header-right">';
1522
  if ($params['documentation_link']) {
1523
- $out .= '<a class="documentation-link" href="' . $this->generate_web_link('documentation_link', '/documentation/') . '" title="' . __('Open documentation for this tool', 'wp-reset') . '" target="blank"><span class="dashicons dashicons-editor-help"></span></a>';
1524
  }
1525
  if ($params['iot_button']) {
1526
- $out .= '<a class="scrollto" href="#iot" title="Jump to Index of Tools"><span class="dashicons dashicons-screenoptions"></span></a>';
1527
  }
1528
  if ($params['create_snapshot']) {
1529
- $out .= '<a id="create-new-snapshot-primary" title="Create a new snapshot" href="#" class="button button-primary create-new-snapshot">' . __('Create Snapshot', 'wp-reset') . '</a>';
1530
  }
1531
  if ($params['collapse_button']) {
1532
- $out .= '<a class="toggle-card" href="#" title="' . __('Collapse / expand box', 'wp-reset') . '"><span class="dashicons dashicons-arrow-up-alt2"></span></a>';
1533
  }
1534
  $out .= '</div></h4>';
1535
 
@@ -1738,8 +1744,8 @@ class WP_Reset
1738
  echo '<p>The following table details what data will be deleted (reset or destroyed) when a selected reset tool is run. Please read it! ';
1739
  echo 'If something is not clear <a href="#" class="change-tab" data-tab="4">contact support</a> before running any tools. It\'s better to ask than to be sorry!';
1740
  echo '</p>';
1741
- echo '<p><i class="dashicons dashicons-trash red" style="vertical-align: bottom;"></i> - tool WILL delete, reset or destroy the noted data<br>';
1742
- echo '<i class="dashicons dashicons-yes" style="vertical-align: bottom;"></i> - tool will not touch the noted data in any way</p>';
1743
 
1744
  echo '<table id="reset-details" class="">';
1745
  echo '<tr>';
@@ -1775,19 +1781,19 @@ class WP_Reset
1775
  echo '<tr>';
1776
  echo '<td>' . $tool . '</td>';
1777
  if (empty($opt[0])) {
1778
- echo '<td><i class="dashicons dashicons-yes" title="Data will NOT be deleted, reset or modified"></i></td>';
1779
  } else {
1780
- echo '<td><i class="dashicons dashicons-trash red" title="Data WILL BE deleted, reset or modified"></i></td>';
1781
  }
1782
  if (empty($opt[1])) {
1783
- echo '<td><i class="dashicons dashicons-yes" title="Data will NOT be deleted, reset or modified"></i></td>';
1784
  } else {
1785
- echo '<td><i class="dashicons dashicons-trash red" title="Data WILL BE deleted, reset or modified"></i></td>';
1786
  }
1787
  if (empty($opt[2])) {
1788
- echo '<td><i class="dashicons dashicons-yes" title="Data will NOT be deleted, reset or modified"></i></td>';
1789
  } else {
1790
- echo '<td><i class="dashicons dashicons-trash red" title="Data WILL BE deleted, reset or modified"></i></td>';
1791
  }
1792
  echo '</tr>';
1793
  } // foreach $rows
@@ -2205,7 +2211,7 @@ class WP_Reset
2205
  </div>
2206
  </div><p></p></div><table class="collection-table"><tbody><tr><th>Type</th><th>Name &amp; Note</th><th class="actions">Actions</th></tr>';
2207
  foreach ($plugins as $slug => $plugin) {
2208
- echo '<tr data-slug="' . $slug . '"><td><span class="dashicons dashicons-admin-plugins" title="Plugin"></span><span class="dashicons dashicons-wordpress" title="Comes from the WordPress repository"></span></td><td class="collection-item-details"><span>' . $plugin['name'] . '</span><i>' . $plugin['desc'] . '</i></td><td class="textcenter"><div class="dropdown">
2209
  <a class="button dropdown-toggle" href="#">Actions</a>
2210
  <div class="dropdown-menu">
2211
  <a href="#" class="dropdown-item install-collection-item button-pro-feature">Install - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
@@ -2435,7 +2441,7 @@ class WP_Reset
2435
  echo '<div class="card" id="card-snapshots">';
2436
  echo '<h4>';
2437
  echo __('Snapshots', 'wp-reset');
2438
- echo '<div class="card-header-right"><a class="toggle-card" href="#" title="' . __('Collapse / expand box', 'wp-reset') . '"><span class="dashicons dashicons-arrow-up-alt2"></span></a></div>';
2439
  echo '</h4>';
2440
  echo '<div class="card-body">';
2441
  echo '<p>A snapshot is a copy of all WP database tables, standard and custom ones, saved in the site\'s database. <a href="https://www.youtube.com/watch?v=xBfMmS12vMY" target="_blank">Watch a short video</a> overview and tutorial about Snapshots.</p>';
@@ -2513,12 +2519,12 @@ class WP_Reset
2513
  echo '<div class="dropdown">
2514
  <a class="button dropdown-toggle" href="#">Actions</a>
2515
  <div class="dropdown-menu">';
2516
- echo '<a data-title="Current DB tables compared to snapshot %s" data-wait-msg="Comparing. Please wait." data-name="' . $name . '" title="Compare snapshot to current database tables" href="#" class="ss-action compare-snapshot dropdown-item" data-ss-uid="' . $ss['uid'] . '">Compare snapshot to current data</a>';
2517
- echo '<a data-btn-confirm="Restore snapshot" data-text-wait="Restoring snapshot. Please wait." data-text-confirm="Are you sure you want to restore the selected snapshot? There is NO UNDO.<br>Restoring the snapshot will delete all current standard and custom tables and replace them with tables from the snapshot." data-text-done="Snapshot has been restored. Click OK to reload the page with new data." title="Restore snapshot by overwriting current database tables" href="#" class="ss-action restore-snapshot dropdown-item" data-ss-uid="' . $ss['uid'] . '">Restore snapshot</a>';
2518
- echo '<a data-success-msg="Snapshot export created!<br><a href=\'%s\'>Download it</a>" data-wait-msg="Exporting snapshot. Please wait." title="Download snapshot as gzipped SQL dump" href="#" class="ss-action download-snapshot dropdown-item" data-ss-uid="' . $ss['uid'] . '">Download snapshot</a>';
2519
- echo '<a data-btn-confirm="Delete snapshot" data-text-wait="Deleting snapshot. Please wait." data-text-confirm="Are you sure you want to delete the selected snapshot and all its data? There is NO UNDO.<br>Deleting the snapshot will not affect the active database tables in any way." data-text-done="Snapshot has been deleted." title="Permanently delete snapshot" href="#" class="ss-action delete-snapshot dropdown-item" data-ss-uid="' . $ss['uid'] . '">Delete snapshot</a>';
2520
- echo '<a href="#" data-feature="cloud-wpr" class="ss-action dropdown-item button-pro-feature">Upload to WP Reset Cloud - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>';
2521
- echo '<a href="#" class="ss-action dropdown-item button-pro-feature" data-feature="cloud-general">Upload to Dropbox, Google Drive, or pCloud - <span class="pro-feature" data-feature="cloud-general"><span class="pro">PRO</span> Feature</span></a>';
2522
  echo '</div></div></td>';
2523
  echo '</tr>';
2524
  } // foreach
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
+ Version: 1.81
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: wp-reset
35
  require_once dirname(__FILE__) . '/wp-reset-utility.php';
36
  require_once dirname(__FILE__) . '/wp-reset-licensing.php';
37
 
38
+ require_once dirname(__FILE__) . '/wp301/wp301.php';
39
+ new wf_wp301(__FILE__, 'tools_page_wp-reset');
40
+
41
  // load WP-CLI commands, if needed
42
  if (defined('WP_CLI') && WP_CLI) {
43
  require_once dirname(__FILE__) . '/wp-reset-cli.php';
419
  wp_enqueue_style('wp-jquery-ui-dialog');
420
  wp_enqueue_style('wp-reset', $this->plugin_url . 'css/wp-reset.css', array(), $this->version);
421
  wp_enqueue_style('wp-reset-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
422
+ wp_enqueue_style('wp-reset-tooltipster', $this->plugin_url . 'css/tooltipster.bundle.min.css', array(), $this->version);
423
 
424
  wp_enqueue_script('plugin-install');
425
  wp_enqueue_script('jquery-ui-dialog');
1164
  // Plugin is already installed
1165
  wp_send_json_success();
1166
  } else {
1167
+ // Install Plugin
1168
  $skin = new WP_Ajax_Upgrader_Skin();
1169
  $upgrader = new Plugin_Upgrader($skin);
1170
  $upgrader->install('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
1227
  $siteurl = get_option('siteurl');
1228
  $home = get_option('home');
1229
  $snapshots = $this->get_snapshots();
1230
+ $wp301promo = get_option('wp301promo');
1231
 
1232
  $active_plugins = get_option('active_plugins');
1233
  $active_theme = wp_get_theme();
1267
  update_option('home', $home);
1268
  update_option('wp-reset', $this->options);
1269
  update_option('wp-reset-snapshots', $snapshots);
1270
+ update_option('wp301promo', $wp301promo);
1271
 
1272
  // remove password nag
1273
  if (get_user_meta($user_id, 'default_password_nag')) {
1415
  {
1416
  $current_screen = get_current_screen();
1417
 
1418
+ if (!empty($current_screen->id) && $current_screen->id == 'tools_page_wp-reset') {
1419
  return true;
1420
  } else {
1421
  return false;
1521
  $out = '';
1522
  $out .= '<h4 id="' . $card_id . '"><span class="card-name">' . htmlspecialchars($title);
1523
  if ($params['pro']) {
1524
+ $out .= ' - <a data-feature="' . $card_id . '" class="pro-feature tooltip" title="WP Reset PRO tool" href="#"><span class="pro">PRO</span> tool</a>';
1525
  }
1526
  $out .= '</span>';
1527
  $out .= '<div class="card-header-right">';
1528
  if ($params['documentation_link']) {
1529
+ $out .= '<a class="documentation-link tooltip" href="' . $this->generate_web_link('documentation_link', '/documentation/') . '" title="' . __('Open documentation for this tool', 'wp-reset') . '" target="blank"><span class="dashicons dashicons-editor-help"></span></a>';
1530
  }
1531
  if ($params['iot_button']) {
1532
+ $out .= '<a class="scrollto tooltip" href="#iot" title="Jump to Index of Tools"><span class="dashicons dashicons-screenoptions"></span></a>';
1533
  }
1534
  if ($params['create_snapshot']) {
1535
+ $out .= '<a id="create-new-snapshot-primary" title="Create a new snapshot" href="#" class="button button-primary create-new-snapshot tooltip">' . __('Create Snapshot', 'wp-reset') . '</a>';
1536
  }
1537
  if ($params['collapse_button']) {
1538
+ $out .= '<a class="toggle-card tooltip" href="#" title="' . __('Collapse / expand box', 'wp-reset') . '"><span class="dashicons dashicons-arrow-up-alt2"></span></a>';
1539
  }
1540
  $out .= '</div></h4>';
1541
 
1744
  echo '<p>The following table details what data will be deleted (reset or destroyed) when a selected reset tool is run. Please read it! ';
1745
  echo 'If something is not clear <a href="#" class="change-tab" data-tab="4">contact support</a> before running any tools. It\'s better to ask than to be sorry!';
1746
  echo '</p>';
1747
+ echo '<p><i class="dashicons dashicons-trash red tooltip" title="Tool WILL delete, reset or destroy the noted data" style="vertical-align: bottom;"></i> - tool WILL delete, reset or destroy the noted data<br>';
1748
+ echo '<i class="dashicons dashicons-yes tooltip" title="Tool will NOT touch the noted data in any way" style="vertical-align: bottom;"></i> - tool will NOT touch the noted data in any way</p>';
1749
 
1750
  echo '<table id="reset-details" class="">';
1751
  echo '<tr>';
1781
  echo '<tr>';
1782
  echo '<td>' . $tool . '</td>';
1783
  if (empty($opt[0])) {
1784
+ echo '<td><i class="dashicons dashicons-yes tooltip" title="Data will NOT be deleted, reset or modified"></i></td>';
1785
  } else {
1786
+ echo '<td><i class="dashicons dashicons-trash red tooltip" title="Data WILL BE deleted, reset or modified"></i></td>';
1787
  }
1788
  if (empty($opt[1])) {
1789
+ echo '<td><i class="dashicons dashicons-yes tooltip" title="Data will NOT be deleted, reset or modified"></i></td>';
1790
  } else {
1791
+ echo '<td><i class="dashicons dashicons-trash red tooltip" title="Data WILL BE deleted, reset or modified"></i></td>';
1792
  }
1793
  if (empty($opt[2])) {
1794
+ echo '<td><i class="dashicons dashicons-yes tooltip" title="Data will NOT be deleted, reset or modified"></i></td>';
1795
  } else {
1796
+ echo '<td><i class="dashicons dashicons-trash red tooltip" title="Data WILL BE deleted, reset or modified"></i></td>';
1797
  }
1798
  echo '</tr>';
1799
  } // foreach $rows
2211
  </div>
2212
  </div><p></p></div><table class="collection-table"><tbody><tr><th>Type</th><th>Name &amp; Note</th><th class="actions">Actions</th></tr>';
2213
  foreach ($plugins as $slug => $plugin) {
2214
+ echo '<tr data-slug="' . $slug . '"><td><span class="dashicons dashicons-admin-plugins tooltip" title="Plugin"></span><span class="dashicons dashicons-wordpress tooltip" title="Comes from the WordPress repository"></span></td><td class="collection-item-details"><span>' . $plugin['name'] . '</span><i>' . $plugin['desc'] . '</i></td><td class="textcenter"><div class="dropdown">
2215
  <a class="button dropdown-toggle" href="#">Actions</a>
2216
  <div class="dropdown-menu">
2217
  <a href="#" class="dropdown-item install-collection-item button-pro-feature">Install - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
2441
  echo '<div class="card" id="card-snapshots">';
2442
  echo '<h4>';
2443
  echo __('Snapshots', 'wp-reset');
2444
+ echo '<div class="card-header-right"><a class="toggle-card tooltip" href="#" title="' . __('Collapse / expand box', 'wp-reset') . '"><span class="dashicons dashicons-arrow-up-alt2"></span></a></div>';
2445
  echo '</h4>';
2446
  echo '<div class="card-body">';
2447
  echo '<p>A snapshot is a copy of all WP database tables, standard and custom ones, saved in the site\'s database. <a href="https://www.youtube.com/watch?v=xBfMmS12vMY" target="_blank">Watch a short video</a> overview and tutorial about Snapshots.</p>';
2519
  echo '<div class="dropdown">
2520
  <a class="button dropdown-toggle" href="#">Actions</a>
2521
  <div class="dropdown-menu">';
2522
+ echo '<a data-title="Current DB tables compared to snapshot %s" data-wait-msg="Comparing. Please wait." data-name="' . $name . '" title="Compare snapshot to current database tables" href="#" class="ss-action compare-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Compare snapshot to current data</a>';
2523
+ echo '<a data-btn-confirm="Restore snapshot" data-text-wait="Restoring snapshot. Please wait." data-text-confirm="Are you sure you want to restore the selected snapshot? There is NO UNDO.<br>Restoring the snapshot will delete all current standard and custom tables and replace them with tables from the snapshot." data-text-done="Snapshot has been restored. Click OK to reload the page with new data." title="Restore snapshot by overwriting current database tables" href="#" class="ss-action restore-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Restore snapshot</a>';
2524
+ echo '<a data-success-msg="Snapshot export created!<br><a href=\'%s\'>Download it</a>" data-wait-msg="Exporting snapshot. Please wait." title="Download snapshot as gzipped SQL dump" href="#" class="ss-action download-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Download snapshot</a>';
2525
+ echo '<a data-btn-confirm="Delete snapshot" data-text-wait="Deleting snapshot. Please wait." data-text-confirm="Are you sure you want to delete the selected snapshot and all its data? There is NO UNDO.<br>Deleting the snapshot will not affect the active database tables in any way." data-text-done="Snapshot has been deleted." title="Permanently delete snapshot" href="#" class="ss-action delete-snapshot dropdown-item tooltip" data-ss-uid="' . $ss['uid'] . '">Delete snapshot</a>';
2526
+ echo '<a href="#" title="WP Reset PRO feature" data-feature="cloud-wpr" class="ss-action dropdown-item button-pro-feature tooltip">Upload to WP Reset Cloud - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>';
2527
+ echo '<a href="#" title="WP Reset PRO feature" class="ss-action dropdown-item button-pro-feature tooltip" data-feature="cloud-general">Upload to Dropbox, Google Drive, or pCloud - <span class="pro-feature" data-feature="cloud-general"><span class="pro">PRO</span> Feature</span></a>';
2528
  echo '</div></div></td>';
2529
  echo '</tr>';
2530
  } // foreach
wp301/wp301-logo.png ADDED
Binary file
wp301/wp301.js ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Campaign for WP 301 Redirects PRO
3
+ * (c) WebFactory Ltd, 2020
4
+ */
5
+
6
+ jQuery(document).ready(function ($) {
7
+ $('#wp301promo_dismiss').on('click', function (e) {
8
+ e.preventDefault();
9
+
10
+ var slug = $(this).data('plugin-slug');
11
+
12
+ $.get({
13
+ url: ajaxurl,
14
+ data: {
15
+ action: 'wp301_promo_dismiss',
16
+ slug: slug,
17
+ _ajax_nonce: wp301_promo.nonce_wp301_promo_dismiss,
18
+ },
19
+ })
20
+ .always(function (data) {})
21
+ .done(function (data) {
22
+ if (data.success) {
23
+ if (slug == 'dashboard') {
24
+ $('#wp301promo_widget').hide();
25
+ } else {
26
+ $('#wp301-dialog').dialog('close');
27
+ }
28
+ } else {
29
+ alert('Sorry, something is not right. Please reload the page and try again.');
30
+ }
31
+ })
32
+ .fail(function (data) {
33
+ alert('Sorry, something is not right. Please reload the page and try again.');
34
+ });
35
+ }); // dismiss
36
+
37
+
38
+ $('#wp301promo_submit').on('click', function (e) {
39
+ e.preventDefault();
40
+
41
+ var btn = $('#wp301promo_submit');
42
+ var name = $('#wp301promo_name').val();
43
+ var email = $('#wp301promo_email').val();
44
+ var plugin = $('#wp301promo_plugin').val();
45
+ var position = $('#wp301promo_position').val();
46
+ var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
47
+
48
+ if (name.length < 2 || name.length > 128) {
49
+ $('#wp301promo_name').focus();
50
+ alert('Please enter your name. Thank you 👍');
51
+ return false;
52
+ }
53
+ if (!regex.test(email) || email.lenght > 128) {
54
+ $('#wp301promo_email').focus();
55
+ alert('Please enter a valid email address. Thank you 👍');
56
+ return false;
57
+ }
58
+
59
+ $(btn).addClass('disabled');
60
+ $.get({
61
+ url: ajaxurl,
62
+ data: {
63
+ action: 'wp301_promo_submit',
64
+ _ajax_nonce: wp301_promo.nonce_wp301_promo_submit,
65
+ name: name,
66
+ email: email,
67
+ position: position,
68
+ plugin: plugin,
69
+ },
70
+ })
71
+ .always(function (data) {
72
+ $(btn).removeClass('disabled');
73
+ })
74
+ .done(function (data) {
75
+ if (data.success) {
76
+ alert(data.data);
77
+
78
+ if (position == 'dashboard') {
79
+ $('#wp301promo_widget').hide();
80
+ } else {
81
+ $('#wp301-dialog').dialog('close');
82
+ }
83
+ } else {
84
+ alert(data.data);
85
+ }
86
+ })
87
+ .fail(function (data) {
88
+ alert('Sorry, something is not right. Please reload the page and try again.');
89
+ });
90
+ });
91
+
92
+
93
+ $('#wp301promo_name, #wp301promo_email').on('keypress', function (e) {
94
+ if (e.which == 13) {
95
+ $('#wp301promo_submit').trigger('click');
96
+ }
97
+ }); // on enter
98
+
99
+
100
+ if (wp301_promo.open_popup && $('#wp301-dialog').length == 1) {
101
+ $('#wp301-dialog').dialog({
102
+ dialogClass: 'wp-dialog wp301-dialog',
103
+ modal: true,
104
+ resizable: false,
105
+ width: 550,
106
+ height: 'auto',
107
+ show: 'fade',
108
+ hide: 'fade',
109
+ close: function (event, ui) {},
110
+ open: function (event, ui) {
111
+ $(this)
112
+ .siblings()
113
+ .find('span.ui-dialog-title')
114
+ .html('Get a WP 301 Redirects PRO license for FREE <del>$158</del>');
115
+ wp301_fix_dialog_close(event, ui);
116
+ },
117
+ autoOpen: true,
118
+ closeOnEscape: false,
119
+ });
120
+ } // open dialog
121
+ }); // jQuery ready
122
+
123
+
124
+ function wp301_fix_dialog_close(event, ui) {
125
+ jQuery('.ui-widget-overlay').bind('click', function () {
126
+ jQuery('#' + event.target.id).dialog('close');
127
+ });
128
+ } // wp301_fix_dialog_close
wp301/wp301.php ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Campaign for WP 301 Redirects PRO
5
+ * (c) WebFactory Ltd, 2020
6
+ */
7
+
8
+
9
+ if (false == class_exists('wf_wp301')) {
10
+ class wf_wp301
11
+ {
12
+ var $plugin_file = '';
13
+ var $plugin_slug = '';
14
+ var $plugin_screen = '';
15
+ var $options = '';
16
+ var $disable_dashboard = false;
17
+
18
+
19
+ function __construct($plugin_file, $plugin_screen)
20
+ {
21
+ $this->plugin_file = $plugin_file;
22
+ $this->plugin_slug = basename(dirname($plugin_file));
23
+ $this->plugin_screen = $plugin_screen;
24
+ $this->options = get_option('wp301promo', array());
25
+
26
+ if (!is_admin() || !empty($this->options['email_submitted']) || date('Y-m-d') > '2020-11-05') {
27
+ return;
28
+ } else {
29
+ add_action('admin_init', array($this, 'init'));
30
+ }
31
+ } // __construct
32
+
33
+
34
+ function init()
35
+ {
36
+ add_action('wp_dashboard_setup', array($this, 'add_widget'));
37
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
38
+ add_action('wp_ajax_wp301_promo_submit', array($this, 'ajax_submit'));
39
+ add_action('wp_ajax_wp301_promo_dismiss', array($this, 'ajax_dismiss'));
40
+ add_action('admin_footer', array($this, 'admin_footer'));
41
+ } // init
42
+
43
+
44
+ function admin_enqueue_scripts()
45
+ {
46
+ $screen = get_current_screen();
47
+
48
+ if ($screen->base != 'dashboard' && $screen->id != $this->plugin_screen) {
49
+ return;
50
+ }
51
+
52
+ if ($screen->base == 'dashboard' && (!empty($this->options['popup_dismissed_dashboard']) || !empty($this->disable_dashboard))) {
53
+ return;
54
+ }
55
+
56
+ if ($screen->id == $this->plugin_screen) {
57
+ wp_enqueue_style('wp-jquery-ui-dialog');
58
+ wp_enqueue_script('jquery-ui-dialog');
59
+ }
60
+
61
+ wp_enqueue_script('wp301_promo', plugin_dir_url($this->plugin_file) . 'wp301/wp301.js');
62
+
63
+ $js_vars = array(
64
+ 'nonce_wp301_promo_submit' => wp_create_nonce('wp301_submit'),
65
+ 'nonce_wp301_promo_dismiss' => wp_create_nonce('wp301_dismiss'),
66
+ );
67
+
68
+ if (empty($this->options['popup_dismissed_' . $this->plugin_slug])) {
69
+ $js_vars['open_popup'] = true;
70
+ }
71
+
72
+ wp_localize_script('wp301_promo', 'wp301_promo', $js_vars);
73
+ } // admin_enqueue_scripts
74
+
75
+
76
+ function ajax_dismiss()
77
+ {
78
+ if (!wp_verify_nonce(@$_GET['_ajax_nonce'], 'wp301_dismiss')) {
79
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
80
+ }
81
+
82
+ $slug = substr(strip_tags(trim(@$_GET['slug'])), 0, 64);
83
+
84
+ $this->options['popup_dismissed_' . $slug] = true;
85
+ $tmp = update_option('wp301promo', $this->options);
86
+
87
+ if ($tmp) {
88
+ wp_send_json_success();
89
+ } else {
90
+ wp_send_json_error();
91
+ }
92
+ } // ajax_dismiss
93
+
94
+
95
+ function ajax_submit()
96
+ {
97
+ if (!wp_verify_nonce(@$_GET['_ajax_nonce'], 'wp301_submit')) {
98
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
99
+ }
100
+
101
+ $email = strip_tags(trim(@$_GET['email']));
102
+ $name = strip_tags(trim(@$_GET['name']));
103
+ $plugin = strip_tags(trim(@$_GET['plugin'])) . '-' . strip_tags(trim(@$_GET['position']));
104
+
105
+ if (!is_email($email)) {
106
+ wp_send_json_error('Please enter a valid email address.');
107
+ }
108
+
109
+ $url = add_query_arg(array('name' => $name, 'email' => $email, 'plugin' => $plugin), 'https://wp301redirects.com/subscribe/');
110
+
111
+ $response = wp_remote_get($url, array('timeout' => 25));
112
+
113
+ if (is_wp_error($response)) {
114
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
115
+ }
116
+
117
+ $body = @json_decode(wp_remote_retrieve_body($response), true);
118
+ if (empty($body['success'])) {
119
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
120
+ }
121
+
122
+ $this->options['email_submitted'] = true;
123
+ update_option('wp301promo', $this->options);
124
+ wp_send_json_success('Thank you for trusting us with your email! You\'ll hear from us soon 🚀');
125
+ } // ajax_submit
126
+
127
+
128
+ function add_widget()
129
+ {
130
+ if (!empty($this->options['popup_dismissed_dashboard']) || !empty($this->disable_dashboard)) {
131
+ return;
132
+ }
133
+
134
+ add_meta_box('wp301promo_widget', 'Get a WP 301 Redirects PRO license for FREE <del>$158</del>', array($this, 'widget_content'), 'dashboard', 'side', 'high');
135
+ } // add_widget
136
+
137
+
138
+ function widget_content()
139
+ {
140
+ $out = '';
141
+
142
+ $out .= '<style>';
143
+ $out .= '#wp301promo_widget .disabled { pointer-events: none; }';
144
+ $out .= '#wp301promo_widget label { font-weight: normal; display: inline-block; width: 15%; margin-bottom: 10px; }';
145
+ $out .= '#wp301promo_widget input { width: 74%; margin-bottom: 10px; }';
146
+ $out .= '#wp301promo_widget .button-primary { padding: 14px 28px; text-decoration: none; line-height: 1; }';
147
+ $out .= '#wp301promo_dismiss { font-style: italic; display: inline-block; color: #444; text-decoration: none; margin: 8px 0 0 0; }';
148
+ $out .= '#wp301promo_dismiss:hover { text-decoration: underline; }';
149
+ $out .= '#wp301promo_widget, #wp301promo_widget p { font-size: 14px; }';
150
+ $out .= '#wp301promo_widget .title301 { font-weight: 600; margin: 10px 0 -10px 0; }';
151
+ $out .= '#wp301promo_widget img { max-width: 50%; max-height: 80px; }';
152
+ $out .= '#wp301promo_widget .center { text-align: center; }';
153
+ $out .= '#wp301promo_email { margin-bottom: 0 !important; }';
154
+ $out .= '#wp301promo_widget { background-color: #fafafa; }';
155
+ $out .= '#wp301promo_widget li a { text-decoration: underline; }';
156
+ $out .= '#wp301promo_widget .wp301inside { padding: 25px 12px 0px 12px; position: relative; }';
157
+ $out .= '#wp301promo_widget p { margin-top: 14px; line-height: 1.5; }';
158
+ $out .= '#wp301promo_widget small { margin-left: 17%; }';
159
+ $out .= '#wp301promo_widget ul { font-size: 14px; margin: 0 0 20px 0; list-style-type: disc; list-style-position: inside; }';
160
+ $out .= '#wp301promo_widget li { margin-bottom: 3px; }';
161
+ $out .= '#wp301promo_submit span { display: none; text-decoration: none; margin-right: 10px; animation: wf-spin-animation 1.5s infinite linear; }';
162
+ $out .= '#wp301promo_submit.disabled span { display: inline-block; }';
163
+ $out .= '@keyframes wf-spin-animation {
164
+ from { transform: rotate(0deg); }
165
+ to { transform: rotate(360deg); }
166
+ }';
167
+ $out .= '#wp301promo_widget .inside { overflow: hidden; margin: 0; }
168
+ #wp301promo_widget .ribbon { margin: 0; padding: 11px 20px 10px 20px; background: #007cba; color: #FFF; font-weight: 800; position: absolute; top: -17px; right: -17px; transform: translateX(30%) translateY(0%) rotate(45deg); transform-origin: top left; letter-spacing: 1px; }
169
+ #wp301promo_widget .ribbon:before, #wp301promo_widget .ribbon:after { content: ""; position: absolute; top:0; margin: 0 -1px; width: 100%; height: 100%; background: #007cba; }
170
+ #wp301promo_widget .ribbon:before { right:100%; }
171
+ #wp301promo_widget .ribbon:after { left:100%; }';
172
+ $out .= '</style>';
173
+
174
+ $plugin_url = plugin_dir_url($this->plugin_file);
175
+
176
+ $out .= '<div class="ribbon">FREE</div>';
177
+ $out .= '<div class="wp301inside">';
178
+
179
+ $out .= '<div class="center"><a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-dashboard" target="_blank"><img src="' . $plugin_url . 'wp301/wp301-logo.png' . '" alt="WP 301 Redirects PRO" title="WP 301 Redirects PRO"></a></div>';
180
+
181
+ $out .= '<p>On November 6th <a href="https://www.webfactoryltd.com/" target="_blank">WebFactory Ltd</a> will give away a limited number of lifetime WP 301 Redirect PRO licenses, <b>each for 10 sites</b>. A $158 retail value! 🚀 Leave your email, we\'ll send you a link &amp; download your copy.</p><p style="margin-bottom: 0;"><b>What do I get?</b></p>';
182
+
183
+ $out .= '<ul>';
184
+ $out .= '<li>Automatically fix 404 errors &amp; URL typos</li>';
185
+ $out .= '<li>Create advanced redirect rules &amp; control affiliate links</li>';
186
+ $out .= '<li>Detailed log of all redirects &amp; 404s</li>';
187
+ $out .= '<li>Manage all sites\' licenses from a central Dashboard</li>';
188
+ $out .= '<li>Lifetime license for 10 sites. <a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-dashboard" target="_blank">See all features</a></li>';
189
+ $out .= '</ul>';
190
+
191
+ $out .= '
192
+ <div>
193
+ <label for="wp301promo_name">Name:</label>
194
+ <input type="text" name="wp301promo_name" id="wp301promo_name" placeholder="How shall we call you?"><br>
195
+ <label for="wp301promo_email">Email:</label>
196
+ <input type="text" name="wp301promo_email" id="wp301promo_email" placeholder="Your best email address to get the plugin"><br>
197
+ <small>We hate spam as much as you do and never send it!</small>
198
+ <input type="hidden" id="wp301promo_plugin" value="' . $this->plugin_slug . '">
199
+ <input type="hidden" id="wp301promo_position" value="dashboard">
200
+ </div>
201
+
202
+ <p class="center">
203
+ <a id="wp301promo_submit" class="button button-primary" href="#"><span class="dashicons dashicons-update"></span>I Want My FREE License <del>$158</del></a><br>
204
+ <a id="wp301promo_dismiss" class="" href="#" data-plugin-slug="dashboard">I don\'t want a free license; don\'t show this again</a>
205
+ </p>
206
+ </div>';
207
+
208
+ echo $out;
209
+ } // widget_content
210
+
211
+
212
+ function admin_footer()
213
+ {
214
+ $screen = get_current_screen();
215
+ if ($screen->id != $this->plugin_screen) {
216
+ return;
217
+ }
218
+
219
+ $out = '';
220
+
221
+ $out .= '<style>';
222
+ $out .= '#wp301promo_widget .disabled { pointer-events: none; }';
223
+ $out .= '.wp301-dialog .ui-dialog-titlebar-close { visibility: hidden; }';
224
+ $out .= '#wp301-dialog label { font-weight: normal; display: inline-block; width: 15%; margin-bottom: 10px; }';
225
+ $out .= '#wp301-dialog input { width: 74%; margin-bottom: 10px; }';
226
+ $out .= '#wp301-dialog .button-primary { padding: 14px 28px; text-decoration: none; line-height: 1; }';
227
+ $out .= '#wp301-dialog, #wp301-dialog p { font-size: 14px; }';
228
+ $out .= '#wp301-dialog .title301 { font-size: 1.3em; font-weight: 600; margin: 10px 0 -10px 0; }';
229
+ $out .= '#wp301-dialog img { max-width: 60%; }';
230
+ $out .= '#wp301-dialog li a { text-decoration: underline; }';
231
+ $out .= '#wp301-dialog small { margin-left: 16%; }';
232
+ $out .= '#wp301-dialog .center { text-align: center; }';
233
+ $out .= '#wp301-dialog, .wp301-dialog .ui-dialog-titlebar { background-color: #fafafa; }';
234
+ $out .= '#wp301-dialog .wp301inside { padding: 12px 12px 0px 12px; }';
235
+ $out .= '#wp301-dialog p { margin-top: 14px; line-height: 1.5; }';
236
+ $out .= '#wp301-dialog ul { margin: 0 0 20px 0; list-style-type: disc; list-style-position: inside; }';
237
+ $out .= '#wp301-dialog li { margin-bottom: 3px; }';
238
+ $out .= '#wp301promo_dismiss { display: inline-block; color: #444; text-decoration: none; margin: 8px 0 0 0; }';
239
+ $out .= '#wp301promo_dismiss:hover { text-decoration: underline; }';
240
+ $out .= '#wp301promo_submit span { display: none; text-decoration: none; margin-right: 10px; animation: wf-spin-animation 1.5s infinite linear; }';
241
+ $out .= '#wp301promo_submit.disabled span { display: inline-block; }';
242
+ $out .= '@keyframes wf-spin-animation {
243
+ from { transform: rotate(0deg); }
244
+ to { transform: rotate(360deg); }
245
+ }';
246
+ $out .= '#wp301-dialog .inside { overflow: hidden; margin: 0; }
247
+ #wp301-dialog .ribbon { margin: 0; padding: 11px 20px 10px 20px; background: #007cba; color: #FFF; font-weight: 800; position: absolute; top: -17px; right: -17px; transform: translateX(30%) translateY(0%) rotate(45deg); transform-origin: top left; letter-spacing: 1px; }
248
+ #wp301-dialog .ribbon:before, #wp301-dialog .ribbon:after { content: ""; position: absolute; top:0; margin: 0 -1px; width: 100%; height: 100%; background: #007cba; }
249
+ #wp301-dialog .ribbon:before { right:100%; }
250
+ #wp301-dialog .ribbon:after { left:100%; }';
251
+ $out .= '</style>';
252
+
253
+ $out .= '<div id="wp301-dialog" style="display: none;" title="Get a WP 301 Redirects PRO license for FREE"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
254
+
255
+ $plugin_url = plugin_dir_url($this->plugin_file);
256
+
257
+ $out .= '<div class="wp301inside">';
258
+ $out .= '<div class="ribbon">FREE</div>';
259
+
260
+ $out .= '<div class="center"><a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-popup" target="_blank"><img src="' . $plugin_url . 'wp301/wp301-logo.png' . '" alt="WP 301 Redirects PRO" title="WP 301 Redirects PRO"></a></div>';
261
+
262
+ $out .= '<p>On November 6th <a href="https://www.webfactoryltd.com/" target="_blank">WebFactory Ltd</a> will give away a limited number of lifetime WP 301 Redirect PRO licenses, <b>each for 10 sites</b>. A $158 retail value! 🚀 Leave your email, we\'ll send you a link &amp; download your copy.</p><p style="margin-bottom: 0;"><b>What do I get?</b></p>';
263
+
264
+ $out .= '<ul>';
265
+ $out .= '<li>Automatically fix 404 errors &amp; URL typos</li>';
266
+ $out .= '<li>Create advanced redirect rules &amp; control affiliate links</li>';
267
+ $out .= '<li>Detailed log of all redirects &amp; 404s</li>';
268
+ $out .= '<li>Manage all sites\' licenses from a central Dashboard</li>';
269
+ $out .= '<li>Lifetime license for 10 sites. <a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-dashboard" target="_blank">See all features</a></li>';
270
+ $out .= '</ul>';
271
+
272
+ $out .= '
273
+ <div>
274
+ <label for="wp301promo_name">Name:</label>
275
+ <input type="text" name="wp301promo_name" id="wp301promo_name" placeholder="How shall we call you?"><br>
276
+ <label for="wp301promo_email">Email:</label>
277
+ <input type="text" name="wp301promo_email" id="wp301promo_email" placeholder="Your best email address to get the plugin"><br>
278
+ <small>We hate spam as much as you do and never send it!</small>
279
+ <input type="hidden" id="wp301promo_plugin" value="' . $this->plugin_slug . '">
280
+ <input type="hidden" id="wp301promo_position" value="popup">
281
+ </div>
282
+
283
+ <p class="center">
284
+ <a id="wp301promo_submit" class="button button-primary" href="#"><span class="dashicons dashicons-update"></span>I Want My FREE License <del>$158</del></a><br>
285
+ <a id="wp301promo_dismiss" class="" href="#" data-plugin-slug="' . $this->plugin_slug . '">I don\'t want a free license; don\'t show this again</a>
286
+ </p>
287
+
288
+ </div>';
289
+
290
+ $out .= '</div>';
291
+
292
+ echo $out;
293
+ } // wp_footer
294
+ } // wf_wp301
295
+ }