Changeset 3511
- Timestamp:
- 12/04/2010 11:41:28 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-templatetags.php
r3481 r3511 503 503 504 504 function bp_directory_blogs_search_form() { 505 global $bp; ?> 505 global $bp; 506 507 $search_value = __( 'Search anything...', 'buddypress' ); 508 if ( !empty( $_GET['s'] ) ) 509 $search_value = stripslashes( $_GET['s'] ); 510 511 ?> 506 512 <form action="" method="get" id="search-blogs-form"> 507 <label><input type="text" name="s" id="blogs_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e( 'Search anything...', 'buddypress' ); }?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>513 <label><input type="text" name="s" id="blogs_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label> 508 514 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 509 515 </form> -
trunk/bp-core.php
r3490 r3511 1679 1679 * @package BuddyPress Core 1680 1680 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 1681 * @param $slug The slug to redirect to for searching. 1682 */ 1683 function bp_core_action_search_site( $slug = false ) { 1684 global $bp; 1685 1686 if ( $bp->current_component == BP_SEARCH_SLUG ) { 1687 $search_terms = $_POST['search-terms']; 1688 $search_which = $_POST['search-which']; 1689 1690 if ( !$slug || empty( $slug ) ) { 1691 switch ( $search_which ) { 1692 case 'members': default: 1693 $slug = $bp->members->slug; 1694 $var = '/?s='; 1695 break; 1696 case 'groups': 1697 $slug = BP_GROUPS_SLUG; 1698 $var = '/?s='; 1699 break; 1700 case 'forums': 1701 $slug = BP_FORUMS_SLUG; 1702 $var = '/?fs='; 1703 break; 1704 case 'blogs': 1705 $slug = BP_BLOGS_SLUG; 1706 $var = '/?s='; 1707 break; 1708 } 1681 * @param string $slug The slug to redirect to for searching. 1682 */ 1683 function bp_core_action_search_site( $slug = '' ) { 1684 global $bp; 1685 1686 if ( BP_SEARCH_SLUG != $bp->current_component ) 1687 return; 1688 1689 if ( empty( $_POST['search-terms'] ) ) { 1690 bp_core_redirect( $bp->root_domain ); 1691 return; 1692 } 1693 1694 $search_terms = stripslashes( $_POST['search-terms'] ); 1695 $search_which = !empty( $_POST['search-which'] ) ? $_POST['search-which'] : ''; 1696 $query_string = '/?s='; 1697 1698 if ( empty( $slug ) ) { 1699 switch ( $search_which ) { 1700 case 'blogs': 1701 $slug = bp_is_active( 'blogs' ) ? $bp->blogs->slug : ''; 1702 break; 1703 case 'forums': 1704 $slug = bp_is_active( 'forums' ) ? $bp->forums->slug : ''; 1705 $query_string = '/?fs='; 1706 break; 1707 case 'groups': 1708 $slug = bp_is_active( 'groups' ) ? $bp->groups->slug : ''; 1709 break; 1710 case 'members': 1711 default: 1712 $slug = $bp->members->slug; 1713 break; 1709 1714 } 1710 1715 1711 $search_url = apply_filters( 'bp_core_search_site', site_url( $slug . $var . urlencode($search_terms) ), $search_terms ); 1712 1713 bp_core_redirect( $search_url ); 1714 } 1716 if ( empty( $slug ) ) { 1717 bp_core_redirect( $bp->root_domain ); 1718 return; 1719 } 1720 } 1721 1722 bp_core_redirect( apply_filters( 'bp_core_search_site', site_url( $slug . $query_string . urlencode( $search_terms ) ), $search_terms ) ); 1715 1723 } 1716 1724 add_action( 'init', 'bp_core_action_search_site', 5 ); -
trunk/bp-core/bp-core-templatetags.php
r3503 r3511 457 457 $search_value = __( 'Search anything...', 'buddypress' ); 458 458 if ( !empty( $_GET['s'] ) ) 459 $search_value = $_GET['s'];459 $search_value = stripslashes( $_GET['s'] ); 460 460 461 461 ?> -
trunk/bp-forums/bp-forums-templatetags.php
r3479 r3511 1031 1031 $search_value = __( 'Search anything...', 'buddypress' ); 1032 1032 if ( !empty( $_REQUEST['fs'] ) ) 1033 $search_value = $_REQUEST['fs'];1033 $search_value = stripslashes( $_REQUEST['fs'] ); 1034 1034 1035 1035 ?> 1036 1036 <form action="" method="get" id="search-forums-form"> 1037 <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr( $search_value) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>1037 <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label> 1038 1038 <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 1039 1039 </form> -
trunk/bp-groups/bp-groups-templatetags.php
r3479 r3511 1836 1836 1837 1837 $search_value = __( 'Search anything...', 'buddypress' ); 1838 if ( isset( $_REQUEST['s'] ) &&!empty( $_REQUEST['s'] ) )1839 $search_value = $_REQUEST['s'];1838 if ( !empty( $_REQUEST['s'] ) ) 1839 $search_value = stripslashes( $_REQUEST['s'] ); 1840 1840 1841 1841 ?> 1842 1842 <form action="" method="get" id="search-groups-form"> 1843 <label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr( $search_value) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>1843 <label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label> 1844 1844 <input type="submit" id="groups_search_submit" name="groups_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 1845 1845 </form>
Note: See TracChangeset
for help on using the changeset viewer.