- 16C5908A112243D1CD25306B9225B53419E6AEBC3D9F235037B77386FED111DCECF69D58699D7CEBFAEC27E366B4FEE8000C46B293030D9C6BBFDCD88498CB77
+ B61758CE3944DCC4E0D26B170CAC7D65E024B14414AEE50DE039C9BC0EAA7B909DAD56CEC1AE40FAEE7F0CD478CF13B3D92ECD128606E0143F921B717217F88D
mp-wp/wp-includes/general-template.php
(1399 . 77)(1399 . 12)
9911 }
9912
9913 /**
9914 * Determine if TinyMCE is available.
9915 *
9916 * Checks to see if the user has deleted the tinymce files to slim down there WordPress install.
9917 *
9918 * @since 2.1.0
9919 *
9920 * @return bool Whether of not TinyMCE exists.
9921 */
9922 function rich_edit_exists() {
9923 global $wp_rich_edit_exists;
9924 if ( !isset($wp_rich_edit_exists) )
9925 $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js');
9926 return $wp_rich_edit_exists;
9927 }
9928
9929 /**
9930 * Whether or not the user should have a WYSIWIG editor.
9931 *
9932 * Checks that the user requires a WYSIWIG editor and that the editor is
9933 * supported in the users browser.
9934 *
9935 * @since 2.0.0
9936 *
9937 * @return bool
9938 */
9939 function user_can_richedit() {
9940 global $wp_rich_edit, $pagenow;
9941
9942 if ( !isset( $wp_rich_edit) ) {
9943 if ( get_user_option( 'rich_editing' ) == 'true' &&
9944 ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) ||
9945 !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) )
9946 && 'comment.php' != $pagenow ) {
9947 $wp_rich_edit = true;
9948 } else {
9949 $wp_rich_edit = false;
9950 }
9951 }
9952
9953 return apply_filters('user_can_richedit', $wp_rich_edit);
9954 }
9955
9956 /**
9957 * Find out which editor should be displayed by default.
9958 *
9959 * Works out which of the two editors to display as the current editor for a
9960 * user.
9961 *
9962 * @since 2.5.0
9963 *
9964 * @return string Either 'tinymce', or 'html', or 'test'
9965 */
9966 function wp_default_editor() {
9967 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
9968 if ( $user = wp_get_current_user() ) { // look for cookie
9969 $ed = get_user_setting('editor', 'tinymce');
9970 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
9971 }
9972 return apply_filters( 'wp_default_editor', $r ); // filter
9973 }
9974
9975 /**
9976 * Display visual editor forms: TinyMCE, or HTML, or both.
9977 * Display HTML editor form.
9978 *
9979 * The amount of rows the text area will have for the content has to be between
9980 * 3 and 100 or will default at 12. There is only one option used for all users,
9981 * named 'default_post_edit_rows'.
9982 *
9983 * If the user can not use the rich editor (TinyMCE), then the switch button
9984 * will not be displayed.
9985 *
9986 * @since 2.1.0
9987 *
9988 * @param string $content Textarea content.
(1486 . 26)(1421 . 11)
9990 if ( !current_user_can( 'upload_files' ) )
9991 $media_buttons = false;
9992
9993 $richedit = user_can_richedit();
9994 $rows = "rows='$rows'";
9995
9996 if ( $richedit || $media_buttons ) { ?>
9997 if ( $media_buttons ) { ?>
9998 <div id="editor-toolbar">
9999 <?php if ( $richedit ) {
10000 $wp_default_editor = wp_default_editor(); ?>
10001 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
10002 <?php if ( 'html' == $wp_default_editor ) {
10003 add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
10004 <a id="edButtonHTML" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
10005 <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
10006 <?php } else {
10007 add_filter('the_editor_content', 'wp_richedit_pre'); ?>
10008 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
10009 <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
10010 <?php }
10011 }
10012
10013 if ( $media_buttons ) { ?>
10014 <?php if ( $media_buttons ) { ?>
10015 <div id="media-buttons" class="hide-if-no-js">
10016 <?php do_action( 'media_buttons' ); ?>
10017 </div>
(1527 . 24)(1447 . 6)
10019 <script type="text/javascript">
10020 // <![CDATA[
10021 edCanvas = document.getElementById('<?php echo $id; ?>');
10022 <?php if ( user_can_richedit() && $prev_id ) { ?>
10023 var dotabkey = true;
10024 // If tinyMCE is defined.
10025 if ( typeof tinyMCE != 'undefined' ) {
10026 // This code is meant to allow tabbing from Title to Post (TinyMCE).
10027 jQuery('#<?php echo $prev_id; ?>')[jQuery.browser.opera ? 'keypress' : 'keydown'](function (e) {
10028 if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
10029 if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
10030 if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
10031 e.preventDefault();
10032 dotabkey = false;
10033 tinyMCE.activeEditor.focus();
10034 return false;
10035 }
10036 }
10037 });
10038 }
10039 <?php } ?>
10040 // ]]>
10041 </script>
10042 <?php