Esempio n. 1
0
 public function emptyTagDataProvider($tag)
 {
     $this->setUp();
     return array_map(function ($v) {
         return [$v];
     }, array_keys($this->parser->getTagmap()));
 }
Esempio n. 2
0
 public function testSanitizeCoverage()
 {
     $this->assertEquals('&', $this->parser->parse('[b]&[/b]'));
 }
Esempio n. 3
0
	<link rel="stylesheet" href="css/prism-coy.css"/>
	<title>BBCode parser</title>
</head>
<body>
<?php 
/**
 * Run
 */
$timer = microtime(true);
// create a new Parser instance
$options = new ParserOptions();
$options->nesting_limit = 10;
$options->baseModuleInterface = Html5BaseModule::class;
$options->parserExtensionInterface = MyAwesomeParserExtension::class;
$options->allow_all = true;
$bbcode = new Parser($options);
var_dump($bbcode->getTagmap());
var_dump($bbcode->getAllowed());
var_dump($bbcode->getNoparse());
var_dump($bbcode->getSingle());
$content = $bbcode->parse(file_get_contents('bbcode.txt'));
echo $content . PHP_EOL;
echo '<!-- bbcode: ' . round(microtime(true) - $timer, 5) . 's -->' . PHP_EOL;
?>
<!-- let's assume you use a common js framework in your project -->
<script src="//ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js"></script>
<script src="js/prism.js"></script>
<script>
	(function(){
		document.observe('dom:loaded', function(){
Esempio n. 4
0
 /**
  * GWBBParser constructor.
  *
  * @param \chillerlan\GW1Database\bbcode\GWBBParserOptions $options
  */
 public function __construct(GWBBParserOptions $options = null)
 {
     parent::__construct(!$options ? new GWBBParserOptions() : $options);
 }
Esempio n. 5
0
 * @created      19.09.2015
 * @author       Smiley <*****@*****.**>
 * @copyright    2015 Smiley
 * @license      MIT
 */
namespace chillerlan\bbcodeExamples;

require_once '../vendor/autoload.php';
use chillerlan\bbcode\Parser;
use chillerlan\bbcode\ParserOptions;
use chillerlan\bbcode\Modules\Markdown\MarkdownBaseModule;
header('Content-type: text/plain;charset=utf-8;');
/**
 * Run
 */
$timer = microtime(true);
// create a new Parser instance
$options = new ParserOptions();
$options->sanitize = false;
$options->nesting_limit = 10;
$options->baseModuleInterface = MarkdownBaseModule::class;
$options->parserExtensionInterface = MyAwesomeParserExtension::class;
$options->allow_all = true;
$bbcode = new Parser($options);
var_dump($bbcode->getTagmap());
#var_dump($bbcode->getAllowed());
#var_dump($bbcode->getNoparse());
#var_dump($bbcode->getSingle());
$content = $bbcode->parse(file_get_contents('bbcode.txt'));
echo $content . PHP_EOL;
echo PHP_EOL . 'bbcode: ' . round(microtime(true) - $timer, 6) . 's';