WordPress.org

Plugin Directory

Changeset 672129 for syntaxhighlighter


Ignore:
Timestamp:
02/23/13 09:12:31 (14 months ago)
Author:
Viper007Bond
Message:

Version 3.1.4

Location:
syntaxhighlighter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • syntaxhighlighter/trunk/readme.txt

    r464389 r672129  
    44Tags: code, sourcecode, php, xhtml, html, css, WordPress.com 
    55Requires at least: 2.7 
    6 Tested up to: 3.3 
     6Tested up to: 3.6 
    77Stable tag: trunk 
    88 
     
    5555 
    5656== ChangeLog == 
     57 
     58= Version 3.1.4 = 
     59 
     60* WordPress 3.6 (alpha) compatibility. Content is now being stripped of slashes before being run through filters so this plugin needs to stop trying to strip slashes and then adding them back. See [ticket #21767](http://core.trac.wordpress.org/ticket/21767). 
    5761 
    5862= Version 3.1.3 = 
  • syntaxhighlighter/trunk/syntaxhighlighter.php

    r399621 r672129  
    55Plugin Name:  SyntaxHighlighter Evolved 
    66Plugin URI:   http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/ 
    7 Version:      3.1.3 
     7Version:      3.1.4 
    88Description:  Easily post syntax-highlighted code to your site without having to modify the code at all. Uses Alex Gorbatchev's <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter">SyntaxHighlighter</a>. <strong>TIP:</strong> Don't use the Visual editor if you don't want your code mangled. TinyMCE will "clean up" your HTML. 
    99Author:       Viper007Bond 
     
    2222class SyntaxHighlighter { 
    2323    // All of these variables are private. Filters are provided for things that can be modified. 
    24     var $pluginver            = '3.1.3';  // Plugin version 
     24    var $pluginver            = '3.1.4';  // Plugin version 
    2525    var $agshver              = false;    // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3) 
    2626    var $shfolder             = false;    // Controls what subfolder to load SyntaxHighlighter from (v2 or v3) 
     
    3737    // Initalize the plugin by registering the hooks 
    3838    function __construct() { 
     39        global $wp_version; 
     40 
    3941        if ( ! function_exists( 'esc_html' ) ) 
    4042            return; 
     
    4951 
    5052        // Into the database 
    51         add_filter( 'content_save_pre',                   array( &$this, 'encode_shortcode_contents_slashed_noquickedit' ), 1 ); // Posts 
    52         add_filter( 'pre_comment_content',                array( &$this, 'encode_shortcode_contents_slashed' ),             1 ); // Comments 
     53        if ( version_compare( $wp_version, '3.5.99999', '>' ) ) { // 3.6+ for http://core.trac.wordpress.org/ticket/21767 
     54            add_filter( 'content_save_pre',               array( &$this, 'encode_shortcode_contents_noquickedit' ),         1 ); // Posts 
     55            add_filter( 'pre_comment_content',            array( &$this, 'encode_shortcode_contents' ),                     1 ); // Comments 
     56        } else { 
     57            add_filter( 'content_save_pre',               array( &$this, 'encode_shortcode_contents_slashed_noquickedit' ), 1 ); // Posts 
     58            add_filter( 'pre_comment_content',            array( &$this, 'encode_shortcode_contents_slashed' ),             1 ); // Comments 
     59        } 
    5360        add_filter( 'group_forum_post_text_before_save',  array( &$this, 'encode_shortcode_contents_slashed' ),             1 ); // BuddyPress 
    5461        add_filter( 'group_forum_topic_text_before_save', array( &$this, 'encode_shortcode_contents_slashed' ),             1 ); // BuddyPress 
     
    401408 
    402409    // HTML entity encode the contents of shortcodes. Expects slashed content. Aborts if AJAX. 
    403     function encode_shortcode_contents_slashed_noquickedit( $content ) { 
     410    function encode_shortcode_contents_noquickedit( $content ) { 
    404411 
    405412        // In certain weird circumstances, the content gets run through "content_save_pre" twice 
     
    411418 
    412419        // Post quick edits aren't decoded for display, so we don't need to encode them (again) 
    413         if ( !empty($_POST) && !empty($_POST['action']) && 'inline-save' == $_POST['action'] ) 
     420        if ( ! empty( $_POST ) && !empty( $_POST['action'] ) && 'inline-save' == $_POST['action'] ) 
     421            return $content; 
     422 
     423        return $this->encode_shortcode_contents( $content ); 
     424    } 
     425 
     426 
     427    // HTML entity encode the contents of shortcodes. Expects slashed content. Aborts if AJAX. 
     428    function encode_shortcode_contents_slashed_noquickedit( $content ) { 
     429 
     430        // In certain weird circumstances, the content gets run through "content_save_pre" twice 
     431        // Keep track and don't allow this filter to be run twice 
     432        // I couldn't easily figure out why this happens and didn't bother looking into it further as this works fine 
     433        if ( true == $this->content_save_pre_ran ) 
     434            return $content; 
     435        $this->content_save_pre_ran = true; 
     436 
     437        // Post quick edits aren't decoded for display, so we don't need to encode them (again) 
     438        if ( ! empty( $_POST ) && !empty( $_POST['action'] ) && 'inline-save' == $_POST['action'] ) 
    414439            return $content; 
    415440 
Note: See TracChangeset for help on using the changeset viewer.