WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/18/2011 07:08:55 AM (10 years ago)
Author:
azaozz
Message:

Add some more documentation and prevent fatal error if a plugin tries to use 'dfw' second time, see #17144

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-editor.php

    r18828 r18988  
    55 * @package WordPress
    66 * @since 3.3
     7 *
     8 * NOTE: Do not instantiate this class directly. Please use the wp_editor() function that will include the file
     9 * and instantiate the class if needed. If you want to extend this class use the 'init' or earlier action to do it
     10 * and call wp_editor() as usual when you need to output the HTML.
    711 *
    812 * Outputs the HTML and JavaScript for the WordPress editors, TinyMCE and Quicktags.
     
    366370
    367371            if ( $set['dfw'] ) {
    368                 function replace_fullscreen(&$val) {
    369                     if ( $val == 'fullscreen' )
    370                         $val = 'wp_fullscreen';
    371                 }
    372 
    373                 array_walk($mce_buttons, 'replace_fullscreen');
    374                 array_walk($mce_buttons_2, 'replace_fullscreen');
    375                 array_walk($mce_buttons_3, 'replace_fullscreen');
    376                 array_walk($mce_buttons_4, 'replace_fullscreen');
     372                // replace the first 'fullscreen' with 'wp_fullscreen'
     373                if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )
     374                    $mce_buttons[$key] = 'wp_fullscreen';
     375                elseif ( ($key = array_search('fullscreen', $mce_buttons_2)) !== false )
     376                    $mce_buttons_2[$key] = 'wp_fullscreen';
     377                elseif ( ($key = array_search('fullscreen', $mce_buttons_3)) !== false )
     378                    $mce_buttons_3[$key] = 'wp_fullscreen';
     379                elseif ( ($key = array_search('fullscreen', $mce_buttons_4)) !== false )
     380                    $mce_buttons_4[$key] = 'wp_fullscreen';
    377381            }
    378382
Note: See TracChangeset for help on using the changeset viewer.