bp_email_add_link_color_to_template( string $value, string $property_name, string $transform )
Add email link styles to rendered email template.
Description Description
This is only used when the email content has been merged into the email template.
Parameters Parameters
- $value
-
(Required) Property value.
- $property_name
-
(Required) Email template property name.
- $transform
-
(Required) How the return value was transformed.
Return Return
(string) Updated value.
Source Source
File: bp-core/bp-core-filters.php
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | function bp_email_add_link_color_to_template( $value , $property_name , $transform ) { if ( $property_name !== 'template' || $transform !== 'add-content' ) { return $value ; } $settings = bp_email_get_appearance_settings(); $replacement = 'style="color: ' . esc_attr( $settings [ 'link_text_color' ] ) . ';' ; // Find all links. preg_match_all( '#<a[^>]+>#i' , $value , $links , PREG_SET_ORDER ); foreach ( $links as $link ) { $new_link = $link = array_shift ( $link ); // Add/modify style property. if ( strpos ( $link , 'style="' ) !== false ) { $new_link = str_replace ( 'style="' , $replacement , $link ); } else { $new_link = str_replace ( '<a ' , "<a {$replacement}\" " , $link ); } if ( $new_link !== $link ) { $value = str_replace ( $link , $new_link , $value ); } } return $value ; } |
Changelog Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |