คู่มือ:แท็ก

From mediawiki.org
This page is a translated version of the page Manual:Tags and the translation is 42% complete.

'เปลี่ยนแท็ก หรือ แท็กการแก้ไข เป็นคำอธิบายประกอบที่เกี่ยวข้องกับการแก้ไขหรือรายการบันทึก 'เปลี่ยนแท็ก หรือ แท็กการแก้ไข เป็นคำอธิบายประกอบที่เกี่ยวข้องกับการแก้ไขหรือรายการบันทึก

A complete list of all the available tags is displayed on Special:Tags. Users with the managechangetags user right – administrators by default – can use this special page to create and delete tags. (See Help:Tags .)

Extensions (for example AbuseFilter and VisualEditor ) mark edits made through their interface with tags.

Tag names

หากคุณวางแผนที่จะฮาร์ดโค้ดแท็กลงในส่วนขยายของคุณ ให้เลือกชื่อที่ไม่ซ้ำใครเพื่อหลีกเลี่ยงความขัดแย้ง ตัวอย่างเช่น VisualEditor ใช้ visualeditor, visualeditor-needcheck, visualeditor-switched ชื่อแท็กต้องไม่มีอักขระ , หรือ /

If your extension allows users to enter their own tag names, you can use the ChangeTags::canCreateTag( $tag ) function to validate those names. (There is no need to pass the optional $user parameter for this purpose.) ฟังก์ชันนี้จะปฏิเสธชื่อแท็กที่ไม่ถูกต้อง รวมถึงชื่อแท็กที่สงวนไว้แล้วโดยส่วนขยายอื่นหรือโดยผู้ใช้บนวิกิ

ตรวจสอบให้แน่ใจว่าได้ลงทะเบียนแท็กทั้งหมดที่ส่วนขยายของคุณใช้ (ไม่ว่าจะเป็นฮาร์ดโค้ดหรือที่ผู้ใช้ระบุ) โดยการใช้ ListDefinedTags hook หากแท็กมีการใช้งานอยู่ (นั่นคือ ไม่ได้ปิดใช้งาน) คุณควรแสดงรายการแท็กนั้นผ่านทาง ChangeTagsListActive hook

หากแท็กมีการใช้งานอยู่ (นั่นคือ ไม่ได้ปิดใช้งาน) คุณควรแสดงรายการแท็กนั้นผ่านทาง ChangeTagCanCreate hook For example, the OAuth extension uses this hook to reserve all tags beginning with OAuth CID:. (See source.)

Using tags from extensions

All tags used on at least one revision, and any tags listed by the ListDefinedTags hook, are shown on Special:Tags.

Each tag is known by a code name, which functions as its unique identifier. This code name is displayed on Special:Tags. Two messages are associated with each tag:

  • MediaWiki:tag-$name can be used to set the "display name" or "friendly name" of the tag. If set, this message will be used on history pages etc. instead of the tag's code name.
  • MediaWiki:tag-$name-description provides a description to be displayed on Special:Tags.

To add a tag to a revision, recent changes entry, or log entry, use ChangeTags::addTag(). The RecentChange_save hook can be useful for this purpose.

Extending Special:Tags

By default, tags defined by extensions cannot be manipulated from Special:Tags at all. All tag management tasks are left up to the extension.

If you wish, you can allow users to delete a tag defined by your extension from the regular Special:Tags interface. To do this, you must implement the ChangeTagCanDelete hook to mark the tag as deletable, then implement the ChangeTagAfterDelete hook to perform extension-specific cleanup actions after MediaWiki has removed the tag from all revisions and log entries to which it is applied.

List of core change tags

เวอร์ชันมีเดียวิกิ:
1.40
  • mw-contentmodelchange: changing the content model
  • mw-new-redirect, mw-removed-redirect, mw-changed-redirect-target: turning a page into a redirect / a redirect into a normal page / changing where a redirect goes
  • mw-blank: blanking the page
  • mw-replace: changing more than 90% of the page text
  • mw-rollback, mw-undo, mw-manual-revert: various kinds of reverts
  • mw-reverted: edit that got reverted
  • mw-server-side-upload: file uploaded using maintenance script

ดูเพิ่ม

Proposals: