Changeset 10203
- Timestamp:
- 10/07/2015 03:34:32 PM (9 years ago)
- Location:
- trunk/src/bp-xprofile
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-filters.php
r10200 r10203 27 27 add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 9 ); 28 28 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 ); 29 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value_by_type', 8, 2);30 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2);29 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value_by_type', 8, 3 ); 30 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 3 ); 31 31 32 32 add_filter( 'bp_get_the_profile_field_edit_value', 'force_balance_tags' ); … … 216 216 217 217 /** 218 * Apply display_filter() filters as defined by the BP_XProfile_Field_Type classes, when fetched inside 219 * a bp_has_profile() loop. 218 * Apply display_filter() filters as defined by BP_XProfile_Field_Type classes, when inside a bp_has_profile() loop. 220 219 * 221 220 * @since 2.1.0 221 * @since 2.4.0 Added `$field_id` parameter. 222 222 * 223 223 * @param mixed $field_value Field value. 224 224 * @param string $field_type Field type. 225 * @param int $field_id Optional. ID of the field. 225 226 * 226 227 * @return mixed 227 228 */ 228 function xprofile_filter_format_field_value_by_type( $field_value, $field_type = '' ) {229 function xprofile_filter_format_field_value_by_type( $field_value, $field_type = '', $field_id = '' ) { 229 230 foreach ( bp_xprofile_get_field_types() as $type => $class ) { 230 231 if ( $type !== $field_type ) { … … 233 234 234 235 if ( method_exists( $class, 'display_filter' ) ) { 235 $field_value = call_user_func( array( $class, 'display_filter' ), $field_value );236 $field_value = call_user_func( array( $class, 'display_filter' ), $field_value, $field_id ); 236 237 } 237 238 } … … 253 254 function xprofile_filter_format_field_value_by_field_id( $field_value, $field_id ) { 254 255 $field = xprofile_get_field( $field_id ); 255 return xprofile_filter_format_field_value_by_type( $field_value, $field->type );256 return xprofile_filter_format_field_value_by_type( $field_value, $field->type, $field_id ); 256 257 } 257 258 -
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php
r10179 r10203 302 302 * 303 303 * @since 2.1.0 304 * 305 * @param string $field_value The date value, as saved in the database. 306 * Typically, this is a MySQL-formatted date 307 * string (Y-m-d H:i:s). 304 * @since 2.4.0 Added the `$field_id` parameter. 305 * 306 * @param string $field_value The date value, as saved in the database. Typically, this is a MySQL-formatted 307 * date string (Y-m-d H:i:s). 308 * @param int $field_id Optional. ID of the field. 308 309 * 309 310 * @return string Date formatted by bp_format_time(). 310 311 */ 311 public static function display_filter( $field_value ) {312 public static function display_filter( $field_value, $field_id = '' ) { 312 313 313 314 // If Unix timestamp. -
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-url.php
r10179 r10203 125 125 * 126 126 * @since 2.1.0 127 * @since 2.4.0 Added the `$field_id` parameter. 127 128 * 128 129 * @param string $submitted_value Raw value submitted by the user. 130 * @param int $field_id Optional. ID of the field. 129 131 * 130 132 * @return string 131 133 */ 132 public static function pre_validate_filter( $submitted_value = '' ) {134 public static function pre_validate_filter( $submitted_value = '', $field_id = '' ) { 133 135 134 136 // Allow empty URL values. … … 153 155 * 154 156 * @since 2.1.0 157 * @since 2.4.0 Added the `$field_id` parameter. 155 158 * 156 159 * @param string $field_value The URL value, as saved in the database. 160 * @param int $field_id Optional. ID of the field. 157 161 * 158 162 * @return string URL converted to a link. 159 163 */ 160 public static function display_filter( $field_value ) {164 public static function display_filter( $field_value, $field_id = '' ) { 161 165 $link = strip_tags( $field_value ); 162 166 $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) ); -
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type.php
r10163 r10203 408 408 * 409 409 * @since 2.1.0 410 * @since 2.4.0 Added the `$field_id` parameter. 410 411 * 411 412 * @param mixed $field_value Submitted field value. 413 * @param int $field_id Optional. ID of the field. 412 414 * 413 415 * @return mixed 414 416 */ 415 public static function pre_validate_filter( $field_value ) {417 public static function pre_validate_filter( $field_value, $field_id = '' ) { 416 418 return $field_value; 417 419 } … … 425 427 * 426 428 * @since 2.1.0 429 * @since 2.4.0 Added `$field_id` parameter. 427 430 * 428 431 * @param mixed $field_value Field value. 432 * @param int $field_id ID of the field. 429 433 * 430 434 * @return mixed 431 435 */ 432 public static function display_filter( $field_value ) {436 public static function display_filter( $field_value, $field_id = '' ) { 433 437 return $field_value; 434 438 }
Note: See TracChangeset
for help on using the changeset viewer.