Changeset 13587 for trunk/src/bp-core/admin/bp-core-admin-settings.php
- Timestamp:
- 09/29/2023 02:07:48 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/admin/bp-core-admin-settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-settings.php
r13533 r13587 453 453 echo bp_get_form_option( $option, $default, $slug ); 454 454 } 455 456 /** 457 * Return settings API option 458 * 459 * @since 1.6.0 460 * 461 * 462 * @param string $option Form option to return. 463 * @param string $default Form option default. 464 * @param bool $slug Form option slug. 465 * @return string 466 */ 467 function bp_get_form_option( $option, $default = '', $slug = false ) { 468 469 // Get the option and sanitize it. 470 $value = bp_get_option( $option, $default ); 471 472 // Slug? 473 if ( true === $slug ) { 474 475 /** 476 * Filters the slug value in the form field. 477 * 478 * @since 1.6.0 479 * 480 * @param string $value Value being returned for the requested option. 481 */ 482 $value = esc_attr( apply_filters( 'editable_slug', $value ) ); 483 } else { // Not a slug. 484 $value = esc_attr( $value ); 485 } 486 487 // Fallback to default. 488 if ( empty( $value ) ) { 489 $value = $default; 490 } 491 455 492 /** 456 * Return settings API option493 * Filters the settings API option. 457 494 * 458 495 * @since 1.6.0 459 496 * 460 * 461 * @param string $option Form option to return. 462 * @param string $default Form option default. 463 * @param bool $slug Form option slug. 464 * @return string 497 * @param string $value Value being returned for the requested option. 498 * @param string $option Option whose value is being requested. 465 499 */ 466 function bp_get_form_option( $option, $default = '', $slug = false ) { 467 468 // Get the option and sanitize it. 469 $value = bp_get_option( $option, $default ); 470 471 // Slug? 472 if ( true === $slug ) { 473 474 /** 475 * Filters the slug value in the form field. 476 * 477 * @since 1.6.0 478 * 479 * @param string $value Value being returned for the requested option. 480 */ 481 $value = esc_attr( apply_filters( 'editable_slug', $value ) ); 482 } else { // Not a slug. 483 $value = esc_attr( $value ); 484 } 485 486 // Fallback to default. 487 if ( empty( $value ) ) 488 $value = $default; 489 490 /** 491 * Filters the settings API option. 492 * 493 * @since 1.6.0 494 * 495 * @param string $value Value being returned for the requested option. 496 * @param string $option Option whose value is being requested. 497 */ 498 return apply_filters( 'bp_get_form_option', $value, $option ); 499 } 500 return apply_filters( 'bp_get_form_option', $value, $option ); 501 }
Note: See TracChangeset
for help on using the changeset viewer.