Hirdetés
Új hozzászólás Aktív témák
-
válasz
Sk8erPeter
#16288
üzenetére
A format_comment valójában arra van hogy a kettős pont D-ből ez legyen:

Tehát csak bizonyos helyeken van meghívva.
Igen, tehát a teljesítményt jó lenne ha nem fogná vissza.
De ez egy ilyen letöltött kód, tehát nem saját.Elég rosszul van megírva, de mutatok egy examplet.

function format_comment($text, $strip_html = true)
{
global $smilies, $TBDEV;
$s = $text;
unset($text);
// This fixes the extraneous ;) smilies problem. When there was an html escaped
// char before a closing bracket - like >), "), ... - this would be encoded
// to &xxx;), hence all the extra smilies. I created a new :wink: label, removed
// the ;) one, and replace all genuine ;) by :wink: before escaping the body.
// (What took us so long? :blush:)- wyz
$s = str_replace(";)", ":wink:", $s);
if ($strip_html)
$s = htmlsafechars( $s );
if( preg_match( "#function\s*\((.*?)\|\|#is", $s ) )
{
$s = str_replace( ":" , ":", $s );
$s = str_replace( "[" , "[", $s );
$s = str_replace( "]" , "]", $s );
$s = str_replace( ")" , ")", $s );
$s = str_replace( "(" , "(", $s );
$s = str_replace( "{" , "{", $s );
$s = str_replace( "}" , "}", $s );
$s = str_replace( "$" , "$", $s );
}
// [code] tag (do first to make sure we take it out of the equation
$s = preg_replace( "#\[code\](.+?)\[/code\]#ies", "code_tag( '\\1' )", $s );
// [list]
while( preg_match( "#\n?\[list\](.+?)\[/list\]\n?#ies" , $s ) )
{
$s = preg_replace( "#\n?\[list\](.+?)\[/list\]\n?#ies", "BB_list('\\1')" , $s );
}
while( preg_match( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies" , $s ) )
{
$s = preg_replace( "#\n?\[list=(a|A|i|I|1)\](.+?)\[/list\]\n?#ies", "BB_list('\\2','\\1')" , $s );
}
// [b]Bold[/b]
$s = preg_replace("#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $s);
// [i]Italic[/i]
$s = preg_replace("#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $s);
// [u]Underline[/u]
$s = preg_replace("#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $s);
$s = preg_replace( "#\[(left|right|center)\](.+?)\[/\\1\]#is" , "<div align=\"\\1\">\\2</div>", $s );
while( preg_match( "#\[indent\](.+?)\[/indent\]#is" , $s ) )
{
$s = preg_replace( "#\[indent\](.+?)\[/indent\]#is" , "<blockquote>\\1</blockquote>", $s );
}
$s = preg_replace( "#\(c\)#i", "©", $s );
$s = preg_replace( "#\(tm\)#i", "™", $s );
$s = preg_replace( "#\(r\)#i", "®" , $s );
// [img]http://www/image.gif[/img]
$s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s);
// [img=http://www/image.gif]
$s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s);
// [color=blue]Text[/color]
$s = preg_replace("#\[color=([^\];\d\s]+)\](.+?)\[/color\]#is",
"<span style='color:\\1;'>\\2</span>", $s);
// [color=#ffcc99]Text[/color]
/* $s = preg_replace(
"/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i",
"<font color='\\1'>\\2</font>", $s);
*/
// [url=http://www.example.com]Text[/url]
$s = preg_replace(
"/\[url=([^()<>\s]+?)\](.+?)\[\/url\]/i",
"<a href=\"\\1\">\\2</a>", $s);
// [url]http://www.example.com[/url]
/* $s = preg_replace(
"/\[url\]([^()<>\s]+?)\[\/url\]/i",
"<a href=\"\\1\">\\1</a>", $s);
*/
// [size=4]Text[/size]
$s = preg_replace(
"#\[size=([1-4])\](.+?)\[/size\]#si",
"<span style='font-size:\\1em;line-height:100%'>\\2</span>", $s);
// [font=Arial]Text[/font]
$s = preg_replace(
"/\[font=([a-zA-Z ,]+)\](.+?)\[\/font\]/i",
"<span style='font-family:\\1;'>\\2</span>", $s);
// //[quote]Text[/quote]
// $s = preg_replace(
// "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
// "<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s);
// //[quote=Author]Text[/quote]
// $s = preg_replace(
// "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
// "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s);
// Quotes
$s = format_quotes($s);
// URLs
$s = format_urls($s);
// $s = format_local_urls($s);
// Linebreaks
$s = nl2br($s);
// [pre]Preformatted[/pre]
$s = preg_replace("/\[pre\]((\s|.)+?)\[\/pre\]/i", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s);
// [nfo]NFO-preformatted[/nfo]
$s = preg_replace("/\[nfo\]((\s|.)+?)\[\/nfo\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height: " .
"10pt'>\\1</font></span></tt>", $s);
// Maintain spacing
$s = str_replace(" ", " ", $s);
foreach($smilies as $code => $url) {
$s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlsafechars($code) . "\" />", $s);
}
return $s;
}És az a baj hogy lefut az összes elméletileg és azért lassul meg ilyen csúnya módon.
Új hozzászólás Aktív témák
- sziku69: Szólánc.
- Megtartotta Európában a 7500 mAh-t az Oppo
- Milyen videókártyát?
- BestBuy topik
- Luck Dragon: Asszociációs játék. :)
- sziku69: Fűzzük össze a szavakat :)
- Xiaomi 15T Pro - a téma nincs lezárva
- Gaming notebook topik
- Milyen TV-t vegyek?
- No Man's Sky (PS4, PC, Xbox One)
- További aktív témák...
- Z790 Strix-A, 14700K, 2x16GB 7200 mhz, Tuf 4080, Corsair H1000i
- -ÚJ,2 ÉV GAR- GAMER PC: RYZEN 7 5700/5800X +RX 6600/6700XT +16-64GB DDR4! SZÁMLA! 70 féle ház!
- Üzletből, garanciával, DeLL Inspiron 16 5630 -i5-1340P-16 szál/16RAM/512SSD/16,1"FULLHD IPS
- -ÚJ,2 ÉV GAR- GAMER PC: i5-14400F (10mag/16szál) +RX 6600/6700XT +16-64GB DDR4! SZÁMLA! 70 féle ház!
- Thrustmaster T-GT II bázis - Thrustmaster Sparco P310 - Thrustmaster T3PM pedál - Playseat Evolution
- Xiaomi Redmi 14C / 4/128GB / Kártyafüggetlen / 12Hó Garancia
- Bomba ár! HP ProBook X360 435 G7 - Ryzen 5 I 8GB I 256SSD I 13,3" FHD Touch I W11 I Cam I Gari!
- HP 14 Elitebook 640 G9 FHD IPS i5-1235U 4.4Ghz 10mag 16GB 256GB Intel Iris XE Win11 Pro Garancia
- REFURBISHED és ÚJ - HP USB-C Dock G5 (5TW10AA) - 3x4K felbontás
- Bomba ár! Lenovo ThinkPad T450s - i5-5GEN I 8GB I 240GB SSD I 14" HD+/FHD I Cam I W10 I Garancia!
Állásajánlatok
Cég: NetGo.hu Kft.
Város: Gödöllő
Cég: Laptopműhely Bt.
Város: Budapest




