ralkage/flarum-ext-word-censor
最新稳定版本:v2.0.0-beta.8
Composer 安装命令:
composer require ralkage/flarum-ext-word-censor
包简介
Configurable word censoring with per-user toggle. On by default for guests and registered users.
README 文档
README
Configurable word censoring extension for Flarum with a per-user toggle. Censoring is on by default for all users, including guests.
Features
- Admin-defined word list — Add words or phrases to censor, one per line
- Configurable replacement character — Choose what character replaces censored letters (default:
*) - Always on for guests — Unauthenticated visitors always see censored content
- Per-user toggle — Registered users can disable censoring from their account settings
- Display-time only — Original post content is preserved in the database; censoring is applied at render time
- HTML-safe — Only censors visible text, leaving HTML tags and attributes intact
How It Works
When a post is serialized for the API response, the extension checks:
- Guest? → Always censor
- Registered user with censoring enabled (default)? → Censor
- Registered user who disabled censoring? → Show original content
Censored words are matched using word boundaries to avoid false positives (e.g., "ass" won't match "assistant"). Matching is case-insensitive.
Example
Word list:
damn
crap
Original post: This is a damn good example
Censored view: This is a **** good example
Installation
composer require ralkage/flarum-ext-word-censor php flarum cache:clear
Enable the extension in the admin panel under Extensions > Word Censor.
Configuration
Admin Settings
Navigate to the Word Censor extension settings page:
| Setting | Description |
|---|---|
| Censored Words | One word or phrase per line. These will be replaced when displayed. |
| Replacement Character | Character used to replace each letter of a censored word. Default: * |
User Settings
Registered users can toggle censoring on/off from Settings in their account page. The toggle is labeled "Enable Word Censoring".
Requirements
- Flarum
^1.8 - PHP 8.0+
Links
License
MIT License. See LICENSE for details.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-21