Plugins List

外掛說明

這是用於提供外掛名稱及外掛開發者外部連結的簡易 WordPress 社群外掛。

這個外掛會使用短代碼方式將 XHTML 清單插入任何文章/頁面。如需自訂清單顯示結果,使用格式引數便能輸出指定的清單內容格式。此外,這個外掛的短代碼也包含一個能顯示未啟用外掛的格式引數。

主要功能

  • 提供能進行格式化並顯示外掛資訊的簡易範本
  • 範本提供的標籤可以自動連結文字內容
  • 可選擇要輸出哪些外掛資料
  • 如果需要,可以同時顯示未啟用的外掛及已啟用的外掛
  • 自動將外掛較長的內容說明限制為指定長度,甚至在輸出時移除 Emoji 表情符號
  • 經過快取的輸出結果,能提供非常快的回應
  • 提供一個可顯示網站外掛數量的獨立短代碼

感謝 Matej Nastran 所開發的 My plugins,這是 Plugins List 的開發構想來源。

Iconography is courtesy of the very talented Janki Rathod.

Please visit the Github page for the latest code development, planned enhancements and known issues

開始使用

如果要顯示網站上已安裝並啟用的外掛清單,請在文章或頁面插入以下短代碼:

<ul>[plugins_list]</ul>

短代碼中可以使用 format 引數及數個預先定義的標籤自訂並格式化輸出結果。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}"]

這個外掛的短代碼可用的標籤如下,標籤必須由雙括號括住…

  • Title:外掛名稱
  • PluginURI:外掛網址
  • Author:外掛開發者名稱
  • AuthorURI:外掛開發者網址
  • Version:外掛版本號碼
  • Description:外掛內容說明
  • RequiresWP:WordPress 核心程式最低版本需求
  • RequiresPHP:PHP 最低版本需求
  • LinkedTitle:會自動連結至對應網址的外掛名稱
  • LinkedAuthor:外掛開發者名稱,會連結至對應的個人資料頁面
  • Active:依據外掛的使用狀態將外掛顯示為 [已啟用] 或 [未啟用]

外掛列表可以透過 CSS 將顯示結果樣式化,僅需在 format 引數或其周圍的元素放置 classid 屬性。

使用 HTML 程式碼

使用 HTML 程式碼可以將外掛清單格式化,但這可能會導致視覺化編輯器的剖析錯誤,甚至會讓不需要出現的字元 (例如異常的執行個體段落標籤) 顯示在清單輸出中。如果真的要使用 HTML 程式碼,強烈建議使用雙括號取代 <> 將 HTML 標籤括住。這個外掛會在輸出前修正這個問題,但這也代表視覺化編輯器不會試著解譯 HTML 程式碼。

範例如下:

<ul>[plugins_list format="{{li}}{{LinkedTitle}} - {{LinkedAuthor}}{{/li}}"]</ul>

這些雙括號字元會在輸出時進行修正,然後在頁面上輸出正確的項目清單。

如果使用區塊編輯器,並且需要以 HTML 程式碼包狀短代碼,請參考下方詳細資訊以了解最佳做法。

其他參數

已啟用及未啟用的外掛

By default, only active plugins are shown, but by using the show_active, show_inactive and show_recent parameters you can change this.

For example, this will show both active and inactive…

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=true]

If you wanted to show just inactive, you’d put..

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=true show_active=false]

If you wanted to show just plugins that are inactive but were recently active, you’d put…

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=false show_active=false show_recent=true]

連結目標及 nofollow

依照預設,搜尋引擎機器人會前往外掛清單提供的連結;如果想讓將這些連結標示為 nofollow (不前往),僅需加入 nofollow=true 參數。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" nofollow=true]

也可以要求瀏覽器在新分頁/新視窗中開啟連結。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" target="_blank"]

限制內容說明長度

這個外掛提供2 個參數限制內容說明長度,便不會讓內容說明長度太長。使用者可以使用 wordschars 參數,便能指定字數或字元數的最大長度。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" words=20]

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" chars=80]

雖然不建議麼做,但如果同時使用這 2 個參數,則會使用會使內容說明長度最短的參數。

依照預設,如果指定內容說明長度,結尾會加上省略符號。如果要變更這項預設值,使用者可以使用 end 參數並指定結尾的表示方式。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" chars=80 end=" [More]"]

移除 Emoji 表情符號

如需移除外掛內容說明中的 Emoji 表情符號,使用 emoji 參數便能達成目的。這個參數的預設值為 true,設定為 false 便能移除外掛內容說明中的 Emoji 表情符號。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" emoji=false]

以開發者名稱排序

如果外掛清單輸出結果需要以開發者名稱排序而非以外掛名稱排序,請使用 by_author 參數。範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" by_author=true]

快取

