本文整理汇总了PHP中BBCode::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BBCode::getInstance方法的具体用法?PHP BBCode::getInstance怎么用?PHP BBCode::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBCode
的用法示例。
在下文中一共展示了BBCode::getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback_html
protected function callback_html($field)
{
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
return html_entity_decode($bbcode->Parse($field));
}
示例2: callback_html
/**
* This callback processes any custom parser.php attributes and custom code with preg_replace
*/
protected function callback_html($field)
{
// Strips vBulletin custom HTML first from $field before parsing $field to parser.php
$vbulletin_markup = $field;
$vbulletin_markup = html_entity_decode($vbulletin_markup);
// Replace '[QUOTE]' with '<blockquote>'
$vbulletin_markup = preg_replace('/\\[QUOTE\\]/', '<blockquote>', $vbulletin_markup);
// Replace '[QUOTE=User Name($1);PostID($2)]' with '<em>@$1 $2 wrote:</em><blockquote>"
$vbulletin_markup = preg_replace('/\\[QUOTE=(.*?);(.*?)\\]/', '<em>@$1 $2 wrote:</em><blockquote>', $vbulletin_markup);
// Replace '[/QUOTE]' with '</blockquote>'
$vbulletin_markup = preg_replace('/\\[\\/QUOTE\\]/', '</blockquote>', $vbulletin_markup);
// Replace '[MENTION=###($1)]User Name($2)[/MENTION]' with '@$2"
$vbulletin_markup = preg_replace('/\\[MENTION=(.*?)\\](.*?)\\[\\/MENTION\\]/', '@$2', $vbulletin_markup);
// Replace '[video=youtube;$1]$2[/video]' with '$2"
$vbulletin_markup = preg_replace('/\\[video\\=youtube;(.*?)\\](.*?)\\[\\/video\\]/', '$2', $vbulletin_markup);
// Now that vBulletin custom HTML has been stripped put the cleaned HTML back in $field
$field = $vbulletin_markup;
// Parse out any bbCodes in $field with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例3: callback_html
/**
* This callback processes any custom parser.php attributes and custom code with preg_replace
*/
protected function callback_html($field)
{
// Strips SMF custom HTML first from $field before parsing $field to parser.php
$SMF_markup = $field;
$SMF_markup = html_entity_decode($SMF_markup);
// Replace '[quote]' with '<blockquote>'
$SMF_markup = preg_replace('/\\[quote\\]/', '<blockquote>', $SMF_markup);
// Replace '[quote ($1)]' with '<blockquote>"
$SMF_markup = preg_replace('/\\[quote (.*?)\\]/', '<blockquote>', $SMF_markup);
// Replace '[/quote]' with '</blockquote>'
$SMF_markup = preg_replace('/\\[\\/quote\\]/', '</blockquote>', $SMF_markup);
// Replace '[glow]' with ''
$SMF_markup = preg_replace('/\\[glow\\]/', '', $SMF_markup);
// Replace '[glow]' with ''
$SMF_markup = preg_replace('/\\[glow=(.*?)\\]/', '', $SMF_markup);
// Replace '[/glow]' with ''
$SMF_markup = preg_replace('/\\[\\/glow\\]/', '', $SMF_markup);
// Replace '[shadow]' with ''
$SMF_markup = preg_replace('/\\[shadow\\]/', '', $SMF_markup);
// Replace '[shadow]' with ''
$SMF_markup = preg_replace('/\\[shadow=(.*?)\\]/', '', $SMF_markup);
// Replace '[/shadow]' with ''
$SMF_markup = preg_replace('/\\[\\/shadow\\]/', '', $SMF_markup);
// Replace '[move]' with ''
$SMF_markup = preg_replace('/\\[move\\]/', '', $SMF_markup);
// Replace '[/move]' with ''
$SMF_markup = preg_replace('/\\[\\/move\\]/', '', $SMF_markup);
// Replace '[table]' with '<table>'
$SMF_markup = preg_replace('/\\[table\\]/', '<table>', $SMF_markup);
// Replace '[/table]' with '</table>'
$SMF_markup = preg_replace('/\\[\\/table\\]/', '</table>', $SMF_markup);
// Replace '[tr]' with '<tr>'
$SMF_markup = preg_replace('/\\[tr\\]/', '<tr>', $SMF_markup);
// Replace '[/tr]' with '</tr>'
$SMF_markup = preg_replace('/\\[\\/tr\\]/', '</tr>', $SMF_markup);
// Replace '[td]' with '<td>'
$SMF_markup = preg_replace('/\\[td\\]/', '<td>', $SMF_markup);
// Replace '[/td]' with '</td>'
$SMF_markup = preg_replace('/\\[\\/td\\]/', '</td>', $SMF_markup);
// Replace '[list]' with '<ul>'
$SMF_markup = preg_replace('/\\[list\\]/', '<ul>', $SMF_markup);
// Replace '[liist type=decimal]' with '<ol type="a">'
$SMF_markup = preg_replace('/\\[list\\ type=decimal\\]/', '<ol type="a">', $SMF_markup);
// Replace '[li]' with '<li>'
$SMF_markup = preg_replace('/\\[li\\]/', '<li>', $SMF_markup);
// Replace '[/li]' with '</li>'
$SMF_markup = preg_replace('/\\[\\/li\\]/', '</li>', $SMF_markup);
// Replace '[tt]' with '<tt>'
$SMF_markup = preg_replace('/\\[tt\\]/', '<tt>', $SMF_markup);
// Replace '[/tt]' with '</tt>'
$SMF_markup = preg_replace('/\\[\\/tt\\]/', '</tt>', $SMF_markup);
// Replace '<br />' with '<br>'
$SMF_markup = preg_replace('/\\<br \\/\\>/', '<br>', $SMF_markup);
// Replace '[size=$1]' with '<span style="font-size:$1%;">$3</span>'
$SMF_markup = preg_replace('/\\[size=(.*?)\\]/', '<span style="font-size:$1">', $SMF_markup);
// Replace '[/size]' with '</span>'
$SMF_markup = preg_replace('/\\[\\/size\\]/', '</span>', $SMF_markup);
// Replace non-break space ' ' with space ' '
$SMF_markup = preg_replace('/ /', ' ', $SMF_markup);
// Now that SMF custom HTML has been stripped put the cleaned HTML back in $field
$field = $SMF_markup;
// Parse out any bbCodes in $field with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例4: callback_html
/**
* This callback processes any custom BBCodes with parser.php
*/
protected function callback_html($field)
{
// Strips Invision custom HTML first from $field before parsing $field to parser.php
$invision_markup = $field;
$invision_markup = html_entity_decode($invision_markup);
// Replace '[html]' with '<pre><code>'
$invision_markup = preg_replace('/\\[html\\]/', '<pre><code>', $invision_markup);
// Replace '[/html]' with '</code></pre>'
$invision_markup = preg_replace('/\\[\\/html\\]/', '</code></pre>', $invision_markup);
// Replace '[sql]' with '<pre><code>'
$invision_markup = preg_replace('/\\[sql\\]/', '<pre><code>', $invision_markup);
// Replace '[/sql]' with '</code></pre>'
$invision_markup = preg_replace('/\\[\\/sql\\]/', '</code></pre>', $invision_markup);
// Replace '[php]' with '<pre><code>'
$invision_markup = preg_replace('/\\[php\\]/', '<pre><code>', $invision_markup);
// Replace '[/php]' with '</code></pre>'
$invision_markup = preg_replace('/\\[\\/php\\]/', '</code></pre>', $invision_markup);
// Replace '[xml]' with '<pre><code>'
$invision_markup = preg_replace('/\\[xml\\]/', '<pre><code>', $invision_markup);
// Replace '[/xml]' with '</code></pre>'
$invision_markup = preg_replace('/\\[\\/xml\\]/', '</code></pre>', $invision_markup);
// Replace '[CODE]' with '<pre><code>'
$invision_markup = preg_replace('/\\[CODE\\]/', '<pre><code>', $invision_markup);
// Replace '[/CODE]' with '</code></pre>'
$invision_markup = preg_replace('/\\[\\/CODE\\]/', '</code></pre>', $invision_markup);
// Replace '[quote:XXXXXXX]' with '<blockquote>'
$invision_markup = preg_replace('/\\[quote:(.*?)\\]/', '<blockquote>', $invision_markup);
// Replace '[quote="$1"]' with '<em>@$1 wrote:</em><blockquote>'
$invision_markup = preg_replace('/\\[quote="(.*?)":(.*?)\\]/', '<em>@$1 wrote:</em><blockquote>', $invision_markup);
// Replace '[/quote:XXXXXXX]' with '</blockquote>'
$invision_markup = preg_replace('/\\[\\/quote:(.*?)\\]/', '</blockquote>', $invision_markup);
// Replace '[twitter]$1[/twitter]' with '<a href="https://twitter.com/$1">@$1</a>"
$invision_markup = preg_replace('/\\[twitter\\](.*?)\\[\\/twitter\\]/', '<a href="https://twitter.com/$1">@$1</a>', $invision_markup);
// Replace '[member='username']' with '@username"
$invision_markup = preg_replace('/\\[member=\'(.*?)\'\\]/', '@$1 ', $invision_markup);
// Replace '[media]' with ''
$invision_markup = preg_replace('/\\[media\\]/', '', $invision_markup);
// Replace '[/media]' with ''
$invision_markup = preg_replace('/\\[\\/media\\]/', '', $invision_markup);
// Replace '[list:XXXXXXX]' with '<ul>'
$invision_markup = preg_replace('/\\[list\\]/', '<ul>', $invision_markup);
// Replace '[list=1:XXXXXXX]' with '<ul>'
$invision_markup = preg_replace('/\\[list=1\\]/', '<ul>', $invision_markup);
// Replace '[*:XXXXXXX]' with '<li>'
$invision_markup = preg_replace('/\\[\\*\\](.*?)\\<br \\/\\>/', '<li>$1</li>', $invision_markup);
// Replace '[/list:u:XXXXXXX]' with '</ul>'
$invision_markup = preg_replace('/\\[\\/list\\]/', '</ul>', $invision_markup);
// Replace '[hr]' with '<hr>"
$invision_markup = preg_replace('/\\[hr\\]/', '<hr>', $invision_markup);
// Replace '[font=XXXXXXX]' with ''
$invision_markup = preg_replace('/\\[font=(.*?)\\]/', '', $invision_markup);
// Replace '[/font]' with ''
$invision_markup = preg_replace('/\\[\\/font\\]/', '', $invision_markup);
// Replace any Invision smilies from path '/sp-resources/forum-smileys/sf-smily.gif' with the equivelant WordPress Smilie
$invision_markup = preg_replace('/\\<img src=(.*?)EMO\\_DIR(.*?)bbc_emoticon(.*?)alt=\'(.*?)\' \\/\\>/', '$4', $invision_markup);
$invision_markup = preg_replace('/\\:angry\\:/', ':mad:', $invision_markup);
$invision_markup = preg_replace('/\\:mellow\\:/', ':neutral:', $invision_markup);
$invision_markup = preg_replace('/\\:blink\\:/', ':eek:', $invision_markup);
$invision_markup = preg_replace('/B\\)/', ':cool:', $invision_markup);
$invision_markup = preg_replace('/\\:rolleyes\\:/', ':roll:', $invision_markup);
$invision_markup = preg_replace('/\\:unsure\\:/', ':???:', $invision_markup);
// Now that Invision custom HTML has been stripped put the cleaned HTML back in $field
$field = $invision_markup;
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例5: callback_html
/**
* This callback processes any custom parser.php attributes and custom HTML code with preg_replace
*/
protected function callback_html($field)
{
// Strip any custom HTML not supported by parser.php first from $field before parsing $field to parser.php
$simplepress_markup = $field;
$simplepress_markup = html_entity_decode($simplepress_markup);
// Replace any SimplePress smilies from path '/sp-resources/forum-smileys/sf-smily.gif' with the equivelant WordPress Smilie
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-confused\\.gif(.*?)\\" \\/>/', ':?', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-cool\\.gif(.*?)\\" \\/>/', ':cool:', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-cry\\.gif(.*?)\\" \\/>/', ':cry:', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-embarassed\\.gif(.*?)\\" \\/>/', ':oops:', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-frown\\.gif(.*?)\\" \\/>/', ':(', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-kiss\\.gif(.*?)\\" \\/>/', ':P', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-laugh\\.gif(.*?)\\" \\/>/', ':D', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-smile\\.gif(.*?)\\" \\/>/', ':smile:', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-surprised\\.gif(.*?)\\" \\/>/', ':o', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-wink\\.gif(.*?)\\" \\/>/', ':wink:', $simplepress_markup);
$simplepress_markup = preg_replace('/\\<img src=(.*?)\\/sp-resources\\/forum-smileys\\/sf-yell\\.gif(.*?)\\" \\/>/', ':x', $simplepress_markup);
// Replace '<div class="sfcode">example code</div>' with '<code>*</code>'
$simplepress_markup = preg_replace('/\\<div class\\=\\"sfcode\\"\\>(.*?)\\<\\/div\\>/', '<code>$1</code>', $simplepress_markup);
// Replace '<strong>username said </strong>' with '@username said:'
$simplepress_markup = preg_replace('/\\<strong\\>(.*?)\\ said\\ \\<\\/strong\\>/', '@$1 said:', $simplepress_markup);
// Replace '<p> </p>' with '<p> </p>'
$simplepress_markup = preg_replace('/\\n( |[\\s\\p{Z}\\xA0\\x{00A0}]+)\\r/', '<br>', $simplepress_markup);
// Now that SimplePress' custom HTML codes have been stripped put the cleaned HTML back in $field
$field = $simplepress_markup;
// Parse out any bbCodes with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例6: callback_html
/**
* This callback processes any custom parser.php attributes and custom code with preg_replace
*/
protected function callback_html($field)
{
// Strips custom dizkus 'magic_url' and 'bbcode_uid' first from $field before parsing $field to parser.php
$dizkus_uid = $field;
$dizkus_uid = html_entity_decode($dizkus_uid);
// Replace '[b:XXXXXXX]' with '<strong>'
$dizkus_uid = preg_replace('/\\[b:(.*?)\\]/', '<strong>', $dizkus_uid);
// Replace '[/b:XXXXXXX]' with '</strong>'
$dizkus_uid = preg_replace('/\\[\\/b:(.*?)\\]/', '</strong>', $dizkus_uid);
// Replace '[i:XXXXXXX]' with '<em>'
$dizkus_uid = preg_replace('/\\[i:(.*?)\\]/', '<em>', $dizkus_uid);
// Replace '[/i:XXXXXXX]' with '</em>'
$dizkus_uid = preg_replace('/\\[\\/i:(.*?)\\]/', '</em>', $dizkus_uid);
// Replace '[u:XXXXXXX]' with '<u>'
$dizkus_uid = preg_replace('/\\[u:(.*?)\\]/', '<u>', $dizkus_uid);
// Replace '[/u:XXXXXXX]' with '</u>'
$dizkus_uid = preg_replace('/\\[\\/u:(.*?)\\]/', '</u>', $dizkus_uid);
// Replace '[quote:XXXXXXX]' with '<blockquote>'
$dizkus_uid = preg_replace('/\\[quote:(.*?)\\]/', '<blockquote>', $dizkus_uid);
// Replace '[quote="$1"]' with '<em>$1 wrote:</em><blockquote>"
$dizkus_uid = preg_replace('/\\[quote="(.*?)":(.*?)\\]/', '<em>@$1 wrote:</em><blockquote>', $dizkus_uid);
// Replace '[/quote:XXXXXXX]' with '</blockquote>'
$dizkus_uid = preg_replace('/\\[\\/quote:(.*?)\\]/', '</blockquote>', $dizkus_uid);
// Replace '[img:XXXXXXX]' with '<img src="'
$dizkus_uid = preg_replace('/\\[img:(.*?)\\]/', '<img src="', $dizkus_uid);
// Replace '[/img:XXXXXXX]' with ' alt="">'
$dizkus_uid = preg_replace('/\\[\\/img:(.*?)\\]/', '" alt="">', $dizkus_uid);
// Replace '<!-- s$1 --><img src=\"{SMILIES_PATH}$2 -->' with '$1'
$dizkus_uid = preg_replace('/<!-- s(.*?) --><img src=\\"{SMILIES_PATH}(.*?)-->/', '$1', $dizkus_uid);
// Replace '<!-- m --><a class="postlink" href="$1">$1</a><!-- m -->' with '$1'
$dizkus_uid = preg_replace('/\\<!-- m --\\>\\<a class="postlink" href="([^\\[]+?)"\\>([^\\[]+?)\\<\\/a\\>\\<!-- m --\\>/', '$1', $dizkus_uid);
// Replace '[url:XXXXXXX]$1[/url:XXXXXXX]' with '<a href="http://$1">$1</a>'
$dizkus_uid = preg_replace('/\\[url:(?:[^\\]]+)\\]([^\\[]+?)\\[\\/url:(?:[^\\]]+)\\]/', '<a href="http://$1">$1</a>', $dizkus_uid);
// Replace '[url=http://$1:XXXXXXX]$3[/url:XXXXXXX]' with '<a href="http://$1">$3</a>'
$dizkus_uid = preg_replace('/\\[url\\=http\\:\\/\\/(.*?)\\:(.*?)\\](.*?)\\[\\/url:(.*?)\\]/i', '<a href="http://$1">$3</a>', $dizkus_uid);
// Replace '[url=https://$1:XXXXXXX]$3[/url:XXXXXXX]' with '<a href="http://$1">$3</a>'
$dizkus_uid = preg_replace('/\\[url\\=https\\:\\/\\/(.*?)\\:(.*?)\\](.*?)\\[\\/url:(.*?)\\]/i', '<a href="https://$1">$3</a>', $dizkus_uid);
// Replace '[email:XXXXXXX]' with '<a href="mailto:$2">$2</a>'
$dizkus_uid = preg_replace('/\\[email:(.*?)\\](.*?)\\[\\/email:(.*?)\\]/', '<a href="mailto:$2">$2</a>', $dizkus_uid);
// Replace '<!-- e -->no.one@domain.adr<!-- e -->' with '$1'
$dizkus_uid = preg_replace('/\\<!-- e --\\>(.*?)\\<!-- e --\\>/', '$1', $dizkus_uid);
// Replace '[code:XXXXXXX]' with '<pre><code>'
$dizkus_uid = preg_replace('/\\[code:(.*?)\\]/', '<pre><code>', $dizkus_uid);
// Replace '[/code:XXXXXXX]' with '</code></pre>'
$dizkus_uid = preg_replace('/\\[\\/code:(.*?)\\]/', '</code></pre>', $dizkus_uid);
// Replace '[color=$1:XXXXXXXX]' with '<span style="color:$1">'
$dizkus_uid = preg_replace('/\\[color=(.*?)\\:(.*?)\\]/', '<span style="color: $1">', $dizkus_uid);
// Replace '[/color:XXXXXXX]' with '</span>'
$dizkus_uid = preg_replace('/\\[\\/color:(.*?)\\]/', '</span>', $dizkus_uid);
// Replace '[size=$1:XXXXXXXX]' with '<span style="font-size:$1%;">$3</span>'
$dizkus_uid = preg_replace('/\\[size=(.*?):(.*?)\\]/', '<span style="font-size:$1%;">', $dizkus_uid);
// Replace '[/size:XXXXXXX]' with ''
$dizkus_uid = preg_replace('/\\[\\/size:(.*?)\\]/', '</span>', $dizkus_uid);
// Replace '[list:XXXXXXX]' with '<ul>'
$dizkus_uid = preg_replace('/\\[list:(.*?)\\]/', '<ul>', $dizkus_uid);
// Replace '[list=a:XXXXXXX]' with '<ol type="a">'
$dizkus_uid = preg_replace('/\\[list=a:(.*?)\\]/', '<ol type="a">', $dizkus_uid);
// Replace '[list=1:XXXXXXX]' with '<ol>'
$dizkus_uid = preg_replace('/\\[list=1:(.*?)\\]/', '<ol>', $dizkus_uid);
// Replace '[*:XXXXXXX]' with '<li>'
$dizkus_uid = preg_replace('/\\[\\*:(.*?)\\]/', '<li>', $dizkus_uid);
// Replace '[/*:m:XXXXXXX]' with '</li>'
$dizkus_uid = preg_replace('/\\[\\/\\*:m:(.*?)\\]/', '</li>', $dizkus_uid);
// Replace '[/list:u:XXXXXXX]' with '</ul>'
$dizkus_uid = preg_replace('/\\[\\/list:u:(.*?)\\]/', '</ul>', $dizkus_uid);
// Replace '[/list:o:XXXXXXX]' with '</ol>'
$dizkus_uid = preg_replace('/\\[\\/list:o:(.*?)\\]/', '</ol>', $dizkus_uid);
// Now that dizkus's 'magic_url' and 'bbcode_uid' have been stripped put the cleaned HTML back in $field
$field = $dizkus_uid;
// Parse out any bbCodes in $field with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例7: callback_html
/**
* This callback processes any custom parser.php attributes and custom code with preg_replace
*/
protected function callback_html($field)
{
// Strips custom e107v1 'magic_url' and 'bbcode_uid' first from $field before parsing $field to parser.php
$e107v1_markup = $field;
$e107v1_markup = html_entity_decode($e107v1_markup);
// Replace '[blockquote]' with '<blockquote>'
$e107v1_markup = preg_replace('/\\[blockquote\\]/', '<blockquote>', $e107v1_markup);
// Replace '[/blockquote]' with '</blockquote>'
$e107v1_markup = preg_replace('/\\[\\/blockquote\\]/', '</blockquote>', $e107v1_markup);
// Replace '[quote$1=$2]' with '<em>$2 wrote:</em><blockquote>"
$e107v1_markup = preg_replace('/\\[quote(.*?)=(.*?)\\]/', '<em>@$2 wrote:</em><blockquote>', $e107v1_markup);
// Replace '[/quote$1]' with '</blockquote>"
$e107v1_markup = preg_replace('/\\[\\/quote(.*?)\\]/', '</blockquote>', $e107v1_markup);
// Remove '[justify]'
$e107v1_markup = preg_replace('/\\[justify\\]/', '', $e107v1_markup);
// Remove '[/justify]'
$e107v1_markup = preg_replace('/\\[\\/justify\\]/', '', $e107v1_markup);
// Replace '[link=(https|http)://$2]$3[/link]' with '<a href="$1://$2">$3</a>'
$e107v1_markup = preg_replace('/\\[link\\=(https|http)\\:\\/\\/(.*?)\\](.*?)\\[\\/link\\]/i', '<a href="$1://$2">$3</a>', $e107v1_markup);
// Replace '[list=(decimal|lower-roman|upper-roman|lower-alpha|upper-alpha)]' with '[list]'
$e107v1_markup = preg_replace('/\\[list\\=(decimal|lower-roman|upper-roman|lower-alpha|upper-alpha)\\]/i', '[list]', $e107v1_markup);
// Replace '[youtube]$1[/youtube]' with '$1"
$e107v1_markup = preg_replace('/\\[youtube\\](.*?)\\[\\/youtube\\]/', 'https://youtu.be/$1', $e107v1_markup);
// Now that e107v1 custom HTML has been stripped put the cleaned HTML back in $field
$field = $e107v1_markup;
// Parse out any bbCodes in $field with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}
示例8: callback_html
/**
* This callback processes any custom parser.php attributes and custom code with preg_replace
*/
protected function callback_html($field)
{
// Strips Xenforo custom HTML first from $field before parsing $field to parser.php
$xenforo_markup = $field;
$xenforo_markup = html_entity_decode($xenforo_markup);
// Replace '[QUOTE]' with '<blockquote>'
$xenforo_markup = preg_replace('/\\[QUOTE\\]/', '<blockquote>', $xenforo_markup);
// Replace '[/QUOTE]' with '</blockquote>'
$xenforo_markup = preg_replace('/\\[\\/QUOTE\\]/', '</blockquote>', $xenforo_markup);
// Replace '[QUOTE=User Name($1)]' with '<em>@$1 wrote:</em><blockquote>"
$xenforo_markup = preg_replace('/\\[quote=\\"(.*?)\\,\\spost\\:\\s(.*?)\\,\\s\\member\\:\\s(.*?)\\"\\](.*?)\\[\\/quote\\]/', '<em>@$1 wrote:</em><blockquote>', $xenforo_markup);
// Replace '[/quote]' with '</blockquote>'
$xenforo_markup = preg_replace('/\\[\\/quote\\]/', '</blockquote>', $xenforo_markup);
// Replace '[media=youtube]$1[/media]' with '$1"
$xenforo_markup = preg_replace('/\\[media\\=youtube\\](.*?)\\[\\/media\\]/', 'https://youtu.be/$1', $xenforo_markup);
// Replace '[media=dailymotion]$1[/media]' with '$1"
$xenforo_markup = preg_replace('/\\[media\\=dailymotion\\](.*?)\\[\\/media\\]/', 'https://www.dailymotion.com/video/$1', $xenforo_markup);
// Replace '[media=vimeo]$1[/media]' with '$1"
$xenforo_markup = preg_replace('/\\[media\\=vimeo\\](.*?)\\[\\/media\\]/', 'https://vimeo.com/$1', $xenforo_markup);
// Now that Xenforo custom HTML has been stripped put the cleaned HTML back in $field
$field = $xenforo_markup;
// Parse out any bbCodes in $field with the BBCode 'parser.php'
require_once bbpress()->admin->admin_dir . 'parser.php';
$bbcode = BBCode::getInstance();
$bbcode->enable_smileys = false;
$bbcode->smiley_regex = false;
return html_entity_decode($bbcode->Parse($field));
}