├── locale
└── en.yml
├── extend.php
├── src
├── Render.php
└── Configure.php
├── CHANGELOG.md
├── LICENSE
└── composer.json
/locale/en.yml:
--------------------------------------------------------------------------------
1 | flarum-bbcode:
2 |
3 | ##
4 | # UNIQUE KEYS - The following keys are used in only one location each.
5 | ##
6 |
7 | # Translations in this namespace are used by the forum user interface.
8 | forum:
9 | quote:
10 | wrote: wrote
11 |
--------------------------------------------------------------------------------
/extend.php:
--------------------------------------------------------------------------------
1 | render(Render::class)
19 | ->configure(Configure::class),
20 | ];
21 |
--------------------------------------------------------------------------------
/src/Render.php:
--------------------------------------------------------------------------------
1 | setParameter('L_WROTE', $this->translator->trans('flarum-bbcode.forum.quote.wrote'));
25 |
26 | return $xml;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [1.2.0](https://github.com/flarum/akismet/compare/v1.1.0...v1.2.0)
4 |
5 | No changes.
6 |
7 | ## [1.1.0](https://github.com/flarum/akismet/compare/v1.0.0...v1.1.0)
8 |
9 | No changes.
10 |
11 | ## [1.0.0](https://github.com/flarum/bbcode/compare/v0.1.0-beta.16...v1.0.0)
12 |
13 | ### Changed
14 | - Compatibility with Flarum v1.0.0.
15 |
16 | ## [0.1.0-beta.16](https://github.com/flarum/bbcode/compare/v0.1.0-beta.15...v0.1.0-beta.16)
17 |
18 | ### Changed
19 | - Updated admin category from formatting to feature (https://github.com/flarum/bbcode/pull/11)
20 |
21 | ## [0.1.0-beta.15](https://github.com/flarum/bbcode/compare/v0.1.0-beta.12...v0.1.0-beta.15)
22 |
23 | ### Changed
24 | - Updated composer.json for new admin area.
25 |
26 | ## [0.1.0-beta.8](https://github.com/flarum/bbcode/compare/v0.1.0-beta.5...v0.1.0-beta.8)
27 |
28 | ### Changed
29 | - Update for beta 8
30 | - Drop `flarum-ext-` prefix from package name ([5d47da1](https://github.com/flarum/bbcode/commit/5d47da142a3e340190dc37e461090226dddcf0cd))
31 |
32 | ## [0.1.0-beta.5](https://github.com/flarum/bbcode/compare/v0.1.0-beta.3...v0.1.0-beta.5)
33 |
34 | ### Added
35 | - New BBCode tags: DEL, COLOR, CENTER, SIZE (@wackymole)
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation)
4 | Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flarum/bbcode",
3 | "description": "Allow posts to be formatted with BBCode.",
4 | "type": "flarum-extension",
5 | "keywords": [
6 | "formatting"
7 | ],
8 | "license": "MIT",
9 | "support": {
10 | "issues": "https://github.com/flarum/framework/issues",
11 | "source": "https://github.com/flarum/bbcode",
12 | "forum": "https://discuss.flarum.org"
13 | },
14 | "homepage": "https://flarum.org",
15 | "funding": [
16 | {
17 | "type": "website",
18 | "url": "https://flarum.org/donate/"
19 | }
20 | ],
21 | "require": {
22 | "flarum/core": "^2.0.0-beta.4"
23 | },
24 | "autoload": {
25 | "psr-4": {
26 | "Flarum\\BBCode\\": "src"
27 | }
28 | },
29 | "extra": {
30 | "branch-alias": {
31 | "dev-main": "2.x-dev"
32 | },
33 | "flarum-extension": {
34 | "title": "BBCode",
35 | "category": "feature",
36 | "icon": {
37 | "name": "fas fa-bold",
38 | "backgroundColor": "#238C59",
39 | "color": "#fff"
40 | }
41 | },
42 | "flarum-cli": {
43 | "modules": {
44 | "admin": false,
45 | "forum": false,
46 | "js": false,
47 | "jsCommon": false,
48 | "css": false,
49 | "gitConf": true,
50 | "githubActions": false,
51 | "prettier": false,
52 | "typescript": false,
53 | "bundlewatch": false,
54 | "backendTesting": false,
55 | "editorConfig": true,
56 | "styleci": true
57 | }
58 | }
59 | },
60 | "repositories": [
61 | {
62 | "type": "path",
63 | "url": "../../*/*"
64 | }
65 | ],
66 | "minimum-stability": "dev",
67 | "prefer-stable": true
68 | }
69 |
--------------------------------------------------------------------------------
/src/Configure.php:
--------------------------------------------------------------------------------
1 | addTagsFromRepositories($config);
19 | $this->adaptHighlightJs($config);
20 | }
21 |
22 | protected function addTagsFromRepositories(Configurator $config): void
23 | {
24 | $config->BBCodes->addFromRepository('B');
25 | $config->BBCodes->addFromRepository('I');
26 | $config->BBCodes->addFromRepository('U');
27 | $config->BBCodes->addFromRepository('S');
28 | $config->BBCodes->addFromRepository('URL');
29 | $config->BBCodes->addFromRepository('IMG');
30 | $config->BBCodes->addFromRepository('EMAIL');
31 | $config->BBCodes->addFromRepository('CODE');
32 | $config->BBCodes->addFromRepository('QUOTE', 'default', [
33 | 'authorStr' => ' '
34 | ]);
35 | $config->BBCodes->addFromRepository('LIST');
36 | $config->BBCodes->addFromRepository('DEL');
37 | $config->BBCodes->addFromRepository('COLOR');
38 | $config->BBCodes->addFromRepository('CENTER');
39 | $config->BBCodes->addFromRepository('SIZE');
40 | $config->BBCodes->addFromRepository('*');
41 | }
42 |
43 | /**
44 | * Fix for highlight JS not working after changing post content.
45 | *
46 | * @link https://github.com/flarum/framework/issues/3794
47 | */
48 | protected function adaptHighlightJs(Configurator $config): void
49 | {
50 | $codeTag = $config->tags->get('CODE');
51 | $script = '
52 | ';
57 | $codeTag->template = str_replace('', $script.'', $codeTag->template);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------