diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index b2e1908f8..9c6c6017a 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -287,12 +287,10 @@ function edit_comment() { // Get an existing post and format it for editing. function get_post_to_edit($id) { - global $richedit; - $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false; $post = get_post($id); - $post->post_content = format_to_edit($post->post_content, $richedit); + $post->post_content = format_to_edit($post->post_content, user_can_richedit()); $post->post_content = apply_filters('content_edit_pre', $post->post_content); $post->post_excerpt = format_to_edit($post->post_excerpt); @@ -350,12 +348,9 @@ function get_default_post_to_edit() { } function get_comment_to_edit($id) { - global $richedit; - $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false; - $comment = get_comment($id); - $comment->comment_content = format_to_edit($comment->comment_content, $richedit); + $comment->comment_content = format_to_edit($comment->comment_content, user_can_richedit()); $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content); $comment->comment_author = format_to_edit($comment->comment_author); diff --git a/wp-admin/profile-update.php b/wp-admin/profile-update.php index 2c6028f55..8e5748419 100644 --- a/wp-admin/profile-update.php +++ b/wp-admin/profile-update.php @@ -17,9 +17,11 @@ if ( is_wp_error( $errors ) ) { exit; } -if ( !isset( $_POST['rich_editing'] ) ) - $_POST['rich_editing'] = 'false'; -update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true ); +if ( rich_edit_exists() ) { + if ( !isset( $_POST['rich_editing'] ) ) + $_POST['rich_editing'] = 'false'; + update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true ); +} do_action('personal_options_update'); diff --git a/wp-admin/profile.php b/wp-admin/profile.php index 50acd7c6d..fe283affa 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -30,8 +30,10 @@ $bookmarklet_height= 440;

+

+ diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index cc880c58d..b09417787 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -750,13 +750,20 @@ function noindex() { echo "\n"; } +function rich_edit_exists() { + global $wp_rich_edit_exists; + if ( !isset($wp_rich_edit_exists) ) + $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js'); + return $wp_rich_edit_exists; +} + function user_can_richedit() { - $can = true; + global $wp_rich_edit; + + if ( !isset($wp_rich_edit) ) + $wp_rich_edit = ( 'true' == get_user_option('rich_editing') && !preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) && rich_edit_exists() ) ? true : false; - if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) ) - $can = false; - - return apply_filters('user_can_richedit', $can); + return apply_filters('user_can_richedit', $wp_rich_edit); } function the_editor($content, $id = 'content', $prev_id = 'title') {