mirror of
https://github.com/flarum/core.git
synced 2025-07-17 06:41:21 +02:00
Update for composer branch
This commit is contained in:
2
extensions/bbcode/.gitignore
vendored
2
extensions/bbcode/.gitignore
vendored
@@ -2,3 +2,5 @@
|
|||||||
composer.phar
|
composer.phar
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
bower_components
|
||||||
|
node_modules
|
@@ -9,6 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require __DIR__.'/vendor/autoload.php';
|
use Flarum\BBCode\Listener;
|
||||||
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
return 'Flarum\BBCode\Extension';
|
return function (Dispatcher $events) {
|
||||||
|
$events->subscribe(Listener\FormatBBCode::class);
|
||||||
|
};
|
@@ -1,10 +1,35 @@
|
|||||||
{
|
{
|
||||||
|
"name": "flarum/bbcode",
|
||||||
|
"description": "Allow posts to be formatted with BBCode.",
|
||||||
|
"type": "flarum-extension",
|
||||||
|
"keywords": ["formatting"],
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Toby Zerner",
|
||||||
|
"email": "toby.zerner@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/flarum/core/issues",
|
||||||
|
"source": "https://github.com/flarum/bbcode"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"flarum/core": "^0.1.0-beta.3"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Flarum\\BBCode\\": "src/"
|
"Flarum\\BBCode\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"extra": {
|
||||||
"style": "phpcs --standard=PSR2 -np src"
|
"flarum-extension": {
|
||||||
|
"title": "BBCode",
|
||||||
|
"icon": {
|
||||||
|
"name": "bold",
|
||||||
|
"backgroundColor": "#238C59",
|
||||||
|
"color": "#fff"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "bbcode",
|
|
||||||
"title": "BBCode",
|
|
||||||
"description": "Allow posts to be formatted with BBCode.",
|
|
||||||
"keywords": ["discussions"],
|
|
||||||
"version": "0.1.0-beta.2",
|
|
||||||
"author": {
|
|
||||||
"name": "Toby Zerner",
|
|
||||||
"email": "toby@flarum.org",
|
|
||||||
"homepage": "http://tobyzerner.com"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"require": {
|
|
||||||
"flarum": ">=0.1.0-beta.2"
|
|
||||||
},
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/flarum/bbcode",
|
|
||||||
"issues": "https://github.com/flarum/core/issues"
|
|
||||||
},
|
|
||||||
"icon": {
|
|
||||||
"name": "bold",
|
|
||||||
"backgroundColor": "#3F8A32",
|
|
||||||
"color": "#fff"
|
|
||||||
}
|
|
||||||
}
|
|
3
extensions/bbcode/js/.gitignore
vendored
3
extensions/bbcode/js/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
bower_components
|
|
||||||
node_modules
|
|
||||||
dist
|
|
@@ -1,7 +0,0 @@
|
|||||||
var gulp = require('flarum-gulp');
|
|
||||||
|
|
||||||
gulp({
|
|
||||||
modules: {
|
|
||||||
'bbcode': 'src/**/*.js'
|
|
||||||
}
|
|
||||||
});
|
|
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"private": true,
|
|
||||||
"devDependencies": {
|
|
||||||
"gulp": "^3.8.11",
|
|
||||||
"flarum-gulp": "^0.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
import { extend } from 'flarum/extend';
|
|
||||||
import app from 'flarum/app';
|
|
||||||
|
|
||||||
app.initializers.add('bbcode', function() {
|
|
||||||
// TODO
|
|
||||||
});
|
|
@@ -1,2 +0,0 @@
|
|||||||
bbcode:
|
|
||||||
# hello_world: "Hello, world!"
|
|
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\BBCode;
|
|
||||||
|
|
||||||
use Flarum\Support\Extension as BaseExtension;
|
|
||||||
use Illuminate\Events\Dispatcher;
|
|
||||||
|
|
||||||
class Extension extends BaseExtension
|
|
||||||
{
|
|
||||||
public function listen(Dispatcher $events)
|
|
||||||
{
|
|
||||||
$events->subscribe('Flarum\BBCode\Listeners\AddClientAssets');
|
|
||||||
$events->subscribe('Flarum\BBCode\Listeners\AddBBCodeFormatter');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -8,19 +8,25 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Flarum\BBCode\Listeners;
|
namespace Flarum\BBCode\Listener;
|
||||||
|
|
||||||
use Flarum\Events\FormatterConfigurator;
|
use Flarum\Event\ConfigureFormatter;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
class AddBBCodeFormatter
|
class FormatBBCode
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param Dispatcher $events
|
||||||
|
*/
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(FormatterConfigurator::class, [$this, 'addBBCodeFormatter']);
|
$events->listen(ConfigureFormatter::class, [$this, 'addBBCodeFormatter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addBBCodeFormatter(FormatterConfigurator $event)
|
/**
|
||||||
|
* @param ConfigureFormatter $event
|
||||||
|
*/
|
||||||
|
public function addBBCodeFormatter(ConfigureFormatter $event)
|
||||||
{
|
{
|
||||||
$event->configurator->BBCodes->addFromRepository('B');
|
$event->configurator->BBCodes->addFromRepository('B');
|
||||||
$event->configurator->BBCodes->addFromRepository('I');
|
$event->configurator->BBCodes->addFromRepository('I');
|
@@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\BBCode\Listeners;
|
|
||||||
|
|
||||||
use Flarum\Events\RegisterLocales;
|
|
||||||
use Flarum\Events\BuildClientView;
|
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
|
||||||
|
|
||||||
class AddClientAssets
|
|
||||||
{
|
|
||||||
public function subscribe(Dispatcher $events)
|
|
||||||
{
|
|
||||||
$events->listen(RegisterLocales::class, [$this, 'addLocale']);
|
|
||||||
$events->listen(BuildClientView::class, [$this, 'addAssets']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addLocale(RegisterLocales $event)
|
|
||||||
{
|
|
||||||
$event->addTranslations('en', __DIR__.'/../../locale/en.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addAssets(BuildClientView $event)
|
|
||||||
{
|
|
||||||
$event->forumAssets([
|
|
||||||
__DIR__.'/../../js/forum/dist/extension.js',
|
|
||||||
__DIR__.'/../../less/forum/extension.less'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$event->forumBootstrapper('bbcode/main');
|
|
||||||
|
|
||||||
$event->forumTranslations([
|
|
||||||
// 'bbcode.hello_world'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user