Файл: kernel/_function/parserString.php
Строк: 115
<?php
function parserString($string) {
$patterns = array();
$patterns[0] = '/[b]/';
$patterns[1] = '/[/b]/';
$patterns[2] = '/[i]/';
$patterns[3] = '/[/i]/';
$patterns[4] = '/[u]/';
$patterns[5] = '/[/u]/';
$patterns[6] = '/[s]/';
$patterns[7] = '/[/s]/';
$patterns[8] = '/[smile]/';
$patterns[9] = '/[/smile]/';
$patterns[10] = '/[a]/';
$patterns[11] = '/[/a]/';
$patterns[12] = '/[sup]/';
$patterns[13] = '/[/sup]/';
$patterns[14] = '/[sub]/';
$patterns[15] = '/[/sub]/';
$patterns[16] = '/[h1]/';
$patterns[17] = '/[/h1]/';
$patterns[18] = '/[h2]/';
$patterns[19] = '/[/h2]/';
$patterns[20] = '/[h3]/';
$patterns[21] = '/[/h3]/';
$patterns[22] = '/[h4]/';
$patterns[23] = '/[/h4]/';
$patterns[24] = '/[h5]/';
$patterns[25] = '/[/h5]/';
$patterns[26] = '/[h6]/';
$patterns[27] = '/[/h6]/';
$patterns[28] = '/[img]/';
$patterns[29] = '/[/img]/';
$patterns[30] = '/[quote]/';
$patterns[31] = '/[/quote]/';
$patterns[32] = '/[link=/'; //[link=http://бла бла бла=l] Текст ссылки [/link] без пробелов
$patterns[33] = '/[/link]/';
$patterns[34] = '/=l]/';
$patterns[35] = '/ /';
$patterns[36] = '/[url=/'; //[url=http://бла бла бла=l] Текст ссылки [/url] без пробелов
$patterns[37] = '/[/url]/';
$patterns[38] = '/]/';
$patterns[39] = '/ /';
$patterns[40] = '/\n/';
/*$patterns[41] = '/[color=/';
$patterns[42] = '/[/color]/';
$patterns[43] = '/]/';*/
$replacements = array();
$replacements[0] = "<b>";
$replacements[1] = "</b>";
$replacements[2] = "<em>";
$replacements[3] = "</em>";
$replacements[4] = "<u>";
$replacements[5] = "</u>";
$replacements[6] = "<s>";
$replacements[7] = "</s>";
$replacements[8] = "<img src='/images/smiles/";
$replacements[9] = ".gif' />";
$replacements[10] = "<a href='";
$replacements[11] = "'>ссылка</a>";
$replacements[12] = "<sup>";
$replacements[13] = "</sup>";
$replacements[14] = "<sub>";
$replacements[15] = "</sub>";
$replacements[16] = "<h1>";
$replacements[17] = "</h1>";
$replacements[18] = "<h2>";
$replacements[19] = "</h2>";
$replacements[20] = "<h3>";
$replacements[21] = "</h3>";
$replacements[22] = "<h4>";
$replacements[23] = "</h4>";
$replacements[24] = "<h5>";
$replacements[25] = "</h5>";
$replacements[26] = "<h6>";
$replacements[27] = "</h6>";
$replacements[28] = "<img src='";
$replacements[29] = "' alt='' width='35%' height='150'/>";
$replacements[30] = "<div class='quote'>";
$replacements[31] = "</div>";
$replacements[32] = "<a target='_parent' href='"; //[link=http://бла бла бла=l] Текст ссылки [/link] без пробелов
$replacements[33] = "</a>";
$replacements[34] = "'>";
$replacements[35] = "' ";
$replacements[36] = "<a target='_blank' href='"; //[link=http://бла бла бла=l] Текст ссылки [/link] без пробелов
$replacements[37] = " <img src='/images/blank_link.png' alt='url'/></a>";
$replacements[38] = "'>";
$replacements[39] = "' ";
$replacements[40] = "<br/>";
/*$replacements[41] = "<font color='";
$replacements[42] = "</font>";
$replacements[43] = "'>";*/
$result = preg_replace($patterns, $replacements, $string);
return $result;
}
?>