Make WordPress Core

Ticket #23295: 23295-3.patch

File 23295-3.patch, 4.6 KB (added by azaozz, 12 years ago)
  • wp-includes/functions.php

     
    38953895 */
    38963896function wp_auth_check_load() {
    38973897        wp_enqueue_script( 'heartbeat' );
     3898        wp_localize_script( 'heartbeat', 'wpAuthCheck', array( 'check' => ( is_admin() || is_user_logged_in() ) ) );
     3899
    38983900        add_filter( 'heartbeat_received', 'wp_auth_check', 10, 2 );
    38993901        add_filter( 'heartbeat_nopriv_received', 'wp_auth_check', 10, 2 );
    3900 
    3901         if ( is_admin() )
    3902                 add_action( 'admin_print_footer_scripts', 'wp_auth_check_js' );
    3903         elseif ( is_user_logged_in() )
    3904                 add_action( 'wp_print_footer_scripts', 'wp_auth_check_js' );
    39053902}
    39063903
    39073904/**
    3908  * Output the JS that shows the wp-login iframe when the user is no longer logged in
    3909  */
    3910 function wp_auth_check_js() {
    3911         ?>
    3912         <script type="text/javascript">
    3913         (function($){
    3914         $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
    3915                 var wrap = $('#wp-auth-check-notice-wrap');
    3916 
    3917                 if ( data['wp-auth-check-html'] && ! wrap.length ) {
    3918                         $('body').append( data['wp-auth-check-html'] );
    3919                 } else if ( !data['wp-auth-check-html'] && wrap.length && ! wrap.data('logged-in') ) {
    3920                         wrap.remove();
    3921                 }
    3922         }).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
    3923                 data['wp-auth-check'] = 1;
    3924         });
    3925         }(jQuery));
    3926         </script>
    3927         <?php
    3928 }
    3929 
    3930 /**
    39313905 * Check whether a user is still logged in, and act accordingly if not.
    39323906 *
    39333907 * @since 3.6.0
     
    39373911                return $response;
    39383912
    39393913        // If the user is logged in and we are outside the login grace period, bail.
    3940         if ( is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ) )
     3914        if ( is_user_logged_in() && wp_validate_auth_cookie( '', 'logged_in' ) && empty( $GLOBALS['login_grace_period'] ) )
    39413915                return $response;
    39423916
    39433917        return array_merge( $response, array(
     
    39473921        position: fixed;
    39483922        height: 90%;
    39493923        left: 50%;
    3950         max-height: 415px;
     3924        max-height: 425px;
    39513925        overflow: auto;
    39523926        top: 35px;
    3953         width: 300px;
     3927        width: 330px;
    39543928        margin: 0 0 0 -160px;
    3955         padding: 12px 20px;
     3929        padding: 12px;
    39563930        border: 1px solid #ddd;
    39573931        background-color: #fbfbfb;
    39583932        -webkit-border-radius: 3px;
     
    39663940#wp-auth-check-form iframe {
    39673941        height: 100%;
    39683942        overflow: hidden;
     3943        border: 0;
     3944        width: 320px;
     3945        display: block;
     3946        margin: auto;
    39693947}
    39703948#wp-auth-check a.wp-auth-check-close {
    39713949        position: absolute;
     
    39763954        background: url("' . includes_url('images/uploader-icons.png') . '") no-repeat scroll -95px center transparent;
    39773955}
    39783956#wp-auth-check h3 {
    3979         margin: 0 0 12px;
     3957        margin: 0 auto 12px;
    39803958        padding: 0;
    3981         font-size: 1.25em;
     3959        font-size: 16px;
     3960        font-family: sans-serif;
     3961        width: 320px;
    39823962}
     3963#wp-auth-check .offscreen-text {
     3964        position: absolute;
     3965        left: -1000em;
     3966        height: 1px;
     3967        width: 1px;
     3968        overflow: hidden;
     3969}
    39833970@media print,
    39843971  (-o-min-device-pixel-ratio: 5/4),
    39853972  (-webkit-min-device-pixel-ratio: 1.25),
     
    39923979</style>
    39933980<div id="wp-auth-check" tabindex="0">
    39943981<h3>' .  __('Session expired') . '</h3>
    3995 <a href="#" class="wp-auth-check-close"><span class="screen-reader-text">' . __('close') . '</span></a>
     3982<a href="#" class="wp-auth-check-close"><span class="offscreen-text">' . __('close') . '</span></a>
    39963983<div id="wp-auth-check-form">
    39973984        <iframe src="' . esc_url( add_query_arg( array( 'interim-login' => 1 ), wp_login_url() ) ) . '" frameborder="0"></iframe>
    39983985</div>
     
    40083995        var height;
    40093996        try { height = $(this.contentWindow.document).find("#login").height(); } catch(er){}
    40103997        if ( height ) {
    4011                 $("#wp-auth-check").css("max-height", height + 40 + "px");
    4012                 $(this).css("height", height + 5 + "px");
     3998                $("#wp-auth-check").css("max-height", height + 50 + "px");
     3999                $(this).css("height", height + 15 + "px");
    40134000                if ( height < 200 ) {
    40144001                        wrap.data("logged-in", true);
    40154002                        setTimeout( function(){ wrap.fadeOut(200, function(){ wrap.remove(); }); }, 5000 );
  • wp-includes/js/heartbeat.js

     
    410410        wp.heartbeat = new Heartbeat();
    411411
    412412}(jQuery));
     413
     414(function($){
     415        $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
     416                var wrap = $('#wp-auth-check-notice-wrap');
     417
     418                if ( data['wp-auth-check-html'] && ! wrap.length ) {
     419                        $('body').append( data['wp-auth-check-html'] );
     420                } else if ( !data['wp-auth-check-html'] && wrap.length && ! wrap.data('logged-in') ) {
     421                        wrap.remove();
     422                }
     423        }).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
     424                if ( window.wpAuthCheck && window.wpAuthCheck.check )
     425                        data['wp-auth-check'] = 1;
     426        });
     427}(jQuery));