Make WordPress Core


Ignore:
Timestamp:
11/05/2011 04:00:38 PM (13 years ago)
Author:
azaozz
Message:

Improve handling of init and adding buttons to Quicktags, fixes #19098

File:
1 edited

Legend:

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

    r19126 r19172  
    140140
    141141        if ( $this->this_quicktags ) {
    142             $qt_buttons = array();
    143142
    144143            $qtInit = array(
    145144                'id' => $editor_id,
    146                 'buttons' => '',
    147                 'disabled_buttons' => ''
     145                'buttons' => ''
    148146            );
    149147
     
    151149                $qtInit = array_merge($qtInit, $set['quicktags']);
    152150
    153             $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
    154 
     151            if ( empty($qtInit['buttons']) )
     152                $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
     153
     154            if ( $set['dfw'] )
     155                $qtInit['buttons'] .= ',fullscreen';
     156
     157            $qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
    155158            $this->qt_settings[$editor_id] = $qtInit;
    156159
    157             if ( !empty($qtInit['buttons']) || !empty($qtInit['disabled_buttons']) ) {
    158                 if ( strpos( ',' . $qtInit['buttons'] . ',', ',link,' ) !== false )
    159                     $qt_buttons[] = 'link';
    160 
    161                 if ( strpos( ',' . $qtInit['disabled_buttons'] . ',', ',link,' ) !== false )
    162                     $qt_buttons = array();
    163             } else {
    164                 $qt_buttons[] = 'link';
    165             }
    166 
    167             if ( $set['dfw'] )
    168                 $qt_buttons[] = 'fullscreen';
    169 
    170             $this->qt_buttons = array_merge( $this->qt_buttons, $qt_buttons );
     160            $this->qt_buttons = array_merge( $this->qt_buttons, explode(',', $qtInit['buttons']) );
    171161        }
    172162
Note: See TracChangeset for help on using the changeset viewer.