bbcode_create
Create a BBCode Resource
&reftitle.description;
resourcebbcode_create
arraybbcode_initial_tags
This function returns a new BBCode Resource used to parse BBCode strings.
&reftitle.parameters;
bbcode_initial_tags
An associative array containing the tag names as keys and parameters
required to correctly parse BBCode as their value. The following key/value
pairs are supported:
flags optional - a flag
set based on the BBCODE_FLAGS_* constants.
type required - an int
indicating the type of tag. Use the BBCODE_TYPE_* constants.
open_tag required - the HTML
replacement string for the open tag.
close_tag required - the HTML
replacement string for the close tag.
default_arg optional -
use this value as the default argument if none is provided and
tag_type is of type OPTARG.
content_handling optional -
Gives the name of the function used as callback for modification
of the content - currently only supports functions not methods.
callback prototype is string name(string $content, string $argument)
param_handling optional -
Gives the name of the function used as callback for modification
of the argument - currently only supports functions not methods.
callback prototype is string name(string $content, string $argument)
childs optional - List of
accepted childs for the tag. The format of the list is a comma
separated string. If the list starts with ! it will be the list of
rejected childs for the tag.
parent optional - List of
accepted childs for the tag. The format of the list is a comma
separated string.
&reftitle.returnvalues;
Returns a BBCode_Container
&reftitle.examples;
bbcode_create example
array('type'=>BBCODE_TYPE_ROOT, 'childs'=>'!i'),
'i'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'',
'close_tag'=>'', 'childs'=>'b'),
'url'=> array('type'=>BBCODE_TYPE_OPTARG,
'open_tag'=>'', 'close_tag'=>'',
'default_arg'=>'{CONTENT}'
'childs'=>'bi'),
'img'=> array('type'=>BBCODE_TYPE_NOARG,
'open_tag'=>'
',
'childs'=>''),
'b'=> array('type'=>BBCODE_TYPE_NOARG, 'open_tag'=>'',
'close_tag'=>''),
);
$text=<<
]]>
&example.outputs;
Bold Text
Italic Text
http://www.php.net/
Content Text
[img]http://static.php.net/www.php.net/images/php.gif[/img]
]]>