Skip to:
Content

BuddyPress.org

Changeset 13892


Ignore:
Timestamp:
06/02/2024 01:16:13 AM (2 years ago)
Author:
espellcaste
Message:

WPCS: Part VI: miscellaneous fixes for some of the files of the core component.

Follow-up to [13883], [13886], [13887], [13888], and [13891]

See #9164 and #7228

Location:
trunk/src/bp-core
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-customizer-email.php

    r13878 r13892  
    2323        }
    2424
    25         $wp_customize->add_panel( 'bp_mailtpl', array(
    26                 'description' => __( 'Customize the appearance of emails sent by BuddyPress.', 'buddypress' ),
    27                 'title'       => _x( 'BuddyPress Emails', 'screen heading', 'buddypress' ),
    28         ) );
     25        $wp_customize->add_panel(
     26                'bp_mailtpl',
     27                array(
     28                        'description' => __( 'Customize the appearance of emails sent by BuddyPress.', 'buddypress' ),
     29                        'title'       => _x( 'BuddyPress Emails', 'screen heading', 'buddypress' ),
     30                )
     31        );
    2932
    3033        $sections = bp_email_get_customizer_sections();
    … …  
    126129         * @param array $sections Email Customizer sections to add.
    127130         */
    128         return apply_filters( 'bp_email_get_customizer_sections', array(
    129                 'section_bp_mailtpl_header' => array(
    130                         'capability' => 'bp_moderate',
    131                         'panel'      => 'bp_mailtpl',
    132                         'title'      => _x( 'Header', 'email', 'buddypress' ),
    133                 ),
    134                 'section_bp_mailtpl_body' => array(
    135                         'capability' => 'bp_moderate',
    136                         'panel'      => 'bp_mailtpl',
    137                         'title'      => _x( 'Body', 'email', 'buddypress' ),
    138                 ),
    139                 'section_bp_mailtpl_footer' => array(
    140                         'capability' => 'bp_moderate',
    141                         'panel'      => 'bp_mailtpl',
    142                         'title'      => _x( 'Footer', 'email', 'buddypress' ),
    143                 ),
    144         ) );
     131        return apply_filters(
     132                'bp_email_get_customizer_sections',
     133                array(
     134                        'section_bp_mailtpl_header' => array(
     135                                'capability' => 'bp_moderate',
     136                                'panel'      => 'bp_mailtpl',
     137                                'title'      => _x( 'Header', 'email', 'buddypress' ),
     138                        ),
     139                        'section_bp_mailtpl_body'   => array(
     140                                'capability' => 'bp_moderate',
     141                                'panel'      => 'bp_mailtpl',
     142                                'title'      => _x( 'Body', 'email', 'buddypress' ),
     143                        ),
     144                        'section_bp_mailtpl_footer' => array(
     145                                'capability' => 'bp_moderate',
     146                                'panel'      => 'bp_mailtpl',
     147                                'title'      => _x( 'Footer', 'email', 'buddypress' ),
     148                        ),
     149                )
     150        );
    145151}
    146152
    … …  
    162168         * @param array $settings Email Customizer settings to add.
    163169         */
    164         return apply_filters( 'bp_email_get_customizer_settings', array(
    165                 'bp_email_options[email_bg]' => array(
    166                         'capability'        => 'bp_moderate',
    167                         'default'           => $defaults['email_bg'],
    168                         'sanitize_callback' => 'sanitize_hex_color',
    169                         'transport'         => 'postMessage',
    170                         'type'              => 'option',
    171                 ),
    172                 'bp_email_options[header_bg]' => array(
    173                         'capability'        => 'bp_moderate',
    174                         'default'           => $defaults['header_bg'],
    175                         'sanitize_callback' => 'sanitize_hex_color',
    176                         'transport'         => 'postMessage',
    177                         'type'              => 'option',
    178                 ),
    179                 'bp_email_options[header_text_size]' => array(
    180                         'capability'        => 'bp_moderate',
    181                         'default'           => $defaults['header_text_size'],
    182                         'sanitize_callback' => 'absint',
    183                         'transport'         => 'postMessage',
    184                         'type'              => 'option',
    185                 ),
    186                 'bp_email_options[header_text_color]' => array(
    187                         'capability'        => 'bp_moderate',
    188                         'default'           => $defaults['header_text_color'],
    189                         'sanitize_callback' => 'sanitize_hex_color',
    190                         'transport'         => 'postMessage',
    191                         'type'              => 'option',
    192                 ),
    193                 'bp_email_options[highlight_color]' => array(
    194                         'capability'        => 'bp_moderate',
    195                         'default'           => $defaults['highlight_color'],
    196                         'sanitize_callback' => 'sanitize_hex_color',
    197                         'transport'         => 'postMessage',
    198                         'type'              => 'option',
    199                 ),
    200                 'bp_email_options[body_bg]' => array(
    201                         'capability'        => 'bp_moderate',
    202                         'default'           => $defaults['body_bg'],
    203                         'sanitize_callback' => 'sanitize_hex_color',
    204                         'transport'         => 'postMessage',
    205                         'type'              => 'option',
    206                 ),
    207                 'bp_email_options[body_text_size]' => array(
    208                         'capability'        => 'bp_moderate',
    209                         'default'           => $defaults['body_text_size'],
    210                         'sanitize_callback' => 'absint',
    211                         'transport'         => 'postMessage',
    212                         'type'              => 'option',
    213                 ),
    214                 'bp_email_options[body_text_color]' => array(
    215                         'capability'        => 'bp_moderate',
    216                         'default'           => $defaults['body_text_color'],
    217                         'sanitize_callback' => 'sanitize_hex_color',
    218                         'transport'         => 'postMessage',
    219                         'type'              => 'option',
    220                 ),
    221                 'bp_email_options[footer_text]' => array(
    222                         'capability'        => 'bp_moderate',
    223                         'default'           => $defaults['footer_text'],
    224                         'sanitize_callback' => 'wp_filter_post_kses',
    225                         'transport'         => 'postMessage',
    226                         'type'              => 'option',
    227                 ),
    228                 'bp_email_options[footer_bg]' => array(
    229                         'capability'        => 'bp_moderate',
    230                         'default'           => $defaults['footer_bg'],
    231                         'sanitize_callback' => 'sanitize_hex_color',
    232                         'transport'         => 'postMessage',
    233                         'type'              => 'option',
    234                 ),
    235                 'bp_email_options[footer_text_size]' => array(
    236                         'capability'        => 'bp_moderate',
    237                         'default'           => $defaults['footer_text_size'],
    238                         'sanitize_callback' => 'absint',
    239                         'transport'         => 'postMessage',
    240                         'type'              => 'option',
    241                 ),
    242                 'bp_email_options[footer_text_color]' => array(
    243                         'capability'        => 'bp_moderate',
    244                         'default'           => $defaults['footer_text_color'],
    245                         'sanitize_callback' => 'sanitize_hex_color',
    246                         'transport'         => 'postMessage',
    247                         'type'              => 'option',
    248                 ),
    249         ) );
     170        return apply_filters(
     171                'bp_email_get_customizer_settings',
     172                array(
     173                        'bp_email_options[email_bg]'          => array(
     174                                'capability'        => 'bp_moderate',
     175                                'default'           => $defaults['email_bg'],
     176                                'sanitize_callback' => 'sanitize_hex_color',
     177                                'transport'         => 'postMessage',
     178                                'type'              => 'option',
     179                        ),
     180                        'bp_email_options[header_bg]'         => array(
     181                                'capability'        => 'bp_moderate',
     182                                'default'           => $defaults['header_bg'],
     183                                'sanitize_callback' => 'sanitize_hex_color',
     184                                'transport'         => 'postMessage',
     185                                'type'              => 'option',
     186                        ),
     187                        'bp_email_options[header_text_size]'  => array(
     188                                'capability'        => 'bp_moderate',
     189                                'default'           => $defaults['header_text_size'],
     190                                'sanitize_callback' => 'absint',
     191                                'transport'         => 'postMessage',
     192                                'type'              => 'option',
     193                        ),
     194                        'bp_email_options[header_text_color]' => array(
     195                                'capability'        => 'bp_moderate',
     196                                'default'           => $defaults['header_text_color'],
     197                                'sanitize_callback' => 'sanitize_hex_color',
     198                                'transport'         => 'postMessage',
     199                                'type'              => 'option',
     200                        ),
     201                        'bp_email_options[highlight_color]'   => array(
     202                                'capability'        => 'bp_moderate',
     203                                'default'           => $defaults['highlight_color'],
     204                                'sanitize_callback' => 'sanitize_hex_color',
     205                                'transport'         => 'postMessage',
     206                                'type'              => 'option',
     207                        ),
     208                        'bp_email_options[body_bg]'           => array(
     209                                'capability'        => 'bp_moderate',
     210                                'default'           => $defaults['body_bg'],
     211                                'sanitize_callback' => 'sanitize_hex_color',
     212                                'transport'         => 'postMessage',
     213                                'type'              => 'option',
     214                        ),
     215                        'bp_email_options[body_text_size]'    => array(
     216                                'capability'        => 'bp_moderate',
     217                                'default'           => $defaults['body_text_size'],
     218                                'sanitize_callback' => 'absint',
     219                                'transport'         => 'postMessage',
     220                                'type'              => 'option',
     221                        ),
     222                        'bp_email_options[body_text_color]'   => array(
     223                                'capability'        => 'bp_moderate',
     224                                'default'           => $defaults['body_text_color'],
     225                                'sanitize_callback' => 'sanitize_hex_color',
     226                                'transport'         => 'postMessage',
     227                                'type'              => 'option',
     228                        ),
     229                        'bp_email_options[footer_text]'       => array(
     230                                'capability'        => 'bp_moderate',
     231                                'default'           => $defaults['footer_text'],
     232                                'sanitize_callback' => 'wp_filter_post_kses',
     233                                'transport'         => 'postMessage',
     234                                'type'              => 'option',
     235                        ),
     236                        'bp_email_options[footer_bg]'         => array(
     237                                'capability'        => 'bp_moderate',
     238                                'default'           => $defaults['footer_bg'],
     239                                'sanitize_callback' => 'sanitize_hex_color',
     240                                'transport'         => 'postMessage',
     241                                'type'              => 'option',
     242                        ),
     243                        'bp_email_options[footer_text_size]'  => array(
     244                                'capability'        => 'bp_moderate',
     245                                'default'           => $defaults['footer_text_size'],
     246                                'sanitize_callback' => 'absint',
     247                                'transport'         => 'postMessage',
     248                                'type'              => 'option',
     249                        ),
     250                        'bp_email_options[footer_text_color]' => array(
     251                                'capability'        => 'bp_moderate',
     252                                'default'           => $defaults['footer_text_color'],
     253                                'sanitize_callback' => 'sanitize_hex_color',
     254                                'transport'         => 'postMessage',
     255                                'type'              => 'option',
     256                        ),
     257                )
     258        );
    250259}
    251260
    … …  
    266275         * @param array $controls Email Customizer controls to add.
    267276         */
    268         return apply_filters( 'bp_email_get_customizer_controls', array(
    269                 'bp_mailtpl_email_bg' => array(
    270                         'class'    => 'WP_Customize_Color_Control',
    271                         'label'    => __( 'Email background color', 'buddypress' ),
    272                         'section'  => 'section_bp_mailtpl_header',
    273                         'settings' => 'bp_email_options[email_bg]',
    274                 ),
    275 
    276                 'bp_mailtpl_header_bg' => array(
    277                         'class'    => 'WP_Customize_Color_Control',
    278                         'label'    => __( 'Header background color', 'buddypress' ),
    279                         'section'  => 'section_bp_mailtpl_header',
    280                         'settings' => 'bp_email_options[header_bg]',
    281                 ),
    282 
    283                 'bp_mailtpl_highlight_color' => array(
    284                         'class'       => 'WP_Customize_Color_Control',
    285                         'description' => __( 'Applied to links and other decorative areas.', 'buddypress' ),
    286                         'label'       => __( 'Highlight color', 'buddypress' ),
    287                         'section'     => 'section_bp_mailtpl_header',
    288                         'settings'    => 'bp_email_options[highlight_color]',
    289                 ),
    290 
    291                 'bp_mailtpl_header_text_color' => array(
    292                         'class'    => 'WP_Customize_Color_Control',
    293                         'label'    => __( 'Text color', 'buddypress' ),
    294                         'section'  => 'section_bp_mailtpl_header',
    295                         'settings' => 'bp_email_options[header_text_color]',
    296                 ),
    297 
    298                 'bp_mailtpl_header_text_size' => array(
    299                         'class'    => 'BP_Customizer_Control_Range',
    300                         'label'    => __( 'Text size', 'buddypress' ),
    301                         'section'  => 'section_bp_mailtpl_header',
    302                         'settings' => 'bp_email_options[header_text_size]',
    303 
    304                         'input_attrs' => array(
    305                                 'max'  => 100,
    306                                 'min'  => 1,
    307                                 'step' => 1,
    308                         ),
    309                 ),
    310 
    311 
    312                 'bp_mailtpl_body_bg' => array(
    313                         'class'    => 'WP_Customize_Color_Control',
    314                         'label'    => __( 'Background color', 'buddypress' ),
    315                         'section'  => 'section_bp_mailtpl_body',
    316                         'settings' => 'bp_email_options[body_bg]',
    317                 ),
    318 
    319 
    320                 'bp_mailtpl_body_text_color' => array(
    321                         'class'    => 'WP_Customize_Color_Control',
    322                         'label'    => __( 'Text color', 'buddypress' ),
    323                         'section'  => 'section_bp_mailtpl_body',
    324                         'settings' => 'bp_email_options[body_text_color]',
    325                 ),
    326 
    327                 'bp_mailtpl_body_text_size' => array(
    328                         'class'    => 'BP_Customizer_Control_Range',
    329                         'label'    => __( 'Text size', 'buddypress' ),
    330                         'section'  => 'section_bp_mailtpl_body',
    331                         'settings' => 'bp_email_options[body_text_size]',
    332 
    333                         'input_attrs' => array(
    334                                 'max'  => 24,
    335                                 'min'  => 8,
    336                                 'step' => 1,
    337                         ),
    338                 ),
    339 
    340 
    341                 'bp_mailtpl_footer_text' => array(
    342                         'class'       => 'WP_Customize_Control',
    343                         'description' => __('Change the email footer here', 'buddypress' ),
    344                         'label'       => __( 'Footer text', 'buddypress' ),
    345                         'section'     => 'section_bp_mailtpl_footer',
    346                         'settings'    => 'bp_email_options[footer_text]',
    347                         'type'        => 'textarea',
    348                 ),
    349 
    350                 'bp_mailtpl_footer_bg' => array(
    351                         'class'    => 'WP_Customize_Color_Control',
    352                         'label'    => __( 'Background color', 'buddypress' ),
    353                         'section'  => 'section_bp_mailtpl_footer',
    354                         'settings' => 'bp_email_options[footer_bg]',
    355                 ),
    356 
    357                 'bp_mailtpl_footer_text_color' => array(
    358                         'class'    => 'WP_Customize_Color_Control',
    359                         'label'    => __( 'Text color', 'buddypress' ),
    360                         'section'  => 'section_bp_mailtpl_footer',
    361                         'settings' => 'bp_email_options[footer_text_color]',
    362                 ),
    363 
    364                 'bp_mailtpl_footer_text_size' => array(
    365                         'class'    => 'BP_Customizer_Control_Range',
    366                         'label'    => __( 'Text size', 'buddypress' ),
    367                         'section'  => 'section_bp_mailtpl_footer',
    368                         'settings' => 'bp_email_options[footer_text_size]',
    369 
    370                         'input_attrs' => array(
    371                                 'max'  => 24,
    372                                 'min'  => 8,
    373                                 'step' => 1,
    374                         ),
    375                 ),
    376         ) );
     277        return apply_filters(
     278                'bp_email_get_customizer_controls',
     279                array(
     280                        'bp_mailtpl_email_bg'          => array(
     281                                'class'    => 'WP_Customize_Color_Control',
     282                                'label'    => __( 'Email background color', 'buddypress' ),
     283                                'section'  => 'section_bp_mailtpl_header',
     284                                'settings' => 'bp_email_options[email_bg]',
     285                        ),
     286
     287                        'bp_mailtpl_header_bg'         => array(
     288                                'class'    => 'WP_Customize_Color_Control',
     289                                'label'    => __( 'Header background color', 'buddypress' ),
     290                                'section'  => 'section_bp_mailtpl_header',
     291                                'settings' => 'bp_email_options[header_bg]',
     292                        ),
     293
     294                        'bp_mailtpl_highlight_color'   => array(
     295                                'class'       => 'WP_Customize_Color_Control',
     296                                'description' => __( 'Applied to links and other decorative areas.', 'buddypress' ),
     297                                'label'       => __( 'Highlight color', 'buddypress' ),
     298                                'section'     => 'section_bp_mailtpl_header',
     299                                'settings'    => 'bp_email_options[highlight_color]',
     300                        ),
     301
     302                        'bp_mailtpl_header_text_color' => array(
     303                                'class'    => 'WP_Customize_Color_Control',
     304                                'label'    => __( 'Text color', 'buddypress' ),
     305                                'section'  => 'section_bp_mailtpl_header',
     306                                'settings' => 'bp_email_options[header_text_color]',
     307                        ),
     308
     309                        'bp_mailtpl_header_text_size'  => array(
     310                                'class'       => 'BP_Customizer_Control_Range',
     311                                'label'       => __( 'Text size', 'buddypress' ),
     312                                'section'     => 'section_bp_mailtpl_header',
     313                                'settings'    => 'bp_email_options[header_text_size]',
     314
     315                                'input_attrs' => array(
     316                                        'max'  => 100,
     317                                        'min'  => 1,
     318                                        'step' => 1,
     319                                ),
     320                        ),
     321
     322                        'bp_mailtpl_body_bg'           => array(
     323                                'class'    => 'WP_Customize_Color_Control',
     324                                'label'    => __( 'Background color', 'buddypress' ),
     325                                'section'  => 'section_bp_mailtpl_body',
     326                                'settings' => 'bp_email_options[body_bg]',
     327                        ),
     328
     329                        'bp_mailtpl_body_text_color'  => array(
     330                                'class'    => 'WP_Customize_Color_Control',
     331                                'label'    => __( 'Text color', 'buddypress' ),
     332                                'section'  => 'section_bp_mailtpl_body',
     333                                'settings' => 'bp_email_options[body_text_color]',
     334                        ),
     335
     336                        'bp_mailtpl_body_text_size'    => array(
     337                                'class'       => 'BP_Customizer_Control_Range',
     338                                'label'       => __( 'Text size', 'buddypress' ),
     339                                'section'     => 'section_bp_mailtpl_body',
     340                                'settings'    => 'bp_email_options[body_text_size]',
     341
     342                                'input_attrs' => array(
     343                                        'max'  => 24,
     344                                        'min'  => 8,
     345                                        'step' => 1,
     346                                ),
     347                        ),
     348
     349                        'bp_mailtpl_footer_text'       => array(
     350                                'class'       => 'WP_Customize_Control',
     351                                'description' => __( 'Change the email footer here', 'buddypress' ),
     352                                'label'       => __( 'Footer text', 'buddypress' ),
     353                                'section'     => 'section_bp_mailtpl_footer',
     354                                'settings'    => 'bp_email_options[footer_text]',
     355                                'type'        => 'textarea',
     356                        ),
     357
     358                        'bp_mailtpl_footer_bg'         => array(
     359                                'class'    => 'WP_Customize_Color_Control',
     360                                'label'    => __( 'Background color', 'buddypress' ),
     361                                'section'  => 'section_bp_mailtpl_footer',
     362                                'settings' => 'bp_email_options[footer_bg]',
     363                        ),
     364
     365                        'bp_mailtpl_footer_text_color' => array(
     366                                'class'    => 'WP_Customize_Color_Control',
     367                                'label'    => __( 'Text color', 'buddypress' ),
     368                                'section'  => 'section_bp_mailtpl_footer',
     369                                'settings' => 'bp_email_options[footer_text_color]',
     370                        ),
     371
     372                        'bp_mailtpl_footer_text_size'  => array(
     373                                'class'       => 'BP_Customizer_Control_Range',
     374                                'label'       => __( 'Text size', 'buddypress' ),
     375                                'section'     => 'section_bp_mailtpl_footer',
     376                                'settings'    => 'bp_email_options[footer_text_size]',
     377
     378                                'input_attrs' => array(
     379                                        'max'  => 24,
     380                                        'min'  => 8,
     381                                        'step' => 1,
     382                                ),
     383                        ),
     384                )
     385        );
    377386}
    378387
    … …  
    391400        }
    392401
    393         $email = get_posts( array(
    394                 'fields'           => 'ids',
    395                 'orderby'          => 'rand',
    396                 'post_status'      => 'publish',
    397                 'post_type'        => bp_get_email_post_type(),
    398                 'posts_per_page'   => 1,
    399                 'suppress_filters' => false,
    400         ) );
     402        $email = get_posts(
     403                array(
     404                        'fields'           => 'ids',
     405                        'orderby'          => 'rand',
     406                        'post_status'      => 'publish',
     407                        'post_type'        => bp_get_email_post_type(),
     408                        'posts_per_page'   => 1,
     409                        'suppress_filters' => false,
     410                )
     411        );
    401412
    402413        $preview_url = admin_url();
  • trunk/src/bp-core/classes/class-bp-email-address.php

    r12353 r13892  
    33 * Interface for objects that have email address properties (address, name).
    44 *
    5  * @since 5.0.0
     5 * @package BuddyPress
     6 * @subpackage Core
    67 */
    78
     9// Exit if accessed directly.
     10defined( 'ABSPATH' ) || exit;
     11
     12/**
     13 * BP_Email_Address Interface.
     14 *
     15 * @since 2.5.0
     16 */
    817interface BP_Email_Address {
     18
    919        /**
    1020         * Gets the email address of the user.
    1121         *
    1222         * @since 5.0.0
     23         *
     24         * @return string
    1325         */
    1426        public function get_address();
    … …  
    1830         *
    1931         * @since 5.0.0
     32         *
     33         * @return string
    2034         */
    2135        public function get_name();
  • trunk/src/bp-core/classes/class-bp-email-delivery.php

    r10470 r13892  
    11<?php
    22/**
    3  * Core component classes.
     3 * Email delivery implementation base class.
    44 *
    55 * @package BuddyPress
    … …  
    77 */
    88
    9 // Exit if accessed directly
     9// Exit if accessed directly.
    1010defined( 'ABSPATH' ) || exit;
    1111
    1212/**
    13  * Email delivery implementation base class.
     13 * BP_Email_Delivery Interface.
    1414 *
    1515 * When implementing support for an email delivery service into BuddyPress,
  • trunk/src/bp-core/classes/class-bp-email-participant.php

    r12353 r13892  
    44 *
    55 * @since 5.0.0
     6 *
     7 * @package BuddyPress
     8 * @subpackage Core
    69 */
    710
     11// Exit if accessed directly.
     12defined( 'ABSPATH' ) || exit;
     13
     14/**
     15 * BP_Email_Participant class.
     16 *
     17 * @since 5.0.0
     18 */
    819abstract class BP_Email_Participant implements BP_Email_Address {
     20
    921        /**
    1022         * Recipient's email address.
    … …  
    2941         *
    3042         * @since 5.0.0
     43         *
     44         * @return string
    3145         */
    3246        public function get_address() {
  • trunk/src/bp-core/classes/class-bp-email-recipient.php

    r13372 r13892  
    11<?php
    22/**
    3  * Core component classes.
     3 * BuddyPress Email Recipient class.
     4 *
     5 * Represents a recipient that an email will be sent to.
    46 *
    57 * @package BuddyPress
    … …  
    79 */
    810
    9 // Exit if accessed directly
     11// Exit if accessed directly.
    1012defined( 'ABSPATH' ) || exit;
    1113
    1214/**
    13  * Represents a recipient that an email will be sent to.
     15 * BP_Email_Recipient class.
    1416 *
    1517 * @since 2.5.0
    … …  
    2224         * @since 2.5.0
    2325         *
    24          * @var WP_User
     26         * @var WP_User|null
    2527         */
    2628        protected $user_object = null;
    … …  
    4547                                $this->user_object = $email_or_user;
    4648
    47                         // Query for WP user by user ID.
     49                                // Query for WP user by user ID.
    4850                        } elseif ( is_int( $email_or_user ) ) {
    4951                                $this->user_object = get_user_by( 'id', $email_or_user );
    … …  
    5557                        }
    5658
    57                 // Array or miscellaneous string.
     59                        // Array or miscellaneous string.
    5860                } else {
    5961                        if ( ! is_array( $email_or_user ) ) {
    … …  
    8284                // We have a user object; so set address and name from DB.
    8385                if ( $this->user_object ) {
    84                         // This is escaped with esc_html in bp_core_get_user_displayname()
     86                        // This is escaped with esc_html in bp_core_get_user_displayname().
    8587                        $wp_name = wp_specialchars_decode( bp_core_get_user_displayname( $this->user_object->ID ), ENT_QUOTES );
    8688
  • trunk/src/bp-core/classes/class-bp-email-sender.php

    r12353 r13892  
    44 *
    55 * @since 5.0.0
     6 *
     7 * @package BuddyPress
     8 * @subpackage Core
    69 */
    710
     11// Exit if accessed directly.
     12defined( 'ABSPATH' ) || exit;
     13
     14/**
     15 * BP_Email_Sender class.
     16 */
    817class BP_Email_Sender extends BP_Email_Participant {}
  • trunk/src/bp-core/classes/class-bp-email.php

    r13372 r13892  
    11<?php
    22/**
    3  * Core component classes.
     3 * Represents an email that will be sent to member(s).
    44 *
    55 * @package BuddyPress
    … …  
    77 */
    88
    9 // Exit if accessed directly
     9// Exit if accessed directly.
    1010defined( 'ABSPATH' ) || exit;
    1111
    1212/**
    13  * Represents an email that will be sent to member(s).
     13 * BP_Email class.
    1414 *
    1515 * @since 2.5.0
    1616 */
    1717class BP_Email {
     18
    1819        /**
    1920         * Addressee details (BCC).
    … …  
    6667         * @since 2.5.0
    6768         *
    68          * @var BP_Email_Sender Sender details.
     69         * @var BP_Email_Sender
    6970         */
    7071        protected $from = null;
    … …  
    8283         * Email headers.
    8384         *
    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[]
    8790         */
    8891        protected $headers = array();
    … …  
    9396         * @since 2.5.0
    9497         *
    95          * @var WP_Post
     98         * @var WP_Post|null
    9699         */
    97100        protected $post_object = null;
    … …  
    102105         * @since 2.5.0
    103106         *
    104          * @var BP_Email_Sender "Reply to" details.
     107         * @var BP_Email_Sender|null
    105108         */
    106109        protected $reply_to = null;
    … …  
    146149         * Token names and replacement values for this email.
    147150         *
    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[]
    151156         */
    152157        protected $tokens = array();
    … …  
    170175                                $domain = substr( $domain, 4 );
    171176                        }
    172 
    173177                } elseif ( function_exists( 'gethostname' ) && gethostname() !== false ) {
    174178                        $domain = gethostname();
    … …  
    205209        }
    206210
    207 
    208211        /*
    209212         * Setters/getters.
    … …  
    228231                        $property_name = 'content_' . $this->get_content_type();
    229232
    230                         if ( ! in_array( $property_name, array( 'content_html', 'content_plaintext', ), true ) ) {
     233                        if ( ! in_array( $property_name, array( 'content_html', 'content_plaintext' ), true ) ) {
    231234                                $property_name = 'content_html';
    232235                        }
    … …  
    236239                        return null;
    237240                }
    238 
    239241
    240242                /**
    … …  
    273275                 * @since 2.5.0
    274276                 *
    275                  * @param string   $retval        Property value.
     277                 * @param mixed    $retval        Property value.
    276278                 * @param string   $property_name Property name.
    277279                 * @param string   $transform     How to transform the return value.
    … …  
    286288         *
    287289         * @since 4.0.0
     290         *
     291         * @return string
    288292         */
    289293        public function get_preheader() {
    … …  
    444448         * @since 2.5.0
    445449         *
    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.
    447452         */
    448453        public function get_post_object( $transform = 'raw' ) {
    … …  
    459464         * @param string $transform Optional. How to transform the return value.
    460465         *                          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.
    462467         */
    463468        public function get_reply_to( $transform = 'raw' ) {
    … …  
    474479         * @param string $transform Optional. How to transform the return value.
    475480         *                          Accepts 'raw' (default) or 'replace-tokens'.
    476          * @return string Email subject.
     481         * @return string|null Email subject, or null if not set.
    477482         */
    478483        public function get_subject( $transform = 'raw' ) {
    … …  
    489494         * @param string $transform Optional. How to transform the return value.
    490495         *                          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.
    492497         */
    493498        public function get_template( $transform = 'raw' ) {
    … …  
    504509         * @param string $transform Optional. How to transform the return value.
    505510         *                          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.
    507512         */
    508513        public function get_to( $transform = 'raw' ) {
    … …  
    519524         * @param string $transform Optional. How to transform the return value.
    520525         *                          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.
    522528         */
    523529        public function get_tokens( $transform = 'raw' ) {
    … …  
    571577         * @param string|array|int|WP_User $bcc_address Either a email address, user ID, WP_User object,
    572578         *                                              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.
    576582         * @return BP_Email
    577583         */
    … …  
    583589                                $bcc[] = new BP_Email_Recipient( $address );
    584590                        }
    585 
    586591                } else {
    587592                        $bcc[] = new BP_Email_Recipient( $bcc_address, $name );
    … …  
    620625         * @param string|array|int|WP_User $cc_address Either a email address, user ID, WP_User object,
    621626         *                                             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.
    625630         * @return BP_Email
    626631         */
    … …  
    632637                                $cc[] = new BP_Email_Recipient( $address );
    633638                        }
    634 
    635639                } else {
    636640                        $cc[] = new BP_Email_Recipient( $cc_address, $name );
    … …  
    710714         */
    711715        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 ) ) {
    713717                        $class        = get_class_vars( get_class() );
    714718                        $content_type = $class['content_type'];
    … …  
    736740         *
    737741         * @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.
    739743         * @return BP_Email
    740744         */
    … …  
    768772         * @since 2.5.0
    769773         *
    770          * @param WP_Post $post
     774         * @param WP_Post $post Post object.
    771775         * @return BP_Email
    772776         */
    … …  
    820824         * @param string|array|int|WP_User $email_address Either a email address, user ID, WP_User object,
    821825         *                                                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.
    823827         * @return BP_Email
    824828         */
    … …  
    913917         * @param string|array|int|WP_User $to_address Either a email address, user ID, WP_User object,
    914918         *                                             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.
    918922         * @return BP_Email
    919923         */
    … …  
    925929                                $to[] = new BP_Email_Recipient( $address );
    926930                        }
    927 
    928931                } else {
    929932                        $to[] = new BP_Email_Recipient( $to_address, $name );
    … …  
    982985                return $this;
    983986        }
    984 
    985987
    986988        /*
  • trunk/src/bp-core/classes/class-bp-phpmailer.php

    r13888 r13892  
    11<?php
    22/**
    3  * Core component classes.
     3 * Email delivery implementation using PHPMailer.
    44 *
    55 * @package BuddyPress
    66 * @subpackage Core
     7 *
     8 * @phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     9 * @phpcs:disable Generic.CodeAnalysis.EmptyStatement.DetectedCatch
     10 * @phpcs:disable Squiz.Commenting.EmptyCatchComment.Missing
    711 */
    812
    … …  
    1115
    1216/**
    13  * Email delivery implementation using PHPMailer.
     17 * BP_PHPMailer class.
    1418 *
    1519 * @since 2.5.0
    … …  
    144148         *
    145149         * @since 2.5.0
     150         *
    146151         * @deprecated 2.5.3 No longer used.
    147152         *
Note: See TracChangeset for help on using the changeset viewer.