You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

209 lines
6.1 KiB

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