diff --git a/reference/bbcode/constants.xml b/reference/bbcode/constants.xml
index 9982289385..a11aa66d45 100644
--- a/reference/bbcode/constants.xml
+++ b/reference/bbcode/constants.xml
@@ -1,5 +1,5 @@
-
+
&reftitle.constants;
&extension.constants;
@@ -67,7 +67,7 @@
This BBCode tag require argument sub-parsing (the argument is also parsed by
- the BBCode extension).
+ the BBCode extension). As Of 0.10.2 another parser can be used as argument parser.
@@ -82,6 +82,197 @@
+
+
+ BBCODE_FLAGS_SMILEYS_ON
+ (integer) - since 0.10.2
+
+
+
+ This BBCode Tag accepts smileys.
+
+
+
+
+
+ BBCODE_FLAGS_SMILEYS_OFF
+ (integer) - since 0.10.2
+
+
+
+ This BBCode Tag does not accept smileys.
+
+
+
+
+
+ BBCODE_FLAGS_ONE_OPEN_PER_LEVEL
+ (integer) - since 0.10.2
+
+
+
+ This BBCode Tag automatically closes if another tag of
+ the same type is found at the same nesting level.
+
+
+
+
+
+ BBCODE_FLAGS_REMOVE_IF_EMPTY
+ (integer) - since 0.10.2
+
+
+
+ This BBCode Tag is automatically removed
+ if content is empty it allows to produce ligther HTML.
+
+
+
+
+
+ BBCODE_ARG_DOUBLE_QUOTE
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option allowing argument quoting with
+ double quotes (")
+
+
+
+
+
+ BBCODE_ARG_SINGLE_QUOTE
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option allowing argument quoting with
+ single quotes (')
+
+
+
+
+
+ BBCODE_ARG_HTML_QUOTE
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option allowing argument quoting with
+ HTML version of double quotes (")
+
+
+
+
+
+ BBCODE_AUTO_CORRECT
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option changing the way errors are
+ treated. It automatically closes tag in the order they
+ are opened. And treat tags with only an open tag as if
+ there were a close tag present.
+
+
+
+
+
+ BBCODE_CORRECT_REOPEN_TAGS
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option changing the way errors are
+ treated. It automatically reopens tag if close tags are
+ not in the good order.
+
+
+
+
+
+ BBCODE_DISABLE_TREE_BUILD
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option disabling the BBCode parsing
+ it can be useful if only the "smiley" replacement must
+ be used.
+
+
+
+
+
+ BBCODE_DEFAULT_SMILEYS_ON
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option setting smileys to ON if no
+ flag is given at tag level.
+
+
+
+
+
+ BBCODE_DEFAULT_SMILEYS_OFF
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option setting smileys to OFF if no
+ flag is given at tag level.
+
+
+
+
+
+ BBCODE_FORCE_SMILEYS_OFF
+ (integer) - since 0.10.2
+
+
+
+ This is a parser option disabling completely the
+ smileys parsing.
+
+
+
+
+
+ BBCODE_SET_FLAGS_SET
+ (integer) - since 0.10.2
+
+
+
+ This permits to SET the complete flag set on a parser.
+
+
+
+
+
+ BBCODE_SET_FLAGS_ADD
+ (integer) - since 0.10.2
+
+
+
+ This permits to switch a flag set ON on a parser.
+
+
+
+
+
+ BBCODE_SET_FLAGS_REMOVE
+ (integer) - since 0.10.2
+
+
+
+ This permits to switch a flag set OFF on a parser.
+
+
+
diff --git a/reference/bbcode/functions/bbcode-add-smiley.xml b/reference/bbcode/functions/bbcode-add-smiley.xml
new file mode 100644
index 0000000000..160405e89f
--- /dev/null
+++ b/reference/bbcode/functions/bbcode-add-smiley.xml
@@ -0,0 +1,148 @@
+
+
+
+
+ bbcode_add_smiley
+ Adds a smiley to the parser
+
+
+ &reftitle.description;
+
+ boolbbcode_add_smiley
+ resourcebbcode_container
+ stringsmiley
+ stringreplace_by
+
+
+
+ Adds a smiley to the parser
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ bbcode_container
+
+
+ BBCode_Container resource, returned by bbcode_create.
+
+
+
+
+ smiley
+
+
+ The string that will be replaced when found.
+
+
+
+
+ replace_by
+
+
+ The string that replace smiley when found.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+ &reftitle.examples;
+
+
+ bbcode_add_smiley usage example
+
+ array('type'=>BBCODE_TYPE_ROOT,
+ 'childs'=>'!i'),
+ 'b'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'',
+ 'close_tag'=>''),
+ 'u'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'',
+ 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_SMILEYS_OFF),
+ 'i'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'',
+ 'close_tag'=>'',
+ 'childs'=>'b'),
+);
+/*
+ * Parsed Text
+ */
+$text=<<");
+bbcode_add_smiley($BBHandler, ":(", "
");
+bbcode_add_smiley($BBHandler, ":D", "
");
+bbcode_add_smiley($BBHandler, ":p", "
");
+bbcode_add_smiley($BBHandler, ":|", "
");
+bbcode_add_smiley($BBHandler, ":6:", "
");
+/*
+ * Parse the text
+ */
+echo bbcode_parse($BBHandler,$text);
+?>
+]]>
+
+ &example.outputs;
+
+
+ Parsed, with smiley
+ Parsed, with no smiley :D
+]]>
+
+
+
+
+
+
+
+
+
diff --git a/reference/bbcode/functions/bbcode-create.xml b/reference/bbcode/functions/bbcode-create.xml
index 5f311efee9..49dd7fe238 100644
--- a/reference/bbcode/functions/bbcode-create.xml
+++ b/reference/bbcode/functions/bbcode-create.xml
@@ -1,5 +1,5 @@
-
+
bbcode_create
@@ -79,15 +79,15 @@
childs optional - List of
- accepted childs for the tag. The format of the list is a comma
+ accepted child 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.
+ rejected Shields for the tag.
parent optional - List of
- accepted childs for the tag. The format of the list is a comma
+ accepted childes for the tag. The format of the list is a comma
separated string.
diff --git a/reference/bbcode/functions/bbcode-set-arg-parser.xml b/reference/bbcode/functions/bbcode-set-arg-parser.xml
new file mode 100644
index 0000000000..86f4099f31
--- /dev/null
+++ b/reference/bbcode/functions/bbcode-set-arg-parser.xml
@@ -0,0 +1,169 @@
+
+
+
+
+ bbcode_set_arg_parser
+ Attach another parser in order to use another rule set for argument parsing
+
+
+ &reftitle.description;
+
+ boolbbcode_set_arg_parser
+ resourcebbcode_container
+ resourcebbcode_arg_parser
+
+
+
+ Attaches another parser to the bbcode_container.
+ This parser is used only when arguments must be parsed.
+ If this function is not used, the default argument parser
+ is the parser itself.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ bbcode_container
+
+
+ BBCode_Container resource, returned by bbcode_create.
+
+
+
+
+ bbcode_arg_parser
+
+
+ BBCode_Container resource, returned by bbcode_create.
+ It will be used only for parsed arguments
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+
+ &reftitle.examples;
+
+
+ bbcode_set_arg_parser usage example
+
+ array('type'=>BBCODE_TYPE_ARG,
+ 'open_tag'=>'Source: {PARAM}
',
+ 'close_tag'=>'
',
+ 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY|BBCODE_FLAGS_ARG_PARSING),
+ 'b'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY),
+ 'u'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_SMILEYS_OFF | BBCODE_FLAGS_REMOVE_IF_EMPTY | BBCODE_FLAGS_SMILEYS_OFF),
+ 'i'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY),
+);
+/*
+ * Generating bbcode ruleset for argument parser
+ */
+$arrayBBCode_arg=array(
+ 'b'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY),
+ 'u'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_SMILEYS_OFF | BBCODE_FLAGS_REMOVE_IF_EMPTY | BBCODE_FLAGS_SMILEYS_OFF),
+ 'i'=> array('type'=>BBCODE_TYPE_NOARG,
+ 'open_tag'=>'', 'close_tag'=>'',
+ 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY),
+);
+/*
+ * Text we are going to parse
+ */
+$text=<<");
+/*
+ * Use the main parser to parse text
+ */
+echo bbcode_parse($BBHandler,$text);
+?>
+]]>
+
+ &example.outputs;
+
+Source: Test
+Foo
+
+Bar example :)
+]]>
+
+
+
+
+
+
+
+
+
diff --git a/reference/bbcode/functions/bbcode-set-flags.xml b/reference/bbcode/functions/bbcode-set-flags.xml
new file mode 100644
index 0000000000..3cc4ad8ddc
--- /dev/null
+++ b/reference/bbcode/functions/bbcode-set-flags.xml
@@ -0,0 +1,141 @@
+
+
+
+
+ bbcode_set_flags
+ Set or alter parser options
+
+
+ &reftitle.description;
+
+ boolbbcode_set_flags
+ resourcebbcode_container
+ intflags
+ intmode
+
+
+
+ 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 automaticaly 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
+
+]]>
+
+
+
+
+
+
+
+
+
diff --git a/reference/bbcode/reference.xml b/reference/bbcode/reference.xml
index 2a5cfa1022..3475093267 100644
--- a/reference/bbcode/reference.xml
+++ b/reference/bbcode/reference.xml
@@ -1,5 +1,5 @@
-
+
BBCode Functions
@@ -15,9 +15,9 @@
approach based on regular expressions. Further more, it helps provide
valid HTML by reordering open / close tags and by automatically closing
unclosed tags.
-
+
Since 0.10.1 It supports argument quoting with single quotes,
- double quotes and html escaped double quotes.
+ double quotes and HTML escaped double quotes.