Skip to content

Commit

Permalink
Install NBBC with Composer
Browse files Browse the repository at this point in the history
Use Composer so that we do not need to include the source code
in the smr repo. Update from 1.4.5 to 2.x, which is maintained
by a new group -- the reason for the major version change is
primarily for Composer and PHP7+ support, which breaks backwards
compatibility with 1.x.

NOTE: Page had manually disabled escaping HTML in the included
source code. The newer version we're now using via Composer has
an `setEscapeContent` method, which we set to `false` to skip
escaping HTML. This allows things like the game news and messages
to display as expected (though it can be dangerous to do this in
theory if you're not careful about user-generated messages).
  • Loading branch information
hemberger committed Apr 2, 2018
1 parent 55ebc63 commit 4605e69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2,055 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"facebook/graph-sdk": "^5.5.0",
"google/recaptcha": "~1.1",
"php": "5.4.0 - 7.2",
"phpmailer/phpmailer": "~6.0"
"phpmailer/phpmailer": "~6.0",
"vanilla/nbbc": "~2.0"
}
}
10 changes: 5 additions & 5 deletions lib/Default/smr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,20 @@ function xmlify($str) {
function bbifyMessage($message, $noLinks=false) {
static $bbParser;
if(!isset($bbParser)) {
require_once(LIB.'External/BBCode/nbbc.php');
$bbParser = new BBCode();
$bbParser = new \Nbbc\BBCode();
$bbParser->SetEnableSmileys(false);
$bbParser->RemoveRule('wiki');
$bbParser->RemoveRule('img');
$bbParser->SetURLTarget('_blank');
$bbParser->SetURLTargetable('override');
$bbParser->setEscapeContent(false); // don't escape HTML, needed for News etc.
$smrRule = array(
'mode' => BBCODE_MODE_CALLBACK,
'mode' => \Nbbc\BBCode::BBCODE_MODE_CALLBACK,
'method' => 'smrBBCode',
'class' => 'link',
'allow_in' => Array('listitem', 'block', 'columns', 'inline'),
'end_tag' => BBCODE_PROHIBIT,
'content' => BBCODE_PROHIBIT,
'end_tag' => \Nbbc\BBCode::BBCODE_PROHIBIT,
'content' => \Nbbc\BBCode::BBCODE_PROHIBIT,
);
$bbParser->AddRule('combatlog',$smrRule);
$bbParser->AddRule('player',$smrRule);
Expand Down
Loading

0 comments on commit 4605e69

Please sign in to comment.