Ticket #26888: 26888.diff
File 26888.diff, 24.2 KB (added by , 11 years ago) |
---|
-
src/wp-includes/pluggable.php
18 18 * 19 19 * @since 2.0.3 20 20 * @global object $current_user The current user object which holds the user data. 21 * @uses do_action() Calls 'set_current_user' hook after setting the current user.22 21 * 23 22 * @param int $id User ID 24 23 * @param string $name User's username … … 34 33 35 34 setup_userdata( $current_user->ID ); 36 35 37 do_action('set_current_user'); 36 /** 37 * Fires after the current user is set. 38 * 39 * @since 2.0.1 40 */ 41 do_action( 'set_current_user' ); 38 42 39 43 return $current_user; 40 44 } … … 204 208 * be set using the 'wp_mail_charset' filter. 205 209 * 206 210 * @since 1.2.1 207 * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters. 208 * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address. 209 * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name. 210 * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type. 211 * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset 212 * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to 213 * phpmailer object. 211 * 214 212 * @uses PHPMailer 215 213 * 216 214 * @param string|array $to Array or comma-separated list of email addresses to send message. … … 222 220 */ 223 221 function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { 224 222 // Compact the input, apply the filters, and extract them back out 223 /** 224 * Filter the wp_mail() arguments. 225 * 226 * @since 2.2.0 227 * 228 * @param array $args A compacted array of wp_mail() arguments, including the "to" email, subject, message, 229 * headers, and attachments values. 230 */ 225 231 extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) ); 226 232 227 233 if ( !is_array($attachments) ) … … 342 348 $from_email = 'wordpress@' . $sitename; 343 349 } 344 350 345 // Plugin authors can override the potentially troublesome default 346 $phpmailer->From = apply_filters( 'wp_mail_from' , $from_email ); 351 /** 352 * Filter the email address to send from. 353 * 354 * @since 2.2.0 355 * 356 * @param string $from_email Email address to send from. 357 */ 358 $phpmailer->From = apply_filters( 'wp_mail_from', $from_email ); 359 360 /** 361 * Filter the name to associate with the "from" email address. 362 * 363 * @since 2.3.0 364 * 365 * @param string $from_name Name associated with the "from" email address. 366 */ 347 367 $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name ); 348 368 349 369 // Set destination addresses … … 415 435 if ( !isset( $content_type ) ) 416 436 $content_type = 'text/plain'; 417 437 438 /** 439 * Filter the wp_mail() content type. 440 * 441 * @since 2.3.0 442 * 443 * @param string $content_type Default wp_mail() content type. 444 */ 418 445 $content_type = apply_filters( 'wp_mail_content_type', $content_type ); 419 446 420 447 $phpmailer->ContentType = $content_type; … … 428 455 $charset = get_bloginfo( 'charset' ); 429 456 430 457 // Set the content-type and charset 458 459 /** 460 * Filter the default wp_mail() charset. 461 * 462 * @since 2.3.0 463 * 464 * @param string $charset Default email charset. 465 */ 431 466 $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); 432 467 433 468 // Set custom headers … … 450 485 } 451 486 } 452 487 488 /** 489 * Fires after PHPMailer is initialized. 490 * 491 * @since 2.2.0 492 * 493 * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference. 494 */ 453 495 do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); 454 496 455 497 // Send! … … 475 517 $username = sanitize_user($username); 476 518 $password = trim($password); 477 519 520 /** 521 * Filter the user to authenticate. 522 * 523 * If a non-null value is passed, the filter will effectively short-circuit 524 * authentication, returning an error instead. 525 * 526 * @since 2.8.0 527 * 528 * @param null|WP_User $user User to authenticate. 529 * @param string $username User login. 530 * @param string $password User password 531 */ 478 532 $user = apply_filters('authenticate', null, $username, $password); 479 533 480 534 if ( $user == null ) { … … 486 540 $ignore_codes = array('empty_username', 'empty_password'); 487 541 488 542 if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) { 489 do_action('wp_login_failed', $username); 543 /** 544 * Fires after a user login as failed. 545 * 546 * @since 2.5.0 547 * 548 * @param string $username User login. 549 */ 550 do_action( 'wp_login_failed', $username ); 490 551 } 491 552 492 553 return $user; … … 501 562 */ 502 563 function wp_logout() { 503 564 wp_clear_auth_cookie(); 504 do_action('wp_logout'); 565 566 /** 567 * Fires after a user is logged-out. 568 * 569 * @since 1.5.0 570 */ 571 do_action( 'wp_logout' ); 505 572 } 506 573 endif; 507 574 … … 523 590 */ 524 591 function wp_validate_auth_cookie($cookie = '', $scheme = '') { 525 592 if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) { 526 do_action('auth_cookie_malformed', $cookie, $scheme); 593 /** 594 * Fires if an authentication cookie is malformed. 595 * 596 * @since 2.7.0 597 * 598 * @param string $cookie Malformed auth cookie. 599 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth', 600 * or 'logged_in'. 601 */ 602 do_action( 'auth_cookie_malformed', $cookie, $scheme ); 527 603 return false; 528 604 } 529 605 … … 537 613 538 614 // Quick check to see if an honest cookie has expired 539 615 if ( $expired < time() ) { 540 do_action('auth_cookie_expired', $cookie_elements); 616 /** 617 * Fires once an authentication cookie has expired. 618 * 619 * @since 2.7.0 620 * 621 * @param array $cookie_elements Array of data for the authentication cookie. 622 */ 623 do_action( 'auth_cookie_expired', $cookie_elements ); 541 624 return false; 542 625 } 543 626 544 627 $user = get_user_by('login', $username); 545 628 if ( ! $user ) { 546 do_action('auth_cookie_bad_username', $cookie_elements); 629 /** 630 * Fires if a bad username is entered in the user authentication process. 631 * 632 * @since 2.7.0 633 * 634 * @param array $cookie_elements Array of data for the authentication cookie. 635 */ 636 do_action( 'auth_cookie_bad_username', $cookie_elements ); 547 637 return false; 548 638 } 549 639 … … 553 643 $hash = hash_hmac('md5', $username . '|' . $expiration, $key); 554 644 555 645 if ( $hmac != $hash ) { 556 do_action('auth_cookie_bad_hash', $cookie_elements); 646 /** 647 * Fires if a bad authentication cookie hash is encountered. 648 * 649 * @since 2.7.0 650 * 651 * @param array $cookie_elements Array of data for the authentication cookie. 652 */ 653 do_action( 'auth_cookie_bad_hash', $cookie_elements ); 557 654 return false; 558 655 } 559 656 560 657 if ( $expiration < time() ) // AJAX/POST grace period set above 561 658 $GLOBALS['login_grace_period'] = 1; 562 659 563 do_action('auth_cookie_valid', $cookie_elements, $user); 660 /** 661 * Fires once an authentication cookie has been validated. 662 * 663 * @since 2.7.0 664 * 665 * @param array $cookie_elements Array of data for the authentication cookie. 666 * @param WP_User $user User object. 667 */ 668 do_action( 'auth_cookie_valid', $cookie_elements, $user ); 564 669 565 670 return $user->ID; 566 671 } … … 572 677 * 573 678 * @since 2.5.0 574 679 * 575 * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID576 * and expiration of cookie.577 *578 680 * @param int $user_id User ID 579 681 * @param int $expiration Cookie expiration in seconds 580 682 * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in … … 590 692 591 693 $cookie = $user->user_login . '|' . $expiration . '|' . $hash; 592 694 593 return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme); 695 /** 696 * Filter the authentication cookie. 697 * 698 * @since 2.5.0 699 * 700 * @param string $cookie Authentication cookie. 701 * @param int $user_id User ID. 702 * @param int $expiration Authentication cookie expiration in seconds. 703 * @param string $scheme Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'. 704 */ 705 return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme ); 594 706 } 595 707 endif; 596 708 … … 656 768 */ 657 769 function wp_set_auth_cookie($user_id, $remember = false, $secure = '') { 658 770 if ( $remember ) { 659 $expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember); 660 // Ensure the browser will continue to send the cookie after the expiration time is reached. 661 // Needed for the login grace period in wp_validate_auth_cookie(). 771 /** 772 * Filter the length of the authentication cookie expiration period. 773 * 774 * @since 2.8.0 775 * 776 * @param int $length Length of the expiration period in seconds. 777 * @param int $user_id User ID. 778 * @param bool $remember Whether to remember the user login. Default false. 779 */ 780 $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember ); 781 782 /* 783 * Ensure the browser will continue to send the cookie after the expiration time is reached. 784 * Needed for the login grace period in wp_validate_auth_cookie(). 785 */ 662 786 $expire = $expiration + ( 12 * HOUR_IN_SECONDS ); 663 787 } else { 664 $expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember); 788 /** This filter is documented in wp-includes/pluggable.php */ 789 $expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember ); 665 790 $expire = 0; 666 791 } 667 792 668 793 if ( '' === $secure ) 669 794 $secure = is_ssl(); 670 795 671 $secure = apply_filters('secure_auth_cookie', $secure, $user_id); 672 $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure); 796 /** 797 * Filter whether to use a secure authentication cookie. 798 * 799 * @since 3.1.0 800 * 801 * @param bool $secure Whether to use a secure auth cookie. Default is value of is_ssl 802 * or false. 803 * @param int $user_id User ID. 804 */ 805 $secure = apply_filters( 'secure_auth_cookie', $secure, $user_id ); 673 806 807 /** 808 * Filter the secure logged-in cookie. 809 * 810 * @since 3.1.0 811 * 812 * @param bool|string $cookie The secure logged-in cookie. Default false. 813 * @param int $user_id User ID. 814 * @param bool $secure Whether to use a secure auth cookie. Default is value 815 * of is_ssl() or false. 816 */ 817 $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', false, $user_id, $secure ); 818 674 819 if ( $secure ) { 675 820 $auth_cookie_name = SECURE_AUTH_COOKIE; 676 821 $scheme = 'secure_auth'; … … 682 827 $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme); 683 828 $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in'); 684 829 685 do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme); 686 do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in'); 830 /** 831 * Fires immediately before the authentication cookie is set. 832 * 833 * @since 2.5.0 834 * 835 * @param string $auth_cookie Authentication cookie. 836 * @param int $expire Login grace period in seconds. Default 43,200 seconds or 12 hours. 837 * @param int $expiration Duration in seconds the authentication cookie should be valid. 838 * Default 1,209,600 seconds or 14 days. 839 * @param int $user_id User ID. 840 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'. 841 */ 842 do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme ); 687 843 844 /** 845 * Fires immediate before the secure authentication cookie is set. 846 * 847 * @since 2.6.0 848 * 849 * @param string $logged_in_cookie The logged-in cookie. 850 * @param int $expire Login grace period in seconds. Default 43,200 seconds or 12 hours. 851 * @param int $expiration Duration in seconds the authentication cookie should be valid. 852 * Default 1,209,600 seconds or 14 days. 853 * @param int $user_id User ID. 854 * @param string $scheme Authentication scheme. Default 'logged_in'. 855 */ 856 do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' ); 857 688 858 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 689 859 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 690 860 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); … … 700 870 * @since 2.5.0 701 871 */ 702 872 function wp_clear_auth_cookie() { 703 do_action('clear_auth_cookie'); 873 /** 874 * Fires just before the authentication cookie is cleared. 875 * 876 * @since 2.7.0 877 */ 878 do_action( 'clear_auth_cookie' ); 704 879 705 880 setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); 706 881 setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); … … 752 927 753 928 $secure = ( is_ssl() || force_ssl_admin() ); 754 929 755 $secure = apply_filters('secure_auth_redirect', $secure); 930 /** 931 * Filter whether to use a secure authentication redirect. 932 * 933 * @since 3.1.0 934 * 935 * @param bool $secure Whether to use a secure authentication redirect. Default false. 936 */ 937 $secure = apply_filters( 'secure_auth_redirect', $secure ); 756 938 757 939 // If https is required and request is http, redirect 758 940 if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { … … 765 947 } 766 948 } 767 949 768 if ( is_user_admin() ) 950 if ( is_user_admin() ) { 769 951 $scheme = 'logged_in'; 770 else 952 } else { 953 /** 954 * Filter the authentication redirect scheme. 955 * 956 * @since 2.9.0 957 * 958 * @param string $scheme Autentication redirect scheme. Default empty. 959 */ 771 960 $scheme = apply_filters( 'auth_redirect_scheme', '' ); 961 } 772 962 773 963 if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) { 774 do_action('auth_redirect', $user_id); 964 /** 965 * Fires before the authentication redirect. 966 * 967 * @since 2.8.0 968 * 969 * @param int $user_id User ID. 970 */ 971 do_action( 'auth_redirect', $user_id ); 775 972 776 973 // If the user wants ssl but the session is not ssl, redirect. 777 974 if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) { … … 806 1003 * To avoid security exploits. 807 1004 * 808 1005 * @since 1.2.0 809 * @uses do_action() Calls 'check_admin_referer' on $action.810 1006 * 811 1007 * @param string $action Action nonce 812 1008 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) … … 822 1018 wp_nonce_ays($action); 823 1019 die(); 824 1020 } 825 do_action('check_admin_referer', $action, $result); 1021 1022 /** 1023 * Fires once the admin request has been validated or not. 1024 * 1025 * @since 1.5.1 1026 * 1027 * @param string $action The nonce action. 1028 * @param bool $result Whether the admin request nonce was validated. 1029 */ 1030 do_action( 'check_admin_referer', $action, $result ); 826 1031 return $result; 827 1032 } 828 1033 endif; … … 855 1060 die( '-1' ); 856 1061 } 857 1062 858 do_action('check_ajax_referer', $action, $result); 1063 /** 1064 * Fires once the AJAX request has been validated or not. 1065 * 1066 * @since 2.1.0 1067 * 1068 * @param string $action The AJAX nonce action. 1069 * @param bool $result Whether the AJAX request nonce was validated. 1070 */ 1071 do_action( 'check_ajax_referer', $action, $result ); 859 1072 860 1073 return $result; 861 1074 } … … 866 1079 * Redirects to another page. 867 1080 * 868 1081 * @since 1.5.1 869 * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.870 1082 * 871 1083 * @param string $location The path to redirect to. 872 1084 * @param int $status Status code to use. … … 968 1180 * If the host is not allowed, then the redirect is to $default supplied 969 1181 * 970 1182 * @since 2.8.1 971 * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing972 * WordPress host string and $location host string.973 1183 * 974 1184 * @param string $location The redirect to validate 975 1185 * @param string $default The value to return if $location is not allowed … … 1000 1210 1001 1211 $wpp = parse_url(home_url()); 1002 1212 1003 $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : ''); 1213 /** 1214 * Filter the list of hosts allowed to be redirected to. 1215 * 1216 * @since 2.3.0 1217 * 1218 * @param array $hosts Array of allowed hosts. 1219 * @param bool|string $host The parsed host, empty if not isset. 1220 */ 1221 $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' ); 1004 1222 1005 1223 if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) 1006 1224 $location = $default; … … 1163 1381 if ( isset($reply_to) ) 1164 1382 $message_headers .= $reply_to . "\n"; 1165 1383 1166 $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id ); 1167 $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id ); 1168 $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id ); 1384 /** 1385 * Filter the comment notification email text. 1386 * 1387 * @since 1.5.2 1388 * 1389 * @param string $notify_message The comment notification email text. 1390 * @param int $comment_id Comment ID. 1391 */ 1392 $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id ); 1169 1393 1394 /** 1395 * Filter the comment notification email subject. 1396 * 1397 * @since 1.5.2 1398 * 1399 * @param string $subject The comment notification email subject. 1400 * @param int $comment_id Comment ID. 1401 */ 1402 $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id ); 1403 1404 /** 1405 * Filter the comment notification email headers. 1406 * 1407 * @since 1.5.2 1408 * 1409 * @param string $message_headers Headers for the comment notification email. 1410 * @param int $comment_id Comment ID. 1411 */ 1412 $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id ); 1413 1170 1414 foreach ( $emails as $email ) { 1171 1415 @wp_mail( $email, $subject, $notify_message, $message_headers ); 1172 1416 } … … 1249 1493 $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title ); 1250 1494 $message_headers = ''; 1251 1495 1252 $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id ); 1253 $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id ); 1254 $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id ); 1255 $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id ); 1496 /** 1497 * Filter the list of recipients for comment moderation emails. 1498 * 1499 * @since 3.7.0 1500 * 1501 * @param array $emails List of email addresses to notify for comment moderation. 1502 * @param int $comment_id Comment ID. 1503 */ 1504 $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id ); 1256 1505 1506 /** 1507 * Filter the comment moderation email text. 1508 * 1509 * @since 1.5.2 1510 * 1511 * @param string $notify_message Text of the comment moderation email. 1512 * @param int $comment_id Comment ID. 1513 */ 1514 $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id ); 1515 1516 /** 1517 * Filter the comment moderation email subject. 1518 * 1519 * @since 1.5.2 1520 * 1521 * @param string $subject Subject of the comment moderation email. 1522 * @param int $comment_id Comment ID. 1523 */ 1524 $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id ); 1525 1526 /** 1527 * Filter the comment moderation email headers. 1528 * 1529 * @since 2.8.0 1530 * 1531 * @param string $message_headers Headers for the comment moderation email. 1532 * @param int $comment_id Comment ID. 1533 */ 1534 $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id ); 1535 1257 1536 foreach ( $emails as $email ) { 1258 1537 @wp_mail( $email, $subject, $notify_message, $message_headers ); 1259 1538 } … … 1331 1610 * @return int 1332 1611 */ 1333 1612 function wp_nonce_tick() { 1613 /** 1614 * Filter the lifespan of nonces in seconds. 1615 * 1616 * @since 2.5.0 1617 * 1618 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds or one day. 1619 */ 1334 1620 $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS ); 1335 1621 1336 1622 return ceil(time() / ( $nonce_life / 2 )); … … 1353 1639 function wp_verify_nonce($nonce, $action = -1) { 1354 1640 $user = wp_get_current_user(); 1355 1641 $uid = (int) $user->ID; 1356 if ( ! $uid ) 1642 if ( ! $uid ) { 1643 /** 1644 * Filter whether the user who generated the nonce is logged out. 1645 * 1646 * @since 3.5.0 1647 * 1648 * @param int $uid ID of the nonce-owning user. 1649 * @param string $action The nonce action. 1650 */ 1357 1651 $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); 1652 } 1358 1653 1359 1654 $i = wp_nonce_tick(); 1360 1655 … … 1381 1676 function wp_create_nonce($action = -1) { 1382 1677 $user = wp_get_current_user(); 1383 1678 $uid = (int) $user->ID; 1384 if ( ! $uid ) 1679 if ( ! $uid ) { 1680 /** This filter is documented in wp-includes/pluggable.php */ 1385 1681 $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); 1682 } 1386 1683 1387 1684 $i = wp_nonce_tick(); 1388 1685 … … 1427 1724 */ 1428 1725 function wp_salt( $scheme = 'auth' ) { 1429 1726 static $cached_salts = array(); 1430 if ( isset( $cached_salts[ $scheme ] ) ) 1727 if ( isset( $cached_salts[ $scheme ] ) ) { 1728 /** 1729 * Filter the WP salt. 1730 * 1731 * @since 2.5.0 1732 * 1733 * @param string $cached_salt Cached salt for the given scheme. 1734 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth', 1735 * 'logged_in', and 'nonce'. 1736 */ 1431 1737 return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme ); 1738 } 1432 1739 1433 1740 static $duplicated_keys; 1434 1741 if ( null === $duplicated_keys ) { … … 1474 1781 } 1475 1782 1476 1783 $cached_salts[ $scheme ] = $key . $salt; 1784 1785 /** This filter is documented in wp-includes/pluggable.php */ 1477 1786 return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme ); 1478 1787 } 1479 1788 endif; … … 1557 1866 $hash = wp_hash_password($password); 1558 1867 } 1559 1868 1560 return apply_filters('check_password', $check, $password, $hash, $user_id); 1869 /** 1870 * Filter whether the plaintext password matches the encrypted password. 1871 * 1872 * @since 2.5.0 1873 * 1874 * @param bool $check Whether the passwords match. 1875 * @param string $hash The hashed password. 1876 * @param int $user_id User ID. 1877 */ 1878 return apply_filters( 'check_password', $check, $password, $hash, $user_id ); 1561 1879 } 1562 1880 1563 1881 // If the stored hash is longer than an MD5, presume the … … 1570 1888 1571 1889 $check = $wp_hasher->CheckPassword($password, $hash); 1572 1890 1891 /** This filter is documented in wp-includes/pluggable.php */ 1573 1892 return apply_filters('check_password', $check, $password, $hash, $user_id); 1574 1893 } 1575 1894 endif; … … 1598 1917 $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1); 1599 1918 } 1600 1919 1601 // random_password filter was previously in random_password function which was deprecated 1602 return apply_filters('random_password', $password); 1920 /** 1921 * Filter the randomly-generated password. 1922 * 1923 * @since 3.0.0 1924 * 1925 * @param string $password The generated password. 1926 */ 1927 return apply_filters( 'random_password', $password ); 1603 1928 } 1604 1929 endif; 1605 1930 … … 1707 2032 $email = $user->user_email; 1708 2033 } elseif ( is_object($id_or_email) ) { 1709 2034 // No avatar for pingbacks or trackbacks 2035 2036 /** 2037 * Filter the list of allowed comment types for retrieving avatars. 2038 * 2039 * @since 3.0.0 2040 * 2041 * @param array $types Array of content types. Default only contains 'comment'. 2042 */ 1710 2043 $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); 1711 2044 if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) 1712 2045 return false; … … 1773 2106 $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />"; 1774 2107 } 1775 2108 1776 return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt); 2109 /** 2110 * Filter the avatar to retrieve. 2111 * 2112 * @since 2.5.0 2113 * 2114 * @param string $avatar <img> tag for the user's avatar. 2115 * @param int|object|string $id_or_email A user ID, email address, or comment object. 2116 * @param int $size Square avatar width and height in pixels to retrieve. 2117 * @param string $alt Alternative text to use in the avatar image tag. Defaults empty. 2118 */ 2119 return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt ); 1777 2120 } 1778 2121 endif; 1779 2122