5.1
- Added a way to filter GitHub and GitLab releases.
- Example of filtering releases by the version number:
//Allow only beta versions (e.g. for testing). $updateChecker->getVcsApi()->setReleaseVersionFilter( '/beta/i', //Regex for the version number. Api::RELEASE_FILTER_ALL, //Disables the default filter(s). 30 //Max number of recent releases to scan for matches. );
- Alternatively, you can use a callback to implement custom filtering rules.
//Set an arbitrary custom filter. $updateChecker->getVcsApi()->setReleaseFilter( function($versionNumber, $releaseObject) { /* Put your custom logic here. The $releaseObject variable contains the release data returned by the GitHub/GitLab API. The format will vary depending on which service you're using. */ return true; }, Api::RELEASE_FILTER_ALL );
- Aside from
Api::RELEASE_FILTER_ALL
, you can also useApi::RELEASE_FILTER_SKIP_PRERELEASE
to filter out pre-releases. - Setting a new filter will override any previous filters, so you can't add a regex-based version filter and a custom callback at the same time.
- Example of filtering releases by the version number:
- Fixed a release asset filtering bug where an asset that matches the filter could be ignored if it was not the first in the list. Props to @liedekef.
- Changed the readme parser to use
wp_strip_all_tags()
instead ofstrip_tags()
when available. Supposedly, it's better at stripping the contents of<script>
and<style>
tags. - The
main
branch is now treated as a default branch (in addition tomaster
).