WordPress.org

Make WordPress Core

Ticket #48965: wp-login.php.patch

File wp-login.php.patch, 2.2 KB (added by pikamander2, 23 months ago)

Use strict comparisons and yoda conditions

  • wp-login.php

     
    106106         */
    107107        if ( 'loggedout' === $wp_error->get_error_code() ) {
    108108                ?>
    109                 <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
     109                <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(-1 !== key.indexOf("wp-autosave-")){sessionStorage.removeItem(key)}}}catch(e){}};</script>
    110110                <?php
    111111        }
    112112
     
    308308                ?>
    309309                <script type="text/javascript">
    310310                try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
    311                 if(typeof wpOnload=='function')wpOnload();
     311                if('function' === typeof wpOnload)wpOnload();
    312312                </script>
    313313                <?php
    314314        }
     
    335335function wp_shake_js() {
    336336        ?>
    337337        <script type="text/javascript">
    338         addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     338        addLoadEvent = function(func){if("undefined"!==typeof jQuery)jQuery(document).ready(func);else if('function'!==typeof wpOnload){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    339339        function s(id,pos){g(id).left=pos+'px';}
    340340        function g(id){return document.getElementById(id).style;}
    341341        function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
     
    523523$secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
    524524setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
    525525
    526 if ( SITECOOKIEPATH != COOKIEPATH ) {
     526if ( SITECOOKIEPATH !== COOKIEPATH ) {
    527527        setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
    528528}
    529529
     
    932932
    933933                $errors = new WP_Error();
    934934
    935                 if ( isset( $_POST['pass1'] ) && $_POST['pass1'] != $_POST['pass2'] ) {
     935                if ( isset( $_POST['pass1'] ) && $_POST['pass1'] !== $_POST['pass2'] ) {
    936936                        $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
    937937                }
    938938