plugins/GeSHi.php
author Dan
Sun, 10 Feb 2008 19:00:04 -0500
changeset 1 c715631f809a
parent 0 441963e5b07a
child 2 9e3258dfae15
permissions -rwxr-xr-x
First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     1
<?php
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     2
/*
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     3
Plugin Name: GeSHi syntax highlighting
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     4
Plugin URI: http://enanocms.org/GeSHi_support
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     5
Description: Adds syntax highlighting support using the GeSHi engine.
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     6
Author: Dan Fuhry
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     7
Version: 0.1
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     8
Author URI: http://enanocms.org/
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
     9
*/
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    10
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    11
/*
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    12
 * GeSHi highlighting plugin for Enano
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    13
 * Version 0.1
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    14
 * Copyright (C) 2007 Dan Fuhry
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    15
 *
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    16
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    17
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    18
 *
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    19
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    20
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    21
 */
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    22
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    23
global $db, $session, $paths, $template, $plugins; // Common objects
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    24
$GLOBALS['geshi_supported_formats'] = array(
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    25
    'abap', 'blitzbasic', 'cpp-qt', 'd', 'idl', 'lua', 'ocaml', 'python', 'smalltalk', 'vhdl', 'actionscript', 'bnf', 'csharp',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    26
    'eiffel', 'ini', 'm68k', 'oobas', 'qbasic', 'smarty', 'visualfoxpro', 'ada', 'caddcl', 'fortran', 'inno', 'matlab',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    27
    'oracle8', 'rails', 'sql', 'winbatch', 'apache', 'cadlisp', 'css', 'freebasic', 'io', 'mirc', 'pascal', 'reg', 'tcl', 'xml',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    28
    'applescript', 'cfdg', 'delphi', 'genero', 'java5', 'mpasm', 'perl', 'robots', 'text', 'xpp', 'asm', 'cfm', 'diff', 'gml', 'java',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    29
    'mysql', 'per', 'ruby', 'thinbasic', 'z80', 'asp', 'c_mac', 'div', 'groovy', 'javascript', 'nsis', 'php-brief', 'sas', 'tsql',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    30
    'autoit', 'c', 'dos', 'haskell', 'latex', 'objc', 'php', 'scheme', 'vbnet', 'bash', 'cpp', 'dot', 'html', 'lisp',
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    31
    'ocaml-brief', 'plsql', 'sdlbasic', 'vb'
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    32
  );
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    33
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    34
// Knock out the existing <code> tag support
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    35
$plugins->attachHook('text_wiki_construct', 'geshi_disable_tw_code($this);');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    36
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    37
function geshi_disable_tw_code($tw)
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    38
{
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    39
  $tw->disable[] = 'Code';
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    40
  foreach ( $tw->rules as $i => $rule )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    41
  {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    42
    if ( $rule == 'Code' )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    43
    {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    44
      unset($tw->rules[$i]);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    45
      return true;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    46
    }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    47
  }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    48
}
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    49
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    50
// Prevent <code> tags from being stripped or sanitized (the plugin will handle all sanitation)
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    51
$plugins->attachHook('render_sanitize_pre', 'geshi_strip_code($text, $geshi_code_blocks, $random_id);');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    52
$plugins->attachHook('render_sanitize_post', 'geshi_restore_code($text, $geshi_code_blocks, $random_id);');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    53
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    54
function geshi_strip_code(&$text, &$codeblocks, $random_id)
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    55
{
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    56
  global $geshi_supported_formats;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    57
  $codeblocks = array();
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    58
  $sf = '(' . implode('|', $geshi_supported_formats) . ')';
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    59
  preg_match_all('/<code type="?' . $sf . '"?>([\w\W]*?)<\/code>/ms', $text, $matches);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    60
  
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    61
  // for debug
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    62
  /*
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    63
  if ( strstr($text, '<code type') )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    64
    die('processing codes: <pre>' . htmlspecialchars(print_r($matches, true)) . '</pre><pre>' . htmlspecialchars($text) . '</pre>' . htmlspecialchars('/<code type="?' . $sf . '"?>([\w\W]*?)<\/code>/'));
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    65
  */
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    66
  
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    67
  foreach ( $matches[0] as $i => $match )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    68
  {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    69
    $codeblocks[$i] = array(
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    70
        'match' => $match,
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    71
        'lang' => $matches[1][$i],
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    72
        'code' => $matches[2][$i]
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    73
      );
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    74
    $text = str_replace_once($match, "{GESHI_BLOCK:$i:$random_id}", $text);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    75
  }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    76
}
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    77
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    78
function geshi_restore_code(&$text, &$codeblocks, $random_id)
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    79
{
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    80
  foreach ( $codeblocks as $i => $match )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    81
  {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    82
    $text = str_replace_once("{GESHI_BLOCK:$i:$random_id}", $match['match'], $text);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    83
  }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    84
}
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    85
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    86
// Formatter hook - where the actual highlighting is performed
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    87
$plugins->attachHook('render_wikiformat_veryearly', 'geshi_strip_code($text, $codeblocks, $random_id);');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    88
$plugins->attachHook('render_wikiformat_post', 'geshi_perform_highlight($result, $codeblocks, $random_id);');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    89
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    90
function geshi_perform_highlight(&$text, &$codeblocks, $random_id)
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    91
{
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    92
  static $did_header_tweak = false;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    93
  if ( !$did_header_tweak )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    94
  {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    95
    $did_header_tweak = true;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    96
    global $template;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    97
    $template->add_header('<style type="text/css">
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    98
      pre.geshi_highlighted {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
    99
        max-height: 1000000px !important;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   100
      }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   101
      pre.geshi_highlighted a {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   102
        background-image: none !important;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   103
        padding-right: 0 !important;
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   104
      }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   105
      </style>
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   106
      ');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   107
  }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   108
  if ( !defined('GESHI_ROOT') )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   109
    define('GESHI_ROOT', ENANO_ROOT . '/plugins/geshi/');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   110
  
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   111
  require_once ( GESHI_ROOT . '/base.php' );
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   112
  
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   113
  foreach ( $codeblocks as $i => $match )
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   114
  {
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   115
    $lang =& $match['lang'];
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   116
    $code =& $match['code'];
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   117
    
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   118
    $geshi = new GeSHi($code, $lang, null);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   119
    $geshi->set_header_type(GESHI_HEADER_PRE);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   120
    // $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   121
    $geshi->set_overall_class('geshi_highlighted');
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   122
    $parsed = $geshi->parse_code();
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   123
    
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   124
    $text = str_replace_once("{GESHI_BLOCK:$i:$random_id}", $parsed, $text);
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   125
  }
c715631f809a First working commit. Works using <code type="whatvever">...</code>. Supports all languages supported by default in GeSHi
Dan
parents: 0
diff changeset
   126
}