Make WordPress Core

Ticket #27523: 27523.diff

File 27523.diff, 11.5 KB (added by DrewAPicture, 12 years ago)
  • 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                                         * Filter the list of teeny MCE plugins.
     250                                         *
     251                                         * @since 2.7.0
     252                                         *
     253                                         * @param array  $plugins   Array of TinyMCE plugins.
     254                                         * @param string $editor_id Unique editor identifier, e.g. 'content'.
     255                                         */
    214256                                        self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
    215257                                } else {
    216258                                        /**
     
    220262                                         * The url should be absolute and should include the js file name to be loaded.
    221263                                         * Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'.
    222264                                         * If the plugin adds a button, it should be added with one of the "$mce_buttons" filters.
     265                                         *
     266                                         * @since 2.5.0
     267                                         *
     268                                         * @param array $external_plugins Array of external TinyMCE plugins.
    223269                                         */
    224270                                        $mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
    225271
     
    248294                                         *
    249295                                         * Specifies which of the default plugins that are included in WordPress should be added to
    250296                                         * the TinyMCE instance.
     297                                         *
     298                                         * @since 3.3.0
     299                                         *
     300                                         * @param array $plugins List of default TinyMCE plugins.
    251301                                         */
    252302                                        $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
    253303
     
    265315                                                 * include path to the file. The language file should follow the same format as
    266316                                                 * wp_mce_translation() and should define a variable $strings that
    267317                                                 * holds all translated strings.
     318                                                 *
     319                                                 * @since 2.5.0
     320                                                 *
     321                                                 * @param array $translations Translations for external TinyMCE plugins.
    268322                                                 */
    269323                                                $mce_external_languages = apply_filters( 'mce_external_languages', array() );
    270324
     
    394448                                        }
    395449                                }
    396450
     451                                /**
     452                                 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
     453                                 *
     454                                 * @since 2.1.0
     455                                 *
     456                                 * @param array $stylesheets Comma-delimited list of stylesheets.
     457                                 */
    397458                                $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
    398459
    399460                                if ( ! empty($mce_css) )
     
    401462                        }
    402463
    403464                        if ( $set['teeny'] ) {
     465
     466                                /**
     467                                 * Filter the list of teeny TinyMCE buttons (Text tab).
     468                                 *
     469                                 * @since 2.7.0
     470                                 *
     471                                 * @param array  $buttons   Array of teeny MCE buttons.
     472                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     473                                 */
    404474                                $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 );
    405475                                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    406476                        } 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);
     477
     478                                /**
     479                                 * Filter the first-row list of TinyMCE buttons (Visual tab).
     480                                 *
     481                                 * @since 2.0.0
     482                                 *
     483                                 * @param array  $buttons   First-row list of buttons.
     484                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     485                                 */
     486                                $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 );
     487
     488                                /**
     489                                 * Filter the second-row list of TinyMCE buttons (Visual tab).
     490                                 *
     491                                 * @since 2.0.0
     492                                 *
     493                                 * @param array  $buttons   Second-row list of buttons.
     494                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     495                                 */
     496                                $mce_buttons_2 = apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id );
     497
     498                                /**
     499                                 * Filter the third-row list of TinyMCE buttons (Visual tab).
     500                                 *
     501                                 * @since 2.0.0
     502                                 *
     503                                 * @param array  $buttons   Third-row list of buttons.
     504                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     505                                 */
     506                                $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
     507
     508                                /**
     509                                 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
     510                                 *
     511                                 * @since 2.5.0
     512                                 *
     513                                 * @param array  $buttons   Fourth-row list of buttons.
     514                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     515                                 */
     516                                $mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
    411517                        }
    412518
    413519                        $body_class = $editor_id;
     
    458564                        if ( is_array( $set['tinymce'] ) )
    459565                                $mceInit = array_merge( $mceInit, $set['tinymce'] );
    460566
    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.
     567                        /*
     568                         * For people who really REALLY know what they're doing with TinyMCE
     569                         * You can modify $mceInit to add, remove, change elements of the config
     570                         * before tinyMCE.init. Setting "valid_elements", "invalid_elements"
     571                         * and "extended_valid_elements" can be done through this filter. Best
     572                         * is to use the default cleanup by not specifying valid_elements,
     573                         * as TinyMCE contains full set of XHTML 1.0.
     574                         */
    465575                        if ( $set['teeny'] ) {
     576
     577                                /**
     578                                 * Filter the teenyMCE config before init.
     579                                 *
     580                                 * @since 2.7.0
     581                                 *
     582                                 * @param array  $mceInit   Array with TinyMCE config.
     583                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     584                                 */
    466585                                $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
    467586                        } else {
     587
     588                                /**
     589                                 * Filter the TinyMCE config before init.
     590                                 *
     591                                 * @since 2.5.0
     592                                 *
     593                                 * @param array  $mceInit   Array with TinyMCE config.
     594                                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
     595                                 */
    468596                                $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
    469597                        }
    470598
     
    796924
    797925                $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
    798926
     927                /**
     928                 * Fires immediately before the TinyMCE settings are printed.
     929                 *
     930                 * @since 3.2.0
     931                 *
     932                 * @param array $mce_settings TinyMCE settings array.
     933                 */
    799934                do_action( 'before_wp_tiny_mce', self::$mce_settings );
    800935                ?>
    801936
     
    830965                        }
    831966                }
    832967
    833                 // Allow scripts to be added after tinymce.js has been loaded but before any editor instances are created.
     968                /**
     969                 * Fires after tinymce.js is loaded, but before any TinyMCE editor
     970                 * instances are created.
     971                 *
     972                 * @since 3.9.0
     973                 *
     974                 * @param array $mce_settings TinyMCE settings array.
     975                 */
    834976                do_action( 'wp_tiny_mce_init', self::$mce_settings );
    835977
    836978                ?>
     
    9071049                if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
    9081050                        self::wp_fullscreen_html();
    9091051
     1052                /**
     1053                 * Fires after any core TinyMCE editor instances are created.
     1054                 *
     1055                 * @since 3.2.0
     1056                 *
     1057                 * @param array $mce_settings TinyMCE settings array.
     1058                 */
    9101059                do_action( 'after_wp_tiny_mce', self::$mce_settings );
    9111060        }
    9121061
     
    9471096                        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
    9481097                );
    9491098
     1099                /**
     1100                 * Filter the list of TinyMCE buttons for the fullscreen
     1101                 * 'Distraction Free Writing' editor.
     1102                 *
     1103                 * @since 3.2.0
     1104                 *
     1105                 * @param array $buttons Array of TinyMCE buttons for the DFW editor.
     1106                 */
    9501107                $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
    9511108
    9521109                foreach ( $buttons as $button => $args ) {
     
    10611218                 *
    10621219                 * @since 3.7.0
    10631220                 *
     1221                 * @see 'wp_link_query_args' filter
     1222                 *
    10641223                 * @param array $results {
    10651224                 *     An associative array of query results.
    10661225                 *
    10671226                 *     @type array {
    1068                  *         @type int    'ID'        The post ID.
    1069                  *         @type string 'title'     The trimmed, escaped post title.
    1070                  *         @type string 'permalink' The post permalink.
    1071                  *         @type string 'info'      A 'Y/m/d'-formatted date for 'post' post type, the 'singular_name' post type label otherwise.
     1227                 *         @type int    $ID        Post ID.
     1228                 *         @type string $title     The trimmed, escaped post title.
     1229                 *         @type string $permalink Post permalink.
     1230                 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
     1231                 *                                 the 'singular_name' post type label otherwise.
    10721232                 *     }
    10731233                 * }
    1074                  * @param array $query   An array of WP_Query arguments. @see 'wp_link_query_args' filter
     1234                 * @param array $query   An array of WP_Query arguments.
    10751235                 */
    10761236                return apply_filters( 'wp_link_query', $results, $query );
    10771237        }