geshi_highlighter GeSHi syntax highlighter 0.1.21 A syntax highlighter that makes use of GeSHi El Bekko 1.3 Beta 1.3 Beta ', '', $tpl_main); ]]> enable_line_numbers(GESHI_NO_LINE_NUMBERS); $GLOBALS['geshi']->line_ending = "\n"; } // // Split text into chunks by regular expression ($inside contains all text inside $start and $end, and $outside contains all text outside) // if(!function_exists('preg_split_text')) { function preg_split_text($text, $start, $end, $retab = true) { global $forum_config; $tokens = preg_split($start, $text); $outside[] = $tokens[0]; $num_tokens = count($tokens); for ($i = 1; $i < $num_tokens; ++$i) { $temp = preg_split($end, $tokens[$i]); //$temp = $temp[0]; $inside[] = $temp[0]; $outside[] = $temp[1]; } if ($forum_config['o_indent_num_spaces'] != 8 && $retab) { $spaces = str_repeat(' ', $forum_config['o_indent_num_spaces']); $inside = str_replace("\t", $spaces, $inside); } return array($inside, $outside); } } // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (preg_match('#\[code\=(.+?)\]#', $text) !== 0 && strpos($text, '[/code]') !== false) { list($geshi_inside, $geshi_outside) = preg_split_text($text, '#\[code\=(.+?)\]#', '#\[/code\]#'); preg_match_all('#\[code\=(.+?)\]#', $text, $geshi_matches); $geshi_languages = $geshi_matches[1]; $geshi_outside = array_map('ltrim', $geshi_outside); $text = implode('[%]', $geshi_outside); } ]]> set_source(html_entity_decode($geshi_inside[$i], ENT_QUOTES)); $GLOBALS['geshi']->set_language($lang); $code = $GLOBALS['geshi']->parse_code(); $text .= '

'.strtoupper($lang).' '.$lang_common['Code'].':
'.$code.'

'; } } $geshi_languages = array_unique($geshi_languages); $repstr = ''; foreach($geshi_languages as $lang) $repstr .= "\n".''; $repstr .= ''."\n"; $GLOBALS['tpl_main'] = str_replace('', $repstr, $GLOBALS['tpl_main']); } ]]>