Changeset 19420 for trunk/wp-includes/general-template.php
- Timestamp:
- 11/23/2011 07:06:52 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/general-template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r19406 r19420 1767 1767 1768 1768 /** 1769 * Loads and initializes WP_Editor class (if needed), passes the settings for an instance of the editor 1769 * Find out which editor should be displayed by default. 1770 * 1771 * Works out which of the two editors to display as the current editor for a 1772 * user. 1773 * 1774 * @since 2.5.0 1775 * 1776 * @return string Either 'tinymce', or 'html', or 'test' 1777 */ 1778 function wp_default_editor() { 1779 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults 1780 if ( $user = wp_get_current_user() ) { // look for cookie 1781 $ed = get_user_setting('editor', 'tinymce'); 1782 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r; 1783 } 1784 return apply_filters( 'wp_default_editor', $r ); // filter 1785 } 1786 1787 /** 1788 * Renders an editor. 1770 1789 * 1771 1790 * Using this function is the proper way to output all needed components for both TinyMCE and Quicktags. 1772 * WP_Editor shouldn't be instantiated separately as it keeps track of loaded scripts. 1773 * See http://core.trac.wordpress.org/ticket/17144. 1791 * _WP_Editors should not be used directly. See http://core.trac.wordpress.org/ticket/17144. 1774 1792 * 1775 1793 * NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason … … 1784 1802 * @param string $content Initial content for the editor. 1785 1803 * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/. 1786 * @param array $settings See WP_Editor::editor().1804 * @param array $settings See _WP_Editors::editor(). 1787 1805 */ 1788 1806 function wp_editor( $content, $editor_id, $settings = array() ) { 1789 global $wp_editor; 1790 1791 if ( !is_a($wp_editor, 'WP_Editor') ) { 1807 if ( ! class_exists( '_WP_Editors' ) ) 1792 1808 require( ABSPATH . WPINC . '/class-wp-editor.php' ); 1793 $wp_editor = new WP_Editor; 1794 } 1795 1796 $wp_editor->editor($content, $editor_id, $settings); 1809 1810 _WP_Editors::editor($content, $editor_id, $settings); 1797 1811 } 1798 1812
Note: See TracChangeset
for help on using the changeset viewer.