Ticket #27523: 27523.diff
| File 27523.diff, 11.5 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/class-wp-editor.php
141 141 include(ABSPATH . 'wp-admin/includes/media.php'); 142 142 143 143 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 ); 145 153 echo "</div>\n"; 146 154 } 147 155 … … 149 157 echo "</div>\n"; 150 158 } 151 159 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 */ 152 167 $the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' . 153 168 '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' . 154 169 '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 */ 155 178 $content = apply_filters( 'the_editor_content', $content ); 156 179 157 180 printf( $the_editor, $content ); … … 189 212 if ( $set['dfw'] ) 190 213 $qtInit['buttons'] .= ',fullscreen'; 191 214 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 193 225 self::$qt_settings[$editor_id] = $qtInit; 194 226 195 227 self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) ); … … 206 238 } 207 239 208 240 self::$mce_locale = $mce_locale; 241 242 /** This filter is documented in wp-admin/includes/media.php */ 209 243 $no_captions = (bool) apply_filters( 'disable_captions', '' ); 210 244 $first_run = true; 211 245 $ext_plugins = ''; 212 246 213 247 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 */ 214 256 self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id ); 215 257 } else { 216 258 /** … … 220 262 * The url should be absolute and should include the js file name to be loaded. 221 263 * Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'. 222 264 * 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. 223 269 */ 224 270 $mce_external_plugins = apply_filters( 'mce_external_plugins', array() ); 225 271 … … 248 294 * 249 295 * Specifies which of the default plugins that are included in WordPress should be added to 250 296 * the TinyMCE instance. 297 * 298 * @since 3.3.0 299 * 300 * @param array $plugins List of default TinyMCE plugins. 251 301 */ 252 302 $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) ); 253 303 … … 265 315 * include path to the file. The language file should follow the same format as 266 316 * wp_mce_translation() and should define a variable $strings that 267 317 * holds all translated strings. 318 * 319 * @since 2.5.0 320 * 321 * @param array $translations Translations for external TinyMCE plugins. 268 322 */ 269 323 $mce_external_languages = apply_filters( 'mce_external_languages', array() ); 270 324 … … 394 448 } 395 449 } 396 450 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 */ 397 458 $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' ); 398 459 399 460 if ( ! empty($mce_css) ) … … 401 462 } 402 463 403 464 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 */ 404 474 $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 ); 405 475 $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array(); 406 476 } 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 ); 411 517 } 412 518 413 519 $body_class = $editor_id; … … 458 564 if ( is_array( $set['tinymce'] ) ) 459 565 $mceInit = array_merge( $mceInit, $set['tinymce'] ); 460 566 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 */ 465 575 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 */ 466 585 $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id ); 467 586 } 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 */ 468 596 $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id ); 469 597 } 470 598 … … 796 924 797 925 $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min'; 798 926 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 */ 799 934 do_action( 'before_wp_tiny_mce', self::$mce_settings ); 800 935 ?> 801 936 … … 830 965 } 831 966 } 832 967 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 */ 834 976 do_action( 'wp_tiny_mce_init', self::$mce_settings ); 835 977 836 978 ?> … … 907 1049 if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) ) 908 1050 self::wp_fullscreen_html(); 909 1051 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 */ 910 1059 do_action( 'after_wp_tiny_mce', self::$mce_settings ); 911 1060 } 912 1061 … … 947 1096 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ), 948 1097 ); 949 1098 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 */ 950 1107 $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons ); 951 1108 952 1109 foreach ( $buttons as $button => $args ) { … … 1061 1218 * 1062 1219 * @since 3.7.0 1063 1220 * 1221 * @see 'wp_link_query_args' filter 1222 * 1064 1223 * @param array $results { 1065 1224 * An associative array of query results. 1066 1225 * 1067 1226 * @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. 1072 1232 * } 1073 1233 * } 1074 * @param array $query An array of WP_Query arguments. @see 'wp_link_query_args' filter1234 * @param array $query An array of WP_Query arguments. 1075 1235 */ 1076 1236 return apply_filters( 'wp_link_query', $results, $query ); 1077 1237 }