From 4a71ab3b10ca5fc9f427d3e0a4f6b38fa46829ab Mon Sep 17 00:00:00 2001 From: Seaton Jiang Date: Sun, 4 Oct 2020 12:12:50 +0800 Subject: [PATCH] fix: replace default github branch --- README.md | 6 +++--- .../includes/class-options-interface.php | 2 +- inc/update-checker/Puc/v4p9/Vcs/Api.php | 4 ++-- inc/update-checker/Puc/v4p9/Vcs/BaseChecker.php | 2 +- inc/update-checker/Puc/v4p9/Vcs/BitBucketApi.php | 4 ++-- inc/update-checker/Puc/v4p9/Vcs/GitHubApi.php | 8 ++++---- inc/update-checker/Puc/v4p9/Vcs/GitLabApi.php | 6 +++--- inc/update-checker/Puc/v4p9/Vcs/PluginUpdateChecker.php | 4 ++-- inc/update-checker/Puc/v4p9/Vcs/ThemeUpdateChecker.php | 4 ++-- languages/kratos.pot | 4 ++-- style.css | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 798956a3..f7d6edd4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

@@ -189,11 +189,11 @@ Detailed changes for each release are documented in the [release notes](https:// If you find Kratos useful, you can buy us a cup of coffee

- +

## License -The code is available under the [MIT](https://github.com/vtrois/kratos/blob/master/LICENSE) license. +The code is available under the [MIT](https://github.com/vtrois/kratos/blob/main/LICENSE) license. The document is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](http://creativecommons.org/licenses/by-nc-nd/4.0/). diff --git a/inc/options-framework/includes/class-options-interface.php b/inc/options-framework/includes/class-options-interface.php index 9243222a..048480b7 100755 --- a/inc/options-framework/includes/class-options-interface.php +++ b/inc/options-framework/includes/class-options-interface.php @@ -246,7 +246,7 @@ public static function optionsframework_fields()

' . __('讨论交流', 'kratos') . '

' . __('版权声明', 'kratos') . '

-

' . __('主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND 4.0 进行许可。', 'kratos') . '

+

' . __('主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND 4.0 进行许可。', 'kratos') . '

' . __('打赏支持', 'kratos') . '

'; diff --git a/inc/update-checker/Puc/v4p9/Vcs/Api.php b/inc/update-checker/Puc/v4p9/Vcs/Api.php index 2827f0b4..27702f2c 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/Api.php +++ b/inc/update-checker/Puc/v4p9/Vcs/Api.php @@ -59,7 +59,7 @@ abstract public function chooseReference($configBranch); * @param string $ref Tag or branch name. * @return array Parsed readme. */ - public function getRemoteReadme($ref = 'master') { + public function getRemoteReadme($ref = 'main') { $fileContents = $this->getRemoteFile($this->getLocalReadmeName(), $ref); if ( empty($fileContents) ) { return array(); @@ -196,7 +196,7 @@ protected function compareTagNames($tag1, $tag2) { * @param string $ref * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. */ - abstract public function getRemoteFile($path, $ref = 'master'); + abstract public function getRemoteFile($path, $ref = 'main'); /** * Get the timestamp of the latest commit that changed the specified branch or tag. diff --git a/inc/update-checker/Puc/v4p9/Vcs/BaseChecker.php b/inc/update-checker/Puc/v4p9/Vcs/BaseChecker.php index 2dab4359..27b77eb1 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/BaseChecker.php +++ b/inc/update-checker/Puc/v4p9/Vcs/BaseChecker.php @@ -3,7 +3,7 @@ interface Puc_v4p9_Vcs_BaseChecker { /** - * Set the repository branch to use for updates. Defaults to 'master'. + * Set the repository branch to use for updates. Defaults to 'main'. * * @param string $branch * @return $this diff --git a/inc/update-checker/Puc/v4p9/Vcs/BitBucketApi.php b/inc/update-checker/Puc/v4p9/Vcs/BitBucketApi.php index 52787c1f..40ce0311 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/BitBucketApi.php +++ b/inc/update-checker/Puc/v4p9/Vcs/BitBucketApi.php @@ -42,7 +42,7 @@ public function chooseReference($configBranch) { $updateSource = $this->getStableTag($configBranch); //Look for version-like tags. - if ( !$updateSource && ($configBranch === 'master') ) { + if ( !$updateSource && ($configBranch === 'main') ) { $updateSource = $this->getLatestTag(); } //If all else fails, use the specified branch itself. @@ -156,7 +156,7 @@ protected function getDownloadUrl($ref) { * @param string $ref * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. */ - public function getRemoteFile($path, $ref = 'master') { + public function getRemoteFile($path, $ref = 'main') { $response = $this->api('src/' . $ref . '/' . ltrim($path)); if ( is_wp_error($response) || !is_string($response) ) { return null; diff --git a/inc/update-checker/Puc/v4p9/Vcs/GitHubApi.php b/inc/update-checker/Puc/v4p9/Vcs/GitHubApi.php index 0187a666..343cf6ee 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/GitHubApi.php +++ b/inc/update-checker/Puc/v4p9/Vcs/GitHubApi.php @@ -164,7 +164,7 @@ public function getBranch($branchName) { * @param string $ref Reference name (e.g. branch or tag). * @return StdClass|null */ - public function getLatestCommit($filename, $ref = 'master') { + public function getLatestCommit($filename, $ref = 'main') { $commits = $this->api( '/repos/:user/:repo/commits', array( @@ -264,7 +264,7 @@ protected function buildApiUrl($url, $queryParams) { * @param string $ref * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. */ - public function getRemoteFile($path, $ref = 'master') { + public function getRemoteFile($path, $ref = 'main') { $apiUrl = '/repos/:user/:repo/contents/' . $path; $response = $this->api($apiUrl, array('ref' => $ref)); @@ -280,7 +280,7 @@ public function getRemoteFile($path, $ref = 'master') { * @param string $ref * @return string */ - public function buildArchiveDownloadUrl($ref = 'master') { + public function buildArchiveDownloadUrl($ref = 'main') { $url = sprintf( 'https://api.github.com/repos/%1$s/%2$s/zipball/%3$s', urlencode($this->userName), @@ -319,7 +319,7 @@ public function setAuthentication($credentials) { public function chooseReference($configBranch) { $updateSource = null; - if ( $configBranch === 'master' ) { + if ( $configBranch === 'main' ) { //Use the latest release. $updateSource = $this->getLatestRelease(); if ( $updateSource === null ) { diff --git a/inc/update-checker/Puc/v4p9/Vcs/GitLabApi.php b/inc/update-checker/Puc/v4p9/Vcs/GitLabApi.php index 30bbd13c..8eb477b3 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/GitLabApi.php +++ b/inc/update-checker/Puc/v4p9/Vcs/GitLabApi.php @@ -238,7 +238,7 @@ protected function buildApiUrl($url, $queryParams) { * @param string $ref * @return null|string Either the contents of the file, or null if the file doesn't exist or there's an error. */ - public function getRemoteFile($path, $ref = 'master') { + public function getRemoteFile($path, $ref = 'main') { $response = $this->api('/:id/repository/files/' . $path, array('ref' => $ref)); if ( is_wp_error($response) || !isset($response->content) || $response->encoding !== 'base64' ) { return null; @@ -253,7 +253,7 @@ public function getRemoteFile($path, $ref = 'master') { * @param string $ref * @return string */ - public function buildArchiveDownloadUrl($ref = 'master') { + public function buildArchiveDownloadUrl($ref = 'main') { $url = sprintf( '%1$s://%2$s/api/v4/projects/%3$s/repository/archive.zip', $this->repositoryProtocol, @@ -289,7 +289,7 @@ public function chooseReference($configBranch) { $updateSource = null; // GitLab doesn't handle releases the same as GitHub so just use the latest tag - if ( $configBranch === 'master' ) { + if ( $configBranch === 'main' ) { $updateSource = $this->getLatestTag(); } diff --git a/inc/update-checker/Puc/v4p9/Vcs/PluginUpdateChecker.php b/inc/update-checker/Puc/v4p9/Vcs/PluginUpdateChecker.php index c21cf66c..6c901780 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/PluginUpdateChecker.php +++ b/inc/update-checker/Puc/v4p9/Vcs/PluginUpdateChecker.php @@ -3,9 +3,9 @@ class Puc_v4p9_Vcs_PluginUpdateChecker extends Puc_v4p9_Plugin_UpdateChecker implements Puc_v4p9_Vcs_BaseChecker { /** - * @var string The branch where to look for updates. Defaults to "master". + * @var string The branch where to look for updates. Defaults to "main". */ - protected $branch = 'master'; + protected $branch = 'main'; /** * @var Puc_v4p9_Vcs_Api Repository API client. diff --git a/inc/update-checker/Puc/v4p9/Vcs/ThemeUpdateChecker.php b/inc/update-checker/Puc/v4p9/Vcs/ThemeUpdateChecker.php index b23f4c98..060376cf 100644 --- a/inc/update-checker/Puc/v4p9/Vcs/ThemeUpdateChecker.php +++ b/inc/update-checker/Puc/v4p9/Vcs/ThemeUpdateChecker.php @@ -4,9 +4,9 @@ class Puc_v4p9_Vcs_ThemeUpdateChecker extends Puc_v4p9_Theme_UpdateChecker implements Puc_v4p9_Vcs_BaseChecker { /** - * @var string The branch where to look for updates. Defaults to "master". + * @var string The branch where to look for updates. Defaults to "main". */ - protected $branch = 'master'; + protected $branch = 'main'; /** * @var Puc_v4p9_Vcs_Api Repository API client. diff --git a/languages/kratos.pot b/languages/kratos.pot index 680557de..f01c807b 100644 --- a/languages/kratos.pot +++ b/languages/kratos.pot @@ -3,7 +3,7 @@ msgid "" msgstr "" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Project-Id-Version: Kratos\n" -"POT-Creation-Date: 2020-09-30 18:27+0800\n" +"POT-Creation-Date: 2020-10-04 12:12+0800\n" "PO-Revision-Date: 2020-02-14 23:32+0800\n" "Last-Translator: \n" "Language-Team: \n" @@ -181,7 +181,7 @@ msgstr "" #: inc/options-framework/includes/class-options-interface.php:249 msgid "" -"主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND " "4.0 进行许可。" diff --git a/style.css b/style.css index 0f9b8d70..98ddcf81 100644 --- a/style.css +++ b/style.css @@ -9,5 +9,5 @@ Author: Seaton Jiang Author URI: https://www.vtrois.com/ Theme URI: https://github.com/vtrois/kratos License: MIT License -License URI: https://github.com/vtrois/kratos/blob/master/LICENSE +License URI: https://github.com/vtrois/kratos/blob/main/LICENSE */