Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function replaceAll($text, $smile)
- {
- global $pageLang;
- switch ($pageLang) {
- case 'pl':
- $clang = "lang_pl";
- $langs = array('en' => 'lang_en', 'br' => 'lang_br', 'se' => 'lang_se');
- break;
- case 'en':
- $clang = "lang_en";
- $langs = array('pl' => 'lang_pl', 'br' => 'lang_br', 'se' => 'lang_se');
- break;
- case 'br':
- $clang = "lang_br";
- $langs = array('pl' => 'lang_pl', 'en' => 'lang_en', 'se' => 'lang_se');
- break;
- case 'se':
- $clang = "lang_se";
- $langs = array('pl' => 'lang_pl', 'en' => 'lang_en', 'br' => 'lang_br');
- break;
- default:
- exit("Lang system error. Report this to administrator.");
- break;
- }
- $text = str_ireplace('['.$clang.']', '', $text);
- $text = str_ireplace('[/'.$clang.']', '', $text);
- foreach ($langs as $k => $v) {
- $rows = 0;
- while(stripos($text, '['.$v.']') !== false && stripos($text, '[/'.$v.']') !== false )
- {
- $lang = substr($text, stripos($text, '['.$v.']')+9, stripos($text, '[/'.$v.']') - stripos($text, '['.$v.']') - 9);
- $text = str_ireplace('['.$v.']'.$lang.'[/'.$v.']', '', $text);
- }
- }
- $rows = 0;
- while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
- {
- $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
- if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
- $text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
- }
- $rows = 0;
- while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
- {
- $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
- if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
- $text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
- }
- $rows = 0;
- while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
- {
- $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
- $text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
- }
- while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false )
- {
- $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8);
- $text = str_ireplace('[player]'.$player.'[/player]', '<a href="?subtopic=characters&name='.urlencode($player).'">'.$player.'</a>', $text);
- }
- while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false )
- {
- $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5);
- $text = str_ireplace('[img]'.$img.'[/img]', '<img src="'.$img.'">', $text);
- }
- while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false )
- {
- $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3);
- $text = str_ireplace('[b]'.$b.'[/b]', '<b>'.$b.'</b>', $text);
- }
- while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false )
- {
- $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3);
- $text = str_ireplace('[i]'.$i.'[/i]', '<i>'.$i.'</i>', $text);
- }
- while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false )
- {
- $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3);
- $text = str_ireplace('[u]'.$u.'[/u]', '<u>'.$u.'</u>', $text);
- }
- return replaceSmile($text, $smile);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement