Plugin Directory

Changeset 600170


Ignore:
Timestamp:
09/17/2012 05:21:19 PM (14 years ago)
Author:
mattshelton
Message:

updated trunk to 0.4 based on branches/01-techmanrc

Location:
wp-markdown-syntaxhighlighter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-markdown-syntaxhighlighter/trunk/readme.txt

    r598545 r600170  
    55Requires at least: 3.1
    66Tested up to: 3.4.1
    7 Stable tag: 0.3.1
     7Stable tag: 0.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7373== Changelog ==
    7474
     75= 0.4 =
     76
     77* Switched from `preg_replace()` to `preg_replace_callback` for ()
     78* Removed some potentially harmful formatting code
     79* *Hat tip to Richard Cyrus for suggesting these changes*
     80
    7581= 0.3.1 =
    7682
  • wp-markdown-syntaxhighlighter/trunk/wp-markdown-syntaxhighlighter.php

    r598541 r600170  
    44Plugin URI: http://www.mattshelton.net
    55Description: This WordPress plugin attempts to properly tag code blocks for SyntaxHighlighter parsing
    6 Version: 0.3.1
     6Version: 0.4
    77Author: Matt Shelton
    88Author URI: http://www.mattshelton.net
     
    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.