Version Description
Download this release
Release Info
Developer | WebFactory |
Plugin | WP Reset – Fastest WordPress Reset Plugin |
Version | 1.80 |
Comparing to | |
See all releases |
Code changes from version 1.77 to 1.80
- css/font/fontello.svg +2 -2
- css/sweetalert2.min.css +1 -2
- css/wp-reset.css +331 -27
- js/wf-licensing.js +83 -0
- js/wp-reset-libs.min.js +6 -3
- js/wp-reset-pointers.js +1 -1
- js/wp-reset.js +1165 -311
- readme.txt +12 -5
- wp-reset-cli.php +1 -1
- wp-reset-licensing.php +629 -0
- wp-reset-utility.php +177 -0
- wp-reset.php +825 -249
css/font/fontello.svg
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0" standalone="no"?>
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
-
<metadata>Copyright (C)
|
5 |
<defs>
|
6 |
<font id="fontello" horiz-adv-x="1000" >
|
7 |
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
@@ -11,4 +11,4 @@
|
|
11 |
<glyph glyph-name="database" unicode="" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
|
12 |
</font>
|
13 |
</defs>
|
14 |
-
</svg>
|
1 |
<?xml version="1.0" standalone="no"?>
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Copyright (C) 2020 by original authors @ fontello.com</metadata>
|
5 |
<defs>
|
6 |
<font id="fontello" horiz-adv-x="1000" >
|
7 |
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
11 |
<glyph glyph-name="database" unicode="" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
|
12 |
</font>
|
13 |
</defs>
|
14 |
+
</svg>
|
css/sweetalert2.min.css
CHANGED
@@ -3,5 +3,4 @@
|
|
3 |
https://github.com/sweetalert2/sweetalert2
|
4 |
MIT License
|
5 |
*/
|
6 |
-
|
7 |
-
@-webkit-keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}body.swal2-toast-shown.swal2-has-input>.swal2-container>.swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-shown.swal2-has-input>.swal2-container>.swal2-toast .swal2-actions{flex:1;align-self:stretch;justify-content:flex-end;height:2.2em}body.swal2-toast-shown.swal2-has-input>.swal2-container>.swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-shown.swal2-has-input>.swal2-container>.swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-shown.swal2-has-input>.swal2-container>.swal2-toast .swal2-validationerror{font-size:1em}body.swal2-toast-shown>.swal2-container{position:fixed;background-color:transparent}body.swal2-toast-shown>.swal2-container.swal2-shown{background-color:transparent}body.swal2-toast-shown>.swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown>.swal2-container.swal2-top-end,body.swal2-toast-shown>.swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown>.swal2-container.swal2-top-left,body.swal2-toast-shown>.swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown>.swal2-container.swal2-center-left,body.swal2-toast-shown>.swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown>.swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-toast-shown>.swal2-container.swal2-center-end,body.swal2-toast-shown>.swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown>.swal2-container.swal2-bottom-left,body.swal2-toast-shown>.swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown>.swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown>.swal2-container.swal2-bottom-end,body.swal2-toast-shown>.swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;box-shadow:0 0 .625em #d9d9d9;overflow-y:hidden}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-close{position:initial}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon-text{font-size:2em;font-weight:700;line-height:1em}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 .0625em #fff,0 0 0 .125em rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:2em;height:2.8125em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.25em;left:-.9375em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:2em 2em;transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;-webkit-transform-origin:0 2em;transform-origin:0 2em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:showSweetToast .5s;animation:showSweetToast .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:hideSweetToast .2s forwards;animation:hideSweetToast .2s forwards}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:animate-toast-success-tip .75s;animation:animate-toast-success-tip .75s}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:animate-toast-success-long .75s;animation:animate-toast-success-long .75s}@-webkit-keyframes showSweetToast{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg);opacity:0}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg);opacity:.5}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg);opacity:.7}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0);opacity:1}}@keyframes showSweetToast{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg);opacity:0}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg);opacity:.5}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg);opacity:.7}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0);opacity:1}}@-webkit-keyframes hideSweetToast{0%{opacity:1}33%{opacity:.5}100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@keyframes hideSweetToast{0%{opacity:1}33%{opacity:.5}100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes animate-toast-success-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes animate-toast-success-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes animate-toast-success-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes animate-toast-success-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-shown{top:auto;right:auto;bottom:auto;left:auto;background-color:transparent}body.swal2-no-backdrop .swal2-shown>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-shown.swal2-top{top:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-top-left,body.swal2-no-backdrop .swal2-shown.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-top-end,body.swal2-no-backdrop .swal2-shown.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-shown.swal2-center{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-left,body.swal2-no-backdrop .swal2-shown.swal2-center-start{top:50%;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-end,body.swal2-no-backdrop .swal2-shown.swal2-center-right{top:50%;right:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom{bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom-left,body.swal2-no-backdrop .swal2-shown.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-bottom-end,body.swal2-no-backdrop .swal2-shown.swal2-bottom-right{right:0;bottom:0}.swal2-container{display:flex;position:fixed;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:10px;background-color:transparent;z-index:1060;overflow-x:hidden;-webkit-overflow-scrolling:touch}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-container.swal2-fade{transition:background-color .1s}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-popup{display:none;position:relative;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem;box-sizing:border-box}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-popup .swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-popup .swal2-title{display:block;position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-popup .swal2-actions{align-items:center;justify-content:center;margin:1.25em auto 0}.swal2-popup .swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-popup .swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-popup .swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-popup .swal2-actions.swal2-loading .swal2-styled.swal2-confirm{width:2.5em;height:2.5em;margin:.46875em;padding:0;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;box-sizing:border-box;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-popup .swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-popup .swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{display:inline-block;width:15px;height:15px;margin-left:5px;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff;content:'';-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal}.swal2-popup .swal2-styled{margin:0 .3125em;padding:.625em 2em;font-weight:500;box-shadow:none}.swal2-popup .swal2-styled:not([disabled]){cursor:pointer}.swal2-popup .swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-popup .swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-popup .swal2-styled:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.swal2-popup .swal2-styled::-moz-focus-inner{border:0}.swal2-popup .swal2-footer{justify-content:center;margin:1.25em 0 0;padding-top:1em;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-popup .swal2-image{max-width:100%;margin:1.25em auto}.swal2-popup .swal2-close{position:absolute;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;transition:color .1s ease-out;border:none;border-radius:0;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer;overflow:hidden}.swal2-popup .swal2-close:hover{-webkit-transform:none;transform:none;color:#f27474}.swal2-popup>.swal2-checkbox,.swal2-popup>.swal2-file,.swal2-popup>.swal2-input,.swal2-popup>.swal2-radio,.swal2-popup>.swal2-select,.swal2-popup>.swal2-textarea{display:none}.swal2-popup .swal2-content{justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:300;line-height:normal;word-wrap:break-word}.swal2-popup #swal2-content{text-align:center}.swal2-popup .swal2-checkbox,.swal2-popup .swal2-file,.swal2-popup .swal2-input,.swal2-popup .swal2-radio,.swal2-popup .swal2-select,.swal2-popup .swal2-textarea{margin:1em auto}.swal2-popup .swal2-file,.swal2-popup .swal2-input,.swal2-popup .swal2-textarea{width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;font-size:1.125em;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);box-sizing:border-box}.swal2-popup .swal2-file.swal2-inputerror,.swal2-popup .swal2-input.swal2-inputerror,.swal2-popup .swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-popup .swal2-file:focus,.swal2-popup .swal2-input:focus,.swal2-popup .swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-popup .swal2-file::-webkit-input-placeholder,.swal2-popup .swal2-input::-webkit-input-placeholder,.swal2-popup .swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-popup .swal2-file:-ms-input-placeholder,.swal2-popup .swal2-input:-ms-input-placeholder,.swal2-popup .swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-popup .swal2-file::-ms-input-placeholder,.swal2-popup .swal2-input::-ms-input-placeholder,.swal2-popup .swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-popup .swal2-file::placeholder,.swal2-popup .swal2-input::placeholder,.swal2-popup .swal2-textarea::placeholder{color:#ccc}.swal2-popup .swal2-range input{width:80%}.swal2-popup .swal2-range output{width:20%;font-weight:600;text-align:center}.swal2-popup .swal2-range input,.swal2-popup .swal2-range output{height:2.625em;margin:1em auto;padding:0;font-size:1.125em;line-height:2.625em}.swal2-popup .swal2-input{height:2.625em;padding:.75em}.swal2-popup .swal2-input[type=number]{max-width:10em}.swal2-popup .swal2-file{font-size:1.125em}.swal2-popup .swal2-textarea{height:6.75em;padding:.75em}.swal2-popup .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;color:#545454;font-size:1.125em}.swal2-popup .swal2-checkbox,.swal2-popup .swal2-radio{align-items:center;justify-content:center}.swal2-popup .swal2-checkbox label,.swal2-popup .swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-popup .swal2-checkbox input,.swal2-popup .swal2-radio input{margin:0 .4em}.swal2-popup .swal2-validationerror{display:none;align-items:center;justify-content:center;padding:.625em;background:#f0f0f0;color:#666;font-size:1em;font-weight:300;overflow:hidden}.swal2-popup .swal2-validationerror::before{display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center;content:'!';zoom:normal}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}.swal2-icon{position:relative;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;line-height:5em;cursor:default;box-sizing:content-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;zoom:normal}.swal2-icon-text{font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:3.75em 3.75em;transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 3.75em;transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;top:-.25em;left:-.25em;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%;z-index:2;box-sizing:content-box}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;top:.5em;left:1.625em;width:.4375em;height:5.625em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);z-index:1}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;height:.3125em;border-radius:.125em;background-color:#a5dc86;z-index:2}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.875em;width:1.5625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-progresssteps{align-items:center;margin:0 0 1.25em;padding:0;font-weight:600}.swal2-progresssteps li{display:inline-block;position:relative}.swal2-progresssteps .swal2-progresscircle{width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center;z-index:20}.swal2-progresssteps .swal2-progresscircle:first-child{margin-left:0}.swal2-progresssteps .swal2-progresscircle:last-child{margin-right:0}.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep{background:#3085d6}.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep~.swal2-progresscircle{background:#add8e6}.swal2-progresssteps .swal2-progresscircle.swal2-activeprogressstep~.swal2-progressline{background:#add8e6}.swal2-progresssteps .swal2-progressline{width:2.5em;height:.4em;margin:0 -1px;background:#3085d6;z-index:10}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}[dir=rtl] .swal2-close{right:auto;left:0}.swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-animate-error-icon{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-animate-error-icon .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}@-webkit-keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
|
3 |
https://github.com/sweetalert2/sweetalert2
|
4 |
MIT License
|
5 |
*/
|
6 |
+
.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;background:#fff;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;width:auto;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:"";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar{position:absolute;bottom:0;left:0;width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;align-items:center;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}
|
|
css/wp-reset.css
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
/**
|
2 |
* WP Reset
|
3 |
* https://wpreset.com/
|
4 |
-
* (c) WebFactory Ltd, 2017-
|
5 |
*/
|
6 |
|
|
|
|
|
|
|
|
|
7 |
.tools_page_wp-reset #wpcontent,
|
8 |
.tools_page_wp-reset .auto-fold #wpcontent {
|
9 |
padding-left: 0;
|
@@ -17,6 +21,13 @@
|
|
17 |
padding: 0;
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
.tools_page_wp-reset #loading-tabs {
|
21 |
padding-top: 80px;
|
22 |
text-align: center;
|
@@ -80,7 +91,7 @@
|
|
80 |
}
|
81 |
|
82 |
.tools_page_wp-reset .button.dropdown-toggle::after {
|
83 |
-
content:
|
84 |
font-family: dashicons;
|
85 |
display: inline-block;
|
86 |
line-height: 1;
|
@@ -98,10 +109,15 @@
|
|
98 |
text-align: center;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
101 |
.tools_page_wp-reset .dropdown .dropdown-menu {
|
102 |
position: absolute;
|
103 |
top: 100%;
|
104 |
-
|
105 |
z-index: 1000;
|
106 |
display: none;
|
107 |
float: left;
|
@@ -141,7 +157,8 @@
|
|
141 |
background-color: #f8f9fa;
|
142 |
}
|
143 |
|
144 |
-
.tools_page_wp-reset #wp_reset_confirm
|
|
|
145 |
vertical-align: top;
|
146 |
}
|
147 |
|
@@ -161,6 +178,18 @@
|
|
161 |
vertical-align: top;
|
162 |
}
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
.tools_page_wp-reset .button.disabled {
|
165 |
pointer-events: none;
|
166 |
cursor: not-allowed;
|
@@ -172,15 +201,12 @@
|
|
172 |
border-radius: 0;
|
173 |
}
|
174 |
|
175 |
-
.tools_page_wp-reset .button,
|
176 |
-
.tools_page_wp-reset .button-secondary
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
.tools_page_wp-reset .button-secondary:focus, .tools_page_wp-reset .button-secondary:hover, .tools_page_wp-reset .button.focus, .tools_page_wp-reset .button.hover, .tools_page_wp-reset .button:focus, .tools_page_wp-reset .button:hover {
|
184 |
background: #fafafa;
|
185 |
border-color: #999;
|
186 |
color: #23282d;
|
@@ -239,6 +265,11 @@
|
|
239 |
z-index: 99999;
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
242 |
.tools_page_wp-reset .swal2-container .swal2-popup .swal2-actions {
|
243 |
margin: 2em auto 0;
|
244 |
}
|
@@ -274,6 +305,8 @@
|
|
274 |
|
275 |
.tools_page_wp-reset .button-delete {
|
276 |
color: #cc2f2f;
|
|
|
|
|
277 |
}
|
278 |
|
279 |
.tools_page_wp-reset .button-delete:hover,
|
@@ -354,6 +387,16 @@
|
|
354 |
margin: 1em 0;
|
355 |
}
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
.tools_page_wp-reset table td {
|
358 |
text-align: left;
|
359 |
padding: 20px 10px;
|
@@ -364,8 +407,11 @@
|
|
364 |
background-color: #f9f9f9;
|
365 |
}
|
366 |
|
367 |
-
.tools_page_wp-reset table .ss-actions
|
368 |
-
|
|
|
|
|
|
|
369 |
}
|
370 |
|
371 |
.tools_page_wp-reset table th {
|
@@ -374,6 +420,19 @@
|
|
374 |
padding: 5px;
|
375 |
}
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
.tools_page_wp-reset table .ss-action {
|
378 |
text-decoration: none;
|
379 |
margin: 5px 10px 5px 0;
|
@@ -533,7 +592,11 @@
|
|
533 |
}
|
534 |
|
535 |
.tools_page_wp-reset .ui-tabs .ui-tabs-nav li a,
|
536 |
-
.tools_page_wp-reset
|
|
|
|
|
|
|
|
|
537 |
cursor: pointer;
|
538 |
}
|
539 |
|
@@ -562,7 +625,7 @@
|
|
562 |
}
|
563 |
|
564 |
.tools_page_wp-reset .ui-tabs-nav:after {
|
565 |
-
content:
|
566 |
clear: both;
|
567 |
display: block;
|
568 |
}
|
@@ -870,13 +933,150 @@
|
|
870 |
}
|
871 |
/* webhooks dialog */
|
872 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
873 |
/* Fontello */
|
874 |
@font-face {
|
875 |
-
font-family:
|
876 |
-
src: url(
|
877 |
-
src: url(
|
878 |
-
url(
|
879 |
-
url(
|
|
|
|
|
880 |
font-weight: normal;
|
881 |
font-style: normal;
|
882 |
}
|
@@ -891,9 +1091,9 @@
|
|
891 |
}
|
892 |
*/
|
893 |
|
894 |
-
[class^=
|
895 |
-
[class*=
|
896 |
-
font-family:
|
897 |
font-style: normal;
|
898 |
font-weight: normal;
|
899 |
display: inline-block;
|
@@ -926,8 +1126,112 @@
|
|
926 |
}
|
927 |
|
928 |
.icon-doc-text-inv:before {
|
929 |
-
content:
|
930 |
} /* '' */
|
931 |
.icon-database:before {
|
932 |
-
content:
|
933 |
} /* '' */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* WP Reset
|
3 |
* https://wpreset.com/
|
4 |
+
* (c) WebFactory Ltd, 2017-2020
|
5 |
*/
|
6 |
|
7 |
+
body.tools_page_wp-reset {
|
8 |
+
overflow-y: scroll;
|
9 |
+
}
|
10 |
+
|
11 |
.tools_page_wp-reset #wpcontent,
|
12 |
.tools_page_wp-reset .auto-fold #wpcontent {
|
13 |
padding-left: 0;
|
21 |
padding: 0;
|
22 |
}
|
23 |
|
24 |
+
.tools_page_wp-reset button.loading,
|
25 |
+
.tools_page_wp-reset a.loading {
|
26 |
+
pointer-events: none;
|
27 |
+
cursor: wait !important;
|
28 |
+
opacity: 0.6;
|
29 |
+
}
|
30 |
+
|
31 |
.tools_page_wp-reset #loading-tabs {
|
32 |
padding-top: 80px;
|
33 |
text-align: center;
|
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;
|
109 |
text-align: center;
|
110 |
}
|
111 |
|
112 |
+
.tools_page_wp-reset .dropdown.dropdown-right .dropdown-menu {
|
113 |
+
left: 0;
|
114 |
+
right: auto;
|
115 |
+
}
|
116 |
+
|
117 |
.tools_page_wp-reset .dropdown .dropdown-menu {
|
118 |
position: absolute;
|
119 |
top: 100%;
|
120 |
+
right: 0;
|
121 |
z-index: 1000;
|
122 |
display: none;
|
123 |
float: left;
|
157 |
background-color: #f8f9fa;
|
158 |
}
|
159 |
|
160 |
+
.tools_page_wp-reset #wp_reset_confirm,
|
161 |
+
.tools_page_wp-reset #nuclear_reset_confirm {
|
162 |
vertical-align: top;
|
163 |
}
|
164 |
|
178 |
vertical-align: top;
|
179 |
}
|
180 |
|
181 |
+
.tools_page_wp-reset .third {
|
182 |
+
width: 32.9%;
|
183 |
+
display: inline-block;
|
184 |
+
vertical-align: top;
|
185 |
+
}
|
186 |
+
|
187 |
+
.tools_page_wp-reset .thirdx2 {
|
188 |
+
width: 65.8%;
|
189 |
+
display: inline-block;
|
190 |
+
vertical-align: top;
|
191 |
+
}
|
192 |
+
|
193 |
.tools_page_wp-reset .button.disabled {
|
194 |
pointer-events: none;
|
195 |
cursor: not-allowed;
|
201 |
border-radius: 0;
|
202 |
}
|
203 |
|
204 |
+
.tools_page_wp-reset .button-secondary:focus,
|
205 |
+
.tools_page_wp-reset .button-secondary:hover,
|
206 |
+
.tools_page_wp-reset .button.focus,
|
207 |
+
.tools_page_wp-reset .button.hover,
|
208 |
+
.tools_page_wp-reset .button:focus,
|
209 |
+
.tools_page_wp-reset .button:hover {
|
|
|
|
|
|
|
210 |
background: #fafafa;
|
211 |
border-color: #999;
|
212 |
color: #23282d;
|
265 |
z-index: 99999;
|
266 |
}
|
267 |
|
268 |
+
.tools_page_wp-reset .swal2-timer-progress-bar {
|
269 |
+
height: 0.2em;
|
270 |
+
background: #dd3036;
|
271 |
+
}
|
272 |
+
|
273 |
.tools_page_wp-reset .swal2-container .swal2-popup .swal2-actions {
|
274 |
margin: 2em auto 0;
|
275 |
}
|
305 |
|
306 |
.tools_page_wp-reset .button-delete {
|
307 |
color: #cc2f2f;
|
308 |
+
border-color: #cc2f2f;
|
309 |
+
background-color: #ffffff;
|
310 |
}
|
311 |
|
312 |
.tools_page_wp-reset .button-delete:hover,
|
387 |
margin: 1em 0;
|
388 |
}
|
389 |
|
390 |
+
.tools_page_wp-reset #reset-details td,
|
391 |
+
.tools_page_wp-reset #reset-details th {
|
392 |
+
padding: 10px 10px;
|
393 |
+
text-align: center;
|
394 |
+
}
|
395 |
+
|
396 |
+
.tools_page_wp-reset #reset-details td:first-child {
|
397 |
+
text-align: left;
|
398 |
+
}
|
399 |
+
|
400 |
.tools_page_wp-reset table td {
|
401 |
text-align: left;
|
402 |
padding: 20px 10px;
|
407 |
background-color: #f9f9f9;
|
408 |
}
|
409 |
|
410 |
+
.tools_page_wp-reset table .ss-actions,
|
411 |
+
.tools_page_wp-reset table .ss-size {
|
412 |
+
text-align: center;
|
413 |
+
white-space: nowrap;
|
414 |
+
width: 70px;
|
415 |
}
|
416 |
|
417 |
.tools_page_wp-reset table th {
|
420 |
padding: 5px;
|
421 |
}
|
422 |
|
423 |
+
.tools_page_wp-reset #reset-details tfoot th {
|
424 |
+
border-top: thin solid #444444;
|
425 |
+
border-bottom: none;
|
426 |
+
}
|
427 |
+
|
428 |
+
.tools_page_wp-reset #reset-details tbody tr:last-child td {
|
429 |
+
border-bottom: none;
|
430 |
+
}
|
431 |
+
|
432 |
+
.tools_page_wp-reset #reset-details th {
|
433 |
+
vertical-align: top;
|
434 |
+
}
|
435 |
+
|
436 |
.tools_page_wp-reset table .ss-action {
|
437 |
text-decoration: none;
|
438 |
margin: 5px 10px 5px 0;
|
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 |
}
|
626 |
|
627 |
.tools_page_wp-reset .ui-tabs-nav:after {
|
628 |
+
content: "";
|
629 |
clear: both;
|
630 |
display: block;
|
631 |
}
|
933 |
}
|
934 |
/* webhooks dialog */
|
935 |
|
936 |
+
.pro-feature {
|
937 |
+
font-weight: normal;
|
938 |
+
font-variant: small-caps;
|
939 |
+
font-style: italic;
|
940 |
+
color: inherit;
|
941 |
+
text-decoration: none;
|
942 |
+
}
|
943 |
+
|
944 |
+
.pro-feature.pro-feature-text {
|
945 |
+
font-weight: 700;
|
946 |
+
font-style: normal;
|
947 |
+
}
|
948 |
+
|
949 |
+
.pro-feature:hover {
|
950 |
+
text-decoration: underline;
|
951 |
+
cursor: pointer;
|
952 |
+
color: inherit;
|
953 |
+
}
|
954 |
+
|
955 |
+
.dropdown-item .pro-feature:hover {
|
956 |
+
text-decoration: none;
|
957 |
+
}
|
958 |
+
|
959 |
+
a.button .pro-feature:hover {
|
960 |
+
text-decoration: inherit;
|
961 |
+
cursor: inherit;
|
962 |
+
color: inherit;
|
963 |
+
}
|
964 |
+
|
965 |
+
th .pro-feature {
|
966 |
+
display: inline-block;
|
967 |
+
}
|
968 |
+
|
969 |
+
li .pro-feature {
|
970 |
+
white-space: nowrap;
|
971 |
+
}
|
972 |
+
|
973 |
+
.pro-feature .pro,
|
974 |
+
.pro-feature.pro-feature-text span {
|
975 |
+
font-weight: 700;
|
976 |
+
color: #dd3036;
|
977 |
+
}
|
978 |
+
|
979 |
+
#pricing-table tr.pricing td {
|
980 |
+
padding: 20px 10px;
|
981 |
+
line-height: 1.5;
|
982 |
+
}
|
983 |
+
|
984 |
+
#pricing-table tr td:nth-child(3),
|
985 |
+
#pricing-table tr th:nth-child(3) {
|
986 |
+
background-color: #f9f9f9;
|
987 |
+
}
|
988 |
+
|
989 |
+
#pricing-table tr.pricing td del {
|
990 |
+
text-decoration-color: #dd3036;
|
991 |
+
}
|
992 |
+
|
993 |
+
#pricing-table tr.pricing td b {
|
994 |
+
font-weight: 900;
|
995 |
+
}
|
996 |
+
|
997 |
+
#tab-pro label {
|
998 |
+
vertical-align: inherit;
|
999 |
+
font-weight: 500;
|
1000 |
+
min-width: 95px;
|
1001 |
+
display: inline-block;
|
1002 |
+
padding: 2px 0;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
#wpr-license-key {
|
1006 |
+
margin-left: 0;
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
.tools_page_wp-reset #pricing-table td,
|
1010 |
+
.tools_page_wp-reset #pricing-table th {
|
1011 |
+
padding: 10px 10px;
|
1012 |
+
text-align: center;
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
.tools_page_wp-reset #pricing-table td:first-child {
|
1016 |
+
text-align: left;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
.tools_page_wp-reset #pricing-table tfoot th {
|
1020 |
+
border-top: thin solid #444444;
|
1021 |
+
border-bottom: none;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
.tools_page_wp-reset #pricing-table tbody tr:last-child td {
|
1025 |
+
border-bottom: none;
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
.tools_page_wp-reset #pricing-table th {
|
1029 |
+
vertical-align: top;
|
1030 |
+
font-weight: normal;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
.tools_page_wp-reset #pricing-table th span {
|
1034 |
+
color: #dd3036;
|
1035 |
+
font-weight: 700;
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
/* collections */
|
1039 |
+
.tools_page_wp-reset .collection-table tr td:first-child .dashicons {
|
1040 |
+
margin-right: 8px;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
.tools_page_wp-reset .collection-table tr td:first-child {
|
1044 |
+
width: 85px;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
.tools_page_wp-reset table tr td:first-child {
|
1048 |
+
padding-left: 5px;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
.tools_page_wp-reset .collection-table td {
|
1052 |
+
padding: 10px 10px;
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
.tools_page_wp-reset table tr td:last-child {
|
1056 |
+
padding-right: 5px;
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
.tools_page_wp-reset .collection-table .actions {
|
1060 |
+
text-align: center;
|
1061 |
+
white-space: nowrap;
|
1062 |
+
width: 100px;
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
.collection-item-details span {
|
1066 |
+
display: block;
|
1067 |
+
font-weight: 500;
|
1068 |
+
}
|
1069 |
+
/* collections */
|
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 |
}
|
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 |
}
|
1127 |
|
1128 |
.icon-doc-text-inv:before {
|
1129 |
+
content: "\f15c";
|
1130 |
} /* '' */
|
1131 |
.icon-database:before {
|
1132 |
+
content: "\f1c0";
|
1133 |
} /* '' */
|
1134 |
+
|
1135 |
+
.wpr-collections-installer {
|
1136 |
+
height: 100px;
|
1137 |
+
display: block;
|
1138 |
+
overflow-y: hidden;
|
1139 |
+
overflow-x: hidden;
|
1140 |
+
position: relative;
|
1141 |
+
padding: 68px 40px;
|
1142 |
+
-webkit-mask-image: -webkit-linear-gradient(
|
1143 |
+
top,
|
1144 |
+
rgba(255, 255, 255, 0) 0%,
|
1145 |
+
rgba(255, 255, 255, 1) 38%,
|
1146 |
+
rgba(255, 255, 255, 1) 63%,
|
1147 |
+
rgba(255, 255, 255, 0) 100%
|
1148 |
+
);
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
.wpr-collections-installer-errors {
|
1152 |
+
overflow-y: auto;
|
1153 |
+
overflow-x: hidden;
|
1154 |
+
position: relative;
|
1155 |
+
padding: 0px 40px;
|
1156 |
+
max-height: 200px;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
.wpr-collections-installer::-webkit-scrollbar,
|
1160 |
+
.wpr-collections-installer-errors::-webkit-scrollbar {
|
1161 |
+
height: 12px;
|
1162 |
+
width: 6px;
|
1163 |
+
background: #ccc;
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
.wpr-collections-installer::-webkit-scrollbar-thumb,
|
1167 |
+
.wpr-collections-installer-errors::-webkit-scrollbar-thumb {
|
1168 |
+
background: #dd3036;
|
1169 |
+
-webkit-border-radius: 1ex;
|
1170 |
+
-webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
.wpr-collections-installer::-webkit-scrollbar-corner,
|
1174 |
+
.wpr-collections-installer-errors::-webkit-scrollbar-corner {
|
1175 |
+
background: #ccc;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
.wpr-collections-installer-message {
|
1179 |
+
text-align: left;
|
1180 |
+
position: relative;
|
1181 |
+
margin: 20px 0;
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
.wpr-collections-error {
|
1185 |
+
position: absolute;
|
1186 |
+
color: #f00;
|
1187 |
+
font-size: 12px;
|
1188 |
+
left: 24px;
|
1189 |
+
bottom: -14px;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
.wpr-collections-installer-message .dashicons {
|
1193 |
+
vertical-align: text-top;
|
1194 |
+
line-height: 24px;
|
1195 |
+
height: 24px;
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
.wpr-collections-installer-loading .dashicons:before {
|
1199 |
+
content: "\f463";
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
.wpr-collections-installer-loading .dashicons {
|
1203 |
+
-webkit-animation: wpr_rspin 1.5s linear infinite;
|
1204 |
+
-moz-animation: wpr_rspin 1.5s linear infinite;
|
1205 |
+
animation: wpr_rspin 1.5s linear infinite;
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
.wpr-collections-installer-done {
|
1209 |
+
opacity: 1;
|
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 |
+
|
1222 |
+
@-moz-keyframes wpr_rspin {
|
1223 |
+
100% {
|
1224 |
+
-moz-transform: rotate(360deg);
|
1225 |
+
}
|
1226 |
+
}
|
1227 |
+
@-webkit-keyframes wpr_rspin {
|
1228 |
+
100% {
|
1229 |
+
-webkit-transform: rotate(360deg);
|
1230 |
+
}
|
1231 |
+
}
|
1232 |
+
@keyframes wpr_rspin {
|
1233 |
+
100% {
|
1234 |
+
-webkit-transform: rotate(360deg);
|
1235 |
+
transform: rotate(360deg);
|
1236 |
+
}
|
1237 |
+
}
|
js/wf-licensing.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WebFactory Licensing Manager
|
3 |
+
* (c) WebFactory Ltd
|
4 |
+
* www.webfactoryltd.com
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
function wf_licensing_verify_licence_ajax(prefix, license_key, button) {
|
9 |
+
data = window['wf_licensing_' + prefix];
|
10 |
+
if (!data) {
|
11 |
+
alert('Licensing data is missing. Please reload the page and try again.');
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
jQuery(button).addClass('loading');
|
16 |
+
|
17 |
+
jQuery
|
18 |
+
.post(
|
19 |
+
ajaxurl,
|
20 |
+
{
|
21 |
+
action: 'wf_licensing_' + prefix + '_validate',
|
22 |
+
license_key: license_key,
|
23 |
+
_ajax_nonce: data.nonce,
|
24 |
+
_rand: Math.floor(Math.random() * 9999) + 1
|
25 |
+
},
|
26 |
+
function (response) {
|
27 |
+
if (data.debug) {
|
28 |
+
console.log('Validate license, first try: ', response);
|
29 |
+
}
|
30 |
+
if (response.success) {
|
31 |
+
location.reload();
|
32 |
+
} else {
|
33 |
+
alert('Unable to contact licensing server. Please try again in a few moments or contact support.');
|
34 |
+
}
|
35 |
+
}
|
36 |
+
)
|
37 |
+
.fail(function () {
|
38 |
+
alert('Undocumented error. Please reload the page and try again.');
|
39 |
+
})
|
40 |
+
.always(function () {
|
41 |
+
jQuery(button).removeClass('loading');
|
42 |
+
jQuery(window).trigger('wf_licensing:ajax_always');
|
43 |
+
});
|
44 |
+
} // wf_licensing_verify_licence_ajax
|
45 |
+
|
46 |
+
|
47 |
+
function wf_licensing_deactivate_licence_ajax(prefix, license_key, button) {
|
48 |
+
data = window['wf_licensing_' + prefix];
|
49 |
+
if (!data) {
|
50 |
+
alert('Licensing data is missing. Please reload the page and try again.');
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
jQuery(button).addClass('loading');
|
55 |
+
|
56 |
+
jQuery
|
57 |
+
.post(
|
58 |
+
ajaxurl,
|
59 |
+
{
|
60 |
+
action: 'wf_licensing_' + prefix + '_deactivate',
|
61 |
+
license_key: license_key,
|
62 |
+
_ajax_nonce: data.nonce,
|
63 |
+
_rand: Math.floor(Math.random() * 9999) + 1
|
64 |
+
},
|
65 |
+
function (response) {
|
66 |
+
if (data.debug) {
|
67 |
+
console.log('Deactivate license, first try: ', response);
|
68 |
+
}
|
69 |
+
if (response.success) {
|
70 |
+
location.reload();
|
71 |
+
} else {
|
72 |
+
alert('Unable to contact licensing server. Please try again in a few moments or contact support.');
|
73 |
+
}
|
74 |
+
}
|
75 |
+
)
|
76 |
+
.fail(function () {
|
77 |
+
alert('Undocumented error. Please reload the page and try again.');
|
78 |
+
})
|
79 |
+
.always(function () {
|
80 |
+
jQuery(button).removeClass('loading');
|
81 |
+
jQuery(window).trigger('wf_licensing:ajax_always');
|
82 |
+
});
|
83 |
+
} // wf_licensing_deactivate_licence_ajax
|
js/wp-reset-libs.min.js
CHANGED
@@ -8,9 +8,12 @@
|
|
8 |
|
9 |
|
10 |
/*
|
11 |
-
|
12 |
-
https://github.com/
|
13 |
MIT License
|
14 |
*/
|
15 |
|
16 |
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";var q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=function(){function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i=function e(t,n,o){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,o)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(o):void 0},a=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},u=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},M=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{!o&&s.return&&s.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},t="SweetAlert2:",B=function(e){console.warn(t+" "+e)},H=function(e){console.error(t+" "+e)},n=[],l=function(e){-1===n.indexOf(e)&&(n.push(e),B(e))},I=function(e){return"function"==typeof e?e():e},R=function(e){return"object"===(void 0===e?"undefined":q(e))&&"function"==typeof e.then},e=Object.freeze({cancel:"cancel",backdrop:"overlay",close:"close",esc:"esc",timer:"timer"}),c=function(e){var t={};for(var n in e)t[e[n]]="swal2-"+e[n];return t},D=c(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","toast","toast-shown","fade","show","hide","noanimation","close","title","header","content","actions","confirm","cancel","footer","icon","icon-text","image","input","has-input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen"]),E=c(["success","warning","info","question","error"]),d={previousBodyPadding:null},p=function(e,t){return!!e.classList&&e.classList.contains(t)},N=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},f=function(e,t,n){e&&t&&("string"==typeof t&&(t=t.split(/\s+/).filter(Boolean)),t.forEach(function(t){e.forEach?e.forEach(function(e){n?e.classList.add(t):e.classList.remove(t)}):n?e.classList.add(t):e.classList.remove(t)}))},W=function(e,t){f(e,t,!0)},P=function(e,t){f(e,t,!1)},z=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(p(e.childNodes[n],t))return e.childNodes[n]},U=function(e){e.style.opacity="",e.style.display=e.id===D.content?"block":"flex"},F=function(e){e.style.opacity="",e.style.display="none"},S=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},K=function(e){return e&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},O=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},L=function(){return document.body.querySelector("."+D.container)},m=function(e){var t=L();return t?t.querySelector("."+e):null},Z=function(){return m(D.popup)},Q=function(){var e=Z();return Array.prototype.slice.call(e.querySelectorAll("."+D.icon))},Y=function(){return m(D.title)},$=function(){return m(D.content)},J=function(){return m(D.image)},X=function(){return m(D.progresssteps)},G=function(){return m(D.confirm)},ee=function(){return m(D.cancel)},te=function(){return m(D.actions)},ne=function(){return m(D.footer)},oe=function(){return m(D.close)},re=function(){var e=Array.prototype.slice.call(Z().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(e,t){return e=parseInt(e.getAttribute("tabindex")),(t=parseInt(t.getAttribute("tabindex")))<e?1:e<t?-1:0}),t=Array.prototype.slice.call(Z().querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable], audio[controls], video[controls]'));return function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(e.concat(t))},h=function(){return!document.body.classList.contains(D["toast-shown"])},g=function(){return document.body.classList.contains(D["toast-shown"])},v=function(){return"undefined"==typeof window||"undefined"==typeof document},y=('\n <div aria-labelledby="'+D.title+'" aria-describedby="'+D.content+'" class="'+D.popup+'" tabindex="-1">\n <div class="'+D.header+'">\n <ul class="'+D.progresssteps+'"></ul>\n <div class="'+D.icon+" "+E.error+'">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="'+D.icon+" "+E.question+'">\n <span class="'+D["icon-text"]+'">?</span>\n </div>\n <div class="'+D.icon+" "+E.warning+'">\n <span class="'+D["icon-text"]+'">!</span>\n </div>\n <div class="'+D.icon+" "+E.info+'">\n <span class="'+D["icon-text"]+'">i</span>\n </div>\n <div class="'+D.icon+" "+E.success+'">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="'+D.image+'" />\n <h2 class="'+D.title+'" id="'+D.title+'"></h2>\n <button type="button" class="'+D.close+'">×</button>\n </div>\n <div class="'+D.content+'">\n <div id="'+D.content+'"></div>\n <input class="'+D.input+'" />\n <input type="file" class="'+D.file+'" />\n <div class="'+D.range+'">\n <input type="range" />\n <output></output>\n </div>\n <select class="'+D.select+'"></select>\n <div class="'+D.radio+'"></div>\n <label for="'+D.checkbox+'" class="'+D.checkbox+'">\n <input type="checkbox" />\n </label>\n <textarea class="'+D.textarea+'"></textarea>\n <div class="'+D.validationerror+'" id="'+D.validationerror+'"></div>\n </div>\n <div class="'+D.actions+'">\n <button type="button" class="'+D.confirm+'">OK</button>\n <button type="button" class="'+D.cancel+'">Cancel</button>\n </div>\n <div class="'+D.footer+'">\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),ie=function(e){var t=L();if(t&&(t.parentNode.removeChild(t),P([document.documentElement,document.body],[D["no-backdrop"],D["has-input"],D["toast-shown"]])),!v()){var n=document.createElement("div");n.className=D.container,n.innerHTML=y,("string"==typeof e.target?document.querySelector(e.target):e.target).appendChild(n);var o=Z(),r=$(),i=z(r,D.input),a=z(r,D.file),s=r.querySelector("."+D.range+" input"),u=r.querySelector("."+D.range+" output"),l=z(r,D.select),c=r.querySelector("."+D.checkbox+" input"),d=z(r,D.textarea);o.setAttribute("role",e.toast?"alert":"dialog"),o.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||o.setAttribute("aria-modal","true");var p=void 0,f=function(e){Ae.isVisible()&&p!==e.target.value&&Ae.resetValidationError(),p=e.target.value};return i.oninput=f,a.onchange=f,l.onchange=f,c.onchange=f,d.oninput=f,s.oninput=function(e){f(e),u.value=s.value},s.onchange=function(e){f(e),s.nextSibling.value=s.value},o}H("SweetAlert2 requires document to initialize")},ae=function(e,t){if(!e)return F(t);if("object"===(void 0===e?"undefined":q(e)))if(t.innerHTML="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0));else e&&(t.innerHTML=e);U(t)},b=function(){if(v())return!1;var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),w=function(){null===d.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(d.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=d.previousBodyPadding+function(){if("ontouchstart"in window||navigator.msMaxTouchPoints)return 0;var e=document.createElement("div");e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}()+"px")},se={},C=function(e,n){var o=L(),t=Z();if(t){null!==e&&"function"==typeof e&&e(t),P(t,D.show),W(t,D.hide);var r=function(){var e,t;g()||(e=window.scrollX,t=window.scrollY,se.restoreFocusTimeout=setTimeout(function(){se.previousActiveElement&&se.previousActiveElement.focus&&(se.previousActiveElement.focus(),se.previousActiveElement=null)},100),void 0!==e&&void 0!==t&&window.scrollTo(e,t),se.keydownTarget.removeEventListener("keydown",se.keydownHandler,{capture:se.keydownListenerCapture}),se.keydownHandlerAdded=!1),o.parentNode&&o.parentNode.removeChild(o),P([document.documentElement,document.body],[D.shown,D["height-auto"],D["no-backdrop"],D["has-input"],D["toast-shown"]]),h()&&(null!==d.previousBodyPadding&&(document.body.style.paddingRight=d.previousBodyPadding,d.previousBodyPadding=null),function(){if(p(document.body,D.iosfix)){var e=parseInt(document.body.style.top,10);P(document.body,D.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}}()),null!==n&&"function"==typeof n&&setTimeout(function(){n()})};b&&!p(t,D.noanimation)?t.addEventListener(b,function e(){t.removeEventListener(b,e),p(t,D.hide)&&r()}):r()}};function k(e){var t=function e(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(n)));Object.getPrototypeOf(e).apply(this,n)};return t.prototype=r(Object.create(e.prototype),{constructor:t}),"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var x={title:"",titleText:"",text:"",html:"",footer:"",type:null,toast:!1,customClass:"",target:"body",backdrop:!0,animation:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:null,confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:null,cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageAlt:"",imageClass:null,timer:null,width:null,padding:null,background:null,input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,grow:!1,position:"center",progressSteps:[],currentProgressStep:null,progressStepsDistance:null,onBeforeOpen:null,onAfterClose:null,onOpen:null,onClose:null,useRejections:!1,expectRejections:!1},A=["useRejections","expectRejections"],T=function(e){return x.hasOwnProperty(e)||"extraParams"===e},j=function(e){return-1!==A.indexOf(e)},ue=function(e){for(var t in e)T(t)||B('Unknown parameter "'+t+'"'),j(t)&&l('The parameter "'+t+'" is deprecated and will be removed in the next major release.')},_='"setDefaults" & "resetDefaults" methods are deprecated in favor of "mixin" method and will be removed in the next major release. For new projects, use "mixin". For past projects already using "setDefaults", support will be provided through an additional package.',V={};var le=[],ce=function(){var e=Z();e||Ae(""),e=Z();var t=te(),n=G(),o=ee();U(t),U(n),W([e,t],D.loading),n.disabled=!0,o.disabled=!0,e.setAttribute("data-loading",!0),e.setAttribute("aria-busy",!0),e.focus()},de=Object.freeze({isValidParameter:T,isDeprecatedParameter:j,argsToParams:function(n){var o={};switch(q(n[0])){case"string":["title","html","type"].forEach(function(e,t){switch(q(n[t])){case"string":o[e]=n[t];break;case"undefined":break;default:H("Unexpected type of "+e+'! Expected "string", got '+q(n[t]))}});break;case"object":r(o,n[0]);break;default:return H('Unexpected type of argument! Expected "string" or "object", got '+q(n[0])),!1}return o},adaptInputValidator:function(n){return function(e,t){return n.call(this,e,t).then(function(){},function(e){return e})}},close:C,closePopup:C,closeModal:C,closeToast:C,isVisible:function(){return!!Z()},clickConfirm:function(){return G().click()},clickCancel:function(){return ee().click()},getPopup:Z,getTitle:Y,getContent:$,getImage:J,getIcons:Q,getButtonsWrapper:function(){return l("swal.getButtonsWrapper() is deprecated and will be removed in the next major release, use swal.getActions() instead"),m(D.actions)},getActions:te,getConfirmButton:G,getCancelButton:ee,getFooter:ne,isLoading:function(){return Z().hasAttribute("data-loading")},fire:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(this,[null].concat(t)))},mixin:function(n){return k(function(e){function t(){return s(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),o(t,[{key:"_main",value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_main",this).call(this,r({},n,e))}}]),t}(this))},queue:function(e){var i=this;le=e;var a=function(){le=[],document.body.removeAttribute("data-swal2-queue-step")},s=[];return new Promise(function(r,e){!function t(n,o){n<le.length?(document.body.setAttribute("data-swal2-queue-step",n),i(le[n]).then(function(e){void 0!==e.value?(s.push(e.value),t(n+1,o)):(a(),r({dismiss:e.dismiss}))})):(a(),r({value:s}))}(0)})},getQueueStep:function(){return document.body.getAttribute("data-swal2-queue-step")},insertQueueStep:function(e,t){return t&&t<le.length?le.splice(t,0,e):le.push(e)},deleteQueueStep:function(e){void 0!==le[e]&&le.splice(e,1)},showLoading:ce,enableLoading:ce,getTimerLeft:function(){return se.timeout&&se.timeout.getTimerLeft()}}),pe="function"==typeof Symbol?Symbol:function(){var t=0;function e(e){return"__"+e+"_"+Math.floor(1e9*Math.random())+"_"+ ++t+"__"}return e.iterator=e("Symbol.iterator"),e}(),fe="function"==typeof WeakMap?WeakMap:function(n,o,t){function e(){o(this,n,{value:pe("WeakMap")})}return e.prototype={delete:function(e){delete e[this[n]]},get:function(e){return e[this[n]]},has:function(e){return t.call(e,this[n])},set:function(e,t){o(e,this[n],{configurable:!0,value:t})}},e}(pe("WeakMap"),Object.defineProperty,{}.hasOwnProperty),me={promise:new fe,innerParams:new fe,domCache:new fe};function he(){var e=me.innerParams.get(this),t=me.domCache.get(this);e.showConfirmButton||(F(t.confirmButton),e.showCancelButton||F(t.actions)),P([t.popup,t.actions],D.loading),t.popup.removeAttribute("aria-busy"),t.popup.removeAttribute("data-loading"),t.confirmButton.disabled=!1,t.cancelButton.disabled=!1}var ge=function e(t,n){var o,r,i;s(this,e);var a=n;this.start=function(){i=!0,r=new Date,o=setTimeout(t,a)},this.stop=function(){i=!1,clearTimeout(o),a-=new Date-r},this.getTimerLeft=function(){return i&&(this.stop(),this.start()),a},this.getStateRunning=function(){return i},this.start()},ve={email:function(e,t){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.reject(t&&t.validationMessage?t.validationMessage:"Invalid email address")},url:function(e,t){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/.test(e)?Promise.resolve():Promise.reject(t&&t.validationMessage?t.validationMessage:"Invalid URL")}};var ye=function(e){var t=L(),n=Z();null!==e.onBeforeOpen&&"function"==typeof e.onBeforeOpen&&e.onBeforeOpen(n),e.animation?(W(n,D.show),W(t,D.fade),P(n,D.hide)):P(n,D.fade),U(n),t.style.overflowY="hidden",b&&!p(n,D.noanimation)?n.addEventListener(b,function e(){n.removeEventListener(b,e),t.style.overflowY="auto"}):t.style.overflowY="auto",W([document.documentElement,document.body,t],D.shown),e.heightAuto&&e.backdrop&&!e.toast&&W([document.documentElement,document.body],D["height-auto"]),h()&&(w(),function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!p(document.body,D.iosfix)){var e=document.body.scrollTop;document.body.style.top=-1*e+"px",W(document.body,D.iosfix)}}()),g()||se.previousActiveElement||(se.previousActiveElement=document.activeElement),null!==e.onOpen&&"function"==typeof e.onOpen&&setTimeout(function(){e.onOpen(n)})};var be=Object.freeze({hideLoading:he,disableLoading:he,getInput:function(e){var t=me.innerParams.get(this),n=me.domCache.get(this);if(!(e=e||t.input))return null;switch(e){case"select":case"textarea":case"file":return z(n.content,D[e]);case"checkbox":return n.popup.querySelector("."+D.checkbox+" input");case"radio":return n.popup.querySelector("."+D.radio+" input:checked")||n.popup.querySelector("."+D.radio+" input:first-child");case"range":return n.popup.querySelector("."+D.range+" input");default:return z(n.content,D.input)}},enableButtons:function(){var e=me.domCache.get(this);e.confirmButton.disabled=!1,e.cancelButton.disabled=!1},disableButtons:function(){var e=me.domCache.get(this);e.confirmButton.disabled=!0,e.cancelButton.disabled=!0},enableConfirmButton:function(){me.domCache.get(this).confirmButton.disabled=!1},disableConfirmButton:function(){me.domCache.get(this).confirmButton.disabled=!0},enableInput:function(){var e=this.getInput();if(!e)return!1;if("radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!1;else e.disabled=!1},disableInput:function(){var e=this.getInput();if(!e)return!1;if(e&&"radio"===e.type)for(var t=e.parentNode.parentNode.querySelectorAll("input"),n=0;n<t.length;n++)t[n].disabled=!0;else e.disabled=!0},showValidationError:function(e){var t=me.domCache.get(this);t.validationError.innerHTML=e;var n=window.getComputedStyle(t.popup);t.validationError.style.marginLeft="-"+n.getPropertyValue("padding-left"),t.validationError.style.marginRight="-"+n.getPropertyValue("padding-right"),U(t.validationError);var o=this.getInput();o&&(o.setAttribute("aria-invalid",!0),o.setAttribute("aria-describedBy",D.validationerror),N(o),W(o,D.inputerror))},resetValidationError:function(){var e=me.domCache.get(this);e.validationError&&F(e.validationError);var t=this.getInput();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedBy"),P(t,D.inputerror))},_main:function(e){var T=this;ue(e);var j=r({},x,e);!function(r){r.inputValidator||Object.keys(ve).forEach(function(e){r.input===e&&(r.inputValidator=r.expectRejections?ve[e]:Ae.adaptInputValidator(ve[e]))}),(!r.target||"string"==typeof r.target&&!document.querySelector(r.target)||"string"!=typeof r.target&&!r.target.appendChild)&&(B('Target parameter is not valid, defaulting to "body"'),r.target="body");var e=void 0,t=Z(),n="string"==typeof r.target?document.querySelector(r.target):r.target;e=t&&n&&t.parentNode!==n.parentNode?ie(r):t||ie(r),r.width&&(e.style.width="number"==typeof r.width?r.width+"px":r.width),r.padding&&(e.style.padding="number"==typeof r.padding?r.padding+"px":r.padding),r.background&&(e.style.background=r.background);for(var o=window.getComputedStyle(e).getPropertyValue("background-color"),i=e.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),a=0;a<i.length;a++)i[a].style.backgroundColor=o;var s=L(),u=Y(),l=$().querySelector("#"+D.content),c=te(),d=G(),p=ee(),f=oe(),m=ne();if(r.titleText?u.innerText=r.titleText:r.title&&(u.innerHTML=r.title.split("\n").join("<br />")),"string"==typeof r.backdrop?L().style.background=r.backdrop:r.backdrop||W([document.documentElement,document.body],D["no-backdrop"]),r.html?ae(r.html,l):r.text?(l.textContent=r.text,U(l)):F(l),r.position in D?W(s,D[r.position]):(B('The "position" parameter is not valid, defaulting to "center"'),W(s,D.center)),r.grow&&"string"==typeof r.grow){var h="grow-"+r.grow;h in D&&W(s,D[h])}"function"==typeof r.animation&&(r.animation=r.animation.call()),r.showCloseButton?(f.setAttribute("aria-label",r.closeButtonAriaLabel),U(f)):F(f),e.className=D.popup,r.toast?(W([document.documentElement,document.body],D["toast-shown"]),W(e,D.toast)):W(e,D.modal),r.customClass&&W(e,r.customClass);var g=X(),v=parseInt(null===r.currentProgressStep?Ae.getQueueStep():r.currentProgressStep,10);r.progressSteps&&r.progressSteps.length?(U(g),S(g),v>=r.progressSteps.length&&B("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),r.progressSteps.forEach(function(e,t){var n=document.createElement("li");if(W(n,D.progresscircle),n.innerHTML=e,t===v&&W(n,D.activeprogressstep),g.appendChild(n),t!==r.progressSteps.length-1){var o=document.createElement("li");W(o,D.progressline),r.progressStepsDistance&&(o.style.width=r.progressStepsDistance),g.appendChild(o)}})):F(g);for(var y=Q(),b=0;b<y.length;b++)F(y[b]);if(r.type){var w=!1;for(var C in E)if(r.type===C){w=!0;break}if(!w)return H("Unknown alert type: "+r.type);var k=e.querySelector("."+D.icon+"."+E[r.type]);U(k),r.animation&&W(k,"swal2-animate-"+r.type+"-icon")}var x=J();if(r.imageUrl?(x.setAttribute("src",r.imageUrl),x.setAttribute("alt",r.imageAlt),U(x),r.imageWidth?x.setAttribute("width",r.imageWidth):x.removeAttribute("width"),r.imageHeight?x.setAttribute("height",r.imageHeight):x.removeAttribute("height"),x.className=D.image,r.imageClass&&W(x,r.imageClass)):F(x),r.showCancelButton?p.style.display="inline-block":F(p),r.showConfirmButton?O(d,"display"):F(d),r.showConfirmButton||r.showCancelButton?U(c):F(c),d.innerHTML=r.confirmButtonText,p.innerHTML=r.cancelButtonText,d.setAttribute("aria-label",r.confirmButtonAriaLabel),p.setAttribute("aria-label",r.cancelButtonAriaLabel),d.className=D.confirm,W(d,r.confirmButtonClass),p.className=D.cancel,W(p,r.cancelButtonClass),r.buttonsStyling){W([d,p],D.styled),r.confirmButtonColor&&(d.style.backgroundColor=r.confirmButtonColor),r.cancelButtonColor&&(p.style.backgroundColor=r.cancelButtonColor);var A=window.getComputedStyle(d).getPropertyValue("background-color");d.style.borderLeftColor=A,d.style.borderRightColor=A}else P([d,p],D.styled),d.style.backgroundColor=d.style.borderLeftColor=d.style.borderRightColor="",p.style.backgroundColor=p.style.borderLeftColor=p.style.borderRightColor="";ae(r.footer,m),!0===r.animation?P(e,D.noanimation):W(e,D.noanimation),r.showLoaderOnConfirm&&!r.preConfirm&&B("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request")}(j),Object.freeze(j),me.innerParams.set(this,j),se.timeout&&(se.timeout.stop(),delete se.timeout),clearTimeout(se.restoreFocusTimeout);var _={popup:Z(),container:L(),content:$(),actions:te(),confirmButton:G(),cancelButton:ee(),closeButton:oe(),validationError:m(D.validationerror),progressSteps:X()};me.domCache.set(this,_);var V=this.constructor;return new Promise(function(t,n){var o=function(e){V.closePopup(j.onClose,j.onAfterClose),j.useRejections?t(e):t({value:e})},l=function(e){V.closePopup(j.onClose,j.onAfterClose),j.useRejections?n(e):t({dismiss:e})},c=function(e){V.closePopup(j.onClose,j.onAfterClose),n(e)};j.timer&&(se.timeout=new ge(function(){l("timer"),delete se.timeout},j.timer)),j.input&&setTimeout(function(){var e=T.getInput();e&&N(e)},0);for(var d=function(t){if(j.showLoaderOnConfirm&&V.showLoading(),j.preConfirm){T.resetValidationError();var e=Promise.resolve().then(function(){return j.preConfirm(t,j.extraParams)});j.expectRejections?e.then(function(e){return o(e||t)},function(e){T.hideLoading(),e&&T.showValidationError(e)}):e.then(function(e){K(_.validationError)||!1===e?T.hideLoading():o(e||t)},function(e){return c(e)})}else o(t)},e=function(e){var t=e||window.event,n=t.target||t.srcElement,o=_.confirmButton,r=_.cancelButton,i=o&&(o===n||o.contains(n)),a=r&&(r===n||r.contains(n));switch(t.type){case"click":if(i&&V.isVisible())if(T.disableButtons(),j.input){var s=function(){var e=T.getInput();if(!e)return null;switch(j.input){case"checkbox":return e.checked?1:0;case"radio":return e.checked?e.value:null;case"file":return e.files.length?e.files[0]:null;default:return j.inputAutoTrim?e.value.trim():e.value}}();if(j.inputValidator){T.disableInput();var u=Promise.resolve().then(function(){return j.inputValidator(s,j.extraParams)});j.expectRejections?u.then(function(){T.enableButtons(),T.enableInput(),d(s)},function(e){T.enableButtons(),T.enableInput(),e&&T.showValidationError(e)}):u.then(function(e){T.enableButtons(),T.enableInput(),e?T.showValidationError(e):d(s)},function(e){return c(e)})}else d(s)}else d(!0);else a&&V.isVisible()&&(T.disableButtons(),l(V.DismissReason.cancel))}},r=_.popup.querySelectorAll("button"),i=0;i<r.length;i++)r[i].onclick=e,r[i].onmouseover=e,r[i].onmouseout=e,r[i].onmousedown=e;if(_.closeButton.onclick=function(){l(V.DismissReason.close)},j.toast)_.popup.onclick=function(e){j.showConfirmButton||j.showCancelButton||j.showCloseButton||j.input||(V.closePopup(j.onClose,j.onAfterClose),l(V.DismissReason.close))};else{var a=!1;_.popup.onmousedown=function(){_.container.onmouseup=function(e){_.container.onmouseup=void 0,e.target===_.container&&(a=!0)}},_.container.onmousedown=function(){_.popup.onmouseup=function(e){_.popup.onmouseup=void 0,(e.target===_.popup||_.popup.contains(e.target))&&(a=!0)}},_.container.onclick=function(e){a?a=!1:e.target===_.container&&I(j.allowOutsideClick)&&l(V.DismissReason.backdrop)}}j.reverseButtons?_.confirmButton.parentNode.insertBefore(_.cancelButton,_.confirmButton):_.confirmButton.parentNode.insertBefore(_.confirmButton,_.cancelButton);var s=function(e,t){for(var n=re(j.focusCancel),o=0;o<n.length;o++){(e+=t)===n.length?e=0:-1===e&&(e=n.length-1);var r=n[e];if(K(r))return r.focus()}_.popup.focus()};se.keydownHandlerAdded&&(se.keydownTarget.removeEventListener("keydown",se.keydownHandler,{capture:se.keydownListenerCapture}),se.keydownHandlerAdded=!1),j.toast||(se.keydownHandler=function(e){return function(e,t){if(t.stopKeydownPropagation&&e.stopPropagation(),"Enter"!==e.key||e.isComposing)if("Tab"===e.key){for(var n=e.target||e.srcElement,o=re(t.focusCancel),r=-1,i=0;i<o.length;i++)if(n===o[i]){r=i;break}e.shiftKey?s(r,-1):s(r,1),e.stopPropagation(),e.preventDefault()}else-1!==["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"].indexOf(e.key)?document.activeElement===_.confirmButton&&K(_.cancelButton)?_.cancelButton.focus():document.activeElement===_.cancelButton&&K(_.confirmButton)&&_.confirmButton.focus():"Escape"!==e.key&&"Esc"!==e.key||!0!==I(t.allowEscapeKey)||l(V.DismissReason.esc);else if(e.target&&T.getInput()&&e.target.outerHTML===T.getInput().outerHTML){if(-1!==["textarea","file"].indexOf(t.input))return;V.clickConfirm(),e.preventDefault()}}(e,j)},se.keydownTarget=j.keydownListenerCapture?window:_.popup,se.keydownListenerCapture=j.keydownListenerCapture,se.keydownTarget.addEventListener("keydown",se.keydownHandler,{capture:se.keydownListenerCapture}),se.keydownHandlerAdded=!0),T.enableButtons(),T.hideLoading(),T.resetValidationError(),j.input&&W(document.body,D["has-input"]);for(var u=["input","file","range","select","radio","checkbox","textarea"],p=void 0,f=0;f<u.length;f++){var m=D[u[f]],h=z(_.content,m);if(p=T.getInput(u[f])){for(var g in p.attributes)if(p.attributes.hasOwnProperty(g)){var v=p.attributes[g].name;"type"!==v&&"value"!==v&&p.removeAttribute(v)}for(var y in j.inputAttributes)p.setAttribute(y,j.inputAttributes[y])}h.className=m,j.inputClass&&W(h,j.inputClass),F(h)}var b=void 0;switch(j.input){case"text":case"email":case"password":case"number":case"tel":case"url":(p=z(_.content,D.input)).value=j.inputValue,p.placeholder=j.inputPlaceholder,p.type=j.input,U(p);break;case"file":(p=z(_.content,D.file)).placeholder=j.inputPlaceholder,p.type=j.input,U(p);break;case"range":var w=z(_.content,D.range),C=w.querySelector("input"),k=w.querySelector("output");C.value=j.inputValue,C.type=j.input,k.value=j.inputValue,U(w);break;case"select":var x=z(_.content,D.select);if(x.innerHTML="",j.inputPlaceholder){var A=document.createElement("option");A.innerHTML=j.inputPlaceholder,A.value="",A.disabled=!0,A.selected=!0,x.appendChild(A)}b=function(e){e.forEach(function(e){var t=M(e,2),n=t[0],o=t[1],r=document.createElement("option");r.value=n,r.innerHTML=o,j.inputValue.toString()===n.toString()&&(r.selected=!0),x.appendChild(r)}),U(x),x.focus()};break;case"radio":var B=z(_.content,D.radio);B.innerHTML="",b=function(e){e.forEach(function(e){var t=M(e,2),n=t[0],o=t[1],r=document.createElement("input"),i=document.createElement("label");r.type="radio",r.name=D.radio,r.value=n,j.inputValue.toString()===n.toString()&&(r.checked=!0),i.innerHTML=o,i.insertBefore(r,i.firstChild),B.appendChild(i)}),U(B);var t=B.querySelectorAll("input");t.length&&t[0].focus()};break;case"checkbox":var E=z(_.content,D.checkbox),P=T.getInput("checkbox");P.type="checkbox",P.value=1,P.id=D.checkbox,P.checked=Boolean(j.inputValue);var S=E.getElementsByTagName("span");S.length&&E.removeChild(S[0]),(S=document.createElement("span")).innerHTML=j.inputPlaceholder,E.appendChild(S),U(E);break;case"textarea":var O=z(_.content,D.textarea);O.value=j.inputValue,O.placeholder=j.inputPlaceholder,U(O);break;case null:break;default:H('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'+j.input+'"')}if("select"===j.input||"radio"===j.input){var L=function(e){return b((t=e,n=[],"undefined"!=typeof Map&&t instanceof Map?t.forEach(function(e,t){n.push([t,e])}):Object.keys(t).forEach(function(e){n.push([e,t[e]])}),n));var t,n};R(j.inputOptions)?(V.showLoading(),j.inputOptions.then(function(e){T.hideLoading(),L(e)})):"object"===q(j.inputOptions)?L(j.inputOptions):H("Unexpected type of inputOptions! Expected object, Map or Promise, got "+q(j.inputOptions))}else-1!==["text","email","number","tel","textarea"].indexOf(j.input)&&R(j.inputValue)&&(V.showLoading(),F(p),j.inputValue.then(function(e){p.value="number"===j.input?parseFloat(e)||0:e+"",U(p),T.hideLoading()}).catch(function(e){H("Error in inputValue promise: "+e),p.value="",U(p),T.hideLoading()}));ye(j),j.toast||(I(j.allowEnterKey)?j.focusCancel&&K(_.cancelButton)?_.cancelButton.focus():j.focusConfirm&&K(_.confirmButton)?_.confirmButton.focus():s(-1,1):document.activeElement&&document.activeElement.blur()),_.container.scrollTop=0})}}),we=void 0;function Ce(){if("undefined"!=typeof window){"undefined"==typeof Promise&&H("This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)");for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(void 0===t[0])return H("SweetAlert2 expects at least 1 attribute!"),!1;we=this;var o=Object.freeze(this.constructor.argsToParams(t));Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0}});var r=this._main(this.params);me.promise.set(this,r)}}Ce.prototype.then=function(e,t){return me.promise.get(this).then(e,t)},Ce.prototype.catch=function(e){return me.promise.get(this).catch(e)},Ce.prototype.finally=function(e){return me.promise.get(this).finally(e)},r(Ce.prototype,be),r(Ce,de),Object.keys(be).forEach(function(t){Ce[t]=function(){var e;if(we)return(e=we)[t].apply(e,arguments)}}),Ce.DismissReason=e,Ce.noop=function(){},Ce.version="7.25.0";var ke,xe,Ae=k((ke=Ce,xe=function(e){function t(){return s(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,ke),o(t,[{key:"_main",value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_main",this).call(this,r({},V,e))}}],[{key:"setDefaults",value:function(t){if(l(_),!t||"object"!==(void 0===t?"undefined":q(t)))throw new TypeError("SweetAlert2: The argument for setDefaults() is required and has to be a object");ue(t),Object.keys(t).forEach(function(e){ke.isValidParameter(e)&&(V[e]=t[e])})}},{key:"resetDefaults",value:function(){l(_),V={}}}]),t}(),"undefined"!=typeof window&&"object"===q(window._swalDefaults)&&xe.setDefaults(window._swalDefaults),xe));return Ae.default=Ae}),"undefined"!=typeof window&&window.Sweetalert2&&(window.swal=window.sweetAlert=window.Swal=window.SweetAlert=window.Sweetalert2);
|
|
|
|
|
|
8 |
|
9 |
|
10 |
/*
|
11 |
+
WPR_Sweetalert2
|
12 |
+
https://github.com/Sweetalert2/Sweetalert2
|
13 |
MIT License
|
14 |
*/
|
15 |
|
16 |
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).wpr_Sweetalert2=e()}(this,function(){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e,n){return(l=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(t){return}}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&u(i,n.prototype),i}).apply(null,arguments)}function d(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t,e,n){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function f(e){return Object.keys(e).map(function(t){return e[t]})}function m(t){return Array.prototype.slice.call(t)}function v(t){console.error("".concat(V," ").concat(t))}function h(t,e){var n;n='"'.concat(t,'" is deprecated and will be removed in the next major release. Please use "').concat(e,'" instead.'),-1===D.indexOf(n)&&(D.push(n),R(n))}function g(t){return t&&Promise.resolve(t)===t}function b(t){return t instanceof Element||"object"===r(e=t)&&e.jquery;var e}function t(t){var e={};for(var n in t)e[t[n]]="swal2-"+t[n];return e}function y(t){var e=z();return e?e.querySelector(t):null}function e(t){return y(".".concat(t))}function n(){var t=W();return m(t.querySelectorAll(".".concat(_.icon)))}function w(){var t=n().filter(function(t){return dt(t)});return t.length?t[0]:null}function C(){return e(_.title)}function k(){return e(_.content)}function x(){return e(_.image)}function P(){return e(_["progress-steps"])}function A(){return e(_["validation-message"])}function B(){return y(".".concat(_.actions," .").concat(_.confirm))}function T(){return y(".".concat(_.actions," .").concat(_.cancel))}function E(){return e(_.actions)}function S(){return e(_.header)}function L(){return e(_.footer)}function O(){return e(_["timer-progress-bar"])}function M(){return e(_.close)}function H(){var t=m(W().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(t,e){return t=parseInt(t.getAttribute("tabindex")),(e=parseInt(e.getAttribute("tabindex")))<t?1:t<e?-1:0}),e=m(W().querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n')).filter(function(t){return"-1"!==t.getAttribute("tabindex")});return function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(t.concat(e)).filter(function(t){return dt(t)})}function I(){return!K()&&!document.body.classList.contains(_["no-backdrop"])}function j(t,e){if(e){for(var n=e.split(/\s+/),o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return;return 1}}function q(t,e,n){var o,i;if(i=e,m((o=t).classList).forEach(function(t){-1===f(_).indexOf(t)&&-1===f(F).indexOf(t)&&-1===f(i.showClass).indexOf(t)&&o.classList.remove(t)}),e.customClass&&e.customClass[n]){if("string"!=typeof e.customClass[n]&&!e.customClass[n].forEach)return R("Invalid type of customClass.".concat(n,'! Expected string or iterable object, got "').concat(r(e.customClass[n]),'"'));st(t,e.customClass[n])}}var V="SweetAlert2:",R=function(t){console.warn("".concat(V," ").concat(t))},D=[],N=function(t){return"function"==typeof t?t():t},U=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),_=t(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","toast-column","show","hide","close","title","header","content","html-container","actions","confirm","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),F=t(["success","warning","info","question","error"]),z=function(){return document.body.querySelector(".".concat(_.container))},W=function(){return e(_.popup)},K=function(){return document.body.classList.contains(_["toast-shown"])},Y={previousBodyPadding:null};function Z(t,e){if(!e)return null;switch(e){case"select":case"textarea":case"file":return lt(t,_[e]);case"checkbox":return t.querySelector(".".concat(_.checkbox," input"));case"radio":return t.querySelector(".".concat(_.radio," input:checked"))||t.querySelector(".".concat(_.radio," input:first-child"));case"range":return t.querySelector(".".concat(_.range," input"));default:return lt(t,_.input)}}function Q(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}}function $(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(function(e){t.forEach?t.forEach(function(t){n?t.classList.add(e):t.classList.remove(e)}):n?t.classList.add(e):t.classList.remove(e)}))}function J(t,e,n){n||0===parseInt(n)?t.style[e]="number"==typeof n?"".concat(n,"px"):n:t.style.removeProperty(e)}function X(t,e){var n=1<arguments.length&&void 0!==e?e:"flex";t.style.opacity="",t.style.display=n}function G(t){t.style.opacity="",t.style.display="none"}function tt(t,e,n){e?X(t,n):G(t)}function et(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return 0<n||0<o}function nt(t,e){var n=1<arguments.length&&void 0!==e&&e,o=O();dt(o)&&(n&&(o.style.transition="none",o.style.width="100%"),setTimeout(function(){o.style.transition="width ".concat(t/1e3,"s linear"),o.style.width="0%"},10))}function ot(){return"undefined"==typeof window||"undefined"==typeof document}function it(t){Xe.isVisible()&&ct!==t.target.value&&Xe.resetValidationMessage(),ct=t.target.value}function rt(t,e){t instanceof HTMLElement?e.appendChild(t):"object"===r(t)?mt(t,e):t&&(e.innerHTML=t)}function at(t,e){var n=E(),o=B(),i=T();e.showConfirmButton||e.showCancelButton||G(n),q(n,e,"actions"),vt(o,"confirm",e),vt(i,"cancel",e),e.buttonsStyling?function(t,e,n){st([t,e],_.styled),n.confirmButtonColor&&(t.style.backgroundColor=n.confirmButtonColor);n.cancelButtonColor&&(e.style.backgroundColor=n.cancelButtonColor);var o=window.getComputedStyle(t).getPropertyValue("background-color");t.style.borderLeftColor=o,t.style.borderRightColor=o}(o,i,e):(ut([o,i],_.styled),o.style.backgroundColor=o.style.borderLeftColor=o.style.borderRightColor="",i.style.backgroundColor=i.style.borderLeftColor=i.style.borderRightColor=""),e.reverseButtons&&o.parentNode.insertBefore(i,o)}var ct,st=function(t,e){$(t,e,!0)},ut=function(t,e){$(t,e,!1)},lt=function(t,e){for(var n=0;n<t.childNodes.length;n++)if(j(t.childNodes[n],e))return t.childNodes[n]},dt=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},pt='\n <div aria-labelledby="'.concat(_.title,'" aria-describedby="').concat(_.content,'" class="').concat(_.popup,'" tabindex="-1">\n <div class="').concat(_.header,'">\n <ul class="').concat(_["progress-steps"],'"></ul>\n <div class="').concat(_.icon," ").concat(F.error,'"></div>\n <div class="').concat(_.icon," ").concat(F.question,'"></div>\n <div class="').concat(_.icon," ").concat(F.warning,'"></div>\n <div class="').concat(_.icon," ").concat(F.info,'"></div>\n <div class="').concat(_.icon," ").concat(F.success,'"></div>\n <img class="').concat(_.image,'" />\n <h2 class="').concat(_.title,'" id="').concat(_.title,'"></h2>\n <button type="button" class="').concat(_.close,'"></button>\n </div>\n <div class="').concat(_.content,'">\n <div id="').concat(_.content,'" class="').concat(_["html-container"],'"></div>\n <input class="').concat(_.input,'" />\n <input type="file" class="').concat(_.file,'" />\n <div class="').concat(_.range,'">\n <input type="range" />\n <output></output>\n </div>\n <select class="').concat(_.select,'"></select>\n <div class="').concat(_.radio,'"></div>\n <label for="').concat(_.checkbox,'" class="').concat(_.checkbox,'">\n <input type="checkbox" />\n <span class="').concat(_.label,'"></span>\n </label>\n <textarea class="').concat(_.textarea,'"></textarea>\n <div class="').concat(_["validation-message"],'" id="').concat(_["validation-message"],'"></div>\n </div>\n <div class="').concat(_.actions,'">\n <button type="button" class="').concat(_.confirm,'">OK</button>\n <button type="button" class="').concat(_.cancel,'">Cancel</button>\n </div>\n <div class="').concat(_.footer,'"></div>\n <div class="').concat(_["timer-progress-bar"],'"></div>\n </div>\n').replace(/(^|\n)\s*/g,""),ft=function(t){var e,n=!!(e=z())&&(e.parentNode.removeChild(e),ut([document.documentElement,document.body],[_["no-backdrop"],_["toast-shown"],_["has-column"]]),!0);if(ot())v("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=_.container,n&&st(o,_["no-transition"]),o.innerHTML=pt;var i,r,a,c,s,u,l,d,p,f,m,h,g="string"==typeof(i=t.target)?document.querySelector(i):i;g.appendChild(o),r=t,(a=W()).setAttribute("role",r.toast?"alert":"dialog"),a.setAttribute("aria-live",r.toast?"polite":"assertive"),r.toast||a.setAttribute("aria-modal","true"),c=g,"rtl"===window.getComputedStyle(c).direction&&st(z(),_.rtl),s=k(),u=lt(s,_.input),l=lt(s,_.file),d=s.querySelector(".".concat(_.range," input")),p=s.querySelector(".".concat(_.range," output")),f=lt(s,_.select),m=s.querySelector(".".concat(_.checkbox," input")),h=lt(s,_.textarea),u.oninput=it,l.onchange=it,f.onchange=it,m.onchange=it,h.oninput=it,d.oninput=function(t){it(t),p.value=d.value},d.onchange=function(t){it(t),d.nextSibling.value=d.value}}},mt=function(t,e){t.jquery?ht(e,t):e.innerHTML=t.toString()},ht=function(t,e){if(t.innerHTML="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},gt=function(){if(ot())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&void 0!==t.style[n])return e[n];return!1}();function vt(t,e,n){var o;tt(t,n["show".concat((o=e).charAt(0).toUpperCase()+o.slice(1),"Button")],"inline-block"),t.innerHTML=n["".concat(e,"ButtonText")],t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]),t.className=_[e],q(t,n,"".concat(e,"Button")),st(t,n["".concat(e,"ButtonClass")])}function bt(t,e){var n=z();if(n){var o,i,r,a;o=n,"string"==typeof(i=e.backdrop)?o.style.background=i:i||st([document.documentElement,document.body],_["no-backdrop"]),!e.backdrop&&e.allowOutsideClick&&R('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),r=n,(a=e.position)in _?st(r,_[a]):(R('The "position" parameter is not valid, defaulting to "center"'),st(r,_.center)),function(t,e){if(e&&"string"==typeof e){var n="grow-".concat(e);n in _&&st(t,_[n])}}(n,e.grow),q(n,e,"container");var c=document.body.getAttribute("data-swal2-queue-step");c&&(n.setAttribute("data-queue-step",c),document.body.removeAttribute("data-swal2-queue-step"))}}function yt(t,e){t.placeholder&&!e.inputPlaceholder||(t.placeholder=e.inputPlaceholder)}var wt={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},Ct=["input","file","range","select","radio","checkbox","textarea"],kt=function(t){if(!Bt[t.input])return v('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(t.input,'"'));var e=At(t.input),n=Bt[t.input](e,t);X(n),setTimeout(function(){Q(n)})},xt=function(t,e){var n=Z(k(),t);if(n)for(var o in!function(t){for(var e=0;e<t.attributes.length;e++){var n=t.attributes[e].name;-1===["type","value","style"].indexOf(n)&&t.removeAttribute(n)}}(n),e)"range"===t&&"placeholder"===o||n.setAttribute(o,e[o])},Pt=function(t){var e=At(t.input);t.customClass&&st(e,t.customClass.input)},At=function(t){var e=_[t]?_[t]:_.input;return lt(k(),e)},Bt={};Bt.text=Bt.email=Bt.password=Bt.number=Bt.tel=Bt.url=function(t,e){return"string"==typeof e.inputValue||"number"==typeof e.inputValue?t.value=e.inputValue:g(e.inputValue)||R('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(r(e.inputValue),'"')),yt(t,e),t.type=e.input,t},Bt.file=function(t,e){return yt(t,e),t},Bt.range=function(t,e){var n=t.querySelector("input"),o=t.querySelector("output");return n.value=e.inputValue,n.type=e.input,o.value=e.inputValue,t},Bt.select=function(t,e){if(t.innerHTML="",e.inputPlaceholder){var n=document.createElement("option");n.innerHTML=e.inputPlaceholder,n.value="",n.disabled=!0,n.selected=!0,t.appendChild(n)}return t},Bt.radio=function(t){return t.innerHTML="",t},Bt.checkbox=function(t,e){var n=Z(k(),"checkbox");return n.value=1,n.id=_.checkbox,n.checked=Boolean(e.inputValue),t.querySelector("span").innerHTML=e.inputPlaceholder,t},Bt.textarea=function(e,t){if(e.value=t.inputValue,yt(e,t),"MutationObserver"in window){var n=parseInt(window.getComputedStyle(W()).width),o=parseInt(window.getComputedStyle(W()).paddingLeft)+parseInt(window.getComputedStyle(W()).paddingRight);new MutationObserver(function(){var t=e.offsetWidth+o;W().style.width=n<t?"".concat(t,"px"):null}).observe(e,{attributes:!0,attributeFilter:["style"]})}return e};function Tt(t,e){var n,o,i,r,a,c=k().querySelector("#".concat(_.content));e.html?(rt(e.html,c),X(c,"block")):e.text?(c.textContent=e.text,X(c,"block")):G(c),n=t,o=e,i=k(),r=wt.innerParams.get(n),a=!r||o.input!==r.input,Ct.forEach(function(t){var e=_[t],n=lt(i,e);xt(t,o.inputAttributes),n.className=e,a&&G(n)}),o.input&&(a&&kt(o),Pt(o)),q(k(),e,"content")}function Et(){return z().getAttribute("data-queue-step")}function St(t,s){var u=P();if(!s.progressSteps||0===s.progressSteps.length)return G(u);X(u),u.innerHTML="";var l=parseInt(void 0===s.currentProgressStep?Et():s.currentProgressStep);l>=s.progressSteps.length&&R("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),s.progressSteps.forEach(function(t,e){var n,o,i,r,a=(n=t,o=document.createElement("li"),st(o,_["progress-step"]),o.innerHTML=n,o);if(u.appendChild(a),e===l&&st(a,_["active-progress-step"]),e!==s.progressSteps.length-1){var c=(i=t,r=document.createElement("li"),st(r,_["progress-step-line"]),i.progressStepsDistance&&(r.style.width=i.progressStepsDistance),r);u.appendChild(c)}})}function Lt(t,e){var n,o,i,r,a=S();q(a,e,"header"),St(0,e),function(t,e){var n=wt.innerParams.get(t);if(n&&e.icon===n.icon&&w())q(w(),e,"icon");else if(Ht(),e.icon)if(-1!==Object.keys(F).indexOf(e.icon)){var o=y(".".concat(_.icon,".").concat(F[e.icon]));X(o),jt(o,e),It(),q(o,e,"icon"),st(o,e.showClass.icon)}else v('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"'))}(t,e),function(t){var e=x();if(!t.imageUrl)return G(e);X(e),e.setAttribute("src",t.imageUrl),e.setAttribute("alt",t.imageAlt),J(e,"width",t.imageWidth),J(e,"height",t.imageHeight),e.className=_.image,q(e,t,"image")}(e),n=e,o=C(),tt(o,n.title||n.titleText),n.title&&rt(n.title,o),n.titleText&&(o.innerText=n.titleText),q(o,n,"title"),i=e,(r=M()).innerHTML=i.closeButtonHtml,q(r,i,"closeButton"),tt(r,i.showCloseButton),r.setAttribute("aria-label",i.closeButtonAriaLabel)}function Ot(t,e){var n,o,i,r;n=e,o=W(),J(o,"width",n.width),J(o,"padding",n.padding),n.background&&(o.style.background=n.background),Rt(o,n),bt(0,e),Lt(t,e),Tt(t,e),at(0,e),i=e,r=L(),tt(r,i.footer),i.footer&&rt(i.footer,r),q(r,i,"footer"),"function"==typeof e.onRender&&e.onRender(W())}function Mt(){return B()&&B().click()}var Ht=function(){for(var t=n(),e=0;e<t.length;e++)G(t[e])},It=function(){for(var t=W(),e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),o=0;o<n.length;o++)n[o].style.backgroundColor=e},jt=function(t,e){if(t.innerHTML="",e.iconHtml)t.innerHTML=qt(e.iconHtml);else if("success"===e.icon)t.innerHTML='\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n ';else if("error"===e.icon)t.innerHTML='\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n ';else{t.innerHTML=qt({question:"?",warning:"!",info:"i"}[e.icon])}},qt=function(t){return'<div class="'.concat(_["icon-content"],'">').concat(t,"</div>")},Vt=[],Rt=function(t,e){t.className="".concat(_.popup," ").concat(dt(t)?e.showClass.popup:""),e.toast?(st([document.documentElement,document.body],_["toast-shown"]),st(t,_.toast)):st(t,_.modal),q(t,e,"popup"),"string"==typeof e.customClass&&st(t,e.customClass),e.icon&&st(t,_["icon-".concat(e.icon)])};function Dt(){var t=W();t||Xe.fire(),t=W();var e=E(),n=B();X(e),X(n,"inline-block"),st([t,e],_.loading),n.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()}function Nt(){return new Promise(function(t){var e=window.scrollX,n=window.scrollY;Wt.restoreFocusTimeout=setTimeout(function(){Wt.previousActiveElement&&Wt.previousActiveElement.focus?(Wt.previousActiveElement.focus(),Wt.previousActiveElement=null):document.body&&document.body.focus(),t()},100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)})}function Ut(){if(Wt.timeout)return function(){var t=O(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=parseInt(window.getComputedStyle(t).width),o=parseInt(e/n*100);t.style.removeProperty("transition"),t.style.width="".concat(o,"%")}(),Wt.timeout.stop()}function _t(){if(Wt.timeout){var t=Wt.timeout.start();return nt(t),t}}function Ft(t){return Object.prototype.hasOwnProperty.call(Kt,t)}function zt(t){return Zt[t]}var Wt={},Kt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconHtml:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:void 0,target:"body",backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,onBeforeOpen:void 0,onOpen:void 0,onRender:void 0,onClose:void 0,onAfterClose:void 0,onDestroy:void 0,scrollbarPadding:!0},Yt=["title","titleText","text","html","icon","hideClass","customClass","allowOutsideClick","allowEscapeKey","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","buttonsStyling","reverseButtons","imageUrl","imageWidth","imageHeight","imageAlt","progressSteps","currentProgressStep"],Zt={animation:'showClass" and "hideClass'},Qt=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],$t=Object.freeze({isValidParameter:Ft,isUpdatableParameter:function(t){return-1!==Yt.indexOf(t)},isDeprecatedParameter:zt,argsToParams:function(o){var i={};return"object"!==r(o[0])||b(o[0])?["title","html","icon"].forEach(function(t,e){var n=o[e];"string"==typeof n||b(n)?i[t]=n:void 0!==n&&v("Unexpected type of ".concat(t,'! Expected "string" or "Element", got ').concat(r(n)))}):c(i,o[0]),i},isVisible:function(){return dt(W())},clickConfirm:Mt,clickCancel:function(){return T()&&T().click()},getContainer:z,getPopup:W,getTitle:C,getContent:k,getHtmlContainer:function(){return e(_["html-container"])},getImage:x,getIcon:w,getIcons:n,getCloseButton:M,getActions:E,getConfirmButton:B,getCancelButton:T,getHeader:S,getFooter:L,getTimerProgressBar:O,getFocusableElements:H,getValidationMessage:A,isLoading:function(){return W().hasAttribute("data-loading")},fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return l(this,e)},mixin:function(n){return function(t){function e(){return o(this,e),d(this,s(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(e,t),a(e,[{key:"_main",value:function(t){return p(s(e.prototype),"_main",this).call(this,c({},n,t))}}]),e}(this)},queue:function(t){var r=this;Vt=t;function a(t,e){Vt=[],t(e)}var c=[];return new Promise(function(i){!function e(n,o){n<Vt.length?(document.body.setAttribute("data-swal2-queue-step",n),r.fire(Vt[n]).then(function(t){void 0!==t.value?(c.push(t.value),e(n+1,o)):a(i,{dismiss:t.dismiss})})):a(i,{value:c})}(0)})},getQueueStep:Et,insertQueueStep:function(t,e){return e&&e<Vt.length?Vt.splice(e,0,t):Vt.push(t)},deleteQueueStep:function(t){void 0!==Vt[t]&&Vt.splice(t,1)},showLoading:Dt,enableLoading:Dt,getTimerLeft:function(){return Wt.timeout&&Wt.timeout.getTimerLeft()},stopTimer:Ut,resumeTimer:_t,toggleTimer:function(){var t=Wt.timeout;return t&&(t.running?Ut:_t)()},increaseTimer:function(t){if(Wt.timeout){var e=Wt.timeout.increase(t);return nt(e,!0),e}},isTimerRunning:function(){return Wt.timeout&&Wt.timeout.isRunning()}});function Jt(){var t=wt.innerParams.get(this);if(t){var e=wt.domCache.get(this);t.showConfirmButton||(G(e.confirmButton),t.showCancelButton||G(e.actions)),ut([e.popup,e.actions],_.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.cancelButton.disabled=!1}}function Xt(){null===Y.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(Y.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Y.previousBodyPadding+function(){var t=document.createElement("div");t.className=_["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))}function Gt(){return!!window.MSInputMethodContext&&!!document.documentMode}function te(){var t=z(),e=W();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")}var ee=function(){var n,o=z();o.ontouchstart=function(t){var e;n=t.target===o||!((e=o).scrollHeight>e.clientHeight)&&"INPUT"!==t.target.tagName},o.ontouchmove=function(t){n&&(t.preventDefault(),t.stopPropagation())}},ne={swalPromiseResolve:new WeakMap};function oe(t,e,n,o){n?ae(t,o):(Nt().then(function(){return ae(t,o)}),Wt.keydownTarget.removeEventListener("keydown",Wt.keydownHandler,{capture:Wt.keydownListenerCapture}),Wt.keydownHandlerAdded=!1),e.parentNode&&!document.body.getAttribute("data-swal2-queue-step")&&e.parentNode.removeChild(e),I()&&(null!==Y.previousBodyPadding&&(document.body.style.paddingRight="".concat(Y.previousBodyPadding,"px"),Y.previousBodyPadding=null),function(){if(j(document.body,_.iosfix)){var t=parseInt(document.body.style.top,10);ut(document.body,_.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),"undefined"!=typeof window&&Gt()&&window.removeEventListener("resize",te),m(document.body.children).forEach(function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})),ut([document.documentElement,document.body],[_.shown,_["height-auto"],_["no-backdrop"],_["toast-shown"],_["toast-column"]])}function ie(t){var e=W();if(e){var n=wt.innerParams.get(this);if(n&&!j(e,n.hideClass.popup)){var o=ne.swalPromiseResolve.get(this);ut(e,n.showClass.popup),st(e,n.hideClass.popup);var i=z();ut(i,n.showClass.backdrop),st(i,n.hideClass.backdrop),function(t,e,n){var o=z(),i=gt&&et(e),r=n.onClose,a=n.onAfterClose;if(r!==null&&typeof r==="function"){r(e)}if(i){re(t,e,o,a)}else{oe(t,o,K(),a)}}(this,e,n),o(t||{})}}}var re=function(t,e,n,o){Wt.swalCloseEventFinishedCallback=oe.bind(null,t,n,K(),o),e.addEventListener(gt,function(t){t.target===e&&(Wt.swalCloseEventFinishedCallback(),delete Wt.swalCloseEventFinishedCallback)})},ae=function(t,e){setTimeout(function(){"function"==typeof e&&e(),t._destroy()})};function ce(t,e,n){var o=wt.domCache.get(t);e.forEach(function(t){o[t].disabled=n})}function se(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=e;else t.disabled=e}var ue=function(){function n(t,e){o(this,n),this.callback=t,this.remaining=e,this.running=!1,this.start()}return a(n,[{key:"start",value:function(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}},{key:"stop",value:function(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date-this.started),this.remaining}},{key:"increase",value:function(t){var e=this.running;return e&&this.stop(),this.remaining+=t,e&&this.start(),this.remaining}},{key:"getTimerLeft",value:function(){return this.running&&(this.stop(),this.start()),this.remaining}},{key:"isRunning",value:function(){return this.running}}]),n}(),le={email:function(t,e){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function de(t){var e,n;(e=t).inputValidator||Object.keys(le).forEach(function(t){e.input===t&&(e.inputValidator=le[t])}),t.showLoaderOnConfirm&&!t.preConfirm&&R("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),t.animation=N(t.animation),(n=t).target&&("string"!=typeof n.target||document.querySelector(n.target))&&("string"==typeof n.target||n.target.appendChild)||(R('Target parameter is not valid, defaulting to "body"'),n.target="body"),"string"==typeof t.title&&(t.title=t.title.split("\n").join("<br />")),ft(t)}function pe(t){var e=z(),n=W();"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n),xe(e,n,t),Ce(e,n),I()&&ke(e,t.scrollbarPadding),K()||Wt.previousActiveElement||(Wt.previousActiveElement=document.activeElement),"function"==typeof t.onOpen&&setTimeout(function(){return t.onOpen(n)}),ut(e,_["no-transition"])}function fe(t){var e=W();if(t.target===e){var n=z();e.removeEventListener(gt,fe),n.style.overflowY="auto"}}function me(t,e){"select"===e.input||"radio"===e.input?Te(t,e):-1!==["text","email","number","tel","textarea"].indexOf(e.input)&&g(e.inputValue)&&Ee(t,e)}function he(t,e){t.disableButtons(),e.input?Oe(t,e):Me(t,e,!0)}function ge(t,e){t.disableButtons(),e(U.cancel)}function ve(t,e){t.closePopup({value:e})}function be(e,t,n,o){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1),n.toast||(t.keydownHandler=function(t){return je(e,t,o)},t.keydownTarget=n.keydownListenerCapture?window:W(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}function ye(t,e,n){var o=H(),i=0;if(i<o.length)return(e+=n)===o.length?e=0:-1===e&&(e=o.length-1),o[e].focus();W().focus()}function we(t,e,n){wt.innerParams.get(t).toast?Ne(t,e,n):(_e(e),Fe(e),ze(t,e,n))}var Ce=function(t,e){gt&&et(e)?(t.style.overflowY="hidden",e.addEventListener(gt,fe)):t.style.overflowY="auto"},ke=function(t,e){!function(){if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&1<navigator.maxTouchPoints)&&!j(document.body,_.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),st(document.body,_.iosfix),ee()}}(),"undefined"!=typeof window&&Gt()&&(te(),window.addEventListener("resize",te)),m(document.body.children).forEach(function(t){t===z()||function(t,e){if("function"==typeof t.contains)return t.contains(e)}(t,z())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))}),e&&Xt(),setTimeout(function(){t.scrollTop=0})},xe=function(t,e,n){st(t,n.showClass.backdrop),X(e),st(e,n.showClass.popup),st([document.documentElement,document.body],_.shown),n.heightAuto&&n.backdrop&&!n.toast&&st([document.documentElement,document.body],_["height-auto"])},Pe=function(t){return t.checked?1:0},Ae=function(t){return t.checked?t.value:null},Be=function(t){return t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},Te=function(e,n){function o(t){return Se[n.input](i,Le(t),n)}var i=k();g(n.inputOptions)?(Dt(),n.inputOptions.then(function(t){e.hideLoading(),o(t)})):"object"===r(n.inputOptions)?o(n.inputOptions):v("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(r(n.inputOptions)))},Ee=function(e,n){var o=e.getInput();G(o),n.inputValue.then(function(t){o.value="number"===n.input?parseFloat(t)||0:"".concat(t),X(o),o.focus(),e.hideLoading()}).catch(function(t){v("Error in inputValue promise: ".concat(t)),o.value="",X(o),o.focus(),e.hideLoading()})},Se={select:function(t,e,i){var r=lt(t,_.select);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("option");o.value=e,o.innerHTML=n,i.inputValue.toString()===e.toString()&&(o.selected=!0),r.appendChild(o)}),r.focus()},radio:function(t,e,a){var c=lt(t,_.radio);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("input"),i=document.createElement("label");o.type="radio",o.name=_.radio,o.value=e,a.inputValue.toString()===e.toString()&&(o.checked=!0);var r=document.createElement("span");r.innerHTML=n,r.className=_.label,i.appendChild(o),i.appendChild(r),c.appendChild(i)});var n=c.querySelectorAll("input");n.length&&n[0].focus()}},Le=function(e){var n=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(function(t,e){n.push([e,t])}):Object.keys(e).forEach(function(t){n.push([t,e[t]])}),n},Oe=function(e,n){var o=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Pe(n);case"radio":return Ae(n);case"file":return Be(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(e,n);n.inputValidator?(e.disableInput(),Promise.resolve().then(function(){return n.inputValidator(o,n.validationMessage)}).then(function(t){e.enableButtons(),e.enableInput(),t?e.showValidationMessage(t):Me(e,n,o)})):e.getInput().checkValidity()?Me(e,n,o):(e.enableButtons(),e.showValidationMessage(n.validationMessage))},Me=function(e,t,n){(t.showLoaderOnConfirm&&Dt(),t.preConfirm)?(e.resetValidationMessage(),Promise.resolve().then(function(){return t.preConfirm(n,t.validationMessage)}).then(function(t){dt(A())||!1===t?e.hideLoading():ve(e,void 0===t?n:t)})):ve(e,n)},He=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"],Ie=["Escape","Esc"],je=function(t,e,n){var o=wt.innerParams.get(t);o.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?qe(t,e,o):"Tab"===e.key?Ve(e,o):-1!==He.indexOf(e.key)?Re():-1!==Ie.indexOf(e.key)&&De(e,o,n)},qe=function(t,e,n){if(!e.isComposing&&e.target&&t.getInput()&&e.target.outerHTML===t.getInput().outerHTML){if(-1!==["textarea","file"].indexOf(n.input))return;Mt(),e.preventDefault()}},Ve=function(t){for(var e=t.target,n=H(),o=-1,i=0;i<n.length;i++)if(e===n[i]){o=i;break}t.shiftKey?ye(0,o,-1):ye(0,o,1),t.stopPropagation(),t.preventDefault()},Re=function(){var t=B(),e=T();document.activeElement===t&&dt(e)?e.focus():document.activeElement===e&&dt(t)&&t.focus()},De=function(t,e,n){N(e.allowEscapeKey)&&(t.preventDefault(),n(U.esc))},Ne=function(e,t,n){t.popup.onclick=function(){var t=wt.innerParams.get(e);t.showConfirmButton||t.showCancelButton||t.showCloseButton||t.input||n(U.close)}},Ue=!1,_e=function(e){e.popup.onmousedown=function(){e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(Ue=!0)}}},Fe=function(e){e.container.onmousedown=function(){e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,t.target!==e.popup&&!e.popup.contains(t.target)||(Ue=!0)}}},ze=function(n,o,i){o.container.onclick=function(t){var e=wt.innerParams.get(n);Ue?Ue=!1:t.target===o.container&&N(e.allowOutsideClick)&&i(U.backdrop)}};var We=function(t,e,n){var o=O();G(o),e.timer&&(t.timeout=new ue(function(){n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&(X(o),setTimeout(function(){t.timeout.running&&nt(e.timer)})))},Ke=function(t,e){if(!e.toast)return N(e.allowEnterKey)?e.focusCancel&&dt(t.cancelButton)?t.cancelButton.focus():e.focusConfirm&&dt(t.confirmButton)?t.confirmButton.focus():void ye(0,-1,1):Ye()},Ye=function(){document.activeElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};var Ze,Qe=function(t){for(var e in t)t[e]=new WeakMap},$e=Object.freeze({hideLoading:Jt,disableLoading:Jt,getInput:function(t){var e=wt.innerParams.get(t||this),n=wt.domCache.get(t||this);return n?Z(n.content,e.input):null},close:ie,closePopup:ie,closeModal:ie,closeToast:ie,enableButtons:function(){ce(this,["confirmButton","cancelButton"],!1)},disableButtons:function(){ce(this,["confirmButton","cancelButton"],!0)},enableInput:function(){return se(this.getInput(),!1)},disableInput:function(){return se(this.getInput(),!0)},showValidationMessage:function(t){var e=wt.domCache.get(this);e.validationMessage.innerHTML=t;var n=window.getComputedStyle(e.popup);e.validationMessage.style.marginLeft="-".concat(n.getPropertyValue("padding-left")),e.validationMessage.style.marginRight="-".concat(n.getPropertyValue("padding-right")),X(e.validationMessage);var o=this.getInput();o&&(o.setAttribute("aria-invalid",!0),o.setAttribute("aria-describedBy",_["validation-message"]),Q(o),st(o,_.inputerror))},resetValidationMessage:function(){var t=wt.domCache.get(this);t.validationMessage&&G(t.validationMessage);var e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedBy"),ut(e,_.inputerror))},getProgressSteps:function(){return wt.domCache.get(this).progressSteps},_main:function(t){!function(t){for(var e in t)Ft(i=e)||R('Unknown parameter "'.concat(i,'"')),t.toast&&(o=e,-1!==Qt.indexOf(o)&&R('The parameter "'.concat(o,'" is incompatible with toasts'))),zt(n=e)&&h(n,zt(n));var n,o,i}(t),Wt.currentInstance&&Wt.currentInstance._destroy(),Wt.currentInstance=this;var e=function(t){var e=c({},Kt.showClass,t.showClass),n=c({},Kt.hideClass,t.hideClass),o=c({},Kt,t);if(o.showClass=e,o.hideClass=n,t.animation===false){o.showClass={popup:"",backdrop:"swal2-backdrop-show swal2-noanimation"};o.hideClass={}}return o}(t);de(e),Object.freeze(e),Wt.timeout&&(Wt.timeout.stop(),delete Wt.timeout),clearTimeout(Wt.restoreFocusTimeout);var n=function(t){var e={popup:W(),container:z(),content:k(),actions:E(),confirmButton:B(),cancelButton:T(),closeButton:M(),validationMessage:A(),progressSteps:P()};return wt.domCache.set(t,e),e}(this);return Ot(this,e),wt.innerParams.set(this,e),function(n,o,i){return new Promise(function(t){var e=function t(e){n.closePopup({dismiss:e})};ne.swalPromiseResolve.set(n,t);We(Wt,i,e);o.confirmButton.onclick=function(){return he(n,i)};o.cancelButton.onclick=function(){return ge(n,e)};o.closeButton.onclick=function(){return e(U.close)};we(n,o,e);be(n,Wt,i,e);if(i.toast&&(i.input||i.footer||i.showCloseButton)){st(document.body,_["toast-column"])}else{ut(document.body,_["toast-column"])}me(n,i);pe(i);Ke(o,i);o.container.scrollTop=0})}(this,n,e)},update:function(e){var t=W(),n=wt.innerParams.get(this);if(!t||j(t,n.hideClass.popup))return R("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");var o={};Object.keys(e).forEach(function(t){Xe.isUpdatableParameter(t)?o[t]=e[t]:R('Invalid parameter to update: "'.concat(t,'". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js'))});var i=c({},n,o);Ot(this,i),wt.innerParams.set(this,i),Object.defineProperties(this,{params:{value:c({},this.params,e),writable:!1,enumerable:!0}})},_destroy:function(){var t=wt.domCache.get(this),e=wt.innerParams.get(this);e&&(t.popup&&Wt.swalCloseEventFinishedCallback&&(Wt.swalCloseEventFinishedCallback(),delete Wt.swalCloseEventFinishedCallback),Wt.deferDisposalTimer&&(clearTimeout(Wt.deferDisposalTimer),delete Wt.deferDisposalTimer),"function"==typeof e.onDestroy&&e.onDestroy(),delete this.params,delete Wt.keydownHandler,delete Wt.keydownTarget,Qe(wt),Qe(ne))}});function Je(){if("undefined"!=typeof window){"undefined"==typeof Promise&&v("This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)"),Ze=this;for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var o=Object.freeze(this.constructor.argsToParams(e));Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0,configurable:!0}});var i=this._main(this.params);wt.promise.set(this,i)}}Je.prototype.then=function(t){return wt.promise.get(this).then(t)},Je.prototype.finally=function(t){return wt.promise.get(this).finally(t)},c(Je.prototype,$e),c(Je,$t),Object.keys($e).forEach(function(t){Je[t]=function(){if(Ze)return Ze[t].apply(Ze,arguments)}}),Je.DismissReason=U,Je.version="9.10.0";var Xe=Je;return Xe.default=Xe}),void 0!==this&&this.wpr_Sweetalert2&&(this.wpr_swal=this.wpr_sweetAlert=this.wpr_Swal=this.wpr_SweetAlert=this.wpr_Sweetalert2);
|
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(){})});
|
js/wp-reset-pointers.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*
|
2 |
* WP Reset
|
3 |
* Backend GUI pointers
|
4 |
-
* (c) Web factory Ltd, 2017 -
|
5 |
*/
|
6 |
|
7 |
jQuery(document).ready(function($){
|
1 |
/*
|
2 |
* WP Reset
|
3 |
* Backend GUI pointers
|
4 |
+
* (c) Web factory Ltd, 2017 - 2020
|
5 |
*/
|
6 |
|
7 |
jQuery(document).ready(function($){
|
js/wp-reset.js
CHANGED
@@ -1,33 +1,36 @@
|
|
1 |
/**
|
2 |
* WP Reset
|
3 |
* https://wpreset.com/
|
4 |
-
* (c) WebFactory Ltd, 2017-
|
5 |
*/
|
6 |
|
7 |
-
jQuery(document).ready(function($) {
|
8 |
// init tabs
|
9 |
-
$(
|
10 |
.tabs({
|
11 |
-
create: function() {
|
12 |
-
$(
|
13 |
},
|
14 |
-
activate: function(event, ui) {
|
15 |
-
localStorage.setItem(
|
|
|
|
|
|
|
16 |
},
|
17 |
-
active: localStorage.getItem(
|
18 |
})
|
19 |
.show();
|
20 |
|
21 |
// helper for swithcing tabs & linking anchors in different tabs
|
22 |
-
$(
|
23 |
e.preventDefault();
|
24 |
|
25 |
-
$(
|
26 |
|
27 |
// get the link anchor and scroll to it
|
28 |
-
target = this.href.split(
|
29 |
if (target) {
|
30 |
-
$.scrollTo(
|
31 |
}
|
32 |
|
33 |
$(this).blur();
|
@@ -35,13 +38,13 @@ jQuery(document).ready(function($) {
|
|
35 |
}); // jump to tab/anchor helper
|
36 |
|
37 |
// helper for scrolling to anchor
|
38 |
-
$(
|
39 |
e.preventDefault();
|
40 |
|
41 |
// get the link anchor and scroll to it
|
42 |
-
target = this.href.split(
|
43 |
if (target) {
|
44 |
-
$.scrollTo(
|
45 |
}
|
46 |
|
47 |
$(this).blur();
|
@@ -49,335 +52,503 @@ jQuery(document).ready(function($) {
|
|
49 |
}); // scroll to anchor helper
|
50 |
|
51 |
// toggle button dropdown menu
|
52 |
-
$(
|
|
|
|
|
53 |
e.preventDefault();
|
54 |
|
55 |
-
parent_dropdown = $(this).parent(
|
56 |
-
sibling_menu = $(this).siblings(
|
57 |
|
58 |
-
$(
|
59 |
-
|
60 |
-
.removeClass('show');
|
61 |
-
$('.dropdown-menu')
|
62 |
-
.not(sibling_menu)
|
63 |
-
.removeClass('show');
|
64 |
|
65 |
-
$(parent_dropdown).toggleClass(
|
66 |
-
$(sibling_menu).toggleClass(
|
67 |
|
68 |
return false;
|
69 |
}); // toggle button dropdown menu
|
70 |
|
71 |
-
$(document).on(
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
74 |
|
75 |
// delete transients
|
76 |
-
$(
|
77 |
e.preventDefault();
|
78 |
|
79 |
-
run_tool(this,
|
80 |
|
81 |
return false;
|
82 |
}); // delete transients
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
// delete uploads
|
85 |
-
$(
|
86 |
e.preventDefault();
|
87 |
|
88 |
-
run_tool(this,
|
89 |
|
90 |
return false;
|
91 |
}); // delete uploads
|
92 |
|
93 |
// reset theme options (mods)
|
94 |
-
$(
|
95 |
e.preventDefault();
|
96 |
|
97 |
-
run_tool(this,
|
98 |
|
99 |
return false;
|
100 |
}); // reset theme options
|
101 |
|
102 |
// delete themes
|
103 |
-
$(
|
104 |
e.preventDefault();
|
105 |
|
106 |
-
run_tool(this,
|
107 |
|
108 |
return false;
|
109 |
}); // delete themes
|
110 |
|
111 |
// delete plugins
|
112 |
-
$(
|
113 |
e.preventDefault();
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
return false;
|
118 |
}); // delete plugins
|
119 |
|
120 |
// drop custom tables
|
121 |
-
$(
|
122 |
e.preventDefault();
|
123 |
|
124 |
-
run_tool(this,
|
125 |
|
126 |
return false;
|
127 |
}); // drop custom tables
|
128 |
|
129 |
// truncate custom tables
|
130 |
-
$(
|
|
|
|
|
131 |
e.preventDefault();
|
132 |
|
133 |
-
run_tool(this,
|
134 |
|
135 |
return false;
|
136 |
}); // truncate custom tables
|
137 |
|
138 |
// delete htaccess file
|
139 |
-
$(
|
140 |
e.preventDefault();
|
141 |
|
142 |
-
run_tool(this,
|
143 |
|
144 |
return false;
|
145 |
}); // delete htaccess file
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
// compare snapshot
|
148 |
-
$(
|
149 |
e.preventDefault();
|
150 |
-
uid = $(this).data(
|
151 |
button = $(this);
|
152 |
|
153 |
-
block_ui($(button).data(
|
154 |
$.get({
|
155 |
url: ajaxurl,
|
156 |
data: {
|
157 |
-
action:
|
158 |
_ajax_nonce: wp_reset.nonce_run_tool,
|
159 |
-
tool:
|
160 |
-
extra_data: uid
|
161 |
-
}
|
162 |
})
|
163 |
-
.always(function(data) {
|
164 |
-
|
165 |
})
|
166 |
-
.done(function(data) {
|
167 |
if (data.success) {
|
168 |
-
msg = $(button)
|
169 |
-
|
170 |
-
|
171 |
-
swal({
|
172 |
-
width: '90%',
|
173 |
title: msg,
|
174 |
html: data.data,
|
175 |
showConfirmButton: false,
|
176 |
allowEnterKey: false,
|
177 |
focusConfirm: false,
|
178 |
showCloseButton: true,
|
179 |
-
customClass:
|
180 |
});
|
181 |
} else {
|
182 |
-
|
183 |
-
|
184 |
-
title: wp_reset.documented_error +
|
185 |
});
|
186 |
}
|
187 |
})
|
188 |
-
.fail(function(data) {
|
189 |
-
|
190 |
});
|
191 |
|
192 |
return false;
|
193 |
}); // compare snapshot
|
194 |
|
195 |
// restore snapshot
|
196 |
-
$(
|
197 |
e.preventDefault();
|
198 |
-
uid = $(this).data(
|
199 |
|
200 |
-
run_tool(this,
|
201 |
|
202 |
return false;
|
203 |
}); // restore snapshot
|
204 |
|
205 |
// download snapshot
|
206 |
-
$(
|
207 |
e.preventDefault();
|
208 |
-
uid = $(this).data(
|
209 |
button = this;
|
210 |
|
211 |
-
block_ui($(this).data(
|
212 |
$.get({
|
213 |
url: ajaxurl,
|
214 |
data: {
|
215 |
-
action:
|
216 |
_ajax_nonce: wp_reset.nonce_run_tool,
|
217 |
-
tool:
|
218 |
-
extra_data: uid
|
219 |
-
}
|
220 |
})
|
221 |
-
.always(function(data) {
|
222 |
-
|
223 |
})
|
224 |
-
.done(function(data) {
|
225 |
if (data.success) {
|
226 |
-
msg = $(button)
|
227 |
-
|
228 |
-
.replace('%s', data.data);
|
229 |
-
swal({ type: 'success', title: msg });
|
230 |
} else {
|
231 |
-
|
232 |
-
|
233 |
-
title: wp_reset.documented_error +
|
234 |
});
|
235 |
}
|
236 |
})
|
237 |
-
.fail(function(data) {
|
238 |
-
|
239 |
});
|
240 |
|
241 |
return false;
|
242 |
}); // download snapshot
|
243 |
|
244 |
// delete snapshot
|
245 |
-
$(
|
246 |
e.preventDefault();
|
247 |
-
uid = $(this).data(
|
248 |
|
249 |
-
run_tool(this,
|
250 |
|
251 |
return false;
|
252 |
}); // delete snapshot
|
253 |
|
254 |
// create snapshot
|
255 |
-
$(
|
256 |
-
e.preventDefault();
|
257 |
-
|
258 |
-
description = $(this).data(
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
swal.close();
|
286 |
})
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
});
|
300 |
-
}
|
301 |
-
|
302 |
-
|
303 |
-
swal({ type: 'error', title: wp_reset.undocumented_error });
|
304 |
-
});
|
305 |
-
} // if confirmed
|
306 |
-
});
|
307 |
|
308 |
return false;
|
309 |
}); // create snapshot
|
310 |
|
311 |
// show/hide extra table info in snapshot diff
|
312 |
-
$(
|
313 |
e.preventDefault();
|
314 |
|
315 |
-
parent = $(this).parents(
|
316 |
-
$(
|
317 |
|
318 |
-
$(
|
319 |
-
.toggleClass(
|
320 |
-
.toggleClass(
|
321 |
|
322 |
return false;
|
323 |
}); // show hide extra info in diff
|
324 |
|
325 |
// standard way of running a tool, with confirmation, loading and success message
|
326 |
function run_tool(button, tool_name, extra_data) {
|
327 |
-
var confirm_title =
|
|
|
328 |
|
329 |
wpr_close_dropdowns();
|
330 |
|
331 |
confirm_action(
|
332 |
confirm_title,
|
333 |
-
$(button).data(
|
334 |
-
$(button).data(
|
335 |
wp_reset.cancel_button
|
336 |
-
).then(result => {
|
337 |
if (result.value) {
|
338 |
-
block = block_ui($(button).data(
|
339 |
$.get({
|
340 |
url: ajaxurl,
|
341 |
data: {
|
342 |
-
action:
|
343 |
_ajax_nonce: wp_reset.nonce_run_tool,
|
344 |
tool: tool_name,
|
345 |
-
extra_data: extra_data
|
346 |
-
}
|
347 |
})
|
348 |
-
.always(function(data) {
|
349 |
-
|
350 |
})
|
351 |
-
.done(function(data) {
|
352 |
if (data.success) {
|
353 |
if (data.data == 1) {
|
354 |
-
msg = $(button).data(
|
355 |
} else {
|
356 |
-
msg = $(button)
|
357 |
-
.data('text-done')
|
358 |
-
.replace('%n', data.data);
|
359 |
}
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
}
|
372 |
} else {
|
373 |
-
|
374 |
-
|
375 |
-
title: wp_reset.documented_error +
|
376 |
});
|
377 |
}
|
378 |
})
|
379 |
-
.fail(function(data) {
|
380 |
-
|
|
|
|
|
|
|
381 |
});
|
382 |
} // if confirmed
|
383 |
});
|
@@ -385,12 +556,12 @@ jQuery(document).ready(function($) {
|
|
385 |
|
386 |
// display a message while an action is performed
|
387 |
function block_ui(message) {
|
388 |
-
tmp =
|
389 |
text: message,
|
390 |
type: false,
|
391 |
imageUrl: wp_reset.icon_url,
|
392 |
onOpen: () => {
|
393 |
-
$(
|
394 |
},
|
395 |
imageWidth: 100,
|
396 |
imageHeight: 100,
|
@@ -398,7 +569,7 @@ jQuery(document).ready(function($) {
|
|
398 |
allowOutsideClick: false,
|
399 |
allowEscapeKey: false,
|
400 |
allowEnterKey: false,
|
401 |
-
showConfirmButton: false
|
402 |
});
|
403 |
|
404 |
return tmp;
|
@@ -406,143 +577,156 @@ jQuery(document).ready(function($) {
|
|
406 |
|
407 |
// display dialog to confirm action
|
408 |
function confirm_action(title, question, btn_confirm, btn_cancel) {
|
409 |
-
tmp =
|
410 |
title: title,
|
411 |
-
|
412 |
html: question,
|
413 |
showCancelButton: true,
|
414 |
focusConfirm: false,
|
415 |
focusCancel: true,
|
416 |
confirmButtonText: btn_confirm,
|
417 |
cancelButtonText: btn_cancel,
|
418 |
-
confirmButtonColor:
|
419 |
-
width:
|
420 |
});
|
421 |
|
422 |
return tmp;
|
423 |
} // confirm_action
|
424 |
|
425 |
-
$(
|
426 |
if (!confirmed) {
|
427 |
-
$(
|
428 |
e.preventDefault();
|
429 |
return false;
|
430 |
}
|
431 |
|
432 |
-
$(this)
|
433 |
-
.off('submit')
|
434 |
-
.submit();
|
435 |
return true;
|
436 |
}); // bypass default submit behaviour
|
437 |
|
438 |
-
$(
|
439 |
-
if ($(
|
440 |
-
|
441 |
title: wp_reset.invalid_confirmation_title,
|
442 |
text: wp_reset.invalid_confirmation,
|
443 |
-
|
444 |
-
confirmButtonText: wp_reset.ok_button
|
445 |
});
|
446 |
|
447 |
e.preventDefault();
|
448 |
return false;
|
449 |
} // wrong confirmation code
|
450 |
|
451 |
-
message = wp_reset.confirm1 +
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
|
|
|
|
469 |
|
470 |
e.preventDefault();
|
471 |
return false;
|
472 |
}); // reset submit
|
473 |
|
474 |
// collapse / expand card
|
475 |
-
$(
|
|
|
|
|
|
|
476 |
e.preventDefault();
|
477 |
|
478 |
-
card = $(this)
|
479 |
-
|
480 |
-
.toggleClass(
|
481 |
-
|
482 |
-
.toggleClass('dashicons-arrow-up-alt2')
|
483 |
-
.toggleClass('dashicons-arrow-down-alt2');
|
484 |
$(this).blur();
|
485 |
|
486 |
-
if (typeof skip_anim !=
|
487 |
-
$(card)
|
488 |
-
.find('.card-body')
|
489 |
-
.toggle();
|
490 |
} else {
|
491 |
-
$(card)
|
492 |
-
.find('.card-body')
|
493 |
-
.slideToggle(500);
|
494 |
}
|
495 |
|
496 |
-
cards = localStorage.getItem(
|
497 |
if (cards == null) {
|
498 |
cards = new Object();
|
499 |
} else {
|
500 |
cards = JSON.parse(cards);
|
501 |
}
|
502 |
|
503 |
-
card_id = card.attr(
|
504 |
|
505 |
-
if (card.hasClass(
|
506 |
-
cards[card_id] =
|
507 |
} else {
|
508 |
-
cards[card_id] =
|
509 |
}
|
510 |
-
localStorage.setItem(
|
511 |
|
512 |
return false;
|
513 |
}); // toggle-card
|
514 |
|
515 |
-
//
|
516 |
-
|
517 |
-
if (
|
518 |
-
|
|
|
|
|
519 |
}
|
520 |
-
|
521 |
-
|
522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
});
|
525 |
|
526 |
// dismiss notice / pointer
|
527 |
-
$(
|
528 |
-
notice_name = $(this).data(
|
529 |
if (!notice_name) {
|
530 |
return true;
|
531 |
}
|
532 |
|
533 |
-
if ($(this).data(
|
534 |
-
$(
|
535 |
}
|
536 |
|
537 |
$.get(ajaxurl, {
|
538 |
notice_name: notice_name,
|
539 |
_ajax_nonce: wp_reset.nonce_dismiss_notice,
|
540 |
-
action:
|
541 |
});
|
542 |
|
543 |
-
$(this)
|
544 |
-
.parents('.notice-wrapper')
|
545 |
-
.fadeOut();
|
546 |
|
547 |
e.preventDefault();
|
548 |
return false;
|
@@ -550,36 +734,36 @@ jQuery(document).ready(function($) {
|
|
550 |
|
551 |
// maybe init survey dialog
|
552 |
if (wp_reset.open_survey) {
|
553 |
-
$(
|
554 |
-
dialogClass:
|
555 |
modal: 1,
|
556 |
resizable: false,
|
557 |
width: 800,
|
558 |
-
height:
|
559 |
-
show:
|
560 |
-
hide:
|
561 |
-
close: function(event, ui) {},
|
562 |
-
open: function(event, ui) {
|
563 |
wpr_fix_dialog_close(event, ui);
|
564 |
},
|
565 |
autoOpen: true,
|
566 |
-
closeOnEscape: true
|
567 |
});
|
568 |
}
|
569 |
|
570 |
// turn questions into checkboxes
|
571 |
-
$(
|
572 |
-
if ($(this).hasClass(
|
573 |
-
$(this).removeClass(
|
574 |
} else {
|
575 |
-
if ($(
|
576 |
-
|
577 |
-
|
578 |
allowOutsideClick: false,
|
579 |
-
text:
|
580 |
});
|
581 |
} else {
|
582 |
-
$(this).addClass(
|
583 |
}
|
584 |
}
|
585 |
|
@@ -588,111 +772,781 @@ jQuery(document).ready(function($) {
|
|
588 |
});
|
589 |
|
590 |
// submit and hide survey
|
591 |
-
$(
|
592 |
-
if (
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
595 |
allowOutsideClick: false,
|
596 |
-
text:
|
597 |
});
|
598 |
return false;
|
599 |
}
|
600 |
|
601 |
if (
|
602 |
-
$(
|
603 |
-
$(
|
604 |
-
.parents(
|
605 |
-
.hasClass(
|
606 |
) {
|
607 |
-
|
608 |
-
|
609 |
allowOutsideClick: false,
|
610 |
-
text:
|
611 |
});
|
612 |
return false;
|
613 |
}
|
614 |
|
615 |
-
answers =
|
616 |
-
$(
|
617 |
-
answers += $(el).data(
|
618 |
});
|
619 |
|
620 |
$.post(ajaxurl, {
|
621 |
-
survey:
|
622 |
answers: answers,
|
623 |
-
emailme: $(
|
624 |
-
custom_answer: $(
|
625 |
_ajax_nonce: wp_reset.nonce_submit_survey,
|
626 |
-
action:
|
627 |
});
|
628 |
|
629 |
-
$(
|
630 |
-
|
631 |
-
|
632 |
-
text:
|
633 |
});
|
634 |
|
635 |
e.preventDefault();
|
636 |
return false;
|
637 |
});
|
638 |
|
639 |
-
$(
|
640 |
$(this).blur();
|
641 |
-
$(
|
642 |
|
643 |
e.preventDefault();
|
644 |
return false;
|
645 |
});
|
646 |
|
647 |
// webhooks dialog init
|
648 |
-
$(
|
649 |
-
dialogClass:
|
650 |
modal: 1,
|
651 |
resizable: false,
|
652 |
-
title:
|
653 |
width: 550,
|
654 |
-
height:
|
655 |
-
show:
|
656 |
-
hide:
|
657 |
-
open: function(event, ui) {
|
658 |
wpr_fix_dialog_close(event, ui);
|
659 |
$(this)
|
660 |
.siblings()
|
661 |
-
.find(
|
662 |
.html(wp_reset.webhooks_dialog_title);
|
663 |
},
|
664 |
-
close: function(event, ui) {},
|
665 |
autoOpen: false,
|
666 |
-
closeOnEscape: true
|
667 |
});
|
668 |
-
$(window).resize(function(e) {
|
669 |
-
$(
|
670 |
-
my:
|
671 |
-
at:
|
672 |
-
of: window
|
673 |
});
|
674 |
});
|
675 |
|
676 |
-
jQuery(
|
677 |
-
$(
|
678 |
-
jQuery(
|
679 |
'<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="' +
|
680 |
wp_reset.webhooks_install_url +
|
681 |
'" style="width:100%;height:100%;border:none;" /></div>'
|
682 |
);
|
683 |
-
jQuery(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
684 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
}); // onload
|
688 |
|
689 |
function wpr_fix_dialog_close(event, ui) {
|
690 |
-
jQuery(
|
691 |
-
jQuery(
|
692 |
});
|
693 |
} // wpr_fix_dialog_close
|
694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
function wpr_close_dropdowns() {
|
696 |
-
jQuery(
|
697 |
-
jQuery(
|
698 |
} // wpr_close_dropdowns
|
1 |
/**
|
2 |
* WP Reset
|
3 |
* https://wpreset.com/
|
4 |
+
* (c) WebFactory Ltd, 2017-2020
|
5 |
*/
|
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();
|
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 |
}); // 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,
|
145 |
+
},
|
146 |
+
},
|
147 |
+
];
|
148 |
+
var looper = $.Deferred().resolve();
|
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) {
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
|
160 |
+
wpr_swal.fire({
|
161 |
+
title: $(button).data("text-wait"),
|
162 |
+
text: " ",
|
163 |
+
type: false,
|
164 |
+
allowOutsideClick: false,
|
165 |
+
allowEscapeKey: false,
|
166 |
+
allowEnterKey: false,
|
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;
|
178 |
+
$.each(tools, function (i, data) {
|
179 |
+
looper = looper.then(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,
|
191 |
+
},
|
192 |
+
url: ajaxurl,
|
193 |
+
})
|
194 |
+
.done(function (response) {
|
195 |
+
if (response.success) {
|
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 |
+
});
|
216 |
+
failed = true;
|
217 |
+
return false;
|
218 |
+
}
|
219 |
+
})
|
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;
|
227 |
+
return false;
|
228 |
+
});
|
229 |
+
});
|
230 |
+
});
|
231 |
+
}); // confirm ok
|
232 |
|
233 |
return false;
|
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) {
|
288 |
+
return false;
|
289 |
+
}
|
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 |
})
|
319 |
+
.always(function (data) {
|
320 |
+
wpr_swal.close();
|
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 |
})
|
375 |
+
.always(function (data) {
|
376 |
+
wpr_swal.close();
|
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,
|
421 |
+
focusConfirm: false,
|
422 |
+
confirmButtonText: wp_reset.snapshot_confirm,
|
423 |
+
cancelButtonText: wp_reset.cancel_button,
|
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 |
})
|
438 |
+
.always(function (data) {
|
439 |
+
wpr_swal.close();
|
440 |
+
})
|
441 |
+
.done(function (data) {
|
442 |
+
if (data.success) {
|
443 |
+
wpr_swal
|
444 |
+
.fire({
|
445 |
+
icon: "success",
|
446 |
+
title: wp_reset.snapshot_success,
|
447 |
+
timer: 2500,
|
448 |
+
timerProgressBar: true,
|
449 |
+
showConfirmButton: true,
|
450 |
+
})
|
451 |
+
.then((result) => {
|
452 |
+
location.reload();
|
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 |
+
});
|
467 |
+
} // if confirmed
|
468 |
+
});
|
|
|
|
|
|
|
|
|
469 |
|
470 |
return false;
|
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,
|
509 |
+
},
|
510 |
})
|
511 |
+
.always(function (data) {
|
512 |
+
wpr_swal.close();
|
513 |
})
|
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 |
});
|
553 |
} // if confirmed
|
554 |
});
|
556 |
|
557 |
// display a message while an action is performed
|
558 |
function block_ui(message) {
|
559 |
+
tmp = wpr_swal.fire({
|
560 |
text: message,
|
561 |
type: false,
|
562 |
imageUrl: wp_reset.icon_url,
|
563 |
onOpen: () => {
|
564 |
+
$(wpr_swal.getImage()).addClass("rotating");
|
565 |
},
|
566 |
imageWidth: 100,
|
567 |
imageHeight: 100,
|
569 |
allowOutsideClick: false,
|
570 |
allowEscapeKey: false,
|
571 |
allowEnterKey: false,
|
572 |
+
showConfirmButton: false,
|
573 |
});
|
574 |
|
575 |
return tmp;
|
577 |
|
578 |
// display dialog to confirm action
|
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 |
|
616 |
e.preventDefault();
|
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 |
|
641 |
e.preventDefault();
|
642 |
return false;
|
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 |
|
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);
|
748 |
},
|
749 |
autoOpen: true,
|
750 |
+
closeOnEscape: true,
|
751 |
});
|
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 |
});
|
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 <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 |
+
|
1001 |
+
// Collections
|
1002 |
+
// for demo purposes only
|
1003 |
+
var collections_ajax_queue = [];
|
1004 |
+
var collections_ajax_queue_count = 0;
|
1005 |
+
var collections_ajax_queue_index = 0;
|
1006 |
+
var collections_errors = [];
|
1007 |
+
var collections_retried = false;
|
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 () {
|
1103 |
+
collections_ajax_queue.push({
|
1104 |
+
slug: item_data.slug,
|
1105 |
+
name: item_data.name,
|
1106 |
+
extra_data: {
|
1107 |
+
source: item_data.source,
|
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,
|
1139 |
+
collection_item_id: collection_item_id,
|
1140 |
+
},
|
1141 |
+
});
|
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();
|
1161 |
+
},
|
1162 |
+
allowOutsideClick: false,
|
1163 |
+
allowEscapeKey: false,
|
1164 |
+
allowEnterKey: false,
|
1165 |
+
showCancelButton: true,
|
1166 |
+
confirmButtonText: "OK",
|
1167 |
+
})
|
1168 |
+
.then((result) => {
|
1169 |
+
collections_ajax_queue = [];
|
1170 |
+
});
|
1171 |
+
|
1172 |
+
return false;
|
1173 |
+
}); // install collection item
|
1174 |
+
|
1175 |
+
// show install collection popup
|
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 () {
|
1185 |
+
install_collection(collection_id, do_activate, do_delete);
|
1186 |
+
},
|
1187 |
+
allowOutsideClick: false,
|
1188 |
+
allowEscapeKey: false,
|
1189 |
+
allowEnterKey: false,
|
1190 |
+
showCancelButton: true,
|
1191 |
+
showConfirmButton: false,
|
1192 |
+
confirmButtonText: "OK",
|
1193 |
+
})
|
1194 |
+
.then((result) => {
|
1195 |
+
collections_ajax_queue = [];
|
1196 |
+
});
|
1197 |
+
} // show install collection popup
|
1198 |
+
|
1199 |
+
// create install collection queue and add popup content
|
1200 |
+
function install_collection(collection_id, do_activate, do_delete) {
|
1201 |
+
collections_ajax_queue = [];
|
1202 |
+
collections_ajax_queue_count = 0;
|
1203 |
+
collections_ajax_queue_index = 0;
|
1204 |
+
collections_errors = [];
|
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,
|
1213 |
+
extra_data: {
|
1214 |
+
source: item_data.source,
|
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,
|
1234 |
+
collection_item_id: item_data.id,
|
1235 |
+
},
|
1236 |
+
});
|
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 |
+
}
|
1244 |
+
|
1245 |
+
for (ci in collections_ajax_queue) {
|
1246 |
+
var message = false;
|
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 |
+
}
|
1285 |
+
|
1286 |
+
collections_ajax_queue_count = collections_ajax_queue.length;
|
1287 |
+
collections_do_ajax();
|
1288 |
+
} // create install collection queue
|
1289 |
+
|
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;
|
1350 |
+
collections_do_ajax();
|
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:
|
1418 |
+
error = false;
|
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;
|
1442 |
+
collections_ajax_queue_index++;
|
1443 |
+
|
1444 |
+
if (collections_ajax_queue.length == 0) {
|
1445 |
+
wpr_swal.close();
|
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) => {
|
1502 |
+
location.reload();
|
1503 |
+
});
|
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,
|
1512 |
+
})
|
1513 |
+
.then((result) => {
|
1514 |
+
location.reload();
|
1515 |
+
});
|
1516 |
+
}
|
1517 |
+
}
|
1518 |
+
},
|
1519 |
+
});
|
1520 |
+
} //run collection ajax
|
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 |
|
1529 |
+
function wpr_clear_local(clear_cookies, clear_storage) {
|
1530 |
+
var cnt = 0;
|
1531 |
+
|
1532 |
+
if (clear_cookies) {
|
1533 |
+
var cookies = Cookies.get();
|
1534 |
+
cnt += Object.keys(cookies).length;
|
1535 |
+
for (cookie in cookies) {
|
1536 |
+
Cookies.remove(cookie);
|
1537 |
+
}
|
1538 |
+
}
|
1539 |
+
|
1540 |
+
if (clear_storage) {
|
1541 |
+
cnt += localStorage.length + sessionStorage.length;
|
1542 |
+
localStorage.clear();
|
1543 |
+
sessionStorage.clear();
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
return cnt;
|
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
|
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,
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,9 +20,6 @@ For support please use the <a href="https://wordpress.org/support/plugin/wp-rese
|
|
20 |
|
21 |
Access WP Reset admin page via the "Tools" menu.
|
22 |
|
23 |
-
WP Reset is fully integrated with <a href="https://wordpress.org/plugins/wp-webhooks/">WP Webhooks</a> plugin - a secure, universal system that connects WP to any 3rd party systems and enables you to initiate actions both from WordPress (for instance start a MailChimp campaign once a new user registers), and from any other application (create a new user in WP when a purchase is made on a 3rd party system). View more <a href="https://underconstructionpage.com/wp-webhooks-connect-integrate-wordpress/" target="_blank">practical use-cases</a> that save hours of repetitive work.
|
24 |
-
|
25 |
-
|
26 |
**Please read carefully before proceeding to understand what WP Reset does, and remember to always create a snapshot**
|
27 |
|
28 |
#### Resetting will delete:
|
@@ -118,6 +115,16 @@ Or if needed, upload manually;
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= v1.77 =
|
122 |
* 2019/12/25
|
123 |
* minor bug fixes
|
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 |
|
20 |
|
21 |
Access WP Reset admin page via the "Tools" menu.
|
22 |
|
|
|
|
|
|
|
23 |
**Please read carefully before proceeding to understand what WP Reset does, and remember to always create a snapshot**
|
24 |
|
25 |
#### Resetting will delete:
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= v1.80 =
|
119 |
+
* 2020/04/17
|
120 |
+
* new tool: Purge Cache
|
121 |
+
* new tool: Delete Local Data
|
122 |
+
* fixed "Delete all plugins" tool
|
123 |
+
* other minor bug fixes
|
124 |
+
* started selling WP Reset PRO
|
125 |
+
* 200,000 installs hit on 2020-03-07 with 1,560,000 downloads
|
126 |
+
|
127 |
+
|
128 |
= v1.77 =
|
129 |
* 2019/12/25
|
130 |
* minor bug fixes
|
wp-reset-cli.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* WP Reset
|
5 |
* https://wpreset.com/
|
6 |
-
* (c) WebFactory Ltd, 2017-
|
7 |
*/
|
8 |
|
9 |
|
3 |
/**
|
4 |
* WP Reset
|
5 |
* https://wpreset.com/
|
6 |
+
* (c) WebFactory Ltd, 2017-2020
|
7 |
*/
|
8 |
|
9 |
|
wp-reset-licensing.php
ADDED
@@ -0,0 +1,629 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebFactory Licensing Manager
|
4 |
+
* (c) WebFactory Ltd
|
5 |
+
* www.webfactoryltd.com
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
if (false === class_exists('WF_Licensing')) {
|
10 |
+
class WF_Licensing
|
11 |
+
{
|
12 |
+
public $prefix = '';
|
13 |
+
private $licensing_servers = array();
|
14 |
+
private $version = '';
|
15 |
+
private $slug = '';
|
16 |
+
private $basename = '';
|
17 |
+
private $plugin_file = '';
|
18 |
+
private $js_folder = '';
|
19 |
+
protected $api_ver = 'v1/';
|
20 |
+
protected $valid_forever = '2035-01-01';
|
21 |
+
protected $unlimited_installs = 99999;
|
22 |
+
public $debug = false;
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Init licensing by setting up various params and hooking into actions.
|
27 |
+
*
|
28 |
+
* @param array $params Prefix, licensing_servers, version, plugin_file, skip_hooks
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
function __construct($params)
|
33 |
+
{
|
34 |
+
$this->prefix = trim($params['prefix']);
|
35 |
+
$this->licensing_servers = $params['licensing_servers'];
|
36 |
+
$this->version = trim($params['version']);
|
37 |
+
$this->slug = dirname(plugin_basename(trim($params['plugin_file'])));
|
38 |
+
$this->basename = plugin_basename(trim($params['plugin_file']));
|
39 |
+
$this->plugin_file = $params['plugin_file'];
|
40 |
+
$this->debug = !empty($params['debug']);
|
41 |
+
|
42 |
+
if ($params['js_folder']) {
|
43 |
+
$this->js_folder = trim($params['js_folder']);
|
44 |
+
} else {
|
45 |
+
$this->js_folder = plugin_dir_url($this->plugin_file) . 'js/';
|
46 |
+
}
|
47 |
+
|
48 |
+
if (empty($params['skip_hooks'])) {
|
49 |
+
register_activation_hook($this->plugin_file, array($this, 'activate_plugin'));
|
50 |
+
register_deactivation_hook($this->plugin_file, array($this, 'deactivate_plugin'));
|
51 |
+
|
52 |
+
add_filter('pre_set_site_transient_update_plugins', array($this, 'update_filter'));
|
53 |
+
add_filter('plugins_api', array($this, 'update_details'), 100, 3);
|
54 |
+
|
55 |
+
add_action('init', array($this, 'init'));
|
56 |
+
|
57 |
+
add_action('wp_ajax_wf_licensing_' . $this->prefix . '_validate', array($this, 'validate_ajax'));
|
58 |
+
add_action('wp_ajax_wf_licensing_' . $this->prefix . '_save', array($this, 'save_ajax'));
|
59 |
+
add_action('wp_ajax_wf_licensing_' . $this->prefix . '_deactivate', array($this, 'deactivate_ajax'));
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->log('__construct', $params, get_object_vars($this));
|
63 |
+
} // __construct
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Actions performed on WP init action.
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
function init()
|
72 |
+
{
|
73 |
+
if (is_admin()) {
|
74 |
+
$vars = array(
|
75 |
+
'prefix' => $this->prefix,
|
76 |
+
'debug' => $this->debug,
|
77 |
+
'nonce' => wp_create_nonce('wf_licensing_' . $this->prefix),
|
78 |
+
'licensing_endpoint' => $this->licensing_servers[0] . $this->api_ver,
|
79 |
+
'request_data' => array(
|
80 |
+
'action' => 'validate_license',
|
81 |
+
'license_key' => '',
|
82 |
+
'rand' => rand(1000, 9999),
|
83 |
+
'version' => $this->version,
|
84 |
+
'wp_version' => get_bloginfo('version'),
|
85 |
+
'site_url' => get_home_url(),
|
86 |
+
'site_title' => get_bloginfo('name'),
|
87 |
+
'meta' => array()
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
wp_enqueue_script('wf_licensing', $this->js_folder . 'wf-licensing.js', array(), 1.0, true);
|
92 |
+
wp_localize_script('wf_licensing', 'wf_licensing_' . $this->prefix, $vars);
|
93 |
+
}
|
94 |
+
} // init
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Log message if debugging is enabled.
|
99 |
+
* Log file: /wp-content/wf-licensing.log
|
100 |
+
*
|
101 |
+
* @param string $message Message to write to log.
|
102 |
+
* @param mixed $data Optional, extra data to write to debug log.
|
103 |
+
*
|
104 |
+
* @return void
|
105 |
+
*/
|
106 |
+
function log($message, ...$data)
|
107 |
+
{
|
108 |
+
if (!$this->debug) {
|
109 |
+
return;
|
110 |
+
}
|
111 |
+
|
112 |
+
$log_file = trailingslashit(WP_CONTENT_DIR) . 'wf-licensing.log';
|
113 |
+
$fp = fopen($log_file, 'a+');
|
114 |
+
|
115 |
+
fputs($fp, '[' . date('r') . '] ' . $this->prefix . ': ');
|
116 |
+
fputs($fp, (string) $message . PHP_EOL);
|
117 |
+
foreach ($data as $tmp) {
|
118 |
+
fputs($fp, var_export($tmp, true) . PHP_EOL);
|
119 |
+
}
|
120 |
+
|
121 |
+
fputs($fp, PHP_EOL);
|
122 |
+
fclose($fp);
|
123 |
+
} // log
|
124 |
+
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Fetches license details from the database.
|
128 |
+
*
|
129 |
+
* @param string $key If set returns only requested options key.
|
130 |
+
*
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
function get_license($key = '')
|
134 |
+
{
|
135 |
+
$default = array(
|
136 |
+
'license_key' => '',
|
137 |
+
'error' => '',
|
138 |
+
'valid_until' => '',
|
139 |
+
'last_check' => 0,
|
140 |
+
'name' => '',
|
141 |
+
'meta' => array()
|
142 |
+
);
|
143 |
+
|
144 |
+
$options = get_option('wf_licensing_' . $this->prefix, array());
|
145 |
+
$options = array_merge($default, $options);
|
146 |
+
|
147 |
+
if (!empty($key)) {
|
148 |
+
return $options[$key];
|
149 |
+
} else {
|
150 |
+
return $options;
|
151 |
+
}
|
152 |
+
} // get_license
|
153 |
+
|
154 |
+
|
155 |
+
function get_license_formatted($key = '')
|
156 |
+
{
|
157 |
+
$license = $this->get_license();
|
158 |
+
$out = array(
|
159 |
+
'name' => '',
|
160 |
+
'name_long' => '',
|
161 |
+
'valid_until' => '',
|
162 |
+
'expires' => '',
|
163 |
+
'license_key' => '',
|
164 |
+
'license_key_hidden' => '',
|
165 |
+
'recurring' => false,
|
166 |
+
'keyless' => false,
|
167 |
+
);
|
168 |
+
|
169 |
+
if (!$this->is_active()) {
|
170 |
+
return $out;
|
171 |
+
}
|
172 |
+
$license['valid_until'] = $license['valid_until'];
|
173 |
+
|
174 |
+
$out['name'] = $license['name'];
|
175 |
+
$out['name_long'] = $license['name'];
|
176 |
+
if ($license['meta']) {
|
177 |
+
$tmp = '';
|
178 |
+
foreach ($license['meta'] as $meta => $meta_value) {
|
179 |
+
|
180 |
+
if ($meta[0] == '_' || filter_var($meta_value, FILTER_VALIDATE_BOOLEAN) != true) {
|
181 |
+
continue;
|
182 |
+
}
|
183 |
+
$meta = str_replace('_', ' ', $meta);
|
184 |
+
$meta = ucwords($meta);
|
185 |
+
$meta = str_ireplace('wpr ', 'WPR ', $meta);
|
186 |
+
$tmp .= $meta . ', ';
|
187 |
+
}
|
188 |
+
$tmp = trim($tmp, ', ');
|
189 |
+
if ($tmp) {
|
190 |
+
$out['name_long'] .= ' with ' . $tmp;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
if ($license['valid_until'] == $this->valid_forever) {
|
195 |
+
$out['valid_until'] = 'forever';
|
196 |
+
$out['recurring'] = false;
|
197 |
+
} else {
|
198 |
+
$out['valid_until'] = 'until ' . date(get_option('date_format'), strtotime($license['valid_until']));
|
199 |
+
$out['recurring'] = true;
|
200 |
+
}
|
201 |
+
|
202 |
+
if (date('Y-m-d') == $license['valid_until']) {
|
203 |
+
$out['expires'] = 'today';
|
204 |
+
} elseif (date('Y-m-d', time() + 30 * DAY_IN_SECONDS) > $license['valid_until']) {
|
205 |
+
$tmp = (strtotime($license['valid_until'] . date(' G:i:s')) - time()) / DAY_IN_SECONDS;
|
206 |
+
$out['expires'] = 'in ' . round($tmp) . ' days';
|
207 |
+
} else {
|
208 |
+
$out['expires'] = 'in more than 30 days';
|
209 |
+
}
|
210 |
+
|
211 |
+
if (empty($license['license_key']) || $license['license_key'] == 'keyless') {
|
212 |
+
$out['keyless'] = true;
|
213 |
+
} else {
|
214 |
+
$out['keyless'] = false;
|
215 |
+
$out['license_key'] = $license['license_key'];
|
216 |
+
$tmp = strlen($license['license_key']);
|
217 |
+
$dash = false;
|
218 |
+
$new = '';
|
219 |
+
for ($i = $tmp - 1; $i >= 0; $i--) {
|
220 |
+
if ($dash == false || $out['license_key'][$i] == '-') {
|
221 |
+
$new = $out['license_key'][$i] . $new;
|
222 |
+
} else {
|
223 |
+
$new = '*' . $new;
|
224 |
+
}
|
225 |
+
if ($out['license_key'][$i] == '-') {
|
226 |
+
$dash = true;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
$out['license_key_hidden'] = $new;
|
230 |
+
}
|
231 |
+
|
232 |
+
$out = apply_filters('wf_licensing_license_formatted_' . $this->prefix, $out);
|
233 |
+
|
234 |
+
if (!empty($key)) {
|
235 |
+
return $out[$key];
|
236 |
+
} else {
|
237 |
+
return $out;
|
238 |
+
}
|
239 |
+
} // get_license_formatted
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Updates license details in the database.
|
244 |
+
*
|
245 |
+
* @param string $data License data to save; or empty to delete license
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
function update_license($data = false)
|
250 |
+
{
|
251 |
+
if (false === $data) {
|
252 |
+
$tmp = delete_option('wf_licensing_' . $this->prefix);
|
253 |
+
} else {
|
254 |
+
$tmp = update_option('wf_licensing_' . $this->prefix, $data);
|
255 |
+
}
|
256 |
+
|
257 |
+
return $tmp;
|
258 |
+
} // update_license
|
259 |
+
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Check if license is valid
|
263 |
+
*
|
264 |
+
* @param string $feature If set it checks for a specific feature.
|
265 |
+
* @param bool $force_check Forces license recheck on server instead of just cached values.
|
266 |
+
*
|
267 |
+
* @return boolean
|
268 |
+
*/
|
269 |
+
function is_active($feature = '', $force_check = false)
|
270 |
+
{
|
271 |
+
$last_check = $this->get_license('last_check');
|
272 |
+
if ($force_check || ($last_check && ($last_check + HOUR_IN_SECONDS * 8) < time())) {
|
273 |
+
$this->log('auto recheck license');
|
274 |
+
$this->validate();
|
275 |
+
}
|
276 |
+
|
277 |
+
$license = $this->get_license();
|
278 |
+
|
279 |
+
if (
|
280 |
+
!empty($license['license_key']) && !empty($license['name']) &&
|
281 |
+
!empty($license['valid_until']) && $license['valid_until'] >= date('Y-m-d')
|
282 |
+
) {
|
283 |
+
if (!empty($feature)) {
|
284 |
+
if (!empty($license['meta'][$feature]) && filter_var($license['meta'][$feature], FILTER_VALIDATE_BOOLEAN) == true) {
|
285 |
+
return true;
|
286 |
+
} else {
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
} else {
|
290 |
+
return true;
|
291 |
+
}
|
292 |
+
} else {
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
} // is_active
|
296 |
+
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Hook to plugin activation action.
|
300 |
+
* If there's a license key, try to activate & write response.
|
301 |
+
*
|
302 |
+
* @return void
|
303 |
+
*/
|
304 |
+
function activate_plugin()
|
305 |
+
{
|
306 |
+
$license = $this->get_license();
|
307 |
+
if ($this->is_active() || empty($license['license_key'])) {
|
308 |
+
return false;
|
309 |
+
}
|
310 |
+
|
311 |
+
$tmp = $this->validate();
|
312 |
+
if ($tmp) {
|
313 |
+
$this->log('activating plugin, license activated');
|
314 |
+
return true;
|
315 |
+
} else {
|
316 |
+
$this->log('activating plugin, unable to activate license');
|
317 |
+
return false;
|
318 |
+
}
|
319 |
+
} // activate_plugin
|
320 |
+
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Hook to plugin deactivation action.
|
324 |
+
* If there's a license key, try to deactivate & write response.
|
325 |
+
*
|
326 |
+
* @return void
|
327 |
+
*/
|
328 |
+
function deactivate_plugin()
|
329 |
+
{
|
330 |
+
if (!$this->is_active()) {
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
|
334 |
+
$license = $this->get_license();
|
335 |
+
$result = $this->query_licensing_server('deactivate_license');
|
336 |
+
|
337 |
+
if (is_wp_error($result) || !is_array($result) || !isset($result['success']) || $result['success'] == false) {
|
338 |
+
$this->log('unable to deactivate license');
|
339 |
+
|
340 |
+
return false;
|
341 |
+
} else {
|
342 |
+
$license['error'] = '';
|
343 |
+
$license['name'] = '';
|
344 |
+
$license['valid_until'] = '';
|
345 |
+
$license['meta'] = '';
|
346 |
+
$license['last_check'] = 0;
|
347 |
+
$this->update_license($license);
|
348 |
+
$this->log('license deactivated');
|
349 |
+
|
350 |
+
return true;
|
351 |
+
}
|
352 |
+
} // deactivate_plugin
|
353 |
+
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Use when uninstalling (deleting) the plugin to clean up.
|
357 |
+
*
|
358 |
+
* @param string $prefix Same prefix as used when initialising the class.
|
359 |
+
* @return bool
|
360 |
+
*/
|
361 |
+
static function uninstall_plugin($prefix)
|
362 |
+
{
|
363 |
+
$tmp = delete_option('wf_licensing_' . $prefix);
|
364 |
+
|
365 |
+
return $tmp;
|
366 |
+
} // uninstall_plugin
|
367 |
+
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Deletes license locally and send deactivate ping to licensing server
|
371 |
+
*
|
372 |
+
* @return void
|
373 |
+
*/
|
374 |
+
function deactivate() {
|
375 |
+
$result = $this->query_licensing_server('deactivate_license', array());
|
376 |
+
$this->update_license(false);
|
377 |
+
|
378 |
+
return $result;
|
379 |
+
} // deactivate
|
380 |
+
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Validate license key on server and save response.
|
384 |
+
*
|
385 |
+
* @param string $license_key License key, or leave empty to pull from saved.
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
+
*/
|
389 |
+
function validate($license_key = '')
|
390 |
+
{
|
391 |
+
$license = $this->get_license();
|
392 |
+
if (empty($license_key)) {
|
393 |
+
$license_key = $license['license_key'];
|
394 |
+
}
|
395 |
+
|
396 |
+
$out = array(
|
397 |
+
'license_key' => $license_key,
|
398 |
+
'error' => '',
|
399 |
+
'name' => '',
|
400 |
+
'last_check' => 0,
|
401 |
+
'valid_until' => '',
|
402 |
+
'meta' => array()
|
403 |
+
);
|
404 |
+
|
405 |
+
$result = $this->query_licensing_server('validate_license', array('license_key' => $license_key));
|
406 |
+
|
407 |
+
if (is_wp_error($result)) {
|
408 |
+
$out['error'] = 'Error querying licensing server. ' . $result->get_error_message() . ' Please try again in a few moments.';
|
409 |
+
$this->update_license($out);
|
410 |
+
|
411 |
+
return false;
|
412 |
+
} elseif (!is_array($result) || !isset($result['success'])) {
|
413 |
+
$out['error'] = 'Invalid response from licensing server. Please try again in a few moments.';
|
414 |
+
$this->update_license($out);
|
415 |
+
|
416 |
+
return false;
|
417 |
+
} elseif ($result['success'] == false) {
|
418 |
+
$out['error'] = $result['data'];
|
419 |
+
$this->update_license($out);
|
420 |
+
|
421 |
+
return true;
|
422 |
+
} else {
|
423 |
+
$out['error'] = $result['data']['error'];
|
424 |
+
$out['name'] = $result['data']['name'];
|
425 |
+
$out['valid_until'] = $result['data']['valid_until'];
|
426 |
+
$out['meta'] = $result['data']['meta'];
|
427 |
+
$out['last_check'] = time();
|
428 |
+
$this->update_license($out);
|
429 |
+
|
430 |
+
return true;
|
431 |
+
}
|
432 |
+
} // validate
|
433 |
+
|
434 |
+
|
435 |
+
function validate_ajax()
|
436 |
+
{
|
437 |
+
check_ajax_referer('wf_licensing_' . $this->prefix);
|
438 |
+
|
439 |
+
$license_key = trim($_REQUEST['license_key']);
|
440 |
+
if (empty($license_key)) {
|
441 |
+
$this->update_license(false);
|
442 |
+
do_action('wf_licensing_' . $this->prefix . '_validate_ajax', $license_key, false);
|
443 |
+
|
444 |
+
wp_send_json_success();
|
445 |
+
} else {
|
446 |
+
$result = $this->validate($license_key);
|
447 |
+
$license = $this->get_license();
|
448 |
+
do_action('wf_licensing_' . $this->prefix . '_validate_ajax', $license_key, $result);
|
449 |
+
|
450 |
+
if ($result == true) {
|
451 |
+
set_site_transient('update_plugins', null);
|
452 |
+
wp_send_json_success($result);
|
453 |
+
} else {
|
454 |
+
wp_send_json_error($license);
|
455 |
+
}
|
456 |
+
}
|
457 |
+
} // validate_ajax
|
458 |
+
|
459 |
+
|
460 |
+
function deactivate_ajax()
|
461 |
+
{
|
462 |
+
check_ajax_referer('wf_licensing_' . $this->prefix);
|
463 |
+
|
464 |
+
$old_license = $this->get_license();
|
465 |
+
$result = $this->deactivate();
|
466 |
+
do_action('wf_licensing_' . $this->prefix . '_deactivate_ajax', $old_license, $result);
|
467 |
+
wp_send_json_success($result);
|
468 |
+
} // deactivate_ajax
|
469 |
+
|
470 |
+
|
471 |
+
function save_ajax()
|
472 |
+
{
|
473 |
+
check_ajax_referer('wf_licensing_' . $this->prefix);
|
474 |
+
|
475 |
+
$out['license_key'] = trim($_POST['license_key']);
|
476 |
+
|
477 |
+
if ($_POST['success'] == 'true') {
|
478 |
+
$out['error'] = trim($_POST['data']['error']);
|
479 |
+
$out['name'] = trim($_POST['data']['name']);
|
480 |
+
$out['valid_until'] = trim($_POST['data']['valid_until']);
|
481 |
+
$out['meta'] = $_POST['data']['meta'];
|
482 |
+
} else {
|
483 |
+
$out['error'] = trim($_POST['data']);
|
484 |
+
$out['name'] = '';
|
485 |
+
$out['valid_until'] = '';
|
486 |
+
$out['meta'] = array();
|
487 |
+
}
|
488 |
+
$out['last_check'] = time();
|
489 |
+
|
490 |
+
$this->update_license($out);
|
491 |
+
do_action('wf_licensing_' . $this->prefix . '_save_ajax', $out);
|
492 |
+
|
493 |
+
wp_send_json_success();
|
494 |
+
} // save_ajax
|
495 |
+
|
496 |
+
|
497 |
+
/**
|
498 |
+
* Run license server query.
|
499 |
+
*
|
500 |
+
* @param string $action
|
501 |
+
* @param array $data
|
502 |
+
*
|
503 |
+
* @return string response|bool
|
504 |
+
*/
|
505 |
+
function query_licensing_server($action, $data = array())
|
506 |
+
{
|
507 |
+
$license = $this->get_license();
|
508 |
+
|
509 |
+
$request_params = array('sslverify' => false, 'timeout' => 25, 'redirection' => 2);
|
510 |
+
$default_data = array(
|
511 |
+
'action' => '',
|
512 |
+
'license_key' => $license['license_key'],
|
513 |
+
'rand' => rand(1000, 9999),
|
514 |
+
'version' => $this->version,
|
515 |
+
'wp_version' => get_bloginfo('version'),
|
516 |
+
'site_url' => get_home_url(),
|
517 |
+
'site_title' => get_bloginfo('name'),
|
518 |
+
'meta' => array()
|
519 |
+
);
|
520 |
+
|
521 |
+
$request_data = array_merge($default_data, $data, array('action' => $action));
|
522 |
+
$request_data = apply_filters('wf_licensing_query_server_data', $request_data);
|
523 |
+
array_walk_recursive($request_data, function (&$val, $ind) {
|
524 |
+
$val = rawurlencode($val);
|
525 |
+
});
|
526 |
+
|
527 |
+
$this->log('query licensing server', $request_data);
|
528 |
+
|
529 |
+
$url = rtrim(add_query_arg($request_data, trailingslashit($this->licensing_servers[0] . $this->api_ver)), '&');
|
530 |
+
$response = wp_remote_get($url, $request_params);
|
531 |
+
$body = wp_remote_retrieve_body($response);
|
532 |
+
$result = @json_decode($body, true);
|
533 |
+
|
534 |
+
$this->log('licensing server response', $response);
|
535 |
+
|
536 |
+
if (is_wp_error($response) || empty($body) || !is_array($result) || !isset($result['success'])) {
|
537 |
+
if (is_wp_error($response)) {
|
538 |
+
return $response;
|
539 |
+
} else {
|
540 |
+
return new WP_Error(1, 'Invalid server response format.');
|
541 |
+
}
|
542 |
+
} else {
|
543 |
+
return $result;
|
544 |
+
}
|
545 |
+
} // query_licensing_server
|
546 |
+
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Plugin info lightbox
|
550 |
+
*
|
551 |
+
* @param object $return
|
552 |
+
* @param string $action
|
553 |
+
* @param object $args
|
554 |
+
*
|
555 |
+
* @return object
|
556 |
+
*/
|
557 |
+
function update_details($return, $action, $args)
|
558 |
+
{
|
559 |
+
if (!$this->is_active()) {
|
560 |
+
return $return;
|
561 |
+
}
|
562 |
+
|
563 |
+
static $response = false;
|
564 |
+
|
565 |
+
if ($action != 'plugin_information' || empty($args->slug) || $args->slug != $this->slug) {
|
566 |
+
return $return;
|
567 |
+
}
|
568 |
+
|
569 |
+
if (empty($response) || is_wp_error($response)) {
|
570 |
+
$response = $this->query_licensing_server('plugin_information', array('request_details' => serialize($args)));
|
571 |
+
}
|
572 |
+
|
573 |
+
if (is_wp_error($response)) {
|
574 |
+
$res = new WP_Error('plugins_api_failed', 'xAn unexpected HTTP error occurred during the API request.', $response->get_error_message());
|
575 |
+
} elseif ($response['success'] != true) {
|
576 |
+
$res = new WP_Error('plugins_api_failed', 'Invalid response data received during the API request.', $response['data']);
|
577 |
+
} else {
|
578 |
+
$res = (object) $response['data'];
|
579 |
+
$res->sections = (array) $res->sections;
|
580 |
+
$res->banners = (array) $res->banners;
|
581 |
+
$res->icons = (array) $res->icons;
|
582 |
+
}
|
583 |
+
|
584 |
+
return $res;
|
585 |
+
} // update_details
|
586 |
+
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Get info on new plugin version if one exists
|
590 |
+
*
|
591 |
+
* @param object current plugin info
|
592 |
+
*
|
593 |
+
* @return object update info
|
594 |
+
*/
|
595 |
+
function update_filter($current)
|
596 |
+
{
|
597 |
+
if (!$this->is_active()) {
|
598 |
+
return $current;
|
599 |
+
}
|
600 |
+
|
601 |
+
static $response = false;
|
602 |
+
|
603 |
+
$response = get_transient('wf_plugin_update_' . $this->prefix);
|
604 |
+
|
605 |
+
if (empty($response)) {
|
606 |
+
$response = $this->query_licensing_server('update_info');
|
607 |
+
set_transient('wf_plugin_update_' . $this->prefix, $response, 120);
|
608 |
+
}
|
609 |
+
|
610 |
+
if (!is_wp_error($response) && $response['success'] == true) {
|
611 |
+
$data = (object)$response['data'];
|
612 |
+
|
613 |
+
if (empty($current)) {
|
614 |
+
$current = new stdClass();
|
615 |
+
}
|
616 |
+
if (empty($current->response)) {
|
617 |
+
$current->response = array();
|
618 |
+
}
|
619 |
+
if (!empty($data) && is_object($data) && version_compare($data->new_version, $this->version) === 1) {
|
620 |
+
$data->icons = (array) $data->icons;
|
621 |
+
$data->banners = (array) $data->banners;
|
622 |
+
$current->response[$this->basename] = $data;
|
623 |
+
}
|
624 |
+
}
|
625 |
+
|
626 |
+
return $current;
|
627 |
+
} // update_filter
|
628 |
+
} // WF_Licensing
|
629 |
+
} // if WF_Licensing
|
wp-reset-utility.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* WP Reset
|
4 |
+
* Utility & Helper functions
|
5 |
+
* (c) WebFactory Ltd, 2015 - 2020
|
6 |
+
*/
|
7 |
+
|
8 |
+
// include only file
|
9 |
+
if (!defined('ABSPATH')) {
|
10 |
+
die('Do not open this file directly.');
|
11 |
+
}
|
12 |
+
|
13 |
+
class WP_Reset_Utility
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Get a list of WordPress versions available for installation
|
17 |
+
*
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
static function get_wordpress_versions()
|
21 |
+
{
|
22 |
+
$versions = 'a:387:{s:15:"5.5-alpha-47570";s:8:"bleeding";s:17:"5.4.1-alpha-47569";s:5:"point";s:3:"5.4";i:1586433381;s:5:"5.3.2";i:1578431355;s:5:"5.3.1";i:1576222826;s:3:"5.3";i:1573985840;s:5:"5.2.4";i:1572476910;s:5:"5.2.3";i:1567634400;s:5:"5.2.2";i:1560816000;s:5:"5.2.1";i:1558396800;s:3:"5.2";i:1557187200;s:5:"5.1.2";i:1567641600;s:5:"5.1.1";i:1552435200;s:3:"5.1";i:1550707200;s:5:"5.0.6";i:1567641600;s:5:"5.0.4";i:1552435200;s:5:"5.0.3";i:1546992000;s:5:"5.0.2";i:1545177600;s:5:"5.0.1";i:1544659200;i:0;i:1544054400;s:6:"4.9.11";i:1567641600;s:6:"4.9.10";i:1552435200;s:5:"4.9.9";i:1544659200;s:5:"4.9.8";i:1533168000;s:5:"4.9.7";i:1530748800;s:5:"4.9.6";i:1526515200;s:5:"4.9.5";i:1522713600;s:5:"4.9.4";i:1517875200;s:5:"4.9.3";i:1517788800;s:5:"4.9.2";i:1516060800;s:5:"4.9.1";i:1511913600;s:3:"4.9";i:1510790400;s:6:"4.8.10";i:1567641600;s:5:"4.8.9";i:1552435200;s:5:"4.8.8";i:1544659200;s:5:"4.8.7";i:1530748800;s:5:"4.8.6";i:1522713600;s:5:"4.8.5";i:1516060800;s:5:"4.8.4";i:1511913600;s:5:"4.8.3";i:1509408000;s:5:"4.8.2";i:1505779200;s:5:"4.8.1";i:1501632000;s:3:"4.8";i:1496880000;s:6:"4.7.14";i:1567641600;s:6:"4.7.13";i:1552435200;s:6:"4.7.12";i:1544659200;s:6:"4.7.11";i:1530748800;s:6:"4.7.10";i:1522713600;s:5:"4.7.9";i:1516060800;s:5:"4.7.8";i:1511913600;s:5:"4.7.7";i:1509408000;s:5:"4.7.6";i:1505779200;s:5:"4.7.5";i:1494892800;s:5:"4.7.4";i:1492646400;s:5:"4.7.3";i:1488758400;s:5:"4.7.2";i:1485388800;s:5:"4.7.1";i:1484092800;s:3:"4.7";i:1480982400;s:6:"4.6.15";i:1567641600;s:6:"4.6.14";i:1552435200;s:6:"4.6.13";i:1544659200;s:6:"4.6.12";i:1530748800;s:6:"4.6.11";i:1522713600;s:6:"4.6.10";i:1516060800;s:5:"4.6.9";i:1511913600;s:5:"4.6.8";i:1509408000;s:5:"4.6.7";i:1505779200;s:5:"4.6.6";i:1494892800;s:5:"4.6.5";i:1492646400;s:5:"4.6.4";i:1488758400;s:5:"4.6.3";i:1485388800;s:5:"4.6.2";i:1484092800;s:5:"4.6.1";i:1473206400;s:3:"4.6";i:1471305600;s:6:"4.5.18";i:1567641600;s:6:"4.5.17";i:1552435200;s:6:"4.5.16";i:1544659200;s:6:"4.5.15";i:1530748800;s:6:"4.5.14";i:1522713600;s:6:"4.5.13";i:1516060800;s:6:"4.5.12";i:1511913600;s:6:"4.5.11";i:1509408000;s:6:"4.5.10";i:1505779200;s:5:"4.5.9";i:1494892800;s:5:"4.5.8";i:1492646400;s:5:"4.5.7";i:1488758400;s:5:"4.5.6";i:1485388800;s:5:"4.5.5";i:1484092800;s:5:"4.5.4";i:1473206400;s:5:"4.5.3";i:1466467200;s:5:"4.5.2";i:1462492800;s:5:"4.5.1";i:1461628800;s:3:"4.5";i:1460419200;s:6:"4.4.19";i:1567641600;s:6:"4.4.18";i:1552435200;s:6:"4.4.17";i:1544659200;s:6:"4.4.16";i:1530748800;s:6:"4.4.15";i:1522713600;s:6:"4.4.14";i:1516060800;s:6:"4.4.13";i:1511913600;s:6:"4.4.12";i:1509408000;s:6:"4.4.11";i:1505779200;s:6:"4.4.10";i:1494892800;s:5:"4.4.9";i:1492646400;s:5:"4.4.8";i:1488758400;s:5:"4.4.7";i:1485388800;s:5:"4.4.6";i:1484092800;s:5:"4.4.5";i:1473206400;s:5:"4.4.4";i:1466467200;s:5:"4.4.3";i:1462492800;s:5:"4.4.2";i:1454371200;s:5:"4.4.1";i:1452038400;s:3:"4.4";i:1449532800;s:6:"4.3.20";i:1567641600;s:6:"4.3.19";i:1552435200;s:6:"4.3.18";i:1544659200;s:6:"4.3.17";i:1530748800;s:6:"4.3.16";i:1522713600;s:6:"4.3.15";i:1516060800;s:6:"4.3.14";i:1511913600;s:6:"4.3.13";i:1509408000;s:6:"4.3.12";i:1505779200;s:6:"4.3.11";i:1494892800;s:6:"4.3.10";i:1492646400;s:5:"4.3.9";i:1488758400;s:5:"4.3.8";i:1485388800;s:5:"4.3.7";i:1484092800;s:5:"4.3.6";i:1473206400;s:5:"4.3.5";i:1466467200;s:5:"4.3.4";i:1462492800;s:5:"4.3.3";i:1454371200;s:5:"4.3.2";i:1452038400;s:5:"4.3.1";i:1442275200;s:3:"4.3";i:1439856000;s:6:"4.2.24";i:1567641600;s:6:"4.2.23";i:1552435200;s:6:"4.2.22";i:1544659200;s:6:"4.2.21";i:1530748800;s:6:"4.2.20";i:1522713600;s:6:"4.2.19";i:1516060800;s:6:"4.2.18";i:1511913600;s:6:"4.2.17";i:1509408000;s:6:"4.2.16";i:1505779200;s:6:"4.2.15";i:1494892800;s:6:"4.2.14";i:1492646400;s:6:"4.2.13";i:1488758400;s:6:"4.2.12";i:1485388800;s:6:"4.2.11";i:1484092800;s:6:"4.2.10";i:1473206400;s:5:"4.2.9";i:1466467200;s:5:"4.2.8";i:1462492800;s:5:"4.2.7";i:1454371200;s:5:"4.2.6";i:1452038400;s:5:"4.2.5";i:1442275200;s:5:"4.2.4";i:1438646400;s:5:"4.2.3";i:1437609600;s:5:"4.2.2";i:1430956800;s:5:"4.2.1";i:1430092800;s:3:"4.2";i:1429747200;s:6:"4.1.27";i:1567641600;s:6:"4.1.26";i:1552435200;s:6:"4.1.25";i:1544659200;s:6:"4.1.24";i:1530748800;s:6:"4.1.23";i:1522713600;s:6:"4.1.22";i:1516060800;s:6:"4.1.21";i:1511913600;s:6:"4.1.20";i:1509408000;s:6:"4.1.19";i:1505779200;s:6:"4.1.18";i:1494892800;s:6:"4.1.17";i:1492646400;s:6:"4.1.16";i:1488758400;s:6:"4.1.15";i:1485388800;s:6:"4.1.14";i:1484092800;s:6:"4.1.13";i:1473206400;s:6:"4.1.12";i:1466467200;s:6:"4.1.11";i:1462492800;s:6:"4.1.10";i:1454371200;s:5:"4.1.9";i:1452038400;s:5:"4.1.8";i:1442275200;s:5:"4.1.7";i:1438646400;s:5:"4.1.6";i:1437609600;s:5:"4.1.5";i:1430956800;s:5:"4.1.4";i:1430092800;s:5:"4.1.3";i:1429747200;s:5:"4.1.2";i:1429574400;s:5:"4.1.1";i:1424217600;s:3:"4.1";i:1418860800;s:6:"4.0.27";i:1567641600;s:6:"4.0.26";i:1552435200;s:6:"4.0.25";i:1544659200;s:6:"4.0.24";i:1530748800;s:6:"4.0.23";i:1522713600;s:6:"4.0.22";i:1516060800;s:6:"4.0.21";i:1511913600;s:6:"4.0.20";i:1509408000;s:6:"4.0.19";i:1505779200;s:6:"4.0.18";i:1494892800;s:6:"4.0.17";i:1492646400;s:6:"4.0.16";i:1488758400;s:6:"4.0.15";i:1485388800;s:6:"4.0.14";i:1484092800;s:6:"4.0.13";i:1473206400;s:6:"4.0.12";i:1466467200;s:6:"4.0.11";i:1462492800;s:6:"4.0.10";i:1454371200;s:5:"4.0.9";i:1452038400;s:5:"4.0.8";i:1442275200;s:5:"4.0.7";i:1438646400;s:5:"4.0.6";i:1437609600;s:5:"4.0.5";i:1430870400;s:5:"4.0.4";i:1430092800;s:5:"4.0.3";i:1429747200;s:5:"4.0.2";i:1429574400;s:5:"4.0.1";i:1416441600;i:1;i:1409788800;s:6:"3.9.28";i:1567641600;s:6:"3.9.27";i:1552435200;s:6:"3.9.26";i:1544659200;s:6:"3.9.25";i:1530748800;s:6:"3.9.24";i:1522713600;s:6:"3.9.23";i:1516060800;s:6:"3.9.22";i:1511913600;s:6:"3.9.21";i:1509408000;s:6:"3.9.20";i:1505779200;s:6:"3.9.19";i:1494892800;s:6:"3.9.18";i:1492646400;s:6:"3.9.17";i:1488758400;s:6:"3.9.16";i:1485388800;s:6:"3.9.15";i:1484092800;s:6:"3.9.14";i:1473206400;s:6:"3.9.13";i:1466467200;s:6:"3.9.12";i:1462492800;s:6:"3.9.11";i:1454371200;s:6:"3.9.10";i:1452038400;s:5:"3.9.9";i:1442275200;s:5:"3.9.8";i:1438646400;s:5:"3.9.7";i:1437609600;s:5:"3.9.6";i:1430956800;s:5:"3.9.5";i:1429747200;s:5:"3.9.4";i:1429574400;s:5:"3.9.3";i:1416441600;s:5:"3.9.2";i:1407283200;s:5:"3.9.1";i:1399507200;s:3:"3.9";i:1397606400;s:6:"3.8.30";i:1567641600;s:6:"3.8.29";i:1553126400;s:6:"3.8.28";i:1544659200;s:6:"3.8.27";i:1530748800;s:6:"3.8.26";i:1522713600;s:6:"3.8.25";i:1516060800;s:6:"3.8.24";i:1511913600;s:6:"3.8.23";i:1509408000;s:6:"3.8.22";i:1505779200;s:6:"3.8.21";i:1494892800;s:6:"3.8.20";i:1492646400;s:6:"3.8.19";i:1488758400;s:6:"3.8.18";i:1485388800;s:6:"3.8.17";i:1484092800;s:6:"3.8.16";i:1473206400;s:6:"3.8.15";i:1466467200;s:6:"3.8.14";i:1462492800;s:6:"3.8.13";i:1454371200;s:6:"3.8.12";i:1452038400;s:6:"3.8.11";i:1442275200;s:6:"3.8.10";i:1438646400;s:5:"3.8.9";i:1437609600;s:5:"3.8.8";i:1430956800;s:5:"3.8.7";i:1429747200;s:5:"3.8.6";i:1429574400;s:5:"3.8.5";i:1416441600;s:5:"3.8.4";i:1407283200;s:5:"3.8.3";i:1397433600;s:5:"3.8.2";i:1396915200;s:5:"3.8.1";i:1390435200;s:3:"3.8";i:1386806400;s:6:"3.7.30";i:1567641600;s:6:"3.7.29";i:1553126400;s:6:"3.7.28";i:1544659200;s:6:"3.7.27";i:1530748800;s:6:"3.7.26";i:1522713600;s:6:"3.7.25";i:1516060800;s:6:"3.7.24";i:1511913600;s:6:"3.7.23";i:1509408000;s:6:"3.7.22";i:1505779200;s:6:"3.7.21";i:1494892800;s:6:"3.7.20";i:1492646400;s:6:"3.7.19";i:1488758400;s:6:"3.7.18";i:1485388800;s:6:"3.7.17";i:1484092800;s:6:"3.7.16";i:1473206400;s:6:"3.7.15";i:1466467200;s:6:"3.7.14";i:1462492800;s:6:"3.7.13";i:1454371200;s:6:"3.7.12";i:1452038400;s:6:"3.7.11";i:1442275200;s:6:"3.7.10";i:1438646400;s:5:"3.7.9";i:1437609600;s:5:"3.7.8";i:1430956800;s:5:"3.7.7";i:1429747200;s:5:"3.7.6";i:1429574400;s:5:"3.7.5";i:1416441600;s:5:"3.7.4";i:1407283200;s:5:"3.7.3";i:1397433600;s:5:"3.7.2";i:1396915200;s:5:"3.7.1";i:1383004800;s:3:"3.7";i:1382572800;s:5:"3.6.1";i:1378857600;s:3:"3.6";i:1375315200;s:5:"3.5.2";i:1371772800;s:5:"3.5.1";i:1358985600;s:3:"3.5";i:1355184000;s:5:"3.4.2";i:1346889600;s:5:"3.4.1";i:1340755200;s:3:"3.4";i:1339545600;s:5:"3.3.3";i:1340755200;s:5:"3.3.2";i:1334880000;s:5:"3.3.1";i:1325548800;s:3:"3.3";i:1323648000;s:5:"3.2.1";i:1310428800;s:3:"3.2";i:1309737600;s:5:"3.1.4";i:1309305600;s:5:"3.1.3";i:1306281600;s:5:"3.1.2";i:1303776000;s:5:"3.1.1";i:1301875200;s:3:"3.1";i:1298419200;s:5:"3.0.6";i:1303776000;s:5:"3.0.5";i:1297036800;s:5:"3.0.4";i:1293580800;s:5:"3.0.3";i:1291766400;s:5:"3.0.2";i:1291075200;s:5:"3.0.1";i:1280361600;i:2;i:1276732800;s:5:"2.9.2";i:1266192000;s:5:"2.9.1";i:1262563200;s:3:"2.9";i:1261094400;s:5:"2.8.6";i:1257984000;s:5:"2.8.5";i:1255996800;s:5:"2.8.4";i:1250035200;s:5:"2.8.3";i:1249257600;s:5:"2.8.2";i:1248048000;s:5:"2.8.1";i:1247097600;s:3:"2.8";i:1244678400;s:5:"2.7.1";i:1234224000;s:3:"2.7";i:1228867200;s:5:"2.6.5";i:1227571200;s:5:"2.6.3";i:1224720000;s:5:"2.6.2";i:1220832000;s:5:"2.6.1";i:1218758400;s:3:"2.6";i:1216080000;s:5:"2.5.1";i:1209081600;s:3:"2.5";i:1206748800;s:5:"2.3.3";i:1202169600;s:5:"2.3.2";i:1198886400;s:5:"2.3.1";i:1193356800;s:3:"2.3";i:1190678400;s:5:"2.2.3";i:1190592000;s:5:"2.2.2";i:1190592000;s:5:"2.2.1";i:1190592000;s:3:"2.2";i:1190592000;s:5:"2.1.3";i:1190592000;s:5:"2.1.2";i:1190592000;s:5:"2.1.1";i:1190592000;s:3:"2.1";i:1190592000;s:6:"2.0.11";i:1190592000;s:6:"2.0.10";i:1190592000;s:5:"2.0.9";i:1190592000;s:5:"2.0.8";i:1190592000;s:5:"2.0.7";i:1190592000;s:5:"2.0.6";i:1190592000;s:5:"2.0.5";i:1190592000;s:5:"2.0.4";i:1190592000;s:5:"2.0.1";i:1190592000;i:3;i:1190592000;s:5:"1.5.2";i:1190592000;s:7:"1.5.1.3";i:1190592000;s:7:"1.5.1.2";i:1190592000;s:7:"1.5.1.1";i:1190592000;s:5:"1.5.1";i:1190592000;s:13:"1.5-strayhorn";i:1190592000;s:5:"1.2.2";i:1190592000;s:5:"1.2.1";i:1190592000;s:10:"1.2-mingus";i:1190592000;s:9:"1.2-delta";i:1190592000;s:12:"1.0-platinum";i:1190592000;s:5:"1.0.2";i:1190592000;s:12:"1.0.2-blakey";i:1190592000;s:11:"1.0.1-miles";i:1190592000;}';
|
23 |
+
|
24 |
+
$versions = unserialize($versions);
|
25 |
+
|
26 |
+
return $versions;
|
27 |
+
} // get_wordpress_versions
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Creates a fancy, iOS alike toggle switch
|
32 |
+
*
|
33 |
+
* @param string $name ID used for checkbox.
|
34 |
+
* @param array $options Various options: value, saved_value, option_key, class
|
35 |
+
* @param boolean $echo Default: true.
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
+
static function create_toogle_switch($name, $options = array(), $echo = true)
|
39 |
+
{
|
40 |
+
$default_options = array('value' => '1', 'saved_value' => '', 'option_key' => $name, 'class' => '');
|
41 |
+
$options = array_merge($default_options, $options);
|
42 |
+
|
43 |
+
$out = "\n";
|
44 |
+
$out .= '<div class="toggle-wrapper ' . $options['class'] . '">';
|
45 |
+
$out .= '<input type="checkbox" id="' . $name . '" ' . self::checked($options['value'], $options['saved_value']) . ' type="checkbox" value="' . $options['value'] . '" name="' . $options['option_key'] . '">';
|
46 |
+
$out .= '<label for="' . $name . '" class="toggle"><span class="toggle_handler"></span></label>';
|
47 |
+
$out .= '</div>';
|
48 |
+
|
49 |
+
if ($echo) {
|
50 |
+
echo $out;
|
51 |
+
} else {
|
52 |
+
return $out;
|
53 |
+
}
|
54 |
+
} // create_toggle_switch
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Helper for creating checkboxes.
|
59 |
+
*
|
60 |
+
* @param string $value Checkbox value, in HTML.
|
61 |
+
* @param array $current Current, saved value of checkbox.
|
62 |
+
* @param boolean $echo Default: false.
|
63 |
+
*
|
64 |
+
* @return void|string
|
65 |
+
*/
|
66 |
+
static function checked($value, $current, $echo = false)
|
67 |
+
{
|
68 |
+
$out = '';
|
69 |
+
|
70 |
+
if (!is_array($current)) {
|
71 |
+
$current = (array) $current;
|
72 |
+
}
|
73 |
+
|
74 |
+
if (in_array($value, $current)) {
|
75 |
+
$out = ' checked="checked" ';
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($echo) {
|
79 |
+
echo $out;
|
80 |
+
} else {
|
81 |
+
return $out;
|
82 |
+
}
|
83 |
+
} // checked
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Format file size to human readable string
|
88 |
+
*
|
89 |
+
* @param int $bytes Size in bytes to format.
|
90 |
+
*
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
static function format_size($bytes)
|
94 |
+
{
|
95 |
+
if ($bytes > 1073741824) {
|
96 |
+
return number_format_i18n($bytes / 1073741824, 2) . ' GB';
|
97 |
+
} elseif ($bytes > 1048576) {
|
98 |
+
return number_format_i18n($bytes / 1048576, 1) . ' MB';
|
99 |
+
} elseif ($bytes > 1024) {
|
100 |
+
return number_format_i18n($bytes / 1024, 1) . ' KB';
|
101 |
+
} else {
|
102 |
+
return number_format_i18n($bytes, 0) . ' bytes';
|
103 |
+
}
|
104 |
+
} // format_size
|
105 |
+
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Create select options for select
|
109 |
+
*
|
110 |
+
* @param array $options options
|
111 |
+
* @param string $selected selected value
|
112 |
+
* @param bool $output echo, if false return html as string
|
113 |
+
* @return string html with options
|
114 |
+
*/
|
115 |
+
static function create_select_options($options, $selected = null, $output = true)
|
116 |
+
{
|
117 |
+
$out = "\n";
|
118 |
+
|
119 |
+
if (is_array($options) && !empty($options) && !isset($options[0]['val'])) {
|
120 |
+
$tmp = array();
|
121 |
+
foreach ($options as $val => $label) {
|
122 |
+
$tmp[] = array('val' => $val, 'label' => $label);
|
123 |
+
} // foreach
|
124 |
+
$options = $tmp;
|
125 |
+
}
|
126 |
+
|
127 |
+
foreach ($options as $tmp) {
|
128 |
+
if ($selected == $tmp['val']) {
|
129 |
+
$out .= "<option selected=\"selected\" value=\"{$tmp['val']}\">{$tmp['label']} </option>\n";
|
130 |
+
} else {
|
131 |
+
$out .= "<option value=\"{$tmp['val']}\">{$tmp['label']} </option>\n";
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($output) {
|
136 |
+
echo $out;
|
137 |
+
} else {
|
138 |
+
return $out;
|
139 |
+
}
|
140 |
+
} // create_select_options
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get table size and row count as html
|
145 |
+
*
|
146 |
+
* @return string html with table details
|
147 |
+
*/
|
148 |
+
static function get_table_details()
|
149 |
+
{
|
150 |
+
global $wpdb, $wp_reset;
|
151 |
+
|
152 |
+
$tbl_core = $tbl_custom = $tbl_size = $tbl_rows = 0;
|
153 |
+
$table_status = $wpdb->get_results('SHOW TABLE STATUS');
|
154 |
+
if (is_array($table_status)) {
|
155 |
+
foreach ($table_status as $index => $table) {
|
156 |
+
if (0 !== stripos($table->Name, $wpdb->prefix)) {
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
if (empty($table->Engine)) {
|
160 |
+
continue;
|
161 |
+
}
|
162 |
+
|
163 |
+
$tbl_rows += $table->Rows;
|
164 |
+
$tbl_size += $table->Data_length + $table->Index_length;
|
165 |
+
if (in_array($table->Name, $wp_reset->core_tables)) {
|
166 |
+
$tbl_core++;
|
167 |
+
} else {
|
168 |
+
$tbl_custom++;
|
169 |
+
}
|
170 |
+
} // foreach
|
171 |
+
} else {
|
172 |
+
return ' no tables found.';
|
173 |
+
}
|
174 |
+
return ' totaling ' . self::format_size($tbl_size) . ' in ' . number_format($tbl_rows) . ' rows.';
|
175 |
+
} // get_table_details
|
176 |
+
|
177 |
+
} // WP_Reset_Utility
|
wp-reset.php
CHANGED
@@ -3,12 +3,12 @@
|
|
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.
|
7 |
Author: WebFactory Ltd
|
8 |
Author URI: https://www.webfactoryltd.com/
|
9 |
Text Domain: wp-reset
|
10 |
|
11 |
-
Copyright 2015 -
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -30,6 +30,11 @@ if (!defined('ABSPATH')) {
|
|
30 |
}
|
31 |
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
// load WP-CLI commands, if needed
|
34 |
if (defined('WP_CLI') && WP_CLI) {
|
35 |
require_once dirname(__FILE__) . '/wp-reset-cli.php';
|
@@ -45,8 +50,9 @@ class WP_Reset
|
|
45 |
public $snapshots_folder = 'wp-reset-snapshots-export';
|
46 |
protected $options = array();
|
47 |
private $delete_count = 0;
|
48 |
-
private $licensing_servers = array('https://
|
49 |
-
|
|
|
50 |
|
51 |
|
52 |
/**
|
@@ -76,6 +82,16 @@ class WP_Reset
|
|
76 |
$this->plugin_url = plugin_dir_url(__FILE__);
|
77 |
$this->load_options();
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
add_action('admin_menu', array($this, 'admin_menu'));
|
80 |
add_action('admin_init', array($this, 'do_all_actions'));
|
81 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
@@ -184,22 +200,18 @@ class WP_Reset
|
|
184 |
/**
|
185 |
* Get options part of plugin options
|
186 |
*
|
187 |
-
* todo: not completed
|
188 |
-
*
|
189 |
* @param string $key Optional.
|
190 |
*
|
191 |
* @return array
|
192 |
*/
|
193 |
-
function get_options(
|
194 |
{
|
195 |
return $this->options['options'];
|
196 |
} // get_options
|
197 |
|
198 |
|
199 |
/**
|
200 |
-
* Update plugin options
|
201 |
-
*
|
202 |
-
* todo: this handles the entire options array although it should only do the options part - it's confusing
|
203 |
*
|
204 |
* @param string $key Data to save.
|
205 |
* @param string $data Option key.
|
@@ -208,11 +220,16 @@ class WP_Reset
|
|
208 |
*/
|
209 |
function update_options($key, $data)
|
210 |
{
|
|
|
|
|
|
|
|
|
|
|
211 |
$this->options[$key] = $data;
|
212 |
$tmp = update_option('wp-reset', $this->options);
|
213 |
|
214 |
return $tmp;
|
215 |
-
} //
|
216 |
|
217 |
|
218 |
/**
|
@@ -368,7 +385,22 @@ class WP_Reset
|
|
368 |
'confirm1' => __('Clicking "Reset WordPress" will reset your site to default values. All content will be lost. Always <a href="#" class="create-new-snapshot" data-description="Before resetting the site">create a snapshot</a> if you want to be able to undo.</b>', 'wp-reset'),
|
369 |
'confirm2' => __('Click "Cancel" to abort.', 'wp-reset'),
|
370 |
'doing_reset' => __('Resetting in progress. Please wait.', 'wp-reset'),
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
'nonce_dismiss_notice' => wp_create_nonce('wp-reset_dismiss_notice'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
'nonce_run_tool' => wp_create_nonce('wp-reset_run_tool'),
|
373 |
'nonce_do_reset' => wp_create_nonce('wp-reset_do_reset'),
|
374 |
);
|
@@ -666,6 +698,53 @@ class WP_Reset
|
|
666 |
} // do_delete_transients
|
667 |
|
668 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
/**
|
670 |
* Resets all theme options (mods).
|
671 |
*
|
@@ -735,14 +814,13 @@ class WP_Reset
|
|
735 |
|
736 |
|
737 |
/**
|
738 |
-
* Deactivate
|
739 |
*
|
740 |
-
* @param
|
741 |
-
* @param bool $silent_deactivate Skip individual plugin deactivation functions when deactivating
|
742 |
*
|
743 |
-
* @return int Number of
|
744 |
*/
|
745 |
-
function
|
746 |
{
|
747 |
if (!function_exists('get_plugins')) {
|
748 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
@@ -751,26 +829,55 @@ class WP_Reset
|
|
751 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
752 |
}
|
753 |
|
754 |
-
$wp_reset_basename = plugin_basename(
|
|
|
755 |
|
756 |
-
$all_plugins = get_plugins();
|
757 |
$active_plugins = (array) get_option('active_plugins', array());
|
758 |
-
if (
|
759 |
if (($key = array_search($wp_reset_basename, $active_plugins)) !== false) {
|
760 |
unset($active_plugins[$key]);
|
761 |
}
|
762 |
-
unset($all_plugins[$wp_reset_basename]);
|
763 |
}
|
764 |
|
765 |
if (!empty($active_plugins)) {
|
766 |
-
deactivate_plugins($active_plugins, $silent_deactivate, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
767 |
}
|
768 |
|
769 |
if (!empty($all_plugins)) {
|
770 |
delete_plugins(array_keys($all_plugins));
|
771 |
}
|
772 |
|
773 |
-
do_action('wp_reset_delete_plugins', $all_plugins, $
|
774 |
|
775 |
return sizeof($all_plugins);
|
776 |
} // do_delete_plugins
|
@@ -943,11 +1050,20 @@ class WP_Reset
|
|
943 |
} elseif ($tool == 'reset_theme_options') {
|
944 |
$cnt = $this->do_reset_theme_options(true);
|
945 |
wp_send_json_success($cnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
} elseif ($tool == 'delete_themes') {
|
947 |
$cnt = $this->do_delete_themes(false);
|
948 |
wp_send_json_success($cnt);
|
|
|
|
|
|
|
949 |
} elseif ($tool == 'delete_plugins') {
|
950 |
-
$cnt = $this->do_delete_plugins(
|
951 |
wp_send_json_success($cnt);
|
952 |
} elseif ($tool == 'delete_uploads') {
|
953 |
$cnt = $this->do_delete_uploads();
|
@@ -1001,12 +1117,82 @@ class WP_Reset
|
|
1001 |
} else {
|
1002 |
wp_send_json_success();
|
1003 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1004 |
} else {
|
1005 |
wp_send_json_error(__('Unknown tool.', 'wp-reset'));
|
1006 |
}
|
1007 |
} // ajax_run_tool
|
1008 |
|
1009 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1010 |
/**
|
1011 |
* Reinstall / reset the WP site
|
1012 |
* There are no failsafes in the function - it reinstalls when called
|
@@ -1031,7 +1217,6 @@ class WP_Reset
|
|
1031 |
}
|
1032 |
|
1033 |
// save values that need to be restored after reset
|
1034 |
-
// todo: use params to determine what gets restored after reset
|
1035 |
$blogname = get_option('blogname');
|
1036 |
$blog_public = get_option('blog_public');
|
1037 |
$wplang = get_option('wplang');
|
@@ -1065,7 +1250,6 @@ class WP_Reset
|
|
1065 |
}
|
1066 |
|
1067 |
// supress errors for WP_CLI
|
1068 |
-
// todo: find a better way to supress errors and send/not send email on reset
|
1069 |
$result = @wp_install($blogname, $current_user->user_login, $current_user->user_email, $blog_public, '', md5(rand()), $wplang);
|
1070 |
$user_id = $result['user_id'];
|
1071 |
|
@@ -1132,7 +1316,6 @@ class WP_Reset
|
|
1132 |
|
1133 |
/**
|
1134 |
* Checks wp_reset post value and performs all actions
|
1135 |
-
* todo: handle messages for various actions
|
1136 |
*
|
1137 |
* @return null|bool
|
1138 |
*/
|
@@ -1310,21 +1493,42 @@ class WP_Reset
|
|
1310 |
* Generate card header including title and action buttons
|
1311 |
*
|
1312 |
* @param string $title Card title.
|
1313 |
-
* @param string $card_id Card ID.
|
1314 |
-
* @param
|
1315 |
-
* @param bool $iot_button Show index of tools button.
|
1316 |
*
|
1317 |
* @return string
|
1318 |
*/
|
1319 |
-
function get_card_header($title, $card_id, $
|
1320 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
$out = '';
|
1322 |
-
$out .= '<h4 id="' . $card_id . '">' . $title;
|
|
|
|
|
|
|
|
|
1323 |
$out .= '<div class="card-header-right">';
|
1324 |
-
if ($
|
|
|
|
|
|
|
1325 |
$out .= '<a class="scrollto" href="#iot" title="Jump to Index of Tools"><span class="dashicons dashicons-screenoptions"></span></a>';
|
1326 |
}
|
1327 |
-
if ($
|
|
|
|
|
|
|
1328 |
$out .= '<a class="toggle-card" href="#" title="' . __('Collapse / expand box', 'wp-reset') . '"><span class="dashicons dashicons-arrow-up-alt2"></span></a>';
|
1329 |
}
|
1330 |
$out .= '</div></h4>';
|
@@ -1406,6 +1610,7 @@ class WP_Reset
|
|
1406 |
echo '<li><a href="#tab-snapshots">' . __('Snapshots', 'wp-reset') . '</a></li>';
|
1407 |
echo '<li><a href="#tab-collections">' . __('Collections', 'wp-reset') . '</a></li>';
|
1408 |
echo '<li><a href="#tab-support">' . __('Support', 'wp-reset') . '</a></li>';
|
|
|
1409 |
echo '</ul>';
|
1410 |
echo '</div>'; // container
|
1411 |
echo '</nav>';
|
@@ -1440,6 +1645,10 @@ class WP_Reset
|
|
1440 |
$this->tab_support();
|
1441 |
echo '</div>';
|
1442 |
|
|
|
|
|
|
|
|
|
1443 |
echo '</div>'; // content
|
1444 |
echo '</div>'; // container
|
1445 |
echo '</div>'; // wp-reset-tabs
|
@@ -1447,67 +1656,6 @@ class WP_Reset
|
|
1447 |
echo '</form>';
|
1448 |
echo '</div>'; // wrap
|
1449 |
|
1450 |
-
// survey
|
1451 |
-
if ($this->is_survey_active('features')) {
|
1452 |
-
echo '<div id="survey-dialog" style="display: none;" title="Help us make WP Reset better for you"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
|
1453 |
-
echo '<p class="subtitle"><b>What new features do you need the most?</b> Choose one or two;</p>';
|
1454 |
-
|
1455 |
-
$questions = array();
|
1456 |
-
$questions[] = '<div class="question-wrapper" data-value="backup" title="Click to select/unselect answer">' .
|
1457 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1458 |
-
'<div class="question"><b>Off-site backups</b><br>' .
|
1459 |
-
'<i>Backup the site to Dropbox, FTP or Google Drive before using any tools</i></div>' .
|
1460 |
-
'</div>';
|
1461 |
-
|
1462 |
-
$questions[] = '<div class="question-wrapper" data-value="wpmu" title="Click to select/unselect answer">' .
|
1463 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1464 |
-
'<div class="question"><b>WordPress Network (WPMU) compatibility</b><br>' .
|
1465 |
-
'<i>Full support & compatibility for all WP Reset tools for all sites in network</i></div>' .
|
1466 |
-
'</div>';
|
1467 |
-
|
1468 |
-
$questions[] = '<div class="question-wrapper" data-value="nothing" title="Click to select/unselect answer">' .
|
1469 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1470 |
-
'<div class="question"><b>Don\'t add anything</b><br>' .
|
1471 |
-
'<i>WP Reset is perfect as is - I don\'t need any new features</i></div>' .
|
1472 |
-
'</div>';
|
1473 |
-
|
1474 |
-
$questions[] = '<div class="question-wrapper" data-value="nuclear" title="Click to select/unselect answer">' .
|
1475 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1476 |
-
'<div class="question"><b>Nuclear reset - run all tools at once</b><br>' .
|
1477 |
-
'<i>Besides resetting, delete all files and all other customizations with one click</i></div>' .
|
1478 |
-
'</div>';
|
1479 |
-
|
1480 |
-
$questions[] = '<div class="question-wrapper" data-value="plugin-collections" title="Click to select/unselect answer">' .
|
1481 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1482 |
-
'<div class="question"><b>Install a set of plugins/themes after reset</b><br>' .
|
1483 |
-
'<i>Save lists of plugins/themes and automatically install them after resetting</i></div>' .
|
1484 |
-
'</div>';
|
1485 |
-
|
1486 |
-
$questions[] = '<div class="question-wrapper" data-value="change-wp-ver" title="Click to select/unselect answer">' .
|
1487 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1488 |
-
'<div class="question"><b>Change WordPress version - rollback or upgrade</b><br>' .
|
1489 |
-
'<i>Pick a version of WP you need (older or never) and switch to it with one click</i></div>' .
|
1490 |
-
'</div>';
|
1491 |
-
|
1492 |
-
shuffle($questions);
|
1493 |
-
$questions[] = '<div class="question-wrapper" data-value="custom" title="Click to select/unselect answer">' .
|
1494 |
-
'<span class="dashicons dashicons-yes"></span>' .
|
1495 |
-
'<div class="question"><b>Something we missed?</b><br><i>Enter the feature you need below;</i>' .
|
1496 |
-
'<input type="text" class="custom-input"></div>' .
|
1497 |
-
'</div>';
|
1498 |
-
|
1499 |
-
echo implode(' ', $questions);
|
1500 |
-
|
1501 |
-
$current_user = wp_get_current_user();
|
1502 |
-
echo '<div class="footer">';
|
1503 |
-
echo '<input id="emailme" type="checkbox" value="' . $current_user->user_email . '"> <label for="emailme">Email me on ' . $current_user->user_email . ' when new features are added. We hate SPAM and never send it.</label><br>';
|
1504 |
-
echo '<a data-survey="features" class="submit-survey button-primary button button-large" href="#">Add those features ASAP!</a>';
|
1505 |
-
echo '<a href="#" class="dismiss-survey wpr-dismiss-notice" data-notice="survey-features" data-survey="features"><i>Close the survey and never show it again</i></a>';
|
1506 |
-
echo '</div>';
|
1507 |
-
|
1508 |
-
echo '</div>';
|
1509 |
-
} // survey
|
1510 |
-
|
1511 |
if (!$this->is_webhooks_active()) {
|
1512 |
echo '<div id="webhooks-dialog" style="display: none;" title="Webhooks"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
|
1513 |
echo '<div style="padding: 20px; font-size: 15px;">';
|
@@ -1537,6 +1685,20 @@ class WP_Reset
|
|
1537 |
$meta = $this->get_meta();
|
1538 |
$snapshots = $this->get_snapshots();
|
1539 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1540 |
// warn that WPR is not WPMU compatible
|
1541 |
if (false === $notice_shown && is_multisite()) {
|
1542 |
echo '<div class="card notice-wrapper notice-error">';
|
@@ -1570,59 +1732,115 @@ class WP_Reset
|
|
1570 |
{
|
1571 |
global $current_user, $wpdb;
|
1572 |
|
1573 |
-
echo '<div class="card"
|
1574 |
-
echo '
|
1575 |
-
echo __('Please read carefully before proceeding', 'wp-reset');
|
1576 |
-
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>';
|
1577 |
-
echo '</h4>';
|
1578 |
echo '<div class="card-body">';
|
1579 |
-
echo '<p
|
1580 |
-
echo '<
|
1581 |
-
echo '
|
1582 |
-
echo '<
|
1583 |
-
echo '<
|
1584 |
-
|
1585 |
-
echo '
|
1586 |
-
|
1587 |
-
echo '<
|
1588 |
-
echo '<
|
1589 |
-
echo '<
|
1590 |
-
echo
|
1591 |
-
echo '
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1598 |
echo '<ul class="plain-list">';
|
1599 |
-
echo '<li>' . __('remember, always <a href="#" class="
|
1600 |
echo '<li>' . __('you will have to confirm the action one more time', 'wp-reset') . '</li>';
|
1601 |
-
echo '<li>' . __('
|
1602 |
-
echo '<li>' . __('site title, WordPress
|
1603 |
-
echo '<li>' . __('you will be logged out, automatically logged in and taken to the admin dashboard', 'wp-reset') . '</li>';
|
1604 |
-
echo '<li>' . __('WP Reset plugin will be reactivated if that option is chosen
|
1605 |
echo '</ul>';
|
1606 |
|
1607 |
echo '<p><b>' . __('WP-CLI Support', 'wp-reset') . '</b><br>';
|
1608 |
echo '' . sprintf(__('All tools available via GUI are available in WP-CLI as well. To get the list of commands run %s. Instead of the active user, the first user with admin privileges found in the database will be restored. ', 'wp-reset'), '<code>wp help reset</code>');
|
1609 |
-
echo sprintf(__('All actions have to be confirmed. If you want to skip confirmation use the standard %s option. Please be careful
|
1610 |
|
1611 |
-
echo '
|
1612 |
-
echo 'All WP Reset tools are integrated with <a href="https://wordpress.org/plugins/wp-webhooks/" target="_blank">WP Webhooks</a> and available as (receive data) actions. Webhooks are a standard, platform-independent way of connecting WordPress to any 3rd party system. This <a href="https://underconstructionpage.com/wp-webhooks-connect-integrate-wordpress/" target="_blank">article</a> has more info, videos and use-cases so you can see just how powerful and easy to use webhooks are.<br>';
|
1613 |
-
if ($this->is_webhooks_active()) {
|
1614 |
-
echo 'WP Webhooks are active. Make sure you enable WP Reset actions in <a href="' . admin_url('options-general.php?page=wp-webhooks-pro&wpwhvrs=settings') . '">settings</a>.';
|
1615 |
-
} else {
|
1616 |
-
echo '<a href="#" class="open-webhooks-dialog">Install WP Webhooks & WPR addon</a> to automate your workflow, develop faster and connect WordPress to any web app or 3rd party system.';
|
1617 |
-
}
|
1618 |
-
echo '</p></div></div>'; // card description
|
1619 |
|
1620 |
$theme = wp_get_theme();
|
|
|
|
|
|
|
|
|
|
|
1621 |
|
1622 |
-
|
1623 |
-
echo '<
|
1624 |
-
echo
|
1625 |
-
echo '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1626 |
echo '<div class="card-body">';
|
1627 |
echo '<p><label for="reactivate-theme"><input name="wpr-post-reset[reactivate_theme]" type="checkbox" id="reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . $theme->get('Name') . '</label></p>';
|
1628 |
echo '<p><label for="reactivate-wpreset"><input name="wpr-post-reset[reactivate_wpreset]" type="checkbox" id="reactivate-wpreset" value="1" checked> ' . __('Reactivate WP Reset plugin', 'wp-reset') . '</label></p>';
|
@@ -1630,18 +1848,34 @@ class WP_Reset
|
|
1630 |
echo '<p><label for="reactivate-webhooks"><input name="wpr-post-reset[reactivate_webhooks]" type="checkbox" id="reactivate-webhooks" value="1" checked> ' . __('Reactivate WP Webhooks plugin', 'wp-reset') . '</label></p>';
|
1631 |
}
|
1632 |
echo '<p><label for="reactivate-plugins"><input name="wpr-post-reset[reactivate_plugins]" type="checkbox" id="reactivate-plugins" value="1"> ' . __('Reactivate all currently active plugins', 'wp-reset') . '</label></p>';
|
1633 |
-
if
|
1634 |
-
echo '<p><a href="' . admin_url('options-general.php?page=wp-webhooks-pro&wpwhvrs=settings') . '">Configure WP Webhooks</a> to run additional actions after reset, or connect to any 3rd party system.</p>';
|
1635 |
-
} else {
|
1636 |
-
echo '<p>To run additional actions after reset or automate a complex workflow <a href="#" class="open-webhooks-dialog">install WP Webhooks & WPR addon</a>. It\'s a standard, platform-independent way of connecting WordPress to any web app. This <a href="https://www.youtube.com/watch?v=m8XDFXCNP9g" target="_blank">short video</a> explains it well.</p>';
|
1637 |
-
}
|
1638 |
-
echo '<p><br>' . __('Type <b>reset</b> in the confirmation field to confirm the reset and then click the "Reset WordPress" button.<br>Always <a href="#" class="create-new-snapshot" data-description="Before resetting the site">create a snapshot</a> before resetting if you want to be able to undo.', 'wp-reset') . '</p>';
|
1639 |
|
1640 |
wp_nonce_field('wp-reset');
|
1641 |
-
echo '<p><input id="wp_reset_confirm" type="text" name="wp_reset_confirm" placeholder="' . esc_attr__('Type in "reset"', 'wp-reset') . '" value="" autocomplete="off"> ';
|
1642 |
echo '<a id="wp_reset_submit" class="button button-delete">' . __('Reset Site', 'wp-reset') . '</a>' . $this->get_snapshot_button('reset-wordpress', 'Before resetting the site') . '</p>';
|
1643 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1644 |
echo '</div>';
|
|
|
1645 |
} // tab_reset
|
1646 |
|
1647 |
|
@@ -1652,39 +1886,52 @@ class WP_Reset
|
|
1652 |
*/
|
1653 |
private function tab_tools()
|
1654 |
{
|
1655 |
-
global $wpdb;
|
1656 |
|
1657 |
$tools = array(
|
1658 |
-
'tool-delete-transients' => 'Delete Transients',
|
1659 |
-
'tool-delete-uploads' => 'Clean Uploads Folder',
|
1660 |
'tool-reset-theme-options' => 'Reset Theme Options',
|
|
|
|
|
|
|
|
|
|
|
|
|
1661 |
'tool-delete-themes' => 'Delete Themes',
|
1662 |
'tool-delete-plugins' => 'Delete Plugins',
|
|
|
|
|
|
|
1663 |
'tool-empty-delete-custom-tables' => 'Empty or Delete Custom Tables',
|
|
|
1664 |
'tool-delete-htaccess' => 'Delete .htaccess File'
|
1665 |
);
|
1666 |
|
1667 |
echo '<div class="card">';
|
1668 |
-
echo $this->get_card_header(__('Index of Tools', 'wp-reset'), 'iot', true
|
1669 |
echo '<div class="card-body">';
|
1670 |
$i = 0;
|
1671 |
$tools_nb = sizeof($tools);
|
1672 |
foreach ($tools as $tool_id => $tool_name) {
|
1673 |
if ($i == 0) {
|
1674 |
-
echo '<div class="
|
1675 |
echo '<ul class="mb0 plain-list">';
|
1676 |
}
|
1677 |
-
if ($i ==
|
1678 |
echo '</div>';
|
1679 |
-
echo '<div class="
|
1680 |
echo '<ul class="mb0 plain-list">';
|
1681 |
}
|
1682 |
|
1683 |
-
|
|
|
|
|
|
|
|
|
|
|
1684 |
|
1685 |
if ($i == $tools_nb - 1) {
|
1686 |
echo '</ul>';
|
1687 |
-
echo '</div>'; //
|
1688 |
}
|
1689 |
$i++;
|
1690 |
} // foreach tools
|
@@ -1692,69 +1939,163 @@ class WP_Reset
|
|
1692 |
echo '</div>';
|
1693 |
|
1694 |
echo '<div class="card">';
|
1695 |
-
echo $this->get_card_header(__('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1696 |
echo '<div class="card-body">';
|
1697 |
echo '<p>All transient related database entries will be deleted. Including expired and non-expired transients, and orphaned transient timeout entries.<br>Always <a href="#" data-description="Before deleting transients" class="create-new-snapshot">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>';
|
1698 |
echo $this->get_tool_icons(false, true);
|
1699 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all transients?" data-btn-confirm="Delete all transients" data-text-wait="Deleting transients. Please wait." data-text-confirm="All database entries related to transients will be deleted. Always ' . esc_attr('<a data-description="Before deleting transients" href="#" class="create-new-snapshot">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n transient database entries have been deleted." data-text-done-singular="One transient database entry has been deleted." class="button button-delete" href="#" id="delete-transients">Delete all transients</a>' . $this->get_snapshot_button('delete-transients', 'Before deleting transients') . '</p>';
|
1700 |
echo '</div>';
|
1701 |
-
echo '</div>';
|
1702 |
|
1703 |
-
|
1704 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
1705 |
|
1706 |
echo '<div class="card">';
|
1707 |
-
echo $this->get_card_header(__('
|
1708 |
echo '<div class="card-body">';
|
1709 |
-
echo '<p>
|
|
|
|
|
|
|
|
|
|
|
1710 |
|
1711 |
-
echo
|
|
|
|
|
|
|
1712 |
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
echo '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1719 |
echo '</div>';
|
|
|
1720 |
|
1721 |
-
echo '<div class="card">';
|
1722 |
-
echo $this->get_card_header(__('
|
1723 |
echo '<div class="card-body">';
|
1724 |
-
echo '<p>
|
|
|
1725 |
echo $this->get_tool_icons(false, true);
|
1726 |
-
|
1727 |
-
echo '</
|
1728 |
echo '</div>';
|
|
|
1729 |
|
1730 |
$theme = wp_get_theme();
|
1731 |
|
1732 |
echo '<div class="card">';
|
1733 |
-
echo $this->get_card_header(__('Delete Themes', 'wp-reset'), 'tool-delete-themes', true, true);
|
1734 |
echo '<div class="card-body">';
|
1735 |
echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . $theme->get('Name') . '.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
|
1736 |
-
|
1737 |
echo $this->get_tool_icons(true, true);
|
1738 |
-
|
1739 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all themes?" data-btn-confirm="Delete all themes" data-text-wait="Deleting all themes. Please wait." data-text-confirm="All themes will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n themes have been deleted." data-text-done-singular="One theme has been deleted." class="button button-delete" href="#" id="delete-themes">Delete all themes</a></p>';
|
1740 |
echo '</div>';
|
1741 |
-
echo '</div>';
|
1742 |
|
1743 |
echo '<div class="card">';
|
1744 |
-
echo $this->get_card_header(__('Delete Plugins', 'wp-reset'), 'tool-delete-plugins', true, true);
|
1745 |
echo '<div class="card-body">';
|
1746 |
echo '<p>' . __('All plugins will be deleted except for WP Reset which will remain active.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
|
1747 |
-
|
1748 |
echo $this->get_tool_icons(true, true);
|
1749 |
-
|
1750 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all plugins?" data-btn-confirm="Delete plugins" data-text-wait="Deleting plugins. Please wait." data-text-confirm="All plugins except WP Reset will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n plugins have been deleted." data-text-done-singular="One plugin has been deleted." class="button button-delete" href="#" id="delete-plugins">Delete plugins</a></p>';
|
1751 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1752 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1753 |
|
1754 |
$custom_tables = $this->get_custom_tables();
|
1755 |
|
1756 |
echo '<div class="card">';
|
1757 |
-
echo $this->get_card_header(__('Empty or Delete Custom Tables', 'wp-reset'), 'tool-empty-delete-custom-tables', true, true);
|
1758 |
echo '<div class="card-body">';
|
1759 |
echo '<p>' . __('This action affects only custom tables with <code>' . $wpdb->prefix . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
|
1760 |
if ($custom_tables) {
|
@@ -1771,27 +2112,54 @@ class WP_Reset
|
|
1771 |
echo '<p>' . __('There are no custom tables. There\'s nothing for this tool to empty or delete.', 'wp-reset') . '</p>';
|
1772 |
$custom_tables_btns = ' disabled';
|
1773 |
}
|
1774 |
-
|
1775 |
echo $this->get_tool_icons(false, true, true);
|
1776 |
-
|
1777 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to empty all custom tables?" data-btn-confirm="Empty custom tables" data-text-wait="Emptying custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be emptied. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before emptying custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been emptied." data-text-done-singular="One custom table has been emptied." class="button button-delete' . $custom_tables_btns . '" href="#" id="truncate-custom-tables">Empty (truncate) custom tables</a>';
|
1778 |
echo '<a data-confirm-title="Are you sure you want to delete all custom tables?" data-btn-confirm="Delete custom tables" data-text-wait="Deleting custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be deleted. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been deleted." data-text-done-singular="One custom table has been deleted." class="button button-delete' . $custom_tables_btns . '" href="#" id="drop-custom-tables">Delete (drop) custom tables</a>' . $this->get_snapshot_button('drop-custom-tables', 'Before deleting custom tables') . '</p>';
|
1779 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1780 |
echo '</div>';
|
|
|
1781 |
|
1782 |
echo '<div class="card">';
|
1783 |
-
echo $this->get_card_header(__('Delete .htaccess File', 'wp-reset'), 'tool-delete-htaccess', true, true);
|
1784 |
echo '<div class="card-body">';
|
1785 |
echo '<p>' . __('This action deletes the .htaccess file located in <code>' . $this->get_htaccess_path() . '</code><br><b>There is NO UNDO. WP Reset does not make any file backups.</b></p>', 'wp-reset');
|
1786 |
|
1787 |
echo '<p>If you need to edit .htaccess, install our free <a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=wp-htaccess-editor&TB_iframe=true&width=600&height=550') . '" class="thickbox open-plugin-details-modal">WP Htaccess Editor</a> plugin. It automatically creates backups when you edit .htaccess as well as checks for syntax errors. To create the default .htaccess file open <a href="' . admin_url('options-permalink.php') . '">Settings - Permalinks</a> and re-save settings. WordPress will recreate the file.</p>';
|
1788 |
-
|
1789 |
echo $this->get_tool_icons(true, false);
|
1790 |
-
|
1791 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete the .htaccess file?" data-btn-confirm="Delete .htaccess file" data-text-wait="Deleting .htaccess file. Please wait." data-text-confirm="Htaccess file will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="Htaccess file has been deleted." data-text-done-singular="Htaccess file has been deleted." class="button button-delete" href="#" id="delete-htaccess">Delete .htaccess file</a></p>';
|
1792 |
|
1793 |
echo '</div>';
|
1794 |
-
echo '</div>';
|
1795 |
} // tab_tools
|
1796 |
|
1797 |
|
@@ -1803,10 +2171,51 @@ class WP_Reset
|
|
1803 |
private function tab_collections()
|
1804 |
{
|
1805 |
echo '<div class="card">';
|
1806 |
-
echo
|
1807 |
-
echo '<
|
1808 |
-
echo '<p
|
|
|
1809 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1810 |
} // tab_collections
|
1811 |
|
1812 |
|
@@ -1818,22 +2227,201 @@ class WP_Reset
|
|
1818 |
private function tab_support()
|
1819 |
{
|
1820 |
echo '<div class="card">';
|
1821 |
-
echo
|
1822 |
-
echo '<
|
|
|
1823 |
echo '</div>';
|
|
|
1824 |
|
1825 |
echo '<div class="card">';
|
1826 |
-
echo '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1827 |
echo '<p>' . __('We are very active on the <a href="https://wordpress.org/support/plugin/wp-reset" target="_blank">official WP Reset support forum</a>. If you found a bug, have a feature idea or just want to say hi - please drop by. We love to hear back from our users.', 'wp-reset') . '</p>';
|
1828 |
echo '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1829 |
|
1830 |
echo '<div class="card">';
|
1831 |
-
echo
|
1832 |
-
echo '<
|
|
|
1833 |
echo '</div>';
|
|
|
1834 |
} // tab_support
|
1835 |
|
1836 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1837 |
/**
|
1838 |
* Echoes content for snapshots tab
|
1839 |
*
|
@@ -1850,52 +2438,49 @@ class WP_Reset
|
|
1850 |
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>';
|
1851 |
echo '</h4>';
|
1852 |
echo '<div class="card-body">';
|
1853 |
-
echo '<p>A snapshot is a copy of all WP database tables, standard and custom ones, saved in
|
1854 |
-
|
|
|
|
|
1855 |
echo '<p>Use snapshots to find out what changes a plugin made to your database or to quickly restore the dev environment after testing database related changes. Restoring a snapshot does not affect other snapshots, or WP Reset settings.</p>';
|
1856 |
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
if (empty($table->Engine)) {
|
1864 |
continue;
|
1865 |
}
|
1866 |
|
1867 |
-
$
|
1868 |
-
$tbl_size += $table->Data_length + $table->Index_length;
|
1869 |
-
if (in_array($table->Name, $this->core_tables)) {
|
1870 |
$tbl_core++;
|
1871 |
} else {
|
1872 |
$tbl_custom++;
|
1873 |
}
|
1874 |
} // foreach
|
1875 |
|
1876 |
-
echo '<p><b>Currently used WordPress tables</b>, prefixed with <i>' . $wpdb->prefix . '</i>, consist of ' . $tbl_core . ' standard and ';
|
1877 |
if ($tbl_custom) {
|
1878 |
echo $tbl_custom . ' custom table' . ($tbl_custom == 1 ? '' : 's');
|
1879 |
} else {
|
1880 |
echo 'no custom tables';
|
1881 |
}
|
1882 |
-
echo '
|
|
|
|
|
1883 |
}
|
1884 |
|
1885 |
-
echo '';
|
1886 |
echo '</div>';
|
1887 |
echo '</div>';
|
1888 |
|
1889 |
echo '<div class="card">';
|
1890 |
-
echo '
|
1891 |
-
echo
|
1892 |
-
echo '<div class="card-header-right"><a id="create-new-snapshot-primary" data-msg-success="Snapshot created!" data-msg-wait="Creating snapshot. Please wait." data-btn-confirm="Create snapshot" data-placeholder="Snapshot name or brief description, ie: before plugin install" data-text="Enter snapshot name or brief description, up to 64 characters." data-title="Create a new snapshot" title="Create a new database snapshot" href="#" class="button button-primary create-new-snapshot">' . __('Create Snapshot', 'wp-reset') . '</a></div>';
|
1893 |
-
echo '</h4>';
|
1894 |
-
|
1895 |
if ($snapshots = $this->get_snapshots()) {
|
1896 |
$snapshots = array_reverse($snapshots);
|
1897 |
echo '<table id="wpr-snapshots">';
|
1898 |
-
echo '<tr><th>Date</th><th>Description</th><th class="ss-actions"> </th></tr>';
|
1899 |
foreach ($snapshots as $ss) {
|
1900 |
echo '<tr id="wpr-ss-' . $ss['uid'] . '">';
|
1901 |
if (!empty($ss['name'])) {
|
@@ -1911,7 +2496,6 @@ class WP_Reset
|
|
1911 |
echo human_time_diff(strtotime($ss['timestamp']), current_time('timestamp')) . ' ago';
|
1912 |
}
|
1913 |
echo '</td>';
|
1914 |
-
//echo '<td title="Created on ' . date(get_option('date_format'), strtotime($ss['timestamp'])) . ' @ ' . date(get_option('time_format'), strtotime($ss['timestamp'])) . '">' . '' . date(get_option('date_format'), strtotime($ss['timestamp'])) . '<br>@ ' . date(get_option('time_format'), strtotime($ss['timestamp'])) . '</td>';
|
1915 |
|
1916 |
echo '<td>';
|
1917 |
if (!empty($ss['name'])) {
|
@@ -1923,7 +2507,8 @@ class WP_Reset
|
|
1923 |
} else {
|
1924 |
echo 'no custom tables';
|
1925 |
}
|
1926 |
-
echo ' totaling ' .
|
|
|
1927 |
echo '<td>';
|
1928 |
echo '<div class="dropdown">
|
1929 |
<a class="button dropdown-toggle" href="#">Actions</a>
|
@@ -1931,15 +2516,26 @@ class WP_Reset
|
|
1931 |
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>';
|
1932 |
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>';
|
1933 |
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>';
|
1934 |
-
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
|
|
|
|
|
|
|
1935 |
echo '</tr>';
|
1936 |
} // foreach
|
1937 |
echo '</table>';
|
1938 |
-
echo '<p id="ss-no-snapshots" class="hidden">There are no
|
1939 |
} else {
|
1940 |
-
echo '<p id="ss-no-snapshots">There are no
|
1941 |
}
|
|
|
|
|
1942 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1943 |
echo '</div>';
|
1944 |
} // tab_snapshots
|
1945 |
|
@@ -2020,27 +2616,6 @@ class WP_Reset
|
|
2020 |
} // get_custom tables
|
2021 |
|
2022 |
|
2023 |
-
/**
|
2024 |
-
* Format file size to human readable string
|
2025 |
-
*
|
2026 |
-
* @param int $bytes Size in bytes to format.
|
2027 |
-
*
|
2028 |
-
* @return string
|
2029 |
-
*/
|
2030 |
-
function format_size($bytes)
|
2031 |
-
{
|
2032 |
-
if ($bytes > 1073741824) {
|
2033 |
-
return number_format_i18n($bytes / 1073741824, 2) . ' GB';
|
2034 |
-
} elseif ($bytes > 1048576) {
|
2035 |
-
return number_format_i18n($bytes / 1048576, 1) . ' MB';
|
2036 |
-
} elseif ($bytes > 1024) {
|
2037 |
-
return number_format_i18n($bytes / 1024, 1) . ' KB';
|
2038 |
-
} else {
|
2039 |
-
return number_format_i18n($bytes, 0) . ' bytes';
|
2040 |
-
}
|
2041 |
-
} // format_size
|
2042 |
-
|
2043 |
-
|
2044 |
/**
|
2045 |
* Creates snapshot of current tables by copying them in the DB and saving metadata.
|
2046 |
*
|
@@ -2374,7 +2949,7 @@ class WP_Reset
|
|
2374 |
$out .= '</tr>';
|
2375 |
$out .= '<tr class="hidden">';
|
2376 |
$out .= '<td>';
|
2377 |
-
$out .= '<p>' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' .
|
2378 |
$out .= '<pre>' . $table['schema'] . '</pre>';
|
2379 |
$out .= '</td>';
|
2380 |
$out .= '<td> </td>';
|
@@ -2393,7 +2968,7 @@ class WP_Reset
|
|
2393 |
$out .= '<tr class="hidden">';
|
2394 |
$out .= '<td> </td>';
|
2395 |
$out .= '<td>';
|
2396 |
-
$out .= '<p>' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' .
|
2397 |
$out .= '<pre>' . $table['schema'] . '</pre>';
|
2398 |
$out .= '</td>';
|
2399 |
$out .= '</tr>';
|
@@ -2419,11 +2994,11 @@ class WP_Reset
|
|
2419 |
$out3 .= '</tr>';
|
2420 |
$out3 .= '<tr class="hidden">';
|
2421 |
$out3 .= '<td>';
|
2422 |
-
$out3 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' .
|
2423 |
$out3 .= '<pre>' . $tbl_current['schema'] . '</pre>';
|
2424 |
$out3 .= '</td>';
|
2425 |
$out3 .= '<td>';
|
2426 |
-
$out3 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' .
|
2427 |
$out3 .= '<pre>' . $tbl_snapshot['schema'] . '</pre>';
|
2428 |
$out3 .= '</td>';
|
2429 |
$out3 .= '</tr>';
|
@@ -2443,10 +3018,10 @@ class WP_Reset
|
|
2443 |
$out2 .= '</tr>';
|
2444 |
$out2 .= '<tr class="hidden">';
|
2445 |
$out2 .= '<td>';
|
2446 |
-
$out2 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' .
|
2447 |
$out2 .= '</td>';
|
2448 |
$out2 .= '<td>';
|
2449 |
-
$out2 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' .
|
2450 |
$out2 .= '</td>';
|
2451 |
$out2 .= '</tr>';
|
2452 |
$out2 .= '<tr class="hidden">';
|
@@ -2465,10 +3040,10 @@ class WP_Reset
|
|
2465 |
$out2 .= '</tr>';
|
2466 |
$out2 .= '<tr class="hidden">';
|
2467 |
$out2 .= '<td>';
|
2468 |
-
$out2 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' .
|
2469 |
$out2 .= '</td>';
|
2470 |
$out2 .= '<td>';
|
2471 |
-
$out2 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' .
|
2472 |
$out2 .= '</td>';
|
2473 |
$out2 .= '</tr>';
|
2474 |
|
@@ -2594,7 +3169,7 @@ class WP_Reset
|
|
2594 |
}
|
2595 |
}
|
2596 |
|
2597 |
-
if ($
|
2598 |
array_unshift($res->plugins, $plugin_info);
|
2599 |
}
|
2600 |
|
@@ -2611,9 +3186,10 @@ class WP_Reset
|
|
2611 |
{
|
2612 |
remove_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
|
2613 |
|
|
|
2614 |
$res = $this->add_plugin_featured('under-construction-page', $res);
|
2615 |
-
$res = $this->add_plugin_featured('wp-force-ssl', $res);
|
2616 |
$res = $this->add_plugin_featured('eps-301-redirects', $res);
|
|
|
2617 |
|
2618 |
return $res;
|
2619 |
} // plugins_api_result
|
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
|
10 |
|
11 |
+
Copyright 2015 - 2020 Web factory Ltd (email: wpreset@webfactoryltd.com)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
30 |
}
|
31 |
|
32 |
|
33 |
+
define('WP_RESET_FILE', __FILE__);
|
34 |
+
|
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';
|
50 |
public $snapshots_folder = 'wp-reset-snapshots-export';
|
51 |
protected $options = array();
|
52 |
private $delete_count = 0;
|
53 |
+
private $licensing_servers = array('https://dashboard.wpreset.com/api/');
|
54 |
+
public $core_tables = array('commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'term_relationships', 'term_taxonomy', 'termmeta', 'terms', 'usermeta', 'users');
|
55 |
+
private $license = null;
|
56 |
|
57 |
|
58 |
/**
|
82 |
$this->plugin_url = plugin_dir_url(__FILE__);
|
83 |
$this->load_options();
|
84 |
|
85 |
+
$this->license = new WF_Licensing(array(
|
86 |
+
'prefix' => 'wpr',
|
87 |
+
'licensing_servers' => $this->licensing_servers,
|
88 |
+
'version' => $this->version,
|
89 |
+
'plugin_file' => __FILE__,
|
90 |
+
'skip_hooks' => false,
|
91 |
+
'debug' => false,
|
92 |
+
'js_folder' => plugin_dir_url(__FILE__) . '/js/'
|
93 |
+
));
|
94 |
+
|
95 |
add_action('admin_menu', array($this, 'admin_menu'));
|
96 |
add_action('admin_init', array($this, 'do_all_actions'));
|
97 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
200 |
/**
|
201 |
* Get options part of plugin options
|
202 |
*
|
|
|
|
|
203 |
* @param string $key Optional.
|
204 |
*
|
205 |
* @return array
|
206 |
*/
|
207 |
+
function get_options()
|
208 |
{
|
209 |
return $this->options['options'];
|
210 |
} // get_options
|
211 |
|
212 |
|
213 |
/**
|
214 |
+
* Update specified plugin options key
|
|
|
|
|
215 |
*
|
216 |
* @param string $key Data to save.
|
217 |
* @param string $data Option key.
|
220 |
*/
|
221 |
function update_options($key, $data)
|
222 |
{
|
223 |
+
if (false === in_array($key, array('meta', 'license', 'dismissed_notices', 'options'))) {
|
224 |
+
user_error('Unknown options key.', E_USER_ERROR);
|
225 |
+
return false;
|
226 |
+
}
|
227 |
+
|
228 |
$this->options[$key] = $data;
|
229 |
$tmp = update_option('wp-reset', $this->options);
|
230 |
|
231 |
return $tmp;
|
232 |
+
} // update_options
|
233 |
|
234 |
|
235 |
/**
|
385 |
'confirm1' => __('Clicking "Reset WordPress" will reset your site to default values. All content will be lost. Always <a href="#" class="create-new-snapshot" data-description="Before resetting the site">create a snapshot</a> if you want to be able to undo.</b>', 'wp-reset'),
|
386 |
'confirm2' => __('Click "Cancel" to abort.', 'wp-reset'),
|
387 |
'doing_reset' => __('Resetting in progress. Please wait.', 'wp-reset'),
|
388 |
+
'snapshot_success' => __('Snapshot created', 'wp-reset'),
|
389 |
+
'snapshot_wait' => __('Creating snapshot. Please wait.', 'wp-reset'),
|
390 |
+
'snapshot_confirm' => __('Create snapshot', 'wp-reset'),
|
391 |
+
'snapshot_placeholder' => __('Snapshot name or brief description, ie: before plugin install', 'wp-reset'),
|
392 |
+
'snapshot_text' => __('Enter snapshot name or brief description', 'wp-reset'),
|
393 |
+
'snapshot_title' => __('Create a new snapshot', 'wp-reset'),
|
394 |
'nonce_dismiss_notice' => wp_create_nonce('wp-reset_dismiss_notice'),
|
395 |
+
'activating' => __('Activating', 'wp-reset'),
|
396 |
+
'deactivating' => __('Deactivating', 'wp-reset'),
|
397 |
+
'deleting' => __('Deleting', 'wp-reset'),
|
398 |
+
'installing' => __('Installing', 'wp-reset'),
|
399 |
+
'activate_failed' => __('Could not activate', 'wp-reset'),
|
400 |
+
'deactivate_failed' => __('Could not deactivate', 'wp-reset'),
|
401 |
+
'delete_failed' => __('Could not delete', 'wp-reset'),
|
402 |
+
'install_failed' => __('Could not install', 'wp-reset'),
|
403 |
+
'install_failed_existing' => __('is already installed', 'wp-reset'),
|
404 |
'nonce_run_tool' => wp_create_nonce('wp-reset_run_tool'),
|
405 |
'nonce_do_reset' => wp_create_nonce('wp-reset_do_reset'),
|
406 |
);
|
698 |
} // do_delete_transients
|
699 |
|
700 |
|
701 |
+
/**
|
702 |
+
* Purge all cache for popular caching plugins
|
703 |
+
*
|
704 |
+
* @return bool true
|
705 |
+
*/
|
706 |
+
function do_purge_cache()
|
707 |
+
{
|
708 |
+
global $wp_reset;
|
709 |
+
|
710 |
+
wp_cache_flush();
|
711 |
+
$wp_reset->do_delete_transients();
|
712 |
+
|
713 |
+
if (function_exists('w3tc_flush_all')) {
|
714 |
+
w3tc_flush_all();
|
715 |
+
}
|
716 |
+
if (function_exists('wp_cache_clear_cache')) {
|
717 |
+
wp_cache_clear_cache();
|
718 |
+
}
|
719 |
+
if (method_exists('LiteSpeed_Cache_API', 'purge_all')) {
|
720 |
+
LiteSpeed_Cache_API::purge_all();
|
721 |
+
}
|
722 |
+
if (class_exists('Endurance_Page_Cache')) {
|
723 |
+
$epc = new Endurance_Page_Cache;
|
724 |
+
$epc->purge_all();
|
725 |
+
}
|
726 |
+
if (class_exists('SG_CachePress_Supercacher') && method_exists('SG_CachePress_Supercacher', 'purge_cache')) {
|
727 |
+
SG_CachePress_Supercacher::purge_cache(true);
|
728 |
+
}
|
729 |
+
if (class_exists('SiteGround_Optimizer\Supercacher\Supercacher')) {
|
730 |
+
SiteGround_Optimizer\Supercacher\Supercacher::purge_cache();
|
731 |
+
}
|
732 |
+
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) {
|
733 |
+
$GLOBALS['wp_fastest_cache']->deleteCache(true);
|
734 |
+
}
|
735 |
+
if (is_callable(array('Swift_Performance_Cache', 'clear_all_cache'))) {
|
736 |
+
Swift_Performance_Cache::clear_all_cache();
|
737 |
+
}
|
738 |
+
if (is_callable(array('Hummingbird\WP_Hummingbird', 'flush_cache'))) {
|
739 |
+
Hummingbird\WP_Hummingbird::flush_cache(true, false);
|
740 |
+
}
|
741 |
+
|
742 |
+
do_action('wp_reset_purge_cache');
|
743 |
+
|
744 |
+
return true;
|
745 |
+
} // do_purge_cache
|
746 |
+
|
747 |
+
|
748 |
/**
|
749 |
* Resets all theme options (mods).
|
750 |
*
|
814 |
|
815 |
|
816 |
/**
|
817 |
+
* Deactivate all plugins
|
818 |
*
|
819 |
+
* @param array keep_wp_reset - Keep WP Reset active and installed, silent_deactivate - Skip individual plugin deactivation functions when deactivating
|
|
|
820 |
*
|
821 |
+
* @return int Number of deactivated plugins.
|
822 |
*/
|
823 |
+
function do_deactivate_plugins($params = array())
|
824 |
{
|
825 |
if (!function_exists('get_plugins')) {
|
826 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
829 |
require_once ABSPATH . 'wp-admin/includes/file.php';
|
830 |
}
|
831 |
|
832 |
+
$wp_reset_basename = plugin_basename(WP_RESET_FILE);
|
833 |
+
$params = shortcode_atts(array('keep_wp_reset' => true, 'silent_deactivate' => false), (array) $params);
|
834 |
|
|
|
835 |
$active_plugins = (array) get_option('active_plugins', array());
|
836 |
+
if ($params['keep_wp_reset']) {
|
837 |
if (($key = array_search($wp_reset_basename, $active_plugins)) !== false) {
|
838 |
unset($active_plugins[$key]);
|
839 |
}
|
|
|
840 |
}
|
841 |
|
842 |
if (!empty($active_plugins)) {
|
843 |
+
deactivate_plugins($active_plugins, $params['silent_deactivate'], false);
|
844 |
+
}
|
845 |
+
|
846 |
+
do_action('wp_reset_deactivate_plugins', $active_plugins, $params);
|
847 |
+
|
848 |
+
return sizeof($active_plugins);
|
849 |
+
} // do_deactivate_plugins
|
850 |
+
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Delete all plugins
|
854 |
+
*
|
855 |
+
* @param array keep_wp_reset - Keep WP Reset active and installed
|
856 |
+
*
|
857 |
+
* @return int Number of deleted plugins.
|
858 |
+
*/
|
859 |
+
function do_delete_plugins($params = array())
|
860 |
+
{
|
861 |
+
if (!function_exists('get_plugins')) {
|
862 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
863 |
+
}
|
864 |
+
if (!function_exists('request_filesystem_credentials')) {
|
865 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
866 |
+
}
|
867 |
+
|
868 |
+
$wp_reset_basename = plugin_basename(WP_RESET_FILE);
|
869 |
+
$params = shortcode_atts(array('keep_wp_reset' => true), (array) $params);
|
870 |
+
|
871 |
+
$all_plugins = get_plugins();
|
872 |
+
if ($params['keep_wp_reset']) {
|
873 |
+
unset($all_plugins[$wp_reset_basename]);
|
874 |
}
|
875 |
|
876 |
if (!empty($all_plugins)) {
|
877 |
delete_plugins(array_keys($all_plugins));
|
878 |
}
|
879 |
|
880 |
+
do_action('wp_reset_delete_plugins', $all_plugins, $params);
|
881 |
|
882 |
return sizeof($all_plugins);
|
883 |
} // do_delete_plugins
|
1050 |
} elseif ($tool == 'reset_theme_options') {
|
1051 |
$cnt = $this->do_reset_theme_options(true);
|
1052 |
wp_send_json_success($cnt);
|
1053 |
+
} elseif ($tool == 'purge_cache') {
|
1054 |
+
$this->do_purge_cache();
|
1055 |
+
wp_send_json_success();
|
1056 |
+
} elseif ($tool == 'delete_wp_cookies') {
|
1057 |
+
wp_clear_auth_cookie();
|
1058 |
+
wp_send_json_success();
|
1059 |
} elseif ($tool == 'delete_themes') {
|
1060 |
$cnt = $this->do_delete_themes(false);
|
1061 |
wp_send_json_success($cnt);
|
1062 |
+
} elseif ($tool == 'deactivate_plugins') {
|
1063 |
+
$cnt = $this->do_deactivate_plugins($extra_data);
|
1064 |
+
wp_send_json_success($cnt);
|
1065 |
} elseif ($tool == 'delete_plugins') {
|
1066 |
+
$cnt = $this->do_delete_plugins($extra_data);
|
1067 |
wp_send_json_success($cnt);
|
1068 |
} elseif ($tool == 'delete_uploads') {
|
1069 |
$cnt = $this->do_delete_uploads();
|
1117 |
} else {
|
1118 |
wp_send_json_success();
|
1119 |
}
|
1120 |
+
} elseif ($tool == 'get_table_details') {
|
1121 |
+
$res = WP_Reset_Utility::get_table_details();
|
1122 |
+
wp_send_json_success($res);
|
1123 |
+
} elseif (
|
1124 |
+
$tool == 'check_deactivate_plugin' ||
|
1125 |
+
$tool == 'check_delete_plugin' ||
|
1126 |
+
$tool == 'check_install_plugin' ||
|
1127 |
+
$tool == 'check_activate_plugin'
|
1128 |
+
) {
|
1129 |
+
$path = $this->get_plugin_path($_GET['slug']);
|
1130 |
+
|
1131 |
+
if (false !== ($error = get_transient('wf_install_error_' . $_GET['slug']))) {
|
1132 |
+
delete_transient('wf_install_error_' . $_GET['slug']);
|
1133 |
+
wp_send_json_success($error);
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
if (false !== $path) {
|
1137 |
+
$active_plugins = (array) get_option('active_plugins', array());
|
1138 |
+
if (false !== array_search($path, $active_plugins)) {
|
1139 |
+
wp_send_json_success('active');
|
1140 |
+
} else {
|
1141 |
+
wp_send_json_success('inactive');
|
1142 |
+
}
|
1143 |
+
} else {
|
1144 |
+
wp_send_json_success('deleted');
|
1145 |
+
}
|
1146 |
+
} elseif ($tool == 'install_plugin') {
|
1147 |
+
$slug = $_GET['slug'];
|
1148 |
+
|
1149 |
+
@include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
1150 |
+
@include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
1151 |
+
@include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
1152 |
+
@include_once ABSPATH . 'wp-admin/includes/file.php';
|
1153 |
+
@include_once ABSPATH . 'wp-admin/includes/misc.php';
|
1154 |
+
|
1155 |
+
wp_cache_flush();
|
1156 |
+
|
1157 |
+
$path = $this->get_plugin_path($slug);
|
1158 |
+
|
1159 |
+
if (false !== $path) {
|
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');
|
1167 |
+
wp_send_json_success();
|
1168 |
+
}
|
1169 |
+
} elseif ($tool == 'activate_plugin') {
|
1170 |
+
$path = $this->get_plugin_path($_GET['slug']);
|
1171 |
+
activate_plugin($path);
|
1172 |
+
wp_send_json_success();
|
1173 |
} else {
|
1174 |
wp_send_json_error(__('Unknown tool.', 'wp-reset'));
|
1175 |
}
|
1176 |
} // ajax_run_tool
|
1177 |
|
1178 |
|
1179 |
+
/**
|
1180 |
+
* Get plugin path from slug
|
1181 |
+
*
|
1182 |
+
* @return string path
|
1183 |
+
*/
|
1184 |
+
function get_plugin_path($slug)
|
1185 |
+
{
|
1186 |
+
$all_plugins = get_plugins();
|
1187 |
+
foreach ($all_plugins as $plugin_path => $plugin) {
|
1188 |
+
if (strpos($plugin_path, $slug . '/') === 0) {
|
1189 |
+
return $plugin_path;
|
1190 |
+
}
|
1191 |
+
}
|
1192 |
+
return false;
|
1193 |
+
} // get_plugin_path
|
1194 |
+
|
1195 |
+
|
1196 |
/**
|
1197 |
* Reinstall / reset the WP site
|
1198 |
* There are no failsafes in the function - it reinstalls when called
|
1217 |
}
|
1218 |
|
1219 |
// save values that need to be restored after reset
|
|
|
1220 |
$blogname = get_option('blogname');
|
1221 |
$blog_public = get_option('blog_public');
|
1222 |
$wplang = get_option('wplang');
|
1250 |
}
|
1251 |
|
1252 |
// supress errors for WP_CLI
|
|
|
1253 |
$result = @wp_install($blogname, $current_user->user_login, $current_user->user_email, $blog_public, '', md5(rand()), $wplang);
|
1254 |
$user_id = $result['user_id'];
|
1255 |
|
1316 |
|
1317 |
/**
|
1318 |
* Checks wp_reset post value and performs all actions
|
|
|
1319 |
*
|
1320 |
* @return null|bool
|
1321 |
*/
|
1493 |
* Generate card header including title and action buttons
|
1494 |
*
|
1495 |
* @param string $title Card title.
|
1496 |
+
* @param string $card_id Card element #ID.
|
1497 |
+
* @param array $params Individual icons arguments
|
|
|
1498 |
*
|
1499 |
* @return string
|
1500 |
*/
|
1501 |
+
function get_card_header($title, $card_id, $params = array())
|
1502 |
{
|
1503 |
+
$params = shortcode_atts(array(
|
1504 |
+
'documentation_link' => false,
|
1505 |
+
'iot_button' => false,
|
1506 |
+
'collapse_button' => false,
|
1507 |
+
'create_snapshot' => false,
|
1508 |
+
'pro' => false
|
1509 |
+
), (array) $params);
|
1510 |
+
|
1511 |
+
if ($params['documentation_link'] === true) {
|
1512 |
+
$params['documentation_link'] = $card_id;
|
1513 |
+
}
|
1514 |
+
|
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>';
|
1610 |
echo '<li><a href="#tab-snapshots">' . __('Snapshots', 'wp-reset') . '</a></li>';
|
1611 |
echo '<li><a href="#tab-collections">' . __('Collections', 'wp-reset') . '</a></li>';
|
1612 |
echo '<li><a href="#tab-support">' . __('Support', 'wp-reset') . '</a></li>';
|
1613 |
+
echo '<li><a href="#tab-pro">' . __('PRO', 'wp-reset') . '</a></li>';
|
1614 |
echo '</ul>';
|
1615 |
echo '</div>'; // container
|
1616 |
echo '</nav>';
|
1645 |
$this->tab_support();
|
1646 |
echo '</div>';
|
1647 |
|
1648 |
+
echo '<div style="display: none;" id="tab-pro">';
|
1649 |
+
$this->tab_pro();
|
1650 |
+
echo '</div>';
|
1651 |
+
|
1652 |
echo '</div>'; // content
|
1653 |
echo '</div>'; // container
|
1654 |
echo '</div>'; // wp-reset-tabs
|
1656 |
echo '</form>';
|
1657 |
echo '</div>'; // wrap
|
1658 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1659 |
if (!$this->is_webhooks_active()) {
|
1660 |
echo '<div id="webhooks-dialog" style="display: none;" title="Webhooks"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
|
1661 |
echo '<div style="padding: 20px; font-size: 15px;">';
|
1685 |
$meta = $this->get_meta();
|
1686 |
$snapshots = $this->get_snapshots();
|
1687 |
|
1688 |
+
// update to PRO after activating the license
|
1689 |
+
if ($this->license->is_active()) {
|
1690 |
+
$plugin = plugin_basename(__FILE__);
|
1691 |
+
$update_url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin)), 'upgrade-plugin_' . $plugin);
|
1692 |
+
|
1693 |
+
echo '<div class="card notice-wrapper notice-info">';
|
1694 |
+
echo '<h2>' . __('Thank you for purchasing WP Reset PRO!<br>Please update plugin files to finish activating the license.', 'wp-reset') . '</h2>';
|
1695 |
+
echo '<p>Your license has been verified & activated.</b> ';
|
1696 |
+
echo 'Please <b>click the button below</b> to update plugin files to the PRO version.</p>';
|
1697 |
+
echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary"><b>Update WP Reset files to PRO & finish the activation</b></a></p>';
|
1698 |
+
echo '</div>';
|
1699 |
+
$notice_shown = true;
|
1700 |
+
}
|
1701 |
+
|
1702 |
// warn that WPR is not WPMU compatible
|
1703 |
if (false === $notice_shown && is_multisite()) {
|
1704 |
echo '<div class="card notice-wrapper notice-error">';
|
1732 |
{
|
1733 |
global $current_user, $wpdb;
|
1734 |
|
1735 |
+
echo '<div class="card">';
|
1736 |
+
echo $this->get_card_header(__('Please read carefully before proceeding', 'wp-reset'), 'reset-description', array('collapse_button' => true));
|
|
|
|
|
|
|
1737 |
echo '<div class="card-body">';
|
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>';
|
1746 |
+
echo '<th> </th>';
|
1747 |
+
echo '<th>Options Reset<a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
|
1748 |
+
echo '<th nowrap>Site Reset</th>';
|
1749 |
+
echo '<th>Nuclear Reset<a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
|
1750 |
+
echo '</tr>';
|
1751 |
+
$rows = array();
|
1752 |
+
$rows['Posts, pages & custom post types'] = array(0, 1, 1);
|
1753 |
+
$rows['Comments'] = array(0, 1, 1);
|
1754 |
+
$rows['Media'] = array(0, 1, 1);
|
1755 |
+
$rows['Media files'] = array(0, 0, 1);
|
1756 |
+
$rows['Users'] = array(0, 1, 1);
|
1757 |
+
$rows['User roles'] = array(1, 1, 1);
|
1758 |
+
$rows['Current user - ' . $current_user->user_login] = array(0, 0, 0);
|
1759 |
+
$rows['Widgets'] = array(1, 1, 1);
|
1760 |
+
$rows['Transients'] = array(1, 1, 1);
|
1761 |
+
$rows['Settings & options (from WP, plugins & themes)'] = array(1, 1, 1);
|
1762 |
+
$rows['Site title, WP address, site address,<br>search engine visibility, timezone'] = array(0, 0, 0);
|
1763 |
+
$rows['Site language'] = array(0, 0, 1);
|
1764 |
+
$rows['Data in all default WP tables'] = array(0, 1, 1);
|
1765 |
+
$rows['Custom database tables with prefix ' . $wpdb->prefix] = array(0, 1, 1);
|
1766 |
+
$rows['Other database tables'] = array(0, 0, 0);
|
1767 |
+
$rows['Plugin files'] = array(0, 0, 1);
|
1768 |
+
$rows['MU plugin files'] = array(0, 0, 1);
|
1769 |
+
$rows['Drop-in files'] = array(0, 0, 1);
|
1770 |
+
$rows['Theme files'] = array(0, 0, 1);
|
1771 |
+
$rows['All files in uploads'] = array(0, 0, 1);
|
1772 |
+
$rows['Custom folders in wp-content'] = array(0, 0, 1);
|
1773 |
+
|
1774 |
+
foreach ($rows as $tool => $opt) {
|
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
|
1794 |
+
echo '<tfoot>';
|
1795 |
+
echo '<tr>';
|
1796 |
+
echo '<th> </th>';
|
1797 |
+
echo '<th>Options Reset<a data-feature="tool-options-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
|
1798 |
+
echo '<th nowrap>Site Reset</th>';
|
1799 |
+
echo '<th>Nuclear Reset<a data-feature="tool-nuclear-reset" class="pro-feature" href="#"><span class="pro">PRO</span> tool</a></th>';
|
1800 |
+
echo '</tr>';
|
1801 |
+
echo '</tfoot>';
|
1802 |
+
echo '</table>';
|
1803 |
+
|
1804 |
+
echo '<p><b>' . __('What happens when I run any Reset tool?', 'wp-reset') . '</b></p>';
|
1805 |
echo '<ul class="plain-list">';
|
1806 |
+
echo '<li>' . __('remember, always <b>make a backup first</b> or use <a href="#" class="change-tab" data-tab="2">snapshots</a>', 'wp-reset') . '</li>';
|
1807 |
echo '<li>' . __('you will have to confirm the action one more time', 'wp-reset') . '</li>';
|
1808 |
+
echo '<li>' . __('see the table above to find out what exactly will be reset or deleted', 'wp-reset') . '</li>';
|
1809 |
+
echo '<li>' . __('site title, WordPress URL, site URL, site language, search engine visibility and current user will always be restored', 'wp-reset') . '</li>';
|
1810 |
+
echo '<li>' . __('you will be logged out, automatically logged back in and taken to the admin dashboard', 'wp-reset') . '</li>';
|
1811 |
+
echo '<li>' . __('WP Reset plugin will be reactivated if that option is chosen', 'wp-reset') . '</li>';
|
1812 |
echo '</ul>';
|
1813 |
|
1814 |
echo '<p><b>' . __('WP-CLI Support', 'wp-reset') . '</b><br>';
|
1815 |
echo '' . sprintf(__('All tools available via GUI are available in WP-CLI as well. To get the list of commands run %s. Instead of the active user, the first user with admin privileges found in the database will be restored. ', 'wp-reset'), '<code>wp help reset</code>');
|
1816 |
+
echo sprintf(__('All actions have to be confirmed. If you want to skip confirmation use the standard %s option. Please be careful and backup first.', 'wp-reset'), '<code>--yes</code>') . '</p>';
|
1817 |
|
1818 |
+
echo '</div></div>'; // card description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1819 |
|
1820 |
$theme = wp_get_theme();
|
1821 |
+
$theme_name = $theme->get('Name');
|
1822 |
+
if (empty($theme_name)) {
|
1823 |
+
$theme_name = '<i>no active theme</i>';
|
1824 |
+
}
|
1825 |
+
$active_plugins = get_option('active_plugins');
|
1826 |
|
1827 |
+
// options reset
|
1828 |
+
echo '<div class="card default-collapsed">';
|
1829 |
+
echo $this->get_card_header(__('Options Reset', 'wp-reset'), 'tool-options-reset', array('collapse_button' => true, 'pro' => true));
|
1830 |
+
echo '<div class="card-body">';
|
1831 |
+
echo '<p>Options table will be reset to default values meaning all WP core settings, widgets, theme settings and customizations, and plugin settings will be gone. Other content and files will not be touched including posts, pages, custom post types, comments and other data stored in separate tables. Site URL and name will be kept as well. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
|
1832 |
+
|
1833 |
+
echo $this->get_tool_icons(false, true);
|
1834 |
+
|
1835 |
+
echo '<p><br><label for="reset-options-reactivate-theme"><input type="checkbox" id="reset-options-reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . $theme_name . '</label></p>';
|
1836 |
+
echo '<p><label for="reset-options-reactivate-plugins"><input type="checkbox" id="reset-options-reactivate-plugins" value="1"> Reactivate ' . sizeof($active_plugins) . ' currently active plugin' . (sizeof($active_plugins) != 1 ? 's' : '') . ' (WP Reset will reactivate by default)</label></p>';
|
1837 |
+
|
1838 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Reset all options - <span data-feature="tool-options-reset" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
1839 |
+
echo '</div>';
|
1840 |
+
echo '</div>'; // options reset
|
1841 |
+
|
1842 |
+
echo '<div class="card">';
|
1843 |
+
echo $this->get_card_header(__('Site Reset', 'wp-reset'), 'tool-site-reset', array('collapse_button' => true));
|
1844 |
echo '<div class="card-body">';
|
1845 |
echo '<p><label for="reactivate-theme"><input name="wpr-post-reset[reactivate_theme]" type="checkbox" id="reactivate-theme" value="1"> ' . __('Reactivate current theme', 'wp-reset') . ' - ' . $theme->get('Name') . '</label></p>';
|
1846 |
echo '<p><label for="reactivate-wpreset"><input name="wpr-post-reset[reactivate_wpreset]" type="checkbox" id="reactivate-wpreset" value="1" checked> ' . __('Reactivate WP Reset plugin', 'wp-reset') . '</label></p>';
|
1848 |
echo '<p><label for="reactivate-webhooks"><input name="wpr-post-reset[reactivate_webhooks]" type="checkbox" id="reactivate-webhooks" value="1" checked> ' . __('Reactivate WP Webhooks plugin', 'wp-reset') . '</label></p>';
|
1849 |
}
|
1850 |
echo '<p><label for="reactivate-plugins"><input name="wpr-post-reset[reactivate_plugins]" type="checkbox" id="reactivate-plugins" value="1"> ' . __('Reactivate all currently active plugins', 'wp-reset') . '</label></p>';
|
1851 |
+
echo '<p>' . __('Type <b>reset</b> in the confirmation field to confirm the reset and then click the "Reset WordPress" button.<br>Always <a href="#" class="create-new-snapshot" data-description="Before resetting the site">create a snapshot</a> before resetting if you want to be able to undo.', 'wp-reset') . '</p>';
|
|
|
|
|
|
|
|
|
|
|
1852 |
|
1853 |
wp_nonce_field('wp-reset');
|
1854 |
+
echo '<p class="mb0"><input id="wp_reset_confirm" type="text" name="wp_reset_confirm" placeholder="' . esc_attr__('Type in "reset"', 'wp-reset') . '" value="" autocomplete="off"> ';
|
1855 |
echo '<a id="wp_reset_submit" class="button button-delete">' . __('Reset Site', 'wp-reset') . '</a>' . $this->get_snapshot_button('reset-wordpress', 'Before resetting the site') . '</p>';
|
1856 |
echo '</div>';
|
1857 |
+
echo '</div>'; // card reset
|
1858 |
+
|
1859 |
+
// nuclear reset
|
1860 |
+
echo '<div class="card default-collapsed">';
|
1861 |
+
echo $this->get_card_header(__('Nuclear Site Reset', 'wp-reset'), 'tool-nuclear-reset', array('collapse_button' => true, 'pro' => true));
|
1862 |
+
echo '<div class="card-body">';
|
1863 |
+
echo '<p>All data will be deleted or reset (see the <a href="#reset-details" class="scrollto">explanation table</a> for details). All data stored in the database including custom tables with <code>' . $wpdb->prefix . '</code> prefix, as well as all files in wp-content, themes and plugins folders. The only thing restored after reset will be your user account so you can log in again, and the basic WP settings like site URL. Please see the <a href="#reset-details" class="scrollto">table above</a> for details.</p>';
|
1864 |
+
|
1865 |
+
echo $this->get_tool_icons(true, true);
|
1866 |
+
|
1867 |
+
if (is_multisite()) {
|
1868 |
+
echo '<p class="mb0 wpmu-error">This tool is <b>not compatible</b> with WP multisite (WPMU). Using it would delete files shared by multiple sites in the WP network.</p>';
|
1869 |
+
} else {
|
1870 |
+
echo '<p><br><label for="nuclear-reset-reactivate-wpreset"><input type="checkbox" id="nuclear-reset-reactivate-wpreset" value="1" checked> ' . __('Reactivate WP Reset plugin', 'wp-reset') . '</label></p>';
|
1871 |
+
|
1872 |
+
echo '<p>' . __('Type <b>reset</b> in the confirmation field to confirm the reset and then click the "Reset WordPress & Delete All Custom Files & Data" button. <b>There is NO UNDO.', 'wp-reset') . '</b></p>';
|
1873 |
+
|
1874 |
+
echo '<p class="mb0"><input id="nuclear_reset_confirm" type="text" placeholder="' . esc_attr__('Type in "reset"', 'wp-reset') . '" value="" autocomplete="off"> ';
|
1875 |
+
echo '<a class="button button-delete button-pro-feature" href="#">' . __('Reset WordPress & Delete All Custom Files & Data', 'wp-reset') . ' - <span data-feature="tool-nuclear-reset" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
1876 |
+
}
|
1877 |
echo '</div>';
|
1878 |
+
echo '</div>'; // nuclear reset
|
1879 |
} // tab_reset
|
1880 |
|
1881 |
|
1886 |
*/
|
1887 |
private function tab_tools()
|
1888 |
{
|
1889 |
+
global $wpdb, $wp_version;
|
1890 |
|
1891 |
$tools = array(
|
|
|
|
|
1892 |
'tool-reset-theme-options' => 'Reset Theme Options',
|
1893 |
+
'_tool-reset-user-roles' => 'Reset User Roles',
|
1894 |
+
'tool-delete-transients' => 'Delete Transients',
|
1895 |
+
'tool-purge-cache' => 'Purge Cache',
|
1896 |
+
'tool-delete-local-data' => 'Delete Local Data',
|
1897 |
+
'_tool-delete-content' => 'Delete Content',
|
1898 |
+
'_tool-delete-widgets' => 'Delete Widgets',
|
1899 |
'tool-delete-themes' => 'Delete Themes',
|
1900 |
'tool-delete-plugins' => 'Delete Plugins',
|
1901 |
+
'_tool-delete-mu-plugins-dropins' => 'Delete MU Plugins & Drop-ins',
|
1902 |
+
'tool-delete-uploads' => 'Clean uploads Folder',
|
1903 |
+
'_tool-delete-wp-content' => 'Clean wp-content Folder',
|
1904 |
'tool-empty-delete-custom-tables' => 'Empty or Delete Custom Tables',
|
1905 |
+
'_tool-switch-wp-version' => 'Switch WP Version',
|
1906 |
'tool-delete-htaccess' => 'Delete .htaccess File'
|
1907 |
);
|
1908 |
|
1909 |
echo '<div class="card">';
|
1910 |
+
echo $this->get_card_header(__('Index of Tools', 'wp-reset'), 'iot', array('collapse_button' => true));
|
1911 |
echo '<div class="card-body">';
|
1912 |
$i = 0;
|
1913 |
$tools_nb = sizeof($tools);
|
1914 |
foreach ($tools as $tool_id => $tool_name) {
|
1915 |
if ($i == 0) {
|
1916 |
+
echo '<div class="third">';
|
1917 |
echo '<ul class="mb0 plain-list">';
|
1918 |
}
|
1919 |
+
if ($i == 5 || $i == 10) {
|
1920 |
echo '</div>';
|
1921 |
+
echo '<div class="third">';
|
1922 |
echo '<ul class="mb0 plain-list">';
|
1923 |
}
|
1924 |
|
1925 |
+
if ($tool_id[0] == '_') {
|
1926 |
+
$tool_id = ltrim($tool_id, '_');
|
1927 |
+
echo '<li><a title="Jump to ' . $tool_name . ' tool" class="scrollto" href="#' . $tool_id . '">' . $tool_name . '</a> <a class="pro-feature" href="#" data-feature="' . $tool_id . '"><span class="pro">PRO</span> tool</a></li>';
|
1928 |
+
} else {
|
1929 |
+
echo '<li><a title="Jump to ' . $tool_name . ' tool" class="scrollto" href="#' . $tool_id . '">' . $tool_name . '</a></li>';
|
1930 |
+
}
|
1931 |
|
1932 |
if ($i == $tools_nb - 1) {
|
1933 |
echo '</ul>';
|
1934 |
+
echo '</div>'; // third
|
1935 |
}
|
1936 |
$i++;
|
1937 |
} // foreach tools
|
1939 |
echo '</div>';
|
1940 |
|
1941 |
echo '<div class="card">';
|
1942 |
+
echo $this->get_card_header(__('Reset Theme Options', 'wp-reset'), 'tool-reset-theme-options', array('iot_button' => true, 'collapse_button' => true));
|
1943 |
+
echo '<div class="card-body">';
|
1944 |
+
echo '<p>' . __('All options (mods) for all themes will be reset; not just for the active theme. The tool works only for themes that use the <a href="https://codex.wordpress.org/Theme_Modification_API" target="_blank">WordPress theme modification API</a>. If options are saved in some other, custom way they won\'t be reset.<br> Always <a href="#" class="create-new-snapshot" data-description="Before resetting theme options">create a snapshot</a> before using this tool if you want to be able to undo its actions.', 'wp-reset') . '</p>';
|
1945 |
+
echo $this->get_tool_icons(false, true);
|
1946 |
+
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to reset all theme options?" data-btn-confirm="Reset theme options" data-text-wait="Resetting theme options. Please wait." data-text-confirm="All options (mods) for all themes will be reset. Always ' . esc_attr('<a data-description="Before resetting theme options" href="#" class="create-new-snapshot">create a snapshot</a> if you want to be able to undo') . '." data-text-done="Options for %n themes have been reset." data-text-done-singular="Options for one theme have been reset." class="button button-delete" href="#" id="reset-theme-options">Reset theme options</a>' . $this->get_snapshot_button('reset-theme-options', 'Before resetting theme options') . '</p>';
|
1947 |
+
echo '</div>';
|
1948 |
+
echo '</div>'; // reset theme options
|
1949 |
+
|
1950 |
+
echo '<div class="card default-collapsed">';
|
1951 |
+
echo $this->get_card_header(__('Reset User Roles', 'wp-reset'), 'tool-reset-user-roles', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
1952 |
+
echo '<div class="card-body">';
|
1953 |
+
echo '<p>Default user roles\' capatibilities will be reset to their default values. All custom roles will be deleted.<br>Users that had custom roles will not be assigned any default ones and might not be able to log in. Roles have to be (re)assigned to them manually.</p>';
|
1954 |
+
echo $this->get_tool_icons(false, true);
|
1955 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Reset user roles - <span data-feature="tool-reset-user-roles" class="pro-feature"><span class="pro">PRO</span> tool</span></a>';
|
1956 |
+
echo $this->get_snapshot_button('reset-user-roles', 'Before resetting user roles') . '</p>';
|
1957 |
+
echo '</div>';
|
1958 |
+
echo '</div>'; // reset user roles
|
1959 |
+
|
1960 |
+
echo '<div class="card">';
|
1961 |
+
echo $this->get_card_header(__('Delete Transients', 'wp-reset'), 'tool-delete-transients', array('iot_button' => true, 'collapse_button' => true));
|
1962 |
echo '<div class="card-body">';
|
1963 |
echo '<p>All transient related database entries will be deleted. Including expired and non-expired transients, and orphaned transient timeout entries.<br>Always <a href="#" data-description="Before deleting transients" class="create-new-snapshot">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>';
|
1964 |
echo $this->get_tool_icons(false, true);
|
1965 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all transients?" data-btn-confirm="Delete all transients" data-text-wait="Deleting transients. Please wait." data-text-confirm="All database entries related to transients will be deleted. Always ' . esc_attr('<a data-description="Before deleting transients" href="#" class="create-new-snapshot">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n transient database entries have been deleted." data-text-done-singular="One transient database entry has been deleted." class="button button-delete" href="#" id="delete-transients">Delete all transients</a>' . $this->get_snapshot_button('delete-transients', 'Before deleting transients') . '</p>';
|
1966 |
echo '</div>';
|
1967 |
+
echo '</div>'; // delete transients
|
1968 |
|
1969 |
+
echo '<div class="card">';
|
1970 |
+
echo $this->get_card_header(__('Purge Cache', 'wp-reset'), 'tool-purge-cache', array('collapse_button' => true, 'iot_button' => true));
|
1971 |
+
echo '<div class="card-body">';
|
1972 |
+
echo '<p>All cache objects stored in both files and the database will be deleted. Along with WP object cache and transients, cache from the following plugins will be purged: W3 Total Cache, WP Cache, LiteSpeed Cache, Endurance Page Cache, SiteGround Optimizer, WP Fastest Cache and Swift Performance.</p>';
|
1973 |
+
echo $this->get_tool_icons(true, true);
|
1974 |
+
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to purge all cache?" data-btn-confirm="Purge cache" data-text-wait="Purging cache. Please wait." data-text-confirm="All cache objects will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="Cache has been purged." data-text-done-singular="Cache has been purged." class="button button-delete" href="#" id="purge-cache">Purge cache</a></p>';
|
1975 |
+
echo '</div>';
|
1976 |
+
echo '</div>'; // purge cache
|
1977 |
|
1978 |
echo '<div class="card">';
|
1979 |
+
echo $this->get_card_header(__('Delete Local Data', 'wp-reset'), 'tool-delete-local-data', array('collapse_button' => true, 'iot_button' => true));
|
1980 |
echo '<div class="card-body">';
|
1981 |
+
echo '<p>All local storage and session storage data will be deleted. Cookies without a custom set path will be deleted as well. WP cookies are not touched, with Delete Local Data button.<br>Deleting all WordPress cookies (including authentication cookies) will delete all WP related cookies and user (you) will be logged out on the next page reload.
|
1982 |
+
</p>';
|
1983 |
+
echo $this->get_tool_icons(false, false);
|
1984 |
+
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all local data?" data-btn-confirm="Delete local data" data-text-wait="Deleting local data. Please wait." data-text-confirm="All local data; cookies, local storage and local session will be deleted. There is NO UNDO. WP Reset does not make backups of local data." data-text-done="%n local data objects have been deleted." data-text-done-singular="One local data object has been deleted." class="button button-delete" href="#" id="delete-local-data">Delete local data</a><a data-confirm-title="Are you sure you want to delete all WP related cookies?" data-btn-confirm="Delete all WordPress cookies" data-text-wait="Deleting WP cookies. Please wait." data-text-confirm="All WP cookies including authentication ones will be deleted. You will have to log in again. There is NO UNDO. WP Reset does not make backups of cookies." data-text-done="All WP cookies have been deleted. Reload the page to login again." data-text-done-singular="All WP cookies have been deleted. Reload the page to login again." class="button button-delete" href="#" id="delete-wp-cookies">Delete all WordPress cookies</a></p>';
|
1985 |
+
echo '</div>';
|
1986 |
+
echo '</div>'; // delete local data
|
1987 |
|
1988 |
+
echo '<div class="card default-collapsed">';
|
1989 |
+
echo $this->get_card_header(__('Delete Content', 'wp-reset'), 'tool-delete-content', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
1990 |
+
echo '<div class="card-body">';
|
1991 |
+
echo '<p>Besides content, all linked or child records (for selected content) will be deleted to prevent creating orphaned rows in the database. For instance, for posts that\'s posts, post meta, and comments related to posts. Delete process does not call any WP hooks such as <i>before_delete_post</i>. Choosing a post type or taxonomy does not delete that parent object it deletes the child objects. Parent objects are defined in code. If you want to remove them, remove their code definition. When media is deleted, files are left in the uploads folder. To delete files use the <a class="scrollto" href="#tool-delete-uploads">Clean uploads Folder</a> tool. Deleting users does not affect the current, logged in user account. All orphaned objects will be reassigned to him.</p>';
|
1992 |
|
1993 |
+
echo $this->get_tool_icons(false, true);
|
1994 |
+
|
1995 |
+
$post_types = get_post_types('', false, 'and');
|
1996 |
+
$taxonomies = get_taxonomies('', false, 'and');
|
1997 |
+
|
1998 |
+
echo '<p><select size="6" multiple id="delete-content-types">';
|
1999 |
+
echo '<option value="_comments">Comments (' . ((int) $wpdb->get_var("SELECT COUNT(comment_id) FROM $wpdb->comments")) . ')</option>';
|
2000 |
+
echo '<option value="_users">Users (' . ((int) $wpdb->get_var("SELECT COUNT(id) FROM $wpdb->users")) . ')</option>';
|
2001 |
+
foreach ($post_types as $type) {
|
2002 |
+
$count = wp_count_posts($type->name, 'readable');
|
2003 |
+
$tmp = 0;
|
2004 |
+
foreach ($count as $cnt) {
|
2005 |
+
$tmp += (int) $cnt;
|
2006 |
+
}
|
2007 |
+
echo '<option value="' . $type->name . '">Post type - ' . $type->label . ' (' . $tmp . ')</option>';
|
2008 |
+
} // foreach post types
|
2009 |
+
foreach ($taxonomies as $tax) {
|
2010 |
+
echo '<option value="_tax_' . $tax->name . '">Taxonomy - ' . $tax->label . ' (' . wp_count_terms($tax->name) . ')</option>';
|
2011 |
+
} // foreach post types
|
2012 |
+
|
2013 |
+
echo '</select><br>';
|
2014 |
+
echo 'Select content object(s) you want to delete. Use ctrl + click to select multiple objects.</p>';
|
2015 |
+
|
2016 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Delete content - <span data-feature="tool-delete-content" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
2017 |
echo '</div>';
|
2018 |
+
echo '</div>'; // delete content
|
2019 |
|
2020 |
+
echo '<div class="card default-collapsed">';
|
2021 |
+
echo $this->get_card_header(__('Delete Widgets', 'wp-reset'), 'tool-delete-widgets', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
2022 |
echo '<div class="card-body">';
|
2023 |
+
echo '<p>All widgets, orphaned, active and inactive ones, as well as widgets in active and inactive sidebars will be deleted including their settings. After deleting, WordPress will automatically recreate default, empty database entries related to widgets. So, no matter how many times users run the tool it will never return "no data deleted". That\'s expected and normal.</p>';
|
2024 |
+
|
2025 |
echo $this->get_tool_icons(false, true);
|
2026 |
+
|
2027 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Delete widgets - <span data-feature="tool-delete-widgets" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
2028 |
echo '</div>';
|
2029 |
+
echo '</div>'; // delete widgets
|
2030 |
|
2031 |
$theme = wp_get_theme();
|
2032 |
|
2033 |
echo '<div class="card">';
|
2034 |
+
echo $this->get_card_header(__('Delete Themes', 'wp-reset'), 'tool-delete-themes', array('iot_button' => true, 'collapse_button' => true));
|
2035 |
echo '<div class="card-body">';
|
2036 |
echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . $theme->get('Name') . '.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
|
|
|
2037 |
echo $this->get_tool_icons(true, true);
|
|
|
2038 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all themes?" data-btn-confirm="Delete all themes" data-text-wait="Deleting all themes. Please wait." data-text-confirm="All themes will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n themes have been deleted." data-text-done-singular="One theme has been deleted." class="button button-delete" href="#" id="delete-themes">Delete all themes</a></p>';
|
2039 |
echo '</div>';
|
2040 |
+
echo '</div>'; // delete themes
|
2041 |
|
2042 |
echo '<div class="card">';
|
2043 |
+
echo $this->get_card_header(__('Delete Plugins', 'wp-reset'), 'tool-delete-plugins', array('iot_button' => true, 'collapse_button' => true));
|
2044 |
echo '<div class="card-body">';
|
2045 |
echo '<p>' . __('All plugins will be deleted except for WP Reset which will remain active.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
|
|
|
2046 |
echo $this->get_tool_icons(true, true);
|
|
|
2047 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all plugins?" data-btn-confirm="Delete plugins" data-text-wait="Deleting plugins. Please wait." data-text-confirm="All plugins except WP Reset will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n plugins have been deleted." data-text-done-singular="One plugin has been deleted." class="button button-delete" href="#" id="delete-plugins">Delete plugins</a></p>';
|
2048 |
echo '</div>';
|
2049 |
+
echo '</div>'; // delete plugins
|
2050 |
+
|
2051 |
+
echo '<div class="card default-collapsed">';
|
2052 |
+
echo $this->get_card_header(__('Delete MU Plugins & Drop-ins', 'wp-reset'), 'tool-delete-mu-plugins-dropins', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
2053 |
+
echo '<div class="card-body">';
|
2054 |
+
echo '<p>MU Plugins are located in <code>/wp-content/mu-plugins/</code> and are, as the name suggests, must-use plugins that are automatically activated by WP and can\'t be deactiavated via the <a href="' . admin_url('plugins.php?plugin_status=mustuse') . '" target="_blank">plugins interface</a>, although if any are used, they are listed in the "Must Use" tab.<br>';
|
2055 |
+
echo 'Drop-ins are pieces of code found in <code>/wp-content/</code> that replace default, built-in WordPress functionality. Most often used are <code>db.php</code> and <code>advanced-cache.php</code> that implement custom DB and cache functionality. They can\'t be deactivated via the <a href="' . admin_url('plugins.php?plugin_status=dropins') . '" target="_blank">plugins interface</a> but if any are present are listed in the "Drop-in" tab.</p>';
|
2056 |
+
|
2057 |
+
if (is_multisite()) {
|
2058 |
+
echo '<p class="mb0 wpmu-error">This tool is <b>not compatible</b> with WP multisite (WPMU). Using it would delete plugins for all sites in the network since they all share the same plugin files.</p>';
|
2059 |
+
} else {
|
2060 |
+
echo $this->get_tool_icons(true, false, true);
|
2061 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Delete must use plugins - <span data-feature="tool-delete-mu-plugins" class="pro-feature"><span class="pro">PRO</span> tool</span></a><a class="button button-delete button-pro-feature" href="#">Delete drop-ins - <span data-feature="tool-delete-dropins" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
2062 |
+
}
|
2063 |
echo '</div>';
|
2064 |
+
echo '</div>'; // delete MU plugins and dropins
|
2065 |
+
|
2066 |
+
$upload_dir = wp_upload_dir(date('Y/m'), true);
|
2067 |
+
$upload_dir['basedir'] = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $upload_dir['basedir']);
|
2068 |
+
|
2069 |
+
echo '<div class="card">';
|
2070 |
+
echo $this->get_card_header(__('Clean uploads Folder', 'wp-reset'), 'tool-delete-uploads', array('iot_button' => true, 'collapse_button' => true));
|
2071 |
+
echo '<div class="card-body">';
|
2072 |
+
echo '<p>' . __('All files in <code>' . $upload_dir['basedir'] . '</code> folder will be deleted. Including folders and subfolders, and files in subfolders. Files associated with <a href="' . admin_url('upload.php') . '">media</a> entries will be deleted too.<br><b>There is NO UNDO. WP Reset does not make any file backups.</b>', 'wp-reset') . '</p>';
|
2073 |
+
echo $this->get_tool_icons(true, false);
|
2074 |
+
if (false != $upload_dir['error']) {
|
2075 |
+
echo '<p class="mb0"><span style="color:#dd3036;"><b>Tool is not available.</b></span> Folder is not writeable by WordPress. Please check file and folder access rights.</p>';
|
2076 |
+
} else {
|
2077 |
+
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete all files & folders in uploads folder?" data-btn-confirm="Delete everything in uploads folder" data-text-wait="Deleting uploads. Please wait." data-text-confirm="All files and folders in uploads will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="%n files & folders have been deleted." data-text-done-singular="One file or folder has been deleted." class="button button-delete" href="#" id="delete-uploads">Delete all files & folders in uploads folder</a></p>';
|
2078 |
+
}
|
2079 |
+
echo '</div>';
|
2080 |
+
echo '</div>'; // clean uploads folder
|
2081 |
+
|
2082 |
+
echo '<div class="card default-collapsed">';
|
2083 |
+
echo $this->get_card_header(__('Clean wp-content Folder', 'wp-reset'), 'tool-delete-wp-content', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
2084 |
+
echo '<div class="card-body">';
|
2085 |
+
echo '<p>All folders and their content in <code>wp-content</code> folder except the following ones will be deleted: <code>mu-plugins</code>, <code>plugins</code>, <code>themes</code>, <code>uploads</code>, <code>wp-reset-autosnapshots</code>, <code>wp-reset-snapshots-export</code>.</p>';
|
2086 |
+
echo $this->get_tool_icons(true, false);
|
2087 |
+
if (false === is_writable(trailingslashit(WP_CONTENT_DIR))) {
|
2088 |
+
echo '<p class="mb0"><span style="color:#dd3036;"><b>Tool is not available.</b></span> Folder is not writeable by WordPress. Please check file and folder access rights.</p>';
|
2089 |
+
} else {
|
2090 |
+
echo '<p class="mb0"><a class="button button-delete button-pro-feature" href="#">Clean wp-content folder - <span data-feature="tool-delete-wp-content" class="pro-feature"><span class="pro">PRO</span> tool</span></a></p>';
|
2091 |
+
}
|
2092 |
+
echo '</div>';
|
2093 |
+
echo '</div>'; // clean wp-content
|
2094 |
|
2095 |
$custom_tables = $this->get_custom_tables();
|
2096 |
|
2097 |
echo '<div class="card">';
|
2098 |
+
echo $this->get_card_header(__('Empty or Delete Custom Tables', 'wp-reset'), 'tool-empty-delete-custom-tables', array('iot_button' => true, 'collapse_button' => true));
|
2099 |
echo '<div class="card-body">';
|
2100 |
echo '<p>' . __('This action affects only custom tables with <code>' . $wpdb->prefix . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
|
2101 |
if ($custom_tables) {
|
2112 |
echo '<p>' . __('There are no custom tables. There\'s nothing for this tool to empty or delete.', 'wp-reset') . '</p>';
|
2113 |
$custom_tables_btns = ' disabled';
|
2114 |
}
|
|
|
2115 |
echo $this->get_tool_icons(false, true, true);
|
|
|
2116 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to empty all custom tables?" data-btn-confirm="Empty custom tables" data-text-wait="Emptying custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be emptied. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before emptying custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been emptied." data-text-done-singular="One custom table has been emptied." class="button button-delete' . $custom_tables_btns . '" href="#" id="truncate-custom-tables">Empty (truncate) custom tables</a>';
|
2117 |
echo '<a data-confirm-title="Are you sure you want to delete all custom tables?" data-btn-confirm="Delete custom tables" data-text-wait="Deleting custom tables. Please wait." data-text-confirm="All custom tables with prefix <code>' . $wpdb->prefix . '</code> will be deleted. Always ' . esc_attr('<a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> if you want to be able to undo') . '." data-text-done="%n custom tables have been deleted." data-text-done-singular="One custom table has been deleted." class="button button-delete' . $custom_tables_btns . '" href="#" id="drop-custom-tables">Delete (drop) custom tables</a>' . $this->get_snapshot_button('drop-custom-tables', 'Before deleting custom tables') . '</p>';
|
2118 |
echo '</div>';
|
2119 |
+
echo '</div>'; // empty custom tables
|
2120 |
+
|
2121 |
+
echo '<div class="card default-collapsed">';
|
2122 |
+
echo $this->get_card_header(__('Switch WP Version', 'wp-reset'), 'tool-switch-wp-version', array('collapse_button' => true, 'iot_button' => true, 'pro' => true));
|
2123 |
+
echo '<div class="card-body">';
|
2124 |
+
if (is_multisite()) {
|
2125 |
+
echo '<p class="mb0 wpmu-error">This tool is <b>not compatible</b> with WP multisite (WPMU). Using it would change the WP version for all sites in the network since they all share the same core files.</p>';
|
2126 |
+
} else {
|
2127 |
+
echo '<p>Replace current WordPress version with the selected new version. Switching from a previous version, to a newer version is mostly supported and properly handled by the WP installer. Reverting WordPress, rolling back WordPress to a previous version is not supported. Results may vary!</p>';
|
2128 |
+
echo $this->get_tool_icons(true, true);
|
2129 |
+
|
2130 |
+
$wp_versions = WP_Reset_Utility::get_wordpress_versions();
|
2131 |
+
echo '<p><label for="select-wp-version">Select the WordPress version to switch to:</label> ';
|
2132 |
+
echo '<select id="select-wp-version">';
|
2133 |
+
echo '<option value="">select WordPress version</option>';
|
2134 |
+
foreach ($wp_versions as $version => $release_date) {
|
2135 |
+
if ($release_date == 'bleeding') {
|
2136 |
+
echo '<option value="bleeding">WordPress v' . $version . ' (Bleeding edge nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
|
2137 |
+
} else if ($release_date == 'point') {
|
2138 |
+
echo '<option value="point-' . substr($version, 0, 3) . '">WordPress v' . $version . ' (Point release nightly)' . ($wp_version == $version ? ' - installed' : '') . '</option>';
|
2139 |
+
} else {
|
2140 |
+
echo '<option value="' . $version . '">WordPress v' . $version . ' (' . date('Y-m-d', $release_date) . ')' . ($wp_version == $version ? ' - installed' : '') . '</option>';
|
2141 |
+
}
|
2142 |
+
}
|
2143 |
+
echo '</select></p>';
|
2144 |
+
|
2145 |
+
echo '<p class="mb0">';
|
2146 |
+
echo '<a class="button button-delete button-pro-feature" href="#">Switch WordPress version - <span data-feature="tool-switch-wp-version" class="pro-feature"><span class="pro">PRO</span> tool</span></a>';
|
2147 |
+
echo '</p>';
|
2148 |
+
}
|
2149 |
echo '</div>';
|
2150 |
+
echo '</div>'; // switch WP version
|
2151 |
|
2152 |
echo '<div class="card">';
|
2153 |
+
echo $this->get_card_header(__('Delete .htaccess File', 'wp-reset'), 'tool-delete-htaccess', array('iot_button' => true, 'collapse_button' => true));
|
2154 |
echo '<div class="card-body">';
|
2155 |
echo '<p>' . __('This action deletes the .htaccess file located in <code>' . $this->get_htaccess_path() . '</code><br><b>There is NO UNDO. WP Reset does not make any file backups.</b></p>', 'wp-reset');
|
2156 |
|
2157 |
echo '<p>If you need to edit .htaccess, install our free <a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=wp-htaccess-editor&TB_iframe=true&width=600&height=550') . '" class="thickbox open-plugin-details-modal">WP Htaccess Editor</a> plugin. It automatically creates backups when you edit .htaccess as well as checks for syntax errors. To create the default .htaccess file open <a href="' . admin_url('options-permalink.php') . '">Settings - Permalinks</a> and re-save settings. WordPress will recreate the file.</p>';
|
|
|
2158 |
echo $this->get_tool_icons(true, false);
|
|
|
2159 |
echo '<p class="mb0"><a data-confirm-title="Are you sure you want to delete the .htaccess file?" data-btn-confirm="Delete .htaccess file" data-text-wait="Deleting .htaccess file. Please wait." data-text-confirm="Htaccess file will be deleted. There is NO UNDO. WP Reset does not make any file backups." data-text-done="Htaccess file has been deleted." data-text-done-singular="Htaccess file has been deleted." class="button button-delete" href="#" id="delete-htaccess">Delete .htaccess file</a></p>';
|
2160 |
|
2161 |
echo '</div>';
|
2162 |
+
echo '</div>'; // delete htaccess
|
2163 |
} // tab_tools
|
2164 |
|
2165 |
|
2171 |
private function tab_collections()
|
2172 |
{
|
2173 |
echo '<div class="card">';
|
2174 |
+
echo $this->get_card_header('What are Plugin & Theme Collections?', 'collections-info', array('collapse_button' => false));
|
2175 |
+
echo '<div class="card-body">';
|
2176 |
+
echo '<p>' . __('Have a set of plugins (and themes) that you install and activate after every reset? Or on every fresh WordPress installation? Well, no more clicking install & active for ten minutes! Build the collection once and install it with one click as many times as needed.</p><p>WP Reset stores collections in the cloud so they\'re accessible on every site you build. You can use free plugins and themes from the official repo, and PRO ones by uploading a ZIP file. We\'ll safely store your license keys too, so you have everything in one place.', 'wp-reset') . '</p>';
|
2177 |
+
echo '<p><a class="button button-secondary button-pro-feature" href="#">Add a new collection - <span data-feature="collections" class="pro-feature"><span class="pro">PRO</span> feature</span></a> <a class="button button-secondary button-pro-feature" href="#">Reload my saved collections from the cloud - <span data-feature="collections" class="pro-feature"><span class="pro">PRO</span> feature</span></a></p>';
|
2178 |
echo '</div>';
|
2179 |
+
echo '</div>'; // collections-info
|
2180 |
+
|
2181 |
+
$plugins = array();
|
2182 |
+
$plugins['eps-301-redirects'] = array('name' => '301 Redirects', 'desc' => 'Easiest way to manage redirects');
|
2183 |
+
$plugins['classic-editor'] = array('name' => 'Classic Editor', 'desc' => 'Any easy fix for all your Gutenberg caused troubles');
|
2184 |
+
$plugins['simple-author-box'] = array('name' => 'Simple Author Box', 'desc' => 'Simplest way to add responsive, great looking author boxes');
|
2185 |
+
$plugins['sticky-menu-or-anything-on-scroll'] = array('name' => 'Sticky Menu (or Anything!) on Scroll', 'desc' => 'Make any element on the page sticky.');
|
2186 |
+
$plugins['under-construction-page'] = array('name' => 'UnderConstructionPage', 'desc' => 'Working on your site? Put it in the under construction mode.');
|
2187 |
+
$plugins['wp-external-links'] = array('name' => 'WP External Links', 'desc' => 'Manage all external & internal links. Control icons, nofollow, noopener, UGC, sponsored and if links open in new window or new tab.');
|
2188 |
+
|
2189 |
+
echo '<div class="card" data-collection-id="1">';
|
2190 |
+
echo $this->get_card_header('Must-have WordPress Plugins', 'collection-id-1', array('collapse_button' => false));
|
2191 |
+
echo '<div class="card-body"><div class="thirdx2"><p class="_mb0"></p><div class="dropdown dropdown-right">
|
2192 |
+
<a class="button dropdown-toggle" href="#">Install collection</a>
|
2193 |
+
<div class="dropdown-menu">
|
2194 |
+
<a class="dropdown-item install-collection" data-activate="true" href="#">Install & activate collection</a>
|
2195 |
+
<a class="dropdown-item install-collection" href="#">Install collection</a>
|
2196 |
+
<a data-feature="collections" class="dropdown-item button-pro-feature" href="#">Delete installed plugins & themes then install & activate collection - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>
|
2197 |
+
<a data-feature="collections" class="dropdown-item button-pro-feature" href="#">Delete installed plugins & themes then install collection - <span class="pro-feature" data-feature="cloud-wpr"><span class="pro">PRO</span> Feature</span></a>
|
2198 |
+
</div>
|
2199 |
+
</div><a class="button add-collection-item button-pro-feature" href="#">Add new plugin or theme - <span data-feature="collections" class="pro-feature"><span class="pro">PRO</span> feature</span></a></div><div class="third textright"><p class="_mb0"></p><div class="dropdown">
|
2200 |
+
<a class="button dropdown-toggle" href="#">Actions</a>
|
2201 |
+
<div class="dropdown-menu">
|
2202 |
+
<a class="dropdown-item button-pro-feature" href="#">Add new collection - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2203 |
+
<a class="dropdown-item button-pro-feature" href="#">Rename collection - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2204 |
+
<a class="dropdown-item button-delete button-pro-feature" href="#">Delete collection - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2205 |
+
</div>
|
2206 |
+
</div><p></p></div><table class="collection-table"><tbody><tr><th>Type</th><th>Name & 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>
|
2212 |
+
<a href="#" class="dropdown-item install-collection-item button-pro-feature">Install & Activate - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2213 |
+
<a href="#" class="dropdown-item edit-collection-item button-pro-feature">Edit - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2214 |
+
<a href="#" class="dropdown-item button-delete button-link-delete delete-collection-item button-pro-feature">Delete - <span class="pro-feature" data-feature="collections"><span class="pro">PRO</span> Feature</span></a>
|
2215 |
+
</div>
|
2216 |
+
</div></td></tr>';
|
2217 |
+
} // foreach plugin
|
2218 |
+
echo '</tbody></table></div></div>';
|
2219 |
} // tab_collections
|
2220 |
|
2221 |
|
2227 |
private function tab_support()
|
2228 |
{
|
2229 |
echo '<div class="card">';
|
2230 |
+
echo $this->get_card_header(__('Documentation', 'wp-reset'), 'support-documentation', array('collapse_button' => false));
|
2231 |
+
echo '<div class="card-body">';
|
2232 |
+
echo '<p class="mb0">' . __('All tools and features are explained in detail in <a href="' . $this->generate_web_link('support-tab', '/documentation/') . '" target="_blank">the documentation</a>. We did our best to describe how things work on both the code level and an "average user" level.', 'wp-reset') . '</p>';
|
2233 |
echo '</div>';
|
2234 |
+
echo '</div>'; // documentation
|
2235 |
|
2236 |
echo '<div class="card">';
|
2237 |
+
echo $this->get_card_header('Emergency Recovery Script', 'support-ers', array('collapse_button' => false, 'pro' => true));
|
2238 |
+
echo '<div class="card-body">';
|
2239 |
+
echo '<p>Emergency Recovery Script is a standalone, single-file, WordPress independent PHP script created to <b>recover WordPress sites from the most difficult situations</b>. When access to the admin is not possible when core files are compromised (accidental delete or malware related situations), when you get the white screen of death, can\'t log in for whatever reason or a plugin has killed your site - emergency recovery script can fix the problem! Some of the things ERS can do;</p>';
|
2240 |
+
echo '<ul class="plain-list">';
|
2241 |
+
echo '<li>Test the integrity of all WP core files and reinstall them if needed</li>';
|
2242 |
+
echo '<li>Detect and remove all files in core folders that are not a part of WP</li>';
|
2243 |
+
echo '<li>Deactivate and activate plugins without logging in to WP admin</li>';
|
2244 |
+
echo '<li>Deactivate and activate themes without logging in to WP admin</li>';
|
2245 |
+
echo '<li>Reset user privileges and roles</li>';
|
2246 |
+
echo '<li>Create new WP admin accounts without logging in to WP admin or knowing the admin username/password</li>';
|
2247 |
+
echo '<li>Modify WordPress address and site address</li>';
|
2248 |
+
echo '</ul>';
|
2249 |
+
echo '<p class="mb0">You can install the script as a preventive measure, so it\'s always available in case of an emergency (don\'t worry, it\'s password protected), or upload it only when needed. On production sites, when big and potentially dangerous changes rarely happen, we suggest uploading it only when needed. On test sites, have it ready in advance because there\'s a higher probability that you\'ll need it. Emergency Recovery Script is a <span class="pro-feature pro-feature-text" data-feature="support-ers">WP Reset <span>PRO</span></span> tool.</p>';
|
2250 |
+
echo '</div>';
|
2251 |
+
echo '</div>'; // emergency recovery script
|
2252 |
+
|
2253 |
+
echo '<div class="card">';
|
2254 |
+
echo $this->get_card_header(__('Public Support Forum', 'wp-reset'), 'support-forum', array('collapse_button' => false));
|
2255 |
+
echo '<div class="card-body">';
|
2256 |
echo '<p>' . __('We are very active on the <a href="https://wordpress.org/support/plugin/wp-reset" target="_blank">official WP Reset support forum</a>. If you found a bug, have a feature idea or just want to say hi - please drop by. We love to hear back from our users.', 'wp-reset') . '</p>';
|
2257 |
echo '</div>';
|
2258 |
+
echo '</div>'; // forum
|
2259 |
+
|
2260 |
+
echo '<div class="card">';
|
2261 |
+
echo $this->get_card_header(__('Premium Email Support', 'wp-reset'), 'support-email', array('collapse_button' => false, 'pro' => true));
|
2262 |
+
echo '<div class="card-body">';
|
2263 |
+
echo '<p class="mb0">Need urgent support? Have one of our devs personally help you with your issue. All PRO license holders have access to premium email support. Get <span class="pro-feature pro-feature-text" data-feature="support-email">WP Reset <span>PRO</span></span> now.</p>';
|
2264 |
+
echo '</div>';
|
2265 |
+
echo '</div>'; // email support
|
2266 |
|
2267 |
echo '<div class="card">';
|
2268 |
+
echo $this->get_card_header(__('Care to Help Out?', 'wp-reset'), 'support-help-out', array('collapse_button' => false));
|
2269 |
+
echo '<div class="card-body">';
|
2270 |
+
echo '<p class="mb0">' . __('No need for donations :) If you can give us a <a href="https://wordpress.org/support/plugin/wp-reset/reviews/#new-post" target="_blank">five star rating</a> you\'ll help out more than you can imagine. A public mention <a href="https://twitter.com/webfactoryltd" target="_blank">@webfactoryltd</a> also does wonders. Thank you!', 'wp-reset') . '</p>';
|
2271 |
echo '</div>';
|
2272 |
+
echo '</div>'; // help out
|
2273 |
} // tab_support
|
2274 |
|
2275 |
|
2276 |
+
/**
|
2277 |
+
* Echoes content for pro tab
|
2278 |
+
*
|
2279 |
+
* @return null
|
2280 |
+
*/
|
2281 |
+
private function tab_pro()
|
2282 |
+
{
|
2283 |
+
echo '<div class="card">';
|
2284 |
+
echo $this->get_card_header(__('WP Reset PRO', 'wp-reset'), 'pro-features', array('collapse_button' => false));
|
2285 |
+
echo '<div class="card-body">';
|
2286 |
+
echo '<p>More ways to reset your site, more tools, automatic snapshots, collections, email support and the emergency recover script - that\'s WP Reset PRO in a nutshell. The same <b>quality and easy-of-use</b> you experienced in the free version is very much a part of the PRO one, but extended and upgraded with more tools that will save you even more time.</p>';
|
2287 |
+
echo '<p>WP Reset PRO is aimed towards <b>webmasters, agencies, and everyone who buildsa a lot of WordPress sites</b>. It\'s much, much more than a "reset" tool. It\'s an easy way to start a new site, to test changes and to get out of the thickest jams. And thanks to its cloud features and the Dashboard it\'ll give you access to collections and snapshots on all the sites you\'re working on - instantly, without dragging any files along.</p>';
|
2288 |
+
echo '<p>Give WP Reset PRO a go. <b>It\'ll pay itself out in hours saved within the first few days!</b></p>';
|
2289 |
+
echo '<p>If you already have a PRO license - <a href="#pro-activate" class="scrollto">activate it</a>.</p>';
|
2290 |
+
echo '</div>';
|
2291 |
+
echo '</div>';
|
2292 |
+
|
2293 |
+
echo '<div class="card">';
|
2294 |
+
echo $this->get_card_header(__('Pricing', 'wp-reset'), 'pro-pricing', array('collapse_button' => false));
|
2295 |
+
echo '<div class="card-body">';
|
2296 |
+
|
2297 |
+
echo '<table id="pricing-table" class="mb0">';
|
2298 |
+
echo '<tr>';
|
2299 |
+
echo '<th> </th>';
|
2300 |
+
echo '<th nowrap>WP Reset <span>PRO</span><br><b>Agency</b></th>';
|
2301 |
+
echo '<th nowrap>WP Reset <span>PRO</span><br><b>Team</b></th>';
|
2302 |
+
echo '<th nowrap>WP Reset <span>PRO</span><br><b>Personal</b></th>';
|
2303 |
+
echo '<th nowrap>WP Reset<br>Free</th>';
|
2304 |
+
echo '</tr>';
|
2305 |
+
|
2306 |
+
$rows = array();
|
2307 |
+
$rows['Options & Nuclear Reset'] = array(false, true, true, true);
|
2308 |
+
$rows['Site Reset'] = array(true, true, true, true);
|
2309 |
+
$rows['9 Basic Reset Tools'] = array(true, true, true, true);
|
2310 |
+
$rows['17+ PRO Reset Tools'] = array(false, true, true, true);
|
2311 |
+
$rows['Granular Content Reset Tools'] = array(false, true, true, true);
|
2312 |
+
$rows['User Snapshots'] = array(true, true, true, true);
|
2313 |
+
$rows['Automatic Snapshots'] = array(false, true, true, true);
|
2314 |
+
$rows['Offload Snapshots to WP Reset Cloud, 2GB storage per site'] = array(false, true, true, true);
|
2315 |
+
$rows['Offload Snapshots to Dropbox, Google Drive & pCloud'] = array(false, true, true, true);
|
2316 |
+
$rows['Plugins & Themes Collections'] = array(false, true, true, true);
|
2317 |
+
$rows['Emergency Recovery Script'] = array(false, true, true, true);
|
2318 |
+
$rows['Email Support'] = array(false, true, true, true);
|
2319 |
+
$rows['WP Reset Dashboard'] = array(false, true, true, true);
|
2320 |
+
$rows['License Manager'] = array(false, false, true, true);
|
2321 |
+
$rows['White-Label'] = array(false, false, false, true);
|
2322 |
+
$rows['Manage Snapshots for all sites in Dashboard'] = array(false, true, true, true);
|
2323 |
+
$rows['Manage Collections for all sites in Dashboard'] = array(false, true, true, true);
|
2324 |
+
$rows['Number of sites included in the license (localhosts are not counted & you can change sites)'] = array('∞', 1, 5, 100);
|
2325 |
+
$rows['Number of WP Reset Cloud site licenses with 2GB storage per site (localhosts are not counted & you can change sites)'] = array(0, 1, 5, 20);
|
2326 |
+
|
2327 |
+
foreach ($rows as $feature => $details) {
|
2328 |
+
echo '<tr>';
|
2329 |
+
echo '<td>' . $feature . '</td>';
|
2330 |
+
$details = array_reverse($details);
|
2331 |
+
foreach ($details as $tmp) {
|
2332 |
+
echo '<td>';
|
2333 |
+
if ($tmp === true) {
|
2334 |
+
echo '<i class="dashicons dashicons-yes green" title="Feature is available"></i>';
|
2335 |
+
} elseif ($tmp === false) {
|
2336 |
+
echo '<i class="dashicons dashicons-no red" title="Feature is not available"></i>';
|
2337 |
+
} else {
|
2338 |
+
echo $tmp;
|
2339 |
+
}
|
2340 |
+
echo '</td>';
|
2341 |
+
} // foreach column
|
2342 |
+
echo '</tr>';
|
2343 |
+
} // foreach $rows
|
2344 |
+
|
2345 |
+
$agency = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-agency-launch'));
|
2346 |
+
$team = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-team-launch'));
|
2347 |
+
$team_lifetime = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-team-lifetime-launch'));
|
2348 |
+
$personal = $this->generate_web_link('pricing-table', '/buy/', array('p' => 'wp-reset-pro-personal-launch'));
|
2349 |
+
echo '<tr class="pricing"><td>Yearly Price</td>';
|
2350 |
+
echo '<td><del> $299/y </del><br><b>50% OFF</b><br>$149 <small>/y</small><br><a href="' . $agency . '" class="button" target="_blank">BUY NOW</a></td>';
|
2351 |
+
echo '<td><del> $158/y </del><br><b>50% OFF</b><br>$79 <small>/y</small><br><a href="' . $team . '" class="button" target="_blank">BUY NOW</a></td>';
|
2352 |
+
echo '<td><del> $79 <small>/y</small> </del><br><b>50% OFF</b><br>$39 <small>/y</small><br><a href="' . $personal . '" class="button" target="_blank">BUY NOW</a></td>';
|
2353 |
+
echo '<td>free</td>';
|
2354 |
+
echo '</tr>';
|
2355 |
+
echo '<tr class="pricing"><td>Lifetime Price</td>';
|
2356 |
+
echo '<td><i>n/a</i></td>';
|
2357 |
+
echo '<td><del> $319 </del><br><b>one-time payment<br>50% OFF</b><br>$159<br><a href="' . $team_lifetime . '" class="button button-primary" target="_blank">BUY NOW</a></td>';
|
2358 |
+
echo '<td><i>n/a</i></td>';
|
2359 |
+
echo '<td>free</td>';
|
2360 |
+
echo '</tr>';
|
2361 |
+
echo '</table>';
|
2362 |
+
|
2363 |
+
echo '</div>';
|
2364 |
+
echo '</div>';
|
2365 |
+
|
2366 |
+
echo '<div class="card">';
|
2367 |
+
echo $this->get_card_header(__('Activate PRO License', 'wp-reset'), 'pro-activate', array('collapse_button' => false));
|
2368 |
+
echo '<div class="card-body">';
|
2369 |
+
|
2370 |
+
echo '<p>License key is visible on the confirmation screen, right after purchasing. You can also find it in the confirmation email sent to the email address provided on purchase. Or use keys created with the <a href="https://dashboard.wpreset.com/licenses/" target="_blank">license manager</a>.</p>
|
2371 |
+
<p>If you don\'t have a license - <a class="scrollto" href="#pro-pricing">purchase one now</a>. In case of problems with the license please <a href="' . $this->generate_web_link('pro-tab-license', '/contact/') . '" target="_blank">contact support</a>.</p>';
|
2372 |
+
|
2373 |
+
echo '<hr>';
|
2374 |
+
echo '<p><label for="wpr-license-key">License Key: </label><input class="regular-text" type="text" id="wpr-license-key" value="' . ($this->license->get_license('license_key') != 'keyless' ? esc_attr($this->license->get_license('license_key')) : '') . '" placeholder="12345678-12345678-12345678-12345678">';
|
2375 |
+
|
2376 |
+
echo '<br><label>Status: </label>';
|
2377 |
+
if ($this->license->is_active()) {
|
2378 |
+
$license_formatted = $this->license->get_license_formatted();
|
2379 |
+
echo '<b style="color: #66b317;">Active</b><br>
|
2380 |
+
<label>Type: </label>' . $license_formatted['name_long'];
|
2381 |
+
echo '<br><label>Valid: </label>' . $license_formatted['valid_until'];
|
2382 |
+
|
2383 |
+
$plugin = plugin_basename(__FILE__);
|
2384 |
+
$update_url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin)), 'upgrade-plugin_' . $plugin);
|
2385 |
+
echo '<p class="center">Thank you for purchasing WP Reset PRO! <b>Your license has been verified and activated.</b> ';
|
2386 |
+
echo 'Please <b>click the button below</b> to update plugin files to the PRO version.</p>';
|
2387 |
+
echo '<p><a href="' . esc_url($update_url) . '" class="button button-primary"><b>Update WP Reset files to PRO & finish the activation</b></a></p>';
|
2388 |
+
} else { // not active
|
2389 |
+
echo '<strong style="color: #ea1919;">Inactive</strong>';
|
2390 |
+
if (!empty($this->license->get_license('error'))) {
|
2391 |
+
echo '<br><label>Error: </label>' . $this->license->get_license('error');
|
2392 |
+
}
|
2393 |
+
}
|
2394 |
+
echo '</p>';
|
2395 |
+
|
2396 |
+
echo '<p>';
|
2397 |
+
if ($this->license->is_active()) {
|
2398 |
+
echo '<a href="#" id="wpr-save-license" data-text-wait="Validating. Please wait." class="button button-secondary">Save & Revalidate License</a>';
|
2399 |
+
echo ' <a href="#" id="wpr-deactivate-license" data-text-wait="Deactivating. Please wait." class="button button-delete">Deactivate License</a>';
|
2400 |
+
} else {
|
2401 |
+
echo '<a href="#" id="wpr-save-license" data-text-wait="Activating. Please wait." class="button button-primary">Save & Activate License</a>';
|
2402 |
+
echo ' <a href="#" data-text-wait="Activating. Please wait." class="button button-secondary" id="wpr-keyless-activation">Keyless Activation</a>';
|
2403 |
+
}
|
2404 |
+
echo '</p>';
|
2405 |
+
echo '<p class="mb0"><i>By attempting to activate a license you agree to share the following data with <a target="_blank" href="https://www.webfactoryltd.com/">WebFactory Ltd</a>: license key, site URL, site title, site WP version, and WP Reset (free) version.</i>';
|
2406 |
+
echo '</p>';
|
2407 |
+
|
2408 |
+
echo '</div>';
|
2409 |
+
echo '</div>'; // activate PRO
|
2410 |
+
|
2411 |
+
// todo: not done
|
2412 |
+
echo '<div style="display: none;">';
|
2413 |
+
|
2414 |
+
echo '<div id="pro-feature-details-tool-nuclear-reset-example">';
|
2415 |
+
echo '<span class="title">this is a title</span>';
|
2416 |
+
echo '<span class="description">this is a description</span>';
|
2417 |
+
echo '<span class="button">button</span>';
|
2418 |
+
echo '<span class="footer">footer</span>';
|
2419 |
+
echo '</div>';
|
2420 |
+
|
2421 |
+
echo '</div>';
|
2422 |
+
} // tab_pro
|
2423 |
+
|
2424 |
+
|
2425 |
/**
|
2426 |
* Echoes content for snapshots tab
|
2427 |
*
|
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>';
|
2442 |
+
|
2443 |
+
echo '<p>Snapshots are primarily a development tool. When using various reset tools we advise using our 1-click snapshot tool available in every tool\'s confirmation dialog. If a full backup that includes files is needed, use one of the <a href="' . admin_url('plugin-install.php?s=backup&tab=search&type=term') . '" target="_blank">backup plugins</a> from the repo.</p>';
|
2444 |
+
|
2445 |
echo '<p>Use snapshots to find out what changes a plugin made to your database or to quickly restore the dev environment after testing database related changes. Restoring a snapshot does not affect other snapshots, or WP Reset settings.</p>';
|
2446 |
|
2447 |
+
echo '<p>To automatically generate snapshots on plugin, theme, and core update, activate, deactivate and similar events enable automatic snapshots available in <span class="pro-feature pro-feature-text" data-feature="snapshots-auto">WP Reset <span>PRO</span></span>.</p>';
|
2448 |
+
|
2449 |
+
$tables = $wpdb->get_results('SHOW TABLES', ARRAY_N);
|
2450 |
+
if (is_array($tables)) {
|
2451 |
+
foreach ($tables as $table) {
|
2452 |
+
if (0 !== stripos($table[0], $wpdb->prefix)) {
|
|
|
2453 |
continue;
|
2454 |
}
|
2455 |
|
2456 |
+
if (in_array($table[0], $this->core_tables)) {
|
|
|
|
|
2457 |
$tbl_core++;
|
2458 |
} else {
|
2459 |
$tbl_custom++;
|
2460 |
}
|
2461 |
} // foreach
|
2462 |
|
2463 |
+
echo '<p class="mb0"><b>Currently used WordPress tables</b>, prefixed with <i>' . $wpdb->prefix . '</i>, consist of ' . $tbl_core . ' standard and ';
|
2464 |
if ($tbl_custom) {
|
2465 |
echo $tbl_custom . ' custom table' . ($tbl_custom == 1 ? '' : 's');
|
2466 |
} else {
|
2467 |
echo 'no custom tables';
|
2468 |
}
|
2469 |
+
echo ' <span id="wpr-table-details"><a href="#" id="show-table-details">(show details)</a></span>';
|
2470 |
+
} else {
|
2471 |
+
echo '<b>Tables information is not available.</b> Something is not working properly on your site. Snapshots won\'t work.';
|
2472 |
}
|
2473 |
|
|
|
2474 |
echo '</div>';
|
2475 |
echo '</div>';
|
2476 |
|
2477 |
echo '<div class="card">';
|
2478 |
+
echo $this->get_card_header('User Created Snapshots', 'snapshots-user', array('collapse_button' => 1, 'create_snapshot' => true, 'snapshot_actions' => true));
|
2479 |
+
echo '<div class="card-body">';
|
|
|
|
|
|
|
2480 |
if ($snapshots = $this->get_snapshots()) {
|
2481 |
$snapshots = array_reverse($snapshots);
|
2482 |
echo '<table id="wpr-snapshots">';
|
2483 |
+
echo '<tr><th>Date</th><th>Description</th><th class="ss-size">Size</th><th class="ss-actions"> </th></tr>';
|
2484 |
foreach ($snapshots as $ss) {
|
2485 |
echo '<tr id="wpr-ss-' . $ss['uid'] . '">';
|
2486 |
if (!empty($ss['name'])) {
|
2496 |
echo human_time_diff(strtotime($ss['timestamp']), current_time('timestamp')) . ' ago';
|
2497 |
}
|
2498 |
echo '</td>';
|
|
|
2499 |
|
2500 |
echo '<td>';
|
2501 |
if (!empty($ss['name'])) {
|
2507 |
} else {
|
2508 |
echo 'no custom tables';
|
2509 |
}
|
2510 |
+
echo ' totaling ' . number_format($ss['tbl_rows']) . ' rows</td>';
|
2511 |
+
echo '<td class="ss-size">' . WP_Reset_Utility::format_size($ss['tbl_size']) . '</td>';
|
2512 |
echo '<td>';
|
2513 |
echo '<div class="dropdown">
|
2514 |
<a class="button dropdown-toggle" href="#">Actions</a>
|
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
|
2525 |
echo '</table>';
|
2526 |
+
echo '<p id="ss-no-snapshots" class="mb0 textcenter hidden">There are no user created snapshots. <a href="#" class="create-new-snapshot">Create a new snapshot.</a></p>';
|
2527 |
} else {
|
2528 |
+
echo '<p id="ss-no-snapshots" class="mb0 textcenter">There are no user created snapshots. <a href="#" class="create-new-snapshot">Create a new snapshot.</a></p>';
|
2529 |
}
|
2530 |
+
echo '</div>';
|
2531 |
+
echo '</div>';
|
2532 |
|
2533 |
+
echo '<div class="card">';
|
2534 |
+
echo $this->get_card_header('Automatic Snapshots', 'snapshots-auto', array('collapse_button' => false, 'pro' => true));
|
2535 |
+
echo '<div class="card-body">';
|
2536 |
+
echo '<p><span class="pro-feature pro-feature-text" data-feature="snapshots-auto">WP Reset <span>PRO</span></span> creates automatic snapshots before significant events occur on your site that can cause it to stop working correctly. Plugin, theme and core updates, plugin and theme activations and deactivations all of those can happen in the background without your knowledge. With automatic snapshots, you can roll back any update with a single click. Snapshots can be uploaded to the WP Reset Cloud, Dropbox, Google Drive or pCloud, giving you an extra layer of security.<br>
|
2537 |
+
Upgrade to <span class="pro-feature pro-feature-text" data-feature="snapshots-auto">WP Reset <span>PRO</span></span> to enable automatic snapshots and give your site an extra layer of safety.</p>';
|
2538 |
+
echo '</div>';
|
2539 |
echo '</div>';
|
2540 |
} // tab_snapshots
|
2541 |
|
2616 |
} // get_custom tables
|
2617 |
|
2618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2619 |
/**
|
2620 |
* Creates snapshot of current tables by copying them in the DB and saving metadata.
|
2621 |
*
|
2949 |
$out .= '</tr>';
|
2950 |
$out .= '<tr class="hidden">';
|
2951 |
$out .= '<td>';
|
2952 |
+
$out .= '<p>' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' . WP_Reset_Utility::format_size($table['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($table['size_index']) . ' in index.</p>';
|
2953 |
$out .= '<pre>' . $table['schema'] . '</pre>';
|
2954 |
$out .= '</td>';
|
2955 |
$out .= '<td> </td>';
|
2968 |
$out .= '<tr class="hidden">';
|
2969 |
$out .= '<td> </td>';
|
2970 |
$out .= '<td>';
|
2971 |
+
$out .= '<p>' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' . WP_Reset_Utility::format_size($table['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($table['size_index']) . ' in index.</p>';
|
2972 |
$out .= '<pre>' . $table['schema'] . '</pre>';
|
2973 |
$out .= '</td>';
|
2974 |
$out .= '</tr>';
|
2994 |
$out3 .= '</tr>';
|
2995 |
$out3 .= '<tr class="hidden">';
|
2996 |
$out3 .= '<td>';
|
2997 |
+
$out3 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index.</p>';
|
2998 |
$out3 .= '<pre>' . $tbl_current['schema'] . '</pre>';
|
2999 |
$out3 .= '</td>';
|
3000 |
$out3 .= '<td>';
|
3001 |
+
$out3 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index.</p>';
|
3002 |
$out3 .= '<pre>' . $tbl_snapshot['schema'] . '</pre>';
|
3003 |
$out3 .= '</td>';
|
3004 |
$out3 .= '</tr>';
|
3018 |
$out2 .= '</tr>';
|
3019 |
$out2 .= '<tr class="hidden">';
|
3020 |
$out2 .= '<td>';
|
3021 |
+
$out2 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index.</p>';
|
3022 |
$out2 .= '</td>';
|
3023 |
$out2 .= '<td>';
|
3024 |
+
$out2 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index.</p>';
|
3025 |
$out2 .= '</td>';
|
3026 |
$out2 .= '</tr>';
|
3027 |
$out2 .= '<tr class="hidden">';
|
3040 |
$out2 .= '</tr>';
|
3041 |
$out2 .= '<tr class="hidden">';
|
3042 |
$out2 .= '<td>';
|
3043 |
+
$out2 .= '<p>' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index.</p>';
|
3044 |
$out2 .= '</td>';
|
3045 |
$out2 .= '<td>';
|
3046 |
+
$out2 .= '<p>' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index.</p>';
|
3047 |
$out2 .= '</td>';
|
3048 |
$out2 .= '</tr>';
|
3049 |
|
3169 |
}
|
3170 |
}
|
3171 |
|
3172 |
+
if (!empty($res->plugins) && is_array($res->plugins) && $plugin_info && is_object($plugin_info)) {
|
3173 |
array_unshift($res->plugins, $plugin_info);
|
3174 |
}
|
3175 |
|
3186 |
{
|
3187 |
remove_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
|
3188 |
|
3189 |
+
$res = $this->add_plugin_featured('sticky-menu-or-anything-on-scroll', $res);
|
3190 |
$res = $this->add_plugin_featured('under-construction-page', $res);
|
|
|
3191 |
$res = $this->add_plugin_featured('eps-301-redirects', $res);
|
3192 |
+
$res = $this->add_plugin_featured('simple-author-box', $res);
|
3193 |
|
3194 |
return $res;
|
3195 |
} // plugins_api_result
|