Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adaur committed Jan 24, 2016
0 parents commit b660338
Show file tree
Hide file tree
Showing 9 changed files with 616 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
featherbb/config.php
.idea/
nbproject/
64 changes: 64 additions & 0 deletions BbcodeToolbar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* Copyright (C) 2015-2016 FeatherBB
* based on code by (C) 2008-2012 FluxBB
* and Rickard Andersson (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/

namespace FeatherBB\Plugins;

use FeatherBB\Core\Plugin as BasePlugin;

class BbcodeToolbar extends BasePlugin
{

public function run()
{
// Add language files into javascript footer block
$this->feather->hooks->bind('view.alter_data', [$this, 'addLanguage']);
// Support default actions
$this->hooks->bind('controller.post.create', [$this, 'addToolbar']);
$this->hooks->bind('controller.post.edit', [$this, 'addToolbar']);
$this->hooks->bind('controller.topic.display', [$this, 'addToolbar']);
// Support PMs plugin
$this->hooks->bind('conversationsPlugin.send.preview', [$this, 'addToolbar']);
$this->hooks->bind('conversationsPlugin.send.display', [$this, 'addToolbar']);
}

public function addLanguage($data)
{
load_textdomain('bbcode-toolbar', dirname(__FILE__).'/lang/'.$this->feather->user->language.'/bbeditor.mo');
$lang_bbeditor = array(
'btnBold' => __('btnBold', 'bbcode-toolbar'),
'btnItalic' => __('btnItalic', 'bbcode-toolbar'),
'btnUnderline' => __('btnUnderline', 'bbcode-toolbar'),
'btnColor' => __('btnColor', 'bbcode-toolbar'),
'btnLeft' => __('btnLeft', 'bbcode-toolbar'),
'btnRight' => __('btnRight', 'bbcode-toolbar'),
'btnJustify' => __('btnJustify', 'bbcode-toolbar'),
'btnCenter' => __('btnCenter', 'bbcode-toolbar'),
'btnLink' => __('btnLink', 'bbcode-toolbar'),
'btnPicture' => __('btnPicture', 'bbcode-toolbar'),
'btnList' => __('btnList', 'bbcode-toolbar'),
'btnQuote' => __('btnQuote', 'bbcode-toolbar'),
'btnCode' => __('btnCode', 'bbcode-toolbar'),
'promptImage' => __('promptImage', 'bbcode-toolbar'),
'promptUrl' => __('promptUrl', 'bbcode-toolbar'),
'promptQuote' => __('promptQuote', 'bbcode-toolbar')
);
$data['jsVars']['bbcodeToolbar'] = json_encode($lang_bbeditor);
return $data;
}

public function addToolbar()
{
$this->feather->template->addAsset('css', 'plugins/bbcode-toolbar/style/bbeditor.css', array('type' => 'text/css', 'rel' => 'stylesheet'));
$this->feather->template->addAsset('css', 'plugins/bbcode-toolbar/style/colorPicker.css', array('type' => 'text/css', 'rel' => 'stylesheet'));
$this->feather->template->addAsset('js', 'plugins/bbcode-toolbar/style/bbeditor.js', array('type' => 'text/javascript'));
$this->feather->template->addAsset('js', 'plugins/bbcode-toolbar/style/colorPicker.js', array('type' => 'text/javascript'));
return true;
}

}
9 changes: 9 additions & 0 deletions featherbb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "bbcode-toolbar",
"title": "BBCode Toolbar",
"description": "Add a default toolbar to format BBCode in your posts.",
"version": "0.1.0",
"author": {
"name": "beaver"
}
}
Binary file added lang/English/bbeditor.mo
Binary file not shown.
63 changes: 63 additions & 0 deletions lang/English/bbeditor.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Project-Id-Version: FeatherBB\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: FeatherBB <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"X-Generator: Poedit 1.8.4\n"
"X-Poedit-SourceCharset: UTF-8\n"

msgid "btnBold"
msgstr "Bold"

msgid "btnItalic"
msgstr "Italic"

msgid "btnUnderline"
msgstr "Underline"

msgid "btnColor"
msgstr "Color"

msgid "btnLeft"
msgstr "Left"

msgid "btnRight"
msgstr "Right"

msgid "btnJustify"
msgstr "Justify"

msgid "btnCenter"
msgstr "Center"

msgid "btnLink"
msgstr "Insert URL Link"

msgid "btnPicture"
msgstr "Insert Image"

msgid "btnList"
msgstr "Unordered List"

msgid "btnQuote"
msgstr "Quote"

msgid "btnCode"
msgstr "Code"

msgid "promptImage"
msgstr "Enter the Image URL:"

msgid "promptUrl"
msgstr "Enter the URL:"

msgid "promptQuote"
msgstr "Please enter the username quoted (or leave blank):"
23 changes: 23 additions & 0 deletions style/bbeditor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.toolbar {
/*width: 400px;*/
/*height: 150px;*/
}
.toolbar-icon {
cursor: pointer;
max-width: 26px;
max-height: 26px;
/*border: 1px solid #ccc;*/
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 1.5px;
/*margin: 1px;*/
/*padding: 2px;*/
}
.toolbar-icon:hover {
background-color: #abccdf;
color: rgb(43, 37, 42);
}
.toolbar-separator {
margin-right: 8px;
}
Loading

0 comments on commit b660338

Please sign in to comment.