Changeset 11048 for trunk/src/bp-core/bp-core-template.php
- Timestamp:
- 08/31/2016 01:21:12 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-template.php
r10899 r11048 583 583 */ 584 584 return apply_filters( 'bp_search_form_type_select', $selection_box ); 585 } 586 587 /** 588 * Output the 'name' attribute for search form input element. 589 * 590 * @since 2.7.0 591 * 592 * @param string $component See bp_get_search_input_name(). 593 */ 594 function bp_search_input_name( $component = '' ) { 595 echo esc_attr( bp_get_search_input_name( $component ) ); 596 } 597 598 /** 599 * Get the 'name' attribute for the search form input element. 600 * 601 * @since 2.7.0 602 * 603 * @param string $component Component name. Defaults to current component. 604 * @return string Text for the 'name' attribute. 605 */ 606 function bp_get_search_input_name( $component = '' ) { 607 if ( ! $component ) { 608 $component = bp_current_component(); 609 } 610 611 $bp = buddypress(); 612 613 $name = ''; 614 if ( isset( $bp->{$component}->id ) ) { 615 $name = $bp->{$component}->id . '_search'; 616 } 617 618 return $name; 619 } 620 621 /** 622 * Output the placeholder text for the search box for a given component. 623 * 624 * @since 2.7.0 625 * 626 * @param string $component See bp_get_search_placeholder(). 627 */ 628 function bp_search_placeholder( $component = '' ) { 629 echo esc_attr( bp_get_search_placeholder( $component ) ); 630 } 631 632 /** 633 * Get the placeholder text for the search box for a given component. 634 * 635 * @since 2.7.0 636 * 637 * @param string $component Component name. Defaults to current component. 638 * @return string Placeholder text for the search field. 639 */ 640 function bp_get_search_placeholder( $component = '' ) { 641 $query_arg = bp_core_get_component_search_query_arg( $component ); 642 643 if ( $query_arg && ! empty( $_REQUEST[ $query_arg ] ) ) { 644 $placeholder = wp_unslash( $_REQUEST[ $query_arg ] ); 645 } else { 646 $placeholder = bp_get_search_default_text( $component ); 647 } 648 649 return $placeholder; 585 650 } 586 651
Note: See TracChangeset
for help on using the changeset viewer.