Alex Gorbatchev’s Syntax Highlighter to PrismJs

Here is big help for those who are using Alex Gorbatchev's Syntax Highlighter and want to use lightweight Syntax Highlighter called prismjs for their blog or website. This code is in written in PHP and WordPress is also in PHP, so those who are using WordPress can easily use this tool. You need to find a way to loop all posts in WordPress.
prismjs


<?php
/**
* Converter for PrismJs. It converts Blog Post from Alex Syntax Highlighter to PrismJs.
*
*/
header('Content-Type: text/html; charset=utf-8');
echo "<link rel='stylesheet' id='prismCSS-css' href='http://o2.satya-weblog.com/extras/prism/prism-min.css' type='text/css' media=''/>";
echo "<script type='text/javascript' src='http://o2.satya-weblog.com/extras/prism/prism-min.js'></script>";
function pre2preAndCode($arr) {
    echo "\n - - - - \n";
    $class = explode(';', $arr[1]);
   // print_r($class);
    if (count($class) > 1) {
        foreach ($class as $cls) {
            if (strpos($cls, 'brush') !== false) {
                $class1 = $cls;
            }
        }
    }
    else {
        $class1 = $class[0];
    }
    //echo '<p>' . $class1 . '</p>';
    $class2 = explode(':', $class1);
    $classVal = isset($class2[1])?trim($class2[1]):$class2[0];
    if (strtolower($classVal) == 'html' OR strtolower($classVal) == 'xml') {
        $classVal = 'markup';
    }
    else if (strtolower($classVal) == 'js') {
        $classVal = 'javascript';
    }
    return '<pre><code class="language-'. $classVal . '">' . $arr[2] . '</code></pre>';
}
function convertContent($data) {
   $modifiedData = preg_replace_callback('@<pre [a-zA-Z"= ]{0,}class="([a-zA-Z_: ;-]{0,})"[a-zA-Z"= ]{0,}>(.*)<\/pre>@isU', 'pre2preAndCode', $data, -1, $count);
   echo "\n Count: " . $count;
   echo "\n\n";
   echo $modifiedData;
}
$str = <<<'EOD'
test 1
test 2
<pre class="php" title="code">
if (a > b) {
    echo '<b>True</b>';
}
</pre>
sdfsdf
    sdfs df
<pre class="html">
<html></html>
</pre>
sdfs
    s
    sdfasdfsdf
sdfsd
    nnnnn
    <pre>TEST Pre </pre>
    test code 333
    <pre><code class="language-markup"><i  class="fa fa-facebook-square fa-2x"></i></code></pre>
    Satya
    <pre class="brush: js">
    function foo()
    {
    }
    </pre>
More test content:
<pre class="brush: css; title: ; notranslate" title="">
#button {
	font-weight: bold;
	border: 2px solid #fff;
}
</pre>
Variation
<pre class="title: ; notranslate;brush: css;" title="">
#button {
	font-weight: bold;
	border: 2px solid #fff;
}
</pre>
EOD;
convertContent($str);

$str is sample data mentioned above for testing conversion from Alex's Syntax Highlighter to PrismJs. It only take brush value and not of gutter etc value into account.