wp/wp-includes/pluggable-deprecated.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    20  * Changes the current user by ID or name.
    20  * Changes the current user by ID or name.
    21  *
    21  *
    22  * Set $id to null and specify a name if you do not know a user's ID.
    22  * Set $id to null and specify a name if you do not know a user's ID.
    23  *
    23  *
    24  * @since 2.0.1
    24  * @since 2.0.1
    25  * @see wp_set_current_user() An alias of wp_set_current_user()
    25  * @deprecated 3.0.0 Use wp_set_current_user()
    26  * @deprecated 3.0.0
    26  * @see wp_set_current_user()
    27  * @deprecated Use wp_set_current_user()
       
    28  *
    27  *
    29  * @param int|null $id User ID.
    28  * @param int|null $id User ID.
    30  * @param string $name Optional. The user's username
    29  * @param string $name Optional. The user's username
    31  * @return WP_User returns wp_set_current_user()
    30  * @return WP_User returns wp_set_current_user()
    32  */
    31  */
    33 function set_current_user($id, $name = '') {
    32 function set_current_user($id, $name = '') {
    34 	_deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
    33 	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
    35 	return wp_set_current_user($id, $name);
    34 	return wp_set_current_user($id, $name);
    36 }
    35 }
    37 endif;
    36 endif;
    38 
    37 
       
    38 if ( !function_exists('get_currentuserinfo') ) :
       
    39 /**
       
    40  * Populate global variables with information about the currently logged in user.
       
    41  *
       
    42  * @since 0.71
       
    43  * @deprecated 4.5.0 Use wp_get_current_user()
       
    44  * @see wp_get_current_user()
       
    45  *
       
    46  * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise.
       
    47  */
       
    48 function get_currentuserinfo() {
       
    49 	_deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' );
       
    50 
       
    51 	return _wp_get_current_user();
       
    52 }
       
    53 endif;
       
    54 
    39 if ( !function_exists('get_userdatabylogin') ) :
    55 if ( !function_exists('get_userdatabylogin') ) :
    40 /**
    56 /**
    41  * Retrieve user info by login name.
    57  * Retrieve user info by login name.
    42  *
    58  *
    43  * @since 0.71
    59  * @since 0.71
    44  * @deprecated 3.3.0
    60  * @deprecated 3.3.0 Use get_user_by()
    45  * @deprecated Use get_user_by('login')
    61  * @see get_user_by()
    46  *
    62  *
    47  * @param string $user_login User's username
    63  * @param string $user_login User's username
    48  * @return bool|object False on failure, User DB row object
    64  * @return bool|object False on failure, User DB row object
    49  */
    65  */
    50 function get_userdatabylogin($user_login) {
    66 function get_userdatabylogin($user_login) {
    51 	_deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
    67 	_deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" );
    52 	return get_user_by('login', $user_login);
    68 	return get_user_by('login', $user_login);
    53 }
    69 }
    54 endif;
    70 endif;
    55 
    71 
    56 if ( !function_exists('get_user_by_email') ) :
    72 if ( !function_exists('get_user_by_email') ) :
    57 /**
    73 /**
    58  * Retrieve user info by email.
    74  * Retrieve user info by email.
    59  *
    75  *
    60  * @since 2.5.0
    76  * @since 2.5.0
    61  * @deprecated 3.3.0
    77  * @deprecated 3.3.0 Use get_user_by()
    62  * @deprecated Use get_user_by('email')
    78  * @see get_user_by()
    63  *
    79  *
    64  * @param string $email User's email address
    80  * @param string $email User's email address
    65  * @return bool|object False on failure, User DB row object
    81  * @return bool|object False on failure, User DB row object
    66  */
    82  */
    67 function get_user_by_email($email) {
    83 function get_user_by_email($email) {
    68 	_deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
    84 	_deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" );
    69 	return get_user_by('email', $email);
    85 	return get_user_by('email', $email);
    70 }
    86 }
    71 endif;
    87 endif;
    72 
    88 
    73 if ( !function_exists('wp_setcookie') ) :
    89 if ( !function_exists('wp_setcookie') ) :
    74 /**
    90 /**
    75  * Sets a cookie for a user who just logged in. This function is deprecated.
    91  * Sets a cookie for a user who just logged in. This function is deprecated.
    76  *
    92  *
    77  * @since 1.5.0
    93  * @since 1.5.0
    78  * @deprecated 2.5.0
    94  * @deprecated 2.5.0 Use wp_set_auth_cookie()
    79  * @deprecated Use wp_set_auth_cookie()
       
    80  * @see wp_set_auth_cookie()
    95  * @see wp_set_auth_cookie()
    81  *
    96  *
    82  * @param string $username The user's username
    97  * @param string $username The user's username
    83  * @param string $password Optional. The user's password
    98  * @param string $password Optional. The user's password
    84  * @param bool $already_md5 Optional. Whether the password has already been through MD5
    99  * @param bool $already_md5 Optional. Whether the password has already been through MD5
    85  * @param string $home Optional. Will be used instead of COOKIEPATH if set
   100  * @param string $home Optional. Will be used instead of COOKIEPATH if set
    86  * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
   101  * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
    87  * @param bool $remember Optional. Remember that the user is logged in
   102  * @param bool $remember Optional. Remember that the user is logged in
    88  */
   103  */
    89 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
   104 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
    90 	_deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
   105 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' );
    91 	$user = get_user_by('login', $username);
   106 	$user = get_user_by('login', $username);
    92 	wp_set_auth_cookie($user->ID, $remember);
   107 	wp_set_auth_cookie($user->ID, $remember);
    93 }
   108 }
    94 else :
   109 else :
    95 	_deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
   110 	_deprecated_function( 'wp_setcookie', '2.5.0', 'wp_set_auth_cookie()' );
    96 endif;
   111 endif;
    97 
   112 
    98 if ( !function_exists('wp_clearcookie') ) :
   113 if ( !function_exists('wp_clearcookie') ) :
    99 /**
   114 /**
   100  * Clears the authentication cookie, logging the user out. This function is deprecated.
   115  * Clears the authentication cookie, logging the user out. This function is deprecated.
   101  *
   116  *
   102  * @since 1.5.0
   117  * @since 1.5.0
   103  * @deprecated 2.5.0
   118  * @deprecated 2.5.0 Use wp_clear_auth_cookie()
   104  * @deprecated Use wp_clear_auth_cookie()
       
   105  * @see wp_clear_auth_cookie()
   119  * @see wp_clear_auth_cookie()
   106  */
   120  */
   107 function wp_clearcookie() {
   121 function wp_clearcookie() {
   108 	_deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
   122 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' );
   109 	wp_clear_auth_cookie();
   123 	wp_clear_auth_cookie();
   110 }
   124 }
   111 else :
   125 else :
   112 	_deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
   126 	_deprecated_function( 'wp_clearcookie', '2.5.0', 'wp_clear_auth_cookie()' );
   113 endif;
   127 endif;
   114 
   128 
   115 if ( !function_exists('wp_get_cookie_login') ):
   129 if ( !function_exists('wp_get_cookie_login') ):
   116 /**
   130 /**
   117  * Gets the user cookie login. This function is deprecated.
   131  * Gets the user cookie login. This function is deprecated.
   119  * This function is deprecated and should no longer be extended as it won't be
   133  * This function is deprecated and should no longer be extended as it won't be
   120  * used anywhere in WordPress. Also, plugins shouldn't use it either.
   134  * used anywhere in WordPress. Also, plugins shouldn't use it either.
   121  *
   135  *
   122  * @since 2.0.3
   136  * @since 2.0.3
   123  * @deprecated 2.5.0
   137  * @deprecated 2.5.0
   124  * @deprecated No alternative
       
   125  *
   138  *
   126  * @return bool Always returns false
   139  * @return bool Always returns false
   127  */
   140  */
   128 function wp_get_cookie_login() {
   141 function wp_get_cookie_login() {
   129 	_deprecated_function( __FUNCTION__, '2.5' );
   142 	_deprecated_function( __FUNCTION__, '2.5.0' );
   130 	return false;
   143 	return false;
   131 }
   144 }
   132 else :
   145 else :
   133 	_deprecated_function( 'wp_get_cookie_login', '2.5' );
   146 	_deprecated_function( 'wp_get_cookie_login', '2.5.0' );
   134 endif;
   147 endif;
   135 
   148 
   136 if ( !function_exists('wp_login') ) :
   149 if ( !function_exists('wp_login') ) :
   137 /**
   150 /**
   138  * Checks a users login information and logs them in if it checks out. This function is deprecated.
   151  * Checks a users login information and logs them in if it checks out. This function is deprecated.
   143  * Plugins extending this function should also provide the global $error and set
   156  * Plugins extending this function should also provide the global $error and set
   144  * what the error is, so that those checking the global for why there was a
   157  * what the error is, so that those checking the global for why there was a
   145  * failure can utilize it later.
   158  * failure can utilize it later.
   146  *
   159  *
   147  * @since 1.2.2
   160  * @since 1.2.2
   148  * @deprecated Use wp_signon()
   161  * @deprecated 2.5.0 Use wp_signon()
       
   162  * @see wp_signon()
       
   163  *
   149  * @global string $error Error when false is returned
   164  * @global string $error Error when false is returned
   150  *
   165  *
   151  * @param string $username   User's username
   166  * @param string $username   User's username
   152  * @param string $password   User's password
   167  * @param string $password   User's password
   153  * @param string $deprecated Not used
   168  * @param string $deprecated Not used
   154  * @return bool False on login failure, true on successful check
   169  * @return bool False on login failure, true on successful check
   155  */
   170  */
   156 function wp_login($username, $password, $deprecated = '') {
   171 function wp_login($username, $password, $deprecated = '') {
   157 	_deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
   172 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' );
   158 	global $error;
   173 	global $error;
   159 
   174 
   160 	$user = wp_authenticate($username, $password);
   175 	$user = wp_authenticate($username, $password);
   161 
   176 
   162 	if ( ! is_wp_error($user) )
   177 	if ( ! is_wp_error($user) )
   164 
   179 
   165 	$error = $user->get_error_message();
   180 	$error = $user->get_error_message();
   166 	return false;
   181 	return false;
   167 }
   182 }
   168 else :
   183 else :
   169 	_deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
   184 	_deprecated_function( 'wp_login', '2.5.0', 'wp_signon()' );
   170 endif;
   185 endif;
   171 
   186 
   172 /**
   187 /**
   173  * WordPress AtomPub API implementation.
   188  * WordPress AtomPub API implementation.
   174  *
   189  *
   175  * Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
   190  * Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
   176  * It is kept here in case a plugin directly referred to the class.
   191  * It is kept here in case a plugin directly referred to the class.
   177  *
   192  *
   178  * @since 2.2.0
   193  * @since 2.2.0
   179  * @deprecated 3.5.0
   194  * @deprecated 3.5.0
       
   195  *
   180  * @link https://wordpress.org/plugins/atom-publishing-protocol/
   196  * @link https://wordpress.org/plugins/atom-publishing-protocol/
   181  */
   197  */
   182 if ( ! class_exists( 'wp_atom_server' ) ) {
   198 if ( ! class_exists( 'wp_atom_server', false ) ) {
   183 	class wp_atom_server {
   199 	class wp_atom_server {
   184 		public function __call( $name, $arguments ) {
   200 		public function __call( $name, $arguments ) {
   185 			_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
   201 			_deprecated_function( __CLASS__ . '::' . $name, '3.5.0', 'the Atom Publishing Protocol plugin' );
   186 		}
   202 		}
   187 
   203 
   188 		public static function __callStatic( $name, $arguments ) {
   204 		public static function __callStatic( $name, $arguments ) {
   189 			_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
   205 			_deprecated_function( __CLASS__ . '::' . $name, '3.5.0', 'the Atom Publishing Protocol plugin' );
   190 		}
   206 		}
   191 	}
   207 	}
   192 }
   208 }