From ea85457cbf0c6f18271d44c20d0391ee2392d2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20N=C3=B6thlich?= Date: Fri, 6 Sep 2019 18:10:14 +0200 Subject: [PATCH] Remove github-updater since all plugins are updated inside the repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrian Nöthlich --- wp-content/plugins/github-updater/CHANGES.md | 961 ---------- wp-content/plugins/github-updater/LICENSE | 339 ---- wp-content/plugins/github-updater/README.md | 37 - .../assets/GitHub_Updater_logo_small.png | Bin 5237 -> 0 bytes .../plugins/github-updater/assets/icon.svg | 104 - .../plugins/github-updater/composer.json | 48 - .../github-updater/css/github-updater.css | 36 - .../plugins/github-updater/github-updater.php | 53 - .../github-updater/js/ghu-install-vanilla.js | 89 - .../plugins/github-updater/js/ghu-install.js | 40 - .../languages/github-updater.pot | 446 ----- .../plugins/github-updater/mu/ghu-loader.php | 84 - wp-content/plugins/github-updater/readme.txt | 59 - .../github-updater/src/GitHub_Updater/API.php | 735 ------- .../src/GitHub_Updater/API/API_Interface.php | 181 -- .../src/GitHub_Updater/API/Bitbucket_API.php | 580 ------ .../API/Bitbucket_Server_API.php | 451 ----- .../src/GitHub_Updater/API/GitHub_API.php | 549 ------ .../src/GitHub_Updater/API/GitLab_API.php | 645 ------- .../src/GitHub_Updater/API/Gitea_API.php | 514 ----- .../GitHub_Updater/API/Language_Pack_API.php | 143 -- .../src/GitHub_Updater/API/Zipfile_API.php | 73 - .../src/GitHub_Updater/Base.php | 951 --------- .../src/GitHub_Updater/Bootstrap.php | 77 - .../src/GitHub_Updater/Branch.php | 108 -- .../src/GitHub_Updater/GHU_Upgrade.php | 65 - .../src/GitHub_Updater/Init.php | 151 -- .../src/GitHub_Updater/Install.php | 560 ------ .../src/GitHub_Updater/Language_Pack.php | 124 -- .../src/GitHub_Updater/Messages.php | 195 -- .../src/GitHub_Updater/Plugin.php | 443 ----- .../src/GitHub_Updater/Readme_Parser.php | 198 -- .../src/GitHub_Updater/Remote_Management.php | 315 --- .../src/GitHub_Updater/Rest_Update.php | 314 --- .../src/GitHub_Updater/Rest_Upgrader_Skin.php | 99 - .../src/GitHub_Updater/Settings.php | 804 -------- .../src/GitHub_Updater/Theme.php | 676 ------- .../src/GitHub_Updater/Traits/API_Common.php | 368 ---- .../Traits/Basic_Auth_Loader.php | 320 ---- .../src/GitHub_Updater/Traits/GHU_Trait.php | 420 ---- .../src/GitHub_Updater/WP_CLI/CLI.php | 78 - .../src/GitHub_Updater/WP_CLI/CLI_Common.php | 33 - .../GitHub_Updater/WP_CLI/CLI_Integration.php | 274 --- .../plugins/github-updater/uninstall.php | 42 - .../vendor/afragen/singleton/LICENSE | 21 - .../vendor/afragen/singleton/README.md | 35 - .../vendor/afragen/singleton/Singleton.php | 108 -- .../vendor/afragen/singleton/composer.json | 33 - .../wordpress-plugin-readme-parser/LICENSE | 674 ------- .../wordpress-plugin-readme-parser/README.md | 15 - .../class-parser.php | 775 -------- .../composer.json | 33 - .../github-updater/vendor/autoload.php | 7 - .../CHANGES.md | 18 - .../persist-admin-notices-dismissal/README.md | 128 -- .../composer.json | 15 - .../dismiss-notice.js | 33 - .../persist-admin-notices-dismissal.php | 190 -- .../vendor/composer/ClassLoader.php | 445 ----- .../github-updater/vendor/composer/LICENSE | 21 - .../vendor/composer/autoload_classmap.php | 12 - .../vendor/composer/autoload_namespaces.php | 10 - .../vendor/composer/autoload_psr4.php | 10 - .../vendor/composer/autoload_real.php | 52 - .../vendor/composer/autoload_static.php | 49 - .../vendor/composer/installed.json | 170 -- .../vendor/erusev/parsedown/LICENSE.txt | 20 - .../vendor/erusev/parsedown/Parsedown.php | 1693 ----------------- .../vendor/erusev/parsedown/README.md | 86 - .../vendor/erusev/parsedown/composer.json | 33 - 70 files changed, 17468 deletions(-) delete mode 100644 wp-content/plugins/github-updater/CHANGES.md delete mode 100644 wp-content/plugins/github-updater/LICENSE delete mode 100644 wp-content/plugins/github-updater/README.md delete mode 100644 wp-content/plugins/github-updater/assets/GitHub_Updater_logo_small.png delete mode 100644 wp-content/plugins/github-updater/assets/icon.svg delete mode 100644 wp-content/plugins/github-updater/composer.json delete mode 100644 wp-content/plugins/github-updater/css/github-updater.css delete mode 100644 wp-content/plugins/github-updater/github-updater.php delete mode 100644 wp-content/plugins/github-updater/js/ghu-install-vanilla.js delete mode 100644 wp-content/plugins/github-updater/js/ghu-install.js delete mode 100644 wp-content/plugins/github-updater/languages/github-updater.pot delete mode 100644 wp-content/plugins/github-updater/mu/ghu-loader.php delete mode 100644 wp-content/plugins/github-updater/readme.txt delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/API_Interface.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/Bitbucket_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/Bitbucket_Server_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/GitHub_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/GitLab_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/Gitea_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/Language_Pack_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/API/Zipfile_API.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Base.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Bootstrap.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Branch.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/GHU_Upgrade.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Init.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Install.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Language_Pack.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Messages.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Plugin.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Readme_Parser.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Remote_Management.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Update.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Upgrader_Skin.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Settings.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Theme.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Traits/API_Common.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Traits/Basic_Auth_Loader.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/Traits/GHU_Trait.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Common.php delete mode 100644 wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Integration.php delete mode 100644 wp-content/plugins/github-updater/uninstall.php delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/singleton/LICENSE delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/singleton/README.md delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/singleton/Singleton.php delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/singleton/composer.json delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/LICENSE delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/README.md delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php delete mode 100644 wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/composer.json delete mode 100644 wp-content/plugins/github-updater/vendor/autoload.php delete mode 100644 wp-content/plugins/github-updater/vendor/collizo4sky/persist-admin-notices-dismissal/CHANGES.md delete mode 100644 wp-content/plugins/github-updater/vendor/collizo4sky/persist-admin-notices-dismissal/README.md delete mode 100644 wp-content/plugins/github-updater/vendor/collizo4sky/persist-admin-notices-dismissal/composer.json delete mode 100644 wp-content/plugins/github-updater/vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js delete mode 100644 wp-content/plugins/github-updater/vendor/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/ClassLoader.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/LICENSE delete mode 100644 wp-content/plugins/github-updater/vendor/composer/autoload_classmap.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/autoload_namespaces.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/autoload_psr4.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/autoload_real.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/autoload_static.php delete mode 100644 wp-content/plugins/github-updater/vendor/composer/installed.json delete mode 100644 wp-content/plugins/github-updater/vendor/erusev/parsedown/LICENSE.txt delete mode 100644 wp-content/plugins/github-updater/vendor/erusev/parsedown/Parsedown.php delete mode 100644 wp-content/plugins/github-updater/vendor/erusev/parsedown/README.md delete mode 100644 wp-content/plugins/github-updater/vendor/erusev/parsedown/composer.json diff --git a/wp-content/plugins/github-updater/CHANGES.md b/wp-content/plugins/github-updater/CHANGES.md deleted file mode 100644 index 8edcd02..0000000 --- a/wp-content/plugins/github-updater/CHANGES.md +++ /dev/null @@ -1,961 +0,0 @@ -#### [unreleased] - -#### 8.8.2 / 2019-07-02 -* added check for `Basic_Auth_Loader::get_credentials()` to match `$slug` and `$git`, fixes edge case [#796](https://github.com/afragen/github-updater/issues/796) -* refactored `Basic_Auth_Loader::get_credentials()` to split out `Basic_Auth_Loader::get_slug_for_credentials()` and `Basic_Auth_Loader::get_type_for_credentials()` -* created more precise adding and removing `Basic_Auth_Loader` hooks -* fixed `Bitbucket_API` return when no tags found - -#### 8.8.1 / 2019-06-11 -* set `homepage` to `PluginURI` or `ThemeURI`, fixes [#791](https://github.com/afragen/github-updater/issues/791) -* fixed Bitbucket release asset updates for proper containing folder structure, thanks @benoitchantre for the bug report - -#### 8.8.0 / 2019-05-15 -* switched from `pre_set_site_transient_update_{plugins|themes}` to `site_transient_update_{plugins|themes}` -* update `Remote_Management` to work with filter change -* update `CLI_Integration` to work with filter change -* use `GITHUB_UPDATER_DIR` constant for all enqueuing - -#### 8.7.3 / 2019-04-08 -* fixed PHP notices on Install [#775](https://github.com/afragen/github-updater/issues/775) -* updated location of `tmp-readme.txt` file to use `get_temp_dir()`, thanks @DavidAnderson684 -* a11y updates for `label for=...` -* fixed to only set cron event for main site only when `DISABLE_WP_CRON` is set, fixes [#782](https://github.com/afragen/github-updater/issues/782) -* a11y updates for settings tabs -* remove filter for `http_request_args` after use, fixes [#783](https://github.com/afragen/github-updater/issues/783) - -#### 8.7.2 / 2019-03-09 -* hotfix to add parity for themes and prevent PHP warning - -#### 8.7.1 / 2019-03-09 -* add new filter hook `github_updater_post_construct_download_link` to allow for returning your own download link -* deprecate filter hook `github_updater_set_rollback_package` as the above replaces it -* add _looser_ check of `Base::get_repo_slugs()`, thanks @sc0ttkclark -* update `class Bitbucket_Server_API`, thanks @allrite for the access -* added filter hook `github_updater_repo_cache_timeout` to change default timeout per repository, thanks @sc0ttkclark - -#### 8.7.0 / 2019-02-24 -* update `Readme_Parser` for changelog and description parsing -* add filter `github_updater_temp_readme_filepath` to change default location if server has permissions issues, fixes [#766](https://github.com/afragen/github-updater/issues/766) -* fix `Readme_Parser` to use `version_compare()` when checking compatibility with `create_contributors()` -* add commit hash and timestamp to branch data, timestamp not returned by this particular GitHub API call 😞 -* add filter `github_updater_remote_is_newer` to use your own version comparison function - -#### 8.6.3 / 2019-02-04 -* use Update PHP messaging as in WP 5.1 in version check - -#### 8.6.2 / 2019-01-14 -* fix for bug with Bitbucket endpoints, fixes [#757](https://github.com/afragen/github-updater/issues/757) - -#### 8.6.1 / 2019-01-11 -* remove `tmp-readme.txt` after parsing, fixes [#754](https://github.com/afragen/github-updater/issues/754) -* directly call `wp_cron()` after refreshing cache -* update POT via `composer.json` and wp-cli -* moved `get_file_headers()` to `trait GHU_Trait` -* cleanup extra header key/value pairs -* add endpoint to Bitbucket to get more than default number of tags, branches, or release assets. Fixes [#752](https://github.com/afragen/github-updater/issues/752) thanks @idpaterson - -#### 8.6.0 / 2018-12-28 🎂 -* add action hook `github_updater_post_rest_process_request` for @Raruto -* add filter hook `github_updater_set_rollback_package` for @sc0ttclark and @moderntribe -* return null for `API_Common::parse_release_asset()` when invalid `$response`, fixes [#750](https://github.com/afragen/github-updater/issues/750) -* make GitHub private repos with release assets use redirect for download link, fixes [#751](https://github.com/afragen/github-updater/issues/751) - -#### 8.5.2 / 2018-12-10 -* fixed parsing of wp.org readme changelog items - -#### 8.5.1 / 2018-11-30 -* refactor release asset API calls to `trait API_Common` -* updated GitLab API v4 endpoints, thanks for all the notice GitLab 😩 - -#### 8.5.0 / 2018-11-26 -* silence rename PHP warning during plugin update -* specify branch for changelog -* refactored dot org override, constant deprecated in favor of new filter `github_updater_override_dot_org` -* now using vanilla JS for Install settings -* refactored GitHub release asset code to get direct download link -* refactored Bitbucket release asset code to get redirected download link for AWS -* refactored GitLab release asset code to get redirected download link -* exit early if checking _View details_ but not done with background update, avoids PHP notices -* updated to add/use composer dependencies and autoloader - -#### 8.4.2 / 2018-11-01 -* updated password fields to not autoload saved passwords, thanks @figureone -* fixed error when saving Remote Management options - -#### 8.4.1 / 2018-10-24 -* updated PAnD library with `forever` fix, this was my fault 💩 - -#### 8.4.0 / 2018-10-23 -* use new constant for assets -* update error checking for `WP_Error` response from `wp_remote_get()` -* updated to use Bitbucket API 2.0 where appropriate -* refactor API calls with new `trait API_Common` -* attempted to update `class Bitbucket_Server_API`, please let me know if I made 💩 -* refactor release asset and AWS download link code -* use action hook `requests-requests.before_redirect` to get AWS redirect URL -* fix for [creating proper GitHub Enterprise base URL](https://github.com/afragen/github-updater/pull/721), oops. Thanks @rlindner -* fixed [#714](https://github.com/afragen/github-updater/issues/714), get correct Bitbucket release asset download link from AWS -* update to `class-parser.php` r7679 -* don't run on heartbeat API 💗 -* only run on `admin-ajax.php` when possibly attempting sequential shiny updates, fixes [#723](https://github.com/afragen/github-updater/issues/723) -* update Persist Admin notices Dismissal library - -#### 8.3.1 / 2018-09-13 -* created `class Bootstrap` to setup plugin loading -* fixed issue with `load_plugin_textdomain()` not loading completely (now loading in `init` hook), thanks @pnoeric and @garrett-eclipse - -#### 8.3.0 / 2018-09-12 -* test to ensure `file_put_contents()` works -* overwrite `tmp-readme.txt` instead of delete -* delete `tmp-readme.txt` on uninstall -* switched check for user privileges to `update_{plugins|themes}` and `install_{plugins|themes}` -* refactored addition of Install tabs for specific privileges -* switch `repo -> slug` and `slug -> file` in plugin/theme objects for more consistency with WP core -* add `override` query arg for RESTful updates to specific tags -* refactor to remove redundancy between rollback and branch switch -* fixed incorrect update notification after update, fixes [#698](https://github.com/afragen/github-updater/issues/698) -* fixed to only load `Settings` on appropriate pages, fixes [#711](https://github.com/afragen/github-updater/issues/711) -* fixed issue where saving options during background updating could cause some checkbox options to be cleared, [5d68ea5](https://github.com/afragen/github-updater/commit/5d68ea54385a2fe62093e25ef42672bbfd504f89) -* updated error handling of Singleton factory -* added remote install from a zipfile, remote URL or local file -* added 'git' and directly declare 'type' in `class Plugin|Theme` -* started to add language pack support for Gitea -* use WPCS 1.1.0 - -#### 8.2.1 / 2018-07-22 -* fixed setting of `Requires PHP` header in `API::set_readme_info()` - -#### 8.2.0 / 2018-07-15 -* fixed `register_activation_hook` to add the `develop` branch if that is the source -* refactored `class Readme_Parser` to use unmodified `vendor/class-parser.php` -* add `Requires PHP` info to _More Detail_ window - -#### 8.1.2 / 2018-06-28 -* fixed malformed link tag, thanks @alexclassroom -* updated POT - -#### 8.1.1 / 2018-06-27 -* updated GitLab CE/Enterprise to use GitLab API v4 -* urlencode part of request to dot org API to avoid redirect - -#### 8.1.0 / 2018-06-26 -* added `register_activation_hook` to correctly rename directory to `github-updater` on activation; activation will fail if rename successful. - -#### 8.0.0 / 2018-06-20 -##### This update requires PHP 5.6 or greater -* added multiple action/filter hooks for adding data to Settings -* refactored `Settings` to add data via hooks -* refactored `class Basic_Auth_Loader` to `trait Basic_Auth_Loader` -* added `trait GHU_Trait` wih common code -* moved traits to own sub-directory -* removed old extended naming code -* refactored Remote Management to new `class Remote_Management` -* converted short array syntax -* removed callback passing of object by reference, it seems of dubious value -* use `ReflectionObject` in `GHU_Trait::get_class_vars()` to pass arbitrary class properties -* refactored WP-CLI integrations -* removed `class Additions`, now self-contained in [GitHub Updater Additions](https://github.com/afragen/github-updater-additions) -* refactored `Install::install()` a bit more -* use new `github_updater_admin_pages` filter hook for adding `index.php` from Remote Management -* ensure that all API install fields are available for all installed APIs -* updated `class-parser.php` the dot org readme parser -* updated POT with more translator messages -* fixed to only load install JS in admin pages -* updated `GitLab_API` for API v4 - -#### 7.6.2 / 2018-04-27 -* move `auth_required` stuff from `Base` to `Settings` -* prevent admin notice from showing when no GitLab.com repo exists -* remove caching of `get_plugins()` and `wp_get_themes()` as it seems to result in issues for some users - -#### 7.6.1 / 2018-04-11 -* check `file_exists()` in `Base::set_installed_apis()` to avoid issue if class not yet loaded prior to checking Settings, fixes [#662](https://github.com/afragen/github-updater/issues/662) and [#667](https://github.com/afragen/github-updater/issues/667) - -#### 7.6.0 / 2018-04-08 -* added "safety orange" warning dashicon when waiting for WP-Cron to finish -* changed all password fields to use `type="password"` -* refactored setting of contributor data for [r42631](https://core.trac.wordpress.org/changeset/42631) -* moved GitLab specific admin notices to `GitLab_API` -* pass `$this` in `Singleton::get_instance()` instead of using `debug_backtrace()` -* refactor `Singleton` to automatically find namespaced class -* added some error handling to `Singleton` -* fixed error messaging -* added support for [Gitea](http://gitea.io/) thanks to [Marco Betschart](https://github.com/marbetschar) -* refactored code out of `class API` into specific API classes -* simplify RESTful update code, no longer parses webhook payload just webhook itself -* updated RESTful update code to use `site_transient_{$transient}` filter to add to update transient -* added error logging to RESTful update code as sometimes GitLab.com seems to timeout the response, thanks @Raruto - -#### 7.5.0 / 2018-01-28 -* fixed _View detail_ ratings for large projects with lots of issues -* fixed `API::set_readme_info()` to see passed parameter as readme data -* added title attribute to icons on Settings subtabs, thanks @petemolinero -* created new `class Init` to help unclutter `class Base` -* fixed PHP Warning if saving empty Remote Management Settings -* changed some variable and function names to be more descriptive -* moved Singleton Factory out of namespace -* moved capabilities check into `class Init` -* moved API classes to subdirectory -* moved WP-CLI classes to subdirectory -* refactored autoloader to grab all subdirectories -* fixed for new WP.org Plugin API response -* updated `vendor/class-parser.php` and `vendor/persist-admin-notices-dismissal` -* fixed `composer.json` for new license format - -#### 7.4.4 / 2017-11-29 -* fixed bug in remote install where Bitbucket credentials weren't transferred to Basic_Auth_Loader, [#630](https://github.com/afragen/github-updater/issues/630) - -#### 7.4.3 / 2017-11-07 -* set all extra header values in `Base::parse_extra_headers()` -* added more error messaging for `class WP_Error` -* fixed some issues with GitHub Release Assets - -#### 7.4.2 / 2017-10-25 -* added check to see if wp-cron is updating and if not send and error message -* fix for WP-CLI updating for private Bitbucket repos, thanks @v8-ict - -#### 7.4.1 / 2017-10-22 -* oops, during refactor of `Install` I copied the incorrect query for GitHub's remote install - -#### 7.4.0 / 2017-10-21 -* use wp-cron for background processing of `wp_remote_get()` calls for getting repo data 🚀 -* fixed [#603](https://github.com/afragen/github-updater/issues/603) by not creating generic global variables accidentally -* fixed issue with remote install of private Bitbucket repos -* added plugin icons to `update-core.php` page for WP 4.9 -* fixed stale AWS download link for GitHub release asset -* cache `get_plugins()` and `wp_get_themes()` for short period giving better performance to some admin pages, fixes [#612](https://github.com/afragen/github-updater/issues/612) -* refactor of methods from `class Base` to `class API` -* created `class API_PseudoTrait` to share methods of `class API`, workaround for OOP traits -* fixed removal of stale options - -#### 7.3.1 / 2017-09-20 -* removed parent constructor from `Branch`, thanks @fwolfst - -#### 7.3.0 / 2017-09-15 -* removed non-constructor stuff from all constructors -* added `parent::__construct()` to extended classes where needed -* fixed [#568](https://github.com/afragen/github-updater/issues/586), thanks @bradmkjr -* fixed multisite bug for theme update rows that I introduced in v7.0.0 :-( -* fixed PHP notice [#591](https://github.com/afragen/github-updater/issues/591) -* fixed bug with current branch data being deleted when saving settings with refactor of `Settings::filter_options()` -* fixed issues with _up to date_ notice during branch switch [#598](https://github.com/afragen/github-updater/issues/598) - -#### 7.2.0 / 2017-08-30 -* added a static proxy class to use for creating Singletons -* fixed Override Dot Org for themes -* fixed PHP Notice [#584](https://github.com/afragen/github-updater/issues/584) -* fixed bug introduced in readme.txt parsing [#589](https://github.com/afragen/github-updater/issues/589) -* fixed bug introduced in v7.0.0 with linter updates to properly display multisite theme updates in themes.php -* fixed branch setting bug [#592](https://github.com/afragen/github-updater/issues/592) by moving trigger from filter hook to direct call, thanks @rob and @idpaterson - -#### 7.1.0 / 2017-08-10 -* always show _Install_ button for single site theme when branch switch is active [#567](https://github.com/afragen/github-updater/issues/567) -* fixed override of dot org to correctly ignore dot org updates [#581](https://github.com/afragen/github-updater/issues/581) -* no more extended naming -* added constant for overriding dot org updates when plugins have identical slugs, `GITHUB_UPDATER_OVERRIDE_DOT_ORG` replacing the `GITHUB_UPDATER_EXTENDED_NAMING` constant -* added Overriding Dot Org functions for both plugins and themes - -#### 7.0.0 / 2017-08-01 -* added support for GitLab Groups [#556](https://github.com/afragen/github-updater/issues/556), thanks @rolandsaven -* refactored Settings and Install to place API Settings data in individual API classes -* refactored Settings to make smaller methods -* simplified `composer.json`, removed autoload section and no need to require `composer/installer` -* many PHP Inspections fixes -* fixed `class Rest_Update` for PHP 5.3 compatibility, thanks @epicfaace -* created `class Branch` to automatically set correct branch during branch switch or install. No more need for Branch header. This is a breaking change as `master` will become the default branch for all repositories. You will need to use _Branch Switch_ to reinstall the current branch for it to be correctly set. - -#### 6.3.5 / 2017-06-29 -* hotfix to `composer.json` to remove classmap and files, I think I messed something up. - -#### 6.3.4 / 2017-05-28 -* fixed [#547](https://github.com/afragen/github-updater/issues/547) for RESTful updating after breaking it again -* fixed PHP errors [#550](https://github.com/afragen/github-updater/issues/550) - -#### 6.3.3 / 2017-05-16 -* definitive fix for [#549](https://github.com/afragen/github-updater/issues/549) -* update to `class-parser.php@5483` - -#### 6.3.2 / 2017-05-09 -* added _broken_ setting to repo not returning HTTP 200 for the main file -* ~~fixed PHP error [#549](https://github.com/afragen/github-updater/issues/549)~~ -* added div class to Settings page to create more specific CSS selectors - -#### 6.3.1 / 2017-05-01 -* simplify uninstall.php -* ensure Basic Auth headers are loaded for RESTful updating [#547](https://github.com/afragen/github-updater/issues/547) - -#### 6.3.0 / 2017-04-26 -* fixed to not run `load_pre_filters()` during WP-CLI, fixes [#528](https://github.com/afragen/github-updater/issues/528) thanks @egifford -* hopefully fixed annoying, intermittent PHP notices empty `parse_header_uri()` output -* added a singleton to `class Settings` to avoid duplicate loads [#531](https://github.com/afragen/github-updater/issues/531) -* refactored subtabs for Settings page -* refactored parsing of extra headers, `Enterprise` and `CE` headers no longer needed -* added support for Bitbucket Server!! Thanks @lkistenkas for access and especially to @BjornW for kicking it off -* refactored `add_endpoints()` to use everywhere -* now requires WordPress 4.4 and above -* update to latest wp.org `class-parser.php` -* move enqueuing of plugin CSS to `Base::init()` -* refactored Language Pack updating to their own classes -* split out abstract methods from `abstract class API` to `interface API_Interface` -* make Autoloader better functioning as a drop-in -* switched logic for plugin branch switching and setting the update transient -* refactor `add_access_token_endpoint()` to `class API` -* refactor Basic Authentication headers to `class Basic_Auth_Loader` -* moved checkboxes before titles in Settings -* updated wiki screenshots -* fixed to call `load_options()` in `Base::init()` to properly utilize options -* add red (#f00) warning dashicon in Settings for repo with malformed header URI - -#### 6.2.2 / 2017-02-09 -* fixed for updating via webhook from GitHub tagged release, declare branch as `master` -* refactored Install download link generation -* fixed PHP notices [#525](https://github.com/afragen/github-updater/issues/525) -* replaced method with `mb_strrpos()` in `class-parser.php` as some users don't have this function -* fixed JSON syntax error in GitHub webhook payload -* fixed GitLab Install tab to always show access token -* fixed GitLab Settings to show individual access tokens - -#### 6.2.1 / 2017-02-02 -* removed `wp_cache_flush()` for Install page, not needed with `Base::admin_pages_update_transients()` -* hotfix for upgrade routine to properly flush caches :P - -#### 6.2.0 / 2017-02-02 -* added WP-CLI compatibility -* refactored `Base::admin_pages_update_transient()` and `API::wp_update_response()` to use `Base::make_update_transient_current()`, this fixed some PHP notices [#508](https://github.com/afragen/github-updater/issues/508) -* added banner display to plugin `View details` iframe -* change `API::get_dot_org_data` to use JSON response to avoid PHP notices -* refactored `GitHub_API::get_repo_meta()` for simplification -* moved some repo renaming to their own methods from `Base::upgrader_source_selection()` to `Base::fix_misnamed_directory()`, `Base::extended_naming()`, and `Base::fix_gitlab_release_asset_directory()` -* moved a couple `class-parser.php` mods to separate functions in `class Readme_Parser` -* refactored `GitHub_API::get_repo_meta()` to use more efficient API call, gets forks also, thanks @egifford -* introduce some variability to transient expiration per plugin -* switch to storing repo data in options table instead of using transients, this should help with object caching which doesn't like transients -* fixed branch switching with extended naming [#520](https://github.com/afragen/github-updater/issues/520), thanks @joelworsham -* updated continuous integration via RESTful endpoints to also update based upon a new tag/release of the repo - -#### 6.1.1 / 2016-11-29 -* hotfix to flush cache during upgrade routine - -#### 6.1.0 / 2016-11-28 -* improved transient saving to save optimized version of transient rather that whole API response -* changed _Refresh Cache_ to POST to only run once. -* fixed `API::wp_update_response` to properly reset the update transient after a shiny update or cache flush -* added `Base::admin_pages_update_transient` to properly reset the update transient on plugins.php and themes.php pages -* fixed Bitbucket authentication during AJAX update -* changed to use dashicon to identify private repos in Settings -* fixed transient update when doing shiny updates -* added ability to update from GitHub release asset -* added our own PHP version check -* refactored setting of update transient during rollback, should eliminate the _up to date_ message and rollback failures -* added `class GHU_Upgrade` to run upgrade functions if needed -* fixed initial display of update for dot org plugins with higher version numbers on git repos when they should be updating from dot org [496](https://github.com/afragen/github-updater/issues/496) -* refactored query to wp.org for plugin data -* revert javascript href call because Firefox can't have nice things -* fixed to allow themes to rollback at any time -* renamed filter hook `github_updater_token_distribution` to `github_updater_set_options` as more descriptive -* added deprecated hook notice for `github_updater_token_distribution` -* fixed setting of GitLab meta -* changed to not skip setting meta when no update available -* fixed `uninstall.php` for option not transient - -#### 6.0.0 / 2016-10-26 -* added `class Language_Pack` and new repo, [Language Pack Maker](https://github.com/afragen/github-updater-language-pack-maker), to create and update from a separate Language Pack repository. -* added new header for Language Pack updates. Language Pack updates can and will now be decoupled from the plugin release. -* obfuscated token/password values in Settings page, for @scarstens -* added support for [GitLab Build Artifacts as Release Assets](https://gitlab.com/help/user/project/builds/artifacts.md), [#459](https://github.com/afragen/github-updater/issues/459) -* improved check for private repo, removes public repos from Settings page when no updates are available -* improved to provide Settings page with dynamically displayed sub-tabs -* added display of installed plugins/themes using GitHub Updater in Settings sub-tabs -* added ability to enter Bitbucket credentials to Install tabs if not already present -* moved action/filter hook calls out of constructors, make @carlalexander happy -* improved to incorporate GitLab personal access tokens, users will need to reset tokens. -* added a filter hook `'github_updater_run_at_scale'` to skip several API calls making GitHub Updater at scale more performant, see README for usage details -* added several hooks for [WP REST Cache](https://github.com/afragen/wordpress-rest-cache) and @scarstens -* skip API calls for branches and tags if branch switching not enabled -* refactored `delete_all_transients()` to delete from database, only called in `class Base` -* refactored and improved _branch switching_ to be consistent among plugins and themes. This means plugins now can rollback to one of the previous 3 tagged releases. -* fixed `get_repo_slugs()` for initially misnamed repository, ie `github-updater-develop` -* renamed `Refresh Transients` to `Refresh Cache`, hopefully to provide more clarity -* refactored to only load GHU site options and other database queries for privileged users on backend only -* added query arg of `?per_page=100` to GitLab query for project IDs, this is max number able to be retrieved, yes an edge case [#465](https://github.com/afragen/github-updater/issues/465) - -#### 5.6.2 / 2016-09-24 -* added reset of _update\_plugins_ and _update\_themes_ transient with _Refresh Transients_ -* throw Exception for webhook update if PUSH is to branch different from webhook -* removed translations from RESTful endpoint responses, only visible from webhook or direct call -* fixed PHP fatal during heartbeat for `class PAnD` not found, early exit in class too early, [#453](https://github.com/afragen/github-updater/issues/453) -* fixed PHP notice in `Bitbucket_API`, [#451](https://github.com/afragen/github-updater/issues/451) - -#### 5.6.1 / 2016-09-15 -* fixed PHP notices when parsing `readme.txt` with missing data -* fixed PHP fatal by namespacing `class WordPressdotorg\Plugin_Directory\Readme\Parser` -* fixed PHP fatal in `WordPressdotorg\Plugin_Directory\Readme\Parser` by avoiding dereferenced array call - -#### 5.6.0 / 2016-09-14 -* added `Refresh Transients` button to Settings page because the `Check Again` button is going away -* added `redirect_on_save()` for Settings page -* switched to slightly modified version of [wp.org plugin readme parser](https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php), now accepts _Markdownified_ readme.txt files -* fixed re-activation of RESTful plugin update, multisite vs single site -* when creating Settings page, check current Plugin/Theme class instance, not transient. Fixes issue where remote install of private repo not having private settings saved. -* fixed PHP errors in Settings page -* fixed saving issues with checkboxes during remote install of private Bitbucket repo -* added one day dismissal of admin notices using [persist-admin-notices-dismissal library](https://github.com/collizo4sky/persist-admin-notices-dismissal) -* Settings page now uses same function to update settings for both single/multisite -* temporary fix for AJAX updates of private Bitbucket repos [#432](https://github.com/afragen/github-updater/issues/432), can only do one per page load, not very AJAXy :P -* fixed `class Rest_Update` to avoid potential race conditions when RESTful endpoint is used as a webhook -* added `branch` and `branches` to update transient, might be able to use this in RESTful update sometime -* fixed extended naming when installing forks of plugins and plugins - -#### 5.5.0 / 2016-07-02 -* better internationalization for changing plugin _View details_ link -* refactored and improved `class Additions` for `GitHub Updater Additions` plugin -* fixed using GitLab CE private token with using `class Install` -* reworked GitHub repo meta as search was occasionally flaky, now also using owner's repos check -* refactored adding extra headers -* added RESTful endpoints for updating from CLI or browser, courtesy of @limikael -* added reset of RESTful API key -* added CSS file to help display theme view details -* refactored `get_remote_{plugin|theme}_meta()` to `get_remote_repo_meta()` as it was in 4 different places :P -* updated for Shiny Updates -* fixed PHP fatal, thanks @charli-polo -* fixed displaying WP_Errors -* made error messages non-static -* fixed pesky PHP notice when updating from 5.4.1.3 [#403](https://github.com/afragen/github-updater/issues/403) -* added _aria-labels_ for screen readers -* always display theme rollback/branch switcher in single site installation [#411](https://github.com/afragen/github-updater/issues/411) -* fixed extended naming issue when branch switching, [#429](https://github.com/afragen/github-updater/issues/429) - -#### 5.4.1 / 2016-04-21 -* get tags for themes to rollback even if no updates are available. I was overzealous in cutting remote API calls. -* ManageWP now works for Remote Management. -* fixed bug in `GitLab_API` to use `path` and not `name`. Thanks @marbetschar -* added filter for background updates if set globally. Thanks @jancbeck -* fixed PHP notice when adding new Remote Management option -* deleted all transients on uninstall -* fixed logic for display of GitLab token fields and error notice -* displayed WP_Error message for `wp_remote_get()` error -* correctly get use GitLab namespace/project instead of project id when needed -* added `data-slug` to theme update rows so CSS may be applied -* now supports MainWP for remote management, thanks @ruben- -* typecast `readme.txt` response to array, fix for occasional malformed `readme.txt` file - -#### 5.4.0 / 2016-3-18 -* fixed deprecated PHP4 constructor in vendor class. -* added `class Additions` to process JSON config from hook to add repos to GitHub Updater, see [GitHub Updater Additions](https://github.com/afragen/github-updater-additions) -* added necessary code in `class Plugin` and `class Theme` for above -* skipped many remote API calls if no update available and use local files, huge performance boost :-) -* removed check for GitHub asset, this eliminates an API call for a rarely used feature -* added additional header `Release Asset: true` to add back ability to set download link to release asset. -* added function to remove _Basic Authentication_ header when downloading private Bitbucket release assets as they are stored on AmazonS3 and use [Query String Request Authentication Alternative](http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationQueryStringAuth) -* consolidated error messages to show only once per error -* added _Other Notes_ section to View details -* updated readme.txt with _Other Notes_ information - -#### 5.3.4 / 2016-01-24 -* reset 'new_version' in update transient to avoid _up to date_ failure with branch switching. -* fixed display of branch switching themes on single install. -* fixed bug in getting Bitbucket branch names. -* fixed to hide checkbox when active as mu-plugin. -* work better with shiny updates. - -#### 5.3.3 / 2016-01-04 -* removed added filters, below as they didn't add functionality to this plugin. -* try to use references to `&$this` -* added PHPUnit testing setup, I could use help writing tests. A great way to contribute. :-) - -#### 5.3.2 / 2015-12-21 -* code simplification for `upgrader_source_selection` -* fixed plugin branch switching to override _up-to-date_ message (most of the time) -* added filters for developers, well I wanted them anyway ;-) - * `github_updater_plugin_transient_update` - * `github_updater_theme_transient_update` - * `github_updater_plugin_row_meta` - * `github_updater_theme_row_meta` - * `github_updater_append_theme_action` -* fixed renaming of updating plugins that were never initially renamed when first installed. Strange bug. - -#### 5.3.1 / 2015-12-03 -* fixed PHP notice during remote installation -* fixed remote install [#325](https://github.com/afragen/github-updater/issues/325) - -#### 5.3.0 / 2015-11-25 -* fixed parsing of `readme.txt` for donate link -* refactored transient storage resulting in significantly few database calls, more performant. -* moved `{get|set}_transient` functions to `abstract class API` -* fixed settings page saving errors. -* fixed shiny updates [#321](https://github.com/afragen/github-updater/issues/321) -* overhauled of renaming code back to using `upgrader_source_selection` and for WordPress 4.4 adding `$args['hook_extra']` to `upgrader_source_selection` filter. Thanks @dd32! - -#### 5.2.0 / 2015-10-14 -* fixed [#309](https://github.com/afragen/github-updater/issues/309) for proper GitHub Enterprise endpoints -* added setting for GitHub Enterprise personal access token -* new `function _add_access_token()` for `class GitHub_API` -* updatede `erusev/parsedown` to current release - -#### 5.1.2 / 2015-09-25 -* added `upgrader_source_selection` filter back for correct updating of current, active theme. -* fixed [#293](https://github.com/afragen/github-updater/issues/293) and [#297](https://github.com/afragen/github-updater/issues/297) -* removed `pre_http_request` filter blocking -* fixed javascript for theme rollback - @scarstens -* play nice with current master branch of wp-update-php - -#### 5.1.1 / 2015-09-09 -* hotfix to comment out `pre_http_request` filter. Updating of plugin doesn't work. I need to re-think this one. - -#### 5.1.0 / 2015-09-09 -* refactored Plugin and Theme constructors moving code calling APIs getting remote data to separate functions -* fixed [#281](https://github.com/afragen/github-updater/issues/281), removed 'Activate Plugin/Theme' buttons post-install -* fixed [#284](https://github.com/afragen/github-updater/issues/284) for GitLab CE/Enterprise install and update -* fixed to re-activate plugins after update, doesn't work with branch switching :person_frowning: -* fixed to correctly rename plugin/theme on update if installed from upload. -* added filter to `pre_http_response` to bypass certain plugins check using `wp_remote_get` with each page load in GitHub Updater. Bypass is only for 12 hours. -* cosmetic fix to display GitHub Updater as active when activated as mu-plugin -* fixed to `theme_api` 'View version details' CSS; better scrolling for changelog info -* fixed annoying PHP notice in `vendor/parse-readme.php` when _Upgrade Notice_ malformed -* fixed `API::return_repo_type` to add 'type' to array; allows easier instance creation of API classes -* updated POT file - -#### 5.0.1 / 2015-08-18 -* updated to current `erusev/parsedown` release, fixes PHP7 issue -* updated to current `WPupdatePHP/wp-update-php/release-1-1-0` branch - -#### 5.0.0 / 2015-08-15 -* fix rollback for GitLab themes -* add branch switcher for themes -* escape all printed strings -* changed from using `upgrader_source_selection` hook to `upgrader_post_install`, this greatly simplifies renaming -* removed `class Remote_Update` as it's no longer needed when using `upgrader_post_install` hook -* added **Remote Management** settings tab more cleanly support those services that currently integrate with GitHub Updater -* modified the process loading so faster for admin level users. Much thanks @khromov -* added hooks for devs to set GitHub Access Tokens and hide the Settings page. Please be sure your client will never need access to the Settings page. Thanks @oncecoupled -* fixed [#267](https://github.com/afragen/github-updater/issues/267) thanks @stevehenty and @rocketgenius - -#### 4.6.2 -* refactor remote update services to new `class Remote_Update` -* general security fixes, don't call files directly... -* fix/test for remote updating via InfiniteWP. Child themes are not identified by IWP as needing updates, otherwise it seems to work as expected. - -#### 4.6.1 -* fix for remote updating via iThemes Sync -* fix for renaming when AJAX updating of plugins - -#### 4.6.0 -* newer, much more precise method for renaming based upon selected repos from the dashboard. Yes, I tested on staging server. :-) -* added feature to use extended naming of plugin directories to avoid potential conflict with WP.org slugs. Props @reinink for the idea. -* strip `.git` from the end of the plugin or theme URI for those who haven't gotten to the README yet. -* added javascript show/hide options on the Install page. -* fixed boolean logic to _not_ display GitLab Private Token input on Install if it's already set. -* updated screenshots in README -* switched a number of methods to be non-static, anticipation of testing. -* [broken: renaming during updates from upgrade services](https://github.com/afragen/github-updater/issues/262) - -#### 4.5.7 -* hotfix GitLab private updating/installing -* fix some PHP notices - -#### 4.5.6 -* bugfix for renaming code to properly strip `-` -* most of Russian translation by [Anatoly Yumashev](https://github.com/yumashev) - -#### 4.5.5 -* back to simplifying the renaming code, always remember to test renaming on live server. -* strip `-` and `-` from beginning and end of update for more precise renaming -* I think this is the end of renaming for a while. :P - -#### 4.5.4 -* hotfix for renaming, I reverted back a bunch with more extensive testing on server. It's amazing how different renaming is locally vs on server. - -#### 4.5.3 -* updated language files -- oops - -#### 4.5.2 -* cleanup and refactor of renaming code. -* added Romanian translation by [Corneliu Cirlan](https://github.com/corneliucirlan) -* added Japanese translation by [ishihara](https://github.com/1shiharat) - -#### 4.5.1 -* fix bug so updates display without having to randomly refresh. - -#### 4.5.0 -* fix some PHP notices -* add update by GitHub release asset in lieu of update by tag when asset is present -* install asset via remote install if asset URI used -* refactor to simplify class structure, created `abstract class API` and `class Messages` -* add GitLab support!! -* refactor to set all git servers and extra headers to static arrays in `Base` -* remove checkbox when loaded as mu-plugin, props @pbearne - -#### 4.4.0 -* only add custom user agent once :P -* add support of GitHub Enterprise via new `GitHub Enterprise` header -* sanitize filter input -* add support for parsing `readme.txt` for _View details_ information using `WordPress_Plugin_Readme_Parser` by @markjaquith -* fixed _View details_ link to show for all cases when plugin using GitHub Updater -* refactor creation of header parts and URIs - -#### 4.3.1 -* Spanish translation by [Jose Miguel Bejarano](https://github.com/xDae) -* German translation by [Linus Metzler](https://github.com/limenet) -* squish PHP notices -* add custom user agent to `wp_remote_get` and tweak error message at request of GitHub ;-) -* fixed edge case renaming bug - -#### 4.3.0 -* use @WPUpdatePhp `class WPUpdatePhp` for PHP version checking -* use not http -* Arabic translation by [Hyyan Abo FAkher](https://github.com/hyyan) -* make strings better for translation - thanks @pedro-mendonca and @fxbenard -* additional Portuguese translation by [Pedro Mendonça](https://github.com/pedro-mendonca) -* refactor for getting local plugin and theme meta, now simpler for additional APIs (I'm thinking about you GitLab) -* fix link in README to GitHub Link -* correctly pass array as last argument in `add_settings_field` -* add focus to URI input field -* add Setting for personal GitHub Access Token to avoid API rate limit - thanks @mlteal -* add Setting for branch switching from the Plugins page -* add 'View details' link in Plugins page - -#### 4.2.2 -* fix POT and some updated languages, thanks @fxbenard -* fix PHP notice for `$options` settings on initial install - thanks @benosman - -#### 4.2.1 -* add PHP version check for graceful exit -* add to error message for 401 error. -* save settings when remote installing a private repo - -#### 4.2.0 -* added minutes until reset of GitHub API's rate limit to error message -* added `placeholder = "master"` to remote install branch text input -* I should have made the last version 4.2.0 as I added a new feature. I'll try to be better with semantic versioning in the future. ;-) - -#### 4.1.4 -* add message to certain admin pages when API returns HTTP error code -* update POT to remove HTML entity codes from strings and generally try to make i18n better -* Swedish translation by [Andréas Lundgren](https://github.com/Adevade) -* added logo to README and Settings page - -#### 4.1.3 -* use `strtolower` comparison of plugin directory and repo name. This might is an issue related to the manual installation of a plugin before any update might occur. This allows the **View details** screen to display in these instances where the case of the directory and repo aren't identical. This doesn't work for themes. - -#### 4.1.2 -* hide star ratings from **View details** screen for private repos - -#### 4.1.1 -* add `plugin` to `$response` in `Plugin::pre_set_site_transient_update_plugins` to fix PHP Notice -* rename `classes` to `src` to follow more conventional naming -* refactor renaming code to function under all circumstances, I hope ;-) - -#### 4.1.0 -* added remote installation of plugins or themes, both public and private -* remote installation using either full URI or short `` format -* created new tabbed interface for settings -* added another screenshot to readme -* I'd like to apologize to all my translators for adding new strings often, you guys are great, thanks! - -#### 4.0.1 -* hotfix to force an array type when sanitizing settings, it gave me a fatal I wasn't expecting. - -#### 4.0.0 -* changed `is_a()` to `instanceof` per -* requires PHP 5.3 or greater as autoloader class requires namespacing
 -* updated all classes for namespacing -* renamed directory and class names to allow for PSR 4 style loading
 -* clean up a number of foreach loops where I was only using either key or value, not both -* Special thanks for all my translators, especially @grappler for adding translation key for description -* bugfix to correctly pick CHANGES.MD or CHANGELOG.MD regardless of case -* removed reading/saving `GitHub Access Token` header into settings. Must use Settings Page. - -#### 3.2.3 - 3.2.6 -* added French translation by @daniel-menard -* added Italian translation by @overclokk -* added Portuguese translation by @valeriosouza -* added Ukrainian translation by @andriiryzhkov (our first translation!!) - -#### 3.2.2 -* remove scraping of user/pass from Bitbucket URI as it's no longer needed -* use `Requires WP` header to fill view options detail -* rename private methods to begin with underscore -* add screenshot to README for Settings Page (only 70 kB) -* stop re-creating transient of transients if it already exists - -#### 3.2.1 -* refactored adding extra headers to `class GitHub_Updater` to ensure they're added before they're needed, resolves issue with WooThemes Updater plugin -* update .pot file - -#### 3.2.0 -* changed settings page and how Bitbucket Private repos authenticate with your username/password -* update .pot - -#### 3.1.1 -* minor transient cleanup -* update .pot file -* fix to get all themes under both single and multisite installs - -#### 3.1.0 -* woot!! - updating from Bitbucket private repos now works!! -* fix to only add HTTP Authentication header under correct circumstances. This obviates need to fix for other APIs that might also use HTTP Authentication. -* fix to correctly add GitHub Access Token from `$options` to `$download_link` - oops -* changes `$options` to `private static $options` to save a few database calls -* Settings page **only** shows private repos, except for initial setup -* simpler test for checking branch as download endpoint -* correctly use `parent::` instead of `self::` -* many updates for translation -* fix to ensure theme rollback and updating works in both single install and multisite -* fix to save settings from single site installations - -#### 3.0.7 -* more efficient solution to HTTP Authentication issues -* more efficient options cleanup -* remove some unnecessary code resulting in few database calls -* change default option setting to use `add_site_option` so not autoloading options - -#### 3.0.6 -* fix for other APIs that use HTTP Authentication, like JetPack - thanks @tsquez - -#### 3.0.5 -* fix more PHP Notices -* correctly set defaults for Settings page :P -* remove options for plugins/themes that are no longer present - -#### 3.0.4 -* Who would've thought `file_exists` was case-sensitive -* when checking meta, use `empty()` instead of `! isset()` for `null array` -* set defaults for Settings page -* fix a number of PHP Notices - -#### 3.0.3 -* Bugfix to properly authenticate on JetPack Stats page - -#### 3.0.2 -* simplify check and exit on Settings if no Bitbucket plugins/themes - -#### 3.0.1 -* Remove Bitbucket settings from page if no appropriate plugins or themes exist. - -#### 3.0.0 -* Settings Page for your GitHub Access Tokens -* added POT file and some more i18n fixes - thanks @grappler -* added `Requires WP` and `Requires PHP` headers to set minimum version requirements - for @GaryJ -* move update check to function to also check WP and PHP version requirements. -* unset any HTTP Authorization headers for GitHub API calls as this gives a 401 error. Rare potential bug if you have private Bitbucket repos. - -#### 2.9.0 -* move instantiation of `class GitHub_Plugin_Updater` and `class GitHub_Theme_Updater` into `GitHub_Updater::init()` and restrict to `current_user_can( 'update_plugins' )` and `current_user_can( 'update_themes' )` so that non-privileged users don't incur load time. -* now loading classes via `spl_autoload_register` -* switched to `erusev/parsedown` for rendering changelogs, faster and more light-weight. -* now parses remote file info to save only file headers to transient. Hopefully speeds up database retrieval of transient. -* added README link to GitHub Link plugin by @szepeviktor -* added mu-plugin option and instructions. -* above revisions mostly due to @szepeviktor prodding me. ;-) -* accept `CHANGES.md` or `CHANGELOG.md` for processing, for @GaryJ -* composer support added, thanks @hyyan - -#### 2.8.1 -* fix for WP Coding Guidelines -* added check for upgrade process instead of `$_GET['action']` (props @SLv99) -* launch classes from `GitHub_Updater::init()` so can load in `add_action( 'init', ...` from `__construct()`. Hopefully this will solve issues with remote upgraders like iThemes Sync, ManageWP, InfiniteWP, and MainWP. Thanks @jazzsequence for testing. Thanks @SLv99 for bringing this to my attention. - -#### 2.8.0 -* refactor API classes and `class GitHub_Updater` to add extra headers from API class. This should allow for better abstraction. Just need to call `GitHub_Updater_{repo}_API::add_headers()` in `class GitHub_Plugin_Updater` and `class GitHub_ Theme_Updater`. -* remove @since tags -* move `maybe_authenticate_http` to `class GitHub_Updater_Bitbucket_API` as it's not used elsewhere -* use non-strict check for http response code (thanks @echav) - -#### 2.7.1 -* added early exit if no local `CHANGES.md` file exists. This should save an API call. -* pull update from WP.org if plugin hosted in WP.org and branch is `master`. - -#### 2.7.0 -* created functions for getting and setting transients -* added deletion of all transients if _force-check_ is used -* removed `GitHub Timeout` and `Bitbucket Timeout` headers -* fix for `wp_remote_retrieve_response_code` check -* give Seth Carstens proper credit in README.md -* move `function make_rating` to `class GitHub_Updater` -* fix for plugin name in update detail view -* fix for Bitbucket repo with no branch tag -* set default timeout to 12 hours, same as WP.org -* fix for 3.9 setting theme update details to `display:none;` -* fix for error when installing themes from WP.org repo -* fix for incorrect plugin upgrade link in detail popup - -#### 2.6.3 -* quick error checking fix for `wp_remote_get` error to wordpress.org API - thanks @deckerweb - -#### 2.6.1 -* fixed CHANGES.md for GFM strike-through - -#### 2.6.0 -* added transient to `plugins_api` call -* better zeroing of variables in getting local theme data -* add error checking to loading of classes -* set default transient timeout to 4 hours -* added new header `GitHub Timeout` or `Bitbucket Timeout` to set individual plugin/theme transient timeout -* ~~fixed for Bitbucket private repos~~ -* abide by WP Coding Guidelines, esp. for braces -* more error checking for correct variable fetch -* added graceful exit if repo does not exist - -#### 2.5.0 -* added `class GitHub_Updater_Bitbucket_API` for Bitbucket hosted plugins and themes. -* improvements to efficiency by not loading when `DOING_AJAX` -* improvements to efficiency in use of transients - -#### 2.4.5 -* set PHP MarkdownExtra posts and comments markup to false props @MikeHansonMe -* remove WP plugin header from `markdown.php` - -#### 2.4.4 -* forgot to include markdown.php - damn - -#### 2.4.2 -* removed PHP Markdown Lib as it required PHP >= 5.3 and that's higher than required by WordPress core. - -#### 2.4.1 -* switched from PHP Markdown Classic to the new PHP Markdown Lib to prevent collisions with other plugins, like Markdown On Save/Improved that also load PHP Markdown or PHP MarkdownExtra. - -#### 2.4.0 -* fixed transient assignment for tags returning empty array. -* added transient for `CHANGES.md` to themes, should further cut down on API 403 errors. -* new feature: theme rollback to previous version thanks @scarstens -* changed update methodology to use most recent tag first. If not tagged update from default branch. - -#### 2.3.3 -* fixed download link to have correct base URI for Repository Contents API. Oops. - -#### 2.3.2 -* rewrite of `GitHub_Update_GitHub_API::construct_download_link` to download zipball and provide appropriate endpoint. - -#### 2.3.1 -* now saving transient and adding early return if API returns 404, this should speed up plugin when repo doesn't have `CHANGES.md` file and provide for early return in no tags have been created. If no tags have been created the API is still hit. - -#### 2.3.0 -* moved action hook to remove `after_theme_row_$stylesheet` to `class GitHub_Theme_Updater` -* added feature: if branch other than `master` is specified then tagged version will be ignored. This should make it much easier for beta testing to groups. See [README.md](https://github.com/afragen/github-updater/blob/develop/README.md) -* converted `class GitHub_Update_GitHub_API` to extension of `class GitHub_Updater` -* combined `description` and `changelog` to show in theme detail view. Rough formatting. Multisite only. -* greatly simplified bug fix from 2.2.2, now using Themes API. - -#### 2.2.2 -* bug fix for removing update notice for WP.org repo themes. Oops. - -#### 2.2.1 -* minor code simplifications -* many thanks to @grappler for solving how to remove default `after_theme_row_$stylesheet` - -#### 2.2.0 -* moved check and load for `markdown.php` into only function that uses it. -* minor README updates -* added abort if this plugin called directly -* added additional data to update available screen in both plugins and themes - issue #8 -* removed requirement for tags in theme updating -* removed extra line endings from `remote_version` -* added ratings function for creating star ratings based upon GitHub repo data. -* bring parts of `class GitHub_Theme_Updater` code on par with `class GitHub_Plugin_Updater` -* added 'ghu-' prefix to transients -* ripped out theme rollback code. Moved to it's own branch on GitHub. -* add custom `after_theme_update_{$stylesheet}` detail. - -#### 2.1.1 -* bug fix to return early from call to `plugins_api` if not getting plugin information. Fixes issue with Plugin Search. - -#### 2.1.0 -* simplify check for `class Markdown_Parser` -* refactor to pass `class GitHub_Update_GitHub_API` as class object. This should enable the creation of other class objects for Bitbucket, etc. -* fix for setting branch when API not responding -* fix for setting download link when API not responding -* redesigned filter for setting transient timeout, but still not working (pull requests welcome) - -#### 2.0.1 -* bug fix to not load `markdown.php` twice. Just in case it's loaded by some other plugin. - -#### 2.0.0 -* rearranged where I put `GitHub Plugin URI` header, etc. in README and in this plugin. -* minor spelling fixes -* renamed some functions for their hooks -* refactored `class GitHub_Plugin_Updater` and `class GitHub_Theme_Updater` to use stdClass objects -* further refactored base class `GitHub_Updater` to contain renaming code and create stdClass objects for data. -* added some ability to see changelog for GitHub hosted plugins. -* trying to follow [WordPress Plugin Boilerplate](https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate), so renamed `classes` to `includes` -* refactored putting all remote api calls in new `class GitHub_Plugin_Updater_API`. -* Theme updating should now be able to have a specified branch. -* works on WordPress 3.8 -* included Michel Fortin's [PHP-Markdown](http://michelf.ca/projects/php-markdown/) for rendering `CHANGES.md` - -#### 1.8.1 -* added some variable declarations -* added early return in no GitHub sourced plugins or themes are identified - -#### 1.8.0 -* refactored to use base class `GitHub_Updater` and extending classes `GitHub_Plugin_Updater` and `GitHub_Theme_Updater`. - -#### 1.7.4 -* changed method of not overwriting extra headers to pass array. - -#### 1.7.3 -* change `'...'` to `…` in renaming notification -* fix to not overwrite extra headers of other plugins. - -#### 1.7.2 -* removed sorting option from `scandir`. Doesn't work with older versions of PHP < 5.4.0 -* removed extraneous data from array in `multisite_get_themes` - -#### 1.7.1 -* updated the transient for themes -* replaced `readdir` with `scandir` for creating WP\_Theme object in multisite - -#### 1.7.0 -* updated class-theme-updater.php to utilize WP\_Theme class -* added method `get_remote_tag` to update plugins using tags or branch, depending upon which has greater version number. -* `get_remote_tag` uses transient to limit calls to API -* fix for `wp_get_themes` not working under plugin network activation on multisite installation. I recreated `wp_get_themes` by reading in the theme directory and adding the WP\_Theme object of `wp_get_theme( 'dir_in_themes_dir' )` to an array. - -#### 1.6.1 -* bug fix for undeclared variable $github_plugins - -#### 1.6.0 -* Added separate method to parse plugin repo info from header -* Shortened GitHub Plugin URI to only use owner/repo -* Shortened GitHub Theme URI to only use owner/repo - -#### 1.5.0 -* Lots of documentation and some bug fixes. Thanks @GaryJones -* Made version checking regex more compatible. Thanks @GaryJones -* Added ability to define branch to update. -* Refactored plugin/theme renaming code. -* Added `GitHub Branch` feature - Thanks @GaryJones -* Trying to comply with WP Coding Standards. -* Major thanks to @GaryJones for all the pull requests and generally improving this project. - -#### 1.4.3 -* Fixed a couple of non-fatal PHP errors. Thanks @jazzsequence - -#### 1.4.2 -* Cleaned up readme's markdown. - -#### 1.4.1 -* Fixed the README to more accurately reflect support for both plugins and themes. - -#### 1.4 -* Fix for rename functions to be more precise, otherwise might rename wp.org repo themes. - -#### 1.3 -* Simplify a couple of if statements. - -#### 1.2 -* Fix to ignore renaming for wp.org plugins - -#### 1.1 -* Sanity check for theme api uri - -#### 1.0 -* Serialized WP\_Theme object to search for added GitHub header, lots of help from Seth. No more `file_get_contents`. -* Converted plugin class and added it to make joint plugin/theme updater. - -#### 0.2 -* Code cleanup. -* Limit `file_get_contents` to 2000 bytes. - -#### 0.1 -* Initial commit diff --git a/wp-content/plugins/github-updater/LICENSE b/wp-content/plugins/github-updater/LICENSE deleted file mode 100644 index d7f1051..0000000 --- a/wp-content/plugins/github-updater/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/wp-content/plugins/github-updater/README.md b/wp-content/plugins/github-updater/README.md deleted file mode 100644 index d89436b..0000000 --- a/wp-content/plugins/github-updater/README.md +++ /dev/null @@ -1,37 +0,0 @@ -![GitHub Updater](./assets/GitHub_Updater_logo_small.png) - -# GitHub Updater - -[![Build Status](https://travis-ci.org/afragen/github-updater.svg?branch=develop)](https://travis-ci.org/afragen/github-updater) - -* Contributors: [Andy Fragen](https://github.com/afragen), [Gary Jones](https://github.com/GaryJones), [Seth Carstens](https://github.com/sethcarstens), [Mikael Lindqvist](https://github.com/limikael), [contributors](https://github.com/afragen/github-updater/graphs/contributors) -* Tags: plugin, theme, update, updater, github, bitbucket, gitlab, remote install -* Requires at least: 4.6 -* Requires PHP: 5.6 -* Tested up to: 5.2 -* Stable tag: [master](https://github.com/afragen/github-updater/releases/latest) -* Donate link: -* License: GPLv2 or later -* License URI: - -A simple plugin to enable automatic updates to your GitHub, Bitbucket, GitLab, or Gitea hosted WordPress plugins, themes, and language packs. It also allows for the remote installation of plugins or themes. - -[Comprehensive information regarding GitHub Updater is available on the wiki.](https://github.com/afragen/github-updater/wiki) - -## Description - -This plugin was designed to simply update any GitHub hosted WordPress plugin or theme. Your plugin or theme **must** contain a header in the style.css header or in the plugin's header denoting the location on GitHub. The format is as follows. - - GitHub Plugin URI: afragen/github-updater - GitHub Plugin URI: https://github.com/afragen/github-updater - -or - - GitHub Theme URI: afragen/test-child - GitHub Theme URI: https://github.com/afragen/test-child - -...where the above URI leads to the __owner/repository__ of your theme or plugin. The URI may be in the format `https://github.com//` or the short format `/`. You do not need both. Only one Plugin or Theme URI is required. You **should not** include any extensions like `.git`. - -## Slack - -We now have a [Slack team for GitHub Updater](https://github-updater.slack.com). Please [click here for an invite](https://github-updater.herokuapp.com). You will be automatically added to the _#general_ and _#random_ channels. Please take a look at other channels too. diff --git a/wp-content/plugins/github-updater/assets/GitHub_Updater_logo_small.png b/wp-content/plugins/github-updater/assets/GitHub_Updater_logo_small.png deleted file mode 100644 index 38eebd1d6146df30bf2412b655e9c9d57da54f5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5237 zcmeI$S2P^Xqrh=3!Rp=WHHhe|1&h_&>V1_UN{A99o2W~4qD5~Zh#*>6HPKdItAvQo zk|>ETO0>WKb$>bkbMEtfxaZvO`OM7goSCPY7z3yV8Gs3ZgM&k+rKxIkz1Ch2OCtR1 zS$#>85eEk!$3WLaO+f*ysHg;nsNRs#HTg@@(B_&5%u~qLN8H@`FG0uW*R(`<)g|uT zfXK<-P*PM(|hTPECH!wH1xM62!@9gYy!^_JX{!eT#@>qh4@3=?)#pC^o(=Y8t zNJuDCSot-&Sma+cN$q4A=o=)t6W6GcyRH!y&0oW<`1Kb~)gDg$$$z46KKf60J{|of z)_#c7c`4X&azm!;_%HRo^IDSS@1;>Nj%0O|Bp zq^now`M%C~vd-&{=XY9nK0iO6%+yWMhhlQ=B%IqUd=%-5Zv~(3((jyFTitn3 z@bd!@Q~_fip`ZPvdXZ?)N8M_hCzfjXQG0UC@ALHO{-yaIwH37((Q|IZcbE581vtma zuP(o)YyR@#G$!$}PWuBt&Po0fZP@QTDkFX=z;Pnl)h_Jc>9V*;R?zdTf{O&M1Z8V zj+d6Ha%rgJg^|hp-uMF#vs7YTSWMUN_PPkBu)dnzJ=@>9;JANIDnylu&Y~TP3S7g;kCtU8D!x7h0ZO!yyC*=Uaw7W>{5?Gz? zH++rCEG7}o&Nbh~4F!3yklmtL#qlx4$xhI3FOWw%fRMDFKgxY2T za7yS$AWF?-%$_EaQ#?E~d>#LJM)&g2rUWiZq0*M^3;^m6c`gHFzl-wj)UxP6AFgor zmJ8buf{L{N*cZW->%cxh>0}^#J#}VU_oLINNsZBG{RD|qw?-~ zG&>%yXabs4FwHnSt;f(J1@mKfZ@ILExS62=mVB_wZG#4g9S@-yM0Tre^5YGNUQT&` z3IYy?yQPii^z_#e3AEZV;eYhNX6Bb<&n+KMi%4&TvJw`x_eeQ0wFld0j1}plz*0|b5hY;hxl=2p`zR>qF{#( zzYN%~7|^tDq%V6pQ0L)?qH*eVc`UmZpC22f<&k_xF9`pVyO7DUQ^O7o-4UXi=F1nL zj%?MFcN^N2!RupzyNel@2HSz`(y+J-TF%1GRX`D~JPABF!xMk>GhA3dD0b?sQF%MHqRlFyFdluL2-LzuPT@ETh8#Yhf%eo)W<9YaHqFFbS%kw89G7R4E(u> z?)KbzssYVSs!)H)q?kf$vD}eaKqpX|0zzG|`a{ zuN)zEB#Y|6C9mx(oJwp;(JjMyDGuzZLVY3h!-j+>lq`>Ld&4tA1Dl?`V27`LUlOZS zR+TqX^(dK`gn1p(a6v;p_j||8Z+()6LnaazI6TrN80TKoVzrn=6Zwst=;xgT`c(Sg zrgrZ<427s))Tlf#yaU>H=!Q0T9l1=Ln2?Ou6rVLO9OJs}k8hAq)bOvASIe2A9;6O~ z^vTPCA}XGXIvSyL?uB_e`SM z{seK@9=LM(P;$RY!#NN7F>98~+yHL`j57}yg*?=Lu$yoR6)Ws-HcN3I1@Gb#)|5@<`FAp8qsPQRov2FLpap+Bxx;F4Yze+`7PM4AT$T2EeU*(>bxN`TBOI_y_o_K|}t{XL+p< zvBZt(`T0{jE&&&CZNv0V*`NN((_lr2YNOF2ZdY(TcY_u4u+)GlELN@ntTxkv4a2~F z-4j!A9Oks|56fY+*s^_YJ8b=EG7a}iP^XDjE|9zJdTW*R>9)wW%Bjo`6l^>`;2rU+ zwiVbaRN_5LTWpR}Tj0C=-5otrFqG6vEb>5yc$xMvKjTzsES`k0FT(z zICu4|8{H+U-)neCt>iA>f)*B-uqZi&;eHVRazNdEZKdnlTWDcHSA_haTaD-g+?s)^>N2(gS zfHp#m40|H+-C6+w&kADHlq#&L`ExVkY6OC^;%R|$mX^iF+sR~PswN@eY8_D;eMd3+ z<|s`*e8SP&SV0a9lb&rW+Z??q)|DVjUH*tf^os$x;*+=iUW}G3k@%v9`bNF--IOzR z6bTCPvL^N_gBB9Ptlk0MSwk|ljX6d+=vQtpU@Hyht`0Q5{BJ&w>|UJVxT{ihnU!@i zMT5@M94?fIdW9(M@Wdnz@1W=fQ0^P7MjE!JuXR*V_c&`1yC;(YG(DmEPfA4=?jNtskFof&X zY7vvAjW-jMiiWv|YD`ZK`B_^iTpLBA&m>tt@^M$F$oO~1Q^jA?ZDr?osy9B>srdmmC|HYG*UinMVxIcpuo7Mc5kBC;?-w^J=}vf#J#6r z60GBUDDT}|+q|A8qqvb^lGp}b>&3X#&zv!uTi2gK@9G57eoNq|T=-*hcud7rDZ{%5PF!0o?>Z z-!rKA``g>AnX2eG>NXk9B0ZY1*N-LEmv{I!a`yBjFzB@aQMTJU1pQG_Wo$#msRf&I z15Ut?foyov#&U{72=LlS;djt3vxBt;@A3{-zCdMruGu5Ia6pgsHF%^k-U4VyU0u_= zbOW-`~nTijM# zrM#dTLrB)k;bvjmX`A3KwYF_^lUbV#jK&rpTd2=MD&Awo^EGZ3;L}OCbw`Au9f$fZXraNpb3uL=>;wZtioLV}L>{khdy{@aSEC zOWmoD8h_>L#iw1zVro0OtacmzZ1ugAm!v+2Z*F0S3#ncP*?iJGedBu?Wq7a1jlhAG z0+}Z#q^|4vixRE!2PFcoeTR9;uVac82B~|{2RY!UxbKEEo}WZ4^hj43B2&5@zflo7 z2!=rvTx|AKZCLE>ol_ED9XX5c3{f>w6BuMOwD;nUSBnHS!^(QXg<@ z)H*OL;55crI==yNEY} znD#cAPZ@42&3S@m>>(JfUTv^YkYBC^Iz`K2vg_166KNL47H&u4ajTqHK5W!+#>HNW zUoRUtzM{jJx8B~&mSf+b_DP*;?{(;WluWH1O$y}b3vS4t-h|5Fx3K$mAj)6qiSqmP zxhE8iT5mGfZo8ia)3K?f?LACBb8aL5C4qVFT!m*2UpfLZ!;KOq{UOXl1xCp~tGb3t z$1pR`A`U9#K+dk=WUaD(T1iZ7V?9NTmnqi% z1A5R*NDQwpM(uN1K7SXdX$G@=_A^htHw?FgUQkDg_;|RM`pAZ^DO(~5IkakqrTDgu z3J?-ar*FkLfNL$`k)5>m$;f4pv57#(gOGCW#ELo-ybxAX0$~1n>Ey;!t0{ZR{Vg+P z>NV@ft_ibv!Ji&W`i*~uRQTVvnt!xOdrxw9%lYH9Cla7GL#VyrI{)ahMA?Ak{i_il zY}J=5S|2qcOYP``z3*e?kenuQ z1z#CT{~jHi6RR{>`@7HGP~=CPn%eIW#p;Y;UQhpWVX{7NFcss}RuF0mzEiGyZdJm= zmLuG-h<0f&9iEbt2Kl6}zU{&Ld3oX6b^paZ@)*mBEWx3nG0!XSIFp2S3a-kh)rx^u zpMzLn((3U>^P{AkrYuMKcGOpCLZlsf5keL_QTif+_H - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wp-content/plugins/github-updater/composer.json b/wp-content/plugins/github-updater/composer.json deleted file mode 100644 index dbe1d9a..0000000 --- a/wp-content/plugins/github-updater/composer.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "afragen/github-updater", - "description": "A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.", - "type": "wordpress-plugin", - "keywords": [ - "wordpress", - "plugin", - "theme", - "updater", - "install" - ], - "license": "GPL-2.0-or-later", - "authors": [ - { - "name": "Andy Fragen", - "email": "andy@thefragens.com", - "homepage": "https://thefragens.com", - "role": "Developer" - } - ], - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/afragen/github-updater" - } - ], - "support": { - "issues": "https://github.com/afragen/github-updater/issues", - "source": "https://github.com/afragen/github-updater" - }, - "prefer-stable": true, - "require": { - "php": ">=5.6", - "afragen/wordpress-plugin-readme-parser": "dev-master", - "afragen/singleton": "dev-master", - "collizo4sky/persist-admin-notices-dismissal": "^1" - }, - "autoload": { - "psr-4": { - "Fragen\\GitHub_Updater\\": "src/GitHub_Updater/" - } - }, - "scripts": { - "post-update-cmd": [ - "wp i18n make-pot . languages/github-updater.pot" - ] - } -} diff --git a/wp-content/plugins/github-updater/css/github-updater.css b/wp-content/plugins/github-updater/css/github-updater.css deleted file mode 100644 index 9856ce1..0000000 --- a/wp-content/plugins/github-updater/css/github-updater.css +++ /dev/null @@ -1,36 +0,0 @@ -div.install-theme-info { - display: block !important; -} - -/* Remove star rating for themes. */ -#theme-installer div.install-theme-info div.star-rating { - display: none; -} - -/* Position Settings input */ -input.ghu-callback-text { - width: 50%; -} - -input.bitbucket_setting { - margin-top: 5px; -} - -/* Position Save and Refresh buttons */ -.github-updater-settings form.settings p.submit { - float: left; - clear: right; - width: 40%; -} - -.github-updater-settings form.settings.no-sub-tabs p.submit { - margin-top: 10px; -} - -div.hide-github-updater-settings { - display: none; -} - -.github-updater-settings .form-table th[scope='row']:empty { - display: none; -} diff --git a/wp-content/plugins/github-updater/github-updater.php b/wp-content/plugins/github-updater/github-updater.php deleted file mode 100644 index 17431a1..0000000 --- a/wp-content/plugins/github-updater/github-updater.php +++ /dev/null @@ -1,53 +0,0 @@ -

'; - printf( - /* translators: 1: minimum PHP version required, 2: Upgrade PHP URL */ - wp_kses_post( __( 'GitHub Updater cannot run on PHP versions older than %1$s. Learn about updating your PHP.', 'github-updater' ) ), - '5.6', - esc_url( __( 'https://wordpress.org/support/update-php/' ) ) - ); - echo '

'; - - return false; -} - -// Setup plugin loading. -require_once __DIR__ . '/src/GitHub_Updater/Bootstrap.php'; -( new Bootstrap( __FILE__ ) )->run(); diff --git a/wp-content/plugins/github-updater/js/ghu-install-vanilla.js b/wp-content/plugins/github-updater/js/ghu-install-vanilla.js deleted file mode 100644 index 2bef2da..0000000 --- a/wp-content/plugins/github-updater/js/ghu-install-vanilla.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Vanilla Javascript to show and hide the API specific settings - * for the remote install feature. - * - * @class Fragen\GitHub_Updater\Install - * @since 8.5.0 - * @access public - * @package github-updater - */ - -(function () { - - // Hide non-default (Bitbucket & GitLab) settings on page load. - let nonDefault = ['bitbucket', 'gitlab', 'gitea', 'zipfile']; - - nonDefault.forEach(function (item) { - let parents = getParents(item, 'tr'); - displayNone(parents); - }); - - // When the api selector changes. - let selects = document.querySelector('select[ name="github_updater_api" ]'); - - // Only run when on proper tab. - if (selects !== null) { - selects.addEventListener('change', function () { - let defaults = ['github', 'bitbucket', 'gitlab', 'gitea', 'zipfile']; - - // Create difference array. - let hideMe = remove(defaults, this.value); - - // Hide items with unselected api's classes. - hideMe.forEach(function (item) { - let parents = getParents(item, 'tr'); - displayNone(parents); - }); - - // Show selected setting. - [this.value].forEach(function (item) { - let parents = getParents(item, 'tr'); - display(parents); - }); - }); - } - - // Remove selected element from array and return array. - function remove(array, element) { - const index = array.indexOf(element); - if (index !== -1) { - array.splice(index, 1); - } - return array; - } - - // Hide element. - function displayNone(array) { - array.forEach((item) => { - item.style.display = 'none'; - }); - } - - // Display element. - function display(array) { - array.forEach((item) => { - item.style.display = ''; - }); - } - - // Return query and selector for `$(query).parents.(selector)`. - function getParents(item, selector) { - return vanillaParents(document.querySelectorAll('input.'.concat(item, '_setting')), selector); - } - - // Vanilla JS version of jQuery `$(query).parents(selector)`. - function vanillaParents(element, selector) { - let parents = []; - if (NodeList.prototype.isPrototypeOf(element)) { - element.forEach((item) => { - element = item.parentElement.closest(selector); - parents.push(element); - }); - } else { - element = item.parentElement.closest(selector); - parents.push(element); - } - return parents; - } - -})(); diff --git a/wp-content/plugins/github-updater/js/ghu-install.js b/wp-content/plugins/github-updater/js/ghu-install.js deleted file mode 100644 index d3874f6..0000000 --- a/wp-content/plugins/github-updater/js/ghu-install.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Javascript to show and hide the API specific settings - * for the remote install feature. - * - * @class Fragen\GitHub_Updater\Install - * @since 4.6.0 - * @access public - * @package github-updater - */ - -jQuery(document).ready( - function ($) { - // Hide non-default (Bitbucket & GitLab) settings on page load. - $.each(['bitbucket', 'gitlab', 'gitea', 'zipfile'], - function () { - $('input.'.concat(this, '_setting')).parents('tr').hide(); - }); - - // When the api selector changes. - $('select[ name="github_updater_api" ]').on('change', - function () { - - // create difference array. - var hideMe = $(['github', 'bitbucket', 'gitlab', 'gitea', 'zipfile']).not([this.value]).get(); - - /* - * Show/hide all settings that have the selected api's class. - * this.value equals either 'github', 'bitbucket', or 'gitlab'. - */ - $.each( - hideMe, - function () { - $('input.'.concat(this, '_setting')).parents('tr').hide(); - } - ); - - $('input.'.concat(this.value, '_setting')).parents('tr').show(); - - }); - }); diff --git a/wp-content/plugins/github-updater/languages/github-updater.pot b/wp-content/plugins/github-updater/languages/github-updater.pot deleted file mode 100644 index df2c44b..0000000 --- a/wp-content/plugins/github-updater/languages/github-updater.pot +++ /dev/null @@ -1,446 +0,0 @@ -# Copyright (C) 2019 Andy Fragen -# This file is distributed under the same license as the GitHub Updater plugin. -msgid "" -msgstr "" -"Project-Id-Version: GitHub Updater 8.8.2\n" -"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/github-updater\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2019-07-02T23:20:16+00:00\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.2.0\n" -"X-Domain: github-updater\n" - -#. Plugin Name of the plugin -#: src/GitHub_Updater/Settings.php:133 -#: src/GitHub_Updater/Settings.php:172 -#: src/GitHub_Updater/Settings.php:223 -msgid "GitHub Updater" -msgstr "" - -#. Plugin URI of the plugin -msgid "https://github.com/afragen/github-updater" -msgstr "" - -#. Description of the plugin -msgid "A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress." -msgstr "" - -#. Author of the plugin -msgid "Andy Fragen" -msgstr "" - -#: mu/ghu-loader.php:65 -msgid "Activated as mu-plugin" -msgstr "" - -#. translators: 1: minimum PHP version required, 2: Upgrade PHP URL -#: github-updater.php:42 -msgid "GitHub Updater cannot run on PHP versions older than %1$s. Learn about updating your PHP." -msgstr "" - -#: src/GitHub_Updater/Install.php:104 -#: src/GitHub_Updater/Install.php:366 -msgid "Install Plugin" -msgstr "" - -#: src/GitHub_Updater/Install.php:107 -#: src/GitHub_Updater/Install.php:369 -msgid "Install Theme" -msgstr "" - -#: src/GitHub_Updater/Install.php:160 -msgid "A repository URI is required." -msgstr "" - -#: src/GitHub_Updater/Install.php:386 -msgid "Plugin" -msgstr "" - -#: src/GitHub_Updater/Install.php:389 -msgid "Theme" -msgstr "" - -#. translators: variable is 'Plugin' or 'Theme' -#: src/GitHub_Updater/Install.php:401 -msgid "GitHub Updater Install %s" -msgstr "" - -#. translators: variable is 'Plugin' or 'Theme' -#: src/GitHub_Updater/Install.php:409 -msgid "%s URI" -msgstr "" - -#: src/GitHub_Updater/Install.php:417 -msgid "Repository Branch" -msgstr "" - -#: src/GitHub_Updater/Install.php:425 -msgid "Remote Repository Host" -msgstr "" - -#: src/GitHub_Updater/Install.php:461 -msgid "URI is case sensitive." -msgstr "" - -#: src/GitHub_Updater/Install.php:476 -msgid "Enter branch name or leave empty for `master`" -msgstr "" - -#: src/GitHub_Updater/Install.php:541 -msgid "Activate" -msgstr "" - -#: src/GitHub_Updater/Install.php:553 -msgctxt "This refers to a network activation in a multisite installation" -msgid "Network Enable" -msgstr "" - -#: src/GitHub_Updater/Settings.php:114 -#: src/GitHub_Updater/Settings.php:719 -msgid "Settings" -msgstr "" - -#: src/GitHub_Updater/Settings.php:171 -#: src/GitHub_Updater/Settings.php:310 -msgid "GitHub Updater Settings" -msgstr "" - -#: src/GitHub_Updater/Settings.php:245 -msgid "Refresh Cache" -msgstr "" - -#: src/GitHub_Updater/Settings.php:277 -msgid "Settings saved." -msgstr "" - -#: src/GitHub_Updater/Settings.php:279 -msgid "RESTful key reset." -msgstr "" - -#: src/GitHub_Updater/Settings.php:281 -msgid "Cache refreshed." -msgstr "" - -#: src/GitHub_Updater/Settings.php:323 -msgid "Enable Branch Switching" -msgstr "" - -#: src/GitHub_Updater/Settings.php:526 -msgid "Check to enable branch switching from the Plugins or Themes page." -msgstr "" - -#: src/GitHub_Updater/Settings.php:550 -msgid "Overridden Plugins and Themes" -msgstr "" - -#: src/GitHub_Updater/Settings.php:551 -msgid "The following plugins or themes might exist on wp.org, but any updates will be downloaded from their respective git repositories." -msgstr "" - -#: src/GitHub_Updater/Settings.php:753 -msgid "This is a private repository." -msgstr "" - -#: src/GitHub_Updater/Settings.php:754 -msgid "This repository has not connected to the API or was unable to connect." -msgstr "" - -#: src/GitHub_Updater/Settings.php:755 -msgid "This repository is hosted on WordPress.org." -msgstr "" - -#: src/GitHub_Updater/Settings.php:792 -msgid "Installed Plugins and Themes" -msgstr "" - -#: src/GitHub_Updater/Plugin.php:324 -msgid "View details" -msgstr "" - -#. translators: %s: theme name -#: src/GitHub_Updater/Theme.php:333 -#: src/GitHub_Updater/Theme.php:529 -msgid "There is a new version of %s available." -msgstr "" - -#. translators: %s: theme version -#: src/GitHub_Updater/Theme.php:345 -msgid "View version %s details." -msgstr "" - -#: src/GitHub_Updater/Theme.php:349 -msgid "Automatic update is unavailable for this theme." -msgstr "" - -#. translators: 1: version number, 2: closing anchor tag, 3: update URL -#: src/GitHub_Updater/Theme.php:354 -#: src/GitHub_Updater/Theme.php:539 -msgid "View version %1$s details%2$s or %3$supdate now%2$s." -msgstr "" - -#. translators: %s: theme name -#: src/GitHub_Updater/Theme.php:359 -#: src/GitHub_Updater/Theme.php:544 -msgid "Update %s now" -msgstr "" - -#. translators: 1: branch name, 2: jQuery dropdown, 3: closing tag -#: src/GitHub_Updater/Theme.php:581 -#: src/GitHub_Updater/Base.php:822 -msgid "Current branch is `%1$s`, try %2$sanother version%3$s" -msgstr "" - -#: src/GitHub_Updater/Theme.php:589 -msgid "Choose a Version" -msgstr "" - -#: src/GitHub_Updater/Theme.php:607 -#: src/GitHub_Updater/Base.php:857 -msgid "No previous tags to rollback to." -msgstr "" - -#: src/GitHub_Updater/Theme.php:611 -msgid "Install" -msgstr "" - -#: src/GitHub_Updater/Base.php:440 -msgid "There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue." -msgstr "" - -#: src/GitHub_Updater/Base.php:833 -msgid "Switch to branch " -msgstr "" - -#: src/GitHub_Updater/Base.php:849 -msgid "Switch to release " -msgstr "" - -#: src/GitHub_Updater/Remote_Management.php:138 -#: src/GitHub_Updater/Remote_Management.php:195 -msgid "Remote Management" -msgstr "" - -#: src/GitHub_Updater/Remote_Management.php:177 -msgid "Reset RESTful key" -msgstr "" - -#. translators: %s: Link to wiki -#: src/GitHub_Updater/Remote_Management.php:235 -msgid "Please refer to the wiki for complete list of attributes. RESTful endpoints begin at:" -msgstr "" - -#: src/GitHub_Updater/Remote_Management.php:243 -msgid "Use of Remote Management services may result increase some page load speeds only for `admin` level users in the dashboard." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:382 -msgid "Bitbucket Private Settings" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:389 -#: src/GitHub_Updater/API/Bitbucket_API.php:477 -msgid "Bitbucket Username" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:398 -#: src/GitHub_Updater/API/Bitbucket_API.php:485 -msgid "Bitbucket Password" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:414 -msgid "Bitbucket Private Repositories" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:444 -msgid "Bitbucket" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:453 -msgid "Check box if private repository. Leave unchecked for public repositories." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:460 -msgid "Enter your personal Bitbucket username and password." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:494 -msgid "Private Bitbucket Repository" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:510 -msgid "Check for private Bitbucket repositories." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:525 -msgid "Enter Bitbucket username." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_API.php:540 -msgid "Enter Bitbucket password." -msgstr "" - -#: src/GitHub_Updater/API/Zipfile_API.php:37 -msgid "Zipfile Slug" -msgstr "" - -#: src/GitHub_Updater/API/Zipfile_API.php:53 -msgid "Enter plugin or theme slug." -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:343 -#: src/GitHub_Updater/API/Gitea_API.php:361 -#: src/GitHub_Updater/API/Gitea_API.php:423 -msgid "Gitea Access Token" -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:352 -msgid "Gitea Private Settings" -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:396 -msgid "Gitea" -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:405 -msgid "Enter your repository specific Gitea Access Token." -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:412 -msgid "Enter your Gitea Access Token." -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:439 -msgid "Enter Gitea Access Token for private Gitea repositories." -msgstr "" - -#: src/GitHub_Updater/API/Gitea_API.php:470 -msgid "You must set a Gitea Access Token." -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:436 -msgid "GitLab Personal Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:445 -msgid "GitLab Private Settings" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:454 -msgid "GitLab.com Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:468 -msgid "GitLab CE or GitLab Enterprise Personal Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:503 -msgid "GitLab" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:512 -msgid "Enter your repository specific GitLab Access Token." -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:519 -msgid "Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token." -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:530 -msgid "GitLab Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:546 -msgid "Enter GitLab Access Token for private GitLab repositories." -msgstr "" - -#: src/GitHub_Updater/API/GitLab_API.php:579 -msgid "You must set a GitLab.com, GitLab CE, or GitLab Enterprise Access Token." -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:371 -msgid "GitHub Personal Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:378 -msgid "GitHub.com Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:391 -msgid "GitHub Enterprise Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:408 -msgid "GitHub Private Settings" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:435 -msgid "Enter your GitHub Access Token. Leave empty for public repositories." -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:442 -msgid "Enter your personal GitHub.com or GitHub Enterprise Access Token to avoid API access limits." -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:453 -msgid "GitHub Access Token" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:467 -msgid "GitHub" -msgstr "" - -#: src/GitHub_Updater/API/GitHub_API.php:481 -msgid "Enter GitHub Access Token for private GitHub repositories." -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_Server_API.php:340 -msgid "Bitbucket Server Private Settings" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_Server_API.php:347 -msgid "Bitbucket Server Username" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_Server_API.php:356 -msgid "Bitbucket Server Password" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_Server_API.php:372 -msgid "Bitbucket Server Private Repositories" -msgstr "" - -#: src/GitHub_Updater/API/Bitbucket_Server_API.php:402 -msgid "Bitbucket Server" -msgstr "" - -#: src/GitHub_Updater/Messages.php:112 -#: src/GitHub_Updater/Messages.php:153 -#: src/GitHub_Updater/Messages.php:173 -msgid "GitHub Updater Error Code:" -msgstr "" - -#. translators: %s: wait time -#: src/GitHub_Updater/Messages.php:119 -msgid "GitHub API’s rate limit will reset in %s minutes." -msgstr "" - -#. translators: %s: GitHub personal access token URL -#: src/GitHub_Updater/Messages.php:125 -msgid "It looks like you are running into GitHub API rate limits. Be sure and configure a Personal Access Token to avoid this issue." -msgstr "" - -#: src/GitHub_Updater/Messages.php:157 -msgid "There is probably an access token or password error on the GitHub Updater Settings page." -msgstr "" - -#: src/GitHub_Updater/Messages.php:188 -msgid "GitHub Updater Information" -msgstr "" - -#: src/GitHub_Updater/Messages.php:190 -msgid "Please be patient while WP-Cron finishes making API calls." -msgstr "" diff --git a/wp-content/plugins/github-updater/mu/ghu-loader.php b/wp-content/plugins/github-updater/mu/ghu-loader.php deleted file mode 100644 index 3d163d1..0000000 --- a/wp-content/plugins/github-updater/mu/ghu-loader.php +++ /dev/null @@ -1,84 +0,0 @@ - esc_html__( 'Activated as mu-plugin', 'github-updater' ) ), $actions ); -} - -/* - * Deactivate normal plugin as it's loaded as mu-plugin. - */ -add_action( 'activated_plugin', 'ghu_deactivate', 10, 1 ); - -/* - * Remove links and checkbox from Plugins page so user can't delete main plugin. - */ -add_filter( 'network_admin_plugin_action_links_' . $ghu_plugin_file, 'ghu_mu_plugin_active' ); -add_filter( 'plugin_action_links_' . $ghu_plugin_file, 'ghu_mu_plugin_active' ); -add_action( - 'after_plugin_row_' . $ghu_plugin_file, - function () { - print ''; - print ''; - } -); diff --git a/wp-content/plugins/github-updater/readme.txt b/wp-content/plugins/github-updater/readme.txt deleted file mode 100644 index 5c961a9..0000000 --- a/wp-content/plugins/github-updater/readme.txt +++ /dev/null @@ -1,59 +0,0 @@ -# GitHub Updater -Contributors: afragen, garyj, sethcarstens, limikael -Donate link: https://thefragens.com/github-updater-donate -Tags: plugin, theme, language pack, updater, remote install -Requires at least: 4.6 -Requires PHP: 5.6 -Tested up to: 5.2 -Stable tag: master -License: GPLv2 or later -License URI: https://www.gnu.org/licenses/gpl-2.0.html - -## Description - -This plugin was designed to simply update any GitHub hosted WordPress plugin or theme. Currently, plugins or themes hosted on GitHub, Bitbucket, GitLab, or Gitea are also supported. Additionally, self-hosted installations of GitHub or GitLab are supported. It also allows for remote installation of plugins or themes into WordPress. - -Your plugin or theme **must** contain a header in the style.css header or in the plugin's header denoting the location on GitHub. The format is as follows. - - GitHub Plugin URI: afragen/github-updater - GitHub Plugin URI: https://github.com/afragen/github-updater - -or - - GitHub Theme URI: afragen/test-child - GitHub Theme URI: https://github.com/afragen/test-child - -...where the above URI leads to the __owner/repository__ of your theme or plugin. The URI may be in the format `https://github.com//` or the short format `/`. You do not need both. Only one Plugin or Theme URI is required. You **must not** include any extensions like `.git`. - -The following headers are available for use depending upon your hosting source. - -### GitHub -* GitHub Plugin URI -* GitHub Theme URI -* GitHub Languages - -### Bitbucket -* Bitbucket Plugin URI -* Bitbucket Theme URI -* Bitbucket Languages - -### GitLab -* GitLab Plugin URI -* GitLab Theme URI -* GitLab Languages -* GitLab CI Job - -### Gitea -* Gitea Plugin URI -* Gitea Theme URI -* Gitea Languages - -## Frequently Asked Questions - -#### Wiki - -[Comprehensive information regarding GitHub Updater is available on the wiki.](https://github.com/afragen/github-updater/wiki) - -#### Slack - -We now have a [Slack team for GitHub Updater](https://github-updater.slack.com). Please [click here for an invite](https://github-updater.herokuapp.com). You will be automatically added to the _#general_ and _#random_ channels. Please take a look at other channels too. diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/API.php b/wp-content/plugins/github-updater/src/GitHub_Updater/API.php deleted file mode 100644 index 719f8d8..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/API.php +++ /dev/null @@ -1,735 +0,0 @@ -type->slug => $code ) - */ - protected static $error_code = []; - - /** - * Holds site options. - * - * @var array $options - */ - protected static $options; - - /** - * Holds extra headers. - * - * @var array $extra_headers - */ - protected static $extra_headers; - - /** - * Variable for setting update transient hours. - * - * @var integer - */ - protected $hours = 12; - - /** - * Variable to hold all repository remote info. - * - * @access protected - * @var array - */ - protected $response = []; - - /** - * Variable to hold AWS redirect URL. - * - * @var string|\WP_Error $redirect - */ - protected $redirect; - - /** - * API constructor. - */ - public function __construct() { - static::$options = $this->get_class_vars( 'Base', 'options' ); - static::$extra_headers = Singleton::get_instance( 'Base', $this )->add_headers( [] ); - } - - /** - * Adds custom user agent for GitHub Updater. - * - * @access public - * - * @param array $args Existing HTTP Request arguments. - * @param string $url URL being passed. - * - * @return array Amended HTTP Request arguments. - */ - public static function http_request_args( $args, $url ) { - $args['sslverify'] = true; - if ( false === stripos( $args['user-agent'], 'GitHub Updater' ) ) { - $args['user-agent'] .= '; GitHub Updater - https://github.com/afragen/github-updater'; - $args['wp-rest-cache'] = [ 'tag' => 'github-updater' ]; - } - - return $args; - } - - /** - * Add data in Settings page. - * - * @param object $git Git API object. - */ - public function settings_hook( $git ) { - add_action( - 'github_updater_add_settings', - function ( $auth_required ) use ( $git ) { - $git->add_settings( $auth_required ); - } - ); - add_filter( 'github_updater_add_repo_setting_field', [ $this, 'add_setting_field' ], 10, 2 ); - } - - /** - * Add data to the setting_field in Settings. - * - * @param array $fields - * @param array $repo - * - * @return array - */ - public function add_setting_field( $fields, $repo ) { - if ( ! empty( $fields ) ) { - return $fields; - } - - return $this->get_repo_api( $repo->git, $repo )->add_repo_setting_field(); - } - - /** - * Get repo's API. - * - * @param string $git (github|bitbucket|gitlab|gitea) - * @param bool|\stdClass $repo - * - * @return \Fragen\GitHub_Updater\API\Bitbucket_API| - * \Fragen\GitHub_Updater\API\Bitbucket_Server_API| - * \Fragen\GitHub_Updater\API\Gitea_API| - * \Fragen\GitHub_Updater\API\GitHub_API| - * \Fragen\GitHub_Updater\API\GitLab_API $repo_api - */ - public function get_repo_api( $git, $repo = false ) { - $repo_api = null; - $repo = $repo ?: new \stdClass(); - switch ( $git ) { - case 'github': - $repo_api = new GitHub_API( $repo ); - break; - case 'bitbucket': - if ( ! empty( $repo->enterprise ) ) { - $repo_api = new Bitbucket_Server_API( $repo ); - } else { - $repo_api = new Bitbucket_API( $repo ); - } - break; - case 'gitlab': - $repo_api = new GitLab_API( $repo ); - break; - case 'gitea': - $repo_api = new Gitea_API( $repo ); - break; - } - - return $repo_api; - } - - /** - * Add Install settings fields. - * - * @param object $git Git API from caller. - */ - public function add_install_fields( $git ) { - add_action( - 'github_updater_add_install_settings_fields', - function ( $type ) use ( $git ) { - $git->add_install_settings_fields( $type ); - } - ); - } - - /** - * Call the API and return a json decoded body. - * Create error messages. - * - * @link http://developer.github.com/v3/ - * - * @param string $url The URL to send the request to. - * - * @return boolean|\stdClass - */ - protected function api( $url ) { - add_filter( 'http_request_args', [ $this, 'http_request_args' ], 10, 2 ); - - $type = $this->return_repo_type(); - $response = wp_remote_get( $this->get_api_url( $url ) ); - $code = (int) wp_remote_retrieve_response_code( $response ); - $allowed_codes = [ 200, 404 ]; - remove_filter( 'http_request_args', [ $this, 'http_request_args' ] ); - - if ( is_wp_error( $response ) ) { - Singleton::get_instance( 'Messages', $this )->create_error_message( $response ); - - return $response; - } - if ( ! in_array( $code, $allowed_codes, true ) ) { - static::$error_code = array_merge( - static::$error_code, - [ - $this->type->slug => [ - 'repo' => $this->type->slug, - 'code' => $code, - 'name' => $this->type->name, - 'git' => $this->type->git, - ], - ] - ); - if ( 'github' === $type['git'] ) { - GitHub_API::ratelimit_reset( $response, $this->type->slug ); - } - Singleton::get_instance( 'Messages', $this )->create_error_message( $type['git'] ); - - return false; - } - - // Gitea doesn't return json encoded raw file. - $response = $this->convert_body_string_to_json( $response ); - - return json_decode( wp_remote_retrieve_body( $response ) ); - } - - /** - * Convert response body to JSON. - * - * @param mixed $response (JSON|string) - * @return mixed $response JSON encoded. - */ - private function convert_body_string_to_json( $response ) { - if ( $this instanceof Gitea_API || $this instanceof Bitbucket_API || $this instanceof Bitbucket_Server_API ) { - $body = wp_remote_retrieve_body( $response ); - if ( null === json_decode( $body ) ) { - $response['body'] = json_encode( $body ); - } - } - - return $response; - } - - /** - * Return repo data for API calls. - * - * @access protected - * - * @return array - */ - protected function return_repo_type() { - $arr = []; - $arr['type'] = $this->type->type; - - switch ( $this->type->git ) { - case 'github': - $arr['git'] = 'github'; - $arr['base_uri'] = 'https://api.github.com'; - $arr['base_download'] = 'https://github.com'; - break; - case 'bitbucket': - $arr['git'] = 'bitbucket'; - if ( empty( $this->type->enterprise ) ) { - $arr['base_uri'] = 'https://api.bitbucket.org'; - $arr['base_download'] = 'https://bitbucket.org'; - } else { - $arr['base_uri'] = $this->type->enterprise_api; - $arr['base_download'] = $this->type->enterprise; - } - break; - case 'gitlab': - $arr['git'] = 'gitlab'; - $arr['base_uri'] = 'https://gitlab.com/api/v4'; - $arr['base_download'] = 'https://gitlab.com'; - break; - case 'gitea': - $arr['git'] = 'gitea'; - $arr['base_uri'] = $this->type->enterprise . '/api/v1'; - $arr['base_download'] = $this->type->enterprise; - break; - } - - return $arr; - } - - /** - * Return API url. - * - * @access protected - * - * @param string $endpoint The endpoint to access. - * @param bool|string $download_link The plugin or theme download link. Defaults to false. - * - * @return string $endpoint - */ - protected function get_api_url( $endpoint, $download_link = false ) { - $type = $this->return_repo_type(); - $segments = [ - 'owner' => $this->type->owner, - 'repo' => $this->type->slug, - 'branch' => empty( $this->type->branch ) ? 'master' : $this->type->branch, - ]; - - foreach ( $segments as $segment => $value ) { - $endpoint = str_replace( ':' . $segment, sanitize_text_field( $value ), $endpoint ); - } - - $repo_api = $this->get_repo_api( $type['git'], $this->type ); - switch ( $type['git'] ) { - case 'github': - if ( ! $this->type->enterprise && $download_link ) { - $type['base_download'] = $type['base_uri']; - break; - } - if ( $this->type->enterprise_api ) { - $type['base_download'] = $this->type->enterprise_api; - $type['base_uri'] = null; - if ( $download_link ) { - break; - } - } - $endpoint = $repo_api->add_endpoints( $this, $endpoint ); - break; - case 'gitlab': - if ( ! $this->type->enterprise && $download_link ) { - break; - } - if ( $this->type->enterprise ) { - $type['base_download'] = $this->type->enterprise; - $type['base_uri'] = null; - if ( $download_link ) { - break; - } - } - $endpoint = $repo_api->add_endpoints( $this, $endpoint ); - break; - case 'bitbucket': - $this->load_authentication_hooks(); - if ( $this->type->enterprise_api ) { - if ( $download_link ) { - $type['base_download'] = $type['base_uri']; - break; - } - $endpoint = $repo_api->add_endpoints( $this, $endpoint ); - - return $this->type->enterprise_api . $endpoint; - } - if ( $download_link && 'release_asset' === self::$method ) { - $type['base_download'] = $type['base_uri']; - } - $endpoint = $repo_api->add_endpoints( $this, $endpoint ); - break; - case 'gitea': - if ( $download_link ) { - $type['base_download'] = $type['base_uri']; - break; - } - $endpoint = $repo_api->add_endpoints( $this, $endpoint ); - break; - default: - break; - } - - $base = $download_link ? $type['base_download'] : $type['base_uri']; - - return $base . $endpoint; - } - - /** - * Query wp.org for plugin/theme information. - * - * @access protected - * - * @return bool|int|mixed|string|\WP_Error - */ - protected function get_dot_org_data() { - $response = isset( $this->response['dot_org'] ) ? $this->response['dot_org'] : false; - - if ( ! $response ) { - $url = "https://api.wordpress.org/{$this->type->type}s/info/1.1/"; - $url = add_query_arg( - [ - 'action' => "{$this->type->type}_information", - rawurlencode( 'request[slug]' ) => $this->type->slug, - ], - $url - ); - $response = wp_remote_get( $url ); - - if ( is_wp_error( $response ) ) { - Singleton::get_instance( 'Messages', $this )->create_error_message( $response ); - - return false; - } - - $response = json_decode( $response['body'] ); - $response = ! empty( $response ) && ! isset( $response->error ) ? 'in dot org' : 'not in dot org'; - - $this->set_repo_cache( 'dot_org', $response ); - } - - return 'in dot org' === $response; - } - - /** - * Add appropriate access token to endpoint. - * - * @access protected - * - * @param GitHub_API|GitLab_API $git Class containing the GitAPI used. - * @param string $endpoint The endpoint being accessed. - * - * @return string $endpoint - */ - protected function add_access_token_endpoint( $git, $endpoint ) { - // This will return if checking during shiny updates. - if ( null === static::$options ) { - return $endpoint; - } - $key = null; - $token = null; - $token_enterprise = null; - - switch ( $git->type->git ) { - case 'github': - $key = 'access_token'; - $token = 'github_access_token'; - $token_enterprise = 'github_enterprise_token'; - break; - case 'gitlab': - $key = 'private_token'; - $token = 'gitlab_access_token'; - $token_enterprise = 'gitlab_enterprise_token'; - break; - case 'gitea': - $key = 'access_token'; - $token = 'gitea_access_token'; - $token_enterprise = 'gitea_access_token'; - break; - case 'bitbucket': - return $endpoint; - } - - // Add hosted access token. - if ( ! empty( static::$options[ $token ] ) ) { - $endpoint = add_query_arg( $key, static::$options[ $token ], $endpoint ); - } - - // Add Enterprise access token. - if ( ! empty( $git->type->enterprise ) && - ! empty( static::$options[ $token_enterprise ] ) - ) { - $endpoint = remove_query_arg( $key, $endpoint ); - $endpoint = add_query_arg( $key, static::$options[ $token_enterprise ], $endpoint ); - } - - // Add repo access token. - if ( ! empty( static::$options[ $git->type->slug ] ) ) { - $endpoint = remove_query_arg( $key, $endpoint ); - $endpoint = add_query_arg( $key, static::$options[ $git->type->slug ], $endpoint ); - } - - return $endpoint; - } - - /** - * Test to exit early if no update available, saves API calls. - * - * @param array|bool $response - * @param bool $branch - * - * @return bool - */ - protected function exit_no_update( $response, $branch = false ) { - /** - * Filters the return value of exit_no_update. - * - * @since 6.0.0 - * @return bool `true` will exit this function early, default will not. - */ - if ( apply_filters( 'ghu_always_fetch_update', false ) ) { - return false; - } - - if ( $branch ) { - return empty( static::$options['branch_switch'] ); - } - - return ! isset( $_POST['ghu_refresh_cache'] ) && ! $response && ! $this->can_update_repo( $this->type ); - } - - /** - * Validate wp_remote_get response. - * - * @access protected - * - * @param \stdClass $response The response. - * - * @return bool true if invalid - */ - protected function validate_response( $response ) { - return empty( $response ) || isset( $response->message ) || is_wp_error( $response ); - } - - /** - * Check if a local file for the repository exists. - * Only checks the root directory of the repository. - * - * @access protected - * - * @param string $filename The filename to check for. - * - * @return bool - */ - protected function local_file_exists( $filename ) { - return file_exists( $this->type->local_path . $filename ); - } - - /** - * Sort tags and set object data. - * - * @param array $parsed_tags - * - * @return bool - */ - protected function sort_tags( $parsed_tags ) { - if ( empty( $parsed_tags ) ) { - return false; - } - - list($tags, $rollback) = $parsed_tags; - usort( $tags, 'version_compare' ); - krsort( $rollback ); - - $newest_tag = array_slice( $tags, -1, 1, true ); - $newest_tag_key = key( $newest_tag ); - $newest_tag = $tags[ $newest_tag_key ]; - - $this->type->newest_tag = $newest_tag; - $this->type->tags = $tags; - $this->type->rollback = $rollback; - - return true; - } - - /** - * Get local file info if no update available. Save API calls. - * - * @param \stdClass $repo Repo data. - * @param string $file - * - * @return null|string - */ - protected function get_local_info( $repo, $file ) { - $response = false; - - if ( isset( $_POST['ghu_refresh_cache'] ) ) { - return $response; - } - - if ( is_dir( $repo->local_path ) && - file_exists( $repo->local_path . $file ) - ) { - $response = file_get_contents( $repo->local_path . $file ); - } - - return $response; - } - - /** - * Set repo object file info. - * - * @param array $response Repo data. - */ - protected function set_file_info( $response ) { - $this->type->transient = $response; - $this->type->remote_version = strtolower( $response['Version'] ); - $this->type->requires_php = ! empty( $response['Requires PHP'] ) ? $response['Requires PHP'] : false; - $this->type->requires = ! empty( $response['Requires WP'] ) ? $response['Requires WP'] : null; - $this->type->dot_org = $response['dot_org']; - } - - /** - * Add remote data to type object. - * - * @access protected - */ - protected function add_meta_repo_object() { - $this->type->rating = $this->make_rating( $this->type->repo_meta ); - $this->type->last_updated = $this->type->repo_meta['last_updated']; - $this->type->num_ratings = $this->type->repo_meta['watchers']; - $this->type->is_private = $this->type->repo_meta['private']; - } - - /** - * Create some sort of rating from 0 to 100 for use in star ratings. - * I'm really just making this up, more based upon popularity. - * - * @param array $repo_meta - * - * @return integer - */ - protected function make_rating( $repo_meta ) { - $watchers = ! empty( $repo_meta['watchers'] ) ? $repo_meta['watchers'] : 0; - $forks = ! empty( $repo_meta['forks'] ) ? $repo_meta['forks'] : 0; - $open_issues = ! empty( $repo_meta['open_issues'] ) ? $repo_meta['open_issues'] : 0; - - $rating = abs( (int) round( $watchers + ( $forks * 1.5 ) - ( $open_issues * 0.1 ) ) ); - - if ( 100 < $rating ) { - return 100; - } - - return $rating; - } - - /** - * Set data from readme.txt. - * Prefer changelog from CHANGES.md. - * - * @param array $readme Array of parsed readme.txt data. - * - * @return bool - */ - protected function set_readme_info( $readme ) { - foreach ( (array) $this->type->sections as $section => $value ) { - if ( 'description' === $section ) { - continue; - } - $readme['sections'][ $section ] = $value; - } - - $readme['remaining_content'] = ! empty( $readme['remaining_content'] ) ? $readme['remaining_content'] : null; - if ( empty( $readme['sections']['other_notes'] ) ) { - unset( $readme['sections']['other_notes'] ); - } else { - $readme['sections']['other_notes'] .= $readme['remaining_content']; - } - unset( $readme['sections']['screenshots'], $readme['sections']['installation'] ); - $readme['sections'] = ! empty( $readme['sections'] ) ? $readme['sections'] : []; - $this->type->sections = array_merge( (array) $this->type->sections, (array) $readme['sections'] ); - $this->type->tested = isset( $readme['tested'] ) ? $readme['tested'] : null; - $this->type->requires = isset( $readme['requires'] ) ? $readme['requires'] : null; - $this->type->requires_php = isset( $readme['requires_php'] ) ? $readme['requires_php'] : null; - $this->type->donate_link = isset( $readme['donate_link'] ) ? $readme['donate_link'] : null; - $this->type->contributors = isset( $readme['contributors'] ) ? $readme['contributors'] : null; - - return true; - } - - /** - * Return the redirect download link for a release asset. - * AWS download link sets a link expiration of ONLY 5 minutes. - * - * @since 6.1.0 - * @uses Requests, requires WP 4.6 - * - * @param string $asset Release asset URI from git host. - * - * @return string|bool|\stdClass Release asset URI from AWS. - */ - protected function get_release_asset_redirect( $asset, $aws = false ) { - if ( ! $asset ) { - return false; - } - - // Unset release asset url if older than 5 min to account for AWS expiration. - if ( $aws && ( time() - strtotime( '-12 hours', $this->response['timeout'] ) ) >= 300 ) { - unset( $this->response['release_asset_redirect'] ); - } - - $response = isset( $this->response['release_asset_redirect'] ) ? $this->response['release_asset_redirect'] : false; - - if ( $this->exit_no_update( $response ) ) { - return false; - } - - if ( ! $response ) { - add_action( 'requests-requests.before_redirect', [ $this, 'set_redirect' ], 10, 1 ); - add_filter( 'http_request_args', [ $this, 'set_aws_release_asset_header' ] ); - $url = $this->add_access_token_endpoint( $this, $asset ); - wp_remote_get( $url ); - remove_filter( 'http_request_args', [ $this, 'set_aws_release_asset_header' ] ); - } - - if ( ! empty( $this->redirect ) ) { - $this->set_repo_cache( 'release_asset_redirect', $this->redirect ); - - return $this->redirect; - } - - return $response; - } - - /** - * Set HTTP header for following AWS release assets. - * - * @since 6.1.0 - * - * @param array $args - * @param string $url - * - * @return mixed $args - */ - public function set_aws_release_asset_header( $args, $url = '' ) { - $args['headers']['accept'] = 'application/octet-stream'; - - return $args; - } - - /** - * Set AWS redirect URL from action hook. - * - * @uses `requests-requests.before_redirect` Action hook. - * - * @param string $location - * @return void - */ - public function set_redirect( $location ) { - $this->redirect = $location; - } - -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/API/API_Interface.php b/wp-content/plugins/github-updater/src/GitHub_Updater/API/API_Interface.php deleted file mode 100644 index 8ffd5fb..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/API/API_Interface.php +++ /dev/null @@ -1,181 +0,0 @@ -type->download_link using Repository Contents API. - * - * @access public - * - * @param bool $branch_switch For direct branch switching. Defaults to false. - * - * @return string URL for download link. - */ - public function construct_download_link( $branch_switch = false); - - /** - * Create endpoints. - * - * @access public - * - * @param GitHub_API|Bitbucket_API|Bitbucket_Server_API|GitLab_API $git - * @param string $endpoint - * - * @return string $endpoint - */ - public function add_endpoints( $git, $endpoint); - - /** - * Parse API response call and return only array of tag numbers. - * - * @access public - * - * @param \stdClass|array $response API response. - * - * @return array|\stdClass Array of tag numbers, object is error. - */ - public function parse_tag_response( $response); - - /** - * Parse API response and return array of meta variables. - * - * @access public - * - * @param \stdClass|array $response API response. - * - * @return array|\stdClass Array of meta variables. - */ - public function parse_meta_response( $response); - - /** - * Parse API response and return array with changelog. - * - * @access public - * - * @param \stdClass|array $response API response. - * - * @return array|\stdClass $arr Array of changes in base64, object if error. - */ - public function parse_changelog_response( $response); - - /** - * Parse API response and return array of branch data. - * - * @access public - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ); - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field(); - - /** - * Add settings for each API. - * - * @param array $auth_required - * - * @return mixed - */ - public function add_settings( $auth_required); - - /** - * Add remote install settings fields. - * - * @param string $type plugin|theme. - */ - public function add_install_settings_fields( $type); - - /** - * Add remote install feature, create endpoint. - * - * @param array $headers - * @param array $install - * - * @return mixed $install - */ - public function remote_install( $headers, $install); -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/API/Bitbucket_API.php b/wp-content/plugins/github-updater/src/GitHub_Updater/API/Bitbucket_API.php deleted file mode 100644 index 6e6c6c8..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/API/Bitbucket_API.php +++ /dev/null @@ -1,580 +0,0 @@ -type = $type; - $this->response = $this->get_repo_cache(); - $branch = new Branch( $this->response ); - if ( ! empty( $type->branch ) ) { - $this->type->branch = ! empty( $branch->cache['current_branch'] ) - ? $branch->cache['current_branch'] - : $type->branch; - } - $this->set_default_credentials(); - $this->settings_hook( $this ); - $this->add_settings_subtab(); - $this->add_install_fields( $this ); - } - - /** - * Set default credentials if option not set. - */ - protected function set_default_credentials() { - $running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers(); - $set_credentials = false; - if ( $this instanceof Bitbucket_API ) { - $username = 'bitbucket_username'; - $password = 'bitbucket_password'; - } - if ( $this instanceof Bitbucket_Server_API ) { - $username = 'bitbucket_server_username'; - $password = 'bitbucket_server_password'; - } - if ( ! isset( static::$options[ $username ] ) ) { - static::$options[ $username ] = null; - $set_credentials = true; - } - if ( ! isset( static::$options[ $password ] ) ) { - static::$options[ $password ] = null; - $set_credentials = true; - } - if ( ( empty( static::$options[ $username ] ) || empty( static::$options[ $password ] ) ) && - ( ( 'bitbucket_username' === $username && - in_array( 'bitbucket', $running_servers, true ) ) || - ( 'bitbucket_server_username' === $username && - in_array( 'bbserver', $running_servers, true ) ) ) - ) { - Singleton::get_instance( 'Messages', $this )->create_error_message( 'bitbucket' ); - static::$error_code['bitbucket'] = [ 'code' => 401 ]; - } - if ( $set_credentials ) { - add_site_option( 'github_updater', static::$options ); - } - } - - /** - * Read the remote file and parse headers. - * - * @access public - * - * @param string $file The file. - * - * @return bool - */ - public function get_remote_info( $file ) { - return $this->get_remote_api_info( 'bitbucket', $file, "/2.0/repositories/:owner/:repo/src/:branch/{$file}" ); - } - - /** - * Get the remote info for tags. - * - * @access public - * - * @return bool - */ - public function get_remote_tag() { - return $this->get_remote_api_tag( 'bitbucket', '/2.0/repositories/:owner/:repo/refs/tags' ); - } - - /** - * Read the remote CHANGES.md file. - * - * @access public - * - * @param string $changes The changelog filename. - * - * @return bool - */ - public function get_remote_changes( $changes ) { - return $this->get_remote_api_changes( 'bitbucket', $changes, "/2.0/repositories/:owner/:repo/src/:branch/{$changes}" ); - } - - /** - * Read and parse remote readme.txt. - * - * @return bool - */ - public function get_remote_readme() { - return $this->get_remote_api_readme( 'bitbucket', '/2.0/repositories/:owner/:repo/src/:branch/readme.txt' ); - } - - /** - * Read the repository meta from API - * - * @return bool - */ - public function get_repo_meta() { - return $this->get_remote_api_repo_meta( 'bitbucket', '/2.0/repositories/:owner/:repo' ); - } - - /** - * Create array of branches and download links as array. - * - * @return bool - */ - public function get_remote_branches() { - return $this->get_remote_api_branches( 'bitbucket', '/2.0/repositories/:owner/:repo/refs/branches' ); - } - - /** - * Return the Bitbucket release asset URL. - * - * @return string - */ - public function get_release_asset() { - return $this->get_api_release_asset( 'bitbucket', '/2.0/repositories/:owner/:repo/downloads' ); - } - - /** - * Construct $this->type->download_link using Bitbucket API - * - * @param boolean $branch_switch For direct branch changing. Defaults to false. - * - * @return string $endpoint - */ - public function construct_download_link( $branch_switch = false ) { - self::$method = 'download_link'; - $download_link_base = $this->get_api_url( '/:owner/:repo/get/', true ); - $endpoint = ''; - - // Release asset. - if ( $this->type->release_asset && '0.0.0' !== $this->type->newest_tag ) { - $release_asset = $this->get_release_asset(); - return $this->get_release_asset_redirect( $release_asset, true ); - } - - /* - * If a branch has been given, use branch. - * If branch is master (default) and tags are used, use newest tag. - */ - if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) { - if ( ! empty( $this->type->enterprise_api ) ) { - $endpoint = add_query_arg( 'at', $this->type->branch, $endpoint ); - } else { - $endpoint .= $this->type->branch . '.zip'; - } - } else { - if ( ! empty( $this->type->enterprise_api ) ) { - $endpoint = add_query_arg( 'at', $this->type->newest_tag, $endpoint ); - } else { - $endpoint .= $this->type->newest_tag . '.zip'; - } - } - - /* - * Create endpoint for branch switching. - */ - if ( $branch_switch ) { - if ( ! empty( $this->type->enterprise_api ) ) { - $endpoint = add_query_arg( 'at', $branch_switch, $endpoint ); - } else { - $endpoint = $branch_switch . '.zip'; - } - } - - $download_link = $download_link_base . $endpoint; - - /** - * Filter download link so developers can point to specific ZipFile - * to use as a download link during a branch switch. - * - * @since 8.8.0 - * - * @param string $download_link Download URL. - * @param /stdClass $this->type Repository object. - * @param string $branch_switch Branch or tag for rollback or branch switching. - */ - return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch ); - } - - /** - * Create Bitbucket API endpoints. - * - * @param Bitbucket_API|API $git - * @param string $endpoint - * - * @return string|void $endpoint - */ - public function add_endpoints( $git, $endpoint ) { - switch ( $git::$method ) { - case 'file': - case 'readme': - case 'meta': - case 'changes': - case 'translation': - case 'release_asset': - case 'download_link': - break; - case 'tags': - case 'branches': - $endpoint = add_query_arg( - [ - 'pagelen' => '100', - 'sort' => '-name', - ], - $endpoint - ); - break; - default: - break; - } - - $endpoint = $this->add_access_token_endpoint( $git, $endpoint ); - - return $endpoint; - } - - /** - * Parse API response call and return only array of tag numbers. - * - * @param \stdClass $response Response from API call. - * - * @return array|\stdClass Array of tag numbers, object is error. - */ - public function parse_tag_response( $response ) { - if ( ! isset( $response->values ) || $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - array_map( - function ( $e ) use ( &$arr ) { - $arr[] = $e->name; - - return $arr; - }, - (array) $response->values - ); - - if ( ! $arr ) { - $arr = new \stdClass(); - $arr->message = 'No tags found'; - } - - return $arr; - } - - /** - * Parse API response and return array of meta variables. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of meta variables. - */ - public function parse_meta_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['private'] = $e->is_private; - $arr['last_updated'] = $e->updated_on; - $arr['watchers'] = 0; - $arr['forks'] = 0; - $arr['open_issues'] = 0; - } - ); - - return $arr; - } - - /** - * Parse API response and return array with changelog in base64. - * - * @param \stdClass|array $response Response from API call. - * - * @return array|\stdClass $arr Array of changes in base64, object if error. - */ - public function parse_changelog_response( $response ) { - } - - /** - * Parse API response and return array of branch data. - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $branches = []; - foreach ( $response as $branch ) { - $branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name ); - $branches[ $branch->name ]['commit_hash'] = $branch->target->hash; - $branches[ $branch->name ]['commit_timestamp'] = $branch->target->date; - } - return $branches; - } - - /** - * Parse tags and create download links. - * - * @param \stdClass|array $response Response from API call. - * @param string $repo_type - * - * @return array - */ - protected function parse_tags( $response, $repo_type ) { - $tags = []; - $rollback = []; - - foreach ( (array) $response as $tag ) { - $download_base = "{$repo_type['base_download']}/{$this->type->owner}/{$this->type->owner}/get/"; - $tags[] = $tag; - $rollback[ $tag ] = $download_base . $tag . '.zip'; - } - - return [ $tags, $rollback ]; - } - - /** - * Add settings for Bitbucket Username and Password. - * - * @param array $auth_required - * - * @return void - */ - public function add_settings( $auth_required ) { - add_settings_section( - 'bitbucket_user', - esc_html__( 'Bitbucket Private Settings', 'github-updater' ), - [ $this, 'print_section_bitbucket_username' ], - 'github_updater_bitbucket_install_settings' - ); - - add_settings_field( - 'bitbucket_username', - esc_html__( 'Bitbucket Username', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_bitbucket_install_settings', - 'bitbucket_user', - [ 'id' => 'bitbucket_username' ] - ); - - add_settings_field( - 'bitbucket_password', - esc_html__( 'Bitbucket Password', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_bitbucket_install_settings', - 'bitbucket_user', - [ - 'id' => 'bitbucket_password', - 'token' => true, - ] - ); - - /* - * Show section for private Bitbucket repositories. - */ - if ( $auth_required['bitbucket_private'] ) { - add_settings_section( - 'bitbucket_id', - esc_html__( 'Bitbucket Private Repositories', 'github-updater' ), - [ $this, 'print_section_bitbucket_info' ], - 'github_updater_bitbucket_install_settings' - ); - } - } - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field() { - $setting_field['page'] = 'github_updater_bitbucket_install_settings'; - $setting_field['section'] = 'bitbucket_id'; - $setting_field['callback_method'] = [ - Singleton::get_instance( 'Settings', $this ), - 'token_callback_checkbox', - ]; - - return $setting_field; - } - - /** - * Add subtab to Settings page. - */ - private function add_settings_subtab() { - add_filter( - 'github_updater_add_settings_subtabs', - function ( $subtabs ) { - return array_merge( $subtabs, [ 'bitbucket' => esc_html__( 'Bitbucket', 'github-updater' ) ] ); - } - ); - } - - /** - * Print the Bitbucket repo Settings text. - */ - public function print_section_bitbucket_info() { - esc_html_e( 'Check box if private repository. Leave unchecked for public repositories.', 'github-updater' ); - } - - /** - * Print the Bitbucket user/pass Settings text. - */ - public function print_section_bitbucket_username() { - esc_html_e( 'Enter your personal Bitbucket username and password.', 'github-updater' ); - } - - /** - * Add remote install settings fields. - * - * @param string $type - */ - public function add_install_settings_fields( $type ) { - if ( ( empty( static::$options['bitbucket_username'] ) || - empty( static::$options['bitbucket_password'] ) ) || - - ( empty( static::$options['bitbucket_server_username'] ) || - empty( static::$options['bitbucket_server_password'] ) ) - ) { - add_settings_field( - 'bitbucket_username', - esc_html__( 'Bitbucket Username', 'github-updater' ), - [ $this, 'bitbucket_username' ], - 'github_updater_install_' . $type, - $type - ); - - add_settings_field( - 'bitbucket_password', - esc_html__( 'Bitbucket Password', 'github-updater' ), - [ $this, 'bitbucket_password' ], - 'github_updater_install_' . $type, - $type - ); - } - - add_settings_field( - 'is_private', - esc_html__( 'Private Bitbucket Repository', 'github-updater' ), - [ $this, 'is_private_repo' ], - 'github_updater_install_' . $type, - $type - ); - } - - /** - * Setting for private repo for remote install. - */ - public function is_private_repo() { - ?> - - - - - - / - * User URI: https://bitbucket.example.com/users// - * - * @link https://docs.atlassian.com/bitbucket-server/rest/5.3.1/bitbucket-rest.html - * - * @author Andy Fragen - * @author Bjorn Wijers - */ -class Bitbucket_Server_API extends Bitbucket_API { - - /** - * Constructor. - * - * @param \stdClass $type - */ - public function __construct( $type ) { - parent::__construct( $type ); - $this->add_settings_subtab(); - } - - /** - * Read the remote file and parse headers. - * - * @param string $file Filename. - * - * @return bool - */ - public function get_remote_info( $file ) { - return $this->get_remote_api_info( 'bbserver', $file, "/1.0/:owner/repos/:repo/browse/{$file}" ); - } - - /** - * Read the repository meta from API - * - * @return bool - */ - public function get_repo_meta() { - return $this->get_remote_api_repo_meta( 'bbserver', '/1.0/:owner/repos/:repo' ); - } - - /** - * Get the remote info for tags. - * - * @access public - * - * @return bool - */ - public function get_remote_tag() { - return $this->get_remote_api_tag( 'bbserver', '/1.0/:owner/repos/:repo/tags' ); - } - - /** - * Read and parse remote readme.txt. - * - * @return bool - */ - public function get_remote_readme() { - return $this->get_remote_api_readme( 'bbserver', '/1.0/:owner/repos/:repo/raw/readme.txt' ); - } - - /** - * Read the remote CHANGES.md file - * - * @param string $changes Changelog filename. - * - * @return bool - */ - public function get_remote_changes( $changes ) { - return $this->get_remote_api_changes( 'bbserver', $changes, "/1.0/:owner/repos/:repo/raw/{$changes}" ); - } - - /** - * Create array of branches and download links as array. - * - * @return bool - */ - public function get_remote_branches() { - return $this->get_remote_api_branches( 'bbserver', '/1.0/:owner/repos/:repo/branches' ); - } - - /** - * Return the Bitbucket Sever release asset URL. - * - * @return string - */ - public function get_release_asset() { - // TODO: make this work. - // return $this->get_api_release_asset( 'bbserver', '/1.0/:owner/:repo/downloads' ); - } - - /** - * Construct $this->type->download_link using Bitbucket Server API. - * - * Downloads requires the official stash-archive plugin which enables - * subdirectory support using the prefix query argument. - * - * @link https://bitbucket.org/atlassian/stash-archive - * - * @param boolean $branch_switch for direct branch changing. - * - * @return string $endpoint - */ - public function construct_download_link( $branch_switch = false ) { - self::$method = 'download_link'; - $download_link_base = $this->get_api_url( '/latest/:owner/repos/:repo/archive', true ); - $endpoint = $this->add_endpoints( $this, '' ); - - if ( $branch_switch ) { - $endpoint = urldecode( add_query_arg( 'at', $branch_switch, $endpoint ) ); - } - - return $download_link_base . $endpoint; - } - - /** - * Create Bitbucket Server API endpoints. - * - * @param Bitbucket_Server_API|API $git - * @param string $endpoint - * - * @return string $endpoint - */ - public function add_endpoints( $git, $endpoint ) { - switch ( self::$method ) { - case 'meta': - case 'translation': - case 'branches': - break; - case 'file': - case 'readme': - $endpoint = add_query_arg( 'at', $git->type->branch, $endpoint ); - break; - case 'changes': - $endpoint = add_query_arg( - [ - 'at' => $git->type->branch, - 'raw' => '', - ], - $endpoint - ); - break; - case 'tags': - case 'download_link': - /* - * Add a prefix query argument to create a subdirectory with the same name - * as the repo, e.g. 'my-repo' becomes 'my-repo/' - * Required for using stash-archive. - */ - $defaults = [ - 'prefix' => $git->type->slug . '/', - 'at' => $git->type->branch, - 'format' => 'zip', - ]; - $endpoint = add_query_arg( $defaults, $endpoint ); - if ( ! empty( $git->type->tags ) ) { - $endpoint = urldecode( add_query_arg( 'at', $git->type->newest_tag, $endpoint ) ); - } - break; - default: - break; - } - - return $endpoint; - } - - /** - * Combines separate text lines from API response into one string with \n line endings. - * Code relying on raw text can now parse it. - * - * @param string|\stdClass|mixed $response - * - * @return string Combined lines of text returned by API - */ - protected function bbserver_recombine_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $remote_info_file = ''; - if ( isset( $response->lines ) ) { - foreach ( (array) $response->lines as $line ) { - $remote_info_file .= $line->text . "\n"; - } - } - - return $remote_info_file; - } - - /** - * Parse API response and return array of meta variables. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of meta variables. - */ - public function parse_meta_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['private'] = ! $e->public; - $arr['last_updated'] = null; - $arr['watchers'] = 0; - $arr['forks'] = 0; - $arr['open_issues'] = 0; - } - ); - - return $arr; - } - - /** - * Parse API response and return array with changelog. - * - * @param string $response Response from API call. - * - * @return void - */ - public function parse_changelog_response( $response ) { - } - - /** - * Parse API response and return object with readme body. - * - * @param string|\stdClass $response - * - * @return void - */ - protected function parse_readme_response( $response ) { - } - - /** - * Parse API response and return array of branch data. - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $branches = []; - foreach ( $response as $branch ) { - $branches[ $branch->displayId ]['download'] = $this->construct_download_link( $branch->displayId ); - $branches[ $branch->displayId ]['commit_hash'] = $branch->latestCommit; - } - return $branches; - } - - /** - * Parse API response call and return only array of tag numbers. - * - * @param \stdClass $response Response from API call. - * - * @return array|\stdClass Array of tag numbers, object is error. - */ - public function parse_tag_response( $response ) { - if ( ! isset( $response->values ) || $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - array_map( - function ( $e ) use ( &$arr ) { - $arr[] = $e->displayId; - - return $arr; - }, - (array) $response->values - ); - - return $arr; - } - - /** - * Parse tags and create download links. - * - * @param \stdClass|array $response Response from API call. - * @param string $repo_type - * - * @return array - */ - protected function parse_tags( $response, $repo_type ) { - $tags = []; - $rollback = []; - - foreach ( (array) $response as $tag ) { - $download_base = "{$repo_type['base_uri']}/latest/{$this->type->owner}/repos/{$this->type->slug}/archive"; - $download_base = $this->add_endpoints( $this, $download_base ); - $tags[] = $tag; - $rollback[ $tag ] = add_query_arg( 'at', $tag, $download_base ); - } - - return [ $tags, $rollback ]; - } - - /** - * Add settings for Bitbucket Server Username and Password. - * - * @param array $auth_required - * - * @return void - */ - public function add_settings( $auth_required ) { - add_settings_section( - 'bitbucket_server_user', - esc_html__( 'Bitbucket Server Private Settings', 'github-updater' ), - [ $this, 'print_section_bitbucket_username' ], - 'github_updater_bbserver_install_settings' - ); - - add_settings_field( - 'bitbucket_server_username', - esc_html__( 'Bitbucket Server Username', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_bbserver_install_settings', - 'bitbucket_server_user', - [ 'id' => 'bitbucket_server_username' ] - ); - - add_settings_field( - 'bitbucket_server_password', - esc_html__( 'Bitbucket Server Password', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_bbserver_install_settings', - 'bitbucket_server_user', - [ - 'id' => 'bitbucket_server_password', - 'token' => true, - ] - ); - - /* - * Show section for private Bitbucket Server repositories. - */ - if ( $auth_required['bitbucket_server'] ) { - add_settings_section( - 'bitbucket_server_id', - esc_html__( 'Bitbucket Server Private Repositories', 'github-updater' ), - [ $this, 'print_section_bitbucket_info' ], - 'github_updater_bbserver_install_settings' - ); - } - } - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field() { - $setting_field['page'] = 'github_updater_bbserver_install_settings'; - $setting_field['section'] = 'bitbucket_server_id'; - $setting_field['callback_method'] = [ - Singleton::get_instance( 'Settings', $this ), - 'token_callback_checkbox', - ]; - - return $setting_field; - } - - /** - * Add subtab to Settings page. - */ - private function add_settings_subtab() { - add_filter( - 'github_updater_add_settings_subtabs', - function ( $subtabs ) { - return array_merge( $subtabs, [ 'bbserver' => esc_html__( 'Bitbucket Server', 'github-updater' ) ] ); - } - ); - } - - /** - * Add remote install feature, create endpoint. - * - * @param array $headers - * @param array $install - * - * @return array $install - */ - public function remote_install( $headers, $install ) { - $bitbucket_org = true; - - if ( 'bitbucket.org' === $headers['host'] || empty( $headers['host'] ) ) { - $base = 'https://bitbucket.org'; - $headers['host'] = 'bitbucket.org'; - } else { - $base = $headers['base_uri']; - $bitbucket_org = false; - } - - if ( ! $bitbucket_org ) { - $install['download_link'] = "{$base}/rest/api/latest/{$headers['owner']}/repos/{$headers['repo']}/archive"; - - $install['download_link'] = add_query_arg( - [ - 'prefix' => $headers['repo'] . '/', - 'at' => $install['github_updater_branch'], - 'format' => 'zip', - ], - $install['download_link'] - ); - - if ( isset( $install['is_private'] ) ) { - $install['options'][ $install['repo'] ] = 1; - } - if ( ! empty( $install['bitbucket_username'] ) ) { - $install['options']['bitbucket_server_username'] = $install['bitbucket_username']; - } - if ( ! empty( $install['bitbucket_password'] ) ) { - $install['options']['bitbucket_server_password'] = $install['bitbucket_password']; - } - } - - return $install; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/API/GitHub_API.php b/wp-content/plugins/github-updater/src/GitHub_Updater/API/GitHub_API.php deleted file mode 100644 index d1a04e7..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/API/GitHub_API.php +++ /dev/null @@ -1,549 +0,0 @@ -type = $type; - $this->response = $this->get_repo_cache(); - $branch = new Branch( $this->response ); - if ( ! empty( $type->branch ) ) { - $this->type->branch = ! empty( $branch->cache['current_branch'] ) - ? $branch->cache['current_branch'] - : $type->branch; - } - $this->settings_hook( $this ); - $this->add_settings_subtab(); - $this->add_install_fields( $this ); - } - - /** - * Read the remote file and parse headers. - * - * @param string $file Filename. - * - * @return bool - */ - public function get_remote_info( $file ) { - return $this->get_remote_api_info( 'github', $file, "/repos/:owner/:repo/contents/{$file}" ); - } - - /** - * Get remote info for tags. - * - * @return bool - */ - public function get_remote_tag() { - return $this->get_remote_api_tag( 'github', '/repos/:owner/:repo/tags' ); - } - - /** - * Read the remote CHANGES.md file. - * - * @param string $changes Changelog filename. - * - * @return bool - */ - public function get_remote_changes( $changes ) { - return $this->get_remote_api_changes( 'github', $changes, "/repos/:owner/:repo/contents/{$changes}" ); - } - - /** - * Read and parse remote readme.txt. - * - * @return bool - */ - public function get_remote_readme() { - $this->get_remote_api_readme( 'github', '/repos/:owner/:repo/contents/readme.txt' ); - } - - /** - * Read the repository meta from API. - * - * @return bool - */ - public function get_repo_meta() { - return $this->get_remote_api_repo_meta( 'github', '/repos/:owner/:repo' ); - } - - /** - * Create array of branches and download links as array. - * - * @return bool - */ - public function get_remote_branches() { - return $this->get_remote_api_branches( 'github', '/repos/:owner/:repo/branches' ); - } - - /** - * Return the GitHub release asset URL. - * - * @return string|bool - */ - public function get_release_asset() { - return $this->get_api_release_asset( 'github', '/repos/:owner/:repo/releases/latest' ); - } - - /** - * Construct $this->type->download_link using Repository Contents API. - * - * @url http://developer.github.com/v3/repos/contents/#get-archive-link - * - * @param boolean $branch_switch for direct branch changing. - * - * @return string $endpoint - */ - public function construct_download_link( $branch_switch = false ) { - self::$method = 'download_link'; - $download_link_base = $this->get_api_url( '/repos/:owner/:repo/zipball/', true ); - $endpoint = ''; - - // Release asset. - if ( $this->type->release_asset && '0.0.0' !== $this->type->newest_tag ) { - $release_asset = $this->get_release_asset(); - if ( property_exists( $this->type, 'is_private' ) && $this->type->is_private ) { - return $this->get_release_asset_redirect( $release_asset, true ); - } - return $release_asset; - } - - /* - * If a branch has been given, use branch. - * If branch is master (default) and tags are used, use newest tag. - */ - if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) { - $endpoint .= $this->type->branch; - } else { - $endpoint .= $this->type->newest_tag; - } - - // Create endpoint for branch switching. - if ( $branch_switch ) { - $endpoint = $branch_switch; - } - - $endpoint = $this->add_access_token_endpoint( $this, $endpoint ); - $download_link = $download_link_base . $endpoint; - - /** - * Filter download link so developers can point to specific ZipFile - * to use as a download link during a branch switch. - * - * @since 8.8.0 - * - * @param string $download_link Download URL. - * @param /stdClass $this->type Repository object. - * @param string $branch_switch Branch or tag for rollback or branch switching. - */ - return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch ); - } - - /** - * Create GitHub API endpoints. - * - * @param GitHub_API|API $git - * @param string $endpoint - * - * @return string $endpoint - */ - public function add_endpoints( $git, $endpoint ) { - switch ( $git::$method ) { - case 'file': - case 'readme': - case 'changes': - $endpoint = add_query_arg( 'ref', $git->type->branch, $endpoint ); - break; - case 'meta': - case 'tags': - case 'download_link': - case 'release_asset': - case 'translation': - break; - case 'branches': - $endpoint = add_query_arg( 'per_page', '100', $endpoint ); - break; - default: - break; - } - - $endpoint = $this->add_access_token_endpoint( $git, $endpoint ); - - /* - * If GitHub Enterprise return this endpoint. - */ - if ( ! empty( $git->type->enterprise_api ) ) { - return $git->type->enterprise_api . $endpoint; - } - - return $endpoint; - } - - /** - * Calculate and store time until rate limit reset. - * - * @param array $response HTTP headers. - * @param string $repo Repo name. - */ - public static function ratelimit_reset( $response, $repo ) { - if ( isset( $response['headers']['x-ratelimit-reset'] ) ) { - $reset = (int) $response['headers']['x-ratelimit-reset']; - $wait = date( 'i', $reset - time() ); - static::$error_code[ $repo ] = array_merge( - static::$error_code[ $repo ], - [ - 'git' => 'github', - 'wait' => $wait, - ] - ); - } - } - - /** - * Parse API response call and return only array of tag numbers. - * - * @param \stdClass|array $response Response from API call. - * - * @return \stdClass|array $arr Array of tag numbers, object is error. - */ - public function parse_tag_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - array_map( - function ( $e ) use ( &$arr ) { - $arr[] = $e->name; - - return $arr; - }, - (array) $response - ); - - return $arr; - } - - /** - * Parse API response and return array of meta variables. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of meta variables. - */ - public function parse_meta_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['private'] = $e->private; - $arr['last_updated'] = $e->pushed_at; - $arr['watchers'] = $e->watchers; - $arr['forks'] = $e->forks; - $arr['open_issues'] = $e->open_issues; - } - ); - - return $arr; - } - - /** - * Parse API response and return array with changelog in base64. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of changes in base64. - */ - public function parse_changelog_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['changes'] = $e->content; - } - ); - - return $arr; - } - - /** - * Parse API response and return array of branch data. - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $branches = []; - foreach ( $response as $branch ) { - $branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name ); - $branches[ $branch->name ]['commit_hash'] = $branch->commit->sha; - $branches[ $branch->name ]['commit_api'] = $branch->commit->url; - } - return $branches; - } - - /** - * Parse tags and create download links. - * - * @param \stdClass|array $response Response from API call. - * @param array $repo_type - * - * @return array - */ - protected function parse_tags( $response, $repo_type ) { - $tags = []; - $rollback = []; - - foreach ( (array) $response as $tag ) { - $download_base = implode( - '/', - [ - $repo_type['base_uri'], - 'repos', - $this->type->owner, - $this->type->slug, - 'zipball/', - ] - ); - $tags[] = $tag; - $rollback[ $tag ] = $download_base . $tag; - } - - return [ $tags, $rollback ]; - } - - /** - * Add settings for GitHub Personal Access Token. - * - * @param array $auth_required - * - * @return void - */ - public function add_settings( $auth_required ) { - add_settings_section( - 'github_access_token', - esc_html__( 'GitHub Personal Access Token', 'github-updater' ), - [ $this, 'print_section_github_access_token' ], - 'github_updater_github_install_settings' - ); - - add_settings_field( - 'github_access_token', - esc_html__( 'GitHub.com Access Token', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_github_install_settings', - 'github_access_token', - [ - 'id' => 'github_access_token', - 'token' => true, - ] - ); - - if ( $auth_required['github_enterprise'] ) { - add_settings_field( - 'github_enterprise_token', - esc_html__( 'GitHub Enterprise Access Token', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_github_install_settings', - 'github_access_token', - [ - 'id' => 'github_enterprise_token', - 'token' => true, - ] - ); - } - - /* - * Show section for private GitHub repositories. - */ - if ( $auth_required['github_private'] || $auth_required['github_enterprise'] ) { - add_settings_section( - 'github_id', - esc_html__( 'GitHub Private Settings', 'github-updater' ), - [ $this, 'print_section_github_info' ], - 'github_updater_github_install_settings' - ); - } - } - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field() { - $setting_field['page'] = 'github_updater_github_install_settings'; - $setting_field['section'] = 'github_id'; - $setting_field['callback_method'] = [ - Singleton::get_instance( 'Settings', $this ), - 'token_callback_text', - ]; - - return $setting_field; - } - - /** - * Print the GitHub text. - */ - public function print_section_github_info() { - esc_html_e( 'Enter your GitHub Access Token. Leave empty for public repositories.', 'github-updater' ); - } - - /** - * Print the GitHub Personal Access Token text. - */ - public function print_section_github_access_token() { - esc_html_e( 'Enter your personal GitHub.com or GitHub Enterprise Access Token to avoid API access limits.', 'github-updater' ); - } - - /** - * Add remote install settings fields. - * - * @param string $type plugin|theme. - */ - public function add_install_settings_fields( $type ) { - add_settings_field( - 'github_access_token', - esc_html__( 'GitHub Access Token', 'github-updater' ), - [ $this, 'github_access_token' ], - 'github_updater_install_' . $type, - $type - ); - } - - /** - * Add subtab to Settings page. - */ - private function add_settings_subtab() { - add_filter( - 'github_updater_add_settings_subtabs', - function ( $subtabs ) { - return array_merge( $subtabs, [ 'github' => esc_html__( 'GitHub', 'github-updater' ) ] ); - } - ); - } - - /** - * GitHub Access Token for remote install. - */ - public function github_access_token() { - ?> - - type = $type; - $this->response = $this->get_repo_cache(); - $branch = new Branch( $this->response ); - if ( ! empty( $type->branch ) ) { - $this->type->branch = ! empty( $branch->cache['current_branch'] ) - ? $branch->cache['current_branch'] - : $type->branch; - } - $this->set_default_credentials(); - $this->settings_hook( $this ); - $this->add_settings_subtab(); - $this->add_install_fields( $this ); - } - - /** - * Set default credentials if option not set. - */ - protected function set_default_credentials() { - $running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers(); - $set_credentials = false; - if ( ! isset( static::$options['gitlab_access_token'] ) ) { - static::$options['gitlab_access_token'] = null; - $set_credentials = true; - } - if ( ! isset( static::$options['gitlab_enterprise_token'] ) ) { - static::$options['gitlab_enterprise_token'] = null; - $set_credentials = true; - } - if ( ( empty( static::$options['gitlab_enterprise_token'] ) && - in_array( 'gitlabce', $running_servers, true ) ) || - ( empty( static::$options['gitlab_access_token'] ) && - in_array( 'gitlab', $running_servers, true ) ) - ) { - $this->gitlab_error_notices(); - } - if ( $set_credentials ) { - add_site_option( 'github_updater', static::$options ); - } - } - - /** - * Read the remote file and parse headers. - * - * @param string $file Filename. - * - * @return bool - */ - public function get_remote_info( $file ) { - $id = $this->get_gitlab_id(); - return $this->get_remote_api_info( 'gitlab', $file, "/projects/{$id}/repository/files/{$file}" ); - } - - /** - * Get remote info for tags. - * - * @return bool - */ - public function get_remote_tag() { - $id = $this->get_gitlab_id(); - return $this->get_remote_api_tag( 'gitlab', "/projects/{$id}/repository/tags" ); - } - - /** - * Read the remote CHANGES.md file. - * - * @param string $changes Changelog filename. - * - * @return bool - */ - public function get_remote_changes( $changes ) { - $id = $this->get_gitlab_id(); - return $this->get_remote_api_changes( 'gitlab', $changes, "/projects/{$id}/repository/files/{$changes}" ); - } - - /** - * Read and parse remote readme.txt. - * - * @return bool - */ - public function get_remote_readme() { - $id = $this->get_gitlab_id(); - return $this->get_remote_api_readme( 'gitlab', "/projects/{$id}/repository/files/readme.txt" ); - } - - /** - * Read the repository meta from API. - * - * @return bool - */ - public function get_repo_meta() { - $response = isset( $this->response['meta'] ) ? $this->response['meta'] : false; - - if ( ! $response ) { - self::$method = 'meta'; - $project = isset( $this->response['project'] ) ? $this->response['project'] : false; - - // exit if transient is empty. - if ( ! $project ) { - return false; - } - - $response = ( $this->type->slug === $project->path ) ? $project : false; - - if ( $response ) { - $response = $this->parse_meta_response( $response ); - $this->set_repo_cache( 'meta', $response ); - $this->set_repo_cache( 'project', null ); - } - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - $this->type->repo_meta = $response; - $this->add_meta_repo_object(); - - return true; - } - - /** - * Create array of branches and download links as array. - * - * @return bool - */ - public function get_remote_branches() { - $id = $this->get_gitlab_id(); - return $this->get_remote_api_branches( 'gitlab', "/projects/{$id}/repository/branches" ); - } - - /** - * Get GitLab release asset download link. - * - * @return string|bool - */ - public function get_release_asset() { - return $this->get_api_release_asset( 'gitlab', "/projects/{$this->response['project_id']}/jobs/artifacts/{$this->type->newest_tag}/download" ); - } - - /** - * Construct $this->type->download_link using GitLab API v4. - * - * @param boolean $branch_switch for direct branch changing. - * - * @return string $endpoint - */ - public function construct_download_link( $branch_switch = false ) { - self::$method = 'download_link'; - $download_link_base = $this->get_api_url( "/projects/{$this->get_gitlab_id()}/repository/archive.zip" ); - $download_link_base = remove_query_arg( 'private_token', $download_link_base ); - - $endpoint = ''; - $endpoint = add_query_arg( 'sha', $this->type->branch, $endpoint ); - - // Release asset. - if ( $this->type->ci_job && '0.0.0' !== $this->type->newest_tag ) { - $release_asset = $this->get_release_asset(); - return $release_asset; - } - - // If branch is master (default) and tags are used, use newest tag. - if ( 'master' === $this->type->branch && ! empty( $this->type->tags ) ) { - $endpoint = add_query_arg( 'sha', $this->type->newest_tag, $endpoint ); - } - - // Create endpoint for branch switching. - if ( $branch_switch ) { - $endpoint = add_query_arg( 'sha', $branch_switch, $endpoint ); - } - - $endpoint = $this->add_access_token_endpoint( $this, $endpoint ); - $download_link = $download_link_base . $endpoint; - - /** - * Filter download link so developers can point to specific ZipFile - * to use as a download link during a branch switch. - * - * @since 8.8.0 - * - * @param string $download_link Download URL. - * @param /stdClass $this->type Repository object. - * @param string $branch_switch Branch or tag for rollback or branch switching. - */ - return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch ); - } - - /** - * Create GitLab API endpoints. - * - * @param GitLab_API|API $git - * @param string $endpoint - * - * @return string $endpoint - */ - public function add_endpoints( $git, $endpoint ) { - switch ( $git::$method ) { - case 'projects': - $endpoint = add_query_arg( 'per_page', '100', $endpoint ); - break; - case 'meta': - case 'tags': - case 'branches': - case 'download_link': - break; - case 'file': - case 'changes': - case 'readme': - $endpoint = add_query_arg( 'ref', $git->type->branch, $endpoint ); - break; - case 'translation': - $endpoint = add_query_arg( 'ref', 'master', $endpoint ); - break; - case 'release_asset': - $endpoint = add_query_arg( 'job', $git->type->ci_job, $endpoint ); - break; - default: - break; - } - - $endpoint = $this->add_access_token_endpoint( $git, $endpoint ); - - /* - * If GitLab CE/Enterprise return this endpoint. - */ - if ( ! empty( $git->type->enterprise_api ) ) { - return $git->type->enterprise_api . $endpoint; - } - - return $endpoint; - } - - /** - * Get GitLab project ID and project meta. - * - * @return string|int - */ - public function get_gitlab_id() { - $id = null; - $response = isset( $this->response['project_id'] ) ? $this->response['project_id'] : false; - - if ( ! $response ) { - self::$method = 'projects'; - $id = implode( '/', [ $this->type->owner, $this->type->slug ] ); - $id = rawurlencode( $id ); - $response = $this->api( '/projects/' . $id ); - - if ( $this->validate_response( $response ) ) { - return $id; - } - - if ( $response && $this->type->slug === $response->path ) { - $id = $response->id; - $this->set_repo_cache( 'project_id', $id ); - $this->set_repo_cache( 'project', $response ); - } - - return $id; - } - - return $response; - } - - /** - * Parse API response call and return only array of tag numbers. - * - * @param \stdClass|array $response Response from API call for tags. - * - * @return \stdClass|array Array of tag numbers, object is error. - */ - public function parse_tag_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - array_map( - function ( $e ) use ( &$arr ) { - $arr[] = $e->name; - - return $arr; - }, - (array) $response - ); - - return $arr; - } - - /** - * Parse API response and return array of meta variables. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of meta variables. - */ - public function parse_meta_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['private'] = isset( $e->visibility ) && 'private' === $e->visibility ? true : false; - $arr['private'] = isset( $e->public ) ? ! $e->public : $arr['private']; - $arr['last_updated'] = $e->last_activity_at; - $arr['watchers'] = 0; - $arr['forks'] = $e->forks_count; - $arr['open_issues'] = isset( $e->open_issues_count ) ? $e->open_issues_count : 0; - } - ); - - return $arr; - } - - /** - * Parse API response and return array with changelog in base64. - * - * @param \stdClass|array $response Response from API call. - * - * @return array|\stdClass $arr Array of changes in base64, object if error. - */ - public function parse_changelog_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['changes'] = $e->content; - } - ); - - return $arr; - } - - /** - * Parse API response and return array of branch data. - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $branches = []; - foreach ( $response as $branch ) { - $branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name ); - $branches[ $branch->name ]['commit_hash'] = $branch->commit->id; - $branches[ $branch->name ]['commit_timestamp'] = $branch->commit->committed_date; - } - return $branches; - } - - /** - * Parse tags and create download links. - * - * @param \stdClass|array $response Response from API call. - * @param array $repo_type - * - * @return array - */ - protected function parse_tags( $response, $repo_type ) { - $tags = []; - $rollback = []; - - foreach ( (array) $response as $tag ) { - $download_link = "/projects/{$this->get_gitlab_id()}/repository/archive.zip"; - $download_link = $this->get_api_url( $download_link ); - $download_link = add_query_arg( 'sha', $tag, $download_link ); - $tags[] = $tag; - $rollback[ $tag ] = $download_link; - } - - return [ $tags, $rollback ]; - } - - /** - * Add settings for GitLab.com, GitLab Community Edition. - * or GitLab Enterprise Access Token. - * - * @param array $auth_required - * - * @return void - */ - public function add_settings( $auth_required ) { - if ( $auth_required['gitlab'] || $auth_required['gitlab_enterprise'] ) { - add_settings_section( - 'gitlab_settings', - esc_html__( 'GitLab Personal Access Token', 'github-updater' ), - [ $this, 'print_section_gitlab_token' ], - 'github_updater_gitlab_install_settings' - ); - } - - if ( $auth_required['gitlab_private'] ) { - add_settings_section( - 'gitlab_id', - esc_html__( 'GitLab Private Settings', 'github-updater' ), - [ $this, 'print_section_gitlab_info' ], - 'github_updater_gitlab_install_settings' - ); - } - - if ( $auth_required['gitlab'] ) { - add_settings_field( - 'gitlab_access_token', - esc_html__( 'GitLab.com Access Token', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_gitlab_install_settings', - 'gitlab_settings', - [ - 'id' => 'gitlab_access_token', - 'token' => true, - ] - ); - } - - if ( $auth_required['gitlab_enterprise'] ) { - add_settings_field( - 'gitlab_enterprise_token', - esc_html__( 'GitLab CE or GitLab Enterprise Personal Access Token', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_gitlab_install_settings', - 'gitlab_settings', - [ - 'id' => 'gitlab_enterprise_token', - 'token' => true, - ] - ); - } - } - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field() { - $setting_field['page'] = 'github_updater_gitlab_install_settings'; - $setting_field['section'] = 'gitlab_id'; - $setting_field['callback_method'] = [ - Singleton::get_instance( 'Settings', $this ), - 'token_callback_text', - ]; - - return $setting_field; - } - - /** - * Add subtab to Settings page. - */ - private function add_settings_subtab() { - add_filter( - 'github_updater_add_settings_subtabs', - function ( $subtabs ) { - return array_merge( $subtabs, [ 'gitlab' => esc_html__( 'GitLab', 'github-updater' ) ] ); - } - ); - } - - /** - * Print the GitLab Settings text. - */ - public function print_section_gitlab_info() { - esc_html_e( 'Enter your repository specific GitLab Access Token.', 'github-updater' ); - } - - /** - * Print the GitLab Access Token Settings text. - */ - public function print_section_gitlab_token() { - esc_html_e( 'Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token.', 'github-updater' ); - } - - /** - * Add remote install settings fields. - * - * @param string $type - */ - public function add_install_settings_fields( $type ) { - add_settings_field( - 'gitlab_access_token', - esc_html__( 'GitLab Access Token', 'github-updater' ), - [ $this, 'gitlab_access_token' ], - 'github_updater_install_' . $type, - $type - ); - } - - /** - * GitLab Access Token for remote install. - */ - public function gitlab_access_token() { - ?> - - get_class_vars( 'Settings', 'auth_required' ); - $error_code = $this->get_error_codes(); - - if ( ! isset( $error_code['gitlab'] ) && - ( ( empty( static::$options['gitlab_enterprise_token'] ) && - $auth_required['gitlab_enterprise'] ) || - ( empty( static::$options['gitlab_access_token'] ) && - $auth_required['gitlab'] ) ) - ) { - self::$error_code['gitlab'] = [ 'error' => true ]; - if ( ! \PAnD::is_admin_notice_active( 'gitlab-error-1' ) ) { - return; - } - ?> -
-

- -

-
- type = $type; - $this->response = $this->get_repo_cache(); - $branch = new Branch( $this->response ); - if ( ! empty( $type->branch ) ) { - $this->type->branch = ! empty( $branch->cache['current_branch'] ) - ? $branch->cache['current_branch'] - : $type->branch; - } - $this->set_default_credentials(); - $this->settings_hook( $this ); - $this->add_settings_subtab(); - $this->add_install_fields( $this ); - } - - /** - * Set default credentials if option not set. - */ - protected function set_default_credentials() { - $running_servers = Singleton::get_instance( 'Base', $this )->get_running_git_servers(); - $set_credentials = false; - if ( ! isset( static::$options['gitea_access_token'] ) ) { - static::$options['gitea_access_token'] = null; - $set_credentials = true; - } - if ( empty( static::$options['gitea_access_token'] ) && - in_array( 'gitea', $running_servers, true ) - ) { - $this->gitea_error_notices(); - } - - if ( $set_credentials ) { - add_site_option( 'github_updater', static::$options ); - } - } - - /** - * Read the remote file and parse headers. - * - * @param string $file Filename. - * - * @return bool - */ - public function get_remote_info( $file ) { - return $this->get_remote_api_info( 'gitea', $file, "/repos/:owner/:repo/raw/:branch/{$file}" ); - } - - /** - * Get remote info for tags. - * - * @return bool - */ - public function get_remote_tag() { - return $this->get_remote_api_tag( 'gitea', '/repos/:owner/:repo/releases' ); - } - - /** - * Read the remote CHANGES.md file. - * - * @param string $changes Changelog filename. - * - * @return mixed - */ - public function get_remote_changes( $changes ) { - return $this->get_remote_api_changes( 'gitea', $changes, "/repos/:owner/:repo/raw/:branch/{$changes}" ); - } - - /** - * Read and parse remote readme.txt. - * - * @return mixed - */ - public function get_remote_readme() { - return $this->get_remote_api_readme( 'gitea', '/repos/:owner/:repo/raw/:branch/readme.txt' ); - } - - /** - * Read the repository meta from API. - * - * @return mixed - */ - public function get_repo_meta() { - return $this->get_remote_api_repo_meta( 'gitea', '/repos/:owner/:repo' ); - } - - /** - * Create array of branches and download links as array. - * - * @return mixed - */ - public function get_remote_branches() { - return $this->get_remote_api_branches( 'gitea', '/repos/:owner/:repo/branches' ); - } - - /** - * Get Gitea release asset. - * - * @return false - */ - public function get_release_asset() { - // TODO: eventually figure this out. - return false; - } - - /** - * Construct $this->type->download_link using Gitea API. - * - * @param boolean $branch_switch for direct branch changing. - * - * @return string $endpoint - */ - public function construct_download_link( $branch_switch = false ) { - self::$method = 'download_link'; - $download_link_base = $this->get_api_url( '/repos/:owner/:repo/archive/', true ); - $endpoint = ''; - - /* - * If a branch has been given, use branch. - * If branch is master (default) and tags are used, use newest tag. - */ - if ( 'master' !== $this->type->branch || empty( $this->type->tags ) ) { - $endpoint .= $this->type->branch . '.zip'; - } else { - $endpoint .= $this->type->newest_tag . '.zip'; - } - - // Create endpoint for branch switching. - if ( $branch_switch ) { - $endpoint = $branch_switch . '.zip'; - } - - $endpoint = $this->add_access_token_endpoint( $this, $endpoint ); - $download_link = $download_link_base . $endpoint; - - /** - * Filter download link so developers can point to specific ZipFile - * to use as a download link during a branch switch. - * - * @since 8.8.0 - * - * @param string $download_link Download URL. - * @param /stdClass $this->type Repository object. - * @param string $branch_switch Branch or tag for rollback or branch switching. - */ - return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch ); - } - - /** - * Create Gitea API endpoints. - * - * @param Gitea_API|API $git - * @param string $endpoint - * - * @return string $endpoint - */ - public function add_endpoints( $git, $endpoint ) { - switch ( $git::$method ) { - case 'file': - case 'readme': - case 'meta': - case 'tags': - case 'changes': - case 'translation': - case 'download_link': - break; - case 'branches': - $endpoint = add_query_arg( 'per_page', '100', $endpoint ); - break; - default: - break; - } - - $endpoint = $this->add_access_token_endpoint( $git, $endpoint ); - - return $endpoint; - } - - /** - * Parse API response call and return only array of tag numbers. - * - * @param \stdClass|array $response Response from API call for tags. - * - * @return \stdClass|array Array of tag numbers, object is error. - */ - public function parse_tag_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - - $arr = []; - array_map( - function ( $e ) use ( &$arr ) { - $arr[] = $e->tag_name; - - return $arr; - }, - (array) $response - ); - - return $arr; - } - - /** - * Parse API response and return array of meta variables. - * - * @param \stdClass|array $response Response from API call. - * - * @return array $arr Array of meta variables. - */ - public function parse_meta_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $arr = []; - $response = [ $response ]; - - array_filter( - $response, - function ( $e ) use ( &$arr ) { - $arr['private'] = $e->private; - $arr['last_updated'] = $e->updated_at; - $arr['watchers'] = $e->watchers_count; - $arr['forks'] = $e->forks_count; - $arr['open_issues'] = isset( $e->open_issues_count ) ? $e->open_issues_count : 0; - } - ); - - return $arr; - } - - /** - * Parse API response and return array with changelog in base64. - * - * @param \stdClass|array $response Response from API call. - * - * @return array|\stdClass $arr Array of changes in base64, object if error. - */ - public function parse_changelog_response( $response ) { - } - - /** - * Parse API response and return array of branch data. - * - * @param \stdClass $response API response. - * - * @return array Array of branch data. - */ - public function parse_branch_response( $response ) { - if ( $this->validate_response( $response ) ) { - return $response; - } - $branches = []; - foreach ( $response as $branch ) { - $branches[ $branch->name ]['download'] = $this->construct_download_link( $branch->name ); - $branches[ $branch->name ]['commit_hash'] = $branch->commit->id; - $branches[ $branch->name ]['commit_timestamp'] = $branch->commit->timestamp; - } - return $branches; - } - - /** - * Parse tags and create download links. - * - * @param \stdClass|array $response Response from API call. - * @param array $repo_type - * - * @return array - */ - protected function parse_tags( $response, $repo_type ) { - $tags = []; - $rollback = []; - - foreach ( (array) $response as $tag ) { - $download_link = implode( - '/', - [ - $repo_type['base_uri'], - 'repos', - $this->type->owner, - $this->type->slug, - 'archive/', - ] - ); - $tags[] = $tag; - $rollback[ $tag ] = $download_link . $tag . '.zip'; - } - - return [ $tags, $rollback ]; - } - - /** - * Add settings for Gitea Access Token. - * - * @param array $auth_required - * - * @return void - */ - public function add_settings( $auth_required ) { - if ( $auth_required['gitea'] ) { - add_settings_section( - 'gitea_settings', - esc_html__( 'Gitea Access Token', 'github-updater' ), - [ $this, 'print_section_gitea_token' ], - 'github_updater_gitea_install_settings' - ); - } - - if ( $auth_required['gitea_private'] ) { - add_settings_section( - 'gitea_id', - esc_html__( 'Gitea Private Settings', 'github-updater' ), - [ $this, 'print_section_gitea_info' ], - 'github_updater_gitea_install_settings' - ); - } - - if ( $auth_required['gitea'] ) { - add_settings_field( - 'gitea_access_token', - esc_html__( 'Gitea Access Token', 'github-updater' ), - [ Singleton::get_instance( 'Settings', $this ), 'token_callback_text' ], - 'github_updater_gitea_install_settings', - 'gitea_settings', - [ - 'id' => 'gitea_access_token', - 'token' => true, - ] - ); - } - } - - /** - * Add values for individual repo add_setting_field(). - * - * @return mixed - */ - public function add_repo_setting_field() { - $setting_field['page'] = 'github_updater_gitea_install_settings'; - $setting_field['section'] = 'gitea_id'; - $setting_field['callback_method'] = [ - Singleton::get_instance( 'Settings', $this ), - 'token_callback_text', - ]; - - return $setting_field; - } - - /** - * Add subtab to Settings page. - */ - private function add_settings_subtab() { - add_filter( - 'github_updater_add_settings_subtabs', - function ( $subtabs ) { - return array_merge( $subtabs, [ 'gitea' => esc_html__( 'Gitea', 'github-updater' ) ] ); - } - ); - } - - /** - * Print the Gitea Settings text. - */ - public function print_section_gitea_info() { - esc_html_e( 'Enter your repository specific Gitea Access Token.', 'github-updater' ); - } - - /** - * Print the Gitea Access Token Settings text. - */ - public function print_section_gitea_token() { - esc_html_e( 'Enter your Gitea Access Token.', 'github-updater' ); - } - - /** - * Add remote install settings fields. - * - * @param string $type - */ - public function add_install_settings_fields( $type ) { - add_settings_field( - 'gitea_access_token', - esc_html__( 'Gitea Access Token', 'github-updater' ), - [ $this, 'gitea_access_token' ], - 'github_updater_install_' . $type, - $type - ); - } - - /** - * Gitea Access Token for remote install. - */ - public function gitea_access_token() { - ?> - - get_class_vars( 'Settings', 'auth_required' ); - $error_code = $this->get_error_codes(); - - if ( ! isset( $error_code['gitea'] ) && - empty( static::$options['gitea_access_token'] ) && - $auth_required['gitea'] - ) { - self::$error_code['gitea'] = [ 'error' => true ]; - if ( ! \PAnD::is_admin_notice_active( 'gitea-error-1' ) ) { - return; - } - ?> -
-

- -

-
- type = $type; - $this->response = $this->get_repo_cache(); - } - - /** - * Get/process Language Packs. - * - * @param array $headers Array of headers of Language Pack. - * - * @return bool When invalid response. - */ - public function get_language_pack( $headers ) { - $response = ! empty( $this->response['languages'] ) ? $this->response['languages'] : false; - - if ( ! $response ) { - $response = $this->get_language_pack_json( $this->type->git, $headers, $response ); - - if ( $response ) { - foreach ( $response as $locale ) { - $package = $this->process_language_pack_package( $this->type->git, $locale, $headers ); - - $response->{$locale->language}->package = $package; - $response->{$locale->language}->type = $this->type->type; - $response->{$locale->language}->version = $this->type->local_version; - } - - $this->set_repo_cache( 'languages', $response ); - } else { - return false; - } - } - - $this->type->language_packs = $response; - - return true; - } - - /** - * Get language-pack.json from appropriate host. - * - * @param string $git ( github|bitbucket|gitlab|gitea ). - * @param array $headers - * @param mixed $response API response. - * - * @return array|bool|mixed - */ - private function get_language_pack_json( $git, $headers, $response ) { - switch ( $git ) { - case 'github': - $response = $this->api( '/repos/' . $headers['owner'] . '/' . $headers['repo'] . '/contents/language-pack.json' ); - $response = isset( $response->content ) - ? json_decode( base64_decode( $response->content ) ) - : null; - break; - case 'bitbucket': - $response = $this->api( '/2.0/repositories/' . $headers['owner'] . '/' . $headers['repo'] . '/src/master/language-pack.json' ); - break; - case 'gitlab': - $id = rawurlencode( $headers['owner'] . '/' . $headers['repo'] ); - $response = $this->api( '/projects/' . $id . '/repository/files/language-pack.json' ); - $response = isset( $response->content ) - ? json_decode( base64_decode( $response->content ) ) - : null; - break; - case 'gitea': - $response = $this->api( '/repos/' . $headers['owner'] . '/' . $headers['repo'] . '/raw/master/language-pack.json' ); - $response = isset( $response->content ) - ? json_decode( base64_decode( $response->content ) ) - : null; - break; - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - return $response; - } - - /** - * Process $package for update transient. - * - * @param string $git ( github|bitbucket|gitlab|gitea ). - * @param string $locale - * @param array $headers - * - * @return array|null|string - */ - private function process_language_pack_package( $git, $locale, $headers ) { - $package = null; - switch ( $git ) { - case 'github': - $package = [ 'https://github.com', $headers['owner'], $headers['repo'], 'blob/master' ]; - $package = implode( '/', $package ) . $locale->package; - $package = add_query_arg( [ 'raw' => 'true' ], $package ); - break; - case 'bitbucket': - $package = [ 'https://bitbucket.org', $headers['owner'], $headers['repo'], 'raw/master' ]; - $package = implode( '/', $package ) . $locale->package; - break; - case 'gitlab': - $package = [ 'https://gitlab.com', $headers['owner'], $headers['repo'], 'raw/master' ]; - $package = implode( '/', $package ) . $locale->package; - break; - case 'gitea': - // TODO: make sure this works as expected. - $package = [ $headers['uri'], 'raw/master' ]; - $package = implode( '/', $package ) . $local->package; - break; - } - - return $package; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/API/Zipfile_API.php b/wp-content/plugins/github-updater/src/GitHub_Updater/API/Zipfile_API.php deleted file mode 100644 index c48fe7d..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/API/Zipfile_API.php +++ /dev/null @@ -1,73 +0,0 @@ - - - 'GitHub' ]; - - /** - * Holds extra repo header types. - * - * @var array - */ - protected static $extra_repo_headers = [ - 'Languages' => 'Languages', - 'CIJob' => 'CI Job', - ]; - - /** - * Holds an array of installed git APIs. - * - * @var array - */ - public static $installed_apis = [ 'github_api' => true ]; - - /** - * Stores the object calling Basic_Auth_Loader. - * - * @access public - * @var \stdClass - */ - public $caller; - - /** - * Store details of all repositories that are installed. - * - * @var \stdClass - */ - protected $config; - - /** - * Constructor. - */ - public function __construct() { - $this->set_installed_apis(); - } - - /** - * Set boolean for installed API classes. - */ - protected function set_installed_apis() { - if ( file_exists( __DIR__ . '/API/Bitbucket_API.php' ) ) { - self::$installed_apis['bitbucket_api'] = true; - self::$git_servers['bitbucket'] = 'Bitbucket'; - } else { - self::$installed_apis['bitbucket_api'] = false; - } - - self::$installed_apis['bitbucket_server_api'] = file_exists( __DIR__ . '/API/Bitbucket_Server_API.php' ); - - if ( file_exists( __DIR__ . '/API/GitLab_API.php' ) ) { - self::$installed_apis['gitlab_api'] = true; - self::$git_servers['gitlab'] = 'GitLab'; - } else { - self::$installed_apis['gitlab_api'] = false; - } - if ( file_exists( __DIR__ . '/API/Gitea_API.php' ) ) { - self::$installed_apis['gitea_api'] = true; - self::$git_servers['gitea'] = 'Gitea'; - } else { - self::$installed_apis['gitea_api'] = false; - } - if ( file_exists( __DIR__ . '/API/Zipfile_API.php' ) ) { - self::$installed_apis['zipfile_api'] = true; - self::$git_servers['zipfile'] = 'Zipfile'; - } else { - self::$installed_apis['zipfile_api'] = false; - } - } - - /** - * Load Plugin, Theme, and Settings with correct capabiltiies and on selective admin pages. - * - * @return bool - */ - public function load() { - if ( ! apply_filters( 'github_updater_hide_settings', false ) ) { - Singleton::get_instance( 'Settings', $this )->run(); - } - if ( ! Singleton::get_instance( 'Init', $this )->can_update() ) { - return false; - } - - // Run GitHub Updater upgrade functions. - $upgrade = new GHU_Upgrade(); - $upgrade->run(); - - // Load plugin stylesheet. - add_action( - 'admin_enqueue_scripts', - function () { - wp_register_style( 'github-updater', plugins_url( basename( GITHUB_UPDATER_DIR ) ) . '/css/github-updater.css' ); - wp_enqueue_style( 'github-updater' ); - } - ); - - if ( isset( $_POST['ghu_refresh_cache'] ) ) { - /** - * Fires later in cycle when Refreshing Cache. - * - * @since 6.0.0 - */ - do_action( 'ghu_refresh_transients' ); - } - - $this->get_meta_plugins(); - $this->get_meta_themes(); - - return true; - } - - /** - * Performs actual plugin metadata fetching. - */ - public function get_meta_plugins() { - if ( Singleton::get_instance( 'Init', $this )->can_update() ) { - Singleton::get_instance( 'Plugin', $this )->get_remote_plugin_meta(); - } - } - - /** - * Performs actual theme metadata fetching. - */ - public function get_meta_themes() { - if ( Singleton::get_instance( 'Init', $this )->can_update() ) { - Singleton::get_instance( 'Theme', $this )->get_remote_theme_meta(); - } - } - - /** - * AJAX endpoint for REST updates. - */ - public function ajax_update() { - Singleton::get_instance( 'Rest_Update', $this )->process_request(); - } - - /** - * Run background processes. - * Piggyback on built-in update function to get metadata. - * Set update transients for remote management. - */ - public function background_update() { - add_action( 'wp_update_plugins', [ $this, 'get_meta_plugins' ] ); - add_action( 'wp_update_themes', [ $this, 'get_meta_themes' ] ); - add_action( 'ghu_get_remote_plugin', [ $this, 'run_cron_batch' ], 10, 1 ); - add_action( 'ghu_get_remote_theme', [ $this, 'run_cron_batch' ], 10, 1 ); - add_action( 'wp_ajax_nopriv_ithemes_sync_request', [ $this, 'get_meta_remote_management' ] ); - add_action( 'update_option_auto_updater.lock', [ $this, 'get_meta_remote_management' ] ); - ( new Remote_Management() )->set_update_transients(); - } - - /** - * Calls $this->get_meta_plugins() and $this->get_meta_themes() - * for remote management services. - */ - public function get_meta_remote_management() { - $this->get_meta_plugins(); - $this->get_meta_themes(); - } - - /** - * Allows developers to use 'github_updater_set_options' hook to set access tokens or other settings. - * Saves results of filter hook to self::$options. - * Single plugin/theme should not be using both hooks. - * - * Hook requires return of associative element array. - * $key === repo-name and $value === token - * e.g. array( 'repo-name' => 'access_token' ); - */ - public function set_options_filter() { - $config = apply_filters( 'github_updater_set_options', [] ); - if ( empty( $config ) ) { - $config = function_exists( 'apply_filters_deprecated' ) - ? apply_filters_deprecated( 'github_updater_token_distribution', [ null ], '6.1.0', 'github_updater_set_options' ) - : apply_filters( 'github_updater_token_distribution', [] ); - } - - if ( ! empty( $config ) ) { - $config = $this->sanitize( $config ); - self::$options = array_merge( get_site_option( 'github_updater' ), $config ); - update_site_option( 'github_updater', self::$options ); - } - } - - /** - * Add extra headers to get_plugins() or wp_get_themes(). - * - * @param array $extra_headers - * - * @return array - */ - public function add_headers( $extra_headers ) { - $ghu_extra_headers = [ - 'RequiresWP' => 'Requires WP', - 'RequiresPHP' => 'Requires PHP', - 'ReleaseAsset' => 'Release Asset', - ]; - - $uri_types = [ - 'PluginURI' => ' Plugin URI', - 'ThemeURI' => ' Theme URI', - ]; - - foreach ( self::$git_servers as $server ) { - foreach ( $uri_types as $uri_key => $uri_value ) { - $ghu_extra_headers[ $server . $uri_key ] = $server . $uri_value; - } - foreach ( self::$extra_repo_headers as $header_key => $header_value ) { - $ghu_extra_headers[ $server . $header_key ] = $server . ' ' . $header_value; - } - } - - self::$extra_headers = array_unique( array_merge( self::$extra_headers, $ghu_extra_headers ) ); - $extra_headers = array_merge( (array) $extra_headers, $ghu_extra_headers ); - ksort( self::$extra_headers ); - - return $extra_headers; - } - - /** - * Runs on wp-cron job to get remote repo meta in background. - * - * @param array $batches - */ - public function run_cron_batch( array $batches ) { - foreach ( $batches as $repo ) { - $this->get_remote_repo_meta( $repo ); - } - } - - /** - * Get remote repo meta data for plugins or themes. - * Calls remote APIs for data. - * - * @param \stdClass $repo - * - * @return bool - */ - public function get_remote_repo_meta( $repo ) { - $file = 'style.css'; - if ( false !== stripos( $repo->type, 'plugin' ) ) { - $file = basename( $repo->file ); - } - - $repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $repo->git, $repo ); - if ( null === $repo_api ) { - return false; - } - - $this->{$repo->type} = $repo; - $this->set_defaults( $repo->type ); - - if ( $repo_api->get_remote_info( $file ) ) { - if ( ! self::is_wp_cli() ) { - if ( ! apply_filters( 'github_updater_run_at_scale', false ) ) { - $repo_api->get_repo_meta(); - $changelog = $this->get_changelog_filename( $repo ); - if ( $changelog ) { - $repo_api->get_remote_changes( $changelog ); - } - $repo_api->get_remote_readme(); - } - if ( ! empty( self::$options['branch_switch'] ) ) { - $repo_api->get_remote_branches(); - } - } - $repo_api->get_remote_tag(); - $repo->download_link = $repo_api->construct_download_link(); - $language_pack = new Language_Pack( $repo, new Language_Pack_API( $repo ) ); - $language_pack->run(); - } - - $this->remove_hooks(); - - return true; - } - - /** - * Set default values for plugin/theme. - * - * @param string $type - */ - protected function set_defaults( $type ) { - if ( ! isset( self::$options['branch_switch'] ) ) { - self::$options['branch_switch'] = null; - } - - if ( ! isset( $this->$type->slug ) ) { - $this->$type = new \stdClass(); - $this->$type->slug = null; - } elseif ( ! isset( self::$options[ $this->$type->slug ] ) ) { - self::$options[ $this->$type->slug ] = null; - add_site_option( 'github_updater', self::$options ); - } - - $this->$type->remote_version = '0.0.0'; - $this->$type->newest_tag = '0.0.0'; - $this->$type->download_link = null; - $this->$type->tags = []; - $this->$type->rollback = []; - $this->$type->branches = []; - $this->$type->requires = null; - $this->$type->tested = null; - $this->$type->donate_link = null; - $this->$type->contributors = []; - $this->$type->downloaded = 0; - $this->$type->last_updated = null; - $this->$type->rating = 0; - $this->$type->num_ratings = 0; - $this->$type->transient = []; - $this->$type->repo_meta = []; - $this->$type->watchers = 0; - $this->$type->forks = 0; - $this->$type->open_issues = 0; - $this->$type->requires = false; - $this->$type->requires_php = false; - } - - /** - * Get filename of changelog and return. - * - * @param \stdClass $repo - * - * @return bool|string - */ - protected function get_changelog_filename( $repo ) { - $changelogs = [ 'CHANGES.md', 'CHANGELOG.md', 'changes.md', 'changelog.md' ]; - $changes = null; - $local_files = null; - - if ( is_dir( $repo->local_path ) ) { - $local_files = scandir( $repo->local_path, 0 ); - } - - $changes = array_intersect( (array) $local_files, $changelogs ); - $changes = array_pop( $changes ); - - if ( ! empty( $changes ) ) { - return $changes; - } - - return false; - } - - /** - * Remove hooks after use. - */ - public function remove_hooks() { - remove_filter( 'extra_theme_headers', [ $this, 'add_headers' ] ); - remove_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] ); - } - - /** - * Checks if dupicate wp-cron event exists. - * - * @param string $event Name of wp-cron event. - * - * @return bool - */ - public function is_duplicate_wp_cron_event( $event ) { - $cron = _get_cron_array(); - foreach ( $cron as $timestamp => $cronhooks ) { - if ( key( $cronhooks ) === $event ) { - $this->is_cron_overdue( $cron, $timestamp ); - - return true; - } - } - - return false; - } - - /** - * Check to see if wp-cron event is overdue by 24 hours and report error message. - * - * @param array $cron - * @param int $timestamp - */ - public function is_cron_overdue( $cron, $timestamp ) { - $overdue = ( ( time() - $timestamp ) / HOUR_IN_SECONDS ) > 24; - if ( $overdue ) { - $error_msg = esc_html__( 'There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue.', 'github-updater' ); - $error = new \WP_Error( 'github_updater_cron_error', $error_msg ); - Singleton::get_instance( 'Messages', $this )->create_error_message( $error ); - } - } - - /** - * Used for renaming of sources to ensure correct directory name. - * - * @since WordPress 4.4.0 The $hook_extra parameter became available. - * - * @param string $source - * @param string $remote_source - * @param \Plugin_Upgrader|\Theme_Upgrader $upgrader - * @param array $hook_extra - * - * @return string - */ - public function upgrader_source_selection( $source, $remote_source, $upgrader, $hook_extra = null ) { - global $wp_filesystem; - $slug = null; - $repo = null; - $new_source = null; - $upgrader_object = null; - - /* - * Rename plugins. - */ - if ( $upgrader instanceof \Plugin_Upgrader ) { - $upgrader_object = Singleton::get_instance( 'Plugin', $this ); - if ( isset( $hook_extra['plugin'] ) ) { - $slug = dirname( $hook_extra['plugin'] ); - $new_source = trailingslashit( $remote_source ) . $slug; - } - } - - /* - * Rename themes. - */ - if ( $upgrader instanceof \Theme_Upgrader ) { - $upgrader_object = Singleton::get_instance( 'Theme', $this ); - if ( isset( $hook_extra['theme'] ) ) { - $slug = $hook_extra['theme']; - $new_source = trailingslashit( $remote_source ) . $slug; - } - } - - $repo = $this->get_repo_slugs( $slug, $upgrader_object ); - - /* - * Not GitHub Updater plugin/theme. - */ - if ( ! isset( $_POST['github_updater_repo'] ) && empty( $repo ) ) { - return $source; - } - - /* - * Remote install source. - */ - $install_options = $this->get_class_vars( 'Install', 'install' ); - if ( empty( $repo ) && isset( $install_options['github_updater_install_repo'] ) ) { - $slug = $install_options['github_updater_install_repo']; - $new_source = trailingslashit( $remote_source ) . $slug; - self::$options['remote_install'] = true; - } - - Singleton::get_instance( 'Branch', $this )->set_branch_on_switch( $slug ); - - $new_source = $this->fix_misnamed_directory( $new_source, $remote_source, $upgrader_object, $slug ); - $new_source = $this->fix_release_asset_directory( $new_source, $remote_source, $upgrader_object, $slug ); - - $wp_filesystem->move( $source, $new_source ); - - return trailingslashit( $new_source ); - } - - /** - * Correctly rename an initially misnamed directory. - * This usually occurs when initial installation not using GitHub Updater. - * May cause plugin/theme deactivation. - * - * @param string $new_source - * @param string $remote_source - * @param Plugin|Theme $upgrader_object - * @param string $slug - * - * @return string $new_source - */ - private function fix_misnamed_directory( $new_source, $remote_source, $upgrader_object, $slug ) { - if ( ! array_key_exists( $slug, (array) $upgrader_object->config ) && - ! isset( self::$options['remote_install'] ) - ) { - if ( $upgrader_object instanceof Plugin ) { - foreach ( (array) $upgrader_object->config as $plugin ) { - if ( $slug === $plugin->slug ) { - $new_source = trailingslashit( $remote_source ) . $slug; - break; - } - } - } - if ( $upgrader_object instanceof Theme ) { - foreach ( (array) $upgrader_object->config as $theme ) { - if ( $slug === $theme->slug ) { - $new_source = trailingslashit( $remote_source ) . $slug; - break; - } - } - } - } - - return $new_source; - } - - /** - * Fix the directory structure of certain release assests. - * - * GitLab release assets have a different download directory structure. - * Bitbucket release assets need to be copied into a containing directory. - * - * @param string $new_source - * @param string $remote_source - * @param Plugin|Theme $upgrader_object - * @param string $slug - * - * @return string $new_source - */ - private function fix_release_asset_directory( $new_source, $remote_source, $upgrader_object, $slug ) { - global $wp_filesystem; - if ( isset( $upgrader_object->config[ $slug ]->release_asset ) && - $upgrader_object->config[ $slug ]->release_asset ) { - if ( 'gitlab' === $upgrader_object->config[ $slug ]->git ) { - $new_source = trailingslashit( dirname( $remote_source ) ) . $slug; - add_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ], 10, 3 ); - } - if ( 'bitbucket' === $upgrader_object->config[ $slug ]->git ) { - $temp_source = trailingslashit( dirname( $remote_source ) ) . $slug; - $wp_filesystem->move( $remote_source, $temp_source ); - wp_mkdir_p( $new_source ); - copy_dir( $temp_source, $new_source ); - $wp_filesystem->delete( $temp_source, true ); - } - } - - return $new_source; - } - - /** - * Delete $source when updating from GitLab Release Asset. - * - * @param bool $true - * @param array $hook_extra - * @param array $result - * - * @return mixed - */ - public function upgrader_post_install( $true, $hook_extra, $result ) { - global $wp_filesystem; - - $wp_filesystem->delete( $result['source'], true ); - remove_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ] ); - - return $result; - } - - /** - * Set array with normal repo names. - * Fix name even if installed without renaming originally, eg -master - * - * @param string $slug - * @param Base|Plugin|Theme $upgrader_object - * - * @return array - */ - protected function get_repo_slugs( $slug, $upgrader_object = null ) { - $arr = []; - $rename = explode( '-', $slug ); - array_pop( $rename ); - $rename = implode( '-', $rename ); - - if ( null === $upgrader_object ) { - $upgrader_object = $this; - } - - $rename = isset( $upgrader_object->config[ $slug ] ) ? $slug : $rename; - - foreach ( (array) $upgrader_object->config as $repo ) { - // Check repo slug or directory name for match. - $slug_check = [ - $repo->slug, - dirname( $repo->file ), - ]; - - // Exact match. - if ( \in_array( $slug, $slug_check, true ) ) { - $arr['slug'] = $repo->slug; - break; - } - - // Soft match, there may still be an exact $slug match. - if ( \in_array( $rename, $slug_check, true ) ) { - $arr['slug'] = $repo->slug; - } - } - - return $arr; - } - - /** - * Update transient for rollback or branch switch. - * - * @param string $type plugin|theme. - * @param \stdClass $repo - * @param bool $set_transient Default false, if true then set update transient. - * - * @return array $rollback Rollback transient. - */ - protected function set_rollback_transient( $type, $repo, $set_transient = false ) { - $repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $repo->git, $repo ); - $this->tag = isset( $_GET['rollback'] ) ? $_GET['rollback'] : false; - $slug = 'plugin' === $type ? $repo->file : $repo->slug; - $download_link = $repo_api->construct_download_link( $this->tag ); - - /** - * Filter download link so developers can point to specific ZipFile - * to use as a download link during a branch switch. - * - * @since 8.6.0 - * - * @param string $download_link Download URL. - * @param /stdClass $repo - * @param string $this->tag Branch or tag for rollback. - */ - $download_link = apply_filters_deprecated( - 'github_updater_set_rollback_package', - [ $download_link, $repo, $this->tag ], - '8.8.0', - 'github_updater_post_construct_download_link' - ); - - $rollback = [ - $type => $slug, - 'new_version' => $this->tag, - 'url' => $repo->uri, - 'package' => $download_link, - 'branch' => $repo->branch, - 'branches' => $repo->branches, - 'type' => $repo->type, - ]; - - if ( 'plugin' === $type ) { - $rollback['slug'] = $repo->slug; - $rollback = (object) $rollback; - } - - return $rollback; - } - - /** - * Check to see if wp-cron/background updating has finished. - * - * @param null $repo - * - * @return bool true when waiting for background job to finish. - */ - protected function waiting_for_background_update( $repo = null ) { - $caches = []; - if ( null !== $repo ) { - $cache = isset( $repo->slug ) ? $this->get_repo_cache( $repo->slug ) : null; - - return empty( $cache ); - } - $repos = array_merge( - Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(), - Singleton::get_instance( 'Theme', $this )->get_theme_configs() - ); - foreach ( $repos as $git_repo ) { - $caches[ $git_repo->slug ] = $this->get_repo_cache( $git_repo->slug ); - } - $waiting = array_filter( - $caches, - function ( $e ) { - return empty( $e ); - } - ); - - return ! empty( $waiting ); - } - - /** - * Create repo parts. - * - * @param string $repo - * @param string $type plugin|theme. - * - * @return mixed - */ - protected function get_repo_parts( $repo, $type ) { - $arr['bool'] = false; - $pattern = '/' . strtolower( $repo ) . '_/'; - $type = preg_replace( $pattern, '', $type ); - $repo_types = [ - 'GitHub' => 'github_' . $type, - 'Bitbucket' => 'bitbucket_' . $type, - 'GitLab' => 'gitlab_' . $type, - 'Gitea' => 'gitea_' . $type, - ]; - $repo_base_uris = [ - 'GitHub' => 'https://github.com/', - 'Bitbucket' => 'https://bitbucket.org/', - 'GitLab' => 'https://gitlab.com/', - 'Gitea' => '', - ]; - - if ( array_key_exists( $repo, $repo_types ) ) { - $arr['type'] = $repo_types[ $repo ]; - $arr['git_server'] = strtolower( $repo ); - $arr['base_uri'] = $repo_base_uris[ $repo ]; - $arr['bool'] = true; - foreach ( self::$extra_repo_headers as $key => $value ) { - $arr[ $key ] = $repo . ' ' . $value; - } - } - - return $arr; - } - - /** - * Return correct update row opening and closing tags for Shiny Updates. - * - * @param string $repo_name - * @param string $type plugin|theme. - * @param bool $branch_switcher - * - * @return array - */ - protected function update_row_enclosure( $repo_name, $type, $branch_switcher = false ) { - global $wp_version; - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); - $repo_base = $repo_name; - $shiny_classes = ' notice inline notice-warning notice-alt'; - - if ( 'plugin' === $type ) { - $repo_base = dirname( $repo_name ); - } - - $open = ' - -
'; - - $enclosure = [ - 'open' => $open, - 'close' => '
', - ]; - - if ( version_compare( $wp_version, '4.6', '>=' ) ) { - $open_p = '

'; - $close_p = '

'; - if ( $branch_switcher ) { - $open_p = ''; - $close_p = ''; - } - $enclosure = [ - 'open' => substr_replace( $open, $shiny_classes, -2, 0 ) . $open_p, - 'close' => $close_p . '', - ]; - } - - return $enclosure; - } - - /** - * Make branch switch row. - * - * @param array $data Parameters for creating branch switching row. - * - * @return void - */ - protected function make_branch_switch_row( $data ) { - $rollback = empty( $this->config[ $data['slug'] ]->rollback ) ? [] : $this->config[ $data['slug'] ]->rollback; - - printf( - /* translators: 1: branch name, 2: jQuery dropdown, 3: closing tag */ - esc_html__( 'Current branch is `%1$s`, try %2$sanother version%3$s', 'github-updater' ), - $data['branch'], - '', - '.' - ); - - print ''; - } - - /** - * Generate update URL. - * - * @param string $type ( plugin or theme ). - * @param string $action - * @param string $repo_name - * - * @return string - */ - protected function get_update_url( $type, $action, $repo_name ) { - $update_url = esc_attr( - add_query_arg( - [ - 'action' => $action, - $type => rawurlencode( $repo_name ), - ], - self_admin_url( 'update.php' ) - ) - ); - - return $update_url; - } - - /** - * Parse Enterprise, Languages, Release Asset, and CI Job headers for plugins and themes. - * - * @param array $header - * @param array|\WP_Theme $headers - * @param array $header_parts - * @param array $repo_parts - * - * @return array $header - */ - protected function parse_extra_headers( $header, $headers, $header_parts, $repo_parts ) { - $hosted_domains = [ 'github.com', 'bitbucket.org', 'gitlab.com' ]; - $theme = null; - - $header['enterprise_uri'] = null; - $header['enterprise_api'] = null; - $header['languages'] = null; - $header['ci_job'] = false; - $header['release_asset'] = false; - - if ( ! empty( $header['host'] ) && ! in_array( $header['host'], $hosted_domains, true ) ) { - $header['enterprise_uri'] = $header['base_uri']; - $header['enterprise_api'] = trim( $header['enterprise_uri'], '/' ); - switch ( $header_parts[0] ) { - case 'GitHub': - $header['enterprise_api'] .= '/api/v3'; - break; - case 'GitLab': - $header['enterprise_api'] .= '/api/v4'; - break; - case 'Bitbucket': - $header['enterprise_api'] .= '/rest/api'; - break; - } - } - - if ( $headers instanceof \WP_Theme ) { - $theme = $headers; - $headers = []; - $headers['Release Asset'] = ''; - $header['release_asset'] = 'true' === $theme->get( 'Release Asset' ); - } - - $self_hosted_parts = array_keys( self::$extra_repo_headers ); - foreach ( $self_hosted_parts as $part ) { - if ( $theme instanceof \WP_Theme ) { - $headers[ $repo_parts[ $part ] ] = $theme->get( $repo_parts[ $part ] ); - } - if ( array_key_exists( $repo_parts[ $part ], $headers ) && - ! empty( $headers[ $repo_parts[ $part ] ] ) - ) { - switch ( $part ) { - case 'Languages': - $header['languages'] = $headers[ $repo_parts[ $part ] ]; - break; - case 'CIJob': - $header['ci_job'] = $headers[ $repo_parts[ $part ] ]; - break; - } - } - } - $header['release_asset'] = ! $header['release_asset'] && isset( $headers['Release Asset'] ) ? 'true' === $headers['Release Asset'] : $header['release_asset']; - - return $header; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Bootstrap.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Bootstrap.php deleted file mode 100644 index 34fd045..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Bootstrap.php +++ /dev/null @@ -1,77 +0,0 @@ -file = $file; - $this->dir = dirname( $file ); - } - - /** - * Run the bootstrap. - * - * @return void - */ - public function run() { - add_action( - 'init', - function() { - load_plugin_textdomain( 'github-updater' ); - } - ); - - define( 'GITHUB_UPDATER_DIR', $this->dir ); - - // Load Autoloader. - require_once $this->dir . '/vendor/autoload.php'; - - register_activation_hook( $this->file, array( new Init(), 'rename_on_activation' ) ); - ( new Init() )->run(); - - /** - * Initialize Persist Admin notices Dismissal. - * - * @link https://github.com/collizo4sky/persist-admin-notices-dismissal - */ - add_action( 'admin_init', array( 'PAnD', 'init' ) ); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Branch.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Branch.php deleted file mode 100644 index ba737e2..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Branch.php +++ /dev/null @@ -1,108 +0,0 @@ -cache = $cache; - $this->load_options(); - self::$options = $this->get_class_vars( 'Base', 'options' ); - } - - /** - * Get the current repo branch. - * - * @access public - * - * @param \stdClass $repo - * - * @return mixed - */ - public function get_current_branch( $repo ) { - $current_branch = ! empty( $this->cache['current_branch'] ) - ? $this->cache['current_branch'] - : $repo->branch; - - return $current_branch; - } - - /** - * Set current branch on branch switch. - * - * @access public - * - * @param string $repo Repository slug. - */ - public function set_branch_on_switch( $repo ) { - $this->cache = $this->get_repo_cache( $repo ); - - if ( isset( $_GET['action'], $_GET['rollback'], $this->cache['branches'] ) && - ( 'upgrade-plugin' === $_GET['action'] || 'upgrade-theme' === $_GET['action'] ) - ) { - $current_branch = array_key_exists( $_GET['rollback'], $this->cache['branches'] ) - ? $_GET['rollback'] - : 'master'; - - $this->set_repo_cache( 'current_branch', $current_branch, $repo ); - self::$options[ 'current_branch_' . $repo ] = $current_branch; - update_site_option( 'github_updater', self::$options ); - } - } - - /** - * Set current branch on install and update options. - * - * @access public - * - * @param array $install Array of install data. - */ - public function set_branch_on_install( $install ) { - $this->set_repo_cache( 'current_branch', $install['github_updater_branch'], $install['repo'] ); - self::$options[ 'current_branch_' . $install['repo'] ] = $install['github_updater_branch']; - update_site_option( 'github_updater', self::$options ); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/GHU_Upgrade.php b/wp-content/plugins/github-updater/src/GitHub_Updater/GHU_Upgrade.php deleted file mode 100644 index 8aecf0e..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/GHU_Upgrade.php +++ /dev/null @@ -1,65 +0,0 @@ -get_class_vars( 'Base', 'options' ); - $db_version = isset( $options['db_version'] ) ? (int) $options['db_version'] : 6000; - - if ( $db_version === $this->db_version ) { - return; - } - - switch ( $db_version ) { - case $db_version < $this->db_version: - $this->delete_flush_cache(); - break; - default: - break; - } - - $options = array_merge( (array) $options, [ 'db_version' => (int) $this->db_version ] ); - update_site_option( 'github_updater', $options ); - } - - /** - * Flush caches and delete cached options. - */ - private function delete_flush_cache() { - wp_cache_flush(); - $this->delete_all_cached_data(); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Init.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Init.php deleted file mode 100644 index a743439..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Init.php +++ /dev/null @@ -1,151 +0,0 @@ -load_options(); - } - - /** - * Rename on activation. - * - * Correctly renames the slug when GitHub Updater is installed - * via FTP or from plugin upload. - * - * Set current branch to `develop` if appropriate. - * - * `rename()` causes activation to fail. - * - * @return void - */ - public function rename_on_activation() { - $plugin_dir = trailingslashit( WP_PLUGIN_DIR ); - $slug = isset( $_GET['plugin'] ) ? $_GET['plugin'] : false; - $exploded = explode( '-', dirname( $slug ) ); - - if ( in_array( 'develop', $exploded, true ) ) { - $options = $this->get_class_vars( 'Base', 'options' ); - update_site_option( 'github_updater', array_merge( $options, [ 'current_branch_github-updater' => 'develop' ] ) ); - } - - if ( $slug && 'github-updater/github-updater.php' !== $slug ) { - @rename( $plugin_dir . dirname( $slug ), $plugin_dir . 'github-updater' ); - } - } - - /** - * Let's get going. - */ - public function run() { - if ( ! static::is_heartbeat() ) { - $this->load_hooks(); - } - - if ( static::is_wp_cli() ) { - include_once __DIR__ . '/WP_CLI/CLI.php'; - include_once __DIR__ . '/WP_CLI/CLI_Integration.php'; - } - } - - /** - * Load relevant action/filter hooks. - * Use 'init' hook for user capabilities. - */ - protected function load_hooks() { - add_action( 'init', [ $this, 'load' ] ); - add_action( 'init', [ $this, 'background_update' ] ); - add_action( 'init', [ $this, 'set_options_filter' ] ); - add_action( 'wp_ajax_github-updater-update', [ $this, 'ajax_update' ] ); - add_action( 'wp_ajax_nopriv_github-updater-update', [ $this, 'ajax_update' ] ); - - // Load hook for shiny updates Basic Authentication headers. - if ( self::is_doing_ajax() ) { - $this->load_authentication_hooks(); - } - - add_filter( 'extra_theme_headers', [ $this, 'add_headers' ] ); - add_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] ); - add_filter( 'upgrader_source_selection', [ $this, 'upgrader_source_selection' ], 10, 4 ); - - // Needed for updating from update-core.php. - if ( ! self::is_doing_ajax() ) { - add_filter( 'upgrader_pre_download', [ $this, 'upgrader_pre_download' ], 10, 3 ); - } - } - - /** - * Checks current user capabilities and admin pages. - * - * @return bool - */ - public function can_update() { - global $pagenow; - - // WP-CLI access has full capabilities. - if ( static::is_wp_cli() ) { - return true; - } - - $can_user_update = current_user_can( 'update_plugins' ) && current_user_can( 'update_themes' ); - $this->load_options(); - - $admin_pages = [ - 'plugins.php', - 'plugin-install.php', - 'themes.php', - 'theme-install.php', - 'update-core.php', - 'update.php', - 'options-general.php', - 'options.php', - 'settings.php', - 'edit.php', - ]; - - // Needed for sequential shiny updating. - if ( isset( $_POST['action'] ) && in_array( $_POST['action'], [ 'update-plugin', 'update-theme' ], true ) ) { - $admin_pages[] = 'admin-ajax.php'; - } - - /** - * Filter $admin_pages to be able to adjust the pages where GitHub Updater runs. - * - * @since 8.0.0 - * - * @param array $admin_pages Default array of admin pages where GitHub Updater runs. - */ - $admin_pages = array_unique( apply_filters( 'github_updater_add_admin_pages', $admin_pages ) ); - - return $can_user_update && in_array( $pagenow, $admin_pages, true ); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Install.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Install.php deleted file mode 100644 index 269c415..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Install.php +++ /dev/null @@ -1,560 +0,0 @@ -/ directly from GitHub Updater. - */ -class Install { - use GHU_Trait, Basic_Auth_Loader; - - /** - * Class options. - * - * @var array - */ - protected static $install = []; - - /** - * Hold local copy of GitHub Updater options. - * - * @var mixed - */ - private static $options; - - /** - * Hold local copy of installed APIs. - * - * @var mixed - */ - private static $installed_apis; - - /** - * Hold local copy of git servers. - * - * @var mixed - */ - private static $git_servers; - - /** - * Constructor. - */ - public function __construct() { - self::$options = $this->get_class_vars( 'Base', 'options' ); - self::$installed_apis = $this->get_class_vars( 'Base', 'installed_apis' ); - self::$git_servers = $this->get_class_vars( 'Base', 'git_servers' ); - } - - /** - * Let's set up the Install tabs. - * Need class-wp-upgrader.php for upgrade classes. - * - * @return void - */ - public function run() { - $this->load_js(); - $this->add_settings_tabs(); - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; - } - - /** - * Load javascript for Install. - * - * @return void - */ - public function load_js() { - add_action( - 'admin_enqueue_scripts', - function () { - wp_register_script( 'ghu-install', plugins_url( basename( GITHUB_UPDATER_DIR ) . '/js/ghu-install-vanilla.js' ), [], false, true ); - wp_enqueue_script( 'ghu-install' ); - } - ); - } - - /** - * Adds Install tabs to Settings page. - */ - public function add_settings_tabs() { - $install_tabs = []; - if ( current_user_can( 'install_plugins' ) ) { - $install_tabs['github_updater_install_plugin'] = esc_html__( 'Install Plugin', 'github-updater' ); - } - if ( current_user_can( 'install_themes' ) ) { - $install_tabs['github_updater_install_theme'] = esc_html__( 'Install Theme', 'github-updater' ); - } - add_filter( - 'github_updater_add_settings_tabs', - function ( $tabs ) use ( $install_tabs ) { - return array_merge( $tabs, $install_tabs ); - } - ); - add_action( - 'github_updater_add_admin_page', - function ( $tab ) { - $this->add_admin_page( $tab ); - } - ); - } - - /** - * Add Settings page data via action hook. - * - * @uses 'github_updater_add_admin_page' action hook - * - * @param string $tab Name of tab. - */ - public function add_admin_page( $tab ) { - if ( 'github_updater_install_plugin' === $tab ) { - $this->install( 'plugin' ); - $this->create_form( 'plugin' ); - } - if ( 'github_updater_install_theme' === $tab ) { - $this->install( 'theme' ); - $this->create_form( 'theme' ); - } - } - - /** - * Install remote plugin or theme. - * - * @param string $type - * @param array $config - * - * @return bool - */ - public function install( $type, $config = null ) { - $this->set_install_post_data( $config ); - - if ( isset( $_POST['option_page'] ) && 'github_updater_install' === $_POST['option_page'] ) { - if ( empty( $_POST['github_updater_branch'] ) ) { - $_POST['github_updater_branch'] = 'master'; - } - - // Exit early if no repo entered. - if ( empty( $_POST['github_updater_repo'] ) ) { - echo '

'; - esc_html_e( 'A repository URI is required.', 'github-updater' ); - echo '

'; - - return false; - } - - // Transform URI to owner/repo. - $headers = $this->parse_header_uri( $_POST['github_updater_repo'] ); - $_POST['github_updater_repo'] = $headers['owner_repo']; - - self::$install = $this->sanitize( $_POST ); - self::$install['repo'] = self::$install['github_updater_install_repo'] = $headers['repo']; - - /* - * Create GitHub endpoint. - * Save Access Token if present. - * Check for GitHub Self-Hosted. - */ - if ( 'github' === self::$install['github_updater_api'] ) { - self::$install = Singleton::get_instance( 'API\GitHub_API', $this, new \stdClass() )->remote_install( $headers, self::$install ); - } - - /* - * Create Bitbucket endpoint and instantiate class Bitbucket_API. - * Save private setting if present. - * Ensures `maybe_authenticate_http()` is available. - */ - if ( 'bitbucket' === self::$install['github_updater_api'] ) { - $this->load_authentication_hooks(); - if ( self::$installed_apis['bitbucket_api'] ) { - self::$install = Singleton::get_instance( 'API\Bitbucket_API', $this, new \stdClass() )->remote_install( $headers, self::$install ); - } - - if ( self::$installed_apis['bitbucket_server_api'] ) { - self::$install = Singleton::get_instance( 'API\Bitbucket_Server_API', $this, new \stdClass() )->remote_install( $headers, self::$install ); - } - } - - /* - * Create GitLab endpoint. - * Save Access Token if present. - * Check for GitLab Self-Hosted. - */ - if ( 'gitlab' === self::$install['github_updater_api'] ) { - if ( self::$installed_apis['gitlab_api'] ) { - self::$install = Singleton::get_instance( 'API\GitLab_API', $this, new \stdClass() )->remote_install( $headers, self::$install ); - } - } - - /* - * Create Gitea endpoint. - * Save Access Token if present. - */ - if ( 'gitea' === self::$install['github_updater_api'] ) { - if ( self::$installed_apis['gitea_api'] ) { - self::$install = Singleton::get_instance( 'API\Gitea_API', $this, new \stdClass() )->remote_install( $headers, self::$install ); - } - } - - /* - * Install from Zipfile. - */ - if ( 'zipfile' === self::$install['github_updater_api'] ) { - self::$install = Singleton::get_instance( 'API\Zipfile_API', $this )->remote_install( $headers, self::$install ); - } - - if ( isset( self::$install['options'] ) ) { - $this->save_options_on_install( self::$install['options'] ); - } - - $url = self::$install['download_link']; - $upgrader = $this->get_upgrader( $type, $url ); - - // Install the repo from the $source urldecode() and save branch setting. - if ( $upgrader && $upgrader->install( $url ) ) { - Singleton::get_instance( 'Branch', $this )->set_branch_on_install( self::$install ); - } else { - return false; - } - } - - return true; - } - - /** - * Save options set during installation. - * - * @param array $install_options Array of options from remote install process. - * @return void - */ - private function save_options_on_install( $install_options ) { - self::$options = array_merge( self::$options, $install_options ); - update_site_option( 'github_updater', self::$options ); - } - - /** - * Set remote install data into $_POST. - * - * @param array $config Data for a remote install. - */ - private function set_install_post_data( $config ) { - if ( ! isset( $config['uri'] ) ) { - return; - } - - $headers = $this->parse_header_uri( $config['uri'] ); - $api = false !== strpos( $headers['host'], '.com' ) - ? rtrim( $headers['host'], '.com' ) - : rtrim( $headers['host'], '.org' ); - - $api = isset( $config['git'] ) ? $config['git'] : $api; - - $_POST['github_updater_repo'] = $config['uri']; - $_POST['github_updater_branch'] = $config['branch']; - $_POST['github_updater_api'] = $api; - $_POST['option_page'] = 'github_updater_install'; - - switch ( $api ) { - case 'github': - $_POST['github_access_token'] = $config['private'] ?: null; - break; - case 'bitbucket': - $_POST['is_private'] = $config['private'] ? '1' : null; - break; - case 'gitlab': - $_POST['gitlab_access_token'] = $config['private'] ?: null; - break; - case 'gitea': - $_POST['gitea_access_token'] = $config['private'] ?: null; - break; - case 'zipfile': - $_POST['zipfile_slug'] = $config['slug']; - break; - } - } - - /** - * Get the appropriate upgrader for remote installation. - * - * @param string $type 'plugin' | 'theme'. - * @param string $url URL of the repository to be installed. - * - * @return bool|\Plugin_Upgrader|\Theme_Upgrader - */ - private function get_upgrader( $type, $url ) { - $nonce = wp_nonce_url( $url ); - $upgrader = false; - - if ( 'plugin' === $type ) { - $plugin = self::$install['repo']; - - // Create a new instance of Plugin_Upgrader. - $skin = static::is_wp_cli() - ? new CLI_Plugin_Installer_Skin() - : new \Plugin_Installer_Skin( compact( 'type', 'url', 'nonce', 'plugin' ) ); - $upgrader = new \Plugin_Upgrader( $skin ); - add_filter( - 'install_plugin_complete_actions', - [ - $this, - 'install_plugin_complete_actions', - ], - 10, - 3 - ); - } - - if ( 'theme' === $type ) { - $theme = self::$install['repo']; - - // Create a new instance of Theme_Upgrader. - $skin = static::is_wp_cli() - ? new CLI_Theme_Installer_Skin() - : new \Theme_Installer_Skin( compact( 'type', 'url', 'nonce', 'theme' ) ); - $upgrader = new \Theme_Upgrader( $skin ); - add_filter( - 'install_theme_complete_actions', - [ - $this, - 'install_theme_complete_actions', - ], - 10, - 3 - ); - } - - return $upgrader; - } - - /** - * Create Install Plugin or Install Theme page. - * - * @param string $type - */ - public function create_form( $type ) { - // Bail if installing. - if ( isset( $_POST['option_page'] ) && 'github_updater_install' === $_POST['option_page'] ) { - return; - } - - $this->register_settings( $type ); ?> -
- -
- get_running_git_servers(); - $git_servers = $this->get_class_vars( 'Base', 'git_servers' ); - $servers_not_running = array_diff( array_flip( $git_servers ), $running_servers ); - if ( ! empty( $servers_not_running ) ) { - foreach ( array_keys( $servers_not_running ) as $server ) { - $class = 'API\\' . $server . '_API'; - Singleton::get_instance( $class, $this )->add_install_settings_fields( $type ); - } - } - } - - /** - * Repo setting. - */ - public function get_repo() { - ?> - - - - - - 'activate', - // 'template' => rawurlencode( $template ), - 'stylesheet' => rawurlencode( $stylesheet ), - ], - admin_url( 'themes.php' ) - ); - $activate_link = esc_url( wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ) ); - - $install_actions['activate'] = '' . esc_attr__( 'Activate', 'github-updater' ) . ' “' . $stylesheet . '”'; - - if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) { - $network_activate_link = add_query_arg( - [ - 'action' => 'enable', - 'theme' => rawurlencode( $stylesheet ), - ], - network_admin_url( 'themes.php' ) - ); - $network_activate_link = esc_url( wp_nonce_url( $network_activate_link, 'enable-theme_' . $stylesheet ) ); - - $install_actions['network_enable'] = '' . esc_attr_x( 'Network Enable', 'This refers to a network activation in a multisite installation', 'github-updater' ) . ''; - unset( $install_actions['activate'] ); - } - ksort( $install_actions ); - - return $install_actions; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Language_Pack.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Language_Pack.php deleted file mode 100644 index 30b68a2..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Language_Pack.php +++ /dev/null @@ -1,124 +0,0 @@ -languages ) { - return; - } - - $this->repo = $repo; - $this->repo_api = $api; - } - - /** - * Do the Language Pack integration. - */ - public function run() { - if ( null === $this->repo ) { - return false; - } - - $headers = $this->parse_header_uri( $this->repo->languages ); - $this->repo_api->get_language_pack( $headers ); - - add_filter( 'site_transient_update_plugins', [ $this, 'update_site_transient' ] ); - add_filter( 'site_transient_update_themes', [ $this, 'update_site_transient' ] ); - } - - /** - * Add language translations to update_plugins or update_themes transients. - * - * @param mixed $transient Update transient. - * - * @return mixed - */ - public function update_site_transient( $transient ) { - $locales = get_available_languages(); - $locales = ! empty( $locales ) ? $locales : [ get_locale() ]; - $repos = []; - - if ( ! isset( $transient->translations ) ) { - return $transient; - } - - if ( 'site_transient_update_plugins' === current_filter() ) { - $repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $translations = wp_get_installed_translations( 'plugins' ); - } - if ( 'site_transient_update_themes' === current_filter() ) { - $repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - $translations = wp_get_installed_translations( 'themes' ); - } - - $repos = array_filter( - $repos, - function ( $e ) { - return isset( $e->language_packs ); - } - ); - - foreach ( $repos as $repo ) { - foreach ( $locales as $locale ) { - $lang_pack_mod = isset( $repo->language_packs->$locale ) - ? strtotime( $repo->language_packs->$locale->updated ) - : 0; - $translation_mod = isset( $translations[ $repo->slug ][ $locale ] ) - ? strtotime( $translations[ $repo->slug ][ $locale ]['PO-Revision-Date'] ) - : 0; - if ( $lang_pack_mod > $translation_mod ) { - $transient->translations[] = (array) $repo->language_packs->$locale; - } - } - } - - $transient->translations = array_unique( $transient->translations, SORT_REGULAR ); - - return $transient; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Messages.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Messages.php deleted file mode 100644 index cb5a66f..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Messages.php +++ /dev/null @@ -1,195 +0,0 @@ -get_error_message(); - add_action( - is_multisite() ? 'network_admin_notices' : 'admin_notices', - [ - $this, - 'show_wp_error', - ] - ); - break; - case 'waiting': - if ( ! apply_filters( 'github_updater_disable_wpcron', false ) ) { - add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', [ $this, 'waiting' ] ); - } - // no break. - case 'git': - default: - add_action( - is_multisite() ? 'network_admin_notices' : 'admin_notices', - [ - $this, - 'show_403_error_message', - ] - ); - add_action( - is_multisite() ? 'network_admin_notices' : 'admin_notices', - [ - $this, - 'show_401_error_message', - ] - ); - } - } - - return true; - } - - /** - * Create error message for 403 error. - * Usually 403 as API rate limit max out. - */ - public function show_403_error_message() { - $_403 = false; - $error_code = $this->get_error_codes(); - foreach ( (array) $error_code as $repo ) { - if ( ( ! $_403 && isset( $repo['code'], $repo['git'] ) ) - && 403 === $repo['code'] && 'github' === $repo['git'] ) { - $_403 = true; - if ( ! \PAnD::is_admin_notice_active( '403-error-1' ) ) { - return; - } ?> -
-

- -
- '; - printf( - /* translators: %s: GitHub personal access token URL */ - wp_kses_post( __( 'It looks like you are running into GitHub API rate limits. Be sure and configure a Personal Access Token to avoid this issue.', 'github-updater' ) ), - esc_url( 'https://help.github.com/articles/creating-an-access-token-for-command-line-use/' ) - ); - ?> -

-
- get_error_codes(); - foreach ( (array) $error_code as $repo ) { - if ( ( ! $_401 && isset( $repo['code'] ) ) && 401 === $repo['code'] ) { - $_401 = true; - if ( ! \PAnD::is_admin_notice_active( '401-error-1' ) ) { - return; - } - ?> -
-

- -
- -

-
- -
-

- -

-
- -
-

- -
- -

-
- load_options(); - - // Get details of installed git sourced plugins. - $this->config = $this->get_plugin_meta(); - - if ( null === $this->config ) { - return; - } - } - - /** - * Returns an array of configurations for the known plugins. - * - * @return array - */ - public function get_plugin_configs() { - return $this->config; - } - - /** - * Get details of Git-sourced plugins from those that are installed. - * - * @return array Indexed array of associative arrays of plugin details. - */ - protected function get_plugin_meta() { - // Ensure get_plugins() function is available. - include_once ABSPATH . '/wp-admin/includes/plugin.php'; - - $plugins = get_plugins(); - $git_plugins = []; - - /** - * Filter to add plugins not containing appropriate header line. - * - * @since 5.4.0 - * @access public - * - * @param array $additions Listing of plugins to add. - * Default null. - * @param array $plugins Listing of all plugins. - * @param string 'plugin' Type being passed. - */ - $additions = apply_filters( 'github_updater_additions', null, $plugins, 'plugin' ); - $plugins = array_merge( $plugins, (array) $additions ); - - foreach ( (array) $plugins as $plugin => $headers ) { - $git_plugin = []; - - foreach ( (array) static::$extra_headers as $value ) { - $header = null; - - if ( empty( $headers[ $value ] ) || false === stripos( $value, 'Plugin' ) ) { - continue; - } - - $header_parts = explode( ' ', $value ); - $repo_parts = $this->get_repo_parts( $header_parts[0], 'plugin' ); - - if ( $repo_parts['bool'] ) { - $header = $this->parse_header_uri( $headers[ $value ] ); - if ( empty( $header ) ) { - continue; - } - } - - $header = $this->parse_extra_headers( $header, $headers, $header_parts, $repo_parts ); - $current_branch = "current_branch_{$header['repo']}"; - $branch = isset( static::$options[ $current_branch ] ) - ? static::$options[ $current_branch ] - : false; - - $git_plugin['type'] = 'plugin'; - $git_plugin['git'] = $repo_parts['git_server']; - $git_plugin['uri'] = "{$header['base_uri']}/{$header['owner_repo']}"; - $git_plugin['enterprise'] = $header['enterprise_uri']; - $git_plugin['enterprise_api'] = $header['enterprise_api']; - $git_plugin['owner'] = $header['owner']; - $git_plugin['slug'] = $header['repo']; - $git_plugin['branch'] = $branch ?: 'master'; - $git_plugin['file'] = $plugin; - $git_plugin['local_path'] = WP_PLUGIN_DIR . "/{$header['repo']}/"; - - $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $git_plugin['file'] ); - $git_plugin['author'] = $plugin_data['AuthorName']; - $git_plugin['name'] = $plugin_data['Name']; - $git_plugin['homepage'] = $plugin_data['PluginURI']; - $git_plugin['local_version'] = strtolower( $plugin_data['Version'] ); - $git_plugin['sections']['description'] = $plugin_data['Description']; - $git_plugin['languages'] = $header['languages']; - $git_plugin['ci_job'] = $header['ci_job']; - $git_plugin['release_asset'] = $header['release_asset']; - $git_plugin['broken'] = ( empty( $header['owner'] ) || empty( $header['repo'] ) ); - - $git_plugin['banners']['high'] = - file_exists( WP_PLUGIN_DIR . "/{$header['repo']}/assets/banner-1544x500.png" ) - ? WP_PLUGIN_URL . "/{$header['repo']}/assets/banner-1544x500.png" - : null; - - $git_plugin['banners']['low'] = - file_exists( WP_PLUGIN_DIR . "/{$header['repo']}/assets/banner-772x250.png" ) - ? WP_PLUGIN_URL . "/{$header['repo']}/assets/banner-772x250.png" - : null; - - $git_plugin['icons'] = []; - $icons = [ - 'svg' => 'icon.svg', - '1x_png' => 'icon-128x128.png', - '1x_jpg' => 'icon-128x128.jpg', - '2x_png' => 'icon-256x256.png', - '2x_jpg' => 'icon-256x256.jpg', - ]; - foreach ( $icons as $key => $filename ) { - $key = preg_replace( '/_png|_jpg/', '', $key ); - $git_plugin['icons'][ $key ] = file_exists( $git_plugin['local_path'] . 'assets/' . $filename ) - ? WP_PLUGIN_URL . "/{$git_plugin['slug']}/assets/{$filename}" - : null; - } - } - - // Exit if not git hosted plugin. - if ( empty( $git_plugin ) ) { - continue; - } - - $git_plugins[ $git_plugin['slug'] ] = (object) $git_plugin; - } - - return $git_plugins; - } - - /** - * Get remote plugin meta to populate $config plugin objects. - * Calls to remote APIs to get data. - */ - public function get_remote_plugin_meta() { - $plugins = []; - foreach ( (array) $this->config as $plugin ) { - /** - * Filter to set if WP-Cron is disabled or if user wants to return to old way. - * - * @since 7.4.0 - * @access public - * - * @param bool - */ - if ( ! $this->waiting_for_background_update( $plugin ) || static::is_wp_cli() - || apply_filters( 'github_updater_disable_wpcron', false ) - ) { - $this->get_remote_repo_meta( $plugin ); - } else { - $plugins[ $plugin->slug ] = $plugin; - } - - // current_filter() check due to calling hook for shiny updates, don't show row twice. - if ( ! $plugin->release_asset && 'init' === current_filter() && - ( ! is_multisite() || is_network_admin() ) - ) { - add_action( "after_plugin_row_{$plugin->file}", [ $this, 'plugin_branch_switcher' ], 15, 3 ); - } - } - - $schedule_event = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? is_main_site() : true; - - if ( $schedule_event ) { - if ( ! wp_next_scheduled( 'ghu_get_remote_plugin' ) && - ! $this->is_duplicate_wp_cron_event( 'ghu_get_remote_plugin' ) && - ! apply_filters( 'github_updater_disable_wpcron', false ) - ) { - wp_schedule_single_event( time(), 'ghu_get_remote_plugin', [ $plugins ] ); - } - } - - if ( ! static::is_wp_cli() ) { - $this->load_pre_filters(); - } - } - - /** - * Load pre-update filters. - */ - public function load_pre_filters() { - add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 ); - add_filter( 'plugins_api', [ $this, 'plugins_api' ], 99, 3 ); - add_filter( 'site_transient_update_plugins', [ $this, 'update_site_transient' ], 15, 1 ); - } - - /** - * Add branch switch row to plugins page. - * - * @param string $plugin_file - * @param \stdClass $plugin_data - * - * @return bool - */ - public function plugin_branch_switcher( $plugin_file, $plugin_data ) { - if ( empty( static::$options['branch_switch'] ) ) { - return false; - } - - $enclosure = $this->update_row_enclosure( $plugin_file, 'plugin', true ); - $plugin = $this->get_repo_slugs( dirname( $plugin_file ) ); - $nonced_update_url = wp_nonce_url( - $this->get_update_url( 'plugin', 'upgrade-plugin', $plugin_file ), - 'upgrade-plugin_' . $plugin_file - ); - - if ( ! empty( $plugin ) ) { - $id = $plugin['slug'] . '-id'; - $branches = isset( $this->config[ $plugin['slug'] ]->branches ) - ? $this->config[ $plugin['slug'] ]->branches - : null; - } else { - return false; - } - - // Get current branch. - $repo = $this->config[ $plugin['slug'] ]; - $branch = Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ); - - $branch_switch_data = []; - $branch_switch_data['slug'] = $plugin['slug']; - $branch_switch_data['nonced_update_url'] = $nonced_update_url; - $branch_switch_data['id'] = $id; - $branch_switch_data['branch'] = $branch; - $branch_switch_data['branches'] = $branches; - - /* - * Create after_plugin_row_ - */ - echo $enclosure['open']; - $this->make_branch_switch_row( $branch_switch_data ); - echo $enclosure['close']; - - return true; - } - - /** - * Add 'View details' link to plugins page. - * - * @param array $links - * @param string $file - * - * @return array $links - */ - public function plugin_row_meta( $links, $file ) { - $regex_pattern = '/(.*)<\/a>/'; - $repo = dirname( $file ); - - /* - * Sanity check for some commercial plugins. - */ - if ( ! isset( $links[2] ) ) { - return $links; - } - - preg_match( $regex_pattern, $links[2], $matches ); - - /* - * Remove 'Visit plugin site' link in favor or 'View details' link. - */ - if ( array_key_exists( $repo, $this->config ) ) { - if ( null !== $repo ) { - unset( $links[2] ); - $links[] = sprintf( - '%s', - esc_url( - add_query_arg( - [ - 'tab' => 'plugin-information', - 'plugin' => $repo, - 'TB_iframe' => 'true', - 'width' => 600, - 'height' => 550, - ], - network_admin_url( 'plugin-install.php' ) - ) - ), - esc_html__( 'View details', 'github-updater' ) - ); - } - } - - return $links; - } - - /** - * Put changelog in plugins_api, return WP.org data as appropriate - * - * @param bool $false - * @param string $action - * @param \stdClass $response - * - * @return mixed - */ - public function plugins_api( $false, $action, $response ) { - if ( ! ( 'plugin_information' === $action ) ) { - return $false; - } - - $plugin = isset( $this->config[ $response->slug ] ) ? $this->config[ $response->slug ] : false; - - // Skip if waiting for background update. - if ( $this->waiting_for_background_update( $plugin ) ) { - return $false; - } - - // wp.org plugin. - if ( ! $plugin || ( $plugin->dot_org && 'master' === $plugin->branch ) ) { - return $false; - } - - $response->slug = $plugin->slug; - $response->plugin_name = $plugin->name; - $response->name = $plugin->name; - $response->author = $plugin->author; - $response->homepage = $plugin->homepage; - $response->donate_link = $plugin->donate_link; - $response->version = $plugin->remote_version; - $response->sections = $plugin->sections; - $response->requires = $plugin->requires; - $response->requires_php = $plugin->requires_php; - $response->tested = $plugin->tested; - $response->downloaded = $plugin->downloaded; - $response->last_updated = $plugin->last_updated; - $response->download_link = $plugin->download_link; - $response->banners = $plugin->banners; - $response->icons = ! empty( $plugin->icons ) ? $plugin->icons : []; - $response->contributors = $plugin->contributors; - if ( ! $this->is_private( $plugin ) ) { - $response->num_ratings = $plugin->num_ratings; - $response->rating = $plugin->rating; - } - - return $response; - } - - /** - * Hook into site_transient_update_plugins to update from GitHub. - * - * @param \stdClass $transient - * - * @return mixed - */ - public function update_site_transient( $transient ) { - foreach ( (array) $this->config as $plugin ) { - if ( $this->can_update_repo( $plugin ) ) { - $response = [ - 'slug' => $plugin->slug, - 'plugin' => $plugin->file, - 'new_version' => $plugin->remote_version, - 'url' => $plugin->uri, - 'package' => $plugin->download_link, - 'icons' => $plugin->icons, - 'tested' => $plugin->tested, - 'requires_php' => $plugin->requires_php, - 'branch' => $plugin->branch, - 'branches' => array_keys( $plugin->branches ), - 'type' => "{$plugin->git}-{$plugin->type}", - ]; - - // Skip on RESTful updating. - if ( isset( $_GET['action'], $_GET['plugin'] ) && - 'github-updater-update' === $_GET['action'] && - $response['slug'] === $_GET['plugin'] - ) { - continue; - } - - // Pull update from dot org if not overriding. - if ( ! $this->override_dot_org( 'plugin', $plugin ) ) { - continue; - } - - $transient->response[ $plugin->file ] = (object) $response; - } else { - /** - * Filter to return array of overrides to dot org. - * - * @since 8.5.0 - * @return array - */ - $overrides = apply_filters( 'github_updater_override_dot_org', [] ); - if ( isset( $transient->response[ $plugin->file ] ) && in_array( $plugin->file, $overrides, true ) ) { - unset( $transient->response[ $plugin->file ] ); - } - } - - // Set transient on rollback. - if ( isset( $_GET['plugin'], $_GET['rollback'] ) && $plugin->file === $_GET['plugin'] - ) { - $transient->response[ $plugin->file ] = $this->set_rollback_transient( 'plugin', $plugin ); - } - } - - return $transient; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Readme_Parser.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Readme_Parser.php deleted file mode 100644 index b9dc57c..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Readme_Parser.php +++ /dev/null @@ -1,198 +0,0 @@ -readme_path = apply_filters( 'github_updater_temp_readme_filepath', $file_path ); - $this->readme_path = file_put_contents( $this->readme_path, $file ) ? $this->readme_path : false; - parent::__construct( $this->readme_path ); - } - - /** - * Parse text into markdown. - * - * @param string $text - * - * @return string - */ - protected function parse_markdown( $text ) { - static $markdown = null; - - if ( null === $markdown ) { - $markdown = new Parsedown(); - } - - return $markdown->text( $text ); - } - - /** - * Return parsed readme.txt as array. - * - * @return array $data - */ - public function parse_data() { - $data = []; - foreach ( get_object_vars( $this ) as $key => $value ) { - $data[ $key ] = 'contributors' === $key ? $this->create_contributors( $value ) : $value; - } - $data = $this->faq_as_h4( $data ); - $data = $this->readme_section_as_h4( 'changelog', $data ); - $data = $this->readme_section_as_h4( 'description', $data ); - - @unlink( $this->readme_path ); - - return $data; - } - - /** - * Sanitize contributors. - * - * @param array $users - * - * @return array - */ - protected function sanitize_contributors( $users ) { - return $users; - } - - /** - * Create contributor data. - * - * @param array $users - * - * @return array $contributors - */ - private function create_contributors( $users ) { - global $wp_version; - $contributors = []; - foreach ( (array) $users as $contributor ) { - $contributors[ $contributor ]['display_name'] = $contributor; - $contributors[ $contributor ]['profile'] = '//profiles.wordpress.org/' . $contributor; - $contributors[ $contributor ]['avatar'] = 'https://wordpress.org/grav-redirect.php?user=' . $contributor; - if ( version_compare( $wp_version, '5.1-alpha', '<' ) ) { - $contributors[ $contributor ] = '//profiles.wordpress.org/' . $contributor; - } - } - - return $contributors; - } - - /** - * Converts FAQ from dictionary list to h4 style. - * - * @param array $data Array of parsed readme data. - * - * @return array $data - */ - public function faq_as_h4( $data ) { - if ( empty( $data['faq'] ) ) { - return $data; - } - unset( $data['sections']['faq'] ); - $data['sections']['faq'] = ''; - foreach ( $data['faq'] as $question => $answer ) { - $data['sections']['faq'] .= "

{$question}

\n{$answer}\n"; - } - - return $data; - } - - /** - * Converts wp.org readme section items to h4 style. - * - * @param string $section Readme section. - * @param array $data Array of parsed readme data. - * - * @return array $data - */ - public function readme_section_as_h4( $section, $data ) { - if ( empty( $data['sections'][ $section ] ) || false !== strpos( $data['sections'][ $section ], '

' ) ) { - return $data; - } - $pattern = '~

=(.*)=

~'; - $replace = '

$1

'; - - $data['sections'][ $section ] = preg_replace( $pattern, $replace, $data['sections'][ $section ] ); - - return $data; - } - - /** - * Replace parent method as some users don't have `mb_strrpos()`. - * - * @access protected - * - * @param string $desc - * @param int $length - * - * @return string - */ - protected function trim_length( $desc, $length = 150 ) { - if ( mb_strlen( $desc ) > $length ) { - $desc = mb_substr( $desc, 0, $length ) . ' …'; - - // If not a full sentence, and one ends within 20% of the end, trim it to that. - if ( function_exists( 'mb_strrpos' ) ) { - $pos = mb_strrpos( $desc, '.' ); - } else { - $pos = strrpos( $desc, '.' ); - } - if ( $pos > ( 0.8 * $length ) && '.' !== mb_substr( $desc, -1 ) ) { - $desc = mb_substr( $desc, 0, $pos + 1 ); - } - } - - return trim( $desc ); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Remote_Management.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Remote_Management.php deleted file mode 100644 index 9d6b950..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Remote_Management.php +++ /dev/null @@ -1,315 +0,0 @@ - 'iThemes Sync', - 'infinitewp' => 'InfiniteWP', - 'managewp' => 'ManageWP', - 'mainwp' => 'MainWP', - ]; - - /** - * Holds the value for the Remote Management API key. - * - * @var string $api_key - */ - private static $api_key; - - /** - * Remote_Management constructor. - */ - public function __construct() { - $this->load_options(); - $this->ensure_api_key_is_set(); - } - - /** - * Load site options. - */ - private function load_options() { - self::$options_remote = get_site_option( 'github_updater_remote_management', [] ); - self::$api_key = get_site_option( 'github_updater_api_key' ); - } - - /** - * Ensure api key is set. - */ - public function ensure_api_key_is_set() { - if ( ! self::$api_key ) { - update_site_option( 'github_updater_api_key', md5( uniqid( \rand(), true ) ) ); - } - } - - /** - * Load needed action/filter hooks. - */ - public function load_hooks() { - add_action( 'admin_init', [ $this, 'remote_management_page_init' ] ); - add_action( - 'github_updater_update_settings', - function ( $post_data ) { - $this->save_settings( $post_data ); - } - ); - add_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] ); - $this->add_settings_tabs(); - } - - /** - * Return list of pages where GitHub Updater loads/runs. - * - * @param array $admin_pages Default list of pages where GitHub Updater loads. - * - * @return array $admin_pages - */ - public function extra_admin_pages( $admin_pages = [] ) { - $extra_admin_pages = []; - foreach ( array_keys( self::$remote_management ) as $key ) { - if ( ! empty( self::$options_remote[ $key ] ) ) { - $extra_admin_pages = [ 'index.php' ]; - break; - } - } - - return array_merge( $admin_pages, $extra_admin_pages ); - } - - /** - * Save Remote Management settings. - * - * @uses 'github_updater_update_settings' action hook - * @uses 'github_updater_save_redirect' filter hook - * - * @param array $post_data $_POST data. - */ - public function save_settings( $post_data ) { - if ( isset( $post_data['option_page'] ) && - 'github_updater_remote_management' === $post_data['option_page'] - ) { - $options = isset( $post_data['github_updater_remote_management'] ) - ? $post_data['github_updater_remote_management'] - : []; - - update_site_option( 'github_updater_remote_management', (array) $this->sanitize( $options ) ); - - add_filter( - 'github_updater_save_redirect', - function ( $option_page ) { - return array_merge( $option_page, [ 'github_updater_remote_management' ] ); - } - ); - } - } - - /** - * Adds Remote Management tab to Settings page. - */ - public function add_settings_tabs() { - $install_tabs = [ 'github_updater_remote_management' => esc_html__( 'Remote Management', 'github-updater' ) ]; - add_filter( - 'github_updater_add_settings_tabs', - function ( $tabs ) use ( $install_tabs ) { - return array_merge( $tabs, $install_tabs ); - } - ); - add_filter( - 'github_updater_add_admin_page', - function ( $tab, $action ) { - $this->add_admin_page( $tab, $action ); - }, - 10, - 2 - ); - } - - /** - * Add Settings page data via action hook. - * - * @uses 'github_updater_add_admin_page' action hook - * - * @param string $tab Tab name. - * @param string $action Form action. - */ - public function add_admin_page( $tab, $action ) { - if ( 'github_updater_remote_management' === $tab ) { - $action = add_query_arg( 'tab', $tab, $action ); ?> -
- -
- true ], $action ); - ?> -
- -
- $name ) { - add_settings_field( - $id, - null, - [ $this, 'token_callback_checkbox_remote' ], - 'github_updater_remote_settings', - 'remote_management', - [ - 'id' => $id, - 'title' => esc_html( $name ), - ] - ); - } - } - - /** - * Print the Remote Management text. - */ - public function print_section_remote_management() { - if ( empty( self::$api_key ) ) { - $this->load_options(); - } - $api_url = add_query_arg( - [ - 'action' => 'github-updater-update', - 'key' => self::$api_key, - ], - admin_url( 'admin-ajax.php' ) - ); - ?> -

- wiki for complete list of attributes. RESTful endpoints begin at:', 'github-updater' ) - ), - 'https://github.com/afragen/github-updater/wiki/Remote-Management---RESTful-Endpoints' - ); - ?> -
- -

- -

- - - extra_admin_pages(); - if ( $this->is_current_page( $remote_management_pages ) ) { - add_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] ); - add_filter( 'site_transient_update_plugins', [ Singleton::get_instance( 'Plugin', $this ), 'update_site_transient' ], 10, 1 ); - add_filter( 'site_transient_update_themes', [ Singleton::get_instance( 'Theme', $this ), 'update_site_transient' ], 10, 1 ); - - Singleton::get_instance( 'Base', $this )->get_meta_remote_management(); - - $current_plugins = get_site_transient( 'update_plugins' ); - $current_themes = get_site_transient( 'update_themes' ); - set_site_transient( 'update_plugins', $current_plugins ); - set_site_transient( 'update_themes', $current_themes ); - - remove_filter( 'github_updater_add_admin_pages', [ $this, 'extra_admin_pages' ] ); - } - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Update.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Update.php deleted file mode 100644 index a2de523..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Update.php +++ /dev/null @@ -1,314 +0,0 @@ -load_options(); - $this->upgrader_skin = new Rest_Upgrader_Skin(); - } - - /** - * Update plugin. - * - * @param string $plugin_slug - * @param string $tag - * - * @throws \UnexpectedValueException Plugin not found or not updatable. - */ - public function update_plugin( $plugin_slug, $tag = 'master' ) { - $plugin = null; - $is_plugin_active = false; - - foreach ( (array) Singleton::get_instance( 'Plugin', $this )->get_plugin_configs() as $config_entry ) { - if ( $config_entry->slug === $plugin_slug ) { - $plugin = $config_entry; - break; - } - } - - if ( ! $plugin ) { - throw new \UnexpectedValueException( 'Plugin not found or not updatable with GitHub Updater: ' . $plugin_slug ); - } - - if ( is_plugin_active( $plugin->file ) ) { - $is_plugin_active = true; - } - - $this->get_remote_repo_meta( $plugin ); - $repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $plugin->git, $plugin ); - - $update = [ - 'slug' => $plugin->slug, - 'plugin' => $plugin->file, - 'new_version' => null, - 'url' => $plugin->uri, - 'package' => $repo_api->construct_download_link( $tag ), - ]; - - add_filter( - 'site_transient_update_plugins', - function ( $current ) use ( $plugin, $update ) { - $current->response[ $plugin->file ] = (object) $update; - - return $current; - } - ); - - $upgrader = new \Plugin_Upgrader( $this->upgrader_skin ); - $upgrader->upgrade( $plugin->file ); - - if ( $is_plugin_active ) { - $activate = is_multisite() ? activate_plugin( $plugin->file, null, true ) : activate_plugin( $plugin->file ); - if ( ! $activate ) { - $this->upgrader_skin->messages[] = 'Plugin reactivated successfully.'; - } - } - } - - /** - * Update a single theme. - * - * @param string $theme_slug - * @param string $tag - * - * @throws \UnexpectedValueException Theme not found or not updatable. - */ - public function update_theme( $theme_slug, $tag = 'master' ) { - $theme = null; - - foreach ( (array) Singleton::get_instance( 'Theme', $this )->get_theme_configs() as $config_entry ) { - if ( $config_entry->slug === $theme_slug ) { - $theme = $config_entry; - break; - } - } - - if ( ! $theme ) { - throw new \UnexpectedValueException( 'Theme not found or not updatable with GitHub Updater: ' . $theme_slug ); - } - - $this->get_remote_repo_meta( $theme ); - $repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $theme->git, $theme ); - - $update = [ - 'theme' => $theme->slug, - 'new_version' => null, - 'url' => $theme->uri, - 'package' => $repo_api->construct_download_link( $tag ), - ]; - - add_filter( - 'site_transient_update_themes', - function ( $current ) use ( $theme, $update ) { - $current->response[ $theme->slug ] = $update; - - return $current; - } - ); - - $upgrader = new \Theme_Upgrader( $this->upgrader_skin ); - $upgrader->upgrade( $theme->slug ); - } - - /** - * Is there an error? - */ - public function is_error() { - return $this->upgrader_skin->error; - } - - /** - * Get messages during update. - */ - public function get_messages() { - return $this->upgrader_skin->messages; - } - - /** - * Process request. - * - * Relies on data in $_REQUEST, prints out json and exits. - * If the request came through a webhook, and if the branch in the - * webhook matches the branch specified by the url, use the latest - * update available as specified in the webhook payload. - * - * @throws \UnexpectedValueException Under multiple bad or missing params. - */ - public function process_request() { - $start = microtime( true ); - try { - if ( ! isset( $_REQUEST['key'] ) || - get_site_option( 'github_updater_api_key' ) !== $_REQUEST['key'] - ) { - throw new \UnexpectedValueException( 'Bad API key.' ); - } - - /** - * Allow access into the REST Update process. - * - * @since 7.6.0 - * @access public - */ - do_action( 'github_updater_pre_rest_process_request' ); - - $tag = 'master'; - if ( isset( $_REQUEST['tag'] ) ) { - $tag = $_REQUEST['tag']; - } elseif ( isset( $_REQUEST['committish'] ) ) { - $tag = $_REQUEST['committish']; - } - - $this->get_webhook_source(); - $current_branch = $this->get_local_branch(); - $override = isset( $_REQUEST['override'] ); - if ( $tag !== $current_branch && ! $override ) { - throw new \UnexpectedValueException( 'Webhook tag and current branch are not matching. Consider using `override` query arg.' ); - } - - if ( isset( $_REQUEST['plugin'] ) ) { - $this->update_plugin( $_REQUEST['plugin'], $tag ); - } elseif ( isset( $_REQUEST['theme'] ) ) { - $this->update_theme( $_REQUEST['theme'], $tag ); - } else { - throw new \UnexpectedValueException( 'No plugin or theme specified for update.' ); - } - } catch ( \Exception $e ) { - $http_response = [ - 'success' => false, - 'messages' => $e->getMessage(), - 'webhook' => $_GET, - 'elapsed_time' => round( ( microtime( true ) - $start ) * 1000, 2 ) . ' ms', - ]; - $this->log_exit( $http_response, 417 ); - } - - $response = [ - 'success' => true, - 'messages' => $this->get_messages(), - 'webhook' => $_GET, - 'elapsed_time' => round( ( microtime( true ) - $start ) * 1000, 2 ) . ' ms', - ]; - - if ( $this->is_error() ) { - $response['success'] = false; - $this->log_exit( $response, 417 ); - } - $this->log_exit( $response, 200 ); - } - - /** - * Returns the current branch of the local repository referenced in the webhook. - * - * @return string $current_branch Default return is 'master'. - */ - private function get_local_branch() { - $repo = false; - if ( isset( $_REQUEST['plugin'] ) ) { - $repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $repo = isset( $repos[ $_REQUEST['plugin'] ] ) ? $repos[ $_REQUEST['plugin'] ] : false; - } - if ( isset( $_REQUEST['theme'] ) ) { - $repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - $repo = isset( $repos[ $_REQUEST['theme'] ] ) ? $repos[ $_REQUEST['theme'] ] : false; - } - $current_branch = $repo ? - Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ) : - 'master'; - - return $current_branch; - } - - /** - * Sets the source of the webhook to $_GET variable. - */ - private function get_webhook_source() { - switch ( $_SERVER ) { - case isset( $_SERVER['HTTP_X_GITHUB_EVENT'] ): - $webhook_source = 'GitHub webhook'; - break; - case isset( $_SERVER['HTTP_X_EVENT_KEY'] ): - $webhook_source = 'Bitbucket webhook'; - break; - case isset( $_SERVER['HTTP_X_GITLAB_EVENT'] ): - $webhook_source = 'GitLab webhook'; - break; - case isset( $_SERVER['HTTP_X_GITEA_EVENT'] ): - $webhook_source = 'Gitea webhook'; - break; - default: - $webhook_source = 'browser'; - break; - } - $_GET['webhook_source'] = $webhook_source; - } - - /** - * Append $response to debug.log and wp_die(). - * - * @param array $response - * @param int $code - * - * 128 == JSON_PRETTY_PRINT - * 64 == JSON_UNESCAPED_SLASHES - */ - private function log_exit( $response, $code ) { - $json_encode_flags = 128 | 64; - - error_log( json_encode( $response, $json_encode_flags ) ); - - /** - * Action hook after processing REST process. - * - * @since 8.6.0 - * - * @param array $response - * @param int $code HTTP response. - */ - do_action( 'github_updater_post_rest_process_request', $response, $code ); - - unset( $response['success'] ); - if ( 200 === $code ) { - wp_die( wp_send_json_success( $response, $code ) ); - } else { - wp_die( wp_send_json_error( $response, $code ) ); - } - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Upgrader_Skin.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Upgrader_Skin.php deleted file mode 100644 index 681e977..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Rest_Upgrader_Skin.php +++ /dev/null @@ -1,99 +0,0 @@ -upgrader->strings[ $string ] ) ) { - $string = $this->upgrader->strings[ $string ]; - } - - if ( false !== strpos( $string, '%' ) ) { - $args = func_get_args(); - $args = array_splice( $args, 1 ); - if ( $args ) { - $args = array_map( 'strip_tags', $args ); - $args = array_map( 'esc_html', $args ); - $string = vsprintf( $string, $args ); - } - } - if ( empty( $string ) ) { - return; - } - - $this->messages[] = $string; - } - - /** - * Set the error flag to true, then let the base class handle the rest. - * - * @param mixed $errors - */ - public function error( $errors ) { - $this->error = true; - parent::error( $errors ); - } - - /** - * Do nothing. - * - * @param mixed $type - */ - protected function decrement_update_count( $type ) { - } - - /** - * Do nothing. - */ - public function header() { - } - - /** - * Do nothing. - */ - public function footer() { - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Settings.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Settings.php deleted file mode 100644 index b1969ed..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Settings.php +++ /dev/null @@ -1,804 +0,0 @@ - false, - 'github_enterprise' => false, - 'bitbucket_private' => false, - 'bitbucket_server' => false, - 'gitlab_private' => false, - 'gitlab_enterprise' => false, - 'gitea_private' => false, - ]; - - /** - * Constructor. - */ - public function __construct() { - parent::__construct(); - $this->refresh_caches(); - $this->load_options(); - } - - /** - * Check for cache refresh. - */ - protected function refresh_caches() { - if ( isset( $_POST['ghu_refresh_cache'] ) && ! ( $this instanceof Messages ) ) { - $this->delete_all_cached_data(); - } - } - - /** - * Let's get going. - */ - public function run() { - $this->load_hooks(); - - // Need to ensure these classes are activated here for hooks to fire. - if ( $this->is_current_page( [ 'options.php', 'options-general.php', 'settings.php' ] ) ) { - Singleton::get_instance( 'Install', $this )->run(); - Singleton::get_instance( 'Remote_Management', $this )->load_hooks(); - } - } - - /** - * Load relevant action/filter hooks. - */ - protected function load_hooks() { - add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', [ $this, 'add_plugin_page' ] ); - add_action( 'network_admin_edit_github-updater', [ $this, 'update_settings' ] ); - - add_filter( - is_multisite() - ? 'network_admin_plugin_action_links_' . $this->ghu_plugin_name - : 'plugin_action_links_' . $this->ghu_plugin_name, - [ $this, 'plugin_action_links' ] - ); - - if ( $this->is_current_page( [ 'options.php', 'options-general.php', 'settings.php', 'edit.php' ] ) ) { - add_action( 'admin_init', [ $this, 'update_settings' ] ); - add_action( 'admin_init', [ $this, 'page_init' ] ); - } - } - - /** - * Define tabs for Settings page. - * By defining in a method, strings can be translated. - * - * @access private - * @return array - */ - private function settings_tabs() { - $tabs = [ 'github_updater_settings' => esc_html__( 'Settings', 'github-updater' ) ]; - - /** - * Filter settings tabs. - * - * @since 8.0.0 - * - * @param array $tabs Array of default tabs. - */ - return apply_filters( 'github_updater_add_settings_tabs', $tabs ); - } - - /** - * Set up the Settings Sub-tabs. - * - * @access private - * @return array - */ - private function settings_sub_tabs() { - $subtabs = [ 'github_updater' => esc_html__( 'GitHub Updater', 'github-updater' ) ]; - $gits = $this->get_running_git_servers(); - $gits[] = in_array( 'gitlabce', $gits, true ) ? 'gitlab' : null; - $gits = array_unique( $gits ); - - $git_subtab = []; - $ghu_subtabs = []; - - /** - * Filter subtabs to be able to add subtab from git API class. - * - * @since 8.0.0 - * - * @param array $ghu_subtabs Array of added subtabs. - * - * @return array $subtabs Array of subtabs. - */ - $ghu_subtabs = apply_filters( 'github_updater_add_settings_subtabs', $ghu_subtabs ); - - foreach ( $gits as $git ) { - if ( array_key_exists( $git, $ghu_subtabs ) ) { - $git_subtab[ $git ] = $ghu_subtabs[ $git ]; - } - } - $subtabs = array_merge( $subtabs, $git_subtab ); - - return $subtabs; - } - - /** - * Add options page. - */ - public function add_plugin_page() { - $parent = is_multisite() ? 'settings.php' : 'options-general.php'; - $capability = is_multisite() ? 'manage_network' : 'manage_options'; - - add_submenu_page( - $parent, - esc_html__( 'GitHub Updater Settings', 'github-updater' ), - esc_html__( 'GitHub Updater', 'github-updater' ), - $capability, - 'github-updater', - [ $this, 'create_admin_page' ] - ); - } - - /** - * Renders setting tabs. - * - * Walks through the object's tabs array and prints them one by one. - * Provides the heading for the settings page. - * - * @access private - */ - private function options_tabs() { - $current_tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : 'github_updater_settings'; - echo ''; - } - - /** - * Render the settings sub-tabs. - * - * @access private - */ - private function options_sub_tabs() { - $current_tab = isset( $_GET['subtab'] ) ? esc_attr( $_GET['subtab'] ) : 'github_updater'; - echo ''; - } - - /** - * Options page callback. - */ - public function create_admin_page() { - $action = is_multisite() ? 'edit.php?action=github-updater' : 'options.php'; - $tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : 'github_updater_settings'; - $subtab = isset( $_GET['subtab'] ) ? esc_attr( $_GET['subtab'] ) : 'github_updater'; - $logo = plugins_url( basename( GITHUB_UPDATER_DIR ) . '/assets/GitHub_Updater_logo_small.png' ); ?> -
-

- GitHub Updater logo
- -

- options_tabs(); ?> - admin_page_notices(); ?> - - options_sub_tabs(); ?> -
- add_hidden_settings_sections(); - } else { - do_settings_sections( 'github_updater_' . $subtab . '_install_settings' ); - $this->display_ghu_repos( $subtab ); - $this->add_hidden_settings_sections( $subtab ); - } - submit_button(); - ?> -
- true ], $action ); ?> -
- -
- - - -
-

'; - } - if ( ( isset( $_GET['updated'] ) && '1' === $_GET['updated'] ) && is_multisite() ) { - esc_html_e( 'Settings saved.', 'github-updater' ); - } elseif ( isset( $_GET['reset'] ) && '1' === $_GET['reset'] ) { - esc_html_e( 'RESTful key reset.', 'github-updater' ); - } elseif ( isset( $_GET['refresh_transients'] ) && '1' === $_GET['refresh_transients'] ) { - esc_html_e( 'Cache refreshed.', 'github-updater' ); - } - if ( $display ) { - echo '

'; - } - } - - /** - * Register and add settings. - * Check to see if it's a private repo. - */ - public function page_init() { - if ( static::is_doing_ajax() ) { - return; - } - - register_setting( - 'github_updater', - 'github_updater', - [ $this, 'sanitize' ] - ); - - $this->ghu_tokens(); - - /* - * Add basic plugin settings. - */ - add_settings_section( - 'github_updater_settings', - esc_html__( 'GitHub Updater Settings', 'github-updater' ), - [ $this, 'print_section_ghu_settings' ], - 'github_updater_install_settings' - ); - - add_settings_field( - 'branch_switch', - null, - [ $this, 'token_callback_checkbox' ], - 'github_updater_install_settings', - 'github_updater_settings', - [ - 'id' => 'branch_switch', - 'title' => esc_html__( 'Enable Branch Switching', 'github-updater' ), - ] - ); - - /** - * Hook to add Git API settings. - * - * @since 8.0.0 - * - * @param array $auth_required Array containing authorization needs of git APIs. - */ - do_action( 'github_updater_add_settings', static::$auth_required ); - } - - /** - * Create and return settings fields for private repositories. - */ - public function ghu_tokens() { - $ghu_options_keys = []; - $ghu_plugins = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $ghu_themes = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - $ghu_tokens = array_merge( $ghu_plugins, $ghu_themes ); - - foreach ( $ghu_tokens as $token ) { - $type = ' '; - $setting_field = []; - $ghu_options_keys[ $token->slug ] = null; - - /* - * Check to see if it's a private repo or Enterprise and set variables. - */ - $this->set_auth_required( $token ); - - /* - * Next if not a private repo or token field not empty. - */ - if ( ! $this->is_private( $token ) ) { - continue; - } - - if ( 'theme' === $token->type ) { - $type = ' '; - } - - $setting_field['id'] = $token->slug; - $setting_field['title'] = $type . esc_html( $token->name ); - - $repo_setting_field = apply_filters( 'github_updater_add_repo_setting_field', [], $token, $token->git ); - - if ( empty( $repo_setting_field ) ) { - continue; - } - - $setting_field = array_merge( $setting_field, $repo_setting_field ); - $setting_field['callback'] = $token->slug; - - $title = 'token_callback_checkbox' !== $setting_field['callback_method'][1] ? $setting_field['title'] : null; - add_settings_field( - $setting_field['id'], - $title, - $setting_field['callback_method'], - $setting_field['page'], - $setting_field['section'], - [ - 'id' => $setting_field['callback'], - 'token' => true, - 'title' => $setting_field['title'], - ] - ); - } - - if ( ! $this->waiting_for_background_update() ) { - $this->unset_stale_options( $ghu_options_keys, $ghu_tokens ); - } else { - Singleton::get_instance( 'Messages', $this )->create_error_message( 'waiting' ); - } - } - - /** - * Check current saved options and unset if repos not present. - * - * @param array $ghu_options_keys - * @param array $ghu_tokens - */ - public function unset_stale_options( $ghu_options_keys, $ghu_tokens ) { - $running_servers = $this->get_running_git_servers(); - $ghu_unset_keys = array_diff_key( static::$options, $ghu_options_keys ); - $always_unset = [ - 'db_version', - 'branch_switch', - 'github_access_token', - 'github_enterprise_token', - ]; - - if ( in_array( 'bitbucket', $running_servers, true ) ) { - $always_unset = array_merge( - $always_unset, - [ - 'bitbucket_username', - 'bitbucket_password', - ] - ); - } - - if ( in_array( 'bbserver', $running_servers, true ) ) { - $always_unset = array_merge( - $always_unset, - [ - 'bitbucket_server_username', - 'bitbucket_server_password', - ] - ); - } - - array_map( - function ( $e ) use ( &$ghu_unset_keys ) { - unset( $ghu_unset_keys[ $e ] ); - }, - $always_unset - ); - - $auth_required = static::$auth_required; - $auth_required_unset = [ - 'github_enterprise' => 'github_enterprise_token', - 'gitlab' => 'gitlab_access_token', - 'gitlab_enterprise' => 'gitlab_enterprise_token', - 'gitea' => 'gitea_access_token', - ]; - - array_map( - function ( $e ) use ( &$ghu_unset_keys, $auth_required, $auth_required_unset ) { - $key = array_search( $e, $auth_required_unset, true ); - if ( $auth_required[ $key ] ) { - unset( $ghu_unset_keys[ $e ] ); - } - }, - $auth_required_unset - ); - - // Unset if current_branch AND if associated with repo. - array_map( - function ( $e ) use ( &$ghu_unset_keys, $ghu_tokens, &$reset_keys ) { - $key = array_search( $e, $ghu_unset_keys, true ); - $repo = str_replace( 'current_branch_', '', $key ); - if ( array_key_exists( $key, $ghu_unset_keys ) - && false !== strpos( $key, 'current_branch' ) - ) { - unset( $ghu_unset_keys[ $key ] ); - } - if ( ! array_key_exists( $repo, $ghu_tokens ) ) { - $reset_keys[ $key ] = $e; - } - }, - $ghu_unset_keys - ); - $ghu_unset_keys = array_merge( $ghu_unset_keys, (array) $reset_keys ); - - if ( ! empty( $ghu_unset_keys ) ) { - foreach ( $ghu_unset_keys as $key => $value ) { - unset( static::$options[ $key ] ); - } - update_site_option( 'github_updater', static::$options ); - } - } - - /** - * Check to see if it's an enterprise or private repo and set variables. - * - * @param \stdClass $token Repo data. - */ - private function set_auth_required( $token ) { - // Set booleans for Enterprise repos. - if ( $token->enterprise ) { - static::$auth_required['github_enterprise'] = static::$auth_required['github_enterprise'] - ?: 'github' === $token->git; - static::$auth_required['gitlab_enterprise'] = static::$auth_required['gitlab_enterprise'] - ?: 'gitlab' === $token->git; - static::$auth_required['bitbucket_server'] = static::$auth_required['bitbucket_server'] - ?: 'bitbucket' === $token->git; - } - - // Set booleans for private repos. - if ( $this->is_private( $token ) ) { - static::$auth_required['github_private'] = static::$auth_required['github_private'] - ?: 'github' === $token->git; - static::$auth_required['bitbucket_private'] = static::$auth_required['bitbucket_private'] - ?: 'bitbucket' === $token->git; - static::$auth_required['gitlab_private'] = static::$auth_required['gitlab_private'] - ?: 'gitlab' === $token->git; - static::$auth_required['gitea_private'] = static::$auth_required['gitea_private'] - ?: 'gitea' === $token->git; - } - - // Always set to true. - static::$auth_required['gitlab'] = true; - static::$auth_required['gitea'] = true; - } - - /** - * Print the GitHub Updater Settings text. - */ - public function print_section_ghu_settings() { - $this->display_dot_org_overrides(); - echo '

' . esc_html__( 'Check to enable branch switching from the Plugins or Themes page.', 'github-updater' ) . '

'; - } - - /** - * Display plugins/themes that are overridden using the filter hook. - * - * @uses `github_updater_override_dot_org` filter hook - * @return void - */ - private function display_dot_org_overrides() { - $plugins = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $themes = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - $dashicon_plugin = '  '; - $dashicon_theme = '  '; - - /** - * Filter to return array of overrides to dot org. - * - * @since 8.5.0 - * @return array - */ - $overrides = apply_filters( 'github_updater_override_dot_org', [] ); - - if ( ! empty( $overrides ) ) { - echo '

' . esc_html__( 'Overridden Plugins and Themes', 'github-updater' ) . '

'; - echo '

' . esc_html__( 'The following plugins or themes might exist on wp.org, but any updates will be downloaded from their respective git repositories.', 'github-updater' ) . '

'; - - foreach ( $plugins as $plugin ) { - if ( in_array( $plugin->file, $overrides, true ) ) { - echo '

' . $dashicon_plugin . $plugin->name . '

'; - } - } - foreach ( $themes as $theme ) { - if ( in_array( $theme->slug, $overrides, true ) ) { - echo '

' . $dashicon_theme . $theme->name . '

'; - } - } - echo '
'; - } - } - - /** - * Get the settings option array and print one of its values. - * - * @param array $args - */ - public function token_callback_text( $args ) { - $name = isset( static::$options[ $args['id'] ] ) ? esc_attr( static::$options[ $args['id'] ] ) : ''; - $type = isset( $args['token'] ) ? 'password' : 'text'; - ?> - - - - filter_options(); - update_site_option( 'github_updater', $this->sanitize( $options ) ); - } - - /** - * Save $options in add-on classes. - * - * @since 8.0.0 - */ - do_action( 'github_updater_update_settings', $_POST ); - - $this->redirect_on_save(); - } - - /** - * Filter options to remove unchecked checkbox options. - * - * @access private - * - * @return array|mixed - */ - private function filter_options() { - $options = static::$options; - - // Remove checkbox options, only after background update complete. - if ( ! $this->waiting_for_background_update() ) { - $options = array_filter( - $options, - function ( $e ) { - return '1' !== $e; - } - ); - } - - $options = array_merge( $options, $_POST['github_updater'] ); - - return $options; - } - - /** - * Redirect to correct Settings tab on Save. - */ - protected function redirect_on_save() { - $update = false; - $refresh_transients = $this->refresh_transients(); - $reset_api_key = Singleton::get_instance( 'Remote_Management', $this )->reset_api_key(); - - /** - * Filter to add to $option_page array. - * - * @since 8.0.0 - * @return array - */ - $option_page = apply_filters( 'github_updater_save_redirect', [ 'github_updater' ] ); - - if ( ( isset( $_POST['action'] ) && 'update' === $_POST['action'] ) && - ( isset( $_POST['option_page'] ) && in_array( $_POST['option_page'], $option_page, true ) ) - ) { - $update = true; - } - - $redirect_url = is_multisite() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' ); - - if ( $update || $refresh_transients || $reset_api_key ) { - $query = isset( $_POST['_wp_http_referer'] ) ? parse_url( $_POST['_wp_http_referer'], PHP_URL_QUERY ) : null; - parse_str( $query, $arr ); - $arr['tab'] = ! empty( $arr['tab'] ) ? $arr['tab'] : 'github_updater_settings'; - $arr['subtab'] = ! empty( $arr['subtab'] ) ? $arr['subtab'] : 'github_updater'; - - $location = add_query_arg( - [ - 'page' => 'github-updater', - 'tab' => $arr['tab'], - 'subtab' => $arr['subtab'], - 'refresh_transients' => $refresh_transients, - 'reset' => $reset_api_key, - 'updated' => $update, - ], - $redirect_url - ); - wp_safe_redirect( $location ); - exit; - } - } - - /** - * Clear GitHub Updater transients. - * - * @return bool - */ - private function refresh_transients() { - if ( isset( $_REQUEST['github_updater_refresh_transients'] ) ) { - $_POST = $_REQUEST; - - return true; - } - - return false; - } - - /** - * Add setting link to plugin page. - * Applied to the list of links to display on the plugins page (beside the activate/deactivate links). - * - * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name) - * - * @param array $links - * - * @return array - */ - public function plugin_action_links( $links ) { - $settings_page = is_multisite() ? 'settings.php' : 'options-general.php'; - $link = [ '' . esc_html__( 'Settings', 'github-updater' ) . '' ]; - - return array_merge( $links, $link ); - } - - /** - * Create settings sections that are hidden. - * Required to preserve subtab settings during saves. - * - * @param array $subtab Subtab to display. - */ - private function add_hidden_settings_sections( $subtab = [] ) { - $subtabs = array_keys( $this->settings_sub_tabs() ); - $hide_tabs = array_diff( $subtabs, (array) $subtab, [ 'github_updater' ] ); - if ( ! empty( $subtab ) ) { - echo '
'; - do_settings_sections( 'github_updater_install_settings' ); - echo '
'; - } - foreach ( $hide_tabs as $hide_tab ) { - echo '
'; - do_settings_sections( 'github_updater_' . $hide_tab . '_install_settings' ); - echo '
'; - } - } - - /** - * Write out listing of installed plugins and themes using GitHub Updater. - * Places a lock dashicon after the repo name if it's a private repo. - * Places a WordPress dashicon after the repo name if it's in dot org. - * - * @param string $git (github|bitbucket|bbserver|gitlab|gitea) - */ - private function display_ghu_repos( $git ) { - $lock_title = esc_html__( 'This is a private repository.', 'github-updater' ); - $broken_title = esc_html__( 'This repository has not connected to the API or was unable to connect.', 'github-updater' ); - $dot_org_title = esc_html__( 'This repository is hosted on WordPress.org.', 'github-updater' ); - - $plugins = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $themes = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - $repos = array_merge( $plugins, $themes ); - $bbserver = [ 'bitbucket', 'bbserver' ]; - - $type_repos = array_filter( - $repos, - function ( $e ) use ( $git, $bbserver ) { - if ( ! empty( $e->enterprise ) && in_array( $git, $bbserver, true ) ) { - return false !== stripos( $e->git, 'bitbucket' ) && 'bbserver' === $git; - } - - return false !== stripos( $e->git, $git ); - } - ); - - $display_data = array_map( - function ( $e ) { - return [ - 'type' => $e->type, - 'slug' => $e->slug, - 'file' => isset( $e->file ) ? $e->file : $e->slug, - 'branch' => $e->branch, - 'name' => $e->name, - 'private' => isset( $e->is_private ) ? $e->is_private : false, - 'broken' => ! isset( $e->remote_version ) || '0.0.0' === $e->remote_version, - 'dot_org' => isset( $e->dot_org ) ? $e->dot_org : false, - ]; - }, - $type_repos - ); - - $lock = ' '; - $broken = ' '; - $dot_org = ' '; - printf( '

' . esc_html__( 'Installed Plugins and Themes', 'github-updater' ) . '

' ); - foreach ( $display_data as $data ) { - $dashicon = false !== strpos( $data['type'], 'theme' ) - ? '  ' - : '  '; - $is_private = $data['private'] ? $lock : null; - $is_broken = $data['broken'] ? $broken : null; - $override = $this->override_dot_org( $data['type'], $data ); - $is_dot_org = $data['dot_org'] && ! $override ? $dot_org : null; - printf( '

' . $dashicon . $data['name'] . $is_private . $is_dot_org . $is_broken . '

' ); - } - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Theme.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Theme.php deleted file mode 100644 index e8a33b0..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Theme.php +++ /dev/null @@ -1,676 +0,0 @@ -load_options(); - - // Get details of installed git sourced themes. - $this->config = $this->get_theme_meta(); - - if ( null === $this->config ) { - return; - } - } - - /** - * Returns an array of configurations for the known themes. - * - * @return array - */ - public function get_theme_configs() { - return $this->config; - } - - /** - * Delete cache of current theme. - * This is needed in case `wp_get_theme()` is called in earlier or in a mu-plugin. - * This action results in the extra headers not being added. - * - * @link https://github.com/afragen/github-updater/issues/586 - */ - private function delete_current_theme_cache() { - $cache_hash = md5( get_stylesheet_directory() ); - wp_cache_delete( 'theme-' . $cache_hash, 'themes' ); - } - - /** - * Reads in WP_Theme class of each theme. - * Populates variable array. - * - * @return array Indexed array of associative arrays of theme details. - */ - protected function get_theme_meta() { - $this->delete_current_theme_cache(); - $git_themes = []; - $themes = wp_get_themes( [ 'errors' => null ] ); - - /** - * Filter to add themes not containing appropriate header line. - * - * @since 5.4.0 - * @access public - * - * @param array $additions Listing of themes to add. - * Default null. - * @param array $themes Listing of all themes. - * @param string 'theme' Type being passed. - */ - $additions = apply_filters( 'github_updater_additions', null, $themes, 'theme' ); - - foreach ( (array) $themes as $theme ) { - $git_theme = []; - - foreach ( (array) static::$extra_headers as $value ) { - $header = null; - $repo_uri = $theme->get( $value ); - - /** - * Get $repo_uri from themes added to GitHub Updater via hook. - */ - foreach ( (array) $additions as $addition ) { - if ( $theme->stylesheet === $addition['slug'] ) { - if ( ! empty( $addition[ $value ] ) ) { - $repo_uri = $addition[ $value ]; - break; - } - } - } - - if ( empty( $repo_uri ) || false === stripos( $value, 'Theme' ) ) { - continue; - } - - $header_parts = explode( ' ', $value ); - $repo_parts = $this->get_repo_parts( $header_parts[0], 'theme' ); - - if ( $repo_parts['bool'] ) { - $header = $this->parse_header_uri( $repo_uri ); - if ( empty( $header ) || $theme->stylesheet !== $header['repo'] ) { - continue; - } - } - - $header = $this->parse_extra_headers( $header, $theme, $header_parts, $repo_parts ); - $current_branch = "current_branch_{$header['repo']}"; - $branch = isset( static::$options[ $current_branch ] ) - ? static::$options[ $current_branch ] - : false; - - $git_theme['type'] = 'theme'; - $git_theme['git'] = $repo_parts['git_server']; - $git_theme['uri'] = "{$header['base_uri']}/{$header['owner_repo']}"; - $git_theme['enterprise'] = $header['enterprise_uri']; - $git_theme['enterprise_api'] = $header['enterprise_api']; - $git_theme['owner'] = $header['owner']; - $git_theme['slug'] = $header['repo']; - $git_theme['file'] = "{$header['repo']}/style.css"; - $git_theme['name'] = $theme->get( 'Name' ); - $git_theme['theme_uri'] = $theme->get( 'ThemeURI' ); - $git_theme['homepage'] = $theme->get( 'ThemeURI' ); - $git_theme['author'] = $theme->get( 'Author' ); - $git_theme['local_version'] = strtolower( $theme->get( 'Version' ) ); - $git_theme['sections']['description'] = $theme->get( 'Description' ); - $git_theme['local_path'] = get_theme_root() . '/' . $git_theme['slug'] . '/'; - $git_theme['branch'] = $branch ?: 'master'; - $git_theme['languages'] = $header['languages']; - $git_theme['ci_job'] = $header['ci_job']; - $git_theme['release_asset'] = $header['release_asset']; - $git_theme['broken'] = ( empty( $header['owner'] ) || empty( $header['repo'] ) ); - - break; - } - - // Exit if not git hosted theme. - if ( empty( $git_theme ) ) { - continue; - } - - $git_themes[ $git_theme['slug'] ] = (object) $git_theme; - } - - return $git_themes; - } - - /** - * Get remote theme meta to populate $config theme objects. - * Calls to remote APIs to get data. - */ - public function get_remote_theme_meta() { - $themes = []; - foreach ( (array) $this->config as $theme ) { - /** - * Filter to set if WP-Cron is disabled or if user wants to return to old way. - * - * @since 7.4.0 - * @access public - * - * @param bool - */ - if ( ! $this->waiting_for_background_update( $theme ) || static::is_wp_cli() - || apply_filters( 'github_updater_disable_wpcron', false ) - ) { - $this->get_remote_repo_meta( $theme ); - } else { - $themes[ $theme->slug ] = $theme; - } - - /* - * Add update row to theme row, only in multisite. - */ - if ( is_multisite() ) { - add_action( 'after_theme_row', [ $this, 'remove_after_theme_row' ], 10, 2 ); - if ( ! $this->tag ) { - add_action( "after_theme_row_{$theme->slug}", [ $this, 'wp_theme_update_row' ], 10, 2 ); - if ( ! $theme->release_asset ) { - add_action( "after_theme_row_{$theme->slug}", [ $this, 'multisite_branch_switcher' ], 15, 2 ); - } - } - } - } - - $schedule_event = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? is_main_site() : true; - - if ( $schedule_event ) { - if ( ! wp_next_scheduled( 'ghu_get_remote_theme' ) && - ! $this->is_duplicate_wp_cron_event( 'ghu_get_remote_theme' ) && - ! apply_filters( 'github_updater_disable_wpcron', false ) - ) { - wp_schedule_single_event( time(), 'ghu_get_remote_theme', [ $themes ] ); - } - } - - if ( ! static::is_wp_cli() ) { - $this->load_pre_filters(); - } - } - - /** - * Load pre-update filters. - */ - public function load_pre_filters() { - if ( ! is_multisite() ) { - add_filter( 'wp_prepare_themes_for_js', [ $this, 'customize_theme_update_html' ] ); - } - add_filter( 'themes_api', [ $this, 'themes_api' ], 99, 3 ); - add_filter( 'site_transient_update_themes', [ $this, 'update_site_transient' ], 15, 1 ); - } - - /** - * Put changelog in themes_api, return WP.org data as appropriate. - * - * @param bool $false - * @param string $action - * @param \stdClass $response - * - * @return mixed - */ - public function themes_api( $false, $action, $response ) { - if ( ! ( 'theme_information' === $action ) ) { - return $false; - } - - $theme = isset( $this->config[ $response->slug ] ) ? $this->config[ $response->slug ] : false; - - // Skip if waiting for background update. - if ( $this->waiting_for_background_update( $theme ) ) { - return $false; - } - - // wp.org theme. - if ( ! $theme ) { - return $false; - } - - $response->slug = $theme->slug; - $response->name = $theme->name; - $response->homepage = $theme->homepage; - $response->donate_link = $theme->donate_link; - $response->version = $theme->remote_version; - $response->sections = $theme->sections; - $response->description = implode( "\n", $theme->sections ); - $response->author = $theme->author; - $response->preview_url = $theme->theme_uri; - $response->requires = $theme->requires; - $response->tested = $theme->tested; - $response->downloaded = $theme->downloaded; - $response->last_updated = $theme->last_updated; - $response->rating = $theme->rating; - $response->num_ratings = $theme->num_ratings; - - return $response; - } - - /** - * Add custom theme update row, from /wp-admin/includes/update.php - * Display update details or rollback links for multisite installation. - * - * @param string $theme_key - * @param array $theme - * - * @author Seth Carstens - */ - public function wp_theme_update_row( $theme_key, $theme ) { - $current = get_site_transient( 'update_themes' ); - - $themes_allowedtags = [ - 'a' => [ - 'href' => [], - 'title' => [], - ], - 'abbr' => [ 'title' => [] ], - 'acronym' => [ 'title' => [] ], - 'code' => [], - 'em' => [], - 'strong' => [], - ]; - $theme_name = wp_kses( $theme['Name'], $themes_allowedtags ); - // $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); - $details_url = esc_attr( - add_query_arg( - [ - 'tab' => 'theme-information', - 'theme' => $theme_key, - 'TB_iframe' => 'true', - 'width' => 270, - 'height' => 400, - ], - self_admin_url( 'theme-install.php' ) - ) - ); - $nonced_update_url = wp_nonce_url( - $this->get_update_url( 'theme', 'upgrade-theme', $theme_key ), - 'upgrade-theme_' . $theme_key - ); - $enclosure = $this->update_row_enclosure( $theme_key, 'theme' ); - - if ( isset( $current->response[ $theme_key ] ) ) { - $response = $current->response[ $theme_key ]; - echo $enclosure['open']; - - printf( - /* translators: %s: theme name */ - esc_html__( 'There is a new version of %s available.', 'github-updater' ), - $theme_name - ); - printf( - /* translators: %s: details URL, theme name */ - ' ', - $details_url, - $theme_name - ); - if ( empty( $response['package'] ) ) { - printf( - /* translators: %s: theme version */ - esc_html__( 'View version %s details.', 'github-updater' ), - $response['new_version'] - ); - echo ' '; - esc_html_e( 'Automatic update is unavailable for this theme.', 'github-updater' ); - echo ''; - } else { - printf( - /* translators: 1: version number, 2: closing anchor tag, 3: update URL */ - esc_html__( 'View version %1$s details%2$s or %3$supdate now%2$s.', 'github-updater' ), - $response['new_version'], - '', - sprintf( - /* translators: %s: theme name */ - '', - $theme_name - ) - ); - } - echo $enclosure['close']; - - do_action( "in_theme_update_message-$theme_key", $theme, $response ); - } - } - - /** - * Create branch switcher row for multisite installation. - * - * @param string $theme_key - * @param array $theme - * - * @return bool - */ - public function multisite_branch_switcher( $theme_key, $theme ) { - if ( empty( static::$options['branch_switch'] ) ) { - return false; - } - - $enclosure = $this->update_row_enclosure( $theme_key, 'theme', true ); - $id = $theme_key . '-id'; - $branches = isset( $this->config[ $theme_key ]->branches ) - ? $this->config[ $theme_key ]->branches - : null; - $nonced_update_url = wp_nonce_url( - $this->get_update_url( 'theme', 'upgrade-theme', $theme_key ), - 'upgrade-theme_' . $theme_key - ); - - // Get current branch. - $repo = $this->config[ $theme_key ]; - $branch = Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ); - - $branch_switch_data = []; - $branch_switch_data['slug'] = $theme_key; - $branch_switch_data['nonced_update_url'] = $nonced_update_url; - $branch_switch_data['id'] = $id; - $branch_switch_data['branch'] = $branch; - $branch_switch_data['branches'] = $branches; - - /* - * Create after_theme_row_ - */ - echo $enclosure['open']; - $this->make_branch_switch_row( $branch_switch_data ); - echo $enclosure['close']; - - return true; - } - - /** - * Remove default after_theme_row_$stylesheet. - * - * @author @grappler - * - * @param string $theme_key - * @param array $theme - */ - public function remove_after_theme_row( $theme_key, $theme ) { - $themes = $this->get_theme_configs(); - - foreach ( static::$git_servers as $server ) { - $repo_header = $server . ' Theme URI'; - $repo_uri = $theme->get( $repo_header ); - - /** - * Filter to add themes not containing appropriate header line. - * - * @since 5.4.0 - * @access public - * - * @param array $additions Listing of themes to add. - * Default null. - * @param array $themes Listing of all themes. - * @param string 'theme' Type being passed. - */ - $additions = apply_filters( 'github_updater_additions', null, $themes, 'theme' ); - foreach ( (array) $additions as $addition ) { - if ( $theme_key === $addition['slug'] ) { - if ( ! empty( $addition[ $server . ' Theme URI' ] ) ) { - $repo_uri = $addition[ $server . ' Theme URI' ]; - break; - } - } - } - if ( empty( $repo_uri ) ) { - continue; - } - break; - } - if ( array_key_exists( $theme_key, $themes ) ) { - remove_action( "after_theme_row_$theme_key", 'wp_theme_update_row' ); - } - } - - /** - * Call theme messaging for single site installation. - * - * @author Seth Carstens - * - * @param array $prepared_themes - * - * @return mixed - */ - public function customize_theme_update_html( $prepared_themes ) { - foreach ( (array) $this->config as $theme ) { - if ( empty( $prepared_themes[ $theme->slug ] ) ) { - continue; - } - - if ( ! empty( $prepared_themes[ $theme->slug ]['hasUpdate'] ) ) { - $prepared_themes[ $theme->slug ]['update'] = $this->append_theme_actions_content( $theme ); - } else { - $prepared_themes[ $theme->slug ]['description'] .= $this->append_theme_actions_content( $theme ); - } - if ( ! $theme->release_asset ) { - $prepared_themes[ $theme->slug ]['description'] .= $this->single_install_switcher( $theme ); - } - } - - return $prepared_themes; - } - - /** - * Create theme update messaging for single site installation. - * - * @author Seth Carstens - * - * @access protected - * - * @param \stdClass $theme - * - * @return string (content buffer) - */ - protected function append_theme_actions_content( $theme ) { - $details_url = esc_attr( - add_query_arg( - [ - 'tab' => 'theme-information', - 'theme' => $theme->slug, - 'TB_iframe' => 'true', - 'width' => 270, - 'height' => 400, - ], - self_admin_url( 'theme-install.php' ) - ) - ); - $nonced_update_url = wp_nonce_url( - $this->get_update_url( 'theme', 'upgrade-theme', $theme->slug ), - 'upgrade-theme_' . $theme->slug - ); - - $current = get_site_transient( 'update_themes' ); - - /** - * Display theme update links. - */ - ob_start(); - if ( isset( $current->response[ $theme->slug ] ) ) { - ?> -

- - name - ); - printf( - ' ', - $details_url, - esc_attr( $theme->name ) - ); - printf( - /* translators: 1: version number, 2: closing anchor tag, 3: update URL */ - esc_html__( 'View version %1$s details%2$s or %3$supdate now%2$s.', 'github-updater' ), - $theme->remote_version = isset( $theme->remote_version ) ? $theme->remote_version : null, - '', - sprintf( - /* translators: %s: theme name */ - '', - $theme->name - ) - ); - ?> - -

- get_update_url( 'theme', 'upgrade-theme', $theme->slug ), - 'upgrade-theme_' . $theme->slug - ); - $rollback_url = sprintf( '%s%s', $nonced_update_url, '&rollback=' ); - - if ( ! isset( static::$options['branch_switch'] ) ) { - return; - } - - ob_start(); - if ( '1' === static::$options['branch_switch'] ) { - printf( - /* translators: 1: branch name, 2: jQuery dropdown, 3: closing tag */ - '

' . esc_html__( 'Current branch is `%1$s`, try %2$sanother version%3$s', 'github-updater' ), - $theme->branch, - '', - '.

' - ); - ?> - - config as $theme ) { - if ( $this->can_update_repo( $theme ) ) { - $response = [ - 'theme' => $theme->slug, - 'new_version' => $theme->remote_version, - 'url' => $theme->uri, - 'package' => $theme->download_link, - 'branch' => $theme->branch, - 'branches' => array_keys( $theme->branches ), - 'type' => "{$theme->git}-{$theme->type}", - ]; - - // Skip on RESTful updating. - if ( isset( $_GET['action'], $_GET['theme'] ) && - 'github-updater-update' === $_GET['action'] && - $response['theme'] === $_GET['theme'] - ) { - continue; - } - - // Pull update from dot org if not overriding. - if ( ! $this->override_dot_org( 'theme', $theme ) ) { - continue; - } - - $transient->response[ $theme->slug ] = $response; - } else { - /** - * Filter to return array of overrides to dot org. - * - * @since 8.5.0 - * @return array - */ - $overrides = apply_filters( 'github_updater_override_dot_org', [] ); - if ( isset( $transient->response[ $theme->slug ] ) && in_array( $theme->slug, $overrides, true ) ) { - unset( $transient->response[ $theme->slug ] ); - } - } - - // Set transient for rollback. - if ( isset( $_GET['theme'], $_GET['rollback'] ) && $theme->slug === $_GET['theme'] - ) { - $transient->response[ $theme->slug ] = $this->set_rollback_transient( 'theme', $theme ); - } - } - - return $transient; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/API_Common.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/API_Common.php deleted file mode 100644 index 6e0d7df..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/API_Common.php +++ /dev/null @@ -1,368 +0,0 @@ -content ) ? base64_decode( $response->content ) : $response; - break; - case 'bbserver': - $response = isset( $response->lines ) ? $this->bbserver_recombine_response( $response ) : $response; - break; - } - - return $response; - } - - /** - * Parse API response that returns as stdClass. - * - * @param string $git (github|bitbucket|gitlab|gitea) - * @param mixed $response API response. - * @return mixed $response - */ - private function parse_response( $git, $response ) { - switch ( $git ) { - case 'bitbucket': - case 'bbserver': - $response = isset( $response->values ) ? $response->values : $response; - break; - } - - return $response; - } - - /** - * Parse API response to release asset URI. - * - * @param string $git (github|bitbucket|gitlab|gitea) - * @param string $request Query to API->api(). - * @param mixed $response API response. - * @return string $response Release asset download link. - */ - private function parse_release_asset( $git, $request, $response ) { - switch ( $git ) { - case 'github': - $download_link = isset( $response->assets[0] ) && ! is_wp_error( $response ) ? $response->assets[0]->browser_download_url : null; - - // Private repo. - $response = ( null !== $download_link && ( property_exists( $this->type, 'is_private' ) && $this->type->is_private ) ) ? $response->assets[0]->url : $download_link; - break; - case 'bitbucket': - $download_base = $this->get_api_url( $request, true ); - $response = isset( $response->values[0] ) && ! is_wp_error( $response ) ? $download_base . '/' . $response->values[0]->name : null; - break; - case 'bbserver': - // TODO: make work. - break; - case 'gitlab': - $response = $this->get_api_url( $request ); - break; - case 'gitea': - break; - } - - return $response; - } - - /** - * Read the remote file and parse headers. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $file Filename. - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_info( $git, $file, $request ) { - $response = isset( $this->response[ $file ] ) ? $this->response[ $file ] : false; - - if ( ! $response ) { - self::$method = 'file'; - $response = $this->api( $request ); - $response = $this->decode_response( $git, $response ); - } - - if ( $response && is_string( $response ) && ! is_wp_error( $response ) ) { - $response = $this->get_file_headers( $response, $this->type->type ); - $this->set_repo_cache( $file, $response ); - $this->set_repo_cache( 'repo', $this->type->slug ); - } - - if ( ! is_array( $response ) || $this->validate_response( $response ) ) { - return false; - } - - $response['dot_org'] = $this->get_dot_org_data(); - $this->set_file_info( $response ); - - return true; - } - - /** - * Get remote info for tags. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_tag( $git, $request ) { - $repo_type = $this->return_repo_type(); - $response = isset( $this->response['tags'] ) ? $this->response['tags'] : false; - - if ( ! $response ) { - self::$method = 'tags'; - $response = $this->api( $request ); - - if ( ! $response ) { - $response = new \stdClass(); - $response->message = 'No tags found'; - } - - if ( $response ) { - $response = $this->parse_tag_response( $response ); - $this->set_repo_cache( 'tags', $response ); - } - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - $tags = $this->parse_tags( $response, $repo_type ); - $this->sort_tags( $tags ); - - return true; - } - - /** - * Read the remote CHANGES.md file. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $changes Changelog filename. - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_changes( $git, $changes, $request ) { - $response = isset( $this->response['changes'] ) ? $this->response['changes'] : false; - - // Set $response from local file if no update available. - if ( ! $response && ! $this->can_update_repo( $this->type ) ) { - $response = $this->get_local_info( $this->type, $changes ); - } - - if ( ! $response ) { - self::$method = 'changes'; - $response = $this->api( $request ); - $response = $this->decode_response( $git, $response ); - } - - if ( ! $response && ! is_wp_error( $response ) ) { - $response = new \stdClass(); - $response->message = 'No changelog found'; - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - if ( $response && ! isset( $this->response['changes'] ) ) { - $parser = new \Parsedown(); - $response = $parser->text( $response ); - $this->set_repo_cache( 'changes', $response ); - } - - $this->type->sections['changelog'] = $response; - - return true; - } - - /** - * Read and parse remote readme.txt. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_readme( $git, $request ) { - if ( ! $this->local_file_exists( 'readme.txt' ) ) { - return false; - } - - $response = isset( $this->response['readme'] ) ? $this->response['readme'] : false; - - // Set $response from local file if no update available. - if ( ! $response && ! $this->can_update_repo( $this->type ) ) { - $response = $this->get_local_info( $this->type, 'readme.txt' ); - } - - if ( ! $response ) { - self::$method = 'readme'; - $response = $this->api( $request ); - $response = $this->decode_response( $git, $response ); - } - - if ( ! $response && ! is_wp_error( $response ) ) { - $response = new \stdClass(); - $response->message = 'No readme found'; - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - if ( $response && ! isset( $this->response['readme'] ) ) { - $parser = new Readme_Parser( $response ); - $response = $parser->parse_data(); - $this->set_repo_cache( 'readme', $response ); - } - - $this->set_readme_info( $response ); - - return true; - } - - /** - * Read the repository meta from API. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_repo_meta( $git, $request ) { - $response = isset( $this->response['meta'] ) ? $this->response['meta'] : false; - - if ( ! $response ) { - self::$method = 'meta'; - $response = $this->api( $request ); - - if ( $response ) { - $response = $this->parse_meta_response( $response ); - $this->set_repo_cache( 'meta', $response ); - } - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - $this->type->repo_meta = $response; - $this->add_meta_repo_object(); - - return true; - } - - /** - * Create array of branches and download links as array. - * - * @param string $git github|bitbucket|gitlab|gitea) - * @param string $request API request. - * - * @return bool - */ - public function get_remote_api_branches( $git, $request ) { - $branches = []; - $response = isset( $this->response['branches'] ) ? $this->response['branches'] : false; - - if ( $this->exit_no_update( $response, true ) ) { - return false; - } - - if ( ! $response ) { - self::$method = 'branches'; - $response = $this->api( $request ); - $response = $this->parse_response( $git, $response ); - - if ( $this->validate_response( $response ) ) { - return false; - } - - if ( $response ) { - $branches = $this->parse_branch_response( $response ); - $this->type->branches = $branches; - $this->set_repo_cache( 'branches', $branches ); - - return true; - } - } - - $this->type->branches = $response; - - return true; - } - - /** - * Get API release asset download link. - * - * @param string $git (github|bitbucket|gitlab|gitea) - * @param string $request Query for API->api(). - * @return string $response Release asset URI. - */ - public function get_api_release_asset( $git, $request ) { - $response = isset( $this->response['release_asset'] ) ? $this->response['release_asset'] : false; - - if ( $response && $this->exit_no_update( $response ) ) { - return false; - } - - if ( ! $response ) { - add_filter( 'http_request_args', [ Singleton::get_instance( 'API', $this ), 'http_release_asset_auth' ], 15, 2 ); - self::$method = 'release_asset'; - $response = $this->api( $request ); - $response = $this->parse_release_asset( $git, $request, $response ); - - if ( ! $response && ! is_wp_error( $response ) ) { - $response = new \stdClass(); - $response->message = 'No release asset found'; - } - remove_filter( 'http_request_args', [ Singleton::get_instance( 'API', $this ), 'http_release_asset_auth' ] ); - } - - if ( $response && ! isset( $this->response['release_asset'] ) ) { - $this->set_repo_cache( 'release_asset', $response ); - } - - if ( $this->validate_response( $response ) ) { - return false; - } - - return $response; - } - -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/Basic_Auth_Loader.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/Basic_Auth_Loader.php deleted file mode 100644 index 27b1c21..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/Basic_Auth_Loader.php +++ /dev/null @@ -1,320 +0,0 @@ -get_credentials( $url ); - - if ( $credentials['private'] && $credentials['isset'] && ! $credentials['api.wordpress'] ) { - $username = $credentials['username']; - $password = $credentials['password']; - - $args['headers']['Authorization'] = 'Basic ' . base64_encode( "$username:$password" ); - } - remove_filter( 'http_request_args', [ $this, 'maybe_basic_authenticate_http' ] ); - - return $args; - } - - /** - * Get credentials (username/password) for Basic Authentication. - * - * @access private - * - * @param string $url The URL. - * - * @return array $credentials - */ - private function get_credentials( $url ) { - $headers = parse_url( $url ); - $username_key = null; - $password_key = null; - $credentials = [ - 'username' => null, - 'password' => null, - 'api.wordpress' => 'api.wordpress.org' === $headers['host'], - 'isset' => false, - 'private' => false, - ]; - $hosts = [ 'bitbucket.org', 'api.bitbucket.org' ]; - - $repos = array_merge( - Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(), - Singleton::get_instance( 'Theme', $this )->get_theme_configs() - ); - - $slug = $this->get_slug_for_credentials( $headers, $repos, $url ); - $type = $this->get_type_for_credentials( $slug, $repos, $url ); - - switch ( $type ) { - case 'bitbucket': - case $type instanceof Bitbucket_API: - case $type instanceof Bitbucket_Server_API: - $bitbucket_org = in_array( $headers['host'], $hosts, true ); - $username_key = $bitbucket_org ? 'bitbucket_username' : 'bitbucket_server_username'; - $password_key = $bitbucket_org ? 'bitbucket_password' : 'bitbucket_server_password'; - break; - } - - // TODO: can use `( $this->caller )::$options` in PHP7. - $caller = $this->get_class_vars( 'Base', 'caller' ); - static::$options = $caller instanceof Install ? $caller::$options : static::$options; - - if ( isset( static::$options[ $username_key ], static::$options[ $password_key ] ) ) { - $credentials['username'] = static::$options[ $username_key ]; - $credentials['password'] = static::$options[ $password_key ]; - $credentials['isset'] = true; - $credentials['private'] = $this->is_repo_private( $url ); - } - - return $credentials; - } - - /** - * Get $slug for Basic Auth credentials. - * - * @param array $headers Array of headers from parse_url(). - * @param array $repos Array of repositories. - * @param string $url URL being called by API. - * - * @return bool|string $slug - */ - private function get_slug_for_credentials( $headers, $repos, $url ) { - $slug = isset( $_REQUEST['slug'] ) ? $_REQUEST['slug'] : false; - $slug = ! $slug && isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : $slug; - $slug = ! $slug && isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : $slug; - - // Set for bulk upgrade. - if ( ! $slug ) { - $plugins = isset( $_REQUEST['plugins'] ) - ? array_map( 'dirname', explode( ',', $_REQUEST['plugins'] ) ) - : []; - $themes = isset( $_REQUEST['themes'] ) - ? explode( ',', $_REQUEST['themes'] ) - : []; - $bulk_update = array_merge( $plugins, $themes ); - if ( ! empty( $bulk_update ) ) { - $slug = array_filter( - $bulk_update, - function ( $e ) use ( $url ) { - return false !== strpos( $url, $e ); - } - ); - $slug = array_pop( $slug ); - } - } - - // In case $type set from Base::$caller doesn't match. - if ( ! $slug && isset( $headers['path'] ) ) { - $path_arr = explode( '/', $headers['path'] ); - foreach ( $path_arr as $key ) { - if ( array_key_exists( $key, $repos ) ) { - $slug = $key; - break; - } - } - } - - return $slug; - } - - /** - * Get repo type for Basic Auth credentials. - * - * @param string $slug Repository slug. - * @param array $repos Array of repositories. - * @param string $url URL being called by API. - * - * @return string $slug - */ - private function get_type_for_credentials( $slug, $repos, $url ) { - $type = $this->get_class_vars( 'Base', 'caller' ); - - $type = $slug && isset( $repos[ $slug ] ) && property_exists( $repos[ $slug ], 'git' ) - ? $repos[ $slug ]->git - : $type; - - // Set for WP-CLI. - if ( ! $slug ) { - foreach ( $repos as $repo ) { - if ( property_exists( $repo, 'download_link' ) && $url === $repo->download_link ) { - $type = $repo->git; - break; - } - } - } - - // Set for Remote Install. - $type = isset( $_POST['github_updater_api'], $_POST['github_updater_repo'] ) && - false !== strpos( $url, basename( $_POST['github_updater_repo'] ) ) - ? $_POST['github_updater_api'] - : $type; - - return $type; - } - - /** - * Determine if repo is private. - * - * @access private - * - * @param string $url The URL. - * - * @return bool true if private - */ - private function is_repo_private( $url ) { - // Used when updating. - $slug = isset( $_REQUEST['rollback'], $_REQUEST['plugin'] ) ? dirname( $_REQUEST['plugin'] ) : false; - $slug = isset( $_REQUEST['rollback'], $_REQUEST['theme'] ) ? $_REQUEST['theme'] : $slug; - $slug = isset( $_REQUEST['slug'] ) ? $_REQUEST['slug'] : $slug; - - if ( $slug && array_key_exists( $slug, static::$options ) && - 1 === (int) static::$options[ $slug ] && - false !== stripos( $url, $slug ) - ) { - return true; - } - - // Used for remote install tab. - if ( isset( $_POST['option_page'], $_POST['is_private'] ) && - 'github_updater_install' === $_POST['option_page'] - ) { - return true; - } - - // Used for refreshing cache. - foreach ( array_keys( static::$options ) as $option ) { - if ( 1 === (int) static::$options[ $option ] && - false !== strpos( $url, $option ) - ) { - return true; - } - } - - return false; - } - - /** - * Removes Basic Authentication header for Bitbucket Release Assets. - * Storage in AmazonS3 buckets, uses Query String Request Authentication Alternative. - * - * @access public - * @link http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationQueryStringAuth - * - * @param array $args The URL arguments passed. - * @param string $url The URL. - * - * @return array $args - */ - public function http_release_asset_auth( $args, $url ) { - $arr_url = parse_url( $url ); - if ( isset( $arr_url['host'] ) && 'bbuseruploads.s3.amazonaws.com' === $arr_url['host'] ) { - unset( $args['headers']['Authorization'] ); - } - remove_filter( 'http_request_args', [ $this, 'http_release_asset_auth' ] ); - - return $args; - } - - /** - * Loads authentication hooks when updating from update-core.php. - * - * @param bool $reply - * @param string $package Update package URL, unused. - * @param \Plugin_Upgrader|\Theme_Upgrader $class Upgrader object. - * - * @return mixed - */ - public function upgrader_pre_download( $reply, $package, $class ) { - if ( $class instanceof \Plugin_Upgrader && - property_exists( $class->skin, 'plugin_info' ) - ) { - $headers = $class->skin->plugin_info; - foreach ( self::$basic_auth_required as $git_server ) { - $ghu_header = $headers[ $git_server . ' Plugin URI' ]; - if ( ! empty( $ghu_header ) ) { - $this->load_authentication_hooks(); - break; - } - } - } - if ( $class instanceof \Theme_Upgrader && - property_exists( $class->skin, 'theme_info' ) - ) { - $theme = $class->skin->theme_info; - foreach ( self::$basic_auth_required as $git_server ) { - $ghu_header = $theme->get( $git_server . ' Theme URI' ); - if ( ! empty( $ghu_header ) ) { - $this->load_authentication_hooks(); - break; - } - } - } - $this->remove_authentication_hooks(); - remove_filter( 'upgrader_pre_download', [ $this, 'upgrader_pre_download' ] ); - - return $reply; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/GHU_Trait.php b/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/GHU_Trait.php deleted file mode 100644 index 3549c9b..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/Traits/GHU_Trait.php +++ /dev/null @@ -1,420 +0,0 @@ -type->slug ) ? $this->type->slug : 'ghu'; - } - $cache_key = 'ghu-' . md5( $repo ); - $cache = get_site_option( $cache_key ); - - if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { - return false; - } - - return $cache; - } - - /** - * Sets repo data for cache in site option. - * - * @access protected - * - * @param string $id Data Identifier. - * @param mixed $response Data to be stored. - * @param string|bool $repo Repo name or false. - * @param string|bool $timeout Timeout for cache. - * Default is $hours (12 hours). - * - * @return bool - */ - public function set_repo_cache( $id, $response, $repo = false, $timeout = false ) { - if ( is_wp_error( $response ) ) { - return false; - } - $hours = $this->get_class_vars( 'API', 'hours' ); - if ( ! $repo ) { - $repo = isset( $this->type->slug ) ? $this->type->slug : 'ghu'; - } - $cache_key = 'ghu-' . md5( $repo ); - $timeout = $timeout ? $timeout : '+' . $hours . ' hours'; - - /** - * Allow filtering of cache timeout for repo information. - * - * @since 8.7.1 - * - * @param string $timeout Timeout value used with strtotime(). - * @param string $id Data Identifier. - * @param mixed $response Data to be stored. - * @param string|bool $repo Repo name or false. - */ - $timeout = apply_filters( 'github_updater_repo_cache_timeout', $timeout, $id, $response, $repo ); - - $this->response['timeout'] = strtotime( $timeout ); - $this->response[ $id ] = $response; - - update_site_option( $cache_key, $this->response ); - - return true; - } - - /** - * Getter for class variables. - * - * @param string $class_name Name of class. - * @param string $var Name of variable. - * - * @return mixed - */ - public function get_class_vars( $class_name, $var ) { - $class = Singleton::get_instance( $class_name, $this ); - $reflection_obj = new \ReflectionObject( $class ); - if ( ! $reflection_obj->hasProperty( $var ) ) { - return false; - } - $property = $reflection_obj->getProperty( $var ); - $property->setAccessible( true ); - - return $property->getValue( $class ); - } - - /** - * Returns static class variable $error_code. - * - * @return array self::$error_code - */ - public function get_error_codes() { - return $this->get_class_vars( 'API', 'error_code' ); - } - - /** - * Function to check if plugin or theme object is able to be updated. - * - * @param \stdClass $type - * - * @return bool - */ - public function can_update_repo( $type ) { - $wp_version = get_bloginfo( 'version' ); - - $wp_version_ok = ! empty( $type->requires ) - ? version_compare( $wp_version, $type->requires, '>=' ) - : true; - $php_version_ok = ! empty( $type->requires_php ) - ? version_compare( phpversion(), $type->requires_php, '>=' ) - : true; - $remote_is_newer = isset( $type->remote_version ) - ? version_compare( $type->remote_version, $type->local_version, '>' ) - : false; - - /** - * Filter $remote_is_newer if you use another method to test for updates. - * - * @since 8.7.0 - * @param bool $remote_is_newer - * @param \stdClass $type Plugin/Theme data. - */ - $remote_is_newer = apply_filters( 'github_updater_remote_is_newer', $remote_is_newer, $type ); - - return $remote_is_newer && $wp_version_ok && $php_version_ok; - } - - /** - * Delete all `ghu-` prefixed data from options table. - * - * @return bool - */ - public function delete_all_cached_data() { - global $wpdb; - - $table = is_multisite() ? $wpdb->base_prefix . 'sitemeta' : $wpdb->base_prefix . 'options'; - $column = is_multisite() ? 'meta_key' : 'option_name'; - $delete_string = 'DELETE FROM ' . $table . ' WHERE ' . $column . ' LIKE %s LIMIT 1000'; - - $wpdb->query( $wpdb->prepare( $delete_string, [ '%ghu-%' ] ) ); - - wp_cron(); - - return true; - } - - /** - * Is this a private repo with a token/checked or needing token/checked? - * Test for whether remote_version is set ( default = 0.0.0 ) or - * a repo option is set/not empty. - * - * @param \stdClass $repo - * - * @return bool - */ - public function is_private( $repo ) { - if ( ! isset( $repo->remote_version ) && ! self::is_doing_ajax() ) { - return true; - } - if ( isset( $repo->remote_version ) && ! self::is_doing_ajax() ) { - return ( '0.0.0' === $repo->remote_version ) || ! empty( self::$options[ $repo->slug ] ); - } - - return false; - } - - /** - * Do we override dot org updates? - * - * @param string $type (plugin|theme) - * @param \stdClass $repo Repository object. - * - * @return bool - */ - public function override_dot_org( $type, $repo ) { - // Correctly account for dashicon in Settings page. - $icon = is_array( $repo ); - $repo = is_array( $repo ) ? (object) $repo : $repo; - $dot_org_master = ! $icon ? $repo->dot_org && 'master' === $repo->branch : true; - - $transient_key = 'plugin' === $type ? $repo->file : null; - $transient_key = 'theme' === $type ? $repo->slug : $transient_key; - - /** - * Filter update to override dot org. - * - * @since 8.5.0 - * - * @return bool - */ - $override = in_array( $transient_key, apply_filters( 'github_updater_override_dot_org', [] ), true ); - - return ! $dot_org_master || $override || $this->deprecate_override_constant(); - } - - /** - * Deprecated dot org override constant. - * - * @return bool - */ - public function deprecate_override_constant() { - if ( defined( 'GITHUB_UPDATER_OVERRIDE_DOT_ORG' ) && GITHUB_UPDATER_OVERRIDE_DOT_ORG ) { - error_log( 'GITHUB_UPDATER_OVERRIDE_DOT_ORG constant deprecated. Use `github_updater_override_dot_org` filter hook.' ); - return true; - } - return false; - } - - /** - * Sanitize each setting field as needed. - * - * @param array $input Contains all settings fields as array keys. - * - * @return array - */ - public function sanitize( $input ) { - $new_input = []; - foreach ( array_keys( (array) $input ) as $id ) { - $new_input[ sanitize_file_name( $id ) ] = sanitize_text_field( $input[ $id ] ); - } - - return $new_input; - } - - /** - * Return an array of the running git servers. - * - * @access public - * @return array $gits - */ - public function get_running_git_servers() { - $plugins = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs(); - $themes = Singleton::get_instance( 'Theme', $this )->get_theme_configs(); - - $repos = array_merge( $plugins, $themes ); - $gits = array_map( - function ( $e ) { - if ( ! empty( $e->enterprise ) ) { - if ( 'bitbucket' === $e->git ) { - return 'bbserver'; - } - if ( 'gitlab' === $e->git ) { - return 'gitlabce'; - } - } - - return $e->git; - }, - $repos - ); - - return array_unique( array_values( $gits ) ); - } - - /** - * Parse URI param returning array of parts. - * - * @param string $repo_header - * - * @return array $header - */ - protected function parse_header_uri( $repo_header ) { - $header_parts = parse_url( $repo_header ); - $header_path = pathinfo( $header_parts['path'] ); - $header['original'] = $repo_header; - $header['scheme'] = isset( $header_parts['scheme'] ) ? $header_parts['scheme'] : null; - $header['host'] = isset( $header_parts['host'] ) ? $header_parts['host'] : null; - $header['owner'] = trim( $header_path['dirname'], '/' ); - $header['repo'] = $header_path['filename']; - $header['owner_repo'] = implode( '/', [ $header['owner'], $header['repo'] ] ); - $header['base_uri'] = str_replace( $header_parts['path'], '', $repo_header ); - $header['uri'] = isset( $header['scheme'] ) ? trim( $repo_header, '/' ) : null; - - $header = $this->sanitize( $header ); - - return $header; - } - - /** - * Take remote file contents as string or array and parse and reduce headers. - * - * @param string|array $contents File contents or array of file headers. - * @param string $type plugin|theme. - * - * @return array $all_headers Reduced array of all headers. - */ - public function get_file_headers( $contents, $type ) { - $all_headers = []; - $default_plugin_headers = [ - 'Name' => 'Plugin Name', - 'PluginURI' => 'Plugin URI', - 'Version' => 'Version', - 'Description' => 'Description', - 'Author' => 'Author', - 'AuthorURI' => 'Author URI', - 'TextDomain' => 'Text Domain', - 'DomainPath' => 'Domain Path', - 'Network' => 'Network', - ]; - - $default_theme_headers = [ - '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', - ]; - - if ( 'plugin' === $type ) { - $all_headers = $default_plugin_headers; - } - if ( 'theme' === $type ) { - $all_headers = $default_theme_headers; - } - - /* - * Merge extra headers and default headers. - */ - $all_headers = array_merge( self::$extra_headers, $all_headers ); - $all_headers = array_unique( $all_headers ); - - /* - * Make sure we catch CR-only line endings. - */ - if ( is_string( $contents ) ) { - $file_data = str_replace( "\r", "\n", $contents ); - - foreach ( $all_headers as $field => $regex ) { - if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) { - $all_headers[ $field ] = _cleanup_header_comment( $match[1] ); - } else { - $all_headers[ $field ] = ''; - } - } - } - - $all_headers = is_array( $contents ) ? $contents : $all_headers; - - // Reduce array to only headers with data. - $all_headers = array_filter( - $all_headers, - function ( $e ) { - return ! empty( $e ); - } - ); - - return $all_headers; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI.php b/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI.php deleted file mode 100644 index ecfab4f..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI.php +++ /dev/null @@ -1,78 +0,0 @@ - - * : delete the cache - * - * ## EXAMPLES - * - * wp github-updater cache delete - * - * @param array $args Array of arguments. - * - * @subcommand cache - */ - public function cache( $args ) { - list($action) = $args; - if ( 'delete' === $action ) { - Singleton::get_instance( 'CLI_Common', $this )->delete_all_cached_data(); - WP_CLI::success( 'GitHub Updater cache has been cleared.' ); - } else { - WP_CLI::error( sprintf( 'Incorrect command syntax, see %s for proper syntax.', '`wp help github-updater cache`' ) ); - } - WP_CLI::success( 'WP-Cron is now running.' ); - WP_CLI::runcommand( 'cron event run --due-now' ); - } - - /** - * Reset GitHub Updater REST API key. - * - * ## EXAMPLES - * - * wp github-updater reset-api-key - * - * @subcommand reset-api-key - */ - public function reset_api_key() { - delete_site_option( 'github_updater_api_key' ); - Singleton::get_instance( 'Remote_Management', $this )->ensure_api_key_is_set(); - $api_key = get_site_option( 'github_updater_api_key' ); - $api_url = add_query_arg( - [ - 'action' => 'github-updater-update', - 'key' => $api_key, - ], - admin_url( 'admin-ajax.php' ) - ); - - WP_CLI::success( 'GitHub Updater REST API key has been reset.' ); - WP_CLI::success( sprintf( 'The current RESTful endpoint is `%s`', $api_url ) ); - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Common.php b/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Common.php deleted file mode 100644 index a29e4b0..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Common.php +++ /dev/null @@ -1,33 +0,0 @@ -base_prefix . 'sitemeta' : $wpdb->base_prefix . 'options'; - $column = is_multisite() ? 'meta_key' : 'option_name'; - $delete_string = 'DELETE FROM ' . $table . ' WHERE ' . $column . ' LIKE %s LIMIT 1000'; - - $wpdb->query( $wpdb->prepare( $delete_string, [ '%ghu-%' ] ) ); - - return true; - } -} diff --git a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Integration.php b/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Integration.php deleted file mode 100644 index 0fc2771..0000000 --- a/wp-content/plugins/github-updater/src/GitHub_Updater/WP_CLI/CLI_Integration.php +++ /dev/null @@ -1,274 +0,0 @@ -run(); - } - - /** - * Off to the races. - */ - public function run() { - add_filter( 'site_transient_update_plugins', [ Singleton::get_instance( 'Plugin', $this ), 'update_site_transient' ], 10, 1 ); - add_filter( 'site_transient_update_themes', [ Singleton::get_instance( 'Theme', $this ), 'update_site_transient' ], 10, 1 ); - } - - /** - * Install plugin from GitHub, Bitbucket, GitLab, or Gitea using GitHub Updater. - * - * ## OPTIONS - * - * - * : URI to the repo being installed - * - * [--branch=] - * : String indicating the branch name to be installed - * --- - * default: master - * --- - * - * [--token=] - * : GitHub, GitLab, or Gitea access token if not already saved - * - * [--bitbucket-private] - * : Indicates a private Bitbucket repository - * - * [--slug=] - * : Optional string indicating the plugin slug - - * [--github] - * : Optional to denote a GitHub repository - * Required when installing from a self-hosted GitHub installation - * - * [--bitbucket] - * : Optional switch to denote a Bitbucket repository - * Required when installing from a self-hosted Bitbucket installation - * - * [--gitlab] - * : Optional switch to denote a GitLab repository - * Required when installing from a self-hosted GitLab installation - * - * [--gitea] - * : Optional switch to denote a Gitea repository - * Required when installing from a Gitea installation - * - * [--zipfile] - * : Optional switch to denote a Zipfile - * Required when installing from a Zipfile - * - * ## EXAMPLES - * - * wp plugin install-git https://github.com/afragen/my-plugin - * - * wp plugin install-git https://github.com/afragen/my-plugin --branch=develop --github - * - * wp plugin install-git https://bitbucket.org/afragen/my-private-plugin --bitbucket-private - * - * wp plugin install-git https://github.com/afragen/my-private-plugin --token=lks9823evalki - * - * @param array $args An array of $uri. - * @param array $assoc_args Array of optional arguments. - * - * @subcommand install-git - */ - public function install_plugin( $args, $assoc_args ) { - list($uri) = $args; - $cli_config = $this->process_args( $uri, $assoc_args ); - Singleton::get_instance( 'Install', $this )->install( 'plugin', $cli_config ); - - $headers = parse_url( $uri, PHP_URL_PATH ); - $slug = basename( $headers ); - $this->process_branch( $cli_config, $slug ); - WP_CLI::success( sprintf( 'Plugin %s installed.', "'$slug'" ) ); - } - - /** - * Install theme from GitHub, Bitbucket, GitLab, or Gitea using GitHub Updater. - * - * ## OPTIONS - * - * - * : URI to the repo being installed - * - * [--branch=] - * : String indicating the branch name to be installed - * --- - * default: master - * --- - * - * [--token=] - * : GitHub or GitLab access token if not already saved - * - * [--bitbucket-private] - * : Indicates a private Bitbucket repository - * - * [--slug=] - * : Optional string indicating the theme slug - * - * [--github] - * : Optional to denote a GitHub repository - * Required when installing from a self-hosted GitHub installation - * - * [--bitbucket] - * : Optional switch to denote a Bitbucket repository - * Required when installing from a self-hosted Bitbucket installation - * - * [--gitlab] - * : Optional switch to denote a GitLab repository - * Required when installing from a self-hosted GitLab installation - * - * [--gitea] - * : Optional switch to denote a Gitea repository - * Required when installing from a Gitea installation - * - * [--zipfile] - * : Optional switch to denote a Zipfile - * Required when installing from a Zipfile - * - * ## EXAMPLES - * - * wp theme install-git https://github.com/afragen/my-theme - * - * wp theme install-git https://bitbucket.org/afragen/my-theme --branch=develop --bitbucket - * - * wp theme install-git https://bitbucket.org/afragen/my-private-theme --bitbucket-private - * - * wp theme install-git https://github.com/afragen/my-private-theme --token=lks9823evalki - * - * @param array $args An array of $uri. - * @param array $assoc_args Array of optional arguments. - * - * @subcommand install-git - */ - public function install_theme( $args, $assoc_args ) { - list($uri) = $args; - $cli_config = $this->process_args( $uri, $assoc_args ); - Singleton::get_instance( 'Install', $this )->install( 'theme', $cli_config ); - - $headers = parse_url( $uri, PHP_URL_PATH ); - $slug = basename( $headers ); - $this->process_branch( $cli_config, $slug ); - WP_CLI::success( sprintf( 'Theme %s installed.', "'$slug'" ) ); - } - - /** - * Process WP-CLI config data. - * - * @param string $uri URI to process. - * @param array $assoc_args Args to process. - * - * @return array $cli_config - */ - private function process_args( $uri, $assoc_args ) { - $token = isset( $assoc_args['token'] ) ? $assoc_args['token'] : false; - $bitbucket_private = isset( $assoc_args['bitbucket-private'] ) ? $assoc_args['bitbucket-private'] : false; - $cli_config = []; - $cli_config['uri'] = $uri; - $cli_config['private'] = $token ?: $bitbucket_private; - $cli_config['branch'] = isset( $assoc_args['branch'] ) ? $assoc_args['branch'] : 'master'; - $cli_config['slug'] = isset( $assoc_args['slug'] ) ? $assoc_args['slug'] : null; - - switch ( $assoc_args ) { - case isset( $assoc_args['github'] ): - $cli_config['git'] = 'github'; - break; - case isset( $assoc_args['bitbucket'] ): - $cli_config['git'] = 'bitbucket'; - break; - case isset( $assoc_args['gitlab'] ): - $cli_config['git'] = 'gitlab'; - break; - case isset( $assoc_args['gitea'] ): - $cli_config['git'] = 'gitea'; - break; - case isset( $assoc_args['zipfile'] ): - $cli_config['git'] = 'zipfile'; - break; - } - - return $cli_config; - } - - /** - * Process branch setting for WP-CLI. - * - * @param array $cli_config Config args. - * @param string $slug Repository slug. - */ - private function process_branch( $cli_config, $slug ) { - $branch_data['github_updater_branch'] = $cli_config['branch']; - $branch_data['repo'] = $slug; - - Singleton::get_instance( 'Branch', $this )->set_branch_on_install( $branch_data ); - } -} - -/** - * Use custom installer skins to display error messages. - */ -require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; - -/** - * Class GitHub_Upgrader_CLI_Plugin_Installer_Skin - */ -class CLI_Plugin_Installer_Skin extends \Plugin_Installer_Skin { - public function header() { - } - - public function footer() { - } - - public function error( $errors ) { - if ( is_wp_error( $errors ) ) { - WP_CLI::error( $errors->get_error_message() . "\n" . $errors->get_error_data() ); - } - } - - public function feedback( $string ) { - } -} - -/** - * Class GitHub_Upgrader_CLI_Theme_Installer_Skin - */ -class CLI_Theme_Installer_Skin extends \Theme_Installer_Skin { - public function header() { - } - - public function footer() { - } - - public function error( $errors ) { - if ( is_wp_error( $errors ) ) { - WP_CLI::error( $errors->get_error_message() . "\n" . $errors->get_error_data() ); - } - } - - public function feedback( $string ) { - } -} diff --git a/wp-content/plugins/github-updater/uninstall.php b/wp-content/plugins/github-updater/uninstall.php deleted file mode 100644 index aa6ac14..0000000 --- a/wp-content/plugins/github-updater/uninstall.php +++ /dev/null @@ -1,42 +0,0 @@ -base_prefix . 'sitemeta' : $wpdb->base_prefix . 'options'; -$column = is_multisite() ? 'meta_key' : 'option_name'; -$delete_string = 'DELETE FROM ' . $table . ' WHERE ' . $column . ' LIKE %s LIMIT 1000'; -$wpdb->query( $wpdb->prepare( $delete_string, array( '%ghu-%' ) ) ); - -@unlink( WP_CONTENT_DIR . '/tmp-readme.txt' ); diff --git a/wp-content/plugins/github-updater/vendor/afragen/singleton/LICENSE b/wp-content/plugins/github-updater/vendor/afragen/singleton/LICENSE deleted file mode 100644 index b913d48..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/singleton/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Andy Fragen - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/wp-content/plugins/github-updater/vendor/afragen/singleton/README.md b/wp-content/plugins/github-updater/vendor/afragen/singleton/README.md deleted file mode 100644 index 5f9eff6..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/singleton/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# singleton - -This is a singleton static proxy generator that I use in several projects instead of creating true Singletons. It was inspired by [Alain Schlesser’s post on Singletons](https://www.alainschlesser.com/singletons-shared-instances/). - -I’ve moved this library into it’s own repository so that I will be better able to include it via composer. - -I have written it to work with PSR-4. - -`composer require afragen/singleton:dev-master` - -When using this Singleton class in your project you will create an array of class instances. - -## Usage - -```php -@param string $class_name -@param object $caller Originating object. -@param null|array|\stdClass $options - -Singleton::get_instance( $class_name, $calling_class, $options ); -``` - -This will usually be called as follows. - -`Singleton::get_instance( 'MyClass', $this );` - -The class object created will also pass the calling object as `$instance[$class_name]->caller`. - -I do my best to automatically determine the namespace of the class. If the class is in a subfolder of `src` it will need to be designated in the call as follows. - -If PSR-4 is set for the `src` directory and the class lives in `src/MySubDir/MyClass` the corresponding call would be as follows. - -`Singleton::get_instance( 'MySubDir\MyClass', $this );` - -I’m still learning how to properly set up using composer so this may be updated along the way. diff --git a/wp-content/plugins/github-updater/vendor/afragen/singleton/Singleton.php b/wp-content/plugins/github-updater/vendor/afragen/singleton/Singleton.php deleted file mode 100644 index 4b032de..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/singleton/Singleton.php +++ /dev/null @@ -1,108 +0,0 @@ -caller = $caller; - - return $instance[ $class ]; - } - - /** - * Determine correct class name with namespace and return. - * - * @param string $class_name - * @param string $class - * - * @return string Namespaced class name. - */ - private static function get_class( $class_name, $class ) { - $reflection = self::get_reflection( $class ); - $namespace = $reflection->getNamespaceName(); - $namespace_parts = explode( '\\', $namespace ); - $count = count( $namespace_parts ); - $classes[-1] = null; - - for ( $i = 0; $i < $count; $i++ ) { - $classes[ $i ] = ltrim( $classes[ $i - 1 ] . '\\' . $namespace_parts[ $i ], '\\' ); - } - - $classes = array_reverse( $classes ); - foreach ( $classes as $namespace ) { - $namespaced_class = $namespace . '\\' . $class_name; - if ( class_exists( $namespaced_class ) ) { - return $namespaced_class; - } - } - - try { - throw new \Exception( "Undefined class '{$class_name}'" ); - } catch ( \Exception $e ) { - $message = "PHP Fatal error: {$e->getMessage()}\nPHP Stack trace:\n"; - $trace = $e->getTraceAsString(); - error_log( $message . $trace ); - die( "
{$message}{$trace}
" ); - } - } - - /** - * Get ReflectionClass of passed class name. - * - * @param string $class - * - * @return \ReflectionClass $reflection - */ - private static function get_reflection( $class ) { - try { - $reflection = new \ReflectionClass( $class ); - } catch ( \ReflectionException $Exception ) { - die( '' . $Exception->xdebug_message . '
' ); - } - - return $reflection; - } - } -} diff --git a/wp-content/plugins/github-updater/vendor/afragen/singleton/composer.json b/wp-content/plugins/github-updater/vendor/afragen/singleton/composer.json deleted file mode 100644 index c86f04e..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/singleton/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "afragen/singleton", - "description": "A singleton static proxy generator.", - "type": "library", - "keywords": [ - "wordpress", - "singleton" - ], - "license": "MIT", - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/afragen/singleton" - } - ], - "authors": [ - { - "name": "Andy Fragen", - "email": "andy@thefragens.com", - "homepage": "https://github.com/afragen/singleton", - "role": "Developer" - } - ], - "prefer-stable": true, - "require": { - "php": ">=5.4" - }, - "autoload": { - "classmap": [ - "Singleton.php" - ] - } -} diff --git a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/LICENSE b/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/LICENSE deleted file mode 100644 index f288702..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/README.md b/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/README.md deleted file mode 100644 index 9edbced..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# WordPress Plugin Readme Parser - -A scrape of the current [WordPress.org Plugin Readme Parser](https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme) - -In my [GitHub Updater](https://github.com/afragen/github-updater) plugin I use the WP.org Plugin Directory readme parser. I created this library to allow me to more easily include the `class-parser.php` for my project by using composer. - -I will try to keep this as up-to-date as possible. - -The `index.php` file, when run locally, will update the `class-parser.php` file with the most current version in meta.trac.wordpress.org. - -## Usage - -`composer require afragen/wordpress-plugin-readme-parser:dev-master` - -`class-parser.php` uses [Michelf’s Markdown_Extra](https://github.com/michelf/php-markdown) but I use a more lightweight markdown parser, [erusev’s Parsedown](https://github.com/erusev/parsedown). Parsedown is required in this `composer.json`. diff --git a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php b/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php deleted file mode 100644 index cc3dc41..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php +++ /dev/null @@ -1,775 +0,0 @@ - to - * - * @var array - */ - private $alias_sections = array( - 'frequently_asked_questions' => 'faq', - 'change_log' => 'changelog', - 'screenshot' => 'screenshots', - ); - - /** - * These are the valid header mappings for the header. - * - * @var array - */ - private $valid_headers = array( - 'tested' => 'tested', - 'tested up to' => 'tested', - 'requires' => 'requires', - 'requires at least' => 'requires', - 'requires php' => 'requires_php', - 'tags' => 'tags', - 'contributors' => 'contributors', - 'donate link' => 'donate_link', - 'stable tag' => 'stable_tag', - 'license' => 'license', - 'license uri' => 'license_uri', - ); - - /** - * These plugin tags are ignored. - * - * @var array - */ - private $ignore_tags = array( - 'plugin', - 'wordpress', - ); - - /** - * Parser constructor. - * - * @param string $file - */ - public function __construct( $file ) { - if ( $file ) { - $this->parse_readme( $file ); - } - } - - /** - * @param string $file - * @return bool - */ - protected function parse_readme( $file ) { - $contents = file_get_contents( $file ); - if ( preg_match( '!!u', $contents ) ) { - $contents = preg_split( '!\R!u', $contents ); - } else { - $contents = preg_split( '!\R!', $contents ); // regex failed due to invalid UTF8 in $contents, see #2298 - } - $contents = array_map( array( $this, 'strip_newlines' ), $contents ); - - // Strip UTF8 BOM if present. - if ( 0 === strpos( $contents[0], "\xEF\xBB\xBF" ) ) { - $contents[0] = substr( $contents[0], 3 ); - } - - // Convert UTF-16 files. - if ( 0 === strpos( $contents[0], "\xFF\xFE" ) ) { - foreach ( $contents as $i => $line ) { - $contents[ $i ] = mb_convert_encoding( $line, 'UTF-8', 'UTF-16' ); - } - } - - $line = $this->get_first_nonwhitespace( $contents ); - $this->name = $this->sanitize_text( trim( $line, "#= \t\0\x0B" ) ); - - // Strip Github style header\n==== underlines. - if ( ! empty( $contents ) && '' === trim( $contents[0], '=-' ) ) { - array_shift( $contents ); - } - - // Handle readme's which do `=== Plugin Name ===\nMy SuperAwesomePlugin Name\n...` - if ( 'plugin name' == strtolower( $this->name ) ) { - $this->name = $line = $this->get_first_nonwhitespace( $contents ); - - // Ensure that the line read wasn't an actual header or description. - if ( strlen( $line ) > 50 || preg_match( '~^(' . implode( '|', array_keys( $this->valid_headers ) ) . ')\s*:~i', $line ) ) { - $this->name = false; - array_unshift( $contents, $line ); - } - } - - // Parse headers. - $headers = array(); - - $line = $this->get_first_nonwhitespace( $contents ); - do { - $value = null; - if ( false === strpos( $line, ':' ) ) { - - // Some plugins have line-breaks within the headers. - if ( empty( $line ) ) { - break; - } else { - continue; - } - } - - $bits = explode( ':', trim( $line ), 2 ); - list( $key, $value ) = $bits; - $key = strtolower( trim( $key, " \t*-\r\n" ) ); - if ( isset( $this->valid_headers[ $key ] ) ) { - $headers[ $this->valid_headers[ $key ] ] = trim( $value ); - } - } while ( ( $line = array_shift( $contents ) ) !== null ); - array_unshift( $contents, $line ); - - if ( ! empty( $headers['tags'] ) ) { - $this->tags = explode( ',', $headers['tags'] ); - $this->tags = array_map( 'trim', $this->tags ); - $this->tags = array_filter( $this->tags ); - $this->tags = array_diff( $this->tags, $this->ignore_tags ); - $this->tags = array_slice( $this->tags, 0, 5 ); - } - if ( ! empty( $headers['requires'] ) ) { - $this->requires = $this->sanitize_requires_version( $headers['requires'] ); - } - if ( ! empty( $headers['tested'] ) ) { - $this->tested = $this->sanitize_tested_version( $headers['tested'] ); - } - if ( ! empty( $headers['requires_php'] ) ) { - $this->requires_php = $this->sanitize_requires_php( $headers['requires_php'] ); - } - if ( ! empty( $headers['contributors'] ) ) { - $this->contributors = explode( ',', $headers['contributors'] ); - $this->contributors = array_map( 'trim', $this->contributors ); - $this->contributors = $this->sanitize_contributors( $this->contributors ); - } - if ( ! empty( $headers['stable_tag'] ) ) { - $this->stable_tag = $this->sanitize_stable_tag( $headers['stable_tag'] ); - } - if ( ! empty( $headers['donate_link'] ) ) { - $this->donate_link = $headers['donate_link']; - } - if ( ! empty( $headers['license'] ) ) { - // Handle the many cases of "License: GPLv2 - http://..." - if ( empty( $headers['license_uri'] ) && preg_match( '!(https?://\S+)!i', $headers['license'], $url ) ) { - $headers['license_uri'] = $url[1]; - $headers['license'] = trim( str_replace( $url[1], '', $headers['license'] ), " -*\t\n\r\n" ); - } - $this->license = $headers['license']; - } - if ( ! empty( $headers['license_uri'] ) ) { - $this->license_uri = $headers['license_uri']; - } - - // Parse the short description. - while ( ( $line = array_shift( $contents ) ) !== null ) { - $trimmed = trim( $line ); - if ( empty( $trimmed ) ) { - $this->short_description .= "\n"; - continue; - } - if ( ( '=' === $trimmed[0] && isset( $trimmed[1] ) && '=' === $trimmed[1] ) || - ( '#' === $trimmed[0] && isset( $trimmed[1] ) && '#' === $trimmed[1] ) - ) { - - // Stop after any Markdown heading. - array_unshift( $contents, $line ); - break; - } - - $this->short_description .= $line . "\n"; - } - $this->short_description = trim( $this->short_description ); - - /* - * Parse the rest of the body. - * Pre-fill the sections, we'll filter out empty sections later. - */ - $this->sections = array_fill_keys( $this->expected_sections, '' ); - $current = $section_name = $section_title = ''; - while ( ( $line = array_shift( $contents ) ) !== null ) { - $trimmed = trim( $line ); - if ( empty( $trimmed ) ) { - $current .= "\n"; - continue; - } - - // Stop only after a ## Markdown header, not a ###. - if ( ( '=' === $trimmed[0] && isset( $trimmed[1] ) && '=' === $trimmed[1] ) || - ( '#' === $trimmed[0] && isset( $trimmed[1] ) && '#' === $trimmed[1] && isset( $trimmed[2] ) && '#' !== $trimmed[2] ) - ) { - - if ( ! empty( $section_name ) ) { - $this->sections[ $section_name ] .= trim( $current ); - } - - $current = ''; - $section_title = trim( $line, "#= \t" ); - $section_name = strtolower( str_replace( ' ', '_', $section_title ) ); - - if ( isset( $this->alias_sections[ $section_name ] ) ) { - $section_name = $this->alias_sections[ $section_name ]; - } - - // If we encounter an unknown section header, include the provided Title, we'll filter it to other_notes later. - if ( ! in_array( $section_name, $this->expected_sections ) ) { - $current .= '

' . $section_title . '

'; - $section_name = 'other_notes'; - } - continue; - } - - $current .= $line . "\n"; - } - - if ( ! empty( $section_name ) ) { - $this->sections[ $section_name ] .= trim( $current ); - } - - // Filter out any empty sections. - $this->sections = array_filter( $this->sections ); - - // Use the short description for the description section if not provided. - if ( empty( $this->sections['description'] ) ) { - $this->sections['description'] = $this->short_description; - } - - // Suffix the Other Notes section to the description. - if ( ! empty( $this->sections['other_notes'] ) ) { - $this->sections['description'] .= "\n" . $this->sections['other_notes']; - unset( $this->sections['other_notes'] ); - } - - // Parse out the Upgrade Notice section into it's own data. - if ( isset( $this->sections['upgrade_notice'] ) ) { - $this->upgrade_notice = $this->parse_section( $this->sections['upgrade_notice'] ); - $this->upgrade_notice = array_map( array( $this, 'sanitize_text' ), $this->upgrade_notice ); - unset( $this->sections['upgrade_notice'] ); - } - - // Display FAQs as a definition list. - if ( isset( $this->sections['faq'] ) ) { - $this->faq = $this->parse_section( $this->sections['faq'] ); - $this->sections['faq'] = ''; - } - - // Markdownify! - $this->sections = array_map( array( $this, 'parse_markdown' ), $this->sections ); - $this->upgrade_notice = array_map( array( $this, 'parse_markdown' ), $this->upgrade_notice ); - $this->faq = array_map( array( $this, 'parse_markdown' ), $this->faq ); - - // Use the first line of the description for the short description if not provided. - if ( ! $this->short_description && ! empty( $this->sections['description'] ) ) { - $this->short_description = array_filter( explode( "\n", $this->sections['description'] ) )[0]; - } - - // Sanitize and trim the short_description to match requirements. - $this->short_description = $this->sanitize_text( $this->short_description ); - $this->short_description = $this->parse_markdown( $this->short_description ); - $this->short_description = wp_strip_all_tags( $this->short_description ); - $this->short_description = $this->trim_length( $this->short_description, 150 ); - - if ( isset( $this->sections['screenshots'] ) ) { - preg_match_all( '#
  • (.*?)
  • #is', $this->sections['screenshots'], $screenshots, PREG_SET_ORDER ); - if ( $screenshots ) { - $i = 1; // Screenshots start from 1. - foreach ( $screenshots as $ss ) { - $this->screenshots[ $i++ ] = $this->filter_text( $ss[1] ); - } - } - unset( $this->sections['screenshots'] ); - } - - if ( ! empty( $this->faq ) ) { - // If the FAQ contained data we couldn't parse, we'll treat it as freeform and display it before any questions which are found. - if ( isset( $this->faq[''] ) ) { - $this->sections['faq'] .= $this->faq['']; - unset( $this->faq[''] ); - } - - if ( $this->faq ) { - $this->sections['faq'] .= "\n
    \n"; - foreach ( $this->faq as $question => $answer ) { - $question_slug = sanitize_title_with_dashes( $question ); - $this->sections['faq'] .= "
    {$question}
    \n
    {$answer}
    \n"; - } - $this->sections['faq'] .= "\n
    \n"; - } - } - - // Filter the HTML. - $this->sections = array_map( array( $this, 'filter_text' ), $this->sections ); - - return true; - } - - /** - * @access protected - * - * @param string $contents - * @return string - */ - protected function get_first_nonwhitespace( &$contents ) { - while ( ( $line = array_shift( $contents ) ) !== null ) { - $trimmed = trim( $line ); - if ( ! empty( $trimmed ) ) { - break; - } - } - - return $line; - } - - /** - * @access protected - * - * @param string $line - * @return string - */ - protected function strip_newlines( $line ) { - return rtrim( $line, "\r\n" ); - } - - /** - * @access protected - * - * @param string $desc - * @param int $length - * @return string - */ - protected function trim_length( $desc, $length = 150 ) { - if ( mb_strlen( $desc ) > $length ) { - $desc = mb_substr( $desc, 0, $length ) . ' …'; - - // If not a full sentence, and one ends within 20% of the end, trim it to that. - if ( '.' !== mb_substr( $desc, -1 ) && ( $pos = mb_strrpos( $desc, '.' ) ) > ( 0.8 * $length ) ) { - $desc = mb_substr( $desc, 0, $pos + 1 ); - } - } - - return trim( $desc ); - } - - /** - * @access protected - * - * @param string $text - * @return string - */ - protected function filter_text( $text ) { - $text = trim( $text ); - - $allowed = array( - 'a' => array( - 'href' => true, - 'title' => true, - 'rel' => true, - ), - 'blockquote' => array( - 'cite' => true, - ), - 'br' => array(), - 'p' => array(), - 'code' => array(), - 'pre' => array(), - 'em' => array(), - 'strong' => array(), - 'ul' => array(), - 'ol' => array(), - 'dl' => array(), - 'dt' => array(), - 'dd' => array(), - 'li' => array(), - 'h3' => array(), - 'h4' => array(), - ); - - $text = force_balance_tags( $text ); - // TODO: make_clickable() will act inside shortcodes. - // $text = make_clickable( $text ); - $text = wp_kses( $text, $allowed ); - - // wpautop() will eventually replace all \n's with
    s, and that isn't what we want (The text may be line-wrapped in the readme, we don't want that, we want paragraph-wrapped text) - // TODO: This incorrectly also applies within `` tags which we don't want either. - // $text = preg_replace( "/(? ])\n/", ' ', $text ); - $text = trim( $text ); - - return $text; - } - - /** - * @access protected - * - * @param string $text - * @return string - */ - protected function sanitize_text( $text ) { - // not fancy - $text = strip_tags( $text ); - $text = esc_html( $text ); - $text = trim( $text ); - - return $text; - } - - /** - * Sanitize provided contributors to valid WordPress users - * - * @param array $users Array of user_login's or user_nicename's. - * @return array Array of user_logins. - */ - protected function sanitize_contributors( $users ) { - foreach ( $users as $i => $name ) { - // Contributors should be listed by their WordPress.org Login name (Example: 'Joe Bloggs') - $user = get_user_by( 'login', $name ); - - // Or failing that, by their user_nicename field (Example: 'joe-bloggs') - if ( ! $user ) { - $user = get_user_by( 'slug', $name ); - } - - // In the event that something invalid is used, we'll ignore it (Example: 'Joe Bloggs (Australian Translation)') - if ( ! $user ) { - unset( $users[ $i ] ); - $this->warnings['contributor_ignored'] = true; - continue; - } - - // Overwrite whatever the author has specified with the sanitized nicename. - $users[ $i ] = $user->user_nicename; - } - - return $users; - } - - /** - * Sanitize the provided stable tag to something we expect. - * - * @param string $stable_tag the raw Stable Tag line from the readme. - * @return string The sanitized $stable_tag. - */ - protected function sanitize_stable_tag( $stable_tag ) { - $stable_tag = trim( $stable_tag ); - $stable_tag = trim( $stable_tag, '"\'' ); // "trunk" - $stable_tag = preg_replace( '!^/?tags/!i', '', $stable_tag ); // "tags/1.2.3" - $stable_tag = preg_replace( '![^a-z0-9_.-]!i', '', $stable_tag ); - - // If the stable_tag begins with a ., we treat it as 0.blah. - if ( '.' == substr( $stable_tag, 0, 1 ) ) { - $stable_tag = "0{$stable_tag}"; - } - - return $stable_tag; - } - - /** - * Sanitizes the Requires PHP header to ensure that it's a valid version header. - * - * @param string $version - * @return string The sanitized $version - */ - protected function sanitize_requires_php( $version ) { - $version = trim( $version ); - - // x.y or x.y.z - if ( $version && ! preg_match( '!^\d+(\.\d+){1,2}$!', $version ) ) { - $this->warnings['requires_php_header_ignored'] = true; - // Ignore the readme value. - $version = ''; - } - - return $version; - } - - /** - * Sanitizes the Tested header to ensure that it's a valid version header. - * - * @param string $version - * @return string The sanitized $version - */ - protected function sanitize_tested_version( $version ) { - $version = trim( $version ); - - if ( $version ) { - - // Handle the edge-case of 'WordPress 5.0' and 'WP 5.0' for historical purposes. - $strip_phrases = [ - 'WordPress', - 'WP', - ]; - $version = trim( str_ireplace( $strip_phrases, '', $version ) ); - - // Strip off any -alpha, -RC, -beta suffixes, as these complicate comparisons and are rarely used. - list( $version, ) = explode( '-', $version ); - - if ( - // x.y or x.y.z - ! preg_match( '!^\d+\.\d(\.\d+)?$!', $version ) || - // Allow plugins to mark themselves as compatible with Stable+0.1 (trunk/master) but not higher - ( - defined( 'WP_CORE_STABLE_BRANCH' ) && - version_compare( (float)$version, (float)WP_CORE_STABLE_BRANCH+0.1, '>' ) - ) - ) { - $this->warnings['tested_header_ignored'] = true; - // Ignore the readme value. - $version = ''; - } - } - - return $version; - } - - /** - * Sanitizes the Requires at least header to ensure that it's a valid version header. - * - * @param string $version - * @return string The sanitized $version - */ - protected function sanitize_requires_version( $version ) { - $version = trim( $version ); - - if ( $version ) { - - // Handle the edge-case of 'WordPress 5.0' and 'WP 5.0' for historical purposes. - $strip_phrases = [ - 'WordPress', - 'WP', - 'or higher', - 'and above', - '+', - ]; - $version = trim( str_ireplace( $strip_phrases, '', $version ) ); - - // Strip off any -alpha, -RC, -beta suffixes, as these complicate comparisons and are rarely used. - list( $version, ) = explode( '-', $version ); - - if ( - // x.y or x.y.z - ! preg_match( '!^\d+\.\d(\.\d+)?$!', $version ) || - // Allow plugins to mark themselves as requireing Stable+0.1 (trunk/master) but not higher - defined( 'WP_CORE_STABLE_BRANCH' ) && ( (float)$version > (float)WP_CORE_STABLE_BRANCH+0.1 ) - ) { - $this->warnings['requires_header_ignored'] = true; - // Ignore the readme value. - $version = ''; - } - } - - return $version; - } - - /** - * Parses a slice of lines from the file into an array of Heading => Content. - * - * We assume that every heading encountered is a new item, and not a sub heading. - * We support headings which are either `= Heading`, `# Heading` or `** Heading`. - * - * @param string|array $lines The lines of the section to parse. - * @return array - */ - protected function parse_section( $lines ) { - $key = $value = ''; - $return = array(); - - if ( ! is_array( $lines ) ) { - $lines = explode( "\n", $lines ); - } - $trimmed_lines = array_map( 'trim', $lines ); - - /* - * The heading style being matched in the block. Can be 'heading' or 'bold'. - * Standard Markdown headings (## .. and == ... ==) are used, but if none are present. - * full line bolding will be used as a heading style. - */ - $heading_style = 'bold'; // 'heading' or 'bold' - foreach ( $trimmed_lines as $trimmed ) { - if ( $trimmed && ( $trimmed[0] == '#' || $trimmed[0] == '=' ) ) { - $heading_style = 'heading'; - break; - } - } - - $line_count = count( $lines ); - for ( $i = 0; $i < $line_count; $i++ ) { - $line = &$lines[ $i ]; - $trimmed = &$trimmed_lines[ $i ]; - if ( ! $trimmed ) { - $value .= "\n"; - continue; - } - - $is_heading = false; - if ( 'heading' == $heading_style && ( $trimmed[0] == '#' || $trimmed[0] == '=' ) ) { - $is_heading = true; - } elseif ( 'bold' == $heading_style && ( substr( $trimmed, 0, 2 ) == '**' && substr( $trimmed, -2 ) == '**' ) ) { - $is_heading = true; - } - - if ( $is_heading ) { - if ( $value ) { - $return[ $key ] = trim( $value ); - } - - $value = ''; - // Trim off the first character of the line, as we know that's the heading style we're expecting to remove. - $key = trim( $line, $trimmed[0] . " \t" ); - continue; - } - - $value .= $line . "\n"; - } - - if ( $key || $value ) { - $return[ $key ] = trim( $value ); - } - - return $return; - } - - /** - * @param string $text - * @return string - */ - protected function parse_markdown( $text ) { - static $markdown = null; - - if ( is_null( $markdown ) ) { - $markdown = new Markdown(); - } - - return $markdown->transform( $text ); - } - - /** - * Determine if the readme contains unique installation instructions. - * - * When phrases are added here, the affected plugins will need to be reparsed to pick it up. - * - * @return bool Whether the instructions differ from default instructions. - */ - protected function has_unique_installation_instructions() { - if ( ! isset( $this->sections['installation'] ) ) { - return false; - } - - // If the plugin installation section contains any of these phrases, skip it as it's not useful. - $common_phrases = array( - 'This section describes how to install the plugin and get it working.', // Default readme.txt content - ); - foreach ( $common_phrases as $phrase ) { - if ( false !== stripos( $this->sections['installation'], $phrase ) ) { - return false; - } - } - - return true; - } -} diff --git a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/composer.json b/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/composer.json deleted file mode 100644 index fef0278..0000000 --- a/wp-content/plugins/github-updater/vendor/afragen/wordpress-plugin-readme-parser/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "afragen/wordpress-plugin-readme-parser", - "description": "A clone of the current WordPress.org Plugin Readme Parser, class-parser.php", - "type": "library", - "keywords": [ - "wordpress", - "readme", - "parser" - ], - "license": "MIT", - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/afragen/wordpress-plugin-reamde-parser" - } - ], - "authors": [ - { - "name": "WordPress.org", - "homepage": "https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme" - } - ], - "prefer-stable": true, - "require": { - "php": ">=5.4", - "erusev/parsedown": "^1.7" - }, - "autoload": { - "classmap": [ - "class-parser.php" - ] - } -} diff --git a/wp-content/plugins/github-updater/vendor/autoload.php b/wp-content/plugins/github-updater/vendor/autoload.php deleted file mode 100644 index 2b782ea..0000000 --- a/wp-content/plugins/github-updater/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - -
    -

    -
    - -
    -

    -
    - -
    -

    -
    - -
    -

    -
    - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * @package Persist Admin notices Dismissal - * @author Collins Agbonghama - * @author Andy Fragen - * @license http://www.gnu.org/licenses GNU General Public License - * @version 1.4.3 - */ - -/** - * Exit if called directly. - */ -if ( ! defined( 'ABSPATH' ) ) { - die; -} - -if ( ! class_exists( 'PAnD' ) ) { - - /** - * Class PAnD - */ - class PAnD { - - /** - * Init hooks. - */ - public static function init() { - add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) ); - add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) ); - - /** - * Filter to activate another filter providing a simpler use case. - * - * @since 1.4.3 - * - * @param bool - */ - if ( apply_filters( 'pand_theme_loader', false ) ) { - add_filter( - 'pand_dismiss_notice_js_url', - function( $js_url, $composer_path ) { - return get_stylesheet_directory_uri() . $composer_path; - }, - 10, - 2 - ); - } - } - - /** - * Enqueue javascript and variables. - */ - public static function load_script() { - - if ( is_customize_preview() ) { - return; - } - - $js_url = plugins_url( 'dismiss-notice.js', __FILE__ ); - $composer_path = '/vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js'; - - /** - * Filter dismiss-notice.js URL. - * - * @since 1.4.3 - * - * @param string $js_url URL to the Javascript file. - * @param string $composer_path Relative path of Javascript file from composer install. - */ - $js_url = apply_filters( 'pand_dismiss_notice_js_url', $js_url, $composer_path ); - wp_enqueue_script( - 'dismissible-notices', - $js_url, - array( 'jquery', 'common' ), - false, - true - ); - - wp_localize_script( - 'dismissible-notices', - 'dismissible_notice', - array( - 'nonce' => wp_create_nonce( 'dismissible-notice' ), - ) - ); - } - - /** - * Handles Ajax request to persist notices dismissal. - * Uses check_ajax_referer to verify nonce. - */ - public static function dismiss_admin_notice() { - $option_name = sanitize_text_field( $_POST['option_name'] ); - $dismissible_length = sanitize_text_field( $_POST['dismissible_length'] ); - - if ( 'forever' != $dismissible_length ) { - // If $dismissible_length is not an integer default to 1 - $dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length; - $dismissible_length = strtotime( absint( $dismissible_length ) . ' days' ); - } - - check_ajax_referer( 'dismissible-notice', 'nonce' ); - self::set_admin_notice_cache( $option_name, $dismissible_length ); - wp_die(); - } - - /** - * Is admin notice active? - * - * @param string $arg data-dismissible content of notice. - * - * @return bool - */ - public static function is_admin_notice_active( $arg ) { - $array = explode( '-', $arg ); - $length = array_pop( $array ); - $option_name = implode( '-', $array ); - $db_record = self::get_admin_notice_cache( $option_name ); - - if ( 'forever' == $db_record ) { - return false; - } elseif ( absint( $db_record ) >= time() ) { - return false; - } else { - return true; - } - } - - /** - * Returns admin notice cached timeout. - * - * @access public - * - * @param string|bool $id admin notice name or false. - * - * @return array|bool The timeout. False if expired. - */ - public static function get_admin_notice_cache( $id = false ) { - if ( ! $id ) { - return false; - } - $cache_key = 'pand-' . md5( $id ); - $timeout = get_site_option( $cache_key ); - $timeout = 'forever' === $timeout ? time() + 60 : $timeout; - - if ( empty( $timeout ) || time() > $timeout ) { - return false; - } - - return $timeout; - } - - /** - * Sets admin notice timeout in site option. - * - * @access public - * - * @param string $id Data Identifier. - * @param string|bool $timeout Timeout for admin notice. - * - * @return bool - */ - public static function set_admin_notice_cache( $id, $timeout ) { - $cache_key = 'pand-' . md5( $id ); - update_site_option( $cache_key, $timeout ); - - return true; - } - - } - -} diff --git a/wp-content/plugins/github-updater/vendor/composer/ClassLoader.php b/wp-content/plugins/github-updater/vendor/composer/ClassLoader.php deleted file mode 100644 index fce8549..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,445 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/wp-content/plugins/github-updater/vendor/composer/LICENSE b/wp-content/plugins/github-updater/vendor/composer/LICENSE deleted file mode 100644 index f27399a..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/wp-content/plugins/github-updater/vendor/composer/autoload_classmap.php b/wp-content/plugins/github-updater/vendor/composer/autoload_classmap.php deleted file mode 100644 index d9995fd..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,12 +0,0 @@ - $vendorDir . '/afragen/singleton/Singleton.php', - 'PAnD' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php', - 'WordPressdotorg\\Plugin_Directory\\Readme\\Parser' => $vendorDir . '/afragen/wordpress-plugin-readme-parser/class-parser.php', -); diff --git a/wp-content/plugins/github-updater/vendor/composer/autoload_namespaces.php b/wp-content/plugins/github-updater/vendor/composer/autoload_namespaces.php deleted file mode 100644 index 2357cf9..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,10 +0,0 @@ - array($vendorDir . '/erusev/parsedown'), -); diff --git a/wp-content/plugins/github-updater/vendor/composer/autoload_psr4.php b/wp-content/plugins/github-updater/vendor/composer/autoload_psr4.php deleted file mode 100644 index f38724f..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,10 +0,0 @@ - array($baseDir . '/src/GitHub_Updater'), -); diff --git a/wp-content/plugins/github-updater/vendor/composer/autoload_real.php b/wp-content/plugins/github-updater/vendor/composer/autoload_real.php deleted file mode 100644 index 0563587..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/autoload_real.php +++ /dev/null @@ -1,52 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit2bcf1c834b610b416c039f4ec3ba2af4::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - return $loader; - } -} diff --git a/wp-content/plugins/github-updater/vendor/composer/autoload_static.php b/wp-content/plugins/github-updater/vendor/composer/autoload_static.php deleted file mode 100644 index 6b684b2..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/autoload_static.php +++ /dev/null @@ -1,49 +0,0 @@ - - array ( - 'Fragen\\GitHub_Updater\\' => 22, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Fragen\\GitHub_Updater\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/GitHub_Updater', - ), - ); - - public static $prefixesPsr0 = array ( - 'P' => - array ( - 'Parsedown' => - array ( - 0 => __DIR__ . '/..' . '/erusev/parsedown', - ), - ), - ); - - public static $classMap = array ( - 'Fragen\\Singleton' => __DIR__ . '/..' . '/afragen/singleton/Singleton.php', - 'PAnD' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php', - 'WordPressdotorg\\Plugin_Directory\\Readme\\Parser' => __DIR__ . '/..' . '/afragen/wordpress-plugin-readme-parser/class-parser.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit2bcf1c834b610b416c039f4ec3ba2af4::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit2bcf1c834b610b416c039f4ec3ba2af4::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit2bcf1c834b610b416c039f4ec3ba2af4::$prefixesPsr0; - $loader->classMap = ComposerStaticInit2bcf1c834b610b416c039f4ec3ba2af4::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/wp-content/plugins/github-updater/vendor/composer/installed.json b/wp-content/plugins/github-updater/vendor/composer/installed.json deleted file mode 100644 index 3a12654..0000000 --- a/wp-content/plugins/github-updater/vendor/composer/installed.json +++ /dev/null @@ -1,170 +0,0 @@ -[ - { - "name": "afragen/singleton", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/afragen/singleton.git", - "reference": "75bce9e88abaefdbbf4d12bc02f71079e465326d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/afragen/singleton/zipball/75bce9e88abaefdbbf4d12bc02f71079e465326d", - "reference": "75bce9e88abaefdbbf4d12bc02f71079e465326d", - "shasum": "" - }, - "require": { - "php": ">=5.4" - }, - "time": "2019-01-05T16:19:38+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "Singleton.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Fragen", - "email": "andy@thefragens.com", - "homepage": "https://github.com/afragen/singleton", - "role": "Developer" - } - ], - "description": "A singleton static proxy generator.", - "keywords": [ - "singleton", - "wordpress" - ] - }, - { - "name": "afragen/wordpress-plugin-readme-parser", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/afragen/wordpress-plugin-readme-parser.git", - "reference": "ef24f2da1c30b431802b20bd235a2353e7165278" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/afragen/wordpress-plugin-readme-parser/zipball/ef24f2da1c30b431802b20bd235a2353e7165278", - "reference": "ef24f2da1c30b431802b20bd235a2353e7165278", - "shasum": "" - }, - "require": { - "erusev/parsedown": "^1.7", - "php": ">=5.4" - }, - "time": "2019-07-01T18:48:13+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "class-parser.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "WordPress.org", - "homepage": "https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme" - } - ], - "description": "A clone of the current WordPress.org Plugin Readme Parser, class-parser.php", - "keywords": [ - "parser", - "readme", - "wordpress" - ] - }, - { - "name": "collizo4sky/persist-admin-notices-dismissal", - "version": "1.4.3", - "version_normalized": "1.4.3.0", - "source": { - "type": "git", - "url": "https://github.com/collizo4sky/persist-admin-notices-dismissal.git", - "reference": "2d7d8bb3cba631ad227c92296a4b675d7cbc71d7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/collizo4sky/persist-admin-notices-dismissal/zipball/2d7d8bb3cba631ad227c92296a4b675d7cbc71d7", - "reference": "2d7d8bb3cba631ad227c92296a4b675d7cbc71d7", - "shasum": "" - }, - "time": "2019-03-12T05:19:51+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "persist-admin-notices-dismissal.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "authors": [ - { - "name": "Collins Agbonghama", - "email": "me@w3guy.com" - } - ], - "description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard." - }, - { - "name": "erusev/parsedown", - "version": "1.7.3", - "version_normalized": "1.7.3.0", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7", - "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "time": "2019-03-17T18:48:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ] - } -] diff --git a/wp-content/plugins/github-updater/vendor/erusev/parsedown/LICENSE.txt b/wp-content/plugins/github-updater/vendor/erusev/parsedown/LICENSE.txt deleted file mode 100644 index 8e7c764..0000000 --- a/wp-content/plugins/github-updater/vendor/erusev/parsedown/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2018 Emanuil Rusev, erusev.com - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/wp-content/plugins/github-updater/vendor/erusev/parsedown/Parsedown.php b/wp-content/plugins/github-updater/vendor/erusev/parsedown/Parsedown.php deleted file mode 100644 index a34b44f..0000000 --- a/wp-content/plugins/github-updater/vendor/erusev/parsedown/Parsedown.php +++ /dev/null @@ -1,1693 +0,0 @@ -DefinitionData = array(); - - # standardize line breaks - $text = str_replace(array("\r\n", "\r"), "\n", $text); - - # remove surrounding line breaks - $text = trim($text, "\n"); - - # split text into lines - $lines = explode("\n", $text); - - # iterate through lines to identify blocks - $markup = $this->lines($lines); - - # trim line breaks - $markup = trim($markup, "\n"); - - return $markup; - } - - # - # Setters - # - - function setBreaksEnabled($breaksEnabled) - { - $this->breaksEnabled = $breaksEnabled; - - return $this; - } - - protected $breaksEnabled; - - function setMarkupEscaped($markupEscaped) - { - $this->markupEscaped = $markupEscaped; - - return $this; - } - - protected $markupEscaped; - - function setUrlsLinked($urlsLinked) - { - $this->urlsLinked = $urlsLinked; - - return $this; - } - - protected $urlsLinked = true; - - function setSafeMode($safeMode) - { - $this->safeMode = (bool) $safeMode; - - return $this; - } - - protected $safeMode; - - protected $safeLinksWhitelist = array( - 'http://', - 'https://', - 'ftp://', - 'ftps://', - 'mailto:', - 'data:image/png;base64,', - 'data:image/gif;base64,', - 'data:image/jpeg;base64,', - 'irc:', - 'ircs:', - 'git:', - 'ssh:', - 'news:', - 'steam:', - ); - - # - # Lines - # - - protected $BlockTypes = array( - '#' => array('Header'), - '*' => array('Rule', 'List'), - '+' => array('List'), - '-' => array('SetextHeader', 'Table', 'Rule', 'List'), - '0' => array('List'), - '1' => array('List'), - '2' => array('List'), - '3' => array('List'), - '4' => array('List'), - '5' => array('List'), - '6' => array('List'), - '7' => array('List'), - '8' => array('List'), - '9' => array('List'), - ':' => array('Table'), - '<' => array('Comment', 'Markup'), - '=' => array('SetextHeader'), - '>' => array('Quote'), - '[' => array('Reference'), - '_' => array('Rule'), - '`' => array('FencedCode'), - '|' => array('Table'), - '~' => array('FencedCode'), - ); - - # ~ - - protected $unmarkedBlockTypes = array( - 'Code', - ); - - # - # Blocks - # - - protected function lines(array $lines) - { - $CurrentBlock = null; - - foreach ($lines as $line) - { - if (chop($line) === '') - { - if (isset($CurrentBlock)) - { - $CurrentBlock['interrupted'] = true; - } - - continue; - } - - if (strpos($line, "\t") !== false) - { - $parts = explode("\t", $line); - - $line = $parts[0]; - - unset($parts[0]); - - foreach ($parts as $part) - { - $shortage = 4 - mb_strlen($line, 'utf-8') % 4; - - $line .= str_repeat(' ', $shortage); - $line .= $part; - } - } - - $indent = 0; - - while (isset($line[$indent]) and $line[$indent] === ' ') - { - $indent ++; - } - - $text = $indent > 0 ? substr($line, $indent) : $line; - - # ~ - - $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); - - # ~ - - if (isset($CurrentBlock['continuable'])) - { - $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock); - - if (isset($Block)) - { - $CurrentBlock = $Block; - - continue; - } - else - { - if ($this->isBlockCompletable($CurrentBlock['type'])) - { - $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); - } - } - } - - # ~ - - $marker = $text[0]; - - # ~ - - $blockTypes = $this->unmarkedBlockTypes; - - if (isset($this->BlockTypes[$marker])) - { - foreach ($this->BlockTypes[$marker] as $blockType) - { - $blockTypes []= $blockType; - } - } - - # - # ~ - - foreach ($blockTypes as $blockType) - { - $Block = $this->{'block'.$blockType}($Line, $CurrentBlock); - - if (isset($Block)) - { - $Block['type'] = $blockType; - - if ( ! isset($Block['identified'])) - { - $Blocks []= $CurrentBlock; - - $Block['identified'] = true; - } - - if ($this->isBlockContinuable($blockType)) - { - $Block['continuable'] = true; - } - - $CurrentBlock = $Block; - - continue 2; - } - } - - # ~ - - if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) - { - $CurrentBlock['element']['text'] .= "\n".$text; - } - else - { - $Blocks []= $CurrentBlock; - - $CurrentBlock = $this->paragraph($Line); - - $CurrentBlock['identified'] = true; - } - } - - # ~ - - if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) - { - $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); - } - - # ~ - - $Blocks []= $CurrentBlock; - - unset($Blocks[0]); - - # ~ - - $markup = ''; - - foreach ($Blocks as $Block) - { - if (isset($Block['hidden'])) - { - continue; - } - - $markup .= "\n"; - $markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']); - } - - $markup .= "\n"; - - # ~ - - return $markup; - } - - protected function isBlockContinuable($Type) - { - return method_exists($this, 'block'.$Type.'Continue'); - } - - protected function isBlockCompletable($Type) - { - return method_exists($this, 'block'.$Type.'Complete'); - } - - # - # Code - - protected function blockCode($Line, $Block = null) - { - if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted'])) - { - return; - } - - if ($Line['indent'] >= 4) - { - $text = substr($Line['body'], 4); - - $Block = array( - 'element' => array( - 'name' => 'pre', - 'handler' => 'element', - 'text' => array( - 'name' => 'code', - 'text' => $text, - ), - ), - ); - - return $Block; - } - } - - protected function blockCodeContinue($Line, $Block) - { - if ($Line['indent'] >= 4) - { - if (isset($Block['interrupted'])) - { - $Block['element']['text']['text'] .= "\n"; - - unset($Block['interrupted']); - } - - $Block['element']['text']['text'] .= "\n"; - - $text = substr($Line['body'], 4); - - $Block['element']['text']['text'] .= $text; - - return $Block; - } - } - - protected function blockCodeComplete($Block) - { - $text = $Block['element']['text']['text']; - - $Block['element']['text']['text'] = $text; - - return $Block; - } - - # - # Comment - - protected function blockComment($Line) - { - if ($this->markupEscaped or $this->safeMode) - { - return; - } - - if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') - { - $Block = array( - 'markup' => $Line['body'], - ); - - if (preg_match('/-->$/', $Line['text'])) - { - $Block['closed'] = true; - } - - return $Block; - } - } - - protected function blockCommentContinue($Line, array $Block) - { - if (isset($Block['closed'])) - { - return; - } - - $Block['markup'] .= "\n" . $Line['body']; - - if (preg_match('/-->$/', $Line['text'])) - { - $Block['closed'] = true; - } - - return $Block; - } - - # - # Fenced Code - - protected function blockFencedCode($Line) - { - if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) - { - $Element = array( - 'name' => 'code', - 'text' => '', - ); - - if (isset($matches[1])) - { - /** - * https://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes - * Every HTML element may have a class attribute specified. - * The attribute, if specified, must have a value that is a set - * of space-separated tokens representing the various classes - * that the element belongs to. - * [...] - * The space characters, for the purposes of this specification, - * are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), - * U+000A LINE FEED (LF), U+000C FORM FEED (FF), and - * U+000D CARRIAGE RETURN (CR). - */ - $language = substr($matches[1], 0, strcspn($matches[1], " \t\n\f\r")); - - $class = 'language-'.$language; - - $Element['attributes'] = array( - 'class' => $class, - ); - } - - $Block = array( - 'char' => $Line['text'][0], - 'element' => array( - 'name' => 'pre', - 'handler' => 'element', - 'text' => $Element, - ), - ); - - return $Block; - } - } - - protected function blockFencedCodeContinue($Line, $Block) - { - if (isset($Block['complete'])) - { - return; - } - - if (isset($Block['interrupted'])) - { - $Block['element']['text']['text'] .= "\n"; - - unset($Block['interrupted']); - } - - if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) - { - $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); - - $Block['complete'] = true; - - return $Block; - } - - $Block['element']['text']['text'] .= "\n".$Line['body']; - - return $Block; - } - - protected function blockFencedCodeComplete($Block) - { - $text = $Block['element']['text']['text']; - - $Block['element']['text']['text'] = $text; - - return $Block; - } - - # - # Header - - protected function blockHeader($Line) - { - if (isset($Line['text'][1])) - { - $level = 1; - - while (isset($Line['text'][$level]) and $Line['text'][$level] === '#') - { - $level ++; - } - - if ($level > 6) - { - return; - } - - $text = trim($Line['text'], '# '); - - $Block = array( - 'element' => array( - 'name' => 'h' . min(6, $level), - 'text' => $text, - 'handler' => 'line', - ), - ); - - return $Block; - } - } - - # - # List - - protected function blockList($Line) - { - list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); - - if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) - { - $Block = array( - 'indent' => $Line['indent'], - 'pattern' => $pattern, - 'element' => array( - 'name' => $name, - 'handler' => 'elements', - ), - ); - - if($name === 'ol') - { - $listStart = stristr($matches[0], '.', true); - - if($listStart !== '1') - { - $Block['element']['attributes'] = array('start' => $listStart); - } - } - - $Block['li'] = array( - 'name' => 'li', - 'handler' => 'li', - 'text' => array( - $matches[2], - ), - ); - - $Block['element']['text'] []= & $Block['li']; - - return $Block; - } - } - - protected function blockListContinue($Line, array $Block) - { - if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) - { - if (isset($Block['interrupted'])) - { - $Block['li']['text'] []= ''; - - $Block['loose'] = true; - - unset($Block['interrupted']); - } - - unset($Block['li']); - - $text = isset($matches[1]) ? $matches[1] : ''; - - $Block['li'] = array( - 'name' => 'li', - 'handler' => 'li', - 'text' => array( - $text, - ), - ); - - $Block['element']['text'] []= & $Block['li']; - - return $Block; - } - - if ($Line['text'][0] === '[' and $this->blockReference($Line)) - { - return $Block; - } - - if ( ! isset($Block['interrupted'])) - { - $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); - - $Block['li']['text'] []= $text; - - return $Block; - } - - if ($Line['indent'] > 0) - { - $Block['li']['text'] []= ''; - - $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); - - $Block['li']['text'] []= $text; - - unset($Block['interrupted']); - - return $Block; - } - } - - protected function blockListComplete(array $Block) - { - if (isset($Block['loose'])) - { - foreach ($Block['element']['text'] as &$li) - { - if (end($li['text']) !== '') - { - $li['text'] []= ''; - } - } - } - - return $Block; - } - - # - # Quote - - protected function blockQuote($Line) - { - if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) - { - $Block = array( - 'element' => array( - 'name' => 'blockquote', - 'handler' => 'lines', - 'text' => (array) $matches[1], - ), - ); - - return $Block; - } - } - - protected function blockQuoteContinue($Line, array $Block) - { - if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) - { - if (isset($Block['interrupted'])) - { - $Block['element']['text'] []= ''; - - unset($Block['interrupted']); - } - - $Block['element']['text'] []= $matches[1]; - - return $Block; - } - - if ( ! isset($Block['interrupted'])) - { - $Block['element']['text'] []= $Line['text']; - - return $Block; - } - } - - # - # Rule - - protected function blockRule($Line) - { - if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) - { - $Block = array( - 'element' => array( - 'name' => 'hr' - ), - ); - - return $Block; - } - } - - # - # Setext - - protected function blockSetextHeader($Line, array $Block = null) - { - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) - { - return; - } - - if (chop($Line['text'], $Line['text'][0]) === '') - { - $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; - - return $Block; - } - } - - # - # Markup - - protected function blockMarkup($Line) - { - if ($this->markupEscaped or $this->safeMode) - { - return; - } - - if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) - { - $element = strtolower($matches[1]); - - if (in_array($element, $this->textLevelElements)) - { - return; - } - - $Block = array( - 'name' => $matches[1], - 'depth' => 0, - 'markup' => $Line['text'], - ); - - $length = strlen($matches[0]); - - $remainder = substr($Line['text'], $length); - - if (trim($remainder) === '') - { - if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) - { - $Block['closed'] = true; - - $Block['void'] = true; - } - } - else - { - if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) - { - return; - } - - if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) - { - $Block['closed'] = true; - } - } - - return $Block; - } - } - - protected function blockMarkupContinue($Line, array $Block) - { - if (isset($Block['closed'])) - { - return; - } - - if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open - { - $Block['depth'] ++; - } - - if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close - { - if ($Block['depth'] > 0) - { - $Block['depth'] --; - } - else - { - $Block['closed'] = true; - } - } - - if (isset($Block['interrupted'])) - { - $Block['markup'] .= "\n"; - - unset($Block['interrupted']); - } - - $Block['markup'] .= "\n".$Line['body']; - - return $Block; - } - - # - # Reference - - protected function blockReference($Line) - { - if (preg_match('/^\[(.+?)\]:[ ]*?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches)) - { - $id = strtolower($matches[1]); - - $Data = array( - 'url' => $matches[2], - 'title' => null, - ); - - if (isset($matches[3])) - { - $Data['title'] = $matches[3]; - } - - $this->DefinitionData['Reference'][$id] = $Data; - - $Block = array( - 'hidden' => true, - ); - - return $Block; - } - } - - # - # Table - - protected function blockTable($Line, array $Block = null) - { - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) - { - return; - } - - if (strpos($Block['element']['text'], '|') !== false and chop($Line['text'], ' -:|') === '') - { - $alignments = array(); - - $divider = $Line['text']; - - $divider = trim($divider); - $divider = trim($divider, '|'); - - $dividerCells = explode('|', $divider); - - foreach ($dividerCells as $dividerCell) - { - $dividerCell = trim($dividerCell); - - if ($dividerCell === '') - { - continue; - } - - $alignment = null; - - if ($dividerCell[0] === ':') - { - $alignment = 'left'; - } - - if (substr($dividerCell, - 1) === ':') - { - $alignment = $alignment === 'left' ? 'center' : 'right'; - } - - $alignments []= $alignment; - } - - # ~ - - $HeaderElements = array(); - - $header = $Block['element']['text']; - - $header = trim($header); - $header = trim($header, '|'); - - $headerCells = explode('|', $header); - - foreach ($headerCells as $index => $headerCell) - { - $headerCell = trim($headerCell); - - $HeaderElement = array( - 'name' => 'th', - 'text' => $headerCell, - 'handler' => 'line', - ); - - if (isset($alignments[$index])) - { - $alignment = $alignments[$index]; - - $HeaderElement['attributes'] = array( - 'style' => 'text-align: '.$alignment.';', - ); - } - - $HeaderElements []= $HeaderElement; - } - - # ~ - - $Block = array( - 'alignments' => $alignments, - 'identified' => true, - 'element' => array( - 'name' => 'table', - 'handler' => 'elements', - ), - ); - - $Block['element']['text'] []= array( - 'name' => 'thead', - 'handler' => 'elements', - ); - - $Block['element']['text'] []= array( - 'name' => 'tbody', - 'handler' => 'elements', - 'text' => array(), - ); - - $Block['element']['text'][0]['text'] []= array( - 'name' => 'tr', - 'handler' => 'elements', - 'text' => $HeaderElements, - ); - - return $Block; - } - } - - protected function blockTableContinue($Line, array $Block) - { - if (isset($Block['interrupted'])) - { - return; - } - - if ($Line['text'][0] === '|' or strpos($Line['text'], '|')) - { - $Elements = array(); - - $row = $Line['text']; - - $row = trim($row); - $row = trim($row, '|'); - - preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches); - - foreach ($matches[0] as $index => $cell) - { - $cell = trim($cell); - - $Element = array( - 'name' => 'td', - 'handler' => 'line', - 'text' => $cell, - ); - - if (isset($Block['alignments'][$index])) - { - $Element['attributes'] = array( - 'style' => 'text-align: '.$Block['alignments'][$index].';', - ); - } - - $Elements []= $Element; - } - - $Element = array( - 'name' => 'tr', - 'handler' => 'elements', - 'text' => $Elements, - ); - - $Block['element']['text'][1]['text'] []= $Element; - - return $Block; - } - } - - # - # ~ - # - - protected function paragraph($Line) - { - $Block = array( - 'element' => array( - 'name' => 'p', - 'text' => $Line['text'], - 'handler' => 'line', - ), - ); - - return $Block; - } - - # - # Inline Elements - # - - protected $InlineTypes = array( - '"' => array('SpecialCharacter'), - '!' => array('Image'), - '&' => array('SpecialCharacter'), - '*' => array('Emphasis'), - ':' => array('Url'), - '<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'), - '>' => array('SpecialCharacter'), - '[' => array('Link'), - '_' => array('Emphasis'), - '`' => array('Code'), - '~' => array('Strikethrough'), - '\\' => array('EscapeSequence'), - ); - - # ~ - - protected $inlineMarkerList = '!"*_&[:<>`~\\'; - - # - # ~ - # - - public function line($text, $nonNestables=array()) - { - $markup = ''; - - # $excerpt is based on the first occurrence of a marker - - while ($excerpt = strpbrk($text, $this->inlineMarkerList)) - { - $marker = $excerpt[0]; - - $markerPosition = strpos($text, $marker); - - $Excerpt = array('text' => $excerpt, 'context' => $text); - - foreach ($this->InlineTypes[$marker] as $inlineType) - { - # check to see if the current inline type is nestable in the current context - - if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables)) - { - continue; - } - - $Inline = $this->{'inline'.$inlineType}($Excerpt); - - if ( ! isset($Inline)) - { - continue; - } - - # makes sure that the inline belongs to "our" marker - - if (isset($Inline['position']) and $Inline['position'] > $markerPosition) - { - continue; - } - - # sets a default inline position - - if ( ! isset($Inline['position'])) - { - $Inline['position'] = $markerPosition; - } - - # cause the new element to 'inherit' our non nestables - - foreach ($nonNestables as $non_nestable) - { - $Inline['element']['nonNestables'][] = $non_nestable; - } - - # the text that comes before the inline - $unmarkedText = substr($text, 0, $Inline['position']); - - # compile the unmarked text - $markup .= $this->unmarkedText($unmarkedText); - - # compile the inline - $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']); - - # remove the examined text - $text = substr($text, $Inline['position'] + $Inline['extent']); - - continue 2; - } - - # the marker does not belong to an inline - - $unmarkedText = substr($text, 0, $markerPosition + 1); - - $markup .= $this->unmarkedText($unmarkedText); - - $text = substr($text, $markerPosition + 1); - } - - $markup .= $this->unmarkedText($text); - - return $markup; - } - - # - # ~ - # - - protected function inlineCode($Excerpt) - { - $marker = $Excerpt['text'][0]; - - if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0]), - 'element' => array( - 'name' => 'code', - 'text' => $text, - ), - ); - } - } - - protected function inlineEmailTag($Excerpt) - { - if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches)) - { - $url = $matches[1]; - - if ( ! isset($matches[2])) - { - $url = 'mailto:' . $url; - } - - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'a', - 'text' => $matches[1], - 'attributes' => array( - 'href' => $url, - ), - ), - ); - } - } - - protected function inlineEmphasis($Excerpt) - { - if ( ! isset($Excerpt['text'][1])) - { - return; - } - - $marker = $Excerpt['text'][0]; - - if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) - { - $emphasis = 'strong'; - } - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) - { - $emphasis = 'em'; - } - else - { - return; - } - - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => $emphasis, - 'handler' => 'line', - 'text' => $matches[1], - ), - ); - } - - protected function inlineEscapeSequence($Excerpt) - { - if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) - { - return array( - 'markup' => $Excerpt['text'][1], - 'extent' => 2, - ); - } - } - - protected function inlineImage($Excerpt) - { - if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') - { - return; - } - - $Excerpt['text']= substr($Excerpt['text'], 1); - - $Link = $this->inlineLink($Excerpt); - - if ($Link === null) - { - return; - } - - $Inline = array( - 'extent' => $Link['extent'] + 1, - 'element' => array( - 'name' => 'img', - 'attributes' => array( - 'src' => $Link['element']['attributes']['href'], - 'alt' => $Link['element']['text'], - ), - ), - ); - - $Inline['element']['attributes'] += $Link['element']['attributes']; - - unset($Inline['element']['attributes']['href']); - - return $Inline; - } - - protected function inlineLink($Excerpt) - { - $Element = array( - 'name' => 'a', - 'handler' => 'line', - 'nonNestables' => array('Url', 'Link'), - 'text' => null, - 'attributes' => array( - 'href' => null, - 'title' => null, - ), - ); - - $extent = 0; - - $remainder = $Excerpt['text']; - - if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) - { - $Element['text'] = $matches[1]; - - $extent += strlen($matches[0]); - - $remainder = substr($remainder, $extent); - } - else - { - return; - } - - if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) - { - $Element['attributes']['href'] = $matches[1]; - - if (isset($matches[2])) - { - $Element['attributes']['title'] = substr($matches[2], 1, - 1); - } - - $extent += strlen($matches[0]); - } - else - { - if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) - { - $definition = strlen($matches[1]) ? $matches[1] : $Element['text']; - $definition = strtolower($definition); - - $extent += strlen($matches[0]); - } - else - { - $definition = strtolower($Element['text']); - } - - if ( ! isset($this->DefinitionData['Reference'][$definition])) - { - return; - } - - $Definition = $this->DefinitionData['Reference'][$definition]; - - $Element['attributes']['href'] = $Definition['url']; - $Element['attributes']['title'] = $Definition['title']; - } - - return array( - 'extent' => $extent, - 'element' => $Element, - ); - } - - protected function inlineMarkup($Excerpt) - { - if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false) - { - return; - } - - if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*[ ]*>/s', $Excerpt['text'], $matches)) - { - return array( - 'markup' => $matches[0], - 'extent' => strlen($matches[0]), - ); - } - - if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches)) - { - return array( - 'markup' => $matches[0], - 'extent' => strlen($matches[0]), - ); - } - - if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) - { - return array( - 'markup' => $matches[0], - 'extent' => strlen($matches[0]), - ); - } - } - - protected function inlineSpecialCharacter($Excerpt) - { - if ($Excerpt['text'][0] === '&' and ! preg_match('/^&#?\w+;/', $Excerpt['text'])) - { - return array( - 'markup' => '&', - 'extent' => 1, - ); - } - - $SpecialCharacter = array('>' => 'gt', '<' => 'lt', '"' => 'quot'); - - if (isset($SpecialCharacter[$Excerpt['text'][0]])) - { - return array( - 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';', - 'extent' => 1, - ); - } - } - - protected function inlineStrikethrough($Excerpt) - { - if ( ! isset($Excerpt['text'][1])) - { - return; - } - - if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) - { - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'del', - 'text' => $matches[1], - 'handler' => 'line', - ), - ); - } - } - - protected function inlineUrl($Excerpt) - { - if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') - { - return; - } - - if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) - { - $url = $matches[0][0]; - - $Inline = array( - 'extent' => strlen($matches[0][0]), - 'position' => $matches[0][1], - 'element' => array( - 'name' => 'a', - 'text' => $url, - 'attributes' => array( - 'href' => $url, - ), - ), - ); - - return $Inline; - } - } - - protected function inlineUrlTag($Excerpt) - { - if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches)) - { - $url = $matches[1]; - - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'a', - 'text' => $url, - 'attributes' => array( - 'href' => $url, - ), - ), - ); - } - } - - # ~ - - protected function unmarkedText($text) - { - if ($this->breaksEnabled) - { - $text = preg_replace('/[ ]*\n/', "
    \n", $text); - } - else - { - $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "
    \n", $text); - $text = str_replace(" \n", "\n", $text); - } - - return $text; - } - - # - # Handlers - # - - protected function element(array $Element) - { - if ($this->safeMode) - { - $Element = $this->sanitiseElement($Element); - } - - $markup = '<'.$Element['name']; - - if (isset($Element['attributes'])) - { - foreach ($Element['attributes'] as $name => $value) - { - if ($value === null) - { - continue; - } - - $markup .= ' '.$name.'="'.self::escape($value).'"'; - } - } - - if (isset($Element['text'])) - { - $markup .= '>'; - - if (!isset($Element['nonNestables'])) - { - $Element['nonNestables'] = array(); - } - - if (isset($Element['handler'])) - { - $markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']); - } - else - { - $markup .= self::escape($Element['text'], true); - } - - $markup .= ''; - } - else - { - $markup .= ' />'; - } - - return $markup; - } - - protected function elements(array $Elements) - { - $markup = ''; - - foreach ($Elements as $Element) - { - $markup .= "\n" . $this->element($Element); - } - - $markup .= "\n"; - - return $markup; - } - - # ~ - - protected function li($lines) - { - $markup = $this->lines($lines); - - $trimmedMarkup = trim($markup); - - if ( ! in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '

    ') - { - $markup = $trimmedMarkup; - $markup = substr($markup, 3); - - $position = strpos($markup, "

    "); - - $markup = substr_replace($markup, '', $position, 4); - } - - return $markup; - } - - # - # Deprecated Methods - # - - function parse($text) - { - $markup = $this->text($text); - - return $markup; - } - - protected function sanitiseElement(array $Element) - { - static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; - static $safeUrlNameToAtt = array( - 'a' => 'href', - 'img' => 'src', - ); - - if (isset($safeUrlNameToAtt[$Element['name']])) - { - $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); - } - - if ( ! empty($Element['attributes'])) - { - foreach ($Element['attributes'] as $att => $val) - { - # filter out badly parsed attribute - if ( ! preg_match($goodAttribute, $att)) - { - unset($Element['attributes'][$att]); - } - # dump onevent attribute - elseif (self::striAtStart($att, 'on')) - { - unset($Element['attributes'][$att]); - } - } - } - - return $Element; - } - - protected function filterUnsafeUrlInAttribute(array $Element, $attribute) - { - foreach ($this->safeLinksWhitelist as $scheme) - { - if (self::striAtStart($Element['attributes'][$attribute], $scheme)) - { - return $Element; - } - } - - $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]); - - return $Element; - } - - # - # Static Methods - # - - protected static function escape($text, $allowQuotes = false) - { - return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); - } - - protected static function striAtStart($string, $needle) - { - $len = strlen($needle); - - if ($len > strlen($string)) - { - return false; - } - else - { - return strtolower(substr($string, 0, $len)) === strtolower($needle); - } - } - - static function instance($name = 'default') - { - if (isset(self::$instances[$name])) - { - return self::$instances[$name]; - } - - $instance = new static(); - - self::$instances[$name] = $instance; - - return $instance; - } - - private static $instances = array(); - - # - # Fields - # - - protected $DefinitionData; - - # - # Read-Only - - protected $specialCharacters = array( - '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', - ); - - protected $StrongRegex = array( - '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', - '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us', - ); - - protected $EmRegex = array( - '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', - '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', - ); - - protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?'; - - protected $voidElements = array( - 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', - ); - - protected $textLevelElements = array( - 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', - 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', - 'i', 'rp', 'del', 'code', 'strike', 'marquee', - 'q', 'rt', 'ins', 'font', 'strong', - 's', 'tt', 'kbd', 'mark', - 'u', 'xm', 'sub', 'nobr', - 'sup', 'ruby', - 'var', 'span', - 'wbr', 'time', - ); -} diff --git a/wp-content/plugins/github-updater/vendor/erusev/parsedown/README.md b/wp-content/plugins/github-updater/vendor/erusev/parsedown/README.md deleted file mode 100644 index b5d9ed2..0000000 --- a/wp-content/plugins/github-updater/vendor/erusev/parsedown/README.md +++ /dev/null @@ -1,86 +0,0 @@ -> I also make [Caret](https://caret.io?ref=parsedown) - a Markdown editor for Mac and PC. - -## Parsedown - -[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown) - - -Better Markdown Parser in PHP - -[Demo](http://parsedown.org/demo) | -[Benchmarks](http://parsedown.org/speed) | -[Tests](http://parsedown.org/tests/) | -[Documentation](https://github.com/erusev/parsedown/wiki/) - -### Features - -* One File -* No Dependencies -* Super Fast -* Extensible -* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown) -* Tested in 5.3 to 7.1 and in HHVM -* [Markdown Extra extension](https://github.com/erusev/parsedown-extra) - -### Installation - -Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown). - -### Example - -``` php -$Parsedown = new Parsedown(); - -echo $Parsedown->text('Hello _Parsedown_!'); # prints:

    Hello Parsedown!

    -``` - -More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI). - -### Security - -Parsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself. - -To tell Parsedown that it is processing untrusted user-input, use the following: -```php -$parsedown = new Parsedown; -$parsedown->setSafeMode(true); -``` - -If instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/). - -In both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above. - -#### Security of Parsedown Extensions - -Safe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS. - -### Escaping HTML -> ⚠️  **WARNING:** This method isn't safe from XSS! - -If you wish to escape HTML **in trusted input**, you can use the following: -```php -$parsedown = new Parsedown; -$parsedown->setMarkupEscaped(true); -``` - -Beware that this still allows users to insert unsafe scripting vectors, such as links like `[xss](javascript:alert%281%29)`. - -### Questions - -**How does Parsedown work?** - -It tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines). - -We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages. - -**Is it compliant with CommonMark?** - -It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve. - -**Who uses it?** - -[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents). - -**How can I help?** - -Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2). diff --git a/wp-content/plugins/github-updater/vendor/erusev/parsedown/composer.json b/wp-content/plugins/github-updater/vendor/erusev/parsedown/composer.json deleted file mode 100644 index f8b40f8..0000000 --- a/wp-content/plugins/github-updater/vendor/erusev/parsedown/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "erusev/parsedown", - "description": "Parser for Markdown.", - "keywords": ["markdown", "parser"], - "homepage": "http://parsedown.org", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "require": { - "php": ">=5.3.0", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "autoload": { - "psr-0": {"Parsedown": ""} - }, - "autoload-dev": { - "psr-0": { - "TestParsedown": "test/", - "ParsedownTest": "test/", - "CommonMarkTest": "test/", - "CommonMarkTestWeak": "test/" - } - } -}