From a9f15da5c6a3c9b294daaeaffb610f2baaed70d7 Mon Sep 17 00:00:00 2001 From: kmhcreative Date: Sun, 8 Dec 2024 14:56:29 -0600 Subject: [PATCH] Updated socials and plugin checker --- .gitignore | 6 +- README.md | 25 +- README.txt | 18 +- css/social_buttons.css | 40 +- css/zappbar_desktops.css | 21 +- css/zappbar_desktops_hd.css | 21 +- css/zappbar_idevices.css | 21 +- css/zappbar_phones.css | 21 +- css/zappbar_tablets.css | 21 +- css/zappbar_tablets_hd.css | 21 +- .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin functions/aq_resizer.php | 0 functions/class.settings-api.php | 2 +- functions/utility_functions.php | 19 +- icon-picker/LICENSE | 0 icon-picker/README.md | 0 icon-picker/css/icon-picker.css | 0 icon-picker/icon-picker-example-plugin.php | 0 icon-picker/js/icon-picker.js | 0 includes/html_inject.php | 121 +- .../social_icons/icons_large/bluesky.png | Bin 0 -> 5218 bytes .../social_icons/icons_large/instagram.png | Bin 5424 -> 3676 bytes .../social_icons/icons_large/threads.png | Bin 0 -> 1762 bytes .../social_icons/icons_medium/bluesky.png | Bin 0 -> 6114 bytes .../social_icons/icons_medium/instagram.png | Bin 4378 -> 2884 bytes .../social_icons/icons_medium/threads.png | Bin 0 -> 1441 bytes .../social_icons/icons_small/bluesky.png | Bin 0 -> 5683 bytes .../social_icons/icons_small/instagram.png | Bin 3552 -> 2335 bytes .../social_icons/icons_small/threads.png | Bin 0 -> 1165 bytes js/jquery.coo.kie.js | 0 options/zappbar_options.php | 24 +- plugin-update-checker/Puc/v5/PucFactory.php | 10 + plugin-update-checker/Puc/v5p4/Autoloader.php | 86 ++ .../Puc/v5p4/DebugBar/Extension.php | 199 ++++ .../Puc/v5p4/DebugBar/Panel.php | 178 +++ .../Puc/v5p4/DebugBar/PluginExtension.php | 40 + .../Puc/v5p4/DebugBar/PluginPanel.php | 41 + .../Puc/v5p4/DebugBar/ThemePanel.php | 25 + .../Puc/v5p4/InstalledPackage.php | 105 ++ plugin-update-checker/Puc/v5p4/Metadata.php | 162 +++ .../Puc/v5p4/OAuthSignature.php | 102 ++ .../Puc/v5p4/Plugin/Package.php | 188 +++ .../Puc/v5p4/Plugin/PluginInfo.php | 136 +++ plugin-update-checker/Puc/v5p4/Plugin/Ui.php | 294 +++++ .../Puc/v5p4/Plugin/Update.php | 116 ++ .../Puc/v5p4/Plugin/UpdateChecker.php | 425 +++++++ plugin-update-checker/Puc/v5p4/PucFactory.php | 362 ++++++ plugin-update-checker/Puc/v5p4/Scheduler.php | 300 +++++ plugin-update-checker/Puc/v5p4/StateStore.php | 214 ++++ .../Puc/v5p4/Theme/Package.php | 69 ++ .../Puc/v5p4/Theme/Update.php | 88 ++ .../Puc/v5p4/Theme/UpdateChecker.php | 159 +++ plugin-update-checker/Puc/v5p4/Update.php | 38 + .../Puc/v5p4/UpdateChecker.php | 1029 +++++++++++++++++ .../Puc/v5p4/UpgraderStatus.php | 200 ++++ plugin-update-checker/Puc/v5p4/Utils.php | 70 ++ plugin-update-checker/Puc/v5p4/Vcs/Api.php | 379 ++++++ .../Puc/v5p4/Vcs/BaseChecker.php | 29 + .../Puc/v5p4/Vcs/BitBucketApi.php | 272 +++++ .../Puc/v5p4/Vcs/GitHubApi.php | 467 ++++++++ .../Puc/v5p4/Vcs/GitLabApi.php | 414 +++++++ .../Puc/v5p4/Vcs/PluginUpdateChecker.php | 275 +++++ .../Puc/v5p4/Vcs/Reference.php | 51 + .../Puc/v5p4/Vcs/ReleaseAssetSupport.php | 83 ++ .../Puc/v5p4/Vcs/ReleaseFilteringFeature.php | 108 ++ .../Puc/v5p4/Vcs/ThemeUpdateChecker.php | 83 ++ .../Puc/v5p4/Vcs/VcsCheckerMethods.php | 59 + .../Puc/v5p4/WpCliCheckTrigger.php | 84 ++ plugin-update-checker/README.md | 177 ++- plugin-update-checker/composer.json | 6 +- plugin-update-checker/css/puc-debug-bar.css | 2 +- plugin-update-checker/js/debug-bar.js | 14 +- .../languages/plugin-update-checker-ca.mo | Bin .../languages/plugin-update-checker-ca.po | 0 .../languages/plugin-update-checker-cs_CZ.mo | Bin .../languages/plugin-update-checker-cs_CZ.po | 0 .../languages/plugin-update-checker-da_DK.mo | Bin .../languages/plugin-update-checker-da_DK.po | 0 .../languages/plugin-update-checker-de_DE.mo | Bin .../languages/plugin-update-checker-de_DE.po | 0 .../languages/plugin-update-checker-es_AR.mo | Bin .../languages/plugin-update-checker-es_AR.po | 0 .../languages/plugin-update-checker-es_CL.mo | Bin .../languages/plugin-update-checker-es_CL.po | 0 .../languages/plugin-update-checker-es_CO.mo | Bin .../languages/plugin-update-checker-es_CO.po | 0 .../languages/plugin-update-checker-es_CR.mo | Bin .../languages/plugin-update-checker-es_CR.po | 0 .../languages/plugin-update-checker-es_DO.mo | Bin .../languages/plugin-update-checker-es_DO.po | 0 .../languages/plugin-update-checker-es_ES.mo | Bin .../languages/plugin-update-checker-es_ES.po | 0 .../languages/plugin-update-checker-es_GT.mo | Bin .../languages/plugin-update-checker-es_GT.po | 0 .../languages/plugin-update-checker-es_HN.mo | Bin .../languages/plugin-update-checker-es_HN.po | 0 .../languages/plugin-update-checker-es_MX.mo | Bin .../languages/plugin-update-checker-es_MX.po | 0 .../languages/plugin-update-checker-es_PE.mo | Bin .../languages/plugin-update-checker-es_PE.po | 0 .../languages/plugin-update-checker-es_PR.mo | Bin .../languages/plugin-update-checker-es_PR.po | 0 .../languages/plugin-update-checker-es_UY.mo | Bin .../languages/plugin-update-checker-es_UY.po | 0 .../languages/plugin-update-checker-es_VE.mo | Bin .../languages/plugin-update-checker-es_VE.po | 0 .../languages/plugin-update-checker-fa_IR.mo | Bin .../languages/plugin-update-checker-fa_IR.po | 0 .../languages/plugin-update-checker-fr_CA.mo | Bin .../languages/plugin-update-checker-fr_CA.po | 0 .../languages/plugin-update-checker-fr_FR.mo | Bin .../languages/plugin-update-checker-fr_FR.po | 0 .../languages/plugin-update-checker-hu_HU.mo | Bin .../languages/plugin-update-checker-hu_HU.po | 0 .../languages/plugin-update-checker-it_IT.mo | Bin 989 -> 1135 bytes .../languages/plugin-update-checker-it_IT.po | 48 +- .../languages/plugin-update-checker-ja.mo | Bin .../languages/plugin-update-checker-ja.po | 0 .../languages/plugin-update-checker-nl_BE.mo | Bin .../languages/plugin-update-checker-nl_BE.po | 0 .../languages/plugin-update-checker-nl_NL.mo | Bin .../languages/plugin-update-checker-nl_NL.po | 0 .../languages/plugin-update-checker-pt_BR.mo | Bin .../languages/plugin-update-checker-pt_BR.po | 0 .../languages/plugin-update-checker-ru_RU.mo | Bin 0 -> 1337 bytes .../languages/plugin-update-checker-ru_RU.po | 48 + .../languages/plugin-update-checker-sl_SI.mo | Bin .../languages/plugin-update-checker-sl_SI.po | 0 .../languages/plugin-update-checker-sv_SE.mo | Bin .../languages/plugin-update-checker-sv_SE.po | 0 .../languages/plugin-update-checker-tr_TR.mo | Bin 0 -> 1118 bytes .../languages/plugin-update-checker-tr_TR.po | 48 + .../languages/plugin-update-checker-uk_UA.mo | Bin 0 -> 1309 bytes .../languages/plugin-update-checker-uk_UA.po | 48 + .../languages/plugin-update-checker-zh_CN.mo | Bin 1060 -> 1174 bytes .../languages/plugin-update-checker-zh_CN.po | 31 +- .../languages/plugin-update-checker.pot | 20 +- plugin-update-checker/license.txt | 2 +- plugin-update-checker/load-v5p4.php | 34 + .../plugin-update-checker.php | 6 +- plugin-update-checker/vendor/Parsedown.php | 7 +- .../vendor/ParsedownModern.php | 0 .../vendor/PucReadmeParser.php | 6 +- widgets/translator.php | 0 widgets/zappbar_sidebar.php | 0 zappbar.php | 26 +- 149 files changed, 7519 insertions(+), 325 deletions(-) mode change 100755 => 100644 fonts/font-awesome/fonts/fontawesome-webfont.eot mode change 100755 => 100644 fonts/font-awesome/fonts/fontawesome-webfont.svg mode change 100755 => 100644 fonts/font-awesome/fonts/fontawesome-webfont.ttf mode change 100755 => 100644 fonts/font-awesome/fonts/fontawesome-webfont.woff mode change 100755 => 100644 functions/aq_resizer.php mode change 100755 => 100644 icon-picker/LICENSE mode change 100755 => 100644 icon-picker/README.md mode change 100755 => 100644 icon-picker/css/icon-picker.css mode change 100755 => 100644 icon-picker/icon-picker-example-plugin.php mode change 100755 => 100644 icon-picker/js/icon-picker.js create mode 100644 includes/images/social_icons/icons_large/bluesky.png create mode 100644 includes/images/social_icons/icons_large/threads.png create mode 100644 includes/images/social_icons/icons_medium/bluesky.png create mode 100644 includes/images/social_icons/icons_medium/threads.png create mode 100644 includes/images/social_icons/icons_small/bluesky.png create mode 100644 includes/images/social_icons/icons_small/threads.png mode change 100755 => 100644 js/jquery.coo.kie.js create mode 100644 plugin-update-checker/Puc/v5/PucFactory.php create mode 100644 plugin-update-checker/Puc/v5p4/Autoloader.php create mode 100644 plugin-update-checker/Puc/v5p4/DebugBar/Extension.php create mode 100644 plugin-update-checker/Puc/v5p4/DebugBar/Panel.php create mode 100644 plugin-update-checker/Puc/v5p4/DebugBar/PluginExtension.php create mode 100644 plugin-update-checker/Puc/v5p4/DebugBar/PluginPanel.php create mode 100644 plugin-update-checker/Puc/v5p4/DebugBar/ThemePanel.php create mode 100644 plugin-update-checker/Puc/v5p4/InstalledPackage.php create mode 100644 plugin-update-checker/Puc/v5p4/Metadata.php create mode 100644 plugin-update-checker/Puc/v5p4/OAuthSignature.php create mode 100644 plugin-update-checker/Puc/v5p4/Plugin/Package.php create mode 100644 plugin-update-checker/Puc/v5p4/Plugin/PluginInfo.php create mode 100644 plugin-update-checker/Puc/v5p4/Plugin/Ui.php create mode 100644 plugin-update-checker/Puc/v5p4/Plugin/Update.php create mode 100644 plugin-update-checker/Puc/v5p4/Plugin/UpdateChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/PucFactory.php create mode 100644 plugin-update-checker/Puc/v5p4/Scheduler.php create mode 100644 plugin-update-checker/Puc/v5p4/StateStore.php create mode 100644 plugin-update-checker/Puc/v5p4/Theme/Package.php create mode 100644 plugin-update-checker/Puc/v5p4/Theme/Update.php create mode 100644 plugin-update-checker/Puc/v5p4/Theme/UpdateChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/Update.php create mode 100644 plugin-update-checker/Puc/v5p4/UpdateChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/UpgraderStatus.php create mode 100644 plugin-update-checker/Puc/v5p4/Utils.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/Api.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/BaseChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/BitBucketApi.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/GitHubApi.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/GitLabApi.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/PluginUpdateChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/Reference.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/ReleaseAssetSupport.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/ReleaseFilteringFeature.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/ThemeUpdateChecker.php create mode 100644 plugin-update-checker/Puc/v5p4/Vcs/VcsCheckerMethods.php create mode 100644 plugin-update-checker/Puc/v5p4/WpCliCheckTrigger.php mode change 100755 => 100644 plugin-update-checker/README.md mode change 100755 => 100644 plugin-update-checker/composer.json mode change 100755 => 100644 plugin-update-checker/css/puc-debug-bar.css mode change 100755 => 100644 plugin-update-checker/js/debug-bar.js mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-ca.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-ca.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-cs_CZ.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-cs_CZ.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-da_DK.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-da_DK.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-de_DE.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-de_DE.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_AR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_AR.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CL.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CL.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CO.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CO.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_CR.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_DO.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_DO.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_ES.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_ES.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_GT.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_GT.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_HN.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_HN.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_MX.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_MX.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_PE.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_PE.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_PR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_PR.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_UY.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_UY.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_VE.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-es_VE.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fa_IR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fa_IR.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fr_CA.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fr_CA.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fr_FR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-fr_FR.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-hu_HU.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-hu_HU.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-it_IT.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-it_IT.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-ja.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-ja.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-nl_BE.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-nl_BE.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-nl_NL.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-nl_NL.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-pt_BR.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-pt_BR.po create mode 100644 plugin-update-checker/languages/plugin-update-checker-ru_RU.mo create mode 100644 plugin-update-checker/languages/plugin-update-checker-ru_RU.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-sl_SI.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-sl_SI.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-sv_SE.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-sv_SE.po create mode 100644 plugin-update-checker/languages/plugin-update-checker-tr_TR.mo create mode 100644 plugin-update-checker/languages/plugin-update-checker-tr_TR.po create mode 100644 plugin-update-checker/languages/plugin-update-checker-uk_UA.mo create mode 100644 plugin-update-checker/languages/plugin-update-checker-uk_UA.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-zh_CN.mo mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker-zh_CN.po mode change 100755 => 100644 plugin-update-checker/languages/plugin-update-checker.pot mode change 100755 => 100644 plugin-update-checker/license.txt create mode 100644 plugin-update-checker/load-v5p4.php mode change 100755 => 100644 plugin-update-checker/plugin-update-checker.php mode change 100755 => 100644 plugin-update-checker/vendor/Parsedown.php mode change 100755 => 100644 plugin-update-checker/vendor/ParsedownModern.php mode change 100755 => 100644 plugin-update-checker/vendor/PucReadmeParser.php mode change 100755 => 100644 widgets/translator.php mode change 100755 => 100644 widgets/zappbar_sidebar.php diff --git a/.gitignore b/.gitignore index 143d684..496ee2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ - -functions/error_log -functions/error_log -icon-picker/error_log -options/error_log +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index de669e5..e83eeea 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ Automagically adds responsive, customizable mobile UI to (almost) any WordPress theme. -**Version:** 0.2.9 +**Version:** 0.3.0 -**Requires WordPress Version:** 3.5 or higher, PHP 5+ +**Requires WordPress Version:** 4.9 or higher, PHP 7.4+ -**Compatible up to:** 6.1.1 +**Compatible up to:** 6.7.1 **Beta Version Disclaimer** @@ -127,8 +127,6 @@ ZappBar has it’s own Social Media functions to make is easy for people to shar **Default Facebook Image:** If a post has no “Featured Image” this is the image that will be displayed as the thumbnail when somebody shares the link on Facebook (if left blank ZappBar will _not_ inject _any_ Facebook `` tags). -**Twitter ID:** Enter the @ Twitter ID associated with your blog (if any). If you leave this blank then no Twitter `` tags will be injected. - **Mastodon ID:** Enter the @username@instance ID associated with your Mastodon account and the Mastodon verification code will be added to your website. **Phone Number:** If you intend to link a ZappBar button to the “Phone” action this is the phone number that will be inserted into the on-screen notice box. @@ -145,7 +143,8 @@ ZappBar has it’s own Social Media functions to make is easy for people to shar * Reddit * RSS Feed * Tumblr -* Twitter +* Threads +* Bluesky **Social Shortcode:** you can invoke this same list of social media links anywhere on your site, even when ZappBars are not being shown, by using the shortcode *_[zb-share]_* which accepts the following parameters: @@ -154,7 +153,7 @@ ZappBar has it’s own Social Media functions to make is easy for people to shar * type=“small” - 16x16 icons as button, spaced far enough apart to be clickable on mobile devices. * type=“medium” - 24x25 icons as buttons * type=“large” - 32x32 icons as buttons -* include=“twitter,linkedin…” - comma-separated list limiting which social media sites will be included. +* include=“threads,linkedin…” - comma-separated list limiting which social media sites will be included. * exclude=“facebook,pinterest…” - comma-separated list of which social media sites to exclude. ### ZappBar Colors @@ -216,7 +215,7 @@ This tab section shows you editable previews of what the ZappBars will look like **Blog Top/Bottom ZappBar:** these bars will ONLY appear on a single blog post, and only if you enabled them under *Top Blog ZappBar* and/or *Bottom Blog ZappBar* -If you are using the ComicPress theme, Comic Easel plugin, or Webcomic plugin more bar options are displayed for the custom comic post pages: +If you are using the ComicPress theme, Comic Easel plugin, Webcomic, or ComicPost plugin more bar options are displayed for the custom comic post pages: **Top/Bottom Comic ZappBar:** Choose whether to use the custom “comic” bars on comics pages, the Default ones, or no top/bottom bar. @@ -252,6 +251,16 @@ simply be an icon with no dynamic elements. ## Changelog +Version 0.3.0 +* Added ComicPost plugin support. +* Removed social media code for X, Twitter, Google+, StumbleUpon, Digg, and Delicious +* Added social media code for sharing on Threads and Bluesky +* Updated/fixed OpenGraph meta +* Added toggle to explicitly include/exclude social meta +* Plugin Update Checker updated to v5.4 +* Minimum WP version increased to 4.9 +* Minimum PHP version increased to 7.4 + Version 0.2.9 * Fixed bug with Mastodon self-verification code which asked for your ID but actually required URL. Now you can enter either. diff --git a/README.txt b/README.txt index 16b5912..6efaf23 100644 --- a/README.txt +++ b/README.txt @@ -3,10 +3,10 @@ Author URI: http://www.kmhcreative.com Plugin URI: https://github.com/kmhcreative/zappbar Contributors: OffWorld, Frumph Tags: Responsive, Mobile, Theme, Modifications -Requires at least: 3.5 -Requires PHP: 5.3 -Tested up to: 6.1.1 -Stable Tag: 0.2.9 +Requires at least: 4.9 +Requires PHP: 7.4 +Tested up to: 6.7.1 +Stable Tag: 0.3.0 License: GPLv3 Licence URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -61,6 +61,16 @@ Zappbar buttons are not functional when shown in Theme "Customize" interface bec == Changelog == += Version 0.3.0 = +* Added ComicPost plugin support. +* Removed social media code for X, Twitter, Google+, StumbleUpon, Digg, and Delicious +* Added social media code for sharing on Threads and Bluesky +* Updated/fixed OpenGraph meta +* Added toggle to explicitly include/exclude social meta +* Plugin Update Checker updated to v5.4 +* Minimum WP version increased to 4.9 +* Minimum PHP version increased to 7.4 + = Version 0.2.9 = * Fixed bug with Mastodon self-verification code which asked for your ID but actually required URL. Now you can enter either. diff --git a/css/social_buttons.css b/css/social_buttons.css index e993675..952a922 100644 --- a/css/social_buttons.css +++ b/css/social_buttons.css @@ -14,8 +14,8 @@ a.zb-share { display: block; padding: 0 5px; } - a.zb-share.twitter { - background-color:#9AE4E8; + a.zb-share.bluesky { + background-color:#0085ff; } a.zb-share.tumblr{ background-color:#001935; @@ -27,6 +27,10 @@ a.zb-share { a.zb-share.facebook { background-color:#3B5998; } + /* Threads */ + a.zb-share.threads { + background-color:#000000; + } /*LinkedIn*/ a.zb-share.linkedin { background-color:#0e76a8; @@ -59,8 +63,8 @@ a.zb-share { } .zb-sharethis.small a.zb-share span { display: none;} /* Twitter */ - .zb-sharethis.small a.zb-share.twitter { - background-image: url('../includes/images/social_icons/icons_small/twitter.png'); + .zb-sharethis.small a.zb-share.bluesky { + background-image: url('../includes/images/social_icons/icons_small/bluesky.png'); } /* Tumblr */ .zb-sharethis.small a.zb-share.tumblr { @@ -74,6 +78,10 @@ a.zb-share { .zb-sharethis.small a.zb-share.facebook { background-image: url('../includes/images/social_icons/icons_small/facebook.png'); } + /*Threads*/ + .zb-sharethis.small a.zb-share.threads { + background-image: url('../includes/images/social_icons/icons_small/threads.png'); + } /*LinkedIn*/ .zb-sharethis.small a.zb-share.linkedin { background-image: url('../includes/images/social_icons/icons_small/linkedin.png'); @@ -105,8 +113,8 @@ a.zb-share { } .zb-sharethis.medium a.zb-share span { display: none;} /* Twitter */ - .zb-sharethis.medium a.zb-share.twitter { - background-image: url('../includes/images/social_icons/icons_medium/twitter.png'); + .zb-sharethis.medium a.zb-share.bluesky { + background-image: url('../includes/images/social_icons/icons_medium/bluesky.png'); } /* Tumblr */ .zb-sharethis.medium a.zb-share.tumblr { @@ -120,6 +128,10 @@ a.zb-share { .zb-sharethis.medium a.zb-share.facebook { background-image: url('../includes/images/social_icons/icons_medium/facebook.png'); } + /*Threads*/ + .zb-sharethis.medium a.zb-share.threads { + background-image: url('../includes/images/social_icons/icons_medium/threads.png'); + } /*LinkedIn*/ .zb-sharethis.medium a.zb-share.linkedin { background-image: url('../includes/images/social_icons/icons_medium/linkedin.png'); @@ -150,8 +162,8 @@ a.zb-share { } .zb-sharethis.large a.zb-share span { display: none;} /* Twitter */ - .zb-sharethis.large a.zb-share.twitter { - background-image: url('../includes/images/social_icons/icons_large/twitter.png'); + .zb-sharethis.large a.zb-share.bluesky { + background-image: url('../includes/images/social_icons/icons_large/bluesky.png'); } /* Tumblr */ .zb-sharethis.large a.zb-share.tumblr { @@ -165,6 +177,10 @@ a.zb-share { .zb-sharethis.large a.zb-share.facebook { background-image: url('../includes/images/social_icons/icons_large/facebook.png'); } + /*Threads*/ + .zb-sharethis.large a.zb-share.threads { + background-image: url('../includes/images/social_icons/icons_large/threads.png'); + } /*LinkedIn*/ .zb-sharethis.large a.zb-share.linkedin { background-image: url('../includes/images/social_icons/icons_large/linkedin.png'); @@ -194,8 +210,8 @@ a.zb-share { line-height: 22px; } /* Twitter */ - .zb-sharethis.label a.zb-share.twitter { - background-image: url('../includes/images/social_icons/icons_small/twitter.png'); + .zb-sharethis.label a.zb-share.bluesky { + background-image: url('../includes/images/social_icons/icons_small/bluesky.png'); } /* Tumblr */ .zb-sharethis.label a.zb-share.tumblr { @@ -209,6 +225,10 @@ a.zb-share { .zb-sharethis.label a.zb-share.facebook { background-image: url('../includes/images/social_icons/icons_small/facebook.png'); } + /*Threads*/ + .zb-sharethis.label a.zb-share.threads { + background-image: url('../includes/images/social_icons/icons_small/threads.png'); + } /*LinkedIn*/ .zb-sharethis.label a.zb-share.linkedin { background-image: url('../includes/images/social_icons/icons_small/linkedin.png'); diff --git a/css/zappbar_desktops.css b/css/zappbar_desktops.css index a172cb7..4e46dd4 100644 --- a/css/zappbar_desktops.css +++ b/css/zappbar_desktops.css @@ -257,8 +257,8 @@ -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -272,35 +272,22 @@ #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/css/zappbar_desktops_hd.css b/css/zappbar_desktops_hd.css index 1775881..fc6610f 100644 --- a/css/zappbar_desktops_hd.css +++ b/css/zappbar_desktops_hd.css @@ -254,8 +254,8 @@ -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -269,35 +269,22 @@ #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/css/zappbar_idevices.css b/css/zappbar_idevices.css index 7182759..3b47dc9 100644 --- a/css/zappbar_idevices.css +++ b/css/zappbar_idevices.css @@ -272,8 +272,8 @@ -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -287,35 +287,22 @@ #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/css/zappbar_phones.css b/css/zappbar_phones.css index 207e812..ede3ed2 100644 --- a/css/zappbar_phones.css +++ b/css/zappbar_phones.css @@ -266,8 +266,8 @@ -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -281,35 +281,22 @@ #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/css/zappbar_tablets.css b/css/zappbar_tablets.css index d4ae103..e1a5997 100644 --- a/css/zappbar_tablets.css +++ b/css/zappbar_tablets.css @@ -270,8 +270,8 @@ -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -285,35 +285,22 @@ #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/css/zappbar_tablets_hd.css b/css/zappbar_tablets_hd.css index 68201fc..8cd4a0b 100644 --- a/css/zappbar_tablets_hd.css +++ b/css/zappbar_tablets_hd.css @@ -310,8 +310,8 @@ html { -ms-border-radius:5px; } /*Twitter*/ -#zappbar_share_this a.twitter{ - background:#3cf url('../includes/images/social_icons/icons_large/twitter.png') 10px center no-repeat; +#zappbar_share_this a.bluesky{ + background:#0085ff url('../includes/images/social_icons/icons_large/bluesky.png') 10px center no-repeat; } /* Tumblr */ #zappbar_share_this a.tumblr { @@ -325,35 +325,22 @@ html { #zappbar_share_this a.facebook{ background:#3B5998 url('../includes/images/social_icons/icons_large/facebook.png') 10px center no-repeat; } -/*Google Plus*/ -#zappbar_share_this a.google-plus{ - background:#D34836 url('../includes/images/social_icons/icons_large/googleplus.png') 10px center no-repeat; +#zappbar_share_this a.threads{ + background:#000000 url('../includes/images/social_icons/icons_large/threads.png') 10px center no-repeat; } /*LinkedIn*/ #zappbar_share_this a.linkedin{ background:#0e76a8 url('../includes/images/social_icons/icons_large/linkedin.png') 10px center no-repeat; } -/*StumbleUpon*/ -#zappbar_share_this a.stumbleupon{ - background:#EF4916 url('../includes/images/social_icons/icons_large/stumbleupon.png') 10px center no-repeat; -} /*Reddit*/ #zappbar_share_this a.reddit{ color: #333 !important; background:#CEE3F8 url('../includes/images/social_icons/icons_large/reddit.png') 10px center no-repeat; } -/*Digg*/ -#zappbar_share_this a.digg{ - background:#1B5790 url('../includes/images/social_icons/icons_large/digg.png') 10px center no-repeat; -} /*Pinterest*/ #zappbar_share_this a.pinterest{ background:#C92228 url('../includes/images/social_icons/icons_large/pinterest.png') 10px center no-repeat; } -/*Delicious*/ -#zappbar_share_this a.delicious{ - background:#0b79e5 url('../includes/images/social_icons/icons_large/delicious.png') 10px center no-repeat; -} /*RSS*/ #zappbar_share_this a.rss-feed{ background:#F64C0B url('../includes/images/social_icons/icons_large/rss.png') 10px center no-repeat; diff --git a/fonts/font-awesome/fonts/fontawesome-webfont.eot b/fonts/font-awesome/fonts/fontawesome-webfont.eot old mode 100755 new mode 100644 diff --git a/fonts/font-awesome/fonts/fontawesome-webfont.svg b/fonts/font-awesome/fonts/fontawesome-webfont.svg old mode 100755 new mode 100644 diff --git a/fonts/font-awesome/fonts/fontawesome-webfont.ttf b/fonts/font-awesome/fonts/fontawesome-webfont.ttf old mode 100755 new mode 100644 diff --git a/fonts/font-awesome/fonts/fontawesome-webfont.woff b/fonts/font-awesome/fonts/fontawesome-webfont.woff old mode 100755 new mode 100644 diff --git a/functions/aq_resizer.php b/functions/aq_resizer.php old mode 100755 new mode 100644 diff --git a/functions/class.settings-api.php b/functions/class.settings-api.php index cb09ca2..4a8d1b8 100644 --- a/functions/class.settings-api.php +++ b/functions/class.settings-api.php @@ -336,7 +336,7 @@ function callback_appbar( $args ) { $targets = array_merge($targets,$woo_targets); } - if (function_exists('ceo_pluginfo') || function_exists('comicpress_themeinfo') || class_exists('Webcomic') || function_exists('webcomic') || post_type_exists('mangapress_comic') ) { + if (function_exists('ceo_pluginfo') || function_exists('comicpress_themeinfo') || class_exists('Webcomic') || function_exists('webcomic') || post_type_exists('mangapress_comic') || function_exists('comicpost_pluginfo') ) { if(function_exists('webcomic')){ $collection = get_webcomic_collections(); $comic_archive = get_webcomic_collection_url($collection[0]); diff --git a/functions/utility_functions.php b/functions/utility_functions.php index 7794664..1d8516e 100644 --- a/functions/utility_functions.php +++ b/functions/utility_functions.php @@ -16,7 +16,6 @@ function hex2rgb($hex) { } $rgb = array($r, $g, $b); return implode(",", $rgb); // returns the rgb values separated by commas - // return $rgb; // returns an array with the rgb values } // Flattens hierachical taxonomy terms while preserving term parameters function zb_get_flat_terms( $taxonomy = 'category', $parent = 0, $hide_empty = 0 ){ @@ -31,16 +30,7 @@ function zb_get_flat_terms( $taxonomy = 'category', $parent = 0, $hide_empty = 0 $list = []; foreach($terms as $term) { $list[] = $term; -// $subargs = array( -// 'hierarchical' => 1, -// 'show_option_none' => '', -// 'hide_empty' => 0, -// 'parent' => $term->term_id, -// 'taxonomy' => $taxonomy -// ); -// $subcats = get_categories($subargs); $subcats = zb_get_flat_terms($taxonomy,$term->term_id); -// $subcats = get_terms($subargs); foreach($subcats as $sub){ $list[] = $sub; } @@ -147,7 +137,7 @@ function zb_share_shortcode( $atts, $content = null ) { $include = strtolower($include); $include = explode(",",$include); } else { - $include = array('facebook','twitter','mastodon','tumblr','reddit','linkedin','pinterest','rss','email'); + $include = array('facebook','threads','bluesky','mastodon','tumblr','reddit','linkedin','pinterest','rss','email'); } if ($exclude != null && $exclude != '') { $exclude = strtolower($exclude); @@ -159,8 +149,11 @@ function zb_share_shortcode( $atts, $content = null ) { if ( in_array('facebook',$include) && !in_array('facebook',$exclude) ) { $social .= 'Facebook'; } - if ( in_array('twitter',$include) && !in_array('twitter',$exclude) ) { - $social .= 'Twitter'; + if ( in_array('threads',$include) && !in_array('threads',$exclude) ){ + $social .= 'Threads'; + } + if ( in_array('bluesky',$include) && !in_array('bluesky',$exclude) ) { + $social .= 'Bluesky'; } if ( in_array('tumblr',$include) && !in_array('tumblr',$exclude) ){ $social .= 'Tumblr'; diff --git a/icon-picker/LICENSE b/icon-picker/LICENSE old mode 100755 new mode 100644 diff --git a/icon-picker/README.md b/icon-picker/README.md old mode 100755 new mode 100644 diff --git a/icon-picker/css/icon-picker.css b/icon-picker/css/icon-picker.css old mode 100755 new mode 100644 diff --git a/icon-picker/icon-picker-example-plugin.php b/icon-picker/icon-picker-example-plugin.php old mode 100755 new mode 100644 diff --git a/icon-picker/js/icon-picker.js b/icon-picker/js/icon-picker.js old mode 100755 new mode 100644 diff --git a/includes/html_inject.php b/includes/html_inject.php index fbaae32..22d14bb 100644 --- a/includes/html_inject.php +++ b/includes/html_inject.php @@ -148,8 +148,34 @@ function build_zappbars($value,$layout,$position,$paged) { } else { }; } + // ComicPost Plugin + if ( function_exists('comicpost_pluginfo') ) { + if ($val[2] == 'prev_chapter') { + $val[2] = comicpost_get_previous_chapter(); + if($val[2] == ''){$xtra = ' zb-disabled';} else { $xtra = ''; } + } else if ($val[2] == 'first_comic') { + $val[2] = comicpost_get_first_comic_in_chapter_permalink(); + if($val[2]==get_permalink()){$xtra = ' zb-disabled';} else { $xtra = '';} + } else if ($val[2] == 'prev_comic') { + $val[2] = comicpost_get_previous_comic_in_chapter_permalink(); + if($val[2] == ''){$xtra = ' zb-disabled';} else { $xtra = ''; } + } else if ($val[2] == 'next_comic') { + $val[2] = comicpost_get_next_comic_in_chapter_permalink(); + if($val[2] == ''){$xtra = ' zb-disabled';} else { $xtra = ''; } + } else if ($val[2] == 'last_comic') { + $val[2] = comicpost_get_last_comic_in_chapter_permalink(); + if($val[2]==get_permalink()){$xtra = ' zb-disabled';} else { $xtra = '';} + } else if ($val[2] == 'next_chapter') { + $val[2] = comicpost_get_next_chapter(); + if($val[2] == ''){$xtra = ' zb-disabled';} else { $xtra = ''; } + } else if ($val[2] == 'comic_archive') { + $val[2] = get_site_url().'/comic'; + $xtra = ''; + } else { + }; + } // Comic Easel Post - if ( get_post_type() == 'comic' || function_exists('ceo_pluginfo') ) { + if ( function_exists('ceo_pluginfo') ) { if (ceo_pluginfo('navigate_only_chapters')) { if ($val[2] == 'prev_chapter') { $val[2] = ceo_get_previous_chapter(); @@ -461,8 +487,11 @@ function build_zappbars($value,$layout,$position,$paged) { } else if ($val[2] == 'share_fb') { $val[2] = 'http://www.facebook.com/sharer.php?u='.urlencode($permalink).'&t='.urlencode($title).''; $xtra = ' zb-social'; - } else if ($val[2] == 'share_twitter') { - $val[2] = 'http://twitter.com/share?text='.urlencode($title).'&url='.urlencode($shortlink).''; + } else if ($val[2] == 'share_threads'){ + $val[2] = 'https://www.threads.net/intent/post?text='.urlencode($title).'%0A%0Z'.urlencode($permalink).''; + $xtra = ' zb-social'; + } else if ($val[2] == 'share_bluesky') { + $val[2] = 'http://bsky.app/intent/compose?text='.urlencode($title).'%20$'.urlencode($shortlink).''; $xtra = ' zb-social'; } else if ($val[2] == 'share_tumblr') { $val[2] = 'http://tumblr.com/widgets/share/tool?canonicalUrl='.urlencode($permalink).''; @@ -641,8 +670,11 @@ function build_zappbars($value,$layout,$position,$paged) { if ( isset($zb_social_panel['facebook']) && $zb_social_panel['facebook'] != '') { ?> Facebook - Twitter + if ( isset($zb_social_panel['threads']) && $zb_social_panel['threads'] != '') { ?> + Threads + + Bluesky Mastodon @@ -734,6 +766,7 @@ function zb_load_assets() { function app_meta() { global $post; + global $wp; $zb_site = get_option('zappbar_site'); $zb_social = get_option('zappbar_social'); $bar_colors = get_option('zappbar_colors'); @@ -819,57 +852,51 @@ function app_meta() { echo ''; echo ''; // Facebook Open Graph stuff // - if ($zb_social['fb_default_img'] != '') { + if ($zb_social['zb_seo_meta'] != 'off') { echo ''; echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; - if ( !is_singular()) { //if it is not a post or a page - // we cannot get a thumbnail + echo ''; + if (is_singular() && has_post_thumbnail( $post->ID) ){ + $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); + echo ''; + echo ''; + echo ''; } else { - if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image - $default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library - echo ''; + if (!empty($options['fallback_thumbnail']) ){ + $thumbnail_src = $zb_social['fb_default_img']; + } else { + $thumbnail_src = get_site_icon_url(); } - else{ - $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); - echo ''; + if (!empty($thumbnail_src)){ + echo ''; } - }; + } echo " - "; - }; -// Twitter stuff // -if ($zb_social['twitter_id'] != '' && substr_count($zb_social['twitter_id'],'@') == 1) { -echo ' - - - - - -'; -} -/* Mastodon Verification Code - Note: this only works if you go save your Profile on Mastodon after it's in place - and only if nothing else is blocking your instance's ability to crawl your site. -*/ -if ($zb_social['mastodon_id'] != ''){ - // see if it starts with "http" or "@" - if ($zb_social['mastodon_id'][0] == '@' && substr_count($zb_social['mastodon_id'],'@') == 2){ - // okay, it looks like a mastodon id, let's split it - $parts = explode("@",$zb_social['mastodon_id']); - // turn it into a URL - $zb_social['mastodon_id'] = 'https://'.$parts[2].'/@'.$parts[1]; - }; - // see if we have a legit URL or not - if (filter_var($zb_social['mastodon_id'], FILTER_VALIDATE_URL)){ -echo ' - - -'; - } // else do nothing + "; + /* Mastodon Verification Code + Note: this only works if you go save your Profile on Mastodon after it's in place + and only if nothing else is blocking your instance's ability to crawl your site. + */ + if ($zb_social['mastodon_id'] != ''){ + // see if it starts with "http" or "@" + if ($zb_social['mastodon_id'][0] == '@' && substr_count($zb_social['mastodon_id'],'@') == 2){ + // okay, it looks like a mastodon id, let's split it + $parts = explode("@",$zb_social['mastodon_id']); + // turn it into a URL + $zb_social['mastodon_id'] = 'https://'.$parts[2].'/@'.$parts[1]; + }; + // see if we have a legit URL or not + if (filter_var($zb_social['mastodon_id'], FILTER_VALIDATE_URL)){ + echo ' + + + '; + } // else do nothing + } } require_once(zappbar_pluginfo('plugin_path').'includes/dynamic-css.php'); diff --git a/includes/images/social_icons/icons_large/bluesky.png b/includes/images/social_icons/icons_large/bluesky.png new file mode 100644 index 0000000000000000000000000000000000000000..f15509e7d0eee126b64475e09778f6a2a8a61e4a GIT binary patch literal 5218 zcmb7IXIN9)whdLP(xfOQhAJ&UsDXsud#?fk0tA6T3cX8_DvA^lsVYSTqzeid1Qcn~ zl%k-h^d^D=3NN5n@44sP_rCXICwr|i=3H}*J@)*u6HSb?>1oc;0001bT^$WG;y>`{ zq9P^!erI1T0RSlEQ5H5h8$$!AE80gK;f8iWiU;}l5pe)ONjb<5;d&8?1G*qRP`)tG zdTTofh;oC0tYr)(4E@xRo+zCV4AMNr$ig+`qN{=%NEuF}6a*zE@Im4bz#t!QUo12T z20G3QCEg!xgF(P!3h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gK$`xnK!=B$0SHscdsRxZ06d9*S`})7}Pe^HF@+vU@O-yd_Tv2Uv#hkYjP9% z*7U?u;zUwON=b^$p(Uknx+sOXIXERH<@jh!K|w*dr1NG~RcgDFxVbqaYN)qYv$(kU zZzFbg97Don=$)>?!5kz81`PItG-K@Z{FpJTwMHY?52?+@~f4Ze**ZkaE*PuWx zitF6ia{W3K9J;!y$~WIu`uR<9LBWZxt}Ygxp3&akj?ptT6bW--&()G@@U2-JlZJ={{yJgM;iOVKl#WNLuTprKOeS+yRo%OHFX!Akkw`?Ryn^dY z7+YAt#(X(K;rbXVRqu;bDh-d0R;#bC$3$tFt<$g85-anroYH_&j)ZVc&CQ{_*iU2q zhzV+398~Wi>GDZ_v|mYHXkD|T1}ojd%iZ1G>!atr?k?Urq41-NZK&s?4JLizE-vXk zbMy15g1G>oK_J-e9(3S<;mp^sTexoiP9m+fS-FvRID7l74n5(Ibqo@~oLs}#X_UMz z%b%WRKQTUjRhhHSsPvRsPjp^WOUv$rrvn3BIO32!!*_k)5b6by!MS^kW-Ju6rOrl~ zku0Y*$)6plz*(d2;8^0R6vw(9!Aqk=e?${w2tTKVITz S2DOEXAHBD`zncgjp79Uu6VfFB literal 0 HcmV?d00001 diff --git a/includes/images/social_icons/icons_medium/bluesky.png b/includes/images/social_icons/icons_medium/bluesky.png new file mode 100644 index 0000000000000000000000000000000000000000..8d7574d18145590a3b0afa5baadc12c691cc1a98 GIT binary patch literal 6114 zcmb_g2UJtb)(%~o(gYNQ2vVek-U5mACcQ}$2@oJs0wnZa1e79z)Qc1m=}meOrHF|1 zDguHaAT<<0K!HDi?RvfcdT*_Fvd)>wp8f5;=i7T`&N{cXG?d6m&XWKD0CE*&c^zy^ ze{`QB#6G9oAv*v7$p%7BPD@2j4yfgVv_{y&0RZLOU5W07)T6Y|F=}2}moDP!$RdN# zxXQ$kfFLwQd<;I-DFJqT%K9g{Q^pjOI1F_p52qGM+Knl+?ISE&8fBPR7V8X4GdI|u zgls*?g8%Om(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CfeIySnkkg{`k=8`)KNXf`PpbIk3jVIeZ z#UX|bm(>*s;%as9pa*QN^HTM-@rw#^&Ayu^k$lCK84t_X2n)g_{T9D2J-tA8zCgsf zT<0nUJ_xt_>jrqO>4hk$q-uSBg5EhN;2tI2SSqF@!NPP0)LP_a^`vqW=?f;BEY8t4 zBA?{Cnq|Nv(O}Lb`l<=TKzUg?@8*E{VJ=a+yG?T3%o^*ZP9Q`tJKc_V>Tvvyt`bt{fK3crgJde-ZF6!invMol$pLF}EpB>Rj<2GiAzv(O9`t{+?E0(# literal 0 HcmV?d00001 diff --git a/includes/images/social_icons/icons_medium/instagram.png b/includes/images/social_icons/icons_medium/instagram.png index e8712ca68d547db145a52eb7562ff020498df463..3425583624b3e7ed121d67f219817284c9033429 100644 GIT binary patch literal 2884 zcmai0dpwi-A74nZ{7|l?&OC&?*lbdaVKXu{W+?YxV~=^*&Gu-+uUyLY=+s0-SNheF zQiMt=bri~_bWy3CQZA)($)#SMli#!Hs7`f$e>~g1-}n3T{(ipi&-e3vmd)^9rJ=r1 z9fd+^&^)P3wGr*il3#)#FnzG9m%d zFf1hEa1x0GE3w52L>wI6!NCD%L%>dKG#-lsu7lWc z^o-W$`86P)^LId=88=>D+5kR;?1k`IEATT$0#*`mUn~>!U1+8bL`8OV0UJrqRw4Kq zqPe*-M1m-Yi(q2rDhh_??zRH&uwsQZ0Xw|{QZynG3q>VRSunyP*btUm+c;R`ZTtxY zB4GtlKC~m+*eH}0Y@`?1ESUBG`0^8taY7>KbfPCDh6SPo#nkjM_XFdmN7F+tq&VLg zjH1d!R;1h{5+D=_*zu7dTd_DIH;sw~QLuz10?8btz$Abi6$K%7CSVxylZzo>2uM>- zJ24X?i3a5b|Ka9vpHjogTkfyioN(V{@1!7n(W6M*^c>Rr$R&cCxkZq{%smA1k;_Mf z+%l*ldk++9RtkjF<(qn-P!_UyS<7k)Strw_W`IuCwhj*cEjS=B^^TdR8rt;Ayi;8R zts=V~HQu;~vKWEoy1kWM+s&s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Sk;hvDW!` z&>x&0bi2D7?WQP&PDRkMMJr9Lgl4-=2wSMtt4s|Bhy-d`mDZ*<&31!GDZDB1B3NfA z27U7Gy7bo8^>C1%j+d{k9DMhki{DIZl_1WF%`%--QdAV7ltLlY>ot-j!kQ)!h~tPj zNzepLnO{d^Fhxn;?@O<<7OuX#%t~kdVEo-b9C@yuRTqNz$0nx7$r^PkX%!vEs3<}! z4N5@>c##bpArL}9L~!0=t;HEbSs41gzFxYr!s)XYe*E*l9epkiAsD69fhRuL|Ig@X z`#@ID=F&8cl-3&!ltyVbE^Le}@;?P61gv#f=P8Z#!(n-9xzj!P%On4KK7?TY3)cSf Uk|ed7d;kCd07*qoM6N<$f*1gaga7~l diff --git a/includes/images/social_icons/icons_medium/threads.png b/includes/images/social_icons/icons_medium/threads.png new file mode 100644 index 0000000000000000000000000000000000000000..1044be22d6486af652e2f763f4fc913ed1f7382a GIT binary patch literal 1441 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|T2doC(|mmy zw18|523AHP24;{FAY@>aVqgWc85q16rQz%#Mh&PMCI*J~Oa>OHnkXO*0vxV%QuQiw3qZOUY$~jP%-qzHM1_jnoV;SI3R@+x3M(KRB&@Hb09I0xZL1XF8=&Bv zUzDm~re~mMpk&9TprBw=l#*r@P?Wt5Z@Sn2DRmzV368|&p4rRy77T3YHG z80i}s=>k>g7FXt#Bv$C=6)QswftllyTAW;zSx}OhpQivaH!&%{w8U0P31kr*K-^i9 znTD__uNdkrpa=CqGWv#k2KsQbfm&@qqE`MznW;dVLFU^T+JIG}h(YbK(Fa+MVz4 zWJG|NhO|oRbG;MSjyZkT%Zr@2h$mGs(o@Xonc+;MDG&cVpR@n{+u!fX-|zqN_{!Vb z^B?S<*Pj0pd;a!q>DZVU1v4`-d(ZgzcnuvL7Ct_{j>h_@>NnzEKf8MMYDGl_!^9uI z>OWQ3oH%pl$hB+J+>T~Da{l=DZ{Ja?YddyWELpz%@awt(2B`$TeDT6VI3_Ugp@+%+n4jOimEF2`Z`tkJ(N;D#DxP;fe%yHK z*RNk!+U8oEi;C!yJ?ZG>)x~IUZ@;{?mG#xTcV-H6=gu{;w)Rd>Pd70#T2xfG_TvA` zjNyz^r%hXBs6N+e;RH(y0|ST0j~};v|NXb5w$|6w)Ku%S(}k<=4oqeC)M{t=Q=_7; zo?KB8aacQb`h*D$@89R^9$dIk@yqw`i`T5-*}8S>jXQTj_G*hiRD9&}O842bXC0GQ zR#(>L=dXV!*>LUp^~}P;iyxF8*BRAZ5%-vU!e7JGG&EkRdZo%a?rGDem83Gf?fmtt zN=IMcdX?{+w<5{ui{4rueDUhlq0^_i&CJZcOrJZqcjZb=6La&|tdk~9Qj#mT*kI1V z?>J@p^w)~>&$sX1ZEa#|nwiIvQ&%Uqdi81vS=rFpckaY|uG+2M&KziCYrC>8HI-FT zQgT8;!P5tyKL@iZfBW`r!sN-#ZEbA4{VjeTljMaTH#K_~6&E)zTBOv|+xzhASJCF? z<{LL}I(mC^U%PfqWXrmBevZ=8(jR~PSW(R=uCB+mUdc>h-_9@>e}8_@#jH$>k214Y zx#Xm!rFA?P0EWuSIo`KkEDoFaG&WE5uYsZA!sc~bw~8K22w1+nMa$4o@csMuGv>?* zsSFDfd-wkR+Q)rYuVze}W-Y?X$||MBIo(9Ge21Uc$;mB#C+q~)ZtgP;>bP;hCY((& zyyKy+Y`ye~B}$r#Du+#1$453FWQZBYV2V!>;&~>Zb2b zKQdo0xUppE($>|yI}#$FOkF=|0?+38Y6rjl`F4Mr{pCBtv%(CYwu8zkPgg&ebxsLQ E00yf#tN;K2 literal 0 HcmV?d00001 diff --git a/includes/images/social_icons/icons_small/bluesky.png b/includes/images/social_icons/icons_small/bluesky.png new file mode 100644 index 0000000000000000000000000000000000000000..0d3e5e479f7aa06179feed0b2fd0a4f7b5287849 GIT binary patch literal 5683 zcmb_g2{@Ep`+w|Z$(p5Xk>$0_V620Q$d-M}mJ9}C8)jkbOF~(avLx9`mV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loxcmR>SJBf?g~G$bJ(dRX zym|0|;bVo&(WHrU_wU_nXx%T&Xpy-wf~Ri3{8TU2?xReff6if@KWEN@0F4bSZi^=# z{~zM8W>Ub-%{O_T7D=j2=1kix8Ma!q(}n5$`SWLFj02_#vP3&cde(NHe~W%D#YS=;OJ4-J#qTG?&|4?b-&PK z`rvpo$E?6YW(`;W@n#Q|rmU@9A1iuNj7~Cbje48U@XFqE_0>Z+Z%VQ?GaAk0S+{=u z#T+w7m3#N^8_)0W=U?_x`CMbjujMmp?D`)+PM#3AHtfvB1cL|PzKKnrK7GT@oQkTd zUyKjlE>?Ur$#1zJSE~RI+sw{;UVG!xV=m13@N%hhqgsEPOQ$D?(k)--%&ii-oZYVE`T#zGjVD~5OSL+))O04Go ZV4LLjPhESrs3<5;db;|#taD0e0swccsUQFV literal 0 HcmV?d00001 diff --git a/js/jquery.coo.kie.js b/js/jquery.coo.kie.js old mode 100755 new mode 100644 diff --git a/options/zappbar_options.php b/options/zappbar_options.php index a872930..5a61e82 100644 --- a/options/zappbar_options.php +++ b/options/zappbar_options.php @@ -354,6 +354,13 @@ function get_settings_fields() { may not work if your theme already has, or another plugin (such as Yoast SEO) injects <meta> for these earlier.','zbotps') ), + array( + 'name' => 'zb_seo_meta', + 'label' => __( 'Social Meta', 'zbopts' ), + 'desc' => __( 'Include social media <meta> tags in site HEAD', 'zbopts'), + 'default' => 'off', + 'type' => 'checkbox' + ), array( 'name' => 'fb_default_img', 'label' => __( 'Default Facebook Image', 'zbopts' ), @@ -362,13 +369,6 @@ function get_settings_fields() { 'button' => __('Choose Image'), 'default' => '' ), - array( - 'name' => 'twitter_id', - 'label' => __( 'Twitter ID', 'zbopts'), - 'desc' => __( '
Enter the @ Twitter ID associated with your blog (if you leave this blank no Twitter <meta> tags will be injected).','zbopts'), - 'type' => 'text', - 'default' => '' - ), array( 'name' => 'mastodon_id', 'label' => __( 'Mastodon ID', 'zbopts'), @@ -408,7 +408,8 @@ function get_settings_fields() { 'reddit' => 'reddit', 'rss' => 'rss', 'tumblr' => 'tumblr', - 'twitter' => 'twitter' + 'bluesky' => 'bluesky', + 'threads' => 'threads' ), 'options' => array( 'email' => 'E-mail Share (email)', @@ -419,7 +420,8 @@ function get_settings_fields() { 'reddit' => 'Reddit (reddit)', 'rss' => 'RSS Feed (rss)', 'tumblr' => 'Tumblr (tumblr)', - 'twitter' => 'Twitter (twitter)' + 'bluesky' => 'Bluesky (bluesky)', + 'threads' => 'Threads (threads)' ) ), array( @@ -436,7 +438,7 @@ function get_settings_fields() {

  • type="small" (16x16 icons as buttons, spaced far enough apart to be clickable on mobile devices)
  • type="medium" (24x24 icons as buttons)
  • type="large" (32x32 icons as buttons)
  • -
  • include="twitter,linkedin..." a comma-separated list limiting which social media sites are included
  • +
  • include="threads,linkedin..." a comma-separated list limiting which social media sites are included
  • exclude="facebook,pinterest..." a comma-separated list of which social media sites to exclude
  • The social shortcode will work even if the ZappBars are set to "Display on: None" under the Site settings. The names to enter @@ -948,7 +950,7 @@ function get_settings_fields() { ); - if (function_exists('ceo_pluginfo') || function_exists('comicpress_themeinfo') || class_exists('Webcomic') || function_exists('webcomic') || post_type_exists('mangapress_comic') ) { + if (function_exists('ceo_pluginfo') || function_exists('comicpress_themeinfo') || class_exists('Webcomic') || function_exists('webcomic') || post_type_exists('mangapress_comic') || function_exists('comicpost_pluginfo') ) { // Detect if any web comics plugins/themes are in use, if so add this bar option $settings_fields['zappbar_site'][] = array( 'name' => 'comic_nav', diff --git a/plugin-update-checker/Puc/v5/PucFactory.php b/plugin-update-checker/Puc/v5/PucFactory.php new file mode 100644 index 0000000..0bc62ce --- /dev/null +++ b/plugin-update-checker/Puc/v5/PucFactory.php @@ -0,0 +1,10 @@ +rootDir = dirname(__FILE__) . '/'; + + $namespaceWithSlash = __NAMESPACE__ . '\\'; + $this->prefix = $namespaceWithSlash; + + $this->libraryDir = $this->rootDir . '../..'; + if ( !self::isPhar() ) { + $this->libraryDir = realpath($this->libraryDir); + } + $this->libraryDir = $this->libraryDir . '/'; + + //Usually, dependencies like Parsedown are in the global namespace, + //but if someone adds a custom namespace to the entire library, they + //will be in the same namespace as this class. + $isCustomNamespace = ( + substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX + ); + $libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : ''; + + $this->staticMap = array( + $libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php', + $libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php', + ); + + //Add the generic, major-version-only factory class to the static map. + $versionSeparatorPos = strrpos(__NAMESPACE__, '\\v'); + if ( $versionSeparatorPos !== false ) { + $versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1); + $pointPos = strpos($versionSegment, 'p'); + if ( ($pointPos !== false) && ($pointPos > 1) ) { + $majorVersionSegment = substr($versionSegment, 0, $pointPos); + $majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment; + $this->staticMap[$majorVersionNs . '\\PucFactory'] = + 'Puc/' . $majorVersionSegment . '/Factory.php'; + } + } + + spl_autoload_register(array($this, 'autoload')); + } + + /** + * Determine if this file is running as part of a Phar archive. + * + * @return bool + */ + private static function isPhar() { + //Check if the current file path starts with "phar://". + static $pharProtocol = 'phar://'; + return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol); + } + + public function autoload($className) { + if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) { + include($this->libraryDir . $this->staticMap[$className]); + return; + } + + if ( strpos($className, $this->prefix) === 0 ) { + $path = substr($className, strlen($this->prefix)); + $path = str_replace(array('_', '\\'), '/', $path); + $path = $this->rootDir . $path . '.php'; + + if ( file_exists($path) ) { + include $path; + } + } + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/DebugBar/Extension.php b/plugin-update-checker/Puc/v5p4/DebugBar/Extension.php new file mode 100644 index 0000000..0adb68c --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/DebugBar/Extension.php @@ -0,0 +1,199 @@ +updateChecker = $updateChecker; + if ( isset($panelClass) ) { + $this->panelClass = $panelClass; + } + + if ( (strpos($this->panelClass, '\\') === false) ) { + $this->panelClass = __NAMESPACE__ . '\\' . $this->panelClass; + } + + add_filter('debug_bar_panels', array($this, 'addDebugBarPanel')); + add_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies')); + + add_action('wp_ajax_puc_v5_debug_check_now', array($this, 'ajaxCheckNow')); + } + + /** + * Register the PUC Debug Bar panel. + * + * @param array $panels + * @return array + */ + public function addDebugBarPanel($panels) { + if ( $this->updateChecker->userCanInstallUpdates() ) { + $panels[] = new $this->panelClass($this->updateChecker); + } + return $panels; + } + + /** + * Enqueue our Debug Bar scripts and styles. + */ + public function enqueuePanelDependencies() { + wp_enqueue_style( + 'puc-debug-bar-style-v5', + $this->getLibraryUrl("/css/puc-debug-bar.css"), + array('debug-bar'), + '20221008' + ); + + wp_enqueue_script( + 'puc-debug-bar-js-v5', + $this->getLibraryUrl("/js/debug-bar.js"), + array('jquery'), + '20221008' + ); + } + + /** + * Run an update check and output the result. Useful for making sure that + * the update checking process works as expected. + */ + public function ajaxCheckNow() { + //phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is checked in preAjaxRequest(). + if ( !isset($_POST['uid']) || ($_POST['uid'] !== $this->updateChecker->getUniqueName('uid')) ) { + return; + } + $this->preAjaxRequest(); + $update = $this->updateChecker->checkForUpdates(); + if ( $update !== null ) { + echo "An update is available:"; + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- For debugging output. + echo '
    ', esc_html(print_r($update, true)), '
    '; + } else { + echo 'No updates found.'; + } + + $errors = $this->updateChecker->getLastRequestApiErrors(); + if ( !empty($errors) ) { + printf('

    The update checker encountered %d API error%s.

    ', count($errors), (count($errors) > 1) ? 's' : ''); + + foreach (array_values($errors) as $num => $item) { + $wpError = $item['error']; + /** @var \WP_Error $wpError */ + printf('

    %d) %s

    ', intval($num + 1), esc_html($wpError->get_error_message())); + + echo '
    '; + printf('
    Error code:
    %s
    ', esc_html($wpError->get_error_code())); + + if ( isset($item['url']) ) { + printf('
    Requested URL:
    %s
    ', esc_html($item['url'])); + } + + if ( isset($item['httpResponse']) ) { + if ( is_wp_error($item['httpResponse']) ) { + $httpError = $item['httpResponse']; + /** @var \WP_Error $httpError */ + printf( + '
    WordPress HTTP API error:
    %s (%s)
    ', + esc_html($httpError->get_error_message()), + esc_html($httpError->get_error_code()) + ); + } else { + //Status code. + printf( + '
    HTTP status:
    %d %s
    ', + esc_html(wp_remote_retrieve_response_code($item['httpResponse'])), + esc_html(wp_remote_retrieve_response_message($item['httpResponse'])) + ); + + //Headers. + echo '
    Response headers:
    ';
    +							foreach (wp_remote_retrieve_headers($item['httpResponse']) as $name => $value) {
    +								printf("%s: %s\n", esc_html($name), esc_html($value));
    +							}
    +							echo '
    '; + + //Body. + $body = wp_remote_retrieve_body($item['httpResponse']); + if ( $body === '' ) { + $body = '(Empty response.)'; + } else if ( strlen($body) > self::RESPONSE_BODY_LENGTH_LIMIT ) { + $length = strlen($body); + $body = substr($body, 0, self::RESPONSE_BODY_LENGTH_LIMIT) + . sprintf("\n(Long string truncated. Total length: %d bytes.)", $length); + } + + printf('
    Response body:
    %s
    ', esc_html($body)); + } + } + echo '
    '; + } + } + + exit; + } + + /** + * Check access permissions and enable error display (for debugging). + */ + protected function preAjaxRequest() { + if ( !$this->updateChecker->userCanInstallUpdates() ) { + die('Access denied'); + } + check_ajax_referer('puc-ajax'); + + //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting -- Part of a debugging feature. + error_reporting(E_ALL); + //phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted + @ini_set('display_errors', 'On'); + } + + /** + * Remove hooks that were added by this extension. + */ + public function removeHooks() { + remove_filter('debug_bar_panels', array($this, 'addDebugBarPanel')); + remove_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies')); + remove_action('wp_ajax_puc_v5_debug_check_now', array($this, 'ajaxCheckNow')); + } + + /** + * @param string $filePath + * @return string + */ + private function getLibraryUrl($filePath) { + $absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/')); + + //Where is the library located inside the WordPress directory structure? + $absolutePath = PucFactory::normalizePath($absolutePath); + + $pluginDir = PucFactory::normalizePath(WP_PLUGIN_DIR); + $muPluginDir = PucFactory::normalizePath(WPMU_PLUGIN_DIR); + $themeDir = PucFactory::normalizePath(get_theme_root()); + + if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) { + //It's part of a plugin. + return plugins_url(basename($absolutePath), $absolutePath); + } else if ( strpos($absolutePath, $themeDir) === 0 ) { + //It's part of a theme. + $relativePath = substr($absolutePath, strlen($themeDir) + 1); + $template = substr($relativePath, 0, strpos($relativePath, '/')); + $baseUrl = get_theme_root_uri($template); + + if ( !empty($baseUrl) && $relativePath ) { + return $baseUrl . '/' . $relativePath; + } + } + + return ''; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/DebugBar/Panel.php b/plugin-update-checker/Puc/v5p4/DebugBar/Panel.php new file mode 100644 index 0000000..b846277 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/DebugBar/Panel.php @@ -0,0 +1,178 @@ +'; + + public function __construct($updateChecker) { + $this->updateChecker = $updateChecker; + $title = sprintf( + 'PUC (%s)', + esc_attr($this->updateChecker->getUniqueName('uid')), + $this->updateChecker->slug + ); + parent::__construct($title); + } + + public function render() { + printf( + '
    ', + esc_attr($this->updateChecker->getUniqueName('debug-bar-panel')), + esc_attr($this->updateChecker->slug), + esc_attr($this->updateChecker->getUniqueName('uid')), + esc_attr(wp_create_nonce('puc-ajax')) + ); + + $this->displayConfiguration(); + $this->displayStatus(); + $this->displayCurrentUpdate(); + + echo '
    '; + } + + private function displayConfiguration() { + echo '

    Configuration

    '; + echo ''; + $this->displayConfigHeader(); + $this->row('Slug', htmlentities($this->updateChecker->slug)); + $this->row('DB option', htmlentities($this->updateChecker->optionName)); + + $requestInfoButton = $this->getMetadataButton(); + $this->row('Metadata URL', htmlentities($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $this->responseBox); + + $scheduler = $this->updateChecker->scheduler; + if ( $scheduler->checkPeriod > 0 ) { + $this->row('Automatic checks', 'Every ' . $scheduler->checkPeriod . ' hours'); + } else { + $this->row('Automatic checks', 'Disabled'); + } + + if ( isset($scheduler->throttleRedundantChecks) ) { + if ( $scheduler->throttleRedundantChecks && ($scheduler->checkPeriod > 0) ) { + $this->row( + 'Throttling', + sprintf( + 'Enabled. If an update is already available, check for updates every %1$d hours instead of every %2$d hours.', + $scheduler->throttledCheckPeriod, + $scheduler->checkPeriod + ) + ); + } else { + $this->row('Throttling', 'Disabled'); + } + } + + $this->updateChecker->onDisplayConfiguration($this); + + echo '
    '; + } + + protected function displayConfigHeader() { + //Do nothing. This should be implemented in subclasses. + } + + protected function getMetadataButton() { + return ''; + } + + private function displayStatus() { + echo '

    Status

    '; + echo ''; + $state = $this->updateChecker->getUpdateState(); + $checkNowButton = ''; + if ( function_exists('get_submit_button') ) { + $checkNowButton = get_submit_button( + 'Check Now', + 'secondary', + 'puc-check-now-button', + false, + array('id' => $this->updateChecker->getUniqueName('check-now-button')) + ); + } + + if ( $state->getLastCheck() > 0 ) { + $this->row('Last check', $this->formatTimeWithDelta($state->getLastCheck()) . ' ' . $checkNowButton . $this->responseBox); + } else { + $this->row('Last check', 'Never'); + } + + $nextCheck = wp_next_scheduled($this->updateChecker->scheduler->getCronHookName()); + $this->row('Next automatic check', $this->formatTimeWithDelta($nextCheck)); + + if ( $state->getCheckedVersion() !== '' ) { + $this->row('Checked version', htmlentities($state->getCheckedVersion())); + $this->row('Cached update', $state->getUpdate()); + } + $this->row('Update checker class', htmlentities(get_class($this->updateChecker))); + echo '
    '; + } + + private function displayCurrentUpdate() { + $update = $this->updateChecker->getUpdate(); + if ( $update !== null ) { + echo '

    An Update Is Available

    '; + echo ''; + $fields = $this->getUpdateFields(); + foreach($fields as $field) { + if ( property_exists($update, $field) ) { + $this->row( + ucwords(str_replace('_', ' ', $field)), + isset($update->$field) ? htmlentities($update->$field) : null + ); + } + } + echo '
    '; + } else { + echo '

    No updates currently available

    '; + } + } + + protected function getUpdateFields() { + return array('version', 'download_url', 'slug',); + } + + private function formatTimeWithDelta($unixTime) { + if ( empty($unixTime) ) { + return 'Never'; + } + + $delta = time() - $unixTime; + $result = human_time_diff(time(), $unixTime); + if ( $delta < 0 ) { + $result = 'after ' . $result; + } else { + $result = $result . ' ago'; + } + $result .= ' (' . $this->formatTimestamp($unixTime) . ')'; + return $result; + } + + private function formatTimestamp($unixTime) { + return gmdate('Y-m-d H:i:s', $unixTime + (get_option('gmt_offset') * 3600)); + } + + public function row($name, $value) { + if ( is_object($value) || is_array($value) ) { + //This is specifically for debugging, so print_r() is fine. + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r + $value = '
    ' . htmlentities(print_r($value, true)) . '
    '; + } else if ($value === null) { + $value = 'null'; + } + printf( + '%1$s %2$s', + esc_html($name), + //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. + $value + ); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/DebugBar/PluginExtension.php b/plugin-update-checker/Puc/v5p4/DebugBar/PluginExtension.php new file mode 100644 index 0000000..b30f3ee --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/DebugBar/PluginExtension.php @@ -0,0 +1,40 @@ +updateChecker->getUniqueName('uid')) ) { + return; + } + $this->preAjaxRequest(); + $info = $this->updateChecker->requestInfo(); + if ( $info !== null ) { + echo 'Successfully retrieved plugin info from the metadata URL:'; + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- For debugging output. + echo '
    ', esc_html(print_r($info, true)), '
    '; + } else { + echo 'Failed to retrieve plugin info from the metadata URL.'; + } + exit; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/DebugBar/PluginPanel.php b/plugin-update-checker/Puc/v5p4/DebugBar/PluginPanel.php new file mode 100644 index 0000000..4c1d230 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/DebugBar/PluginPanel.php @@ -0,0 +1,41 @@ +row('Plugin file', htmlentities($this->updateChecker->pluginFile)); + parent::displayConfigHeader(); + } + + protected function getMetadataButton() { + $requestInfoButton = ''; + if ( function_exists('get_submit_button') ) { + $requestInfoButton = get_submit_button( + 'Request Info', + 'secondary', + 'puc-request-info-button', + false, + array('id' => $this->updateChecker->getUniqueName('request-info-button')) + ); + } + return $requestInfoButton; + } + + protected function getUpdateFields() { + return array_merge( + parent::getUpdateFields(), + array('homepage', 'upgrade_notice', 'tested',) + ); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/DebugBar/ThemePanel.php b/plugin-update-checker/Puc/v5p4/DebugBar/ThemePanel.php new file mode 100644 index 0000000..7b9d99a --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/DebugBar/ThemePanel.php @@ -0,0 +1,25 @@ +row('Theme directory', htmlentities($this->updateChecker->directoryName)); + parent::displayConfigHeader(); + } + + protected function getUpdateFields() { + return array_merge(parent::getUpdateFields(), array('details_url')); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/InstalledPackage.php b/plugin-update-checker/Puc/v5p4/InstalledPackage.php new file mode 100644 index 0000000..341e7a3 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/InstalledPackage.php @@ -0,0 +1,105 @@ +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; diff --git a/plugin-update-checker/Puc/v5p4/Metadata.php b/plugin-update-checker/Puc/v5p4/Metadata.php new file mode 100644 index 0000000..2d93d8e --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Metadata.php @@ -0,0 +1,162 @@ + + */ + protected $extraProperties = array(); + + /** + * Create an instance of this class from a JSON document. + * + * @abstract + * @param string $json + * @return self + */ + public static function fromJson($json) { + throw new LogicException('The ' . __METHOD__ . ' method must be implemented by subclasses'); + } + + /** + * @param string $json + * @param self $target + * @return bool + */ + protected static function createFromJson($json, $target) { + /** @var \StdClass $apiResponse */ + $apiResponse = json_decode($json); + if ( empty($apiResponse) || !is_object($apiResponse) ){ + $errorMessage = "Failed to parse update metadata. Try validating your .json file with https://jsonlint.com/"; + do_action('puc_api_error', new WP_Error('puc-invalid-json', $errorMessage)); + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error -- For plugin developers. + trigger_error(esc_html($errorMessage), E_USER_NOTICE); + return false; + } + + $valid = $target->validateMetadata($apiResponse); + if ( is_wp_error($valid) ){ + do_action('puc_api_error', $valid); + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error -- For plugin developers. + trigger_error(esc_html($valid->get_error_message()), E_USER_NOTICE); + return false; + } + + foreach(get_object_vars($apiResponse) as $key => $value){ + $target->$key = $value; + } + + return true; + } + + /** + * No validation by default! Subclasses should check that the required fields are present. + * + * @param \StdClass $apiResponse + * @return bool|\WP_Error + */ + protected function validateMetadata($apiResponse) { + return true; + } + + /** + * Create a new instance by copying the necessary fields from another object. + * + * @abstract + * @param \StdClass|self $object The source object. + * @return self The new copy. + */ + public static function fromObject($object) { + throw new LogicException('The ' . __METHOD__ . ' method must be implemented by subclasses'); + } + + /** + * Create an instance of StdClass that can later be converted back to an + * update or info container. Useful for serialization and caching, as it + * avoids the "incomplete object" problem if the cached value is loaded + * before this class. + * + * @return \StdClass + */ + public function toStdClass() { + $object = new stdClass(); + $this->copyFields($this, $object); + return $object; + } + + /** + * Transform the metadata into the format used by WordPress core. + * + * @return object + */ + abstract public function toWpFormat(); + + /** + * Copy known fields from one object to another. + * + * @param \StdClass|self $from + * @param \StdClass|self $to + */ + protected function copyFields($from, $to) { + $fields = $this->getFieldNames(); + + if ( property_exists($from, 'slug') && !empty($from->slug) ) { + //Let plugins add extra fields without having to create subclasses. + $fields = apply_filters($this->getPrefixedFilter('retain_fields') . '-' . $from->slug, $fields); + } + + foreach ($fields as $field) { + if ( property_exists($from, $field) ) { + $to->$field = $from->$field; + } + } + } + + /** + * @return string[] + */ + protected function getFieldNames() { + return array(); + } + + /** + * @param string $tag + * @return string + */ + protected function getPrefixedFilter($tag) { + return 'puc_' . $tag; + } + + public function __set($name, $value) { + $this->extraProperties[$name] = $value; + } + + public function __get($name) { + return isset($this->extraProperties[$name]) ? $this->extraProperties[$name] : null; + } + + public function __isset($name) { + return isset($this->extraProperties[$name]); + } + + public function __unset($name) { + unset($this->extraProperties[$name]); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/OAuthSignature.php b/plugin-update-checker/Puc/v5p4/OAuthSignature.php new file mode 100644 index 0000000..ccb62b4 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/OAuthSignature.php @@ -0,0 +1,102 @@ +consumerKey = $consumerKey; + $this->consumerSecret = $consumerSecret; + } + + /** + * Sign a URL using OAuth 1.0. + * + * @param string $url The URL to be signed. It may contain query parameters. + * @param string $method HTTP method such as "GET", "POST" and so on. + * @return string The signed URL. + */ + public function sign($url, $method = 'GET') { + $parameters = array(); + + //Parse query parameters. + $query = wp_parse_url($url, PHP_URL_QUERY); + if ( !empty($query) ) { + parse_str($query, $parsedParams); + if ( is_array($parsedParams) ) { + $parameters = $parsedParams; + } + //Remove the query string from the URL. We'll replace it later. + $url = substr($url, 0, strpos($url, '?')); + } + + $parameters = array_merge( + $parameters, + array( + 'oauth_consumer_key' => $this->consumerKey, + 'oauth_nonce' => $this->nonce(), + 'oauth_signature_method' => 'HMAC-SHA1', + 'oauth_timestamp' => time(), + 'oauth_version' => '1.0', + ) + ); + unset($parameters['oauth_signature']); + + //Parameters must be sorted alphabetically before signing. + ksort($parameters); + + //The most complicated part of the request - generating the signature. + //The string to sign contains the HTTP method, the URL path, and all of + //our query parameters. Everything is URL encoded. Then we concatenate + //them with ampersands into a single string to hash. + $encodedVerb = urlencode($method); + $encodedUrl = urlencode($url); + $encodedParams = urlencode(http_build_query($parameters, '', '&')); + + $stringToSign = $encodedVerb . '&' . $encodedUrl . '&' . $encodedParams; + + //Since we only have one OAuth token (the consumer secret) we only have + //to use it as our HMAC key. However, we still have to append an & to it + //as if we were using it with additional tokens. + $secret = urlencode($this->consumerSecret) . '&'; + + //The signature is a hash of the consumer key and the base string. Note + //that we have to get the raw output from hash_hmac and base64 encode + //the binary data result. + $parameters['oauth_signature'] = base64_encode(hash_hmac('sha1', $stringToSign, $secret, true)); + + return ($url . '?' . http_build_query($parameters)); + } + + /** + * Generate a random nonce. + * + * @return string + */ + private function nonce() { + $mt = microtime(); + + $rand = null; + if ( is_callable('random_bytes') ) { + try { + $rand = random_bytes(16); + } catch (\Exception $ex) { + //Fall back to mt_rand (below). + } + } + if ( $rand === null ) { + //phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand + $rand = function_exists('wp_rand') ? wp_rand() : mt_rand(); + } + + return md5($mt . '_' . $rand); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Plugin/Package.php b/plugin-update-checker/Puc/v5p4/Plugin/Package.php new file mode 100644 index 0000000..30deaee --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Plugin/Package.php @@ -0,0 +1,188 @@ +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( + "Cannot 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') ) { + 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 = PucFactory::normalizePath(WPMU_PLUGIN_DIR); + $pluginPath = PucFactory::normalizePath($this->pluginAbsolutePath); + } + + $cachedResult = (strpos($pluginPath, $muPluginDir) === 0); + } + + return $cachedResult; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Plugin/PluginInfo.php b/plugin-update-checker/Puc/v5p4/Plugin/PluginInfo.php new file mode 100644 index 0000000..2428488 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Plugin/PluginInfo.php @@ -0,0 +1,136 @@ +sections = (array)$instance->sections; + $instance->icons = (array)$instance->icons; + + return $instance; + } + + /** + * Very, very basic validation. + * + * @param \StdClass $apiResponse + * @return bool|\WP_Error + */ + protected function validateMetadata($apiResponse) { + if ( + !isset($apiResponse->name, $apiResponse->version) + || empty($apiResponse->name) + || empty($apiResponse->version) + ) { + return new \WP_Error( + 'puc-invalid-metadata', + "The plugin metadata file does not contain the required 'name' and/or 'version' keys." + ); + } + return true; + } + + + /** + * Transform plugin info into the format used by the native WordPress.org API + * + * @return object + */ + public function toWpFormat(){ + $info = new \stdClass; + + //The custom update API is built so that many fields have the same name and format + //as those returned by the native WordPress.org API. These can be assigned directly. + $sameFormat = array( + 'name', 'slug', 'version', 'requires', 'tested', 'rating', 'upgrade_notice', + 'num_ratings', 'downloaded', 'active_installs', 'homepage', 'last_updated', + 'requires_php', + ); + foreach($sameFormat as $field){ + if ( isset($this->$field) ) { + $info->$field = $this->$field; + } else { + $info->$field = null; + } + } + + //Other fields need to be renamed and/or transformed. + $info->download_link = $this->download_url; + $info->author = $this->getFormattedAuthor(); + $info->sections = array_merge(array('description' => ''), $this->sections); + + if ( !empty($this->banners) ) { + //WP expects an array with two keys: "high" and "low". Both are optional. + //Docs: https://wordpress.org/plugins/about/faq/#banners + $info->banners = is_object($this->banners) ? get_object_vars($this->banners) : $this->banners; + $info->banners = array_intersect_key($info->banners, array('high' => true, 'low' => true)); + } + + return $info; + } + + protected function getFormattedAuthor() { + if ( !empty($this->author_homepage) ){ + /** @noinspection HtmlUnknownTarget */ + return sprintf('%s', $this->author_homepage, $this->author); + } + return $this->author; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Plugin/Ui.php b/plugin-update-checker/Puc/v5p4/Plugin/Ui.php new file mode 100644 index 0000000..a9cdbda --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Plugin/Ui.php @@ -0,0 +1,294 @@ +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'; + $lastRequestApiErrors = $this->updateChecker->getLastRequestApiErrors(); + + if ( ($update === null) && !empty($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 ($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, $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() { + //phpcs:disable WordPress.Security.NonceVerification.Recommended -- Just displaying a message. + if ( isset($_GET['puc_update_check_result'], $_GET['puc_slug']) && ($_GET['puc_slug'] == $this->updateChecker->slug) ) { + $status = sanitize_key($_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'), $status); + $noticeClass = 'error notice-error'; + } + + $message = esc_html($message); + + //Plugins can replace the message with their own, including adding HTML. + $message = apply_filters( + $this->updateChecker->getUniqueName('manual_check_message'), + $message, + $status + ); + + printf( + '

    %s

    %s
    ', + esc_attr($noticeClass), + //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Was escaped above, and plugins can add HTML. + $message, + //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Contains HTML. Content should already be escaped. + $details + ); + } + //phpcs:enable + } + + /** + * 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, + esc_html($wpError->get_error_message()), + esc_html($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; diff --git a/plugin-update-checker/Puc/v5p4/Plugin/Update.php b/plugin-update-checker/Puc/v5p4/Plugin/Update.php new file mode 100644 index 0000000..0fb3137 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Plugin/Update.php @@ -0,0 +1,116 @@ +copyFields($object, $update); + return $update; + } + + /** + * @return string[] + */ + protected function getFieldNames() { + return array_merge(parent::getFieldNames(), self::$extraFields); + } + + /** + * Transform the update into the format used by WordPress native plugin API. + * + * @return object + */ + public function toWpFormat() { + $update = parent::toWpFormat(); + + $update->id = $this->id; + $update->url = $this->homepage; + $update->tested = $this->tested; + $update->requires_php = $this->requires_php; + $update->plugin = $this->filename; + + if ( !empty($this->upgrade_notice) ) { + $update->upgrade_notice = $this->upgrade_notice; + } + + if ( !empty($this->icons) && is_array($this->icons) ) { + //This should be an array with up to 4 keys: 'svg', '1x', '2x' and 'default'. + //Docs: https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#plugin-icons + $icons = array_intersect_key( + $this->icons, + array('svg' => true, '1x' => true, '2x' => true, 'default' => true) + ); + if ( !empty($icons) ) { + $update->icons = $icons; + + //It appears that the 'default' icon isn't used anywhere in WordPress 4.9, + //but lets set it just in case a future release needs it. + if ( !isset($update->icons['default']) ) { + $update->icons['default'] = current($update->icons); + } + } + } + + return $update; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Plugin/UpdateChecker.php b/plugin-update-checker/Puc/v5p4/Plugin/UpdateChecker.php new file mode 100644 index 0000000..6d1aae8 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Plugin/UpdateChecker.php @@ -0,0 +1,425 @@ +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.', + $slug, + $slugUsedBy + ), E_USER_ERROR); + } + add_filter($slugCheckFilter, array($this, 'getAbsolutePath')); + + parent::__construct($metadataUrl, dirname($this->pluginFile), $slug, $checkPeriod, $optionName); + + //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->extraUi = new Ui($this); + } + + /** + * Create an instance of the scheduler. + * + * @param int $checkPeriod + * @return Scheduler + */ + protected function createScheduler($checkPeriod) { + $scheduler = new 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 PluginInfo + */ + public function requestInfo($queryArgs = array()) { + list($pluginInfo, $result) = $this->requestMetadata( + PluginInfo::class, + 'request_info', + $queryArgs + ); + + if ( $pluginInfo !== null ) { + /** @var PluginInfo $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 UpdateChecker::requestInfo() + * + * @return 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 = 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(); + $this->fixSupportedWordpressVersion($pluginInfo); + + $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; + } + + protected function getNoUpdateItemFields() { + return array_merge( + parent::getNoUpdateItemFields(), + array( + 'id' => $this->pluginFile, + 'slug' => $this->slug, + 'plugin' => $this->pluginFile, + 'icons' => array(), + 'banners' => array(), + 'banners_rtl' => array(), + 'tested' => '', + 'compatibility' => new \stdClass(), + ) + ); + } + + /** + * 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 Update|null + */ + public function getUpdate() { + $update = parent::getUpdate(); + if ( isset($update) ) { + /** @var 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 DebugBar\PluginExtension($this); + } + + /** + * Create a package instance that represents this plugin or theme. + * + * @return InstalledPackage + */ + protected function createInstalledPackage() { + return new Package($this->pluginAbsolutePath, $this); + } + + /** + * @return Package + */ + public function getInstalledPackage() { + return $this->package; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/PucFactory.php b/plugin-update-checker/Puc/v5p4/PucFactory.php new file mode 100644 index 0000000..b7cbbb1 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/PucFactory.php @@ -0,0 +1,362 @@ + '', + 'slug' => '', + 'checkPeriod' => 12, + 'optionName' => '', + 'muPluginFile' => '', + ); + $args = array_merge($defaults, array_intersect_key($args, $defaults)); + extract($args, EXTR_SKIP); + + //Check for the service URI + if ( empty($metadataUrl) ) { + $metadataUrl = self::getServiceURI($fullPath); + } + + return self::buildUpdateChecker($metadataUrl, $fullPath, $slug, $checkPeriod, $optionName, $muPluginFile); + } + + /** + * Create a new instance of the update checker. + * + * This method automatically detects if you're using it for a plugin or a theme and chooses + * the appropriate implementation for your update source (JSON file, GitHub, BitBucket, etc). + * + * @see UpdateChecker::__construct + * + * @param string $metadataUrl The URL of the metadata file, a GitHub repository, or another supported update source. + * @param string $fullPath Full path to the main plugin file or to the theme directory. + * @param string $slug Custom slug. Defaults to the name of the main plugin file or the theme directory. + * @param int $checkPeriod How often to check for updates (in hours). + * @param string $optionName Where to store bookkeeping info about update checks. + * @param string $muPluginFile The plugin filename relative to the mu-plugins directory. + * @return Plugin\UpdateChecker|Theme\UpdateChecker|Vcs\BaseChecker + */ + public static function buildUpdateChecker($metadataUrl, $fullPath, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '') { + $fullPath = self::normalizePath($fullPath); + $id = null; + + //Plugin or theme? + $themeDirectory = self::getThemeDirectoryName($fullPath); + if ( self::isPluginFile($fullPath) ) { + $type = 'Plugin'; + $id = $fullPath; + } else if ( $themeDirectory !== null ) { + $type = 'Theme'; + $id = $themeDirectory; + } else { + throw new \RuntimeException(sprintf( + 'The update checker cannot determine if "%s" is a plugin or a theme. ' . + 'This is a bug. Please contact the PUC developer.', + htmlentities($fullPath) + )); + } + + //Which hosting service does the URL point to? + $service = self::getVcsService($metadataUrl); + + $apiClass = null; + if ( empty($service) ) { + //The default is to get update information from a remote JSON file. + $checkerClass = $type . '\\UpdateChecker'; + } else { + //You can also use a VCS repository like GitHub. + $checkerClass = 'Vcs\\' . $type . 'UpdateChecker'; + $apiClass = $service . 'Api'; + } + + $checkerClass = self::getCompatibleClassVersion($checkerClass); + if ( $checkerClass === null ) { + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + trigger_error( + esc_html(sprintf( + 'PUC %s does not support updates for %ss %s', + self::$latestCompatibleVersion, + strtolower($type), + $service ? ('hosted on ' . $service) : 'using JSON metadata' + )), + E_USER_ERROR + ); + } + + if ( !isset($apiClass) ) { + //Plain old update checker. + return new $checkerClass($metadataUrl, $id, $slug, $checkPeriod, $optionName, $muPluginFile); + } else { + //VCS checker + an API client. + $apiClass = self::getCompatibleClassVersion($apiClass); + if ( $apiClass === null ) { + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + trigger_error(esc_html(sprintf( + 'PUC %s does not support %s', + self::$latestCompatibleVersion, + $service + )), E_USER_ERROR); + } + + return new $checkerClass( + new $apiClass($metadataUrl), + $id, + $slug, + $checkPeriod, + $optionName, + $muPluginFile + ); + } + } + + /** + * + * Normalize a filesystem path. Introduced in WP 3.9. + * Copying here allows use of the class on earlier versions. + * This version adapted from WP 4.8.2 (unchanged since 4.5.4) + * + * @param string $path Path to normalize. + * @return string Normalized path. + */ + public static function normalizePath($path) { + if ( function_exists('wp_normalize_path') ) { + return wp_normalize_path($path); + } + $path = str_replace('\\', '/', $path); + $path = preg_replace('|(?<=.)/+|', '/', $path); + if ( substr($path, 1, 1) === ':' ) { + $path = ucfirst($path); + } + return $path; + } + + /** + * Check if the path points to a plugin file. + * + * @param string $absolutePath Normalized path. + * @return bool + */ + protected static function isPluginFile($absolutePath) { + //Is the file inside the "plugins" or "mu-plugins" directory? + $pluginDir = self::normalizePath(WP_PLUGIN_DIR); + $muPluginDir = self::normalizePath(WPMU_PLUGIN_DIR); + if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) { + return true; + } + + //Is it a file at all? Caution: is_file() can fail if the parent dir. doesn't have the +x permission set. + if ( !is_file($absolutePath) ) { + return false; + } + + //Does it have a valid plugin header? + //This is a last-ditch check for plugins symlinked from outside the WP root. + if ( function_exists('get_file_data') ) { + $headers = get_file_data($absolutePath, array('Name' => 'Plugin Name'), 'plugin'); + return !empty($headers['Name']); + } + + return false; + } + + /** + * Get the name of the theme's directory from a full path to a file inside that directory. + * E.g. "/abc/public_html/wp-content/themes/foo/whatever.php" => "foo". + * + * Note that subdirectories are currently not supported. For example, + * "/xyz/wp-content/themes/my-theme/includes/whatever.php" => NULL. + * + * @param string $absolutePath Normalized path. + * @return string|null Directory name, or NULL if the path doesn't point to a theme. + */ + protected static function getThemeDirectoryName($absolutePath) { + if ( is_file($absolutePath) ) { + $absolutePath = dirname($absolutePath); + } + + if ( file_exists($absolutePath . '/style.css') ) { + return basename($absolutePath); + } + return null; + } + + /** + * Get the service URI from the file header. + * + * @param string $fullPath + * @return string + */ + private static function getServiceURI($fullPath) { + //Look for the URI + if ( is_readable($fullPath) ) { + $seek = array( + 'github' => 'GitHub URI', + 'gitlab' => 'GitLab URI', + 'bucket' => 'BitBucket URI', + ); + $seek = apply_filters('puc_get_source_uri', $seek); + $data = get_file_data($fullPath, $seek); + foreach ($data as $key => $uri) { + if ( $uri ) { + return $uri; + } + } + } + + //URI was not found so throw an error. + throw new \RuntimeException( + sprintf('Unable to locate URI in header of "%s"', htmlentities($fullPath)) + ); + } + + /** + * Get the name of the hosting service that the URL points to. + * + * @param string $metadataUrl + * @return string|null + */ + private static function getVcsService($metadataUrl) { + $service = null; + + //Which hosting service does the URL point to? + $host = (string)(wp_parse_url($metadataUrl, PHP_URL_HOST)); + $path = (string)(wp_parse_url($metadataUrl, PHP_URL_PATH)); + + //Check if the path looks like "/user-name/repository". + //For GitLab.com it can also be "/user/group1/group2/.../repository". + $repoRegex = '@^/?([^/]+?)/([^/#?&]+?)/?$@'; + if ( $host === 'gitlab.com' ) { + $repoRegex = '@^/?(?:[^/#?&]++/){1,20}(?:[^/#?&]++)/?$@'; + } + if ( preg_match($repoRegex, $path) ) { + $knownServices = array( + 'github.com' => 'GitHub', + 'bitbucket.org' => 'BitBucket', + 'gitlab.com' => 'GitLab', + ); + if ( isset($knownServices[$host]) ) { + $service = $knownServices[$host]; + } + } + + return apply_filters('puc_get_vcs_service', $service, $host, $path, $metadataUrl); + } + + /** + * Get the latest version of the specified class that has the same major version number + * as this factory class. + * + * @param string $class Partial class name. + * @return string|null Full class name. + */ + protected static function getCompatibleClassVersion($class) { + if ( isset(self::$classVersions[$class][self::$latestCompatibleVersion]) ) { + return self::$classVersions[$class][self::$latestCompatibleVersion]; + } + return null; + } + + /** + * Get the specific class name for the latest available version of a class. + * + * @param string $class + * @return null|string + */ + public static function getLatestClassVersion($class) { + if ( !self::$sorted ) { + self::sortVersions(); + } + + if ( isset(self::$classVersions[$class]) ) { + return reset(self::$classVersions[$class]); + } else { + return null; + } + } + + /** + * Sort available class versions in descending order (i.e. newest first). + */ + protected static function sortVersions() { + foreach ( self::$classVersions as $class => $versions ) { + uksort($versions, array(__CLASS__, 'compareVersions')); + self::$classVersions[$class] = $versions; + } + self::$sorted = true; + } + + protected static function compareVersions($a, $b) { + return -version_compare($a, $b); + } + + /** + * Register a version of a class. + * + * @access private This method is only for internal use by the library. + * + * @param string $generalClass Class name without version numbers, e.g. 'PluginUpdateChecker'. + * @param string $versionedClass Actual class name, e.g. 'PluginUpdateChecker_1_2'. + * @param string $version Version number, e.g. '1.2'. + */ + public static function addVersion($generalClass, $versionedClass, $version) { + if ( empty(self::$myMajorVersion) ) { + $lastNamespaceSegment = substr(__NAMESPACE__, strrpos(__NAMESPACE__, '\\') + 1); + self::$myMajorVersion = substr(ltrim($lastNamespaceSegment, 'v'), 0, 1); + } + + //Store the greatest version number that matches our major version. + $components = explode('.', $version); + if ( $components[0] === self::$myMajorVersion ) { + + if ( + empty(self::$latestCompatibleVersion) + || version_compare($version, self::$latestCompatibleVersion, '>') + ) { + self::$latestCompatibleVersion = $version; + } + + } + + if ( !isset(self::$classVersions[$generalClass]) ) { + self::$classVersions[$generalClass] = array(); + } + self::$classVersions[$generalClass][$version] = $versionedClass; + self::$sorted = false; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Scheduler.php b/plugin-update-checker/Puc/v5p4/Scheduler.php new file mode 100644 index 0000000..e4bc3d0 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Scheduler.php @@ -0,0 +1,300 @@ +updateChecker = $updateChecker; + $this->checkPeriod = $checkPeriod; + + //Set up the periodic update checks + $this->cronHook = $this->updateChecker->getUniqueName('cron_check_updates'); + if ( $this->checkPeriod > 0 ){ + + //Trigger the check via Cron. + //Try to use one of the default schedules if possible as it's less likely to conflict + //with other plugins and their custom schedules. + $defaultSchedules = array( + 1 => 'hourly', + 12 => 'twicedaily', + 24 => 'daily', + ); + if ( array_key_exists($this->checkPeriod, $defaultSchedules) ) { + $scheduleName = $defaultSchedules[$this->checkPeriod]; + } else { + //Use a custom cron schedule. + $scheduleName = 'every' . $this->checkPeriod . 'hours'; + //phpcs:ignore WordPress.WP.CronInterval.ChangeDetected -- WPCS fails to parse the callback. + add_filter('cron_schedules', array($this, '_addCustomSchedule')); + } + + if ( !wp_next_scheduled($this->cronHook) && !defined('WP_INSTALLING') ) { + //Randomly offset the schedule to help prevent update server traffic spikes. Without this + //most checks may happen during times of day when people are most likely to install new plugins. + $upperLimit = max($this->checkPeriod * 3600 - 15 * 60, 1); + if ( function_exists('wp_rand') ) { + $randomOffset = wp_rand(0, $upperLimit); + } else { + //This constructor may be called before wp_rand() is available. + //phpcs:ignore WordPress.WP.AlternativeFunctions.rand_rand + $randomOffset = rand(0, $upperLimit); + } + $firstCheckTime = time() - $randomOffset; + $firstCheckTime = apply_filters( + $this->updateChecker->getUniqueName('first_check_time'), + $firstCheckTime + ); + wp_schedule_event($firstCheckTime, $scheduleName, $this->cronHook); + } + add_action($this->cronHook, array($this, 'maybeCheckForUpdates')); + + //In case Cron is disabled or unreliable, we also manually trigger + //the periodic checks while the user is browsing the Dashboard. + add_action( 'admin_init', array($this, 'maybeCheckForUpdates') ); + + //Like WordPress itself, we check more often on certain pages. + /** @see wp_update_plugins */ + add_action('load-update-core.php', array($this, 'maybeCheckForUpdates')); + //phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- Not actually code, just file names. + //"load-update.php" and "load-plugins.php" or "load-themes.php". + $this->hourlyCheckHooks = array_merge($this->hourlyCheckHooks, $hourlyHooks); + foreach($this->hourlyCheckHooks as $hook) { + add_action($hook, array($this, 'maybeCheckForUpdates')); + } + //This hook fires after a bulk update is complete. + add_action('upgrader_process_complete', array($this, 'removeHooksIfLibraryGone'), 1, 0); + add_action('upgrader_process_complete', array($this, 'upgraderProcessComplete'), 11, 2); + + } else { + //Periodic checks are disabled. + wp_clear_scheduled_hook($this->cronHook); + } + } + + /** + * Remove all hooks if this version of PUC has been deleted or overwritten. + * + * Callback for the "upgrader_process_complete" action. + */ + public function removeHooksIfLibraryGone() { + //Cancel all further actions if the current version of PUC has been deleted or overwritten + //by a different version during the upgrade. If we try to do anything more in that situation, + //we could trigger a fatal error by trying to autoload a deleted class. + clearstatcache(); + if ( !file_exists(__FILE__) ) { + $this->removeHooks(); + $this->updateChecker->removeHooks(); + } + } + + /** + * Runs upon the WP action upgrader_process_complete. + * + * We look at the parameters to decide whether to call maybeCheckForUpdates() or not. + * We also check if the update checker has been removed by the update. + * + * @param \WP_Upgrader $upgrader WP_Upgrader instance + * @param array $upgradeInfo extra information about the upgrade + */ + public function upgraderProcessComplete( + /** @noinspection PhpUnusedParameterInspection */ + $upgrader, $upgradeInfo + ) { + //Sanity check and limitation to relevant types. + if ( + !is_array($upgradeInfo) || !isset($upgradeInfo['type'], $upgradeInfo['action']) + || 'update' !== $upgradeInfo['action'] || !in_array($upgradeInfo['type'], array('plugin', 'theme')) + ) { + return; + } + + //Filter out notifications of upgrades that should have no bearing upon whether or not our + //current info is up-to-date. + if ( is_a($this->updateChecker, Theme\UpdateChecker::class) ) { + if ( 'theme' !== $upgradeInfo['type'] || !isset($upgradeInfo['themes']) ) { + return; + } + + //Letting too many things going through for checks is not a real problem, so we compare widely. + if ( !in_array( + strtolower($this->updateChecker->directoryName), + array_map('strtolower', $upgradeInfo['themes']) + ) ) { + return; + } + } + + if ( is_a($this->updateChecker, Plugin\UpdateChecker::class) ) { + if ( 'plugin' !== $upgradeInfo['type'] || !isset($upgradeInfo['plugins']) ) { + return; + } + + //Themes pass in directory names in the information array, but plugins use the relative plugin path. + if ( !in_array( + strtolower($this->updateChecker->directoryName), + array_map('dirname', array_map('strtolower', $upgradeInfo['plugins'])) + ) ) { + return; + } + } + + $this->maybeCheckForUpdates(); + } + + /** + * Check for updates if the configured check interval has already elapsed. + * Will use a shorter check interval on certain admin pages like "Dashboard -> Updates" or when doing cron. + * + * You can override the default behaviour by using the "puc_check_now-$slug" filter. + * The filter callback will be passed three parameters: + * - Current decision. TRUE = check updates now, FALSE = don't check now. + * - Last check time as a Unix timestamp. + * - Configured check period in hours. + * Return TRUE to check for updates immediately, or FALSE to cancel. + * + * This method is declared public because it's a hook callback. Calling it directly is not recommended. + */ + public function maybeCheckForUpdates() { + if ( empty($this->checkPeriod) ){ + return; + } + + $state = $this->updateChecker->getUpdateState(); + $shouldCheck = ($state->timeSinceLastCheck() >= $this->getEffectiveCheckPeriod()); + + if ( $shouldCheck ) { + //Sanity check: Do not proceed if one of the critical classes is missing. + //That can happen - theoretically and extremely rarely - if maybeCheckForUpdates() + //is called before the old version of our plugin has been fully deleted, or + //called from an independent AJAX request during deletion. + if ( !( + class_exists(Utils::class) + && class_exists(Metadata::class) + && class_exists(Plugin\Update::class) + && class_exists(Theme\Update::class) + ) ) { + return; + } + } + + //Let plugin authors substitute their own algorithm. + $shouldCheck = apply_filters( + $this->updateChecker->getUniqueName('check_now'), + $shouldCheck, + $state->getLastCheck(), + $this->checkPeriod + ); + + if ( $shouldCheck ) { + $this->updateChecker->checkForUpdates(); + } + } + + /** + * Calculate the actual check period based on the current status and environment. + * + * @return int Check period in seconds. + */ + protected function getEffectiveCheckPeriod() { + $currentFilter = current_filter(); + if ( in_array($currentFilter, array('load-update-core.php', 'upgrader_process_complete')) ) { + //Check more often when the user visits "Dashboard -> Updates" or does a bulk update. + $period = 60; + } else if ( in_array($currentFilter, $this->hourlyCheckHooks) ) { + //Also check more often on /wp-admin/update.php and the "Plugins" or "Themes" page. + $period = 3600; + } else if ( $this->throttleRedundantChecks && ($this->updateChecker->getUpdate() !== null) ) { + //Check less frequently if it's already known that an update is available. + $period = $this->throttledCheckPeriod * 3600; + } else if ( defined('DOING_CRON') && constant('DOING_CRON') ) { + //WordPress cron schedules are not exact, so let's do an update check even + //if slightly less than $checkPeriod hours have elapsed since the last check. + $cronFuzziness = 20 * 60; + $period = $this->checkPeriod * 3600 - $cronFuzziness; + } else { + $period = $this->checkPeriod * 3600; + } + + return $period; + } + + /** + * Add our custom schedule to the array of Cron schedules used by WP. + * + * @param array $schedules + * @return array + */ + public function _addCustomSchedule($schedules) { + if ( $this->checkPeriod && ($this->checkPeriod > 0) ){ + $scheduleName = 'every' . $this->checkPeriod . 'hours'; + $schedules[$scheduleName] = array( + 'interval' => $this->checkPeriod * 3600, + 'display' => sprintf('Every %d hours', $this->checkPeriod), + ); + } + return $schedules; + } + + /** + * Remove the scheduled cron event that the library uses to check for updates. + * + * @return void + */ + public function removeUpdaterCron() { + wp_clear_scheduled_hook($this->cronHook); + } + + /** + * Get the name of the update checker's WP-cron hook. Mostly useful for debugging. + * + * @return string + */ + public function getCronHookName() { + return $this->cronHook; + } + + /** + * Remove most hooks added by the scheduler. + */ + public function removeHooks() { + remove_filter('cron_schedules', array($this, '_addCustomSchedule')); + remove_action('admin_init', array($this, 'maybeCheckForUpdates')); + remove_action('load-update-core.php', array($this, 'maybeCheckForUpdates')); + + if ( $this->cronHook !== null ) { + remove_action($this->cronHook, array($this, 'maybeCheckForUpdates')); + } + if ( !empty($this->hourlyCheckHooks) ) { + foreach ($this->hourlyCheckHooks as $hook) { + remove_action($hook, array($this, 'maybeCheckForUpdates')); + } + } + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/StateStore.php b/plugin-update-checker/Puc/v5p4/StateStore.php new file mode 100644 index 0000000..3828c1c --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/StateStore.php @@ -0,0 +1,214 @@ +optionName = $optionName; + } + + /** + * Get time elapsed since the last update check. + * + * If there are no recorded update checks, this method returns a large arbitrary number + * (i.e. time since the Unix epoch). + * + * @return int Elapsed time in seconds. + */ + public function timeSinceLastCheck() { + $this->lazyLoad(); + return time() - $this->lastCheck; + } + + /** + * @return int + */ + public function getLastCheck() { + $this->lazyLoad(); + return $this->lastCheck; + } + + /** + * Set the time of the last update check to the current timestamp. + * + * @return $this + */ + public function setLastCheckToNow() { + $this->lazyLoad(); + $this->lastCheck = time(); + return $this; + } + + /** + * @return null|Update + */ + public function getUpdate() { + $this->lazyLoad(); + return $this->update; + } + + /** + * @param Update|null $update + * @return $this + */ + public function setUpdate(Update $update = null) { + $this->lazyLoad(); + $this->update = $update; + return $this; + } + + /** + * @return string + */ + public function getCheckedVersion() { + $this->lazyLoad(); + return $this->checkedVersion; + } + + /** + * @param string $version + * @return $this + */ + public function setCheckedVersion($version) { + $this->lazyLoad(); + $this->checkedVersion = strval($version); + return $this; + } + + /** + * Get translation updates. + * + * @return array + */ + public function getTranslations() { + $this->lazyLoad(); + if ( isset($this->update, $this->update->translations) ) { + return $this->update->translations; + } + return array(); + } + + /** + * Set translation updates. + * + * @param array $translationUpdates + */ + public function setTranslations($translationUpdates) { + $this->lazyLoad(); + if ( isset($this->update) ) { + $this->update->translations = $translationUpdates; + $this->save(); + } + } + + public function save() { + $state = new \stdClass(); + + $state->lastCheck = $this->lastCheck; + $state->checkedVersion = $this->checkedVersion; + + if ( isset($this->update)) { + $state->update = $this->update->toStdClass(); + + $updateClass = get_class($this->update); + $state->updateClass = $updateClass; + $prefix = $this->getLibPrefix(); + if ( Utils::startsWith($updateClass, $prefix) ) { + $state->updateBaseClass = substr($updateClass, strlen($prefix)); + } + } + + update_site_option($this->optionName, $state); + $this->isLoaded = true; + } + + /** + * @return $this + */ + public function lazyLoad() { + if ( !$this->isLoaded ) { + $this->load(); + } + return $this; + } + + protected function load() { + $this->isLoaded = true; + + $state = get_site_option($this->optionName, null); + + if ( + !is_object($state) + //Sanity check: If the Utils class is missing, the plugin is probably in the process + //of being deleted (e.g. the old version gets deleted during an update). + || !class_exists(Utils::class) + ) { + $this->lastCheck = 0; + $this->checkedVersion = ''; + $this->update = null; + return; + } + + $this->lastCheck = intval(Utils::get($state, 'lastCheck', 0)); + $this->checkedVersion = Utils::get($state, 'checkedVersion', ''); + $this->update = null; + + if ( isset($state->update) ) { + //This mess is due to the fact that the want the update class from this version + //of the library, not the version that saved the update. + + $updateClass = null; + if ( isset($state->updateBaseClass) ) { + $updateClass = $this->getLibPrefix() . $state->updateBaseClass; + } else if ( isset($state->updateClass) ) { + $updateClass = $state->updateClass; + } + + $factory = array($updateClass, 'fromObject'); + if ( ($updateClass !== null) && is_callable($factory) ) { + $this->update = call_user_func($factory, $state->update); + } + } + } + + public function delete() { + delete_site_option($this->optionName); + + $this->lastCheck = 0; + $this->checkedVersion = ''; + $this->update = null; + } + + private function getLibPrefix() { + //This assumes that the current class is at the top of the versioned namespace. + return __NAMESPACE__ . '\\'; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Theme/Package.php b/plugin-update-checker/Puc/v5p4/Theme/Package.php new file mode 100644 index 0000000..0b20702 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Theme/Package.php @@ -0,0 +1,69 @@ +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; diff --git a/plugin-update-checker/Puc/v5p4/Theme/Update.php b/plugin-update-checker/Puc/v5p4/Theme/Update.php new file mode 100644 index 0000000..0a69fd6 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Theme/Update.php @@ -0,0 +1,88 @@ + $this->slug, + 'new_version' => $this->version, + 'url' => $this->details_url, + ); + + if ( !empty($this->download_url) ) { + $update['package'] = $this->download_url; + } + + return $update; + } + + /** + * Create a new instance of Theme_Update from its JSON-encoded representation. + * + * @param string $json Valid JSON string representing a theme information object. + * @return self New instance of ThemeUpdate, or NULL on error. + */ + public static function fromJson($json) { + $instance = new self(); + if ( !parent::createFromJson($json, $instance) ) { + return null; + } + return $instance; + } + + /** + * Create a new instance by copying the necessary fields from another object. + * + * @param \StdClass|self $object The source object. + * @return self The new copy. + */ + public static function fromObject($object) { + $update = new self(); + $update->copyFields($object, $update); + return $update; + } + + /** + * Basic validation. + * + * @param \StdClass $apiResponse + * @return bool|\WP_Error + */ + protected function validateMetadata($apiResponse) { + $required = array('version', 'details_url'); + foreach($required as $key) { + if ( !isset($apiResponse->$key) || empty($apiResponse->$key) ) { + return new \WP_Error( + 'tuc-invalid-metadata', + sprintf('The theme metadata is missing the required "%s" key.', $key) + ); + } + } + return true; + } + + protected function getFieldNames() { + return array_merge(parent::getFieldNames(), self::$extraFields); + } + + protected function getPrefixedFilter($tag) { + return parent::getPrefixedFilter($tag) . '_theme'; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Theme/UpdateChecker.php b/plugin-update-checker/Puc/v5p4/Theme/UpdateChecker.php new file mode 100644 index 0000000..80481e6 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Theme/UpdateChecker.php @@ -0,0 +1,159 @@ +stylesheet = $stylesheet; + + parent::__construct( + $metadataUrl, + $stylesheet, + $customSlug ? $customSlug : $stylesheet, + $checkPeriod, + $optionName + ); + } + + /** + * For themes, the update array is indexed by theme directory name. + * + * @return string + */ + protected function getUpdateListKey() { + return $this->directoryName; + } + + /** + * Retrieve the latest update (if any) from the configured API endpoint. + * + * @return Update|null An instance of Update, or NULL when no updates are available. + */ + public function requestUpdate() { + list($themeUpdate, $result) = $this->requestMetadata(Update::class, 'request_update'); + + if ( $themeUpdate !== null ) { + /** @var Update $themeUpdate */ + $themeUpdate->slug = $this->slug; + } + + $themeUpdate = $this->filterUpdateResult($themeUpdate, $result); + return $themeUpdate; + } + + protected function getNoUpdateItemFields() { + return array_merge( + parent::getNoUpdateItemFields(), + array( + 'theme' => $this->directoryName, + 'requires' => '', + ) + ); + } + + public function userCanInstallUpdates() { + return current_user_can('update_themes'); + } + + /** + * Create an instance of the scheduler. + * + * @param int $checkPeriod + * @return Scheduler + */ + protected function createScheduler($checkPeriod) { + return new Scheduler($this, $checkPeriod, array('load-themes.php')); + } + + /** + * Is there an update being installed right now for this theme? + * + * @param \WP_Upgrader|null $upgrader The upgrader that's performing the current update. + * @return bool + */ + public function isBeingUpgraded($upgrader = null) { + return $this->upgraderStatus->isThemeBeingUpgraded($this->stylesheet, $upgrader); + } + + protected function createDebugBarExtension() { + return new DebugBar\Extension($this, DebugBar\ThemePanel::class); + } + + /** + * 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. + * + * @param callable $callback + * @return void + */ + public function addQueryArgFilter($callback){ + $this->addFilter('request_update_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_update_options', $callback); + } + + /** + * Register a callback for filtering theme updates retrieved from the external API. + * + * The callback function should take two arguments. If the theme update was retrieved + * successfully, the first argument passed will be an instance of Theme_Update. 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 Theme_Update 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_update_result', $callback, 10, 2); + } + + /** + * Create a package instance that represents this plugin or theme. + * + * @return InstalledPackage + */ + protected function createInstalledPackage() { + return new Package($this->stylesheet, $this); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Update.php b/plugin-update-checker/Puc/v5p4/Update.php new file mode 100644 index 0000000..6c58510 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Update.php @@ -0,0 +1,38 @@ +slug = $this->slug; + $update->new_version = $this->version; + $update->package = $this->download_url; + + return $update; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/UpdateChecker.php b/plugin-update-checker/Puc/v5p4/UpdateChecker.php new file mode 100644 index 0000000..8833547 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/UpdateChecker.php @@ -0,0 +1,1029 @@ +debugMode = (bool)(constant('WP_DEBUG')); + $this->metadataUrl = $metadataUrl; + $this->directoryName = $directoryName; + $this->slug = !empty($slug) ? $slug : $this->directoryName; + + $this->optionName = $optionName; + if ( empty($this->optionName) ) { + //BC: Initially the library only supported plugin updates and didn't use type prefixes + //in the option name. Lets use the same prefix-less name when possible. + if ( $this->filterSuffix === '' ) { + $this->optionName = 'external_updates-' . $this->slug; + } else { + $this->optionName = $this->getUniqueName('external_updates'); + } + } + + if ( empty($this->translationType) ) { + $this->translationType = $this->componentType; + } + + $this->package = $this->createInstalledPackage(); + $this->scheduler = $this->createScheduler($checkPeriod); + $this->upgraderStatus = new UpgraderStatus(); + $this->updateState = new StateStore($this->optionName); + + if ( did_action('init') ) { + $this->loadTextDomain(); + } else { + add_action('init', array($this, 'loadTextDomain')); + } + + $this->installHooks(); + + if ( ($this->wpCliCheckTrigger === null) && defined('WP_CLI') ) { + $this->wpCliCheckTrigger = new WpCliCheckTrigger($this->componentType, $this->scheduler); + } + } + + /** + * @internal + */ + public function loadTextDomain() { + //We're not using load_plugin_textdomain() or its siblings because figuring out where + //the library is located (plugin, mu-plugin, theme, custom wp-content paths) is messy. + $domain = 'plugin-update-checker'; + $locale = apply_filters( + 'plugin_locale', + (is_admin() && function_exists('get_user_locale')) ? get_user_locale() : get_locale(), + $domain + ); + + $moFile = $domain . '-' . $locale . '.mo'; + $path = realpath(dirname(__FILE__) . '/../../languages'); + + if ($path && file_exists($path)) { + load_textdomain($domain, $path . '/' . $moFile); + } + } + + protected function installHooks() { + //Insert our update info into the update array maintained by WP. + add_filter('site_transient_' . $this->updateTransient, array($this,'injectUpdate')); + + //Insert translation updates into the update list. + add_filter('site_transient_' . $this->updateTransient, array($this, 'injectTranslationUpdates')); + + //Clear translation updates when WP clears the update cache. + //This needs to be done directly because the library doesn't actually remove obsolete plugin updates, + //it just hides them (see getUpdate()). We can't do that with translations - too much disk I/O. + add_action( + 'delete_site_transient_' . $this->updateTransient, + array($this, 'clearCachedTranslationUpdates') + ); + + //Rename the update directory to be the same as the existing directory. + if ( $this->directoryName !== '.' ) { + add_filter('upgrader_source_selection', array($this, 'fixDirectoryName'), 10, 3); + } + + //Allow HTTP requests to the metadata URL even if it's on a local host. + add_filter('http_request_host_is_external', array($this, 'allowMetadataHost'), 10, 2); + + //DebugBar integration. + if ( did_action('plugins_loaded') ) { + $this->maybeInitDebugBar(); + } else { + add_action('plugins_loaded', array($this, 'maybeInitDebugBar')); + } + } + + /** + * Remove hooks that were added by this update checker instance. + */ + public function removeHooks() { + remove_filter('site_transient_' . $this->updateTransient, array($this,'injectUpdate')); + remove_filter('site_transient_' . $this->updateTransient, array($this, 'injectTranslationUpdates')); + remove_action( + 'delete_site_transient_' . $this->updateTransient, + array($this, 'clearCachedTranslationUpdates') + ); + + remove_filter('upgrader_source_selection', array($this, 'fixDirectoryName'), 10); + remove_filter('http_request_host_is_external', array($this, 'allowMetadataHost'), 10); + remove_action('plugins_loaded', array($this, 'maybeInitDebugBar')); + + remove_action('init', array($this, 'loadTextDomain')); + + if ( $this->scheduler ) { + $this->scheduler->removeHooks(); + } + + if ( $this->debugBarExtension ) { + $this->debugBarExtension->removeHooks(); + } + } + + /** + * Check if the current user has the required permissions to install updates. + * + * @return bool + */ + abstract public function userCanInstallUpdates(); + + /** + * Explicitly allow HTTP requests to the metadata URL. + * + * WordPress has a security feature where the HTTP API will reject all requests that are sent to + * another site hosted on the same server as the current site (IP match), a local host, or a local + * IP, unless the host exactly matches the current site. + * + * This feature is opt-in (at least in WP 4.4). Apparently some people enable it. + * + * That can be a problem when you're developing your plugin and you decide to host the update information + * on the same server as your test site. Update requests will mysteriously fail. + * + * We fix that by adding an exception for the metadata host. + * + * @param bool $allow + * @param string $host + * @return bool + */ + public function allowMetadataHost($allow, $host) { + if ( $this->cachedMetadataHost === 0 ) { + $this->cachedMetadataHost = wp_parse_url($this->metadataUrl, PHP_URL_HOST); + } + + if ( is_string($this->cachedMetadataHost) && (strtolower($host) === strtolower($this->cachedMetadataHost)) ) { + return true; + } + return $allow; + } + + /** + * Create a package instance that represents this plugin or theme. + * + * @return InstalledPackage + */ + abstract protected function createInstalledPackage(); + + /** + * @return InstalledPackage + */ + public function getInstalledPackage() { + return $this->package; + } + + /** + * Create an instance of the scheduler. + * + * This is implemented as a method to make it possible for plugins to subclass the update checker + * and substitute their own scheduler. + * + * @param int $checkPeriod + * @return Scheduler + */ + abstract protected function createScheduler($checkPeriod); + + /** + * Check for updates. The results are stored in the DB option specified in $optionName. + * + * @return Update|null + */ + public function checkForUpdates() { + $installedVersion = $this->getInstalledVersion(); + //Fail silently if we can't find the plugin/theme or read its header. + if ( $installedVersion === null ) { + $this->triggerError( + sprintf('Skipping update check for %s - installed version unknown.', $this->slug), + E_USER_WARNING + ); + return null; + } + + //Start collecting API errors. + $this->lastRequestApiErrors = array(); + add_action('puc_api_error', array($this, 'collectApiErrors'), 10, 4); + + $state = $this->updateState; + $state->setLastCheckToNow() + ->setCheckedVersion($installedVersion) + ->save(); //Save before checking in case something goes wrong + + $state->setUpdate($this->requestUpdate()); + $state->save(); + + //Stop collecting API errors. + remove_action('puc_api_error', array($this, 'collectApiErrors'), 10); + + return $this->getUpdate(); + } + + /** + * Load the update checker state from the DB. + * + * @return StateStore + */ + public function getUpdateState() { + return $this->updateState->lazyLoad(); + } + + /** + * Reset update checker state - i.e. last check time, cached update data and so on. + * + * Call this when your plugin is being uninstalled, or if you want to + * clear the update cache. + */ + public function resetUpdateState() { + $this->updateState->delete(); + } + + /** + * 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 Update|null + */ + public function getUpdate() { + $update = $this->updateState->getUpdate(); + + //Is there an update available? + if ( isset($update) ) { + //Check if the update is actually newer than the currently installed version. + $installedVersion = $this->getInstalledVersion(); + if ( ($installedVersion !== null) && version_compare($update->version, $installedVersion, '>') ){ + return $update; + } + } + return null; + } + + /** + * Retrieve the latest update (if any) from the configured API endpoint. + * + * Subclasses should run the update through filterUpdateResult before returning it. + * + * @return Update An instance of Update, or NULL when no updates are available. + */ + abstract public function requestUpdate(); + + /** + * Filter the result of a requestUpdate() call. + * + * @template T of Update + * @param T|null $update + * @param array|WP_Error|null $httpResult The value returned by wp_remote_get(), if any. + * @return T + */ + 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); + } + + 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 Metadata|null $update + */ + protected function fixSupportedWordpressVersion(Metadata $update = null) { + if ( !isset($update->tested) || !preg_match('/^\d++\.\d++$/', $update->tested) ) { + return; + } + + $actualWpVersions = array(); + + $wpVersion = $GLOBALS['wp_version']; + + if ( function_exists('get_core_updates') ) { + $coreUpdates = get_core_updates(); + if ( is_array($coreUpdates) ) { + foreach ($coreUpdates as $coreUpdate) { + if ( isset($coreUpdate->current) ) { + $actualWpVersions[] = $coreUpdate->current; + } + } + } + } + + $actualWpVersions[] = $wpVersion; + + $actualWpPatchNumber = null; + foreach ($actualWpVersions as $version) { + if ( preg_match('/^(?P\d++\.\d++)(?:\.(?P\d++))?/', $version, $versionParts) ) { + if ( $versionParts['majorMinor'] === $update->tested ) { + $patch = isset($versionParts['patch']) ? intval($versionParts['patch']) : 0; + if ( $actualWpPatchNumber === null ) { + $actualWpPatchNumber = $patch; + } else { + $actualWpPatchNumber = max($actualWpPatchNumber, $patch); + } + } + } + } + if ( $actualWpPatchNumber === null ) { + $actualWpPatchNumber = 999; + } + + if ( $actualWpPatchNumber > 0 ) { + $update->tested .= '.' . $actualWpPatchNumber; + } + } + + /** + * Get the currently installed version of the plugin or theme. + * + * @return string|null Version number. + */ + public function getInstalledVersion() { + return $this->package->getInstalledVersion(); + } + + /** + * Get the full path of the plugin or theme directory. + * + * @return string + */ + public function getAbsoluteDirectoryPath() { + return $this->package->getAbsoluteDirectoryPath(); + } + + /** + * Trigger a PHP error, but only when $debugMode is enabled. + * + * @param string $message + * @param int $errorType + */ + public function triggerError($message, $errorType) { + if ( $this->isDebugModeEnabled() ) { + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error -- Only happens in debug mode. + trigger_error(esc_html($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. + * + * This method adds the "puc_" prefix and the "-$slug" suffix to the filter name. + * For example, "pre_inject_update" becomes "puc_pre_inject_update-plugin-slug". + * + * @param string $baseTag + * @return string + */ + public function getUniqueName($baseTag) { + $name = 'puc_' . $baseTag; + if ( $this->filterSuffix !== '' ) { + $name .= '_' . $this->filterSuffix; + } + return $name . '-' . $this->slug; + } + + /** + * Store API errors that are generated when checking for updates. + * + * @internal + * @param \WP_Error $error + * @param array|null $httpResponse + * @param string|null $url + * @param string|null $slug + */ + public function collectApiErrors($error, $httpResponse = null, $url = null, $slug = null) { + if ( isset($slug) && ($slug !== $this->slug) ) { + return; + } + + $this->lastRequestApiErrors[] = array( + 'error' => $error, + 'httpResponse' => $httpResponse, + 'url' => $url, + ); + } + + /** + * @return array + */ + public function getLastRequestApiErrors() { + return $this->lastRequestApiErrors; + } + + /* ------------------------------------------------------------------- + * PUC filters and filter utilities + * ------------------------------------------------------------------- + */ + + /** + * Register a callback for one of the update checker filters. + * + * Identical to add_filter(), except it automatically adds the "puc_" prefix + * and the "-$slug" suffix to the filter name. For example, "request_info_result" + * becomes "puc_request_info_result-your_plugin_slug". + * + * @param string $tag + * @param callable $callback + * @param int $priority + * @param int $acceptedArgs + */ + public function addFilter($tag, $callback, $priority = 10, $acceptedArgs = 1) { + add_filter($this->getUniqueName($tag), $callback, $priority, $acceptedArgs); + } + + /* ------------------------------------------------------------------- + * Inject updates + * ------------------------------------------------------------------- + */ + + /** + * Insert the latest update (if any) into the update list maintained by WP. + * + * @param \stdClass $updates Update list. + * @return \stdClass Modified update list. + */ + public function injectUpdate($updates) { + //Is there an update to insert? + $update = $this->getUpdate(); + + if ( !$this->shouldShowUpdates() ) { + $update = null; + } + + if ( !empty($update) ) { + //Let plugins filter the update info before it's passed on to WordPress. + $update = apply_filters($this->getUniqueName('pre_inject_update'), $update); + $updates = $this->addUpdateToList($updates, $update->toWpFormat()); + } else { + //Clean up any stale update info. + $updates = $this->removeUpdateFromList($updates); + //Add a placeholder item to the "no_update" list to enable auto-update support. + //If we don't do this, the option to enable automatic updates will only show up + //when an update is available. + $updates = $this->addNoUpdateItem($updates); + } + + return $updates; + } + + /** + * @param \stdClass|null $updates + * @param \stdClass|array $updateToAdd + * @return \stdClass + */ + protected function addUpdateToList($updates, $updateToAdd) { + if ( !is_object($updates) ) { + $updates = new stdClass(); + $updates->response = array(); + } + + $updates->response[$this->getUpdateListKey()] = $updateToAdd; + return $updates; + } + + /** + * @param \stdClass|null $updates + * @return \stdClass|null + */ + protected function removeUpdateFromList($updates) { + if ( isset($updates, $updates->response) ) { + unset($updates->response[$this->getUpdateListKey()]); + } + return $updates; + } + + /** + * See this post for more information: + * @link https://make.wordpress.org/core/2020/07/30/recommended-usage-of-the-updates-api-to-support-the-auto-updates-ui-for-plugins-and-themes-in-wordpress-5-5/ + * + * @param \stdClass|null $updates + * @return \stdClass + */ + protected function addNoUpdateItem($updates) { + if ( !is_object($updates) ) { + $updates = new stdClass(); + $updates->response = array(); + $updates->no_update = array(); + } else if ( !isset($updates->no_update) ) { + $updates->no_update = array(); + } + + $updates->no_update[$this->getUpdateListKey()] = (object) $this->getNoUpdateItemFields(); + + return $updates; + } + + /** + * Subclasses should override this method to add fields that are specific to plugins or themes. + * @return array + */ + protected function getNoUpdateItemFields() { + return array( + 'new_version' => $this->getInstalledVersion(), + 'url' => '', + 'package' => '', + 'requires_php' => '', + ); + } + + /** + * Get the key that will be used when adding updates to the update list that's maintained + * by the WordPress core. The list is always an associative array, but the key is different + * for plugins and themes. + * + * @return string + */ + abstract protected function getUpdateListKey(); + + /** + * Should we show available updates? + * + * Usually the answer is "yes", but there are exceptions. For example, WordPress doesn't + * support automatic updates installation for mu-plugins, so PUC usually won't show update + * notifications in that case. See the plugin-specific subclass for details. + * + * Note: This method only applies to updates that are displayed (or not) in the WordPress + * admin. It doesn't affect APIs like requestUpdate and getUpdate. + * + * @return bool + */ + protected function shouldShowUpdates() { + return true; + } + + /* ------------------------------------------------------------------- + * JSON-based update API + * ------------------------------------------------------------------- + */ + + /** + * Retrieve plugin or theme metadata from the JSON document at $this->metadataUrl. + * + * @param class-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 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()). + $queryArgs = array_merge( + array( + 'installed_version' => strval($this->getInstalledVersion()), + 'php' => phpversion(), + 'locale' => get_locale(), + ), + $queryArgs + ); + $queryArgs = apply_filters($this->getUniqueName($filterRoot . '_query_args'), $queryArgs); + + //Various options for the wp_remote_get() call. Plugins can filter these, too. + $options = array( + 'timeout' => wp_doing_cron() ? 10 : 3, + 'headers' => array( + 'Accept' => 'application/json', + ), + ); + $options = apply_filters($this->getUniqueName($filterRoot . '_options'), $options); + + //The metadata file should be at 'http://your-api.com/url/here/$slug/info.json' + $url = $this->metadataUrl; + if ( !empty($queryArgs) ){ + $url = add_query_arg($queryArgs, $url); + } + + $result = wp_remote_get($url, $options); + + $result = apply_filters($this->getUniqueName('request_metadata_http_result'), $result, $url, $options); + + //Try to parse the response + $status = $this->validateApiResponse($result); + $metadata = null; + if ( !is_wp_error($status) ){ + if ( (strpos($metaClass, '\\') === false) ) { + $metaClass = __NAMESPACE__ . '\\' . $metaClass; + } + $metadata = call_user_func(array($metaClass, 'fromJson'), $result['body']); + } else { + do_action('puc_api_error', $status, $result, $url, $this->slug); + $this->triggerError( + sprintf('The URL %s does not point to a valid metadata file. ', $url) + . $status->get_error_message(), + E_USER_WARNING + ); + } + + return array($metadata, $result); + } + + /** + * Check if $result is a successful update API response. + * + * @param array|WP_Error $result + * @return true|WP_Error + */ + protected function validateApiResponse($result) { + if ( is_wp_error($result) ) { /** @var WP_Error $result */ + return new WP_Error($result->get_error_code(), 'WP HTTP Error: ' . $result->get_error_message()); + } + + if ( !isset($result['response']['code']) ) { + return new WP_Error( + 'puc_no_response_code', + 'wp_remote_get() returned an unexpected result.' + ); + } + + if ( $result['response']['code'] !== 200 ) { + return new WP_Error( + 'puc_unexpected_response_code', + 'HTTP response code is ' . $result['response']['code'] . ' (expected: 200)' + ); + } + + if ( empty($result['body']) ) { + return new WP_Error('puc_empty_response', 'The metadata file appears to be empty.'); + } + + return true; + } + + /* ------------------------------------------------------------------- + * Language packs / Translation updates + * ------------------------------------------------------------------- + */ + + /** + * Filter a list of translation updates and return a new list that contains only updates + * that apply to the current site. + * + * @param array $translations + * @return array + */ + protected function filterApplicableTranslations($translations) { + $languages = array_flip(array_values(get_available_languages())); + $installedTranslations = $this->getInstalledTranslations(); + + $applicableTranslations = array(); + 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? + if ( isset($installedTranslations[$translation->language]) ) { + $updateTimestamp = strtotime($translation->updated); + $installedTimestamp = strtotime($installedTranslations[$translation->language]['PO-Revision-Date']); + $isApplicable = $updateTimestamp > $installedTimestamp; + } + + if ( $isApplicable ) { + $applicableTranslations[] = $translation; + } + } + + return $applicableTranslations; + } + + /** + * Get a list of installed translations for this plugin or theme. + * + * @return array + */ + protected function getInstalledTranslations() { + if ( !function_exists('wp_get_installed_translations') ) { + return array(); + } + $installedTranslations = wp_get_installed_translations($this->translationType . 's'); + if ( isset($installedTranslations[$this->directoryName]) ) { + $installedTranslations = $installedTranslations[$this->directoryName]; + } else { + $installedTranslations = array(); + } + return $installedTranslations; + } + + /** + * Insert translation updates into the list maintained by WordPress. + * + * @param stdClass $updates + * @return stdClass + */ + public function injectTranslationUpdates($updates) { + $translationUpdates = $this->getTranslationUpdates(); + if ( empty($translationUpdates) ) { + return $updates; + } + + //Being defensive. + if ( !is_object($updates) ) { + $updates = new stdClass(); + } + if ( !isset($updates->translations) ) { + $updates->translations = array(); + } + + //In case there's a name collision with a plugin or theme hosted on wordpress.org, + //remove any preexisting updates that match our thing. + $updates->translations = array_values(array_filter( + $updates->translations, + array($this, 'isNotMyTranslation') + )); + + //Add our updates to the list. + foreach($translationUpdates as $update) { + $convertedUpdate = array_merge( + array( + 'type' => $this->translationType, + 'slug' => $this->directoryName, + 'autoupdate' => 0, + //AFAICT, WordPress doesn't actually use the "version" field for anything. + //But lets make sure it's there, just in case. + 'version' => isset($update->version) ? $update->version : ('1.' . strtotime($update->updated)), + ), + (array)$update + ); + + $updates->translations[] = $convertedUpdate; + } + + return $updates; + } + + /** + * Get a list of available translation updates. + * + * This method will return an empty array if there are no updates. + * Uses cached update data. + * + * @return array + */ + public function getTranslationUpdates() { + return $this->updateState->getTranslations(); + } + + /** + * Remove all cached translation updates. + * + * @see wp_clean_update_cache + */ + public function clearCachedTranslationUpdates() { + $this->updateState->setTranslations(array()); + } + + /** + * Filter callback. Keeps only translations that *don't* match this plugin or theme. + * + * @param array $translation + * @return bool + */ + protected function isNotMyTranslation($translation) { + $isMatch = isset($translation['type'], $translation['slug']) + && ($translation['type'] === $this->translationType) + && ($translation['slug'] === $this->directoryName); + + return !$isMatch; + } + + /* ------------------------------------------------------------------- + * Fix directory name when installing updates + * ------------------------------------------------------------------- + */ + + /** + * Rename the update directory to match the existing plugin/theme directory. + * + * When WordPress installs a plugin or theme update, it assumes that the ZIP file will contain + * exactly one directory, and that the directory name will be the same as the directory where + * the plugin or theme is currently installed. + * + * GitHub and other repositories provide ZIP downloads, but they often use directory names like + * "project-branch" or "project-tag-hash". We need to change the name to the actual plugin folder. + * + * This is a hook callback. Don't call it from a plugin. + * + * @access protected + * + * @param string $source The directory to copy to /wp-content/plugins or /wp-content/themes. Usually a subdirectory of $remoteSource. + * @param string $remoteSource WordPress has extracted the update to this directory. + * @param \WP_Upgrader $upgrader + * @return string|WP_Error + */ + public function fixDirectoryName($source, $remoteSource, $upgrader) { + global $wp_filesystem; + /** @var \WP_Filesystem_Base $wp_filesystem */ + + //Basic sanity checks. + if ( !isset($source, $remoteSource, $upgrader, $upgrader->skin, $wp_filesystem) ) { + return $source; + } + + //If WordPress is upgrading anything other than our plugin/theme, leave the directory name unchanged. + if ( !$this->isBeingUpgraded($upgrader) ) { + return $source; + } + + //Rename the source to match the existing directory. + $correctedSource = trailingslashit($remoteSource) . $this->directoryName . '/'; + if ( $source !== $correctedSource ) { + //The update archive should contain a single directory that contains the rest of plugin/theme files. + //Otherwise, WordPress will try to copy the entire working directory ($source == $remoteSource). + //We can't rename $remoteSource because that would break WordPress code that cleans up temporary files + //after update. + if ( $this->isBadDirectoryStructure($remoteSource) ) { + return new WP_Error( + 'puc-incorrect-directory-structure', + sprintf( + 'The directory structure of the update is incorrect. All files should be inside ' . + 'a directory named %s, not at the root of the ZIP archive.', + htmlentities($this->slug) + ) + ); + } + + /** @var \WP_Upgrader_Skin $upgrader ->skin */ + $upgrader->skin->feedback(sprintf( + 'Renaming %s to %s…', + '' . basename($source) . '', + '' . $this->directoryName . '' + )); + + if ( $wp_filesystem->move($source, $correctedSource, true) ) { + $upgrader->skin->feedback('Directory successfully renamed.'); + return $correctedSource; + } else { + return new WP_Error( + 'puc-rename-failed', + 'Unable to rename the update to match the existing directory.' + ); + } + } + + return $source; + } + + /** + * Is there an update being installed right now, for this plugin or theme? + * + * @param \WP_Upgrader|null $upgrader The upgrader that's performing the current update. + * @return bool + */ + abstract public function isBeingUpgraded($upgrader = null); + + /** + * Check for incorrect update directory structure. An update must contain a single directory, + * all other files should be inside that directory. + * + * @param string $remoteSource Directory path. + * @return bool + */ + protected function isBadDirectoryStructure($remoteSource) { + global $wp_filesystem; + /** @var \WP_Filesystem_Base $wp_filesystem */ + + $sourceFiles = $wp_filesystem->dirlist($remoteSource); + if ( is_array($sourceFiles) ) { + $sourceFiles = array_keys($sourceFiles); + $firstFilePath = trailingslashit($remoteSource) . $sourceFiles[0]; + return (count($sourceFiles) > 1) || (!$wp_filesystem->is_dir($firstFilePath)); + } + + //Assume it's fine. + return false; + } + + /* ------------------------------------------------------------------- + * DebugBar integration + * ------------------------------------------------------------------- + */ + + /** + * Initialize the update checker Debug Bar plugin/add-on thingy. + */ + public function maybeInitDebugBar() { + if ( + class_exists('Debug_Bar', false) + && class_exists('Debug_Bar_Panel', false) + && file_exists(dirname(__FILE__) . '/DebugBar') + ) { + $this->debugBarExtension = $this->createDebugBarExtension(); + } + } + + protected function createDebugBarExtension() { + return new DebugBar\Extension($this); + } + + /** + * Display additional configuration details in the Debug Bar panel. + * + * @param DebugBar\Panel $panel + */ + public function onDisplayConfiguration($panel) { + //Do nothing. Subclasses can use this to add additional info to the panel. + } + + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/UpgraderStatus.php b/plugin-update-checker/Puc/v5p4/UpgraderStatus.php new file mode 100644 index 0000000..e8340fd --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/UpgraderStatus.php @@ -0,0 +1,200 @@ +isBeingUpgraded('plugin', $pluginFile, $upgrader); + } + + /** + * Is there an update being installed for a specific theme? + * + * @param string $stylesheet Theme directory name. + * @param \WP_Upgrader|null $upgrader The upgrader that's performing the current update. + * @return bool + */ + public function isThemeBeingUpgraded($stylesheet, $upgrader = null) { + return $this->isBeingUpgraded('theme', $stylesheet, $upgrader); + } + + /** + * Check if a specific theme or plugin is being upgraded. + * + * @param string $type + * @param string $id + * @param \Plugin_Upgrader|\WP_Upgrader|null $upgrader + * @return bool + */ + protected function isBeingUpgraded($type, $id, $upgrader = null) { + if ( isset($upgrader) ) { + list($currentType, $currentId) = $this->getThingBeingUpgradedBy($upgrader); + if ( $currentType !== null ) { + $this->currentType = $currentType; + $this->currentId = $currentId; + } + } + return ($this->currentType === $type) && ($this->currentId === $id); + } + + /** + * Figure out which theme or plugin is being upgraded by a WP_Upgrader instance. + * + * Returns an array with two items. The first item is the type of the thing that's being + * upgraded: "plugin" or "theme". The second item is either the plugin basename or + * the theme directory name. If we can't determine what the upgrader is doing, both items + * will be NULL. + * + * Examples: + * ['plugin', 'plugin-dir-name/plugin.php'] + * ['theme', 'theme-dir-name'] + * + * @param \Plugin_Upgrader|\WP_Upgrader $upgrader + * @return array + */ + private function getThingBeingUpgradedBy($upgrader) { + if ( !isset($upgrader, $upgrader->skin) ) { + return array(null, null); + } + + //Figure out which plugin or theme is being upgraded. + $pluginFile = null; + $themeDirectoryName = null; + + $skin = $upgrader->skin; + if ( isset($skin->theme_info) && ($skin->theme_info instanceof \WP_Theme) ) { + $themeDirectoryName = $skin->theme_info->get_stylesheet(); + } elseif ( $skin instanceof \Plugin_Upgrader_Skin ) { + if ( isset($skin->plugin) && is_string($skin->plugin) && ($skin->plugin !== '') ) { + $pluginFile = $skin->plugin; + } + } elseif ( $skin instanceof \Theme_Upgrader_Skin ) { + if ( isset($skin->theme) && is_string($skin->theme) && ($skin->theme !== '') ) { + $themeDirectoryName = $skin->theme; + } + } elseif ( isset($skin->plugin_info) && is_array($skin->plugin_info) ) { + //This case is tricky because Bulk_Plugin_Upgrader_Skin (etc) doesn't actually store the plugin + //filename anywhere. Instead, it has the plugin headers in $plugin_info. So the best we can + //do is compare those headers to the headers of installed plugins. + $pluginFile = $this->identifyPluginByHeaders($skin->plugin_info); + } + + if ( $pluginFile !== null ) { + return array('plugin', $pluginFile); + } elseif ( $themeDirectoryName !== null ) { + return array('theme', $themeDirectoryName); + } + return array(null, null); + } + + /** + * Identify an installed plugin based on its headers. + * + * @param array $searchHeaders The plugin file header to look for. + * @return string|null Plugin basename ("foo/bar.php"), or NULL if we can't identify the plugin. + */ + private function identifyPluginByHeaders($searchHeaders) { + if ( !function_exists('get_plugins') ){ + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); + } + + $installedPlugins = get_plugins(); + $matches = array(); + foreach($installedPlugins as $pluginBasename => $headers) { + $diff1 = array_diff_assoc($headers, $searchHeaders); + $diff2 = array_diff_assoc($searchHeaders, $headers); + if ( empty($diff1) && empty($diff2) ) { + $matches[] = $pluginBasename; + } + } + + //It's possible (though very unlikely) that there could be two plugins with identical + //headers. In that case, we can't unambiguously identify the plugin that's being upgraded. + if ( count($matches) !== 1 ) { + return null; + } + + return reset($matches); + } + + /** + * @access private + * + * @param mixed $input + * @param array $hookExtra + * @return mixed Returns $input unaltered. + */ + public function setUpgradedThing($input, $hookExtra) { + if ( !empty($hookExtra['plugin']) && is_string($hookExtra['plugin']) ) { + $this->currentId = $hookExtra['plugin']; + $this->currentType = 'plugin'; + } elseif ( !empty($hookExtra['theme']) && is_string($hookExtra['theme']) ) { + $this->currentId = $hookExtra['theme']; + $this->currentType = 'theme'; + } else { + $this->currentType = null; + $this->currentId = null; + } + return $input; + } + + /** + * @access private + * + * @param array $options + * @return array + */ + public function setUpgradedPluginFromOptions($options) { + if ( isset($options['hook_extra']['plugin']) && is_string($options['hook_extra']['plugin']) ) { + $this->currentType = 'plugin'; + $this->currentId = $options['hook_extra']['plugin']; + } else { + $this->currentType = null; + $this->currentId = null; + } + return $options; + } + + /** + * @access private + * + * @param mixed $input + * @return mixed Returns $input unaltered. + */ + public function clearUpgradedThing($input = null) { + $this->currentId = null; + $this->currentType = null; + return $input; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Utils.php b/plugin-update-checker/Puc/v5p4/Utils.php new file mode 100644 index 0000000..2130996 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Utils.php @@ -0,0 +1,70 @@ +$node) ) { + $currentValue = $currentValue->$node; + } else { + return $default; + } + } + + return $currentValue; + } + + /** + * Get the first array element that is not empty. + * + * @param array $values + * @param mixed|null $default Returns this value if there are no non-empty elements. + * @return mixed|null + */ + public static function findNotEmpty($values, $default = null) { + if ( empty($values) ) { + return $default; + } + + foreach ($values as $value) { + if ( !empty($value) ) { + return $value; + } + } + + return $default; + } + + /** + * Check if the input string starts with the specified prefix. + * + * @param string $input + * @param string $prefix + * @return bool + */ + public static function startsWith($input, $prefix) { + $length = strlen($prefix); + return (substr($input, 0, $length) === $prefix); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/Api.php b/plugin-update-checker/Puc/v5p4/Vcs/Api.php new file mode 100644 index 0000000..715f1de --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/Api.php @@ -0,0 +1,379 @@ +repositoryUrl = $repositoryUrl; + $this->setAuthentication($credentials); + } + + /** + * @return string + */ + public function getRepositoryUrl() { + return $this->repositoryUrl; + } + + /** + * Figure out which reference (i.e. tag or branch) contains the latest version. + * + * @param string $configBranch Start looking in this branch. + * @return null|Reference + */ + public function chooseReference($configBranch) { + $strategies = $this->getUpdateDetectionStrategies($configBranch); + + if ( !empty($this->strategyFilterName) ) { + $strategies = apply_filters( + $this->strategyFilterName, + $strategies, + $this->slug + ); + } + + foreach ($strategies as $strategy) { + $reference = call_user_func($strategy); + if ( !empty($reference) ) { + return $reference; + } + } + return null; + } + + /** + * Get an ordered list of strategies that can be used to find the latest version. + * + * The update checker will try each strategy in order until one of them + * returns a valid reference. + * + * @param string $configBranch + * @return array Array of callables that return Vcs_Reference objects. + */ + abstract protected function getUpdateDetectionStrategies($configBranch); + + /** + * Get the readme.txt file from the remote repository and parse it + * according to the plugin readme standard. + * + * @param string $ref Tag or branch name. + * @return array Parsed readme. + */ + public function getRemoteReadme($ref = 'master') { + $fileContents = $this->getRemoteFile($this->getLocalReadmeName(), $ref); + if ( empty($fileContents) ) { + return array(); + } + + $parser = new PucReadmeParser(); + return $parser->parse_readme_contents($fileContents); + } + + /** + * Get the case-sensitive name of the local readme.txt file. + * + * In most cases it should just be called "readme.txt", but some plugins call it "README.txt", + * "README.TXT", or even "Readme.txt". Most VCS are case-sensitive so we need to know the correct + * capitalization. + * + * Defaults to "readme.txt" (all lowercase). + * + * @return string + */ + public function getLocalReadmeName() { + static $fileName = null; + if ( $fileName !== null ) { + return $fileName; + } + + $fileName = 'readme.txt'; + if ( isset($this->localDirectory) ) { + $files = scandir($this->localDirectory); + if ( !empty($files) ) { + foreach ($files as $possibleFileName) { + if ( strcasecmp($possibleFileName, 'readme.txt') === 0 ) { + $fileName = $possibleFileName; + break; + } + } + } + } + return $fileName; + } + + /** + * Get a branch. + * + * @param string $branchName + * @return Reference|null + */ + abstract public function getBranch($branchName); + + /** + * Get a specific tag. + * + * @param string $tagName + * @return Reference|null + */ + abstract public function getTag($tagName); + + /** + * Get the tag that looks like the highest version number. + * (Implementations should skip pre-release versions if possible.) + * + * @return Reference|null + */ + abstract public function getLatestTag(); + + /** + * Check if a tag name string looks like a version number. + * + * @param string $name + * @return bool + */ + protected function looksLikeVersion($name) { + //Tag names may be prefixed with "v", e.g. "v1.2.3". + $name = ltrim($name, 'v'); + + //The version string must start with a number. + if ( !is_numeric(substr($name, 0, 1)) ) { + return false; + } + + //The goal is to accept any SemVer-compatible or "PHP-standardized" version number. + return (preg_match('@^(\d{1,5}?)(\.\d{1,10}?){0,4}?($|[abrdp+_\-]|\s)@i', $name) === 1); + } + + /** + * Check if a tag appears to be named like a version number. + * + * @param \stdClass $tag + * @return bool + */ + protected function isVersionTag($tag) { + $property = $this->tagNameProperty; + return isset($tag->$property) && $this->looksLikeVersion($tag->$property); + } + + /** + * Sort a list of tags as if they were version numbers. + * Tags that don't look like version number will be removed. + * + * @param \stdClass[] $tags Array of tag objects. + * @return \stdClass[] Filtered array of tags sorted in descending order. + */ + protected function sortTagsByVersion($tags) { + //Keep only those tags that look like version numbers. + $versionTags = array_filter($tags, array($this, 'isVersionTag')); + //Sort them in descending order. + usort($versionTags, array($this, 'compareTagNames')); + + return $versionTags; + } + + /** + * Compare two tags as if they were version number. + * + * @param \stdClass $tag1 Tag object. + * @param \stdClass $tag2 Another tag object. + * @return int + */ + protected function compareTagNames($tag1, $tag2) { + $property = $this->tagNameProperty; + if ( !isset($tag1->$property) ) { + return 1; + } + if ( !isset($tag2->$property) ) { + return -1; + } + return -version_compare(ltrim($tag1->$property, 'v'), ltrim($tag2->$property, 'v')); + } + + /** + * Get the contents of a file from a specific branch or tag. + * + * @param string $path File name. + * @param string $ref + * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. + */ + abstract public function getRemoteFile($path, $ref = 'master'); + + /** + * Get the timestamp of the latest commit that changed the specified branch or tag. + * + * @param string $ref Reference name (e.g. branch or tag). + * @return string|null + */ + abstract public function getLatestCommitTime($ref); + + /** + * Get the contents of the changelog file from the repository. + * + * @param string $ref + * @param string $localDirectory Full path to the local plugin or theme directory. + * @return null|string The HTML contents of the changelog. + */ + public function getRemoteChangelog($ref, $localDirectory) { + $filename = $this->findChangelogName($localDirectory); + if ( empty($filename) ) { + return null; + } + + $changelog = $this->getRemoteFile($filename, $ref); + if ( $changelog === null ) { + return null; + } + + return Parsedown::instance()->text($changelog); + } + + /** + * Guess the name of the changelog file. + * + * @param string $directory + * @return string|null + */ + protected function findChangelogName($directory = null) { + if ( !isset($directory) ) { + $directory = $this->localDirectory; + } + if ( empty($directory) || !is_dir($directory) || ($directory === '.') ) { + return null; + } + + $possibleNames = array('CHANGES.md', 'CHANGELOG.md', 'changes.md', 'changelog.md'); + $files = scandir($directory); + $foundNames = array_intersect($possibleNames, $files); + + if ( !empty($foundNames) ) { + return reset($foundNames); + } + return null; + } + + /** + * Set authentication credentials. + * + * @param $credentials + */ + public function setAuthentication($credentials) { + $this->credentials = $credentials; + } + + public function isAuthenticationEnabled() { + return !empty($this->credentials); + } + + /** + * @param string $url + * @return string + */ + public function signDownloadUrl($url) { + return $url; + } + + /** + * @param string $filterName + */ + public function setHttpFilterName($filterName) { + $this->httpFilterName = $filterName; + } + + /** + * @param string $filterName + */ + public function setStrategyFilterName($filterName) { + $this->strategyFilterName = $filterName; + } + + /** + * @param string $directory + */ + public function setLocalDirectory($directory) { + if ( empty($directory) || !is_dir($directory) || ($directory === '.') ) { + $this->localDirectory = null; + } else { + $this->localDirectory = $directory; + } + } + + /** + * @param string $slug + */ + public function setSlug($slug) { + $this->slug = $slug; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/BaseChecker.php b/plugin-update-checker/Puc/v5p4/Vcs/BaseChecker.php new file mode 100644 index 0000000..78e0dde --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/BaseChecker.php @@ -0,0 +1,29 @@ +[^/]+?)/(?P[^/#?&]+?)/?$@', $path, $matches) ) { + $this->username = $matches['username']; + $this->repository = $matches['repository']; + } else { + throw new \InvalidArgumentException('Invalid BitBucket repository URL: "' . $repositoryUrl . '"'); + } + + parent::__construct($repositoryUrl, $credentials); + } + + protected function getUpdateDetectionStrategies($configBranch) { + $strategies = array( + self::STRATEGY_STABLE_TAG => function () use ($configBranch) { + return $this->getStableTag($configBranch); + }, + ); + + if ( ($configBranch === 'master' || $configBranch === 'main') ) { + $strategies[self::STRATEGY_LATEST_TAG] = array($this, 'getLatestTag'); + } + + $strategies[self::STRATEGY_BRANCH] = function () use ($configBranch) { + return $this->getBranch($configBranch); + }; + return $strategies; + } + + public function getBranch($branchName) { + $branch = $this->api('/refs/branches/' . $branchName); + if ( is_wp_error($branch) || empty($branch) ) { + return null; + } + + //The "/src/{stuff}/{path}" endpoint doesn't seem to handle branch names that contain slashes. + //If we don't encode the slash, we get a 404. If we encode it as "%2F", we get a 401. + //To avoid issues, if the branch name is not URL-safe, let's use the commit hash instead. + $ref = $branch->name; + if ((urlencode($ref) !== $ref) && isset($branch->target->hash)) { + $ref = $branch->target->hash; + } + + return new Reference(array( + 'name' => $ref, + 'updated' => $branch->target->date, + 'downloadUrl' => $this->getDownloadUrl($branch->name), + )); + } + + /** + * Get a specific tag. + * + * @param string $tagName + * @return Reference|null + */ + public function getTag($tagName) { + $tag = $this->api('/refs/tags/' . $tagName); + if ( is_wp_error($tag) || empty($tag) ) { + return null; + } + + return new Reference(array( + 'name' => $tag->name, + 'version' => ltrim($tag->name, 'v'), + 'updated' => $tag->target->date, + 'downloadUrl' => $this->getDownloadUrl($tag->name), + )); + } + + /** + * Get the tag that looks like the highest version number. + * + * @return Reference|null + */ + public function getLatestTag() { + $tags = $this->api('/refs/tags?sort=-target.date'); + if ( !isset($tags, $tags->values) || !is_array($tags->values) ) { + return null; + } + + //Filter and sort the list of tags. + $versionTags = $this->sortTagsByVersion($tags->values); + + //Return the first result. + if ( !empty($versionTags) ) { + $tag = $versionTags[0]; + return new Reference(array( + 'name' => $tag->name, + 'version' => ltrim($tag->name, 'v'), + 'updated' => $tag->target->date, + 'downloadUrl' => $this->getDownloadUrl($tag->name), + )); + } + return null; + } + + /** + * Get the tag/ref specified by the "Stable tag" header in the readme.txt of a given branch. + * + * @param string $branch + * @return null|Reference + */ + protected function getStableTag($branch) { + $remoteReadme = $this->getRemoteReadme($branch); + if ( !empty($remoteReadme['stable_tag']) ) { + $tag = $remoteReadme['stable_tag']; + + //You can explicitly opt out of using tags by setting "Stable tag" to + //"trunk" or the name of the current branch. + if ( ($tag === $branch) || ($tag === 'trunk') ) { + return $this->getBranch($branch); + } + + return $this->getTag($tag); + } + + return null; + } + + /** + * @param string $ref + * @return string + */ + protected function getDownloadUrl($ref) { + return sprintf( + 'https://bitbucket.org/%s/%s/get/%s.zip', + $this->username, + $this->repository, + $ref + ); + } + + /** + * Get the contents of a file from a specific branch or tag. + * + * @param string $path File name. + * @param string $ref + * @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('src/' . $ref . '/' . ltrim($path)); + if ( is_wp_error($response) || !is_string($response) ) { + return null; + } + return $response; + } + + /** + * Get the timestamp of the latest commit that changed the specified branch or tag. + * + * @param string $ref Reference name (e.g. branch or tag). + * @return string|null + */ + public function getLatestCommitTime($ref) { + $response = $this->api('commits/' . $ref); + if ( isset($response->values, $response->values[0], $response->values[0]->date) ) { + return $response->values[0]->date; + } + return null; + } + + /** + * Perform a BitBucket API 2.0 request. + * + * @param string $url + * @param string $version + * @return mixed|\WP_Error + */ + public function api($url, $version = '2.0') { + $url = ltrim($url, '/'); + $isSrcResource = Utils::startsWith($url, 'src/'); + + $url = implode('/', array( + 'https://api.bitbucket.org', + $version, + 'repositories', + $this->username, + $this->repository, + $url + )); + $baseUrl = $url; + + if ( $this->oauth ) { + $url = $this->oauth->sign($url,'GET'); + } + + $options = array('timeout' => wp_doing_cron() ? 10 : 3); + if ( !empty($this->httpFilterName) ) { + $options = apply_filters($this->httpFilterName, $options); + } + $response = wp_remote_get($url, $options); + if ( is_wp_error($response) ) { + do_action('puc_api_error', $response, null, $url, $this->slug); + return $response; + } + + $code = wp_remote_retrieve_response_code($response); + $body = wp_remote_retrieve_body($response); + if ( $code === 200 ) { + if ( $isSrcResource ) { + //Most responses are JSON-encoded, but src resources just + //return raw file contents. + $document = $body; + } else { + $document = json_decode($body); + } + return $document; + } + + $error = new \WP_Error( + 'puc-bitbucket-http-error', + sprintf('BitBucket API error. Base URL: "%s", HTTP status code: %d.', $baseUrl, $code) + ); + do_action('puc_api_error', $error, $response, $url, $this->slug); + + return $error; + } + + /** + * @param array $credentials + */ + public function setAuthentication($credentials) { + parent::setAuthentication($credentials); + + if ( !empty($credentials) && !empty($credentials['consumer_key']) ) { + $this->oauth = new OAuthSignature( + $credentials['consumer_key'], + $credentials['consumer_secret'] + ); + } else { + $this->oauth = null; + } + } + + public function signDownloadUrl($url) { + //Add authentication data to download URLs. Since OAuth signatures incorporate + //timestamps, we have to do this immediately before inserting the update. Otherwise, + //authentication could fail due to a stale timestamp. + if ( $this->oauth ) { + $url = $this->oauth->sign($url); + } + return $url; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/GitHubApi.php b/plugin-update-checker/Puc/v5p4/Vcs/GitHubApi.php new file mode 100644 index 0000000..610d932 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/GitHubApi.php @@ -0,0 +1,467 @@ +[^/]+?)/(?P[^/#?&]+?)/?$@', $path, $matches) ) { + $this->userName = $matches['username']; + $this->repositoryName = $matches['repository']; + } else { + throw new \InvalidArgumentException('Invalid GitHub repository URL: "' . $repositoryUrl . '"'); + } + + parent::__construct($repositoryUrl, $accessToken); + } + + /** + * Get the latest release from GitHub. + * + * @return Reference|null + */ + public function getLatestRelease() { + //The "latest release" endpoint returns one release and always skips pre-releases, + //so we can only use it if that's compatible with the current filter settings. + if ( + $this->shouldSkipPreReleases() + && ( + ($this->releaseFilterMaxReleases === 1) || !$this->hasCustomReleaseFilter() + ) + ) { + //Just get the latest release. + $release = $this->api('/repos/:user/:repo/releases/latest'); + if ( is_wp_error($release) || !is_object($release) || !isset($release->tag_name) ) { + return null; + } + $foundReleases = array($release); + } else { + //Get a list of the most recent releases. + $foundReleases = $this->api( + '/repos/:user/:repo/releases', + array('per_page' => $this->releaseFilterMaxReleases) + ); + if ( is_wp_error($foundReleases) || !is_array($foundReleases) ) { + return null; + } + } + + foreach ($foundReleases as $release) { + //Always skip drafts. + if ( isset($release->draft) && !empty($release->draft) ) { + continue; + } + + //Skip pre-releases unless specifically included. + if ( + $this->shouldSkipPreReleases() + && isset($release->prerelease) + && !empty($release->prerelease) + ) { + continue; + } + + $versionNumber = ltrim($release->tag_name, 'v'); //Remove the "v" prefix from "v1.2.3". + + //Custom release filtering. + if ( !$this->matchesCustomReleaseFilter($versionNumber, $release) ) { + continue; + } + + $reference = new Reference(array( + 'name' => $release->tag_name, + 'version' => $versionNumber, + 'downloadUrl' => $release->zipball_url, + 'updated' => $release->created_at, + 'apiResponse' => $release, + )); + + if ( isset($release->assets[0]) ) { + $reference->downloadCount = $release->assets[0]->download_count; + } + + if ( $this->releaseAssetsEnabled ) { + //Use the first release asset that matches the specified regular expression. + if ( isset($release->assets, $release->assets[0]) ) { + $matchingAssets = array_values(array_filter($release->assets, array($this, 'matchesAssetFilter'))); + } else { + $matchingAssets = array(); + } + + if ( !empty($matchingAssets) ) { + if ( $this->isAuthenticationEnabled() ) { + /** + * Keep in mind that we'll need to add an "Accept" header to download this asset. + * + * @see setUpdateDownloadHeaders() + */ + $reference->downloadUrl = $matchingAssets[0]->url; + } else { + //It seems that browser_download_url only works for public repositories. + //Using an access_token doesn't help. Maybe OAuth would work? + $reference->downloadUrl = $matchingAssets[0]->browser_download_url; + } + + $reference->downloadCount = $matchingAssets[0]->download_count; + } else if ( $this->releaseAssetPreference === Api::REQUIRE_RELEASE_ASSETS ) { + //None of the assets match the filter, and we're not allowed + //to fall back to the auto-generated source ZIP. + return null; + } + } + + if ( !empty($release->body) ) { + $reference->changelog = Parsedown::instance()->text($release->body); + } + + return $reference; + } + + return null; + } + + /** + * Get the tag that looks like the highest version number. + * + * @return Reference|null + */ + public function getLatestTag() { + $tags = $this->api('/repos/:user/:repo/tags'); + + if ( is_wp_error($tags) || !is_array($tags) ) { + return null; + } + + $versionTags = $this->sortTagsByVersion($tags); + if ( empty($versionTags) ) { + return null; + } + + $tag = $versionTags[0]; + return new Reference(array( + 'name' => $tag->name, + 'version' => ltrim($tag->name, 'v'), + 'downloadUrl' => $tag->zipball_url, + 'apiResponse' => $tag, + )); + } + + /** + * Get a branch by name. + * + * @param string $branchName + * @return null|Reference + */ + public function getBranch($branchName) { + $branch = $this->api('/repos/:user/:repo/branches/' . $branchName); + if ( is_wp_error($branch) || empty($branch) ) { + return null; + } + + $reference = new Reference(array( + 'name' => $branch->name, + 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), + 'apiResponse' => $branch, + )); + + if ( isset($branch->commit, $branch->commit->commit, $branch->commit->commit->author->date) ) { + $reference->updated = $branch->commit->commit->author->date; + } + + return $reference; + } + + /** + * Get the latest commit that changed the specified file. + * + * @param string $filename + * @param string $ref Reference name (e.g. branch or tag). + * @return \StdClass|null + */ + public function getLatestCommit($filename, $ref = 'master') { + $commits = $this->api( + '/repos/:user/:repo/commits', + array( + 'path' => $filename, + 'sha' => $ref, + ) + ); + if ( !is_wp_error($commits) && isset($commits[0]) ) { + return $commits[0]; + } + return null; + } + + /** + * Get the timestamp of the latest commit that changed the specified branch or tag. + * + * @param string $ref Reference name (e.g. branch or tag). + * @return string|null + */ + public function getLatestCommitTime($ref) { + $commits = $this->api('/repos/:user/:repo/commits', array('sha' => $ref)); + if ( !is_wp_error($commits) && isset($commits[0]) ) { + return $commits[0]->commit->author->date; + } + return null; + } + + /** + * Perform a GitHub API request. + * + * @param string $url + * @param array $queryParams + * @return mixed|\WP_Error + */ + protected function api($url, $queryParams = array()) { + $baseUrl = $url; + $url = $this->buildApiUrl($url, $queryParams); + + $options = array('timeout' => wp_doing_cron() ? 10 : 3); + if ( $this->isAuthenticationEnabled() ) { + $options['headers'] = array('Authorization' => $this->getAuthorizationHeader()); + } + + if ( !empty($this->httpFilterName) ) { + $options = apply_filters($this->httpFilterName, $options); + } + $response = wp_remote_get($url, $options); + if ( is_wp_error($response) ) { + do_action('puc_api_error', $response, null, $url, $this->slug); + return $response; + } + + $code = wp_remote_retrieve_response_code($response); + $body = wp_remote_retrieve_body($response); + if ( $code === 200 ) { + $document = json_decode($body); + return $document; + } + + $error = new \WP_Error( + 'puc-github-http-error', + sprintf('GitHub API error. Base URL: "%s", HTTP status code: %d.', $baseUrl, $code) + ); + do_action('puc_api_error', $error, $response, $url, $this->slug); + + return $error; + } + + /** + * Build a fully qualified URL for an API request. + * + * @param string $url + * @param array $queryParams + * @return string + */ + protected function buildApiUrl($url, $queryParams) { + $variables = array( + 'user' => $this->userName, + 'repo' => $this->repositoryName, + ); + foreach ($variables as $name => $value) { + $url = str_replace('/:' . $name, '/' . urlencode($value), $url); + } + $url = 'https://api.github.com' . $url; + + if ( !empty($queryParams) ) { + $url = add_query_arg($queryParams, $url); + } + + return $url; + } + + /** + * Get the contents of a file from a specific branch or tag. + * + * @param string $path File name. + * @param string $ref + * @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') { + $apiUrl = '/repos/:user/:repo/contents/' . $path; + $response = $this->api($apiUrl, array('ref' => $ref)); + + if ( is_wp_error($response) || !isset($response->content) || ($response->encoding !== 'base64') ) { + return null; + } + return base64_decode($response->content); + } + + /** + * Generate a URL to download a ZIP archive of the specified branch/tag/etc. + * + * @param string $ref + * @return string + */ + public function buildArchiveDownloadUrl($ref = 'master') { + $url = sprintf( + 'https://api.github.com/repos/%1$s/%2$s/zipball/%3$s', + urlencode($this->userName), + urlencode($this->repositoryName), + urlencode($ref) + ); + return $url; + } + + /** + * Get a specific tag. + * + * @param string $tagName + * @return void + */ + public function getTag($tagName) { + //The current GitHub update checker doesn't use getTag, so I didn't bother to implement it. + throw new \LogicException('The ' . __METHOD__ . ' method is not implemented and should not be used.'); + } + + public function setAuthentication($credentials) { + parent::setAuthentication($credentials); + $this->accessToken = is_string($credentials) ? $credentials : null; + + //Optimization: Instead of filtering all HTTP requests, let's do it only when + //WordPress is about to download an update. + add_filter('upgrader_pre_download', array($this, 'addHttpRequestFilter'), 10, 1); //WP 3.7+ + } + + protected function getUpdateDetectionStrategies($configBranch) { + $strategies = array(); + + if ( $configBranch === 'master' || $configBranch === 'main') { + //Use the latest release. + $strategies[self::STRATEGY_LATEST_RELEASE] = array($this, 'getLatestRelease'); + //Failing that, use the tag with the highest version number. + $strategies[self::STRATEGY_LATEST_TAG] = array($this, 'getLatestTag'); + } + + //Alternatively, just use the branch itself. + $strategies[self::STRATEGY_BRANCH] = function () use ($configBranch) { + return $this->getBranch($configBranch); + }; + + return $strategies; + } + + /** + * Get the unchanging part of a release asset URL. Used to identify download attempts. + * + * @return string + */ + protected function getAssetApiBaseUrl() { + return sprintf( + '//api.github.com/repos/%1$s/%2$s/releases/assets/', + $this->userName, + $this->repositoryName + ); + } + + protected function getFilterableAssetName($releaseAsset) { + if ( isset($releaseAsset->name) ) { + return $releaseAsset->name; + } + return null; + } + + /** + * @param bool $result + * @return bool + * @internal + */ + public function addHttpRequestFilter($result) { + if ( !$this->downloadFilterAdded && $this->isAuthenticationEnabled() ) { + //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args -- The callback doesn't change the timeout. + add_filter('http_request_args', array($this, 'setUpdateDownloadHeaders'), 10, 2); + add_action('requests-requests.before_redirect', array($this, 'removeAuthHeaderFromRedirects'), 10, 4); + $this->downloadFilterAdded = true; + } + return $result; + } + + /** + * Set the HTTP headers that are necessary to download updates from private repositories. + * + * See GitHub docs: + * + * @link https://developer.github.com/v3/repos/releases/#get-a-single-release-asset + * @link https://developer.github.com/v3/auth/#basic-authentication + * + * @internal + * @param array $requestArgs + * @param string $url + * @return array + */ + public function setUpdateDownloadHeaders($requestArgs, $url = '') { + //Is WordPress trying to download one of our release assets? + if ( $this->releaseAssetsEnabled && (strpos($url, $this->getAssetApiBaseUrl()) !== false) ) { + $requestArgs['headers']['Accept'] = 'application/octet-stream'; + } + //Use Basic authentication, but only if the download is from our repository. + $repoApiBaseUrl = $this->buildApiUrl('/repos/:user/:repo/', array()); + if ( $this->isAuthenticationEnabled() && (strpos($url, $repoApiBaseUrl)) === 0 ) { + $requestArgs['headers']['Authorization'] = $this->getAuthorizationHeader(); + } + return $requestArgs; + } + + /** + * When following a redirect, the Requests library will automatically forward + * the authorization header to other hosts. We don't want that because it breaks + * AWS downloads and can leak authorization information. + * + * @param string $location + * @param array $headers + * @internal + */ + public function removeAuthHeaderFromRedirects(&$location, &$headers) { + $repoApiBaseUrl = $this->buildApiUrl('/repos/:user/:repo/', array()); + if ( strpos($location, $repoApiBaseUrl) === 0 ) { + return; //This request is going to GitHub, so it's fine. + } + //Remove the header. + if ( isset($headers['Authorization']) ) { + unset($headers['Authorization']); + } + } + + /** + * Generate the value of the "Authorization" header. + * + * @return string + */ + protected function getAuthorizationHeader() { + return 'Basic ' . base64_encode($this->userName . ':' . $this->accessToken); + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/GitLabApi.php b/plugin-update-checker/Puc/v5p4/Vcs/GitLabApi.php new file mode 100644 index 0000000..2cbd6eb --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/GitLabApi.php @@ -0,0 +1,414 @@ +repositoryHost = wp_parse_url($repositoryUrl, PHP_URL_HOST) . $port; + + if ( $this->repositoryHost !== 'gitlab.com' ) { + $this->repositoryProtocol = wp_parse_url($repositoryUrl, PHP_URL_SCHEME); + } + + //Find the repository information + $path = wp_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 { + //There could be subgroups in the URL: gitlab.domain.com/group/subgroup/subgroup2/repository + if ( $subgroup !== null ) { + $path = str_replace(trailingslashit($subgroup), '', $path); + } + + //This is not a traditional url, it could be gitlab is in a deeper subdirectory. + //Get the path segments. + $segments = explode('/', untrailingslashit(ltrim($path, '/'))); + + //We need at least /user-name/repository-name/ + if ( count($segments) < 2 ) { + throw new \InvalidArgumentException('Invalid GitLab repository URL: "' . $repositoryUrl . '"'); + } + + //Get the username and repository name. + $usernameRepo = array_splice($segments, -2, 2); + $this->userName = $usernameRepo[0]; + $this->repositoryName = $usernameRepo[1]; + + //Append the remaining segments to the host if there are segments left. + if ( count($segments) > 0 ) { + $this->repositoryHost = trailingslashit($this->repositoryHost) . implode('/', $segments); + } + + //Add subgroups to username. + if ( $subgroup !== null ) { + $this->userName = $usernameRepo[0] . '/' . untrailingslashit($subgroup); + } + } + + parent::__construct($repositoryUrl, $accessToken); + } + + /** + * Get the latest release from GitLab. + * + * @return Reference|null + */ + public function getLatestRelease() { + $releases = $this->api('/:id/releases', array('per_page' => $this->releaseFilterMaxReleases)); + if ( is_wp_error($releases) || empty($releases) || !is_array($releases) ) { + return null; + } + + foreach ($releases as $release) { + if ( + //Skip invalid/unsupported releases. + !is_object($release) + || !isset($release->tag_name) + //Skip upcoming releases. + || ( + !empty($release->upcoming_release) + && $this->shouldSkipPreReleases() + ) + ) { + continue; + } + + $versionNumber = ltrim($release->tag_name, 'v'); //Remove the "v" prefix from "v1.2.3". + + //Apply custom filters. + if ( !$this->matchesCustomReleaseFilter($versionNumber, $release) ) { + continue; + } + + $downloadUrl = $this->findReleaseDownloadUrl($release); + if ( empty($downloadUrl) ) { + //The latest release doesn't have valid download URL. + return null; + } + + if ( !empty($this->accessToken) ) { + $downloadUrl = add_query_arg('private_token', $this->accessToken, $downloadUrl); + } + + return new Reference(array( + 'name' => $release->tag_name, + 'version' => $versionNumber, + 'downloadUrl' => $downloadUrl, + 'updated' => $release->released_at, + 'apiResponse' => $release, + )); + } + + return null; + } + + /** + * @param object $release + * @return string|null + */ + protected function findReleaseDownloadUrl($release) { + if ( $this->releaseAssetsEnabled ) { + if ( isset($release->assets, $release->assets->links) ) { + //Use the first asset link where the URL matches the filter. + foreach ($release->assets->links as $link) { + if ( $this->matchesAssetFilter($link) ) { + return $link->url; + } + } + } + + if ( $this->releaseAssetPreference === Api::REQUIRE_RELEASE_ASSETS ) { + //Falling back to source archives is not allowed, so give up. + return null; + } + } + + //Use the first source code archive that's in ZIP format. + foreach ($release->assets->sources as $source) { + if ( isset($source->format) && ($source->format === 'zip') ) { + return $source->url; + } + } + + return null; + } + + /** + * Get the tag that looks like the highest version number. + * + * @return Reference|null + */ + public function getLatestTag() { + $tags = $this->api('/:id/repository/tags'); + if ( is_wp_error($tags) || empty($tags) || !is_array($tags) ) { + return null; + } + + $versionTags = $this->sortTagsByVersion($tags); + if ( empty($versionTags) ) { + return null; + } + + $tag = $versionTags[0]; + return new Reference(array( + 'name' => $tag->name, + 'version' => ltrim($tag->name, 'v'), + 'downloadUrl' => $this->buildArchiveDownloadUrl($tag->name), + 'apiResponse' => $tag, + )); + } + + /** + * Get a branch by name. + * + * @param string $branchName + * @return null|Reference + */ + public function getBranch($branchName) { + $branch = $this->api('/:id/repository/branches/' . $branchName); + if ( is_wp_error($branch) || empty($branch) ) { + return null; + } + + $reference = new Reference(array( + 'name' => $branch->name, + 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), + 'apiResponse' => $branch, + )); + + if ( isset($branch->commit, $branch->commit->committed_date) ) { + $reference->updated = $branch->commit->committed_date; + } + + return $reference; + } + + /** + * Get the timestamp of the latest commit that changed the specified branch or tag. + * + * @param string $ref Reference name (e.g. branch or tag). + * @return string|null + */ + public function getLatestCommitTime($ref) { + $commits = $this->api('/:id/repository/commits/', array('ref_name' => $ref)); + if ( is_wp_error($commits) || !is_array($commits) || !isset($commits[0]) ) { + return null; + } + + return $commits[0]->committed_date; + } + + /** + * Perform a GitLab API request. + * + * @param string $url + * @param array $queryParams + * @return mixed|\WP_Error + */ + protected function api($url, $queryParams = array()) { + $baseUrl = $url; + $url = $this->buildApiUrl($url, $queryParams); + + $options = array('timeout' => wp_doing_cron() ? 10 : 3); + if ( !empty($this->httpFilterName) ) { + $options = apply_filters($this->httpFilterName, $options); + } + + $response = wp_remote_get($url, $options); + if ( is_wp_error($response) ) { + do_action('puc_api_error', $response, null, $url, $this->slug); + return $response; + } + + $code = wp_remote_retrieve_response_code($response); + $body = wp_remote_retrieve_body($response); + if ( $code === 200 ) { + return json_decode($body); + } + + $error = new \WP_Error( + 'puc-gitlab-http-error', + sprintf('GitLab API error. URL: "%s", HTTP status code: %d.', $baseUrl, $code) + ); + do_action('puc_api_error', $error, $response, $url, $this->slug); + + return $error; + } + + /** + * Build a fully qualified URL for an API request. + * + * @param string $url + * @param array $queryParams + * @return string + */ + protected function buildApiUrl($url, $queryParams) { + $variables = array( + 'user' => $this->userName, + 'repo' => $this->repositoryName, + 'id' => $this->userName . '/' . $this->repositoryName, + ); + + foreach ($variables as $name => $value) { + $url = str_replace("/:{$name}", '/' . urlencode($value), $url); + } + + $url = substr($url, 1); + $url = sprintf('%1$s://%2$s/api/v4/projects/%3$s', $this->repositoryProtocol, $this->repositoryHost, $url); + + if ( !empty($this->accessToken) ) { + $queryParams['private_token'] = $this->accessToken; + } + + if ( !empty($queryParams) ) { + $url = add_query_arg($queryParams, $url); + } + + return $url; + } + + /** + * Get the contents of a file from a specific branch or tag. + * + * @param string $path File name. + * @param string $ref + * @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('/:id/repository/files/' . $path, array('ref' => $ref)); + if ( is_wp_error($response) || !isset($response->content) || $response->encoding !== 'base64' ) { + return null; + } + + return base64_decode($response->content); + } + + /** + * Generate a URL to download a ZIP archive of the specified branch/tag/etc. + * + * @param string $ref + * @return string + */ + public function buildArchiveDownloadUrl($ref = 'master') { + $url = sprintf( + '%1$s://%2$s/api/v4/projects/%3$s/repository/archive.zip', + $this->repositoryProtocol, + $this->repositoryHost, + 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); + } + + return $url; + } + + /** + * Get a specific tag. + * + * @param string $tagName + * @return void + */ + public function getTag($tagName) { + throw new \LogicException('The ' . __METHOD__ . ' method is not implemented and should not be used.'); + } + + protected function getUpdateDetectionStrategies($configBranch) { + $strategies = array(); + + if ( ($configBranch === 'main') || ($configBranch === 'master') ) { + $strategies[self::STRATEGY_LATEST_RELEASE] = array($this, 'getLatestRelease'); + $strategies[self::STRATEGY_LATEST_TAG] = array($this, 'getLatestTag'); + } + + $strategies[self::STRATEGY_BRANCH] = function () use ($configBranch) { + return $this->getBranch($configBranch); + }; + + return $strategies; + } + + public function setAuthentication($credentials) { + parent::setAuthentication($credentials); + $this->accessToken = is_string($credentials) ? $credentials : null; + } + + /** + * Use release assets that link to GitLab generic packages (e.g. .zip files) + * instead of automatically generated source archives. + * + * This is included for backwards compatibility with older versions of PUC. + * + * @return void + * @deprecated Use enableReleaseAssets() instead. + * @noinspection PhpUnused -- Public API + */ + public function enableReleasePackages() { + $this->enableReleaseAssets( + /** @lang RegExp */ '/\.zip($|[?&#])/i', + Api::REQUIRE_RELEASE_ASSETS + ); + } + + protected function getFilterableAssetName($releaseAsset) { + if ( isset($releaseAsset->url) ) { + return $releaseAsset->url; + } + return null; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/PluginUpdateChecker.php b/plugin-update-checker/Puc/v5p4/Vcs/PluginUpdateChecker.php new file mode 100644 index 0000000..f00097f --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/PluginUpdateChecker.php @@ -0,0 +1,275 @@ +api = $api; + + parent::__construct($api->getRepositoryUrl(), $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile); + + $this->api->setHttpFilterName($this->getUniqueName('request_info_options')); + $this->api->setStrategyFilterName($this->getUniqueName('vcs_update_detection_strategies')); + $this->api->setSlug($this->slug); + } + + public function requestInfo($unusedParameter = null) { + //We have to make several remote API requests to gather all the necessary info + //which can take a while on slow networks. + if ( function_exists('set_time_limit') ) { + @set_time_limit(60); + } + + $api = $this->api; + $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); + + $info = new Plugin\PluginInfo(); + $info->filename = $this->pluginFile; + $info->slug = $this->slug; + + $this->setInfoFromHeader($this->package->getPluginHeader(), $info); + $this->setIconsFromLocalAssets($info); + $this->setBannersFromLocalAssets($info); + + //Pick a branch or tag. + $updateSource = $api->chooseReference($this->branch); + if ( $updateSource ) { + $ref = $updateSource->name; + $info->version = $updateSource->version; + $info->last_updated = $updateSource->updated; + $info->download_url = $updateSource->downloadUrl; + + if ( !empty($updateSource->changelog) ) { + $info->sections['changelog'] = $updateSource->changelog; + } + if ( isset($updateSource->downloadCount) ) { + $info->downloaded = $updateSource->downloadCount; + } + } else { + //There's probably a network problem or an authentication error. + do_action( + 'puc_api_error', + new \WP_Error( + 'puc-no-update-source', + 'Could not retrieve version information from the repository. ' + . 'This usually means that the update checker either can\'t connect ' + . 'to the repository or it\'s configured incorrectly.' + ), + null, null, $this->slug + ); + return null; + } + + //Get headers from the main plugin file 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. + $mainPluginFile = basename($this->pluginFile); + $remotePlugin = $api->getRemoteFile($mainPluginFile, $ref); + if ( !empty($remotePlugin) ) { + $remoteHeader = $this->package->getFileHeader($remotePlugin); + $this->setInfoFromHeader($remoteHeader, $info); + } + + //Sanity check: Reject updates that don't have a version number. + //This can happen when we're using a branch, and we either fail to retrieve the main plugin + //file or the file doesn't have a "Version" header. + if ( empty($info->version) ) { + do_action( + 'puc_api_error', + new \WP_Error( + 'puc-no-plugin-version', + 'Could not find the version number in the repository.' + ), + null, null, $this->slug + ); + return null; + } + + //Try parsing readme.txt. If it's formatted according to WordPress.org standards, it will contain + //a lot of useful information like the required/tested WP version, changelog, and so on. + if ( $this->readmeTxtExistsLocally() ) { + $this->setInfoFromRemoteReadme($ref, $info); + } + + //The changelog might be in a separate file. + if ( empty($info->sections['changelog']) ) { + $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'); + } + } + + if ( empty($info->last_updated) ) { + //Fetch the latest commit that changed the tag or branch and use it as the "last_updated" date. + $latestCommitTime = $api->getLatestCommitTime($ref); + if ( $latestCommitTime !== null ) { + $info->last_updated = $latestCommitTime; + } + } + + $info = apply_filters($this->getUniqueName('request_info_result'), $info, null); + return $info; + } + + /** + * Check if the currently installed version has a readme.txt file. + * + * @return bool + */ + protected function readmeTxtExistsLocally() { + return $this->package->fileExists($this->api->getLocalReadmeName()); + } + + /** + * Copy plugin metadata from a file header to a Plugin Info object. + * + * @param array $fileHeader + * @param Plugin\PluginInfo $pluginInfo + */ + protected function setInfoFromHeader($fileHeader, $pluginInfo) { + $headerToPropertyMap = array( + 'Version' => 'version', + 'Name' => 'name', + 'PluginURI' => 'homepage', + 'Author' => 'author', + 'AuthorName' => 'author', + 'AuthorURI' => 'author_homepage', + + 'Requires WP' => 'requires', + 'Tested WP' => 'tested', + 'Requires at least' => 'requires', + 'Tested up to' => 'tested', + + 'Requires PHP' => 'requires_php', + ); + foreach ($headerToPropertyMap as $headerName => $property) { + if ( isset($fileHeader[$headerName]) && !empty($fileHeader[$headerName]) ) { + $pluginInfo->$property = $fileHeader[$headerName]; + } + } + + if ( !empty($fileHeader['Description']) ) { + $pluginInfo->sections['description'] = $fileHeader['Description']; + } + } + + /** + * Copy plugin metadata from the remote readme.txt file. + * + * @param string $ref GitHub tag or branch where to look for the readme. + * @param Plugin\PluginInfo $pluginInfo + */ + protected function setInfoFromRemoteReadme($ref, $pluginInfo) { + $readme = $this->api->getRemoteReadme($ref); + if ( empty($readme) ) { + return; + } + + if ( isset($readme['sections']) ) { + $pluginInfo->sections = array_merge($pluginInfo->sections, $readme['sections']); + } + if ( !empty($readme['tested_up_to']) ) { + $pluginInfo->tested = $readme['tested_up_to']; + } + if ( !empty($readme['requires_at_least']) ) { + $pluginInfo->requires = $readme['requires_at_least']; + } + if ( !empty($readme['requires_php']) ) { + $pluginInfo->requires_php = $readme['requires_php']; + } + + if ( isset($readme['upgrade_notice'], $readme['upgrade_notice'][$pluginInfo->version]) ) { + $pluginInfo->upgrade_notice = $readme['upgrade_notice'][$pluginInfo->version]; + } + } + + /** + * Add icons from the currently installed version to a Plugin Info object. + * + * The icons should be in a subdirectory named "assets". Supported image formats + * and file names are described here: + * @link https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#plugin-icons + * + * @param Plugin\PluginInfo $pluginInfo + */ + protected function setIconsFromLocalAssets($pluginInfo) { + $icons = $this->getLocalAssetUrls(array( + 'icon.svg' => 'svg', + 'icon-256x256.png' => '2x', + 'icon-256x256.jpg' => '2x', + 'icon-128x128.png' => '1x', + 'icon-128x128.jpg' => '1x', + )); + + if ( !empty($icons) ) { + //The "default" key seems to be used only as last-resort fallback in WP core (5.8/5.9), + //but we'll set it anyway in case some code somewhere needs it. + reset($icons); + $firstKey = key($icons); + $icons['default'] = $icons[$firstKey]; + + $pluginInfo->icons = $icons; + } + } + + /** + * Add banners from the currently installed version to a Plugin Info object. + * + * The banners should be in a subdirectory named "assets". Supported image formats + * and file names are described here: + * @link https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#plugin-headers + * + * @param Plugin\PluginInfo $pluginInfo + */ + protected function setBannersFromLocalAssets($pluginInfo) { + $banners = $this->getLocalAssetUrls(array( + 'banner-772x250.png' => 'high', + 'banner-772x250.jpg' => 'high', + 'banner-1544x500.png' => 'low', + 'banner-1544x500.jpg' => 'low', + )); + + if ( !empty($banners) ) { + $pluginInfo->banners = $banners; + } + } + + /** + * @param array $filesToKeys + * @return array + */ + protected function getLocalAssetUrls($filesToKeys) { + $assetDirectory = $this->package->getAbsoluteDirectoryPath() . DIRECTORY_SEPARATOR . 'assets'; + if ( !is_dir($assetDirectory) ) { + return array(); + } + $assetBaseUrl = trailingslashit(plugins_url('', $assetDirectory . '/imaginary.file')); + + $foundAssets = array(); + foreach ($filesToKeys as $fileName => $key) { + $fullBannerPath = $assetDirectory . DIRECTORY_SEPARATOR . $fileName; + if ( !isset($icons[$key]) && is_file($fullBannerPath) ) { + $foundAssets[$key] = $assetBaseUrl . $fileName; + } + } + + return $foundAssets; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/Reference.php b/plugin-update-checker/Puc/v5p4/Vcs/Reference.php new file mode 100644 index 0000000..c30bcf7 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/Reference.php @@ -0,0 +1,51 @@ +properties = $properties; + } + + /** + * @param string $name + * @return mixed|null + */ + public function __get($name) { + return array_key_exists($name, $this->properties) ? $this->properties[$name] : null; + } + + /** + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) { + $this->properties[$name] = $value; + } + + /** + * @param string $name + * @return bool + */ + public function __isset($name) { + return isset($this->properties[$name]); + } + + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/ReleaseAssetSupport.php b/plugin-update-checker/Puc/v5p4/Vcs/ReleaseAssetSupport.php new file mode 100644 index 0000000..352fc5e --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/ReleaseAssetSupport.php @@ -0,0 +1,83 @@ +releaseAssetsEnabled = true; + $this->assetFilterRegex = $nameRegex; + $this->releaseAssetPreference = $preference; + } + + /** + * Disable release assets. + * + * @return void + * @noinspection PhpUnused -- Public API + */ + public function disableReleaseAssets() { + $this->releaseAssetsEnabled = false; + $this->assetFilterRegex = null; + } + + /** + * Does the specified asset match the name regex? + * + * @param mixed $releaseAsset Data type and structure depend on the host/API. + * @return bool + */ + protected function matchesAssetFilter($releaseAsset) { + if ( $this->assetFilterRegex === null ) { + //The default is to accept all assets. + return true; + } + + $name = $this->getFilterableAssetName($releaseAsset); + if ( !is_string($name) ) { + return false; + } + return (bool)preg_match($this->assetFilterRegex, $releaseAsset->name); + } + + /** + * Get the part of asset data that will be checked against the filter regex. + * + * @param mixed $releaseAsset + * @return string|null + */ + abstract protected function getFilterableAssetName($releaseAsset); + } + +endif; \ No newline at end of file diff --git a/plugin-update-checker/Puc/v5p4/Vcs/ReleaseFilteringFeature.php b/plugin-update-checker/Puc/v5p4/Vcs/ReleaseFilteringFeature.php new file mode 100644 index 0000000..bbf9c47 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/ReleaseFilteringFeature.php @@ -0,0 +1,108 @@ + 100 ) { + throw new \InvalidArgumentException(sprintf( + 'The max number of releases is too high (%d). It must be 100 or less.', + $maxReleases + )); + } else if ( $maxReleases < 1 ) { + throw new \InvalidArgumentException(sprintf( + 'The max number of releases is too low (%d). It must be at least 1.', + $maxReleases + )); + } + + $this->releaseFilterCallback = $callback; + $this->releaseFilterByType = $releaseTypes; + $this->releaseFilterMaxReleases = $maxReleases; + return $this; + } + + /** + * Filter releases by their version number. + * + * @param string $regex A regular expression. The release version number must match this regex. + * @param int $releaseTypes + * @param int $maxReleasesToExamine + * @return $this + * @noinspection PhpUnused -- Public API + */ + public function setReleaseVersionFilter( + $regex, + $releaseTypes = Api::RELEASE_FILTER_SKIP_PRERELEASE, + $maxReleasesToExamine = 20 + ) { + return $this->setReleaseFilter( + function ($versionNumber) use ($regex) { + return (preg_match($regex, $versionNumber) === 1); + }, + $releaseTypes, + $maxReleasesToExamine + ); + } + + /** + * @param string $versionNumber The detected release version number. + * @param object $releaseObject Varies depending on the host/API. + * @return bool + */ + protected function matchesCustomReleaseFilter($versionNumber, $releaseObject) { + if ( !is_callable($this->releaseFilterCallback) ) { + return true; //No custom filter. + } + return call_user_func($this->releaseFilterCallback, $versionNumber, $releaseObject); + } + + /** + * @return bool + */ + protected function shouldSkipPreReleases() { + //Maybe this could be a bitfield in the future, if we need to support + //more release types. + return ($this->releaseFilterByType !== Api::RELEASE_FILTER_ALL); + } + + /** + * @return bool + */ + protected function hasCustomReleaseFilter() { + return isset($this->releaseFilterCallback) && is_callable($this->releaseFilterCallback); + } + } + +endif; \ No newline at end of file diff --git a/plugin-update-checker/Puc/v5p4/Vcs/ThemeUpdateChecker.php b/plugin-update-checker/Puc/v5p4/Vcs/ThemeUpdateChecker.php new file mode 100644 index 0000000..3d16f19 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/ThemeUpdateChecker.php @@ -0,0 +1,83 @@ +api = $api; + + parent::__construct($api->getRepositoryUrl(), $stylesheet, $customSlug, $checkPeriod, $optionName); + + $this->api->setHttpFilterName($this->getUniqueName('request_update_options')); + $this->api->setStrategyFilterName($this->getUniqueName('vcs_update_detection_strategies')); + $this->api->setSlug($this->slug); + } + + public function requestUpdate() { + $api = $this->api; + $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); + + $update = new Theme\Update(); + $update->slug = $this->slug; + + //Figure out which reference (tag or branch) we'll use to get the latest version of the theme. + $updateSource = $api->chooseReference($this->branch); + if ( $updateSource ) { + $ref = $updateSource->name; + $update->download_url = $updateSource->downloadUrl; + } else { + do_action( + 'puc_api_error', + new \WP_Error( + 'puc-no-update-source', + 'Could not retrieve version information from the repository. ' + . 'This usually means that the update checker either can\'t connect ' + . 'to the repository or it\'s configured incorrectly.' + ), + null, null, $this->slug + ); + $ref = $this->branch; + } + + //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->package->getFileHeader($api->getRemoteFile('style.css', $ref)); + $update->version = Utils::findNotEmpty(array( + $remoteHeader['Version'], + Utils::get($updateSource, 'version'), + )); + + //The details URL defaults to the Theme URI header or the repository URL. + $update->details_url = Utils::findNotEmpty(array( + $remoteHeader['ThemeURI'], + $this->package->getHeaderValue('ThemeURI'), + $this->metadataUrl, + )); + + if ( empty($update->version) ) { + //It looks like we didn't find a valid update after all. + $update = null; + } + + $update = $this->filterUpdateResult($update); + return $update; + } + } + +endif; diff --git a/plugin-update-checker/Puc/v5p4/Vcs/VcsCheckerMethods.php b/plugin-update-checker/Puc/v5p4/Vcs/VcsCheckerMethods.php new file mode 100644 index 0000000..e5a5608 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/Vcs/VcsCheckerMethods.php @@ -0,0 +1,59 @@ +branch = $branch; + return $this; + } + + /** + * Set authentication credentials. + * + * @param array|string $credentials + * @return $this + */ + public function setAuthentication($credentials) { + $this->api->setAuthentication($credentials); + return $this; + } + + /** + * @return Api + */ + public function getVcsApi() { + return $this->api; + } + + public function getUpdate() { + $update = parent::getUpdate(); + + if ( isset($update) && !empty($update->download_url) ) { + $update->download_url = $this->api->signDownloadUrl($update->download_url); + } + + return $update; + } + + public function onDisplayConfiguration($panel) { + parent::onDisplayConfiguration($panel); + $panel->row('Branch', $this->branch); + $panel->row('Authentication enabled', $this->api->isAuthenticationEnabled() ? 'Yes' : 'No'); + $panel->row('API client', get_class($this->api)); + } + } + +endif; \ No newline at end of file diff --git a/plugin-update-checker/Puc/v5p4/WpCliCheckTrigger.php b/plugin-update-checker/Puc/v5p4/WpCliCheckTrigger.php new file mode 100644 index 0000000..523cca4 --- /dev/null +++ b/plugin-update-checker/Puc/v5p4/WpCliCheckTrigger.php @@ -0,0 +1,84 @@ +componentType = $componentType; + $this->scheduler = $scheduler; + + if ( !defined('WP_CLI') || !class_exists(WP_CLI::class, false) ) { + return; //Nothing to do if WP-CLI is not available. + } + + /* + * We can't hook directly into wp_update_plugins(), but we can hook into the WP-CLI + * commands that call it. We'll use the "before_invoke:xyz" hook to trigger update checks. + */ + foreach ($this->getRelevantCommands() as $command) { + WP_CLI::add_hook('before_invoke:' . $command, [$this, 'triggerUpdateCheckOnce']); + } + } + + private function getRelevantCommands() { + $result = []; + foreach (['status', 'list', 'update'] as $subcommand) { + $result[] = $this->componentType . ' ' . $subcommand; + } + return $result; + } + + /** + * Trigger a potential update check once. + * + * @param mixed $input + * @return mixed The input value, unchanged. + * @internal This method is public so that it can be used as a WP-CLI hook callback. + * It should not be called directly. + * + */ + public function triggerUpdateCheckOnce($input = null) { + if ( $this->wasCheckTriggered ) { + return $input; + } + + $this->wasCheckTriggered = true; + $this->scheduler->maybeCheckForUpdates(); + + return $input; + } +} \ No newline at end of file diff --git a/plugin-update-checker/README.md b/plugin-update-checker/README.md old mode 100755 new mode 100644 index ddb9fb5..4c1c197 --- a/plugin-update-checker/README.md +++ b/plugin-update-checker/README.md @@ -19,7 +19,8 @@ From the users' perspective, it works just like with plugins and themes hosted o - [BitBucket Integration](#bitbucket-integration) - [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) + - [How to Release a GitLab Update](#how-to-release-a-gitlab-update) +- [Migrating from 4.x](#migrating-from-4x) - [License Management](#license-management) - [Resources](#resources) @@ -40,7 +41,7 @@ Getting Started { "name" : "Plugin Name", "version" : "2.0", - "download_url" : "http://example.com/plugin-name-2.0.zip", + "download_url" : "https://example.com/plugin-name-2.0.zip", "sections" : { "description" : "Plugin description here. You can use HTML." } @@ -53,8 +54,8 @@ Getting Started ```json { "version": "2.0", - "details_url": "http://example.com/version-2.0-details.html", - "download_url": "http://example.com/example-theme-2.0.zip" + "details_url": "https://example.com/version-2.0-details.html", + "download_url": "https://example.com/example-theme-2.0.zip" } ``` @@ -64,8 +65,10 @@ Getting Started ```php require 'path/to/plugin-update-checker/plugin-update-checker.php'; - $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( - 'http://example.com/path/to/details.json', + use YahnisElsts\PluginUpdateChecker\v5\PucFactory; + + $myUpdateChecker = PucFactory::buildUpdateChecker( + 'https://example.com/path/to/details.json', __FILE__, //Full path to the main plugin file or functions.php. 'unique-plugin-or-theme-slug' ); @@ -96,17 +99,19 @@ By default, the library will check the specified URL for changes every 12 hours. ```php require 'plugin-update-checker/plugin-update-checker.php'; - $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( + use YahnisElsts\PluginUpdateChecker\v5\PucFactory; + + $myUpdateChecker = PucFactory::buildUpdateChecker( 'https://github.com/user-name/repo-name/', __FILE__, 'unique-plugin-or-theme-slug' ); + + //Set the branch that contains the stable release. + $myUpdateChecker->setBranch('stable-branch-name'); //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'); ``` 3. Plugins only: Add a `readme.txt` file formatted according to the [WordPress.org plugin readme standard](https://wordpress.org/plugins/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. @@ -127,7 +132,7 @@ This library supports a couple of different ways to release updates on GitHub. P To release version 1.2.3, create a new Git tag named `v1.2.3` or `1.2.3`. That's it. - PUC doesn't require strict adherence to [SemVer](http://semver.org/). These are all valid tag names: `v1.2.3`, `v1.2-foo`, `1.2.3_rc1-ABC`, `1.2.3.4.5`. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. If that's a problem, you might want to use GitHub releases or branches instead. + PUC doesn't require strict adherence to [SemVer](https://semver.org/). These are all valid tag names: `v1.2.3`, `v1.2-foo`, `1.2.3_rc1-ABC`, `1.2.3.4.5`. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. If that's a problem, you might want to use GitHub releases or branches instead. - **Stable branch** @@ -175,7 +180,9 @@ The library will pull update details from the following parts of a release/tag/b ```php require 'plugin-update-checker/plugin-update-checker.php'; - $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( + use YahnisElsts\PluginUpdateChecker\v5\PucFactory; + + $myUpdateChecker = PucFactory::buildUpdateChecker( 'https://bitbucket.org/user-name/repo-name', __FILE__, 'unique-plugin-or-theme-slug' @@ -214,7 +221,7 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli You can skip the "stable tag" bit and just create a new Git tag named `v1.2.3` or `1.2.3`. The update checker will look at the most recent tags and pick the one that looks like the highest version number. - PUC doesn't require strict adherence to [SemVer](http://semver.org/). These are all valid tag names: `v1.2.3`, `v1.2-foo`, `1.2.3_rc1-ABC`, `1.2.3.4.5`. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. + PUC doesn't require strict adherence to [SemVer](https://semver.org/). These are all valid tag names: `v1.2.3`, `v1.2-foo`, `1.2.3_rc1-ABC`, `1.2.3.4.5`. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. - **Stable branch** @@ -227,11 +234,13 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli ### GitLab Integration 1. Download [the latest release](https://github.com/YahnisElsts/plugin-update-checker/releases/latest) and copy the `plugin-update-checker` directory to your plugin or theme. -2. Add the following code to the main plugin file or `functions.php`: +2. Add the following code to the main plugin file or `functions.php` and define how you want to check for updates from Gitlab (refer to: [Gitlab: How to Release an Update](#how-to-release-a-gitlab-update)): ```php require 'plugin-update-checker/plugin-update-checker.php'; - $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( + use YahnisElsts\PluginUpdateChecker\v5\PucFactory; + + $myUpdateChecker = PucFactory::buildUpdateChecker( 'https://gitlab.com/user-name/repo-name/', __FILE__, 'unique-plugin-or-theme-slug' @@ -239,63 +248,125 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli //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_v4p10_Vcs_PluginUpdateChecker( - new Puc_v4p10_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'), - __FILE__, - 'unique-plugin-or-theme-slug' - ); - //Optional: Add setAuthentication(...) and setBranch(...) as shown above. - ``` - If you're using a self-hosted GitLab instance and [subgroups or nested groups](https://docs.gitlab.com/ce/user/group/subgroups/index.html), you have to tell the update checker which parts of the URL are subgroups: - ```php - $myUpdateChecker = new Puc_v4p10_Vcs_PluginUpdateChecker( - new Puc_v4p10_Vcs_GitLabApi('https://myserver.com/group-name/subgroup-level1/subgroup-level2/subgroup-level3/repo-name/', null, 'subgroup-level1/subgroup-level2/subgroup-level3'), - __FILE__, - 'unique-plugin-or-theme-slug' - ); - - ``` + use YahnisElsts\PluginUpdateChecker\v5p4\Vcs\PluginUpdateChecker; + use YahnisElsts\PluginUpdateChecker\v5p4\Vcs\GitLabApi; + + $myUpdateChecker = new PluginUpdateChecker( + new GitLabApi('https://myserver.com/user-name/repo-name/'), + __FILE__, + 'unique-plugin-or-theme-slug' + ); + //Optional: Add setAuthentication(...) and setBranch(...) as shown above. + ``` + If you're using a self-hosted GitLab instance and [subgroups or nested groups](https://docs.gitlab.com/ce/user/group/subgroups/index.html), you have to tell the update checker which parts of the URL are subgroups: + ```php + use YahnisElsts\PluginUpdateChecker\v5p4\Vcs\PluginUpdateChecker; + use YahnisElsts\PluginUpdateChecker\v5p4\Vcs\GitLabApi; + $myUpdateChecker = new PluginUpdateChecker( + new GitLabApi( + 'https://myserver.com/group-name/subgroup-level1/subgroup-level2/subgroup-level3/repo-name/', + null, + 'subgroup-level1/subgroup-level2/subgroup-level3' + ), + __FILE__, + 'unique-plugin-or-theme-slug' + ); + ``` + 3. Plugins only: Add a `readme.txt` file formatted according to the [WordPress.org plugin readme standard](https://wordpress.org/plugins/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 +#### How to Release a GitLab Update -GitLab doesn't have an equivalent to GitHub's releases, so the process is slightly different. You can use any of the following approaches: +A GitLab repository can be checked for updates in 3 different ways. + +- **GitLab releases** -- **Tags** + Create a new release using the "Releases" feature on GitLab. The tag name should match the version number. You can add a `v` prefix to the tag, like `v1.2.3`. Releases that are marked as ["Upcoming Release"](https://docs.gitlab.com/ee/user/project/releases/index.html#upcoming-releases) will be automatically ignored. - To release version 1.2.3, create a new Git tag named `v1.2.3` or `1.2.3`. That's it. + If you want to use custom release assets, call the `enableReleaseAssets()` method after creating the update checker instance: + ```php + $myUpdateChecker->getVcsApi()->enableReleaseAssets(); + ``` - PUC doesn't require strict adherence to [SemVer](http://semver.org/). These are all valid tag names: `v1.2.3`, `v1.2-foo`, `1.2.3_rc1-ABC`, `1.2.3.4.5`. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. If that's a problem, you might want to use GitLab branches instead. + By default, PUC will use the first available asset link, regardless of type. You can pass a regular expression to `enableReleaseAssets()` to make it pick the first link where the URL matches the regex. For example: + ```php + $myUpdateChecker->getVcsApi()->enableReleaseAssets('/\.zip($|[?&#])/i'); + ``` + + **Tip:** You can use a Gitlab CI/CD Pipeline to automatically generate your update on release using a Generic Package. For more information about generic packages, refer to the following links: + - [Gitlab CI/CD Release Documentation](https://docs.gitlab.com/ee/user/project/releases/#create-release-from-gitlab-ci) + - [Gitlab Release Assets as Generic Package Documentation](https://gitlab.com/gitlab-org/release-cli/-/tree/master/docs/examples/release-assets-as-generic-package/) + - [Example .gitlab-ci.yml file using Release Generic Packages for generating a update package from the Sensei-LMS wordpress plugin](https://gist.github.com/timwiel/9dfd3526c768efad4973254085e065ce) -- **Stable branch** +- **Tags** + + To release version 1.2.3, create a new Git tag named `v1.2.3` or `1.2.3`. The update checker will look at recent tags and use the one that looks like the highest version number. - Point the update checker at a stable, production-ready branch: - ```php - $updateChecker->setBranch('branch-name'); - ``` - PUC will periodically check the `Version` header in the main plugin file or `style.css` and display a notification if it's greater than the installed version. - - 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. + PUC doesn't require strict adherence to [SemVer](https://semver.org/). However, be warned that it's not smart enough to filter out alpha/beta/RC versions. If that's a problem, you might want to use GitLab branches instead. + +- **Stable branch** + + Point the update checker at any stable, production-ready branch: + ```php + $myUpdateChecker->setBranch('stable-branch-name'); + ``` + PUC will periodically check the `Version` header in the main plugin file or `style.css` and display a notification if it's greater than the installed version. Caveat: Even if you set the branch to `main` (the default) or `master` (the historical default), the update checker will still look for recent releases and tags first. + +Migrating from 4.x +------------------ + +Older versions of the library didn't use namespaces. Code that was written for those versions will need to be updated to work with the current version. At a minimum, you'll need to change the factory class name. + +Old code: +```php +$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( + 'https://example.com/info.json', + __FILE__, + 'my-slug' +); +``` + +New code: +```php +use YahnisElsts\PluginUpdateChecker\v5\PucFactory; + +$myUpdateChecker = PucFactory::buildUpdateChecker( + 'https://example.com/info.json', + __FILE__, + 'my-slug' +); +``` + +Other classes have also been renamed, usually by simply removing the `Puc_vXpY_` prefix and converting `Category_Thing` to `Category\Thing`. Here's a table of the most commonly used classes and their new names: + +| Old class name | New class name | +|-------------------------------------|----------------------------------------------------------------| +| `Puc_v4_Factory` | `YahnisElsts\PluginUpdateChecker\v5\PucFactory` | +| `Puc_v4p13_Factory` | `YahnisElsts\PluginUpdateChecker\v5p4\PucFactory` | +| `Puc_v4p13_Plugin_UpdateChecker` | `YahnisElsts\PluginUpdateChecker\v5p4\Plugin\UpdateChecker` | +| `Puc_v4p13_Theme_UpdateChecker` | `YahnisElsts\PluginUpdateChecker\v5p4\Theme\UpdateChecker` | +| `Puc_v4p13_Vcs_PluginUpdateChecker` | `YahnisElsts\PluginUpdateChecker\v5p4\Vcs\PluginUpdateChecker` | +| `Puc_v4p13_Vcs_ThemeUpdateChecker` | `YahnisElsts\PluginUpdateChecker\v5p4\Vcs\ThemeUpdateChecker` | +| `Puc_v4p13_Vcs_GitHubApi` | `YahnisElsts\PluginUpdateChecker\v5p4\Vcs\GitHubApi` | +| `Puc_v4p13_Vcs_GitLabApi` | `YahnisElsts\PluginUpdateChecker\v5p4\Vcs\GitLabApi` | +| `Puc_v4p13_Vcs_BitBucketApi` | `YahnisElsts\PluginUpdateChecker\v5p4\Vcs\BitBucketApi` | 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). +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 --------- -- [This blog post](http://w-shadow.com/blog/2010/09/02/automatic-updates-for-any-plugin/) has more information about the update checker API. *Slightly out of date.* +- [This blog post](https://w-shadow.com/blog/2010/09/02/automatic-updates-for-any-plugin/) has more information about the update checker API. *Slightly out of date.* - [Debug Bar](https://wordpress.org/plugins/debug-bar/) - useful for testing and debugging the update checker. - [Update format reference](https://docs.google.com/spreadsheets/d/1eOBbW7Go2qEQXReOOCdidMTf_tDYRq4JfegcO1CBPIs/edit?usp=sharing) - describes all fields supported by the JSON-based update information format used by the update checker. Only covers plugins. Themes use a similar but more limited format. -- [Securing download links](http://w-shadow.com/blog/2013/03/19/plugin-updates-securing-download-links/) - a general overview. -- [A GUI for entering download credentials](http://open-tools.net/documentation/tutorial-automatic-updates.html#wordpress) -- [Theme Update Checker](http://w-shadow.com/blog/2011/06/02/automatic-updates-for-commercial-themes/) - an older, theme-only variant of this update checker. +- [Securing download links](https://w-shadow.com/blog/2013/03/19/plugin-updates-securing-download-links/) - a general overview. +- [A GUI for entering download credentials](https://open-tools.net/documentation/tutorial-automatic-updates.html#wordpress) +- [Theme Update Checker](https://w-shadow.com/blog/2011/06/02/automatic-updates-for-commercial-themes/) - an older, theme-only variant of this update checker. diff --git a/plugin-update-checker/composer.json b/plugin-update-checker/composer.json old mode 100755 new mode 100644 index db487f3..f7af7eb --- a/plugin-update-checker/composer.json +++ b/plugin-update-checker/composer.json @@ -9,15 +9,15 @@ { "name": "Yahnis Elsts", "email": "whiteshadow@w-shadow.com", - "homepage": "http://w-shadow.com/", + "homepage": "https://w-shadow.com/", "role": "Developer" } ], "require": { - "php": ">=5.2.0", + "php": ">=5.6.20", "ext-json": "*" }, "autoload": { - "files": ["load-v4p10.php"] + "files": ["load-v5p4.php"] } } diff --git a/plugin-update-checker/css/puc-debug-bar.css b/plugin-update-checker/css/puc-debug-bar.css old mode 100755 new mode 100644 index 2cb3f8e..649db4f --- a/plugin-update-checker/css/puc-debug-bar.css +++ b/plugin-update-checker/css/puc-debug-bar.css @@ -1,4 +1,4 @@ -.puc-debug-bar-panel-v4 pre { +.puc-debug-bar-panel-v5 pre { margin-top: 0; } diff --git a/plugin-update-checker/js/debug-bar.js b/plugin-update-checker/js/debug-bar.js old mode 100755 new mode 100644 index b8435db..80f53f1 --- a/plugin-update-checker/js/debug-bar.js +++ b/plugin-update-checker/js/debug-bar.js @@ -2,7 +2,7 @@ jQuery(function($) { function runAjaxAction(button, action) { button = $(button); - var panel = button.closest('.puc-debug-bar-panel-v4'); + var panel = button.closest('.puc-debug-bar-panel-v5'); var responseBox = button.closest('td').find('.puc-ajax-response'); responseBox.text('Processing...').show(); @@ -14,19 +14,21 @@ jQuery(function($) { _wpnonce: panel.data('nonce') }, function(data) { + //The response contains HTML that should already be escaped in server-side code. + //phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html responseBox.html(data); }, 'html' ); } - $('.puc-debug-bar-panel-v4 input[name="puc-check-now-button"]').click(function() { - runAjaxAction(this, 'puc_v4_debug_check_now'); + $('.puc-debug-bar-panel-v5 input[name="puc-check-now-button"]').on('click', function() { + runAjaxAction(this, 'puc_v5_debug_check_now'); return false; }); - $('.puc-debug-bar-panel-v4 input[name="puc-request-info-button"]').click(function() { - runAjaxAction(this, 'puc_v4_debug_request_info'); + $('.puc-debug-bar-panel-v5 input[name="puc-request-info-button"]').on('click', function() { + runAjaxAction(this, 'puc_v5_debug_request_info'); return false; }); @@ -34,7 +36,7 @@ jQuery(function($) { // Debug Bar uses the panel class name as part of its link and container IDs. This means we can // end up with multiple identical IDs if more than one plugin uses the update checker library. // Fix it by replacing the class name with the plugin slug. - var panels = $('#debug-menu-targets').find('.puc-debug-bar-panel-v4'); + var panels = $('#debug-menu-targets').find('.puc-debug-bar-panel-v5'); panels.each(function() { var panel = $(this); var uid = panel.data('uid'); diff --git a/plugin-update-checker/languages/plugin-update-checker-ca.mo b/plugin-update-checker/languages/plugin-update-checker-ca.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-ca.po b/plugin-update-checker/languages/plugin-update-checker-ca.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-cs_CZ.mo b/plugin-update-checker/languages/plugin-update-checker-cs_CZ.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-cs_CZ.po b/plugin-update-checker/languages/plugin-update-checker-cs_CZ.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-da_DK.mo b/plugin-update-checker/languages/plugin-update-checker-da_DK.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-da_DK.po b/plugin-update-checker/languages/plugin-update-checker-da_DK.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-de_DE.mo b/plugin-update-checker/languages/plugin-update-checker-de_DE.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-de_DE.po b/plugin-update-checker/languages/plugin-update-checker-de_DE.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_AR.mo b/plugin-update-checker/languages/plugin-update-checker-es_AR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_AR.po b/plugin-update-checker/languages/plugin-update-checker-es_AR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CL.mo b/plugin-update-checker/languages/plugin-update-checker-es_CL.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CL.po b/plugin-update-checker/languages/plugin-update-checker-es_CL.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CO.mo b/plugin-update-checker/languages/plugin-update-checker-es_CO.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CO.po b/plugin-update-checker/languages/plugin-update-checker-es_CO.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CR.mo b/plugin-update-checker/languages/plugin-update-checker-es_CR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_CR.po b/plugin-update-checker/languages/plugin-update-checker-es_CR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_DO.mo b/plugin-update-checker/languages/plugin-update-checker-es_DO.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_DO.po b/plugin-update-checker/languages/plugin-update-checker-es_DO.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_ES.mo b/plugin-update-checker/languages/plugin-update-checker-es_ES.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_ES.po b/plugin-update-checker/languages/plugin-update-checker-es_ES.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_GT.mo b/plugin-update-checker/languages/plugin-update-checker-es_GT.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_GT.po b/plugin-update-checker/languages/plugin-update-checker-es_GT.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_HN.mo b/plugin-update-checker/languages/plugin-update-checker-es_HN.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_HN.po b/plugin-update-checker/languages/plugin-update-checker-es_HN.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_MX.mo b/plugin-update-checker/languages/plugin-update-checker-es_MX.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_MX.po b/plugin-update-checker/languages/plugin-update-checker-es_MX.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_PE.mo b/plugin-update-checker/languages/plugin-update-checker-es_PE.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_PE.po b/plugin-update-checker/languages/plugin-update-checker-es_PE.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_PR.mo b/plugin-update-checker/languages/plugin-update-checker-es_PR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_PR.po b/plugin-update-checker/languages/plugin-update-checker-es_PR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_UY.mo b/plugin-update-checker/languages/plugin-update-checker-es_UY.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_UY.po b/plugin-update-checker/languages/plugin-update-checker-es_UY.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_VE.mo b/plugin-update-checker/languages/plugin-update-checker-es_VE.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-es_VE.po b/plugin-update-checker/languages/plugin-update-checker-es_VE.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fa_IR.mo b/plugin-update-checker/languages/plugin-update-checker-fa_IR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fa_IR.po b/plugin-update-checker/languages/plugin-update-checker-fa_IR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fr_CA.mo b/plugin-update-checker/languages/plugin-update-checker-fr_CA.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fr_CA.po b/plugin-update-checker/languages/plugin-update-checker-fr_CA.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fr_FR.mo b/plugin-update-checker/languages/plugin-update-checker-fr_FR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-fr_FR.po b/plugin-update-checker/languages/plugin-update-checker-fr_FR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-hu_HU.mo b/plugin-update-checker/languages/plugin-update-checker-hu_HU.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-hu_HU.po b/plugin-update-checker/languages/plugin-update-checker-hu_HU.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-it_IT.mo b/plugin-update-checker/languages/plugin-update-checker-it_IT.mo old mode 100755 new mode 100644 index 6a2c57d98f667286c49857745f52a20c6a54107c..4b40d32304dd2746496014f89ffc22d7a2b97b53 GIT binary patch literal 1135 zcmZWo%We}f6g5yl3JU}aHn6x(hWBZYo!8co?Ne#7)JzW+epTRe#dQ`8==#i{P6h(1u`EFE?qRKj2SEvEYE~`;Ym5uhs z>QU@kHLA3%32cJw9_EM=_#oWRGo?+V?7Q2#*>|?b$?P zy8L+FotSj!wY$esv2w|<1GO@O-ip9==)O)Aslh;7XVeHi)8ZB8D7p3XE2%6g3^^Vk zyTf&ImNAXcA2{L0Q|)tW^o}k^cM~%T6HN(P?`)RYlTpdzgY}6nU^brQEu+X3c2CWQ z7ZEv|%`GMv3QnXbb>S?x-j9=(eq;R@QqL2~(0ja?Qqf!_<@lG%`ECD~W#$oVRr~{k C>Q&|d delta 531 zcmY+A&r2IY6vrpoSVfDp9#o=)M?ep)6LyzGF^DJ{L>f?RPQ8>#GFb=LnXo@1NFaZM ztm40*C$Ap7Nd5&6?Lm)1PyHACF4Bq*KKpt5<}velf5#q22TxPE3x@ar=0P1yfIdj$ z3VZ?A;4^pt1fD@2jAj@s!bSKOsDUN?7c9o6;csvmZo)J0CCuR)7_AMYj3H+^kPeYX z_ErDCBWbotTAol(2B9*VOoyUF6;juaJ*5em=n3VErY}opx8>Q!`@^_Pk)gJT&i*VW z_nDdFLQSlY1MVU+Kz3H@9*&g*;DD0Z+$D=cDPd^$E~{M z*S@+4Bi;yv4t)`sph~-*38+52YaL0S)|Bp;4TX{)%d}Fm+HyUa$__@HQl(T$&a?eb z<8`6ESa_JFEq`v;k_~Gv`E3;@hgZ~AVb^HYRK84pSc@M8h4K_LNt`5hF2BQe{eP=K qyYM_^0*y)7cSR^*YpSDKC{V1a8yKwV7?-q+HepM}s23N)B6|UA1%vzm diff --git a/plugin-update-checker/languages/plugin-update-checker-it_IT.po b/plugin-update-checker/languages/plugin-update-checker-it_IT.po old mode 100755 new mode 100644 index d894642..db62bb1 --- a/plugin-update-checker/languages/plugin-update-checker-it_IT.po +++ b/plugin-update-checker/languages/plugin-update-checker-it_IT.po @@ -1,38 +1,48 @@ msgid "" msgstr "" "Project-Id-Version: plugin-update-checker\n" -"POT-Creation-Date: 2016-06-29 20:21+0100\n" -"PO-Revision-Date: 2017-01-15 12:24+0100\n" -"Last-Translator: Igor Lückel \n" +"POT-Creation-Date: 2020-08-08 14:36+0300\n" +"PO-Revision-Date: 2022-05-20 00:17+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.5.5\n" +"X-Generator: Poedit 3.0\n" "X-Poedit-Basepath: ..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: __;_e\n" -"Language: de_DE\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: d79\n" +"Language: it_IT\n" "X-Poedit-SearchPath-0: .\n" -#: github-checker.php:137 -msgid "There is no changelog available." -msgstr "Non c'è alcuna sezione di aggiornamento disponibile" - -#: plugin-update-checker.php:852 +#: Puc/v4p11/Plugin/Ui.php:128 msgid "Check for updates" msgstr "Verifica aggiornamenti" -#: plugin-update-checker.php:896 -msgid "This plugin is up to date." -msgstr "Il plugin è aggiornato" +#: Puc/v4p11/Plugin/Ui.php:213 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "Il plugin %s è aggiornato." + +#: Puc/v4p11/Plugin/Ui.php:215 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Una nuova versione del plugin %s è disponibile." -#: plugin-update-checker.php:898 -msgid "A new version of this plugin is available." -msgstr "Una nuova versione del plugin è disponibile" +#: Puc/v4p11/Plugin/Ui.php:217 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Non è possibile verificare se c'è un aggiornamento disponibile per %s." -#: plugin-update-checker.php:900 +#: Puc/v4p11/Plugin/Ui.php:223 #, php-format msgid "Unknown update checker status \"%s\"" -msgstr "Si è verificato un problema sconosciuto \"%s\"" +msgstr "Stato di controllo aggiornamenti sconosciuto \"%s\"" + +#: Puc/v4p11/Vcs/PluginUpdateChecker.php:98 +msgid "There is no changelog available." +msgstr "Non c'è alcun registro delle modifiche disponibile." diff --git a/plugin-update-checker/languages/plugin-update-checker-ja.mo b/plugin-update-checker/languages/plugin-update-checker-ja.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-ja.po b/plugin-update-checker/languages/plugin-update-checker-ja.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-nl_BE.mo b/plugin-update-checker/languages/plugin-update-checker-nl_BE.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-nl_BE.po b/plugin-update-checker/languages/plugin-update-checker-nl_BE.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-nl_NL.mo b/plugin-update-checker/languages/plugin-update-checker-nl_NL.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-nl_NL.po b/plugin-update-checker/languages/plugin-update-checker-nl_NL.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-pt_BR.mo b/plugin-update-checker/languages/plugin-update-checker-pt_BR.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-pt_BR.po b/plugin-update-checker/languages/plugin-update-checker-pt_BR.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-ru_RU.mo b/plugin-update-checker/languages/plugin-update-checker-ru_RU.mo new file mode 100644 index 0000000000000000000000000000000000000000..50b330e9332d5024e9bf5f931e5b1e76dca7cd7a GIT binary patch literal 1337 zcmZuw&u<$=6dq`R${Y|}xNvxlltO7{+1&&h*4}=9X zJv7OUR;mz!8|uGcN~*d9Q*njM>_5O?z=^+rZ+7zw+L52Xc{|@X?|X0Uzuubpo?*R) zcn8rzypFh!aBG5i6Y&&5h(8gth`$jr;*FOWTL!KGIq*B+$(I@X9r!NtKTa@q4)_nS z3w(cuv3cM(K$kxOo&vu83S*E|3vvcJ!x6*dYQ4IT&S$k+L)p7YYni5E)E7qPtTU8a zQj(L(s5ca9Ak%C>VnZaUxRFYat*VQ+{yefTldmqzOKM8V+NfnyTzdnm7ZnajQB zJ)p7wmMlhOGICvetgW-JWzX;{eSW=m8SR_n^bm`takk(D{w4m~kNnl6Rz7kEpS7Wo7xu zMBw?2R;G+phIej{P|e6&=7Uix64i7sNaxbTtDVby>4>L=%Gadk%c__46E%ov=|*B2 zU-8eRl3JKdN7T+_KQR<~A)eO>|3u_+B+M`(&ug^PLW`7N&h&a7k;3~#n#T)GHyCW= z_taeA$8kWXPm|mFr{W->i{umN$S=gQVxl>Q<%W>fy&lduB3*Q^ ztsbi*h3*a8=$ZTIy20$j@~-{OKC+L2lXAPfPe^~V)9T@#eT?0te8B7vDv)KQ13o-9)+N{JLMh-GwQXgq3H`cx{G|?z%3j!>U_X4doGg p^$6zwr!DW1J9>c)S9aI#RRwYXL(s|fZP{fYnp literal 0 HcmV?d00001 diff --git a/plugin-update-checker/languages/plugin-update-checker-ru_RU.po b/plugin-update-checker/languages/plugin-update-checker-ru_RU.po new file mode 100644 index 0000000..33a1199 --- /dev/null +++ b/plugin-update-checker/languages/plugin-update-checker-ru_RU.po @@ -0,0 +1,48 @@ +msgid "" +msgstr "" +"Project-Id-Version: plugin-update-checker\n" +"POT-Creation-Date: 2020-08-08 14:36+0300\n" +"PO-Revision-Date: 2021-12-20 17:59+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 2.2\n" +"X-Poedit-Basepath: ..\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: \n" +"Language: ru_RU\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p11/Plugin/Ui.php:128 +msgid "Check for updates" +msgstr "Проверить обновления" + +#: Puc/v4p11/Plugin/Ui.php:213 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "Плагин %s обновлён." + +#: Puc/v4p11/Plugin/Ui.php:215 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Новая версия %s доступна." + +#: Puc/v4p11/Plugin/Ui.php:217 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Не удалось определить, доступны ли обновления для %s." + +#: Puc/v4p11/Plugin/Ui.php:223 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Неизвестный статус средства проверки обновлений \"%s\"" + +#: Puc/v4p11/Vcs/PluginUpdateChecker.php:98 +msgid "There is no changelog available." +msgstr "Журнал изменений отсутствует." diff --git a/plugin-update-checker/languages/plugin-update-checker-sl_SI.mo b/plugin-update-checker/languages/plugin-update-checker-sl_SI.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-sl_SI.po b/plugin-update-checker/languages/plugin-update-checker-sl_SI.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-sv_SE.mo b/plugin-update-checker/languages/plugin-update-checker-sv_SE.mo old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-sv_SE.po b/plugin-update-checker/languages/plugin-update-checker-sv_SE.po old mode 100755 new mode 100644 diff --git a/plugin-update-checker/languages/plugin-update-checker-tr_TR.mo b/plugin-update-checker/languages/plugin-update-checker-tr_TR.mo new file mode 100644 index 0000000000000000000000000000000000000000..58be2f9306dd0e01aa725c03d583ca53bdd536a0 GIT binary patch literal 1118 zcmZWn&uA(EYi8EL z|3fcT#W_dLkt#u@Tq?V#{trF(&_ANz+WCbT?YG~~&U@c{@6G)4+0q+RH zH>2~*AyOlH>8_q_yQT8Vzs6>7pAB>FBwq5t#2acVW{Y|-k9_N(} z`|M@cW-ixukka~|j*T6;#g@H_&ZpFKoa;zy(BF}ZiF~XAk5n9{lq8Lwsk}0B)A=%_ zWN}QGhR$lct{0!3FD!lDq1N5@xxfoo`HVLfu2NdqI+K6KlLP1T@LY$O((Z11m)pCq z)7F=(85oTSsIm5L78biD4y@}7W$9s|y!x(w8C3#4u^bN+aE;g<#7Y2uh1&iB_Og+~Q(_=q9E~m#-@;IwvA`q&lZxM4* h*%@3qXG)dNj%J6mBiduQgCI)C^*rfJ|1>cX{{#HHSPlRH literal 0 HcmV?d00001 diff --git a/plugin-update-checker/languages/plugin-update-checker-tr_TR.po b/plugin-update-checker/languages/plugin-update-checker-tr_TR.po new file mode 100644 index 0000000..ba5e291 --- /dev/null +++ b/plugin-update-checker/languages/plugin-update-checker-tr_TR.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: 2021-11-15 19:07+0300\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 3.0\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: Emre Erkan \n" +"Language: tr\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p3/Plugin/UpdateChecker.php:395 +msgid "Check for updates" +msgstr "Güncellemeleri kontrol et" + +#: Puc/v4p3/Plugin/UpdateChecker.php:548 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "%s eklentisi güncel." + +#: Puc/v4p3/Plugin/UpdateChecker.php:550 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "%s eklentisinin yeni bir sürümü mevcut." + +#: Puc/v4p3/Plugin/UpdateChecker.php:552 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "%s için güncelleme olup olmadığı belirlenemedi." + +#: Puc/v4p3/Plugin/UpdateChecker.php:558 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Bilinmeyen güncelleme denetleyicisi durumu \"%s\"" + +#: Puc/v4p3/Vcs/PluginUpdateChecker.php:95 +msgid "There is no changelog available." +msgstr "Kullanılabilir bir değişiklik yok." diff --git a/plugin-update-checker/languages/plugin-update-checker-uk_UA.mo b/plugin-update-checker/languages/plugin-update-checker-uk_UA.mo new file mode 100644 index 0000000000000000000000000000000000000000..79494e524ebd28dcba540d54c7f4949d5a436508 GIT binary patch literal 1309 zcmZuwO>YxN7#`a6L*`J?a}O_(LZM-{yPHs=HA@94(heN%>IG?f}VQqrO)i<3(}EaKQpuM^S;mXuKm}?6TdL5 z4-lUqT8QI_M+mz{h!cpH2txdcm_+=I2oWD0V{9I{0OY`*fFHiY*zdqkasK07#^!+k z0KW!KPcZfwPy>GiZUIjM{{@0lF3=g$8LrrS7n+;~Zn09Ae7m55^u^L;)2YDX%eD1sCoe$2Pn+DIVUB`^`s3&+!L@NQ+7OpMK zABgZAx7J9d7E<%podLROaa(^rNTOKQ?F&+w(BWe13ZFa3Q<2P;gyQqElXhd-3ux|U ztZP5;t3nDD=~M;OOhq@=YbLph5`HCBD_KAi?-R!?oT=Nv zU>ly6Q=S`!9-TTxcI%!DJ&(R5mynM0#n9h-bRnFz+mhj4@O-*^x1wD1X3v1)f#RR3 zA1L`Q%~eMhzoN%w4#yF|%c!7x&C_^Q71Wj*16nL}tf~5l_rE9*oVn*kI-{wy(^v z_?gTzvs2tJ9u({5b(#0n?2!4jSOhGx51C-cI*DmKm7sfZ|UStu|vFUgWo2?dJ# zgc^qh{C1>$@u>QfL4lPtBz%E^BAdmA{e{1!XIS;LY0s>hQtXC3j-Uzxi-(oXvt)N~ e(TmOhac^_B%Vwy(g_1+_)VeFXzd5TNhy4cu&FZoM literal 0 HcmV?d00001 diff --git a/plugin-update-checker/languages/plugin-update-checker-uk_UA.po b/plugin-update-checker/languages/plugin-update-checker-uk_UA.po new file mode 100644 index 0000000..b84b16e --- /dev/null +++ b/plugin-update-checker/languages/plugin-update-checker-uk_UA.po @@ -0,0 +1,48 @@ +msgid "" +msgstr "" +"Project-Id-Version: plugin-update-checker\n" +"POT-Creation-Date: 2020-08-08 14:36+0300\n" +"PO-Revision-Date: 2021-12-20 17:55+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 2.2\n" +"X-Poedit-Basepath: ..\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" +"Last-Translator: \n" +"Language: uk_UA\n" +"X-Poedit-SearchPath-0: .\n" + +#: Puc/v4p11/Plugin/Ui.php:128 +msgid "Check for updates" +msgstr "Перевірити оновлення" + +#: Puc/v4p11/Plugin/Ui.php:213 +#, php-format +msgctxt "the plugin title" +msgid "The %s plugin is up to date." +msgstr "Плагін %s оновлено." + +#: Puc/v4p11/Plugin/Ui.php:215 +#, php-format +msgctxt "the plugin title" +msgid "A new version of the %s plugin is available." +msgstr "Нова версія %s доступна." + +#: Puc/v4p11/Plugin/Ui.php:217 +#, php-format +msgctxt "the plugin title" +msgid "Could not determine if updates are available for %s." +msgstr "Не вдалося визначити, чи доступні оновлення для %s." + +#: Puc/v4p11/Plugin/Ui.php:223 +#, php-format +msgid "Unknown update checker status \"%s\"" +msgstr "Невідомий статус перевірки оновлень \"%s\"" + +#: Puc/v4p11/Vcs/PluginUpdateChecker.php:98 +msgid "There is no changelog available." +msgstr "Немає доступного журналу змін." diff --git a/plugin-update-checker/languages/plugin-update-checker-zh_CN.mo b/plugin-update-checker/languages/plugin-update-checker-zh_CN.mo old mode 100755 new mode 100644 index c0fc4055778c6587af79724223e28c087346aa9c..86d114472907c99814f248ed3e063f8bd0ce5819 GIT binary patch delta 401 zcmZ3&F^#kSo)F7a1|Z-BVi_P#0b*VtUIWA+@BoMff%qX1O9Js{AXWfkUPcB6B_OQ_ zq-wh}pm*5RU-uVqloKQA)x$ zzbI89GcPT_C^xYrGe1uuF)6>aL_u}pNjILb%+zv)l+=>M%$(xMe2kxjjC2hQb&V_) z42`S|4YUm`3=AfVFe?~mWI7b5CYI#qWo0JjrRyc<=h|`k09mDp>8ZLQsfoE(3UI!a zLRCh*v)^PTrXnUi+>CCM;}}0G8R!~V z=o*+P7+6>t8fY6>7#MK*B<7`;CZ?zAhNLFuS}9E4!c;U_gSl~X5|g}AacW{oex5^F kNl|`gv0ie1t{q&tl|ofUytCir70eowA2T~lHeg8u04@+Uvj6}9 diff --git a/plugin-update-checker/languages/plugin-update-checker-zh_CN.po b/plugin-update-checker/languages/plugin-update-checker-zh_CN.po old mode 100755 new mode 100644 index 005b4d0..d4f7056 --- a/plugin-update-checker/languages/plugin-update-checker-zh_CN.po +++ b/plugin-update-checker/languages/plugin-update-checker-zh_CN.po @@ -1,48 +1,57 @@ msgid "" msgstr "" "Project-Id-Version: plugin-update-checker\n" -"POT-Creation-Date: 2017-11-24 17:02+0200\n" -"PO-Revision-Date: 2020-08-04 08:10+0800\n" +"POT-Creation-Date: 2022-01-29 12:09+0800\n" +"PO-Revision-Date: 2022-01-29 12:10+0800\n" +"Last-Translator: Seaton Jiang \n" "Language-Team: \n" +"Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.4\n" +"X-Generator: Poedit 2.4.3\n" "X-Poedit-Basepath: ..\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" -"Last-Translator: Seaton Jiang \n" -"Language: zh_CN\n" "X-Poedit-SearchPath-0: .\n" -#: Puc/v4p3/Plugin/UpdateChecker.php:395 +#: Puc/v4p11/Plugin/Ui.php:54 +msgid "View details" +msgstr "查看详情" + +#: Puc/v4p11/Plugin/Ui.php:77 +#, php-format +msgid "More information about %s" +msgstr "%s 的更多信息" + +#: Puc/v4p11/Plugin/Ui.php:128 msgid "Check for updates" msgstr "检查更新" -#: Puc/v4p3/Plugin/UpdateChecker.php:548 +#: Puc/v4p11/Plugin/Ui.php:214 #, php-format msgctxt "the plugin title" msgid "The %s plugin is up to date." msgstr "%s 目前是最新版本。" -#: Puc/v4p3/Plugin/UpdateChecker.php:550 +#: Puc/v4p11/Plugin/Ui.php:216 #, php-format msgctxt "the plugin title" msgid "A new version of the %s plugin is available." msgstr "%s 当前有可用的更新。" -#: Puc/v4p3/Plugin/UpdateChecker.php:552 +#: Puc/v4p11/Plugin/Ui.php:218 #, php-format msgctxt "the plugin title" msgid "Could not determine if updates are available for %s." msgstr "%s 无法确定是否有可用的更新。" -#: Puc/v4p3/Plugin/UpdateChecker.php:558 +#: Puc/v4p11/Plugin/Ui.php:224 #, php-format msgid "Unknown update checker status \"%s\"" msgstr "未知的更新检查状态:%s" -#: Puc/v4p3/Vcs/PluginUpdateChecker.php:95 +#: Puc/v4p11/Vcs/PluginUpdateChecker.php:100 msgid "There is no changelog available." msgstr "没有可用的更新日志。" diff --git a/plugin-update-checker/languages/plugin-update-checker.pot b/plugin-update-checker/languages/plugin-update-checker.pot old mode 100755 new mode 100644 index 29d1f40..5b6319c --- a/plugin-update-checker/languages/plugin-update-checker.pot +++ b/plugin-update-checker/languages/plugin-update-checker.pot @@ -2,48 +2,48 @@ msgid "" msgstr "" "Project-Id-Version: plugin-update-checker\n" -"POT-Creation-Date: 2020-08-08 14:36+0300\n" +"POT-Creation-Date: 2022-07-29 15:34+0300\n" "PO-Revision-Date: 2016-01-10 20:59+0100\n" -"Last-Translator: Tamás András Horváth \n" +"Last-Translator: \n" "Language-Team: \n" "Language: en_US\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.4\n" -"X-Poedit-Basepath: ..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.1.1\n" +"X-Poedit-Basepath: ..\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" "X-Poedit-SearchPath-0: .\n" -#: Puc/v4p10/Plugin/Ui.php:128 +#: Puc/v5p4/Plugin/Ui.php:128 msgid "Check for updates" msgstr "" -#: Puc/v4p10/Plugin/Ui.php:213 +#: Puc/v5p4/Plugin/Ui.php:214 #, php-format msgctxt "the plugin title" msgid "The %s plugin is up to date." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:215 +#: Puc/v5p4/Plugin/Ui.php:216 #, php-format msgctxt "the plugin title" msgid "A new version of the %s plugin is available." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:217 +#: Puc/v5p4/Plugin/Ui.php:218 #, php-format msgctxt "the plugin title" msgid "Could not determine if updates are available for %s." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:223 +#: Puc/v5p4/Plugin/Ui.php:224 #, php-format msgid "Unknown update checker status \"%s\"" msgstr "" -#: Puc/v4p10/Vcs/PluginUpdateChecker.php:98 +#: Puc/v5p4/Vcs/PluginUpdateChecker.php:100 msgid "There is no changelog available." msgstr "" diff --git a/plugin-update-checker/license.txt b/plugin-update-checker/license.txt old mode 100755 new mode 100644 index be948f6..7fff536 --- a/plugin-update-checker/license.txt +++ b/plugin-update-checker/license.txt @@ -1,4 +1,4 @@ -Copyright (c) 2017 Jānis Elsts +Copyright (c) 2023 Jānis Elsts Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/plugin-update-checker/load-v5p4.php b/plugin-update-checker/load-v5p4.php new file mode 100644 index 0000000..2cd9580 --- /dev/null +++ b/plugin-update-checker/load-v5p4.php @@ -0,0 +1,34 @@ + Plugin\UpdateChecker::class, + 'Theme\\UpdateChecker' => Theme\UpdateChecker::class, + + 'Vcs\\PluginUpdateChecker' => Vcs\PluginUpdateChecker::class, + 'Vcs\\ThemeUpdateChecker' => Vcs\ThemeUpdateChecker::class, + + 'GitHubApi' => Vcs\GitHubApi::class, + 'BitBucketApi' => Vcs\BitBucketApi::class, + 'GitLabApi' => Vcs\GitLabApi::class, + ) + as $pucGeneralClass => $pucVersionedClass +) { + MajorFactory::addVersion($pucGeneralClass, $pucVersionedClass, '5.4'); + //Also add it to the minor-version factory in case the major-version factory + //was already defined by another, older version of the update checker. + MinorFactory::addVersion($pucGeneralClass, $pucVersionedClass, '5.4'); +} + diff --git a/plugin-update-checker/plugin-update-checker.php b/plugin-update-checker/plugin-update-checker.php old mode 100755 new mode 100644 index 5a03ddb..da4cb1e --- a/plugin-update-checker/plugin-update-checker.php +++ b/plugin-update-checker/plugin-update-checker.php @@ -1,10 +1,10 @@ =') ) { - require __DIR__ . '/ParsedownModern.php'; - } else { - require __DIR__ . '/ParsedownLegacy.php'; - } + require __DIR__ . '/ParsedownModern.php'; } diff --git a/plugin-update-checker/vendor/ParsedownModern.php b/plugin-update-checker/vendor/ParsedownModern.php old mode 100755 new mode 100644 diff --git a/plugin-update-checker/vendor/PucReadmeParser.php b/plugin-update-checker/vendor/PucReadmeParser.php old mode 100755 new mode 100644 index 1f5cec9..a794c49 --- a/plugin-update-checker/vendor/PucReadmeParser.php +++ b/plugin-update-checker/vendor/PucReadmeParser.php @@ -241,7 +241,11 @@ function user_sanitize( $text, $strict = false ) { // whitelisted chars } function sanitize_text( $text ) { // not fancy - $text = strip_tags($text); + $text = function_exists('wp_strip_all_tags') + ? wp_strip_all_tags($text) + //phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter -- Using wp_strip_all_tags() if available + : strip_tags($text); + $text = esc_html($text); $text = trim($text); return $text; diff --git a/widgets/translator.php b/widgets/translator.php old mode 100755 new mode 100644 diff --git a/widgets/zappbar_sidebar.php b/widgets/zappbar_sidebar.php old mode 100755 new mode 100644 diff --git a/zappbar.php b/zappbar.php index e103af5..8f2f6f6 100644 --- a/zappbar.php +++ b/zappbar.php @@ -3,13 +3,13 @@ Plugin Name: ZappBar Plugin URI: https://github.com/kmhcreative/zappbar Description: Adds mobile-friendly web app navigation and toolbars to any WordPress theme. -Version: 0.2.9 +Version: 0.3.0 Author: K.M. Hansen Author URI: http://www.kmhcreative.com License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html -Copyright 2012-2022 K.M. Hansen (email : software@kmhcreative.com) +Copyright 2012-2024 K.M. Hansen (email : software@kmhcreative.com) ==== Beta Version Disclaimer ===== @@ -79,13 +79,16 @@ function zb_activate($reset = false) { ), 'zappbar_social' => array( + 'zb_seo_meta' => 'off', 'fb_default_img' => '', 'twitter_id' => '', + 'mastodon_id' => '', 'phone_number' => '', 'email_address' => '', 'social_panel' => array( 'facebook' => 'facebook', - 'twitter' => 'twitter', + 'threads' => 'threads', + 'bluesky' => 'bluesky', 'google' => 'google', 'reddit' => 'reddit', 'linkedin' => 'linkedin', @@ -251,7 +254,7 @@ function zappbar_pluginfo($whichinfo = null) { 'plugin_url' => plugin_dir_url(__FILE__), 'plugin_path' => plugin_dir_path(__FILE__), 'plugin_basename' => plugin_basename(__FILE__), - 'version' => '0.2.9' + 'version' => '0.3.0' ); // Combine em. $zappbar_pluginfo = array_merge($zappbar_pluginfo, $zappbar_addinfo); @@ -271,12 +274,6 @@ function zappbar_pluginfo($whichinfo = null) { @require('functions/class.settings-api.php'); @require('functions/aq_resizer.php'); @require('options/zappbar_options.php'); - @require('plugin-update-checker/plugin-update-checker.php'); - $ZappBarUpdateChecker = Puc_v4_Factory::buildUpdateChecker( - 'https://github.com/kmhcreative/zappbar', - __FILE__,'zappbar' - ); - $ZappBarUpdateChecker->getVcsApi()->enableReleaseAssets(); } else { // We are on the front end @require('functions/utility_functions.php'); @@ -284,6 +281,15 @@ function zappbar_pluginfo($whichinfo = null) { @require('includes/html_inject.php'); } +// Plugin Update Check can no longer be inside if-else +@require('plugin-update-checker/plugin-update-checker.php'); +use YahnisElsts\PluginUpdateChecker\v5\PucFactory; +$ZappBarUpdateChecker = PucFactory::buildUpdateChecker( +'https://github.com/kmhcreative/zappbar', + __FILE__,'zappbar' +); +$ZappBarUpdateChecker->getVcsApi()->enableReleaseAssets(); + // Load all the widgets foreach (glob(plugin_dir_path(__FILE__) . 'widgets/*.php') as $widgefile) { require_once($widgefile);