Make WordPress Core

Ticket #27523: 27523.2.diff

File 27523.2.diff, 13.0 KB (added by kpdesign, 12 years ago)

Second pass

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

     
    141141                                        include(ABSPATH . 'wp-admin/includes/media.php');
    142142
    143143                                echo '<div id="wp-' . $editor_id . '-media-buttons" class="wp-media-buttons">';
    144                                 do_action('media_buttons', $editor_id);
     144
     145                                /**
     146                                 * Fires after the default media button(s) are displayed.
     147                                 *
     148                                 * @since 2.5.0
     149                                 *
     150                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     151                                 */
     152                                do_action( 'media_buttons', $editor_id );
    145153                                echo "</div>\n";
    146154                        }
    147155
     
    149157                        echo "</div>\n";
    150158                }
    151159
     160                /**
     161                 * Filter the HTML markup output that displays the editor.
     162                 *
     163                 * @since 2.1.0
     164                 *
     165                 * @param string $output Editor's HTML markup.
     166                 */
    152167                $the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
    153168                        '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
    154169                        'id="' . $editor_id . '">%s</textarea></div>' );
     170
     171                /**
     172                 * Filter the default editor content.
     173                 *
     174                 * @since 2.1.0
     175                 *
     176                 * @param string $content Default editor content.
     177                 */
    155178                $content = apply_filters( 'the_editor_content', $content );
    156179
    157180                printf( $the_editor, $content );
     
    189212                        if ( $set['dfw'] )
    190213                                $qtInit['buttons'] .= ',fullscreen';
    191214
    192                         $qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
     215                        /**
     216                         * Filter the quicktags settings.
     217                         *
     218                         * @since 3.3.0
     219                         *
     220                         * @param array  $qtInit    Quicktags settings.
     221                         * @param string $editor_id The unique editor identifier, e.g. 'content'.
     222                         */
     223                        $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
     224
    193225                        self::$qt_settings[$editor_id] = $qtInit;
    194226
    195227                        self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
     
    206238                                }
    207239
    208240                                self::$mce_locale = $mce_locale;
     241
     242                                /** This filter is documented in wp-admin/includes/media.php */
    209243                                $no_captions = (bool) apply_filters( 'disable_captions', '' );
    210244                                $first_run = true;
    211245                                $ext_plugins = '';
    212246
    213247                                if ( $set['teeny'] ) {
     248
     249                                        /**
     250                                         * Filter the list of teenyMCE plugins.
     251                                         *
     252                                         * @since 2.7.0
     253                                         *
     254                                         * @param array  $plugins   An array of teenyMCE plugins.
     255                                         * @param string $editor_id Unique editor identifier, e.g. 'content'.
     256                                         */
    214257                                        self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
    215258                                } else {
     259
    216260                                        /**
    217                                          * TinyMCE external plugins filter
     261                                         * Filter the list of TinyMCE external plugins.
    218262                                         *
    219                                          * Takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
    220                                          * The url should be absolute and should include the js file name to be loaded.
    221                                          * Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'.
    222                                          * If the plugin adds a button, it should be added with one of the "$mce_buttons" filters.
     263                                         * The filter takes an associative array of external plugins for
     264                                         * TinyMCE in the form 'plugin_name' => 'url'.
     265                                         *
     266                                         * The url should be absolute, and should include the js filename
     267                                         * to be loaded. For example:
     268                                         * 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.
     269                                         *
     270                                         * If the external plugin adds a button, it should be added with
     271                                         * one of the 'mce_buttons' filters.
     272                                         *
     273                                         * @since 2.5.0
     274                                         *
     275                                         * @param array $external_plugins An array of external TinyMCE plugins.
    223276                                         */
    224277                                        $mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
    225278
     
    244297                                        }
    245298
    246299                                        /**
    247                                          * TinyMCE default plugins filter
     300                                         * Filter the list of default TinyMCE plugins.
    248301                                         *
    249                                          * Specifies which of the default plugins that are included in WordPress should be added to
    250                                          * the TinyMCE instance.
     302                                         * The filter specifies which of the default plugins included
     303                                         * in WordPress should be added to the TinyMCE instance.
     304                                         *
     305                                         * @since 3.3.0
     306                                         *
     307                                         * @param array $plugins An array of default TinyMCE plugins.
    251308                                         */
    252309                                        $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
    253310
     
    258315                                        }
    259316
    260317                                        if ( ! empty( $mce_external_plugins ) ) {
     318
    261319                                                /**
    262                                                  * This filter loads translations for external TinyMCE 3.x plugins.
     320                                                 * Filter the translations loaded for external TinyMCE 3.x plugins.
    263321                                                 *
    264                                                  * Takes an associative array 'plugin_name' => 'path', where path is the
    265                                                  * include path to the file. The language file should follow the same format as
    266                                                  * wp_mce_translation() and should define a variable $strings that
    267                                                  * holds all translated strings.
     322                                                 * The filter takes an associative array ('plugin_name' => 'path')
     323                                                 * where 'path' is the include path to the file.
     324                                                 *
     325                                                 * The language file should follow the same format as wp_mce_translation(),
     326                                                 * and should define a variable ($strings) that holds all translated strings.
     327                                                 *
     328                                                 * @since 2.5.0
     329                                                 *
     330                                                 * @param array $translations Translations for external TinyMCE plugins.
    268331                                                 */
    269332                                                $mce_external_languages = apply_filters( 'mce_external_languages', array() );
    270333
     
    394457                                        }
    395458                                }
    396459
     460                                /**
     461                                 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
     462                                 *
     463                                 * @since 2.1.0
     464                                 *
     465                                 * @param array $stylesheets Comma-delimited list of stylesheets.
     466                                 */
    397467                                $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
    398468
    399469                                if ( ! empty($mce_css) )
     
    401471                        }
    402472
    403473                        if ( $set['teeny'] ) {
     474
     475                                /**
     476                                 * Filter the list of teenyMCE buttons (Text tab).
     477                                 *
     478                                 * @since 2.7.0
     479                                 *
     480                                 * @param array  $buttons   An array of teenyMCE buttons.
     481                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     482                                 */
    404483                                $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 );
    405484                                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    406485                        } else {
    407                                 $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);
    408                                 $mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id);
    409                                 $mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id);
    410                                 $mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
     486
     487                                /**
     488                                 * Filter the first-row list of TinyMCE buttons (Visual tab).
     489                                 *
     490                                 * @since 2.0.0
     491                                 *
     492                                 * @param array  $buttons   First-row list of buttons.
     493                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     494                                 */
     495                                $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 );
     496
     497                                /**
     498                                 * Filter the second-row list of TinyMCE buttons (Visual tab).
     499                                 *
     500                                 * @since 2.0.0
     501                                 *
     502                                 * @param array  $buttons   Second-row list of buttons.
     503                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     504                                 */
     505                                $mce_buttons_2 = apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id );
     506
     507                                /**
     508                                 * Filter the third-row list of TinyMCE buttons (Visual tab).
     509                                 *
     510                                 * @since 2.0.0
     511                                 *
     512                                 * @param array  $buttons   Third-row list of buttons.
     513                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     514                                 */
     515                                $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
     516
     517                                /**
     518                                 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
     519                                 *
     520                                 * @since 2.5.0
     521                                 *
     522                                 * @param array  $buttons   Fourth-row list of buttons.
     523                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     524                                 */
     525                                $mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
    411526                        }
    412527
    413528                        $body_class = $editor_id;
     
    458573                        if ( is_array( $set['tinymce'] ) )
    459574                                $mceInit = array_merge( $mceInit, $set['tinymce'] );
    460575
    461                         // For people who really REALLY know what they're doing with TinyMCE
    462                         // You can modify $mceInit to add, remove, change elements of the config before tinyMCE.init
    463                         // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through this filter.
    464                         // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
     576                        /*
     577                         * For people who really REALLY know what they're doing with TinyMCE
     578                         * You can modify $mceInit to add, remove, change elements of the config
     579                         * before tinyMCE.init. Setting "valid_elements", "invalid_elements"
     580                         * and "extended_valid_elements" can be done through this filter. Best
     581                         * is to use the default cleanup by not specifying valid_elements,
     582                         * as TinyMCE contains full set of XHTML 1.0.
     583                         */
    465584                        if ( $set['teeny'] ) {
     585
     586                                /**
     587                                 * Filter the teenyMCE config before init.
     588                                 *
     589                                 * @since 2.7.0
     590                                 *
     591                                 * @param array  $mceInit   An array with teenyMCE config.
     592                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     593                                 */
    466594                                $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
    467595                        } else {
     596
     597                                /**
     598                                 * Filter the TinyMCE config before init.
     599                                 *
     600                                 * @since 2.5.0
     601                                 *
     602                                 * @param array  $mceInit   An array with TinyMCE config.
     603                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     604                                 */
    468605                                $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
    469606                        }
    470607
     
    796933
    797934                $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
    798935
     936                /**
     937                 * Fires immediately before the TinyMCE settings are printed.
     938                 *
     939                 * @since 3.2.0
     940                 *
     941                 * @param array $mce_settings TinyMCE settings array.
     942                 */
    799943                do_action( 'before_wp_tiny_mce', self::$mce_settings );
    800944                ?>
    801945
     
    830974                        }
    831975                }
    832976
    833                 // Allow scripts to be added after tinymce.js has been loaded but before any editor instances are created.
     977                /**
     978                 * Fires after tinymce.js is loaded, but before any TinyMCE editor
     979                 * instances are created.
     980                 *
     981                 * @since 3.9.0
     982                 *
     983                 * @param array $mce_settings TinyMCE settings array.
     984                 */
    834985                do_action( 'wp_tiny_mce_init', self::$mce_settings );
    835986
    836987                ?>
     
    9071058                if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
    9081059                        self::wp_fullscreen_html();
    9091060
     1061                /**
     1062                 * Fires after any core TinyMCE editor instances are created.
     1063                 *
     1064                 * @since 3.2.0
     1065                 *
     1066                 * @param array $mce_settings TinyMCE settings array.
     1067                 */
    9101068                do_action( 'after_wp_tiny_mce', self::$mce_settings );
    9111069        }
    9121070
     
    9471105                        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
    9481106                );
    9491107
     1108                /**
     1109                 * Filter the list of TinyMCE buttons for the fullscreen
     1110                 * 'Distraction Free Writing' editor.
     1111                 *
     1112                 * @since 3.2.0
     1113                 *
     1114                 * @param array $buttons An array of TinyMCE buttons for the DFW editor.
     1115                 */
    9501116                $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
    9511117
    9521118                foreach ( $buttons as $button => $args ) {
     
    10621228                 *
    10631229                 * @since 3.7.0
    10641230                 *
     1231                 * @see 'wp_link_query_args' filter
     1232                 *
    10651233                 * @param array $results {
    10661234                 *     An associative array of query results.
    10671235                 *
    10681236                 *     @type array {
    1069                  *         @type int    'ID'        The post ID.
    1070                  *         @type string 'title'     The trimmed, escaped post title.
    1071                  *         @type string 'permalink' The post permalink.
    1072                  *         @type string 'info'      A 'Y/m/d'-formatted date for 'post' post type, the 'singular_name' post type label otherwise.
     1237                 *         @type int    $ID        Post ID.
     1238                 *         @type string $title     The trimmed, escaped post title.
     1239                 *         @type string $permalink Post permalink.
     1240                 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
     1241                 *                                 the 'singular_name' post type label otherwise.
    10731242                 *     }
    10741243                 * }
    1075                  * @param array $query   An array of WP_Query arguments. @see 'wp_link_query_args' filter
     1244                 * @param array $query  An array of WP_Query arguments.
    10761245                 */
    10771246                return apply_filters( 'wp_link_query', $results, $query );
    10781247        }