Ticket #2603: pgibbs3.patch
File pgibbs3.patch, 3.4 KB (added by , 14 years ago) |
---|
-
bp-xprofile/bp-xprofile-filters.php
8 8 add_filter( 'xprofile_get_field_data', 'wp_filter_kses', 1 ); 9 9 add_filter( 'xprofile_field_name_before_save', 'wp_filter_kses', 1 ); 10 10 add_filter( 'xprofile_field_description_before_save', 'wp_filter_kses', 1 ); 11 add_filter( 'xprofile_filter_format_field_data', 'wp_filter_kses', 1 ); 11 12 12 13 add_filter( 'bp_get_the_profile_field_edit_value', 'wp_filter_kses', 1 ); 13 14 add_filter( 'bp_get_the_profile_field_description', 'wp_filter_kses', 1 ); 14 15 15 16 add_filter( 'xprofile_field_name_before_save', 'force_balance_tags' ); 16 17 add_filter( 'xprofile_field_description_before_save', 'force_balance_tags' ); 18 add_filter( 'xprofile_filter_format_field_data', 'force_balance_tags' ); 17 19 18 20 add_filter( 'bp_get_the_profile_field_value', 'wptexturize' ); 19 21 add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 2 ); … … 41 43 42 44 /* Custom BuddyPress filters */ 43 45 46 /** 47 * xprofile_filter_format_field_data() 48 * 49 * Sanitises xprofile field data. 50 * 51 * @package BuddyPress xProfile 52 * @param string $value The new field value 53 * @param int $id ID for bp_xprofile_data record. May be zero if this is a new record. 54 * @param BP_XProfile_ProfileData $profiledata Current xProfile field data class. 55 * @return string|array 56 */ 57 function xprofile_filter_format_field_data( $value, $id, $profiledata ) { 58 if ( !$field = new BP_XProfile_Field( $profiledata->field_id ) ) 59 return $value; 60 61 switch ( $field->type ) { 62 case 'textbox': 63 case 'textarea': 64 $value = apply_filters( 'xprofile_filter_format_field_data', $value, $id ); 65 break; 66 67 case 'checkbox': 68 case 'selectbox': 69 case 'multiselectbox': 70 case 'radio': 71 if ( !is_array( $value ) ) 72 break; 73 74 foreach ( $value as $v ) { 75 $v = apply_filters( 'xprofile_filter_format_field_data', $v, $id ); 76 } 77 break; 78 } 79 80 return $value; 81 } 82 add_filter( 'xprofile_data_value_before_save', 'xprofile_filter_format_field_data', 10, 3 ); 83 44 84 function xprofile_filter_format_field_value( $field_value, $field_type = '' ) { 45 85 if ( !isset($field_value) || empty( $field_value ) ) 46 86 return false; -
bp-xprofile/bp-xprofile-classes.php
719 719 function save() { 720 720 global $wpdb, $bp; 721 721 722 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id );723 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id );724 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id );725 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id );722 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id, $this ); 723 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id, $this ); 724 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id, $this ); 725 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id, $this ); 726 726 727 727 do_action( 'xprofile_data_before_save', $this ); 728 728