Plugin Directory

Changeset 600150


Ignore:
Timestamp:
09/17/2012 04:55:27 PM (14 years ago)
Author:
mattshelton
Message:

first integration of some of the patch

Location:
wp-markdown-syntaxhighlighter/branches/01-techmanrc
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • wp-markdown-syntaxhighlighter/branches/01-techmanrc/wp-markdown-syntaxhighlighter.php

    r600137 r600150  
    4545
    4646function wmsh_filter_markdown( $text ) {
    47         $return = preg_replace( '|<pre><code>#!!([^\n]+)\n(.*?)</code></pre>|se', 'wmsh_add_parameters(\'$2\',\'$1\');', $text);
    48         $return = preg_replace( '|<pre><code>#!([^\n]+)\n(.*?)</code></pre>|se', 'wmsh_add_language(\'$2\',\'$1\');', $return);
    49         return $return;
     47    $return = preg_replace_callback(
     48        '|<pre><code>#!!([^\n]+)\n(.*?)</code></pre>|s',
     49        function( $m ) {
     50            return wmsh_add_parameters($m[2], $m[1]);
     51        },
     52        $text
     53    );
     54
     55    $return = preg_replace_callback(
     56        '|<pre><code>#!([^\n]+)\n(.*?)</code></pre>|s',
     57        function( $m ) {
     58            return wmsh_add_language($m[2],$m[1]);
     59        },
     60        $return
     61    );
     62       
     63    return $return;
    5064}
    5165
     
    115129*/
    116130function wmsh_add_language( $code, $language ) {
    117     if(strcasecmp($language, 'xml') == 0) {
    118         $code = stripslashes( trim( str_replace(array('&amp;', '&#039;', '&quot;'), array('&','\'','"'), $code) ) );
    119     } else {
    120         $code = stripslashes( trim( htmlspecialchars_decode( $code, ENT_NOQUOTES ) ) );
    121     }
    122131    return '<pre class="' . WMSH_BRUSH . ': '. $language . '; notranslate">' . $code . '</pre>';
    123132}
     
    143152        $class = parseParameters($params) . "notranslate";
    144153
    145         if(strcasecmp($params[WMSH_BRUSH], 'xml') == 0) {
    146             $code = stripslashes( trim( str_replace(array('&amp;', '&#039;', '&quot;'), array('&','\'','"'), $code) ) );
    147         } else {
    148             $code = stripslashes( trim( htmlspecialchars_decode( $code, ENT_NOQUOTES ) ) );
    149         }
    150154       
    151155        $output = "<pre class=\"" . $class . "\"";
Note: See TracChangeset for help on using the changeset viewer.