]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/pluggable-deprecated.php
WordPress 4.4.2-scripts
[autoinstalls/wordpress.git] / wp-includes / pluggable-deprecated.php
1 <?php
2 /**
3  * Deprecated pluggable functions from past WordPress versions. You shouldn't use these
4  * functions and look for the alternatives instead. The functions will be removed in a
5  * later version.
6  *
7  * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
8  *
9  * @package WordPress
10  * @subpackage Deprecated
11  * @see pluggable.php
12  */
13
14 /*
15  * Deprecated functions come here to die.
16  */
17
18 if ( !function_exists('set_current_user') ) :
19 /**
20  * Changes the current user by ID or name.
21  *
22  * Set $id to null and specify a name if you do not know a user's ID.
23  *
24  * @since 2.0.1
25  * @deprecated 3.0.0 Use wp_set_current_user()
26  * @see wp_set_current_user()
27  *
28  * @param int|null $id User ID.
29  * @param string $name Optional. The user's username
30  * @return WP_User returns wp_set_current_user()
31  */
32 function set_current_user($id, $name = '') {
33         _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
34         return wp_set_current_user($id, $name);
35 }
36 endif;
37
38 if ( !function_exists('get_userdatabylogin') ) :
39 /**
40  * Retrieve user info by login name.
41  *
42  * @since 0.71
43  * @deprecated 3.3.0 Use get_user_by()
44  * @see get_user_by()
45  *
46  * @param string $user_login User's username
47  * @return bool|object False on failure, User DB row object
48  */
49 function get_userdatabylogin($user_login) {
50         _deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
51         return get_user_by('login', $user_login);
52 }
53 endif;
54
55 if ( !function_exists('get_user_by_email') ) :
56 /**
57  * Retrieve user info by email.
58  *
59  * @since 2.5.0
60  * @deprecated 3.3.0 Use get_user_by()
61  * @see get_user_by()
62  *
63  * @param string $email User's email address
64  * @return bool|object False on failure, User DB row object
65  */
66 function get_user_by_email($email) {
67         _deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
68         return get_user_by('email', $email);
69 }
70 endif;
71
72 if ( !function_exists('wp_setcookie') ) :
73 /**
74  * Sets a cookie for a user who just logged in. This function is deprecated.
75  *
76  * @since 1.5.0
77  * @deprecated 2.5.0 Use wp_set_auth_cookie()
78  * @see wp_set_auth_cookie()
79  *
80  * @param string $username The user's username
81  * @param string $password Optional. The user's password
82  * @param bool $already_md5 Optional. Whether the password has already been through MD5
83  * @param string $home Optional. Will be used instead of COOKIEPATH if set
84  * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
85  * @param bool $remember Optional. Remember that the user is logged in
86  */
87 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
88         _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
89         $user = get_user_by('login', $username);
90         wp_set_auth_cookie($user->ID, $remember);
91 }
92 else :
93         _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
94 endif;
95
96 if ( !function_exists('wp_clearcookie') ) :
97 /**
98  * Clears the authentication cookie, logging the user out. This function is deprecated.
99  *
100  * @since 1.5.0
101  * @deprecated 2.5.0 Use wp_clear_auth_cookie()
102  * @see wp_clear_auth_cookie()
103  */
104 function wp_clearcookie() {
105         _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
106         wp_clear_auth_cookie();
107 }
108 else :
109         _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
110 endif;
111
112 if ( !function_exists('wp_get_cookie_login') ):
113 /**
114  * Gets the user cookie login. This function is deprecated.
115  *
116  * This function is deprecated and should no longer be extended as it won't be
117  * used anywhere in WordPress. Also, plugins shouldn't use it either.
118  *
119  * @since 2.0.3
120  * @deprecated 2.5.0
121  *
122  * @return bool Always returns false
123  */
124 function wp_get_cookie_login() {
125         _deprecated_function( __FUNCTION__, '2.5' );
126         return false;
127 }
128 else :
129         _deprecated_function( 'wp_get_cookie_login', '2.5' );
130 endif;
131
132 if ( !function_exists('wp_login') ) :
133 /**
134  * Checks a users login information and logs them in if it checks out. This function is deprecated.
135  *
136  * Use the global $error to get the reason why the login failed. If the username
137  * is blank, no error will be set, so assume blank username on that case.
138  *
139  * Plugins extending this function should also provide the global $error and set
140  * what the error is, so that those checking the global for why there was a
141  * failure can utilize it later.
142  *
143  * @since 1.2.2
144  * @deprecated 2.5.0 Use wp_signon()
145  * @see wp_signon()
146  *
147  * @global string $error Error when false is returned
148  *
149  * @param string $username   User's username
150  * @param string $password   User's password
151  * @param string $deprecated Not used
152  * @return bool False on login failure, true on successful check
153  */
154 function wp_login($username, $password, $deprecated = '') {
155         _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
156         global $error;
157
158         $user = wp_authenticate($username, $password);
159
160         if ( ! is_wp_error($user) )
161                 return true;
162
163         $error = $user->get_error_message();
164         return false;
165 }
166 else :
167         _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
168 endif;
169
170 /**
171  * WordPress AtomPub API implementation.
172  *
173  * Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
174  * It is kept here in case a plugin directly referred to the class.
175  *
176  * @since 2.2.0
177  * @deprecated 3.5.0
178  *
179  * @link https://wordpress.org/plugins/atom-publishing-protocol/
180  */
181 if ( ! class_exists( 'wp_atom_server', false ) ) {
182         class wp_atom_server {
183                 public function __call( $name, $arguments ) {
184                         _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
185                 }
186
187                 public static function __callStatic( $name, $arguments ) {
188                         _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
189                 }
190         }
191 }