diff --git a/CHANGELOG.md b/CHANGELOG.md index bad7e61c0..be1ee710e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). +## [ 1.4.0 ] - 2019-03-07 +### Added +* Clearer instructions and help text when adding an external connection. +* Log image sideloading failures when using `DISTRIBUTOR_DEBUG`. + +### Fixed +* Allow attachments to be distributed from local environments. +* Ensure pagination is reset when switching views on the pull content screen. +* Remove extraneous checkboxes from pulled content screen. +* Suppress a PHP warning when no meta is being distributed for attachments. + ## [ 1.3.9 ] - 2019-02-21 ### Fixed * Ensure posts distributed as draft can be published. diff --git a/README.md b/README.md index 9ba919be8..d6e354c87 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ The plugin contains a standard test suite compatible with PHPUnit. If you want t You can define a constant `DISTRIBUTOR_DEBUG` to `true` to increase the ease of debugging in Distributor. This will make all remote requests blocking and expose the subscription post type. +Enabling this will also provide more debugging information in your error log for image side loading issues. The specific logging method may change in the future. + ### Work with us diff --git a/composer.json b/composer.json index 2e1c572e3..ebe97cf90 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ } }, "require-dev": { - "10up/wp_mock": "dev-dev", - "10up/phpcs-composer": "dev-master", - "phpunit/phpunit": "^6.5", - "10up/wpacceptance": "~0.10.0" + "10up/wpacceptance": "~0.12.0", + "10up/wp_mock": "~0.4", + "phpunit/phpunit": "~7.5", + "10up/phpcs-composer": "dev-master" }, "scripts": { - "lint": "phpcs .", - "lint-fix": "phpcbf ." + "lint": "./vendor/bin/phpcs . --runtime-set testVersion 5.6-", + "lint-fix": "phpcbf . --runtime-set testVersion 5.6-" }, "minimum-stability": "dev", "prefer-stable": true diff --git a/dist/css/admin-external-connection.min.css b/dist/css/admin-external-connection.min.css index ac7bbeeb0..baed92bcb 100644 --- a/dist/css/admin-external-connection.min.css +++ b/dist/css/admin-external-connection.min.css @@ -1,2 +1,2 @@ -#dt_external_connection_details .handlediv,#dt_external_connection_details h2{display:none}#dt_external_connection_details .inside{padding:0}#dt_external_connection_details{background-color:inherit;border:0;-webkit-box-shadow:none;box-shadow:none}#dt_external_connection_details .dt-roles-allowed label{font-weight:400}#dt_external_connection_details .dt-roles-allowed label:first-child{margin-bottom:5px;display:inline-block;font-weight:700}#dt_external_connection_details label{font-size:14px;font-weight:700}#dt_external_connection_details input,#dt_external_connection_details select{margin:0 0 8px}#dt_external_connection_details select[multiple=multiple]{height:auto}#dt_external_connection_details .suggest{font-weight:700;cursor:pointer}.description{display:block}#dt_external_connection_details .connection-field-wrap,#dt_external_connection_details p{margin-bottom:3em}.endpoint-errors{margin:5px 0 0}.endpoint-errors li{padding-left:15px;font-style:italic}.endpoint-errors li:before{content:"-";margin-right:5px}.misc-pub-visibility{display:none}.endpoint-result[data-endpoint-state=loading]:before{content:" ";vertical-align:middle;top:-.25em;border-radius:50%;width:.8em;margin-right:8px;height:.8em;display:inline-block;font-size:9px;position:relative;text-indent:-9999em;border-top:.5em solid #cfcfcf;border-right:.5em solid #cfcfcf;border-bottom:.5em solid #cfcfcf;border-left:.5em solid #666;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear}.endpoint-result[data-endpoint-state=error]:before,.endpoint-result[data-endpoint-state=valid]:before,.endpoint-result[data-endpoint-state=warning]:before{content:" ";display:inline-block;border-radius:50%;background-color:red;width:10px;height:10px;border:1px solid #999;vertical-align:middle;top:-2px;position:relative;margin-right:5px}.endpoint-result[data-endpoint-state=valid]:before{background-color:#62ff00}.endpoint-result[data-endpoint-state=warning]:before{background-color:#ffe000}.endpoint-result .dashicons-yes{color:#46b450}.endpoint-result .dashicons-warning{color:#ffb900}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}#submitdiv{display:none}.delete-link{color:#a00;margin-left:1em;text-decoration:none}.delete-link:hover{color:red;text-decoration:none}#poststuff #post-body.columns-2{margin-right:0}#side-sortables{display:none}.oauth-connection-established .message-header{font-size:16px;color:green;font-weight:700}input[type=password].error-required,input[type=text].error-required{border:2px solid red} +#dt_external_connection_details .handlediv,#dt_external_connection_details h2{display:none}#dt_external_connection_details .inside{padding:0}#dt_external_connection_details{background-color:inherit;border:0;-webkit-box-shadow:none;box-shadow:none}#dt_external_connection_details .dt-roles-allowed label{font-weight:400}#dt_external_connection_details .dt-roles-allowed label:first-child{margin-bottom:5px;display:inline-block;font-weight:700}#dt_external_connection_details label{font-size:14px;font-weight:700}#dt_external_connection_details input,#dt_external_connection_details select{margin:0 0 8px}#dt_external_connection_details select[multiple=multiple]{height:auto}#dt_external_connection_details .suggest{font-weight:700;cursor:pointer}.description{display:block}#dt_external_connection_details .card,#dt_external_connection_details .connection-field-wrap,#dt_external_connection_details p{margin-bottom:2em}#dt_external_connection_details .card p{margin-bottom:1em}.endpoint-errors{margin:5px 0 0}.endpoint-errors li{padding-left:15px;font-style:italic}.endpoint-errors li:before{content:"-";margin-right:5px}.misc-pub-visibility{display:none}.endpoint-result[data-endpoint-state=loading]:before{content:" ";vertical-align:middle;top:-.25em;border-radius:50%;width:.8em;margin-right:8px;height:.8em;display:inline-block;font-size:9px;position:relative;text-indent:-9999em;border-top:.5em solid #cfcfcf;border-right:.5em solid #cfcfcf;border-bottom:.5em solid #cfcfcf;border-left:.5em solid #666;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear}.endpoint-result[data-endpoint-state=error]:before,.endpoint-result[data-endpoint-state=valid]:before,.endpoint-result[data-endpoint-state=warning]:before{content:" ";display:inline-block;border-radius:50%;background-color:red;width:10px;height:10px;border:1px solid #999;vertical-align:middle;top:-2px;position:relative;margin-right:5px}.endpoint-result[data-endpoint-state=valid]:before{background-color:#62ff00}.endpoint-result[data-endpoint-state=warning]:before{background-color:#ffe000}.endpoint-result .dashicons-yes{color:#46b450}.endpoint-result .dashicons-warning{color:#ffb900}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}#submitdiv{display:none}.delete-link{color:#a00;margin-left:1em;text-decoration:none}.delete-link:hover{color:red;text-decoration:none}#poststuff #post-body.columns-2{margin-right:0}#side-sortables{display:none}.oauth-connection-established .message-header{font-size:16px;color:green;font-weight:700}input[type=password].error-required,input[type=text].error-required{border:2px solid red} /*# sourceMappingURL=admin-external-connection.min.css.map */ diff --git a/dist/css/admin-external-connection.min.css.map b/dist/css/admin-external-connection.min.css.map index 577fad93e..ea97564db 100644 --- a/dist/css/admin-external-connection.min.css.map +++ b/dist/css/admin-external-connection.min.css.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["admin-external-connection.min.css"],"sourcesContent":["#dt_external_connection_details .handlediv,#dt_external_connection_details h2{display:none}#dt_external_connection_details .inside{padding:0}#dt_external_connection_details{background-color:inherit;border:0;-webkit-box-shadow:none;box-shadow:none}#dt_external_connection_details .dt-roles-allowed label{font-weight:400}#dt_external_connection_details .dt-roles-allowed label:first-child{margin-bottom:5px;display:inline-block;font-weight:700}#dt_external_connection_details label{font-size:14px;font-weight:700}#dt_external_connection_details input,#dt_external_connection_details select{margin:0 0 8px}#dt_external_connection_details select[multiple=multiple]{height:auto}#dt_external_connection_details .suggest{font-weight:700;cursor:pointer}.description{display:block}#dt_external_connection_details .connection-field-wrap,#dt_external_connection_details p{margin-bottom:3em}.endpoint-errors{margin:5px 0 0}.endpoint-errors li{padding-left:15px;font-style:italic}.endpoint-errors li:before{content:\"-\";margin-right:5px}.misc-pub-visibility{display:none}.endpoint-result[data-endpoint-state=loading]:before{content:\" \";vertical-align:middle;top:-.25em;border-radius:50%;width:.8em;margin-right:8px;height:.8em;display:inline-block;font-size:9px;position:relative;text-indent:-9999em;border-top:.5em solid #cfcfcf;border-right:.5em solid #cfcfcf;border-bottom:.5em solid #cfcfcf;border-left:.5em solid #666;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear}.endpoint-result[data-endpoint-state=error]:before,.endpoint-result[data-endpoint-state=valid]:before,.endpoint-result[data-endpoint-state=warning]:before{content:\" \";display:inline-block;border-radius:50%;background-color:red;width:10px;height:10px;border:1px solid #999;vertical-align:middle;top:-2px;position:relative;margin-right:5px}.endpoint-result[data-endpoint-state=valid]:before{background-color:#62ff00}.endpoint-result[data-endpoint-state=warning]:before{background-color:#ffe000}.endpoint-result .dashicons-yes{color:#46b450}.endpoint-result .dashicons-warning{color:#ffb900}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}#submitdiv{display:none}.delete-link{color:#a00;margin-left:1em;text-decoration:none}.delete-link:hover{color:red;text-decoration:none}#poststuff #post-body.columns-2{margin-right:0}#side-sortables{display:none}.oauth-connection-established .message-header{font-size:16px;color:green;font-weight:700}input[type=password].error-required,input[type=text].error-required{border:2px solid red}"],"file":"admin-external-connection.min.css"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["admin-external-connection.min.css"],"sourcesContent":["#dt_external_connection_details .handlediv,#dt_external_connection_details h2{display:none}#dt_external_connection_details .inside{padding:0}#dt_external_connection_details{background-color:inherit;border:0;-webkit-box-shadow:none;box-shadow:none}#dt_external_connection_details .dt-roles-allowed label{font-weight:400}#dt_external_connection_details .dt-roles-allowed label:first-child{margin-bottom:5px;display:inline-block;font-weight:700}#dt_external_connection_details label{font-size:14px;font-weight:700}#dt_external_connection_details input,#dt_external_connection_details select{margin:0 0 8px}#dt_external_connection_details select[multiple=multiple]{height:auto}#dt_external_connection_details .suggest{font-weight:700;cursor:pointer}.description{display:block}#dt_external_connection_details .card,#dt_external_connection_details .connection-field-wrap,#dt_external_connection_details p{margin-bottom:2em}#dt_external_connection_details .card p{margin-bottom:1em}.endpoint-errors{margin:5px 0 0}.endpoint-errors li{padding-left:15px;font-style:italic}.endpoint-errors li:before{content:\"-\";margin-right:5px}.misc-pub-visibility{display:none}.endpoint-result[data-endpoint-state=loading]:before{content:\" \";vertical-align:middle;top:-.25em;border-radius:50%;width:.8em;margin-right:8px;height:.8em;display:inline-block;font-size:9px;position:relative;text-indent:-9999em;border-top:.5em solid #cfcfcf;border-right:.5em solid #cfcfcf;border-bottom:.5em solid #cfcfcf;border-left:.5em solid #666;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear}.endpoint-result[data-endpoint-state=error]:before,.endpoint-result[data-endpoint-state=valid]:before,.endpoint-result[data-endpoint-state=warning]:before{content:\" \";display:inline-block;border-radius:50%;background-color:red;width:10px;height:10px;border:1px solid #999;vertical-align:middle;top:-2px;position:relative;margin-right:5px}.endpoint-result[data-endpoint-state=valid]:before{background-color:#62ff00}.endpoint-result[data-endpoint-state=warning]:before{background-color:#ffe000}.endpoint-result .dashicons-yes{color:#46b450}.endpoint-result .dashicons-warning{color:#ffb900}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}#submitdiv{display:none}.delete-link{color:#a00;margin-left:1em;text-decoration:none}.delete-link:hover{color:red;text-decoration:none}#poststuff #post-body.columns-2{margin-right:0}#side-sortables{display:none}.oauth-connection-established .message-header{font-size:16px;color:green;font-weight:700}input[type=password].error-required,input[type=text].error-required{border:2px solid red}"],"file":"admin-external-connection.min.css"} \ No newline at end of file diff --git a/dist/css/push.min.css b/dist/css/push.min.css index 54b6b210e..5ebeae0d9 100644 --- a/dist/css/push.min.css +++ b/dist/css/push.min.css @@ -1,2 +1,2 @@ -#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} +#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} /*# sourceMappingURL=push.min.css.map */ diff --git a/dist/css/push.min.css.map b/dist/css/push.min.css.map index 77abce9b3..08b94b00f 100644 --- a/dist/css/push.min.css.map +++ b/dist/css/push.min.css.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}"],"file":"push.min.css"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}"],"file":"push.min.css"} \ No newline at end of file diff --git a/dist/js/admin-distributed-post.min.js.map b/dist/js/admin-distributed-post.min.js.map index 8800f64c7..2637423fe 100644 --- a/dist/js/admin-distributed-post.min.js.map +++ b/dist/js/admin-distributed-post.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/admin-external-connection.min.js.map b/dist/js/admin-external-connection.min.js.map index 69c6cf083..9d73c6af3 100644 --- a/dist/js/admin-external-connection.min.js.map +++ b/dist/js/admin-external-connection.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","_window","dt","endpoint_checking_message","auth","_underscores2","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","_jquery2","ajax","url","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_underscores","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"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","file":"admin-external-connection.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning); // eslint-disable-line no-alert\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning ); // eslint-disable-line no-alert\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","dt","endpoint_checking_message","auth","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","ajax","url","ajaxurl","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_jquery2","_underscores","_underscores2","_window","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"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","file":"admin-external-connection.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning); // eslint-disable-line no-alert\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning ); // eslint-disable-line no-alert\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/admin-pull.min.js b/dist/js/admin-pull.min.js index a32a91ed0..cf9998229 100644 --- a/dist/js/admin-pull.min.js +++ b/dist/js/admin-pull.min.js @@ -1,2 +1,2 @@ -!function(e){function t(o){if(n[o])return n[o].exports;var u=n[o]={i:o,l:!1,exports:{}};return e[o].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t){e.exports=jQuery},,,,function(e,t,n){"use strict";var o=n(0),u=function(e){return e&&e.__esModule?e:{default:e}}(o),l=document.getElementById("pull_connections"),r=document.getElementById("pull_post_type"),c=document.getElementById("pull_post_type_submit"),d=document.getElementById("posts-filter");(0,u.default)(l).on("change",function(e){document.location=e.currentTarget.options[e.currentTarget.selectedIndex].getAttribute("data-pull-url"),document.body.className+=" dt-loading"}),l&&r&&c&&d&&(0,u.default)(c).on("click",function(e){e.preventDefault();var t=r.options[r.selectedIndex].value,n=l.options[l.selectedIndex].getAttribute("data-pull-url"),o="new";-1<(" "+d.className+" ").indexOf(" status-skipped ")?o="skipped":-1<(" "+d.className+" ").indexOf(" status-pulled ")&&(o="pulled"),document.location=n+"&pull_post_type="+t+"&status="+o,document.body.className+=" dt-loading"})}]); +!function(e){function t(o){if(n[o])return n[o].exports;var u=n[o]={i:o,l:!1,exports:{}};return e[o].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t){e.exports=jQuery},,,,function(e,t,n){"use strict";var o=n(0),u=function(e){return e&&e.__esModule?e:{default:e}}(o),l=document.getElementById("pull_connections"),c=document.getElementById("pull_post_type"),r=document.getElementById("pull_post_type_submit"),d=document.getElementById("post-search-input"),a=document.getElementById("search-submit"),s=document.getElementById("posts-filter");(0,u.default)(l).on("change",function(e){document.location=e.currentTarget.options[e.currentTarget.selectedIndex].getAttribute("data-pull-url"),document.body.className+=" dt-loading"}),l&&c&&s&&(r&&(0,u.default)(r).on("click",function(e){e.preventDefault(),document.location=i(),document.body.className+=" dt-loading"}),d&&a&&(0,u.default)(a).on("click",function(e){e.preventDefault();var t=d.value;document.location=i()+"&s="+t,document.body.className+=" dt-loading"}));var i=function(){var e=c.options[c.selectedIndex].value,t=l.options[l.selectedIndex].getAttribute("data-pull-url"),n="new";return-1<(" "+s.className+" ").indexOf(" status-skipped ")?n="skipped":-1<(" "+s.className+" ").indexOf(" status-pulled ")&&(n="pulled"),t+"&pull_post_type="+e+"&status="+n}}]); //# sourceMappingURL=admin-pull.min.js.map \ No newline at end of file diff --git a/dist/js/admin-pull.min.js.map b/dist/js/admin-pull.min.js.map index 32031fbba..3b74518bf 100644 --- a/dist/js/admin-pull.min.js.map +++ b/dist/js/admin-pull.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","postType","value","url","status","indexOf"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFwEO,CACA,CACA,CAED,SAAUvB,EAAQD,EAASH,GAEjC,YG9EA,IAAA4B,GAAA5B,EAAA,GHmFI6B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIV,WAAaU,GAAQC,QAASD,IAFjDF,GGjFhCI,EAAmBC,SAASC,eAAgB,oBAC5CC,EAAiBF,SAASC,eAAgB,kBAC1CE,EAAoBH,SAASC,eAAgB,yBAC7CG,EAAOJ,SAASC,eAAgB,iBAEtC,EAAAL,EAAAE,SAAQC,GAAmBM,GAAI,SAAU,SAAEC,GAE1CN,SAASO,SAAWD,EAAME,cAAcC,QAAQH,EAAME,cAAcE,eAAeC,aAAc,iBAEjGX,SAASY,KAAKC,WAAa,gBAGvBd,GAAoBG,GAAkBC,GAAqBC,IAC/D,EAAAR,EAAAE,SAAQK,GAAoBE,GAAI,QAAS,SAAEC,GAE1CA,EAAMQ,gBAEN,IAAMC,GAAWb,EAAeO,QAASP,EAAeQ,eAAgBM,MAClEC,EAAMlB,EAAiBU,QAASV,EAAiBW,eAAgBC,aAAc,iBACjFO,EAAS,OAEP,GAAM,IAAMd,EAAKS,UAAY,KAAMM,QAAS,oBACjDD,EAAS,WACG,GAAM,IAAMd,EAAKS,UAAY,KAAMM,QAAS,qBACxDD,EAAS,UAGVlB,SAASO,SAAWU,EAAM,mBAAqBF,EAAW,WAAaG,EAEvElB,SAASY,KAAKC,WAAa","file":"admin-pull.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && choosePostTypeBtn && form) {\n\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\tevent.preventDefault();\n\n\t\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\t\tvar url = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\t\tvar status = 'new';\n\n\t\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\t\tstatus = 'skipped';\n\t\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && choosePostTypeBtn && form ) {\n\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\tevent.preventDefault();\n\n\t\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\t\tconst url = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\t\tlet status = 'new';\n\n\t\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\t\tstatus = 'skipped';\n\t\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","searchField","searchBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","getURL","search","value","postType","baseURL","status","indexOf"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFwEO,CACA,CACA,CAED,SAAUvB,EAAQD,EAASH,GAEjC,YG9EA,IAAA4B,GAAA5B,EAAA,GHmFI6B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIV,WAAaU,GAAQC,QAASD,IAFjDF,GGjFhCI,EAAmBC,SAASC,eAAgB,oBAC5CC,EAAiBF,SAASC,eAAgB,kBAC1CE,EAAoBH,SAASC,eAAgB,yBAC7CG,EAAcJ,SAASC,eAAgB,qBACvCI,EAAYL,SAASC,eAAgB,iBACrCK,EAAON,SAASC,eAAgB,iBAEtC,EAAAL,EAAAE,SAAQC,GAAmBQ,GAAI,SAAU,SAAEC,GAE1CR,SAASS,SAAWD,EAAME,cAAcC,QAAQH,EAAME,cAAcE,eAAeC,aAAc,iBAEjGb,SAASc,KAAKC,WAAa,gBAGvBhB,GAAoBG,GAAkBI,IAErCH,IACJ,EAAAP,EAAAE,SAAQK,GAAoBI,GAAI,QAAS,SAAEC,GAE1CA,EAAMQ,iBAENhB,SAASS,SAAWQ,IAEpBjB,SAASc,KAAKC,WAAa,gBAIxBX,GAAeC,IACnB,EAAAT,EAAAE,SAAQO,GAAYE,GAAI,QAAS,SAAEC,GAClCA,EAAMQ,gBAEN,IAAME,GAASd,EAAYe,KAE3BnB,UAASS,SAAWQ,IAAW,MAAQC,EAEvClB,SAASc,KAAKC,WAAa,gBAU9B,IAAME,GAAS,WACd,GAAMG,GAAWlB,EAAeS,QAAST,EAAeU,eAAgBO,MAClEE,EAAUtB,EAAiBY,QAASZ,EAAiBa,eAAgBC,aAAc,iBACrFS,EAAS,KAQb,QANM,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,oBACjDD,EAAS,WACG,GAAM,IAAMhB,EAAKS,UAAY,KAAMQ,QAAS,qBACxDD,EAAS,UAGHD,EAAU,mBAAqBD,EAAW,WAAaE","file":"admin-pull.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar searchField = document.getElementById('post-search-input');\nvar searchBtn = document.getElementById('search-submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && form) {\n\n\tif (choosePostTypeBtn) {\n\t\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n\n\tif (searchField && searchBtn) {\n\t\t(0, _jquery2.default)(searchBtn).on('click', function (event) {\n\t\t\tevent.preventDefault();\n\n\t\t\tvar search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t});\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nvar getURL = function getURL() {\n\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\tvar baseURL = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\tvar status = 'new';\n\n\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\tstatus = 'skipped';\n\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst searchField = document.getElementById( 'post-search-input' );\nconst searchBtn = document.getElementById( 'search-submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && form ) {\n\n\tif ( choosePostTypeBtn ) {\n\t\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tdocument.location = getURL();\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n\n\tif ( searchField && searchBtn ) {\n\t\tjQuery( searchBtn ).on( 'click', ( event ) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst search = searchField.value;\n\n\t\t\tdocument.location = getURL() + '&s=' + search;\n\n\t\t\tdocument.body.className += ' ' + 'dt-loading';\n\t\t} );\n\t}\n}\n\n/**\n * Build our Distribution URL.\n *\n * @return {string}\n */\nconst getURL = () => {\n\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\tconst baseURL = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\tlet status = 'new';\n\n\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\tstatus = 'skipped';\n\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\tstatus = 'pulled';\n\t}\n\n\treturn baseURL + '&pull_post_type=' + postType + '&status=' + status;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/gutenberg-status-plugin.min.js.map b/dist/js/gutenberg-status-plugin.min.js.map index cd97ca8c1..88b813056 100644 --- a/dist/js/gutenberg-status-plugin.min.js.map +++ b/dist/js/gutenberg-status-plugin.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB8B,EAAAC,GAAGC,SAASC,qBAAuB,IACtDC,GAAmBJ,EAAAC,GAAGI,QAAtBD,eACAE,EAAON,EAAAC,GAAGM,KAAVD,GACAH,EAAyBH,EAAAC,GAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWV,EAAAY,YAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNX,EAAAC,GAAGM,KAAKQ,QAASf,EAAAC,GAAGM,KAAKD,GAAI,sCAAuC,eACrEN,EAAAY,YAAYI,iBACZ,MAAQhB,EAAAY,YAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUjB,EAAAY,YAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUjB,EAAAY,YAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\t/**\n * Render the distributed from component.\n */\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\t/**\n * Render the distributed to component.\n */\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\t/**\n\t * Render the distributed from component.\n\t */\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Render the distributed to component.\n\t */\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB+B,KAAGC,SAASC,qBAAuB,IACtDC,GAAmBH,KAAGI,QAAtBD,eACAE,EAAOL,KAAGM,KAAVD,GACAH,EAAyBF,KAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWE,cAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNV,KAAGM,KAAKQ,QAASd,KAAGM,KAAKD,GAAI,sCAAuC,eACrEM,cAAYI,iBACZ,MAAQJ,cAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUL,cAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUL,cAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\t/**\n * Render the distributed from component.\n */\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\t/**\n * Render the distributed to component.\n */\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\t/**\n\t * Render the distributed from component.\n\t */\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Render the distributed to component.\n\t */\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/gutenberg-syndicated-post.min.js.map b/dist/js/gutenberg-syndicated-post.min.js.map index 1f8e51e97..3c204c917 100644 --- a/dist/js/gutenberg-syndicated-post.min.js.map +++ b/dist/js/gutenberg-syndicated-post.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAKA,IAFA8B,EAAAC,GAAGC,KAAKC,cAAeH,EAAAI,YAAYF,KAAM,eAEpC,MAAQF,EAAAI,YAAYC,kBAAoB,MAAQL,EAAAI,YAAYE,eAAiB,CAEjF,GAAIC,GAAU,GACRC,IAEDC,UAAUT,EAAAI,YAAYM,gBAC1BH,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gFAAkFZ,EAAAI,YAAYS,iBAAkBb,EAAAI,YAAYU,sBACtJL,SAAUT,EAAAI,YAAYW,WAenCR,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,2GAA4G,eAAiBZ,EAAAI,YAAYU,qBAAsBd,EAAAI,YAAYS,kBAElNL,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,cAAe,eACnCM,IAAKlB,EAAAI,YAAYe,eAGlBX,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,gBAAiB,eACrCM,IAAKlB,EAAAI,YAAYgB,YAvBlBb,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gEAAiE,eAAiBZ,EAAAI,YAAYU,sBAErIN,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKlB,EAAAI,YAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKlB,EAAAI,YAAYgB,WAkBnBpB,EAAAC,GAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAKA,IAFA+B,KAAGC,KAAKC,cAAeC,cAAYF,KAAM,eAEpC,MAAQE,cAAYC,kBAAoB,MAAQD,cAAYE,eAAiB,CAEjF,GAAIC,GAAU,GACRC,IAEDC,UAAUL,cAAYM,gBAC1BH,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,gFAAkFR,cAAYS,iBAAkBT,cAAYU,sBACtJL,SAAUL,cAAYW,WAenCR,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,2GAA4G,eAAiBR,cAAYU,qBAAsBV,cAAYS,kBAElNL,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,cAAe,eACnCM,IAAKd,cAAYe,eAGlBX,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,gBAAiB,eACrCM,IAAKd,cAAYgB,YAvBlBb,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,gEAAiE,eAAiBR,cAAYU,sBAErIN,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKd,cAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOhB,KAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKd,cAAYgB,WAkBnBnB,KAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/push.min.js.map b/dist/js/push.min.js.map index 124783a4f..5452a1763 100644 --- a/dist/js/push.min.js.map +++ b/dist/js/push.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","on","doError","distributorPushWrapper","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","connectionsSelected","connectionsSelectedList","innerText","showConnections","connectionsNewList","connection","nameMatch","replace","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","distributorMenuExited","blur","querySelector","connectionsSearchInput","syndicateButton","actionWrapper","postStatusInput","asDraftInput","appendChild","hoverIntent","contains","data","action","nonce","dt","connections","postId","postStatus","checked","value","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","event","target","nodeName","preventDefault","currentTarget","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement","debounce"],"mappings":"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","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).on('load', function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar connectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\tvar connectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\tvar connectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\tvar connectionsSearchInput = document.getElementById('dt-connection-search');\n\tvar syndicateButton = distributorPushWrapper.querySelector('.syndicate-button');\n\tvar actionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\tvar postStatusInput = document.getElementById('dt-post-status');\n\tvar asDraftInput = document.getElementById('dt-as-draft');\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n \t * Handle UI error changes\n \t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(_window.dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t/**\n * Handle exiting the distributor menu.\n */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(syndicateButton).on('click', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = _window.dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n\n\t/**\n * List for connection filtering\n */\n\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\tif ('' === event.currentTarget.value) {\n\t\t\tshowConnections(_window.dtConnections);\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\tshowConnections();\n\t}, 300));\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, dtConnections } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).on( 'load', () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tconst connectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\tconst connectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\tconst connectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\tconst connectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\tconst syndicateButton = distributorPushWrapper.querySelector( '.syndicate-button' );\n\tconst actionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\tconst postStatusInput = document.getElementById( 'dt-post-status' );\n\tconst asDraftInput = document.getElementById( 'dt-as-draft' );\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t\t * Handle UI error changes\n\t\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\t/**\n\t * Handle exiting the distributor menu.\n\t */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( syndicateButton ).on( 'click', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n\n\t/**\n\t * List for connection filtering\n\t */\n\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\tif ( '' === event.currentTarget.value ) {\n\t\t\tshowConnections( dtConnections );\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\tshowConnections();\n\t}, 300 ) );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","on","doError","distributorPushWrapper","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","connectionsSelected","connectionsSelectedList","innerText","showConnections","connectionsNewList","connection","nameMatch","replace","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","distributorMenuExited","blur","querySelector","connectionsSearchInput","syndicateButton","actionWrapper","postStatusInput","asDraftInput","appendChild","hoverIntent","contains","data","action","nonce","dt","connections","postId","postStatus","checked","value","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","event","target","nodeName","preventDefault","currentTarget","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement","debounce"],"mappings":"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","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).on('load', function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar connectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\tvar connectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\tvar connectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\tvar connectionsSearchInput = document.getElementById('dt-connection-search');\n\tvar syndicateButton = distributorPushWrapper.querySelector('.syndicate-button');\n\tvar actionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\tvar postStatusInput = document.getElementById('dt-post-status');\n\tvar asDraftInput = document.getElementById('dt-as-draft');\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n \t * Handle UI error changes\n \t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(_window.dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t/**\n * Handle exiting the distributor menu.\n */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(syndicateButton).on('click', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = _window.dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n\n\t/**\n * List for connection filtering\n */\n\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\tif ('' === event.currentTarget.value) {\n\t\t\tshowConnections(_window.dtConnections);\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\tshowConnections();\n\t}, 300));\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fff10cbf8520b51427a4","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, dtConnections } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).on( 'load', () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tconst connectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\tconst connectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\tconst connectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\tconst connectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\tconst syndicateButton = distributorPushWrapper.querySelector( '.syndicate-button' );\n\tconst actionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\tconst postStatusInput = document.getElementById( 'dt-post-status' );\n\tconst asDraftInput = document.getElementById( 'dt-as-draft' );\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t\t * Handle UI error changes\n\t\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\t/**\n\t * Handle exiting the distributor menu.\n\t */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( syndicateButton ).on( 'click', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n\n\t/**\n\t * List for connection filtering\n\t */\n\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\tif ( '' === event.currentTarget.value ) {\n\t\t\tshowConnections( dtConnections );\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\tshowConnections();\n\t}, 300 ) );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""} \ No newline at end of file diff --git a/distributor.php b/distributor.php index ac903878e..5e7a0c725 100644 --- a/distributor.php +++ b/distributor.php @@ -2,7 +2,7 @@ /** * Plugin Name: Distributor * Description: Makes it easy to syndicate and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 1.3.9 + * Version: 1.4.0 * Author: 10up Inc. * Author URI: https://distributorplugin.com * License: GPLv2 or later @@ -17,7 +17,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '1.3.9' ); +define( 'DT_VERSION', '1.4.0' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); // Define a constant if we're network activated to allow plugin to respond accordingly. diff --git a/includes/classes/Authentication.php b/includes/classes/Authentication.php index 987e31b1a..846f2951a 100644 --- a/includes/classes/Authentication.php +++ b/includes/classes/Authentication.php @@ -22,7 +22,7 @@ abstract class Authentication { * * @var string */ - static public $error_message; + public static $error_message; /** * Set associative arguments as instance variables diff --git a/includes/classes/Authentications/WordPressBasicAuth.php b/includes/classes/Authentications/WordPressBasicAuth.php index b0d9c5401..f672d5143 100644 --- a/includes/classes/Authentications/WordPressBasicAuth.php +++ b/includes/classes/Authentications/WordPressBasicAuth.php @@ -43,7 +43,7 @@ public function __construct( $args ) { parent::__construct( $args ); if ( isset( $this->password ) && isset( $this->username ) ) { - $this->base64_encoded = base64_encode( $this->username . ':' . $this->password ); + $this->base64_encoded = base64_encode( $this->username . ':' . $this->password ); // @codingStandardsIgnoreLine valid use of base64_encode } if ( empty( $this->base64_encoded ) ) { @@ -66,7 +66,7 @@ public static function credentials_form( $args = array() ) {
- +

