Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README

This file was deleted.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ProcessWire BBCode Textformatter

BBCode Text Formatter using the Vanilla maintained version of the NBBC Parser (https://github.com/vanilla/nbbc).

BBCode is a good format to use when outputting untrusted user input.

This module is also configured to use the included smiley conversion,
which converts text smileys to images.

*Note - This module uses the composer file loader (https://github.com/Wilkins/composer-file-loader).
26 changes: 17 additions & 9 deletions TextformatterBBCode.module
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php
<?php namespace ProcessWire;

/**
* ProcessWire BBCode Textformatter
*
* Uses the NBBC library from http://nbbc.sourceforge.net
* NBBC Copyright (C) 2008-10, the Phantom Inker. All rights reserved.
*
* ProcessWire 2.x
* Uses the NBBC library from https://github.com/vanilla/nbbc
* Copyright © 2008-10, Sean Werkema. All rights reserved.
* Portions copyright © Vanilla Forums Inc. All rights reserved.
*
* ProcessWire 3.x
* Copyright (C) 2012 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
Expand All @@ -20,19 +21,26 @@ class TextformatterBBCode extends Textformatter {
public static function getModuleInfo() {
return array(
'title' => 'BBCode (NBBC)',
'version' => 145,
'version' => 146,
'summary' => "BBCode Text Formatter using the NBBC Parser.",
'url' => 'http://nbbc.sourceforge.net/',
);
}

public function format(&$str) {

$path = $this->config->paths->TextformatterBBCode;
$url = $this->config->urls->TextformatterBBCode;
require_once($path . 'nbbc.php');
$bbcode = new BBCode();

require_once($path . 'nbbc/PackageLoader.php');
$loader = new \PackageLoader\PackageLoader();
$loader->load(__DIR__."/nbbc");
$bbcode = new \Nbbc\BBCode();
$bbcode->setSmileyDir($path . 'smileys');
$bbcode->setSmileyURL($url . 'smileys');
$str = $bbcode->Parse($str);
$str = $bbcode->Parse($str);

}


}
Loading