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