Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: user_can_richedit

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
917                ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) ||
918                     !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) )
919                     && 'comment.php' != $pagenow ) {
920                $wp_rich_edit = true;
921           } else {
922                $wp_rich_edit = false;
923           }
924      }
925
926      return apply_filters('user_can_richedit', $wp_rich_edit);
927 }
928
929 function wp_default_editor() {
930      $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
931      if ( $user = wp_get_current_user() ) { // look for cookie
932           if ( isset($_COOKIE['wordpress_editor_' . $user->ID]) && in_array($_COOKIE['wordpress_editor_' . $user->ID], array('tinymce', 'html', 'test') ) )
933                $r = $_COOKIE['wordpress_editor_' . $user->ID];
934      }
935      return apply_filters( 'wp_default_editor', $r ); // filter