Adapt to new data structure
<?php
$obj = new bbcode(
[
<?php
$obj = new bbcode(
[
'' => [
'type' => BBCODE::TYPE_ROOT,
'' => [
'type' => BBCODE::TYPE_ROOT,
- 'childs' => ['ul','url','img','b','i']
+ 'child' => ['ul','url','img','b','i']
- 'type' => BBCODE::TYPE_NOARG
+ 'type' => BBCODE::TYPE_MULTI
//TODO: by default open tag = <KEY> and close tag = </KEY>
],
'b' => [
//TODO: by default open tag = <KEY> and close tag = </KEY>
],
'b' => [
- 'type' => BBCODE::TYPE_NOARG
+ 'type' => BBCODE::TYPE_MULTI
- 'type' => BBCODE::TYPE_NOARG,
- 'childs' => [ 'li' ]
+ 'type' => BBCODE::TYPE_MULTI,
+ 'child' => ['li']
- 'type' => BBCODE::TYPE_NOARG,
- 'parent' => 'ul',
- 'childs' => ['url','img','b','i']
+ 'type' => BBCODE::TYPE_MULTI,
+ 'parent' => ['ul'],
+ 'child' => ['url','img','b','i']
- 'type' => BBCODE::TYPE_OPTARG,
- 'open_tag' => '<a href="{PARAM}">',
- 'close_tag' => '</a>',
- 'default_arg' => '{CONTENT}',
- 'parent' => [ '', 'li', 'b', 'i' ]
- ]
+ 'type' => BBCODE::TYPE_MULTI,
+ 'parent' => ['','li','b','i'],
+ 'open' => '<a%s>',
+ 'close' => '</a>',
+ 'arg' => 'href'
+ ],
],
[
':)' => '<img src="smiley.gif" alt=":)" />',
],
[
':)' => '<img src="smiley.gif" alt=":)" />',
[
'' => [
'type' => BBCODE::TYPE_ROOT,
[
'' => [
'type' => BBCODE::TYPE_ROOT,
- 'childs' => ['ul','url','img','b','i']
+ 'child' => ['ul','url','img','b','i']
- 'type' => BBCODE::TYPE_NOARG
+ 'type' => BBCODE::TYPE_MULTI
//TODO: by default open tag = <KEY> and close tag = </KEY>
],
'b' => [
//TODO: by default open tag = <KEY> and close tag = </KEY>
],
'b' => [
- 'type' => BBCODE::TYPE_NOARG
+ 'type' => BBCODE::TYPE_MULTI
- 'type' => BBCODE::TYPE_NOARG,
- 'childs' => [ 'li' ]
+ 'type' => BBCODE::TYPE_MULTI,
+ 'child' => [ 'li' ]
- 'type' => BBCODE::TYPE_NOARG,
+ 'type' => BBCODE::TYPE_MULTI,
- 'childs' => ['url','img','b','i']
+ 'child' => ['url','img','b','i']
- 'type' => BBCODE::TYPE_OPTARG,
- 'open_tag' => '<a href="{PARAM}">',
- 'close_tag' => '</a>',
- 'default_arg' => '{CONTENT}',
- 'parent' => [ '', 'li', 'b', 'i' ]
+ 'type' => BBCODE::TYPE_MULTI,
+ 'parent' => [ '', 'li', 'b', 'i', null, 'toto', 0, 42 ],
+ 'open' => '<a href="{PARAM}">',
+ 'close' => '</a>',
+ 'default' => '{CONTENT}'
':D' => '<img src="happy.gif" alt=":D" />',
':p' => '<img src="tong.gif" alt=":p" />',
':|' => '<img src="special.gif" alt=":|" />',
':D' => '<img src="happy.gif" alt=":D" />',
':p' => '<img src="tong.gif" alt=":p" />',
':|' => '<img src="special.gif" alt=":|" />',
- ':6:' => '<img src="six.gif" alt=":6:" />'
+ ':6:' => '<img src="six.gif" alt=":6:" />',
],
BBCODE::REMOVE_EMPTY
);
],
BBCODE::REMOVE_EMPTY
);