...
array(
'tag' => 'code',
'type' => 'unparsed_content',
'content' => '<div class="codeheader">' . $txt['code'] . ': <a href="javascript:void(0);" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code prettyprint">$1</pre>',
'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled)
{
global $context;
if (!isset($disabled['code']))
{
$data = str_replace("\t", "<span class=\"tab\">\t</span>", $data);
}
},
'block_level' => true,
),
array(
'tag' => 'code',
'type' => 'unparsed_equals_content',
'content' => '<div class="codeheader">' . $txt['code'] . ': ($2) <a href="#" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code prettyprint">$1</pre>',
'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled)
{
global $context;
if (!isset($disabled['code']))
{
$data[0] = str_replace("\t", "<span class=\"tab\">\t</span>", $data[0]);
}
},
'block_level' => true,
),
...
array(
'tag' => 'email',
'type' => 'unparsed_content',
'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
},
),
...
array(
'tag' => 'ftp',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_ftp new_win" target="_blank">$1</a>',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
if (strpos($data, 'ftp://') !== 0 && strpos($data, 'ftps://') !== 0)
{
$data = 'ftp://' . $data;
}
},
),
array(
'tag' => 'ftp',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_ftp new_win" target="_blank">',
'after' => '</a>',
'validate' => function (&$tag, &$data, $disabled)
{
if (strpos($data, 'ftp://') !== 0 && strpos($data, 'ftps://') !== 0)
{
$data = 'ftp://' . $data;
}
},
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),
...
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => 'width:100%;max-width:$1px;', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => 'max-height:$1px;', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}" style="{width}{height}" class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
{
$data = 'http://' . $data;
}
},
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
{
$data = 'http://' . $data;
}
},
'disabled_content' => '($1)',
),
array(
'tag' => 'iurl',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link">$1</a>',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
{
$data = 'http://' . $data;
}
},
),
array(
'tag' => 'iurl',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link">',
'after' => '</a>',
'validate' => function (&$tag, &$data, $disabled)
{
if (substr($data, 0, 1) == '#')
{
$data = '#post_' . substr($data, 1);
}
elseif (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
{
$data = 'http://' . $data;
}
},
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),
...
array(
'tag' => 'size',
'type' => 'unparsed_equals',
'test' => '[1-7]\]',
'before' => '<span style="font-size: $1;" class="bbc_size">',
'after' => '</span>',
'validate' => function (&$tag, &$data, $disabled)
{
$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
$data = $sizes[$data] . 'em';
},
'disallow_parents' => array('size'),
'disallow_before' => '<span>',
'disallow_after' => '</span>',
),
...
array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br />' => ''));
if (preg_match("~^https?://~i", $data) !== 1)
{
$data = 'http://' . $data;
}
},
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link" target="_blank">',
'after' => '</a>',
'validate' => function (&$tag, &$data, $disabled)
{
if (preg_match("~^https?://~i", $data) !== 1)
{
$data = 'http://' . $data;
}
},
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),