WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/24/2006 03:57:19 AM (14 years ago)
Author:
markjaquith
Message:

Don't assume that TinyMCE exists, and degrade gracefully if it doesn't. fixes #3272

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r4371 r4417  
    751751}
    752752
     753function rich_edit_exists() {
     754    global $wp_rich_edit_exists;
     755    if ( !isset($wp_rich_edit_exists) )
     756        $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js');
     757    return $wp_rich_edit_exists;
     758}
     759
    753760function user_can_richedit() {
    754     $can = true;
    755 
    756     if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
    757         $can = false;
    758 
    759     return apply_filters('user_can_richedit', $can);
     761    global $wp_rich_edit;
     762   
     763    if ( !isset($wp_rich_edit) )
     764        $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;
     765
     766    return apply_filters('user_can_richedit', $wp_rich_edit);
    760767}
    761768
Note: See TracChangeset for help on using the changeset viewer.