[WordPress] 外掛分享: bbPress Post Toolbar

首頁外掛目錄 › bbPress Post Toolbar
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
100+
安裝啟用
尚無評分
5248 天前
最後更新
0%
問題解決
WordPress WordPress 3.1+ and bbPress 2.0++ v0.7.5 上架:2011-06-22

內容簡介

這是適用於 bbPress 2.0 的文章工具列。

工具列會自動顯示,但也可設定為手動插入。
啟用了 bbPress 帖子中的圖像嵌入(可在設定中開啟)。
使用者可直接上傳圖像至網站( Valums' 的 Ajax Upload 指令碼)。
允許在 bbPress 帖子中使用 。
嵌入多個提供者(Dailymotion、LiveLeak、Megavideo、Metacafe、Vimeo、YouTube)的線上影片,可使用 http://...。
也提供一個簡短指令。
使用 [paste]http://...[/paste] 可嵌入來自多個提供者(GitHub的Gist、Pastebin.com)的線上貼文。
所有的工具列項目都是可插入的,可將預設項目關閉並取代為自訂項目。
預設的項目設置包括格式、表情符號和影片。
工具列的自訂 CSS 樣式。
按鈕的自訂排序。

您可以在我網站上的論壇 上檢視工具列範例。

若有任何問題或回饋,請至我的論壇上留言,因為我會更常查看網站論壇而非WordPress的外掛程式論壇。
我在 GitHub 上也有這個專案的存放庫,點此連結。
若有漏洞報告、功能要求或其他問題,請通過GitHub 問題系統來報告。
任何的捐款都是可愛地接受的。😉

待辦事項

睡覺。
整理一些東西。
我現在還想不到的其他事情。
放鬆並享用一杯熱巧克力。

自訂按鈕

以下是關於標準按鈕,而非面板開啟按鈕。如果要了解面板開啟按鈕的作用,只需查看 bbpress-post-toolbar.php 檔案。

將自訂按鈕添加到工具列是通過創建外掛並添加過濾器來連接到按鈕。

下面是我如何將 Spoiler 按鈕添加到工具列的示例,這是我修改的 Tiny Spoiler 外掛。

注意:這不是我對 Tiny Spoiler 唯一的修改。我還建立了一個函數來解析 bbPress 帖子中的 [spoiler] 簡碼。

function bbp_5o1_spoiler_add_to_toolbar($items) {
$javascript = <<<JS
function(){ insert_shortcode('spoiler') }
JS;
$items[] = array( 'action' => 'api_item',
'inside_anchor' => '<img src="'. site_url() . '/wp-content/plugins/tiny-spoiler/spoiler_btn.png" title="Spoiler" alt="Spoiler" />',
'data' => $javascript);
return $items;
}
add_filter( 'bbp_5o1_toolbar_add_items' , 'bbp_5o1_spoiler_add_to_toolbar' );

可用的 JavaScript 函数

實際上,只需查看 toolbar.js 即可。

插入 HTML 標記:insert_data('tag')
(返回,可能繞著文本包裝)
插入簡碼標籤:insert_shortcode('tag')
(返回 [tag][/tag],可能繞著文本包裝)
插入表情符號:insert_smiley(':)')
插入顏色:insert_color('red')

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.7.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「bbPress Post Toolbar」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Post toolbar for bbPress 2.0.

Toolbar is automatically shown, though it can be set to manual insertion.
Enables embedding of images in a bbPress post (turn it on in the settings).
Users can upload images directly to the site (Valums’ Ajax Upload script)
Allows in a bbPress posts.
Embeds online videos from multiple providers (Dailymotion, LiveLeak, Megavideo, Metacafe, Vimeo, YouTube,) using http://…
Also provides a shortcode.
Embeds online pastebins from multiple providers (GitHub’s Gist, Pastebin.com) using [paste]http://…[/paste]
Toolbar items all pluggable, defaults can be turned off and replaced by custom ones.
Default item set is formatting, smilies, and videos.
Custom CSS styling of the bar.
Custom button ordering.

An example of the toolbar is on the forum on my website.
I would prefer it if support and feedback is placed on my forum because I’ll check my website more often than WordPress’ plugin forums.
I have a GitHub repository for this project here.
Bug reports, feature requests and other issues can be reported through the GitHub Issues system.
Any donations will be gratefully accepted. 😉
To Do

Go to sleep.
Clean some things.
Other things that I can’t figure out yet.
Relax and have a cup of hot chocolate.

Custom Buttons
The following is about standard push buttons, not panel opening buttons. To see how a panel opening button works just view the bbpress-post-toolbar.php source.
Adding custom buttons to the toolbar is done using by making a plugin and adding a filter to hook into the button.
My example below is how I added the Spoiler button to the toolbar, which is my modification of the Tiny Spoiler plugin.
Note: This isn’t my only modification to Tiny Spoiler. I had to also build a function to parse the [spoiler] shortcode inside a bbPress post.
function bbp_5o1_spoiler_add_to_toolbar($items) {
$javascript = << 'api_item',
'inside_anchor' => 'Spoiler',
'data' => $javascript);
return $items;
}
add_filter( 'bbp_5o1_toolbar_add_items' , 'bbp_5o1_spoiler_add_to_toolbar' );

Available JavaScript Functions
Really, just look inside toolbar.js

Insert an HTML tag: insert_data('tag')
(returns , potentially wrapped around text)
Insert a shortcode tag: insert_shortcode('tag')
(returns [tag][/tag], potentially wrapped around text)
Insert a smiley: insert_smiley(':)')
Insert a color: insert_color('red')
Insert a size: insert_size('5pt')
testText(tag_s, tag_e) can be used to try to wrap a start- and end-tag around selected text. If there is text selected then the tag will be applied at the end of the post content wrapped around a single space.

Available Action/Filter hookers
These are filters or actions that I have made to make buttons populate the bar:

apply_filters( ‘bbp_5o1_toolbar_add_items’, array() );
do_action( ‘bbp_5o1_toolbar_css’ );

延伸相關外掛

文章
Filter
Apply Filters
Mastodon