Ticket #27523: 27523.2.diff
| File 27523.2.diff, 13.0 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 /** 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 */ 214 257 self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id ); 215 258 } else { 259 216 260 /** 217 * TinyMCE external plugins filter261 * Filter the list of TinyMCE external plugins. 218 262 * 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. 223 276 */ 224 277 $mce_external_plugins = apply_filters( 'mce_external_plugins', array() ); 225 278 … … 244 297 } 245 298 246 299 /** 247 * TinyMCE default plugins filter300 * Filter the list of default TinyMCE plugins. 248 301 * 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. 251 308 */ 252 309 $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) ); 253 310 … … 258 315 } 259 316 260 317 if ( ! empty( $mce_external_plugins ) ) { 318 261 319 /** 262 * This filter loads translationsfor external TinyMCE 3.x plugins.320 * Filter the translations loaded for external TinyMCE 3.x plugins. 263 321 * 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. 268 331 */ 269 332 $mce_external_languages = apply_filters( 'mce_external_languages', array() ); 270 333 … … 394 457 } 395 458 } 396 459 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 */ 397 467 $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' ); 398 468 399 469 if ( ! empty($mce_css) ) … … 401 471 } 402 472 403 473 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 */ 404 483 $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 484 $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array(); 406 485 } 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 ); 411 526 } 412 527 413 528 $body_class = $editor_id; … … 458 573 if ( is_array( $set['tinymce'] ) ) 459 574 $mceInit = array_merge( $mceInit, $set['tinymce'] ); 460 575 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 */ 465 584 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 */ 466 594 $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id ); 467 595 } 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 */ 468 605 $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id ); 469 606 } 470 607 … … 796 933 797 934 $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min'; 798 935 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 */ 799 943 do_action( 'before_wp_tiny_mce', self::$mce_settings ); 800 944 ?> 801 945 … … 830 974 } 831 975 } 832 976 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 */ 834 985 do_action( 'wp_tiny_mce_init', self::$mce_settings ); 835 986 836 987 ?> … … 907 1058 if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) ) 908 1059 self::wp_fullscreen_html(); 909 1060 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 */ 910 1068 do_action( 'after_wp_tiny_mce', self::$mce_settings ); 911 1069 } 912 1070 … … 947 1105 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ), 948 1106 ); 949 1107 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 */ 950 1116 $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons ); 951 1117 952 1118 foreach ( $buttons as $button => $args ) { … … 1062 1228 * 1063 1229 * @since 3.7.0 1064 1230 * 1231 * @see 'wp_link_query_args' filter 1232 * 1065 1233 * @param array $results { 1066 1234 * An associative array of query results. 1067 1235 * 1068 1236 * @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. 1073 1242 * } 1074 1243 * } 1075 * @param array $query An array of WP_Query arguments. @see 'wp_link_query_args' filter1244 * @param array $query An array of WP_Query arguments. 1076 1245 */ 1077 1246 return apply_filters( 'wp_link_query', $results, $query ); 1078 1247 }