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