Skip to:
Content

BuddyPress.org

Changeset 8645


Ignore:
Timestamp:
07/17/2014 07:59:53 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Clean up brackets, whitespace, and code formatting in bp-xprofile-filters.php. Also remove a rogue unused filter that should have been removed in r3248.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r8644 r8645  
    2727add_filter( 'bp_get_the_profile_field_value',           'esc_html',        8 );
    2828add_filter( 'bp_get_the_profile_field_value',           'convert_smilies', 9 );
     29add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value',         1, 2 );
     30add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value_by_type', 8, 2 );
     31add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_link_profile_data',          9, 2 );
    2932
    3033add_filter( 'bp_get_the_profile_field_edit_value',      'force_balance_tags' );
     
    4750
    4851add_filter( 'xprofile_get_field_data',                  'stripslashes' );
    49 
    50 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value', 1, 2 );
    51 add_filter( 'bp_get_the_site_member_profile_data',      'xprofile_filter_format_field_value', 1, 2 );
    5252add_filter( 'xprofile_get_field_data',                  'xprofile_filter_format_field_value_by_field_id', 5, 2 );
    53 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_format_field_value_by_type', 8, 2 );
    54 add_filter( 'bp_get_the_profile_field_value',           'xprofile_filter_link_profile_data',  9, 2 );
    5553
    5654add_filter( 'xprofile_data_value_before_save',          'xprofile_sanitize_data_value_before_save', 1, 2 );
     
    8381 * @return string
    8482 */
    85 function xprofile_sanitize_data_value_before_save ( $field_value, $field_id, $reserialize = true ) {
     83function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, $reserialize = true ) {
    8684
    8785    // Return if empty
     
    109107        }
    110108
    111         if ( !empty( $reserialize ) )
     109        if ( !empty( $reserialize ) ) {
    112110            $filtered_field_value = serialize( $filtered_values );
    113         else
     111        } else {
    114112            $filtered_field_value = $filtered_values;
     113        }
    115114    }
    116115
     
    128127 */
    129128function xprofile_filter_format_field_value( $field_value, $field_type = '' ) {
     129
    130130    // Valid field values of 0 or '0' get caught by empty(), so we have an extra check for these. See #BP5731
    131     if ( ! isset( $field_value ) || empty( $field_value ) && '0' != $field_value )
     131    if ( ! isset( $field_value ) || empty( $field_value ) && ( '0' !== $field_value ) ) {
    132132        return false;
    133 
    134     if ( 'datebox' != $field_type ) {
    135         $field_value = str_replace(']]>', ']]>', $field_value );
     133    }
     134
     135    if ( 'datebox' !== $field_type ) {
     136        $field_value = str_replace( ']]>', ']]>', $field_value );
    136137    }
    137138
     
    176177
    177178function xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    178     if ( 'datebox' == $field_type )
     179
     180    if ( 'datebox' === $field_type ) {
    179181        return $field_value;
    180 
    181     if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
     182    }
     183
     184    if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) ) {
    182185        return $field_value;
     186    }
    183187
    184188    $values = explode( ',', $field_value );
     
    223227 * @return array $comments
    224228 */
    225 function xprofile_filter_comments( $comments, $post_id ) {
     229function xprofile_filter_comments( $comments, $post_id = 0 ) {
     230
    226231    // Locate comment authors with WP accounts
    227232    foreach( (array) $comments as $comment ) {
     
    261266 * @since BuddyPress (1.7)
    262267 *
    263  * @global BuddyPress $bp
    264  * @global WPDB $wpdb
    265268 * @param BP_User_Query $user_query
    266269 * @param string $user_ids_sql
    267270 */
    268 function bp_xprofile_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql ) {
    269     global $bp, $wpdb;
     271function bp_xprofile_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql = '' ) {
    270272
    271273    if ( ! bp_is_active( 'xprofile' ) ) {
Note: See TracChangeset for help on using the changeset viewer.