e107v1::callback_html( $field )
This callback processes any custom parser.php attributes and custom code with preg_replace
Contents
Description Description
Source Source
File: includes/admin/converters/e107v1.php
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'
return parent::callback_html( $field );
}