Skip to:
Content

BuddyPress.org

Changeset 13901


Ignore:
Timestamp:
06/02/2024 07:14:55 PM (2 years ago)
Author:
espellcaste
Message:

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

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

See #9164 and #7228

Location:
trunk/src/bp-core/classes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-attachment-avatar.php

    r13414 r13901  
    3232                $allowed_types = bp_core_get_allowed_avatar_types();
    3333
    34                 parent::__construct( array(
    35                         'action'                => 'bp_avatar_upload',
    36                         'file_input'            => 'file',
    37                         'original_max_filesize' => bp_core_avatar_original_max_filesize(),
    38 
    39                         // Specific errors for avatars.
    40                         'upload_error_strings'  => array(
    41                                 /* translators: %s: Max file size for the profile photo */
    42                                 9  => sprintf( _x( 'That photo is too big. Please upload one smaller than %s', 'profile photo upload error', 'buddypress' ), size_format( bp_core_avatar_original_max_filesize() ) ),
    43 
    44                                 /* translators: %s: comma separated list of file types allowed for the profile photo */
    45                                 10 => sprintf( _nx( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'profile photo upload error', 'buddypress' ), self::get_avatar_types( $allowed_types ) ),
    46                         ),
    47                 ) );
     34                parent::__construct(
     35                        array(
     36                                'action'                => 'bp_avatar_upload',
     37                                'file_input'            => 'file',
     38                                'original_max_filesize' => bp_core_avatar_original_max_filesize(),
     39
     40                                // Specific errors for avatars.
     41                                'upload_error_strings'  => array(
     42                                        /* translators: %s: Max file size for the profile photo */
     43                                        9  => sprintf( _x( 'That photo is too big. Please upload one smaller than %s', 'profile photo upload error', 'buddypress' ), size_format( bp_core_avatar_original_max_filesize() ) ),
     44
     45                                        /* translators: %s: comma separated list of file types allowed for the profile photo */
     46                                        10 => sprintf( _nx( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'profile photo upload error', 'buddypress' ), self::get_avatar_types( $allowed_types ) ),
     47                                ),
     48                        )
     49                );
    4850        }
    4951
    … …  
    98100                        $file['error'] = 9;
    99101
    100                 // File is of invalid type.
     102                        // File is of invalid type.
    101103                } elseif ( ! bp_core_check_avatar_type( array( 'file' => $file ) ) ) {
    102104                        $file['error'] = 10;
    … …  
    153155                        3 => 180,
    154156                        6 => -90,
    155                         8 =>  90,
     157                        8 => 90,
    156158                );
    157159
    … …  
    163165                if ( empty( $edit_args ) ) {
    164166                        return false;
     167                }
    165168
    166169                // Add the file to the edit arguments.
    167                 } else {
    168                         $edit_args['file'] = $file;
    169                 }
     170                $edit_args['file'] = $file;
    170171
    171172                return parent::edit_image( 'avatar', $edit_args );
    … …  
    176177         *
    177178         * @since 2.3.0
    178          *
    179179         *
    180180         * @param string $file the absolute path to the file.
    … …  
    186186                $full_height    = bp_core_avatar_full_height();
    187187
    188                 if ( isset( $uploaded_image[0] ) && $uploaded_image[0] < $full_width || $uploaded_image[1] < $full_height ) {
    189                         return true;
    190                 }
    191 
    192                 return false;
     188                return ( isset( $uploaded_image[0] ) && ( $uploaded_image[0] < $full_width || $uploaded_image[1] < $full_height ) );
    193189        }
    194190
    … …  
    198194         * @since 2.3.0
    199195         *
    200          * @see  BP_Attachment::crop for the list of parameters
     196         * @see BP_Attachment::crop() for the list of parameters
    201197         *
    202198         * @param array $args Array of arguments for the cropping.
    … …  
    229225
    230226                // Bail if the avatar is not available.
    231                 if ( ! file_exists( $absolute_path ) )  {
     227                if ( ! file_exists( $absolute_path ) ) {
    232228                        return false;
    233229                }
    … …  
    281277                                                }
    282278
    283                                                 $is_full  = preg_match( "/-bpfull/", $avatar_file->name );
    284                                                 $is_thumb = preg_match( "/-bpthumb/", $avatar_file->name );
     279                                                $is_full  = preg_match( '/-bpfull/', $avatar_file->name );
     280                                                $is_thumb = preg_match( '/-bpthumb/', $avatar_file->name );
    285281
    286282                                                if ( $is_full || $is_thumb ) {
    … …  
    322318                        'thumb' => '',
    323319                );
    324                 $timestamp   = bp_core_current_time( true, 'timestamp' );
     320                $timestamp    = bp_core_current_time( true, 'timestamp' );
    325321
    326322                foreach ( $avatar_types as $key_type => $type ) {
    … …  
    359355         */
    360356        private function get_user_id() {
    361                 $bp = buddypress();
     357                $bp      = buddypress();
    362358                $user_id = 0;
    363359
    … …  
    424420                                'item_id'    => $user_id,
    425421                                'has_avatar' => bp_get_user_has_avatar( $user_id ),
    426                                 'nonces'  => array(
     422                                'nonces'     => array(
    427423                                        'set'    => wp_create_nonce( 'bp_avatar_cropstore' ),
    428424                                        'remove' => wp_create_nonce( 'bp_delete_avatar_link' ),
    … …  
    476472
    477473                // Include the specific css.
    478                 $script_data['extra_js']  = $js_scripts;
     474                $script_data['extra_js'] = $js_scripts;
    479475
    480476                // Set the object to contextualize the filter.
  • trunk/src/bp-core/classes/class-bp-attachment-cover-image.php

    r13414 r13901  
    3030                $max_upload_file_size = bp_attachments_get_max_upload_file_size( 'cover_image' );
    3131
    32                 parent::__construct( array(
    33                         'action'                => 'bp_cover_image_upload',
    34                         'file_input'            => 'file',
    35                         'original_max_filesize' => $max_upload_file_size,
    36                         'base_dir'              => bp_attachments_uploads_dir_get( 'dir' ),
    37                         'required_wp_files'     => array( 'file', 'image' ),
    38 
    39                         // Specific errors for cover images.
    40                         'upload_error_strings'  => array(
    41                                 /* translators: %s: Max file size for the cover image */
    42                                 11  => sprintf( _x( 'That image is too big. Please upload one smaller than %s', 'cover image upload error', 'buddypress' ), size_format( $max_upload_file_size ) ),
    43 
    44                                 /* translators: %s: comma separated list of file types allowed for the cover image */
    45                                 12  => sprintf( _nx( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'cover image upload error', 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
    46                         ),
    47                 ) );
     32                parent::__construct(
     33                        array(
     34                                'action'                => 'bp_cover_image_upload',
     35                                'file_input'            => 'file',
     36                                'original_max_filesize' => $max_upload_file_size,
     37                                'base_dir'              => bp_attachments_uploads_dir_get( 'dir' ),
     38                                'required_wp_files'     => array( 'file', 'image' ),
     39
     40                                // Specific errors for cover images.
     41                                'upload_error_strings'  => array(
     42                                        /* translators: %s: Max file size for the cover image */
     43                                        11 => sprintf( _x( 'That image is too big. Please upload one smaller than %s', 'cover image upload error', 'buddypress' ), size_format( $max_upload_file_size ) ),
     44
     45                                        /* translators: %s: comma separated list of file types allowed for the cover image */
     46                                        12 => sprintf( _nx( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'cover image upload error', 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
     47                                ),
     48                        )
     49                );
    4850        }
    4951
    … …  
    8385                        $file['error'] = 11;
    8486
    85                 // File is of invalid type.
     87                        // File is of invalid type.
    8688                } elseif ( isset( $file['tmp_name'] ) && isset( $file['name'] ) && ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
    8789                        $file['error'] = 12;
    … …  
    138140                        3 => 180,
    139141                        6 => -90,
    140                         8 =>  90,
     142                        8 => 90,
    141143                );
    142144
    … …  
    149151                        return false;
    150152
    151                 // Add the file to the edit arguments.
     153                        // Add the file to the edit arguments.
    152154                } else {
    153                         $edit_args = array_merge( $edit_args, array( 'file' => $file, 'save' => false ) );
     155                        $edit_args = array_merge(
     156                                $edit_args,
     157                                array(
     158                                        'file' => $file,
     159                                        'save' => false,
     160                                )
     161                        );
    154162                }
    155163
    … …  
    157165                $editor = parent::edit_image( 'cover_image', $edit_args );
    158166
    159                 if ( is_wp_error( $editor ) )  {
     167                if ( is_wp_error( $editor ) ) {
    160168                        return $editor;
    161169                } elseif ( ! is_a( $editor, 'WP_Image_Editor' ) ) {
    … …  
    173181         *
    174182         * @param string $file The absolute path to the file.
    175          * @return false|string $value The absolute path to the new file name.
     183         * @return false|string
    176184         */
    177185        public function generate_filename( $file = '' ) {
    … …  
    208216                                'item_id'         => $item_id,
    209217                                'has_cover_image' => bp_attachments_get_user_has_cover_image( $item_id ),
    210                                 'nonces'  => array(
     218                                'nonces'          => array(
    211219                                        'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
    212220                                ),
    … …  
    226234                                'item_id'         => bp_get_current_group_id(),
    227235                                'has_cover_image' => bp_attachments_get_group_has_cover_image( $item_id ),
    228                                 'nonces'  => array(
     236                                'nonces'          => array(
    229237                                        'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
    230238                                ),
  • trunk/src/bp-core/classes/class-bp-attachment.php

    r13718 r13901  
    5353         *
    5454         * @param array|string $args {
     55         *     Array of upload parameters.
     56         *
    5557         *     @type int    $original_max_filesize  Maximum file size in kilobytes. Defaults to php.ini settings.
    5658         *     @type array  $allowed_mime_types     List of allowed file extensions (eg: array( 'jpg', 'gif', 'png' ) ).
    … …  
    6971                // Upload action and the file input name are required parameters.
    7072                if ( empty( $args['action'] ) || empty( $args['file_input'] ) ) {
    71                         return false;
     73                        return;
    7274                }
    7375
    … …  
    9294                                $this->{$key} = $this->set_upload_error_strings( $param );
    9395
    94                         // Sanitize the base dir.
     96                                // Sanitize the base dir.
    9597                        } elseif ( 'base_dir' === $key ) {
    9698                                $this->{$key} = sanitize_title( $param );
    9799
    98                         // Sanitize the upload dir filter arg to pass.
     100                                // Sanitize the upload dir filter arg to pass.
    99101                        } elseif ( 'upload_dir_filter_args' === $key ) {
    100102                                $this->{$key} = (int) $param;
    101103
    102                         // Action & File input are already set and sanitized.
     104                                // Action & File input are already set and sanitized.
    103105                        } elseif ( 'action' !== $key && 'file_input' !== $key ) {
    104106                                $this->{$key} = $param;
    … …  
    114116         *
    115117         * @since 2.3.0
    116          *
    117118         */
    118119        public function set_upload_dir() {
    119120                // Set the directory, path, & url variables.
    120                 $this->upload_dir  = bp_upload_dir();
     121                $this->upload_dir = bp_upload_dir();
    121122
    122123                if ( empty( $this->upload_dir ) ) {
    123                         return false;
     124                        return;
    124125                }
    125126
    … …  
    139140                if ( ! empty( $this->base_dir ) ) {
    140141                        $this->upload_path = trailingslashit( $this->upload_path ) . $this->base_dir;
    141                         $this->url         = trailingslashit( $this->url  ) . $this->base_dir;
     142                        $this->url         = trailingslashit( $this->url ) . $this->base_dir;
    142143
    143144                        // Finally create the base dir.
    … …  
    195196                        }
    196197
    197                         require_once( ABSPATH . "/wp-admin/includes/{$wp_file}.php" );
     198                        require_once ABSPATH . "/wp-admin/includes/{$wp_file}.php";
    198199                }
    199200        }
    … …  
    207208         * @param string      $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional).
    208209         * @param string|null $time              Optional. Time formatted in 'yyyy/mm'. Default null.
    209          * @return array On success, returns an associative array of file attributes.
     210         * @return false|array On success, returns an associative array of file attributes.
    210211         *               On failure, returns an array containing the error message
    211212         *               (eg: array( 'error' => $message ) )
    … …  
    257258                 * and no specific filter has been requested, use a default
    258259                 * filter to create the specific $base dir
     260                 *
    259261                 * @see  BP_Attachment->upload_dir_filter()
    260262                 */
    … …  
    290292         * @since 2.9.0
    291293         *
    292          * @param  string $retval Filename.
     294         * @param string $retval Filename.
    293295         * @return string
    294296         */
    295297        public function sanitize_utf8_filename( $retval ) {
    296                 // PHP 5.4+ or with PECL intl 2.0+
     298                // PHP 5.4+ or with PECL intl 2.0+ .
    297299                if ( function_exists( 'transliterator_transliterate' ) && seems_utf8( $retval ) ) {
    298300                        $retval = transliterator_transliterate( 'Any-Latin; Latin-ASCII; [\u0080-\u7fff] remove', $retval );
    299301
    300                 // Older.
     302                        // Older.
    301303                } else {
    302304                        // Use WP's built-in function to convert accents to their ASCII equivalent.
    … …  
    318320         * the 'upload_filetypes' setting. BuddyPress will respect this setting.
    319321         *
     322         * @since 2.3.0
     323         *
    320324         * @see check_upload_mimes()
    321325         *
    322          * @since 2.3.0
    323          *
     326         * @return array Valid mime types.
    324327         */
    325328        protected function validate_mime_types() {
    326                 $wp_mimes = get_allowed_mime_types();
     329                $wp_mimes    = get_allowed_mime_types();
    327330                $valid_mimes = array();
    328331
    … …  
    331334                        foreach ( $wp_mimes as $ext_pattern => $mime ) {
    332335                                if ( $ext !== '' && strpos( $ext_pattern, $ext ) !== false ) {
    333                                         $valid_mimes[$ext_pattern] = $mime;
     336                                        $valid_mimes[ $ext_pattern ] = $mime;
    334337                                }
    335338                        }
    … …  
    388391                 * @param array $upload_dir     The original Uploads dir.
    389392                 */
    390                 return apply_filters( 'bp_attachment_upload_dir', array(
    391                         'path'    => $this->upload_path,
    392                         'url'     => $this->url,
    393                         'subdir'  => false,
    394                         'basedir' => $this->upload_path,
    395                         'baseurl' => $this->url,
    396                         'error'   => false
    397                 ), $upload_dir );
     393                return apply_filters(
     394                        'bp_attachment_upload_dir',
     395                        array(
     396                                'path'    => $this->upload_path,
     397                                'url'     => $this->url,
     398                                'subdir'  => false,
     399                                'basedir' => $this->upload_path,
     400                                'baseurl' => $this->url,
     401                                'error'   => false,
     402                        ),
     403                        $upload_dir
     404                );
    398405        }
    399406
    … …  
    406413         * @since 2.3.0
    407414         *
     415         * @return bool
    408416         */
    409417        public function create_dir() {
    … …  
    432440         *
    433441         * @param array $args {
     442         *     Array of arguments for the crop method.
     443         *
    434444         *     @type string $original_file The source file (absolute path) for the Attachment.
    435445         *     @type int    $crop_x        The start x position to crop from.
    … …  
    489499
    490500                // Check image file types.
    491                 $check_types = array( 'src_file' => array( 'file' => $r['original_file'], 'error' => _x( 'source file', 'Attachment source file', 'buddypress' ) ) );
     501                $check_types = array(
     502                        'src_file' => array(
     503                                'file'  => $r['original_file'],
     504                                'error' => _x( 'source file', 'Attachment source file', 'buddypress' ),
     505                        ),
     506                );
    492507                if ( ! empty( $r['dst_file'] ) ) {
    493                         $check_types['dst_file'] = array( 'file' => $r['dst_file'], 'error' => _x( 'destination file', 'Attachment destination file', 'buddypress' ) );
     508                        $check_types['dst_file'] = array(
     509                                'file'  => $r['dst_file'],
     510                                'error' => _x( 'destination file', 'Attachment destination file', 'buddypress' ),
     511                        );
    494512                }
    495513
    … …  
    498516
    499517                foreach ( $check_types as $file ) {
    500                         $is_image      = wp_check_filetype( $file['file'] );
    501                         $ext           = $is_image['ext'];
     518                        $is_image = wp_check_filetype( $file['file'] );
     519                        $ext      = $is_image['ext'];
    502520
    503521                        if ( empty( $ext ) || empty( $supported_image_types[ $ext ] ) ) {
    … …  
    538556         */
    539557        public function script_data() {
    540                 $script_data = array(
     558                return array(
    541559                        'action'            => $this->action,
    542560                        'file_data_name'    => $this->file_input,
    … …  
    547565                        ),
    548566                );
    549 
    550                 return $script_data;
    551567        }
    552568
    … …  
    557573         *
    558574         * @param string $attachment_type The attachement type (eg: avatar).
    559          * @param array $args {
     575         * @param array  $args {
     576         *     Optional. Array of arguments for the add_revision method.
     577         *
    560578         *     @type string $file_abspath The source file (absolute path) for the attachment.
    561579         *     @type string $file_id      Optional. The file ID to use as a suffix for the revision directory.
    … …  
    599617                // Avatars and Cover Images are specific attachments.
    600618                if ( 'avatar' === $attachment_type || 'cover_image' === $attachment_type ) {
    601                         $revision_dir  = $dirname . 'history';
     619                        $revision_dir = $dirname . 'history';
    602620                }
    603621
    … …  
    631649        public static function get_image_data( $file ) {
    632650                // Try to get image basic data.
    633                 list( $width, $height, $sourceImageType ) = @getimagesize( $file );
     651                list( $width, $height, $source_image_type ) = @getimagesize( $file );
    634652
    635653                // No need to carry on if we couldn't get image's basic data.
    636                 if ( is_null( $width ) || is_null( $height ) || is_null( $sourceImageType ) ) {
     654                if ( is_null( $width ) || is_null( $height ) || is_null( $source_image_type ) ) {
    637655                        return false;
    638656                }
    … …  
    646664                // Make sure the wp_read_image_metadata function is reachable.
    647665                if ( ! function_exists( 'wp_read_image_metadata' ) ) {
    648                         require_once( ABSPATH . 'wp-admin/includes/image.php' );
     666                        require_once ABSPATH . 'wp-admin/includes/image.php';
    649667                }
    650668
    … …  
    672690         * @param string $attachment_type The attachment type (eg: avatar or cover_image). Required.
    673691         * @param array  $args {
     692         *     Optional. Array of arguments for the edit_image method.
     693         *
    674694         *     @type string $file     Absolute path to the image file (required).
    675695         *     @type int    $max_w    Max width attribute for the editor's resize method (optional).
    … …  
    738758                        return $editor->save( $editor->generate_filename() );
    739759
    740                 // Need to do some other edit actions or use a specific method to save file.
     760                        // Need to do some other edit actions or use a specific method to save file.
    741761                } else {
    742762                        return $editor;
  • trunk/src/bp-core/classes/class-bp-block.php

    r13877 r13901  
    1717 */
    1818class BP_Block {
     19
    1920        /**
    2021         * WP Block Type object.
    2122         *
    2223         * @since 6.0.0
     24         *
    2325         * @var WP_Block_Type|WP_Error
    2426         */
    … …  
    2931         *
    3032         * @since 6.0.0
     33         *
    3134         * @var array
    3235         */
    … …  
    3740         *
    3841         * @since 6.0.0
     42         *
    3943         * @var array
    4044         */
  • trunk/src/bp-core/classes/class-bp-button.php

    r13818 r13901  
    233233         * @since 1.2.6
    234234         *
    235          * @param array|string $args See {@BP_Button}.
     235         * @param array|string $args See `BP_Button`.
    236236         */
    237237        public function __construct( $args = '' ) {
    … …  
    246246
    247247                // Deprecated. Subject to removal in a future release.
     248
    248249                $this->wrapper = $r['wrapper'];
    249                 if ( !empty( $r['link_id']    ) ) $this->link_id    = ' id="' .    $r['link_id']    . '"';
    250                 if ( !empty( $r['link_href']  ) ) $this->link_href  = ' href="' .  $r['link_href']  . '"';
    251                 if ( !empty( $r['link_title'] ) ) $this->link_title = ' title="' . $r['link_title'] . '"';
    252                 if ( !empty( $r['link_rel']   ) ) $this->link_rel   = ' rel="' .   $r['link_rel']   . '"';
    253                 if ( !empty( $r['link_class'] ) ) $this->link_class = ' class="' . $r['link_class'] . '"';
    254                 if ( !empty( $r['link_text']  ) ) $this->link_text  =              $r['link_text'];
     250
     251                if ( ! empty( $r['link_id'] ) ) {
     252                        $this->link_id = ' id="' . $r['link_id'] . '"';
     253                }
     254                if ( ! empty( $r['link_href'] ) ) {
     255                        $this->link_href = ' href="' . $r['link_href'] . '"';
     256                }
     257                if ( ! empty( $r['link_title'] ) ) {
     258                        $this->link_title = ' title="' . $r['link_title'] . '"';
     259                }
     260                if ( ! empty( $r['link_rel'] ) ) {
     261                        $this->link_rel = ' rel="' . $r['link_rel'] . '"';
     262                }
     263                if ( ! empty( $r['link_class'] ) ) {
     264                        $this->link_class = ' class="' . $r['link_class'] . '"';
     265                }
     266                if ( ! empty( $r['link_text'] ) ) {
     267                        $this->link_text = $r['link_text'];
     268                }
    255269
    256270                // Required button properties.
    … …  
    262276                // $id and $component are required and component must be active.
    263277                if ( empty( $r['id'] ) || empty( $r['component'] ) || ! bp_is_active( $this->component ) ) {
    264                         return false;
     278                        return;
    265279                }
    266280
    267281                // No button for guests if must be logged in.
    268                 if ( true == $this->must_be_logged_in && ! is_user_logged_in() ) {
    269                         return false;
     282                if ( true === $this->must_be_logged_in && ! is_user_logged_in() ) {
     283                        return;
    270284                }
    271285
    272286                // The block_self property.
    273                 if ( true == $this->block_self ) {
     287                if ( true === $this->block_self ) {
    274288                        /*
    275289                         * No button if you are the current user in a members loop.
    … …  
    279293                         */
    280294                        if ( bp_get_member_user_id() ) {
    281                                 if ( is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id() ) {
    282                                         return false;
     295                                if ( is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() ) {
     296                                        return;
    283297                                }
    284298
    285                         // No button if viewing your own profile (and not in a members loop).
     299                                // No button if viewing your own profile (and not in a members loop).
    286300                        } elseif ( bp_is_my_profile() ) {
    287                                 return false;
     301                                return;
    288302                        }
    289303                }
    … …  
    311325
    312326                        // Render parent element attributes.
    313                         $parent_elem = new BP_Core_HTML_Element( array(
    314                                 'element' => $r['parent_element'],
    315                                 'attr'    => $r['parent_attr']
    316                         ) );
     327                        $parent_elem = new BP_Core_HTML_Element(
     328                                array(
     329                                        'element' => $r['parent_element'],
     330                                        'attr'    => $r['parent_attr'],
     331                                )
     332                        );
    317333
    318334                        // Set before and after.
    … …  
    320336                        $after  = $parent_elem->get( 'close_tag' );
    321337
    322                 // No parent element.
     338                        // No parent element.
    323339                } else {
    324                         $before = $after = '';
     340                        $before = '';
     341                        $after  = '';
    325342                }
    326343
    … …  
    339356                        }
    340357
    341                         $button = new BP_Core_HTML_Element( array(
    342                                 'element'    => $r['button_element'],
    343                                 'attr'       => $r['button_attr'],
    344                                 'inner_html' => ! empty( $r['link_text'] ) ? $r['link_text'] : ''
    345                         ) );
     358                        $button = new BP_Core_HTML_Element(
     359                                array(
     360                                        'element'    => $r['button_element'],
     361                                        'attr'       => $r['button_attr'],
     362                                        'inner_html' => ! empty( $r['link_text'] ) ? $r['link_text'] : '',
     363                                )
     364                        );
    346365                        $button = $button->contents();
    347366                }
    … …  
    374393         * @since 2.7.0.
    375394         *
    376          * @param  array $r See {@link BP_Button} class for full documentation.
     395         * @param  array $r See {@see BP_Button} class for full documentation.
    377396         * @return array
    378397         */
    … …  
    380399                // Array of deprecated arguments.
    381400                $backpat_args = array(
    382                         'wrapper', 'wrapper_class', 'wrapper_id',
    383                         'link_href', 'link_class', 'link_id', 'link_rel', 'link_title'
     401                        'wrapper',
     402                        'wrapper_class',
     403                        'wrapper_id',
     404                        'link_href',
     405                        'link_class',
     406                        'link_id',
     407                        'link_rel',
     408                        'link_title',
    384409                );
    385410
    … …  
    389414                        }
    390415
    391                         $parent = $child = false;
     416                        $parent = false;
     417                        $child  = false;
    392418                        $sep    = strpos( $prop, '_' );
    393419
    … …  
    410436                                $r[ "{$parent}_element" ] = $r[ $prop ];
    411437
    412                         // Set attributes.
     438                                // Set attributes.
    413439                        } elseif ( true === $child ) {
    414                                 $new_prop = substr( $prop, strpos( $prop, '_' ) +1 );
     440                                $new_prop = substr( $prop, strpos( $prop, '_' ) + 1 );
    415441                                if ( empty( $r[ "{$parent}_attr" ] ) ) {
    416442                                        $r[ "{$parent}_attr" ] = array();
Note: See TracChangeset for help on using the changeset viewer.