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