Changeset 8665
- Timestamp:
- 07/22/2014 08:24:39 PM (11 years ago)
- Location:
- trunk/src/bp-xprofile
- Files:
-
- 2 edited
-
bp-xprofile-classes.php (modified) (1 diff)
-
bp-xprofile-filters.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-classes.php
r8656 r8665 1098 1098 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id ); 1099 1099 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id ); 1100 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id );1100 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id, true, $this ); 1101 1101 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id ); 1102 1102 -
trunk/src/bp-xprofile/bp-xprofile-filters.php
r8645 r8665 52 52 add_filter( 'xprofile_get_field_data', 'xprofile_filter_format_field_value_by_field_id', 5, 2 ); 53 53 54 add_filter( 'xprofile_data_value_before_save', 'xprofile_sanitize_data_value_before_save', 1, 2);54 add_filter( 'xprofile_data_value_before_save', 'xprofile_sanitize_data_value_before_save', 1, 4 ); 55 55 add_filter( 'xprofile_filtered_data_value_before_save', 'trim', 2 ); 56 56 … … 61 61 * 62 62 * @param string $content 63 * @param object $data_obj The BP_XProfile_ProfileData object 63 64 * @return string $content 64 65 */ 65 function xprofile_filter_kses( $content ) {66 function xprofile_filter_kses( $content, $data_obj = null ) { 66 67 global $allowedtags; 67 68 … … 69 70 $xprofile_allowedtags['a']['rel'] = array(); 70 71 71 $xprofile_allowedtags = apply_filters( 'xprofile_allowed_tags', $xprofile_allowedtags );72 $xprofile_allowedtags = apply_filters( 'xprofile_allowed_tags', $xprofile_allowedtags, $data_obj ); 72 73 return wp_kses( $content, $xprofile_allowedtags ); 73 74 } … … 79 80 * @param int $field_id 80 81 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true 82 * @param object $data_obj The BP_XProfile_ProfileData object 81 83 * @return string 82 84 */ 83 function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, $reserialize = true ) {85 function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, $reserialize = true, $data_obj = null ) { 84 86 85 87 // Return if empty … … 93 95 // Filter single value 94 96 if ( !is_array( $field_value ) ) { 95 $kses_field_value = xprofile_filter_kses( $field_value );97 $kses_field_value = xprofile_filter_kses( $field_value, $data_obj ); 96 98 $filtered_field_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); 97 $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value );99 $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value, $data_obj ); 98 100 99 101 // Filter each array item independently … … 101 103 $filtered_values = array(); 102 104 foreach ( (array) $field_value as $value ) { 103 $kses_field_value = xprofile_filter_kses( $value );105 $kses_field_value = xprofile_filter_kses( $value, $data_obj ); 104 106 $filtered_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); 105 $filtered_values[] = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_value, $value );107 $filtered_values[] = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_value, $value, $data_obj ); 106 108 107 109 }
Note: See TracChangeset
for help on using the changeset viewer.