]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/pluggable-deprecated.php
WordPress 4.2.5-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  * @see wp_set_current_user() An alias of wp_set_current_user()
26  * @deprecated 3.0.0
27  * @deprecated Use wp_set_current_user()
28  *
29  * @param int|null $id User ID.
30  * @param string $name Optional. The user's username
31  * @return WP_User returns wp_set_current_user()
32  */
33 function set_current_user($id, $name = '') {
34         _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
35         return wp_set_current_user($id, $name);
36 }
37 endif;
38
39 if ( !function_exists('get_userdatabylogin') ) :
40 /**
41  * Retrieve user info by login name.
42  *
43  * @since 0.71
44  * @deprecated 3.3.0
45  * @deprecated Use get_user_by('login')
46  *
47  * @param string $user_login User's username
48  * @return bool|object False on failure, User DB row object
49  */
50 function get_userdatabylogin($user_login) {
51         _deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
52         return get_user_by('login', $user_login);
53 }
54 endif;
55
56 if ( !function_exists('get_user_by_email') ) :
57 /**
58  * Retrieve user info by email.
59  *
60  * @since 2.5.0
61  * @deprecated 3.3.0
62  * @deprecated Use get_user_by('email')
63  *
64  * @param string $email User's email address
65  * @return bool|object False on failure, User DB row object
66  */
67 function get_user_by_email($email) {
68         _deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
69         return get_user_by('email', $email);
70 }
71 endif;
72
73 if ( !function_exists('wp_setcookie') ) :
74 /**
75  * Sets a cookie for a user who just logged in. This function is deprecated.
76  *
77  * @since 1.5.0
78  * @deprecated 2.5.0
79  * @deprecated Use wp_set_auth_cookie()
80  * @see wp_set_auth_cookie()
81  *
82  * @param string $username The user's username
83  * @param string $password Optional. The user's password
84  * @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
86  * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
87  * @param bool $remember Optional. Remember that the user is logged in
88  */
89 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
90         _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
91         $user = get_user_by('login', $username);
92         wp_set_auth_cookie($user->ID, $remember);
93 }
94 else :
95         _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
96 endif;
97
98 if ( !function_exists('wp_clearcookie') ) :
99 /**
100  * Clears the authentication cookie, logging the user out. This function is deprecated.
101  *
102  * @since 1.5.0
103  * @deprecated 2.5.0
104  * @deprecated Use wp_clear_auth_cookie()
105  * @see wp_clear_auth_cookie()
106  */
107 function wp_clearcookie() {
108         _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
109         wp_clear_auth_cookie();
110 }
111 else :
112         _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
113 endif;
114
115 if ( !function_exists('wp_get_cookie_login') ):
116 /**
117  * Gets the user cookie login. This function is deprecated.
118  *
119  * 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.
121  *
122  * @since 2.0.3
123  * @deprecated 2.5.0
124  * @deprecated No alternative
125  *
126  * @return bool Always returns false
127  */
128 function wp_get_cookie_login() {
129         _deprecated_function( __FUNCTION__, '2.5' );
130         return false;
131 }
132 else :
133         _deprecated_function( 'wp_get_cookie_login', '2.5' );
134 endif;
135
136 if ( !function_exists('wp_login') ) :
137 /**
138  * Checks a users login information and logs them in if it checks out. This function is deprecated.
139  *
140  * Use the global $error to get the reason why the login failed. If the username
141  * is blank, no error will be set, so assume blank username on that case.
142  *
143  * 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
145  * failure can utilize it later.
146  *
147  * @since 1.2.2
148  * @deprecated Use wp_signon()
149  * @global string $error Error when false is returned
150  *
151  * @param string $username   User's username
152  * @param string $password   User's password
153  * @param string $deprecated Not used
154  * @return bool False on login failure, true on successful check
155  */
156 function wp_login($username, $password, $deprecated = '') {
157         _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
158         global $error;
159
160         $user = wp_authenticate($username, $password);
161
162         if ( ! is_wp_error($user) )
163                 return true;
164
165         $error = $user->get_error_message();
166         return false;
167 }
168 else :
169         _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
170 endif;
171
172 /**
173  * WordPress AtomPub API implementation.
174  *
175  * 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.
177  *
178  * @since 2.2.0
179  * @deprecated 3.5.0
180  * @link https://wordpress.org/plugins/atom-publishing-protocol/
181  */
182 if ( ! class_exists( 'wp_atom_server' ) ) {
183         class wp_atom_server {
184                 public function __call( $name, $arguments ) {
185                         _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
186                 }
187
188                 public static function __callStatic( $name, $arguments ) {
189                         _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
190                 }
191         }
192 }