Ответов: 2 Просмотров: 1373
|
к сожалению, все осталось прежнем пример: может дело в обработке bb посмотрите как я делаю PHP:
скопировать код в буфер обмена
function code_bbcode($text) { $text = html_entity_decode(trim($text), ENT_QUOTES, 'UTF-8'); $text = preg_replace_callback('#\[php\](.*?)\[/php\]#si', create_function('$matches', ' $matches[1] = htmlspecialchars_decode($matches[1]); $matches[1] = (stripos($matches[1], "<?PHP ") === false)? "<?PHP \r\n".$matches[1]. "\n?>": $matches[1]; $matches[1] = highlight_string($matches[1], 1); $br_num = substr_count($matches[1], "\n"); $numeric[] = "<table cellpadding=\"0px\" cellspacing=\"0px\" border=\"0\"><tr><td style=\"font-size:13px; border-right:#999999 ; padding-right:5px; font-family:\'Courier New\', Courier, monospace; text-align:right; vertical-align:top;\">"; for($i=1; $i<=$br_num + 1; $i++) { $numeric[] = $i."<br />"; } $numeric[] = "</td><td style=\font-size:13px; padding:1px 5px 0px; vertical-align:top; white-space:nowrap;\">".$matches[1]; $numeric[] = "</td></tr></table>"; $matches[1] = implode("", $numeric); $result = "<div style=\"background-color:#A9B8C2; padding:1px 5px 0px; border: 1px solid #9fa9b8; font-family: Lucida Grande, Verdana, Helvetica, Arial, sans-serif;font-size:10px; \">PHP</div><div style=\"background-color:#e0e6e9; border: 1px solid #9fa9b8; padding:5px;\">".$matches[1]." </div>"; return $result;'), $text);
что самое интересное. заменяю <br /> на \n все работает как нужно. |