Pro_Lamer4e
Registered
здравейте, имам проблем с BBcode едитор, когато в текста присъства ( ' ) изобщо не запазва в базата никакъв текст ,има ли начин да се оправи това и как.
";
$replace = str_replace("{ZEILEN}", $zeilen, $start_html);
$replace .= $after_replace;
$replace .= $end_html;
$text = str_replace($str_to_match, $replace, $text);
}
$text = str_replace("
", $end_html, $text);
return $text;
}[/code]
Код:
function encode_code($text) {
$start_html = "<div align=\"center\"><div style=\"width: 85%; overflow: auto\">"
. "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\" class=\"bgcolor4\">"
. "<tr bgcolor=\"E5EFFF\"><td colspan=\"2\"><font class=\"block-title\">Code</font></td></tr>"
. "<tr class=\"bgcolor1\"><td align=\"right\" class=\"code\" style=\"width: 5px; border-right: none\">{ZEILEN}</td><td class=\"code\">";
$end_html = "</td></tr></table></div></div>";
$match_count = preg_match_all("#\[code\](.*?)\[/code\]#si", $text, $matches);
for ($mout = 0; $mout < $match_count; ++$mout) {
$before_replace = $matches[1][$mout];
$after_replace = $matches[1][$mout];
$after_replace = trim($after_replace);
$zeilen_array = explode("<br />", $after_replace);
$j = 1;
$zeilen = "";
foreach ($zeilen_array as $str) {
$zeilen .= "" . $j . "<br />";
++$j;
}
$after_replace = str_replace("", "", $after_replace);
$after_replace = str_replace("&", "&", $after_replace);
$after_replace = str_replace("", " ", $after_replace);
$after_replace = str_replace("", " ", $after_replace);
$after_replace = str_replace("", " ", $after_replace);
$after_replace = preg_replace("/^ {1}/m", " ", $after_replace);
$str_to_match = "[code]" . $before_replace . "
$replace = str_replace("{ZEILEN}", $zeilen, $start_html);
$replace .= $after_replace;
$replace .= $end_html;
$text = str_replace($str_to_match, $replace, $text);
}
$text = str_replace("
Код:
", $start_html, $text);
$text = str_replace("
return $text;
}[/code]