Version Description
(2021-12-04) =
* [Added]
Converting images using remote server
* [Added]
Converting images to AVIF format
* [Added]
Error detection for invalid permalinks structure
See changelog.txt for previous versions.
=
Download this release
Release Info
Developer | mateuszgbiorczyk |
Plugin | Converter for Media – Optimize images | Convert WebP & AVIF |
Version | 4.0.0 |
Comparing to | |
See all releases |
Code changes from version 3.2.4 to 4.0.0
- assets/build/css/styles.css +1 -1
- assets/build/js/scripts.js +1 -1
- changelog.txt +5 -0
- readme.txt +37 -25
- src/Action/ConvertPaths.php +1 -1
- src/Conversion/Endpoint/ImagesCounterEndpoint.php +39 -0
- src/Conversion/Endpoint/PathsEndpoint.php +9 -3
- src/Conversion/Endpoint/RegenerateEndpoint.php +14 -5
- src/Conversion/Format/AvifFormat.php +25 -3
- src/Conversion/Method/GdMethod.php +1 -1
- src/Conversion/Method/ImagickMethod.php +1 -1
- src/Conversion/Method/LibraryMethodAbstract.php +16 -21
- src/Conversion/Method/MethodAbstract.php +13 -10
- src/Conversion/Method/MethodFactory.php +28 -6
- src/Conversion/Method/MethodIntegrator.php +4 -3
- src/Conversion/Method/MethodInterface.php +9 -3
- src/Conversion/Method/RemoteMethod.php +365 -0
- src/Conversion/OutputPath.php +2 -2
- src/Conversion/SkipLarger.php +16 -31
- src/Error/Detector/LibsNotInstalledDetector.php +17 -0
- src/Error/Detector/LibsWithoutWebpSupportDetector.php +17 -0
- src/Error/Detector/PassthruExecutionDetector.php +6 -0
- src/Error/Detector/PermalinksStructureDetector.php +22 -0
- src/Error/Detector/RewritesErrorsDetector.php +4 -2
- src/Error/Detector/SettingsIncorrectDetector.php +15 -12
- src/Error/Detector/TokenStatusDetector.php +69 -0
- src/Error/Detector/WebpFormatActivatedDetector.php +35 -0
- src/Error/ErrorDetectorAggregator.php +18 -3
- src/Error/Notice/AccessTokenInvalidNotice.php +27 -0
- src/Error/Notice/ApiLimitExceededNotice.php +27 -0
- src/Error/Notice/LibsNotInstalledNotice.php +1 -0
- src/Error/Notice/LibsWithoutWebpSupportNotice.php +1 -1
- src/Error/Notice/PermalinksStructureInvalidNotice.php +27 -0
- src/Error/Notice/WebpRequiredNotice.php +27 -0
- src/{Conversion/Exception → Exception}/ConversionErrorException.php +2 -2
- src/{Conversion/Exception → Exception}/ExceptionAbstract.php +2 -2
- src/{Conversion/Exception → Exception}/ExceptionInterface.php +3 -3
- src/{Conversion/Exception → Exception}/ExtensionUnsupportedException.php +2 -2
- src/Exception/FilesizeOversizeException.php +30 -0
- src/{Conversion/Exception → Exception}/FunctionUnavailableException.php +2 -2
- src/{Conversion/Exception → Exception}/ImageInvalidException.php +2 -2
- src/{Conversion/Exception → Exception}/ImagickNotSupportWebpException.php +2 -2
- src/{Conversion/Exception → Exception}/ImagickUnavailableException.php +2 -2
- src/{Conversion/Exception → Exception}/LargerThanOriginalException.php +8 -4
- src/{Conversion/Exception → Exception}/OutputPathException.php +2 -2
- src/Exception/RemoteErrorResponseException.php +26 -0
- src/Exception/RemoteRequestException.php +26 -0
- src/{Conversion/Exception → Exception}/ResolutionOversizeException.php +2 -2
- src/{Conversion/Exception → Exception}/ServerConfigurationException.php +2 -2
- src/{Conversion/Exception → Exception}/SourcePathException.php +2 -2
- src/Loader/HtaccessLoader.php +3 -1
- src/Model/Token.php +80 -0
- src/Plugin/Uninstall/PluginSettings.php +2 -0
- src/Repository/TokenRepository.php +56 -0
- src/Service/TokenValidator.php +83 -0
- src/Settings/Option/AccessTokenOption.php +90 -0
- src/Settings/Option/ConversionMethodOption.php +13 -3
- src/Settings/Option/ExtraFeaturesOption.php +6 -6
- src/Settings/Option/ImagesQualityOption.php +1 -1
- src/Settings/Option/LoaderTypeOption.php +1 -1
- src/Settings/Option/OptionAbstract.php +1 -0
- src/Settings/Option/OptionIntegration.php +1 -0
- src/Settings/Option/OptionsAggregator.php +1 -0
- src/Settings/Option/OutputFormatsOption.php +18 -1
- src/Settings/Page/SettingsPage.php +24 -11
- src/Settings/SettingsSave.php +44 -8
- src/WebpConverter.php +1 -1
- src/WebpConverterConstants.php +26 -0
- templates/components/fields/token.php +57 -0
- templates/components/widgets/options.php +7 -3
- templates/components/widgets/regenerate.php +27 -24
- templates/views/settings.php +16 -8
- vendor/autoload.php +1 -1
- vendor/composer/ClassLoader.php +3 -39
- vendor/composer/autoload_classmap.php +30 -14
- vendor/composer/autoload_real.php +6 -6
- vendor/composer/autoload_static.php +34 -18
- vendor/composer/installed.json +1 -5
- vendor/composer/installed.php +2 -2
- webp-converter-for-media.php +3 -3
assets/build/css/styles.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";@keyframes dotsLoading{0%,to{content:"..."}25%{content:" .."}50%{content:". ."}75%{content:".. "}}@font-face{font-family:Exo\ 2;font-style:"normal";font-weight:400;src:url(../../fonts/Exo2/Exo2-Regular.woff2) format("woff2"),url(../../fonts/Exo2/Exo2-Regular.woff) format("woff"),url(../../fonts/Exo2/Exo2-Regular.ttf) format("truetype")}@font-face{font-family:Exo\ 2;font-style:"normal";font-weight:500;src:url(../../fonts/Exo2/Exo2-SemiBold.woff2) format("woff2"),url(../../fonts/Exo2/Exo2-SemiBold.woff) format("woff"),url(../../fonts/Exo2/Exo2-SemiBold.ttf) format("truetype")}.webpModal [hidden]{display:none!important}.webpModal *,.webpModal :after,.webpModal :before{box-sizing:border-box;margin:0;padding:0}.webpModal__outer{background-color:rgba(0,0,0,.75);height:100%;left:0;position:fixed;top:0;width:100%;z-index:9999}.webpModal__form{background-color:#fff;font-family:Exo\ 2,sans-serif;font-size:0;left:50%;max-width:calc(100vw - 40px);padding:20px 30px;position:absolute;top:50%;transform:translate(-50%,-50%);width:600px}.webpModal__headline{font-size:16px;font-weight:500;line-height:1.5;padding:4px 0}.webpModal__desc{font-size:14px;line-height:1.5714285714;padding:4px 0}.webpModal__options{padding:10px 0}.webpModal__textarea{border:1px solid #b4b9be!important;border-radius:0;display:none;font-size:14px;line-height:1.5714285714;margin-top:10px;padding:4px 10px;width:100%}.webpModal__textarea[placeholder]{display:block}.webpModal__textarea[placeholder=""]{display:none}.webpModal__buttons{align-items:center;display:flex;flex-wrap:wrap;margin:0 -5px;padding:5px 0}.webpModal__button{padding:5px;width:50%}.webpModal__buttonInner{width:100%}.webpPage{color:#444;font-family:Exo\ 2,sans-serif;margin:0;overflow:hidden;padding:0 20px 0 0}.webpPage *,.webpPage :after,.webpPage :before{box-sizing:border-box;margin:0;padding:0}.webpPage [hidden]{display:none!important}.webpPage .webpPage__headline{font-size:24px;line-height:1.2083333333;margin:0;padding:15px 0 23px}.webpPage__alert{background-color:#46b450;color:#fff;font-size:14px;line-height:1.5714285714;margin-bottom:30px;padding:15px 20px}.webpPage__columns{margin:0 -30px;overflow:hidden}.webpPage__column{float:left;padding:0 30px}.webpPage__column--large{width:66.666%}.webpPage__column--small{width:33.333%}.webpPage__widget{background-color:#fff}.webpPage__widget+.webpPage__widget{margin-top:60px}.webpPage__widgetTitle{background-color:#0073aa;color:#fff;font-size:16px;font-weight:400;line-height:1.5;padding:14px 30px}.webpPage__widgetTitle--second{background-color:#a0a5aa}.webpPage__widgetTitle--error{background-color:#dc3232}.webpPage__widgetRow{padding-bottom:10px}.webpPage__widgetRow:last-child{padding-bottom:0}.webpPage__widgetRow .webpButton{margin:10px 0}.webpPage__widgetColumns{display:flex;flex-wrap:wrap;margin:0 -10px}.webpPage__widgetColumn{padding:0 10px;width:50%}.webpPage__widgetColumn:first-child:last-child{flex:1}.webpPage__widgetColumnNotice{background-color:#0073aa;margin:10px 0;padding:10px 20px}.webpPage__widgetColumnNotice p{color:#fff;font-size:1.2rem}.webpPage__quality{border:1px solid #a0a5aa;display:flex;flex-wrap:wrap;margin:10px 0}.webpPage__qualityItem{border-left:1px solid #a0a5aa;flex:1;margin-left:-1px;text-align:center}.webpPage__qualityItemInput{display:none!important}.webpPage__qualityItemLabel{display:block;font-size:14px;line-height:1.5714285714;padding:14px 20px;position:relative;transition:color .3s,background-color .3s}.webpPage__qualityItemInput:checked+.webpPage__qualityItemLabel{background-color:#46b450;color:#fff;margin:-1px;padding:15px 21px}.webpPage__qualityItemInput[disabled]+.webpPage__qualityItemLabel{opacity:0;pointer-events:none}.notice[data-notice=webp-converter]{margin-top:20px;padding:0}.webpButton{background-color:#fff;border:1px solid transparent;box-shadow:none!important;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:14px;font-weight:500;line-height:1.5714285714;min-width:180px;opacity:1!important;outline:none!important;padding:9px 30px;position:relative;text-align:center;text-decoration:none;text-decoration:none!important;transition:color .3s!important;z-index:10}p>.webpButton{margin:6px 0}.webpButton:before{float:left;font-family:dashicons;font-size:20px;line-height:1.1;margin-right:10px}.webpButton:after{content:"";height:100%;left:0;position:absolute;top:0;transition:width .3s;width:0;z-index:-1}.webpButton:hover:after{width:100%}.webpButton[disabled]{opacity:.5!important;pointer-events:none}.webpButton--blue:hover,.webpButton--green:hover,.webpButton--red:hover{color:#fff!important}.webpButton--blue{border-color:#0073aa;color:#0073aa!important}.webpButton--blue:after{background-color:#0073aa}.webpButton--green{border-color:#46b450;color:#46b450!important}.webpButton--green:after{background-color:#46b450}.webpButton--red{border-color:#dc3232;color:#dc3232!important}.webpButton--red:after{background-color:#dc3232}.webpContent{font-family:Exo\ 2,sans-serif;padding:20px 30px}.webpContent p{font-size:14px;line-height:1.5714285714;max-width:800px}.webpContent p.center{text-align:center}.webpContent--wide p{max-width:100%}.webpContent a{box-shadow:none;color:#0073aa;outline:none;text-decoration:underline;transition:opacity .3s}.webpContent a:hover{opacity:.5}.webpContent h1,.webpContent h2,.webpContent h3,.webpContent h4,.webpContent h5,.webpContent h6{font-size:16px;font-weight:500;line-height:1.5}.webpContent h1,.webpContent h2,.webpContent h3,.webpContent h4,.webpContent h5,.webpContent h6,.webpContent p{margin:10px 0 0;padding:4px 0}.webpContent h1:first-child,.webpContent h2:first-child,.webpContent h3:first-child,.webpContent h4:first-child,.webpContent h5:first-child,.webpContent h6:first-child,.webpContent p:first-child,.webpContent p>p{margin-top:0}.webpContent h1+p,.webpContent h2+p,.webpContent h3+p,.webpContent h4+p,.webpContent h5+p,.webpContent h6+p{font-size:12px;line-height:1.75;margin-top:0}.webpContent--notice h1+p,.webpContent--notice h2+p,.webpContent--notice h3+p,.webpContent--notice h4+p,.webpContent--notice h5+p,.webpContent--notice h6+p{font-size:14px;line-height:1.5714285714}.webpContent__buttons{margin-top:-10px;overflow:hidden;padding:10px 0}.webpContent__button{float:left;margin:20px 20px 0 0}.webpContent__button:last-child{margin-right:0}.webpField{display:flex;padding:10px 0}.webpField+.webpField{margin-top:-12px}.webpField__input{display:none!important}.webpField__input+label{display:inline-block;position:relative}.webpField__input[disabled]+label{pointer-events:none}.webpField__input[disabled]+label:after,.webpField__input[disabled]+label:before{opacity:.25}.webpField__input--checkbox+label,.webpField__input--radio+label{height:22px;width:22px}.webpField__input--checkbox+label:after,.webpField__input--checkbox+label:before,.webpField__input--radio+label:after,.webpField__input--radio+label:before{align-items:center;content:"";display:flex;height:22px;justify-content:center;left:0;position:absolute;top:0;width:22px}.webpField__input--checkbox+label:before,.webpField__input--radio+label:before{border:1px solid #b4b9be}.webpField__input--checkbox+label:after,.webpField__input--radio+label:after{position:absolute;transform:scale(0);transition:transform .3s}.webpField__input--checkbox:checked+label:after,.webpField__input--radio:checked+label:after{transform:scale(1)}.webpField__input--checkbox+label:after{color:#46b450;content:"\f147";font-family:dashicons;font-size:20px;line-height:1}.webpField__input--radio+label:before{border-radius:50%}.webpField__input--radio+label:after{background-color:#46b450;border-radius:50%;content:"";height:6px;left:8px;top:8px;width:6px}.webpField__input--toggle+label{height:22px;width:44px}.webpField__input--toggle+label:after,.webpField__input--toggle+label:before{content:"";position:absolute}.webpField__input--toggle+label:before{background-color:hsla(210,7%,73%,.5);border:1px solid #b4b9be;border-radius:11px;height:22px;left:0;top:0;transition:background-color .3s;width:44px}.webpField__input--toggle+label:after{background-color:#fff;border-radius:50%;height:16px;left:3px;position:absolute;top:3px;transition:transform .3s;width:16px}.webpField__input--toggle:checked+label:before{background-color:#46b450}.webpField__input--toggle:checked+label:after{transform:translateX(22px)}.webpField__label{display:block;flex:1;font-size:14px;line-height:1.5714285714;margin-left:20px;max-width:650px;position:relative}.webpInput{align-items:center;display:flex;padding:10px 0}.webpInput__field{border:1px solid #b4b9be!important;border-radius:0!important;box-shadow:none!important;flex:1;font-size:14px!important;line-height:1.5714285714!important;padding:9px 15px!important}.webpInput__button{margin:0 0 0 10px!important}.webpLoader__status{padding:20px 0 10px;position:relative}.webpLoader__bar--hidden{display:none}.webpLoader__barProgress{font-size:0;height:21px;line-height:0;position:relative}.webpLoader__barProgress:before{background-color:#46b450;content:"";height:100%;left:0;position:absolute;top:0;transition:width .3s;width:0}.webpLoader__barProgress--error:before{background-color:#dc3232}.webpLoader__barProgress[data-percent="0"]:before{width:0}.webpLoader__barProgress[data-percent="1"]:before{width:1%}.webpLoader__barProgress[data-percent="2"]:before{width:2%}.webpLoader__barProgress[data-percent="3"]:before{width:3%}.webpLoader__barProgress[data-percent="4"]:before{width:4%}.webpLoader__barProgress[data-percent="5"]:before{width:5%}.webpLoader__barProgress[data-percent="6"]:before{width:6%}.webpLoader__barProgress[data-percent="7"]:before{width:7%}.webpLoader__barProgress[data-percent="8"]:before{width:8%}.webpLoader__barProgress[data-percent="9"]:before{width:9%}.webpLoader__barProgress[data-percent="10"]:before{width:10%}.webpLoader__barProgress[data-percent="11"]:before{width:11%}.webpLoader__barProgress[data-percent="12"]:before{width:12%}.webpLoader__barProgress[data-percent="13"]:before{width:13%}.webpLoader__barProgress[data-percent="14"]:before{width:14%}.webpLoader__barProgress[data-percent="15"]:before{width:15%}.webpLoader__barProgress[data-percent="16"]:before{width:16%}.webpLoader__barProgress[data-percent="17"]:before{width:17%}.webpLoader__barProgress[data-percent="18"]:before{width:18%}.webpLoader__barProgress[data-percent="19"]:before{width:19%}.webpLoader__barProgress[data-percent="20"]:before{width:20%}.webpLoader__barProgress[data-percent="21"]:before{width:21%}.webpLoader__barProgress[data-percent="22"]:before{width:22%}.webpLoader__barProgress[data-percent="23"]:before{width:23%}.webpLoader__barProgress[data-percent="24"]:before{width:24%}.webpLoader__barProgress[data-percent="25"]:before{width:25%}.webpLoader__barProgress[data-percent="26"]:before{width:26%}.webpLoader__barProgress[data-percent="27"]:before{width:27%}.webpLoader__barProgress[data-percent="28"]:before{width:28%}.webpLoader__barProgress[data-percent="29"]:before{width:29%}.webpLoader__barProgress[data-percent="30"]:before{width:30%}.webpLoader__barProgress[data-percent="31"]:before{width:31%}.webpLoader__barProgress[data-percent="32"]:before{width:32%}.webpLoader__barProgress[data-percent="33"]:before{width:33%}.webpLoader__barProgress[data-percent="34"]:before{width:34%}.webpLoader__barProgress[data-percent="35"]:before{width:35%}.webpLoader__barProgress[data-percent="36"]:before{width:36%}.webpLoader__barProgress[data-percent="37"]:before{width:37%}.webpLoader__barProgress[data-percent="38"]:before{width:38%}.webpLoader__barProgress[data-percent="39"]:before{width:39%}.webpLoader__barProgress[data-percent="40"]:before{width:40%}.webpLoader__barProgress[data-percent="41"]:before{width:41%}.webpLoader__barProgress[data-percent="42"]:before{width:42%}.webpLoader__barProgress[data-percent="43"]:before{width:43%}.webpLoader__barProgress[data-percent="44"]:before{width:44%}.webpLoader__barProgress[data-percent="45"]:before{width:45%}.webpLoader__barProgress[data-percent="46"]:before{width:46%}.webpLoader__barProgress[data-percent="47"]:before{width:47%}.webpLoader__barProgress[data-percent="48"]:before{width:48%}.webpLoader__barProgress[data-percent="49"]:before{width:49%}.webpLoader__barProgress[data-percent="50"]:before{width:50%}.webpLoader__barProgress[data-percent="51"]:before{width:51%}.webpLoader__barProgress[data-percent="52"]:before{width:52%}.webpLoader__barProgress[data-percent="53"]:before{width:53%}.webpLoader__barProgress[data-percent="54"]:before{width:54%}.webpLoader__barProgress[data-percent="55"]:before{width:55%}.webpLoader__barProgress[data-percent="56"]:before{width:56%}.webpLoader__barProgress[data-percent="57"]:before{width:57%}.webpLoader__barProgress[data-percent="58"]:before{width:58%}.webpLoader__barProgress[data-percent="59"]:before{width:59%}.webpLoader__barProgress[data-percent="60"]:before{width:60%}.webpLoader__barProgress[data-percent="61"]:before{width:61%}.webpLoader__barProgress[data-percent="62"]:before{width:62%}.webpLoader__barProgress[data-percent="63"]:before{width:63%}.webpLoader__barProgress[data-percent="64"]:before{width:64%}.webpLoader__barProgress[data-percent="65"]:before{width:65%}.webpLoader__barProgress[data-percent="66"]:before{width:66%}.webpLoader__barProgress[data-percent="67"]:before{width:67%}.webpLoader__barProgress[data-percent="68"]:before{width:68%}.webpLoader__barProgress[data-percent="69"]:before{width:69%}.webpLoader__barProgress[data-percent="70"]:before{width:70%}.webpLoader__barProgress[data-percent="71"]:before{width:71%}.webpLoader__barProgress[data-percent="72"]:before{width:72%}.webpLoader__barProgress[data-percent="73"]:before{width:73%}.webpLoader__barProgress[data-percent="74"]:before{width:74%}.webpLoader__barProgress[data-percent="75"]:before{width:75%}.webpLoader__barProgress[data-percent="76"]:before{width:76%}.webpLoader__barProgress[data-percent="77"]:before{width:77%}.webpLoader__barProgress[data-percent="78"]:before{width:78%}.webpLoader__barProgress[data-percent="79"]:before{width:79%}.webpLoader__barProgress[data-percent="80"]:before{width:80%}.webpLoader__barProgress[data-percent="81"]:before{width:81%}.webpLoader__barProgress[data-percent="82"]:before{width:82%}.webpLoader__barProgress[data-percent="83"]:before{width:83%}.webpLoader__barProgress[data-percent="84"]:before{width:84%}.webpLoader__barProgress[data-percent="85"]:before{width:85%}.webpLoader__barProgress[data-percent="86"]:before{width:86%}.webpLoader__barProgress[data-percent="87"]:before{width:87%}.webpLoader__barProgress[data-percent="88"]:before{width:88%}.webpLoader__barProgress[data-percent="89"]:before{width:89%}.webpLoader__barProgress[data-percent="90"]:before{width:90%}.webpLoader__barProgress[data-percent="91"]:before{width:91%}.webpLoader__barProgress[data-percent="92"]:before{width:92%}.webpLoader__barProgress[data-percent="93"]:before{width:93%}.webpLoader__barProgress[data-percent="94"]:before{width:94%}.webpLoader__barProgress[data-percent="95"]:before{width:95%}.webpLoader__barProgress[data-percent="96"]:before{width:96%}.webpLoader__barProgress[data-percent="97"]:before{width:97%}.webpLoader__barProgress[data-percent="98"]:before{width:98%}.webpLoader__barProgress[data-percent="99"]:before{width:99%}.webpLoader__barProgress[data-percent="100"]:before{width:100%}.webpLoader__barCount{background-color:#46b450;color:#fff;display:inline-block;font-family:monospace;font-size:12px;line-height:1.75;padding:0 5px;position:relative}.webpLoader__barProgress--error .webpLoader__barCount{background-color:#dc3232}.webpLoader__barCount:after{animation:dotsLoading 1s linear infinite;content:"...";margin-left:5px}.webpLoader__barProgress--error .webpLoader__barCount:after,.webpLoader__barProgress[data-percent="100"] .webpLoader__barCount:after{display:none}.webpLoader__barProgress[data-percent="0"] .webpLoader__barCount:before{content:"0%"}.webpLoader__barProgress[data-percent="1"] .webpLoader__barCount:before{content:"1%"}.webpLoader__barProgress[data-percent="2"] .webpLoader__barCount:before{content:"2%"}.webpLoader__barProgress[data-percent="3"] .webpLoader__barCount:before{content:"3%"}.webpLoader__barProgress[data-percent="4"] .webpLoader__barCount:before{content:"4%"}.webpLoader__barProgress[data-percent="5"] .webpLoader__barCount:before{content:"5%"}.webpLoader__barProgress[data-percent="6"] .webpLoader__barCount:before{content:"6%"}.webpLoader__barProgress[data-percent="7"] .webpLoader__barCount:before{content:"7%"}.webpLoader__barProgress[data-percent="8"] .webpLoader__barCount:before{content:"8%"}.webpLoader__barProgress[data-percent="9"] .webpLoader__barCount:before{content:"9%"}.webpLoader__barProgress[data-percent="10"] .webpLoader__barCount:before{content:"10%"}.webpLoader__barProgress[data-percent="11"] .webpLoader__barCount:before{content:"11%"}.webpLoader__barProgress[data-percent="12"] .webpLoader__barCount:before{content:"12%"}.webpLoader__barProgress[data-percent="13"] .webpLoader__barCount:before{content:"13%"}.webpLoader__barProgress[data-percent="14"] .webpLoader__barCount:before{content:"14%"}.webpLoader__barProgress[data-percent="15"] .webpLoader__barCount:before{content:"15%"}.webpLoader__barProgress[data-percent="16"] .webpLoader__barCount:before{content:"16%"}.webpLoader__barProgress[data-percent="17"] .webpLoader__barCount:before{content:"17%"}.webpLoader__barProgress[data-percent="18"] .webpLoader__barCount:before{content:"18%"}.webpLoader__barProgress[data-percent="19"] .webpLoader__barCount:before{content:"19%"}.webpLoader__barProgress[data-percent="20"] .webpLoader__barCount:before{content:"20%"}.webpLoader__barProgress[data-percent="21"] .webpLoader__barCount:before{content:"21%"}.webpLoader__barProgress[data-percent="22"] .webpLoader__barCount:before{content:"22%"}.webpLoader__barProgress[data-percent="23"] .webpLoader__barCount:before{content:"23%"}.webpLoader__barProgress[data-percent="24"] .webpLoader__barCount:before{content:"24%"}.webpLoader__barProgress[data-percent="25"] .webpLoader__barCount:before{content:"25%"}.webpLoader__barProgress[data-percent="26"] .webpLoader__barCount:before{content:"26%"}.webpLoader__barProgress[data-percent="27"] .webpLoader__barCount:before{content:"27%"}.webpLoader__barProgress[data-percent="28"] .webpLoader__barCount:before{content:"28%"}.webpLoader__barProgress[data-percent="29"] .webpLoader__barCount:before{content:"29%"}.webpLoader__barProgress[data-percent="30"] .webpLoader__barCount:before{content:"30%"}.webpLoader__barProgress[data-percent="31"] .webpLoader__barCount:before{content:"31%"}.webpLoader__barProgress[data-percent="32"] .webpLoader__barCount:before{content:"32%"}.webpLoader__barProgress[data-percent="33"] .webpLoader__barCount:before{content:"33%"}.webpLoader__barProgress[data-percent="34"] .webpLoader__barCount:before{content:"34%"}.webpLoader__barProgress[data-percent="35"] .webpLoader__barCount:before{content:"35%"}.webpLoader__barProgress[data-percent="36"] .webpLoader__barCount:before{content:"36%"}.webpLoader__barProgress[data-percent="37"] .webpLoader__barCount:before{content:"37%"}.webpLoader__barProgress[data-percent="38"] .webpLoader__barCount:before{content:"38%"}.webpLoader__barProgress[data-percent="39"] .webpLoader__barCount:before{content:"39%"}.webpLoader__barProgress[data-percent="40"] .webpLoader__barCount:before{content:"40%"}.webpLoader__barProgress[data-percent="41"] .webpLoader__barCount:before{content:"41%"}.webpLoader__barProgress[data-percent="42"] .webpLoader__barCount:before{content:"42%"}.webpLoader__barProgress[data-percent="43"] .webpLoader__barCount:before{content:"43%"}.webpLoader__barProgress[data-percent="44"] .webpLoader__barCount:before{content:"44%"}.webpLoader__barProgress[data-percent="45"] .webpLoader__barCount:before{content:"45%"}.webpLoader__barProgress[data-percent="46"] .webpLoader__barCount:before{content:"46%"}.webpLoader__barProgress[data-percent="47"] .webpLoader__barCount:before{content:"47%"}.webpLoader__barProgress[data-percent="48"] .webpLoader__barCount:before{content:"48%"}.webpLoader__barProgress[data-percent="49"] .webpLoader__barCount:before{content:"49%"}.webpLoader__barProgress[data-percent="50"] .webpLoader__barCount:before{content:"50%"}.webpLoader__barProgress[data-percent="51"] .webpLoader__barCount:before{content:"51%"}.webpLoader__barProgress[data-percent="52"] .webpLoader__barCount:before{content:"52%"}.webpLoader__barProgress[data-percent="53"] .webpLoader__barCount:before{content:"53%"}.webpLoader__barProgress[data-percent="54"] .webpLoader__barCount:before{content:"54%"}.webpLoader__barProgress[data-percent="55"] .webpLoader__barCount:before{content:"55%"}.webpLoader__barProgress[data-percent="56"] .webpLoader__barCount:before{content:"56%"}.webpLoader__barProgress[data-percent="57"] .webpLoader__barCount:before{content:"57%"}.webpLoader__barProgress[data-percent="58"] .webpLoader__barCount:before{content:"58%"}.webpLoader__barProgress[data-percent="59"] .webpLoader__barCount:before{content:"59%"}.webpLoader__barProgress[data-percent="60"] .webpLoader__barCount:before{content:"60%"}.webpLoader__barProgress[data-percent="61"] .webpLoader__barCount:before{content:"61%"}.webpLoader__barProgress[data-percent="62"] .webpLoader__barCount:before{content:"62%"}.webpLoader__barProgress[data-percent="63"] .webpLoader__barCount:before{content:"63%"}.webpLoader__barProgress[data-percent="64"] .webpLoader__barCount:before{content:"64%"}.webpLoader__barProgress[data-percent="65"] .webpLoader__barCount:before{content:"65%"}.webpLoader__barProgress[data-percent="66"] .webpLoader__barCount:before{content:"66%"}.webpLoader__barProgress[data-percent="67"] .webpLoader__barCount:before{content:"67%"}.webpLoader__barProgress[data-percent="68"] .webpLoader__barCount:before{content:"68%"}.webpLoader__barProgress[data-percent="69"] .webpLoader__barCount:before{content:"69%"}.webpLoader__barProgress[data-percent="70"] .webpLoader__barCount:before{content:"70%"}.webpLoader__barProgress[data-percent="71"] .webpLoader__barCount:before{content:"71%"}.webpLoader__barProgress[data-percent="72"] .webpLoader__barCount:before{content:"72%"}.webpLoader__barProgress[data-percent="73"] .webpLoader__barCount:before{content:"73%"}.webpLoader__barProgress[data-percent="74"] .webpLoader__barCount:before{content:"74%"}.webpLoader__barProgress[data-percent="75"] .webpLoader__barCount:before{content:"75%"}.webpLoader__barProgress[data-percent="76"] .webpLoader__barCount:before{content:"76%"}.webpLoader__barProgress[data-percent="77"] .webpLoader__barCount:before{content:"77%"}.webpLoader__barProgress[data-percent="78"] .webpLoader__barCount:before{content:"78%"}.webpLoader__barProgress[data-percent="79"] .webpLoader__barCount:before{content:"79%"}.webpLoader__barProgress[data-percent="80"] .webpLoader__barCount:before{content:"80%"}.webpLoader__barProgress[data-percent="81"] .webpLoader__barCount:before{content:"81%"}.webpLoader__barProgress[data-percent="82"] .webpLoader__barCount:before{content:"82%"}.webpLoader__barProgress[data-percent="83"] .webpLoader__barCount:before{content:"83%"}.webpLoader__barProgress[data-percent="84"] .webpLoader__barCount:before{content:"84%"}.webpLoader__barProgress[data-percent="85"] .webpLoader__barCount:before{content:"85%"}.webpLoader__barProgress[data-percent="86"] .webpLoader__barCount:before{content:"86%"}.webpLoader__barProgress[data-percent="87"] .webpLoader__barCount:before{content:"87%"}.webpLoader__barProgress[data-percent="88"] .webpLoader__barCount:before{content:"88%"}.webpLoader__barProgress[data-percent="89"] .webpLoader__barCount:before{content:"89%"}.webpLoader__barProgress[data-percent="90"] .webpLoader__barCount:before{content:"90%"}.webpLoader__barProgress[data-percent="91"] .webpLoader__barCount:before{content:"91%"}.webpLoader__barProgress[data-percent="92"] .webpLoader__barCount:before{content:"92%"}.webpLoader__barProgress[data-percent="93"] .webpLoader__barCount:before{content:"93%"}.webpLoader__barProgress[data-percent="94"] .webpLoader__barCount:before{content:"94%"}.webpLoader__barProgress[data-percent="95"] .webpLoader__barCount:before{content:"95%"}.webpLoader__barProgress[data-percent="96"] .webpLoader__barCount:before{content:"96%"}.webpLoader__barProgress[data-percent="97"] .webpLoader__barCount:before{content:"97%"}.webpLoader__barProgress[data-percent="98"] .webpLoader__barCount:before{content:"98%"}.webpLoader__barProgress[data-percent="99"] .webpLoader__barCount:before{content:"99%"}.webpLoader__barProgress[data-percent="100"] .webpLoader__barCount:before{content:"100%"}.webpLoader__size{font-size:14px;line-height:1.5714285714;margin-bottom:-10px;padding:4px 0}.webpLoader__sizeProgress{font-weight:500}.webpLoader__success{margin-top:20px;padding:4px 0 4px 20px;position:relative}.webpLoader__success:before{background-color:#46b450;content:"";height:100%;left:0;position:absolute;top:0;width:2px}.webpLoader__successContent{color:#46b450;font-size:14px;font-weight:500;line-height:1.5714285714}.webpLoader__successContent a{color:inherit}.webpLoader__errors{border-left:2px solid #a0a5aa;margin-top:20px}.webpLoader__errorsTitle{background-color:#a0a5aa;color:#fff;display:inline-block;font-size:14px;line-height:1.5714285714;padding:4px 22px}.webpLoader__errorsContent{padding:10px 0 10px 20px}.webpLoader__errorsContent>p{font-size:12px;line-height:1.75;margin:0;max-width:100%}.webpLoader__errorsContent>p.webpLoader__errorsContentError{color:#dc3232;font-size:14px;font-weight:500;line-height:1.5714285714}.webpLoader__errorsContent pre{font-size:12px;line-height:1.75;white-space:normal}.webpLoader__button--disabled{opacity:.25!important;pointer-events:none}.webpPopup{margin-top:20px}.webpPopup__inner{background-color:#fff;display:flex;flex-wrap:wrap}.webpPopup__image{background-image:url(../../img/author.jpg);background-position:50%;background-repeat:no-repeat;background-size:cover;width:152px}.webpPopup__content{border:1px solid #a0a5aa;border-left:0;flex:1;padding:10px 20px}.webpServerInfo{color:#222;text-align:center}.webpServerInfo pre{font-family:monospace;margin:0}.webpServerInfo h1,.webpServerInfo h2{display:none}.webpServerInfo p{max-width:100%}.webpServerInfo table{border:0;border-collapse:collapse;margin:10px auto;width:100%}.webpServerInfo td,.webpServerInfo th{border:1px solid #666;font-size:12px;line-height:1.75;padding:4px 5px;text-align:center;vertical-align:baseline}.webpServerInfo .p{text-align:left}.webpServerInfo .e{background-color:#ccf;font-weight:700;width:300px}.webpServerInfo .h{background-color:#99c;font-weight:700}.webpServerInfo .v{word-wrap:break-word;background-color:#ddd;max-width:300px;overflow-x:auto}.webpServerInfo .v i{color:#999}.webpServerInfo img{border:0;float:right}@media screen and (max-width:1024px){.webpPage__column--large{width:100%}.webpPage__column--small{margin-top:40px;width:100%}.webpPage__widget+.webpPage__widget{margin-top:40px}.webpPage__widgetColumns{display:block}.webpPage__widgetColumn{width:100%}}@media screen and (max-width:782px){.webpModal__button{width:100%}.webpPage{padding-right:0}.webpPage__quality{display:block}.webpPage__qualityItem{border-left:0}.webpPage__qualityItem+.webpPage__qualityItem{border-top:1px solid #a0a5aa}.webpInput{display:block}.webpInput__field{width:100%}.webpInput__button{margin:10px 0 0!important}.webpPopup__inner{border:1px solid #a0a5aa;display:block}.webpPopup__image{height:152px;margin:20px auto 0}.webpPopup__content{border:0}}
|
1 |
+
@charset "UTF-8";@keyframes dotsLoading{0%,to{content:"..."}25%{content:" .."}50%{content:". ."}75%{content:".. "}}@font-face{font-family:Exo\ 2;font-style:"normal";font-weight:400;src:url(../../fonts/Exo2/Exo2-Regular.woff2) format("woff2"),url(../../fonts/Exo2/Exo2-Regular.woff) format("woff"),url(../../fonts/Exo2/Exo2-Regular.ttf) format("truetype")}@font-face{font-family:Exo\ 2;font-style:"normal";font-weight:500;src:url(../../fonts/Exo2/Exo2-SemiBold.woff2) format("woff2"),url(../../fonts/Exo2/Exo2-SemiBold.woff) format("woff"),url(../../fonts/Exo2/Exo2-SemiBold.ttf) format("truetype")}.webpModal [hidden]{display:none!important}.webpModal *,.webpModal :after,.webpModal :before{box-sizing:border-box;margin:0;padding:0}.webpModal__outer{background-color:rgba(0,0,0,.75);height:100%;left:0;position:fixed;top:0;width:100%;z-index:9999}.webpModal__form{background-color:#fff;font-family:Exo\ 2,sans-serif;font-size:0;left:50%;max-width:calc(100vw - 40px);padding:20px 30px;position:absolute;top:50%;transform:translate(-50%,-50%);width:600px}.webpModal__headline{font-size:16px;font-weight:500;line-height:1.5;padding:4px 0}.webpModal__desc{font-size:14px;line-height:1.5714285714;padding:4px 0}.webpModal__options{padding:10px 0}.webpModal__textarea{border:1px solid #b4b9be!important;border-radius:0;display:none;font-size:14px;line-height:1.5714285714;margin-top:10px;padding:4px 10px;width:100%}.webpModal__textarea[placeholder]{display:block}.webpModal__textarea[placeholder=""]{display:none}.webpModal__buttons{align-items:center;display:flex;flex-wrap:wrap;margin:0 -5px;padding:5px 0}.webpModal__button{padding:5px;width:50%}.webpModal__buttonInner{width:100%}.webpPage{color:#444;font-family:Exo\ 2,sans-serif;margin:0;overflow:hidden;padding:0 20px 0 0}.webpPage *,.webpPage :after,.webpPage :before{box-sizing:border-box;margin:0;padding:0}.webpPage [hidden]{display:none!important}.webpPage .webpPage__headline{font-size:24px;line-height:1.2083333333;margin:0;padding:15px 0 23px}.webpPage__alert{background-color:#46b450;color:#fff;font-size:14px;line-height:1.5714285714;margin-bottom:30px;padding:15px 20px}.webpPage__columns{margin:0 -30px;overflow:hidden}.webpPage__column{float:left;padding:0 30px}.webpPage__column--large{width:66.666%}.webpPage__column--small{width:33.333%}.webpPage__widget{background-color:#fff}.webpPage__widget+.webpPage__widget{margin-top:60px}.webpPage__widgetTitle{background-color:#0073aa;color:#fff;font-size:16px;font-weight:400;line-height:1.5;padding:14px 30px}.webpPage__widgetTitle--second{background-color:#a0a5aa}.webpPage__widgetTitle--error{background-color:#dc3232}.webpPage__widgetRow{padding-bottom:10px}.webpPage__widgetRow:last-child{padding-bottom:0}.webpPage__widgetRow .webpButton{margin:10px 0}.webpPage__widgetColumns{display:flex;flex-wrap:wrap;margin:0 -10px}.webpPage__widgetColumn{padding:0 10px;width:50%}.webpPage__widgetColumn:first-child:last-child{flex:1}.webpPage__widgetColumnNotice{background-color:#0073aa;margin:10px 0;padding:10px 20px}.webpPage__widgetColumnNotice p{color:#fff;font-size:1.2rem}.webpPage__quality{border:1px solid #a0a5aa;display:flex;flex-wrap:wrap;margin:10px 0}.webpPage__qualityItem{border-left:1px solid #a0a5aa;flex:1;margin-left:-1px;text-align:center}.webpPage__qualityItemInput{display:none!important}.webpPage__qualityItemLabel{display:block;font-size:14px;line-height:1.5714285714;padding:14px 20px;position:relative;transition:color .3s,background-color .3s}.webpPage__qualityItemInput:checked+.webpPage__qualityItemLabel{background-color:#46b450;color:#fff;margin:-1px;padding:15px 21px}.webpPage__qualityItemInput[disabled]+.webpPage__qualityItemLabel{opacity:0;pointer-events:none}.notice[data-notice=webp-converter]{margin-top:20px;padding:0}.webpButton{background-color:#fff;border:1px solid transparent;box-shadow:none!important;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:14px;font-weight:500;line-height:1.5714285714;min-width:180px;opacity:1!important;outline:none!important;padding:9px 30px;position:relative;text-align:center;text-decoration:none;text-decoration:none!important;transition:color .3s!important;z-index:10}p>.webpButton{margin:6px 0}.webpButton:before{float:left;font-family:dashicons;font-size:20px;line-height:1.1;margin-right:10px}.webpButton:after{content:"";height:100%;left:0;position:absolute;top:0;transition:width .3s;width:0;z-index:-1}.webpButton:hover:after{width:100%}.webpButton[disabled]{opacity:.5!important;pointer-events:none}.webpButton--blue:hover,.webpButton--green:hover,.webpButton--red:hover{color:#fff!important}.webpButton--blue{border-color:#0073aa;color:#0073aa!important}.webpButton--blue:after{background-color:#0073aa}.webpButton--green{border-color:#46b450;color:#46b450!important}.webpButton--green:after{background-color:#46b450}.webpButton--red{border-color:#dc3232;color:#dc3232!important}.webpButton--red:after{background-color:#dc3232}.webpContent{font-family:Exo\ 2,sans-serif;padding:20px 30px}.webpContent p{font-size:14px;line-height:1.5714285714;max-width:800px}.webpContent p.center{text-align:center}.webpContent--wide p{max-width:100%}.webpContent a{box-shadow:none;color:#0073aa;outline:none;text-decoration:underline;transition:opacity .3s}.webpContent a:hover{opacity:.5}.webpContent h1,.webpContent h2,.webpContent h3,.webpContent h4,.webpContent h5,.webpContent h6{font-size:16px;font-weight:500;line-height:1.5}.webpContent h1,.webpContent h2,.webpContent h3,.webpContent h4,.webpContent h5,.webpContent h6,.webpContent p{margin:10px 0 0;padding:4px 0}.webpContent h1:first-child,.webpContent h2:first-child,.webpContent h3:first-child,.webpContent h4:first-child,.webpContent h5:first-child,.webpContent h6:first-child,.webpContent p:first-child,.webpContent p>p,.webpInput+p{margin-top:0}.webpContent h1+p,.webpContent h2+p,.webpContent h3+p,.webpContent h4+p,.webpContent h5+p,.webpContent h6+p{font-size:12px;line-height:1.75;margin-top:0}.webpContent--notice h1+p,.webpContent--notice h2+p,.webpContent--notice h3+p,.webpContent--notice h4+p,.webpContent--notice h5+p,.webpContent--notice h6+p{font-size:14px;line-height:1.5714285714}.webpContent__buttons{margin-top:-10px;overflow:hidden;padding:10px 0}.webpContent__button{float:left;margin:20px 20px 0 0}.webpContent__button:last-child{margin-right:0}.webpField{display:flex;padding:10px 0}.webpField+.webpField{margin-top:-12px}.webpField__input{display:none!important}.webpField__input+label{display:inline-block;position:relative}.webpField__input[disabled]+label{pointer-events:none}.webpField__input[disabled]+label:after,.webpField__input[disabled]+label:before{opacity:.25}.webpField__input--checkbox+label,.webpField__input--radio+label{height:22px;width:22px}.webpField__input--checkbox+label:after,.webpField__input--checkbox+label:before,.webpField__input--radio+label:after,.webpField__input--radio+label:before{align-items:center;content:"";display:flex;height:22px;justify-content:center;left:0;position:absolute;top:0;width:22px}.webpField__input--checkbox+label:before,.webpField__input--radio+label:before{border:1px solid #b4b9be}.webpField__input--checkbox+label:after,.webpField__input--radio+label:after{position:absolute;transform:scale(0);transition:transform .3s}.webpField__input--checkbox:checked+label:after,.webpField__input--radio:checked+label:after{transform:scale(1)}.webpField__input--checkbox+label:after{color:#46b450;content:"\f147";font-family:dashicons;font-size:20px;line-height:1}.webpField__input--radio+label:before{border-radius:50%}.webpField__input--radio+label:after{background-color:#46b450;border-radius:50%;content:"";height:6px;left:8px;top:8px;width:6px}.webpField__input--toggle+label{height:22px;width:44px}.webpField__input--toggle+label:after,.webpField__input--toggle+label:before{content:"";position:absolute}.webpField__input--toggle+label:before{background-color:hsla(210,7%,73%,.5);border:1px solid #b4b9be;border-radius:11px;height:22px;left:0;top:0;transition:background-color .3s;width:44px}.webpField__input--toggle+label:after{background-color:#fff;border-radius:50%;height:16px;left:3px;position:absolute;top:3px;transition:transform .3s;width:16px}.webpField__input--toggle:checked+label:before{background-color:#46b450}.webpField__input--toggle:checked+label:after{transform:translateX(22px)}.webpField__label{display:block;flex:1;font-size:14px;line-height:1.5714285714;margin-left:20px;max-width:650px;position:relative}.webpInput{align-items:center;display:flex;padding:10px 0}.webpInput__field{border:1px solid #b4b9be!important;border-radius:0!important;box-shadow:none!important;flex:1;font-size:14px!important;line-height:1.5714285714!important;padding:9px 15px!important}.webpInput__button{margin:0 0 0 10px!important}.webpLoader__status{padding:20px 0 10px;position:relative}.webpLoader__bar--hidden{display:none}.webpLoader__barProgress{font-size:0;height:21px;line-height:0;position:relative}.webpLoader__barProgress:before{background-color:#46b450;content:"";height:100%;left:0;position:absolute;top:0;transition:width .3s;width:0}.webpLoader__barProgress--error:before{background-color:#dc3232}.webpLoader__barProgress[data-percent="0"]:before{width:0}.webpLoader__barProgress[data-percent="1"]:before{width:1%}.webpLoader__barProgress[data-percent="2"]:before{width:2%}.webpLoader__barProgress[data-percent="3"]:before{width:3%}.webpLoader__barProgress[data-percent="4"]:before{width:4%}.webpLoader__barProgress[data-percent="5"]:before{width:5%}.webpLoader__barProgress[data-percent="6"]:before{width:6%}.webpLoader__barProgress[data-percent="7"]:before{width:7%}.webpLoader__barProgress[data-percent="8"]:before{width:8%}.webpLoader__barProgress[data-percent="9"]:before{width:9%}.webpLoader__barProgress[data-percent="10"]:before{width:10%}.webpLoader__barProgress[data-percent="11"]:before{width:11%}.webpLoader__barProgress[data-percent="12"]:before{width:12%}.webpLoader__barProgress[data-percent="13"]:before{width:13%}.webpLoader__barProgress[data-percent="14"]:before{width:14%}.webpLoader__barProgress[data-percent="15"]:before{width:15%}.webpLoader__barProgress[data-percent="16"]:before{width:16%}.webpLoader__barProgress[data-percent="17"]:before{width:17%}.webpLoader__barProgress[data-percent="18"]:before{width:18%}.webpLoader__barProgress[data-percent="19"]:before{width:19%}.webpLoader__barProgress[data-percent="20"]:before{width:20%}.webpLoader__barProgress[data-percent="21"]:before{width:21%}.webpLoader__barProgress[data-percent="22"]:before{width:22%}.webpLoader__barProgress[data-percent="23"]:before{width:23%}.webpLoader__barProgress[data-percent="24"]:before{width:24%}.webpLoader__barProgress[data-percent="25"]:before{width:25%}.webpLoader__barProgress[data-percent="26"]:before{width:26%}.webpLoader__barProgress[data-percent="27"]:before{width:27%}.webpLoader__barProgress[data-percent="28"]:before{width:28%}.webpLoader__barProgress[data-percent="29"]:before{width:29%}.webpLoader__barProgress[data-percent="30"]:before{width:30%}.webpLoader__barProgress[data-percent="31"]:before{width:31%}.webpLoader__barProgress[data-percent="32"]:before{width:32%}.webpLoader__barProgress[data-percent="33"]:before{width:33%}.webpLoader__barProgress[data-percent="34"]:before{width:34%}.webpLoader__barProgress[data-percent="35"]:before{width:35%}.webpLoader__barProgress[data-percent="36"]:before{width:36%}.webpLoader__barProgress[data-percent="37"]:before{width:37%}.webpLoader__barProgress[data-percent="38"]:before{width:38%}.webpLoader__barProgress[data-percent="39"]:before{width:39%}.webpLoader__barProgress[data-percent="40"]:before{width:40%}.webpLoader__barProgress[data-percent="41"]:before{width:41%}.webpLoader__barProgress[data-percent="42"]:before{width:42%}.webpLoader__barProgress[data-percent="43"]:before{width:43%}.webpLoader__barProgress[data-percent="44"]:before{width:44%}.webpLoader__barProgress[data-percent="45"]:before{width:45%}.webpLoader__barProgress[data-percent="46"]:before{width:46%}.webpLoader__barProgress[data-percent="47"]:before{width:47%}.webpLoader__barProgress[data-percent="48"]:before{width:48%}.webpLoader__barProgress[data-percent="49"]:before{width:49%}.webpLoader__barProgress[data-percent="50"]:before{width:50%}.webpLoader__barProgress[data-percent="51"]:before{width:51%}.webpLoader__barProgress[data-percent="52"]:before{width:52%}.webpLoader__barProgress[data-percent="53"]:before{width:53%}.webpLoader__barProgress[data-percent="54"]:before{width:54%}.webpLoader__barProgress[data-percent="55"]:before{width:55%}.webpLoader__barProgress[data-percent="56"]:before{width:56%}.webpLoader__barProgress[data-percent="57"]:before{width:57%}.webpLoader__barProgress[data-percent="58"]:before{width:58%}.webpLoader__barProgress[data-percent="59"]:before{width:59%}.webpLoader__barProgress[data-percent="60"]:before{width:60%}.webpLoader__barProgress[data-percent="61"]:before{width:61%}.webpLoader__barProgress[data-percent="62"]:before{width:62%}.webpLoader__barProgress[data-percent="63"]:before{width:63%}.webpLoader__barProgress[data-percent="64"]:before{width:64%}.webpLoader__barProgress[data-percent="65"]:before{width:65%}.webpLoader__barProgress[data-percent="66"]:before{width:66%}.webpLoader__barProgress[data-percent="67"]:before{width:67%}.webpLoader__barProgress[data-percent="68"]:before{width:68%}.webpLoader__barProgress[data-percent="69"]:before{width:69%}.webpLoader__barProgress[data-percent="70"]:before{width:70%}.webpLoader__barProgress[data-percent="71"]:before{width:71%}.webpLoader__barProgress[data-percent="72"]:before{width:72%}.webpLoader__barProgress[data-percent="73"]:before{width:73%}.webpLoader__barProgress[data-percent="74"]:before{width:74%}.webpLoader__barProgress[data-percent="75"]:before{width:75%}.webpLoader__barProgress[data-percent="76"]:before{width:76%}.webpLoader__barProgress[data-percent="77"]:before{width:77%}.webpLoader__barProgress[data-percent="78"]:before{width:78%}.webpLoader__barProgress[data-percent="79"]:before{width:79%}.webpLoader__barProgress[data-percent="80"]:before{width:80%}.webpLoader__barProgress[data-percent="81"]:before{width:81%}.webpLoader__barProgress[data-percent="82"]:before{width:82%}.webpLoader__barProgress[data-percent="83"]:before{width:83%}.webpLoader__barProgress[data-percent="84"]:before{width:84%}.webpLoader__barProgress[data-percent="85"]:before{width:85%}.webpLoader__barProgress[data-percent="86"]:before{width:86%}.webpLoader__barProgress[data-percent="87"]:before{width:87%}.webpLoader__barProgress[data-percent="88"]:before{width:88%}.webpLoader__barProgress[data-percent="89"]:before{width:89%}.webpLoader__barProgress[data-percent="90"]:before{width:90%}.webpLoader__barProgress[data-percent="91"]:before{width:91%}.webpLoader__barProgress[data-percent="92"]:before{width:92%}.webpLoader__barProgress[data-percent="93"]:before{width:93%}.webpLoader__barProgress[data-percent="94"]:before{width:94%}.webpLoader__barProgress[data-percent="95"]:before{width:95%}.webpLoader__barProgress[data-percent="96"]:before{width:96%}.webpLoader__barProgress[data-percent="97"]:before{width:97%}.webpLoader__barProgress[data-percent="98"]:before{width:98%}.webpLoader__barProgress[data-percent="99"]:before{width:99%}.webpLoader__barProgress[data-percent="100"]:before{width:100%}.webpLoader__barCount{background-color:#46b450;color:#fff;display:inline-block;font-family:monospace;font-size:12px;line-height:1.75;padding:0 5px;position:relative}.webpLoader__barProgress--error .webpLoader__barCount{background-color:#dc3232}.webpLoader__barCount:after{animation:dotsLoading 1s linear infinite;content:"...";margin-left:5px}.webpLoader__barProgress--error .webpLoader__barCount:after,.webpLoader__barProgress[data-percent="100"] .webpLoader__barCount:after{display:none}.webpLoader__barProgress[data-percent="0"] .webpLoader__barCount:before{content:"0%"}.webpLoader__barProgress[data-percent="1"] .webpLoader__barCount:before{content:"1%"}.webpLoader__barProgress[data-percent="2"] .webpLoader__barCount:before{content:"2%"}.webpLoader__barProgress[data-percent="3"] .webpLoader__barCount:before{content:"3%"}.webpLoader__barProgress[data-percent="4"] .webpLoader__barCount:before{content:"4%"}.webpLoader__barProgress[data-percent="5"] .webpLoader__barCount:before{content:"5%"}.webpLoader__barProgress[data-percent="6"] .webpLoader__barCount:before{content:"6%"}.webpLoader__barProgress[data-percent="7"] .webpLoader__barCount:before{content:"7%"}.webpLoader__barProgress[data-percent="8"] .webpLoader__barCount:before{content:"8%"}.webpLoader__barProgress[data-percent="9"] .webpLoader__barCount:before{content:"9%"}.webpLoader__barProgress[data-percent="10"] .webpLoader__barCount:before{content:"10%"}.webpLoader__barProgress[data-percent="11"] .webpLoader__barCount:before{content:"11%"}.webpLoader__barProgress[data-percent="12"] .webpLoader__barCount:before{content:"12%"}.webpLoader__barProgress[data-percent="13"] .webpLoader__barCount:before{content:"13%"}.webpLoader__barProgress[data-percent="14"] .webpLoader__barCount:before{content:"14%"}.webpLoader__barProgress[data-percent="15"] .webpLoader__barCount:before{content:"15%"}.webpLoader__barProgress[data-percent="16"] .webpLoader__barCount:before{content:"16%"}.webpLoader__barProgress[data-percent="17"] .webpLoader__barCount:before{content:"17%"}.webpLoader__barProgress[data-percent="18"] .webpLoader__barCount:before{content:"18%"}.webpLoader__barProgress[data-percent="19"] .webpLoader__barCount:before{content:"19%"}.webpLoader__barProgress[data-percent="20"] .webpLoader__barCount:before{content:"20%"}.webpLoader__barProgress[data-percent="21"] .webpLoader__barCount:before{content:"21%"}.webpLoader__barProgress[data-percent="22"] .webpLoader__barCount:before{content:"22%"}.webpLoader__barProgress[data-percent="23"] .webpLoader__barCount:before{content:"23%"}.webpLoader__barProgress[data-percent="24"] .webpLoader__barCount:before{content:"24%"}.webpLoader__barProgress[data-percent="25"] .webpLoader__barCount:before{content:"25%"}.webpLoader__barProgress[data-percent="26"] .webpLoader__barCount:before{content:"26%"}.webpLoader__barProgress[data-percent="27"] .webpLoader__barCount:before{content:"27%"}.webpLoader__barProgress[data-percent="28"] .webpLoader__barCount:before{content:"28%"}.webpLoader__barProgress[data-percent="29"] .webpLoader__barCount:before{content:"29%"}.webpLoader__barProgress[data-percent="30"] .webpLoader__barCount:before{content:"30%"}.webpLoader__barProgress[data-percent="31"] .webpLoader__barCount:before{content:"31%"}.webpLoader__barProgress[data-percent="32"] .webpLoader__barCount:before{content:"32%"}.webpLoader__barProgress[data-percent="33"] .webpLoader__barCount:before{content:"33%"}.webpLoader__barProgress[data-percent="34"] .webpLoader__barCount:before{content:"34%"}.webpLoader__barProgress[data-percent="35"] .webpLoader__barCount:before{content:"35%"}.webpLoader__barProgress[data-percent="36"] .webpLoader__barCount:before{content:"36%"}.webpLoader__barProgress[data-percent="37"] .webpLoader__barCount:before{content:"37%"}.webpLoader__barProgress[data-percent="38"] .webpLoader__barCount:before{content:"38%"}.webpLoader__barProgress[data-percent="39"] .webpLoader__barCount:before{content:"39%"}.webpLoader__barProgress[data-percent="40"] .webpLoader__barCount:before{content:"40%"}.webpLoader__barProgress[data-percent="41"] .webpLoader__barCount:before{content:"41%"}.webpLoader__barProgress[data-percent="42"] .webpLoader__barCount:before{content:"42%"}.webpLoader__barProgress[data-percent="43"] .webpLoader__barCount:before{content:"43%"}.webpLoader__barProgress[data-percent="44"] .webpLoader__barCount:before{content:"44%"}.webpLoader__barProgress[data-percent="45"] .webpLoader__barCount:before{content:"45%"}.webpLoader__barProgress[data-percent="46"] .webpLoader__barCount:before{content:"46%"}.webpLoader__barProgress[data-percent="47"] .webpLoader__barCount:before{content:"47%"}.webpLoader__barProgress[data-percent="48"] .webpLoader__barCount:before{content:"48%"}.webpLoader__barProgress[data-percent="49"] .webpLoader__barCount:before{content:"49%"}.webpLoader__barProgress[data-percent="50"] .webpLoader__barCount:before{content:"50%"}.webpLoader__barProgress[data-percent="51"] .webpLoader__barCount:before{content:"51%"}.webpLoader__barProgress[data-percent="52"] .webpLoader__barCount:before{content:"52%"}.webpLoader__barProgress[data-percent="53"] .webpLoader__barCount:before{content:"53%"}.webpLoader__barProgress[data-percent="54"] .webpLoader__barCount:before{content:"54%"}.webpLoader__barProgress[data-percent="55"] .webpLoader__barCount:before{content:"55%"}.webpLoader__barProgress[data-percent="56"] .webpLoader__barCount:before{content:"56%"}.webpLoader__barProgress[data-percent="57"] .webpLoader__barCount:before{content:"57%"}.webpLoader__barProgress[data-percent="58"] .webpLoader__barCount:before{content:"58%"}.webpLoader__barProgress[data-percent="59"] .webpLoader__barCount:before{content:"59%"}.webpLoader__barProgress[data-percent="60"] .webpLoader__barCount:before{content:"60%"}.webpLoader__barProgress[data-percent="61"] .webpLoader__barCount:before{content:"61%"}.webpLoader__barProgress[data-percent="62"] .webpLoader__barCount:before{content:"62%"}.webpLoader__barProgress[data-percent="63"] .webpLoader__barCount:before{content:"63%"}.webpLoader__barProgress[data-percent="64"] .webpLoader__barCount:before{content:"64%"}.webpLoader__barProgress[data-percent="65"] .webpLoader__barCount:before{content:"65%"}.webpLoader__barProgress[data-percent="66"] .webpLoader__barCount:before{content:"66%"}.webpLoader__barProgress[data-percent="67"] .webpLoader__barCount:before{content:"67%"}.webpLoader__barProgress[data-percent="68"] .webpLoader__barCount:before{content:"68%"}.webpLoader__barProgress[data-percent="69"] .webpLoader__barCount:before{content:"69%"}.webpLoader__barProgress[data-percent="70"] .webpLoader__barCount:before{content:"70%"}.webpLoader__barProgress[data-percent="71"] .webpLoader__barCount:before{content:"71%"}.webpLoader__barProgress[data-percent="72"] .webpLoader__barCount:before{content:"72%"}.webpLoader__barProgress[data-percent="73"] .webpLoader__barCount:before{content:"73%"}.webpLoader__barProgress[data-percent="74"] .webpLoader__barCount:before{content:"74%"}.webpLoader__barProgress[data-percent="75"] .webpLoader__barCount:before{content:"75%"}.webpLoader__barProgress[data-percent="76"] .webpLoader__barCount:before{content:"76%"}.webpLoader__barProgress[data-percent="77"] .webpLoader__barCount:before{content:"77%"}.webpLoader__barProgress[data-percent="78"] .webpLoader__barCount:before{content:"78%"}.webpLoader__barProgress[data-percent="79"] .webpLoader__barCount:before{content:"79%"}.webpLoader__barProgress[data-percent="80"] .webpLoader__barCount:before{content:"80%"}.webpLoader__barProgress[data-percent="81"] .webpLoader__barCount:before{content:"81%"}.webpLoader__barProgress[data-percent="82"] .webpLoader__barCount:before{content:"82%"}.webpLoader__barProgress[data-percent="83"] .webpLoader__barCount:before{content:"83%"}.webpLoader__barProgress[data-percent="84"] .webpLoader__barCount:before{content:"84%"}.webpLoader__barProgress[data-percent="85"] .webpLoader__barCount:before{content:"85%"}.webpLoader__barProgress[data-percent="86"] .webpLoader__barCount:before{content:"86%"}.webpLoader__barProgress[data-percent="87"] .webpLoader__barCount:before{content:"87%"}.webpLoader__barProgress[data-percent="88"] .webpLoader__barCount:before{content:"88%"}.webpLoader__barProgress[data-percent="89"] .webpLoader__barCount:before{content:"89%"}.webpLoader__barProgress[data-percent="90"] .webpLoader__barCount:before{content:"90%"}.webpLoader__barProgress[data-percent="91"] .webpLoader__barCount:before{content:"91%"}.webpLoader__barProgress[data-percent="92"] .webpLoader__barCount:before{content:"92%"}.webpLoader__barProgress[data-percent="93"] .webpLoader__barCount:before{content:"93%"}.webpLoader__barProgress[data-percent="94"] .webpLoader__barCount:before{content:"94%"}.webpLoader__barProgress[data-percent="95"] .webpLoader__barCount:before{content:"95%"}.webpLoader__barProgress[data-percent="96"] .webpLoader__barCount:before{content:"96%"}.webpLoader__barProgress[data-percent="97"] .webpLoader__barCount:before{content:"97%"}.webpLoader__barProgress[data-percent="98"] .webpLoader__barCount:before{content:"98%"}.webpLoader__barProgress[data-percent="99"] .webpLoader__barCount:before{content:"99%"}.webpLoader__barProgress[data-percent="100"] .webpLoader__barCount:before{content:"100%"}.webpLoader__size{font-size:14px;line-height:1.5714285714;margin-bottom:-10px;padding:4px 0}.webpLoader__sizeProgress{font-weight:500}.webpLoader__success{margin-top:20px;padding:4px 0 4px 20px;position:relative}.webpLoader__success:before{background-color:#46b450;content:"";height:100%;left:0;position:absolute;top:0;width:2px}.webpLoader__successContent{color:#46b450;font-size:14px;font-weight:500;line-height:1.5714285714}.webpLoader__successContent a{color:inherit}.webpLoader__errors{border-left:2px solid #a0a5aa;margin-top:20px}.webpLoader__errorsTitle{background-color:#a0a5aa;color:#fff;display:inline-block;font-size:14px;line-height:1.5714285714;padding:4px 22px}.webpLoader__errorsContent{padding:10px 0 10px 20px}.webpLoader__errorsContent>p{font-size:12px;line-height:1.75;margin:0;max-width:100%}.webpLoader__errorsContent>p.webpLoader__errorsContentError{color:#dc3232;font-size:14px;font-weight:500;line-height:1.5714285714}.webpLoader__errorsContent pre{font-size:12px;line-height:1.75;white-space:normal}.webpLoader__button--disabled{opacity:.25!important;pointer-events:none}.webpPopup{margin-top:20px}.webpPopup__inner{background-color:#fff;display:flex;flex-wrap:wrap}.webpPopup__image{background-image:url(../../img/author.jpg);background-position:50%;background-repeat:no-repeat;background-size:cover;width:152px}.webpPopup__content{border:1px solid #a0a5aa;border-left:0;flex:1;padding:10px 20px}.webpServerInfo{color:#222;text-align:center}.webpServerInfo pre{font-family:monospace;margin:0}.webpServerInfo h1,.webpServerInfo h2{display:none}.webpServerInfo p{max-width:100%}.webpServerInfo table{border:0;border-collapse:collapse;margin:10px auto;width:100%}.webpServerInfo td,.webpServerInfo th{border:1px solid #666;font-size:12px;line-height:1.75;padding:4px 5px;text-align:center;vertical-align:baseline}.webpServerInfo .p{text-align:left}.webpServerInfo .e{background-color:#ccf;font-weight:700;width:300px}.webpServerInfo .h{background-color:#99c;font-weight:700}.webpServerInfo .v{word-wrap:break-word;background-color:#ddd;max-width:300px;overflow-x:auto}.webpServerInfo .v i{color:#999}.webpServerInfo img{border:0;float:right}@media screen and (max-width:1024px){.webpPage__column--large{width:100%}.webpPage__column--small{margin-top:40px;width:100%}.webpPage__widget+.webpPage__widget{margin-top:40px}.webpPage__widgetColumns{display:block}.webpPage__widgetColumn{width:100%}}@media screen and (max-width:782px){.webpModal__button{width:100%}.webpPage{padding-right:0}.webpPage__quality{display:block}.webpPage__qualityItem{border-left:0}.webpPage__qualityItem+.webpPage__qualityItem{border-top:1px solid #a0a5aa}.webpInput{display:block}.webpInput__field{width:100%}.webpInput__button{margin:10px 0 0!important}.webpPopup__inner{border:1px solid #a0a5aa;display:block}.webpPopup__image{height:152px;margin:20px auto 0}.webpPopup__content{border:0}}
|
assets/build/js/scripts.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){var e,t={669:function(e,t,r){e.exports=r(609)},448:function(e,t,r){"use strict";var n=r(867),o=r(26),s=r(372),i=r(327),a=r(97),u=r(109),c=r(985),f=r(61);e.exports=function(e){return new Promise((function(t,r){var l=e.data,h=e.headers,d=e.responseType;n.isFormData(l)&&delete h["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",v=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(m+":"+v)}var _=a(e.baseURL,e.url);function g(){if(p){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,s={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,r,s),p=null}}if(p.open(e.method.toUpperCase(),i(_,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(r(f("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(f("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(f(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var b=(e.withCredentials||c(_))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;b&&(h[e.xsrfHeaderName]=b)}"setRequestHeader"in p&&n.forEach(h,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete h[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),d&&"json"!==d&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),l||(l=null),p.send(l)}))}},609:function(e,t,r){"use strict";var n=r(867),o=r(849),s=r(321),i=r(185);function a(e){var t=new s(e),r=o(s.prototype.request,t);return n.extend(r,s.prototype,t),n.extend(r,t),r}var u=a(r(655));u.Axios=s,u.create=function(e){return a(i(u.defaults,e))},u.Cancel=r(263),u.CancelToken=r(972),u.isCancel=r(502),u.all=function(e){return Promise.all(e)},u.spread=r(713),u.isAxiosError=r(268),e.exports=u,e.exports.default=u},263:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:function(e,t,r){"use strict";var n=r(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:function(e,t,r){"use strict";var n=r(867),o=r(327),s=r(782),i=r(572),a=r(185),u=r(875),c=u.validators;function f(e){this.defaults=e,this.interceptors={request:new s,response:new s}}f.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!n){var f=[i,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(s),o=Promise.resolve(e);f.length;)o=o.then(f.shift(),f.shift());return o}for(var l=e;r.length;){var h=r.shift(),d=r.shift();try{l=h(l)}catch(e){d(e);break}}try{o=i(l)}catch(e){return Promise.reject(e)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},f.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){f.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){f.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=f},782:function(e,t,r){"use strict";var n=r(867);function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:function(e,t,r){"use strict";var n=r(793),o=r(303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},61:function(e,t,r){"use strict";var n=r(481);e.exports=function(e,t,r,o,s){var i=new Error(e);return n(i,t,r,o,s)}},572:function(e,t,r){"use strict";var n=r(867),o=r(527),s=r(502),i=r(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return a(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(a(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:function(e){"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:function(e,t,r){"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],s=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(s,c),n.forEach(i,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(void 0,t[o])})),n.forEach(a,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var f=o.concat(s).concat(i).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===f.indexOf(e)}));return n.forEach(l,c),r}},26:function(e,t,r){"use strict";var n=r(61);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:function(e,t,r){"use strict";var n=r(867),o=r(655);e.exports=function(e,t,r){var s=this||o;return n.forEach(r,(function(r){e=r.call(s,e,t)})),e}},655:function(e,t,r){"use strict";var n=r(155),o=r(867),s=r(16),i=r(481),a={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,f={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==n&&"[object process]"===Object.prototype.toString.call(n))&&(c=r(448)),c),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)||t&&"application/json"===t["Content-Type"]?(u(t,"application/json"),function(e,t,r){if(o.isString(e))try{return(t||JSON.parse)(e),o.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||n&&o.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};f.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){f.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){f.headers[e]=o.merge(a)})),e.exports=f},849:function(e){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:function(e,t,r){"use strict";var n=r(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(n.isURLSearchParams(t))s=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},303:function(e){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:function(e,t,r){"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:function(e){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:function(e){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:function(e,t,r){"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:function(e,t,r){"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:function(e,t,r){"use strict";var n=r(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,i={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:function(e,t,r){"use strict";var n=r(593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var s={},i=n.version.split(".");function a(e,t){for(var r=t?t.split("."):i,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&a(t);return function(i,a,u){if(!1===e)throw new Error(function(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(a," has been removed in "+t));return o&&!s[a]&&(s[a]=!0),!e||e(i,a,u)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],i=t[s];if(i){var a=e[s],u=void 0===a||i(a,s,e);if(!0!==u)throw new TypeError("option "+s+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:o}},867:function(e,t,r){"use strict";var n=r(849),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function i(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):s(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)f(arguments[n],r);return t},extend:function(e,t,r){return f(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},70:function(e,t,r){"use strict";var n=r(669),o=r.n(n);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.button_open=document.querySelector('[data-slug="webp-converter-for-media"] a[href*="action=deactivate"]'),this.modal=document.querySelector(".webpModal"),this.button_open&&this.modal)return this.outer=this.modal.querySelector(".webpModal__outer"),this.form=this.outer.querySelector(".webpModal__form"),this.form_options=this.form.querySelectorAll('[name="webpc_reason"]'),this.form_comment=this.form.querySelector('[name="webpc_comment"]'),this.button_submit=this.form.querySelector('button[type="submit"]'),this.button_cancel=this.form.querySelector('button[type="button"]'),this.events={open_modal:this.open_modal.bind(this)},this.atts={option_placeholder:"data-placeholder"},this.status={is_sent:!1},!0}},{key:"set_events",value:function(){var e=this;this.button_open.addEventListener("click",this.events.open_modal),this.button_submit.addEventListener("click",this.submit_form.bind(this)),this.button_cancel.addEventListener("click",this.cancel_form.bind(this)),this.outer.addEventListener("click",this.close_modal.bind(this)),this.form.addEventListener("click",(function(e){e.stopPropagation()}));for(var t=this.form_options.length,r=function(t){e.form_options[t].addEventListener("change",(function(){e.set_current_option(t)}))},n=0;n<t;n++)r(n)}},{key:"open_modal",value:function(e){e.preventDefault(),this.button_open.removeEventListener("click",this.events.open_modal),this.modal.removeAttribute("hidden")}},{key:"close_modal",value:function(){this.modal.setAttribute("hidden","hidden")}},{key:"submit_form",value:function(e){var t=this;e.preventDefault(),this.close_modal(),this.status.is_sent||(this.status.is_sent=!0,setTimeout((function(){t.send_request(),t.button_open.click()}),0))}},{key:"send_request",value:function(){var e=new FormData(this.form),t=this.form.getAttribute("action");o()({method:"POST",url:t,data:e})}},{key:"cancel_form",value:function(e){var t=this;e.preventDefault(),this.close_modal(),setTimeout((function(){t.button_open.click()}),0)}},{key:"set_current_option",value:function(e){this.form_comment.value="";var t=this.form_options[e].getAttribute(this.atts.option_placeholder);this.form_comment.setAttribute("placeholder",t)}}])&&s(t.prototype,r),n&&s(t,n),e}();function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.notice=document.querySelector('.notice[data-notice="webp-converter-for-media"]'),this.notice)return this.settings={ajax_url:this.notice.getAttribute("data-url"),ajax_action:"webpc_notice",button_close_class:".notice-dismiss",button_hide_class:"[data-permanently]"},this.events={click_on_close:this.click_on_close.bind(this)},!0}},{key:"set_events",value:function(){this.notice.addEventListener("click",this.events.click_on_close)}},{key:"click_on_close",value:function(e){var t=this.settings,r=t.button_close_class,n=t.button_hide_class;this.notice.removeEventListener("click",this.events.click_on_close),e.target.matches(r)?this.hide_notice(!1):e.target.matches(n)&&this.hide_notice(!0)}},{key:"hide_notice",value:function(e){var t=this.settings.button_close_class;this.send_request(e),e&&this.notice.querySelector(t).click()}},{key:"send_request",value:function(e){var t=this.settings.ajax_url;o()({method:"POST",url:t,data:this.get_data_for_request(e)})}},{key:"get_data_for_request",value:function(e){var t=this.settings.ajax_action,r=new FormData;return r.append("action",t),r.append("is_permanently",e?1:0),r}}])&&a(t.prototype,r),n&&a(t,n),e}();function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.section=document.querySelector(".webpLoader"),this.section)return this.wrapper=this.section.querySelector(".webpLoader__status"),this.progress=this.wrapper.querySelector(".webpLoader__barProgress"),this.progress_size=this.section.querySelector(".webpLoader__sizeProgress"),this.errors=this.section.querySelector(".webpLoader__errors"),this.errors_inner=this.errors.querySelector(".webpLoader__errorsContent"),this.success=this.section.querySelector(".webpLoader__success"),this.success_popup=this.section.querySelector(".webpLoader__popup"),this.option_force=this.section.querySelector('input[name="regenerate_force"]'),this.button=this.section.querySelector(".webpLoader__button"),this.data={count:0,max:0,items:[],size:{before:0,after:0},errors:[]},this.settings={is_disabled:!1,ajax:{url_paths:this.section.getAttribute("data-api-paths"),url_regenerate:this.section.getAttribute("data-api-regenerate"),error_message:this.section.getAttribute("data-api-error-message")},units:["kB","MB","GB"]},this.atts={progress:"data-percent"},this.classes={progress_error:"webpLoader__barProgress--error",button_disabled:"webpLoader__button--disabled",error_message:"webpLoader__errorsContentError"},!0}},{key:"set_events",value:function(){this.button.addEventListener("click",this.init_regeneration.bind(this))}},{key:"init_regeneration",value:function(e){e.preventDefault(),this.settings.is_disabled||(this.settings.is_disabled=!0,this.button.classList.add(this.classes.button_disabled),this.option_force.setAttribute("disabled","disabled"),this.wrapper.removeAttribute("hidden"),this.send_request_for_paths())}},{key:"send_request_for_paths",value:function(){var e=this,t=this.settings.ajax.url_paths;o()({method:"POST",url:t,data:this.get_data_for_paths_request()}).then((function(t){e.data.items=t.data,e.data.max=t.data.length,e.regenerate_next_images()})).catch((function(t){e.catch_request_error(t,!0)}))}},{key:"get_data_for_paths_request",value:function(){var e=new FormData;return e.append("regenerate_force",this.option_force.checked?1:0),e}},{key:"regenerate_next_images",value:function(){if(0===this.data.max&&this.update_progress(),!(this.data.count>=this.data.max)){var e=this.data.items[this.data.count];this.data.count++,this.send_request_for_regeneration(e)}}},{key:"send_request_for_regeneration",value:function(e){var t=this,r=this.settings.ajax.url_regenerate;o()({method:"POST",url:r,data:{paths:e}}).then((function(e){var r=e.data.is_fatal_error;t.update_errors(e.data.errors,r),r||(t.update_size(e.data.size.before,e.data.size.after),t.update_progress(),t.regenerate_next_images())})).catch((function(r){t.catch_request_error(r,!1,e),t.regenerate_next_images()}))}},{key:"update_errors",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0;r<e.length;r++)this.print_error_message(e[r],t);t&&this.set_fatal_error()}},{key:"set_fatal_error",value:function(){this.progress.classList.add(this.classes.progress_error)}},{key:"catch_request_error",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t&&(this.print_error_message([this.settings.ajax.error_message],!0),this.set_fatal_error());var n=null!==r?'["'.concat(r.join('", "'),'"]'):"";this.print_error_message("".concat(e.response.status," - ").concat(e.response.statusText," (").concat(e.response.config.url,") ").concat(n),!0,!0)}},{key:"print_error_message",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("p");if(r){var o=document.createElement("pre");o.innerText=e,n.appendChild(o)}else n.innerHTML=e;t&&n.classList.add(this.classes.error_message),this.errors.removeAttribute("hidden"),this.errors_inner.appendChild(n)}},{key:"update_size",value:function(e,t){var r=this.data.size;r.before+=e,r.after+=t;var n=r.before-r.after;if(n<0&&(n=0),0!==n){var o=Math.round(100*(1-r.after/r.before));o<0&&(o=0);var s=-1;do{s++,n/=1024}while(n>1024);var i=n.toFixed(2),a=this.settings.units[s];this.progress_size.innerHTML="".concat(i," ").concat(a," (").concat(o,"%)")}}},{key:"update_progress",value:function(){var e=this.data.max>0?Math.floor(this.data.count/this.data.max*100):100;e>100&&(e=100),100===e&&(this.success.removeAttribute("hidden"),this.success_popup&&this.success_popup.removeAttribute("hidden")),this.progress.setAttribute(this.atts.progress,e.toString())}}])&&c(t.prototype,r),n&&c(t,n),e}();new function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new i,new u,new f}},694:function(){},155:function(e){var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],c=!1,f=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):f=-1,u.length&&h())}function h(){if(!c){var e=i(l);c=!0;for(var t=u.length;t;){for(a=u,u=[];++f<t;)a&&a[f].run();f=-1,t=u.length}a=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||c||i(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},593:function(e){"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.m=t,e=[],n.O=function(t,r,o,s){if(!r){var i=1/0;for(f=0;f<e.length;f++){r=e[f][0],o=e[f][1],s=e[f][2];for(var a=!0,u=0;u<r.length;u++)(!1&s||i>=s)&&Object.keys(n.O).every((function(e){return n.O[e](r[u])}))?r.splice(u--,1):(a=!1,s<i&&(i=s));if(a){e.splice(f--,1);var c=o();void 0!==c&&(t=c)}}return t}s=s||0;for(var f=e.length;f>0&&e[f-1][2]>s;f--)e[f]=e[f-1];e[f]=[r,o,s]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={794:0,505:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,s,i=r[0],a=r[1],u=r[2],c=0;if(i.some((function(t){return 0!==e[t]}))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var f=u(n)}for(t&&t(r);c<i.length;c++)s=i[c],n.o(e,s)&&e[s]&&e[s][0](),e[i[c]]=0;return n.O(f)},r=self.webpackChunkwebp_converter_for_media=self.webpackChunkwebp_converter_for_media||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),n.O(void 0,[505],(function(){return n(70)}));var o=n.O(void 0,[505],(function(){return n(694)}));o=n.O(o)}();
|
1 |
+
!function(){var e,t={669:function(e,t,r){e.exports=r(609)},448:function(e,t,r){"use strict";var n=r(867),o=r(26),i=r(372),s=r(327),a=r(97),u=r(109),c=r(985),f=r(61);e.exports=function(e){return new Promise((function(t,r){var l=e.data,h=e.headers,d=e.responseType;n.isFormData(l)&&delete h["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",v=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(m+":"+v)}var g=a(e.baseURL,e.url);function _(){if(p){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,i={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,r,i),p=null}}if(p.open(e.method.toUpperCase(),s(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=_:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(_)},p.onabort=function(){p&&(r(f("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(f("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(f(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var b=(e.withCredentials||c(g))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;b&&(h[e.xsrfHeaderName]=b)}"setRequestHeader"in p&&n.forEach(h,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete h[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),d&&"json"!==d&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),l||(l=null),p.send(l)}))}},609:function(e,t,r){"use strict";var n=r(867),o=r(849),i=r(321),s=r(185);function a(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var u=a(r(655));u.Axios=i,u.create=function(e){return a(s(u.defaults,e))},u.Cancel=r(263),u.CancelToken=r(972),u.isCancel=r(502),u.all=function(e){return Promise.all(e)},u.spread=r(713),u.isAxiosError=r(268),e.exports=u,e.exports.default=u},263:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:function(e,t,r){"use strict";var n=r(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:function(e,t,r){"use strict";var n=r(867),o=r(327),i=r(782),s=r(572),a=r(185),u=r(875),c=u.validators;function f(e){this.defaults=e,this.interceptors={request:new i,response:new i}}f.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!n){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(i),o=Promise.resolve(e);f.length;)o=o.then(f.shift(),f.shift());return o}for(var l=e;r.length;){var h=r.shift(),d=r.shift();try{l=h(l)}catch(e){d(e);break}}try{o=s(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},f.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){f.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){f.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=f},782:function(e,t,r){"use strict";var n=r(867);function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:function(e,t,r){"use strict";var n=r(793),o=r(303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},61:function(e,t,r){"use strict";var n=r(481);e.exports=function(e,t,r,o,i){var s=new Error(e);return n(s,t,r,o,i)}},572:function(e,t,r){"use strict";var n=r(867),o=r(527),i=r(502),s=r(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:function(e){"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:function(e,t,r){"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(i,c),n.forEach(s,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(void 0,t[o])})),n.forEach(a,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var f=o.concat(i).concat(s).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===f.indexOf(e)}));return n.forEach(l,c),r}},26:function(e,t,r){"use strict";var n=r(61);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:function(e,t,r){"use strict";var n=r(867),o=r(655);e.exports=function(e,t,r){var i=this||o;return n.forEach(r,(function(r){e=r.call(i,e,t)})),e}},655:function(e,t,r){"use strict";var n=r(155),o=r(867),i=r(16),s=r(481),a={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,f={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==n&&"[object process]"===Object.prototype.toString.call(n))&&(c=r(448)),c),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)||t&&"application/json"===t["Content-Type"]?(u(t,"application/json"),function(e,t,r){if(o.isString(e))try{return(t||JSON.parse)(e),o.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&o.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw s(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};f.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){f.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){f.headers[e]=o.merge(a)})),e.exports=f},849:function(e){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:function(e,t,r){"use strict";var n=r(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},303:function(e){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:function(e,t,r){"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:function(e){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:function(e){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:function(e,t,r){"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:function(e,t,r){"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:function(e,t,r){"use strict";var n=r(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,i,s={};return e?(n.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:function(e,t,r){"use strict";var n=r(593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var i={},s=n.version.split(".");function a(e,t){for(var r=t?t.split("."):s,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&a(t);return function(s,a,u){if(!1===e)throw new Error(function(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(a," has been removed in "+t));return o&&!i[a]&&(i[a]=!0),!e||e(s,a,u)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],s=t[i];if(s){var a=e[i],u=void 0===a||s(a,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:o}},867:function(e,t,r){"use strict";var n=r(849),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,isUndefined:s,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):i(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)f(arguments[n],r);return t},extend:function(e,t,r){return f(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},80:function(e,t,r){"use strict";var n=r(669),o=r.n(n);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.section=document.querySelector("[data-calculate-widget]"),this.section)return this.button=this.section.querySelector("[data-calculate-widget-button]"),this.loading=this.section.querySelector("[data-calculate-widget-loading]"),this.output=this.section.querySelector("[data-calculate-widget-output]"),this.settings={ajax:{url_calculation:this.section.getAttribute("data-calculate-widget-api")}},!0}},{key:"set_events",value:function(){this.button.addEventListener("click",this.init_calculation.bind(this))}},{key:"init_calculation",value:function(e){e.preventDefault(),this.button.setAttribute("hidden","hidden"),this.loading.removeAttribute("hidden"),this.send_request_for_calculation()}},{key:"send_request_for_calculation",value:function(){var e=this,t=this.settings.ajax.url_calculation;o()({method:"POST",url:t}).then((function(t){e.loading.setAttribute("hidden","hidden"),e.output.innerText=t.data.value_output,e.output.removeAttribute("hidden","hidden")})).catch((function(t){e.button.removeAttribute("hidden"),e.loading.setAttribute("hidden","hidden")}))}}])&&i(t.prototype,r),n&&i(t,n),e}();function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.button_open=document.querySelector('[data-slug="webp-converter-for-media"] a[href*="action=deactivate"]'),this.modal=document.querySelector(".webpModal"),this.button_open&&this.modal)return this.outer=this.modal.querySelector(".webpModal__outer"),this.form=this.outer.querySelector(".webpModal__form"),this.form_options=this.form.querySelectorAll('[name="webpc_reason"]'),this.form_comment=this.form.querySelector('[name="webpc_comment"]'),this.button_submit=this.form.querySelector('button[type="submit"]'),this.button_cancel=this.form.querySelector('button[type="button"]'),this.events={open_modal:this.open_modal.bind(this)},this.atts={option_placeholder:"data-placeholder"},this.status={is_sent:!1},!0}},{key:"set_events",value:function(){var e=this;this.button_open.addEventListener("click",this.events.open_modal),this.button_submit.addEventListener("click",this.submit_form.bind(this)),this.button_cancel.addEventListener("click",this.cancel_form.bind(this)),this.outer.addEventListener("click",this.close_modal.bind(this)),this.form.addEventListener("click",(function(e){e.stopPropagation()}));for(var t=this.form_options.length,r=function(t){e.form_options[t].addEventListener("change",(function(){e.set_current_option(t)}))},n=0;n<t;n++)r(n)}},{key:"open_modal",value:function(e){e.preventDefault(),this.button_open.removeEventListener("click",this.events.open_modal),this.modal.removeAttribute("hidden")}},{key:"close_modal",value:function(){this.modal.setAttribute("hidden","hidden")}},{key:"submit_form",value:function(e){var t=this;e.preventDefault(),this.close_modal(),this.status.is_sent||(this.status.is_sent=!0,setTimeout((function(){t.send_request(),t.button_open.click()}),0))}},{key:"send_request",value:function(){var e=new FormData(this.form),t=this.form.getAttribute("action");o()({method:"POST",url:t,data:e})}},{key:"cancel_form",value:function(e){var t=this;e.preventDefault(),this.close_modal(),setTimeout((function(){t.button_open.click()}),0)}},{key:"set_current_option",value:function(e){this.form_comment.value="";var t=this.form_options[e].getAttribute(this.atts.option_placeholder);this.form_comment.setAttribute("placeholder",t)}}])&&a(t.prototype,r),n&&a(t,n),e}();function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.notice=document.querySelector('.notice[data-notice="webp-converter-for-media"]'),this.notice)return this.settings={ajax_url:this.notice.getAttribute("data-url"),ajax_action:"webpc_notice",button_close_class:".notice-dismiss",button_hide_class:"[data-permanently]"},this.events={click_on_close:this.click_on_close.bind(this)},!0}},{key:"set_events",value:function(){this.notice.addEventListener("click",this.events.click_on_close)}},{key:"click_on_close",value:function(e){var t=this.settings,r=t.button_close_class,n=t.button_hide_class;this.notice.removeEventListener("click",this.events.click_on_close),e.target.matches(r)?this.hide_notice(!1):e.target.matches(n)&&this.hide_notice(!0)}},{key:"hide_notice",value:function(e){var t=this.settings.button_close_class;this.send_request(e),e&&this.notice.querySelector(t).click()}},{key:"send_request",value:function(e){var t=this.settings.ajax_url;o()({method:"POST",url:t,data:this.get_data_for_request(e)})}},{key:"get_data_for_request",value:function(e){var t=this.settings.ajax_action,r=new FormData;return r.append("action",t),r.append("is_permanently",e?1:0),r}}])&&c(t.prototype,r),n&&c(t,n),e}();function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.set_vars()&&this.set_events()}var t,r,n;return t=e,(r=[{key:"set_vars",value:function(){if(this.section=document.querySelector(".webpLoader"),this.section)return this.wrapper=this.section.querySelector(".webpLoader__status"),this.progress=this.wrapper.querySelector(".webpLoader__barProgress"),this.progress_size=this.section.querySelector(".webpLoader__sizeProgress"),this.errors=this.section.querySelector(".webpLoader__errors"),this.errors_inner=this.errors.querySelector(".webpLoader__errorsContent"),this.success=this.section.querySelector(".webpLoader__success"),this.success_popup=this.section.querySelector(".webpLoader__popup"),this.option_force=this.section.querySelector('input[name="regenerate_force"]'),this.button=this.section.querySelector(".webpLoader__button"),this.data={count:0,max:0,items:[],size:{before:0,after:0},errors:[]},this.settings={is_disabled:!1,ajax:{url_paths:this.section.getAttribute("data-api-paths"),url_regenerate:this.section.getAttribute("data-api-regenerate"),error_message:this.section.getAttribute("data-api-error-message")},units:["kB","MB","GB"]},this.atts={progress:"data-percent"},this.classes={progress_error:"webpLoader__barProgress--error",button_disabled:"webpLoader__button--disabled",error_message:"webpLoader__errorsContentError"},!0}},{key:"set_events",value:function(){this.button.addEventListener("click",this.init_regeneration.bind(this))}},{key:"init_regeneration",value:function(e){e.preventDefault(),this.settings.is_disabled||(this.settings.is_disabled=!0,this.button.classList.add(this.classes.button_disabled),this.option_force.setAttribute("disabled","disabled"),this.wrapper.removeAttribute("hidden"),this.send_request_for_paths())}},{key:"send_request_for_paths",value:function(){var e=this,t=this.settings.ajax.url_paths;o()({method:"POST",url:t,data:{regenerate_force:this.option_force.checked?1:0}}).then((function(t){e.data.items=t.data,e.data.max=t.data.length,e.regenerate_next_images()})).catch((function(t){e.catch_request_error(t,!0)}))}},{key:"regenerate_next_images",value:function(){if(0===this.data.max&&this.update_progress(),!(this.data.count>=this.data.max)){var e=this.data.items[this.data.count];this.data.count++,this.send_request_for_regeneration(e)}}},{key:"send_request_for_regeneration",value:function(e){var t=this,r=this.settings.ajax.url_regenerate;o()({method:"POST",url:r,data:{regenerate_force:this.option_force.checked?1:0,paths:e}}).then((function(e){var r=e.data.is_fatal_error;t.update_errors(e.data.errors,r),r||(t.update_size(e.data.size.before,e.data.size.after),t.update_progress(),t.regenerate_next_images())})).catch((function(r){t.catch_request_error(r,!1,e),t.regenerate_next_images()}))}},{key:"update_errors",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0;r<e.length;r++)this.print_error_message(e[r],t);t&&this.set_fatal_error()}},{key:"set_fatal_error",value:function(){this.progress.classList.add(this.classes.progress_error)}},{key:"catch_request_error",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t&&(this.print_error_message([this.settings.ajax.error_message],!0),this.set_fatal_error());var n=null!==r?'["'.concat(r.join('", "'),'"]'):"";this.print_error_message("".concat(e.response.status," - ").concat(e.response.statusText," (").concat(e.response.config.url,") ").concat(n),!0,!0)}},{key:"print_error_message",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("p");if(r){var o=document.createElement("pre");o.innerText=e,n.appendChild(o)}else n.innerHTML=e;t&&n.classList.add(this.classes.error_message),this.errors.removeAttribute("hidden"),this.errors_inner.appendChild(n)}},{key:"update_size",value:function(e,t){var r=this.data.size;r.before+=e,r.after+=t;var n=r.before-r.after;if(n<0&&(n=0),0!==n){var o=Math.round(100*(1-r.after/r.before));o<0&&(o=0);var i=-1;do{i++,n/=1024}while(n>1024);var s=n.toFixed(2),a=this.settings.units[i];this.progress_size.innerHTML="".concat(s," ").concat(a," (").concat(o,"%)")}}},{key:"update_progress",value:function(){var e=this.data.max>0?Math.floor(this.data.count/this.data.max*100):100;e>100&&(e=100),100===e&&(this.success.removeAttribute("hidden"),this.success_popup&&this.success_popup.removeAttribute("hidden")),this.progress.setAttribute(this.atts.progress,e.toString())}}])&&l(t.prototype,r),n&&l(t,n),e}();new function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new u,new f,new h,new s}},694:function(){},155:function(e){var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,u=[],c=!1,f=-1;function l(){c&&a&&(c=!1,a.length?u=a.concat(u):f=-1,u.length&&h())}function h(){if(!c){var e=s(l);c=!0;for(var t=u.length;t;){for(a=u,u=[];++f<t;)a&&a[f].run();f=-1,t=u.length}a=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||c||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},593:function(e){"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=function(t,r,o,i){if(!r){var s=1/0;for(f=0;f<e.length;f++){r=e[f][0],o=e[f][1],i=e[f][2];for(var a=!0,u=0;u<r.length;u++)(!1&i||s>=i)&&Object.keys(n.O).every((function(e){return n.O[e](r[u])}))?r.splice(u--,1):(a=!1,i<s&&(s=i));if(a){e.splice(f--,1);var c=o();void 0!==c&&(t=c)}}return t}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[r,o,i]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={794:0,505:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,i,s=r[0],a=r[1],u=r[2],c=0;if(s.some((function(t){return 0!==e[t]}))){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(u)var f=u(n)}for(t&&t(r);c<s.length;c++)i=s[c],n.o(e,i)&&e[i]&&e[i][0](),e[s[c]]=0;return n.O(f)},r=self.webpackChunkwebp_converter_for_media=self.webpackChunkwebp_converter_for_media||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),n.O(void 0,[505],(function(){return n(80)}));var o=n.O(void 0,[505],(function(){return n(694)}));o=n.O(o)}();
|
changelog.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
= 3.2.4 (2021-11-21) =
|
4 |
* `[Fixed]` Automatic image conversion when /uploads directory is not organized into monthly and yearly folders
|
5 |
* `[Fixed]` Displaying errors when converting images
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 4.0.0 (2021-12-04) =
|
4 |
+
* `[Added]` Converting images using remote server
|
5 |
+
* `[Added]` Converting images to AVIF format
|
6 |
+
* `[Added]` Error detection for invalid permalinks structure
|
7 |
+
|
8 |
= 3.2.4 (2021-11-21) =
|
9 |
* `[Fixed]` Automatic image conversion when /uploads directory is not organized into monthly and yearly folders
|
10 |
* `[Fixed]` Displaying errors when converting images
|
readme.txt
CHANGED
@@ -21,6 +21,10 @@ As of today, over 90% of users use browsers that support the WebP format. The lo
|
|
21 |
|
22 |
This will be a profit both for your users who will not have to download so much data, but also for a server that will be less loaded. Remember that a better optimized website also affects your Google ranking.
|
23 |
|
|
|
|
|
|
|
|
|
24 |
#### How does this work?
|
25 |
|
26 |
- If you have just installed the plugin, you can optimize images with one click.
|
@@ -104,7 +108,7 @@ If you get an error: `File "%s" is unreadable. Please check file permissions.` m
|
|
104 |
|
105 |
If you get an error: `"%s" is not a valid image file.` means that the file is damaged in some way. Download the file to disk, save it again using any graphics program and add again to the page. If the error applies to individual images then you can ignore it - just the original images will load, not WebP.
|
106 |
|
107 |
-
If you get an error: `"%s" converted to
|
108 |
|
109 |
In the case of the above problems, **contacting the support forum will be useless**. Unfortunately, we are unable to help you if your files are damaged. You have to fix it yourself. If you have previously used other tools that changed the original files and damaged them, you will do nothing more.
|
110 |
|
@@ -153,7 +157,7 @@ If the converted image in WebP format is larger than the original, the browser w
|
|
153 |
|
154 |
When such a situation occurs, a file in `.webp.deleted` format will be created. This avoids re-converting images that were larger than original after converting to WebP. If the option of forced conversion of all images is checked, this image will also be re-converted.
|
155 |
|
156 |
-
If you want to force the use of WebP files, uncheck the `Automatic removal of
|
157 |
|
158 |
Remember that this plugin supports images from the `/wp-content` directory, e.g. files downloaded from the Media Library. Redirections will not work if your images are downloaded from another domain, i.e. from an external service.
|
159 |
|
@@ -372,6 +376,7 @@ and add this code line:
|
|
372 |
`types {`
|
373 |
` # ...`
|
374 |
` image/webp webp;`
|
|
|
375 |
`}`
|
376 |
|
377 |
Then find the configuration file in one of the paths *(remember to select configuration file used by your vhost)*:
|
@@ -382,6 +387,16 @@ and add below code in this file *(add these lines to very beginning of file if p
|
|
382 |
|
383 |
`server {`
|
384 |
` location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
` if ($http_accept !~* "image/webp") {`
|
386 |
` break;`
|
387 |
` }`
|
@@ -403,6 +418,18 @@ Please manually paste the following code **at the beginning of .htaccess file**
|
|
403 |
|
404 |
`# BEGIN WebP Converter`
|
405 |
`# ! --- DO NOT EDIT PREVIOUS LINE --- !`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
`<IfModule mod_rewrite.c>
|
407 |
RewriteEngine On
|
408 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
@@ -427,10 +454,12 @@ And the following code **at the beginning of .htaccess file** in the `/wp-conten
|
|
427 |
`# ! --- DO NOT EDIT PREVIOUS LINE --- !`
|
428 |
`<IfModule mod_mime.c>
|
429 |
AddType image/webp .webp
|
|
|
430 |
</IfModule>
|
431 |
<IfModule mod_expires.c>
|
432 |
ExpiresActive On
|
433 |
ExpiresByType image/webp "access plus 1 year"
|
|
|
434 |
</IfModule>
|
435 |
<IfModule mod_headers.c>
|
436 |
Header Set Cache-Control "private"
|
@@ -440,9 +469,9 @@ And the following code **at the beginning of .htaccess file** in the `/wp-conten
|
|
440 |
|
441 |
= Is the plugin completely free? =
|
442 |
|
443 |
-
|
444 |
|
445 |
-
However, working on plugins and technical support requires many hours of work. If you want to appreciate
|
446 |
|
447 |
Thank you for all the ratings and reviews.
|
448 |
|
@@ -458,27 +487,10 @@ This is all very important to us and allows us to do even better things for you!
|
|
458 |
|
459 |
== Changelog ==
|
460 |
|
461 |
-
=
|
462 |
-
* `[
|
463 |
-
* `[
|
464 |
-
|
465 |
-
= 3.2.3 (2021-10-15) =
|
466 |
-
* `[Added]` Exclusion of re-converting images that caused regeneration error
|
467 |
-
|
468 |
-
= 3.2.2 (2021-09-26) =
|
469 |
-
* `[Changed]` Option "Force redirections to WebP for all domains" as default
|
470 |
-
* `[Added]` Debug information for regeneration error
|
471 |
-
|
472 |
-
= 3.2.1 (2021-09-12) =
|
473 |
-
* `[Fixed]` Skipping converted images when converting all images
|
474 |
-
|
475 |
-
= 3.2.0 (2021-09-12) =
|
476 |
-
* `[Removed]` Filter `webpc_files_paths`
|
477 |
-
* `[Removed]` Filter `webpc_dir_excluded`
|
478 |
-
* `[Changed]` Error handling when converting images
|
479 |
-
* `[Added]` Filter `webpc_supported_source_file` to exclude paths to files from converting
|
480 |
-
* `[Added]` Filter `webpc_supported_source_directory` to exclude paths to directories from converting
|
481 |
-
* `[Added]` Modifications to appearance of plugin settings page
|
482 |
|
483 |
See [changelog.txt](https://plugins.svn.wordpress.org/webp-converter-for-media/trunk/changelog.txt) for previous versions.
|
484 |
|
21 |
|
22 |
This will be a profit both for your users who will not have to download so much data, but also for a server that will be less loaded. Remember that a better optimized website also affects your Google ranking.
|
23 |
|
24 |
+
#### AVIF support
|
25 |
+
|
26 |
+
Now you can use AVIF as the output format for your images. The AVIF format is a new extension - even better than WebP. It allows you to achieve a similar or higher level of image compression, but the quality of the converted images is better.
|
27 |
+
|
28 |
#### How does this work?
|
29 |
|
30 |
- If you have just installed the plugin, you can optimize images with one click.
|
108 |
|
109 |
If you get an error: `"%s" is not a valid image file.` means that the file is damaged in some way. Download the file to disk, save it again using any graphics program and add again to the page. If the error applies to individual images then you can ignore it - just the original images will load, not WebP.
|
110 |
|
111 |
+
If you get an error: `"%s" converted to .webp is larger than original and has been deleted.` means the original image weighed less than WebP. This happens when images have been compressed before. Disable the *"Automatic removal of files in output formats larger than original"* option in plugin settings to force always using WebP.
|
112 |
|
113 |
In the case of the above problems, **contacting the support forum will be useless**. Unfortunately, we are unable to help you if your files are damaged. You have to fix it yourself. If you have previously used other tools that changed the original files and damaged them, you will do nothing more.
|
114 |
|
157 |
|
158 |
When such a situation occurs, a file in `.webp.deleted` format will be created. This avoids re-converting images that were larger than original after converting to WebP. If the option of forced conversion of all images is checked, this image will also be re-converted.
|
159 |
|
160 |
+
If you want to force the use of WebP files, uncheck the `Automatic removal of files in output formats larger than original` option in the plugin settings. Then click on the `Regenerate All` button to convert all images again.
|
161 |
|
162 |
Remember that this plugin supports images from the `/wp-content` directory, e.g. files downloaded from the Media Library. Redirections will not work if your images are downloaded from another domain, i.e. from an external service.
|
163 |
|
376 |
`types {`
|
377 |
` # ...`
|
378 |
` image/webp webp;`
|
379 |
+
` image/avif avif;`
|
380 |
`}`
|
381 |
|
382 |
Then find the configuration file in one of the paths *(remember to select configuration file used by your vhost)*:
|
387 |
|
388 |
`server {`
|
389 |
` location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {`
|
390 |
+
` if ($http_accept !~* "image/avif") {`
|
391 |
+
` break;`
|
392 |
+
` }`
|
393 |
+
` add_header Vary Accept;`
|
394 |
+
` add_header Cache-Control "private" always;`
|
395 |
+
` expires 365d;`
|
396 |
+
` try_files /wp-content/uploads-webpc/$path.$ext.avif $uri =404;`
|
397 |
+
` }`
|
398 |
+
` `
|
399 |
+
` location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {`
|
400 |
` if ($http_accept !~* "image/webp") {`
|
401 |
` break;`
|
402 |
` }`
|
418 |
|
419 |
`# BEGIN WebP Converter`
|
420 |
`# ! --- DO NOT EDIT PREVIOUS LINE --- !`
|
421 |
+
`<IfModule mod_rewrite.c>
|
422 |
+
RewriteEngine On
|
423 |
+
RewriteCond %{HTTP_ACCEPT} image/avif
|
424 |
+
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.avif -f
|
425 |
+
RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.avif [NC,T=image/avif,L]
|
426 |
+
RewriteCond %{HTTP_ACCEPT} image/avif
|
427 |
+
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.avif -f
|
428 |
+
RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.avif [NC,T=image/avif,L]
|
429 |
+
RewriteCond %{HTTP_ACCEPT} image/avif
|
430 |
+
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.avif -f
|
431 |
+
RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.avif [NC,T=image/avif,L]
|
432 |
+
</IfModule>
|
433 |
`<IfModule mod_rewrite.c>
|
434 |
RewriteEngine On
|
435 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
454 |
`# ! --- DO NOT EDIT PREVIOUS LINE --- !`
|
455 |
`<IfModule mod_mime.c>
|
456 |
AddType image/webp .webp
|
457 |
+
AddType image/avif .avif
|
458 |
</IfModule>
|
459 |
<IfModule mod_expires.c>
|
460 |
ExpiresActive On
|
461 |
ExpiresByType image/webp "access plus 1 year"
|
462 |
+
ExpiresByType image/avif "access plus 1 year"
|
463 |
</IfModule>
|
464 |
<IfModule mod_headers.c>
|
465 |
Header Set Cache-Control "private"
|
469 |
|
470 |
= Is the plugin completely free? =
|
471 |
|
472 |
+
The plugin is free and you can use it without restrictions. We also offer a paid version that allows for additional functionalities
|
473 |
|
474 |
+
However, working on plugins and technical support requires many hours of work. If you are using the free version of the plugin and if you want to appreciate us, you can [provide us a coffee](https://ko-fi.com/gbiorczyk/?utm_source=webp-converter-for-media&utm_medium=readme-faq). Thanks everyone!
|
475 |
|
476 |
Thank you for all the ratings and reviews.
|
477 |
|
487 |
|
488 |
== Changelog ==
|
489 |
|
490 |
+
= 4.0.0 (2021-12-04) =
|
491 |
+
* `[Added]` Converting images using remote server
|
492 |
+
* `[Added]` Converting images to AVIF format
|
493 |
+
* `[Added]` Error detection for invalid permalinks structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
|
495 |
See [changelog.txt](https://plugins.svn.wordpress.org/webp-converter-for-media/trunk/changelog.txt) for previous versions.
|
496 |
|
src/Action/ConvertPaths.php
CHANGED
@@ -40,7 +40,7 @@ class ConvertPaths implements HookableInterface {
|
|
40 |
*/
|
41 |
public function convert_files_by_paths( array $paths ) {
|
42 |
( new MethodIntegrator( $this->plugin_data ) )
|
43 |
-
->init_conversion( $this->remove_paths_from_excluded_paths( $paths ) );
|
44 |
}
|
45 |
|
46 |
/**
|
40 |
*/
|
41 |
public function convert_files_by_paths( array $paths ) {
|
42 |
( new MethodIntegrator( $this->plugin_data ) )
|
43 |
+
->init_conversion( $this->remove_paths_from_excluded_paths( $paths ), false );
|
44 |
}
|
45 |
|
46 |
/**
|
src/Conversion/Endpoint/ImagesCounterEndpoint.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Conversion\Endpoint;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Calculates the number of all images to be converted.
|
7 |
+
*/
|
8 |
+
class ImagesCounterEndpoint extends EndpointAbstract {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* {@inheritdoc}
|
12 |
+
*/
|
13 |
+
public function get_route_name(): string {
|
14 |
+
return 'images-counter';
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* {@inheritdoc}
|
19 |
+
*/
|
20 |
+
public function get_route_response( \WP_REST_Request $request ) {
|
21 |
+
$images_count = number_format(
|
22 |
+
count( ( new PathsEndpoint( $this->plugin_data ) )->get_paths( false ) ),
|
23 |
+
0,
|
24 |
+
'',
|
25 |
+
' '
|
26 |
+
);
|
27 |
+
|
28 |
+
return new \WP_REST_Response(
|
29 |
+
[
|
30 |
+
'value_output' => sprintf(
|
31 |
+
/* translators: %1$s: images count */
|
32 |
+
__( '%1$s for AVIF and %1$s for WebP', 'webp-converter-for-media' ),
|
33 |
+
$images_count
|
34 |
+
),
|
35 |
+
],
|
36 |
+
200
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
src/Conversion/Endpoint/PathsEndpoint.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Endpoint;
|
4 |
|
|
|
|
|
5 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
6 |
|
7 |
/**
|
@@ -9,7 +11,8 @@ use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
|
9 |
*/
|
10 |
class PathsEndpoint extends EndpointAbstract {
|
11 |
|
12 |
-
const PATHS_PER_REQUEST_LOCAL
|
|
|
13 |
|
14 |
/**
|
15 |
* {@inheritdoc}
|
@@ -28,7 +31,7 @@ class PathsEndpoint extends EndpointAbstract {
|
|
28 |
'required' => false,
|
29 |
'default' => false,
|
30 |
'sanitize_callback' => function ( $value ) {
|
31 |
-
return ( $value === '1' );
|
32 |
},
|
33 |
],
|
34 |
];
|
@@ -40,10 +43,13 @@ class PathsEndpoint extends EndpointAbstract {
|
|
40 |
public function get_route_response( \WP_REST_Request $request ) {
|
41 |
$params = $request->get_params();
|
42 |
$skip_converted = ( $params['regenerate_force'] !== true );
|
|
|
43 |
|
44 |
$data = $this->get_paths(
|
45 |
$skip_converted,
|
46 |
-
|
|
|
|
|
47 |
);
|
48 |
|
49 |
return new \WP_REST_Response(
|
2 |
|
3 |
namespace WebpConverter\Conversion\Endpoint;
|
4 |
|
5 |
+
use WebpConverter\Conversion\Method\RemoteMethod;
|
6 |
+
use WebpConverter\Settings\Option\ConversionMethodOption;
|
7 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
8 |
|
9 |
/**
|
11 |
*/
|
12 |
class PathsEndpoint extends EndpointAbstract {
|
13 |
|
14 |
+
const PATHS_PER_REQUEST_LOCAL = 10;
|
15 |
+
const PATHS_PER_REQUEST_REMOTE = 1;
|
16 |
|
17 |
/**
|
18 |
* {@inheritdoc}
|
31 |
'required' => false,
|
32 |
'default' => false,
|
33 |
'sanitize_callback' => function ( $value ) {
|
34 |
+
return ( (string) $value === '1' );
|
35 |
},
|
36 |
],
|
37 |
];
|
43 |
public function get_route_response( \WP_REST_Request $request ) {
|
44 |
$params = $request->get_params();
|
45 |
$skip_converted = ( $params['regenerate_force'] !== true );
|
46 |
+
$settings = $this->plugin_data->get_plugin_settings();
|
47 |
|
48 |
$data = $this->get_paths(
|
49 |
$skip_converted,
|
50 |
+
( $settings[ ConversionMethodOption::OPTION_NAME ] !== RemoteMethod::METHOD_NAME )
|
51 |
+
? self::PATHS_PER_REQUEST_LOCAL
|
52 |
+
: self::PATHS_PER_REQUEST_REMOTE
|
53 |
);
|
54 |
|
55 |
return new \WP_REST_Response(
|
src/Conversion/Endpoint/RegenerateEndpoint.php
CHANGED
@@ -21,7 +21,15 @@ class RegenerateEndpoint extends EndpointAbstract {
|
|
21 |
*/
|
22 |
public function get_route_args(): array {
|
23 |
return [
|
24 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
'description' => 'Array of file paths (server paths)',
|
26 |
'required' => true,
|
27 |
'default' => [],
|
@@ -37,7 +45,7 @@ class RegenerateEndpoint extends EndpointAbstract {
|
|
37 |
*/
|
38 |
public function get_route_response( \WP_REST_Request $request ) {
|
39 |
$params = $request->get_params();
|
40 |
-
$data = $this->convert_images( $params['paths'] );
|
41 |
|
42 |
if ( $data !== false ) {
|
43 |
return new \WP_REST_Response(
|
@@ -58,12 +66,13 @@ class RegenerateEndpoint extends EndpointAbstract {
|
|
58 |
/**
|
59 |
* Initializes image conversion to output formats.
|
60 |
*
|
61 |
-
* @param string[] $paths
|
|
|
62 |
*
|
63 |
* @return array[]|false Status of conversion.
|
64 |
*/
|
65 |
-
public function convert_images( array $paths ) {
|
66 |
-
$response = ( new MethodIntegrator( $this->plugin_data ) )->init_conversion( $paths );
|
67 |
if ( $response === null ) {
|
68 |
return false;
|
69 |
}
|
21 |
*/
|
22 |
public function get_route_args(): array {
|
23 |
return [
|
24 |
+
'regenerate_force' => [
|
25 |
+
'description' => 'Option to force all images to be converted again (set `1` to enable)',
|
26 |
+
'required' => false,
|
27 |
+
'default' => false,
|
28 |
+
'sanitize_callback' => function ( $value ) {
|
29 |
+
return ( (string) $value === '1' );
|
30 |
+
},
|
31 |
+
],
|
32 |
+
'paths' => [
|
33 |
'description' => 'Array of file paths (server paths)',
|
34 |
'required' => true,
|
35 |
'default' => [],
|
45 |
*/
|
46 |
public function get_route_response( \WP_REST_Request $request ) {
|
47 |
$params = $request->get_params();
|
48 |
+
$data = $this->convert_images( $params['paths'], $params['regenerate_force'] );
|
49 |
|
50 |
if ( $data !== false ) {
|
51 |
return new \WP_REST_Response(
|
66 |
/**
|
67 |
* Initializes image conversion to output formats.
|
68 |
*
|
69 |
+
* @param string[] $paths Server paths of source images.
|
70 |
+
* @param bool $regenerate_force .
|
71 |
*
|
72 |
* @return array[]|false Status of conversion.
|
73 |
*/
|
74 |
+
public function convert_images( array $paths, bool $regenerate_force ) {
|
75 |
+
$response = ( new MethodIntegrator( $this->plugin_data ) )->init_conversion( $paths, $regenerate_force );
|
76 |
if ( $response === null ) {
|
77 |
return false;
|
78 |
}
|
src/Conversion/Format/AvifFormat.php
CHANGED
@@ -2,6 +2,10 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Format;
|
4 |
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
* Supports AVIF as output format for images.
|
7 |
*/
|
@@ -9,6 +13,15 @@ class AvifFormat extends FormatAbstract {
|
|
9 |
|
10 |
const FORMAT_EXTENSION = 'avif';
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* {@inheritdoc}
|
14 |
*/
|
@@ -27,14 +40,23 @@ class AvifFormat extends FormatAbstract {
|
|
27 |
* {@inheritdoc}
|
28 |
*/
|
29 |
public function get_label(): string {
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
* {@inheritdoc}
|
36 |
*/
|
37 |
public function is_available( string $conversion_method ): bool {
|
38 |
-
return
|
39 |
}
|
40 |
}
|
2 |
|
3 |
namespace WebpConverter\Conversion\Format;
|
4 |
|
5 |
+
use WebpConverter\Conversion\Method\RemoteMethod;
|
6 |
+
use WebpConverter\Repository\TokenRepository;
|
7 |
+
use WebpConverter\WebpConverterConstants;
|
8 |
+
|
9 |
/**
|
10 |
* Supports AVIF as output format for images.
|
11 |
*/
|
13 |
|
14 |
const FORMAT_EXTENSION = 'avif';
|
15 |
|
16 |
+
/**
|
17 |
+
* @var TokenRepository
|
18 |
+
*/
|
19 |
+
private $token_repository;
|
20 |
+
|
21 |
+
public function __construct( TokenRepository $token_repository = null ) {
|
22 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
23 |
+
}
|
24 |
+
|
25 |
/**
|
26 |
* {@inheritdoc}
|
27 |
*/
|
40 |
* {@inheritdoc}
|
41 |
*/
|
42 |
public function get_label(): string {
|
43 |
+
if ( $this->token_repository->get_token()->get_valid_status() ) {
|
44 |
+
return 'AVIF';
|
45 |
+
}
|
46 |
+
|
47 |
+
return sprintf(
|
48 |
+
/* translators: %1$s: option name, %2$s: open anchor tag, %3$s: close anchor tag */
|
49 |
+
__( '%1$s (available in %2$sthe PRO version%3$s)', 'webp-converter-for-media' ),
|
50 |
+
'AVIF',
|
51 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-output-formats-avif-upgrade' ) ) . '" target="_blank">',
|
52 |
+
'</a>'
|
53 |
+
);
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
* {@inheritdoc}
|
58 |
*/
|
59 |
public function is_available( string $conversion_method ): bool {
|
60 |
+
return ( $this->token_repository->get_token()->get_valid_status() && ( $conversion_method === RemoteMethod::METHOD_NAME ) );
|
61 |
}
|
62 |
}
|
src/Conversion/Method/GdMethod.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
5 |
-
use WebpConverter\Conversion\Exception;
|
6 |
use WebpConverter\Conversion\Format\WebpFormat;
|
|
|
7 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
8 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
9 |
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
|
|
5 |
use WebpConverter\Conversion\Format\WebpFormat;
|
6 |
+
use WebpConverter\Exception;
|
7 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
8 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
9 |
|
src/Conversion/Method/ImagickMethod.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
5 |
-
use WebpConverter\Conversion\Exception;
|
6 |
use WebpConverter\Conversion\Format\WebpFormat;
|
|
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
8 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
9 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
|
|
5 |
use WebpConverter\Conversion\Format\WebpFormat;
|
6 |
+
use WebpConverter\Exception;
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
8 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
9 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
src/Conversion/Method/LibraryMethodAbstract.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
5 |
-
use WebpConverter\Conversion\Exception;
|
6 |
use WebpConverter\Conversion\SkipCrashed;
|
7 |
use WebpConverter\Conversion\SkipLarger;
|
|
|
8 |
use WebpConverter\Settings\Option\OutputFormatsOption;
|
9 |
|
10 |
/**
|
@@ -17,22 +17,25 @@ abstract class LibraryMethodAbstract extends MethodAbstract implements LibraryMe
|
|
17 |
*/
|
18 |
private $skip_crashed;
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
$this->skip_crashed = $skip_crashed;
|
|
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
* {@inheritdoc}
|
26 |
*/
|
27 |
-
public function convert_paths( array $paths, array $plugin_settings ) {
|
28 |
$output_formats = $plugin_settings[ OutputFormatsOption::OPTION_NAME ];
|
29 |
foreach ( $output_formats as $output_format ) {
|
30 |
foreach ( $paths as $path ) {
|
31 |
try {
|
32 |
-
$
|
33 |
-
|
34 |
-
$this->size_before += $response['data']['size_before'];
|
35 |
-
$this->size_after += $response['data']['size_after'];
|
36 |
} catch ( \Exception $e ) {
|
37 |
$this->errors[] = $e->getMessage();
|
38 |
}
|
@@ -47,12 +50,13 @@ abstract class LibraryMethodAbstract extends MethodAbstract implements LibraryMe
|
|
47 |
* @param string $format Extension of output format.
|
48 |
* @param mixed[] $plugin_settings .
|
49 |
*
|
50 |
-
* @return
|
51 |
*
|
52 |
* @throws Exception\OutputPathException
|
53 |
* @throws Exception\SourcePathException
|
|
|
54 |
*/
|
55 |
-
private function convert_path( string $path, string $format, array $plugin_settings )
|
56 |
$this->set_server_config();
|
57 |
|
58 |
try {
|
@@ -65,19 +69,10 @@ abstract class LibraryMethodAbstract extends MethodAbstract implements LibraryMe
|
|
65 |
$this->convert_image_to_output( $image, $source_path, $output_path, $format, $plugin_settings );
|
66 |
|
67 |
$this->skip_crashed->delete_crashed_file( $output_path );
|
68 |
-
|
69 |
-
|
70 |
-
unlink( $output_path . '.' . SkipLarger::DELETED_FILE_EXTENSION );
|
71 |
-
}
|
72 |
-
do_action( 'webpc_convert_after', $output_path, $source_path );
|
73 |
-
|
74 |
-
return [
|
75 |
-
'success' => true,
|
76 |
-
'message' => null,
|
77 |
-
'data' => $this->get_conversion_stats( $source_path, $output_path ),
|
78 |
-
];
|
79 |
} catch ( \Exception $e ) {
|
80 |
-
$this->
|
81 |
throw $e;
|
82 |
}
|
83 |
}
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
|
|
5 |
use WebpConverter\Conversion\SkipCrashed;
|
6 |
use WebpConverter\Conversion\SkipLarger;
|
7 |
+
use WebpConverter\Exception;
|
8 |
use WebpConverter\Settings\Option\OutputFormatsOption;
|
9 |
|
10 |
/**
|
17 |
*/
|
18 |
private $skip_crashed;
|
19 |
|
20 |
+
/**
|
21 |
+
* @var SkipLarger
|
22 |
+
*/
|
23 |
+
private $skip_larger;
|
24 |
+
|
25 |
+
public function __construct( SkipCrashed $skip_crashed, SkipLarger $skip_larger ) {
|
26 |
$this->skip_crashed = $skip_crashed;
|
27 |
+
$this->skip_larger = $skip_larger;
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* {@inheritdoc}
|
32 |
*/
|
33 |
+
public function convert_paths( array $paths, array $plugin_settings, bool $regenerate_force ) {
|
34 |
$output_formats = $plugin_settings[ OutputFormatsOption::OPTION_NAME ];
|
35 |
foreach ( $output_formats as $output_format ) {
|
36 |
foreach ( $paths as $path ) {
|
37 |
try {
|
38 |
+
$this->convert_path( $path, $output_format, $plugin_settings );
|
|
|
|
|
|
|
39 |
} catch ( \Exception $e ) {
|
40 |
$this->errors[] = $e->getMessage();
|
41 |
}
|
50 |
* @param string $format Extension of output format.
|
51 |
* @param mixed[] $plugin_settings .
|
52 |
*
|
53 |
+
* @return void
|
54 |
*
|
55 |
* @throws Exception\OutputPathException
|
56 |
* @throws Exception\SourcePathException
|
57 |
+
* @throws Exception\LargerThanOriginalException
|
58 |
*/
|
59 |
+
private function convert_path( string $path, string $format, array $plugin_settings ) {
|
60 |
$this->set_server_config();
|
61 |
|
62 |
try {
|
69 |
$this->convert_image_to_output( $image, $source_path, $output_path, $format, $plugin_settings );
|
70 |
|
71 |
$this->skip_crashed->delete_crashed_file( $output_path );
|
72 |
+
$this->skip_larger->remove_image_if_is_larger( $output_path, $source_path, $plugin_settings );
|
73 |
+
$this->update_conversion_stats( $source_path, $output_path );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
} catch ( \Exception $e ) {
|
75 |
+
$this->log_conversion_error( $e->getMessage(), $plugin_settings );
|
76 |
throw $e;
|
77 |
}
|
78 |
}
|
src/Conversion/Method/MethodAbstract.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
5 |
-
use WebpConverter\Conversion\Exception;
|
6 |
use WebpConverter\Conversion\OutputPath;
|
|
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
8 |
|
9 |
/**
|
@@ -37,6 +37,13 @@ abstract class MethodAbstract implements MethodInterface {
|
|
37 |
*/
|
38 |
protected $size_after = 0;
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* {@inheritdoc}
|
42 |
*/
|
@@ -112,21 +119,17 @@ abstract class MethodAbstract implements MethodInterface {
|
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
-
* Returns results data of conversion.
|
116 |
-
*
|
117 |
* @param string $source_path Server path of source image.
|
118 |
* @param string $output_path Server path of output image.
|
119 |
*
|
120 |
-
* @return
|
121 |
*/
|
122 |
-
protected function
|
123 |
$size_before = filesize( $source_path );
|
124 |
$size_after = ( file_exists( $output_path ) ) ? filesize( $output_path ) : $size_before;
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
'size_after' => $size_after ?: 0,
|
129 |
-
];
|
130 |
}
|
131 |
|
132 |
/**
|
@@ -135,7 +138,7 @@ abstract class MethodAbstract implements MethodInterface {
|
|
135 |
*
|
136 |
* @return void
|
137 |
*/
|
138 |
-
protected function
|
139 |
$features = $plugin_settings[ ExtraFeaturesOption::OPTION_NAME ];
|
140 |
if ( in_array( ExtraFeaturesOption::OPTION_VALUE_DEBUG_ENABLED, $features ) ) {
|
141 |
error_log( sprintf( 'WebP Converter for Media: %s', $error_message ) ); // phpcs:ignore
|
2 |
|
3 |
namespace WebpConverter\Conversion\Method;
|
4 |
|
|
|
5 |
use WebpConverter\Conversion\OutputPath;
|
6 |
+
use WebpConverter\Exception;
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
8 |
|
9 |
/**
|
37 |
*/
|
38 |
protected $size_after = 0;
|
39 |
|
40 |
+
/**
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
public static function is_pro_feature(): bool {
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
/**
|
48 |
* {@inheritdoc}
|
49 |
*/
|
119 |
}
|
120 |
|
121 |
/**
|
|
|
|
|
122 |
* @param string $source_path Server path of source image.
|
123 |
* @param string $output_path Server path of output image.
|
124 |
*
|
125 |
+
* @return void
|
126 |
*/
|
127 |
+
protected function update_conversion_stats( string $source_path, string $output_path ) {
|
128 |
$size_before = filesize( $source_path );
|
129 |
$size_after = ( file_exists( $output_path ) ) ? filesize( $output_path ) : $size_before;
|
130 |
|
131 |
+
$this->size_before += $size_before ?: 0;
|
132 |
+
$this->size_after += $size_after ?: 0;
|
|
|
|
|
133 |
}
|
134 |
|
135 |
/**
|
138 |
*
|
139 |
* @return void
|
140 |
*/
|
141 |
+
protected function log_conversion_error( string $error_message, array $plugin_settings ) {
|
142 |
$features = $plugin_settings[ ExtraFeaturesOption::OPTION_NAME ];
|
143 |
if ( in_array( ExtraFeaturesOption::OPTION_VALUE_DEBUG_ENABLED, $features ) ) {
|
144 |
error_log( sprintf( 'WebP Converter for Media: %s', $error_message ) ); // phpcs:ignore
|
src/Conversion/Method/MethodFactory.php
CHANGED
@@ -4,6 +4,8 @@ namespace WebpConverter\Conversion\Method;
|
|
4 |
|
5 |
use WebpConverter\Conversion\Format\FormatFactory;
|
6 |
use WebpConverter\Conversion\SkipCrashed;
|
|
|
|
|
7 |
|
8 |
/**
|
9 |
* Adds support for all conversion methods and returns information about them.
|
@@ -15,6 +17,16 @@ class MethodFactory {
|
|
15 |
*/
|
16 |
private $skip_crashed;
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Objects of supported conversion methods.
|
20 |
*
|
@@ -22,11 +34,18 @@ class MethodFactory {
|
|
22 |
*/
|
23 |
private $methods = [];
|
24 |
|
25 |
-
public function __construct(
|
26 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
$this->set_integration( new ImagickMethod( $this->skip_crashed ) );
|
29 |
-
$this->set_integration( new GdMethod( $this->skip_crashed ) );
|
|
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -72,14 +91,17 @@ class MethodFactory {
|
|
72 |
* @return string[] Names of conversion methods with labels.
|
73 |
*/
|
74 |
public function get_available_methods(): array {
|
75 |
-
$
|
|
|
76 |
foreach ( $this->get_methods_objects() as $method_name => $method ) {
|
77 |
if ( ! $method::is_method_installed()
|
78 |
|| ( ! ( new FormatFactory() )->get_available_formats( $method_name ) ) ) {
|
79 |
continue;
|
80 |
}
|
81 |
|
82 |
-
$
|
|
|
|
|
83 |
}
|
84 |
return $values;
|
85 |
}
|
4 |
|
5 |
use WebpConverter\Conversion\Format\FormatFactory;
|
6 |
use WebpConverter\Conversion\SkipCrashed;
|
7 |
+
use WebpConverter\Conversion\SkipLarger;
|
8 |
+
use WebpConverter\Repository\TokenRepository;
|
9 |
|
10 |
/**
|
11 |
* Adds support for all conversion methods and returns information about them.
|
17 |
*/
|
18 |
private $skip_crashed;
|
19 |
|
20 |
+
/**
|
21 |
+
* @var SkipLarger
|
22 |
+
*/
|
23 |
+
private $skip_larger;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var TokenRepository
|
27 |
+
*/
|
28 |
+
private $token_repository;
|
29 |
+
|
30 |
/**
|
31 |
* Objects of supported conversion methods.
|
32 |
*
|
34 |
*/
|
35 |
private $methods = [];
|
36 |
|
37 |
+
public function __construct(
|
38 |
+
SkipCrashed $skip_crashed = null,
|
39 |
+
SkipLarger $skip_larger = null,
|
40 |
+
TokenRepository $token_repository = null
|
41 |
+
) {
|
42 |
+
$this->skip_crashed = $skip_crashed ?: new SkipCrashed();
|
43 |
+
$this->skip_larger = $skip_larger ?: new SkipLarger();
|
44 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
45 |
|
46 |
+
$this->set_integration( new ImagickMethod( $this->skip_crashed, $this->skip_larger ) );
|
47 |
+
$this->set_integration( new GdMethod( $this->skip_crashed, $this->skip_larger ) );
|
48 |
+
$this->set_integration( new RemoteMethod( $this->skip_larger ) );
|
49 |
}
|
50 |
|
51 |
/**
|
91 |
* @return string[] Names of conversion methods with labels.
|
92 |
*/
|
93 |
public function get_available_methods(): array {
|
94 |
+
$token_status = $this->token_repository->get_token()->get_valid_status();
|
95 |
+
$values = [];
|
96 |
foreach ( $this->get_methods_objects() as $method_name => $method ) {
|
97 |
if ( ! $method::is_method_installed()
|
98 |
|| ( ! ( new FormatFactory() )->get_available_formats( $method_name ) ) ) {
|
99 |
continue;
|
100 |
}
|
101 |
|
102 |
+
if ( ( $token_status && $method::is_pro_feature() ) || ( ! $token_status && ! $method::is_pro_feature() ) ) {
|
103 |
+
$values[ $method_name ] = $method->get_label();
|
104 |
+
}
|
105 |
}
|
106 |
return $values;
|
107 |
}
|
src/Conversion/Method/MethodIntegrator.php
CHANGED
@@ -22,16 +22,17 @@ class MethodIntegrator {
|
|
22 |
/**
|
23 |
* Initializes converting source images using active and set conversion method.
|
24 |
*
|
25 |
-
* @param string[] $paths
|
|
|
26 |
*
|
27 |
* @return mixed[]|null Results data of conversion.
|
28 |
*/
|
29 |
-
public function init_conversion( array $paths ) {
|
30 |
if ( ! $method = $this->get_method_used() ) {
|
31 |
return null;
|
32 |
}
|
33 |
|
34 |
-
$method->convert_paths( $paths, $this->plugin_data->get_plugin_settings() );
|
35 |
return [
|
36 |
'is_fatal_error' => $method->is_fatal_error(),
|
37 |
'errors' => apply_filters( 'webpc_convert_errors', $method->get_errors() ),
|
22 |
/**
|
23 |
* Initializes converting source images using active and set conversion method.
|
24 |
*
|
25 |
+
* @param string[] $paths Server paths for source images.
|
26 |
+
* @param bool $regenerate_force .
|
27 |
*
|
28 |
* @return mixed[]|null Results data of conversion.
|
29 |
*/
|
30 |
+
public function init_conversion( array $paths, bool $regenerate_force ) {
|
31 |
if ( ! $method = $this->get_method_used() ) {
|
32 |
return null;
|
33 |
}
|
34 |
|
35 |
+
$method->convert_paths( $paths, $this->plugin_data->get_plugin_settings(), $regenerate_force );
|
36 |
return [
|
37 |
'is_fatal_error' => $method->is_fatal_error(),
|
38 |
'errors' => apply_filters( 'webpc_convert_errors', $method->get_errors() ),
|
src/Conversion/Method/MethodInterface.php
CHANGED
@@ -21,6 +21,11 @@ interface MethodInterface {
|
|
21 |
*/
|
22 |
public function get_label(): string;
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
/**
|
25 |
* Returns status of whether method is installed.
|
26 |
*
|
@@ -66,10 +71,11 @@ interface MethodInterface {
|
|
66 |
/**
|
67 |
* Converts source paths to output formats.
|
68 |
*
|
69 |
-
* @param string[] $paths
|
70 |
-
* @param mixed[] $plugin_settings
|
|
|
71 |
*
|
72 |
* @return void
|
73 |
*/
|
74 |
-
public function convert_paths( array $paths, array $plugin_settings );
|
75 |
}
|
21 |
*/
|
22 |
public function get_label(): string;
|
23 |
|
24 |
+
/**
|
25 |
+
* @return bool
|
26 |
+
*/
|
27 |
+
public static function is_pro_feature(): bool;
|
28 |
+
|
29 |
/**
|
30 |
* Returns status of whether method is installed.
|
31 |
*
|
71 |
/**
|
72 |
* Converts source paths to output formats.
|
73 |
*
|
74 |
+
* @param string[] $paths Server paths of source images.
|
75 |
+
* @param mixed[] $plugin_settings .
|
76 |
+
* @param bool $regenerate_force .
|
77 |
*
|
78 |
* @return void
|
79 |
*/
|
80 |
+
public function convert_paths( array $paths, array $plugin_settings, bool $regenerate_force );
|
81 |
}
|
src/Conversion/Method/RemoteMethod.php
ADDED
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Conversion\Method;
|
4 |
+
|
5 |
+
use WebpConverter\Conversion\SkipLarger;
|
6 |
+
use WebpConverter\Exception;
|
7 |
+
use WebpConverter\Model\Token;
|
8 |
+
use WebpConverter\Repository\TokenRepository;
|
9 |
+
use WebpConverter\Settings\Option\AccessTokenOption;
|
10 |
+
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
11 |
+
use WebpConverter\Settings\Option\ImagesQualityOption;
|
12 |
+
use WebpConverter\Settings\Option\OutputFormatsOption;
|
13 |
+
use WebpConverter\WebpConverterConstants;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Supports image conversion method using remote API.
|
17 |
+
*/
|
18 |
+
class RemoteMethod extends MethodAbstract {
|
19 |
+
|
20 |
+
const METHOD_NAME = 'remote';
|
21 |
+
const MAX_FILESIZE_BYTES = ( 10 * 1024 * 1024 );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var SkipLarger
|
25 |
+
*/
|
26 |
+
private $skip_larger;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var TokenRepository
|
30 |
+
*/
|
31 |
+
private $token_repository;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var Token
|
35 |
+
*/
|
36 |
+
private $token;
|
37 |
+
|
38 |
+
public function __construct( SkipLarger $skip_larger, TokenRepository $token_repository = null ) {
|
39 |
+
$this->skip_larger = $skip_larger;
|
40 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* {@inheritdoc}
|
45 |
+
*/
|
46 |
+
public function get_name(): string {
|
47 |
+
return self::METHOD_NAME;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* {@inheritdoc}
|
52 |
+
*/
|
53 |
+
public function get_label(): string {
|
54 |
+
if ( $this->token_repository->get_token()->get_valid_status() ) {
|
55 |
+
return __( 'Remote server', 'webp-converter-for-media' );
|
56 |
+
}
|
57 |
+
|
58 |
+
return sprintf(
|
59 |
+
/* translators: %1$s: option name, %2$s: open anchor tag, %3$s: close anchor tag */
|
60 |
+
__( '%1$s (available in %2$sthe PRO version%3$s)', 'webp-converter-for-media' ),
|
61 |
+
__( 'Remote server', 'webp-converter-for-media' ),
|
62 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-conversion-method-remote-upgrade' ) ) . '" target="_blank">',
|
63 |
+
'</a>'
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
public static function is_pro_feature(): bool {
|
71 |
+
return true;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* {@inheritdoc}
|
76 |
+
*/
|
77 |
+
public static function is_method_installed(): bool {
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* {@inheritdoc}
|
83 |
+
*/
|
84 |
+
public static function is_method_active( string $format ): bool {
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* {@inheritdoc}
|
90 |
+
*
|
91 |
+
* @throws Exception\SourcePathException
|
92 |
+
* @throws Exception\OutputPathException
|
93 |
+
*/
|
94 |
+
public function convert_paths( array $paths, array $plugin_settings, bool $regenerate_force ) {
|
95 |
+
$output_formats = $plugin_settings[ OutputFormatsOption::OPTION_NAME ];
|
96 |
+
$file_paths = $this->get_source_paths( $paths, $plugin_settings );
|
97 |
+
|
98 |
+
if ( ! $file_paths ) {
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
|
102 |
+
$source_paths = [];
|
103 |
+
$output_paths = [];
|
104 |
+
$this->token = $this->token_repository->get_token();
|
105 |
+
|
106 |
+
foreach ( $output_formats as $output_format ) {
|
107 |
+
$source_paths[ $output_format ] = $file_paths;
|
108 |
+
$output_paths[ $output_format ] = $this->get_output_paths( $file_paths, $output_format );
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( ! $regenerate_force ) {
|
112 |
+
foreach ( $source_paths as $output_format => $extensions_paths ) {
|
113 |
+
foreach ( $extensions_paths as $path_index => $extensions_path ) {
|
114 |
+
if ( file_exists( $output_paths[ $output_format ][ $path_index ] ) ) {
|
115 |
+
unset( $source_paths[ $output_format ][ $path_index ] );
|
116 |
+
unset( $output_paths[ $output_format ][ $path_index ] );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
try {
|
123 |
+
$converted_files = $this->init_connections( $source_paths, $plugin_settings );
|
124 |
+
|
125 |
+
foreach ( $converted_files as $output_format => $format_converted_files ) {
|
126 |
+
foreach ( $format_converted_files as $path_index => $converted_file ) {
|
127 |
+
$source_path = $source_paths[ $output_format ][ $path_index ];
|
128 |
+
$output_path = $output_paths[ $output_format ][ $path_index ];
|
129 |
+
|
130 |
+
file_put_contents( $output_path, $converted_file );
|
131 |
+
|
132 |
+
try {
|
133 |
+
$this->skip_larger->remove_image_if_is_larger( $output_path, $source_path, $plugin_settings );
|
134 |
+
$this->update_conversion_stats( $source_path, $output_path );
|
135 |
+
} catch ( Exception\LargerThanOriginalException $e ) {
|
136 |
+
$this->save_conversion_error( $e->getMessage(), $plugin_settings );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
} catch ( Exception\RemoteErrorResponseException $e ) {
|
141 |
+
$this->save_conversion_error( $e->getMessage(), $plugin_settings, true );
|
142 |
+
}
|
143 |
+
|
144 |
+
$this->token_repository->update_token( $this->token );
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @param string $error_message .
|
149 |
+
* @param mixed[] $plugin_settings .
|
150 |
+
* @param bool $is_fatal_error .
|
151 |
+
*
|
152 |
+
* @return void
|
153 |
+
*/
|
154 |
+
private function save_conversion_error( string $error_message, array $plugin_settings, bool $is_fatal_error = false ) {
|
155 |
+
if ( $is_fatal_error ) {
|
156 |
+
$this->is_fatal_error = true;
|
157 |
+
}
|
158 |
+
|
159 |
+
$this->errors[] = $error_message;
|
160 |
+
$this->log_conversion_error( $error_message, $plugin_settings );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @param string[] $paths .
|
165 |
+
* @param mixed[] $plugin_settings .
|
166 |
+
*
|
167 |
+
* @return string[]
|
168 |
+
*
|
169 |
+
* @throws Exception\SourcePathException
|
170 |
+
*/
|
171 |
+
private function get_source_paths( array $paths, array $plugin_settings ): array {
|
172 |
+
$source_paths = [];
|
173 |
+
foreach ( $paths as $path ) {
|
174 |
+
$source_path = $this->get_image_source_path( $path );
|
175 |
+
if ( filesize( $source_path ) > self::MAX_FILESIZE_BYTES ) {
|
176 |
+
$this->save_conversion_error(
|
177 |
+
( new Exception\FilesizeOversizeException( [ self::MAX_FILESIZE_BYTES, $source_path ] ) )->getMessage(),
|
178 |
+
$plugin_settings
|
179 |
+
);
|
180 |
+
continue;
|
181 |
+
}
|
182 |
+
|
183 |
+
$source_paths[] = $this->get_image_source_path( $path );
|
184 |
+
}
|
185 |
+
|
186 |
+
return $source_paths;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @param string[] $source_paths .
|
191 |
+
* @param string $output_format .
|
192 |
+
*
|
193 |
+
* @return string[]
|
194 |
+
*
|
195 |
+
* @throws Exception\OutputPathException
|
196 |
+
*/
|
197 |
+
private function get_output_paths( array $source_paths, string $output_format ): array {
|
198 |
+
$output_path = [];
|
199 |
+
foreach ( $source_paths as $path ) {
|
200 |
+
$output_path[] = $this->get_image_output_path( $path, $output_format );
|
201 |
+
}
|
202 |
+
|
203 |
+
return $output_path;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* @param array[] $source_paths .
|
208 |
+
* @param mixed[] $plugin_settings .
|
209 |
+
*
|
210 |
+
* @return array[]
|
211 |
+
*
|
212 |
+
* @throws Exception\RemoteErrorResponseException
|
213 |
+
*/
|
214 |
+
private function init_connections( array $source_paths, array $plugin_settings ): array {
|
215 |
+
$mh_items = [];
|
216 |
+
$values = [];
|
217 |
+
|
218 |
+
$mh = curl_multi_init();
|
219 |
+
if ( ! $mh ) {
|
220 |
+
return $values;
|
221 |
+
}
|
222 |
+
|
223 |
+
foreach ( $source_paths as $output_format => $format_source_paths ) {
|
224 |
+
foreach ( $format_source_paths as $resource_id => $source_path ) {
|
225 |
+
$connect = $this->get_curl_connection( $source_path, $output_format, $plugin_settings );
|
226 |
+
if ( ! $connect ) {
|
227 |
+
continue;
|
228 |
+
}
|
229 |
+
|
230 |
+
curl_multi_add_handle( $mh, $connect );
|
231 |
+
$mh_items[ $output_format ] = $mh_items[ $output_format ] ?? [];
|
232 |
+
$mh_items[ $output_format ][ $resource_id ] = $connect;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
$running = null;
|
237 |
+
do {
|
238 |
+
curl_multi_exec( $mh, $running );
|
239 |
+
curl_multi_select( $mh );
|
240 |
+
} while ( $running > 0 );
|
241 |
+
|
242 |
+
foreach ( $mh_items as $output_format => $format_mh_items ) {
|
243 |
+
foreach ( $format_mh_items as $resource_id => $mh_item ) {
|
244 |
+
$http_code = curl_getinfo( $mh_item, CURLINFO_HTTP_CODE );
|
245 |
+
$response = curl_multi_getcontent( $mh_item );
|
246 |
+
|
247 |
+
if ( ( $http_code === 200 ) && $response ) {
|
248 |
+
$values[ $output_format ] = $values[ $output_format ] ?? [];
|
249 |
+
$values[ $output_format ][ $resource_id ] = $response;
|
250 |
+
} else {
|
251 |
+
$this->handle_request_error(
|
252 |
+
$source_paths[ $output_format ][ $resource_id ],
|
253 |
+
$plugin_settings,
|
254 |
+
$http_code,
|
255 |
+
$response
|
256 |
+
);
|
257 |
+
}
|
258 |
+
curl_multi_remove_handle( $mh, $mh_item );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
curl_multi_close( $mh );
|
263 |
+
return $values;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* @param string $source_path .
|
268 |
+
* @param string $output_format .
|
269 |
+
* @param mixed[] $plugin_settings .
|
270 |
+
*
|
271 |
+
* @return resource|null
|
272 |
+
*/
|
273 |
+
private function get_curl_connection( string $source_path, string $output_format, array $plugin_settings ) {
|
274 |
+
$connect = curl_init( WebpConverterConstants::API_CONVERSION_URL );
|
275 |
+
if ( ! $connect ) {
|
276 |
+
return null;
|
277 |
+
}
|
278 |
+
|
279 |
+
curl_setopt( $connect, CURLOPT_SSL_VERIFYPEER, 0 );
|
280 |
+
curl_setopt( $connect, CURLOPT_RETURNTRANSFER, 1 );
|
281 |
+
curl_setopt( $connect, CURLOPT_TIMEOUT, apply_filters( 'webpc_remote_timeout', 30 ) );
|
282 |
+
curl_setopt( $connect, CURLOPT_POST, 1 );
|
283 |
+
curl_setopt(
|
284 |
+
$connect,
|
285 |
+
CURLOPT_POSTFIELDS,
|
286 |
+
[
|
287 |
+
'access_token' => $plugin_settings[ AccessTokenOption::OPTION_NAME ],
|
288 |
+
'domain_host' => parse_url( get_site_url(), PHP_URL_HOST ),
|
289 |
+
'source_file' => curl_file_create( $source_path ),
|
290 |
+
'output_format' => $output_format,
|
291 |
+
'quality_level' => $plugin_settings[ ImagesQualityOption::OPTION_NAME ],
|
292 |
+
'strip_metadata' => ( ! in_array( ExtraFeaturesOption::OPTION_VALUE_KEEP_METADATA, $plugin_settings[ ExtraFeaturesOption::OPTION_NAME ] ) ),
|
293 |
+
]
|
294 |
+
);
|
295 |
+
curl_setopt(
|
296 |
+
$connect,
|
297 |
+
CURLOPT_HTTPHEADER,
|
298 |
+
[
|
299 |
+
'Content-Type: multipart/form-data',
|
300 |
+
'Expect:',
|
301 |
+
]
|
302 |
+
);
|
303 |
+
curl_setopt( $connect, CURLOPT_RETURNTRANSFER, true );
|
304 |
+
curl_setopt( $connect, CURLOPT_HEADERFUNCTION, [ $this, 'handle_request_header' ] );
|
305 |
+
|
306 |
+
return $connect;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* @param resource $curl .
|
311 |
+
* @param string $header .
|
312 |
+
*
|
313 |
+
* @return int
|
314 |
+
*/
|
315 |
+
public function handle_request_header( $curl, string $header ): int {
|
316 |
+
$header_length = strlen( $header );
|
317 |
+
$header_data = explode( ':', $header );
|
318 |
+
if ( count( $header_data ) > 2 ) {
|
319 |
+
return $header_length;
|
320 |
+
}
|
321 |
+
|
322 |
+
$header_key = strtolower( trim( $header_data[0] ) );
|
323 |
+
if ( $header_key === WebpConverterConstants::API_RESPONSE_VALUE_LIMIT_USAGE ) {
|
324 |
+
$this->token->set_images_usage( intval( $header_data[1] ) );
|
325 |
+
} elseif ( $header_key === WebpConverterConstants::API_RESPONSE_VALUE_LIMIT_MAX ) {
|
326 |
+
$this->token->set_images_limit( intval( $header_data[1] ) );
|
327 |
+
} elseif ( $header_key === WebpConverterConstants::API_RESPONSE_VALUE_SUBSCRIPTION_ACTIVE ) {
|
328 |
+
$this->token->set_valid_status( ( trim( $header_data[1] ) === '1' ) );
|
329 |
+
}
|
330 |
+
|
331 |
+
return $header_length;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @param string $source_path .
|
336 |
+
* @param mixed[] $plugin_settings .
|
337 |
+
* @param int $http_code .
|
338 |
+
* @param string|null $response .
|
339 |
+
*
|
340 |
+
* @return void
|
341 |
+
*
|
342 |
+
* @throws Exception\RemoteErrorResponseException
|
343 |
+
*/
|
344 |
+
private function handle_request_error(
|
345 |
+
string $source_path,
|
346 |
+
array $plugin_settings,
|
347 |
+
int $http_code,
|
348 |
+
string $response = null
|
349 |
+
) {
|
350 |
+
$response_value = ( $response ) ? json_decode( $response, true ) : [];
|
351 |
+
$error_message = $response_value[ WebpConverterConstants::API_RESPONSE_VALUE_ERROR_MESSAGE ] ?? '';
|
352 |
+
$error_fatal_status = $response_value[ WebpConverterConstants::API_RESPONSE_VALUE_ERROR_FATAL_STATUS ] ?? false;
|
353 |
+
|
354 |
+
if ( $error_message && $error_fatal_status ) {
|
355 |
+
throw new Exception\RemoteErrorResponseException( $error_message );
|
356 |
+
} elseif ( $error_message ) {
|
357 |
+
$this->save_conversion_error( $error_message, $plugin_settings );
|
358 |
+
} else {
|
359 |
+
$this->save_conversion_error(
|
360 |
+
( new Exception\RemoteRequestException( [ $http_code, $source_path ] ) )->getMessage(),
|
361 |
+
$plugin_settings
|
362 |
+
);
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}
|
src/Conversion/OutputPath.php
CHANGED
@@ -33,7 +33,7 @@ class OutputPath {
|
|
33 |
*
|
34 |
* @return string[] Server paths for output images.
|
35 |
*/
|
36 |
-
public static function get_paths( string $path, bool $create_dir = false, array $file_extensions =
|
37 |
$new_path = self::get_directory_path( $path );
|
38 |
if ( $new_path && $create_dir && ! self::make_directories( self::check_directories( $new_path ) ) ) {
|
39 |
return [];
|
@@ -43,7 +43,7 @@ class OutputPath {
|
|
43 |
$paths = [];
|
44 |
foreach ( $extensions as $extension ) {
|
45 |
$output_path = sprintf( '%1$s.%2$s', $new_path, $extension );
|
46 |
-
if ( in_array( $extension, $file_extensions, true ) ) {
|
47 |
$paths[] = $output_path;
|
48 |
}
|
49 |
}
|
33 |
*
|
34 |
* @return string[] Server paths for output images.
|
35 |
*/
|
36 |
+
public static function get_paths( string $path, bool $create_dir = false, array $file_extensions = null ): array {
|
37 |
$new_path = self::get_directory_path( $path );
|
38 |
if ( $new_path && $create_dir && ! self::make_directories( self::check_directories( $new_path ) ) ) {
|
39 |
return [];
|
43 |
$paths = [];
|
44 |
foreach ( $extensions as $extension ) {
|
45 |
$output_path = sprintf( '%1$s.%2$s', $new_path, $extension );
|
46 |
+
if ( ( $file_extensions === null ) || in_array( $extension, $file_extensions, true ) ) {
|
47 |
$paths[] = $output_path;
|
48 |
}
|
49 |
}
|
src/Conversion/SkipLarger.php
CHANGED
@@ -2,58 +2,43 @@
|
|
2 |
|
3 |
namespace WebpConverter\Conversion;
|
4 |
|
5 |
-
use WebpConverter\
|
6 |
-
use WebpConverter\HookableInterface;
|
7 |
-
use WebpConverter\PluginData;
|
8 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
9 |
|
10 |
/**
|
11 |
* Deletes output after conversion if it is larger than original.
|
12 |
*/
|
13 |
-
class SkipLarger
|
14 |
|
15 |
const DELETED_FILE_EXTENSION = 'deleted';
|
16 |
|
17 |
-
/**
|
18 |
-
* @var PluginData
|
19 |
-
*/
|
20 |
-
private $plugin_data;
|
21 |
-
|
22 |
-
public function __construct( PluginData $plugin_data ) {
|
23 |
-
$this->plugin_data = $plugin_data;
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* {@inheritdoc}
|
28 |
-
*/
|
29 |
-
public function init_hooks() {
|
30 |
-
add_action( 'webpc_convert_after', [ $this, 'remove_image_if_is_larger' ], 10, 2 );
|
31 |
-
}
|
32 |
-
|
33 |
/**
|
34 |
* Removes converted output image if it is larger than original image.
|
35 |
*
|
36 |
-
* @param string
|
37 |
-
* @param string
|
|
|
38 |
*
|
39 |
* @return void
|
40 |
* @throws Exception\LargerThanOriginalException
|
41 |
-
* @internal
|
42 |
*/
|
43 |
-
public function remove_image_if_is_larger( string $
|
44 |
-
if ( (
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
return;
|
49 |
}
|
50 |
|
51 |
-
$file = fopen( $
|
52 |
if ( $file !== false ) {
|
53 |
fclose( $file );
|
54 |
-
unlink( $
|
55 |
}
|
56 |
|
57 |
-
throw new Exception\LargerThanOriginalException( $
|
58 |
}
|
59 |
}
|
2 |
|
3 |
namespace WebpConverter\Conversion;
|
4 |
|
5 |
+
use WebpConverter\Exception;
|
|
|
|
|
6 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
7 |
|
8 |
/**
|
9 |
* Deletes output after conversion if it is larger than original.
|
10 |
*/
|
11 |
+
class SkipLarger {
|
12 |
|
13 |
const DELETED_FILE_EXTENSION = 'deleted';
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* Removes converted output image if it is larger than original image.
|
17 |
*
|
18 |
+
* @param string $output_path .
|
19 |
+
* @param string $source_path .
|
20 |
+
* @param mixed[] $plugin_settings .
|
21 |
*
|
22 |
* @return void
|
23 |
* @throws Exception\LargerThanOriginalException
|
|
|
24 |
*/
|
25 |
+
public function remove_image_if_is_larger( string $output_path, string $source_path, array $plugin_settings ) {
|
26 |
+
if ( file_exists( $output_path . '.' . self::DELETED_FILE_EXTENSION ) ) {
|
27 |
+
unlink( $output_path . '.' . self::DELETED_FILE_EXTENSION );
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( ! in_array( ExtraFeaturesOption::OPTION_VALUE_ONLY_SMALLER, $plugin_settings[ ExtraFeaturesOption::OPTION_NAME ] )
|
31 |
+
|| ( ! file_exists( $output_path ) || ! file_exists( $source_path ) )
|
32 |
+
|| ( filesize( $output_path ) < filesize( $source_path ) ) ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
$file = fopen( $output_path . '.' . self::DELETED_FILE_EXTENSION, 'w' );
|
37 |
if ( $file !== false ) {
|
38 |
fclose( $file );
|
39 |
+
unlink( $output_path );
|
40 |
}
|
41 |
|
42 |
+
throw new Exception\LargerThanOriginalException( [ $source_path, $output_path ] );
|
43 |
}
|
44 |
}
|
src/Error/Detector/LibsNotInstalledDetector.php
CHANGED
@@ -4,17 +4,34 @@ namespace WebpConverter\Error\Detector;
|
|
4 |
|
5 |
use WebpConverter\Conversion\Method\GdMethod;
|
6 |
use WebpConverter\Conversion\Method\ImagickMethod;
|
|
|
7 |
use WebpConverter\Error\Notice\LibsNotInstalledNotice;
|
|
|
|
|
8 |
|
9 |
/**
|
10 |
* Checks for configuration errors about non-installed methods for converting images.
|
11 |
*/
|
12 |
class LibsNotInstalledDetector implements ErrorDetector {
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* {@inheritdoc}
|
16 |
*/
|
17 |
public function get_error() {
|
|
|
|
|
|
|
|
|
|
|
18 |
if ( GdMethod::is_method_installed() || ImagickMethod::is_method_installed() ) {
|
19 |
return null;
|
20 |
}
|
4 |
|
5 |
use WebpConverter\Conversion\Method\GdMethod;
|
6 |
use WebpConverter\Conversion\Method\ImagickMethod;
|
7 |
+
use WebpConverter\Conversion\Method\RemoteMethod;
|
8 |
use WebpConverter\Error\Notice\LibsNotInstalledNotice;
|
9 |
+
use WebpConverter\PluginData;
|
10 |
+
use WebpConverter\Settings\Option\ConversionMethodOption;
|
11 |
|
12 |
/**
|
13 |
* Checks for configuration errors about non-installed methods for converting images.
|
14 |
*/
|
15 |
class LibsNotInstalledDetector implements ErrorDetector {
|
16 |
|
17 |
+
/**
|
18 |
+
* @var PluginData
|
19 |
+
*/
|
20 |
+
private $plugin_data;
|
21 |
+
|
22 |
+
public function __construct( PluginData $plugin_data ) {
|
23 |
+
$this->plugin_data = $plugin_data;
|
24 |
+
}
|
25 |
+
|
26 |
/**
|
27 |
* {@inheritdoc}
|
28 |
*/
|
29 |
public function get_error() {
|
30 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
31 |
+
if ( $plugin_settings[ ConversionMethodOption::OPTION_NAME ] === RemoteMethod::METHOD_NAME ) {
|
32 |
+
return null;
|
33 |
+
}
|
34 |
+
|
35 |
if ( GdMethod::is_method_installed() || ImagickMethod::is_method_installed() ) {
|
36 |
return null;
|
37 |
}
|
src/Error/Detector/LibsWithoutWebpSupportDetector.php
CHANGED
@@ -5,17 +5,34 @@ namespace WebpConverter\Error\Detector;
|
|
5 |
use WebpConverter\Conversion\Format\WebpFormat;
|
6 |
use WebpConverter\Conversion\Method\GdMethod;
|
7 |
use WebpConverter\Conversion\Method\ImagickMethod;
|
|
|
8 |
use WebpConverter\Error\Notice\LibsWithoutWebpSupportNotice;
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* Checks for configuration errors about image conversion methods that do not support WebP output format.
|
12 |
*/
|
13 |
class LibsWithoutWebpSupportDetector implements ErrorDetector {
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* {@inheritdoc}
|
17 |
*/
|
18 |
public function get_error() {
|
|
|
|
|
|
|
|
|
|
|
19 |
if ( GdMethod::is_method_active( WebpFormat::FORMAT_EXTENSION )
|
20 |
|| ImagickMethod::is_method_active( WebpFormat::FORMAT_EXTENSION ) ) {
|
21 |
return null;
|
5 |
use WebpConverter\Conversion\Format\WebpFormat;
|
6 |
use WebpConverter\Conversion\Method\GdMethod;
|
7 |
use WebpConverter\Conversion\Method\ImagickMethod;
|
8 |
+
use WebpConverter\Conversion\Method\RemoteMethod;
|
9 |
use WebpConverter\Error\Notice\LibsWithoutWebpSupportNotice;
|
10 |
+
use WebpConverter\PluginData;
|
11 |
+
use WebpConverter\Settings\Option\ConversionMethodOption;
|
12 |
|
13 |
/**
|
14 |
* Checks for configuration errors about image conversion methods that do not support WebP output format.
|
15 |
*/
|
16 |
class LibsWithoutWebpSupportDetector implements ErrorDetector {
|
17 |
|
18 |
+
/**
|
19 |
+
* @var PluginData
|
20 |
+
*/
|
21 |
+
private $plugin_data;
|
22 |
+
|
23 |
+
public function __construct( PluginData $plugin_data ) {
|
24 |
+
$this->plugin_data = $plugin_data;
|
25 |
+
}
|
26 |
+
|
27 |
/**
|
28 |
* {@inheritdoc}
|
29 |
*/
|
30 |
public function get_error() {
|
31 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
32 |
+
if ( $plugin_settings[ ConversionMethodOption::OPTION_NAME ] === RemoteMethod::METHOD_NAME ) {
|
33 |
+
return null;
|
34 |
+
}
|
35 |
+
|
36 |
if ( GdMethod::is_method_active( WebpFormat::FORMAT_EXTENSION )
|
37 |
|| ImagickMethod::is_method_active( WebpFormat::FORMAT_EXTENSION ) ) {
|
38 |
return null;
|
src/Error/Detector/PassthruExecutionDetector.php
CHANGED
@@ -7,6 +7,7 @@ use WebpConverter\Loader\LoaderAbstract;
|
|
7 |
use WebpConverter\Loader\PassthruLoader;
|
8 |
use WebpConverter\PluginData;
|
9 |
use WebpConverter\PluginInfo;
|
|
|
10 |
|
11 |
/**
|
12 |
* Checks for configuration errors about disabled file supports Pass Thru loader.
|
@@ -32,6 +33,11 @@ class PassthruExecutionDetector implements ErrorDetector {
|
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
public function get_error() {
|
|
|
|
|
|
|
|
|
|
|
35 |
do_action( LoaderAbstract::ACTION_NAME, true, true );
|
36 |
|
37 |
$has_error = false;
|
7 |
use WebpConverter\Loader\PassthruLoader;
|
8 |
use WebpConverter\PluginData;
|
9 |
use WebpConverter\PluginInfo;
|
10 |
+
use WebpConverter\Settings\Option\LoaderTypeOption;
|
11 |
|
12 |
/**
|
13 |
* Checks for configuration errors about disabled file supports Pass Thru loader.
|
33 |
* {@inheritdoc}
|
34 |
*/
|
35 |
public function get_error() {
|
36 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
37 |
+
if ( $plugin_settings[ LoaderTypeOption::OPTION_NAME ] !== PassthruLoader::LOADER_TYPE ) {
|
38 |
+
return null;
|
39 |
+
}
|
40 |
+
|
41 |
do_action( LoaderAbstract::ACTION_NAME, true, true );
|
42 |
|
43 |
$has_error = false;
|
src/Error/Detector/PermalinksStructureDetector.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Detector;
|
4 |
+
|
5 |
+
use WebpConverter\Error\Notice\PermalinksStructureInvalidNotice;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Checks for configuration errors about Permalinks Structure.
|
9 |
+
*/
|
10 |
+
class PermalinksStructureDetector implements ErrorDetector {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* {@inheritdoc}
|
14 |
+
*/
|
15 |
+
public function get_error() {
|
16 |
+
if ( get_option( 'permalink_structure', '' ) !== '' ) {
|
17 |
+
return null;
|
18 |
+
}
|
19 |
+
|
20 |
+
return new PermalinksStructureInvalidNotice();
|
21 |
+
}
|
22 |
+
}
|
src/Error/Detector/RewritesErrorsDetector.php
CHANGED
@@ -56,8 +56,10 @@ class RewritesErrorsDetector implements ErrorDetector {
|
|
56 |
* {@inheritdoc}
|
57 |
*/
|
58 |
public function get_error() {
|
59 |
-
$
|
60 |
-
if ( ! $
|
|
|
|
|
61 |
return null;
|
62 |
}
|
63 |
|
56 |
* {@inheritdoc}
|
57 |
*/
|
58 |
public function get_error() {
|
59 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
60 |
+
if ( ! $plugin_settings[ SupportedDirectoriesOption::OPTION_NAME ]
|
61 |
+
|| ! $plugin_settings[ OutputFormatsOption::OPTION_NAME ]
|
62 |
+
|| ! in_array( WebpFormat::FORMAT_EXTENSION, $plugin_settings[ OutputFormatsOption::OPTION_NAME ] ) ) {
|
63 |
return null;
|
64 |
}
|
65 |
|
src/Error/Detector/SettingsIncorrectDetector.php
CHANGED
@@ -6,6 +6,7 @@ use WebpConverter\Error\Notice\SettingsIncorrectNotice;
|
|
6 |
use WebpConverter\PluginData;
|
7 |
use WebpConverter\Settings\Option\ConversionMethodOption;
|
8 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
|
|
9 |
use WebpConverter\Settings\Option\OutputFormatsOption;
|
10 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
11 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
@@ -28,18 +29,20 @@ class SettingsIncorrectDetector implements ErrorDetector {
|
|
28 |
* {@inheritdoc}
|
29 |
*/
|
30 |
public function get_error() {
|
31 |
-
$
|
32 |
-
|
33 |
-
if ( ( ! isset( $
|
34 |
-
|| ! $
|
35 |
-
|| ( ! isset( $
|
36 |
-
|| ! $
|
37 |
-
|| ( ! isset( $
|
38 |
-
|| ! $
|
39 |
-
|| ( ! isset( $
|
40 |
-
|| ! $
|
41 |
-
|| ( ! isset( $
|
42 |
-
|| ! $
|
|
|
|
|
43 |
return new SettingsIncorrectNotice();
|
44 |
}
|
45 |
|
6 |
use WebpConverter\PluginData;
|
7 |
use WebpConverter\Settings\Option\ConversionMethodOption;
|
8 |
use WebpConverter\Settings\Option\ImagesQualityOption;
|
9 |
+
use WebpConverter\Settings\Option\LoaderTypeOption;
|
10 |
use WebpConverter\Settings\Option\OutputFormatsOption;
|
11 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
12 |
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
29 |
* {@inheritdoc}
|
30 |
*/
|
31 |
public function get_error() {
|
32 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
33 |
+
|
34 |
+
if ( ( ! isset( $plugin_settings[ SupportedExtensionsOption::OPTION_NAME ] )
|
35 |
+
|| ! $plugin_settings[ SupportedExtensionsOption::OPTION_NAME ] )
|
36 |
+
|| ( ! isset( $plugin_settings[ SupportedDirectoriesOption::OPTION_NAME ] )
|
37 |
+
|| ! $plugin_settings[ SupportedDirectoriesOption::OPTION_NAME ] )
|
38 |
+
|| ( ! isset( $plugin_settings[ OutputFormatsOption::OPTION_NAME ] )
|
39 |
+
|| ! $plugin_settings[ OutputFormatsOption::OPTION_NAME ] )
|
40 |
+
|| ( ! isset( $plugin_settings[ ConversionMethodOption::OPTION_NAME ] )
|
41 |
+
|| ! $plugin_settings[ ConversionMethodOption::OPTION_NAME ] )
|
42 |
+
|| ( ! isset( $plugin_settings[ ImagesQualityOption::OPTION_NAME ] )
|
43 |
+
|| ! $plugin_settings[ ImagesQualityOption::OPTION_NAME ] )
|
44 |
+
|| ( ! isset( $plugin_settings[ LoaderTypeOption::OPTION_NAME ] )
|
45 |
+
|| ! $plugin_settings[ LoaderTypeOption::OPTION_NAME ] ) ) {
|
46 |
return new SettingsIncorrectNotice();
|
47 |
}
|
48 |
|
src/Error/Detector/TokenStatusDetector.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Detector;
|
4 |
+
|
5 |
+
use WebpConverter\Conversion\Endpoint\PathsEndpoint;
|
6 |
+
use WebpConverter\Error\Notice\AccessTokenInvalidNotice;
|
7 |
+
use WebpConverter\Error\Notice\ApiLimitExceededNotice;
|
8 |
+
use WebpConverter\PluginData;
|
9 |
+
use WebpConverter\Repository\TokenRepository;
|
10 |
+
use WebpConverter\Service\TokenValidator;
|
11 |
+
use WebpConverter\Settings\Option\AccessTokenOption;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Checks for the token status for the PRO version.
|
15 |
+
*/
|
16 |
+
class TokenStatusDetector implements ErrorDetector {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var PluginData
|
20 |
+
*/
|
21 |
+
private $plugin_data;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var TokenRepository
|
25 |
+
*/
|
26 |
+
private $token_repository;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var TokenValidator
|
30 |
+
*/
|
31 |
+
private $token_validator;
|
32 |
+
|
33 |
+
public function __construct(
|
34 |
+
PluginData $plugin_data,
|
35 |
+
TokenRepository $token_repository = null,
|
36 |
+
TokenValidator $token_validator = null
|
37 |
+
) {
|
38 |
+
$this->plugin_data = $plugin_data;
|
39 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
40 |
+
$this->token_validator = $token_validator ?: new TokenValidator();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* {@inheritdoc}
|
45 |
+
*/
|
46 |
+
public function get_error() {
|
47 |
+
$settings = $this->plugin_data->get_plugin_settings();
|
48 |
+
if ( ! isset( $settings[ AccessTokenOption::OPTION_NAME ] ) || ! $settings[ AccessTokenOption::OPTION_NAME ] ) {
|
49 |
+
return null;
|
50 |
+
}
|
51 |
+
|
52 |
+
$token = $this->token_repository->get_token();
|
53 |
+
if ( ! $token->get_valid_status() ) {
|
54 |
+
return new AccessTokenInvalidNotice();
|
55 |
+
}
|
56 |
+
|
57 |
+
$images_usage = ( $token->get_images_usage() + ( PathsEndpoint::PATHS_PER_REQUEST_REMOTE * 2 ) );
|
58 |
+
if ( $images_usage > $token->get_images_limit() ) {
|
59 |
+
$token = $this->token_validator->validate_token( $token->get_token_value() );
|
60 |
+
}
|
61 |
+
|
62 |
+
$images_usage = ( $token->get_images_usage() + ( PathsEndpoint::PATHS_PER_REQUEST_REMOTE * 2 ) );
|
63 |
+
if ( $images_usage > $token->get_images_limit() ) {
|
64 |
+
return new ApiLimitExceededNotice();
|
65 |
+
}
|
66 |
+
|
67 |
+
return null;
|
68 |
+
}
|
69 |
+
}
|
src/Error/Detector/WebpFormatActivatedDetector.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Detector;
|
4 |
+
|
5 |
+
use WebpConverter\Conversion\Format\WebpFormat;
|
6 |
+
use WebpConverter\Error\Notice\WebpRequiredNotice;
|
7 |
+
use WebpConverter\PluginData;
|
8 |
+
use WebpConverter\Settings\Option\OutputFormatsOption;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Checks if the WebP as output format is active.
|
12 |
+
*/
|
13 |
+
class WebpFormatActivatedDetector implements ErrorDetector {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var PluginData
|
17 |
+
*/
|
18 |
+
private $plugin_data;
|
19 |
+
|
20 |
+
public function __construct( PluginData $plugin_data ) {
|
21 |
+
$this->plugin_data = $plugin_data;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* {@inheritdoc}
|
26 |
+
*/
|
27 |
+
public function get_error() {
|
28 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
29 |
+
if ( in_array( WebpFormat::FORMAT_EXTENSION, $plugin_settings[ OutputFormatsOption::OPTION_NAME ] ) ) {
|
30 |
+
return null;
|
31 |
+
}
|
32 |
+
|
33 |
+
return new WebpRequiredNotice();
|
34 |
+
}
|
35 |
+
}
|
src/Error/ErrorDetectorAggregator.php
CHANGED
@@ -6,9 +6,12 @@ use WebpConverter\Error\Detector\LibsNotInstalledDetector;
|
|
6 |
use WebpConverter\Error\Detector\LibsWithoutWebpSupportDetector;
|
7 |
use WebpConverter\Error\Detector\PassthruExecutionDetector;
|
8 |
use WebpConverter\Error\Detector\PathsErrorsDetector;
|
|
|
9 |
use WebpConverter\Error\Detector\RestApiDisabledDetector;
|
10 |
use WebpConverter\Error\Detector\RewritesErrorsDetector;
|
11 |
use WebpConverter\Error\Detector\SettingsIncorrectDetector;
|
|
|
|
|
12 |
use WebpConverter\Error\Notice\ErrorNotice;
|
13 |
use WebpConverter\Error\Notice\RewritesCachedNotice;
|
14 |
use WebpConverter\HookableInterface;
|
@@ -139,9 +142,17 @@ class ErrorDetectorAggregator implements HookableInterface {
|
|
139 |
|
140 |
$this->cached_errors = [];
|
141 |
|
142 |
-
if ( $new_error = ( new
|
143 |
$this->cached_errors[] = $new_error;
|
144 |
-
} elseif ( $new_error = ( new
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$this->cached_errors[] = $new_error;
|
146 |
}
|
147 |
|
@@ -159,7 +170,11 @@ class ErrorDetectorAggregator implements HookableInterface {
|
|
159 |
$this->cached_errors[] = $new_error;
|
160 |
}
|
161 |
|
162 |
-
if (
|
|
|
|
|
|
|
|
|
163 |
$this->cached_errors[] = $new_error;
|
164 |
}
|
165 |
|
6 |
use WebpConverter\Error\Detector\LibsWithoutWebpSupportDetector;
|
7 |
use WebpConverter\Error\Detector\PassthruExecutionDetector;
|
8 |
use WebpConverter\Error\Detector\PathsErrorsDetector;
|
9 |
+
use WebpConverter\Error\Detector\PermalinksStructureDetector;
|
10 |
use WebpConverter\Error\Detector\RestApiDisabledDetector;
|
11 |
use WebpConverter\Error\Detector\RewritesErrorsDetector;
|
12 |
use WebpConverter\Error\Detector\SettingsIncorrectDetector;
|
13 |
+
use WebpConverter\Error\Detector\TokenStatusDetector;
|
14 |
+
use WebpConverter\Error\Detector\WebpFormatActivatedDetector;
|
15 |
use WebpConverter\Error\Notice\ErrorNotice;
|
16 |
use WebpConverter\Error\Notice\RewritesCachedNotice;
|
17 |
use WebpConverter\HookableInterface;
|
142 |
|
143 |
$this->cached_errors = [];
|
144 |
|
145 |
+
if ( $new_error = ( new TokenStatusDetector( $this->plugin_data ) )->get_error() ) {
|
146 |
$this->cached_errors[] = $new_error;
|
147 |
+
} elseif ( $new_error = ( new LibsNotInstalledDetector( $this->plugin_data ) )->get_error() ) {
|
148 |
+
$this->cached_errors[] = $new_error;
|
149 |
+
} elseif ( $new_error = ( new LibsWithoutWebpSupportDetector( $this->plugin_data ) )->get_error() ) {
|
150 |
+
$this->cached_errors[] = $new_error;
|
151 |
+
} elseif ( $new_error = ( new WebpFormatActivatedDetector( $this->plugin_data ) )->get_error() ) {
|
152 |
+
$this->cached_errors[] = $new_error;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( $new_error = ( new PermalinksStructureDetector() )->get_error() ) {
|
156 |
$this->cached_errors[] = $new_error;
|
157 |
}
|
158 |
|
170 |
$this->cached_errors[] = $new_error;
|
171 |
}
|
172 |
|
173 |
+
if ( $this->cached_errors ) {
|
174 |
+
return $this->cached_errors;
|
175 |
+
}
|
176 |
+
|
177 |
+
if ( $new_error = ( new SettingsIncorrectDetector( $this->plugin_data ) )->get_error() ) {
|
178 |
$this->cached_errors[] = $new_error;
|
179 |
}
|
180 |
|
src/Error/Notice/AccessTokenInvalidNotice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Notice;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class AccessTokenInvalidNotice implements ErrorNotice {
|
9 |
+
|
10 |
+
const ERROR_KEY = 'token_invalid';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* {@inheritdoc}
|
14 |
+
*/
|
15 |
+
public function get_key(): string {
|
16 |
+
return self::ERROR_KEY;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* {@inheritdoc}
|
21 |
+
*/
|
22 |
+
public function get_message(): array {
|
23 |
+
return [
|
24 |
+
__( 'Your access token is invalid or your subscription has expired. Check the value given in and try to activate it again.', 'webp-converter-for-media' ),
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
src/Error/Notice/ApiLimitExceededNotice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Notice;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class ApiLimitExceededNotice implements ErrorNotice {
|
9 |
+
|
10 |
+
const ERROR_KEY = 'token_limit';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* {@inheritdoc}
|
14 |
+
*/
|
15 |
+
public function get_key(): string {
|
16 |
+
return self::ERROR_KEY;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* {@inheritdoc}
|
21 |
+
*/
|
22 |
+
public function get_message(): array {
|
23 |
+
return [
|
24 |
+
__( 'Your limit for the number of converted images in the current billing period has been exceeded. You can wait until the end of the billing period. Then your limit will be renewed. Another solution is to cancel the current subscription and buy a new one with a new limit.', 'webp-converter-for-media' ),
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
src/Error/Notice/LibsNotInstalledNotice.php
CHANGED
@@ -27,6 +27,7 @@ class LibsNotInstalledNotice implements ErrorNotice {
|
|
27 |
'<a href="https://wordpress.org/plugins/webp-converter-for-media/#faq" target="_blank">',
|
28 |
'</a>'
|
29 |
),
|
|
|
30 |
];
|
31 |
}
|
32 |
}
|
27 |
'<a href="https://wordpress.org/plugins/webp-converter-for-media/#faq" target="_blank">',
|
28 |
'</a>'
|
29 |
),
|
30 |
+
__( 'You can also use "Remote server" option in "Conversion method" field in the plugin settings. This option allows you to convert your images using a remote server, so your server does not have to meet all technical requirements for libraries.', 'webp-converter-for-media' ),
|
31 |
];
|
32 |
}
|
33 |
}
|
src/Error/Notice/LibsWithoutWebpSupportNotice.php
CHANGED
@@ -27,7 +27,7 @@ class LibsWithoutWebpSupportNotice implements ErrorNotice {
|
|
27 |
'<a href="https://wordpress.org/plugins/webp-converter-for-media/#faq" target="_blank">',
|
28 |
'</a>'
|
29 |
),
|
30 |
-
__( '
|
31 |
];
|
32 |
}
|
33 |
}
|
27 |
'<a href="https://wordpress.org/plugins/webp-converter-for-media/#faq" target="_blank">',
|
28 |
'</a>'
|
29 |
),
|
30 |
+
__( 'You can also use "Remote server" option in "Conversion method" field in the plugin settings. This option allows you to convert your images using a remote server, so your server does not have to meet all technical requirements for libraries.', 'webp-converter-for-media' ),
|
31 |
];
|
32 |
}
|
33 |
}
|
src/Error/Notice/PermalinksStructureInvalidNotice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Notice;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class PermalinksStructureInvalidNotice implements ErrorNotice {
|
9 |
+
|
10 |
+
const ERROR_KEY = 'permalinks_invalid';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* {@inheritdoc}
|
14 |
+
*/
|
15 |
+
public function get_key(): string {
|
16 |
+
return self::ERROR_KEY;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* {@inheritdoc}
|
21 |
+
*/
|
22 |
+
public function get_message(): array {
|
23 |
+
return [
|
24 |
+
__( 'The URL structure for permalinks on your website are not set. This is necessary for the REST API to function properly. In the admin panel, go to Settings -> Permalinks and select an option other than "Plain". Then save your changes.', 'webp-converter-for-media' ),
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
src/Error/Notice/WebpRequiredNotice.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Error\Notice;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class WebpRequiredNotice implements ErrorNotice {
|
9 |
+
|
10 |
+
const ERROR_KEY = 'webp_required';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* {@inheritdoc}
|
14 |
+
*/
|
15 |
+
public function get_key(): string {
|
16 |
+
return self::ERROR_KEY;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* {@inheritdoc}
|
21 |
+
*/
|
22 |
+
public function get_message(): array {
|
23 |
+
return [
|
24 |
+
__( 'WebP as the output format is required. In the "Output formats" option, select the WebP format.', 'webp-converter-for-media' ),
|
25 |
+
];
|
26 |
+
}
|
27 |
+
}
|
src/{Conversion/Exception → Exception}/ConversionErrorException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ConversionErrorException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ConversionErrorException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/ExceptionAbstract.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
abstract class ExceptionAbstract extends \Exception implements ExceptionInterface {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
abstract class ExceptionAbstract extends \Exception implements ExceptionInterface {
|
9 |
|
src/{Conversion/Exception → Exception}/ExceptionInterface.php
RENAMED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
interface ExceptionInterface {
|
9 |
|
10 |
/**
|
11 |
-
* @param
|
12 |
*/
|
13 |
public function __construct( $value = [] );
|
14 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
interface ExceptionInterface {
|
9 |
|
10 |
/**
|
11 |
+
* @param mixed[]|string $value Params of exception.
|
12 |
*/
|
13 |
public function __construct( $value = [] );
|
14 |
|
src/{Conversion/Exception → Exception}/ExtensionUnsupportedException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ExtensionUnsupportedException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ExtensionUnsupportedException extends ExceptionAbstract {
|
9 |
|
src/Exception/FilesizeOversizeException.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class FilesizeOversizeException extends ExceptionAbstract {
|
9 |
+
|
10 |
+
const ERROR_MESSAGE = 'Image is larger than the maximum size of %1$sMB: "%2$s".';
|
11 |
+
const ERROR_CODE = 'max_filezile';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* {@inheritdoc}
|
15 |
+
*/
|
16 |
+
public function get_error_message( array $values ): string {
|
17 |
+
return sprintf(
|
18 |
+
self::ERROR_MESSAGE,
|
19 |
+
round( $values[0] / 1024 / 1024 ),
|
20 |
+
$values[1]
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* {@inheritdoc}
|
26 |
+
*/
|
27 |
+
public function get_error_status(): string {
|
28 |
+
return self::ERROR_CODE;
|
29 |
+
}
|
30 |
+
}
|
src/{Conversion/Exception → Exception}/FunctionUnavailableException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class FunctionUnavailableException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class FunctionUnavailableException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/ImageInvalidException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ImageInvalidException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ImageInvalidException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/ImagickNotSupportWebpException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ImagickNotSupportWebpException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ImagickNotSupportWebpException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/ImagickUnavailableException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ImagickUnavailableException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ImagickUnavailableException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/LargerThanOriginalException.php
RENAMED
@@ -1,20 +1,24 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class LargerThanOriginalException extends ExceptionAbstract {
|
9 |
|
10 |
-
const ERROR_MESSAGE = 'Image "%s" converted to
|
11 |
const ERROR_CODE = 'larger_than_original';
|
12 |
|
13 |
/**
|
14 |
* {@inheritdoc}
|
15 |
*/
|
16 |
public function get_error_message( array $values ): string {
|
17 |
-
return sprintf(
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
/**
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class LargerThanOriginalException extends ExceptionAbstract {
|
9 |
|
10 |
+
const ERROR_MESSAGE = 'Image "%1$s" converted to .%2$s is larger than original and has been deleted.';
|
11 |
const ERROR_CODE = 'larger_than_original';
|
12 |
|
13 |
/**
|
14 |
* {@inheritdoc}
|
15 |
*/
|
16 |
public function get_error_message( array $values ): string {
|
17 |
+
return sprintf(
|
18 |
+
self::ERROR_MESSAGE,
|
19 |
+
$values[0],
|
20 |
+
pathinfo( $values[1], PATHINFO_EXTENSION )
|
21 |
+
);
|
22 |
}
|
23 |
|
24 |
/**
|
src/{Conversion/Exception → Exception}/OutputPathException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class OutputPathException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class OutputPathException extends ExceptionAbstract {
|
9 |
|
src/Exception/RemoteErrorResponseException.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class RemoteErrorResponseException extends ExceptionAbstract {
|
9 |
+
|
10 |
+
const ERROR_MESSAGE = null;
|
11 |
+
const ERROR_CODE = 'remote_response_error';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* {@inheritdoc}
|
15 |
+
*/
|
16 |
+
public function get_error_message( array $values ): string {
|
17 |
+
return $values[0];
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* {@inheritdoc}
|
22 |
+
*/
|
23 |
+
public function get_error_status(): string {
|
24 |
+
return self::ERROR_CODE;
|
25 |
+
}
|
26 |
+
}
|
src/Exception/RemoteRequestException.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* {@inheritdoc}
|
7 |
+
*/
|
8 |
+
class RemoteRequestException extends ExceptionAbstract {
|
9 |
+
|
10 |
+
const ERROR_MESSAGE = 'There was an error connecting to the API, received a response code of %1$s: "%2$s".';
|
11 |
+
const ERROR_CODE = 'remote_request_failed';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* {@inheritdoc}
|
15 |
+
*/
|
16 |
+
public function get_error_message( array $values ): string {
|
17 |
+
return sprintf( self::ERROR_MESSAGE, $values[0], $values[1] );
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* {@inheritdoc}
|
22 |
+
*/
|
23 |
+
public function get_error_status(): string {
|
24 |
+
return self::ERROR_CODE;
|
25 |
+
}
|
26 |
+
}
|
src/{Conversion/Exception → Exception}/ResolutionOversizeException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ResolutionOversizeException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ResolutionOversizeException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/ServerConfigurationException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class ServerConfigurationException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class ServerConfigurationException extends ExceptionAbstract {
|
9 |
|
src/{Conversion/Exception → Exception}/SourcePathException.php
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace WebpConverter\
|
4 |
|
5 |
/**
|
6 |
-
*
|
7 |
*/
|
8 |
class SourcePathException extends ExceptionAbstract {
|
9 |
|
1 |
<?php
|
2 |
|
3 |
+
namespace WebpConverter\Exception;
|
4 |
|
5 |
/**
|
6 |
+
* {@inheritdoc}
|
7 |
*/
|
8 |
class SourcePathException extends ExceptionAbstract {
|
9 |
|
src/Loader/HtaccessLoader.php
CHANGED
@@ -200,7 +200,9 @@ class HtaccessLoader extends LoaderAbstract {
|
|
200 |
|
201 |
$content .= '<IfModule mod_expires.c>' . PHP_EOL;
|
202 |
$content .= ' ExpiresActive On' . PHP_EOL;
|
203 |
-
|
|
|
|
|
204 |
$content .= '</IfModule>';
|
205 |
|
206 |
return apply_filters( 'webpc_htaccess_mod_expires', $content );
|
200 |
|
201 |
$content .= '<IfModule mod_expires.c>' . PHP_EOL;
|
202 |
$content .= ' ExpiresActive On' . PHP_EOL;
|
203 |
+
foreach ( $this->get_mime_types() as $format => $mime_type ) {
|
204 |
+
$content .= " ExpiresByType ${mime_type} \"access plus 1 year\"" . PHP_EOL;
|
205 |
+
}
|
206 |
$content .= '</IfModule>';
|
207 |
|
208 |
return apply_filters( 'webpc_htaccess_mod_expires', $content );
|
src/Model/Token.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Model;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Stores token information for the PRO version.
|
7 |
+
*/
|
8 |
+
class Token {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string|null
|
12 |
+
*/
|
13 |
+
private $token_value;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var bool
|
17 |
+
*/
|
18 |
+
private $valid_status;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var int
|
22 |
+
*/
|
23 |
+
private $images_usage;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var int
|
27 |
+
*/
|
28 |
+
private $images_limit;
|
29 |
+
|
30 |
+
public function __construct(
|
31 |
+
string $token_value = null,
|
32 |
+
bool $valid_status = false,
|
33 |
+
int $images_usage = 0,
|
34 |
+
int $images_limit = 0
|
35 |
+
) {
|
36 |
+
$this->token_value = $token_value;
|
37 |
+
$this->valid_status = $valid_status;
|
38 |
+
$this->images_usage = $images_usage;
|
39 |
+
$this->images_limit = $images_limit;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function set_token_value( string $token_value = null ): self {
|
43 |
+
$this->token_value = $token_value;
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return string|null
|
49 |
+
*/
|
50 |
+
public function get_token_value() {
|
51 |
+
return $this->token_value;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function set_valid_status( bool $status ): self {
|
55 |
+
$this->valid_status = $status;
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function get_valid_status(): bool {
|
60 |
+
return $this->valid_status;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function set_images_usage( int $count ): self {
|
64 |
+
$this->images_usage = $count;
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function get_images_usage(): int {
|
69 |
+
return $this->images_usage;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function set_images_limit( int $count ): self {
|
73 |
+
$this->images_limit = $count;
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function get_images_limit(): int {
|
78 |
+
return $this->images_limit;
|
79 |
+
}
|
80 |
+
}
|
src/Plugin/Uninstall/PluginSettings.php
CHANGED
@@ -6,6 +6,7 @@ use WebpConverter\Error\ErrorDetectorAggregator;
|
|
6 |
use WebpConverter\Notice\ThanksNotice;
|
7 |
use WebpConverter\Notice\WelcomeNotice;
|
8 |
use WebpConverter\Plugin\Update;
|
|
|
9 |
use WebpConverter\Service\OptionsAccessManager;
|
10 |
use WebpConverter\Settings\SettingsSave;
|
11 |
|
@@ -26,5 +27,6 @@ class PluginSettings {
|
|
26 |
OptionsAccessManager::delete_option( ErrorDetectorAggregator::ERRORS_CACHE_OPTION );
|
27 |
OptionsAccessManager::delete_option( SettingsSave::SETTINGS_OPTION );
|
28 |
OptionsAccessManager::delete_option( Update::VERSION_OPTION );
|
|
|
29 |
}
|
30 |
}
|
6 |
use WebpConverter\Notice\ThanksNotice;
|
7 |
use WebpConverter\Notice\WelcomeNotice;
|
8 |
use WebpConverter\Plugin\Update;
|
9 |
+
use WebpConverter\Repository\TokenRepository;
|
10 |
use WebpConverter\Service\OptionsAccessManager;
|
11 |
use WebpConverter\Settings\SettingsSave;
|
12 |
|
27 |
OptionsAccessManager::delete_option( ErrorDetectorAggregator::ERRORS_CACHE_OPTION );
|
28 |
OptionsAccessManager::delete_option( SettingsSave::SETTINGS_OPTION );
|
29 |
OptionsAccessManager::delete_option( Update::VERSION_OPTION );
|
30 |
+
OptionsAccessManager::delete_option( TokenRepository::TOKEN_OPTION );
|
31 |
}
|
32 |
}
|
src/Repository/TokenRepository.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Repository;
|
4 |
+
|
5 |
+
use WebpConverter\Model\Token;
|
6 |
+
use WebpConverter\Service\OptionsAccessManager;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Manages the token for the PRO version.
|
10 |
+
*/
|
11 |
+
class TokenRepository {
|
12 |
+
|
13 |
+
const TOKEN_OPTION = 'webpc_token_data';
|
14 |
+
const TOKEN_VALUE_ACCESS_VALUE = 'token_value';
|
15 |
+
const TOKEN_VALUE_VALID_STATUS = 'valid_status';
|
16 |
+
const TOKEN_VALUE_IMAGES_USAGE = 'images_usage';
|
17 |
+
const TOKEN_VALUE_IMAGES_LIMIT = 'images_limit';
|
18 |
+
|
19 |
+
public function get_token(): Token {
|
20 |
+
$values = OptionsAccessManager::get_option( self::TOKEN_OPTION, null );
|
21 |
+
if ( $values === null ) {
|
22 |
+
return new Token();
|
23 |
+
}
|
24 |
+
|
25 |
+
return new Token(
|
26 |
+
$values[ self::TOKEN_VALUE_ACCESS_VALUE ] ?? null,
|
27 |
+
$values[ self::TOKEN_VALUE_VALID_STATUS ] ?? false,
|
28 |
+
$values[ self::TOKEN_VALUE_IMAGES_USAGE ] ?? 0,
|
29 |
+
$values[ self::TOKEN_VALUE_IMAGES_LIMIT ] ?? 0
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param Token $token .
|
35 |
+
*
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
+
public function update_token( Token $token ) {
|
39 |
+
OptionsAccessManager::update_option(
|
40 |
+
self::TOKEN_OPTION,
|
41 |
+
[
|
42 |
+
self::TOKEN_VALUE_ACCESS_VALUE => $token->get_token_value(),
|
43 |
+
self::TOKEN_VALUE_VALID_STATUS => $token->get_valid_status(),
|
44 |
+
self::TOKEN_VALUE_IMAGES_USAGE => $token->get_images_usage(),
|
45 |
+
self::TOKEN_VALUE_IMAGES_LIMIT => $token->get_images_limit(),
|
46 |
+
]
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function reset_token() {
|
54 |
+
$this->update_token( new Token() );
|
55 |
+
}
|
56 |
+
}
|
src/Service/TokenValidator.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Service;
|
4 |
+
|
5 |
+
use WebpConverter\Model\Token;
|
6 |
+
use WebpConverter\Repository\TokenRepository;
|
7 |
+
use WebpConverter\WebpConverterConstants;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Checks the token status for the PRO version.
|
11 |
+
*/
|
12 |
+
class TokenValidator {
|
13 |
+
|
14 |
+
const API_TOKEN_SUCCESS_CODE = 200;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var TokenRepository
|
18 |
+
*/
|
19 |
+
private $token_repository;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var Token
|
23 |
+
*/
|
24 |
+
private $token;
|
25 |
+
|
26 |
+
public function __construct( TokenRepository $token_repository = null ) {
|
27 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
28 |
+
}
|
29 |
+
|
30 |
+
public function validate_token( string $token_value = null ): Token {
|
31 |
+
$this->token = $this->token_repository->get_token();
|
32 |
+
$status = ( $token_value && $this->check_access_token( $token_value ) );
|
33 |
+
|
34 |
+
if ( $status ) {
|
35 |
+
$this->token_repository->update_token(
|
36 |
+
$this->token
|
37 |
+
->set_token_value( $token_value )
|
38 |
+
->set_valid_status( true )
|
39 |
+
);
|
40 |
+
} else {
|
41 |
+
$this->token_repository->reset_token();
|
42 |
+
}
|
43 |
+
|
44 |
+
return $this->token_repository->get_token();
|
45 |
+
}
|
46 |
+
|
47 |
+
private function check_access_token( string $token_value ): bool {
|
48 |
+
$connect = curl_init( sprintf( WebpConverterConstants::API_TOKEN_VALIDATION_URL, $token_value ) );
|
49 |
+
if ( ! $connect ) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
curl_setopt( $connect, CURLOPT_SSL_VERIFYPEER, 0 );
|
54 |
+
curl_setopt( $connect, CURLOPT_RETURNTRANSFER, 1 );
|
55 |
+
curl_setopt( $connect, CURLOPT_TIMEOUT, 10 );
|
56 |
+
curl_setopt( $connect, CURLOPT_POST, 1 );
|
57 |
+
curl_setopt(
|
58 |
+
$connect,
|
59 |
+
CURLOPT_POSTFIELDS,
|
60 |
+
[
|
61 |
+
'domain_host' => parse_url( get_site_url(), PHP_URL_HOST ),
|
62 |
+
]
|
63 |
+
);
|
64 |
+
|
65 |
+
$response = curl_exec( $connect );
|
66 |
+
$code = curl_getinfo( $connect, CURLINFO_HTTP_CODE );
|
67 |
+
curl_close( $connect );
|
68 |
+
|
69 |
+
if ( $code !== self::API_TOKEN_SUCCESS_CODE ) {
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
$response_json = ( $response && is_string( $response ) ) ? json_decode( $response, true ) : null;
|
74 |
+
if ( ! $response_json ) {
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->token->set_images_usage( $response_json[ WebpConverterConstants::API_RESPONSE_VALUE_LIMIT_USAGE ] );
|
79 |
+
$this->token->set_images_limit( $response_json[ WebpConverterConstants::API_RESPONSE_VALUE_LIMIT_MAX ] );
|
80 |
+
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
}
|
src/Settings/Option/AccessTokenOption.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Settings\Option;
|
4 |
+
|
5 |
+
use WebpConverter\Repository\TokenRepository;
|
6 |
+
use WebpConverter\WebpConverterConstants;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* {@inheritdoc}
|
10 |
+
*/
|
11 |
+
class AccessTokenOption extends OptionAbstract {
|
12 |
+
|
13 |
+
const OPTION_NAME = 'access_token';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var TokenRepository
|
17 |
+
*/
|
18 |
+
private $token_repository;
|
19 |
+
|
20 |
+
public function __construct( TokenRepository $token_repository = null ) {
|
21 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* {@inheritdoc}
|
26 |
+
*/
|
27 |
+
public function get_priority(): int {
|
28 |
+
return 30;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function get_name(): string {
|
35 |
+
return self::OPTION_NAME;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* {@inheritdoc}
|
40 |
+
*/
|
41 |
+
public function get_type(): string {
|
42 |
+
return OptionAbstract::OPTION_TYPE_TOKEN;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* {@inheritdoc}
|
47 |
+
*/
|
48 |
+
public function get_label(): string {
|
49 |
+
return __( 'Access Token', 'webp-converter-for-media' );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* {@inheritdoc}
|
54 |
+
*/
|
55 |
+
public function get_info(): string {
|
56 |
+
if ( $this->token_repository->get_token()->get_valid_status() ) {
|
57 |
+
return sprintf(
|
58 |
+
/* translators: %1$s: open anchor tag, %2$s: close anchor tag */
|
59 |
+
__( 'To manage your subscriptions, please visit %1$sour website%2$s.', 'webp-converter-for-media' ),
|
60 |
+
'<a href="' . esc_url( WebpConverterConstants::SUBSCRIPTION_MANAGEMENT_URL ) . '" target="_blank">',
|
61 |
+
'</a>'
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
return sprintf(
|
66 |
+
/* translators: %1$s: open anchor tag, %2$s: close anchor tag, %3$s: open anchor tag, %4$s: close anchor tag */
|
67 |
+
__( 'Provide a valid value to access %1$sthe PRO functionalities%2$s. You can find out more about it %3$shere%4$s.', 'webp-converter-for-media' ),
|
68 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-access-token-pro-features' ) ) . '" target="_blank">',
|
69 |
+
'</a>',
|
70 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-access-token-upgrade' ) ) . '" target="_blank">',
|
71 |
+
'</a>'
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* {@inheritdoc}
|
77 |
+
*
|
78 |
+
* @return string[]
|
79 |
+
*/
|
80 |
+
public function get_values( array $settings ): array {
|
81 |
+
return [];
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* {@inheritdoc}
|
86 |
+
*/
|
87 |
+
public function get_default_value( array $settings = null ): string {
|
88 |
+
return '';
|
89 |
+
}
|
90 |
+
}
|
src/Settings/Option/ConversionMethodOption.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace WebpConverter\Settings\Option;
|
4 |
|
5 |
use WebpConverter\Conversion\Method\MethodFactory;
|
|
|
6 |
|
7 |
/**
|
8 |
* {@inheritdoc}
|
@@ -26,7 +27,7 @@ class ConversionMethodOption extends OptionAbstract {
|
|
26 |
* {@inheritdoc}
|
27 |
*/
|
28 |
public function get_priority(): int {
|
29 |
-
return
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -53,8 +54,17 @@ class ConversionMethodOption extends OptionAbstract {
|
|
53 |
/**
|
54 |
* {@inheritdoc}
|
55 |
*/
|
56 |
-
public function
|
57 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
/**
|
3 |
namespace WebpConverter\Settings\Option;
|
4 |
|
5 |
use WebpConverter\Conversion\Method\MethodFactory;
|
6 |
+
use WebpConverter\WebpConverterConstants;
|
7 |
|
8 |
/**
|
9 |
* {@inheritdoc}
|
27 |
* {@inheritdoc}
|
28 |
*/
|
29 |
public function get_priority(): int {
|
30 |
+
return 50;
|
31 |
}
|
32 |
|
33 |
/**
|
54 |
/**
|
55 |
* {@inheritdoc}
|
56 |
*/
|
57 |
+
public function get_notice_lines() {
|
58 |
+
return [
|
59 |
+
__( 'The Remote server allows you to reduce the server load, because your images are converted by our server. This option is also useful when the server does not meet all of the plugin\'s technical requirements.', 'webp-converter-for-media' ),
|
60 |
+
sprintf(
|
61 |
+
/* translators: %1$s: open anchor tag, %2$s: arrow icon, %3$s: close anchor tag */
|
62 |
+
__( '%1$sRead more %2$s%3$s', 'webp-converter-for-media' ),
|
63 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-conversion-method-info' ) ) . '" target="_blank">',
|
64 |
+
'<span class="dashicons dashicons-arrow-right-alt"></span>',
|
65 |
+
'</a>'
|
66 |
+
),
|
67 |
+
];
|
68 |
}
|
69 |
|
70 |
/**
|
src/Settings/Option/ExtraFeaturesOption.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
namespace WebpConverter\Settings\Option;
|
4 |
|
5 |
use WebpConverter\Conversion\Method\GdMethod;
|
6 |
-
use WebpConverter\Loader\
|
7 |
|
8 |
/**
|
9 |
* {@inheritdoc}
|
@@ -23,7 +23,7 @@ class ExtraFeaturesOption extends OptionAbstract {
|
|
23 |
* {@inheritdoc}
|
24 |
*/
|
25 |
public function get_priority(): int {
|
26 |
-
return
|
27 |
}
|
28 |
|
29 |
/**
|
@@ -62,11 +62,11 @@ class ExtraFeaturesOption extends OptionAbstract {
|
|
62 |
public function get_values( array $settings ): array {
|
63 |
return [
|
64 |
self::OPTION_VALUE_ONLY_SMALLER => __(
|
65 |
-
'Automatic removal of
|
66 |
'webp-converter-for-media'
|
67 |
),
|
68 |
self::OPTION_VALUE_MOD_EXPIRES => __(
|
69 |
-
'Browser Caching for
|
70 |
'webp-converter-for-media'
|
71 |
),
|
72 |
self::OPTION_VALUE_KEEP_METADATA => __(
|
@@ -82,7 +82,7 @@ class ExtraFeaturesOption extends OptionAbstract {
|
|
82 |
'webp-converter-for-media'
|
83 |
),
|
84 |
self::OPTION_VALUE_REFERER_DISABLED => __(
|
85 |
-
'Force redirections to
|
86 |
'webp-converter-for-media'
|
87 |
),
|
88 |
self::OPTION_VALUE_DEBUG_ENABLED => __(
|
@@ -102,7 +102,7 @@ class ExtraFeaturesOption extends OptionAbstract {
|
|
102 |
if ( ( $settings[ ConversionMethodOption::OPTION_NAME ] ?? '' ) === GdMethod::METHOD_NAME ) {
|
103 |
$values[] = self::OPTION_VALUE_KEEP_METADATA;
|
104 |
}
|
105 |
-
if ( ( $settings[ LoaderTypeOption::OPTION_NAME ] ?? '' )
|
106 |
$values[] = self::OPTION_VALUE_REFERER_DISABLED;
|
107 |
}
|
108 |
return $values;
|
3 |
namespace WebpConverter\Settings\Option;
|
4 |
|
5 |
use WebpConverter\Conversion\Method\GdMethod;
|
6 |
+
use WebpConverter\Loader\PassthruLoader;
|
7 |
|
8 |
/**
|
9 |
* {@inheritdoc}
|
23 |
* {@inheritdoc}
|
24 |
*/
|
25 |
public function get_priority(): int {
|
26 |
+
return 80;
|
27 |
}
|
28 |
|
29 |
/**
|
62 |
public function get_values( array $settings ): array {
|
63 |
return [
|
64 |
self::OPTION_VALUE_ONLY_SMALLER => __(
|
65 |
+
'Automatic removal of files in output formats larger than original',
|
66 |
'webp-converter-for-media'
|
67 |
),
|
68 |
self::OPTION_VALUE_MOD_EXPIRES => __(
|
69 |
+
'Browser Caching for files in output formats (saving images in browser cache memory)',
|
70 |
'webp-converter-for-media'
|
71 |
),
|
72 |
self::OPTION_VALUE_KEEP_METADATA => __(
|
82 |
'webp-converter-for-media'
|
83 |
),
|
84 |
self::OPTION_VALUE_REFERER_DISABLED => __(
|
85 |
+
'Force redirections to output formats for all domains (by default, images in output formats are loaded only in domain of your website - when image is displayed via URL on another domain that original file is loaded)',
|
86 |
'webp-converter-for-media'
|
87 |
),
|
88 |
self::OPTION_VALUE_DEBUG_ENABLED => __(
|
102 |
if ( ( $settings[ ConversionMethodOption::OPTION_NAME ] ?? '' ) === GdMethod::METHOD_NAME ) {
|
103 |
$values[] = self::OPTION_VALUE_KEEP_METADATA;
|
104 |
}
|
105 |
+
if ( ( $settings[ LoaderTypeOption::OPTION_NAME ] ?? '' ) === PassthruLoader::LOADER_TYPE ) {
|
106 |
$values[] = self::OPTION_VALUE_REFERER_DISABLED;
|
107 |
}
|
108 |
return $values;
|
src/Settings/Option/ImagesQualityOption.php
CHANGED
@@ -13,7 +13,7 @@ class ImagesQualityOption extends OptionAbstract {
|
|
13 |
* {@inheritdoc}
|
14 |
*/
|
15 |
public function get_priority(): int {
|
16 |
-
return
|
17 |
}
|
18 |
|
19 |
/**
|
13 |
* {@inheritdoc}
|
14 |
*/
|
15 |
public function get_priority(): int {
|
16 |
+
return 60;
|
17 |
}
|
18 |
|
19 |
/**
|
src/Settings/Option/LoaderTypeOption.php
CHANGED
@@ -16,7 +16,7 @@ class LoaderTypeOption extends OptionAbstract {
|
|
16 |
* {@inheritdoc}
|
17 |
*/
|
18 |
public function get_priority(): int {
|
19 |
-
return
|
20 |
}
|
21 |
|
22 |
/**
|
16 |
* {@inheritdoc}
|
17 |
*/
|
18 |
public function get_priority(): int {
|
19 |
+
return 70;
|
20 |
}
|
21 |
|
22 |
/**
|
src/Settings/Option/OptionAbstract.php
CHANGED
@@ -11,6 +11,7 @@ abstract class OptionAbstract implements OptionInterface {
|
|
11 |
const OPTION_TYPE_RADIO = 'radio';
|
12 |
const OPTION_TYPE_QUALITY = 'quality';
|
13 |
const OPTION_TYPE_INPUT = 'input';
|
|
|
14 |
|
15 |
/**
|
16 |
* {@inheritdoc}
|
11 |
const OPTION_TYPE_RADIO = 'radio';
|
12 |
const OPTION_TYPE_QUALITY = 'quality';
|
13 |
const OPTION_TYPE_INPUT = 'input';
|
14 |
+
const OPTION_TYPE_TOKEN = 'token';
|
15 |
|
16 |
/**
|
17 |
* {@inheritdoc}
|
src/Settings/Option/OptionIntegration.php
CHANGED
@@ -85,6 +85,7 @@ class OptionIntegration {
|
|
85 |
}
|
86 |
return null;
|
87 |
case OptionAbstract::OPTION_TYPE_INPUT:
|
|
|
88 |
return sanitize_text_field( $current_value );
|
89 |
}
|
90 |
|
85 |
}
|
86 |
return null;
|
87 |
case OptionAbstract::OPTION_TYPE_INPUT:
|
88 |
+
case OptionAbstract::OPTION_TYPE_TOKEN:
|
89 |
return sanitize_text_field( $current_value );
|
90 |
}
|
91 |
|
src/Settings/Option/OptionsAggregator.php
CHANGED
@@ -19,6 +19,7 @@ class OptionsAggregator {
|
|
19 |
|
20 |
$this->set_option( new SupportedExtensionsOption() );
|
21 |
$this->set_option( new SupportedDirectoriesOption() );
|
|
|
22 |
$this->set_option( new OutputFormatsOption( $conversion_method ) );
|
23 |
$this->set_option( $conversion_method );
|
24 |
$this->set_option( new ImagesQualityOption() );
|
19 |
|
20 |
$this->set_option( new SupportedExtensionsOption() );
|
21 |
$this->set_option( new SupportedDirectoriesOption() );
|
22 |
+
$this->set_option( new AccessTokenOption() );
|
23 |
$this->set_option( new OutputFormatsOption( $conversion_method ) );
|
24 |
$this->set_option( $conversion_method );
|
25 |
$this->set_option( new ImagesQualityOption() );
|
src/Settings/Option/OutputFormatsOption.php
CHANGED
@@ -4,6 +4,7 @@ namespace WebpConverter\Settings\Option;
|
|
4 |
|
5 |
use WebpConverter\Conversion\Format\FormatFactory;
|
6 |
use WebpConverter\Conversion\Format\WebpFormat;
|
|
|
7 |
|
8 |
/**
|
9 |
* {@inheritdoc}
|
@@ -33,7 +34,7 @@ class OutputFormatsOption extends OptionAbstract {
|
|
33 |
* {@inheritdoc}
|
34 |
*/
|
35 |
public function get_priority(): int {
|
36 |
-
return
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -57,6 +58,22 @@ class OutputFormatsOption extends OptionAbstract {
|
|
57 |
return __( 'List of supported output formats', 'webp-converter-for-media' );
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* {@inheritdoc}
|
62 |
*
|
4 |
|
5 |
use WebpConverter\Conversion\Format\FormatFactory;
|
6 |
use WebpConverter\Conversion\Format\WebpFormat;
|
7 |
+
use WebpConverter\WebpConverterConstants;
|
8 |
|
9 |
/**
|
10 |
* {@inheritdoc}
|
34 |
* {@inheritdoc}
|
35 |
*/
|
36 |
public function get_priority(): int {
|
37 |
+
return 40;
|
38 |
}
|
39 |
|
40 |
/**
|
58 |
return __( 'List of supported output formats', 'webp-converter-for-media' );
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* {@inheritdoc}
|
63 |
+
*/
|
64 |
+
public function get_notice_lines() {
|
65 |
+
return [
|
66 |
+
__( 'The AVIF format is a new extension - is the successor to WebP. It allows you to achieve even higher levels of image compression, and the quality of the converted images is better than in WebP.', 'webp-converter-for-media' ),
|
67 |
+
sprintf(
|
68 |
+
/* translators: %1$s: open anchor tag, %2$s: arrow icon, %3$s: close anchor tag */
|
69 |
+
__( '%1$sRead more %2$s%3$s', 'webp-converter-for-media' ),
|
70 |
+
'<a href="' . esc_url( sprintf( WebpConverterConstants::UPGRADE_PRO_PREFIX_URL, 'field-output-formats-info' ) ) . '" target="_blank">',
|
71 |
+
'<span class="dashicons dashicons-arrow-right-alt"></span>',
|
72 |
+
'</a>'
|
73 |
+
),
|
74 |
+
];
|
75 |
+
}
|
76 |
+
|
77 |
/**
|
78 |
* {@inheritdoc}
|
79 |
*
|
src/Settings/Page/SettingsPage.php
CHANGED
@@ -3,11 +3,13 @@
|
|
3 |
|
4 |
namespace WebpConverter\Settings\Page;
|
5 |
|
|
|
6 |
use WebpConverter\Conversion\Endpoint\PathsEndpoint;
|
7 |
use WebpConverter\Conversion\Endpoint\RegenerateEndpoint;
|
8 |
use WebpConverter\Loader\LoaderAbstract;
|
9 |
use WebpConverter\PluginData;
|
10 |
use WebpConverter\PluginInfo;
|
|
|
11 |
use WebpConverter\Service\ViewLoader;
|
12 |
use WebpConverter\Settings\PluginOptions;
|
13 |
use WebpConverter\Settings\SettingsSave;
|
@@ -29,12 +31,19 @@ class SettingsPage extends PageAbstract {
|
|
29 |
*/
|
30 |
private $plugin_data;
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
public function __construct(
|
33 |
PluginInfo $plugin_info,
|
34 |
-
PluginData $plugin_data
|
|
|
35 |
) {
|
36 |
-
$this->plugin_info
|
37 |
-
$this->plugin_data
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -53,22 +62,26 @@ class SettingsPage extends PageAbstract {
|
|
53 |
( new ViewLoader( $this->plugin_info ) )->load_view(
|
54 |
self::PAGE_VIEW_PATH,
|
55 |
[
|
56 |
-
'errors_messages'
|
57 |
-
'errors_codes'
|
58 |
-
'options'
|
59 |
-
'submit_value'
|
60 |
-
'
|
|
|
|
|
|
|
61 |
'%1$s&%2$s=%3$s',
|
62 |
PageIntegration::get_settings_page_url(),
|
63 |
SettingsSave::NONCE_PARAM_KEY,
|
64 |
wp_create_nonce( SettingsSave::NONCE_PARAM_VALUE )
|
65 |
),
|
66 |
-
'settings_debug_url'
|
67 |
'%s&action=server',
|
68 |
PageIntegration::get_settings_page_url()
|
69 |
),
|
70 |
-
'
|
71 |
-
'
|
|
|
72 |
]
|
73 |
);
|
74 |
|
3 |
|
4 |
namespace WebpConverter\Settings\Page;
|
5 |
|
6 |
+
use WebpConverter\Conversion\Endpoint\ImagesCounterEndpoint;
|
7 |
use WebpConverter\Conversion\Endpoint\PathsEndpoint;
|
8 |
use WebpConverter\Conversion\Endpoint\RegenerateEndpoint;
|
9 |
use WebpConverter\Loader\LoaderAbstract;
|
10 |
use WebpConverter\PluginData;
|
11 |
use WebpConverter\PluginInfo;
|
12 |
+
use WebpConverter\Repository\TokenRepository;
|
13 |
use WebpConverter\Service\ViewLoader;
|
14 |
use WebpConverter\Settings\PluginOptions;
|
15 |
use WebpConverter\Settings\SettingsSave;
|
31 |
*/
|
32 |
private $plugin_data;
|
33 |
|
34 |
+
/**
|
35 |
+
* @var TokenRepository
|
36 |
+
*/
|
37 |
+
private $token_repository;
|
38 |
+
|
39 |
public function __construct(
|
40 |
PluginInfo $plugin_info,
|
41 |
+
PluginData $plugin_data,
|
42 |
+
TokenRepository $token_repository = null
|
43 |
) {
|
44 |
+
$this->plugin_info = $plugin_info;
|
45 |
+
$this->plugin_data = $plugin_data;
|
46 |
+
$this->token_repository = $token_repository ?: new TokenRepository();
|
47 |
}
|
48 |
|
49 |
/**
|
62 |
( new ViewLoader( $this->plugin_info ) )->load_view(
|
63 |
self::PAGE_VIEW_PATH,
|
64 |
[
|
65 |
+
'errors_messages' => apply_filters( 'webpc_server_errors_messages', [] ),
|
66 |
+
'errors_codes' => apply_filters( 'webpc_server_errors', [] ),
|
67 |
+
'options' => ( new PluginOptions() )->get_options(),
|
68 |
+
'submit_value' => SettingsSave::SUBMIT_VALUE,
|
69 |
+
'submit_activate_token' => SettingsSave::SUBMIT_TOKEN_ACTIVATE,
|
70 |
+
'submit_deactivate_token' => SettingsSave::SUBMIT_TOKEN_DEACTIVATE,
|
71 |
+
'token_valid_status' => $this->token_repository->get_token()->get_valid_status(),
|
72 |
+
'settings_url' => sprintf(
|
73 |
'%1$s&%2$s=%3$s',
|
74 |
PageIntegration::get_settings_page_url(),
|
75 |
SettingsSave::NONCE_PARAM_KEY,
|
76 |
wp_create_nonce( SettingsSave::NONCE_PARAM_VALUE )
|
77 |
),
|
78 |
+
'settings_debug_url' => sprintf(
|
79 |
'%s&action=server',
|
80 |
PageIntegration::get_settings_page_url()
|
81 |
),
|
82 |
+
'api_calculate_url' => ( new ImagesCounterEndpoint( $this->plugin_data ) )->get_route_url(),
|
83 |
+
'api_paths_url' => ( new PathsEndpoint( $this->plugin_data ) )->get_route_url(),
|
84 |
+
'api_regenerate_url' => ( new RegenerateEndpoint( $this->plugin_data ) )->get_route_url(),
|
85 |
]
|
86 |
);
|
87 |
|
src/Settings/SettingsSave.php
CHANGED
@@ -4,9 +4,16 @@ namespace WebpConverter\Settings;
|
|
4 |
|
5 |
use WebpConverter\Conversion\Cron\Event;
|
6 |
use WebpConverter\Conversion\Directory\DirectoryFactory;
|
|
|
|
|
|
|
7 |
use WebpConverter\Loader\LoaderAbstract;
|
8 |
use WebpConverter\PluginData;
|
9 |
use WebpConverter\Service\OptionsAccessManager;
|
|
|
|
|
|
|
|
|
10 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
11 |
|
12 |
/**
|
@@ -14,18 +21,26 @@ use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
|
14 |
*/
|
15 |
class SettingsSave {
|
16 |
|
17 |
-
const SETTINGS_OPTION
|
18 |
-
const SUBMIT_VALUE
|
19 |
-
const
|
20 |
-
const
|
|
|
|
|
21 |
|
22 |
/**
|
23 |
* @var PluginData
|
24 |
*/
|
25 |
private $plugin_data;
|
26 |
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/**
|
@@ -34,7 +49,9 @@ class SettingsSave {
|
|
34 |
* @return void
|
35 |
*/
|
36 |
public function save_settings() {
|
37 |
-
if ( ! isset( $_POST[ self::SUBMIT_VALUE ] )
|
|
|
|
|
38 |
|| ! isset( $_REQUEST[ self::NONCE_PARAM_KEY ] )
|
39 |
|| ! wp_verify_nonce( $_REQUEST[ self::NONCE_PARAM_KEY ], self::NONCE_PARAM_VALUE ) ) { // phpcs:ignore
|
40 |
return;
|
@@ -46,7 +63,26 @@ class SettingsSave {
|
|
46 |
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
47 |
}
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
$this->plugin_data->invalidate_plugin_settings();
|
51 |
$this->init_actions_after_save();
|
52 |
}
|
4 |
|
5 |
use WebpConverter\Conversion\Cron\Event;
|
6 |
use WebpConverter\Conversion\Directory\DirectoryFactory;
|
7 |
+
use WebpConverter\Conversion\Format\AvifFormat;
|
8 |
+
use WebpConverter\Conversion\Format\WebpFormat;
|
9 |
+
use WebpConverter\Conversion\Method\RemoteMethod;
|
10 |
use WebpConverter\Loader\LoaderAbstract;
|
11 |
use WebpConverter\PluginData;
|
12 |
use WebpConverter\Service\OptionsAccessManager;
|
13 |
+
use WebpConverter\Service\TokenValidator;
|
14 |
+
use WebpConverter\Settings\Option\AccessTokenOption;
|
15 |
+
use WebpConverter\Settings\Option\ConversionMethodOption;
|
16 |
+
use WebpConverter\Settings\Option\OutputFormatsOption;
|
17 |
use WebpConverter\Settings\Option\SupportedDirectoriesOption;
|
18 |
|
19 |
/**
|
21 |
*/
|
22 |
class SettingsSave {
|
23 |
|
24 |
+
const SETTINGS_OPTION = 'webpc_settings';
|
25 |
+
const SUBMIT_VALUE = 'webpc_save';
|
26 |
+
const SUBMIT_TOKEN_ACTIVATE = 'webpc_token_activate';
|
27 |
+
const SUBMIT_TOKEN_DEACTIVATE = 'webpc_token_deactivate';
|
28 |
+
const NONCE_PARAM_KEY = '_wpnonce';
|
29 |
+
const NONCE_PARAM_VALUE = 'webpc-save';
|
30 |
|
31 |
/**
|
32 |
* @var PluginData
|
33 |
*/
|
34 |
private $plugin_data;
|
35 |
|
36 |
+
/**
|
37 |
+
* @var TokenValidator
|
38 |
+
*/
|
39 |
+
private $token_validator;
|
40 |
+
|
41 |
+
public function __construct( PluginData $plugin_data, TokenValidator $token_validator = null ) {
|
42 |
+
$this->plugin_data = $plugin_data;
|
43 |
+
$this->token_validator = $token_validator ?: new TokenValidator();
|
44 |
}
|
45 |
|
46 |
/**
|
49 |
* @return void
|
50 |
*/
|
51 |
public function save_settings() {
|
52 |
+
if ( ( ! isset( $_POST[ self::SUBMIT_VALUE ] )
|
53 |
+
&& ! isset( $_POST[ self::SUBMIT_TOKEN_ACTIVATE ] )
|
54 |
+
&& ! isset( $_POST[ self::SUBMIT_TOKEN_DEACTIVATE ] ) )
|
55 |
|| ! isset( $_REQUEST[ self::NONCE_PARAM_KEY ] )
|
56 |
|| ! wp_verify_nonce( $_REQUEST[ self::NONCE_PARAM_KEY ], self::NONCE_PARAM_VALUE ) ) { // phpcs:ignore
|
57 |
return;
|
63 |
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
64 |
}
|
65 |
|
66 |
+
if ( isset( $_POST[ self::SUBMIT_TOKEN_ACTIVATE ] ) ) {
|
67 |
+
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = sanitize_text_field( $_POST[ AccessTokenOption::OPTION_NAME ] ?: '' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
68 |
+
} elseif ( isset( $_POST[ self::SUBMIT_TOKEN_DEACTIVATE ] ) ) {
|
69 |
+
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = '';
|
70 |
+
}
|
71 |
+
|
72 |
+
$token = $this->token_validator->validate_token( $plugin_settings[ AccessTokenOption::OPTION_NAME ] );
|
73 |
+
if ( $token->get_valid_status() ) {
|
74 |
+
$plugin_settings[ ConversionMethodOption::OPTION_NAME ] = RemoteMethod::METHOD_NAME;
|
75 |
+
|
76 |
+
$output_formats = $plugin_settings[ OutputFormatsOption::OPTION_NAME ] ?: [ WebpFormat::FORMAT_EXTENSION ];
|
77 |
+
$output_formats[] = AvifFormat::FORMAT_EXTENSION;
|
78 |
+
|
79 |
+
$plugin_settings[ OutputFormatsOption::OPTION_NAME ] = array_unique( $output_formats );
|
80 |
+
}
|
81 |
+
|
82 |
+
OptionsAccessManager::update_option(
|
83 |
+
self::SETTINGS_OPTION,
|
84 |
+
( new PluginOptions() )->get_values( false, $plugin_settings )
|
85 |
+
);
|
86 |
$this->plugin_data->invalidate_plugin_settings();
|
87 |
$this->init_actions_after_save();
|
88 |
}
|
src/WebpConverter.php
CHANGED
@@ -27,11 +27,11 @@ class WebpConverter {
|
|
27 |
( new Action\RegenerateAll( $plugin_data ) )->init_hooks();
|
28 |
( new Conversion\Directory\DirectoryFactory() )->init_hooks();
|
29 |
( new Conversion\DirectoryFiles( $plugin_data ) )->init_hooks();
|
|
|
30 |
( new Endpoint\EndpointIntegration( new Endpoint\PathsEndpoint( $plugin_data ) ) )->init_hooks();
|
31 |
( new Endpoint\EndpointIntegration( new Endpoint\RegenerateEndpoint( $plugin_data ) ) )->init_hooks();
|
32 |
( new Conversion\SkipConvertedPaths( $plugin_data ) )->init_hooks();
|
33 |
( new Conversion\SkipExcludedPaths() )->init_hooks();
|
34 |
-
( new Conversion\SkipLarger( $plugin_data ) )->init_hooks();
|
35 |
( new Cron\Event( $plugin_data ) )->init_hooks();
|
36 |
( new Cron\Schedules() )->init_hooks();
|
37 |
( new ErrorDetectorAggregator( $plugin_info, $plugin_data ) )->init_hooks();
|
27 |
( new Action\RegenerateAll( $plugin_data ) )->init_hooks();
|
28 |
( new Conversion\Directory\DirectoryFactory() )->init_hooks();
|
29 |
( new Conversion\DirectoryFiles( $plugin_data ) )->init_hooks();
|
30 |
+
( new Endpoint\EndpointIntegration( new Endpoint\ImagesCounterEndpoint( $plugin_data ) ) )->init_hooks();
|
31 |
( new Endpoint\EndpointIntegration( new Endpoint\PathsEndpoint( $plugin_data ) ) )->init_hooks();
|
32 |
( new Endpoint\EndpointIntegration( new Endpoint\RegenerateEndpoint( $plugin_data ) ) )->init_hooks();
|
33 |
( new Conversion\SkipConvertedPaths( $plugin_data ) )->init_hooks();
|
34 |
( new Conversion\SkipExcludedPaths() )->init_hooks();
|
|
|
35 |
( new Cron\Event( $plugin_data ) )->init_hooks();
|
36 |
( new Cron\Schedules() )->init_hooks();
|
37 |
( new ErrorDetectorAggregator( $plugin_info, $plugin_data ) )->init_hooks();
|
src/WebpConverterConstants.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* .
|
7 |
+
*/
|
8 |
+
class WebpConverterConstants {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* URLs.
|
12 |
+
*/
|
13 |
+
const UPGRADE_PRO_PREFIX_URL = 'https://mattplugins.com/products/webp-converter-for-media-pro/?utm_source=webp-converter-for-media&utm_medium=plugin-settings&utm_campaign=upgrade-to-pro&utm_content=%s';
|
14 |
+
const SUBSCRIPTION_MANAGEMENT_URL = 'https://panel.mattplugins.com';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* API.
|
18 |
+
*/
|
19 |
+
const API_TOKEN_VALIDATION_URL = 'https://api-converter.mattplugins.com/access-token/%s';
|
20 |
+
const API_CONVERSION_URL = 'https://api-converter.mattplugins.com/convert';
|
21 |
+
const API_RESPONSE_VALUE_LIMIT_USAGE = 'api_limit_usage';
|
22 |
+
const API_RESPONSE_VALUE_LIMIT_MAX = 'api_limit_max';
|
23 |
+
const API_RESPONSE_VALUE_SUBSCRIPTION_ACTIVE = 'api_subscription_active';
|
24 |
+
const API_RESPONSE_VALUE_ERROR_MESSAGE = 'error_message';
|
25 |
+
const API_RESPONSE_VALUE_ERROR_FATAL_STATUS = 'error_fatal_status';
|
26 |
+
}
|
templates/components/fields/token.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Token field displayed in plugin settings form.
|
4 |
+
*
|
5 |
+
* @var string $submit_activate_token .
|
6 |
+
* @var string $submit_deactivate_token .
|
7 |
+
* @var bool $token_valid_status .
|
8 |
+
* @var string $api_calculate_url URL of REST API endpoint.
|
9 |
+
* @var mixed[] $option Data of field.
|
10 |
+
* @var string $index Index of field.
|
11 |
+
* @package WebP Converter for Media
|
12 |
+
*/
|
13 |
+
|
14 |
+
?>
|
15 |
+
<?php if ( $option['info'] ) : ?>
|
16 |
+
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
|
17 |
+
<?php endif; ?>
|
18 |
+
<div class="webpInput">
|
19 |
+
<input type="text"
|
20 |
+
name="<?php echo esc_attr( $option['name'] ); ?>"
|
21 |
+
value="<?php echo esc_attr( $option['value'] ); ?>"
|
22 |
+
id="<?php echo esc_attr( $option['name'] ); ?>"
|
23 |
+
class="webpInput__field"
|
24 |
+
<?php echo ( $token_valid_status ) ? 'readonly' : ''; ?>
|
25 |
+
>
|
26 |
+
<?php if ( ! $token_valid_status ) : ?>
|
27 |
+
<button type="submit"
|
28 |
+
name="<?php echo esc_attr( $submit_activate_token ); ?>"
|
29 |
+
class="webpInput__button webpButton webpButton--green">
|
30 |
+
<?php echo esc_html( __( 'Activate Token', 'webp-converter-for-media' ) ); ?>
|
31 |
+
</button>
|
32 |
+
<?php else : ?>
|
33 |
+
<button type="submit"
|
34 |
+
name="<?php echo esc_attr( $submit_deactivate_token ); ?>"
|
35 |
+
class="webpInput__button webpButton webpButton--red">
|
36 |
+
<?php echo esc_html( __( 'Deactivate Token', 'webp-converter-for-media' ) ); ?>
|
37 |
+
</button>
|
38 |
+
<?php endif; ?>
|
39 |
+
</div>
|
40 |
+
<p data-calculate-widget data-calculate-widget-api="<?php echo esc_url( $api_calculate_url ); ?>">
|
41 |
+
<?php
|
42 |
+
echo esc_html( __( 'How many maximum images to convert are on my website?', 'webp-converter-for-media' ) );
|
43 |
+
echo ' ';
|
44 |
+
echo wp_kses_post(
|
45 |
+
sprintf(
|
46 |
+
/* translators: %1$s: open anchor tag, %2$s: close anchor tag */
|
47 |
+
__( '%1$sCalculate%2$s', 'webp-converter-for-media' ),
|
48 |
+
'<a href="#" data-calculate-widget-button>',
|
49 |
+
'</a>'
|
50 |
+
)
|
51 |
+
);
|
52 |
+
?>
|
53 |
+
<strong data-calculate-widget-loading hidden>
|
54 |
+
<?php echo esc_html( __( 'Please wait...', 'webp-converter-for-media' ) ); ?>
|
55 |
+
</strong>
|
56 |
+
<strong data-calculate-widget-output hidden></strong>
|
57 |
+
</p>
|
templates/components/widgets/options.php
CHANGED
@@ -2,9 +2,13 @@
|
|
2 |
/**
|
3 |
* Widget displayed settings form on plugin settings page.
|
4 |
*
|
5 |
-
* @var mixed[] $options
|
6 |
-
* @var string $submit_value
|
7 |
-
* @var string $
|
|
|
|
|
|
|
|
|
8 |
* @package WebP Converter for Media
|
9 |
*/
|
10 |
|
2 |
/**
|
3 |
* Widget displayed settings form on plugin settings page.
|
4 |
*
|
5 |
+
* @var mixed[] $options Options of plugin settings.
|
6 |
+
* @var string $submit_value Value of submit button.
|
7 |
+
* @var string $submit_activate_token .
|
8 |
+
* @var string $submit_deactivate_token .
|
9 |
+
* @var bool $token_valid_status .
|
10 |
+
* @var string $settings_debug_url URL of plugin settings page (debug view).
|
11 |
+
* @var string $api_calculate_url URL of REST API endpoint.
|
12 |
* @package WebP Converter for Media
|
13 |
*/
|
14 |
|
templates/components/widgets/regenerate.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
/**
|
3 |
* Widget allows regeneration images on plugin settings page.
|
4 |
*
|
|
|
5 |
* @var string $api_paths_url URL of REST API endpoint.
|
6 |
* @var string $api_regenerate_url URL of REST API endpoint.
|
7 |
* @package WebP Converter for Media
|
@@ -56,32 +57,34 @@
|
|
56 |
?>
|
57 |
</div>
|
58 |
</div>
|
59 |
-
|
60 |
-
<div class="
|
61 |
-
<div class="
|
62 |
-
|
63 |
-
<
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
<
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
</div>
|
83 |
</div>
|
84 |
-
|
85 |
<div class="webpLoader__errors" hidden>
|
86 |
<div class="webpLoader__errorsTitle">
|
87 |
<?php echo esc_html( __( 'Additional informations about process:', 'webp-converter-for-media' ) ); ?>
|
2 |
/**
|
3 |
* Widget allows regeneration images on plugin settings page.
|
4 |
*
|
5 |
+
* @var bool $token_valid_status .
|
6 |
* @var string $api_paths_url URL of REST API endpoint.
|
7 |
* @var string $api_regenerate_url URL of REST API endpoint.
|
8 |
* @package WebP Converter for Media
|
57 |
?>
|
58 |
</div>
|
59 |
</div>
|
60 |
+
<?php if ( ! $token_valid_status ) : ?>
|
61 |
+
<div class="webpLoader__popup webpPopup" hidden>
|
62 |
+
<div class="webpPopup__inner">
|
63 |
+
<div class="webpPopup__image"></div>
|
64 |
+
<div class="webpPopup__content">
|
65 |
+
<p>
|
66 |
+
<?php
|
67 |
+
echo wp_kses_post(
|
68 |
+
sprintf(
|
69 |
+
/* translators: %s break line tag */
|
70 |
+
__( 'Hello, my name is Mateusz! %sI am glad you managed to reduce the weight of your website. If you would like to support me in developing this plugin, I will be very grateful to you! If every plugin user did it, I could devote myself fully to working on this plugin.', 'webp-converter-for-media' ),
|
71 |
+
'<br>'
|
72 |
+
)
|
73 |
+
);
|
74 |
+
?>
|
75 |
+
</p>
|
76 |
+
<p>
|
77 |
+
<a href="https://ko-fi.com/gbiorczyk/?utm_source=webp-converter-for-media&utm_medium=notice-regenerate"
|
78 |
+
target="_blank"
|
79 |
+
class="webpButton webpButton--blue dashicons-coffee"
|
80 |
+
>
|
81 |
+
<?php echo wp_kses_post( __( 'Provide me a coffee', 'webp-converter-for-media' ) ); ?>
|
82 |
+
</a>
|
83 |
+
</p>
|
84 |
+
</div>
|
85 |
</div>
|
86 |
</div>
|
87 |
+
<?php endif; ?>
|
88 |
<div class="webpLoader__errors" hidden>
|
89 |
<div class="webpLoader__errorsTitle">
|
90 |
<?php echo esc_html( __( 'Additional informations about process:', 'webp-converter-for-media' ) ); ?>
|
templates/views/settings.php
CHANGED
@@ -2,14 +2,18 @@
|
|
2 |
/**
|
3 |
* Main tab of plugin settings page.
|
4 |
*
|
5 |
-
* @var string[][] $errors_messages
|
6 |
-
* @var string[] $errors_codes
|
7 |
-
* @var mixed[] $options
|
8 |
-
* @var string $submit_value
|
9 |
-
* @var string $
|
10 |
-
* @var string $
|
11 |
-
* @var
|
12 |
-
* @var string $
|
|
|
|
|
|
|
|
|
13 |
* @package WebP Converter for Media
|
14 |
*/
|
15 |
|
@@ -26,6 +30,10 @@
|
|
26 |
<?php echo esc_html( __( 'Changes were successfully saved!', 'webp-converter-for-media' ) ); ?>
|
27 |
<?php echo esc_html( __( 'Please flush cache if you use caching plugin or caching via hosting.', 'webp-converter-for-media' ) ); ?>
|
28 |
</div>
|
|
|
|
|
|
|
|
|
29 |
<?php endif; ?>
|
30 |
<?php
|
31 |
require_once dirname( __DIR__ ) . '/components/widgets/errors.php';
|
2 |
/**
|
3 |
* Main tab of plugin settings page.
|
4 |
*
|
5 |
+
* @var string[][] $errors_messages .
|
6 |
+
* @var string[] $errors_codes .
|
7 |
+
* @var mixed[] $options Options of plugin settings.
|
8 |
+
* @var string $submit_value Value of submit button.
|
9 |
+
* @var string $submit_activate_token .
|
10 |
+
* @var string $submit_deactivate_token .
|
11 |
+
* @var bool $token_valid_status .
|
12 |
+
* @var string $settings_url URL of plugin settings page (default view).
|
13 |
+
* @var string $settings_debug_url URL of plugin settings page (debug view).
|
14 |
+
* @var string $api_calculate_url URL of REST API endpoint.
|
15 |
+
* @var string $api_paths_url URL of REST API endpoint.
|
16 |
+
* @var string $api_regenerate_url URL of REST API endpoint.
|
17 |
* @package WebP Converter for Media
|
18 |
*/
|
19 |
|
30 |
<?php echo esc_html( __( 'Changes were successfully saved!', 'webp-converter-for-media' ) ); ?>
|
31 |
<?php echo esc_html( __( 'Please flush cache if you use caching plugin or caching via hosting.', 'webp-converter-for-media' ) ); ?>
|
32 |
</div>
|
33 |
+
<?php elseif ( isset( $_POST[ $submit_activate_token ] ) && $token_valid_status ) : // phpcs:ignore ?>
|
34 |
+
<div class="webpPage__alert">
|
35 |
+
<?php echo esc_html( __( 'The access token has been activated!', 'webp-converter-for-media' ) ); ?>
|
36 |
+
</div>
|
37 |
<?php endif; ?>
|
38 |
<?php
|
39 |
require_once dirname( __DIR__ ) . '/components/widgets/errors.php';
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit80287993f128e7a857f0f2db132eda4f::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -37,13 +37,11 @@ namespace Composer\Autoload;
|
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
-
* @see
|
41 |
-
* @see
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
45 |
-
private $vendorDir;
|
46 |
-
|
47 |
// PSR-4
|
48 |
private $prefixLengthsPsr4 = array();
|
49 |
private $prefixDirsPsr4 = array();
|
@@ -59,13 +57,6 @@ class ClassLoader
|
|
59 |
private $missingClasses = array();
|
60 |
private $apcuPrefix;
|
61 |
|
62 |
-
private static $registeredLoaders = array();
|
63 |
-
|
64 |
-
public function __construct($vendorDir = null)
|
65 |
-
{
|
66 |
-
$this->vendorDir = $vendorDir;
|
67 |
-
}
|
68 |
-
|
69 |
public function getPrefixes()
|
70 |
{
|
71 |
if (!empty($this->prefixesPsr0)) {
|
@@ -309,17 +300,6 @@ class ClassLoader
|
|
309 |
public function register($prepend = false)
|
310 |
{
|
311 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
312 |
-
|
313 |
-
if (null === $this->vendorDir) {
|
314 |
-
return;
|
315 |
-
}
|
316 |
-
|
317 |
-
if ($prepend) {
|
318 |
-
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
319 |
-
} else {
|
320 |
-
unset(self::$registeredLoaders[$this->vendorDir]);
|
321 |
-
self::$registeredLoaders[$this->vendorDir] = $this;
|
322 |
-
}
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -328,17 +308,13 @@ class ClassLoader
|
|
328 |
public function unregister()
|
329 |
{
|
330 |
spl_autoload_unregister(array($this, 'loadClass'));
|
331 |
-
|
332 |
-
if (null !== $this->vendorDir) {
|
333 |
-
unset(self::$registeredLoaders[$this->vendorDir]);
|
334 |
-
}
|
335 |
}
|
336 |
|
337 |
/**
|
338 |
* Loads the given class or interface.
|
339 |
*
|
340 |
* @param string $class The name of the class
|
341 |
-
* @return
|
342 |
*/
|
343 |
public function loadClass($class)
|
344 |
{
|
@@ -347,8 +323,6 @@ class ClassLoader
|
|
347 |
|
348 |
return true;
|
349 |
}
|
350 |
-
|
351 |
-
return null;
|
352 |
}
|
353 |
|
354 |
/**
|
@@ -393,16 +367,6 @@ class ClassLoader
|
|
393 |
return $file;
|
394 |
}
|
395 |
|
396 |
-
/**
|
397 |
-
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
398 |
-
*
|
399 |
-
* @return self[]
|
400 |
-
*/
|
401 |
-
public static function getRegisteredLoaders()
|
402 |
-
{
|
403 |
-
return self::$registeredLoaders;
|
404 |
-
}
|
405 |
-
|
406 |
private function findFileWithExtension($class, $ext)
|
407 |
{
|
408 |
// PSR-4 lookup
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
|
|
|
|
45 |
// PSR-4
|
46 |
private $prefixLengthsPsr4 = array();
|
47 |
private $prefixDirsPsr4 = array();
|
57 |
private $missingClasses = array();
|
58 |
private $apcuPrefix;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
300 |
public function register($prepend = false)
|
301 |
{
|
302 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
|
305 |
/**
|
308 |
public function unregister()
|
309 |
{
|
310 |
spl_autoload_unregister(array($this, 'loadClass'));
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
314 |
* Loads the given class or interface.
|
315 |
*
|
316 |
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
*/
|
319 |
public function loadClass($class)
|
320 |
{
|
323 |
|
324 |
return true;
|
325 |
}
|
|
|
|
|
326 |
}
|
327 |
|
328 |
/**
|
367 |
return $file;
|
368 |
}
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
private function findFileWithExtension($class, $ext)
|
371 |
{
|
372 |
// PSR-4 lookup
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -6,7 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
10 |
'WebpConverter\\Action\\ConvertAttachment' => $baseDir . '/src/Action/ConvertAttachment.php',
|
11 |
'WebpConverter\\Action\\ConvertDir' => $baseDir . '/src/Action/ConvertDir.php',
|
12 |
'WebpConverter\\Action\\ConvertPaths' => $baseDir . '/src/Action/ConvertPaths.php',
|
@@ -27,21 +26,9 @@ return array(
|
|
27 |
'WebpConverter\\Conversion\\Endpoint\\EndpointAbstract' => $baseDir . '/src/Conversion/Endpoint/EndpointAbstract.php',
|
28 |
'WebpConverter\\Conversion\\Endpoint\\EndpointIntegration' => $baseDir . '/src/Conversion/Endpoint/EndpointIntegration.php',
|
29 |
'WebpConverter\\Conversion\\Endpoint\\EndpointInterface' => $baseDir . '/src/Conversion/Endpoint/EndpointInterface.php',
|
|
|
30 |
'WebpConverter\\Conversion\\Endpoint\\PathsEndpoint' => $baseDir . '/src/Conversion/Endpoint/PathsEndpoint.php',
|
31 |
'WebpConverter\\Conversion\\Endpoint\\RegenerateEndpoint' => $baseDir . '/src/Conversion/Endpoint/RegenerateEndpoint.php',
|
32 |
-
'WebpConverter\\Conversion\\Exception\\ConversionErrorException' => $baseDir . '/src/Conversion/Exception/ConversionErrorException.php',
|
33 |
-
'WebpConverter\\Conversion\\Exception\\ExceptionAbstract' => $baseDir . '/src/Conversion/Exception/ExceptionAbstract.php',
|
34 |
-
'WebpConverter\\Conversion\\Exception\\ExceptionInterface' => $baseDir . '/src/Conversion/Exception/ExceptionInterface.php',
|
35 |
-
'WebpConverter\\Conversion\\Exception\\ExtensionUnsupportedException' => $baseDir . '/src/Conversion/Exception/ExtensionUnsupportedException.php',
|
36 |
-
'WebpConverter\\Conversion\\Exception\\FunctionUnavailableException' => $baseDir . '/src/Conversion/Exception/FunctionUnavailableException.php',
|
37 |
-
'WebpConverter\\Conversion\\Exception\\ImageInvalidException' => $baseDir . '/src/Conversion/Exception/ImageInvalidException.php',
|
38 |
-
'WebpConverter\\Conversion\\Exception\\ImagickNotSupportWebpException' => $baseDir . '/src/Conversion/Exception/ImagickNotSupportWebpException.php',
|
39 |
-
'WebpConverter\\Conversion\\Exception\\ImagickUnavailableException' => $baseDir . '/src/Conversion/Exception/ImagickUnavailableException.php',
|
40 |
-
'WebpConverter\\Conversion\\Exception\\LargerThanOriginalException' => $baseDir . '/src/Conversion/Exception/LargerThanOriginalException.php',
|
41 |
-
'WebpConverter\\Conversion\\Exception\\OutputPathException' => $baseDir . '/src/Conversion/Exception/OutputPathException.php',
|
42 |
-
'WebpConverter\\Conversion\\Exception\\ResolutionOversizeException' => $baseDir . '/src/Conversion/Exception/ResolutionOversizeException.php',
|
43 |
-
'WebpConverter\\Conversion\\Exception\\ServerConfigurationException' => $baseDir . '/src/Conversion/Exception/ServerConfigurationException.php',
|
44 |
-
'WebpConverter\\Conversion\\Exception\\SourcePathException' => $baseDir . '/src/Conversion/Exception/SourcePathException.php',
|
45 |
'WebpConverter\\Conversion\\Format\\AvifFormat' => $baseDir . '/src/Conversion/Format/AvifFormat.php',
|
46 |
'WebpConverter\\Conversion\\Format\\FormatAbstract' => $baseDir . '/src/Conversion/Format/FormatAbstract.php',
|
47 |
'WebpConverter\\Conversion\\Format\\FormatFactory' => $baseDir . '/src/Conversion/Format/FormatFactory.php',
|
@@ -58,6 +45,7 @@ return array(
|
|
58 |
'WebpConverter\\Conversion\\Method\\MethodFactory' => $baseDir . '/src/Conversion/Method/MethodFactory.php',
|
59 |
'WebpConverter\\Conversion\\Method\\MethodIntegrator' => $baseDir . '/src/Conversion/Method/MethodIntegrator.php',
|
60 |
'WebpConverter\\Conversion\\Method\\MethodInterface' => $baseDir . '/src/Conversion/Method/MethodInterface.php',
|
|
|
61 |
'WebpConverter\\Conversion\\OutputPath' => $baseDir . '/src/Conversion/OutputPath.php',
|
62 |
'WebpConverter\\Conversion\\PathsValidator' => $baseDir . '/src/Conversion/PathsValidator.php',
|
63 |
'WebpConverter\\Conversion\\SkipConvertedPaths' => $baseDir . '/src/Conversion/SkipConvertedPaths.php',
|
@@ -69,10 +57,15 @@ return array(
|
|
69 |
'WebpConverter\\Error\\Detector\\LibsWithoutWebpSupportDetector' => $baseDir . '/src/Error/Detector/LibsWithoutWebpSupportDetector.php',
|
70 |
'WebpConverter\\Error\\Detector\\PassthruExecutionDetector' => $baseDir . '/src/Error/Detector/PassthruExecutionDetector.php',
|
71 |
'WebpConverter\\Error\\Detector\\PathsErrorsDetector' => $baseDir . '/src/Error/Detector/PathsErrorsDetector.php',
|
|
|
72 |
'WebpConverter\\Error\\Detector\\RestApiDisabledDetector' => $baseDir . '/src/Error/Detector/RestApiDisabledDetector.php',
|
73 |
'WebpConverter\\Error\\Detector\\RewritesErrorsDetector' => $baseDir . '/src/Error/Detector/RewritesErrorsDetector.php',
|
74 |
'WebpConverter\\Error\\Detector\\SettingsIncorrectDetector' => $baseDir . '/src/Error/Detector/SettingsIncorrectDetector.php',
|
|
|
|
|
75 |
'WebpConverter\\Error\\ErrorDetectorAggregator' => $baseDir . '/src/Error/ErrorDetectorAggregator.php',
|
|
|
|
|
76 |
'WebpConverter\\Error\\Notice\\BypassingApacheNotice' => $baseDir . '/src/Error/Notice/BypassingApacheNotice.php',
|
77 |
'WebpConverter\\Error\\Notice\\ErrorNotice' => $baseDir . '/src/Error/Notice/ErrorNotice.php',
|
78 |
'WebpConverter\\Error\\Notice\\LibsNotInstalledNotice' => $baseDir . '/src/Error/Notice/LibsNotInstalledNotice.php',
|
@@ -83,17 +76,36 @@ return array(
|
|
83 |
'WebpConverter\\Error\\Notice\\PathUploadsUnavailableNotice' => $baseDir . '/src/Error/Notice/PathUploadsUnavailableNotice.php',
|
84 |
'WebpConverter\\Error\\Notice\\PathWebpDuplicatedNotice' => $baseDir . '/src/Error/Notice/PathWebpDuplicatedNotice.php',
|
85 |
'WebpConverter\\Error\\Notice\\PathWebpNotWritableNotice' => $baseDir . '/src/Error/Notice/PathWebpNotWritableNotice.php',
|
|
|
86 |
'WebpConverter\\Error\\Notice\\RestApiDisabledNotice' => $baseDir . '/src/Error/Notice/RestApiDisabledNotice.php',
|
87 |
'WebpConverter\\Error\\Notice\\RewritesCachedNotice' => $baseDir . '/src/Error/Notice/RewritesCachedNotice.php',
|
88 |
'WebpConverter\\Error\\Notice\\RewritesNotExecutedNotice' => $baseDir . '/src/Error/Notice/RewritesNotExecutedNotice.php',
|
89 |
'WebpConverter\\Error\\Notice\\RewritesNotWorkingNotice' => $baseDir . '/src/Error/Notice/RewritesNotWorkingNotice.php',
|
90 |
'WebpConverter\\Error\\Notice\\SettingsIncorrectNotice' => $baseDir . '/src/Error/Notice/SettingsIncorrectNotice.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
'WebpConverter\\HookableInterface' => $baseDir . '/src/HookableInterface.php',
|
92 |
'WebpConverter\\Loader\\HtaccessLoader' => $baseDir . '/src/Loader/HtaccessLoader.php',
|
93 |
'WebpConverter\\Loader\\LoaderAbstract' => $baseDir . '/src/Loader/LoaderAbstract.php',
|
94 |
'WebpConverter\\Loader\\LoaderIntegration' => $baseDir . '/src/Loader/LoaderIntegration.php',
|
95 |
'WebpConverter\\Loader\\LoaderInterface' => $baseDir . '/src/Loader/LoaderInterface.php',
|
96 |
'WebpConverter\\Loader\\PassthruLoader' => $baseDir . '/src/Loader/PassthruLoader.php',
|
|
|
97 |
'WebpConverter\\Notice\\NoticeAbstract' => $baseDir . '/src/Notice/NoticeAbstract.php',
|
98 |
'WebpConverter\\Notice\\NoticeFactory' => $baseDir . '/src/Notice/NoticeFactory.php',
|
99 |
'WebpConverter\\Notice\\NoticeIntegration' => $baseDir . '/src/Notice/NoticeIntegration.php',
|
@@ -117,10 +129,13 @@ return array(
|
|
117 |
'WebpConverter\\Plugin\\Uninstall\\PluginSettings' => $baseDir . '/src/Plugin/Uninstall/PluginSettings.php',
|
118 |
'WebpConverter\\Plugin\\Uninstall\\WebpFiles' => $baseDir . '/src/Plugin/Uninstall/WebpFiles.php',
|
119 |
'WebpConverter\\Plugin\\Update' => $baseDir . '/src/Plugin/Update.php',
|
|
|
120 |
'WebpConverter\\Service\\FileLoader' => $baseDir . '/src/Service/FileLoader.php',
|
121 |
'WebpConverter\\Service\\OptionsAccessManager' => $baseDir . '/src/Service/OptionsAccessManager.php',
|
|
|
122 |
'WebpConverter\\Service\\ViewLoader' => $baseDir . '/src/Service/ViewLoader.php',
|
123 |
'WebpConverter\\Settings\\AdminAssets' => $baseDir . '/src/Settings/AdminAssets.php',
|
|
|
124 |
'WebpConverter\\Settings\\Option\\ConversionMethodOption' => $baseDir . '/src/Settings/Option/ConversionMethodOption.php',
|
125 |
'WebpConverter\\Settings\\Option\\ExtraFeaturesOption' => $baseDir . '/src/Settings/Option/ExtraFeaturesOption.php',
|
126 |
'WebpConverter\\Settings\\Option\\ImagesQualityOption' => $baseDir . '/src/Settings/Option/ImagesQualityOption.php',
|
@@ -140,4 +155,5 @@ return array(
|
|
140 |
'WebpConverter\\Settings\\PluginOptions' => $baseDir . '/src/Settings/PluginOptions.php',
|
141 |
'WebpConverter\\Settings\\SettingsSave' => $baseDir . '/src/Settings/SettingsSave.php',
|
142 |
'WebpConverter\\WebpConverter' => $baseDir . '/src/WebpConverter.php',
|
|
|
143 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
'WebpConverter\\Action\\ConvertAttachment' => $baseDir . '/src/Action/ConvertAttachment.php',
|
10 |
'WebpConverter\\Action\\ConvertDir' => $baseDir . '/src/Action/ConvertDir.php',
|
11 |
'WebpConverter\\Action\\ConvertPaths' => $baseDir . '/src/Action/ConvertPaths.php',
|
26 |
'WebpConverter\\Conversion\\Endpoint\\EndpointAbstract' => $baseDir . '/src/Conversion/Endpoint/EndpointAbstract.php',
|
27 |
'WebpConverter\\Conversion\\Endpoint\\EndpointIntegration' => $baseDir . '/src/Conversion/Endpoint/EndpointIntegration.php',
|
28 |
'WebpConverter\\Conversion\\Endpoint\\EndpointInterface' => $baseDir . '/src/Conversion/Endpoint/EndpointInterface.php',
|
29 |
+
'WebpConverter\\Conversion\\Endpoint\\ImagesCounterEndpoint' => $baseDir . '/src/Conversion/Endpoint/ImagesCounterEndpoint.php',
|
30 |
'WebpConverter\\Conversion\\Endpoint\\PathsEndpoint' => $baseDir . '/src/Conversion/Endpoint/PathsEndpoint.php',
|
31 |
'WebpConverter\\Conversion\\Endpoint\\RegenerateEndpoint' => $baseDir . '/src/Conversion/Endpoint/RegenerateEndpoint.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
'WebpConverter\\Conversion\\Format\\AvifFormat' => $baseDir . '/src/Conversion/Format/AvifFormat.php',
|
33 |
'WebpConverter\\Conversion\\Format\\FormatAbstract' => $baseDir . '/src/Conversion/Format/FormatAbstract.php',
|
34 |
'WebpConverter\\Conversion\\Format\\FormatFactory' => $baseDir . '/src/Conversion/Format/FormatFactory.php',
|
45 |
'WebpConverter\\Conversion\\Method\\MethodFactory' => $baseDir . '/src/Conversion/Method/MethodFactory.php',
|
46 |
'WebpConverter\\Conversion\\Method\\MethodIntegrator' => $baseDir . '/src/Conversion/Method/MethodIntegrator.php',
|
47 |
'WebpConverter\\Conversion\\Method\\MethodInterface' => $baseDir . '/src/Conversion/Method/MethodInterface.php',
|
48 |
+
'WebpConverter\\Conversion\\Method\\RemoteMethod' => $baseDir . '/src/Conversion/Method/RemoteMethod.php',
|
49 |
'WebpConverter\\Conversion\\OutputPath' => $baseDir . '/src/Conversion/OutputPath.php',
|
50 |
'WebpConverter\\Conversion\\PathsValidator' => $baseDir . '/src/Conversion/PathsValidator.php',
|
51 |
'WebpConverter\\Conversion\\SkipConvertedPaths' => $baseDir . '/src/Conversion/SkipConvertedPaths.php',
|
57 |
'WebpConverter\\Error\\Detector\\LibsWithoutWebpSupportDetector' => $baseDir . '/src/Error/Detector/LibsWithoutWebpSupportDetector.php',
|
58 |
'WebpConverter\\Error\\Detector\\PassthruExecutionDetector' => $baseDir . '/src/Error/Detector/PassthruExecutionDetector.php',
|
59 |
'WebpConverter\\Error\\Detector\\PathsErrorsDetector' => $baseDir . '/src/Error/Detector/PathsErrorsDetector.php',
|
60 |
+
'WebpConverter\\Error\\Detector\\PermalinksStructureDetector' => $baseDir . '/src/Error/Detector/PermalinksStructureDetector.php',
|
61 |
'WebpConverter\\Error\\Detector\\RestApiDisabledDetector' => $baseDir . '/src/Error/Detector/RestApiDisabledDetector.php',
|
62 |
'WebpConverter\\Error\\Detector\\RewritesErrorsDetector' => $baseDir . '/src/Error/Detector/RewritesErrorsDetector.php',
|
63 |
'WebpConverter\\Error\\Detector\\SettingsIncorrectDetector' => $baseDir . '/src/Error/Detector/SettingsIncorrectDetector.php',
|
64 |
+
'WebpConverter\\Error\\Detector\\TokenStatusDetector' => $baseDir . '/src/Error/Detector/TokenStatusDetector.php',
|
65 |
+
'WebpConverter\\Error\\Detector\\WebpFormatActivatedDetector' => $baseDir . '/src/Error/Detector/WebpFormatActivatedDetector.php',
|
66 |
'WebpConverter\\Error\\ErrorDetectorAggregator' => $baseDir . '/src/Error/ErrorDetectorAggregator.php',
|
67 |
+
'WebpConverter\\Error\\Notice\\AccessTokenInvalidNotice' => $baseDir . '/src/Error/Notice/AccessTokenInvalidNotice.php',
|
68 |
+
'WebpConverter\\Error\\Notice\\ApiLimitExceededNotice' => $baseDir . '/src/Error/Notice/ApiLimitExceededNotice.php',
|
69 |
'WebpConverter\\Error\\Notice\\BypassingApacheNotice' => $baseDir . '/src/Error/Notice/BypassingApacheNotice.php',
|
70 |
'WebpConverter\\Error\\Notice\\ErrorNotice' => $baseDir . '/src/Error/Notice/ErrorNotice.php',
|
71 |
'WebpConverter\\Error\\Notice\\LibsNotInstalledNotice' => $baseDir . '/src/Error/Notice/LibsNotInstalledNotice.php',
|
76 |
'WebpConverter\\Error\\Notice\\PathUploadsUnavailableNotice' => $baseDir . '/src/Error/Notice/PathUploadsUnavailableNotice.php',
|
77 |
'WebpConverter\\Error\\Notice\\PathWebpDuplicatedNotice' => $baseDir . '/src/Error/Notice/PathWebpDuplicatedNotice.php',
|
78 |
'WebpConverter\\Error\\Notice\\PathWebpNotWritableNotice' => $baseDir . '/src/Error/Notice/PathWebpNotWritableNotice.php',
|
79 |
+
'WebpConverter\\Error\\Notice\\PermalinksStructureInvalidNotice' => $baseDir . '/src/Error/Notice/PermalinksStructureInvalidNotice.php',
|
80 |
'WebpConverter\\Error\\Notice\\RestApiDisabledNotice' => $baseDir . '/src/Error/Notice/RestApiDisabledNotice.php',
|
81 |
'WebpConverter\\Error\\Notice\\RewritesCachedNotice' => $baseDir . '/src/Error/Notice/RewritesCachedNotice.php',
|
82 |
'WebpConverter\\Error\\Notice\\RewritesNotExecutedNotice' => $baseDir . '/src/Error/Notice/RewritesNotExecutedNotice.php',
|
83 |
'WebpConverter\\Error\\Notice\\RewritesNotWorkingNotice' => $baseDir . '/src/Error/Notice/RewritesNotWorkingNotice.php',
|
84 |
'WebpConverter\\Error\\Notice\\SettingsIncorrectNotice' => $baseDir . '/src/Error/Notice/SettingsIncorrectNotice.php',
|
85 |
+
'WebpConverter\\Error\\Notice\\WebpRequiredNotice' => $baseDir . '/src/Error/Notice/WebpRequiredNotice.php',
|
86 |
+
'WebpConverter\\Exception\\ConversionErrorException' => $baseDir . '/src/Exception/ConversionErrorException.php',
|
87 |
+
'WebpConverter\\Exception\\ExceptionAbstract' => $baseDir . '/src/Exception/ExceptionAbstract.php',
|
88 |
+
'WebpConverter\\Exception\\ExceptionInterface' => $baseDir . '/src/Exception/ExceptionInterface.php',
|
89 |
+
'WebpConverter\\Exception\\ExtensionUnsupportedException' => $baseDir . '/src/Exception/ExtensionUnsupportedException.php',
|
90 |
+
'WebpConverter\\Exception\\FilesizeOversizeException' => $baseDir . '/src/Exception/FilesizeOversizeException.php',
|
91 |
+
'WebpConverter\\Exception\\FunctionUnavailableException' => $baseDir . '/src/Exception/FunctionUnavailableException.php',
|
92 |
+
'WebpConverter\\Exception\\ImageInvalidException' => $baseDir . '/src/Exception/ImageInvalidException.php',
|
93 |
+
'WebpConverter\\Exception\\ImagickNotSupportWebpException' => $baseDir . '/src/Exception/ImagickNotSupportWebpException.php',
|
94 |
+
'WebpConverter\\Exception\\ImagickUnavailableException' => $baseDir . '/src/Exception/ImagickUnavailableException.php',
|
95 |
+
'WebpConverter\\Exception\\LargerThanOriginalException' => $baseDir . '/src/Exception/LargerThanOriginalException.php',
|
96 |
+
'WebpConverter\\Exception\\OutputPathException' => $baseDir . '/src/Exception/OutputPathException.php',
|
97 |
+
'WebpConverter\\Exception\\RemoteErrorResponseException' => $baseDir . '/src/Exception/RemoteErrorResponseException.php',
|
98 |
+
'WebpConverter\\Exception\\RemoteRequestException' => $baseDir . '/src/Exception/RemoteRequestException.php',
|
99 |
+
'WebpConverter\\Exception\\ResolutionOversizeException' => $baseDir . '/src/Exception/ResolutionOversizeException.php',
|
100 |
+
'WebpConverter\\Exception\\ServerConfigurationException' => $baseDir . '/src/Exception/ServerConfigurationException.php',
|
101 |
+
'WebpConverter\\Exception\\SourcePathException' => $baseDir . '/src/Exception/SourcePathException.php',
|
102 |
'WebpConverter\\HookableInterface' => $baseDir . '/src/HookableInterface.php',
|
103 |
'WebpConverter\\Loader\\HtaccessLoader' => $baseDir . '/src/Loader/HtaccessLoader.php',
|
104 |
'WebpConverter\\Loader\\LoaderAbstract' => $baseDir . '/src/Loader/LoaderAbstract.php',
|
105 |
'WebpConverter\\Loader\\LoaderIntegration' => $baseDir . '/src/Loader/LoaderIntegration.php',
|
106 |
'WebpConverter\\Loader\\LoaderInterface' => $baseDir . '/src/Loader/LoaderInterface.php',
|
107 |
'WebpConverter\\Loader\\PassthruLoader' => $baseDir . '/src/Loader/PassthruLoader.php',
|
108 |
+
'WebpConverter\\Model\\Token' => $baseDir . '/src/Model/Token.php',
|
109 |
'WebpConverter\\Notice\\NoticeAbstract' => $baseDir . '/src/Notice/NoticeAbstract.php',
|
110 |
'WebpConverter\\Notice\\NoticeFactory' => $baseDir . '/src/Notice/NoticeFactory.php',
|
111 |
'WebpConverter\\Notice\\NoticeIntegration' => $baseDir . '/src/Notice/NoticeIntegration.php',
|
129 |
'WebpConverter\\Plugin\\Uninstall\\PluginSettings' => $baseDir . '/src/Plugin/Uninstall/PluginSettings.php',
|
130 |
'WebpConverter\\Plugin\\Uninstall\\WebpFiles' => $baseDir . '/src/Plugin/Uninstall/WebpFiles.php',
|
131 |
'WebpConverter\\Plugin\\Update' => $baseDir . '/src/Plugin/Update.php',
|
132 |
+
'WebpConverter\\Repository\\TokenRepository' => $baseDir . '/src/Repository/TokenRepository.php',
|
133 |
'WebpConverter\\Service\\FileLoader' => $baseDir . '/src/Service/FileLoader.php',
|
134 |
'WebpConverter\\Service\\OptionsAccessManager' => $baseDir . '/src/Service/OptionsAccessManager.php',
|
135 |
+
'WebpConverter\\Service\\TokenValidator' => $baseDir . '/src/Service/TokenValidator.php',
|
136 |
'WebpConverter\\Service\\ViewLoader' => $baseDir . '/src/Service/ViewLoader.php',
|
137 |
'WebpConverter\\Settings\\AdminAssets' => $baseDir . '/src/Settings/AdminAssets.php',
|
138 |
+
'WebpConverter\\Settings\\Option\\AccessTokenOption' => $baseDir . '/src/Settings/Option/AccessTokenOption.php',
|
139 |
'WebpConverter\\Settings\\Option\\ConversionMethodOption' => $baseDir . '/src/Settings/Option/ConversionMethodOption.php',
|
140 |
'WebpConverter\\Settings\\Option\\ExtraFeaturesOption' => $baseDir . '/src/Settings/Option/ExtraFeaturesOption.php',
|
141 |
'WebpConverter\\Settings\\Option\\ImagesQualityOption' => $baseDir . '/src/Settings/Option/ImagesQualityOption.php',
|
155 |
'WebpConverter\\Settings\\PluginOptions' => $baseDir . '/src/Settings/PluginOptions.php',
|
156 |
'WebpConverter\\Settings\\SettingsSave' => $baseDir . '/src/Settings/SettingsSave.php',
|
157 |
'WebpConverter\\WebpConverter' => $baseDir . '/src/WebpConverter.php',
|
158 |
+
'WebpConverter\\WebpConverterConstants' => $baseDir . '/src/WebpConverterConstants.php',
|
159 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit37614692d30f246008194d111fcdb36b
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
-
self::$loader = $loader = new \Composer\Autoload\ClassLoader(
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
-
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit80287993f128e7a857f0f2db132eda4f
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit80287993f128e7a857f0f2db132eda4f', 'loadClassLoader'), true, true);
|
26 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit80287993f128e7a857f0f2db132eda4f', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
+
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit80287993f128e7a857f0f2db132eda4f::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'W' =>
|
@@ -21,7 +21,6 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
21 |
);
|
22 |
|
23 |
public static $classMap = array (
|
24 |
-
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
25 |
'WebpConverter\\Action\\ConvertAttachment' => __DIR__ . '/../..' . '/src/Action/ConvertAttachment.php',
|
26 |
'WebpConverter\\Action\\ConvertDir' => __DIR__ . '/../..' . '/src/Action/ConvertDir.php',
|
27 |
'WebpConverter\\Action\\ConvertPaths' => __DIR__ . '/../..' . '/src/Action/ConvertPaths.php',
|
@@ -42,21 +41,9 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
42 |
'WebpConverter\\Conversion\\Endpoint\\EndpointAbstract' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointAbstract.php',
|
43 |
'WebpConverter\\Conversion\\Endpoint\\EndpointIntegration' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointIntegration.php',
|
44 |
'WebpConverter\\Conversion\\Endpoint\\EndpointInterface' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointInterface.php',
|
|
|
45 |
'WebpConverter\\Conversion\\Endpoint\\PathsEndpoint' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/PathsEndpoint.php',
|
46 |
'WebpConverter\\Conversion\\Endpoint\\RegenerateEndpoint' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/RegenerateEndpoint.php',
|
47 |
-
'WebpConverter\\Conversion\\Exception\\ConversionErrorException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ConversionErrorException.php',
|
48 |
-
'WebpConverter\\Conversion\\Exception\\ExceptionAbstract' => __DIR__ . '/../..' . '/src/Conversion/Exception/ExceptionAbstract.php',
|
49 |
-
'WebpConverter\\Conversion\\Exception\\ExceptionInterface' => __DIR__ . '/../..' . '/src/Conversion/Exception/ExceptionInterface.php',
|
50 |
-
'WebpConverter\\Conversion\\Exception\\ExtensionUnsupportedException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ExtensionUnsupportedException.php',
|
51 |
-
'WebpConverter\\Conversion\\Exception\\FunctionUnavailableException' => __DIR__ . '/../..' . '/src/Conversion/Exception/FunctionUnavailableException.php',
|
52 |
-
'WebpConverter\\Conversion\\Exception\\ImageInvalidException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ImageInvalidException.php',
|
53 |
-
'WebpConverter\\Conversion\\Exception\\ImagickNotSupportWebpException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ImagickNotSupportWebpException.php',
|
54 |
-
'WebpConverter\\Conversion\\Exception\\ImagickUnavailableException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ImagickUnavailableException.php',
|
55 |
-
'WebpConverter\\Conversion\\Exception\\LargerThanOriginalException' => __DIR__ . '/../..' . '/src/Conversion/Exception/LargerThanOriginalException.php',
|
56 |
-
'WebpConverter\\Conversion\\Exception\\OutputPathException' => __DIR__ . '/../..' . '/src/Conversion/Exception/OutputPathException.php',
|
57 |
-
'WebpConverter\\Conversion\\Exception\\ResolutionOversizeException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ResolutionOversizeException.php',
|
58 |
-
'WebpConverter\\Conversion\\Exception\\ServerConfigurationException' => __DIR__ . '/../..' . '/src/Conversion/Exception/ServerConfigurationException.php',
|
59 |
-
'WebpConverter\\Conversion\\Exception\\SourcePathException' => __DIR__ . '/../..' . '/src/Conversion/Exception/SourcePathException.php',
|
60 |
'WebpConverter\\Conversion\\Format\\AvifFormat' => __DIR__ . '/../..' . '/src/Conversion/Format/AvifFormat.php',
|
61 |
'WebpConverter\\Conversion\\Format\\FormatAbstract' => __DIR__ . '/../..' . '/src/Conversion/Format/FormatAbstract.php',
|
62 |
'WebpConverter\\Conversion\\Format\\FormatFactory' => __DIR__ . '/../..' . '/src/Conversion/Format/FormatFactory.php',
|
@@ -73,6 +60,7 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
73 |
'WebpConverter\\Conversion\\Method\\MethodFactory' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodFactory.php',
|
74 |
'WebpConverter\\Conversion\\Method\\MethodIntegrator' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodIntegrator.php',
|
75 |
'WebpConverter\\Conversion\\Method\\MethodInterface' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodInterface.php',
|
|
|
76 |
'WebpConverter\\Conversion\\OutputPath' => __DIR__ . '/../..' . '/src/Conversion/OutputPath.php',
|
77 |
'WebpConverter\\Conversion\\PathsValidator' => __DIR__ . '/../..' . '/src/Conversion/PathsValidator.php',
|
78 |
'WebpConverter\\Conversion\\SkipConvertedPaths' => __DIR__ . '/../..' . '/src/Conversion/SkipConvertedPaths.php',
|
@@ -84,10 +72,15 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
84 |
'WebpConverter\\Error\\Detector\\LibsWithoutWebpSupportDetector' => __DIR__ . '/../..' . '/src/Error/Detector/LibsWithoutWebpSupportDetector.php',
|
85 |
'WebpConverter\\Error\\Detector\\PassthruExecutionDetector' => __DIR__ . '/../..' . '/src/Error/Detector/PassthruExecutionDetector.php',
|
86 |
'WebpConverter\\Error\\Detector\\PathsErrorsDetector' => __DIR__ . '/../..' . '/src/Error/Detector/PathsErrorsDetector.php',
|
|
|
87 |
'WebpConverter\\Error\\Detector\\RestApiDisabledDetector' => __DIR__ . '/../..' . '/src/Error/Detector/RestApiDisabledDetector.php',
|
88 |
'WebpConverter\\Error\\Detector\\RewritesErrorsDetector' => __DIR__ . '/../..' . '/src/Error/Detector/RewritesErrorsDetector.php',
|
89 |
'WebpConverter\\Error\\Detector\\SettingsIncorrectDetector' => __DIR__ . '/../..' . '/src/Error/Detector/SettingsIncorrectDetector.php',
|
|
|
|
|
90 |
'WebpConverter\\Error\\ErrorDetectorAggregator' => __DIR__ . '/../..' . '/src/Error/ErrorDetectorAggregator.php',
|
|
|
|
|
91 |
'WebpConverter\\Error\\Notice\\BypassingApacheNotice' => __DIR__ . '/../..' . '/src/Error/Notice/BypassingApacheNotice.php',
|
92 |
'WebpConverter\\Error\\Notice\\ErrorNotice' => __DIR__ . '/../..' . '/src/Error/Notice/ErrorNotice.php',
|
93 |
'WebpConverter\\Error\\Notice\\LibsNotInstalledNotice' => __DIR__ . '/../..' . '/src/Error/Notice/LibsNotInstalledNotice.php',
|
@@ -98,17 +91,36 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
98 |
'WebpConverter\\Error\\Notice\\PathUploadsUnavailableNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathUploadsUnavailableNotice.php',
|
99 |
'WebpConverter\\Error\\Notice\\PathWebpDuplicatedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathWebpDuplicatedNotice.php',
|
100 |
'WebpConverter\\Error\\Notice\\PathWebpNotWritableNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathWebpNotWritableNotice.php',
|
|
|
101 |
'WebpConverter\\Error\\Notice\\RestApiDisabledNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RestApiDisabledNotice.php',
|
102 |
'WebpConverter\\Error\\Notice\\RewritesCachedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesCachedNotice.php',
|
103 |
'WebpConverter\\Error\\Notice\\RewritesNotExecutedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesNotExecutedNotice.php',
|
104 |
'WebpConverter\\Error\\Notice\\RewritesNotWorkingNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesNotWorkingNotice.php',
|
105 |
'WebpConverter\\Error\\Notice\\SettingsIncorrectNotice' => __DIR__ . '/../..' . '/src/Error/Notice/SettingsIncorrectNotice.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
'WebpConverter\\HookableInterface' => __DIR__ . '/../..' . '/src/HookableInterface.php',
|
107 |
'WebpConverter\\Loader\\HtaccessLoader' => __DIR__ . '/../..' . '/src/Loader/HtaccessLoader.php',
|
108 |
'WebpConverter\\Loader\\LoaderAbstract' => __DIR__ . '/../..' . '/src/Loader/LoaderAbstract.php',
|
109 |
'WebpConverter\\Loader\\LoaderIntegration' => __DIR__ . '/../..' . '/src/Loader/LoaderIntegration.php',
|
110 |
'WebpConverter\\Loader\\LoaderInterface' => __DIR__ . '/../..' . '/src/Loader/LoaderInterface.php',
|
111 |
'WebpConverter\\Loader\\PassthruLoader' => __DIR__ . '/../..' . '/src/Loader/PassthruLoader.php',
|
|
|
112 |
'WebpConverter\\Notice\\NoticeAbstract' => __DIR__ . '/../..' . '/src/Notice/NoticeAbstract.php',
|
113 |
'WebpConverter\\Notice\\NoticeFactory' => __DIR__ . '/../..' . '/src/Notice/NoticeFactory.php',
|
114 |
'WebpConverter\\Notice\\NoticeIntegration' => __DIR__ . '/../..' . '/src/Notice/NoticeIntegration.php',
|
@@ -132,10 +144,13 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
132 |
'WebpConverter\\Plugin\\Uninstall\\PluginSettings' => __DIR__ . '/../..' . '/src/Plugin/Uninstall/PluginSettings.php',
|
133 |
'WebpConverter\\Plugin\\Uninstall\\WebpFiles' => __DIR__ . '/../..' . '/src/Plugin/Uninstall/WebpFiles.php',
|
134 |
'WebpConverter\\Plugin\\Update' => __DIR__ . '/../..' . '/src/Plugin/Update.php',
|
|
|
135 |
'WebpConverter\\Service\\FileLoader' => __DIR__ . '/../..' . '/src/Service/FileLoader.php',
|
136 |
'WebpConverter\\Service\\OptionsAccessManager' => __DIR__ . '/../..' . '/src/Service/OptionsAccessManager.php',
|
|
|
137 |
'WebpConverter\\Service\\ViewLoader' => __DIR__ . '/../..' . '/src/Service/ViewLoader.php',
|
138 |
'WebpConverter\\Settings\\AdminAssets' => __DIR__ . '/../..' . '/src/Settings/AdminAssets.php',
|
|
|
139 |
'WebpConverter\\Settings\\Option\\ConversionMethodOption' => __DIR__ . '/../..' . '/src/Settings/Option/ConversionMethodOption.php',
|
140 |
'WebpConverter\\Settings\\Option\\ExtraFeaturesOption' => __DIR__ . '/../..' . '/src/Settings/Option/ExtraFeaturesOption.php',
|
141 |
'WebpConverter\\Settings\\Option\\ImagesQualityOption' => __DIR__ . '/../..' . '/src/Settings/Option/ImagesQualityOption.php',
|
@@ -155,14 +170,15 @@ class ComposerStaticInit37614692d30f246008194d111fcdb36b
|
|
155 |
'WebpConverter\\Settings\\PluginOptions' => __DIR__ . '/../..' . '/src/Settings/PluginOptions.php',
|
156 |
'WebpConverter\\Settings\\SettingsSave' => __DIR__ . '/../..' . '/src/Settings/SettingsSave.php',
|
157 |
'WebpConverter\\WebpConverter' => __DIR__ . '/../..' . '/src/WebpConverter.php',
|
|
|
158 |
);
|
159 |
|
160 |
public static function getInitializer(ClassLoader $loader)
|
161 |
{
|
162 |
return \Closure::bind(function () use ($loader) {
|
163 |
-
$loader->prefixLengthsPsr4 =
|
164 |
-
$loader->prefixDirsPsr4 =
|
165 |
-
$loader->classMap =
|
166 |
|
167 |
}, null, ClassLoader::class);
|
168 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit80287993f128e7a857f0f2db132eda4f
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'W' =>
|
21 |
);
|
22 |
|
23 |
public static $classMap = array (
|
|
|
24 |
'WebpConverter\\Action\\ConvertAttachment' => __DIR__ . '/../..' . '/src/Action/ConvertAttachment.php',
|
25 |
'WebpConverter\\Action\\ConvertDir' => __DIR__ . '/../..' . '/src/Action/ConvertDir.php',
|
26 |
'WebpConverter\\Action\\ConvertPaths' => __DIR__ . '/../..' . '/src/Action/ConvertPaths.php',
|
41 |
'WebpConverter\\Conversion\\Endpoint\\EndpointAbstract' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointAbstract.php',
|
42 |
'WebpConverter\\Conversion\\Endpoint\\EndpointIntegration' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointIntegration.php',
|
43 |
'WebpConverter\\Conversion\\Endpoint\\EndpointInterface' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/EndpointInterface.php',
|
44 |
+
'WebpConverter\\Conversion\\Endpoint\\ImagesCounterEndpoint' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/ImagesCounterEndpoint.php',
|
45 |
'WebpConverter\\Conversion\\Endpoint\\PathsEndpoint' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/PathsEndpoint.php',
|
46 |
'WebpConverter\\Conversion\\Endpoint\\RegenerateEndpoint' => __DIR__ . '/../..' . '/src/Conversion/Endpoint/RegenerateEndpoint.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
'WebpConverter\\Conversion\\Format\\AvifFormat' => __DIR__ . '/../..' . '/src/Conversion/Format/AvifFormat.php',
|
48 |
'WebpConverter\\Conversion\\Format\\FormatAbstract' => __DIR__ . '/../..' . '/src/Conversion/Format/FormatAbstract.php',
|
49 |
'WebpConverter\\Conversion\\Format\\FormatFactory' => __DIR__ . '/../..' . '/src/Conversion/Format/FormatFactory.php',
|
60 |
'WebpConverter\\Conversion\\Method\\MethodFactory' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodFactory.php',
|
61 |
'WebpConverter\\Conversion\\Method\\MethodIntegrator' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodIntegrator.php',
|
62 |
'WebpConverter\\Conversion\\Method\\MethodInterface' => __DIR__ . '/../..' . '/src/Conversion/Method/MethodInterface.php',
|
63 |
+
'WebpConverter\\Conversion\\Method\\RemoteMethod' => __DIR__ . '/../..' . '/src/Conversion/Method/RemoteMethod.php',
|
64 |
'WebpConverter\\Conversion\\OutputPath' => __DIR__ . '/../..' . '/src/Conversion/OutputPath.php',
|
65 |
'WebpConverter\\Conversion\\PathsValidator' => __DIR__ . '/../..' . '/src/Conversion/PathsValidator.php',
|
66 |
'WebpConverter\\Conversion\\SkipConvertedPaths' => __DIR__ . '/../..' . '/src/Conversion/SkipConvertedPaths.php',
|
72 |
'WebpConverter\\Error\\Detector\\LibsWithoutWebpSupportDetector' => __DIR__ . '/../..' . '/src/Error/Detector/LibsWithoutWebpSupportDetector.php',
|
73 |
'WebpConverter\\Error\\Detector\\PassthruExecutionDetector' => __DIR__ . '/../..' . '/src/Error/Detector/PassthruExecutionDetector.php',
|
74 |
'WebpConverter\\Error\\Detector\\PathsErrorsDetector' => __DIR__ . '/../..' . '/src/Error/Detector/PathsErrorsDetector.php',
|
75 |
+
'WebpConverter\\Error\\Detector\\PermalinksStructureDetector' => __DIR__ . '/../..' . '/src/Error/Detector/PermalinksStructureDetector.php',
|
76 |
'WebpConverter\\Error\\Detector\\RestApiDisabledDetector' => __DIR__ . '/../..' . '/src/Error/Detector/RestApiDisabledDetector.php',
|
77 |
'WebpConverter\\Error\\Detector\\RewritesErrorsDetector' => __DIR__ . '/../..' . '/src/Error/Detector/RewritesErrorsDetector.php',
|
78 |
'WebpConverter\\Error\\Detector\\SettingsIncorrectDetector' => __DIR__ . '/../..' . '/src/Error/Detector/SettingsIncorrectDetector.php',
|
79 |
+
'WebpConverter\\Error\\Detector\\TokenStatusDetector' => __DIR__ . '/../..' . '/src/Error/Detector/TokenStatusDetector.php',
|
80 |
+
'WebpConverter\\Error\\Detector\\WebpFormatActivatedDetector' => __DIR__ . '/../..' . '/src/Error/Detector/WebpFormatActivatedDetector.php',
|
81 |
'WebpConverter\\Error\\ErrorDetectorAggregator' => __DIR__ . '/../..' . '/src/Error/ErrorDetectorAggregator.php',
|
82 |
+
'WebpConverter\\Error\\Notice\\AccessTokenInvalidNotice' => __DIR__ . '/../..' . '/src/Error/Notice/AccessTokenInvalidNotice.php',
|
83 |
+
'WebpConverter\\Error\\Notice\\ApiLimitExceededNotice' => __DIR__ . '/../..' . '/src/Error/Notice/ApiLimitExceededNotice.php',
|
84 |
'WebpConverter\\Error\\Notice\\BypassingApacheNotice' => __DIR__ . '/../..' . '/src/Error/Notice/BypassingApacheNotice.php',
|
85 |
'WebpConverter\\Error\\Notice\\ErrorNotice' => __DIR__ . '/../..' . '/src/Error/Notice/ErrorNotice.php',
|
86 |
'WebpConverter\\Error\\Notice\\LibsNotInstalledNotice' => __DIR__ . '/../..' . '/src/Error/Notice/LibsNotInstalledNotice.php',
|
91 |
'WebpConverter\\Error\\Notice\\PathUploadsUnavailableNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathUploadsUnavailableNotice.php',
|
92 |
'WebpConverter\\Error\\Notice\\PathWebpDuplicatedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathWebpDuplicatedNotice.php',
|
93 |
'WebpConverter\\Error\\Notice\\PathWebpNotWritableNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PathWebpNotWritableNotice.php',
|
94 |
+
'WebpConverter\\Error\\Notice\\PermalinksStructureInvalidNotice' => __DIR__ . '/../..' . '/src/Error/Notice/PermalinksStructureInvalidNotice.php',
|
95 |
'WebpConverter\\Error\\Notice\\RestApiDisabledNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RestApiDisabledNotice.php',
|
96 |
'WebpConverter\\Error\\Notice\\RewritesCachedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesCachedNotice.php',
|
97 |
'WebpConverter\\Error\\Notice\\RewritesNotExecutedNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesNotExecutedNotice.php',
|
98 |
'WebpConverter\\Error\\Notice\\RewritesNotWorkingNotice' => __DIR__ . '/../..' . '/src/Error/Notice/RewritesNotWorkingNotice.php',
|
99 |
'WebpConverter\\Error\\Notice\\SettingsIncorrectNotice' => __DIR__ . '/../..' . '/src/Error/Notice/SettingsIncorrectNotice.php',
|
100 |
+
'WebpConverter\\Error\\Notice\\WebpRequiredNotice' => __DIR__ . '/../..' . '/src/Error/Notice/WebpRequiredNotice.php',
|
101 |
+
'WebpConverter\\Exception\\ConversionErrorException' => __DIR__ . '/../..' . '/src/Exception/ConversionErrorException.php',
|
102 |
+
'WebpConverter\\Exception\\ExceptionAbstract' => __DIR__ . '/../..' . '/src/Exception/ExceptionAbstract.php',
|
103 |
+
'WebpConverter\\Exception\\ExceptionInterface' => __DIR__ . '/../..' . '/src/Exception/ExceptionInterface.php',
|
104 |
+
'WebpConverter\\Exception\\ExtensionUnsupportedException' => __DIR__ . '/../..' . '/src/Exception/ExtensionUnsupportedException.php',
|
105 |
+
'WebpConverter\\Exception\\FilesizeOversizeException' => __DIR__ . '/../..' . '/src/Exception/FilesizeOversizeException.php',
|
106 |
+
'WebpConverter\\Exception\\FunctionUnavailableException' => __DIR__ . '/../..' . '/src/Exception/FunctionUnavailableException.php',
|
107 |
+
'WebpConverter\\Exception\\ImageInvalidException' => __DIR__ . '/../..' . '/src/Exception/ImageInvalidException.php',
|
108 |
+
'WebpConverter\\Exception\\ImagickNotSupportWebpException' => __DIR__ . '/../..' . '/src/Exception/ImagickNotSupportWebpException.php',
|
109 |
+
'WebpConverter\\Exception\\ImagickUnavailableException' => __DIR__ . '/../..' . '/src/Exception/ImagickUnavailableException.php',
|
110 |
+
'WebpConverter\\Exception\\LargerThanOriginalException' => __DIR__ . '/../..' . '/src/Exception/LargerThanOriginalException.php',
|
111 |
+
'WebpConverter\\Exception\\OutputPathException' => __DIR__ . '/../..' . '/src/Exception/OutputPathException.php',
|
112 |
+
'WebpConverter\\Exception\\RemoteErrorResponseException' => __DIR__ . '/../..' . '/src/Exception/RemoteErrorResponseException.php',
|
113 |
+
'WebpConverter\\Exception\\RemoteRequestException' => __DIR__ . '/../..' . '/src/Exception/RemoteRequestException.php',
|
114 |
+
'WebpConverter\\Exception\\ResolutionOversizeException' => __DIR__ . '/../..' . '/src/Exception/ResolutionOversizeException.php',
|
115 |
+
'WebpConverter\\Exception\\ServerConfigurationException' => __DIR__ . '/../..' . '/src/Exception/ServerConfigurationException.php',
|
116 |
+
'WebpConverter\\Exception\\SourcePathException' => __DIR__ . '/../..' . '/src/Exception/SourcePathException.php',
|
117 |
'WebpConverter\\HookableInterface' => __DIR__ . '/../..' . '/src/HookableInterface.php',
|
118 |
'WebpConverter\\Loader\\HtaccessLoader' => __DIR__ . '/../..' . '/src/Loader/HtaccessLoader.php',
|
119 |
'WebpConverter\\Loader\\LoaderAbstract' => __DIR__ . '/../..' . '/src/Loader/LoaderAbstract.php',
|
120 |
'WebpConverter\\Loader\\LoaderIntegration' => __DIR__ . '/../..' . '/src/Loader/LoaderIntegration.php',
|
121 |
'WebpConverter\\Loader\\LoaderInterface' => __DIR__ . '/../..' . '/src/Loader/LoaderInterface.php',
|
122 |
'WebpConverter\\Loader\\PassthruLoader' => __DIR__ . '/../..' . '/src/Loader/PassthruLoader.php',
|
123 |
+
'WebpConverter\\Model\\Token' => __DIR__ . '/../..' . '/src/Model/Token.php',
|
124 |
'WebpConverter\\Notice\\NoticeAbstract' => __DIR__ . '/../..' . '/src/Notice/NoticeAbstract.php',
|
125 |
'WebpConverter\\Notice\\NoticeFactory' => __DIR__ . '/../..' . '/src/Notice/NoticeFactory.php',
|
126 |
'WebpConverter\\Notice\\NoticeIntegration' => __DIR__ . '/../..' . '/src/Notice/NoticeIntegration.php',
|
144 |
'WebpConverter\\Plugin\\Uninstall\\PluginSettings' => __DIR__ . '/../..' . '/src/Plugin/Uninstall/PluginSettings.php',
|
145 |
'WebpConverter\\Plugin\\Uninstall\\WebpFiles' => __DIR__ . '/../..' . '/src/Plugin/Uninstall/WebpFiles.php',
|
146 |
'WebpConverter\\Plugin\\Update' => __DIR__ . '/../..' . '/src/Plugin/Update.php',
|
147 |
+
'WebpConverter\\Repository\\TokenRepository' => __DIR__ . '/../..' . '/src/Repository/TokenRepository.php',
|
148 |
'WebpConverter\\Service\\FileLoader' => __DIR__ . '/../..' . '/src/Service/FileLoader.php',
|
149 |
'WebpConverter\\Service\\OptionsAccessManager' => __DIR__ . '/../..' . '/src/Service/OptionsAccessManager.php',
|
150 |
+
'WebpConverter\\Service\\TokenValidator' => __DIR__ . '/../..' . '/src/Service/TokenValidator.php',
|
151 |
'WebpConverter\\Service\\ViewLoader' => __DIR__ . '/../..' . '/src/Service/ViewLoader.php',
|
152 |
'WebpConverter\\Settings\\AdminAssets' => __DIR__ . '/../..' . '/src/Settings/AdminAssets.php',
|
153 |
+
'WebpConverter\\Settings\\Option\\AccessTokenOption' => __DIR__ . '/../..' . '/src/Settings/Option/AccessTokenOption.php',
|
154 |
'WebpConverter\\Settings\\Option\\ConversionMethodOption' => __DIR__ . '/../..' . '/src/Settings/Option/ConversionMethodOption.php',
|
155 |
'WebpConverter\\Settings\\Option\\ExtraFeaturesOption' => __DIR__ . '/../..' . '/src/Settings/Option/ExtraFeaturesOption.php',
|
156 |
'WebpConverter\\Settings\\Option\\ImagesQualityOption' => __DIR__ . '/../..' . '/src/Settings/Option/ImagesQualityOption.php',
|
170 |
'WebpConverter\\Settings\\PluginOptions' => __DIR__ . '/../..' . '/src/Settings/PluginOptions.php',
|
171 |
'WebpConverter\\Settings\\SettingsSave' => __DIR__ . '/../..' . '/src/Settings/SettingsSave.php',
|
172 |
'WebpConverter\\WebpConverter' => __DIR__ . '/../..' . '/src/WebpConverter.php',
|
173 |
+
'WebpConverter\\WebpConverterConstants' => __DIR__ . '/../..' . '/src/WebpConverterConstants.php',
|
174 |
);
|
175 |
|
176 |
public static function getInitializer(ClassLoader $loader)
|
177 |
{
|
178 |
return \Closure::bind(function () use ($loader) {
|
179 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit80287993f128e7a857f0f2db132eda4f::$prefixLengthsPsr4;
|
180 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit80287993f128e7a857f0f2db132eda4f::$prefixDirsPsr4;
|
181 |
+
$loader->classMap = ComposerStaticInit80287993f128e7a857f0f2db132eda4f::$classMap;
|
182 |
|
183 |
}, null, ClassLoader::class);
|
184 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,5 +1 @@
|
|
1 |
-
|
2 |
-
"packages": [],
|
3 |
-
"dev": false,
|
4 |
-
"dev-package-names": []
|
5 |
-
}
|
1 |
+
[]
|
|
|
|
|
|
|
|
vendor/composer/installed.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
'type' => 'library',
|
6 |
'install_path' => __DIR__ . '/../../',
|
7 |
'aliases' => array(),
|
8 |
-
'reference' => '
|
9 |
'name' => 'gbiorczyk/webp-converter-for-media',
|
10 |
'dev' => false,
|
11 |
),
|
@@ -16,7 +16,7 @@
|
|
16 |
'type' => 'library',
|
17 |
'install_path' => __DIR__ . '/../../',
|
18 |
'aliases' => array(),
|
19 |
-
'reference' => '
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
),
|
5 |
'type' => 'library',
|
6 |
'install_path' => __DIR__ . '/../../',
|
7 |
'aliases' => array(),
|
8 |
+
'reference' => 'f9ceb37afe91236b323011131111c3dd7378a53c',
|
9 |
'name' => 'gbiorczyk/webp-converter-for-media',
|
10 |
'dev' => false,
|
11 |
),
|
16 |
'type' => 'library',
|
17 |
'install_path' => __DIR__ . '/../../',
|
18 |
'aliases' => array(),
|
19 |
+
'reference' => 'f9ceb37afe91236b323011131111c3dd7378a53c',
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
),
|
webp-converter-for-media.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
/**
|
4 |
* Plugin Name: WebP Converter for Media
|
5 |
* Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
|
6 |
-
* Version:
|
7 |
* Author: Mateusz Gbiorczyk
|
8 |
-
* Author URI: https://
|
9 |
* Text Domain: webp-converter-for-media
|
10 |
* Network: true
|
11 |
*/
|
@@ -13,5 +13,5 @@
|
|
13 |
require_once __DIR__ . '/vendor/autoload.php';
|
14 |
|
15 |
new WebpConverter\WebpConverter(
|
16 |
-
new WebpConverter\PluginInfo( __FILE__, '
|
17 |
);
|
3 |
/**
|
4 |
* Plugin Name: WebP Converter for Media
|
5 |
* Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
|
6 |
+
* Version: 4.0.0
|
7 |
* Author: Mateusz Gbiorczyk
|
8 |
+
* Author URI: https://mattplugins.com/
|
9 |
* Text Domain: webp-converter-for-media
|
10 |
* Network: true
|
11 |
*/
|
13 |
require_once __DIR__ . '/vendor/autoload.php';
|
14 |
|
15 |
new WebpConverter\WebpConverter(
|
16 |
+
new WebpConverter\PluginInfo( __FILE__, '4.0.0' )
|
17 |
);
|