webbuilders-group/silverstripe-githubshortcode

为 HTMLText 字段添加 GitHub Star 和 Fork 按钮及其计数的简码。

安装: 55

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 4

分支: 1

公开问题: 1

类型:silverstripe-vendormodule

2.0.2 2023-10-19 18:59 UTC

This package is auto-updated.

Last update: 2024-09-19 20:50:24 UTC


README

为 HTMLText 字段添加 GitHub Star 和 Fork 按钮及其计数的简码。

维护者联系方式

要求

  • SilverStripe CMS 4.x | 5.x

安装

  • 在项目文件夹中运行 composer require webbuilders-group/silverstripe-githubshortcode dev-master
  • 运行 dev/build?flush=all 以重新生成清单

用法

使用非常简单,要添加 GitHub 按钮,只需添加以下内容

[github repo="repository owner/repository name"]

可选地,您可以添加 layout="stacked" 以使用堆叠布局(默认为内联)。此外,您还可以可选地添加 button="stars" 或 button="forks"(默认为两者都显示)以仅显示星标或分支。

[github repo="repository owner/repository name" layout="stacked"]

[github repo="repository owner/repository name" layout="stacked" button="stars"]

在 3.1 中,上述简码将按包含方式工作,但简码的更新语法将是(当然,layout 和 button 不是必需的)

[github,repo="repository owner/repository name",layout="stacked",button="stars"]

配置选项

有一些配置选项可供您选择

WebbuildersGroup\GitHubShortCode\GitHubShortCode:
    CacheTime: 86400 #Cache time in seconds (default is 1 day, remember the GitHub api is rate limited)
    UseBasicAuth: false #Use GitHub authentication or not
    Username: "your username" #GitHub Username, required if using authentication
    Password: "your password" #GitHub Password, required if using authentication
    UseShortHandNumbers: true #Use short hand numbers i.e 5.6K or not