Changeset 13892 for trunk/src/bp-core/classes/class-bp-email.php
- Timestamp:
- 06/02/2024 01:16:13 AM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-email.php
r13372 r13892 1 1 <?php 2 2 /** 3 * Core component classes.3 * Represents an email that will be sent to member(s). 4 4 * 5 5 * @package BuddyPress … … 7 7 */ 8 8 9 // Exit if accessed directly 9 // Exit if accessed directly. 10 10 defined( 'ABSPATH' ) || exit; 11 11 12 12 /** 13 * Represents an email that will be sent to member(s).13 * BP_Email class. 14 14 * 15 15 * @since 2.5.0 16 16 */ 17 17 class BP_Email { 18 18 19 /** 19 20 * Addressee details (BCC). … … 66 67 * @since 2.5.0 67 68 * 68 * @var BP_Email_Sender Sender details.69 * @var BP_Email_Sender 69 70 */ 70 71 protected $from = null; … … 82 83 * Email headers. 83 84 * 84 * @since 2.5.0 85 * 86 * @var string[] Associative pairing of email header name/value. 85 * Associative pairing of email header name/value. 86 * 87 * @since 2.5.0 88 * 89 * @var string[] 87 90 */ 88 91 protected $headers = array(); … … 93 96 * @since 2.5.0 94 97 * 95 * @var WP_Post 98 * @var WP_Post|null 96 99 */ 97 100 protected $post_object = null; … … 102 105 * @since 2.5.0 103 106 * 104 * @var BP_Email_Sender "Reply to" details.107 * @var BP_Email_Sender|null 105 108 */ 106 109 protected $reply_to = null; … … 146 149 * Token names and replacement values for this email. 147 150 * 148 * @since 2.5.0 149 * 150 * @var string[] Associative pairing of token name (key) and replacement value (value). 151 * Associative pairing of token name (key) and replacement value (value). 152 * 153 * @since 2.5.0 154 * 155 * @var string[] 151 156 */ 152 157 protected $tokens = array(); … … 170 175 $domain = substr( $domain, 4 ); 171 176 } 172 173 177 } elseif ( function_exists( 'gethostname' ) && gethostname() !== false ) { 174 178 $domain = gethostname(); … … 205 209 } 206 210 207 208 211 /* 209 212 * Setters/getters. … … 228 231 $property_name = 'content_' . $this->get_content_type(); 229 232 230 if ( ! in_array( $property_name, array( 'content_html', 'content_plaintext' ,), true ) ) {233 if ( ! in_array( $property_name, array( 'content_html', 'content_plaintext' ), true ) ) { 231 234 $property_name = 'content_html'; 232 235 } … … 236 239 return null; 237 240 } 238 239 241 240 242 /** … … 273 275 * @since 2.5.0 274 276 * 275 * @param string$retval Property value.277 * @param mixed $retval Property value. 276 278 * @param string $property_name Property name. 277 279 * @param string $transform How to transform the return value. … … 286 288 * 287 289 * @since 4.0.0 290 * 291 * @return string 288 292 */ 289 293 public function get_preheader() { … … 444 448 * @since 2.5.0 445 449 * 446 * @return WP_Post The post. 450 * @param string $transform Optional. How to transform the return value. Defaults to 'raw'. 451 * @return WP_Post|null WP_Post object, or null if not set. 447 452 */ 448 453 public function get_post_object( $transform = 'raw' ) { … … 459 464 * @param string $transform Optional. How to transform the return value. 460 465 * Accepts 'raw' (default) or 'replace-tokens'. 461 * @return BP_Email_Recipient "Reply to" recipient.466 * @return BP_Email_Recipient|null "Reply to" recipient, or null if not set. 462 467 */ 463 468 public function get_reply_to( $transform = 'raw' ) { … … 474 479 * @param string $transform Optional. How to transform the return value. 475 480 * Accepts 'raw' (default) or 'replace-tokens'. 476 * @return string Email subject.481 * @return string|null Email subject, or null if not set. 477 482 */ 478 483 public function get_subject( $transform = 'raw' ) { … … 489 494 * @param string $transform Optional. How to transform the return value. 490 495 * Accepts 'raw' (default) or 'replace-tokens'. 491 * @return string Email template. Assumed to be HTML.496 * @return string|null Email template. Assumed to be HTML. Or null if not set. 492 497 */ 493 498 public function get_template( $transform = 'raw' ) { … … 504 509 * @param string $transform Optional. How to transform the return value. 505 510 * Accepts 'raw' (default) or 'replace-tokens'. 506 * @return BP_Email_Recipient[] "To" recipients.511 * @return BP_Email_Recipient[]|null "To" recipients. Or null if not set. 507 512 */ 508 513 public function get_to( $transform = 'raw' ) { … … 519 524 * @param string $transform Optional. How to transform the return value. 520 525 * Accepts 'raw' (default) or 'replace-tokens'. 521 * @return string[] Associative pairing of token name (key) and replacement value (value). 526 * @return string[]|null Associative pairing of token name (key) and replacement value (value). 527 * Or null if not set. 522 528 */ 523 529 public function get_tokens( $transform = 'raw' ) { … … 571 577 * @param string|array|int|WP_User $bcc_address Either a email address, user ID, WP_User object, 572 578 * or an array containing any combination of the above. 573 * @param string $name Optional. If $bcc_address is a string, this is the recipient's name.574 * @param string $operation Optional. If "replace", $to_address replaces current setting (default).575 * If "add", $to_address is added to the current setting.579 * @param string $name Optional. If $bcc_address is a string, this is the recipient's name. 580 * @param string $operation Optional. If "replace", $to_address replaces current setting (default). 581 * If "add", $to_address is added to the current setting. 576 582 * @return BP_Email 577 583 */ … … 583 589 $bcc[] = new BP_Email_Recipient( $address ); 584 590 } 585 586 591 } else { 587 592 $bcc[] = new BP_Email_Recipient( $bcc_address, $name ); … … 620 625 * @param string|array|int|WP_User $cc_address Either a email address, user ID, WP_User object, 621 626 * or an array containing any combination of the above. 622 * @param string $name Optional. If $cc_address is a string, this is the recipient's name.623 * @param string $operation Optional. If "replace", $to_address replaces current setting (default).624 * If "add", $to_address is added to the current setting.627 * @param string $name Optional. If $cc_address is a string, this is the recipient's name. 628 * @param string $operation Optional. If "replace", $to_address replaces current setting (default). 629 * If "add", $to_address is added to the current setting. 625 630 * @return BP_Email 626 631 */ … … 632 637 $cc[] = new BP_Email_Recipient( $address ); 633 638 } 634 635 639 } else { 636 640 $cc[] = new BP_Email_Recipient( $cc_address, $name ); … … 710 714 */ 711 715 public function set_content_type( $content_type ) { 712 if ( ! in_array( $content_type, array( 'html', 'plaintext' ,), true ) ) {716 if ( ! in_array( $content_type, array( 'html', 'plaintext' ), true ) ) { 713 717 $class = get_class_vars( get_class() ); 714 718 $content_type = $class['content_type']; … … 736 740 * 737 741 * @param string|array|int|WP_User $email_address Either a email address, user ID, or WP_User object. 738 * @param string $name Optional. If $email_address is a string, this is the recipient's name.742 * @param string $name Optional. If $email_address is a string, this is the recipient's name. 739 743 * @return BP_Email 740 744 */ … … 768 772 * @since 2.5.0 769 773 * 770 * @param WP_Post $post 774 * @param WP_Post $post Post object. 771 775 * @return BP_Email 772 776 */ … … 820 824 * @param string|array|int|WP_User $email_address Either a email address, user ID, WP_User object, 821 825 * or an array containing any combination of the above. 822 * @param string $name Optional. If $email_address is a string, this is the recipient's name.826 * @param string $name Optional. If $email_address is a string, this is the recipient's name. 823 827 * @return BP_Email 824 828 */ … … 913 917 * @param string|array|int|WP_User $to_address Either a email address, user ID, WP_User object, 914 918 * or an array containing any combination of the above. 915 * @param string $name Optional. If $to_address is a string, this is the recipient's name.916 * @param string $operation Optional. If "replace", $to_address replaces current setting (default).917 * If "add", $to_address is added to the current setting.919 * @param string $name Optional. If $to_address is a string, this is the recipient's name. 920 * @param string $operation Optional. If "replace", $to_address replaces current setting (default). 921 * If "add", $to_address is added to the current setting. 918 922 * @return BP_Email 919 923 */ … … 925 929 $to[] = new BP_Email_Recipient( $address ); 926 930 } 927 928 931 } else { 929 932 $to[] = new BP_Email_Recipient( $to_address, $name ); … … 982 985 return $this; 983 986 } 984 985 987 986 988 /*
Note: See TracChangeset
for help on using the changeset viewer.