• v0.2.0 f6080eeeb6

    v0.2.0 Stable

    hanyixuanten released this 2026-08-12 18:48:13 +08:00 | 0 commits to main since this release

    Full Changelog: https://github.com/hanyixuanten/oi-contest-schedule/compare/v0.1.0...v0.2.0

    v0.2.0

    English

    Changed

    • Renamed the plugin to vblg OI Contest Schedule, including its package slug, bootstrap file, text domain, translation sources, documentation, issue templates, and distribution workflows.
    • Renamed the shortcode from [oi_contest_schedule] to [oics_oi_contest_schedule].
    • Updated the dashboard widget to use the standard responsive layout instead of forcing the compact layout.
    • Switched translation delivery to WordPress.org language packs and excluded translation source files from release packages.
    • Updated the build and deployment workflows for the new plugin slug and package name.

    Upgrade Notes

    • The plugin slug and shortcode have changed. Existing content using [oi_contest_schedule] must be updated to [oics_oi_contest_schedule].

    简体中文

    变更

    • 插件更名为 vblg OI Contest Schedule,并同步更新软件包 slug、入口文件、文本域、翻译源文件、文档、Issue 模板及发布工作流。
    • 短代码由 [oi_contest_schedule] 更名为 [oics_oi_contest_schedule]
    • 仪表盘小组件改为使用标准响应式布局,不再强制启用紧凑布局。
    • 翻译改由 WordPress.org 语言包提供,发布包不再包含翻译源文件。
    • 构建和部署工作流已适配新的插件 slug 与安装包名称。

    升级说明

    • 插件 slug 和短代码均已变更。现有内容中的 [oi_contest_schedule] 需要替换为 [oics_oi_contest_schedule]
    Downloads
  • v0.1.0 55e04309b0

    v0.1.0 Stable

    hanyixuanten released this 2026-08-06 18:56:16 +08:00 | 4 commits to main since this release

    OI Contest Schedule

    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 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.
    • 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.
    • Supports responsive and compact layouts.
    • Caches the remote contest feed for five minutes with the WordPress Transients API.
    • Includes English and Simplified Chinese translations.

    Requirements

    • WordPress 6.4 or later
    • PHP 7.4 or later
    • Outbound HTTPS access to raw.githubusercontent.com

    Installation

    Install a release package

    1. Download the latest plugin ZIP from the repository's 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.

    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.

    The block is rendered dynamically, so contest data remains current without editing the post.

    Shortcode

    For classic editors or templates, the shortcode remains available:

    [oi_contest_schedule]
    

    The shortcode accepts the following attributes:

    Attribute Default Description
    limit 10 Number of contests to show. Values are constrained to the range 1-50.
    compact false Set to true to use the compact layout.

    Example:

    [oi_contest_schedule limit="20" compact="true"]
    

    Data And Caching

    The plugin retrieves contest data from the public JSON feed maintained by OI-contest-fetch. Only running and upcoming contests with valid links are shown, ordered by start time.

    The normalized response is cached for five minutes. Uninstalling the plugin removes this cached transient. Site developers can replace the feed URL with the oics_contest_data_url filter:

    add_filter(
        'oics_contest_data_url',
        static function () {
            return 'https://example.com/contests.json';
        }
    );
    

    The replacement endpoint must return the same JSON structure as the default feed.

    Development

    The plugin has no Composer or npm dependencies. To build an installable archive, ensure grep, sed, GNU gettext's msgfmt, zip, and unzip are available, then run:

    ./build.sh build
    

    The command validates translations and package contents, then creates oi-contest-schedule-<version>.zip in the repository root. To remove local build artifacts, run:

    ./build.sh clean
    

    Project Structure

    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
    

    License

    This project is licensed under the GNU General Public License v3.0.

    OI Contest Schedule

    OI Contest Schedule 是一款轻量级 WordPress 插件,可在 WordPress 仪表盘、文章或页面中展示正在进行和即将开始的程序设计竞赛,不显示已结束的赛事。

    比赛数据由 OI-contest-fetch 提供,时间会根据访客客户端设备的时区显示,而非 WordPress 中设置的站点时区。日程中会标明客户端时区的 IANA 名称,例如 Asia/Shanghai

    功能特性

    • 在 WordPress 仪表盘中添加“即将到来的 OI 赛事”小组件。
    • 提供“OI 赛事日程”区块,可直接插入文章或页面。
    • 保留 [oi_contest_schedule] 短代码,兼容经典编辑器和模板。
    • 展示比赛平台、标题、开始和结束时间,以及实时倒计时。
    • 自动标记正在进行的比赛。
    • 支持响应式布局和紧凑布局。
    • 使用 WordPress Transients API 缓存远程比赛数据五分钟。
    • 内置英文和简体中文翻译。

    环境要求

    • WordPress 6.4 或更高版本
    • PHP 7.4 或更高版本
    • 服务器能够通过 HTTPS 访问 raw.githubusercontent.com

    安装

    安装发行包

    1. 从仓库的 Releases 页面下载最新的插件 ZIP 包。
    2. 在 WordPress 后台进入 插件 > 安装插件 > 上传插件
    3. 选择 ZIP 文件,然后安装并启用插件。

    从源码安装

    1. 将本仓库复制或克隆到 wp-content/plugins/oi-contest-schedule
    2. 在 WordPress 后台的 插件 页面启用 OI Contest Schedule

    启用后,赛事小组件会自动显示在 仪表盘 > 首页 中。

    编辑器区块

    在文章或页面编辑器中点击“添加区块”,搜索“OI 赛事日程”并插入。在区块设置侧栏中可以选择显示的赛事数量(1-50),也可以启用紧凑布局。

    该区块使用动态渲染,无需重新编辑文章即可显示最新赛事数据。

    短代码

    经典编辑器或模板仍可使用以下短代码:

    [oi_contest_schedule]
    

    短代码支持以下属性:

    属性 默认值 说明
    limit 10 显示的比赛数量,取值范围限制为 1-50。
    compact false 设置为 true 时使用紧凑布局。

    示例:

    [oi_contest_schedule limit="20" compact="true"]
    

    数据与缓存

    插件从 OI-contest-fetch 维护的公开 JSON 数据源获取比赛信息,仅展示链接有效且正在进行或尚未开始的比赛,并按照开始时间排序。

    规范化后的数据会缓存五分钟,卸载插件时会删除该缓存。站点开发者可以通过 oics_contest_data_url 过滤器替换数据源地址:

    add_filter(
        'oics_contest_data_url',
        static function () {
            return 'https://example.com/contests.json';
        }
    );
    

    替换后的接口需要返回与默认数据源相同的 JSON 结构。

    开发与构建

    本插件不依赖 Composer 或 npm。构建安装包前,请确保系统中已安装 grepsed、GNU gettext 的 msgfmtzipunzip,然后运行:

    ./build.sh build
    

    该命令会检查翻译和安装包内容,并在仓库根目录生成 oi-contest-schedule-<版本>.zip。清理本地构建产物可运行:

    ./build.sh clean
    

    项目结构

    oi-contest-schedule.php   插件入口与元数据
    includes/                 数据客户端、渲染器和插件集成
    assets/                   前端样式与倒计时脚本
    languages/                翻译模板与中文翻译
    uninstall.php             卸载时清理缓存
    build.sh                  发布包构建脚本
    

    许可证

    本项目基于 GNU General Public License v3.0 发布。

    Downloads