<?
require('geshi/geshi.php');                                                                       
                                                                                                                       
$str = '
<html>                                                                                                                 
<head>                                                                                                                 
<style>                                                                                                                
pre {   color: #f8f8f2; background-color: #272822;font: 80% "Lucida Console", monospace;width: auto;}                  
                                                                                                                       
.kw1, .kw2, .kw3, kw4   { color: #F92672; font-weight: bold }                                                          
.st0, .st_h             { color: #E6DB74 }                                                                             
.nu0                    { color: #ae81ff }                                                                             
.br0, .sy0              { color: #999 }                                                                                
.vim .sy0               { color: #red }                                                                                
.re0, .re1, .re5        { color: #FD971F }                                                                             
.co0, .co1, .coMULTI    { color: #75715e }                                                                             
pre.ol                  { background-color: #232526;}                                                                  
pre.li                  { background-color: #272822;}                                                                  
                                                                                                                       
</style>                                                                                                               
</head>                                                                                                                
        <body>                                                                                                         
        <p>Test</p>
<code class="ruby">
#!/usr/bin/env ruby                                                                         
                                                                                                                       
require "rubygems"                                                                                                     
require "progressbar"                                                                                                  
require "net/http"                                                                                                     
                                                                                                                       
if ARGV.size < 1                                                                                                       
        puts "usage vimeo.rb <id_video>"                                                                               
        exit 1                                                                                                         
else                                                                                                                   
        id = ARGV[0]                                                                                                   
        match=1                                                                                                        
end
</code>

function replaceCode($match) {                                                                                         
        $geshi = new GeSHi($match[2], $match[1]);                                                                      
        $geshi->enable_classes();                                                                                      
        $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);                                                        
        return $geshi->parse_code();                                                                                   
}                                                                                                                      
$mod=preg_replace_callback("#<code class=\"(.*)\">(.*?)</code>#s", "replaceCode", $str);                               
print $mod;                                                                                                            
?>