Skip to:
Content

BuddyPress.org

Ticket #2255: 2255.diff

File 2255.diff, 3.9 KB (added by sorich87, 13 years ago)
  • bp-core/bp-core-templatetags.php

     
    454454function bp_directory_members_search_form() {
    455455        global $bp;
    456456
    457         $default_search_value = bp_get_search_default_text(); 
     457        $default_search_value = bp_get_search_default_text();
    458458        $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value;
    459459
    460460        ?>
     
    10221022
    10231023        $options = array();
    10241024
     1025        $options['posts'] = __( 'Posts', 'buddypress' );
     1026
    10251027        if ( bp_is_active( 'xprofile' ) )
    10261028                $options['members'] = __( 'Members', 'buddypress' );
    10271029
     
    10461048        return apply_filters( 'bp_search_form_type_select', $selection_box );
    10471049}
    10481050
    1049 /** 
    1050  * Get the default text for the search box for a given component. 
    1051  * 
    1052  * @global object $bp BuddyPress global settings 
    1053  * @return string 
    1054  * @since 1.3 
    1055  */ 
    1056 function bp_search_default_text() { 
    1057         echo bp_get_search_default_text(); 
    1058 } 
    1059         function bp_get_search_default_text( $component = false ) { 
    1060                 global $bp; 
    1061                
    1062                 if ( empty( $component ) ) 
     1051/**
     1052 * Get the default text for the search box for a given component.
     1053 *
     1054 * @global object $bp BuddyPress global settings
     1055 * @return string
     1056 * @since 1.3
     1057 */
     1058function bp_search_default_text() {
     1059        echo bp_get_search_default_text();
     1060}
     1061        function bp_get_search_default_text( $component = false ) {
     1062                global $bp;
     1063
     1064                if ( empty( $component ) )
    10631065                        $component = $bp->current_component;
    1064                
     1066
    10651067                $default_text = __( 'Search anything...', 'buddypress' );
    1066                
     1068
    10671069                if ( !empty( $bp->default_search_strings[$component] ) ) {
    10681070                        // Most of the time, $component will be the actual component name
    10691071                        $default_text = $bp->default_search_strings[$component];
     
    10761078                                        $default_text = $bp->default_search_strings[$key];
    10771079                        }
    10781080                }
    1079                
    1080                 return apply_filters( 'bp_search_default_text', $default_text, $component );
    1081         }
    10821081
     1082                return apply_filters( 'bp_search_default_text', $default_text, $component );
     1083        }
     1084
    10831085function bp_search_form() {
    10841086        $form = '
    10851087                <form action="' . bp_search_form_action() . '" method="post" id="search-form">
     
    11551157                $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
    11561158
    11571159        preg_match( "%\s*((?:<[^>]+>)+\S*)\s*|\s+%s", $text, $matches, PREG_OFFSET_CAPTURE, $excerpt_length );
    1158        
     1160
    11591161        if ( !empty( $matches ) ) {
    1160                 $pos = array_pop( array_pop( $matches ) );     
     1162                $pos = array_pop( array_pop( $matches ) );
    11611163                $text = substr( $text, 0, $pos ) . ' [...]';
    11621164        }
    1163        
     1165
    11641166        return apply_filters( 'bp_create_excerpt', $text, $original_text );
    11651167}
    11661168add_filter( 'bp_create_excerpt', 'wp_trim_excerpt' );
     
    21752177        add_filter( 'body_class', 'bp_get_the_body_class', 10, 2 )
    21762178
    21772179
    2178 ?>
    2179  No newline at end of file
     2180?>
  • bp-core.php

     
    169169                $bp->current_component = $bp->default_component;
    170170
    171171        // The default text for the members directory search box
    172         $bp->default_search_strings[$bp->members->slug] = __( 'Search Members...', 'buddypress' ); 
     172        $bp->default_search_strings[$bp->members->slug] = __( 'Search Members...', 'buddypress' );
    173173
    174174        do_action( 'bp_core_setup_globals' );
    175175}
     
    251251
    252252        if ( empty( $page_ids ) )
    253253                return false;
    254                
     254
    255255        $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( BP_ROOT_BLOG ) . 'posts' : $wpdb->posts;
    256256
    257257        $page_ids_sql = implode( ',', (array)$page_ids );
     
    17071707
    17081708        if ( empty( $slug ) ) {
    17091709                switch ( $search_which ) {
     1710                        case 'posts':
     1711                                $slug = '';
     1712                                break;
    17101713                        case 'blogs':
    17111714                                $slug = bp_is_active( 'blogs' )  ? $bp->blogs->slug  : '';
    17121715                                break;
     
    21632166
    21642167        bp_core_update_page_meta( $page_ids );
    21652168}
    2166 ?>
    2167  No newline at end of file
     2169?>