依照預設,Plugins List 所產生的外掛清單會每 5 分鐘重新快取一次,確保盡可能不影響主機效能。如需變更這項預設設定,請使用 cache 參數並設定整數分鐘值;如果將這個參數值設定為 false,便會關閉這個外掛的外掛清單頁面快取機制。

範例如下:

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" cache=60]

上列參數值會將頁面快取保留 1 小時 (60 分鐘),而下列設定則會關閉快取機制。

[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" cache=false]<h3>Using with the block editor</h3>

直接將短代碼插入區塊編輯器中不會產生任何問題,這會自動將短代碼新增至 [短代碼] 區塊中。請注意,如果需要使用 HTML 程式碼包裝短代碼,便會產生問題,解決方案是先新增 [短代碼] 區塊,然後加入以 HTML 程式碼包裝的短代碼,如此一來 HTML 程式碼便能如預期般執行。

外掛安裝數量

這個外掛還提供一個可以顯示網站外掛安裝數量的短代碼。只要將 [plugins_number] 插入文章或頁面,預設會傳回目前已啟用外掛的數量。

如需同時顯示啟用及未啟用的外掛數量…

[plugins_number inactive=true]

也可以指定僅顯示未啟用外掛的數量…

[plugins_number inactive=true active=false]

這個短代碼預設會將短代碼的執行結果進行快取。如需變更快取的分鐘數,請使用 cache 參數,而將參數值設定為 false 便能關閉快取。範例如下:

[plugins_number inactive=true cache=120]

這會將快取設定為保留 2 小時。

使用者評論及介紹

預設的 WordPress 內容頁面結構整齊

螢幕擷圖

  • 外掛清單使用範例

安裝方式

在 WordPress 管理後台的 [外掛] 選單 ([外掛]→[新增外掛]) 中可以找到及安裝 Plugins List,也可以從 WordPress.org 手動下載並安裝…

  1. 將完整的 plugins-list 資料夾上傳至網站的 wp-content/plugins/ 目錄中。
  2. 請在 WordPress 管理後台的 [外掛] 選單啟用這個外掛。

完成後便可使用。

常見問題集

這個外掛將括住標籤的井號變更為雙括號的原因為何?

在範本中使用雙括號 (即 {{{{) 是最標準的做法,因此這個外掛會朝這個目標邁進。但是我 (指開發者) 不想貿然終止現有的使用方式,因此這個外掛會同時支援新舊兩種方法。不過我沒有將舊方法記錄於此,因為我希望大家改用雙括號這種新方法。

I’m adding an HTML tag to the format parameter and it’s not appearing

For your security, not all HTML tags are allowed – we’ve limited this to any that are for the purposed of text formatting (inc. bullet points) and tables.

The full list of allowed tags are: , , ,

<

blockquote>,
, , , , , , ,

<

div>, , ,

<

h1>,

<

h2>,

<

h3>,

<

h4>,

<

h5>,

<

h6>,

, , ,

  • ,
  • <

    ol>,

    <

    p>,

    <

    pre>, , , , , , , , , ,

    <

    table>, , , , and

    <

    ul>.

    使用者評論

    2020 年 6 月 22 日
    simple and well done plugin, works right away and displays list of plugins installed on my website.
    2019 年 5 月 15 日
    I like to show a credit page on my websites but each time you add or replace a plugin, you are supposed to update that page. That's a burden! This light plugin takes care of it. Awsome! 🙂
    閱讀全部 12 則使用者評論

    參與者及開發者

    以下人員參與了開源軟體〈Plugins List〉的開發相關工作。

    參與者

    〈Plugins List〉外掛目前已有 4 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

    將〈Plugins List〉外掛本地化為台灣繁體中文版

    對開發相關資訊感興趣?

    任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

    變更記錄

    I use semantic versioning, with the first release being 1.0.

    2.6.1

    • Enhancement: Code quality improvements made – passes PHPCS for WordPress and WordPress VIP sniffs
    • Enhancement: Added unique prefixes to all of the function names

    2.6

    • Enhancement: Added a new tag named Active that allows you to display whether the plugin is, well, active or not
    • Enhancement: Added tags to display the “Required PHP” and “Required WordPress” details
    • Enhancement: Back in 2.4 I added the ability to turn off the display of active plugins, to completement the paramter for inactive plugins. However, I forgot to document it, so I’ve now done that
    • Enhancement: Added new parameter show_recent, which allows you to decide whether to show recently active plugins

    2.5.2

    • Bug: What can I say? I certainly made the plugin secure in the last release. Mainly by stopping things from working. Sorry. Hopefully that’s now fixed now. I’ve also taken the opportunity to review which HTML tags I’m allowing – the full list is in the FAQ.

    2.5.1

    • Enhancement: Strip HTML tags from the format parameter, unless it’s for formatting. This is to ensure no XSS vulnerabilities can occur. Thanks to Yuki Haruma and Patchstack for reporting this to me.

    2.5

    • Enhancement: New header, inc. GPL information, added to the plugin. A bit boring, I know, but a change is a change.
    • Enhancement: New parameters added allowing you to limit the description length to either a certain number of words or characters. The latter is intelligent, not chopping the sentence off in the middle of a wo
    • Enhancement: Extra spacing and HTML is now stripped from the plugin description by default. HTML in a plugin description? I’m looking at you Jetpack…
    • Enhancement: A new parameter allows you to have emoji removed from the description as well. Nothing wrong with emojis, mind you, but they’re not for everyone
    • Enhancement: To support the length truncation, I’ve also added a new parameter to that you can specify what happens at the end of the sentence when this happens
    • Enhancement: Finally, I updated this README with improved formatting and better examples. Oh, and I better explain how to use this plugin with the block editor too.
    • Maintenance: Tested under PHP 8.2. No changes required for this, but I can confirm that it works without issue /wipes sweat from brow/

    2.4.4

    • Enhancement: To reduce the plugin’s output footprint, I’ve removed the HTML comments – they were useful for the rare case of debugging but adding un-needed content to each page load for the 99.99999% rest of the time
    • Enhancement: Now follows the best code standards – not just the official WordPress standards but also the strictest WordPress VIP standards too
    • Enhancement: Added donation links back in and generally improved the plugin meta
    • Maintenance: Removed PHP version check as this is now covered in the plugin README

    2.4.3

    • Enhancement: A PHP detection function has been added, so an error will be reported if the required level of PHP is not available
    • Bug: Now using uasort instead of usort to get around an issue with array keys. Thanks to dgw

    2.4.2

    • Maintenance: This release sees the minimum PHP version required, increased to PHP 7. If you’re running on an older release, please continue to use 2.4.1 until you’re able to upgrade your PHP
    • Enhancement: Because minimal VIP coding standards are not enough, it now passes the full-fat VIP standards as well
    • Enhancement: Can now sort the output by author

    2.4.1

    • Enhancement: Code quality enhancements to bring it in line with WordPress.com VIP coding standards

    2.4

    • Enhancement: Now uses the standard double braces for templates (and HTML as well)
    • Enhancement: Can now specify to list just inactive plugins
    • Enhancement: Now using a time constant instead of a hard-coded number
    • Enhancement: Added Github links to plugin meta
    • Maintenance: Changed caching from hours to minutes
    • Maintenance: Tidying up of code

    2.3.2

    • Maintenance: Updates to README
    • Maintenance: Removed un-needed language folder and domain path
    • Maintenance: Removed donation links

    2.3.1

    • Bug: A number of the tags had stopped working. I don’t know what I’d been drinking when I tested the last release but it can’t have been good. Now all fixed
    • Maintenance: Plugin now requires WP 4.6 to work as we need to move with the times
    • Maintenance: Updated the links to my site because I like to move around
    • Maintenance: Tweaked this README to reflect the changes above but also the new plugin directory layout

    2.3

    • Enhancement: Improved the performance of the search/replace of tags
    • Enhancement: Added a method of adding HTML to the formatting without causing issues with the visual editor
    • Enhancement: After WP 4.6 you no longer need to include the plugin domain. So I don’t!
    • Maintenance: Merged all the included files together as the total amount of code wasn’t enough to justify having it split!

    2.2.7

    • Maintenance: Updated branding, inc. adding donation links

    2.2.6

    • Maintenance: Updated branding
    • Maintenance: Stopped the naughty behavior of hard-coding the plugin folder name in INCLUDES
    • Maintenance: Removed the apl- prefix from the file names

    2.2.5

    • Maintenance: Added text domain and domain path

    2.2.4

    • Enhancement: Added internationalization

    2.2.3

    • Maintenance: Updated links and changed branding

    2.2.2

    • Bug: Accidentally left some debug output in place. Sorry!

    2.2.1

    • Bug: Fixed PHP error
    • Bug: Corrected caching
    • Enhancement: Added uninstaller – cache will be wiped upon uninstall

    2.2

    • Maintenance: Added instructions for generating list via PHP function call
    • Enhancement: Improved caching so that data is not left behind on options table
    • Enhancement: Prevent plugin’s HTML comment from appearing around each entry
    • Enhancement: Add link target and nofollow option
    • Enhancement: Added shortcode to return number of plugins

    2.1

    • Maintenance: Divided code into separate files all of which, except the main launch file, have been added into an ‘includes’ folder
    • Maintenance: Split main code into separate functions to make future enhancement easier. This and the previous change have been made in preparation for version 3.
    • Enhancement: Added caching
    • Enhancement: Comment added to HTML output with debug information on

    2.0

    • Maintenance: Renamed plugin and functions within it
    • Maintenance: Improved code readability, including adding PHPDoc comments
    • Maintenance: Re-written README
    • Maintenance: Changed default format to not display plugin version, as this is a security risk
    • Enhancement: Added links to plugin meta