Esta es la funcion que reemplaza:
Código PHP:
Ver original
function fixBBCTags($body) { //code without value pattern $body = preg_replace('#<pre\s\ class=(\'|")_prettyXprint\1>(.*?)<\/pre>#is','[code]$2[/code]',$body); //normal code $body = preg_replace('#<pre\s+class=(\'|")_prettyXprint\s+_lang-auto\s+_linenums:(?:.*?)\1>(.*?)<\/pre>#is','[code]$2[/code]',$body); //code with value pattern $body = preg_replace('#<pre\s+class=(\'|")_prettyXprint\s_lang-(.*?)\s_linenums:(?:.*?)\1>(.*?)<\/pre>#is','[code=$2]$3[/code]',$body); //code with value pattern version 2 $body = preg_replace('#<pre\s+class=(\'|")_prettyXprint\s+_lang-(.*?)\1>(.*?)<\/pre>#is','[code=$2]$3[/code]',$body); //geshi block $body = preg_replace('#<pre\s+class=(\'|")(.*?)\sgeshi_block\1>(.*?)<\/pre>#is','[code=$2]$3[/code]',$body); //images //list decimal $body = preg_replace('#<ul\s+class=(\'|")bbc\s+bbcol\s+decimal\1>(.*?)<\/ul>#is','[list type=decimal]$2[/list]',$body); //normal quote $body = preg_replace('#<blockquote\s+class=(\'|")ipsBlockquote\1>(.*?)<\/blockquote>#is','[quote]$2[/quote]',$body); $body = preg_replace('#<a\s+data-ipb=(\'|")nomediaparse\1\s+href=\1mailto:(.*?)\1>(.*?)<\/a>#is','[email]$2[/email]',$body); //list normal //Center $body = preg_replace('#<p\s+style=(\'|")text-align:center;\1>(.*?)<\/p>#is','[center]$2[/center]',$body); //left //right $body = preg_replace('#<p\s+style=(\'|")text-align:right;\1>(.*?)<\/p>#is','[right]$2[/right]',$body); //ftp $body = preg_replace('#<a\s+data-ipb=(\'|")nomediaparse\1\s+href=\1ftp:(?:.*?)\1>(.*?)<\/a>#is','[ftp]$2[/ftp]',$body); //underline //strike //superindex //subindex //items list //quote with value pattern $body = preg_replace('#<blockquote\s+class=(\'|")ipsBlockquote\1\s+data-author=\1(.*?)\1\s+data-cid=\1([0-9]+)\1\s+data-time=\1([0-9]+)\1>(.*?)<\/blockquote>#is','[quote author=$2 link=topic=.msg$3#msg$3 date=$4]$5[/quote]',$body); //italic //bold //color $body = preg_replace('#<span\s+style=(\'|")color:(.*?);\1>(.*?)<\/span>#is','[color=$2]$3[/color]',$body); //font size $body = preg_replace('#<span\s+style=(\'|")font-size:(.*?)px;\1>(.*?)<\/span>#is','[size=$2pt]$3[/size]',$body); //font type $body = preg_replace('#<span\s+style=(\'|")font-family:(.*?),(?:.*?);\1>(.*?)<\/span>#is','[font=$2]$3[/font]',$body); //Url $body = preg_replace('#<a\s+data-ipb=(\'|")nomediaparse\1\s+href=\1(.*?)\1>(.*?)<\/a>#is','[url=$2]$3[/url]',$body); //marquee $body); return $body; }
Y aqui la utilizo, por ahí en la línea 32:
Código PHP:
Ver original
"SELECT p.pid AS id_msg, p.topic_id AS id_topic, p.post_date AS poster_time, p.author_id AS id_member, SUBSTRING(t.title, 1, 255) AS subject, SUBSTRING(p.author_name, 1, 255) AS poster_name, SUBSTRING(p.ip_address, 1, 255) AS poster_ip, p.use_emo AS smileys_enabled, IFNULL(p.edit_time, 0) AS modified_time, SUBSTRING(p.edit_name, 1, 255) AS modified_name, t.forum_id AS id_board, SUBSTRING(p.post, 1, 65534) AS body, SUBSTRING(mem.email, 1, 255) AS poster_email, 'xx' AS icon FROM " . $from_prefix ."posts AS p LEFT JOIN " . $from_prefix ."topics AS t ON (t.tid = p.topic_id) LEFT JOIN " . $from_prefix ."members AS mem ON (mem.member_id = p.author_id) WHERE p.pid != 0 ORDER BY p.pid LIMIT " . $i ."," . $limit); { 'id_msg' => $row['id_msg'], 'id_topic' => $row['id_topic'], 'poster_time' => $row['poster_time'], 'id_member' => $row['id_member'], 'subject' => $row['subject'], 'poster_name' => $row['poster_name'], 'poster_ip' => $row['poster_ip'], 'smileys_enabled' => $row['smileys_enabled'], 'modified_time' => $row['modified_time'], 'modified_name' => $row['modified_name'], 'id_board' => $row['id_board'], 'poster_email' => $row['poster_email'], 'icon' => $row['icon'], ); }
Anteriormente lo intenté con varios parseadores HTML con el mismo resultado, ¿qué estaré haciendo mal?, ¿habrá otra manera de hacerlo?.
Saludos.