Changeset 3248
- Timestamp:
- 09/10/2010 11:10:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-xprofile/bp-xprofile-filters.php
r2576 r3248 2 2 3 3 /* Apply WordPress defined filters */ 4 add_filter( 'bp_get_the_profile_field_value', 'wp_filter_kses', 1 );5 add_filter( 'bp_get_the_profile_field_name', 'wp_filter_kses', 1 );6 4 7 add_filter( 'bp_get_the_site_member_profile_data', 'wp_filter_kses', 1 ); 8 add_filter( 'xprofile_get_field_data', 'wp_filter_kses', 1 ); 9 add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses', 1 ); 5 add_filter( 'bp_get_the_profile_field_value', 'wp_filter_kses', 1 ); 6 add_filter( 'bp_get_the_profile_field_name', 'wp_filter_kses', 1 ); 7 add_filter( 'bp_get_the_site_member_profile_data', 'wp_filter_kses', 1 ); 8 add_filter( 'bp_get_the_profile_field_edit_value', 'wp_filter_kses', 1 ); 9 add_filter( 'bp_get_the_profile_field_description', 'wp_filter_kses', 1 ); 10 11 add_filter( 'bp_get_the_profile_field_value', 'wptexturize' ); 12 add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 2 ); 13 add_filter( 'bp_get_the_profile_field_value', 'convert_chars' ); 14 add_filter( 'bp_get_the_profile_field_value', 'wpautop' ); 15 add_filter( 'bp_get_the_profile_field_value', 'make_clickable' ); 16 add_filter( 'bp_get_the_profile_field_value', 'force_balance_tags' ); 17 18 add_filter( 'bp_get_the_profile_field_value', 'stripslashes' ); 19 add_filter( 'bp_get_the_profile_field_edit_value', 'stripslashes' ); 20 add_filter( 'bp_get_the_profile_field_name', 'stripslashes' ); 21 add_filter( 'bp_get_the_profile_field_description', 'stripslashes' ); 22 add_filter( 'bp_get_the_site_member_profile_data', 'stripslashes' ); 23 24 add_filter( 'xprofile_get_field_data', 'wp_filter_kses', 1 ); 25 add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses', 1 ); 10 26 add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses', 1 ); 27 add_filter( 'xprofile_data_value_before_save', 'wp_filter_kses', 1 ); 11 28 12 add_filter( 'bp_get_the_profile_field_edit_value', 'wp_filter_kses', 1 ); 13 add_filter( 'bp_get_the_profile_field_description', 'wp_filter_kses', 1 ); 29 add_filter( 'xprofile_get_field_data', 'force_balance_tags' ); 30 add_filter( 'xprofile_field_name_before_save', 'force_balance_tags' ); 31 add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' ); 32 add_filter( 'xprofile_data_value_before_save', 'force_balance_tags' ); 14 33 15 add_filter( 'xprofile_field_name_before_save', 'force_balance_tags' ); 16 add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' ); 17 18 add_filter( 'bp_get_the_profile_field_value', 'wptexturize' ); 19 add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 2 ); 20 add_filter( 'bp_get_the_profile_field_value', 'convert_chars' ); 21 add_filter( 'bp_get_the_profile_field_value', 'wpautop' ); 22 add_filter( 'bp_get_the_profile_field_value', 'make_clickable' ); 23 add_filter( 'bp_get_the_profile_field_value', 'force_balance_tags' ); 24 25 add_filter( 'bp_get_the_site_member_profile_data', 'wptexturize' ); 26 add_filter( 'bp_get_the_site_member_profile_data', 'convert_smilies', 2 ); 27 add_filter( 'bp_get_the_site_member_profile_data', 'convert_chars' ); 28 add_filter( 'bp_get_the_site_member_profile_data', 'make_clickable' ); 29 add_filter( 'bp_get_the_site_member_profile_data', 'force_balance_tags' ); 30 31 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 ); 32 add_filter( 'bp_get_the_site_member_profile_data', 'xprofile_filter_format_field_value', 1, 2 ); 33 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 50, 2 ); 34 35 add_filter( 'bp_get_the_profile_field_edit_value', 'stripslashes' ); 36 add_filter( 'bp_get_the_profile_field_value', 'stripslashes' ); 37 add_filter( 'bp_get_the_profile_field_name', 'stripslashes' ); 38 add_filter( 'xprofile_get_field_data', 'stripslashes' ); 39 add_filter( 'bp_get_the_profile_field_description', 'stripslashes' ); 40 add_filter( 'bp_get_the_site_member_profile_data', 'stripslashes' ); 34 add_filter( 'xprofile_get_field_data', 'stripslashes' ); 41 35 42 36 /* Custom BuddyPress filters */ 43 37 38 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 ); 39 add_filter( 'bp_get_the_site_member_profile_data', 'xprofile_filter_format_field_value', 1, 2 ); 40 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 50, 2 ); 41 44 42 function xprofile_filter_format_field_value( $field_value, $field_type = '' ) { 45 if ( !isset( $field_value) || empty( $field_value ) )43 if ( !isset( $field_value ) || empty( $field_value ) ) 46 44 return false; 47 45 48 if ( 'datebox' == $field_type ) {46 if ( 'datebox' == $field_type ) 49 47 $field_value = bp_format_time( $field_value, true ); 50 } else {48 else 51 49 $field_value = str_replace(']]>', ']]>', $field_value ); 52 }53 50 54 return stripslashes( stripslashes( $field_value ));51 return stripslashes( $field_value ); 55 52 } 56 53 … … 68 65 $value = trim( $value ); 69 66 70 / * If the value is a URL, skip it and just make it clickable. */67 // If the value is a URL, skip it and just make it clickable. 71 68 if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) { 72 69 $new_values[] = make_clickable( $value ); 73 70 } else { 74 if ( count( explode( ' ', $value ) ) > 5 ) 71 if ( count( explode( ' ', $value ) ) > 5 ) { 75 72 $new_values[] = $value; 76 else73 } else { 77 74 $new_values[] = '<a href="' . site_url( BP_MEMBERS_SLUG ) . '/?s=' . strip_tags( $value ) . '">' . $value . '</a>'; 75 } 78 76 } 79 77 } … … 87 85 function xprofile_filter_comments( $comments, $post_id ) { 88 86 foreach( (array)$comments as $comment ) { 89 if ( $comment->user_id ) 87 if ( $comment->user_id ) { 90 88 $user_ids[] = $comment->user_id; 89 } 91 90 } 92 91 … … 102 101 foreach( (array)$comments as $i => $comment ) { 103 102 if ( !empty( $comment->user_id ) ) { 104 if ( !empty( $users[$comment->user_id] ) ) 103 if ( !empty( $users[$comment->user_id] ) ) { 105 104 $comments[$i]->comment_author = $users[$comment->user_id]; 105 } 106 106 } 107 107 }
Note: See TracChangeset
for help on using the changeset viewer.