Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Second parse code tag
- */
- function bbcode_second_pass_code($type, $code)
- {
- global $phpbb_root_path;
- // when using the /e modifier, preg_replace slashes double-quotes but does not
- // seem to slash anything else
- $code = str_replace('\"', '"', $code);
- // ------------------------------------------------------------------------------------
- // edited by jb (nebler.org)
- // including geshi
- // geshipfad, relativ zum haupt-ordner (oder absolut (untested))
- $geshi_path = $phpbb_root_path . 'includes/geshi/geshi.php';
- if (empty($type))
- {
- $code = str_replace("\t", ' ', $code);
- $code = str_replace(' ', ' ', $code);
- $code = str_replace(' ', ' ', $code);
- // remove newline at the beginning
- if (!empty($code) && $code[0] == "\n")
- {
- $code = substr($code, 1);
- }
- }
- else if(!include_once( $geshi_path ) ) { // include = zur laufzeit, requier zum start
- echo 'geshi n\'a pas pu être!';
- } else
- {
- // Es kommt nicht ursprünglicher Code an ...
- // hier die rückformatierung, vllt nicht schön aber selten ;)
- // Not the english way ... steht irgendwo im quellcode :)
- $astr_to = array('<', '>', '[', ']', '.', ':','"','&');
- $astr_from = array('<', '>', '[', ']', '.', ':','"', '&');
- $code = str_replace($astr_from, $astr_to, $code);
- // binde geshi ein, siehe geshi-faq
- // geshi Objekt erzeugen und code erzeuegn
- $geshi = new GeSHi( $code, $type );
- // Zeilennummern aktivieren, besonderes highlght alle 5 Zeilen, siehe documentation von geshi
- $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
- // header type setzten, siehe documentation von geshi
- $geshi->set_header_type(GESHI_HEADER_NONE);
- // code parsen und highlighten
- $code = $geshi->parse_code();
- // überflüssige <br /> entfernen
- $code = str_replace( "\n", "\r", $code );
- }
- // ------------------------------------------------------------------------------------
- $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');
- return $code;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement