Make WordPress Core

Ticket #27523: 27523.3.diff

File 27523.3.diff, 12.9 KB (added by DrewAPicture, 13 years ago)

Final pass.

  • src/wp-includes/class-wp-editor.php

     
    172172                                        include(ABSPATH . 'wp-admin/includes/media.php');
    173173
    174174                                echo '<div id="wp-' . $editor_id . '-media-buttons" class="wp-media-buttons">';
    175                                 do_action('media_buttons', $editor_id);
     175
     176                                /**
     177                                 * Fires after the default media button(s) are displayed.
     178                                 *
     179                                 * @since 2.5.0
     180                                 *
     181                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     182                                 */
     183                                do_action( 'media_buttons', $editor_id );
    176184                                echo "</div>\n";
    177185                        }
    178186
    … …  
    180188                        echo "</div>\n";
    181189                }
    182190
     191                /**
     192                 * Filter the HTML markup output that displays the editor.
     193                 *
     194                 * @since 2.1.0
     195                 *
     196                 * @param string $output Editor's HTML markup.
     197                 */
    183198                $the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
    184199                        '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
    185200                        'id="' . $editor_id . '">%s</textarea></div>' );
     201
     202                /**
     203                 * Filter the default editor content.
     204                 *
     205                 * @since 2.1.0
     206                 *
     207                 * @param string $content Default editor content.
     208                 */
    186209                $content = apply_filters( 'the_editor_content', $content );
    187210
    188211                printf( $the_editor, $content );
    … …  
    220243                        if ( $set['dfw'] )
    221244                                $qtInit['buttons'] .= ',fullscreen';
    222245
    223                         $qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
     246                        /**
     247                         * Filter the Quicktags settings.
     248                         *
     249                         * @since 3.3.0
     250                         *
     251                         * @param array  $qtInit    Quicktags settings.
     252                         * @param string $editor_id The unique editor ID, e.g. 'content'.
     253                         */
     254                        $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
     255
    224256                        self::$qt_settings[$editor_id] = $qtInit;
    225257
    226258                        self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
    … …  
    237269                                }
    238270
    239271                                self::$mce_locale = $mce_locale;
     272
     273                                /** This filter is documented in wp-admin/includes/media.php */
    240274                                $no_captions = (bool) apply_filters( 'disable_captions', '' );
    241275                                $first_run = true;
    242276                                $ext_plugins = '';
    243277
    244278                                if ( $set['teeny'] ) {
     279
     280                                        /**
     281                                         * Filter the list of teenyMCE plugins.
     282                                         *
     283                                         * @since 2.7.0
     284                                         *
     285                                         * @param array  $plugins   An array of teenyMCE plugins.
     286                                         * @param string $editor_id Unique editor identifier, e.g. 'content'.
     287                                         */
    245288                                        self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
    246289                                } else {
     290
    247291                                        /**
    248                                          * TinyMCE external plugins filter
     292                                         * Filter the list of TinyMCE external plugins.
    249293                                         *
    250                                          * Takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
    251                                          * The url should be absolute and should include the js file name to be loaded.
    252                                          * Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'.
    253                                          * If the plugin adds a button, it should be added with one of the "$mce_buttons" filters.
     294                                         * The filter takes an associative array of external plugins for
     295                                         * TinyMCE in the form 'plugin_name' => 'url'.
     296                                         *
     297                                         * The url should be absolute, and should include the js filename
     298                                         * to be loaded. For example:
     299                                         * 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.
     300                                         *
     301                                         * If the external plugin adds a button, it should be added with
     302                                         * one of the 'mce_buttons' filters.
     303                                         *
     304                                         * @since 2.5.0
     305                                         *
     306                                         * @param array $external_plugins An array of external TinyMCE plugins.
    254307                                         */
    255308                                        $mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
    256309
    … …  
    275328                                        }
    276329
    277330                                        /**
    278                                          * TinyMCE default plugins filter
     331                                         * Filter the list of default TinyMCE plugins.
    279332                                         *
    280                                          * Specifies which of the default plugins that are included in WordPress should be added to
    281                                          * the TinyMCE instance.
     333                                         * The filter specifies which of the default plugins included
     334                                         * in WordPress should be added to the TinyMCE instance.
     335                                         *
     336                                         * @since 3.3.0
     337                                         *
     338                                         * @param array $plugins An array of default TinyMCE plugins.
    282339                                         */
    283340                                        $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
    284341
    … …  
    289346                                        }
    290347
    291348                                        if ( ! empty( $mce_external_plugins ) ) {
     349
    292350                                                /**
    293                                                  * This filter loads translations for external TinyMCE 3.x plugins.
     351                                                 * Filter the translations loaded for external TinyMCE 3.x plugins.
    294352                                                 *
    295                                                  * Takes an associative array 'plugin_name' => 'path', where path is the
    296                                                  * include path to the file. The language file should follow the same format as
    297                                                  * wp_mce_translation() and should define a variable $strings that
    298                                                  * holds all translated strings.
     353                                                 * The filter takes an associative array ('plugin_name' => 'path')
     354                                                 * where 'path' is the include path to the file.
     355                                                 *
     356                                                 * The language file should follow the same format as wp_mce_translation(),
     357                                                 * and should define a variable ($strings) that holds all translated strings.
     358                                                 *
     359                                                 * @since 2.5.0
     360                                                 *
     361                                                 * @param array $translations Translations for external TinyMCE plugins.
    299362                                                 */
    300363                                                $mce_external_languages = apply_filters( 'mce_external_languages', array() );
    301364
    … …  
    425488                                        }
    426489                                }
    427490
     491                                /**
     492                                 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
     493                                 *
     494                                 * @since 2.1.0
     495                                 *
     496                                 * @param array $stylesheets Comma-delimited list of stylesheets.
     497                                 */
    428498                                $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
    429499
    430500                                if ( ! empty($mce_css) )
    … …  
    432502                        }
    433503
    434504                        if ( $set['teeny'] ) {
     505
     506                                /**
     507                                 * Filter the list of teenyMCE buttons (Text tab).
     508                                 *
     509                                 * @since 2.7.0
     510                                 *
     511                                 * @param array  $buttons   An array of teenyMCE buttons.
     512                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     513                                 */
    435514                                $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
    436515                                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    437516                        } else {
    438                                 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
    439                                 $mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id);
    440                                 $mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id);
    441                                 $mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
     517
     518                                /**
     519                                 * Filter the first-row list of TinyMCE buttons (Visual tab).
     520                                 *
     521                                 * @since 2.0.0
     522                                 *
     523                                 * @param array  $buttons   First-row list of buttons.
     524                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     525                                 */
     526                                $mce_buttons = apply_filters( 'mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id );
     527
     528                                /**
     529                                 * Filter the second-row list of TinyMCE buttons (Visual tab).
     530                                 *
     531                                 * @since 2.0.0
     532                                 *
     533                                 * @param array  $buttons   Second-row list of buttons.
     534                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     535                                 */
     536                                $mce_buttons_2 = apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id );
     537
     538                                /**
     539                                 * Filter the third-row list of TinyMCE buttons (Visual tab).
     540                                 *
     541                                 * @since 2.0.0
     542                                 *
     543                                 * @param array  $buttons   Third-row list of buttons.
     544                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     545                                 */
     546                                $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
     547
     548                                /**
     549                                 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
     550                                 *
     551                                 * @since 2.5.0
     552                                 *
     553                                 * @param array  $buttons   Fourth-row list of buttons.
     554                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     555                                 */
     556                                $mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
    442557                        }
    443558
    444559                        $body_class = $editor_id;
    … …  
    489604                        if ( is_array( $set['tinymce'] ) )
    490605                                $mceInit = array_merge( $mceInit, $set['tinymce'] );
    491606
    492                         // For people who really REALLY know what they're doing with TinyMCE
    493                         // You can modify $mceInit to add, remove, change elements of the config before tinyMCE.init
    494                         // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through this filter.
    495                         // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
     607                        /*
     608                         * For people who really REALLY know what they're doing with TinyMCE
     609                         * You can modify $mceInit to add, remove, change elements of the config
     610                         * before tinyMCE.init. Setting "valid_elements", "invalid_elements"
     611                         * and "extended_valid_elements" can be done through this filter. Best
     612                         * is to use the default cleanup by not specifying valid_elements,
     613                         * as TinyMCE contains full set of XHTML 1.0.
     614                         */
    496615                        if ( $set['teeny'] ) {
     616
     617                                /**
     618                                 * Filter the teenyMCE config before init.
     619                                 *
     620                                 * @since 2.7.0
     621                                 *
     622                                 * @param array  $mceInit   An array with teenyMCE config.
     623                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     624                                 */
    497625                                $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
    498626                        } else {
     627
     628                                /**
     629                                 * Filter the TinyMCE config before init.
     630                                 *
     631                                 * @since 2.5.0
     632                                 *
     633                                 * @param array  $mceInit   An array with TinyMCE config.
     634                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     635                                 */
    499636                                $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
    500637                        }
    501638
    … …  
    827964
    828965                $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
    829966
     967                /**
     968                 * Fires immediately before the TinyMCE settings are printed.
     969                 *
     970                 * @since 3.2.0
     971                 *
     972                 * @param array $mce_settings TinyMCE settings array.
     973                 */
    830974                do_action( 'before_wp_tiny_mce', self::$mce_settings );
    831975                ?>
    832976
    … …  
    8611005                        }
    8621006                }
    8631007
    864                 // Allow scripts to be added after tinymce.js has been loaded but before any editor instances are created.
     1008                /**
     1009                 * Fires after tinymce.js is loaded, but before any TinyMCE editor
     1010                 * instances are created.
     1011                 *
     1012                 * @since 3.9.0
     1013                 *
     1014                 * @param array $mce_settings TinyMCE settings array.
     1015                 */
    8651016                do_action( 'wp_tiny_mce_init', self::$mce_settings );
    8661017
    8671018                ?>
    … …  
    9381089                if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
    9391090                        self::wp_fullscreen_html();
    9401091
     1092                /**
     1093                 * Fires after any core TinyMCE editor instances are created.
     1094                 *
     1095                 * @since 3.2.0
     1096                 *
     1097                 * @param array $mce_settings TinyMCE settings array.
     1098                 */
    9411099                do_action( 'after_wp_tiny_mce', self::$mce_settings );
    9421100        }
    9431101
    … …  
    9781136                        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
    9791137                );
    9801138
     1139                /**
     1140                 * Filter the list of TinyMCE buttons for the fullscreen
     1141                 * 'Distraction Free Writing' editor.
     1142                 *
     1143                 * @since 3.2.0
     1144                 *
     1145                 * @param array $buttons An array of TinyMCE buttons for the DFW editor.
     1146                 */
    9811147                $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
    9821148
    9831149                foreach ( $buttons as $button => $args ) {
    … …  
    10931259                 *
    10941260                 * @since 3.7.0
    10951261                 *
     1262                 * @see 'wp_link_query_args' filter
     1263                 *
    10961264                 * @param array $results {
    10971265                 *     An associative array of query results.
    10981266                 *
    10991267                 *     @type array {
    1100                  *         @type int    'ID'        The post ID.
    1101                  *         @type string 'title'     The trimmed, escaped post title.
    1102                  *         @type string 'permalink' The post permalink.
    1103                  *         @type string 'info'      A 'Y/m/d'-formatted date for 'post' post type, the 'singular_name' post type label otherwise.
     1268                 *         @type int    $ID        Post ID.
     1269                 *         @type string $title     The trimmed, escaped post title.
     1270                 *         @type string $permalink Post permalink.
     1271                 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
     1272                 *                                 the 'singular_name' post type label otherwise.
    11041273                 *     }
    11051274                 * }
    1106                  * @param array $query   An array of WP_Query arguments. @see 'wp_link_query_args' filter
     1275                 * @param array $query  An array of WP_Query arguments.
    11071276                 */
    11081277                return apply_filters( 'wp_link_query', $results, $query );
    11091278        }