Changeset 24738 for trunk/wp-includes/functions.php
- Timestamp:
- 07/18/2013 07:06:35 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r24723 r24738 3917 3917 /** 3918 3918 * Load the auth check for monitoring whether the user is still logged in. 3919 * Can be disabled with remove_action( 'admin_init', 'wp_auth_check_load' ); 3919 * 3920 * Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); 3921 * 3922 * This is disabled for certain screens where a login screen could cause an 3923 * inconvenient interruption. A filter called wp_auth_check_load can be used 3924 * for fine-grained control. 3920 3925 * 3921 3926 * @since 3.6.0 3922 *3923 * @return void3924 3927 */ 3925 3928 function wp_auth_check_load() { 3926 global $pagenow; 3927 3928 // Don't load for these types of requests 3929 if ( defined('XMLRPC_REQUEST') || defined('IFRAME_REQUEST') || 'wp-login.php' == $pagenow ) 3929 if ( ! is_admin() && ! is_user_logged_in() ) 3930 3930 return; 3931 3931 3932 if ( is_admin() || is_user_logged_in() ) { 3933 if ( defined('DOING_AJAX') ) { 3934 add_filter( 'heartbeat_received', 'wp_auth_check', 10, 2 ); 3935 add_filter( 'heartbeat_nopriv_received', 'wp_auth_check', 10, 2 ); 3936 } else { 3937 wp_enqueue_style( 'wp-auth-check' ); 3938 wp_enqueue_script( 'wp-auth-check' ); 3939 3940 if ( is_admin() ) 3941 add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); 3942 else 3943 add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); 3944 } 3945 } 3946 } 3947 3948 /** 3949 * Output the HTML that shows the wp-login dialog when the user is no longer logged in 3932 if ( defined( 'IFRAME_REQUEST' ) ) 3933 return; 3934 3935 $screen = get_current_screen(); 3936 $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); 3937 $show = ! in_array( $screen->id, $hidden ); 3938 3939 if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { 3940 wp_enqueue_style( 'wp-auth-check' ); 3941 wp_enqueue_script( 'wp-auth-check' ); 3942 3943 add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); 3944 add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); 3945 } 3946 } 3947 3948 /** 3949 * Output the HTML that shows the wp-login dialog when the user is no longer logged in. 3950 * 3951 * @since 3.6.0 3950 3952 */ 3951 3953 function wp_auth_check_html() { … … 3986 3988 3987 3989 /** 3988 * Check whether a user is still logged in, and act accordingly if not. 3990 * Check whether a user is still logged in, for the heartbeat. 3991 * 3992 * Send a result that shows a log-in box if the user is no longer logged in, 3993 * or if their cookie is within the grace period. 3989 3994 * 3990 3995 * @since 3.6.0 3991 3996 */ 3992 3997 function wp_auth_check( $response, $data ) { 3993 if ( ! isset( $data['wp-auth-check'] ) ) 3994 return $response; 3995 3996 // If the user is logged in and we are outside the login grace period, bail. 3997 if ( is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ) ) 3998 return array_merge( $response, array( 'wp-auth-check' => '1' ) ); 3999 4000 return array_merge( $response, array( 'wp-auth-check' => 'show' ) ); 3998 $response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ); 3999 return $response; 4001 4000 } 4002 4001
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)