<?
function bb_html ($metin,$mdir='editor'){
$metin = ' '.$metin;
$bb = array(
'(')',
'([t.])',
'/](s.)[/is',
'([ol](.*?)[/ol])is',
'([ul](.*?)[/ul])is',
'([li](.*?)[/li])is',
'([kod](.*?)[/kod])is',
'((.*?) )is',
'([caption](.+?)[/caption])is',
'([left](.*?)[/left])is',
'([center](.*?)[/center])is',
'([right](.*?)[/right])is',
'([renk=(.*?)](.*?)[/renk])is',
'([a(.+?)](.+?))is',
'([img(.+?)])is',
'([b](.+?)[/b])is',
'([strong>(.+?)[/strong])is',
'([i](.+?)[/i])is',
'([strike](.+?)[/strike])is',
'([u](.+?)[/u])is',
'([s](.+?)[/s])is',
'([p(.*?)](.+?)[/p])is',
'([sub](.+?)[/sub])is',
'([sup](.+?)[/sup])is',
'([em](.+?)[/em])is',
'([pre](.+?)[/pre])is',
'([hr(.*?)])is',
'([br])is',
'([br /])is'
);
$html = array(
"'",
'"',
"][",
"<ol>$1</ol>",
"<ul>$1</ul>",
"<li>$1</li>",
'<div id="code">'.highlight_string(html_entity_decode(trim("$1")), true).'</div>',
'<div id="code">'.highlight_string(html_entity_decode(trim("$1")), true).'</div>',
"<caption>$1</caption>",
"<p align="left\\">$1</p>",
"<p align="center\\">$1</p>",
"<p align="right\\">$1</p>",
"<font color="".htmlspecialchars(strip_tags('$1))."\\">$2</font>",
"<a$1 target="_blank\\">$2</a>",
"<img$1>",
"<b>$1</b>",
"<b>$1</b>",
"<i>$1</i>",
"<i>$1</i>",
"<u>$1</u>",
"<s>$1</s>",
"<p$1>$2</p>",
"<sub>$1</sub>",
"<sup>$1</sup>",
"<em>$1</em>",
"<pre>$1</pre>",
"<hr$1 />",
"<br>",
"<br />"
);
$metin = preg_replace($bb,$html,$metin);
return substr($metin, 1);
}
//KULLANIMI
$yazi="<b>php ve mysql</b>";
echo bb_html($yazi);
?>
|