Make WordPress Core

Ticket #26148: 26148.2.patch

File 26148.2.patch, 8.3 KB (added by SergeyBiryukov, 12 years ago)
  • src/wp-includes/user.php

     
    2020 *
    2121 * @param array $credentials Optional. User info in order to sign on.
    2222 * @param bool $secure_cookie Optional. Whether to use secure cookie.
    23  * @return object Either WP_Error on failure, or WP_User on success.
     23 * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
    2424 */
    25 function wp_signon( $credentials = '', $secure_cookie = '' ) {
     25function wp_signon( $credentials = array(), $secure_cookie = '' ) {
    2626        if ( empty($credentials) ) {
    2727                if ( ! empty($_POST['log']) )
    2828                        $credentials['user_login'] = $_POST['log'];
     
    3737        else
    3838                $credentials['remember'] = false;
    3939
    40         // TODO do we deprecate the wp_authentication action?
    4140        /**
    4241         * Fires before the user is authenticated.
    4342         *
     
    101100
    102101/**
    103102 * Authenticate the user using the username and password.
     103 *
     104 * @since 2.8.0
     105 *
     106 * @param WP_User|WP_Error|null $user     WP_User or WP_Error object from a previous callback. Default null.
     107 * @param string                $username Username for authentication.
     108 * @param string                $password Password for authentication.
     109 * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
    104110 */
    105 add_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    106 function wp_authenticate_username_password($user, $username, $password) {
    107         if ( is_a($user, 'WP_User') ) { return $user; }
     111function wp_authenticate_username_password( $user, $username, $password ) {
     112        if ( is_a( $user, 'WP_User' ) ) {
     113                return $user;
     114        }
    108115
    109116        if ( empty($username) || empty($password) ) {
    110117                if ( is_wp_error( $user ) )
     
    148155
    149156/**
    150157 * Authenticate the user using the WordPress auth cookie.
     158 *
     159 * @since 2.8.0
     160 *
     161 * @param WP_User|WP_Error|null $user     WP_User or WP_Error object from a previous callback. Default null.
     162 * @param string                $username Username. If passed, cancels the cookie authentication.
     163 * @param string                $password Password. If passed, cancels the cookie authentication.
     164 * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
    151165 */
    152 function wp_authenticate_cookie($user, $username, $password) {
    153         if ( is_a($user, 'WP_User') ) { return $user; }
     166function wp_authenticate_cookie( $user, $username, $password ) {
     167        if ( is_a( $user, 'WP_User' ) ) {
     168                return $user;
     169        }
    154170
    155171        if ( empty($username) && empty($password) ) {
    156172                $user_id = wp_validate_auth_cookie();
     
    178194 * spammer, or if the user's primary blog has been marked as spam.
    179195 *
    180196 * @since 3.7.0
     197 *
     198 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null.
     199 * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer.
    181200 */
    182201function wp_authenticate_spam_check( $user ) {
    183202        if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) {
     
    201220 * Number of posts user has written.
    202221 *
    203222 * @since 3.0.0
    204  * @uses $wpdb WordPress database object for queries.
     223 * @global $wpdb WordPress database object for queries.
    205224 *
    206225 * @param int $userid User ID.
    207226 * @return int Amount of posts user has written.
     
    288307 * The option will first check for the per site name and then the per Network name.
    289308 *
    290309 * @since 2.0.0
    291  * @uses $wpdb WordPress database object for queries.
     310 * @global $wpdb WordPress database object for queries.
    292311 * @uses apply_filters() Calls 'get_user_option_$option' hook with result,
    293312 *              option parameter, and user data object.
    294313 *
     
    295314 * @param string $option User option name.
    296315 * @param int $user Optional. User ID.
    297316 * @param bool $deprecated Use get_option() to check for an option in the options table.
    298  * @return mixed
     317 * @return mixed User option value on success, false on failure.
    299318 */
    300319function get_user_option( $option, $user = 0, $deprecated = '' ) {
    301320        global $wpdb;
     
    341360 * Deletes the user option if $newvalue is empty.
    342361 *
    343362 * @since 2.0.0
    344  * @uses $wpdb WordPress database object for queries
     363 * @global $wpdb WordPress database object for queries.
    345364 *
    346  * @param int $user_id User ID
     365 * @param int $user_id User ID.
    347366 * @param string $option_name User option name.
    348367 * @param mixed $newvalue User option value.
    349368 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
    350  * @return unknown
     369 * @return int|bool User meta ID if the key didn't exist, true on successful update, false on failure.
    351370 */
    352371function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
    353372        global $wpdb;
     
    366385 * it will prepend the WordPress table prefix to the option name.
    367386 *
    368387 * @since 3.0.0
    369  * @uses $wpdb WordPress database object for queries
     388 * @global $wpdb WordPress database object for queries
    370389 *
    371390 * @param int $user_id User ID
    372391 * @param string $option_name User option name.
    373392 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
    374  * @return unknown
     393 * @return bool True on success, false on failure.
    375394 */
    376395function delete_user_option( $user_id, $option_name, $global = false ) {
    377396        global $wpdb;
     
    423442        var $query_limit;
    424443
    425444        /**
    426          * PHP5 constructor
     445         * PHP5 constructor.
    427446         *
    428447         * @since 3.1.0
    429448         *
    430          * @param string|array $args The query variables
     449         * @param string|array $args Optional. The query variables.
    431450         * @return WP_User_Query
    432451         */
    433452        function __construct( $query = null ) {
     
    438457        }
    439458
    440459        /**
    441          * Prepare the query variables
     460         * Prepare the query variables.
    442461         *
    443462         * @since 3.1.0
    444463         *
    445          * @param string|array $args The query variables
     464         * @param string|array $args Optional. The query variables.
    446465         */
    447466        function prepare_query( $query = array() ) {
    448467                global $wpdb;
     
    650669        }
    651670
    652671        /**
    653          * Execute the query, with the current variables
     672         * Execute the query, with the current variables.
    654673         *
    655674         * @since 3.1.0
     675         * @global $wpdb WordPress database object for queries.
    656676         */
    657677        function query() {
    658678                global $wpdb;
     
    755775        }
    756776
    757777        /**
    758          * Return the list of users
     778         * Return the list of users.
    759779         *
    760780         * @since 3.1.0
    761781         * @access public
     
    767787        }
    768788
    769789        /**
    770          * Return the total number of users for the current query
     790         * Return the total number of users for the current query.
    771791         *
    772792         * @since 3.1.0
    773793         * @access public
     
    783803 * Retrieve list of users matching criteria.
    784804 *
    785805 * @since 3.1.0
    786  * @uses $wpdb
    787806 * @uses WP_User_Query See for default arguments and information.
    788807 *
    789808 * @param array $args Optional.
     
    803822 * Get the blogs a user belongs to.
    804823 *
    805824 * @since 3.0.0
     825 * @global $wpdb WordPress database object for queries.
    806826 *
    807827 * @param int $user_id User ID
    808828 * @param bool $all Whether to retrieve all blogs, or only blogs that are not marked as deleted, archived, or spam.
     
    11511171 * </ol>
    11521172 *
    11531173 * @since 2.3.0
    1154  * @uses $wpdb WordPress database object for queries
     1174 * @global $wpdb WordPress database object for queries.
    11551175 *
    11561176 * @param string|array $args Optional. Override defaults.
    11571177 * @return string|null Null on display. String of HTML content on retrieve.
     
    13901410 * Checks whether the given email exists.
    13911411 *
    13921412 * @since 2.1.0
    1393  * @uses $wpdb
    13941413 *
    13951414 * @param string $email Email.
    13961415 * @return bool|int The user's ID on success, and false on failure.
     
    14571476 * 'yim' - User's Yahoo IM account.
    14581477 *
    14591478 * @since 2.0.0
    1460  * @uses $wpdb WordPress database layer.
     1479 * @global $wpdb WordPress database object for queries.
    14611480 * @uses apply_filters() Calls filters for most of the $userdata fields with the prefix 'pre_user'. See note above.
    14621481 * @uses do_action() Calls 'profile_update' hook when updating giving the user's ID
    14631482 * @uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID
     
    18381857 * hashing process. This field is now hashed; old values are no longer accepted
    18391858 * but have a different WP_Error code so good user feedback can be provided.
    18401859 *
    1841  * @uses $wpdb WordPress Database object
     1860 * @global $wpdb WordPress database object for queries.
    18421861 *
    18431862 * @param string $key       Hash to validate sending user's password.
    18441863 * @param string $login     The user login.