From b718294d3c7b6aa6ca977cafccacaf8694a9ecce Mon Sep 17 00:00:00 2001 From: hanyixuanten <105723997+hanyixuanten@users.noreply.github.com> Date: Mon, 10 Aug 2026 19:03:44 +0800 Subject: [PATCH] rename --- .github/ISSUE_TEMPLATE/issue-en.yml | 4 +-- .github/ISSUE_TEMPLATE/issue.yml | 4 +-- .github/workflows/deploy-wordpress-svn.yml | 4 +-- .github/workflows/package-plugin.yml | 6 ++-- AGENTS.md | 8 +++--- README.md | 28 +++++++++---------- README_zh.md | 24 ++++++++-------- build.sh | 16 ++++------- includes/class-contest-client.php | 6 ++-- includes/class-plugin.php | 24 ++++++++-------- includes/class-schedule-renderer.php | 14 +++++----- ...N.po => vblg-oi-contest-schedule-zh_CN.po} | 6 ++-- ...edule.pot => vblg-oi-contest-schedule.pot} | 6 ++-- readme.txt | 16 +++++------ ...hedule.php => vblg-oi-contest-schedule.php | 10 ++----- 15 files changed, 82 insertions(+), 94 deletions(-) rename languages/{oi-contest-schedule-zh_CN.po => vblg-oi-contest-schedule-zh_CN.po} (92%) rename languages/{oi-contest-schedule.pot => vblg-oi-contest-schedule.pot} (89%) rename oi-contest-schedule.php => vblg-oi-contest-schedule.php (73%) diff --git a/.github/ISSUE_TEMPLATE/issue-en.yml b/.github/ISSUE_TEMPLATE/issue-en.yml index 4b2c943..9994989 100644 --- a/.github/ISSUE_TEMPLATE/issue-en.yml +++ b/.github/ISSUE_TEMPLATE/issue-en.yml @@ -1,5 +1,5 @@ name: Bug Report and Feature Request -description: Report an OI Contest Schedule issue or suggest a feature or documentation improvement +description: Report a vblg OI Contest Schedule issue or suggest a feature or documentation improvement title: "[Issue]: " body: - type: markdown @@ -32,7 +32,7 @@ body: - type: input id: plugin-version attributes: - label: OI Contest Schedule version + label: vblg OI Contest Schedule version placeholder: "For example: 0.1.0" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/issue.yml b/.github/ISSUE_TEMPLATE/issue.yml index 9dfd42b..4e4680f 100644 --- a/.github/ISSUE_TEMPLATE/issue.yml +++ b/.github/ISSUE_TEMPLATE/issue.yml @@ -1,5 +1,5 @@ name: 问题反馈与功能建议 -description: 反馈 OI Contest Schedule 的问题,或提出功能和文档改进建议 +description: 反馈 vblg OI Contest Schedule 的问题,或提出功能和文档改进建议 title: "[Issue]: " body: - type: markdown @@ -32,7 +32,7 @@ body: - type: input id: plugin-version attributes: - label: OI Contest Schedule 版本 + label: vblg OI Contest Schedule 版本 placeholder: 例如:0.1.0 validations: required: true diff --git a/.github/workflows/deploy-wordpress-svn.yml b/.github/workflows/deploy-wordpress-svn.yml index 1ae22c3..fd2c1fc 100644 --- a/.github/workflows/deploy-wordpress-svn.yml +++ b/.github/workflows/deploy-wordpress-svn.yml @@ -21,8 +21,8 @@ jobs: runs-on: ubuntu-latest env: - PLUGIN_SLUG: oi-contest-schedule - SVN_URL: https://plugins.svn.wordpress.org/oi-contest-schedule + PLUGIN_SLUG: vblg-oi-contest-schedule + SVN_URL: https://plugins.svn.wordpress.org/vblg-oi-contest-schedule SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} diff --git a/.github/workflows/package-plugin.yml b/.github/workflows/package-plugin.yml index f5a364a..7b2e83e 100644 --- a/.github/workflows/package-plugin.yml +++ b/.github/workflows/package-plugin.yml @@ -29,8 +29,8 @@ jobs: id: package run: | set -eu - version="$(grep -E '^ \* Version:' oi-contest-schedule.php | sed -E 's/^ \* Version: *//')" - archive_name="oi-contest-schedule-${version}.zip" + version="$(grep -E '^ \* Version:' vblg-oi-contest-schedule.php | sed -E 's/^ \* Version: *//')" + archive_name="vblg-oi-contest-schedule-${version}.zip" if [ "${GITHUB_REF_TYPE}" = "tag" ] && [ "${GITHUB_REF_NAME}" != "v${version}" ]; then printf 'Tag %s does not match plugin version %s.\n' "${GITHUB_REF_NAME}" "${version}" >&2 exit 1 @@ -41,7 +41,7 @@ jobs: - name: Upload plugin archive uses: actions/upload-artifact@v4 with: - name: oi-contest-schedule-plugin + name: vblg-oi-contest-schedule-plugin path: ${{ steps.package.outputs.archive }} if-no-files-found: error retention-days: 30 diff --git a/AGENTS.md b/AGENTS.md index 5111987..a130659 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,7 +10,7 @@ ## Architecture -- `oi-contest-schedule.php` owns plugin metadata, constants, loading, and startup hooks. +- `vblg-oi-contest-schedule.php` owns plugin metadata, constants, loading, and startup hooks. - `includes/class-plugin.php` owns WordPress integration, widgets, shortcode registration, and asset enqueueing. - `includes/class-contest-client.php` owns remote fetching, transient caching, validation, normalization, and sorting. - `includes/class-schedule-renderer.php` owns escaped server-rendered markup. @@ -19,8 +19,8 @@ ## Localization and text changes -- Whenever modifying a file that contains text, explicitly check whether the change adds, removes, or changes user-facing/translatable strings and whether `languages/oi-contest-schedule.pot` and `languages/oi-contest-schedule-zh_CN.po` must also change. -- PHP gettext calls use the `oi-contest-schedule` text domain. JavaScript-facing translated strings are localized from PHP. +- Whenever modifying a file that contains text, explicitly check whether the change adds, removes, or changes user-facing/translatable strings and whether `languages/vblg-oi-contest-schedule.pot` and `languages/vblg-oi-contest-schedule-zh_CN.po` must also change. +- PHP gettext calls use the `vblg-oi-contest-schedule` text domain. Translations are loaded by WordPress automatically; the plugin does not call `load_plugin_textdomain()`, and the packaged ZIP does not include `languages/`. JavaScript-facing translated strings are localized from PHP. - Treat POT and PO files as editable localization sources. MO files are generated by the build and must not be committed from the source tree. - After PO changes, run `./build.sh build`; it validates gettext syntax and format placeholders with `msgfmt`. @@ -36,7 +36,7 @@ When the user's message is exactly `release X.Y.Z` or `release vX.Y.Z` (allowing 1. Confirm the version is valid SemVer and inspect the worktree before editing. Do not overwrite unrelated user changes. 2. Find the previous release tag from Git history, preferring the nearest reachable version tag: `git describe --tags --abbrev=0 --match 'v*'`. If none exists, state that the release notes cover the full repository history. -3. Search tracked source files for the current version and release metadata. Update every applicable version occurrence, including the plugin header and `OICS_VERSION` in `oi-contest-schedule.php`, `Stable tag` plus changelog/upgrade-notice headings in `readme.txt`, and `Project-Id-Version` in both PO and POT files. Review other search results rather than assuming this list is exhaustive. Do not edit generated copies under `build/`. +3. Search tracked source files for the current version and release metadata. Update every applicable version occurrence, including the plugin header and `OICS_VERSION` in `vblg-oi-contest-schedule.php`, `Stable tag` plus changelog/upgrade-notice headings in `readme.txt`, and `Project-Id-Version` in both PO and POT files. Review other search results rather than assuming this list is exhaustive. Do not edit generated copies under `build/`. 4. Review `git diff ..HEAD` and the commit log over the same range. Derive release notes only from that evidence; group user-visible changes, fixes, compatibility changes, and developer-facing changes as appropriate. Do not include uncommitted release-preparation edits as previously completed work unless clearly labeled. 5. Add concise release entries to the repository changelog/upgrade notice where appropriate, keeping WordPress.org formatting valid. Check whether English and Chinese documentation or translations need corresponding updates. 6. Run `./build.sh build` and report any validation failures. Confirm the produced ZIP version and the requested tag agree with the plugin header and `Stable tag`. diff --git a/README.md b/README.md index bc23cc4..c930b42 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# OI Contest Schedule +# vblg OI Contest Schedule [简体中文](README_zh.md) -OI Contest Schedule is a lightweight WordPress plugin that displays currently running and upcoming competitive programming contests in the WordPress dashboard or on any post or page. Contests that have ended are not displayed. +vblg OI Contest Schedule is a lightweight WordPress plugin that displays currently running and upcoming competitive programming contests in the WordPress dashboard or on any post or page. Contests that have ended are not displayed. Contest data is provided by [OI-contest-fetch](https://github.com/hanyixuanten/OI-contest-fetch) and displayed in each visitor's client device time zone, not the time zone configured in WordPress. The schedule identifies the client time zone by its IANA name, such as `Asia/Shanghai`. ## Features - Adds an **Upcoming OI Contests** widget to the WordPress dashboard. -- Provides an **OI Contest Schedule** block for posts and pages. +- Provides a **vblg OI Contest Schedule** block for posts and pages. - Keeps the `[oi_contest_schedule]` shortcode available for compatibility and templates. - Shows contest platform, title, start and end times, and a live countdown. - Identifies contests that are currently running. @@ -27,20 +27,20 @@ Contest data is provided by [OI-contest-fetch](https://github.com/hanyixuanten/O ### Install a release package -1. Download the latest plugin ZIP from the repository's [Releases](https://github.com/hanyixuanten/oi-contest-schedule/releases) page. +1. Download the latest plugin ZIP from the repository's [Releases](https://github.com/hanyixuanten/vblg-oi-contest-schedule/releases) page. 2. In WordPress, go to **Plugins > Add New Plugin > Upload Plugin**. 3. Select the ZIP file, then install and activate the plugin. ### Install from source -1. Copy or clone this repository to `wp-content/plugins/oi-contest-schedule`. -2. Activate **OI Contest Schedule** from the WordPress **Plugins** page. +1. Copy or clone this repository to `wp-content/plugins/vblg-oi-contest-schedule`. +2. Activate **vblg OI Contest Schedule** from the WordPress **Plugins** page. After activation, the dashboard widget appears automatically on **Dashboard > Home**. ## Editor Block -In the post or page editor, select **Add block**, search for **OI Contest Schedule**, and insert the block. Use the block settings sidebar to choose how many contests to display (1-50) and whether to use the compact layout. +In the post or page editor, select **Add block**, search for **vblg OI Contest Schedule**, and insert the block. Use the block settings sidebar to choose how many contests to display (1-50) and whether to use the compact layout. The block is rendered dynamically, so contest data remains current without editing the post. @@ -90,7 +90,7 @@ The plugin has no Composer or npm dependencies. To build an installable archive, ./build.sh build ``` -The command validates translations and package contents, then creates `oi-contest-schedule-.zip` in the repository root. To remove local build artifacts, run: +The command validates translations and package contents, then creates `vblg-oi-contest-schedule-.zip` in the repository root. The packaged archive does not include the `languages/` directory. To remove local build artifacts, run: ```bash ./build.sh clean @@ -99,12 +99,12 @@ The command validates translations and package contents, then creates `oi-contes ## Project Structure ```text -oi-contest-schedule.php Plugin bootstrap and metadata -includes/ Data client, renderer, and plugin integration -assets/ Frontend styles and countdown script -languages/ Translation template and Chinese translation -uninstall.php Cache cleanup on uninstall -build.sh Release package builder +vblg-oi-contest-schedule.php Plugin bootstrap and metadata +includes/ Data client, renderer, and plugin integration +assets/ Frontend styles and countdown script +languages/ Translation template and Chinese translation (not packaged) +uninstall.php Cache cleanup on uninstall +build.sh Release package builder ``` ## License diff --git a/README_zh.md b/README_zh.md index 126e701..c4205cb 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,8 +1,8 @@ -# OI Contest Schedule +# vblg OI Contest Schedule [English](README.md) -OI Contest Schedule 是一款轻量级 WordPress 插件,可在 WordPress 仪表盘、文章或页面中展示正在进行和即将开始的程序设计竞赛,不显示已结束的赛事。 +vblg OI Contest Schedule 是一款轻量级 WordPress 插件,可在 WordPress 仪表盘、文章或页面中展示正在进行和即将开始的程序设计竞赛,不显示已结束的赛事。 比赛数据由 [OI-contest-fetch](https://github.com/hanyixuanten/OI-contest-fetch) 提供,时间会根据访客客户端设备的时区显示,而非 WordPress 中设置的站点时区。日程中会标明客户端时区的 IANA 名称,例如 `Asia/Shanghai`。 @@ -27,14 +27,14 @@ OI Contest Schedule 是一款轻量级 WordPress 插件,可在 WordPress 仪 ### 安装发行包 -1. 从仓库的 [Releases](https://github.com/hanyixuanten/oi-contest-schedule/releases) 页面下载最新的插件 ZIP 包。 +1. 从仓库的 [Releases](https://github.com/hanyixuanten/vblg-oi-contest-schedule/releases) 页面下载最新的插件 ZIP 包。 2. 在 WordPress 后台进入 **插件 > 安装插件 > 上传插件**。 3. 选择 ZIP 文件,然后安装并启用插件。 ### 从源码安装 -1. 将本仓库复制或克隆到 `wp-content/plugins/oi-contest-schedule`。 -2. 在 WordPress 后台的 **插件** 页面启用 **OI Contest Schedule**。 +1. 将本仓库复制或克隆到 `wp-content/plugins/vblg-oi-contest-schedule`。 +2. 在 WordPress 后台的 **插件** 页面启用 **vblg OI Contest Schedule**。 启用后,赛事小组件会自动显示在 **仪表盘 > 首页** 中。 @@ -90,7 +90,7 @@ add_filter( ./build.sh build ``` -该命令会检查翻译和安装包内容,并在仓库根目录生成 `oi-contest-schedule-<版本>.zip`。清理本地构建产物可运行: +该命令会检查翻译和安装包内容,并在仓库根目录生成 `vblg-oi-contest-schedule-<版本>.zip`。生成的安装包不包含 `languages/` 目录。清理本地构建产物可运行: ```bash ./build.sh clean @@ -99,12 +99,12 @@ add_filter( ## 项目结构 ```text -oi-contest-schedule.php 插件入口与元数据 -includes/ 数据客户端、渲染器和插件集成 -assets/ 前端样式与倒计时脚本 -languages/ 翻译模板与中文翻译 -uninstall.php 卸载时清理缓存 -build.sh 发布包构建脚本 +vblg-oi-contest-schedule.php 插件入口与元数据 +includes/ 数据客户端、渲染器和插件集成 +assets/ 前端样式与倒计时脚本 +languages/ 翻译模板与中文翻译(不打包) +uninstall.php 卸载时清理缓存 +build.sh 发布包构建脚本 ``` ## 许可证 diff --git a/build.sh b/build.sh index fc3fa74..30d826a 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ set -eu -plugin_slug="oi-contest-schedule" +plugin_slug="vblg-oi-contest-schedule" plugin_file="${plugin_slug}.php" script_dir="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)" build_dir="${script_dir}/build" @@ -34,23 +34,17 @@ build() { "${plugin_dir}/" cp -R "${script_dir}/includes" "${plugin_dir}/" cp -R "${script_dir}/assets" "${plugin_dir}/" - mkdir -p "${plugin_dir}/languages" - cp "${script_dir}/languages/${plugin_slug}.pot" \ - "${script_dir}/languages/${plugin_slug}-zh_CN.po" \ - "${plugin_dir}/languages/" - msgfmt --check --check-format \ - --output-file="${plugin_dir}/languages/${plugin_slug}-zh_CN.mo" \ + msgfmt --check --check-format --output-file=/dev/null \ "${script_dir}/languages/${plugin_slug}-zh_CN.po" ( cd "${build_dir}" zip -qr "${archive_path}" "${plugin_slug}" ) - unzip -p "${archive_path}" "${plugin_slug}/${plugin_file}" | grep -q '^ \* Plugin Name: OI Contest Schedule$' + unzip -p "${archive_path}" "${plugin_slug}/${plugin_file}" | grep -q '^ \* Plugin Name: vblg OI Contest Schedule$' unzip -p "${archive_path}" "${plugin_slug}/readme.txt" | grep -q "^Stable tag: ${version}$" - unzip -Z1 "${archive_path}" | grep -q "^${plugin_slug}/languages/${plugin_slug}-zh_CN.mo$" - if unzip -Z1 "${archive_path}" | grep -q '/wp-plugins-.*\.po$'; then - printf 'Unexpected GlotPress submission file found in archive.\n' >&2 + if unzip -Z1 "${archive_path}" | grep -q "^${plugin_slug}/languages/"; then + printf 'Unexpected languages directory found in archive.\n' >&2 exit 1 fi unzip -Z1 "${archive_path}" | grep -q "^${plugin_slug}/includes/class-contest-client.php$" diff --git a/includes/class-contest-client.php b/includes/class-contest-client.php index ee9cb88..8eefa88 100644 --- a/includes/class-contest-client.php +++ b/includes/class-contest-client.php @@ -17,7 +17,7 @@ final class OICS_Contest_Client { apply_filters( 'oics_contest_data_url', self::DATA_URL ), array( 'timeout' => 10, - 'user-agent' => 'OI Contest Schedule/' . OICS_VERSION . '; ' . home_url( '/' ), + 'user-agent' => 'vblg OI Contest Schedule/' . OICS_VERSION . '; ' . home_url( '/' ), ) ); @@ -26,12 +26,12 @@ final class OICS_Contest_Client { } if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { - return new WP_Error( 'oics_http_error', __( 'The contest data source returned an unexpected response.', 'oi-contest-schedule' ) ); + return new WP_Error( 'oics_http_error', __( 'The contest data source returned an unexpected response.', 'vblg-oi-contest-schedule' ) ); } $payload = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! $this->is_valid_payload( $payload ) ) { - return new WP_Error( 'oics_invalid_payload', __( 'The contest data source returned invalid data.', 'oi-contest-schedule' ) ); + return new WP_Error( 'oics_invalid_payload', __( 'The contest data source returned invalid data.', 'vblg-oi-contest-schedule' ) ); } $normalized = array( diff --git a/includes/class-plugin.php b/includes/class-plugin.php index f150575..8edb279 100644 --- a/includes/class-plugin.php +++ b/includes/class-plugin.php @@ -37,11 +37,11 @@ final class OICS_Plugin { 'oics-schedule-editor', 'oicsScheduleEditorL10n', array( - 'title' => __( 'OI Contest Schedule', 'oi-contest-schedule' ), - 'description' => __( 'Display upcoming OI contests with local times and live countdowns.', 'oi-contest-schedule' ), - 'settings' => __( 'Schedule settings', 'oi-contest-schedule' ), - 'limit' => __( 'Number of contests', 'oi-contest-schedule' ), - 'compact' => __( 'Compact layout', 'oi-contest-schedule' ), + 'title' => __( 'vblg OI Contest Schedule', 'vblg-oi-contest-schedule' ), + 'description' => __( 'Display upcoming OI contests with local times and live countdowns.', 'vblg-oi-contest-schedule' ), + 'settings' => __( 'Schedule settings', 'vblg-oi-contest-schedule' ), + 'limit' => __( 'Number of contests', 'vblg-oi-contest-schedule' ), + 'compact' => __( 'Compact layout', 'vblg-oi-contest-schedule' ), ) ); @@ -77,12 +77,12 @@ final class OICS_Plugin { 'oics-schedule', 'oicsScheduleL10n', array( - 'running' => __( 'Running', 'oi-contest-schedule' ), - 'ended' => __( 'Ended', 'oi-contest-schedule' ), - 'day' => __( 'd', 'oi-contest-schedule' ), - 'hour' => __( 'h', 'oi-contest-schedule' ), - 'minute' => __( 'm', 'oi-contest-schedule' ), - 'second' => __( 's', 'oi-contest-schedule' ), + 'running' => __( 'Running', 'vblg-oi-contest-schedule' ), + 'ended' => __( 'Ended', 'vblg-oi-contest-schedule' ), + 'day' => __( 'd', 'vblg-oi-contest-schedule' ), + 'hour' => __( 'h', 'vblg-oi-contest-schedule' ), + 'minute' => __( 'm', 'vblg-oi-contest-schedule' ), + 'second' => __( 's', 'vblg-oi-contest-schedule' ), ) ); } @@ -113,7 +113,7 @@ final class OICS_Plugin { public function register_dashboard_widget() { wp_add_dashboard_widget( 'oics_contest_schedule', - esc_html__( 'Upcoming OI Contests', 'oi-contest-schedule' ), + esc_html__( 'Upcoming OI Contests', 'vblg-oi-contest-schedule' ), array( $this, 'render_dashboard_widget' ) ); } diff --git a/includes/class-schedule-renderer.php b/includes/class-schedule-renderer.php index b32f30f..efe6627 100644 --- a/includes/class-schedule-renderer.php +++ b/includes/class-schedule-renderer.php @@ -12,12 +12,12 @@ final class OICS_Schedule_Renderer { public function render( $limit = 10, $compact = false ) { $payload = $this->client->get_payload(); if ( is_wp_error( $payload ) ) { - return $this->render_notice( __( 'Contest data is temporarily unavailable. Please try again later.', 'oi-contest-schedule' ), 'error' ); + return $this->render_notice( __( 'Contest data is temporarily unavailable. Please try again later.', 'vblg-oi-contest-schedule' ), 'error' ); } $contests = array_slice( $payload['contests'], 0, $limit ); if ( empty( $contests ) ) { - return $this->render_notice( __( 'No upcoming contests.', 'oi-contest-schedule' ), 'empty' ); + return $this->render_notice( __( 'No upcoming contests.', 'vblg-oi-contest-schedule' ), 'empty' ); } $classes = 'oics-schedule'; @@ -30,13 +30,13 @@ final class OICS_Schedule_Renderer {
-

+

- : + : UTC

- +
@@ -45,7 +45,7 @@ final class OICS_Schedule_Renderer {

- : + :

@@ -69,7 +69,7 @@ final class OICS_Schedule_Renderer { - +