-<?php
-$br = (php_sapi_name() == "cli")? "":"<br>";
-
-if(!extension_loaded('bbcode')) {
- dl('bbcode.' . PHP_SHLIB_SUFFIX);
-}
-$module = 'bbcode';
-$functions = get_extension_funcs($module);
-/*echo "Functions available in the test extension:$br\n";
-foreach($functions as $func) {
- echo $func."$br\n";
-}*/
-echo "$br\n";
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $obj = new $module(
- [
- '' => [
- 'type' => BBCODE::TYPE_ROOT,
- 'childs' => ['ul','url','img','b','i']
- ],
- 'i' => [
- 'type' => BBCODE::TYPE_NOARG
- //TODO: by default open tag = <KEY> and close tag = </KEY>
- ],
- 'b' => [
- 'type' => BBCODE::TYPE_NOARG
- ],
- 'ul' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'childs' => [ 'li' ]
- ],
- 'li' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'parent' => 'ul',
- 'childs' => ['url','img','b','i']
- ],
- 'url' => [
- 'type' => BBCODE::TYPE_OPTARG,
- 'open_tag' => '<a href="{PARAM}">',
- 'close_tag' => '</a>',
- 'default_arg' => '{CONTENT}',
- 'parent' => [ '', 'li', 'b', 'i' ]
- ]
- ],
- [
- ':)' => '<img src="smiley.gif" alt=":)" />',
- ':(' => '<img src="sad.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:" />'
- ],
- BBCode::REMOVE_EMPTY
- );
- $obj2 = new $module(
- [
- '' => [
- 'type' => BBCODE::TYPE_ROOT,
- 'childs' => ['ul','url','img','b','i']
- ],
- 'i' => [
- 'type' => BBCODE::TYPE_NOARG
- //TODO: by default open tag = <KEY> and close tag = </KEY>
- ],
- 'b' => [
- 'type' => BBCODE::TYPE_NOARG
- ],
- 'ul' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'childs' => [ 'li' ]
- ],
- 'li' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'parent' => 'ul',
- 'childs' => ['url','img','b','i']
- ],
- 'url' => [
- 'type' => BBCODE::TYPE_OPTARG,
- 'open_tag' => '<a href="{PARAM}">',
- 'close_tag' => '</a>',
- 'default_arg' => '{CONTENT}',
- 'parent' => [ '', 'li', 'b', 'i' ]
- ]
- ],
- [
- ':)' => '<img src="smiley.gif" alt=":)" />',
- ':(' => '<img src="sad.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:" />'
- ],
- BBCode::REMOVE_EMPTY
- );
- $obj3 = new $module(
- [
- '' => [
- 'type' => BBCODE::TYPE_ROOT,
- 'childs' => ['ul','url','img','b','i']
- ],
- 'i' => [
- 'type' => BBCODE::TYPE_NOARG
- //TODO: by default open tag = <KEY> and close tag = </KEY>
- ],
- 'b' => [
- 'type' => BBCODE::TYPE_NOARG
- ],
- 'ul' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'childs' => [ 'li' ]
- ],
- 'li' => [
- 'type' => BBCODE::TYPE_NOARG,
- 'parent' => 'ul',
- 'childs' => ['url','img','b','i']
- ],
- 'url' => [
- 'type' => BBCODE::TYPE_OPTARG,
- 'open_tag' => '<a href="{PARAM}">',
- 'close_tag' => '</a>',
- 'default_arg' => '{CONTENT}',
- 'parent' => [ '', 'li', 'b', 'i' ]
- ]
- ],
- [
- ':)' => '<img src="smiley.gif" alt=":)" />',
- ':(' => '<img src="sad.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:" />'
- ],
- BBCode::REMOVE_EMPTY
- );
- $obj3 = null;
- unset($obj2);
- var_dump($obj2 = clone $obj);
- var_dump($obj3 = clone $obj);
- var_dump($obj4 = clone $obj);
- var_dump($obj5 = clone $obj);
- var_dump($obj6 = clone $obj);
- var_dump($obj2 = clone $obj);
- //var_dump(new $module(BBCode::TYPE_ARG, 'tutu'));
- exit;
- //$str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-
- /*
- array(
- 'b' => array(
- 'type'=>BBCODE_TYPE_NOARG,
- 'open_tag'=>'<b class="sub">',
- 'close_tag'=>'</b>',
- 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY
- ),
- 'u' => array(
- 'type'=>BBCODE_TYPE_NOARG,
- 'open_tag'=>'<u>',
- 'close_tag'=>'</u>',
- 'flags'=>BBCODE_FLAGS_SMILEYS_OFF | BBCODE_FLAGS_REMOVE_IF_EMPTY | BBCODE_FLAGS_SMILEYS_OFF
- ),
- 'i' => array(
- 'type'=>BBCODE_TYPE_NOARG,
- 'open_tag'=>'<i>',
- 'close_tag'=>'</i>',
- 'flags'=>BBCODE_FLAGS_REMOVE_IF_EMPTY
- )
- ),
- */
-