@@ -80,6 +80,14 @@ public static function credentials_form( $args = array() ) { + + + Important: We strongly recommend using the Application Passwords plugin on the site you are connecting to in order to create a unique password for this connection. This helps limit the use of your primary password and will allow you to revoke access in the future if needed.', 'distributor' ) ), esc_url( $plugin_link ) ); + ?>

-

- - .
- - -

+
+

+ .

+


+

+
get_error_message() ); $count ++; if ( $count <= 3 ) { - $this->is_valid_token( $count ); + self::is_valid_token( $count ); } return false; diff --git a/includes/classes/ExternalConnections/WordPressDotcomExternalConnection.php b/includes/classes/ExternalConnections/WordPressDotcomExternalConnection.php index 52e2d29b5..ec504f60d 100644 --- a/includes/classes/ExternalConnections/WordPressDotcomExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressDotcomExternalConnection.php @@ -19,27 +19,33 @@ class WordPressDotcomExternalConnection extends WordPressExternalConnection { * * @var string */ - static public $slug = 'wpdotcom'; + public static $slug = 'wpdotcom'; /** * Connection pretty label * + * This is to represent the authentication method, + * not the connection type. This value was previously + * "WordPress.com REST API". + * + * @since 1.4.0 Label as authentication method, not connection type + * * @var string */ - static public $label = 'WordPress.com REST API'; + public static $label = 'WordPress.com Application'; /** * Connection auth class * * @var string */ - static public $auth_handler_class = '\Distributor\Authentications\WordPressDotcomOauth2Authentication'; + public static $auth_handler_class = '\Distributor\Authentications\WordPressDotcomOauth2Authentication'; /** * Connection REST API namespace * * @var string */ - static public $namespace = 'wp/v2'; + public static $namespace = 'wp/v2'; } diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php index a5f17caa0..cff5eac73 100644 --- a/includes/classes/ExternalConnections/WordPressExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php @@ -20,35 +20,41 @@ class WordPressExternalConnection extends ExternalConnection { * * @var string */ - static public $slug = 'wp'; + public static $slug = 'wp'; /** * Connection pretty label * + * This is to represent the authentication method, + * not the connection type. This value was previously + * "WordPress REST API". + * + * @since 1.4.0 Label as authentication method, not connection type + * * @var string */ - static public $label = 'WordPress REST API'; + public static $label = 'Username / Password'; /** * Auth handler to use * * @var string */ - static public $auth_handler_class = '\Distributor\Authentications\WordPressBasicAuth'; + public static $auth_handler_class = '\Distributor\Authentications\WordPressBasicAuth'; /** * REST API namespace * * @var string */ - static public $namespace = 'wp/v2'; + public static $namespace = 'wp/v2'; /** * Remote request timeout * * @var integer */ - static public $timeout = 5; + public static $timeout = 5; /** * Default post type to pull. @@ -877,8 +883,8 @@ public function check_connections() { private function to_wp_post( $post ) { $obj = new \stdClass(); - $obj->ID = $post['id']; - $obj->post_title = $post['title']['rendered']; + $obj->ID = $post['id']; + $obj->post_title = $post['title']['rendered']; if ( isset( $post['excerpt']['raw'] ) ) { $obj->post_excerpt = $post['excerpt']['raw']; @@ -888,8 +894,8 @@ private function to_wp_post( $post ) { $obj->post_excerpt = ''; } - $obj->post_status = 'draft'; - $obj->post_author = get_current_user_id(); + $obj->post_status = 'draft'; + $obj->post_author = get_current_user_id(); $obj->post_password = $post['password']; $obj->post_date = $post['date']; diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index d308d7b8e..786ffcc3e 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -28,7 +28,7 @@ class NetworkSiteConnection extends Connection { * * @var string */ - static public $slug = 'networkblog'; + public static $slug = 'networkblog'; /** * Default post type to pull. @@ -186,7 +186,7 @@ public function pull( $items ) { if ( ! empty( $post_props['meta']['dt_connection_map'] ) ) { foreach ( $post_props['meta']['dt_connection_map'] as $distributed ) { - $distributed = unserialize( $distributed ); + $distributed = maybe_unserialize( $distributed ); if ( array_key_exists( $current_blog_id, $distributed['internal'] ) ) { $dt_pull_messages['duplicated'] = 1; diff --git a/includes/classes/PullListTable.php b/includes/classes/PullListTable.php index a104965bb..20d1145ab 100644 --- a/includes/classes/PullListTable.php +++ b/includes/classes/PullListTable.php @@ -59,6 +59,11 @@ public function get_columns() { 'date' => esc_html__( 'Date', 'distributor' ), ]; + // Remove checkbox column on the Pulled view + if ( isset( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { + unset( $columns['cb'] ); + } + return $columns; } @@ -85,14 +90,40 @@ public function get_sortable_columns() { */ protected function get_views() { - $current_status = ( empty( $_GET['status'] ) ) ? 'new' : sanitize_key( $_GET['status'] ); + $current_status = ( empty( $_GET['status'] ) ) ? 'new' : sanitize_key( $_GET['status'] ); // @codingStandardsIgnoreLine No nonce needed. $request_uri = $_SERVER['REQUEST_URI']; + $url = add_query_arg( + array( + 'paged' => false, + 's' => false, + ), + $request_uri + ); + $new_url = add_query_arg( + array( + 'status' => 'new', + ), + $url + ); + $pulled_url = add_query_arg( + array( + 'status' => 'pulled', + ), + $url + ); + $skipped_url = add_query_arg( + array( + 'status' => 'skipped', + ), + $url + ); + $status_links = [ - 'new' => '' . esc_html__( 'New', 'distributor' ) . '', - 'pulled' => '' . esc_html__( 'Pulled', 'distributor' ) . '', - 'skipped' => '' . esc_html__( 'Skipped', 'distributor' ) . '', + 'new' => '' . esc_html__( 'New', 'distributor' ) . '', + 'pulled' => '' . esc_html__( 'Pulled', 'distributor' ) . '', + 'skipped' => '' . esc_html__( 'Skipped', 'distributor' ) . '', ]; return $status_links; @@ -123,7 +154,7 @@ protected function bulk_actions( $which = '' ) { * * @param array $actions An array of the available bulk actions. */ - $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); + $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // @codingStandardsIgnoreLine valid filter name $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions ); $two = ''; } else { @@ -155,12 +186,12 @@ protected function bulk_actions( $which = '' ) { * * @global string $mode * - * @param WP_Post $post The current WP_Post object. + * @param \WP_Post $post The current WP_Post object. */ public function column_date( $post ) { global $mode; - if ( ! empty( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { + if ( ! empty( $_GET['status'] ) && 'pulled' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce isn't required. if ( ! empty( $this->sync_log[ $post->ID ] ) ) { $syndicated_at = get_post_meta( $this->sync_log[ $post->ID ], 'dt_syndicate_time', true ); @@ -172,11 +203,13 @@ public function column_date( $post ) { $time_diff = time() - $syndicated_at; if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { + /* translators: %s: a human readable time */ $h_time = sprintf( esc_html__( '%s ago', 'distributor' ), human_time_diff( $syndicated_at ) ); } else { $h_time = date( 'F j, Y', $syndicated_at ); } + /* translators: %s: time of pull */ echo sprintf( esc_html__( 'Pulled %s', 'distributor' ), esc_html( $h_time ) ); } } @@ -193,6 +226,7 @@ public function column_date( $post ) { $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { + /* translators: %s: a human readable time */ $h_time = sprintf( esc_html__( '%s ago', 'distributor' ), human_time_diff( $time ) ); } else { $h_time = mysql2date( esc_html__( 'Y/m/d', 'distributor' ), $m_time ); @@ -222,15 +256,16 @@ public function column_date( $post ) { /** * Output standard table columns (not name) * - * @param array $item Item to output. - * @param string $column_name Column name. + * @param array|\WP_Post $item Item to output. + * @param string $column_name Column name. + * + * @return string Url, post title, or empty string. * @since 0.8 */ public function column_default( $item, $column_name ) { switch ( $column_name ) { case 'name': return $item['post_title']; - break; case 'url': $url = get_post_meta( $item->ID, 'dt_external_connection_url', true ); @@ -239,20 +274,21 @@ public function column_default( $item, $column_name ) { } return $url; - break; } + + return ''; } /** * Output name column wrapper * * @since 4.3.0 - * @param WP_Post $item Post object. - * @param string $classes CSS classes. - * @param string $data Column data. - * @param string $primary Whether primary or not. + * @param \WP_Post $item Post object. + * @param string $classes CSS classes. + * @param string $data Column data. + * @param string $primary Whether primary or not. */ - protected function _column_name( $item, $classes, $data, $primary ) { + protected function _column_name( $item, $classes, $data, $primary ) { // @codingStandardsIgnoreLine valid function name echo ''; $this->column_name( $item ); echo wp_kses_post( $this->handle_row_actions( $item, 'title', $primary ) ); @@ -262,7 +298,7 @@ protected function _column_name( $item, $classes, $data, $primary ) { /** * Output inner name column with actions * - * @param WP_Post $item Post object. + * @param \WP_Post $item Post object. * @since 0.8 */ public function column_name( $item ) { @@ -279,16 +315,16 @@ public function column_name( $item ) { $actions = []; - if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { + if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed. $actions = [ 'view' => '' . esc_html__( 'View', 'distributor' ) . '', 'skip' => sprintf( '%s', esc_url( wp_nonce_url( admin_url( 'admin.php?page=pull&action=skip&_wp_http_referer=' . rawurlencode( $_SERVER['REQUEST_URI'] ) . '&post=' . $item->ID . '&connection_type=' . $connection_type . '&connection_id=' . $connection_id ), 'dt_skip' ) ), esc_html__( 'Skip', 'distributor' ) ), ]; - } elseif ( 'skipped' === $_GET['status'] ) { + } elseif ( 'skipped' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed. $actions = [ 'view' => '' . esc_html__( 'View', 'distributor' ) . '', ]; - } elseif ( 'pulled' === $_GET['status'] ) { + } elseif ( 'pulled' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not needed $new_post_id = ( ! empty( $this->sync_log[ (int) $item->ID ] ) ) ? $this->sync_log[ (int) $item->ID ] : 0; $new_post = get_post( $new_post_id ); @@ -344,8 +380,8 @@ public function prepare_items() { 'post_type' => $connection_now->pull_post_type ?: 'post', ]; - if ( ! empty( $_GET['s'] ) ) { - $remote_get_args['s'] = rawurlencode( $_GET['s'] ); + if ( ! empty( $_GET['s'] ) ) { // @codingStandardsIgnoreLine Nonce isn't required. + $remote_get_args['s'] = rawurlencode( $_GET['s'] ); // @codingStandardsIgnoreLine Nonce isn't required. } if ( is_a( $connection_now, '\Distributor\ExternalConnection' ) ) { @@ -375,7 +411,7 @@ public function prepare_items() { } } - if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { + if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. $remote_get_args['post__not_in'] = array_merge( $skipped, $syndicated ); $remote_get_args['meta_query'] = [ @@ -384,7 +420,7 @@ public function prepare_items() { 'compare' => 'NOT EXISTS', ], ]; - } elseif ( 'skipped' === $_GET['status'] ) { + } elseif ( 'skipped' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. $remote_get_args['post__in'] = $skipped; } else { $remote_get_args['post__in'] = $syndicated; @@ -414,11 +450,12 @@ public function prepare_items() { * Handles the checkbox column output. * * @since 4.3.0 - * @param WP_Post $post The current WP_Post object. + * @param \WP_Post $post The current WP_Post object. */ public function column_cb( $post ) { ?> @@ -433,12 +470,12 @@ public function column_cb( $post ) { * @return array */ public function get_bulk_actions() { - if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { + if ( empty( $_GET['status'] ) || 'new' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. $actions = [ 'bulk-syndicate' => esc_html__( 'Pull', 'distributor' ), 'bulk-skip' => esc_html__( 'Skip', 'distributor' ), ]; - } elseif ( 'skipped' === $_GET['status'] ) { + } elseif ( 'skipped' === $_GET['status'] ) { // @codingStandardsIgnoreLine Nonce not required. $actions = [ 'bulk-syndicate' => esc_html__( 'Pull', 'distributor' ), ]; diff --git a/includes/distributed-post-ui.php b/includes/distributed-post-ui.php index 496c786f9..a4005fa24 100644 --- a/includes/distributed-post-ui.php +++ b/includes/distributed-post-ui.php @@ -33,11 +33,13 @@ function add_help_tab() { return; } - if ( empty( $_GET['post'] ) ) { + if ( empty( $_GET['post'] ) ) { // @codingStandardsIgnoreLine Nonce validation not necessary here. return; } - $connection_map = get_post_meta( intval( $_GET['post'] ), 'dt_connection_map', true ); + $post_id = intval( $_GET['post'] ); // @codingStandardsIgnoreLine Nonce not necessary, simply type-casting data here from the admin. + + $connection_map = get_post_meta( $post_id, 'dt_connection_map', true ); if ( empty( $connection_map ) ) { return; @@ -45,13 +47,14 @@ function add_help_tab() { $screen = get_current_screen(); - $post_type_object = get_post_type_object( get_post_type( $_GET['post'] ) ); + $post_type_object = get_post_type_object( get_post_type( $post_id ) ); // Add my_help_tab if current screen is My Admin Page $screen->add_help_tab( array( 'id' => 'distributer', 'title' => esc_html__( 'Distributor', 'distributor' ), + /* translators: %1$s: Post type singular name, %2$s: Post type singular name, %3$s: Pos type name */ 'content' => '

' . sprintf( esc_html__( 'The number of connections this %1$s has been distributed to is shown in the publish meta box. If this %2$s is deleted, it could have ramifications across all those %3$s.', 'distributor' ), esc_html( strtolower( $post_type_object->labels->singular_name ) ), esc_html( strtolower( $post_type_object->labels->singular_name ) ), esc_html( strtolower( $post_type_object->labels->name ) ) ) . '

', ) ); @@ -60,7 +63,7 @@ function add_help_tab() { /** * Output distributed to number * - * @param WP_Post $post Post object. + * @param \WP_Post $post Post object. * @since 0.8 */ function distributed_to( $post ) { @@ -83,6 +86,7 @@ function distributed_to( $post ) {
+ %d connection', 'Distributed to %d connections', (int) $total_connections, 'distributor' ) ), (int) $total_connections ); ?> (?) diff --git a/includes/external-connection-cpt.php b/includes/external-connection-cpt.php index eabcc41d4..92207b236 100644 --- a/includes/external-connection-cpt.php +++ b/includes/external-connection-cpt.php @@ -82,6 +82,7 @@ function output_status_column( $column_name, $post_id ) { + title="" > @@ -263,7 +264,7 @@ function ajax_verify_external_connection() { * @since 0.8 */ function admin_enqueue_scripts( $hook ) { - if ( ( 'post.php' === $hook && 'dt_ext_connection' === get_post_type() ) || ( 'post-new.php' === $hook && ! empty( $_GET['post_type'] ) && 'dt_ext_connection' === $_GET['post_type'] ) ) { + if ( ( 'post.php' === $hook && 'dt_ext_connection' === get_post_type() ) || ( 'post-new.php' === $hook && ! empty( $_GET['post_type'] ) && 'dt_ext_connection' === $_GET['post_type'] ) ) { // @codingStandardsIgnoreLine Nonce not required. wp_enqueue_style( 'dt-admin-external-connection', plugins_url( '/dist/css/admin-external-connection.min.css', __DIR__ ), array(), DT_VERSION ); wp_enqueue_script( 'dt-admin-external-connection', plugins_url( '/dist/js/admin-external-connection.min.js', __DIR__ ), array( 'jquery', 'underscore' ), DT_VERSION, true ); @@ -292,7 +293,7 @@ function admin_enqueue_scripts( $hook ) { wp_dequeue_script( 'autosave' ); } - if ( ! empty( $_GET['page'] ) && 'distributor' === $_GET['page'] ) { + if ( ! empty( $_GET['page'] ) && 'distributor' === $_GET['page'] ) { // @codingStandardsIgnoreLine Nonce not required wp_enqueue_style( 'dt-admin-external-connections', plugins_url( '/dist/css/admin-external-connections.min.css', __DIR__ ), array(), DT_VERSION ); } } @@ -310,7 +311,7 @@ function filter_enter_title_here( $label, $post = 0 ) { return $label; } - return esc_html__( 'Enter external connection name', 'distributor' ); + return esc_html__( 'Label this external connection', 'distributor' ); } /** @@ -399,7 +400,7 @@ function add_meta_boxes() { * Output connection options meta box * * @since 0.8 - * @param WP_Post $post Post object. + * @param \WP_Post $post Post object. */ function meta_box_external_connection_details( $post ) { wp_nonce_field( 'dt_external_connection_details_action', 'dt_external_connection_details' ); @@ -444,13 +445,12 @@ function meta_box_external_connection_details( $post ) {

-
+
-

@@ -493,7 +493,7 @@ function meta_box_external_connection_details( $post ) { -

+

@@ -532,7 +532,7 @@ function dashboard() {

- + @@ -598,13 +598,13 @@ function add_submenu_item() { esc_html__( 'External Connections', 'distributor' ), esc_html__( 'External Connections', 'distributor' ), /** - * Filter Distributor capabilities allowed to manage external connections. - * - * @since 1.0.0 - * - * @param string manage_options The capability allowed to manage external connections. - */ - apply_filters( 'dt_external_capabilities', 'manage_options' ), + * Filter Distributor capabilities allowed to manage external connections. + * + * @since 1.0.0 + * + * @param string manage_options The capability allowed to manage external connections. + */ + apply_filters( 'dt_external_capabilities', 'manage_options' ), 'distributor' ); } @@ -665,11 +665,13 @@ function filter_post_updated_messages( $messages ) { 2 => esc_html__( 'Custom field updated.', 'distributor' ), 3 => esc_html__( 'Custom field deleted.', 'distributor' ), 4 => esc_html__( 'External connection updated.', 'distributor' ), - 5 => isset( $_GET['revision'] ) ? sprintf( __( ' External connection restored to revision from %s', 'distributor' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + /* translators: %s: revision title */ + 5 => isset( $_GET['revision'] ) ? sprintf( __( ' External connection restored to revision from %s', 'distributor' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // @codingStandardsIgnoreLine Nonce not required 6 => esc_html__( 'External connection created.', 'distributor' ), 7 => esc_html__( 'External connection saved.', 'distributor' ), 8 => esc_html__( 'External connection submitted.', 'distributor' ), 9 => sprintf( + /* translators: %s: a date and time */ __( 'External connection scheduled for: %1$s.', 'distributor' ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ), diff --git a/includes/pull-ui.php b/includes/pull-ui.php index b77cf5e31..476bce4d7 100644 --- a/includes/pull-ui.php +++ b/includes/pull-ui.php @@ -66,7 +66,7 @@ function setup_list_table() { $internal_connection = new \Distributor\InternalConnections\NetworkSiteConnection( $site_array['site'] ); $connection_list_table->connection_objects[] = $internal_connection; - if ( ! empty( $_GET['connection_id'] ) && ! empty( $_GET['connection_type'] ) && 'internal' === $_GET['connection_type'] && (int) $internal_connection->site->blog_id === (int) $_GET['connection_id'] ) { + if ( ! empty( $_GET['connection_id'] ) && ! empty( $_GET['connection_type'] ) && 'internal' === $_GET['connection_type'] && (int) $internal_connection->site->blog_id === (int) $_GET['connection_id'] ) { // @codingStandardsIgnoreLine Content is type casted, no need for nonce. $connection_now = $internal_connection; } } @@ -90,7 +90,7 @@ function setup_list_table() { if ( ! is_wp_error( $external_connection ) ) { $connection_list_table->connection_objects[] = $external_connection; - if ( ! empty( $_GET['connection_id'] ) && ! empty( $_GET['connection_type'] ) && 'external' === $_GET['connection_type'] && (int) $external_connection_id === (int) $_GET['connection_id'] ) { + if ( ! empty( $_GET['connection_id'] ) && ! empty( $_GET['connection_type'] ) && 'external' === $_GET['connection_type'] && (int) $external_connection_id === (int) $_GET['connection_id'] ) { // @codingStandardsIgnoreLine Content is type casted, no need for nonce. $connection_now = $external_connection; } } @@ -110,7 +110,7 @@ function setup_list_table() { * @since 0.8 */ function admin_enqueue_scripts( $hook ) { - if ( 'distributor_page_pull' !== $hook || empty( $_GET['page'] ) || 'pull' !== $_GET['page'] ) { + if ( 'distributor_page_pull' !== $hook || empty( $_GET['page'] ) || 'pull' !== $_GET['page'] ) { // @codingStandardsIgnoreLine Comparing values, not using them. return; } @@ -251,8 +251,6 @@ function( $remote_post_id ) use ( $post_type ) { wp_safe_redirect( wp_get_referer() ); exit; - - break; case 'bulk-skip': case 'skip': if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'dt_skip' ) && ! wp_verify_nonce( $_GET['_wpnonce'], 'bulk-distributor_page_pull' ) ) { @@ -295,8 +293,6 @@ function( $remote_post_id ) use ( $post_type ) { wp_safe_redirect( wp_get_referer() ); exit; - - break; } } @@ -397,8 +393,8 @@ function dashboard() { // This is either from a query param, "post" post type, or the first in the list $connection_now->pull_post_type = $connection_now->pull_post_types[0]['slug']; foreach ( $connection_now->pull_post_types as $post_type ) { - if ( isset( $_GET['pull_post_type'] ) ) { - if ( $_GET['pull_post_type'] === $post_type['slug'] ) { + if ( isset( $_GET['pull_post_type'] ) ) { // @codingStandardsIgnoreLine No nonce needed here. + if ( $_GET['pull_post_type'] === $post_type['slug'] ) { // @codingStandardsIgnoreLine Comparing values, no nonce needed. $connection_now->pull_post_type = $post_type['slug']; break; } @@ -439,7 +435,7 @@ function dashboard() { views(); ?> - + connection_objects ) ) : ?> diff --git a/includes/push-ui.php b/includes/push-ui.php index c097cab93..51bd6de7e 100644 --- a/includes/push-ui.php +++ b/includes/push-ui.php @@ -60,7 +60,7 @@ function syndicatable() { return false; } - if ( ! in_array( get_post_type(), \Distributor\Utils\distributable_post_types(), true ) || ( ! empty( $_GET['post_type'] ) && 'dt_ext_connection' === $_GET['post_type'] ) ) { + if ( ! in_array( get_post_type(), \Distributor\Utils\distributable_post_types(), true ) || ( ! empty( $_GET['post_type'] ) && 'dt_ext_connection' === $_GET['post_type'] ) ) { // @codingStandardsIgnoreLine Nonce not required return false; } @@ -303,6 +303,7 @@ function menu_content() {

+ labels->singular_name ) ) ); ?> . @@ -357,7 +358,7 @@ function menu_content() { $external_connections_query = new \WP_Query( array( 'post_type' => 'dt_ext_connection', - 'posts_per_page' => 200, + 'posts_per_page' => 200, // @codingStandardsIgnoreLine This high pagination limit is purposeful 'no_found_rows' => true, 'post_status' => 'publish', ) @@ -365,7 +366,7 @@ function menu_content() { $current_post_type = get_post_type(); - if ( ! empty( $_GET['post_type'] ) ) { + if ( ! empty( $_GET['post_type'] ) ) { // @codingStandardsIgnoreLine nonce not required $current_post_type = sanitize_key( $_GET['post_type'] ); } @@ -443,6 +444,7 @@ function menu_content() {

+

ID ) ) ); ?>

diff --git a/includes/rest-api.php b/includes/rest-api.php index 1b255af52..f009004f3 100644 --- a/includes/rest-api.php +++ b/includes/rest-api.php @@ -42,10 +42,10 @@ function() { * Use the raw content for Gutenberg->Gutenberg posts. Note: `distributor_raw_content` * is only sent when the origin supports Gutenberg. * - * @param stdClass $prepared_post An object representing a single post prepared. - * @param WP_REST_Request $request Request object. + * @param Object $prepared_post An object representing a single post prepared. + * @param \WP_REST_Request $request Request object. * - * @return stdClass $prepared_post The filtered post object. + * @return Object $prepared_post The filtered post object. */ function filter_distributor_content( $prepared_post, $request ) { @@ -60,9 +60,9 @@ function filter_distributor_content( $prepared_post, $request ) { /** * When an API push is being received, handle Distributor specific attributes * - * @param WP_Post $post Post object. - * @param WP_REST_Request $request Request object. - * @param bool $update Update or create. + * @param \WP_Post $post Post object. + * @param \WP_REST_Request $request Request object. + * @param bool $update Update or create. * @since 1.0 */ function process_distributor_attributes( $post, $request, $update ) { @@ -120,8 +120,8 @@ function process_distributor_attributes( $post, $request, $update ) { * * @since 1.0 * - * @param WP_Post $post Inserted or updated post object. - * @param WP_REST_Request $request Request object. + * @param \WP_Post $post Inserted or updated post object. + * @param \WP_REST_Request $request Request object. * @param bool $update True when creating a post, false when updating. */ do_action( 'dt_process_distributor_attributes', $post, $request, $update ); @@ -130,11 +130,11 @@ function process_distributor_attributes( $post, $request, $update ) { /** * Filter the data requested over REST API when a post is pulled. * - * @param WP_REST_Response $response Response object. - * @param WP_Post $post Post object. - * @param WP_REST_Request $request Request object. + * @param \WP_REST_Response $response Response object. + * @param \WP_Post $post Post object. + * @param \WP_REST_Request $request Request object. * - * @return WP_REST_Response $response The filtered response object. + * @return \WP_REST_Response $response The filtered response object. */ function prepare_distributor_content( $response, $post, $request ) { @@ -144,7 +144,7 @@ function prepare_distributor_content( $response, $post, $request ) { } // Is the local site is running Gutenberg? if ( \Distributor\Utils\is_using_gutenberg( $post ) ) { - $post_data = $response->get_data(); + $post_data = $response->get_data(); $post_data['is_using_gutenberg'] = true; $response->set_data( $post_data ); } diff --git a/includes/settings.php b/includes/settings.php index 1e5e418d3..b0526fa49 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -108,6 +108,7 @@ function update_notice( $plugin_file, $plugin_data, $status ) {

+ Register for a free Distributor key to receive updates.', 'distributor' ), esc_url( $notice_url ) ) ); ?>

@@ -126,6 +127,7 @@ function maybe_notice() { if ( preg_match( '/-dev$/', DT_VERSION ) ) { ?>
+

download and install the stable version of Distributor instead.', 'distributor' ), 'npm install && npm run build', 'https://distributorplugin.com/' ) ); ?>

+

Register Distributor to receive important plugin update notices and other Distributor news.', 'distributor' ), esc_url( $notice_url ) ) ); ?>

ID, 'dt_original_post_deleted', true ); if ( $unlinked || $original_deleted ) { @@ -170,7 +172,7 @@ function add_linked_class( $classes ) { /** * Output syndicated on date * - * @param WP_Post $post Post object + * @param \WP_Post $post Post object * @since 0.8 */ function syndication_date( $post ) { @@ -233,7 +235,10 @@ function new_revisions_meta_box( $post_id ) { $post_type = get_post_type_object( get_post_type( $post_id ) ); ?>

- labels->name ) ) ); ?> + labels->name ) ) ); + ?>

- %3$s. However, the original has been deleted.', 'distributor' ), esc_html( strtolower( $post_type_singular ) ), esc_url( $post_url ), esc_html( $original_location_name ) ) ); ?> + %3$s. However, the original has been deleted.', 'distributor' ), esc_html( strtolower( $post_type_singular ) ), esc_url( $post_url ), esc_html( $original_location_name ) ) ); + ?>

- %2$s.', 'distributor' ), esc_url( $post_url ), esc_html( $original_location_name ) ) ); ?> + %2$s.', 'distributor' ), esc_url( $post_url ), esc_html( $original_location_name ) ) ); + ?> ID ) ) : ?> + unlink from the original.', 'distributor' ), esc_html( strtolower( $post_type_singular ) ), wp_nonce_url( add_query_arg( 'action', 'unlink', admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) ), "unlink-post_{$post->ID}" ) ) ); ?>

+ %1$s.', 'distributor' ), esc_url( $post_url ), esc_html( $original_location_name ) ) ); ?> + restore it.", 'distributor' ), esc_html( strtolower( $post_type_singular ) ), wp_nonce_url( add_query_arg( 'action', 'link', admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) ), "link-post_{$post->ID}" ) ) ); ?>

@@ -520,6 +536,7 @@ function enqueue_gutenberg_edit_scripts() { restore_current_blog(); if ( empty( $original_location_name ) ) { + /* translators: %d: the original blog id */ $original_location_name = sprintf( esc_html__( 'Blog #%d', 'distributor' ), $original_blog_id ); } } else { diff --git a/includes/template-tags.php b/includes/template-tags.php index b104b06c7..44455a4b7 100644 --- a/includes/template-tags.php +++ b/includes/template-tags.php @@ -164,7 +164,7 @@ function distributor_get_original_site_link( $post_id = null ) { $site_url = distributor_get_original_site_url( $post_id ); if ( empty( $site_name ) || empty( $site_url ) ) { - return; + return ''; } /** @@ -174,6 +174,7 @@ function distributor_get_original_site_link( $post_id = null ) { * * @param string A formatted version of the original site link. */ + /* translators: %1$s: site url, %2$s; site name*/ return apply_filters( 'distributor_get_original_site_link', sprintf( __( 'By %2$s', 'distributor' ), esc_url( $site_url ), esc_html( $site_name ) ) ); } diff --git a/includes/utils.php b/includes/utils.php index c556e3bfa..24b3631b2 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -46,6 +46,15 @@ function is_using_gutenberg( $post ) { if ( ! function_exists( 'use_block_editor_for_post' ) ) { include_once ABSPATH . 'wp-admin/includes/post.php'; } + + // Previous to Gutenberg 5.0, `use_block_editor_for_post` was named `gutenberg_can_edit_post`. + if ( ! function_exists( 'use_block_editor_for_post' ) ) { + if ( function_exists( 'gutenberg_can_edit_post' ) ) { + return gutenberg_can_edit_post( $post ); + } + return false; + } + return use_block_editor_for_post( $post ); } @@ -515,7 +524,7 @@ function set_media( $post_id, $media ) { $featured_keys = wp_list_pluck( $media, 'featured' ); // Note: this is not a strict search because of issues with typecasting in some setups - $featured_key = array_search( true, $featured_keys ); + $featured_key = array_search( true, $featured_keys ); // @codingStandardsIgnoreLine Ignore strict search requirement. $media = ( false !== $featured_key ) ? array( $media[ $featured_key ] ) : array(); } @@ -559,7 +568,9 @@ function set_media( $post_id, $media ) { } // Transfer all meta - set_meta( $image_id, $media_item['meta'] ); + if ( isset( $media_item['meta'] ) ) { + set_meta( $image_id, $media_item['meta'] ); + } // Transfer post properties wp_update_post( @@ -580,7 +591,7 @@ function set_media( $post_id, $media ) { /** * This is a helper function for transporting/formatting data about a media post * - * @param WP_Post $media_post Media post. + * @param \WP_Post $media_post Media post. * @since 1.0 * @return array */ @@ -665,17 +676,35 @@ function process_media( $url, $post_id ) { require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; + // Allows to pull media from local IP addresses + // Uses a "magic number" for priority so we only unhook our call, just in case + add_filter( 'http_request_host_is_external', '__return_true', 88 ); + // Download file to temp location. $file_array['tmp_name'] = download_url( $url ); + remove_filter( 'http_request_host_is_external', '__return_true', 88 ); + // If error storing temporarily, return the error. if ( is_wp_error( $file_array['tmp_name'] ) ) { + + // Distributor is in debug mode, display the issue, could be storage related. + if ( is_dt_debug() ) { + error_log( sprintf( 'Distributor: %s', $file_array['tmp_name']->get_error_message() ) ); // @codingStandardsIgnoreLine + } + return false; } // Do the validation and storage stuff. $result = media_handle_sideload( $file_array, $post_id ); if ( is_wp_error( $result ) ) { + + // Distributor is in debug mode, display the issue, could be storage related. + if ( is_dt_debug() ) { + error_log( sprintf( 'Distributor: %s', $file_array['tmp_name']->get_error_message() ) ); // @codingStandardsIgnoreLine + } + return false; } return (int) $result; diff --git a/lang/distributor.pot b/lang/distributor.pot index 3f3e7f969..96c509e9e 100644 --- a/lang/distributor.pot +++ b/lang/distributor.pot @@ -2,16 +2,16 @@ # This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Distributor 1.3.9\n" +"Project-Id-Version: Distributor 1.4.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n" -"POT-Creation-Date: 2019-02-22 18:47:15+00:00\n" +"POT-Creation-Date: 2019-03-08 15:35:57+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -"X-Generator: node-wp-i18n 1.1.1\n" +"X-Generator: node-wp-i18n 1.2.1\n" #: distributor.php:63 msgid "Distributor requires PHP version 5.6." @@ -96,8 +96,8 @@ msgstr "" #: includes/classes/Authentications/WordPressBasicAuth.php:69 msgid "" -"We need a username (preferrably with an Administrator role) to the " -"WordPress site with the API." +"A username from the external WordPress site to connect with. For full " +"functionality, this needs to be a user with an administrator role." msgstr "" #: includes/classes/Authentications/WordPressBasicAuth.php:73 @@ -108,6 +108,16 @@ msgstr "" msgid "(Change)" msgstr "" +#: includes/classes/Authentications/WordPressBasicAuth.php:89 +#. translators: %s: Application Passwords plugin URL +msgid "" +"Important: We strongly recommend using the Application Passwords plugin on the site you are connecting " +"to in order to create a unique password for this connection. This helps " +"limit the use of your primary password and will allow you to revoke access " +"in the future if needed." +msgstr "" + #: includes/classes/Authentications/WordPressDotcomOauth2Authentication.php:106 msgid "To connect, first " msgstr "" @@ -162,7 +172,7 @@ msgid "Edit \"%s\"" msgstr "" #: includes/classes/ExternalConnectionListTable.php:74 -#: includes/classes/PullListTable.php:299 +#: includes/classes/PullListTable.php:335 msgid "Edit" msgstr "" @@ -189,35 +199,35 @@ msgstr "" msgid "Delete Permanently" msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:188 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:302 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:689 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:194 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:308 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:695 msgid "Could not connect to API endpoint." msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:194 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:316 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:518 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:636 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:695 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:200 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:322 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:524 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:642 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:701 msgid "Response body is empty" msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:200 #: includes/classes/ExternalConnections/WordPressExternalConnection.php:206 -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:526 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:212 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:532 msgid "Could not determine remote post type endpoint" msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:308 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:314 msgid "API endpoint error." msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:476 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:482 msgid "Post id required to push" msgstr "" -#: includes/classes/ExternalConnections/WordPressExternalConnection.php:644 +#: includes/classes/ExternalConnections/WordPressExternalConnection.php:650 msgid "Could not determine remote post id." msgstr "" @@ -230,100 +240,103 @@ msgstr "" msgid "Date" msgstr "" -#: includes/classes/PullListTable.php:93 +#: includes/classes/PullListTable.php:124 msgid "New" msgstr "" -#: includes/classes/PullListTable.php:94 +#: includes/classes/PullListTable.php:125 msgid "Pulled" msgstr "" -#: includes/classes/PullListTable.php:95 +#: includes/classes/PullListTable.php:126 msgid "Skipped" msgstr "" -#: includes/classes/PullListTable.php:137 +#: includes/classes/PullListTable.php:168 msgid "Select bulk action" msgstr "" -#: includes/classes/PullListTable.php:146 +#: includes/classes/PullListTable.php:177 msgid "Apply" msgstr "" -#: includes/classes/PullListTable.php:168 +#: includes/classes/PullListTable.php:199 msgid "Post deleted." msgstr "" -#: includes/classes/PullListTable.php:170 -#: includes/classes/PullListTable.php:189 +#: includes/classes/PullListTable.php:201 +#: includes/classes/PullListTable.php:222 msgid "Y/m/d g:i:s a" msgstr "" -#: includes/classes/PullListTable.php:175 -#: includes/classes/PullListTable.php:196 +#: includes/classes/PullListTable.php:207 +#: includes/classes/PullListTable.php:230 +#. translators: %s: a human readable time msgid "%s ago" msgstr "" -#: includes/classes/PullListTable.php:180 +#: includes/classes/PullListTable.php:213 +#. translators: %s: time of pull msgid "Pulled %s" msgstr "" -#: includes/classes/PullListTable.php:185 -#: includes/classes/PullListTable.php:186 +#: includes/classes/PullListTable.php:218 +#: includes/classes/PullListTable.php:219 msgid "Unpublished" msgstr "" -#: includes/classes/PullListTable.php:198 +#: includes/classes/PullListTable.php:232 msgid "Y/m/d" msgstr "" -#: includes/classes/PullListTable.php:203 +#: includes/classes/PullListTable.php:237 msgid "Published" msgstr "" -#: includes/classes/PullListTable.php:206 +#: includes/classes/PullListTable.php:240 msgid "Missed schedule" msgstr "" -#: includes/classes/PullListTable.php:208 +#: includes/classes/PullListTable.php:242 msgid "Scheduled" msgstr "" -#: includes/classes/PullListTable.php:211 +#: includes/classes/PullListTable.php:245 msgid "Last Modified" msgstr "" -#: includes/classes/PullListTable.php:238 -#: includes/external-connection-cpt.php:213 +#: includes/classes/PullListTable.php:273 +#: includes/external-connection-cpt.php:214 msgid "None" msgstr "" -#: includes/classes/PullListTable.php:284 -#: includes/classes/PullListTable.php:289 -#: includes/classes/PullListTable.php:298 includes/push-ui.php:437 -#: includes/push-ui.php:472 +#: includes/classes/PullListTable.php:320 +#: includes/classes/PullListTable.php:325 +#: includes/classes/PullListTable.php:334 includes/push-ui.php:438 +#: includes/push-ui.php:474 msgid "View" msgstr "" -#: includes/classes/PullListTable.php:285 -#: includes/classes/PullListTable.php:439 +#: includes/classes/PullListTable.php:321 +#: includes/classes/PullListTable.php:476 msgid "Skip" msgstr "" -#: includes/classes/PullListTable.php:307 +#: includes/classes/PullListTable.php:343 msgid "(no title)" msgstr "" -#: includes/classes/PullListTable.php:422 +#: includes/classes/PullListTable.php:459 +#. translators: %s: the post title or draft msgid "Select %s" msgstr "" -#: includes/classes/PullListTable.php:438 -#: includes/classes/PullListTable.php:443 +#: includes/classes/PullListTable.php:475 +#: includes/classes/PullListTable.php:480 msgid "Pull" msgstr "" -#: includes/classes/PullListTable.php:472 +#: includes/classes/PullListTable.php:509 msgid "Filter" msgstr "" @@ -331,14 +344,17 @@ msgstr "" msgid "Distributor" msgstr "" -#: includes/distributed-post-ui.php:55 +#: includes/distributed-post-ui.php:58 +#. translators: %1$s: Post type singular name, %2$s: Post type singular name, +#. %3$s: Pos type name msgid "" "The number of connections this %1$s has been distributed to is shown in the " "publish meta box. If this %2$s is deleted, it could have ramifications " "across all those %3$s." msgstr "" -#: includes/distributed-post-ui.php:86 +#: includes/distributed-post-ui.php:90 +#. translators: %d: number of connections msgid "Distributed to %d connection" msgid_plural "Distributed to %d connections" msgstr[0] "" @@ -348,82 +364,79 @@ msgstr[1] "" msgid "Status" msgstr "" -#: includes/external-connection-cpt.php:85 +#: includes/external-connection-cpt.php:86 +#. translators: %s: human readable time difference msgid "Last Checked on %s" msgstr "" -#: includes/external-connection-cpt.php:88 +#: includes/external-connection-cpt.php:89 msgid "(Verify)" msgstr "" -#: includes/external-connection-cpt.php:193 +#: includes/external-connection-cpt.php:194 msgid "URL" msgstr "" -#: includes/external-connection-cpt.php:276 +#: includes/external-connection-cpt.php:277 msgid "No connection found." msgstr "" -#: includes/external-connection-cpt.php:277 +#: includes/external-connection-cpt.php:278 msgid "Connection established." msgstr "" -#: includes/external-connection-cpt.php:278 +#: includes/external-connection-cpt.php:279 msgid "Limited connection established." msgstr "" -#: includes/external-connection-cpt.php:279 +#: includes/external-connection-cpt.php:280 msgid "Push distribution unavailable." msgstr "" -#: includes/external-connection-cpt.php:280 +#: includes/external-connection-cpt.php:281 msgid "Pull distribution limited to basic content, i.e. title and content body." msgstr "" -#: includes/external-connection-cpt.php:281 +#: includes/external-connection-cpt.php:282 msgid "Did you mean: " msgstr "" -#: includes/external-connection-cpt.php:282 +#: includes/external-connection-cpt.php:283 msgid "Checking endpoint..." msgstr "" -#: includes/external-connection-cpt.php:283 +#: includes/external-connection-cpt.php:284 msgid "Authentication failed." msgstr "" -#: includes/external-connection-cpt.php:284 +#: includes/external-connection-cpt.php:285 msgid "Change" msgstr "" -#: includes/external-connection-cpt.php:285 +#: includes/external-connection-cpt.php:286 msgid "Cancel" msgstr "" -#: includes/external-connection-cpt.php:286 +#: includes/external-connection-cpt.php:287 msgid "Distributor not installed on remote site." msgstr "" -#: includes/external-connection-cpt.php:287 +#: includes/external-connection-cpt.php:288 msgid "" "Be careful assigning less trusted roles push privileges as they will " "inherit the capabilities of the user on the remote site." msgstr "" -#: includes/external-connection-cpt.php:313 -msgid "Enter external connection name" +#: includes/external-connection-cpt.php:314 +msgid "Label this external connection" msgstr "" -#: includes/external-connection-cpt.php:395 +#: includes/external-connection-cpt.php:396 msgid "External Connection Details" msgstr "" -#: includes/external-connection-cpt.php:447 -msgid "External Connection Type" -msgstr "" - -#: includes/external-connection-cpt.php:453 -msgid "We need to know what type of API we are communicating with." +#: includes/external-connection-cpt.php:448 +msgid "Authentication Method" msgstr "" #: includes/external-connection-cpt.php:473 @@ -436,8 +449,9 @@ msgstr "" #: includes/external-connection-cpt.php:496 msgid "" -"Please be warned all these users will inherit the permissions of the user " -"on the remote site" +"Select the roles of users on this site that will be allowed to push content " +"to this connection. Keep in mind that pushing will use the permissions of " +"the user credentials provided for this connection." msgstr "" #: includes/external-connection-cpt.php:505 @@ -455,7 +469,7 @@ msgstr "" #: includes/external-connection-cpt.php:529 #: includes/external-connection-cpt.php:598 #: includes/external-connection-cpt.php:599 -#: includes/external-connection-cpt.php:620 includes/pull-ui.php:372 +#: includes/external-connection-cpt.php:620 includes/pull-ui.php:368 msgid "External Connections" msgstr "" @@ -517,31 +531,33 @@ msgstr "" msgid "Custom field deleted." msgstr "" -#: includes/external-connection-cpt.php:668 +#: includes/external-connection-cpt.php:669 +#. translators: %s: revision title msgid " External connection restored to revision from %s" msgstr "" -#: includes/external-connection-cpt.php:669 +#: includes/external-connection-cpt.php:670 msgid "External connection created." msgstr "" -#: includes/external-connection-cpt.php:670 +#: includes/external-connection-cpt.php:671 msgid "External connection saved." msgstr "" -#: includes/external-connection-cpt.php:671 +#: includes/external-connection-cpt.php:672 msgid "External connection submitted." msgstr "" -#: includes/external-connection-cpt.php:673 +#: includes/external-connection-cpt.php:675 +#. translators: %s: a date and time msgid "External connection scheduled for: %1$s." msgstr "" -#: includes/external-connection-cpt.php:674 +#: includes/external-connection-cpt.php:676 msgid "M j, Y @ G:i" msgstr "" -#: includes/external-connection-cpt.php:676 +#: includes/external-connection-cpt.php:678 msgid "External connection draft updated." msgstr "" @@ -553,95 +569,97 @@ msgstr "" msgid "Posts per page" msgstr "" -#: includes/pull-ui.php:194 includes/pull-ui.php:264 +#: includes/pull-ui.php:194 includes/pull-ui.php:262 msgid "Cheatin’ uh?" msgstr "" -#: includes/pull-ui.php:195 includes/pull-ui.php:265 +#: includes/pull-ui.php:195 includes/pull-ui.php:263 msgid "Sorry, you are not allowed to add this item." msgstr "" -#: includes/pull-ui.php:341 +#: includes/pull-ui.php:337 msgid "No Connections to Pull from," msgstr "" -#: includes/pull-ui.php:343 +#: includes/pull-ui.php:339 msgid "Create One?" msgstr "" -#: includes/pull-ui.php:346 +#: includes/pull-ui.php:342 msgid "Pull Content from" msgstr "" -#: includes/pull-ui.php:350 +#: includes/pull-ui.php:346 msgid "Network Connections" msgstr "" -#: includes/pull-ui.php:419 +#: includes/pull-ui.php:415 msgid "Post(s) have been marked as skipped." msgstr "" -#: includes/pull-ui.php:425 +#: includes/pull-ui.php:421 msgid "Post(s) have been pulled." msgstr "" -#: includes/pull-ui.php:431 +#: includes/pull-ui.php:427 msgid "Post(s) have been already distributed." msgstr "" -#: includes/pull-ui.php:438 +#: includes/pull-ui.php:434 msgid "Could not pull content from connection due to error." msgstr "" -#: includes/pull-ui.php:450 +#: includes/pull-ui.php:446 msgid "Search" msgstr "" -#: includes/push-ui.php:306 +#: includes/push-ui.php:307 +#. translators: %s: post type name msgid "This %s has been distributed from" msgstr "" -#: includes/push-ui.php:309 +#: includes/push-ui.php:310 msgid "You can " msgstr "" -#: includes/push-ui.php:310 +#: includes/push-ui.php:311 msgid "view the original" msgstr "" -#: includes/push-ui.php:446 +#: includes/push-ui.php:448 +#. translators: %s the post title msgid "Distribute "%s" to other connections." msgstr "" -#: includes/push-ui.php:451 +#: includes/push-ui.php:453 msgid "Search available connections" msgstr "" -#: includes/push-ui.php:481 +#: includes/push-ui.php:483 msgid "Selected connections" msgstr "" -#: includes/push-ui.php:482 +#: includes/push-ui.php:484 msgid "No connections selected" msgstr "" -#: includes/push-ui.php:499 +#: includes/push-ui.php:501 msgid "Distribute" msgstr "" -#: includes/push-ui.php:499 +#: includes/push-ui.php:501 msgid "As draft" msgstr "" -#: includes/push-ui.php:505 +#: includes/push-ui.php:507 msgid "Post successfully distributed." msgstr "" -#: includes/push-ui.php:508 +#: includes/push-ui.php:510 msgid "There was an issue distributing the post." msgstr "" -#: includes/push-ui.php:514 +#: includes/push-ui.php:516 msgid "No connections available for distribution." msgstr "" @@ -665,11 +683,13 @@ msgstr "" msgid "Original site url for Distributor." msgstr "" -#: includes/settings.php:111 +#: includes/settings.php:112 +#. translators: %s: distributor notice url msgid "Register for a free Distributor key to receive updates." msgstr "" -#: includes/settings.php:129 +#: includes/settings.php:131 +#. translators: %1$s: npm commands, %2$s: distributor url msgid "" "You appear to be running a development version of Distributor. Certain " "features may not work correctly without regularly running %1$s. If " @@ -678,63 +698,64 @@ msgid "" "instead." msgstr "" -#: includes/settings.php:151 +#: includes/settings.php:154 +#. translators: %s: distributor url msgid "" "Register Distributor to receive important plugin update " "notices and other Distributor news." msgstr "" -#: includes/settings.php:178 +#: includes/settings.php:181 msgid "Override Author Byline" msgstr "" -#: includes/settings.php:180 +#: includes/settings.php:183 msgid "Media Handling" msgstr "" -#: includes/settings.php:183 includes/settings.php:221 -#: includes/settings.php:328 includes/settings.php:331 +#: includes/settings.php:186 includes/settings.php:224 +#: includes/settings.php:331 includes/settings.php:334 msgid "Registration Key" msgstr "" -#: includes/settings.php:203 +#: includes/settings.php:206 msgid "" "For linked distributed posts, replace the author name and link with the " "original site name and link." msgstr "" -#: includes/settings.php:221 includes/settings.php:331 +#: includes/settings.php:224 includes/settings.php:334 msgid "Email" msgstr "" -#: includes/settings.php:225 includes/settings.php:335 +#: includes/settings.php:228 includes/settings.php:338 msgid "" "Registration is 100% free and provides update notifications and upgrades " "inside the dashboard; Register for your key." msgstr "" -#: includes/settings.php:242 +#: includes/settings.php:245 msgid "Process the featured image only (default)." msgstr "" -#: includes/settings.php:247 +#: includes/settings.php:250 msgid "Process the featured image and any attached images." msgstr "" -#: includes/settings.php:270 +#: includes/settings.php:273 msgid "Settings" msgstr "" -#: includes/settings.php:290 +#: includes/settings.php:293 msgid "Distributor Settings" msgstr "" -#: includes/settings.php:317 +#: includes/settings.php:320 msgid "Distributor Network Settings" msgstr "" -#: includes/settings.php:361 +#: includes/settings.php:364 msgid "Security error!" msgstr "" @@ -754,53 +775,62 @@ msgstr "" msgid "Linked" msgstr "" -#: includes/syndicated-post-ui.php:195 +#: includes/syndicated-post-ui.php:197 msgid "Distributed on: " msgstr "" -#: includes/syndicated-post-ui.php:223 +#: includes/syndicated-post-ui.php:225 msgid "Revisions" msgstr "" -#: includes/syndicated-post-ui.php:236 +#: includes/syndicated-post-ui.php:240 +#. translators: %s the post type name msgid "Distributed %s do not support revisions unless unlinked." msgstr "" -#: includes/syndicated-post-ui.php:422 includes/syndicated-post-ui.php:523 +#: includes/syndicated-post-ui.php:429 includes/syndicated-post-ui.php:540 +#. translators: %d: the blog ID +#. translators: %d: the original blog id msgid "Blog #%d" msgstr "" -#: includes/syndicated-post-ui.php:434 +#: includes/syndicated-post-ui.php:443 +#. translators: %1$s: post type name, %2$s: site url, %3$s: site name msgid "" "This %1$s was distributed from %3$s. However, the " "original has been deleted." msgstr "" -#: includes/syndicated-post-ui.php:438 +#: includes/syndicated-post-ui.php:450 +#. translators: %1$s: site url, %2$s: site name msgid "Distributed from %2$s." msgstr "" -#: includes/syndicated-post-ui.php:440 +#: includes/syndicated-post-ui.php:454 +#. translators: %1$s: post type name, %2$s: unlink url msgid "" "The original %1$s will update this version unless you unlink from the original." msgstr "" -#: includes/syndicated-post-ui.php:445 +#: includes/syndicated-post-ui.php:460 +#. translators: %1$s: site url, %2$s: site name msgid "Originally distributed from %1$s." msgstr "" -#: includes/syndicated-post-ui.php:446 +#: includes/syndicated-post-ui.php:462 +#. translators: %1$s: post type name, %2$s: link url msgid "" "This %1$s has been unlinked from the original. However, you can always restore it." msgstr "" -#: includes/template-tags.php:177 +#: includes/template-tags.php:178 +#. translators: %1$s: site url, %2$s; site name msgid "By %2$s" msgstr "" -#: includes/template-tags.php:230 +#: includes/template-tags.php:231 msgid "Distributed from" msgstr "" @@ -813,23 +843,23 @@ msgstr "" msgid "Input" msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:395 -msgid "Check for updates" -msgstr "" - -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:432 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:54 msgid "View details" msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:455 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:77 msgid "More information about %s" msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:558 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:128 +msgid "Check for updates" +msgstr "" + +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:223 msgid "Unknown update checker status \"%s\"" msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php:98 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/PluginUpdateChecker.php:98 msgid "There is no changelog available." msgstr "" @@ -856,17 +886,17 @@ msgctxt "verb" msgid "Trash" msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:548 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:213 msgctxt "the plugin title" msgid "The %s plugin is up to date." msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:550 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:215 msgctxt "the plugin title" msgid "A new version of the %s plugin is available." msgstr "" -#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/UpdateChecker.php:552 +#: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php:217 msgctxt "the plugin title" msgid "Could not determine if updates are available for %s." msgstr "" \ No newline at end of file diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4/Factory.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4/Factory.php index 3ab674c27..e0b0e3c3e 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4/Factory.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4/Factory.php @@ -1,6 +1,6 @@ pluginAbsolutePath = $pluginFile; - $this->pluginFile = plugin_basename($this->pluginAbsolutePath); - $this->muPluginFile = $muPluginFile; - - //If no slug is specified, use the name of the main plugin file as the slug. - //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'. - if ( empty($slug) ){ - $slug = basename($this->pluginFile, '.php'); - } - - //Plugin slugs must be unique. - $slugCheckFilter = 'puc_is_slug_in_use-' . $this->slug; - $slugUsedBy = apply_filters($slugCheckFilter, false); - if ( $slugUsedBy ) { - $this->triggerError(sprintf( - 'Plugin slug "%s" is already in use by %s. Slugs must be unique.', - htmlentities($this->slug), - htmlentities($slugUsedBy) - ), E_USER_ERROR); - } - add_filter($slugCheckFilter, array($this, 'getAbsolutePath')); - - //Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume - //it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir). - if ( (strpbrk($this->pluginFile, '/\\') === false) && $this->isUnknownMuPlugin() ) { - $this->muPluginFile = $this->pluginFile; - } - - //To prevent a crash during plugin uninstallation, remove updater hooks when the user removes the plugin. - //Details: https://github.com/YahnisElsts/plugin-update-checker/issues/138#issuecomment-335590964 - add_action('uninstall_' . $this->pluginFile, array($this, 'removeHooks')); - - $this->manualCheckErrorTransient = $this->getUniqueName('manual_check_errors'); - - parent::__construct($metadataUrl, dirname($this->pluginFile), $slug, $checkPeriod, $optionName); - } - - /** - * Create an instance of the scheduler. - * - * @param int $checkPeriod - * @return Puc_v4p4_Scheduler - */ - protected function createScheduler($checkPeriod) { - $scheduler = new Puc_v4p4_Scheduler($this, $checkPeriod, array('load-plugins.php')); - register_deactivation_hook($this->pluginFile, array($scheduler, 'removeUpdaterCron')); - return $scheduler; - } - - /** - * Install the hooks required to run periodic update checks and inject update info - * into WP data structures. - * - * @return void - */ - protected function installHooks(){ - //Override requests for plugin information - add_filter('plugins_api', array($this, 'injectInfo'), 20, 3); - - add_filter('plugin_row_meta', array($this, 'addViewDetailsLink'), 10, 3); - add_filter('plugin_row_meta', array($this, 'addCheckForUpdatesLink'), 10, 2); - add_action('admin_init', array($this, 'handleManualCheck')); - add_action('all_admin_notices', array($this, 'displayManualCheckResult')); - - //Clear the version number cache when something - anything - is upgraded or WP clears the update cache. - add_filter('upgrader_post_install', array($this, 'clearCachedVersion')); - add_action('delete_site_transient_update_plugins', array($this, 'clearCachedVersion')); - - parent::installHooks(); - } - - /** - * Remove update checker hooks. - * - * The intent is to prevent a fatal error that can happen if the plugin has an uninstall - * hook. During uninstallation, WP includes the main plugin file (which creates a PUC instance), - * the uninstall hook runs, WP deletes the plugin files and then updates some transients. - * If PUC hooks are still around at this time, they could throw an error while trying to - * autoload classes from files that no longer exist. - * - * The "site_transient_{$transient}" filter is the main problem here, but let's also remove - * most other PUC hooks to be safe. - * - * @internal - */ - public function removeHooks() { - parent::removeHooks(); - - remove_filter('plugins_api', array($this, 'injectInfo'), 20); - - remove_filter('plugin_row_meta', array($this, 'addViewDetailsLink'), 10); - remove_filter('plugin_row_meta', array($this, 'addCheckForUpdatesLink'), 10); - remove_action('admin_init', array($this, 'handleManualCheck')); - remove_action('all_admin_notices', array($this, 'displayManualCheckResult')); - - remove_filter('upgrader_post_install', array($this, 'clearCachedVersion')); - remove_action('delete_site_transient_update_plugins', array($this, 'clearCachedVersion')); - } - - /** - * Retrieve plugin info from the configured API endpoint. - * - * @uses wp_remote_get() - * - * @param array $queryArgs Additional query arguments to append to the request. Optional. - * @return Puc_v4p4_Plugin_Info - */ - public function requestInfo($queryArgs = array()) { - list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p4_Plugin_Info', 'request_info', $queryArgs); - - if ( $pluginInfo !== null ) { - /** @var Puc_v4p4_Plugin_Info $pluginInfo */ - $pluginInfo->filename = $this->pluginFile; - $pluginInfo->slug = $this->slug; - } - - $pluginInfo = apply_filters($this->getUniqueName('request_info_result'), $pluginInfo, $result); - return $pluginInfo; - } - - /** - * Retrieve the latest update (if any) from the configured API endpoint. - * - * @uses PluginUpdateChecker::requestInfo() - * - * @return Puc_v4p4_Update|null An instance of Plugin_Update, or NULL when no updates are available. - */ - public function requestUpdate() { - //For the sake of simplicity, this function just calls requestInfo() - //and transforms the result accordingly. - $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1')); - if ( $pluginInfo === null ){ - return null; - } - $update = Puc_v4p4_Plugin_Update::fromPluginInfo($pluginInfo); - - $update = $this->filterUpdateResult($update); - - return $update; - } - - /** - * Get the currently installed version of the plugin. - * - * @return string Version number. - */ - public function getInstalledVersion(){ - if ( isset($this->cachedInstalledVersion) ) { - return $this->cachedInstalledVersion; - } - - $pluginHeader = $this->getPluginHeader(); - if ( isset($pluginHeader['Version']) ) { - $this->cachedInstalledVersion = $pluginHeader['Version']; - return $pluginHeader['Version']; - } else { - //This can happen if the filename points to something that is not a plugin. - $this->triggerError( - sprintf( - "Can't to read the Version header for '%s'. The filename is incorrect or is not a plugin.", - $this->pluginFile - ), - E_USER_WARNING - ); - return null; - } - } - - /** - * Get plugin's metadata from its file header. - * - * @return array - */ - protected function getPluginHeader() { - if ( !is_file($this->pluginAbsolutePath) ) { - //This can happen if the plugin filename is wrong. - $this->triggerError( - sprintf( - "Can't to read the plugin header for '%s'. The file does not exist.", - $this->pluginFile - ), - E_USER_WARNING - ); - return array(); - } - - if ( !function_exists('get_plugin_data') ){ - /** @noinspection PhpIncludeInspection */ - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); - } - return get_plugin_data($this->pluginAbsolutePath, false, false); - } - - /** - * @return array - */ - protected function getHeaderNames() { - return array( - 'Name' => 'Plugin Name', - 'PluginURI' => 'Plugin URI', - 'Version' => 'Version', - 'Description' => 'Description', - 'Author' => 'Author', - 'AuthorURI' => 'Author URI', - 'TextDomain' => 'Text Domain', - 'DomainPath' => 'Domain Path', - 'Network' => 'Network', - - //The newest WordPress version that this plugin requires or has been tested with. - //We support several different formats for compatibility with other libraries. - 'Tested WP' => 'Tested WP', - 'Requires WP' => 'Requires WP', - 'Tested up to' => 'Tested up to', - 'Requires at least' => 'Requires at least', - ); - } - - - /** - * Intercept plugins_api() calls that request information about our plugin and - * use the configured API endpoint to satisfy them. - * - * @see plugins_api() - * - * @param mixed $result - * @param string $action - * @param array|object $args - * @return mixed - */ - public function injectInfo($result, $action = null, $args = null){ - $relevant = ($action == 'plugin_information') && isset($args->slug) && ( - ($args->slug == $this->slug) || ($args->slug == dirname($this->pluginFile)) - ); - if ( !$relevant ) { - return $result; - } - - $pluginInfo = $this->requestInfo(); - $pluginInfo = apply_filters($this->getUniqueName('pre_inject_info'), $pluginInfo); - if ( $pluginInfo ) { - return $pluginInfo->toWpFormat(); - } - - return $result; - } - - protected function shouldShowUpdates() { - //No update notifications for mu-plugins unless explicitly enabled. The MU plugin file - //is usually different from the main plugin file so the update wouldn't show up properly anyway. - return !$this->isUnknownMuPlugin(); - } - - /** - * @param stdClass|null $updates - * @param stdClass $updateToAdd - * @return stdClass - */ - protected function addUpdateToList($updates, $updateToAdd) { - if ( $this->isMuPlugin() ) { - //WP does not support automatic update installation for mu-plugins, but we can - //still display a notice. - $updateToAdd->package = null; - } - return parent::addUpdateToList($updates, $updateToAdd); - } - - /** - * @param stdClass|null $updates - * @return stdClass|null - */ - protected function removeUpdateFromList($updates) { - $updates = parent::removeUpdateFromList($updates); - if ( !empty($this->muPluginFile) && isset($updates, $updates->response) ) { - unset($updates->response[$this->muPluginFile]); - } - return $updates; - } - - /** - * For plugins, the update array is indexed by the plugin filename relative to the "plugins" - * directory. Example: "plugin-name/plugin.php". - * - * @return string - */ - protected function getUpdateListKey() { - if ( $this->isMuPlugin() ) { - return $this->muPluginFile; - } - return $this->pluginFile; - } - - /** - * Alias for isBeingUpgraded(). - * - * @deprecated - * @param WP_Upgrader|null $upgrader The upgrader that's performing the current update. - * @return bool - */ - public function isPluginBeingUpgraded($upgrader = null) { - return $this->isBeingUpgraded($upgrader); - } - - /** - * Is there an update being installed for this plugin, right now? - * - * @param WP_Upgrader|null $upgrader - * @return bool - */ - public function isBeingUpgraded($upgrader = null) { - return $this->upgraderStatus->isPluginBeingUpgraded($this->pluginFile, $upgrader); - } - - /** - * Get the details of the currently available update, if any. - * - * If no updates are available, or if the last known update version is below or equal - * to the currently installed version, this method will return NULL. - * - * Uses cached update data. To retrieve update information straight from - * the metadata URL, call requestUpdate() instead. - * - * @return Puc_v4p4_Plugin_Update|null - */ - public function getUpdate() { - $update = parent::getUpdate(); - if ( isset($update) ) { - /** @var Puc_v4p4_Plugin_Update $update */ - $update->filename = $this->pluginFile; - } - return $update; - } - - /** - * Add a "Check for updates" link to the plugin row in the "Plugins" page. By default, - * the new link will appear after the "Visit plugin site" link if present, otherwise - * after the "View plugin details" link. - * - * You can change the link text by using the "puc_manual_check_link-$slug" filter. - * Returning an empty string from the filter will disable the link. - * - * @param array $pluginMeta Array of meta links. - * @param string $pluginFile - * @return array - */ - public function addCheckForUpdatesLink($pluginMeta, $pluginFile) { - $isRelevant = ($pluginFile == $this->pluginFile) - || (!empty($this->muPluginFile) && $pluginFile == $this->muPluginFile); - - if ( $isRelevant && $this->userCanInstallUpdates() ) { - $linkUrl = wp_nonce_url( - add_query_arg( - array( - 'puc_check_for_updates' => 1, - 'puc_slug' => $this->slug, - ), - self_admin_url('plugins.php') - ), - 'puc_check_for_updates' - ); - - $linkText = apply_filters( - $this->getUniqueName('manual_check_link'), - __('Check for updates', 'plugin-update-checker') - ); - if ( !empty($linkText) ) { - /** @noinspection HtmlUnknownTarget */ - $pluginMeta[] = sprintf('%s', esc_attr($linkUrl), $linkText); - } - } - return $pluginMeta; - } - - /** - * Add a "View Details" link to the plugin row in the "Plugins" page. By default, - * the new link will appear before the "Visit plugin site" link (if present). - * - * You can change the link text by using the "puc_view_details_link-$slug" filter. - * Returning an empty string from the filter will disable the link. - * - * You can change the position of the link using the - * "puc_view_details_link_position-$slug" filter. - * Returning 'before' or 'after' will place the link immediately before/after the - * "Visit plugin site" link - * Returning 'append' places the link after any existing links at the time of the hook. - * Returning 'replace' replaces the "Visit plugin site" link - * Returning anything else disables the link when there is a "Visit plugin site" link. - * - * If there is no "Visit plugin site" link 'append' is always used! - * - * @param array $pluginMeta Array of meta links. - * @param string $pluginFile - * @param array $pluginData Array of plugin header data. - * @return array - */ - public function addViewDetailsLink($pluginMeta, $pluginFile, $pluginData = array()) { - $isRelevant = ($pluginFile == $this->pluginFile) - || (!empty($this->muPluginFile) && $pluginFile == $this->muPluginFile); - - if ( $isRelevant && $this->userCanInstallUpdates() && !isset($pluginData['slug']) ) { - $linkText = apply_filters($this->getUniqueName('view_details_link'), __('View details')); - if ( !empty($linkText) ) { - $viewDetailsLinkPosition = 'append'; - - //Find the "Visit plugin site" link (if present). - $visitPluginSiteLinkIndex = count($pluginMeta) - 1; - if ( $pluginData['PluginURI'] ) { - $escapedPluginUri = esc_url($pluginData['PluginURI']); - foreach ($pluginMeta as $linkIndex => $existingLink) { - if ( strpos($existingLink, $escapedPluginUri) !== false ) { - $visitPluginSiteLinkIndex = $linkIndex; - $viewDetailsLinkPosition = apply_filters( - $this->getUniqueName('view_details_link_position'), - 'before' - ); - break; - } - } - } - - $viewDetailsLink = sprintf('%s', - esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . urlencode($this->slug) . - '&TB_iframe=true&width=600&height=550')), - esc_attr(sprintf(__('More information about %s'), $pluginData['Name'])), - esc_attr($pluginData['Name']), - $linkText - ); - switch ($viewDetailsLinkPosition) { - case 'before': - array_splice($pluginMeta, $visitPluginSiteLinkIndex, 0, $viewDetailsLink); - break; - case 'after': - array_splice($pluginMeta, $visitPluginSiteLinkIndex + 1, 0, $viewDetailsLink); - break; - case 'replace': - $pluginMeta[$visitPluginSiteLinkIndex] = $viewDetailsLink; - break; - case 'append': - default: - $pluginMeta[] = $viewDetailsLink; - break; - } - } - } - return $pluginMeta; - } - - - /** - * Check for updates when the user clicks the "Check for updates" link. - * @see self::addCheckForUpdatesLink() - * - * @return void - */ - public function handleManualCheck() { - $shouldCheck = - isset($_GET['puc_check_for_updates'], $_GET['puc_slug']) - && $_GET['puc_slug'] == $this->slug - && $this->userCanInstallUpdates() - && check_admin_referer('puc_check_for_updates'); - - if ( $shouldCheck ) { - $update = $this->checkForUpdates(); - $status = ($update === null) ? 'no_update' : 'update_available'; - - if ( ($update === null) && !empty($this->lastRequestApiErrors) ) { - //Some errors are not critical. For example, if PUC tries to retrieve the readme.txt - //file from GitHub and gets a 404, that's an API error, but it doesn't prevent updates - //from working. Maybe the plugin simply doesn't have a readme. - //Let's only show important errors. - $foundCriticalErrors = false; - $questionableErrorCodes = array( - 'puc-github-http-error', - 'puc-gitlab-http-error', - 'puc-bitbucket-http-error', - ); - - foreach ($this->lastRequestApiErrors as $item) { - $wpError = $item['error']; - /** @var WP_Error $wpError */ - if ( !in_array($wpError->get_error_code(), $questionableErrorCodes) ) { - $foundCriticalErrors = true; - break; - } - } - - if ( $foundCriticalErrors ) { - $status = 'error'; - set_site_transient($this->manualCheckErrorTransient, $this->lastRequestApiErrors, 60); - } - } - - wp_redirect(add_query_arg( - array( - 'puc_update_check_result' => $status, - 'puc_slug' => $this->slug, - ), - self_admin_url('plugins.php') - )); - } - } - - /** - * Display the results of a manual update check. - * @see self::handleManualCheck() - * - * You can change the result message by using the "puc_manual_check_message-$slug" filter. - */ - public function displayManualCheckResult() { - if ( isset($_GET['puc_update_check_result'], $_GET['puc_slug']) && ($_GET['puc_slug'] == $this->slug) ) { - $status = strval($_GET['puc_update_check_result']); - $title = $this->getPluginTitle(); - $noticeClass = 'updated notice-success'; - $details = ''; - - if ( $status == 'no_update' ) { - $message = sprintf(_x('The %s plugin is up to date.', 'the plugin title', 'plugin-update-checker'), $title); - } else if ( $status == 'update_available' ) { - $message = sprintf(_x('A new version of the %s plugin is available.', 'the plugin title', 'plugin-update-checker'), $title); - } else if ( $status === 'error' ) { - $message = sprintf(_x('Could not determine if updates are available for %s.', 'the plugin title', 'plugin-update-checker'), $title); - $noticeClass = 'error notice-error'; - - $details = $this->formatManualCheckErrors(get_site_transient($this->manualCheckErrorTransient)); - delete_site_transient($this->manualCheckErrorTransient); - } else { - $message = sprintf(__('Unknown update checker status "%s"', 'plugin-update-checker'), htmlentities($status)); - $noticeClass = 'error notice-error'; - } - printf( - '

%s

%s
', - $noticeClass, - apply_filters($this->getUniqueName('manual_check_message'), $message, $status), - $details - ); - } - } - - /** - * Format the list of errors that were thrown during an update check. - * - * @param array $errors - * @return string - */ - protected function formatManualCheckErrors($errors) { - if ( empty($errors) ) { - return ''; - } - $output = ''; - - $showAsList = count($errors) > 1; - if ( $showAsList ) { - $output .= '
    '; - $formatString = '
  1. %1$s %2$s
  2. '; - } else { - $formatString = '

    %1$s %2$s

    '; - } - foreach ($errors as $item) { - $wpError = $item['error']; - /** @var WP_Error $wpError */ - $output .= sprintf( - $formatString, - $wpError->get_error_message(), - $wpError->get_error_code() - ); - } - if ( $showAsList ) { - $output .= '
'; - } - - return $output; - } - - /** - * Get the translated plugin title. - * - * @return string - */ - protected function getPluginTitle() { - $title = ''; - $header = $this->getPluginHeader(); - if ( $header && !empty($header['Name']) && isset($header['TextDomain']) ) { - $title = translate($header['Name'], $header['TextDomain']); - } - return $title; - } - - /** - * Check if the current user has the required permissions to install updates. - * - * @return bool - */ - public function userCanInstallUpdates() { - return current_user_can('update_plugins'); - } - - /** - * Check if the plugin file is inside the mu-plugins directory. - * - * @return bool - */ - protected function isMuPlugin() { - static $cachedResult = null; - - if ( $cachedResult === null ) { - //Convert both paths to the canonical form before comparison. - $muPluginDir = realpath(WPMU_PLUGIN_DIR); - $pluginPath = realpath($this->pluginAbsolutePath); - - $cachedResult = (strpos($pluginPath, $muPluginDir) === 0); - } - - return $cachedResult; - } - - /** - * MU plugins are partially supported, but only when we know which file in mu-plugins - * corresponds to this plugin. - * - * @return bool - */ - protected function isUnknownMuPlugin() { - return empty($this->muPluginFile) && $this->isMuPlugin(); - } - - /** - * Clear the cached plugin version. This method can be set up as a filter (hook) and will - * return the filter argument unmodified. - * - * @param mixed $filterArgument - * @return mixed - */ - public function clearCachedVersion($filterArgument = null) { - $this->cachedInstalledVersion = null; - return $filterArgument; - } - - /** - * Get absolute path to the main plugin file. - * - * @return string - */ - public function getAbsolutePath() { - return $this->pluginAbsolutePath; - } - - /** - * @return string - */ - public function getAbsoluteDirectoryPath() { - return dirname($this->pluginAbsolutePath); - } - - /** - * Register a callback for filtering query arguments. - * - * The callback function should take one argument - an associative array of query arguments. - * It should return a modified array of query arguments. - * - * @uses add_filter() This method is a convenience wrapper for add_filter(). - * - * @param callable $callback - * @return void - */ - public function addQueryArgFilter($callback){ - $this->addFilter('request_info_query_args', $callback); - } - - /** - * Register a callback for filtering arguments passed to wp_remote_get(). - * - * The callback function should take one argument - an associative array of arguments - - * and return a modified array or arguments. See the WP documentation on wp_remote_get() - * for details on what arguments are available and how they work. - * - * @uses add_filter() This method is a convenience wrapper for add_filter(). - * - * @param callable $callback - * @return void - */ - public function addHttpRequestArgFilter($callback) { - $this->addFilter('request_info_options', $callback); - } - - /** - * Register a callback for filtering the plugin info retrieved from the external API. - * - * The callback function should take two arguments. If the plugin info was retrieved - * successfully, the first argument passed will be an instance of PluginInfo. Otherwise, - * it will be NULL. The second argument will be the corresponding return value of - * wp_remote_get (see WP docs for details). - * - * The callback function should return a new or modified instance of PluginInfo or NULL. - * - * @uses add_filter() This method is a convenience wrapper for add_filter(). - * - * @param callable $callback - * @return void - */ - public function addResultFilter($callback) { - $this->addFilter('request_info_result', $callback, 10, 2); - } - - protected function createDebugBarExtension() { - return new Puc_v4p4_DebugBar_PluginExtension($this); - } - } - -endif; diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Autoloader.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Autoloader.php similarity index 94% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Autoloader.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Autoloader.php index e435f6650..1f3ad687a 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Autoloader.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Autoloader.php @@ -1,8 +1,8 @@ updateChecker = $updateChecker; @@ -150,11 +150,11 @@ private function getLibraryUrl($filePath) { $absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/')); //Where is the library located inside the WordPress directory structure? - $absolutePath = Puc_v4p4_Factory::normalizePath($absolutePath); + $absolutePath = Puc_v4p5_Factory::normalizePath($absolutePath); - $pluginDir = Puc_v4p4_Factory::normalizePath(WP_PLUGIN_DIR); - $muPluginDir = Puc_v4p4_Factory::normalizePath(WPMU_PLUGIN_DIR); - $themeDir = Puc_v4p4_Factory::normalizePath(get_theme_root()); + $pluginDir = Puc_v4p5_Factory::normalizePath(WP_PLUGIN_DIR); + $muPluginDir = Puc_v4p5_Factory::normalizePath(WPMU_PLUGIN_DIR); + $themeDir = Puc_v4p5_Factory::normalizePath(get_theme_root()); if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) { //It's part of a plugin. diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/Panel.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/Panel.php similarity index 96% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/Panel.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/Panel.php index 728eb8095..8016bc7a7 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/Panel.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/Panel.php @@ -1,9 +1,9 @@
'; diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/PluginExtension.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/PluginExtension.php similarity index 75% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/PluginExtension.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/PluginExtension.php index f8faf33fd..5196ba1c4 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/DebugBar/PluginExtension.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/DebugBar/PluginExtension.php @@ -1,12 +1,12 @@ 'GitHub', 'bitbucket.org' => 'BitBucket', diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/InstalledPackage.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/InstalledPackage.php new file mode 100644 index 000000000..fd5d71b27 --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/InstalledPackage.php @@ -0,0 +1,103 @@ +updateChecker = $updateChecker; + } + + /** + * Get the currently installed version of the plugin or theme. + * + * @return string|null Version number. + */ + abstract public function getInstalledVersion(); + + /** + * Get the full path of the plugin or theme directory (without a trailing slash). + * + * @return string + */ + abstract public function getAbsoluteDirectoryPath(); + + /** + * Check whether a regular file exists in the package's directory. + * + * @param string $relativeFileName File name relative to the package directory. + * @return bool + */ + public function fileExists($relativeFileName) { + return is_file( + $this->getAbsoluteDirectoryPath() + . DIRECTORY_SEPARATOR + . ltrim($relativeFileName, '/\\') + ); + } + + /* ------------------------------------------------------------------- + * File header parsing + * ------------------------------------------------------------------- + */ + + /** + * Parse plugin or theme metadata from the header comment. + * + * This is basically a simplified version of the get_file_data() function from /wp-includes/functions.php. + * It's intended as a utility for subclasses that detect updates by parsing files in a VCS. + * + * @param string|null $content File contents. + * @return string[] + */ + public function getFileHeader($content) { + $content = (string)$content; + + //WordPress only looks at the first 8 KiB of the file, so we do the same. + $content = substr($content, 0, 8192); + //Normalize line endings. + $content = str_replace("\r", "\n", $content); + + $headers = $this->getHeaderNames(); + $results = array(); + foreach ($headers as $field => $name) { + $success = preg_match('/^[ \t\/*#@]*' . preg_quote($name, '/') . ':(.*)$/mi', $content, $matches); + + if ( ($success === 1) && $matches[1] ) { + $value = $matches[1]; + if ( function_exists('_cleanup_header_comment') ) { + $value = _cleanup_header_comment($value); + } + $results[$field] = $value; + } else { + $results[$field] = ''; + } + } + + return $results; + } + + /** + * @return array Format: ['HeaderKey' => 'Header Name'] + */ + abstract protected function getHeaderNames(); + + /** + * Get the value of a specific plugin or theme header. + * + * @param string $headerName + * @return string Either the value of the header, or an empty string if the header doesn't exist. + */ + abstract public function getHeaderValue($headerName); + + } +endif; \ No newline at end of file diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Metadata.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Metadata.php similarity index 97% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Metadata.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Metadata.php index 40e8ffae8..6a89ca883 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Metadata.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Metadata.php @@ -1,5 +1,5 @@ pluginAbsolutePath = $pluginAbsolutePath; + $this->pluginFile = plugin_basename($this->pluginAbsolutePath); + + parent::__construct($updateChecker); + + //Clear the version number cache when something - anything - is upgraded or WP clears the update cache. + add_filter('upgrader_post_install', array($this, 'clearCachedVersion')); + add_action('delete_site_transient_update_plugins', array($this, 'clearCachedVersion')); + } + + public function getInstalledVersion() { + if ( isset($this->cachedInstalledVersion) ) { + return $this->cachedInstalledVersion; + } + + $pluginHeader = $this->getPluginHeader(); + if ( isset($pluginHeader['Version']) ) { + $this->cachedInstalledVersion = $pluginHeader['Version']; + return $pluginHeader['Version']; + } else { + //This can happen if the filename points to something that is not a plugin. + $this->updateChecker->triggerError( + sprintf( + "Can't to read the Version header for '%s'. The filename is incorrect or is not a plugin.", + $this->updateChecker->pluginFile + ), + E_USER_WARNING + ); + return null; + } + } + + /** + * Clear the cached plugin version. This method can be set up as a filter (hook) and will + * return the filter argument unmodified. + * + * @param mixed $filterArgument + * @return mixed + */ + public function clearCachedVersion($filterArgument = null) { + $this->cachedInstalledVersion = null; + return $filterArgument; + } + + public function getAbsoluteDirectoryPath() { + return dirname($this->pluginAbsolutePath); + } + + /** + * Get the value of a specific plugin or theme header. + * + * @param string $headerName + * @param string $defaultValue + * @return string Either the value of the header, or $defaultValue if the header doesn't exist or is empty. + */ + public function getHeaderValue($headerName, $defaultValue = '') { + $headers = $this->getPluginHeader(); + if ( isset($headers[$headerName]) && ($headers[$headerName] !== '') ) { + return $headers[$headerName]; + } + return $defaultValue; + } + + protected function getHeaderNames() { + return array( + 'Name' => 'Plugin Name', + 'PluginURI' => 'Plugin URI', + 'Version' => 'Version', + 'Description' => 'Description', + 'Author' => 'Author', + 'AuthorURI' => 'Author URI', + 'TextDomain' => 'Text Domain', + 'DomainPath' => 'Domain Path', + 'Network' => 'Network', + + //The newest WordPress version that this plugin requires or has been tested with. + //We support several different formats for compatibility with other libraries. + 'Tested WP' => 'Tested WP', + 'Requires WP' => 'Requires WP', + 'Tested up to' => 'Tested up to', + 'Requires at least' => 'Requires at least', + ); + } + + /** + * Get the translated plugin title. + * + * @return string + */ + public function getPluginTitle() { + $title = ''; + $header = $this->getPluginHeader(); + if ( $header && !empty($header['Name']) && isset($header['TextDomain']) ) { + $title = translate($header['Name'], $header['TextDomain']); + } + return $title; + } + + /** + * Get plugin's metadata from its file header. + * + * @return array + */ + public function getPluginHeader() { + if ( !is_file($this->pluginAbsolutePath) ) { + //This can happen if the plugin filename is wrong. + $this->updateChecker->triggerError( + sprintf( + "Can't to read the plugin header for '%s'. The file does not exist.", + $this->updateChecker->pluginFile + ), + E_USER_WARNING + ); + return array(); + } + + if ( !function_exists('get_plugin_data') ) { + /** @noinspection PhpIncludeInspection */ + require_once(ABSPATH . '/wp-admin/includes/plugin.php'); + } + return get_plugin_data($this->pluginAbsolutePath, false, false); + } + + public function removeHooks() { + remove_filter('upgrader_post_install', array($this, 'clearCachedVersion')); + remove_action('delete_site_transient_update_plugins', array($this, 'clearCachedVersion')); + } + + /** + * Check if the plugin file is inside the mu-plugins directory. + * + * @return bool + */ + public function isMuPlugin() { + static $cachedResult = null; + + if ( $cachedResult === null ) { + if ( !defined('WPMU_PLUGIN_DIR') || !is_string(WPMU_PLUGIN_DIR) ) { + $cachedResult = false; + return $cachedResult; + } + + //Convert both paths to the canonical form before comparison. + $muPluginDir = realpath(WPMU_PLUGIN_DIR); + $pluginPath = realpath($this->pluginAbsolutePath); + //If realpath() fails, just normalize the syntax instead. + if (($muPluginDir === false) || ($pluginPath === false)) { + $muPluginDir = Puc_v4p5_Factory::normalizePath(WPMU_PLUGIN_DIR); + $pluginPath = Puc_v4p5_Factory::normalizePath($this->pluginAbsolutePath); + } + + $cachedResult = (strpos($pluginPath, $muPluginDir) === 0); + } + + return $cachedResult; + } + } + +endif; \ No newline at end of file diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php new file mode 100644 index 000000000..46b6a4dc2 --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Ui.php @@ -0,0 +1,277 @@ +updateChecker = $updateChecker; + $this->manualCheckErrorTransient = $this->updateChecker->getUniqueName('manual_check_errors'); + + add_action('admin_init', array($this, 'onAdminInit')); + } + + public function onAdminInit() { + if ( $this->updateChecker->userCanInstallUpdates() ) { + $this->handleManualCheck(); + + add_filter('plugin_row_meta', array($this, 'addViewDetailsLink'), 10, 3); + add_filter('plugin_row_meta', array($this, 'addCheckForUpdatesLink'), 10, 2); + add_action('all_admin_notices', array($this, 'displayManualCheckResult')); + } + } + + /** + * Add a "View Details" link to the plugin row in the "Plugins" page. By default, + * the new link will appear before the "Visit plugin site" link (if present). + * + * You can change the link text by using the "puc_view_details_link-$slug" filter. + * Returning an empty string from the filter will disable the link. + * + * You can change the position of the link using the + * "puc_view_details_link_position-$slug" filter. + * Returning 'before' or 'after' will place the link immediately before/after + * the "Visit plugin site" link. + * Returning 'append' places the link after any existing links at the time of the hook. + * Returning 'replace' replaces the "Visit plugin site" link. + * Returning anything else disables the link when there is a "Visit plugin site" link. + * + * If there is no "Visit plugin site" link 'append' is always used! + * + * @param array $pluginMeta Array of meta links. + * @param string $pluginFile + * @param array $pluginData Array of plugin header data. + * @return array + */ + public function addViewDetailsLink($pluginMeta, $pluginFile, $pluginData = array()) { + if ( $this->isMyPluginFile($pluginFile) && !isset($pluginData['slug']) ) { + $linkText = apply_filters($this->updateChecker->getUniqueName('view_details_link'), __('View details')); + if ( !empty($linkText) ) { + $viewDetailsLinkPosition = 'append'; + + //Find the "Visit plugin site" link (if present). + $visitPluginSiteLinkIndex = count($pluginMeta) - 1; + if ( $pluginData['PluginURI'] ) { + $escapedPluginUri = esc_url($pluginData['PluginURI']); + foreach ($pluginMeta as $linkIndex => $existingLink) { + if ( strpos($existingLink, $escapedPluginUri) !== false ) { + $visitPluginSiteLinkIndex = $linkIndex; + $viewDetailsLinkPosition = apply_filters( + $this->updateChecker->getUniqueName('view_details_link_position'), + 'before' + ); + break; + } + } + } + + $viewDetailsLink = sprintf('%s', + esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . urlencode($this->updateChecker->slug) . + '&TB_iframe=true&width=600&height=550')), + esc_attr(sprintf(__('More information about %s'), $pluginData['Name'])), + esc_attr($pluginData['Name']), + $linkText + ); + switch ($viewDetailsLinkPosition) { + case 'before': + array_splice($pluginMeta, $visitPluginSiteLinkIndex, 0, $viewDetailsLink); + break; + case 'after': + array_splice($pluginMeta, $visitPluginSiteLinkIndex + 1, 0, $viewDetailsLink); + break; + case 'replace': + $pluginMeta[$visitPluginSiteLinkIndex] = $viewDetailsLink; + break; + case 'append': + default: + $pluginMeta[] = $viewDetailsLink; + break; + } + } + } + return $pluginMeta; + } + + /** + * Add a "Check for updates" link to the plugin row in the "Plugins" page. By default, + * the new link will appear after the "Visit plugin site" link if present, otherwise + * after the "View plugin details" link. + * + * You can change the link text by using the "puc_manual_check_link-$slug" filter. + * Returning an empty string from the filter will disable the link. + * + * @param array $pluginMeta Array of meta links. + * @param string $pluginFile + * @return array + */ + public function addCheckForUpdatesLink($pluginMeta, $pluginFile) { + if ( $this->isMyPluginFile($pluginFile) ) { + $linkUrl = wp_nonce_url( + add_query_arg( + array( + 'puc_check_for_updates' => 1, + 'puc_slug' => $this->updateChecker->slug, + ), + self_admin_url('plugins.php') + ), + 'puc_check_for_updates' + ); + + $linkText = apply_filters( + $this->updateChecker->getUniqueName('manual_check_link'), + __('Check for updates', 'plugin-update-checker') + ); + if ( !empty($linkText) ) { + /** @noinspection HtmlUnknownTarget */ + $pluginMeta[] = sprintf('%s', esc_attr($linkUrl), $linkText); + } + } + return $pluginMeta; + } + + protected function isMyPluginFile($pluginFile) { + return ($pluginFile == $this->updateChecker->pluginFile) + || (!empty($this->updateChecker->muPluginFile) && ($pluginFile == $this->updateChecker->muPluginFile)); + } + + /** + * Check for updates when the user clicks the "Check for updates" link. + * + * @see self::addCheckForUpdatesLink() + * + * @return void + */ + public function handleManualCheck() { + $shouldCheck = + isset($_GET['puc_check_for_updates'], $_GET['puc_slug']) + && $_GET['puc_slug'] == $this->updateChecker->slug + && check_admin_referer('puc_check_for_updates'); + + if ( $shouldCheck ) { + $update = $this->updateChecker->checkForUpdates(); + $status = ($update === null) ? 'no_update' : 'update_available'; + + if ( ($update === null) && !empty($this->lastRequestApiErrors) ) { + //Some errors are not critical. For example, if PUC tries to retrieve the readme.txt + //file from GitHub and gets a 404, that's an API error, but it doesn't prevent updates + //from working. Maybe the plugin simply doesn't have a readme. + //Let's only show important errors. + $foundCriticalErrors = false; + $questionableErrorCodes = array( + 'puc-github-http-error', + 'puc-gitlab-http-error', + 'puc-bitbucket-http-error', + ); + + foreach ($this->lastRequestApiErrors as $item) { + $wpError = $item['error']; + /** @var WP_Error $wpError */ + if ( !in_array($wpError->get_error_code(), $questionableErrorCodes) ) { + $foundCriticalErrors = true; + break; + } + } + + if ( $foundCriticalErrors ) { + $status = 'error'; + set_site_transient($this->manualCheckErrorTransient, $this->lastRequestApiErrors, 60); + } + } + + wp_redirect(add_query_arg( + array( + 'puc_update_check_result' => $status, + 'puc_slug' => $this->updateChecker->slug, + ), + self_admin_url('plugins.php') + )); + exit; + } + } + + /** + * Display the results of a manual update check. + * + * @see self::handleManualCheck() + * + * You can change the result message by using the "puc_manual_check_message-$slug" filter. + */ + public function displayManualCheckResult() { + if ( isset($_GET['puc_update_check_result'], $_GET['puc_slug']) && ($_GET['puc_slug'] == $this->updateChecker->slug) ) { + $status = strval($_GET['puc_update_check_result']); + $title = $this->updateChecker->getInstalledPackage()->getPluginTitle(); + $noticeClass = 'updated notice-success'; + $details = ''; + + if ( $status == 'no_update' ) { + $message = sprintf(_x('The %s plugin is up to date.', 'the plugin title', 'plugin-update-checker'), $title); + } else if ( $status == 'update_available' ) { + $message = sprintf(_x('A new version of the %s plugin is available.', 'the plugin title', 'plugin-update-checker'), $title); + } else if ( $status === 'error' ) { + $message = sprintf(_x('Could not determine if updates are available for %s.', 'the plugin title', 'plugin-update-checker'), $title); + $noticeClass = 'error notice-error'; + + $details = $this->formatManualCheckErrors(get_site_transient($this->manualCheckErrorTransient)); + delete_site_transient($this->manualCheckErrorTransient); + } else { + $message = sprintf(__('Unknown update checker status "%s"', 'plugin-update-checker'), htmlentities($status)); + $noticeClass = 'error notice-error'; + } + printf( + '

%s

%s
', + $noticeClass, + apply_filters($this->updateChecker->getUniqueName('manual_check_message'), $message, $status), + $details + ); + } + } + + /** + * Format the list of errors that were thrown during an update check. + * + * @param array $errors + * @return string + */ + protected function formatManualCheckErrors($errors) { + if ( empty($errors) ) { + return ''; + } + $output = ''; + + $showAsList = count($errors) > 1; + if ( $showAsList ) { + $output .= '
    '; + $formatString = '
  1. %1$s %2$s
  2. '; + } else { + $formatString = '

    %1$s %2$s

    '; + } + foreach ($errors as $item) { + $wpError = $item['error']; + /** @var WP_Error $wpError */ + $output .= sprintf( + $formatString, + $wpError->get_error_message(), + $wpError->get_error_code() + ); + } + if ( $showAsList ) { + $output .= '
'; + } + + return $output; + } + + public function removeHooks() { + remove_action('admin_init', array($this, 'onAdminInit')); + remove_filter('plugin_row_meta', array($this, 'addViewDetailsLink'), 10); + remove_filter('plugin_row_meta', array($this, 'addCheckForUpdatesLink'), 10); + remove_action('all_admin_notices', array($this, 'displayManualCheckResult')); + } + } +endif; \ No newline at end of file diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/Update.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Update.php similarity index 87% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/Update.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Update.php index 7b093554d..499f43a3a 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Plugin/Update.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Plugin/Update.php @@ -1,5 +1,5 @@ pluginAbsolutePath = $pluginFile; + $this->pluginFile = plugin_basename($this->pluginAbsolutePath); + $this->muPluginFile = $muPluginFile; + + //If no slug is specified, use the name of the main plugin file as the slug. + //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'. + if ( empty($slug) ){ + $slug = basename($this->pluginFile, '.php'); + } + + //Plugin slugs must be unique. + $slugCheckFilter = 'puc_is_slug_in_use-' . $slug; + $slugUsedBy = apply_filters($slugCheckFilter, false); + if ( $slugUsedBy ) { + $this->triggerError(sprintf( + 'Plugin slug "%s" is already in use by %s. Slugs must be unique.', + htmlentities($slug), + htmlentities($slugUsedBy) + ), E_USER_ERROR); + } + add_filter($slugCheckFilter, array($this, 'getAbsolutePath')); + + //Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume + //it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir). + if ( (strpbrk($this->pluginFile, '/\\') === false) && $this->isUnknownMuPlugin() ) { + $this->muPluginFile = $this->pluginFile; + } + + //To prevent a crash during plugin uninstallation, remove updater hooks when the user removes the plugin. + //Details: https://github.com/YahnisElsts/plugin-update-checker/issues/138#issuecomment-335590964 + add_action('uninstall_' . $this->pluginFile, array($this, 'removeHooks')); + + parent::__construct($metadataUrl, dirname($this->pluginFile), $slug, $checkPeriod, $optionName); + + $this->extraUi = new Puc_v4p5_Plugin_Ui($this); + } + + /** + * Create an instance of the scheduler. + * + * @param int $checkPeriod + * @return Puc_v4p5_Scheduler + */ + protected function createScheduler($checkPeriod) { + $scheduler = new Puc_v4p5_Scheduler($this, $checkPeriod, array('load-plugins.php')); + register_deactivation_hook($this->pluginFile, array($scheduler, 'removeUpdaterCron')); + return $scheduler; + } + + /** + * Install the hooks required to run periodic update checks and inject update info + * into WP data structures. + * + * @return void + */ + protected function installHooks(){ + //Override requests for plugin information + add_filter('plugins_api', array($this, 'injectInfo'), 20, 3); + + parent::installHooks(); + } + + /** + * Remove update checker hooks. + * + * The intent is to prevent a fatal error that can happen if the plugin has an uninstall + * hook. During uninstallation, WP includes the main plugin file (which creates a PUC instance), + * the uninstall hook runs, WP deletes the plugin files and then updates some transients. + * If PUC hooks are still around at this time, they could throw an error while trying to + * autoload classes from files that no longer exist. + * + * The "site_transient_{$transient}" filter is the main problem here, but let's also remove + * most other PUC hooks to be safe. + * + * @internal + */ + public function removeHooks() { + parent::removeHooks(); + $this->extraUi->removeHooks(); + $this->package->removeHooks(); + + remove_filter('plugins_api', array($this, 'injectInfo'), 20); + } + + /** + * Retrieve plugin info from the configured API endpoint. + * + * @uses wp_remote_get() + * + * @param array $queryArgs Additional query arguments to append to the request. Optional. + * @return Puc_v4p5_Plugin_Info + */ + public function requestInfo($queryArgs = array()) { + list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p5_Plugin_Info', 'request_info', $queryArgs); + + if ( $pluginInfo !== null ) { + /** @var Puc_v4p5_Plugin_Info $pluginInfo */ + $pluginInfo->filename = $this->pluginFile; + $pluginInfo->slug = $this->slug; + } + + $pluginInfo = apply_filters($this->getUniqueName('request_info_result'), $pluginInfo, $result); + return $pluginInfo; + } + + /** + * Retrieve the latest update (if any) from the configured API endpoint. + * + * @uses PluginUpdateChecker::requestInfo() + * + * @return Puc_v4p5_Update|null An instance of Plugin_Update, or NULL when no updates are available. + */ + public function requestUpdate() { + //For the sake of simplicity, this function just calls requestInfo() + //and transforms the result accordingly. + $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1')); + if ( $pluginInfo === null ){ + return null; + } + $update = Puc_v4p5_Plugin_Update::fromPluginInfo($pluginInfo); + + $update = $this->filterUpdateResult($update); + + return $update; + } + + /** + * Intercept plugins_api() calls that request information about our plugin and + * use the configured API endpoint to satisfy them. + * + * @see plugins_api() + * + * @param mixed $result + * @param string $action + * @param array|object $args + * @return mixed + */ + public function injectInfo($result, $action = null, $args = null){ + $relevant = ($action == 'plugin_information') && isset($args->slug) && ( + ($args->slug == $this->slug) || ($args->slug == dirname($this->pluginFile)) + ); + if ( !$relevant ) { + return $result; + } + + $pluginInfo = $this->requestInfo(); + $pluginInfo = apply_filters($this->getUniqueName('pre_inject_info'), $pluginInfo); + if ( $pluginInfo ) { + return $pluginInfo->toWpFormat(); + } + + return $result; + } + + protected function shouldShowUpdates() { + //No update notifications for mu-plugins unless explicitly enabled. The MU plugin file + //is usually different from the main plugin file so the update wouldn't show up properly anyway. + return !$this->isUnknownMuPlugin(); + } + + /** + * @param stdClass|null $updates + * @param stdClass $updateToAdd + * @return stdClass + */ + protected function addUpdateToList($updates, $updateToAdd) { + if ( $this->package->isMuPlugin() ) { + //WP does not support automatic update installation for mu-plugins, but we can + //still display a notice. + $updateToAdd->package = null; + } + return parent::addUpdateToList($updates, $updateToAdd); + } + + /** + * @param stdClass|null $updates + * @return stdClass|null + */ + protected function removeUpdateFromList($updates) { + $updates = parent::removeUpdateFromList($updates); + if ( !empty($this->muPluginFile) && isset($updates, $updates->response) ) { + unset($updates->response[$this->muPluginFile]); + } + return $updates; + } + + /** + * For plugins, the update array is indexed by the plugin filename relative to the "plugins" + * directory. Example: "plugin-name/plugin.php". + * + * @return string + */ + protected function getUpdateListKey() { + if ( $this->package->isMuPlugin() ) { + return $this->muPluginFile; + } + return $this->pluginFile; + } + + /** + * Alias for isBeingUpgraded(). + * + * @deprecated + * @param WP_Upgrader|null $upgrader The upgrader that's performing the current update. + * @return bool + */ + public function isPluginBeingUpgraded($upgrader = null) { + return $this->isBeingUpgraded($upgrader); + } + + /** + * Is there an update being installed for this plugin, right now? + * + * @param WP_Upgrader|null $upgrader + * @return bool + */ + public function isBeingUpgraded($upgrader = null) { + return $this->upgraderStatus->isPluginBeingUpgraded($this->pluginFile, $upgrader); + } + + /** + * Get the details of the currently available update, if any. + * + * If no updates are available, or if the last known update version is below or equal + * to the currently installed version, this method will return NULL. + * + * Uses cached update data. To retrieve update information straight from + * the metadata URL, call requestUpdate() instead. + * + * @return Puc_v4p5_Plugin_Update|null + */ + public function getUpdate() { + $update = parent::getUpdate(); + if ( isset($update) ) { + /** @var Puc_v4p5_Plugin_Update $update */ + $update->filename = $this->pluginFile; + } + return $update; + } + + /** + * Get the translated plugin title. + * + * @deprecated + * @return string + */ + public function getPluginTitle() { + return $this->package->getPluginTitle(); + } + + /** + * Check if the current user has the required permissions to install updates. + * + * @return bool + */ + public function userCanInstallUpdates() { + return current_user_can('update_plugins'); + } + + /** + * Check if the plugin file is inside the mu-plugins directory. + * + * @deprecated + * @return bool + */ + protected function isMuPlugin() { + return $this->package->isMuPlugin(); + } + + /** + * MU plugins are partially supported, but only when we know which file in mu-plugins + * corresponds to this plugin. + * + * @return bool + */ + protected function isUnknownMuPlugin() { + return empty($this->muPluginFile) && $this->package->isMuPlugin(); + } + + /** + * Get absolute path to the main plugin file. + * + * @return string + */ + public function getAbsolutePath() { + return $this->pluginAbsolutePath; + } + + /** + * Register a callback for filtering query arguments. + * + * The callback function should take one argument - an associative array of query arguments. + * It should return a modified array of query arguments. + * + * @uses add_filter() This method is a convenience wrapper for add_filter(). + * + * @param callable $callback + * @return void + */ + public function addQueryArgFilter($callback){ + $this->addFilter('request_info_query_args', $callback); + } + + /** + * Register a callback for filtering arguments passed to wp_remote_get(). + * + * The callback function should take one argument - an associative array of arguments - + * and return a modified array or arguments. See the WP documentation on wp_remote_get() + * for details on what arguments are available and how they work. + * + * @uses add_filter() This method is a convenience wrapper for add_filter(). + * + * @param callable $callback + * @return void + */ + public function addHttpRequestArgFilter($callback) { + $this->addFilter('request_info_options', $callback); + } + + /** + * Register a callback for filtering the plugin info retrieved from the external API. + * + * The callback function should take two arguments. If the plugin info was retrieved + * successfully, the first argument passed will be an instance of PluginInfo. Otherwise, + * it will be NULL. The second argument will be the corresponding return value of + * wp_remote_get (see WP docs for details). + * + * The callback function should return a new or modified instance of PluginInfo or NULL. + * + * @uses add_filter() This method is a convenience wrapper for add_filter(). + * + * @param callable $callback + * @return void + */ + public function addResultFilter($callback) { + $this->addFilter('request_info_result', $callback, 10, 2); + } + + protected function createDebugBarExtension() { + return new Puc_v4p5_DebugBar_PluginExtension($this); + } + + /** + * Create a package instance that represents this plugin or theme. + * + * @return Puc_v4p5_InstalledPackage + */ + protected function createInstalledPackage() { + return new Puc_v4p5_Plugin_Package($this->pluginAbsolutePath, $this); + } + + /** + * @return Puc_v4p5_Plugin_Package + */ + public function getInstalledPackage() { + return $this->package; + } + } + +endif; diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Scheduler.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Scheduler.php similarity index 96% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Scheduler.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Scheduler.php index 4fa1e6db9..c2bd55c14 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Scheduler.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Scheduler.php @@ -1,11 +1,11 @@ lazyLoad(); @@ -73,10 +73,10 @@ public function getUpdate() { } /** - * @param Puc_v4p4_Update|null $update + * @param Puc_v4p5_Update|null $update * @return $this */ - public function setUpdate(Puc_v4p4_Update $update = null) { + public function setUpdate(Puc_v4p5_Update $update = null) { $this->lazyLoad(); $this->update = $update; return $this; @@ -138,7 +138,7 @@ public function save() { $updateClass = get_class($this->update); $state->updateClass = $updateClass; $prefix = $this->getLibPrefix(); - if ( Puc_v4p4_Utils::startsWith($updateClass, $prefix) ) { + if ( Puc_v4p5_Utils::startsWith($updateClass, $prefix) ) { $state->updateBaseClass = substr($updateClass, strlen($prefix)); } } @@ -169,8 +169,8 @@ protected function load() { return; } - $this->lastCheck = intval(Puc_v4p4_Utils::get($state, 'lastCheck', 0)); - $this->checkedVersion = Puc_v4p4_Utils::get($state, 'checkedVersion', ''); + $this->lastCheck = intval(Puc_v4p5_Utils::get($state, 'lastCheck', 0)); + $this->checkedVersion = Puc_v4p5_Utils::get($state, 'checkedVersion', ''); $this->update = null; if ( isset($state->update) ) { diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Package.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Package.php new file mode 100644 index 000000000..49daee86e --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Package.php @@ -0,0 +1,65 @@ +stylesheet = $stylesheet; + $this->theme = wp_get_theme($this->stylesheet); + + parent::__construct($updateChecker); + } + + public function getInstalledVersion() { + return $this->theme->get('Version'); + } + + public function getAbsoluteDirectoryPath() { + if ( method_exists($this->theme, 'get_stylesheet_directory') ) { + return $this->theme->get_stylesheet_directory(); //Available since WP 3.4. + } + return get_theme_root($this->stylesheet) . '/' . $this->stylesheet; + } + + /** + * Get the value of a specific plugin or theme header. + * + * @param string $headerName + * @param string $defaultValue + * @return string Either the value of the header, or $defaultValue if the header doesn't exist or is empty. + */ + public function getHeaderValue($headerName, $defaultValue = '') { + $value = $this->theme->get($headerName); + if ( ($headerName === false) || ($headerName === '') ) { + return $defaultValue; + } + return $value; + } + + protected function getHeaderNames() { + return array( + 'Name' => 'Theme Name', + 'ThemeURI' => 'Theme URI', + 'Description' => 'Description', + 'Author' => 'Author', + 'AuthorURI' => 'Author URI', + 'Version' => 'Version', + 'Template' => 'Template', + 'Status' => 'Status', + 'Tags' => 'Tags', + 'TextDomain' => 'Text Domain', + 'DomainPath' => 'Domain Path', + ); + } + } + +endif; \ No newline at end of file diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Theme/Update.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Update.php similarity index 89% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Theme/Update.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Update.php index 5a43e11b7..9b28a9ad7 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Theme/Update.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Theme/Update.php @@ -1,8 +1,8 @@ stylesheet = $stylesheet; - $this->theme = wp_get_theme($this->stylesheet); parent::__construct( $metadataUrl, @@ -45,13 +39,13 @@ protected function getUpdateListKey() { /** * Retrieve the latest update (if any) from the configured API endpoint. * - * @return Puc_v4p4_Update|null An instance of Update, or NULL when no updates are available. + * @return Puc_v4p5_Update|null An instance of Update, or NULL when no updates are available. */ public function requestUpdate() { - list($themeUpdate, $result) = $this->requestMetadata('Puc_v4p4_Theme_Update', 'request_update'); + list($themeUpdate, $result) = $this->requestMetadata('Puc_v4p5_Theme_Update', 'request_update'); if ( $themeUpdate !== null ) { - /** @var Puc_v4p4_Theme_Update $themeUpdate */ + /** @var Puc_v4p5_Theme_Update $themeUpdate */ $themeUpdate->slug = $this->slug; } @@ -63,33 +57,14 @@ public function userCanInstallUpdates() { return current_user_can('update_themes'); } - /** - * Get the currently installed version of the plugin or theme. - * - * @return string Version number. - */ - public function getInstalledVersion() { - return $this->theme->get('Version'); - } - - /** - * @return string - */ - public function getAbsoluteDirectoryPath() { - if ( method_exists($this->theme, 'get_stylesheet_directory') ) { - return $this->theme->get_stylesheet_directory(); //Available since WP 3.4. - } - return get_theme_root($this->stylesheet) . '/' . $this->stylesheet; - } - /** * Create an instance of the scheduler. * * @param int $checkPeriod - * @return Puc_v4p4_Scheduler + * @return Puc_v4p5_Scheduler */ protected function createScheduler($checkPeriod) { - return new Puc_v4p4_Scheduler($this, $checkPeriod, array('load-themes.php')); + return new Puc_v4p5_Scheduler($this, $checkPeriod, array('load-themes.php')); } /** @@ -103,7 +78,7 @@ public function isBeingUpgraded($upgrader = null) { } protected function createDebugBarExtension() { - return new Puc_v4p4_DebugBar_Extension($this, 'Puc_v4p4_DebugBar_ThemePanel'); + return new Puc_v4p5_DebugBar_Extension($this, 'Puc_v4p5_DebugBar_ThemePanel'); } /** @@ -155,22 +130,12 @@ public function addResultFilter($callback) { } /** - * @return array + * Create a package instance that represents this plugin or theme. + * + * @return Puc_v4p5_InstalledPackage */ - protected function getHeaderNames() { - return array( - 'Name' => 'Theme Name', - 'ThemeURI' => 'Theme URI', - 'Description' => 'Description', - 'Author' => 'Author', - 'AuthorURI' => 'Author URI', - 'Version' => 'Version', - 'Template' => 'Template', - 'Status' => 'Status', - 'Tags' => 'Tags', - 'TextDomain' => 'Text Domain', - 'DomainPath' => 'Domain Path', - ); + protected function createInstalledPackage() { + return new Puc_v4p5_Theme_Package($this->stylesheet, $this); } } diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Update.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Update.php similarity index 84% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Update.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Update.php index af66eb28f..14cde22d3 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Update.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Update.php @@ -1,5 +1,5 @@ package = $this->createInstalledPackage(); $this->scheduler = $this->createScheduler($checkPeriod); - $this->upgraderStatus = new Puc_v4p4_UpgraderStatus(); - $this->updateState = new Puc_v4p4_StateStore($this->optionName); + $this->upgraderStatus = new Puc_v4p5_UpgraderStatus(); + $this->updateState = new Puc_v4p5_StateStore($this->optionName); if ( did_action('init') ) { $this->loadTextDomain(); @@ -192,6 +198,20 @@ public function allowMetadataHost($allow, $host) { return $allow; } + /** + * Create a package instance that represents this plugin or theme. + * + * @return Puc_v4p5_InstalledPackage + */ + abstract protected function createInstalledPackage(); + + /** + * @return Puc_v4p5_InstalledPackage + */ + public function getInstalledPackage() { + return $this->package; + } + /** * Create an instance of the scheduler. * @@ -199,14 +219,14 @@ public function allowMetadataHost($allow, $host) { * and substitute their own scheduler. * * @param int $checkPeriod - * @return Puc_v4p4_Scheduler + * @return Puc_v4p5_Scheduler */ abstract protected function createScheduler($checkPeriod); /** * Check for updates. The results are stored in the DB option specified in $optionName. * - * @return Puc_v4p4_Update|null + * @return Puc_v4p5_Update|null */ public function checkForUpdates() { $installedVersion = $this->getInstalledVersion(); @@ -240,7 +260,7 @@ public function checkForUpdates() { /** * Load the update checker state from the DB. * - * @return Puc_v4p4_StateStore + * @return Puc_v4p5_StateStore */ public function getUpdateState() { return $this->updateState->lazyLoad(); @@ -265,7 +285,7 @@ public function resetUpdateState() { * Uses cached update data. To retrieve update information straight from * the metadata URL, call requestUpdate() instead. * - * @return Puc_v4p4_Update|null + * @return Puc_v4p5_Update|null */ public function getUpdate() { $update = $this->updateState->getUpdate(); @@ -286,21 +306,23 @@ public function getUpdate() { * * Subclasses should run the update through filterUpdateResult before returning it. * - * @return Puc_v4p4_Update An instance of Update, or NULL when no updates are available. + * @return Puc_v4p5_Update An instance of Update, or NULL when no updates are available. */ abstract public function requestUpdate(); /** * Filter the result of a requestUpdate() call. * - * @param Puc_v4p4_Update|null $update + * @param Puc_v4p5_Update|null $update * @param array|WP_Error|null $httpResult The value returned by wp_remote_get(), if any. - * @return Puc_v4p4_Update + * @return Puc_v4p5_Update */ protected function filterUpdateResult($update, $httpResult = null) { //Let plugins/themes modify the update. $update = apply_filters($this->getUniqueName('request_update_result'), $update, $httpResult); + $this->fixSupportedWordpressVersion($update); + if ( isset($update, $update->translations) ) { //Keep only those translation updates that apply to this site. $update->translations = $this->filterApplicableTranslations($update->translations); @@ -309,19 +331,63 @@ protected function filterUpdateResult($update, $httpResult = null) { return $update; } + /** + * The "Tested up to" field in the plugin metadata is supposed to be in the form of "major.minor", + * while WordPress core's list_plugin_updates() expects the $update->tested field to be an exact + * version, e.g. "major.minor.patch", to say it's compatible. In other case it shows + * "Compatibility: Unknown". + * The function mimics how wordpress.org API crafts the "tested" field out of "Tested up to". + * + * @param Puc_v4p5_Update|null $update + */ + protected function fixSupportedWordpressVersion(Puc_v4p5_Update $update = null) { + if ( !isset($update->tested) || !preg_match('/^\d++\.\d++$/', $update->tested) ) { + return; + } + + $actualWpVersions = array(); + + $wpVersion = $GLOBALS['wp_version']; + + if ( function_exists('get_preferred_from_update_core') ) { + $coreUpdate = get_preferred_from_update_core(); + if ( isset($coreUpdate->current) && version_compare($coreUpdate->current, $wpVersion, '>') ) { + $actualWpVersions[] = $coreUpdate->current; + } + } + + $actualWpVersions[] = $wpVersion; + + $actualWpPatchNumber = "999"; + foreach ($actualWpVersions as $version) { + if ( preg_match('/^(?P\d++\.\d++)\.(?P\d++)/', $version, $versionParts) ) { + if ( $versionParts['majorMinor'] === $update->tested ) { + $actualWpPatchNumber = $versionParts['patch']; + break; + } + } + } + + $update->tested .= '.' . $actualWpPatchNumber; + } + /** * Get the currently installed version of the plugin or theme. * * @return string|null Version number. */ - abstract public function getInstalledVersion(); + public function getInstalledVersion() { + return $this->package->getInstalledVersion(); + } /** * Get the full path of the plugin or theme directory. * * @return string */ - abstract public function getAbsoluteDirectoryPath(); + public function getAbsoluteDirectoryPath() { + return $this->package->getAbsoluteDirectoryPath(); + } /** * Trigger a PHP error, but only when $debugMode is enabled. @@ -329,12 +395,22 @@ abstract public function getAbsoluteDirectoryPath(); * @param string $message * @param int $errorType */ - protected function triggerError($message, $errorType) { - if ($this->debugMode) { + public function triggerError($message, $errorType) { + if ( $this->isDebugModeEnabled() ) { trigger_error($message, $errorType); } } + /** + * @return bool + */ + protected function isDebugModeEnabled() { + if ( $this->debugMode === null ) { + $this->debugMode = (bool)(constant('WP_DEBUG')); + } + return $this->debugMode; + } + /** * Get the full name of an update checker filter, action or DB entry. * @@ -346,7 +422,7 @@ protected function triggerError($message, $errorType) { */ public function getUniqueName($baseTag) { $name = 'puc_' . $baseTag; - if ($this->filterSuffix !== '') { + if ( $this->filterSuffix !== '' ) { $name .= '_' . $this->filterSuffix; } return $name . '-' . $this->slug; @@ -494,7 +570,7 @@ protected function shouldShowUpdates() { * @param string $metaClass Parse the JSON as an instance of this class. It must have a static fromJson method. * @param string $filterRoot * @param array $queryArgs Additional query arguments. - * @return array [Puc_v4p4_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get(). + * @return array [Puc_v4p5_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get(). */ protected function requestMetadata($metaClass, $filterRoot, $queryArgs = array()) { //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()). @@ -593,7 +669,7 @@ protected function filterApplicableTranslations($translations) { $installedTranslations = $this->getInstalledTranslations(); $applicableTranslations = array(); - foreach($translations as $translation) { + foreach ($translations as $translation) { //Does it match one of the available core languages? $isApplicable = array_key_exists($translation->language, $languages); //Is it more recent than an already-installed translation? @@ -818,52 +894,6 @@ protected function isBadDirectoryStructure($remoteSource) { return false; } - /* ------------------------------------------------------------------- - * File header parsing - * ------------------------------------------------------------------- - */ - - /** - * Parse plugin or theme metadata from the header comment. - * - * This is basically a simplified version of the get_file_data() function from /wp-includes/functions.php. - * It's intended as a utility for subclasses that detect updates by parsing files in a VCS. - * - * @param string|null $content File contents. - * @return string[] - */ - public function getFileHeader($content) { - $content = (string) $content; - - //WordPress only looks at the first 8 KiB of the file, so we do the same. - $content = substr($content, 0, 8192); - //Normalize line endings. - $content = str_replace("\r", "\n", $content); - - $headers = $this->getHeaderNames(); - $results = array(); - foreach ($headers as $field => $name) { - $success = preg_match('/^[ \t\/*#@]*' . preg_quote($name, '/') . ':(.*)$/mi', $content, $matches); - - if ( ($success === 1) && $matches[1] ) { - $value = $matches[1]; - if ( function_exists('_cleanup_header_comment') ) { - $value = _cleanup_header_comment($value); - } - $results[$field] = $value; - } else { - $results[$field] = ''; - } - } - - return $results; - } - - /** - * @return array Format: ['HeaderKey' => 'Header Name'] - */ - abstract protected function getHeaderNames(); - /* ------------------------------------------------------------------- * DebugBar integration * ------------------------------------------------------------------- @@ -873,19 +903,19 @@ abstract protected function getHeaderNames(); * Initialize the update checker Debug Bar plugin/add-on thingy. */ public function maybeInitDebugBar() { - if ( class_exists('Debug_Bar', false) && file_exists(dirname(__FILE__ . '/DebugBar')) ) { + if ( class_exists('Debug_Bar', false) && file_exists(dirname(__FILE__) . '/DebugBar') ) { $this->createDebugBarExtension(); } } protected function createDebugBarExtension() { - return new Puc_v4p4_DebugBar_Extension($this); + return new Puc_v4p5_DebugBar_Extension($this); } /** * Display additional configuration details in the Debug Bar panel. * - * @param Puc_v4p4_DebugBar_Panel $panel + * @param Puc_v4p5_DebugBar_Panel $panel */ public function onDisplayConfiguration($panel) { //Do nothing. Subclasses can use this to add additional info to the panel. diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/UpgraderStatus.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/UpgraderStatus.php similarity index 98% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/UpgraderStatus.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/UpgraderStatus.php index 14194d8bb..ba41189f1 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/UpgraderStatus.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/UpgraderStatus.php @@ -1,5 +1,5 @@ $branch->name, 'updated' => $branch->target->date, 'downloadUrl' => $this->getDownloadUrl($branch->name), @@ -70,7 +70,7 @@ public function getBranch($branchName) { * Get a specific tag. * * @param string $tagName - * @return Puc_v4p4_Vcs_Reference|null + * @return Puc_v4p5_Vcs_Reference|null */ public function getTag($tagName) { $tag = $this->api('/refs/tags/' . $tagName); @@ -78,7 +78,7 @@ public function getTag($tagName) { return null; } - return new Puc_v4p4_Vcs_Reference(array( + return new Puc_v4p5_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'updated' => $tag->target->date, @@ -89,7 +89,7 @@ public function getTag($tagName) { /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p4_Vcs_Reference|null + * @return Puc_v4p5_Vcs_Reference|null */ public function getLatestTag() { $tags = $this->api('/refs/tags?sort=-target.date'); @@ -103,7 +103,7 @@ public function getLatestTag() { //Return the first result. if ( !empty($versionTags) ) { $tag = $versionTags[0]; - return new Puc_v4p4_Vcs_Reference(array( + return new Puc_v4p5_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'updated' => $tag->target->date, @@ -117,7 +117,7 @@ public function getLatestTag() { * Get the tag/ref specified by the "Stable tag" header in the readme.txt of a given branch. * * @param string $branch - * @return null|Puc_v4p4_Vcs_Reference + * @return null|Puc_v4p5_Vcs_Reference */ protected function getStableTag($branch) { $remoteReadme = $this->getRemoteReadme($branch); @@ -233,7 +233,7 @@ public function setAuthentication($credentials) { parent::setAuthentication($credentials); if ( !empty($credentials) && !empty($credentials['consumer_key']) ) { - $this->oauth = new Puc_v4p4_OAuthSignature( + $this->oauth = new Puc_v4p5_OAuthSignature( $credentials['consumer_key'], $credentials['consumer_secret'] ); diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitHubApi.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitHubApi.php similarity index 96% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitHubApi.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitHubApi.php index e3f1e57dd..5ddaa7c80 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitHubApi.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitHubApi.php @@ -1,8 +1,8 @@ api('/repos/:user/:repo/releases/latest'); @@ -60,7 +60,7 @@ public function getLatestRelease() { return null; } - $reference = new Puc_v4p4_Vcs_Reference(array( + $reference = new Puc_v4p5_Vcs_Reference(array( 'name' => $release->tag_name, 'version' => ltrim($release->tag_name, 'v'), //Remove the "v" prefix from "v1.2.3". 'downloadUrl' => $this->signDownloadUrl($release->zipball_url), @@ -103,7 +103,7 @@ public function getLatestRelease() { /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p4_Vcs_Reference|null + * @return Puc_v4p5_Vcs_Reference|null */ public function getLatestTag() { $tags = $this->api('/repos/:user/:repo/tags'); @@ -118,7 +118,7 @@ public function getLatestTag() { } $tag = $versionTags[0]; - return new Puc_v4p4_Vcs_Reference(array( + return new Puc_v4p5_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'downloadUrl' => $this->signDownloadUrl($tag->zipball_url), @@ -130,7 +130,7 @@ public function getLatestTag() { * Get a branch by name. * * @param string $branchName - * @return null|Puc_v4p4_Vcs_Reference + * @return null|Puc_v4p5_Vcs_Reference */ public function getBranch($branchName) { $branch = $this->api('/repos/:user/:repo/branches/' . $branchName); @@ -138,7 +138,7 @@ public function getBranch($branchName) { return null; } - $reference = new Puc_v4p4_Vcs_Reference(array( + $reference = new Puc_v4p5_Vcs_Reference(array( 'name' => $branch->name, 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), 'apiResponse' => $branch, @@ -290,7 +290,7 @@ public function buildArchiveDownloadUrl($ref = 'master') { * Get a specific tag. * * @param string $tagName - * @return Puc_v4p4_Vcs_Reference|null + * @return void */ public function getTag($tagName) { //The current GitHub update checker doesn't use getTag, so I didn't bother to implement it. @@ -306,7 +306,7 @@ public function setAuthentication($credentials) { * Figure out which reference (i.e tag or branch) contains the latest version. * * @param string $configBranch Start looking in this branch. - * @return null|Puc_v4p4_Vcs_Reference + * @return null|Puc_v4p5_Vcs_Reference */ public function chooseReference($configBranch) { $updateSource = null; diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitLabApi.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitLabApi.php similarity index 79% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitLabApi.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitLabApi.php index 574c309cb..5179c534a 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/GitLabApi.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/GitLabApi.php @@ -1,8 +1,8 @@ repositoryHost = @parse_url($repositoryUrl, PHP_URL_HOST); + $port = @parse_url($repositoryUrl, PHP_URL_PORT); + if ( !empty($port) ){ + $port = ':' . $port; + } + $this->repositoryHost = @parse_url($repositoryUrl, PHP_URL_HOST) . $port; //Find the repository information $path = @parse_url($repositoryUrl, PHP_URL_PATH); if ( preg_match('@^/?(?P[^/]+?)/(?P[^/#?&]+?)/?$@', $path, $matches) ) { $this->userName = $matches['username']; $this->repositoryName = $matches['repository']; + } elseif ( ($this->repositoryHost === 'gitlab.com') ) { + //This is probably a repository in a subgroup, e.g. "/organization/category/repo". + $parts = explode('/', trim($path, '/')); + if ( count($parts) < 3 ) { + throw new InvalidArgumentException('Invalid GitLab.com repository URL: "' . $repositoryUrl . '"'); + } + $lastPart = array_pop($parts); + $this->userName = implode('/', $parts); + $this->repositoryName = $lastPart; } else { //This is not a traditional url, it could be gitlab is in a deeper subdirectory. //Get the path segments. @@ -57,7 +70,7 @@ public function __construct($repositoryUrl, $accessToken = null) { /** * Get the latest release from GitLab. * - * @return Puc_v4p4_Vcs_Reference|null + * @return Puc_v4p5_Vcs_Reference|null */ public function getLatestRelease() { return $this->getLatestTag(); @@ -66,10 +79,10 @@ public function getLatestRelease() { /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p4_Vcs_Reference|null + * @return Puc_v4p5_Vcs_Reference|null */ public function getLatestTag() { - $tags = $this->api('/:user/:repo/repository/tags'); + $tags = $this->api('/:id/repository/tags'); if ( is_wp_error($tags) || empty($tags) || !is_array($tags) ) { return null; } @@ -80,7 +93,7 @@ public function getLatestTag() { } $tag = $versionTags[0]; - return new Puc_v4p4_Vcs_Reference(array( + return new Puc_v4p5_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'downloadUrl' => $this->buildArchiveDownloadUrl($tag->name), @@ -92,15 +105,15 @@ public function getLatestTag() { * Get a branch by name. * * @param string $branchName - * @return null|Puc_v4p4_Vcs_Reference + * @return null|Puc_v4p5_Vcs_Reference */ public function getBranch($branchName) { - $branch = $this->api('/:user/:repo/repository/branches/' . $branchName); + $branch = $this->api('/:id/repository/branches/' . $branchName); if ( is_wp_error($branch) || empty($branch) ) { return null; } - $reference = new Puc_v4p4_Vcs_Reference(array( + $reference = new Puc_v4p5_Vcs_Reference(array( 'name' => $branch->name, 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), 'apiResponse' => $branch, @@ -120,7 +133,7 @@ public function getBranch($branchName) { * @return string|null */ public function getLatestCommitTime($ref) { - $commits = $this->api('/:user/:repo/repository/commits/', array('ref_name' => $ref)); + $commits = $this->api('/:id/repository/commits/', array('ref_name' => $ref)); if ( is_wp_error($commits) || !is_array($commits) || !isset($commits[0]) ) { return null; } @@ -175,14 +188,15 @@ protected function api($url, $queryParams = array()) { protected function buildApiUrl($url, $queryParams) { $variables = array( 'user' => $this->userName, - 'repo' => $this->repositoryName + 'repo' => $this->repositoryName, + 'id' => $this->userName . '/' . $this->repositoryName, ); foreach ($variables as $name => $value) { - $url = str_replace("/:{$name}", urlencode('/' . $value), $url); + $url = str_replace("/:{$name}", '/' . urlencode($value), $url); } - $url = substr($url, 3); + $url = substr($url, 1); $url = sprintf('https://%1$s/api/v4/projects/%2$s', $this->repositoryHost, $url); if ( !empty($this->accessToken) ) { @@ -204,7 +218,7 @@ protected function buildApiUrl($url, $queryParams) { * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. */ public function getRemoteFile($path, $ref = 'master') { - $response = $this->api('/:user/:repo/repository/files/' . $path, array('ref' => $ref)); + $response = $this->api('/:id/repository/files/' . $path, array('ref' => $ref)); if ( is_wp_error($response) || !isset($response->content) || $response->encoding !== 'base64' ) { return null; } @@ -220,12 +234,11 @@ public function getRemoteFile($path, $ref = 'master') { */ public function buildArchiveDownloadUrl($ref = 'master') { $url = sprintf( - 'https://%1$s/%2$s/%3$s/repository/%4$s/archive.zip', + 'https://%1$s/api/v4/projects/%2$s/repository/archive.zip', $this->repositoryHost, - urlencode($this->userName), - urlencode($this->repositoryName), - urlencode($ref) + urlencode($this->userName . '/' . $this->repositoryName) ); + $url = add_query_arg('sha', urlencode($ref), $url); if ( !empty($this->accessToken) ) { $url = add_query_arg('private_token', $this->accessToken, $url); @@ -238,7 +251,7 @@ public function buildArchiveDownloadUrl($ref = 'master') { * Get a specific tag. * * @param string $tagName - * @return Puc_v4p4_Vcs_Reference|null + * @return void */ public function getTag($tagName) { throw new LogicException('The ' . __METHOD__ . ' method is not implemented and should not be used.'); @@ -248,7 +261,7 @@ public function getTag($tagName) { * Figure out which reference (i.e tag or branch) contains the latest version. * * @param string $configBranch Start looking in this branch. - * @return null|Puc_v4p4_Vcs_Reference + * @return null|Puc_v4p5_Vcs_Reference */ public function chooseReference($configBranch) { $updateSource = null; @@ -271,4 +284,4 @@ public function setAuthentication($credentials) { } } -endif; \ No newline at end of file +endif; diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/PluginUpdateChecker.php similarity index 87% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/PluginUpdateChecker.php index 3b96e814f..4f0535d58 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/PluginUpdateChecker.php @@ -1,21 +1,21 @@ api; - $api->setLocalDirectory($this->getAbsoluteDirectoryPath()); + $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); - $info = new Puc_v4p4_Plugin_Info(); + $info = new Puc_v4p5_Plugin_Info(); $info->filename = $this->pluginFile; $info->slug = $this->slug; - $this->setInfoFromHeader($this->getPluginHeader(), $info); + $this->setInfoFromHeader($this->package->getPluginHeader(), $info); //Pick a branch or tag. $updateSource = $api->chooseReference($this->branch); @@ -81,7 +81,7 @@ public function requestInfo($unusedParameter = null) { $mainPluginFile = basename($this->pluginFile); $remotePlugin = $api->getRemoteFile($mainPluginFile, $ref); if ( !empty($remotePlugin) ) { - $remoteHeader = $this->getFileHeader($remotePlugin); + $remoteHeader = $this->package->getFileHeader($remotePlugin); $this->setInfoFromHeader($remoteHeader, $info); } @@ -93,7 +93,7 @@ public function requestInfo($unusedParameter = null) { //The changelog might be in a separate file. if ( empty($info->sections['changelog']) ) { - $info->sections['changelog'] = $api->getRemoteChangelog($ref, dirname($this->getAbsolutePath())); + $info->sections['changelog'] = $api->getRemoteChangelog($ref, $this->package->getAbsoluteDirectoryPath()); if ( empty($info->sections['changelog']) ) { $info->sections['changelog'] = __('There is no changelog available.', 'plugin-update-checker'); } @@ -117,18 +117,14 @@ public function requestInfo($unusedParameter = null) { * @return bool */ protected function readmeTxtExistsLocally() { - $pluginDirectory = $this->getAbsoluteDirectoryPath(); - if ( empty($pluginDirectory) || !is_dir($pluginDirectory) || ($pluginDirectory === '.') ) { - return false; - } - return is_file($pluginDirectory . '/' . $this->api->getLocalReadmeName()); + return $this->package->fileExists($this->api->getLocalReadmeName()); } /** * Copy plugin metadata from a file header to a Plugin Info object. * * @param array $fileHeader - * @param Puc_v4p4_Plugin_Info $pluginInfo + * @param Puc_v4p5_Plugin_Info $pluginInfo */ protected function setInfoFromHeader($fileHeader, $pluginInfo) { $headerToPropertyMap = array( @@ -159,7 +155,7 @@ protected function setInfoFromHeader($fileHeader, $pluginInfo) { * Copy plugin metadata from the remote readme.txt file. * * @param string $ref GitHub tag or branch where to look for the readme. - * @param Puc_v4p4_Plugin_Info $pluginInfo + * @param Puc_v4p5_Plugin_Info $pluginInfo */ protected function setInfoFromRemoteReadme($ref, $pluginInfo) { $readme = $this->api->getRemoteReadme($ref); diff --git a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/Reference.php b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/Reference.php similarity index 92% rename from vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/Reference.php rename to vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/Reference.php index 8a708770e..d59ed5049 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p4/Vcs/Reference.php +++ b/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p5/Vcs/Reference.php @@ -1,5 +1,5 @@ api; - $api->setLocalDirectory($this->getAbsoluteDirectoryPath()); + $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); - $update = new Puc_v4p4_Theme_Update(); + $update = new Puc_v4p5_Theme_Update(); $update->slug = $this->slug; //Figure out which reference (tag or branch) we'll use to get the latest version of the theme. @@ -59,16 +59,16 @@ public function requestUpdate() { //Get headers from the main stylesheet in this branch/tag. Its "Version" header and other metadata //are what the WordPress install will actually see after upgrading, so they take precedence over releases/tags. - $remoteHeader = $this->getFileHeader($api->getRemoteFile('style.css', $ref)); - $update->version = Puc_v4p4_Utils::findNotEmpty(array( + $remoteHeader = $this->package->getFileHeader($api->getRemoteFile('style.css', $ref)); + $update->version = Puc_v4p5_Utils::findNotEmpty(array( $remoteHeader['Version'], - Puc_v4p4_Utils::get($updateSource, 'version'), + Puc_v4p5_Utils::get($updateSource, 'version'), )); //The details URL defaults to the Theme URI header or the repository URL. - $update->details_url = Puc_v4p4_Utils::findNotEmpty(array( + $update->details_url = Puc_v4p5_Utils::findNotEmpty(array( $remoteHeader['ThemeURI'], - $this->theme->get('ThemeURI'), + $this->package->getHeaderValue('ThemeURI'), $this->metadataUrl, )); diff --git a/vendor/yahnis-elsts/plugin-update-checker/README.md b/vendor/yahnis-elsts/plugin-update-checker/README.md index 212a99cde..61f72fcb3 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/README.md +++ b/vendor/yahnis-elsts/plugin-update-checker/README.md @@ -20,6 +20,7 @@ From the users' perspective, it works just like with plugins and themes hosted o - [How to Release an Update](#how-to-release-an-update-2) - [GitLab Integration](#gitlab-integration) - [How to Release an Update](#how-to-release-an-update-3) +- [License Management](#license-management) - [Resources](#resources) @@ -63,7 +64,7 @@ Getting Started require 'path/to/plugin-update-checker/plugin-update-checker.php'; $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( 'http://example.com/path/to/details.json', - __FILE__, + __FILE__, //Full path to the main plugin file or functions.php. 'unique-plugin-or-theme-slug' ); ``` @@ -115,6 +116,11 @@ This library supports a couple of different ways to release updates on GitHub. P Create a new release using the "Releases" feature on GitHub. The tag name and release title don't matter. The description is optional, but if you do provide one, it will be displayed when the user clicks the "View version x.y.z details" link on the "Plugins" page. Note that PUC ignores releases marked as "This is a pre-release". + If you want to use release assets, call the `enableReleaseAssets()` method after creating the update checker instance: + ```php + $myUpdateChecker->getVcsApi()->enableReleaseAssets(); + ``` + - **Tags** To release version 1.2.3, create a new Git tag named `v1.2.3` or `1.2.3`. That's it. @@ -229,19 +235,23 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli 'unique-plugin-or-theme-slug' ); - //Note: Self-hosted instances of GitLab must be initialized like this: - $myUpdateChecker = new Puc_v4_Vcs_PluginUpdateChecker( - new Puc_v4p4_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'), - __FILE__, - 'unique-plugin-or-theme-slug' - ); - //Optional: If you're using a private repository, specify the access token like this: $myUpdateChecker->setAuthentication('your-token-here'); //Optional: Set the branch that contains the stable release. $myUpdateChecker->setBranch('stable-branch-name'); ``` + + Alternatively, if you're using a self-hosted GitLab instance, initialize the update checker like this: + ```php + $myUpdateChecker = new Puc_v4p5_Vcs_PluginUpdateChecker( + new Puc_v4p5_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'), + __FILE__, + 'unique-plugin-or-theme-slug' + ); + //Optional: Add setAuthentication(...) and setBranch(...) as shown above. + ``` + 3. Plugins only: Add a `readme.txt` file formatted according to the [WordPress.org plugin readme standard](https://wordpress.org/plugins/about/readme.txt) to your repository. The contents of this file will be shown when the user clicks the "View version 1.2.3 details" link. #### How to Release an Update @@ -264,6 +274,11 @@ GitLab doesn't have an equivalent to GitHub's releases, so the process is slight Caveat: If you set the branch to `master` (the default), the update checker will look for recent releases and tags first. It'll only use the `master` branch if it doesn't find anything else suitable. +License Management +------------------ + +Currently, the update checker doesn't have any built-in license management features. It only provides some hooks that you can use to, for example, append license keys to update requests (`$updateChecker->addQueryArgFilter()`). If you're looking for ways to manage and verify licenses, please post your feedback in [this issue](https://github.com/YahnisElsts/plugin-update-checker/issues/222). + Resources --------- diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.mo b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.mo new file mode 100644 index 000000000..24639b694 Binary files /dev/null and b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.mo differ diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.po b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.po new file mode 100644 index 000000000..5dfa8ba4e --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-fr_CA.po @@ -0,0 +1,48 @@ +msgid "" +msgstr "" +"Project-Id-Version: plugin-update-checker\n" +"POT-Creation-Date: 2017-11-24 17:02+0200\n" +"PO-Revision-Date: 2018-02-12 10:32-0500\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.4\n" +"X-Poedit-Basepath: ..\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: Eric Gagnon \n" +"Language: fr_CA\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p3/Plugin/UpdateChecker.php:395 +msgid "Check for updates" +msgstr "Vérifier les mises à jour" + +#: Puc/v4p3/Plugin/UpdateChecker.php:548 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "L’extension %s est à jour." + +#: Puc/v4p3/Plugin/UpdateChecker.php:550 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Une nouvelle version de l’extension %s est disponible." + +#: Puc/v4p3/Plugin/UpdateChecker.php:552 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Impossible de déterminer si une mise à jour est disponible pour \"%s\"" + +#: Puc/v4p3/Plugin/UpdateChecker.php:558 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Un problème inconnu est survenu \"%s\"" + +#: Puc/v4p3/Vcs/PluginUpdateChecker.php:95 +msgid "There is no changelog available." +msgstr "Il n’y a aucun journal de mise à jour disponible." diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.mo b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.mo new file mode 100644 index 000000000..1cea26dda Binary files /dev/null and b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.mo differ diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.po b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.po new file mode 100644 index 000000000..e1734bb52 --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_BE.po @@ -0,0 +1,48 @@ +msgid "" +msgstr "" +"Project-Id-Version: plugin-update-checker\n" +"POT-Creation-Date: 2018-03-25 18:15+0200\n" +"PO-Revision-Date: 2018-03-25 18:32+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"X-Poedit-Basepath: ..\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: Frank Goossens \n" +"Language: nl_BE\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p3/Plugin/UpdateChecker.php:395 +msgid "Check for updates" +msgstr "Controleer op nieuwe versies" + +#: Puc/v4p3/Plugin/UpdateChecker.php:548 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "De meest recente %s versie is geïnstalleerd." + +#: Puc/v4p3/Plugin/UpdateChecker.php:550 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Er is een nieuwe versie van %s beschikbaar." + +#: Puc/v4p3/Plugin/UpdateChecker.php:552 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Kon niet bepalen of er nieuwe versie van %s beschikbaar is." + +#: Puc/v4p3/Plugin/UpdateChecker.php:558 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Ongekende status bij controle op nieuwe versie: \"%s\"" + +#: Puc/v4p3/Vcs/PluginUpdateChecker.php:95 +msgid "There is no changelog available." +msgstr "Er is geen changelog beschikbaar." diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.mo b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.mo new file mode 100644 index 000000000..16dde622b Binary files /dev/null and b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.mo differ diff --git a/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.po b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.po new file mode 100644 index 000000000..7f57a89fb --- /dev/null +++ b/vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-nl_NL.po @@ -0,0 +1,48 @@ +msgid "" +msgstr "" +"Project-Id-Version: plugin-update-checker\n" +"POT-Creation-Date: 2018-03-25 18:15+0200\n" +"PO-Revision-Date: 2018-03-25 18:32+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"X-Poedit-Basepath: ..\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: Frank Goossens \n" +"Language: nl_NL\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p3/Plugin/UpdateChecker.php:395 +msgid "Check for updates" +msgstr "Controleer op nieuwe versies" + +#: Puc/v4p3/Plugin/UpdateChecker.php:548 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "De meest recente %s versie is geïnstalleerd." + +#: Puc/v4p3/Plugin/UpdateChecker.php:550 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Er is een nieuwe versie van %s beschikbaar." + +#: Puc/v4p3/Plugin/UpdateChecker.php:552 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Kon niet bepalen of er nieuwe versie van %s beschikbaar is." + +#: Puc/v4p3/Plugin/UpdateChecker.php:558 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Ongekende status bij controle op nieuwe versie: \"%s\"" + +#: Puc/v4p3/Vcs/PluginUpdateChecker.php:95 +msgid "There is no changelog available." +msgstr "Er is geen changelog beschikbaar." diff --git a/vendor/yahnis-elsts/plugin-update-checker/plugin-update-checker.php b/vendor/yahnis-elsts/plugin-update-checker/plugin-update-checker.php index a0fef1908..f521f9d00 100644 --- a/vendor/yahnis-elsts/plugin-update-checker/plugin-update-checker.php +++ b/vendor/yahnis-elsts/plugin-update-checker/plugin-update-checker.php @@ -1,24 +1,24 @@ $2', $_sections[$i]); - $_sections[$i] = $this->filter_text( $_sections[$i], true ); - $title = $this->sanitize_text( $_sections[$i-1] ); - $sections[str_replace(' ', '_', strtolower($title))] = array('title' => $title, 'content' => $_sections[$i]); + for ( $i=0; $i < count($_sections); $i +=2 ) { + $title = $this->sanitize_text( $_sections[$i] ); + if ( isset($_sections[$i+1]) ) { + $content = preg_replace('/(^[\s]*)=[\s]+(.+?)[\s]+=/m', '$1

$2

', $_sections[$i+1]); + $content = $this->filter_text( $content, true ); + } else { + $content = ''; + } + $sections[str_replace(' ', '_', strtolower($title))] = array('title' => $title, 'content' => $content); } @@ -157,8 +161,11 @@ function parse_readme_contents( $file_contents ) { $upgrade_notice = array(); if ( isset($final_sections['upgrade_notice']) ) { $split = preg_split( '#

(.*?)

#', $final_sections['upgrade_notice'], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); - for ( $i = 0; $i < count( $split ); $i += 2 ) - $upgrade_notice[$this->sanitize_text( $split[$i] )] = substr( $this->sanitize_text( $split[$i + 1] ), 0, 300 ); + if ( count($split) >= 2 ) { + for ( $i = 0; $i < count( $split ); $i += 2 ) { + $upgrade_notice[$this->sanitize_text( $split[$i] )] = substr( $this->sanitize_text( $split[$i + 1] ), 0, 300 ); + } + } unset( $final_sections['upgrade_notice'] ); } @@ -331,4 +338,4 @@ function decodeit( $matches ) { } // end class -endif; \ No newline at end of file +endif;