WordPress.org

Plugin Directory

Changeset 545721


Ignore:
Timestamp:
05/18/12 11:23:09 (2 years ago)
Author:
nbachiyski
Message:

Conform to the WordPress spacing standards

Location:
ice/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ice/trunk/class-ice-span-filter.php

    r545717 r545721  
    109109    static function get_css_classes( $tag ) { 
    110110        if ( preg_match( '/class\s*=\s*[\'"]([^\'"]+)[\'"]/', $tag, $matches ) ) 
    111             return preg_split( '/[ \r\n\t]+/', trim($matches[1]) ); 
     111            return preg_split( '/[ \r\n\t]+/', trim( $matches[1] ) ); 
    112112 
    113113        return array(); 
  • ice/trunk/ice.php

    r545697 r545721  
    2929 
    3030    function __construct() { 
    31         add_filter('mce_external_plugins', array( $this, 'load_plugins' ) ); 
    32         add_filter('wp_insert_post_data', array( $this, 'save_revisions_content' ), 1, 2); 
    33         add_filter('the_editor_content', array( $this, 'load_revisions_content' ) , 1 ); 
     31        add_filter( 'mce_external_plugins', array( $this, 'load_plugins' ) ); 
     32        add_filter( 'wp_insert_post_data', array( $this, 'save_revisions_content' ), 1, 2 ); 
     33        add_filter( 'the_editor_content', array( $this, 'load_revisions_content' ) , 1 ); 
    3434        add_action( 'wp_head', array( $this, 'add_preview_css' ) ); 
    3535    } 
    3636 
    3737    // Add plugins to TinyMCE 
    38     function load_plugins($plugins) { 
     38    function load_plugins( $plugins ) { 
    3939        global $current_screen; 
    4040        // Only add to the default editor (for now?), supporting this in other editor instances would require more post-processing 
     
    4242            return $plugins; 
    4343 
    44         $url = plugin_dir_url(__file__); 
     44        $url = plugin_dir_url( __FILE__ ); 
    4545 
    4646        $plugins['ice'] = $url . 'ice/editor_plugin.js'; 
     
    4848 
    4949        // Add buttons to TinyMCE 
    50         add_filter('mce_buttons', array( $this, 'add_mce_buttons' ) ); 
    51         add_filter('mce_buttons_2', array( $this, 'add_mce_buttons_2' ) ); 
     50        add_filter( 'mce_buttons', array( $this, 'add_mce_buttons' ) ); 
     51        add_filter( 'mce_buttons_2', array( $this, 'add_mce_buttons_2' ) ); 
    5252 
    5353        // And to DFW 
    54         add_filter('wp_fullscreen_buttons', array( $this, 'fullscreen_button' ) ); 
     54        add_filter( 'wp_fullscreen_buttons', array( $this, 'fullscreen_button' ) ); 
    5555 
    5656        // Add Ice specific editor settings 
    57         add_filter('tiny_mce_before_init', array( $this, 'mce_settings' ), 10, 2); 
     57        add_filter( 'tiny_mce_before_init', array( $this, 'mce_settings' ), 10, 2 ); 
    5858 
    5959        // Output the JS in the footer 
    60         add_action('admin_print_footer_scripts', array( $this, 'add_js' ) ); 
     60        add_action( 'admin_print_footer_scripts', array( $this, 'add_js' ) ); 
    6161 
    6262        return $plugins; 
    6363    } 
    6464 
    65     function add_mce_buttons($buttons) { 
     65    function add_mce_buttons( $buttons ) { 
    6666        return array_merge( $buttons, array( 
    6767            '|', 
     
    7373    } 
    7474 
    75     function add_mce_buttons_2($buttons) { 
     75    function add_mce_buttons_2( $buttons ) { 
    7676        return array_merge( $buttons, array( 
    7777            '|', 
     
    8686        ?> 
    8787        <script type="text/javascript"> 
    88         jQuery(document).ready(function($){ 
    89             if ( typeof(tinymce) != 'undefined' && $('#wp-content-wrap').hasClass('html-active') ) { 
    90                 var css = $('<style type="text/css">#wp-content-wrap #qt_content_fullscreen{display:none}</style>'); 
    91                 $(document.head).append(css); 
    92  
    93                 $('#content-tmce').one('click', function(){ 
     88        jQuery(document ).ready(function( $){ 
     89            if ( typeof(tinymce ) != 'undefined' && $( '#wp-content-wrap' ).hasClass( 'html-active' ) ) { 
     90                var css = $( '<style type="text/css">#wp-content-wrap #qt_content_fullscreen{display:none}</style>' ); 
     91                $(document.head ).append(css ); 
     92 
     93                $( '#content-tmce' ).one( 'click', function(){ 
    9494                    css.remove(); 
    9595                }); 
     
    101101 
    102102    // $settings is a PHP associative array containing all init strings: $settings['mce_setting_name'] = 'setting string'; 
    103     function mce_settings($settings, $editor_id) { 
     103    function mce_settings( $settings, $editor_id ) { 
    104104        global $current_user, $post; 
    105105 
     
    111111        /* 
    112112        Any of the following can be set by using the 'mce_ice_settings' filter. 
    113         Note that the array is json encoded before adding it to the MCE settings (default values shown). 
     113        Note that the array is json encoded before adding it to the MCE settings (default values shown ). 
    114114            'deleteTag' => 'span', ** 
    115115            'insertTag' => 'span', ** 
     
    139139        ); 
    140140 
    141         $ice_settings = apply_filters('mce_ice_settings', $ice_settings); 
     141        $ice_settings = apply_filters( 'mce_ice_settings', $ice_settings ); 
    142142        $settings['ice'] = json_encode( $ice_settings ); 
    143143 
     
    146146 
    147147    // save the content with revisions as meta 
    148     function save_revisions_content($data, $postarr) { 
    149  
    150         if ( empty($postarr['post_ID']) ) 
     148    function save_revisions_content( $data, $postarr ) { 
     149 
     150        if ( empty( $postarr['post_ID'] ) ) 
    151151            return $data; 
    152152 
    153153        // save the content in post_meta 
    154         $post_id = (int) $postarr['post_ID']; 
    155         update_post_meta($post_id, '_ice_revisions_content', $data['post_content']); 
     154        $post_id = (int)$postarr['post_ID']; 
     155        update_post_meta( $post_id, '_ice_revisions_content', $data['post_content'] ); 
    156156 
    157157        // remove the change tracking spans 
    158         $data['post_content'] = $this->strip_spans($data['post_content']); 
     158        $data['post_content'] = $this->strip_spans( $data['post_content'] ); 
    159159 
    160160        return $data; 
     
    162162 
    163163    // load the content with revisions when post is published 
    164     function load_revisions_content($content) { 
     164    function load_revisions_content( $content ) { 
    165165        global $post, $post_ID, $pagenow; 
    166166 
    167         if ( !isset($post) || !isset($post_ID) || !current_user_can('edit_post', $post_ID) ) 
     167        if ( !isset( $post ) || !isset( $post_ID ) || !current_user_can( 'edit_post', $post_ID ) ) 
    168168            return $content; 
    169169 
    170         $meta = get_post_meta($post_ID, '_ice_revisions_content'); 
    171         $content = empty($meta) ? $content : (string) array_pop($meta); 
     170        $meta = get_post_meta( $post_ID, '_ice_revisions_content' ); 
     171        $content = empty( $meta )? $content : (string)array_pop( $meta ); 
    172172 
    173173        return $content; 
     
    200200 
    201201    // show "track changes" button in fullscreen mode 
    202     function fullscreen_button($buttons) { 
     202    function fullscreen_button( $buttons ) { 
    203203        if ( !user_can_richedit() ) 
    204204            return $buttons; 
     
    206206        ?> 
    207207        <style type="text/css" scoped="scoped"> 
    208         #wp_fs_ice_toggleshowchanges span {background: url("<?php echo plugin_dir_url(__file__) . 'ice/img/ice-showchanges.png'; ?>"); 
     208        #wp_fs_ice_toggleshowchanges span {background: url("<?php echo plugin_dir_url( __FILE__ ) . 'ice/img/ice-showchanges.png'; ?>"); 
    209209        </style> 
    210210        <?php 
    211211 
    212         $buttons['ice_toggleshowchanges'] = array( 'title' => __('Show Track Changes', 'mce-revisions'), 'onclick' => "tinymce.execCommand('ice_toggleshowchanges');", 'both' => false ); 
     212        $buttons['ice_toggleshowchanges'] = array( 'title' => __( 'Show Track Changes', 'mce-revisions' ), 'onclick' => "tinymce.execCommand( 'ice_toggleshowchanges' );", 'both' => false ); 
    213213        return $buttons; 
    214214    } 
    215215 
    216216    // strip change tracking spans, expects slashed $content 
    217     function strip_spans($content) { 
     217    function strip_spans( $content ) { 
    218218        // short-circuit if no tracking spans 
    219         if ( strpos($content, 'data-userid=') === false && strpos($content, 'ice-wp-') === false ) 
     219        if ( strpos( $content, 'data-userid=' ) === false && strpos( $content, 'ice-wp-' ) === false ) 
    220220            return $content; 
    221221 
    222         $span_filter = new ICE_Span_Filter( stripslashes($content), $this->tracking_css_classes ); 
     222        $span_filter = new ICE_Span_Filter( stripslashes( $content ), $this->tracking_css_classes ); 
    223223        return addslashes( $span_filter->filter() ); 
    224224    } 
Note: See TracChangeset for help on using the changeset viewer.