bbcode_set_flags
Set or alter parser options
&reftitle.description;
boolbbcode_set_flags
resourcebbcode_container
intflags
intmodeBBCODE_SET_FLAGS_SET
Set or alter parser options
&reftitle.parameters;
bbcode_container
BBCode_Container resource, returned by bbcode_create.
flags
The flag set that must be applied to the bbcode_container options
mode
One of the BBCODE_SET_FLAGS_* constant to set, unset
a specific flag set or to replace the flag set by flags.
&reftitle.returnvalues;
&return.success;
&reftitle.examples;
bbcode_set_flags usage example
array('type'=>BBCODE_TYPE_NOARG,
'open_tag'=>'', 'close_tag'=>''),
'u'=> array('type'=>BBCODE_TYPE_NOARG,
'open_tag'=>'', 'close_tag'=>''),
'i'=> array('type'=>BBCODE_TYPE_NOARG,
'open_tag'=>'', 'close_tag'=>''),
);
/*
* Paired incorrectly nested BBCode
*/
$text="[i] Parser [b] Auto Correction [/i] at work [/b]\n";
$BBHandler=bbcode_create($arrayBBCode);
echo bbcode_parse($BBHandler,$text);
// Enabling reopening of automatically closed elements
bbcode_set_flags($BBHandler,BBCODE_CORRECT_REOPEN_TAGS,
BBCODE_SET_FLAGS_SET);
echo bbcode_parse($BBHandler,$text);
/*
* Unpaired incorrectly nested BBCode
*/
$text="[i] Parser [b] Auto Correction [/i] at work\n";
echo bbcode_parse($BBHandler,$text);
// Enabling automatic close of pending tags
bbcode_set_flags($BBHandler,
BBCODE_CORRECT_REOPEN_TAGS|BBCODE_AUTO_CORRECT,
BBCODE_SET_FLAGS_SET);
echo bbcode_parse($BBHandler,$text);
?>
]]>
&example.outputs;
Parser Auto Correction at work
Parser Auto Correction at work
Parser [b] Auto Correction at work
Parser Auto Correction at work
]]>