Changeset 3627
- Timestamp:
- 12/30/2010 10:13:05 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
bp-blogs.php (modified) (2 diffs)
-
bp-blogs/bp-blogs-templatetags.php (modified) (1 diff)
-
bp-core.php (modified) (1 diff)
-
bp-core/bp-core-templatetags.php (modified) (2 diffs)
-
bp-forums.php (modified) (3 diffs)
-
bp-forums/bp-forums-templatetags.php (modified) (1 diff)
-
bp-groups.php (modified) (2 diffs)
-
bp-groups/bp-groups-templatetags.php (modified) (1 diff)
-
bp-themes/bp-default/_inc/ajax.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r3578 r3627 13 13 define ( 'BP_BLOGS_SLUG', $bp->pages->blogs->slug ); 14 14 15 / * For internal identification */15 // For internal identification 16 16 $bp->blogs->id = 'blogs'; 17 17 … … 23 23 $bp->blogs->format_notification_function = 'bp_blogs_format_notifications'; 24 24 25 / * Register this in the active components array */25 // Register this in the active components array 26 26 $bp->active_components[$bp->blogs->slug] = $bp->blogs->id; 27 28 // The default text for the blogs directory search box 29 $bp->default_search_strings[$bp->blogs->slug] = __( 'Search Blogs...', 'buddypress' ); 27 30 28 31 do_action( 'bp_blogs_setup_globals' ); -
trunk/bp-blogs/bp-blogs-templatetags.php
r3616 r3627 505 505 global $bp; 506 506 507 $search_value = __( 'Search anything...', 'buddypress' ); 508 if ( !empty( $_GET['s'] ) ) 509 $search_value = stripslashes( $_GET['s'] ); 507 $default_search_value = bp_get_search_default_text(); 508 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 510 509 511 510 ?> 512 511 <form action="" method="get" id="search-blogs-form"> 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>512 <label><input type="text" name="s" id="blogs_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label> 514 513 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 515 514 </form> -
trunk/bp-core.php
r3612 r3627 168 168 if ( !$bp->current_component && $bp->displayed_user->id ) 169 169 $bp->current_component = $bp->default_component; 170 171 // The default text for the members directory search box 172 $bp->default_search_strings[$bp->members->slug] = __( 'Search Members...', 'buddypress' ); 170 173 171 174 do_action( 'bp_core_setup_globals' ); -
trunk/bp-core/bp-core-templatetags.php
r3622 r3627 455 455 global $bp; 456 456 457 $search_value = __( 'Search anything...', 'buddypress' ); 458 if ( !empty( $_GET['s'] ) ) 459 $search_value = stripslashes( $_GET['s'] ); 457 $default_search_value = bp_get_search_default_text(); 458 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 460 459 461 460 ?> 462 461 <form action="" method="get" id="search-members-form"> 463 <label><input type="text" name="s" id="members_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>462 <label><input type="text" name="s" id="members_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label> 464 463 <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 465 464 </form> … … 1049 1048 } 1050 1049 1050 /** 1051 * Get the default text for the search box for a given component. 1052 * 1053 * @global object $bp BuddyPress global settings 1054 * @return string 1055 * @since 1.3 1056 */ 1057 function bp_search_default_text() { 1058 echo bp_get_search_default_text(); 1059 } 1060 function bp_get_search_default_text( $component = false ) { 1061 global $bp; 1062 1063 if ( empty( $component ) ) 1064 $component = $bp->current_component; 1065 1066 $default_text = __( 'Search anything...', 'buddypress' ); 1067 1068 if ( !empty( $bp->default_search_strings[$component] ) ) { 1069 // Most of the time, $component will be the actual component name 1070 $default_text = $bp->default_search_strings[$component]; 1071 } else { 1072 // When the request comes through AJAX, we need to get the component name 1073 // out of $bp->pages 1074 if ( !empty( $bp->pages->{$component}->slug ) ) { 1075 $key = $bp->pages->{$component}->slug; 1076 if ( !empty( $bp->default_search_strings[$key] ) ) 1077 $default_text = $bp->default_search_strings[$key]; 1078 } 1079 } 1080 1081 return apply_filters( 'bp_search_default_text', $default_text, $component ); 1082 } 1083 1051 1084 function bp_search_form() { 1052 1085 $form = ' -
trunk/bp-forums.php
r3592 r3627 5 5 define( 'BP_FORUMS_PARENT_FORUM_ID', 1 ); 6 6 7 if ( !defined( 'BP_FORUMS_SLUG' ) )8 define( 'BP_FORUMS_SLUG', 'forums' );9 10 7 if ( !defined( 'BB_PATH' ) ) 11 8 require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-bbpress.php' ); … … 14 11 require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-filters.php' ); 15 12 13 /** 14 * Puts important forums component data into the $bp global for later use. 15 * 16 * @package BuddyPress Forums 17 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 18 */ 16 19 function bp_forums_setup() { 17 20 global $bp; 18 19 /* For internal identification */ 21 22 if ( !defined( 'BP_FORUMS_SLUG' ) ) 23 define ( 'BP_FORUMS_SLUG', $bp->pages->forums->slug ); 24 25 // For internal identification 20 26 $bp->forums->id = 'forums'; 21 27 … … 26 32 $bp->forums->bbconfig = $bp->site_options['bb-config-location']; 27 33 28 / * Register this in the active components array */34 // Register this in the active components array 29 35 $bp->active_components[$bp->forums->slug] = $bp->forums->id; 36 37 // The default text for the forums directory search box 38 $bp->default_search_strings[$bp->forums->slug] = __( 'Search Forum Topics...', 'buddypress' ); 30 39 31 40 do_action( 'bp_forums_setup' ); -
trunk/bp-forums/bp-forums-templatetags.php
r3616 r3627 1029 1029 global $bp; 1030 1030 1031 $search_value = __( 'Search anything...', 'buddypress' ); 1032 if ( !empty( $_REQUEST['fs'] ) ) 1033 $search_value = stripslashes( $_REQUEST['fs'] ); 1031 $default_search_value = bp_get_search_default_text(); 1032 $search_value = !empty( $_REQUEST['fs'] ) ? stripslashes( $_REQUEST['fs'] ) : $default_search_value; 1034 1033 1035 1034 ?> 1036 1035 <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>1036 <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label> 1038 1037 <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 1039 1038 </form> -
trunk/bp-groups.php
r3620 r3627 5 5 require ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-filters.php' ); 6 6 7 /** 8 * Puts important groups component data into the $bp global for later use. 9 * 10 * @package BuddyPress Groups 11 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 12 */ 7 13 function groups_setup_globals() { 8 global $bp , $wpdb;14 global $bp; 9 15 10 16 if ( !defined( 'BP_GROUPS_SLUG' ) ) … … 40 46 // Auto join group when non group member performs group activity 41 47 $bp->groups->auto_join = defined( 'BP_DISABLE_AUTO_GROUP_JOIN' ) ? false : true; 48 49 // The default text for the groups directory search box 50 $bp->default_search_strings[$bp->groups->slug] = __( 'Search Groups...', 'buddypress' ); 42 51 43 52 do_action( 'groups_setup_globals' ); -
trunk/bp-groups/bp-groups-templatetags.php
r3616 r3627 1872 1872 global $bp; 1873 1873 1874 $search_value = __( 'Search anything...', 'buddypress' ); 1875 if ( !empty( $_REQUEST['s'] ) ) 1876 $search_value = stripslashes( $_REQUEST['s'] ); 1874 $default_search_value = bp_get_search_default_text(); 1875 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 1877 1876 1878 1877 ?> 1879 1878 <form action="" method="get" id="search-groups-form"> 1880 <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>1879 <label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label> 1881 1880 <input type="submit" id="groups_search_submit" name="groups_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 1882 1881 </form> -
trunk/bp-themes/bp-default/_inc/ajax.php
r3592 r3627 54 54 $qs[] = 'page=' . $_POST['page']; 55 55 56 if ( !empty( $_POST['search_terms'] ) && __( 'Search anything...', 'buddypress' ) != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] ) 56 $object_search_text = bp_get_search_default_text( $object ); 57 if ( !empty( $_POST['search_terms'] ) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] ) 57 58 $qs[] = 'search_terms=' . $_POST['search_terms']; 58 59
Note: See TracChangeset
for help on using the changeset viewer.