Make WordPress Core

Ticket #21976: 21976-2.patch

File 21976-2.patch, 14.5 KB (added by azaozz, 13 years ago)
  • wp-includes/class-wp-editor.php

     
    167167                                self::$baseurl = includes_url('js/tinymce');
    168168                                self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
    169169                                $no_captions = (bool) apply_filters( 'disable_captions', '' );
    170                                 $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
    171170                                $first_run = true;
    172171                                $ext_plugins = '';
     172                                $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
    173173
     174                                if ( $set['dfw'] )
     175                                        $plugins[] = 'wpfullscreen';
     176
    174177                                if ( $set['teeny'] ) {
    175178                                        self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs'), $editor_id );
    176179                                } else {
     
    254257                                        $plugins = array_unique( apply_filters('tiny_mce_plugins', $plugins) );
    255258                                }
    256259
    257                                 if ( $set['dfw'] )
    258                                         $plugins[] = 'wpfullscreen';
    259 
    260260                                self::$plugins = $plugins;
    261261                                self::$ext_plugins = $ext_plugins;
    262262
     
    362362                                $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'separator', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
    363363                                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    364364                        } else {
    365                                 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
     365                                $mce_buttons = array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'wp_adv' );
     366
     367                                if ( $set['dfw'] )
     368                                        array_splice($mce_buttons, -1, 0, 'wp_fullscreen');
     369
     370                                $mce_buttons = apply_filters('mce_buttons', $mce_buttons, $editor_id);
    366371                                $mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ), $editor_id);
    367372                                $mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id);
    368373                                $mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
     
    378383                                unset($set['tinymce']['body_class']);
    379384                        }
    380385
    381                         if ( $set['dfw'] ) {
    382                                 // replace the first 'fullscreen' with 'wp_fullscreen'
    383                                 if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )
    384                                         $mce_buttons[$key] = 'wp_fullscreen';
    385                                 elseif ( ($key = array_search('fullscreen', $mce_buttons_2)) !== false )
    386                                         $mce_buttons_2[$key] = 'wp_fullscreen';
    387                                 elseif ( ($key = array_search('fullscreen', $mce_buttons_3)) !== false )
    388                                         $mce_buttons_3[$key] = 'wp_fullscreen';
    389                                 elseif ( ($key = array_search('fullscreen', $mce_buttons_4)) !== false )
    390                                         $mce_buttons_4[$key] = 'wp_fullscreen';
    391                         }
    392 
    393386                        $mceInit = array (
    394387                                'elements' => $editor_id,
    395388                                'wpautop' => (bool) $set['wpautop'],
  • wp-includes/js/tinymce/langs/wp-langs-en.js

     
    170170unload_msg:"The changes you made will be lost if you navigate away from this page."
    171171},
    172172fullscreen:{
    173 desc:"Toggle fullscreen mode (Alt + Shift + G)"
     173desc:"Toggle fullscreen mode"
    174174},
    175175media:{
    176176desc:"Insert / edit embedded media",
  • wp-includes/js/tinymce/langs/wp-langs.php

     
    207207                ),
    208208
    209209                'fullscreen' => array(
    210                         'desc' => __('Toggle fullscreen mode (Alt + Shift + G)')
     210                        'desc' => __('Toggle fullscreen mode')
    211211                ),
    212212
    213213                'media' => array(
  • wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js

     
    272272                        ed.addShortcut(mod_key + '+p', 'wordpress.wp_page_desc', 'WP_Page');
    273273                        ed.addShortcut('ctrl+s', 'save_desc', function(){if('function'==typeof autosave)autosave();});
    274274
    275                         if ( /\bwpfullscreen\b/.test(ed.settings.plugins) )
     275                        if ( /\bwpfullscreen\b/.test(ed.settings.plugins) && ed.id != 'mce_fullscreen' )
    276276                                ed.addShortcut(mod_key + '+w', 'wordpress.wp_fullscreen_desc', 'wpFullScreen');
    277                         else if ( /\bfullscreen\b/.test(ed.settings.plugins) )
    278                                 ed.addShortcut(mod_key + '+g', 'fullscreen.desc', 'mceFullScreen');
    279277
    280278                        // popup buttons for images and the gallery
    281279                        ed.onInit.add(function(ed) {
  • wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js

     
    9494                        });
    9595
    9696                        ed.addCommand('wpFullScreen', function() {
    97                                 if ( typeof(fullscreen) == 'undefined' )
     97                                if ( typeof(fullscreen) == 'undefined' || tinymce.get('mce_fullscreen') ) // don't open DFW if TinyMCE's fullscreen is currently open
    9898                                        return;
    9999
    100100                                if ( 'wp_mce_fullscreen' == ed.id )
  • wp-includes/js/tinymce/wp-mce-help.php

     
    88/** @ignore */
    99require_once('../../../wp-load.php');
    1010header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
     11
     12$default_modkey = _x('Ctrl', 'PC/Windows modifier key');
     13$custom_modkey = _x('Alt + Shift', 'PC/Windows modifier keys');
     14$dfw_modkey = _x('Alt', 'PC/Windows modifier key');
     15
     16if ( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac OS') !== false ) {
     17        $default_modkey = _x('Command', 'Macintosh modifier key');
     18        $custom_modkey = _x('Option + Shift', 'Macintosh modifier keys');
     19        $dfw_modkey = _x('Control', 'Macintosh modifier key');
     20}
     21
    1122?>
    1223<!DOCTYPE html>
    1324<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
     
    90101        #flipper div p {
    91102                margin-top: 0.4em;
    92103                margin-bottom: 0.8em;
    93                 text-align: justify;
    94104        }
    95105        th {
    96106                text-align: center;
     
    171181        <h2><?php _e('Rich Editing Basics'); ?></h2>
    172182        <p><?php _e('<em>Rich editing</em>, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear approximately as they will on the internet.'); ?></p>
    173183        <p><?php _e('WordPress includes a rich HTML editor that works well in all major web browsers used today. However editing HTML is not the same as typing text. Each web page has two major components: the structure, which is the actual HTML code and is produced by the editor as you type, and the display, that is applied to it by the currently selected WordPress theme and is defined in style.css. WordPress is producing valid XHTML 1.0 which means that inserting multiple line breaks (BR tags) after a paragraph would not produce white space on the web page. The BR tags will be removed as invalid by the internal HTML correcting functions.'); ?></p>
    174         <p><?php _e('While using the editor, most basic keyboard shortcuts work like in any other text editor. For example: Shift+Enter inserts line break, Ctrl+C = copy, Ctrl+X = cut, Ctrl+Z = undo, Ctrl+Y = redo, Ctrl+A = select all, etc. (on Mac use the Command key instead of Ctrl). See the Hotkeys tab for all available keyboard shortcuts.'); ?></p>
     184        <p><?php printf( __('While using the editor, most basic keyboard shortcuts work like in any other text editor. For example: Shift + Enter inserts line break, %1$s + C = copy, %1$s + X = cut, %1$s + Z = undo, %1$s + Y = redo, %1$s + A = select all, etc. See the Hotkeys tab for all available keyboard shortcuts.'), $default_modkey ); ?></p>
    175185    <p><?php _e('If you do not like the way the rich editor works, you may turn it off from Your Profile submenu, under Users in the admin menu.'); ?></p>
    176186</div>
    177187
     
    189199
    190200<div id="content3" class="hidden">
    191201        <h2><?php _e('Writing at Full Speed'); ?></h2>
    192     <p><?php _e('Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Ctrl + letter. Macintosh uses Command + letter.'); ?></p>
     202        <p><?php printf( __('Rather than reaching for your mouse to click on the toolbar, use the access keys: %s + Letter.'), $default_modkey ); ?></p>
    193203
    194204        <table class="keys">
    195                 <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
    196                 <tr><th>c</th><td><?php _e('Copy'); ?></td><th>v</th><td><?php _e('Paste'); ?></td></tr>
    197                 <tr><th>a</th><td><?php _e('Select all'); ?></td><th>x</th><td><?php _e('Cut'); ?></td></tr>
    198                 <tr><th>z</th><td><?php _e('Undo'); ?></td><th>y</th><td><?php _e('Redo'); ?></td></tr>
     205        <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
     206        <?php
    199207
    200                 <tr><th>b</th><td><?php _e('Bold'); ?></td><th>i</th><td><?php _e('Italic'); ?></td></tr>
    201                 <tr><th>u</th><td><?php _e('Underline'); ?></td><th>1</th><td><?php _e('Heading 1'); ?></td></tr>
    202                 <tr><th>2</th><td><?php _e('Heading 2'); ?></td><th>3</th><td><?php _e('Heading 3'); ?></td></tr>
    203                 <tr><th>4</th><td><?php _e('Heading 4'); ?></td><th>5</th><td><?php _e('Heading 5'); ?></td></tr>
    204                 <tr><th>6</th><td><?php _e('Heading 6'); ?></td><th>9</th><td><?php _e('Address'); ?></td></tr>
     208        $default_shortcuts = array(
     209                'c' =>  __('Copy'),
     210                'v' => __('Paste'),
     211                'a' => __('Select all'),
     212                'x' => __('Cut'),
     213                'z' => __('Undo'),
     214                'y' => __('Redo'),
     215                'b' => __('Bold'),
     216                'i' => __('Italic'),
     217                'u' => __('Underline'),
     218                '1' => __('Heading 1'),
     219                '2' => __('Heading 2'),
     220                '3' => __('Heading 3'),
     221                '4' => __('Heading 4'),
     222                '5' => __('Heading 5'),
     223                '6' => __('Heading 6'),
     224                '9' => __('Address'),
     225        );
     226
     227        $i = 0;
     228        $cols = 2;
     229        foreach ( $default_shortcuts as $letter => $desc ) {
     230                if ( $i % $cols === 0 )
     231                        echo '<tr>';
     232
     233                ++$i;
     234                echo "<th>$letter</th><td>$desc</td>";
     235
     236                if ( $i % $cols === 0 )
     237                        echo "</tr>\n";
     238        }
     239
     240        if ( $i % $cols !== 0 )
     241                echo "<th></th><td></td></tr>\n";
     242
     243        ?>
    205244        </table>
    206245
    207         <p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.'); ?></p>
     246        <p><?php printf( __('The following shortcuts use different access keys: %s + Letter.'), $custom_modkey ); ?></p>
    208247        <table class="keys">
    209                 <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
    210                 <tr><th>n</th><td><?php _e('Check Spelling'); ?></td><th>l</th><td><?php _e('Align Left'); ?></td></tr>
    211                 <tr><th>j</th><td><?php _e('Justify Text'); ?></td><th>c</th><td><?php _e('Align Center'); ?></td></tr>
    212                 <tr><th>d</th><td><span style="text-decoration: line-through;"><?php _e('Strikethrough'); ?></span></td><th>r</th><td><?php _e('Align Right'); ?></td></tr>
    213                 <tr><th>u</th><td><strong>&bull;</strong> <?php _e('List'); ?></td><th>a</th><td><?php _e('Insert link'); ?></td></tr>
    214                 <tr><th>o</th><td>1. <?php _e('List'); ?></td><th>s</th><td><?php _e('Remove link'); ?></td></tr>
    215                 <tr><th>q</th><td><?php _e('Quote'); ?></td><th>m</th><td><?php _e('Insert Image'); ?></td></tr>
    216                 <tr><th>g</th><td><?php _e('Full Screen'); ?></td><th>t</th><td><?php _e('Insert More Tag'); ?></td></tr>
    217                 <tr><th>p</th><td><?php _e('Insert Page Break tag'); ?></td><th>h</th><td><?php _e('Help'); ?></td></tr>
    218                 <tr><th>w</th><td colspan="3"><?php _e('Distraction Free Writing mode'); ?></td></tr>
     248        <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
     249        <?php
     250
     251        $custom_shortcuts = array(
     252                'n' => __('Check Spelling'),
     253                'l' => __('Align Left'),
     254                'c' => __('Align Center'),
     255                'r' => __('Align Right'),
     256                'j' => __('Justify'),
     257                'd' => __('Strikethrough'),
     258                'u' => __('Unordered List'),
     259                'a' => __('Insert link'),
     260                'o' => __('Ordered List'),
     261                's' => __('Remove link'),
     262                'q' => __('Quote'),
     263                'm' => __('Insert Image'),
     264                't' => __('Insert More Tag'),
     265                'p' => __('Insert Page Break tag'),
     266                'h' => __('Help'),
     267                'w' => __('Distraction Free Writing mode'),
     268        );
     269
     270        $i = 0;
     271        $cols = 2;
     272        foreach ( $custom_shortcuts as $letter => $desc ) {
     273                if ( $i % $cols === 0 )
     274                        echo '<tr>';
     275
     276                ++$i;
     277                echo "<th>$letter</th><td>$desc</td>";
     278
     279                if ( $i % $cols === 0 )
     280                        echo "</tr>\n";
     281        }
     282
     283        if ( $i % $cols !== 0 )
     284                echo "<th></th><td></td></tr>\n";
     285
     286        ?>
    219287        </table>
    220288
    221         <p style="padding: 15px 10px 10px;"><?php _e('Editor width in Distraction Free Writing mode:'); ?></p>
     289        <p><?php _e('Editor width in Distraction Free Writing mode:'); ?></p>
    222290        <table class="keys">
    223                 <tr><th><span class="win">Alt +</span><span class="mac">Ctrl +</span></th><td><?php _e('Wider'); ?></td>
    224                         <th><span class="win">Alt -</span><span class="mac">Ctrl -</span></th><td><?php _e('Narrower'); ?></td></tr>
    225                 <tr><th><span class="win">Alt 0</span><span class="mac">Ctrl 0</span></th><td><?php _e('Default width'); ?></td><th></th><td></td></tr>
     291                <tr><th><?php echo $dfw_modkey; ?> +</th><td><?php _e('Wider'); ?></td><th><?php echo $dfw_modkey; ?> &ndash;</th><td><?php _e('Narrower'); ?></td></tr>
     292                <tr><th><?php echo $dfw_modkey; ?> 0</th><td><?php _e('Default width'); ?></td><th></th><td></td></tr>
    226293        </table>
    227294</div>
    228295