Make WordPress Core

Ticket #30503: 30503.patch

File 30503.patch, 43.0 KB (added by colorful tones, 10 years ago)

Lots of whitespace for opening and closing parenthesis

  • src/wp-includes/pluggable.php

     
    66 * @package WordPress
    77 */
    88
    9 if ( !function_exists('wp_set_current_user') ) :
     9if ( !function_exists( 'wp_set_current_user' ) ) :
    1010/**
    1111 * Changes the current user by ID or name.
    1212 *
     
    2323 * @param string $name User's username
    2424 * @return WP_User Current user User object
    2525 */
    26 function wp_set_current_user($id, $name = '') {
     26function wp_set_current_user( $id, $name = '' ) {
    2727        global $current_user;
    2828
    2929        if ( isset( $current_user ) && ( $current_user instanceof WP_User ) && ( $id == $current_user->ID ) )
     
    4444}
    4545endif;
    4646
    47 if ( !function_exists('wp_get_current_user') ) :
     47if ( !function_exists( 'wp_get_current_user' ) ) :
    4848/**
    4949 * Retrieve the current user object.
    5050 *
     
    6161}
    6262endif;
    6363
    64 if ( !function_exists('get_currentuserinfo') ) :
     64if ( !function_exists( 'get_currentuserinfo' ) ) :
    6565/**
    6666 * Populate global variables with information about the currently logged in user.
    6767 *
     
    124124}
    125125endif;
    126126
    127 if ( !function_exists('get_userdata') ) :
     127if ( !function_exists( 'get_userdata' ) ) :
    128128/**
    129129 * Retrieve user info by user ID.
    130130 *
     
    138138}
    139139endif;
    140140
    141 if ( !function_exists('get_user_by') ) :
     141if ( !function_exists( 'get_user_by' ) ) :
    142142/**
    143143 * Retrieve user info by a given field
    144144 *
     
    161161}
    162162endif;
    163163
    164 if ( !function_exists('cache_users') ) :
     164if ( !function_exists( 'cache_users' ) ) :
    165165/**
    166166 * Retrieve info for user lists to prevent multiple queries by get_userdata()
    167167 *
     
    302302                                switch ( strtolower( $name ) ) {
    303303                                        // Mainly for legacy -- process a From: header if it's there
    304304                                        case 'from':
    305                                                 if ( strpos($content, '<' ) !== false ) {
     305                                                if ( strpos( $content, '<' ) !== false ) {
    306306                                                        // So... making my life hard again?
    307307                                                        $from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
    308308                                                        $from_name = str_replace( '"', '', $from_name );
     
    434434        }
    435435
    436436        if ( !empty( $bcc ) ) {
    437                 foreach ( (array) $bcc as $recipient) {
     437                foreach ( (array) $bcc as $recipient ) {
    438438                        try {
    439439                                // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
    440440                                $recipient_name = '';
     
    495495                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
    496496                }
    497497
    498                 if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
     498                if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) )
    499499                        $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
    500500        }
    501501
    502502        if ( !empty( $attachments ) ) {
    503503                foreach ( $attachments as $attachment ) {
    504504                        try {
    505                                 $phpmailer->AddAttachment($attachment);
     505                                $phpmailer->AddAttachment( $attachment );
    506506                        } catch ( phpmailerException $e ) {
    507507                                continue;
    508508                        }
     
    527527}
    528528endif;
    529529
    530 if ( !function_exists('wp_authenticate') ) :
     530if ( !function_exists( 'wp_authenticate' ) ) :
    531531/**
    532532 * Checks a user's login information and logs them in if it checks out.
    533533 *
     
    537537 * @param string $password User's password
    538538 * @return WP_User|WP_Error WP_User object if login successful, otherwise WP_Error object.
    539539 */
    540 function wp_authenticate($username, $password) {
    541         $username = sanitize_user($username);
    542         $password = trim($password);
     540function wp_authenticate( $username, $password ) {
     541        $username = sanitize_user( $username );
     542        $password = trim( $password );
    543543
    544544        /**
    545545         * Filter the user to authenticate.
     
    558558        if ( $user == null ) {
    559559                // TODO what should the error message be? (Or would these even happen?)
    560560                // Only needed if all authentication handlers fail to return anything.
    561                 $user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username or incorrect password.'));
     561                $user = new WP_Error('authentication_failed', __( '<strong>ERROR</strong>: Invalid username or incorrect password.' ) );
    562562        }
    563563
    564         $ignore_codes = array('empty_username', 'empty_password');
     564        $ignore_codes = array( 'empty_username', 'empty_password' );
    565565
    566         if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
     566        if ( is_wp_error( $user ) && !in_array( $user->get_error_code(), $ignore_codes ) ) {
    567567                /**
    568568                 * Fires after a user login has failed.
    569569                 *
     
    578578}
    579579endif;
    580580
    581 if ( !function_exists('wp_logout') ) :
     581if ( !function_exists( 'wp_logout' ) ) :
    582582/**
    583583 * Log the current user out.
    584584 *
     
    597597}
    598598endif;
    599599
    600 if ( !function_exists('wp_validate_auth_cookie') ) :
     600if ( !function_exists( 'wp_validate_auth_cookie' ) ) :
    601601/**
    602602 * Validates authentication cookie.
    603603 *
     
    613613 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
    614614 * @return bool|int False if invalid cookie, User ID if valid.
    615615 */
    616 function wp_validate_auth_cookie($cookie = '', $scheme = '') {
    617         if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
     616function wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
     617        if ( ! $cookie_elements = wp_parse_auth_cookie( $cookie, $scheme ) ) {
    618618                /**
    619619                 * Fires if an authentication cookie is malformed.
    620620                 *
     
    652652                return false;
    653653        }
    654654
    655         $user = get_user_by('login', $username);
     655        $user = get_user_by( 'login', $username );
    656656        if ( ! $user ) {
    657657                /**
    658658                 * Fires if a bad username is entered in the user authentication process.
     
    665665                return false;
    666666        }
    667667
    668         $pass_frag = substr($user->user_pass, 8, 4);
     668        $pass_frag = substr( $user->user_pass, 8, 4 );
    669669
    670670        $key = wp_hash( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
    671671
     
    710710}
    711711endif;
    712712
    713 if ( !function_exists('wp_generate_auth_cookie') ) :
     713if ( !function_exists( 'wp_generate_auth_cookie' ) ) :
    714714/**
    715715 * Generate authentication cookie contents.
    716716 *
     
    723723 * @return string Authentication cookie contents. Empty string if user does not exist.
    724724 */
    725725function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) {
    726         $user = get_userdata($user_id);
     726        $user = get_userdata( $user_id );
    727727        if ( ! $user ) {
    728728                return '';
    729729        }
     
    733733                $token = $manager->create( $expiration );
    734734        }
    735735
    736         $pass_frag = substr($user->user_pass, 8, 4);
     736        $pass_frag = substr( $user->user_pass, 8, 4 );
    737737
    738738        $key = wp_hash( $user->user_login . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
    739739
     
    758758}
    759759endif;
    760760
    761 if ( !function_exists('wp_parse_auth_cookie') ) :
     761if ( !function_exists( 'wp_parse_auth_cookie' ) ) :
    762762/**
    763763 * Parse a cookie into its components
    764764 *
     
    768768 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
    769769 * @return array Authentication cookie components
    770770 */
    771 function wp_parse_auth_cookie($cookie = '', $scheme = '') {
    772         if ( empty($cookie) ) {
    773                 switch ($scheme){
     771function wp_parse_auth_cookie( $cookie = '', $scheme = '' ) {
     772        if ( empty( $cookie ) ) {
     773                switch ( $scheme ){
    774774                        case 'auth':
    775775                                $cookie_name = AUTH_COOKIE;
    776776                                break;
     
    790790                                }
    791791            }
    792792
    793                 if ( empty($_COOKIE[$cookie_name]) )
     793                if ( empty( $_COOKIE[$cookie_name] ) )
    794794                        return false;
    795795                $cookie = $_COOKIE[$cookie_name];
    796796        }
     
    806806}
    807807endif;
    808808
    809 if ( !function_exists('wp_set_auth_cookie') ) :
     809if ( !function_exists( 'wp_set_auth_cookie' ) ) :
    810810/**
    811811 * Sets the authentication cookies based on user ID.
    812812 *
     
    821821 * @param mixed $secure  Whether the admin cookies should only be sent over HTTPS.
    822822 *                       Default is_ssl().
    823823 */
    824 function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
     824function wp_set_auth_cookie( $user_id, $remember = false, $secure = '' ) {
    825825        if ( $remember ) {
    826826                /**
    827827                 * Filter the duration of the authentication cookie expiration period.
     
    915915         */
    916916        do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
    917917
    918         setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    919         setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    920         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
     918        setcookie( $auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true );
     919        setcookie( $auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true );
     920        setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
    921921        if ( COOKIEPATH != SITECOOKIEPATH )
    922                 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
     922                setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true );
    923923}
    924924endif;
    925925
    926 if ( !function_exists('wp_clear_auth_cookie') ) :
     926if ( !function_exists( 'wp_clear_auth_cookie' ) ) :
    927927/**
    928928 * Removes all of the cookies associated with authentication.
    929929 *
     
    958958}
    959959endif;
    960960
    961 if ( !function_exists('is_user_logged_in') ) :
     961if ( !function_exists( 'is_user_logged_in' ) ) :
    962962/**
    963963 * Checks if the current visitor is a logged in user.
    964964 *
     
    976976}
    977977endif;
    978978
    979 if ( !function_exists('auth_redirect') ) :
     979if ( !function_exists( 'auth_redirect' ) ) :
    980980/**
    981981 * Checks if a user is logged in, if not it redirects them to the login page.
    982982 *
     
    997997        $secure = apply_filters( 'secure_auth_redirect', $secure );
    998998
    999999        // If https is required and request is http, redirect
    1000         if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
     1000        if ( $secure && !is_ssl() && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
    10011001                if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    10021002                        wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    10031003                        exit();
     
    10311031                do_action( 'auth_redirect', $user_id );
    10321032
    10331033                // If the user wants ssl but the session is not ssl, redirect.
    1034                 if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
     1034                if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
    10351035                        if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    10361036                                wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    10371037                                exit();
     
    10511051
    10521052        $login_url = wp_login_url($redirect, true);
    10531053
    1054         wp_redirect($login_url);
     1054        wp_redirect( $login_url );
    10551055        exit();
    10561056}
    10571057endif;
    10581058
    1059 if ( !function_exists('check_admin_referer') ) :
     1059if ( !function_exists( 'check_admin_referer' ) ) :
    10601060/**
    10611061 * Makes sure that a user was referred from another admin page.
    10621062 *
     
    10671067 * @param string $action Action nonce
    10681068 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
    10691069 */
    1070 function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
     1070function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
    10711071        if ( -1 == $action )
    10721072                _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );
    10731073
    1074         $adminurl = strtolower(admin_url());
    1075         $referer = strtolower(wp_get_referer());
    1076         $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;
    1077         if ( !$result && !(-1 == $action && strpos($referer, $adminurl) === 0) ) {
    1078                 wp_nonce_ays($action);
     1074        $adminurl = strtolower( admin_url() );
     1075        $referer = strtolower( wp_get_referer() );
     1076        $result = isset( $_REQUEST[$query_arg] ) ? wp_verify_nonce( $_REQUEST[$query_arg], $action ) : false;
     1077        if ( !$result && !( -1 == $action && strpos($referer, $adminurl) === 0 ) ) {
     1078                wp_nonce_ays( $action );
    10791079                die();
    10801080        }
    10811081
     
    10921092}
    10931093endif;
    10941094
    1095 if ( !function_exists('check_ajax_referer') ) :
     1095if ( !function_exists( 'check_ajax_referer' ) ) :
    10961096/**
    10971097 * Verifies the AJAX request to prevent processing requests external of the blog.
    10981098 *
     
    11341134}
    11351135endif;
    11361136
    1137 if ( !function_exists('wp_redirect') ) :
     1137if ( !function_exists( 'wp_redirect' ) ) :
    11381138/**
    11391139 * Redirects to another page.
    11401140 *
     
    11701170        if ( ! $location )
    11711171                return false;
    11721172
    1173         $location = wp_sanitize_redirect($location);
     1173        $location = wp_sanitize_redirect( $location );
    11741174
    11751175        if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
    1176                 status_header($status); // This causes problems on IIS and some FastCGI setups
     1176                status_header( $status ); // This causes problems on IIS and some FastCGI setups
    11771177
    1178         header("Location: $location", true, $status);
     1178        header( "Location: $location", true, $status );
    11791179
    11801180        return true;
    11811181}
    11821182endif;
    11831183
    1184 if ( !function_exists('wp_sanitize_redirect') ) :
     1184if ( !function_exists( 'wp_sanitize_redirect' ) ) :
    11851185/**
    11861186 * Sanitizes a URL for use in a redirect.
    11871187 *
     
    11891189 *
    11901190 * @return string redirect-sanitized URL
    11911191 **/
    1192 function wp_sanitize_redirect($location) {
    1193         $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!*]|i', '', $location);
    1194         $location = wp_kses_no_null($location);
     1192function wp_sanitize_redirect( $location ) {
     1193        $location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!*]|i', '', $location );
     1194        $location = wp_kses_no_null( $location );
    11951195
    11961196        // remove %0d and %0a from location
    1197         $strip = array('%0d', '%0a', '%0D', '%0A');
    1198         $location = _deep_replace($strip, $location);
     1197        $strip = array( '%0d', '%0a', '%0D', '%0A' );
     1198        $location = _deep_replace( $strip, $location );
    11991199        return $location;
    12001200}
    12011201endif;
    12021202
    1203 if ( !function_exists('wp_safe_redirect') ) :
     1203if ( !function_exists( 'wp_safe_redirect' ) ) :
    12041204/**
    12051205 * Performs a safe (local) redirect, using wp_redirect().
    12061206 *
     
    12161216 *
    12171217 * @return void Does not return anything
    12181218 **/
    1219 function wp_safe_redirect($location, $status = 302) {
     1219function wp_safe_redirect( $location, $status = 302 ) {
    12201220
    12211221        // Need to look at the URL the way it will end up in wp_redirect()
    1222         $location = wp_sanitize_redirect($location);
     1222        $location = wp_sanitize_redirect( $location );
    12231223
    1224         $location = wp_validate_redirect($location, admin_url());
     1224        $location = wp_validate_redirect( $location, admin_url() );
    12251225
    1226         wp_redirect($location, $status);
     1226        wp_redirect( $location, $status );
    12271227}
    12281228endif;
    12291229
    1230 if ( !function_exists('wp_validate_redirect') ) :
     1230if ( !function_exists( 'wp_validate_redirect' ) ) :
    12311231/**
    12321232 * Validates a URL for use in a redirect.
    12331233 *
     
    12431243 * @param string $default The value to return if $location is not allowed
    12441244 * @return string redirect-sanitized URL
    12451245 **/
    1246 function wp_validate_redirect($location, $default = '') {
     1246function wp_validate_redirect( $location, $default = '' ) {
    12471247        $location = trim( $location );
    12481248        // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
    1249         if ( substr($location, 0, 2) == '//' )
     1249        if ( substr( $location, 0, 2 ) == '//' )
    12501250                $location = 'http:' . $location;
    12511251
    12521252        // In php 5 parse_url may fail if the URL query part contains http://, bug #38143
    1253         $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
     1253        $test = ( $cut = strpos( $location, '?' ) ) ? substr( $location, 0, $cut ) : $location;
    12541254
    1255         $lp  = parse_url($test);
     1255        $lp  = parse_url( $test );
    12561256
    12571257        // Give up if malformed URL
    12581258        if ( false === $lp )
    12591259                return $default;
    12601260
    12611261        // Allow only http and https schemes. No data:, etc.
    1262         if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
     1262        if ( isset( $lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
    12631263                return $default;
    12641264
    12651265        // Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
    1266         if ( isset($lp['scheme'])  && !isset($lp['host']) )
     1266        if ( isset( $lp['scheme'] )  && !isset( $lp['host'] ) )
    12671267                return $default;
    12681268
    1269         $wpp = parse_url(home_url());
     1269        $wpp = parse_url( home_url() );
    12701270
    12711271        /**
    12721272         * Filter the whitelist of hosts to redirect to.
     
    12761276         * @param array       $hosts An array of allowed hosts.
    12771277         * @param bool|string $host  The parsed host; empty if not isset.
    12781278         */
    1279         $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
     1279        $allowed_hosts = ( array ) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset($lp['host'] ) ? $lp['host'] : '' );
    12801280
    1281         if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
     1281        if ( isset( $lp['host'] ) && ( !in_array( $lp['host'], $allowed_hosts ) && $lp['host'] != strtolower( $wpp['host'] ) ) )
    12821282                $location = $default;
    12831283
    12841284        return $location;
    12851285}
    12861286endif;
    12871287
    1288 if ( ! function_exists('wp_notify_postauthor') ) :
     1288if ( ! function_exists( 'wp_notify_postauthor' ) ) :
    12891289/**
    12901290 * Notify an author (and/or others) of a comment/trackback/pingback on a post.
    12911291 *
     
    13711371                $emails = array_flip( $emails );
    13721372        }
    13731373
    1374         $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
     1374        $comment_author_domain = @gethostbyaddr( $comment->comment_author_IP );
    13751375
    13761376        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    13771377        // we want to reverse this for the plain text arena of emails.
    1378         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     1378        $blogname = wp_specialchars_decode( get_option('blogname'), ENT_QUOTES );
    13791379
    13801380        switch ( $comment->comment_type ) {
    13811381                case 'trackback':
    13821382                        $notify_message  = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
    13831383                        /* translators: 1: website name, 2: author IP, 3: author domain */
    1384                         $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     1384                        $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    13851385                        $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
    13861386                        $notify_message .= sprintf( __( 'Comment: %s' ), $comment->comment_content ) . "\r\n\r\n";
    13871387                        $notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
    13881388                        /* translators: 1: blog name, 2: post title */
    1389                         $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
     1389                        $subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title );
    13901390                        break;
    13911391                case 'pingback':
    13921392                        $notify_message  = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
    13931393                        /* translators: 1: comment author, 2: author IP, 3: author domain */
    1394                         $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     1394                        $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    13951395                        $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
    13961396                        $notify_message .= sprintf( __( 'Comment: %s' ), $comment->comment_content ) . "\r\n\r\n";
    13971397                        $notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
    13981398                        /* translators: 1: blog name, 2: post title */
    1399                         $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
     1399                        $subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title );
    14001400                        break;
    14011401                default: // Comments
    14021402                        $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
     
    14081408                        $notify_message .= sprintf( __('Comment: %s' ), $comment->comment_content ) . "\r\n\r\n";
    14091409                        $notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";
    14101410                        /* translators: 1: blog name, 2: post title */
    1411                         $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
     1411                        $subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title );
    14121412                        break;
    14131413        }
    1414         $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
    1415         $notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment_id ) ) . "\r\n";
     1414        $notify_message .= get_permalink( $comment->comment_post_I D) . "#comments\r\n\r\n";
     1415        $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment_id ) ) . "\r\n";
    14161416
    14171417        if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
    14181418                if ( EMPTY_TRASH_DAYS )
    1419                         $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
     1419                        $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c=$comment_id" ) ) . "\r\n";
    14201420                else
    1421                         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    1422                 $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1421                        $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c=$comment_id" ) ) . "\r\n";
     1422                $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c=$comment_id" ) ) . "\r\n";
    14231423        }
    14241424
    1425         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
     1425        $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) );
    14261426
    14271427        if ( '' == $comment->comment_author ) {
    14281428                $from = "From: \"$blogname\" <$wp_email>";
     
    14371437        $message_headers = "$from\n"
    14381438                . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    14391439
    1440         if ( isset($reply_to) )
     1440        if ( isset( $reply_to ) )
    14411441                $message_headers .= $reply_to . "\n";
    14421442
    14431443        /**
     
    14781478}
    14791479endif;
    14801480
    1481 if ( !function_exists('wp_notify_moderator') ) :
     1481if ( !function_exists( 'wp_notify_moderator' ) ) :
    14821482/**
    14831483 * Notifies the moderator of the blog about a new comment that is awaiting approval.
    14841484 *
     
    14891489 * @param int $comment_id Comment ID
    14901490 * @return bool Always returns true
    14911491 */
    1492 function wp_notify_moderator($comment_id) {
     1492function wp_notify_moderator( $comment_id ) {
    14931493        global $wpdb;
    14941494
    14951495        if ( 0 == get_option( 'moderation_notify' ) )
    14961496                return true;
    14971497
    1498         $comment = get_comment($comment_id);
    1499         $post = get_post($comment->comment_post_ID);
     1498        $comment = get_comment( $comment_id );
     1499        $post = get_post( $comment->comment_post_ID );
    15001500        $user = get_userdata( $post->post_author );
    15011501        // Send to the administration and to the post author if the author can modify the comment.
    15021502        $emails = array( get_option( 'admin_email' ) );
     
    15051505                        $emails[] = $user->user_email;
    15061506        }
    15071507
    1508         $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
    1509         $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
     1508        $comment_author_domain = @gethostbyaddr( $comment->comment_author_IP );
     1509        $comments_waiting = $wpdb->get_var( "SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'" );
    15101510
    15111511        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    15121512        // we want to reverse this for the plain text arena of emails.
    1513         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     1513        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    15141514
    15151515        switch ( $comment->comment_type ) {
    15161516                case 'trackback':
    1517                         $notify_message  = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
    1518                         $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
    1519                         $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    1520                         $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
    1521                         $notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
     1517                        $notify_message  = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
     1518                        $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
     1519                        $notify_message .= sprintf( __( 'Website : %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     1520                        $notify_message .= sprintf( __( 'URL    : %s' ), $comment->comment_author_url ) . "\r\n";
     1521                        $notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment->comment_content . "\r\n\r\n";
    15221522                        break;
    15231523                case 'pingback':
    1524                         $notify_message  = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
    1525                         $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
    1526                         $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    1527                         $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
    1528                         $notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
     1524                        $notify_message  = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
     1525                        $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
     1526                        $notify_message .= sprintf( __( 'Website : %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     1527                        $notify_message .= sprintf( __( 'URL    : %s' ), $comment->comment_author_url ) . "\r\n";
     1528                        $notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment->comment_content . "\r\n\r\n";
    15291529                        break;
    15301530                default: // Comments
    1531                         $notify_message  = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
    1532                         $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
    1533                         $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    1534                         $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
    1535                         $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
    1536                         $notify_message .= sprintf( __('Whois  : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n";
    1537                         $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
     1531                        $notify_message  = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
     1532                        $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
     1533                        $notify_message .= sprintf( __( 'Author : %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     1534                        $notify_message .= sprintf( __( 'E-mail : %s' ), $comment->comment_author_email ) . "\r\n";
     1535                        $notify_message .= sprintf( __( 'URL    : %s' ), $comment->comment_author_url ) . "\r\n";
     1536                        $notify_message .= sprintf( __( 'Whois  : http://whois.arin.net/rest/ip/%s' ), $comment->comment_author_IP ) . "\r\n";
     1537                        $notify_message .= __( 'Comment: ' ) . "\r\n" . $comment->comment_content . "\r\n\r\n";
    15381538                        break;
    15391539        }
    15401540
    1541         $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n";
     1541        $notify_message .= sprintf( __( 'Approve it: %s' ),  admin_url( "comment.php?action=approve&c=$comment_id" ) ) . "\r\n";
    15421542        if ( EMPTY_TRASH_DAYS )
    1543                 $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
     1543                $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c=$comment_id" ) ) . "\r\n";
    15441544        else
    1545                 $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    1546         $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1545                $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c=$comment_id" ) ) . "\r\n";
     1546        $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c=$comment_id" ) ) . "\r\n";
    15471547
    1548         $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
    1549                 'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
    1550         $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
     1548        $notify_message .= sprintf( _n( 'Currently %s comment is waiting for approval. Please visit the moderation panel:',
     1549                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting ), number_format_i18n( $comments_waiting ) ) . "\r\n";
     1550        $notify_message .= admin_url( "edit-comments.php?comment_status=moderated" ) . "\r\n";
    15511551
    1552         $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
     1552        $subject = sprintf( __( '[%1$s] Please moderate: "%2$s"' ), $blogname, $post->post_title );
    15531553        $message_headers = '';
    15541554
    15551555        /**
     
    16001600}
    16011601endif;
    16021602
    1603 if ( !function_exists('wp_password_change_notification') ) :
     1603if ( !function_exists( 'wp_password_change_notification' ) ) :
    16041604/**
    16051605 * Notify the blog admin of a user changing password, normally via email.
    16061606 *
     
    16121612        // send a copy of password change notification to the admin
    16131613        // but check to see if it's the admin whose password we're changing, and skip this
    16141614        if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
    1615                 $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
     1615                $message = sprintf( __( 'Password Lost and Changed for user: %s' ), $user->user_login ) . "\r\n";
    16161616                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    16171617                // we want to reverse this for the plain text arena of emails.
    1618                 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    1619                 wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
     1618                $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
     1619                wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Password Lost/Changed' ), $blogname ), $message );
    16201620        }
    16211621}
    16221622endif;
    16231623
    1624 if ( !function_exists('wp_new_user_notification') ) :
     1624if ( !function_exists( 'wp_new_user_notification' ) ) :
    16251625/**
    16261626 * Email login credentials to a newly-registered user.
    16271627 *
     
    16321632 * @param int    $user_id        User ID.
    16331633 * @param string $plaintext_pass Optional. The user's plaintext password. Default empty.
    16341634 */
    1635 function wp_new_user_notification($user_id, $plaintext_pass = '') {
     1635function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
    16361636        $user = get_userdata( $user_id );
    16371637
    16381638        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    16391639        // we want to reverse this for the plain text arena of emails.
    1640         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     1640        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    16411641
    1642         $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
    1643         $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
    1644         $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
     1642        $message  = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
     1643        $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
     1644        $message .= sprintf( __( 'E-mail: %s' ), $user->user_email ) . "\r\n";
    16451645
    1646         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     1646        @wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
    16471647
    1648         if ( empty($plaintext_pass) )
     1648        if ( empty( $plaintext_pass ) )
    16491649                return;
    16501650
    1651         $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    1652         $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
     1651        $message  = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n";
     1652        $message .= sprintf( __( 'Password: %s' ), $plaintext_pass ) . "\r\n";
    16531653        $message .= wp_login_url() . "\r\n";
    16541654
    1655         wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
     1655        wp_mail( $user->user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message );
    16561656
    16571657}
    16581658endif;
    16591659
    1660 if ( !function_exists('wp_nonce_tick') ) :
     1660if ( !function_exists( 'wp_nonce_tick' ) ) :
    16611661/**
    16621662 * Get the time-dependent variable for nonce creation.
    16631663 *
     
    16821682}
    16831683endif;
    16841684
    1685 if ( !function_exists('wp_verify_nonce') ) :
     1685if ( !function_exists( 'wp_verify_nonce' ) ) :
    16861686/**
    16871687 * Verify that correct nonce was used with time limit.
    16881688 *
     
    16951695 * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
    16961696 * @return bool Whether the nonce check passed or failed.
    16971697 */
    1698 function wp_verify_nonce($nonce, $action = -1) {
     1698function wp_verify_nonce( $nonce, $action = -1 ) {
    16991699        $user = wp_get_current_user();
    17001700        $uid = (int) $user->ID;
    17011701        if ( ! $uid ) {
     
    17181718        $i = wp_nonce_tick();
    17191719
    17201720        // Nonce generated 0-12 hours ago
    1721         $expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10 );
     1721        $expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
    17221722        if ( hash_equals( $expected, $nonce ) ) {
    17231723                return 1;
    17241724        }
     
    17341734}
    17351735endif;
    17361736
    1737 if ( !function_exists('wp_create_nonce') ) :
     1737if ( !function_exists( 'wp_create_nonce' ) ) :
    17381738/**
    17391739 * Creates a cryptographic token tied to a specific action, user, and window of time.
    17401740 *
     
    17431743 * @param string $action Scalar value to add context to the nonce.
    17441744 * @return string The token.
    17451745 */
    1746 function wp_create_nonce($action = -1) {
     1746function wp_create_nonce( $action = -1 ) {
    17471747        $user = wp_get_current_user();
    17481748        $uid = (int) $user->ID;
    17491749        if ( ! $uid ) {
     
    17581758}
    17591759endif;
    17601760
    1761 if ( !function_exists('wp_salt') ) :
     1761if ( !function_exists( 'wp_salt' ) ) :
    17621762/**
    17631763 * Get salt to add to hashes.
    17641764 *
     
    18621862}
    18631863endif;
    18641864
    1865 if ( !function_exists('wp_hash') ) :
     1865if ( !function_exists( 'wp_hash' ) ) :
    18661866/**
    18671867 * Get hash of given string.
    18681868 *
     
    18711871 * @param string $data Plain text to hash
    18721872 * @return string Hash of $data
    18731873 */
    1874 function wp_hash($data, $scheme = 'auth') {
    1875         $salt = wp_salt($scheme);
     1874function wp_hash( $data, $scheme = 'auth' ) {
     1875        $salt = wp_salt( $scheme );
    18761876
    1877         return hash_hmac('md5', $data, $salt);
     1877        return hash_hmac( 'md5', $data, $salt );
    18781878}
    18791879endif;
    18801880
    1881 if ( !function_exists('wp_hash_password') ) :
     1881if ( !function_exists( 'wp_hash_password' ) ) :
    18821882/**
    18831883 * Create a hash (encrypt) of a plain text password.
    18841884 *
     
    18931893 * @param string $password Plain text user password to hash
    18941894 * @return string The hash string of the password
    18951895 */
    1896 function wp_hash_password($password) {
     1896function wp_hash_password( $password ) {
    18971897        global $wp_hasher;
    18981898
    1899         if ( empty($wp_hasher) ) {
    1900                 require_once( ABSPATH . WPINC . '/class-phpass.php');
     1899        if ( empty( $wp_hasher ) ) {
     1900                require_once( ABSPATH . WPINC . '/class-phpass.php' );
    19011901                // By default, use the portable hash from phpass
    1902                 $wp_hasher = new PasswordHash(8, true);
     1902                $wp_hasher = new PasswordHash( 8, true );
    19031903        }
    19041904
    19051905        return $wp_hasher->HashPassword( trim( $password ) );
    19061906}
    19071907endif;
    19081908
    1909 if ( !function_exists('wp_check_password') ) :
     1909if ( !function_exists( 'wp_check_password' ) ) :
    19101910/**
    19111911 * Checks the plaintext password against the encrypted Password.
    19121912 *
     
    19281928 * @param string $hash Hash of the user's password to check against.
    19291929 * @return bool False, if the $password does not match the hashed password
    19301930 */
    1931 function wp_check_password($password, $hash, $user_id = '') {
     1931function wp_check_password( $password, $hash, $user_id = '' ) {
    19321932        global $wp_hasher;
    19331933
    19341934        // If the hash is still md5...
    1935         if ( strlen($hash) <= 32 ) {
     1935        if ( strlen( $hash ) <= 32 ) {
    19361936                $check = hash_equals( $hash, md5( $password ) );
    19371937                if ( $check && $user_id ) {
    19381938                        // Rehash using new hash.
    1939                         wp_set_password($password, $user_id);
    1940                         $hash = wp_hash_password($password);
     1939                        wp_set_password( $password, $user_id );
     1940                        $hash = wp_hash_password( $password );
    19411941                }
    19421942
    19431943                /**
     
    19551955
    19561956        // If the stored hash is longer than an MD5, presume the
    19571957        // new style phpass portable hash.
    1958         if ( empty($wp_hasher) ) {
    1959                 require_once( ABSPATH . WPINC . '/class-phpass.php');
     1958        if ( empty( $wp_hasher ) ) {
     1959                require_once( ABSPATH . WPINC . '/class-phpass.php' );
    19601960                // By default, use the portable hash from phpass
    1961                 $wp_hasher = new PasswordHash(8, true);
     1961                $wp_hasher = new PasswordHash( 8, true );
    19621962        }
    19631963
    1964         $check = $wp_hasher->CheckPassword($password, $hash);
     1964        $check = $wp_hasher->CheckPassword( $password, $hash );
    19651965
    19661966        /** This filter is documented in wp-includes/pluggable.php */
    19671967        return apply_filters( 'check_password', $check, $password, $hash, $user_id );
    19681968}
    19691969endif;
    19701970
    1971 if ( !function_exists('wp_generate_password') ) :
     1971if ( !function_exists( 'wp_generate_password' ) ) :
    19721972/**
    19731973 * Generates a random password drawn from the defined set of characters.
    19741974 *
     
    19891989
    19901990        $password = '';
    19911991        for ( $i = 0; $i < $length; $i++ ) {
    1992                 $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
     1992                $password .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 );
    19931993        }
    19941994
    19951995        /**
     
    20032003}
    20042004endif;
    20052005
    2006 if ( !function_exists('wp_rand') ) :
     2006if ( !function_exists( 'wp_rand' ) ) :
    20072007/**
    20082008 * Generates a random number
    20092009 *
     
    20182018
    20192019        // Reset $rnd_value after 14 uses
    20202020        // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
    2021         if ( strlen($rnd_value) < 8 ) {
     2021        if ( strlen( $rnd_value ) < 8 ) {
    20222022                if ( defined( 'WP_SETUP_CONFIG' ) )
    20232023                        static $seed = '';
    20242024                else
    2025                         $seed = get_transient('random_seed');
    2026                 $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
    2027                 $rnd_value .= sha1($rnd_value);
    2028                 $rnd_value .= sha1($rnd_value . $seed);
    2029                 $seed = md5($seed . $rnd_value);
     2025                        $seed = get_transient( 'random_seed' );
     2026                $rnd_value = md5( uniqid( microtime() . mt_rand(), true ) . $seed );
     2027                $rnd_value .= sha1( $rnd_value );
     2028                $rnd_value .= sha1( $rnd_value . $seed );
     2029                $seed = md5( $seed . $rnd_value );
    20302030                if ( ! defined( 'WP_SETUP_CONFIG' ) )
    2031                         set_transient('random_seed', $seed);
     2031                        set_transient( 'random_seed', $seed );
    20322032        }
    20332033
    20342034        // Take the first 8 digits for our value
    2035         $value = substr($rnd_value, 0, 8);
     2035        $value = substr( $rnd_value, 0, 8 );
    20362036
    20372037        // Strip the first eight, leaving the remainder for the next call to wp_rand().
    2038         $rnd_value = substr($rnd_value, 8);
     2038        $rnd_value = substr( $rnd_value, 8 );
    20392039
    2040         $value = abs(hexdec($value));
     2040        $value = abs( hexdec( $value ) );
    20412041
    20422042        // Some misconfigured 32bit environments (Entropy PHP, for example) truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
    20432043        $max_random_number = 3000000000 === 2147483647 ? (float) "4294967295" : 4294967295; // 4294967295 = 0xffffffff
     
    20462046        if ( $max != 0 )
    20472047                $value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
    20482048
    2049         return abs(intval($value));
     2049        return abs( intval( $value ) );
    20502050}
    20512051endif;
    20522052
    2053 if ( !function_exists('wp_set_password') ) :
     2053if ( !function_exists( 'wp_set_password' ) ) :
    20542054/**
    20552055 * Updates the user's password with a new encrypted one.
    20562056 *
     
    20722072        global $wpdb;
    20732073
    20742074        $hash = wp_hash_password( $password );
    2075         $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) );
     2075        $wpdb->update( $wpdb->users, array( 'user_pass' => $hash, 'user_activation_key' => '' ), array( 'ID' => $user_id ) );
    20762076
    2077         wp_cache_delete($user_id, 'users');
     2077        wp_cache_delete( $user_id, 'users' );
    20782078}
    20792079endif;
    20802080
     
    20912091 * @return string `<img>` tag for the user's avatar.
    20922092*/
    20932093function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
    2094         if ( ! get_option('show_avatars') )
     2094        if ( ! get_option( 'show_avatars' ) )
    20952095                return false;
    20962096
    2097         if ( false === $alt)
     2097        if ( false === $alt )
    20982098                $safe_alt = '';
    20992099        else
    21002100                $safe_alt = esc_attr( $alt );
    21012101
    2102         if ( !is_numeric($size) )
     2102        if ( !is_numeric( $size ) )
    21032103                $size = '96';
    21042104
    21052105        $email = '';
    2106         if ( is_numeric($id_or_email) ) {
     2106        if ( is_numeric( $id_or_email ) ) {
    21072107                $id = (int) $id_or_email;
    2108                 $user = get_userdata($id);
     2108                $user = get_userdata( $id );
    21092109                if ( $user )
    21102110                        $email = $user->user_email;
    2111         } elseif ( is_object($id_or_email) ) {
     2111        } elseif ( is_object( $id_or_email ) ) {
    21122112                // No avatar for pingbacks or trackbacks
    21132113
    21142114                /**
     
    21242124
    21252125                if ( ! empty( $id_or_email->user_id ) ) {
    21262126                        $id = (int) $id_or_email->user_id;
    2127                         $user = get_userdata($id);
     2127                        $user = get_userdata( $id );
    21282128                        if ( $user )
    21292129                                $email = $user->user_email;
    21302130                }
     
    21362136        }
    21372137
    21382138        if ( empty($default) ) {
    2139                 $avatar_default = get_option('avatar_default');
    2140                 if ( empty($avatar_default) )
     2139                $avatar_default = get_option( 'avatar_default' );
     2140                if ( empty( $avatar_default ) )
    21412141                        $default = 'mystery';
    21422142                else
    21432143                        $default = $avatar_default;
    21442144        }
    21452145
    2146         if ( !empty($email) )
     2146        if ( !empty( $email ) )
    21472147                $email_hash = md5( strtolower( trim( $email ) ) );
    21482148
    21492149        if ( is_ssl() ) {
    21502150                $host = 'https://secure.gravatar.com';
    21512151        } else {
    2152                 if ( !empty($email) )
     2152                if ( !empty( $email ) )
    21532153                        $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) );
    21542154                else
    21552155                        $host = 'http://0.gravatar.com';
     
    21592159                $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
    21602160        elseif ( 'blank' == $default )
    21612161                $default = $email ? 'blank' : includes_url( 'images/blank.gif' );
    2162         elseif ( !empty($email) && 'gravatar_default' == $default )
     2162        elseif ( !empty( $email ) && 'gravatar_default' == $default )
    21632163                $default = '';
    21642164        elseif ( 'gravatar_default' == $default )
    21652165                $default = "$host/avatar/?s={$size}";
    2166         elseif ( empty($email) )
     2166        elseif ( empty( $email ) )
    21672167                $default = "$host/avatar/?d=$default&amp;s={$size}";
    2168         elseif ( strpos($default, 'http://') === 0 )
     2168        elseif ( strpos( $default, 'http://' ) === 0 )
    21692169                $default = add_query_arg( 's', $size, $default );
    21702170
    2171         if ( !empty($email) ) {
     2171        if ( !empty( $email ) ) {
    21722172                $out = "$host/avatar/";
    21732173                $out .= $email_hash;
    21742174                $out .= '?s='.$size;
    21752175                $out .= '&amp;d=' . urlencode( $default );
    21762176
    2177                 $rating = get_option('avatar_rating');
     2177                $rating = get_option( 'avatar_rating' );
    21782178                if ( !empty( $rating ) )
    21792179                        $out .= "&amp;r={$rating}";
    21802180
     
    22352235        if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
    22362236                require( ABSPATH . WPINC . '/wp-diff.php' );
    22372237
    2238         $left_string  = normalize_whitespace($left_string);
    2239         $right_string = normalize_whitespace($right_string);
     2238        $left_string  = normalize_whitespace( $left_string );
     2239        $right_string = normalize_whitespace( $right_string );
    22402240
    2241         $left_lines  = explode("\n", $left_string);
    2242         $right_lines = explode("\n", $right_string);
    2243         $text_diff = new Text_Diff($left_lines, $right_lines);
     2241        $left_lines  = explode( "\n", $left_string );
     2242        $right_lines = explode( "\n", $right_string );
     2243        $text_diff = new Text_Diff( $left_lines, $right_lines );
    22442244        $renderer  = new WP_Text_Diff_Renderer_Table( $args );
    2245         $diff = $renderer->render($text_diff);
     2245        $diff = $renderer->render( $text_diff );
    22462246
    22472247        if ( !$diff )
    22482248                return '';