Ticket #2477: inline-docs-pluggable-funcs.diff
| File inline-docs-pluggable-funcs.diff, 6.1 KB (added by , 20 years ago) |
|---|
-
wp-includes/pluggable-functions.php
4 4 plugins are loaded. */ 5 5 6 6 if ( !function_exists('set_current_user') ) : 7 /** 8 * Populates global user information for any user 9 * Set $id to null and specify a name if you do not know a user's ID 10 * @param int $id ID of the user you would like to include 11 * @param string $name (optional) Name of the user to populate data with 12 * @return object WP_User instance 13 */ 7 14 function set_current_user($id, $name = '') { 8 15 global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; 9 16 … … 29 36 30 37 31 38 if ( !function_exists('get_currentuserinfo') ) : 39 /** 40 * Populate global variables with information about the currently logged in user 41 */ 32 42 function get_currentuserinfo() { 33 43 global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; 34 44 … … 55 65 endif; 56 66 57 67 if ( !function_exists('get_userdata') ) : 68 /** 69 * Get an object containing data about a user 70 * @param int $user_id 71 * @return object user data 72 */ 58 73 function get_userdata( $user_id ) { 59 74 global $wpdb; 60 75 $user_id = (int) $user_id; … … 102 117 endif; 103 118 104 119 if ( !function_exists('update_user_cache') ) : 120 /** 121 * Updates a users cache when overridden by a plugin, core function does nothing 122 */ 105 123 function update_user_cache() { 106 124 return true; 107 125 } 108 126 endif; 109 127 110 128 if ( !function_exists('get_userdatabylogin') ) : 129 /** 130 * Grabs some info about a user based on their login name 131 * @param string $user_login 132 * @return object user info 133 */ 111 134 function get_userdatabylogin($user_login) { 112 135 global $wpdb; 113 136 $user_login = sanitize_user( $user_login ); … … 156 179 endif; 157 180 158 181 if ( !function_exists('wp_mail') ) : 182 /** 183 * Function to send mail, similar to PHP's mail 184 * @param string $to outgoing email address 185 * @param string $subject subjecct of the mail 186 * @param string $message body of the mail 187 * @param string $headers (optional) Additional headers 188 * @return bool 189 */ 159 190 function wp_mail($to, $subject, $message, $headers = '') { 160 191 if( $headers == '' ) { 161 192 $headers = "MIME-Version: 1.0\n" . … … 168 199 endif; 169 200 170 201 if ( !function_exists('wp_login') ) : 202 /** 203 * Checks a users login information and logs them in if it checks out 204 * @param string $username 205 * @param string $password 206 * @param bool $already_md5 (optional, default false) if the password has already been md5 hashed 207 * @return bool 208 */ 171 209 function wp_login($username, $password, $already_md5 = false) { 172 210 global $wpdb, $error; 173 211 … … 200 238 endif; 201 239 202 240 if ( !function_exists('is_user_logged_in') ) : 241 /** 242 * Function to check if the current visitor is a logged in user 243 * @return bool 244 */ 203 245 function is_user_logged_in() { 204 246 global $current_user; 205 247 … … 210 252 endif; 211 253 212 254 if ( !function_exists('auth_redirect') ) : 255 /** 256 * Checks if a user is logged in, if not it redirects them to the login page 257 */ 213 258 function auth_redirect() { 214 // Checks if a user is logged in, if not redirects them to the login page215 259 if ( (!empty($_COOKIE[USER_COOKIE]) && 216 260 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || 217 261 (empty($_COOKIE[USER_COOKIE])) ) { … … 224 268 endif; 225 269 226 270 if ( !function_exists('check_admin_referer') ) : 271 /** 272 * Makes sure that a user was referred from another admin page, to avoid security exploits 273 */ 227 274 function check_admin_referer() { 228 275 $adminurl = strtolower(get_settings('siteurl')).'/wp-admin'; 229 276 $referer = strtolower($_SERVER['HTTP_REFERER']); … … 236 283 // Cookie safe redirect. Works around IIS Set-Cookie bug. 237 284 // http://support.microsoft.com/kb/q176113/ 238 285 if ( !function_exists('wp_redirect') ) : 286 /** 287 * Redirects to another page, with a workaround for the ISS Set-Cookie bug 288 * @param string $location 289 */ 239 290 function wp_redirect($location) { 240 291 global $is_IIS; 241 292 … … 249 300 endif; 250 301 251 302 if ( !function_exists('wp_setcookie') ) : 303 /** 304 * Sets a cookie for a user who just logged in 305 * @param string $username 306 * @param string $password 307 * @param bool $already_md5 if the password has already been md5 hashed 308 * @param string $home (optional) Will be used instead of COOKIEPATH if set 309 * @param string $siteurl (optional) Will be used instead of SITECOOKIEPATH if set 310 * @param bool $remember remember that the user is logged in 311 */ 252 312 function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '', $remember = false) { 253 313 if ( !$already_md5 ) 254 314 $password = md5( md5($password) ); // Double hash the password in the cookie. … … 282 342 endif; 283 343 284 344 if ( !function_exists('wp_clearcookie') ) : 345 /** 346 * Unsets a user's login cookies, effectively logging them out 347 */ 285 348 function wp_clearcookie() { 286 349 setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); 287 350 setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); … … 291 354 endif; 292 355 293 356 if ( ! function_exists('wp_notify_postauthor') ) : 357 /** 358 * Notify an author of a comment/trackback/pingback to one of their posts 359 * @param int $comment_id 360 * @param string $comment_type 361 * @return bool success 362 */ 294 363 function wp_notify_postauthor($comment_id, $comment_type='') { 295 364 global $wpdb; 296 365 … … 363 432 } 364 433 endif; 365 434 366 /* wp_notify_moderator 367 notifies the moderator of the blog (usually the admin) 368 about a new comment that waits for approval 369 always returns true 435 if ( !function_exists('wp_notify_moderator') ) : 436 /** 437 * Notifies the moderator of the blog about a new comment that is awaiting approval 438 * @param int $comment_id 439 * @return true 370 440 */ 371 if ( !function_exists('wp_notify_moderator') ) :372 441 function wp_notify_moderator($comment_id) { 373 442 global $wpdb; 374 443 … … 407 476 endif; 408 477 409 478 if ( !function_exists('wp_new_user_notification') ) : 479 /** 480 * Notify the blog admin of a new user, normally via email 481 * @param int $user_id 482 * @param string $plaintext_pass (optional) 483 */ 410 484 function wp_new_user_notification($user_id, $plaintext_pass = '') { 411 485 $user = new WP_User($user_id); 412 486