DokuWiki

It's better when it's simple

使用者工具

網站工具


zh-tw:devel:plugins

外掛開發

編寫一個 DokuWiki 外掛十分容易,在動手開發自己的外掛之前,請記得在既有的 外掛列表 中搜尋類似的外掛,並熟讀提供給外掛作者的 安全指南

DokuWiki 具備彈性的外掛應用程式介面(API, Application Programming Interface),允許開發者擴展其功能,無論是額外的 語法模式(syntax modes)、自定義的 操作模式(action modes) 或是新的 匯出格式(export formats) 等;根據外掛的用途,一個外掛可以由以下外掛類型中的一個或多的構件所組成。

外掛類型

目前 DokuWiki 外掛可以劃分成以下七種類型:

A simple plugin like color plugin may only consist of a single file, syntax.php. More advanced plugins consist of several components, for example the structured data plugin have the syntax handling split in “data entry” and “table view” components, an action component for the special edit button attached to every data entry and an admin interface for database maintenance.

開發資源

以下是開發外掛時可以參考的資源:

外掛名稱

有效的外掛名稱須滿足以下規則:

  • 只能含有字元 a-z 與數字 0-9
  • 出於下述原因,不允許使用底線 _ 字元:
    • This is used to separate <plugin name> from <component name>.
    • Using underscore will also give a popularity rating of zero.
  • 如果兩個不同的外掛採用相同的名稱:
    • 兩者彼此相互排斥,本質上不能相容
    • 如此之外,一個外掛名稱在 https://www.dokuwiki.org/ 上只能有一個外掛頁面

外掛精靈

A Wizard to create the basic skeleton for a DokuWiki plugin can be found at http://pluginwizard.dokuwiki.org/ and is recommended to be used for starting the development. Alternatively use the dev Plugin.

If you later need to extend your plugin refer to the plugin file structure on how files are arranged in a plugin.

外掛發佈

如果您創建了外掛,請與社群分享;只要在外掛的命名空間 plugin 中創建一個以您的外掛命名的頁面即可。例如:如果您的外掛目錄名為 sample,則在當前的維基站點上創建一個 plugin:sample 頁面。

這個頁面內容應該包含關於如何安裝與使用外掛的說明,並提供適當的說明,讓使用者在安裝外掛之前可以很好地瞭解它的功能;在頁面上插入螢幕截圖是一個不錯的作法!在 外掛頁面範本 中有一些關於如何創建使用者友善的外掛頁面的小技巧。

在外掛頁面的最上方,必須填寫一些詮釋資料(metadata)欄位,各個欄位的敘述可以在 外掛:外掛倉庫 頁面上找到。

從版本 Ponder Stibbons 開始,支援了自動更新提示。為了使更新過程正常運作,外掛維基頁面上的「上次更新日期(Last updated on)」必須與原始 tarball/zipfile 壓縮包內 plugin.info.txt 文件的日期相同;如果不符合前述情況,則不會進行更新,或者「更新(“Update”)」訊號仍然存在。

https://www.dokuwiki.org/ 不允許上傳檔案,因此您需要將您的外掛檔案託管在其他地方。我們建議使用像是 Git 這樣的版本控制系統(Revision Control System) 來管理您的原始碼;如果您採用這樣的方式,最簡單的作法是使用如 GitHubGitLabBitbucket 這樣的公共託管倉庫,它們也為您的託管倉庫提供了程式錯誤追蹤工具。

外掛開發人員可以查看 有問題外掛列表 頁面,檢查 plugin.info.txt 在 GitHub 託管倉庫上與 https://www.dokuwiki.org/ 上對應頁面的差異。

調查概述

外掛程式調查 是對存在於 https://www.dokuwiki.org/ 網站上 plugin 命名空間下的所有外掛 的開發人員概覽,資料自 2010-09-05 由自動化腳本蒐集,或經由手動下載與探勘,總共檢查了包含 672 個外掛在內的 697 個外掛頁面,並下載與解析了 647 個外掛(96%)的原始碼。

zh-tw/devel/plugins.txt · 上一次變更: 2023-04-14 19:43 由 Hsins

若無特別註明,本 wiki 上的內容都是採用以下授權方式: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki