Skip to content

Commit b660338

Browse files
committed
Initial commit
0 parents  commit b660338

File tree

9 files changed

+616
-0
lines changed

9 files changed

+616
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
featherbb/config.php
2+
.idea/
3+
nbproject/

BbcodeToolbar.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
/**
4+
* Copyright (C) 2015-2016 FeatherBB
5+
* based on code by (C) 2008-2012 FluxBB
6+
* and Rickard Andersson (C) 2002-2008 PunBB
7+
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
8+
*/
9+
10+
namespace FeatherBB\Plugins;
11+
12+
use FeatherBB\Core\Plugin as BasePlugin;
13+
14+
class BbcodeToolbar extends BasePlugin
15+
{
16+
17+
public function run()
18+
{
19+
// Add language files into javascript footer block
20+
$this->feather->hooks->bind('view.alter_data', [$this, 'addLanguage']);
21+
// Support default actions
22+
$this->hooks->bind('controller.post.create', [$this, 'addToolbar']);
23+
$this->hooks->bind('controller.post.edit', [$this, 'addToolbar']);
24+
$this->hooks->bind('controller.topic.display', [$this, 'addToolbar']);
25+
// Support PMs plugin
26+
$this->hooks->bind('conversationsPlugin.send.preview', [$this, 'addToolbar']);
27+
$this->hooks->bind('conversationsPlugin.send.display', [$this, 'addToolbar']);
28+
}
29+
30+
public function addLanguage($data)
31+
{
32+
load_textdomain('bbcode-toolbar', dirname(__FILE__).'/lang/'.$this->feather->user->language.'/bbeditor.mo');
33+
$lang_bbeditor = array(
34+
'btnBold' => __('btnBold', 'bbcode-toolbar'),
35+
'btnItalic' => __('btnItalic', 'bbcode-toolbar'),
36+
'btnUnderline' => __('btnUnderline', 'bbcode-toolbar'),
37+
'btnColor' => __('btnColor', 'bbcode-toolbar'),
38+
'btnLeft' => __('btnLeft', 'bbcode-toolbar'),
39+
'btnRight' => __('btnRight', 'bbcode-toolbar'),
40+
'btnJustify' => __('btnJustify', 'bbcode-toolbar'),
41+
'btnCenter' => __('btnCenter', 'bbcode-toolbar'),
42+
'btnLink' => __('btnLink', 'bbcode-toolbar'),
43+
'btnPicture' => __('btnPicture', 'bbcode-toolbar'),
44+
'btnList' => __('btnList', 'bbcode-toolbar'),
45+
'btnQuote' => __('btnQuote', 'bbcode-toolbar'),
46+
'btnCode' => __('btnCode', 'bbcode-toolbar'),
47+
'promptImage' => __('promptImage', 'bbcode-toolbar'),
48+
'promptUrl' => __('promptUrl', 'bbcode-toolbar'),
49+
'promptQuote' => __('promptQuote', 'bbcode-toolbar')
50+
);
51+
$data['jsVars']['bbcodeToolbar'] = json_encode($lang_bbeditor);
52+
return $data;
53+
}
54+
55+
public function addToolbar()
56+
{
57+
$this->feather->template->addAsset('css', 'plugins/bbcode-toolbar/style/bbeditor.css', array('type' => 'text/css', 'rel' => 'stylesheet'));
58+
$this->feather->template->addAsset('css', 'plugins/bbcode-toolbar/style/colorPicker.css', array('type' => 'text/css', 'rel' => 'stylesheet'));
59+
$this->feather->template->addAsset('js', 'plugins/bbcode-toolbar/style/bbeditor.js', array('type' => 'text/javascript'));
60+
$this->feather->template->addAsset('js', 'plugins/bbcode-toolbar/style/colorPicker.js', array('type' => 'text/javascript'));
61+
return true;
62+
}
63+
64+
}

featherbb.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "bbcode-toolbar",
3+
"title": "BBCode Toolbar",
4+
"description": "Add a default toolbar to format BBCode in your posts.",
5+
"version": "0.1.0",
6+
"author": {
7+
"name": "beaver"
8+
}
9+
}

lang/English/bbeditor.mo

1.06 KB
Binary file not shown.

lang/English/bbeditor.po

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#
2+
msgid ""
3+
msgstr ""
4+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
5+
"Project-Id-Version: FeatherBB\n"
6+
"POT-Creation-Date: \n"
7+
"PO-Revision-Date: \n"
8+
"Last-Translator: \n"
9+
"Language-Team: FeatherBB <[email protected]>\n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: 8bit\n"
13+
"Language: en\n"
14+
"X-Generator: Poedit 1.8.4\n"
15+
"X-Poedit-SourceCharset: UTF-8\n"
16+
17+
msgid "btnBold"
18+
msgstr "Bold"
19+
20+
msgid "btnItalic"
21+
msgstr "Italic"
22+
23+
msgid "btnUnderline"
24+
msgstr "Underline"
25+
26+
msgid "btnColor"
27+
msgstr "Color"
28+
29+
msgid "btnLeft"
30+
msgstr "Left"
31+
32+
msgid "btnRight"
33+
msgstr "Right"
34+
35+
msgid "btnJustify"
36+
msgstr "Justify"
37+
38+
msgid "btnCenter"
39+
msgstr "Center"
40+
41+
msgid "btnLink"
42+
msgstr "Insert URL Link"
43+
44+
msgid "btnPicture"
45+
msgstr "Insert Image"
46+
47+
msgid "btnList"
48+
msgstr "Unordered List"
49+
50+
msgid "btnQuote"
51+
msgstr "Quote"
52+
53+
msgid "btnCode"
54+
msgstr "Code"
55+
56+
msgid "promptImage"
57+
msgstr "Enter the Image URL:"
58+
59+
msgid "promptUrl"
60+
msgstr "Enter the URL:"
61+
62+
msgid "promptQuote"
63+
msgstr "Please enter the username quoted (or leave blank):"

style/bbeditor.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.toolbar {
2+
/*width: 400px;*/
3+
/*height: 150px;*/
4+
}
5+
.toolbar-icon {
6+
cursor: pointer;
7+
max-width: 26px;
8+
max-height: 26px;
9+
/*border: 1px solid #ccc;*/
10+
-webkit-border-radius: 4px;
11+
-moz-border-radius: 4px;
12+
border-radius: 4px;
13+
padding: 1.5px;
14+
/*margin: 1px;*/
15+
/*padding: 2px;*/
16+
}
17+
.toolbar-icon:hover {
18+
background-color: #abccdf;
19+
color: rgb(43, 37, 42);
20+
}
21+
.toolbar-separator {
22+
margin-right: 8px;
23+
}

0 commit comments

Comments
 (0)