Ticket #2255: 2255.diff
File 2255.diff, 3.9 KB (added by , 13 years ago) |
---|
-
bp-core/bp-core-templatetags.php
454 454 function bp_directory_members_search_form() { 455 455 global $bp; 456 456 457 $default_search_value = bp_get_search_default_text(); 457 $default_search_value = bp_get_search_default_text(); 458 458 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 459 459 460 460 ?> … … 1022 1022 1023 1023 $options = array(); 1024 1024 1025 $options['posts'] = __( 'Posts', 'buddypress' ); 1026 1025 1027 if ( bp_is_active( 'xprofile' ) ) 1026 1028 $options['members'] = __( 'Members', 'buddypress' ); 1027 1029 … … 1046 1048 return apply_filters( 'bp_search_form_type_select', $selection_box ); 1047 1049 } 1048 1050 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 */ 1058 function 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 ) ) 1063 1065 $component = $bp->current_component; 1064 1066 1065 1067 $default_text = __( 'Search anything...', 'buddypress' ); 1066 1068 1067 1069 if ( !empty( $bp->default_search_strings[$component] ) ) { 1068 1070 // Most of the time, $component will be the actual component name 1069 1071 $default_text = $bp->default_search_strings[$component]; … … 1076 1078 $default_text = $bp->default_search_strings[$key]; 1077 1079 } 1078 1080 } 1079 1080 return apply_filters( 'bp_search_default_text', $default_text, $component );1081 }1082 1081 1082 return apply_filters( 'bp_search_default_text', $default_text, $component ); 1083 } 1084 1083 1085 function bp_search_form() { 1084 1086 $form = ' 1085 1087 <form action="' . bp_search_form_action() . '" method="post" id="search-form"> … … 1155 1157 $text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text ); 1156 1158 1157 1159 preg_match( "%\s*((?:<[^>]+>)+\S*)\s*|\s+%s", $text, $matches, PREG_OFFSET_CAPTURE, $excerpt_length ); 1158 1160 1159 1161 if ( !empty( $matches ) ) { 1160 $pos = array_pop( array_pop( $matches ) ); 1162 $pos = array_pop( array_pop( $matches ) ); 1161 1163 $text = substr( $text, 0, $pos ) . ' [...]'; 1162 1164 } 1163 1165 1164 1166 return apply_filters( 'bp_create_excerpt', $text, $original_text ); 1165 1167 } 1166 1168 add_filter( 'bp_create_excerpt', 'wp_trim_excerpt' ); … … 2175 2177 add_filter( 'body_class', 'bp_get_the_body_class', 10, 2 ) 2176 2178 2177 2179 2178 ?> 2179 No newline at end of file 2180 ?> -
bp-core.php
169 169 $bp->current_component = $bp->default_component; 170 170 171 171 // 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' ); 173 173 174 174 do_action( 'bp_core_setup_globals' ); 175 175 } … … 251 251 252 252 if ( empty( $page_ids ) ) 253 253 return false; 254 254 255 255 $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( BP_ROOT_BLOG ) . 'posts' : $wpdb->posts; 256 256 257 257 $page_ids_sql = implode( ',', (array)$page_ids ); … … 1707 1707 1708 1708 if ( empty( $slug ) ) { 1709 1709 switch ( $search_which ) { 1710 case 'posts': 1711 $slug = ''; 1712 break; 1710 1713 case 'blogs': 1711 1714 $slug = bp_is_active( 'blogs' ) ? $bp->blogs->slug : ''; 1712 1715 break; … … 2163 2166 2164 2167 bp_core_update_page_meta( $page_ids ); 2165 2168 } 2166 ?> 2167 No newline at end of file 2169 ?>