Ticket #6844: 6844.01.patch
File 6844.01.patch, 15.6 KB (added by , 9 years ago) |
---|
-
src/bp-blogs/bp-blogs-template.php
1441 1441 do_action( 'bp_blogs_blog_tabs' ); 1442 1442 } 1443 1443 1444 /**1445 * Output the blog directory search form.1446 */1447 function bp_directory_blogs_search_form() {1448 1444 1449 $query_arg = bp_core_get_component_search_query_arg( 'blogs' );1450 1451 if ( ! empty( $_REQUEST[ $query_arg ] ) ) {1452 $search_value = stripslashes( $_REQUEST[ $query_arg ] );1453 } else {1454 $search_value = bp_get_search_default_text( 'blogs' );1455 }1456 1457 $search_form_html = '<form action="" method="get" id="search-blogs-form">1458 <label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label>1459 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />1460 </form>';1461 1462 /**1463 * Filters the output for the blog directory search form.1464 *1465 * @since 1.9.01466 *1467 * @param string $search_form_html HTML markup for blog directory search form.1468 */1469 echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html );1470 }1471 1472 1445 /** 1473 1446 * Output the Create a Site button. 1474 1447 * -
src/bp-forums/bp-forums-template.php
2648 2648 } 2649 2649 2650 2650 /** 2651 * Output the forums directory search form.2652 */2653 function bp_directory_forums_search_form() {2654 $default_search_value = bp_get_search_default_text( 'forums' );2655 $search_value = !empty( $_REQUEST['fs'] ) ? stripslashes( $_REQUEST['fs'] ) : $default_search_value;2656 2657 $search_form_html = '<form action="" method="get" id="search-forums-form">2658 <label for="forums_search"><input type="text" name="s" id="forums_search" placeholder="'. esc_attr( $search_value ) .'" /></label>2659 <input type="submit" id="forums_search_submit" name="forums_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />2660 </form>';2661 2662 /**2663 * Filters the forums directory search form.2664 *2665 * @since 1.9.02666 *2667 * @param string $search_form_html HTML search form for the forums directory.2668 */2669 echo apply_filters( 'bp_directory_forums_search_form', $search_form_html );2670 }2671 2672 /**2673 2651 * Output the link to a given forum. 2674 2652 * 2675 2653 * @see bp_get_forum_permalink() for a description of arguments. -
src/bp-groups/bp-groups-template.php
5610 5610 return $retval; 5611 5611 } 5612 5612 5613 /**5614 * @since 1.0.05615 */5616 function bp_directory_groups_search_form() {5617 5613 5618 $query_arg = bp_core_get_component_search_query_arg( 'groups' );5619 5614 5620 if ( ! empty( $_REQUEST[ $query_arg ] ) ) {5621 $search_value = stripslashes( $_REQUEST[ $query_arg ] );5622 } else {5623 $search_value = bp_get_search_default_text( 'groups' );5624 }5625 5626 $search_form_html = '<form action="" method="get" id="search-groups-form">5627 <label for="groups_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="groups_search" placeholder="'. esc_attr( $search_value ) .'" /></label>5628 <input type="submit" id="groups_search_submit" name="groups_search_submit" value="'. __( 'Search', 'buddypress' ) .'" />5629 </form>';5630 5631 /**5632 * Filters the HTML markup for the groups search form.5633 *5634 * @since 1.9.05635 *5636 * @param string $search_form_html HTML markup for the search form.5637 */5638 echo apply_filters( 'bp_directory_groups_search_form', $search_form_html );5639 5640 }5641 5642 5615 /** 5643 5616 * Displays group header tabs. 5644 5617 * -
src/bp-members/bp-members-template.php
1407 1407 } 1408 1408 } 1409 1409 1410 /**1411 * Output the Members directory search form.1412 */1413 function bp_directory_members_search_form() {1414 1410 1415 $query_arg = bp_core_get_component_search_query_arg( 'members' );1416 1411 1417 if ( ! empty( $_REQUEST[ $query_arg ] ) ) {1418 $search_value = stripslashes( $_REQUEST[ $query_arg ] );1419 } else {1420 $search_value = bp_get_search_default_text( 'members' );1421 }1422 1423 $search_form_html = '<form action="" method="get" id="search-members-form">1424 <label for="members_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>1425 <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />1426 </form>';1427 1428 /**1429 * Filters the Members component search form.1430 *1431 * @since 1.9.01432 *1433 * @param string $search_form_html HTML markup for the member search form.1434 */1435 echo apply_filters( 'bp_directory_members_search_form', $search_form_html );1436 }1437 1438 1412 /** 1439 1413 * Output the total member count. 1440 1414 */ -
src/bp-templates/bp-legacy/buddypress-functions.php
88 88 add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization 89 89 add_action( 'bp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head>. 90 90 91 /** Includes ***********************************************************/ 92 93 add_action( 'bp_init', array( $this, 'require_files' ) ); 94 91 95 /** Body no-js Class **************************************************/ 92 96 93 97 add_filter( 'body_class', array( $this, 'add_nojs_body_class' ), 20, 1 ); … … 429 433 return $retval; 430 434 } 431 435 436 /** 437 * Add and loop over locations of files required to be included. 438 * 439 */ 440 function require_files() { 441 // Get array of paths to file locations to loop over. 442 $includes = $this->locate_includes( array('bp-dir-search.php', 'buddypress-ajax.php') ); 443 444 // Loop include files returned from locate_includes 445 foreach($includes as $include){ 446 include_once( $include ); 447 } 448 } 449 450 /** 451 * Pass in file names to check for physical file location. Returns path to located file. 452 * @param [type] $files [description] 453 * @return [type] [description] 454 */ 455 private function locate_includes( $files ) { 456 $locations = array(); 457 458 // No need to check child if template == stylesheet. 459 if ( is_child_theme() ) { 460 $locations['bp-child'] = array( 461 'dir' => get_stylesheet_directory(), 462 ); 463 } 464 465 $locations['bp-parent'] = array( 466 'dir' => get_template_directory(), 467 ); 468 469 $locations['bp-legacy'] = array( 470 'dir' => bp_get_theme_compat_dir(), 471 ); 472 473 // Subdirectories within the top-level $locations directories. 474 $subdirs = array( 475 'buddypress/_incl', 476 'community/_incl', 477 ); 478 479 $retval = array(); 480 foreach( $files as $file ) { 481 foreach ( $locations as $location ) { 482 foreach ( $subdirs as $subdir ) { 483 if ( file_exists( trailingslashit( $location['dir'] ) . trailingslashit( $subdir ) . $file ) ) { 484 $retval[] = trailingslashit( $location['dir'] ) . trailingslashit( $subdir ) . $file; 485 break 2; 486 } 487 } 488 } 489 } 490 return $retval; 491 } 492 432 493 /** 433 494 * Put some scripts in the header, like AJAX url for wp-lists. 434 495 * -
src/bp-templates/bp-legacy/buddypress/_incl/bp-dir-search.php
1 <?php 2 3 4 /** 5 * Return the dir screen specific functions. Preserves the existing template 6 * function names to ensure compatibility with older overloaded templates. 7 * @return html 8 */ 9 10 function bp_directory_blogs_search_form() { 11 12 $query_arg = bp_core_get_component_search_query_arg( 'blogs' ); 13 14 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 15 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 16 } else { 17 $search_value = bp_get_search_default_text( 'blogs' ); 18 } 19 $form_id = 'search-blogs-form'; 20 $label_for = 'blogs_search'; 21 $input_id = 'blogs_search_submit'; 22 23 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 24 25 /** 26 * Filters the HTML markup for the groups search form. 27 * 28 * @since 1.9.0 29 * 30 * @param string $search_form_html HTML markup for the search form. 31 */ 32 echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html ); 33 } 34 35 function bp_directory_forums_search_form() { 36 37 $default_search_value = bp_get_search_default_text( 'forums' ); 38 $search_value = !empty( $_REQUEST['fs'] ) ? stripslashes( $_REQUEST['fs'] ) : $default_search_value; 39 40 $form_id = 'search-forums-form'; 41 $label_for = 'forums_search'; 42 $input_id = 'forums_search_submit'; 43 44 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 45 46 /** 47 * Filters the HTML markup for the groups search form. 48 * 49 * @since 1.9.0 50 * 51 * @param string $search_form_html HTML markup for the search form. 52 */ 53 echo apply_filters( 'bp_directory_forums_search_form', $search_form_html ); 54 } 55 56 function bp_directory_groups_search_form() { 57 58 $query_arg = bp_core_get_component_search_query_arg( 'groups' ); 59 60 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 61 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 62 } else { 63 $search_value = bp_get_search_default_text( 'groups' ); 64 } 65 $form_id = 'search-groups-form'; 66 $label_for = 'groups_search'; 67 $input_id = 'groups_search_submit'; 68 69 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 70 71 /** 72 * Filters the HTML markup for the groups search form. 73 * 74 * @since 1.9.0 75 * 76 * @param string $search_form_html HTML markup for the search form. 77 */ 78 echo apply_filters( 'bp_directory_groups_search_form', $search_form_html ); 79 } 80 81 function bp_directory_members_search_form() { 82 83 $query_arg = bp_core_get_component_search_query_arg( 'members' ); 84 85 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 86 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 87 } else { 88 $search_value = bp_get_search_default_text( 'members' ); 89 } 90 $form_id = 'search-members-form'; 91 $label_for = 'members_search'; 92 $input_id = 'members_search_submit'; 93 94 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 95 96 /** 97 * Filters the Members component search form. 98 * 99 * @since 1.9.0 100 * 101 * @param string $search_form_html HTML markup for the member search form. 102 */ 103 echo apply_filters( 'bp_directory_members_search_form', $search_form_html ); 104 } 105 106 /** 107 * Provides the directory search form markup. 108 * 109 * @since 2.6.0 110 */ 111 function bp_get_dir_search_markup( $query_arg = '', $search_value = '', $form_id = '', $label_for = '', $input_id = '' ){ 112 113 ob_start(); ?> 114 <form action="" method="get" id="<?php echo $form_id; ?>"> 115 <label for="<?php echo $label_for; ?>"> 116 <input type="text" name="<?php esc_attr_e( $query_arg ) ;?>" id="<?php echo $label_for; ?>" placeholder="<?php esc_attr_e( $search_value ) ; ?>" /> 117 </label> 118 <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ); ?>" /> 119 </form> 120 121 <?php 122 return ob_get_clean(); 123 } -
src/bp-templates/bp-legacy/buddypress/_incl/bp-dir-search.php
1 <?php 2 3 4 /** 5 * Return the dir screen specific functions. Preserves the existing template 6 * function names to ensure compatibility with older overloaded templates. 7 * @return html 8 */ 9 10 function bp_directory_blogs_search_form() { 11 12 $query_arg = bp_core_get_component_search_query_arg( 'blogs' ); 13 14 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 15 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 16 } else { 17 $search_value = bp_get_search_default_text( 'blogs' ); 18 } 19 $form_id = 'search-blogs-form'; 20 $label_for = 'blogs_search'; 21 $input_id = 'blogs_search_submit'; 22 23 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 24 25 /** 26 * Filters the HTML markup for the groups search form. 27 * 28 * @since 1.9.0 29 * 30 * @param string $search_form_html HTML markup for the search form. 31 */ 32 echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html ); 33 } 34 35 function bp_directory_forums_search_form() { 36 37 $default_search_value = bp_get_search_default_text( 'forums' ); 38 $search_value = !empty( $_REQUEST['fs'] ) ? stripslashes( $_REQUEST['fs'] ) : $default_search_value; 39 40 $form_id = 'search-forums-form'; 41 $label_for = 'forums_search'; 42 $input_id = 'forums_search_submit'; 43 44 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 45 46 /** 47 * Filters the HTML markup for the groups search form. 48 * 49 * @since 1.9.0 50 * 51 * @param string $search_form_html HTML markup for the search form. 52 */ 53 echo apply_filters( 'bp_directory_forums_search_form', $search_form_html ); 54 } 55 56 function bp_directory_groups_search_form() { 57 58 $query_arg = bp_core_get_component_search_query_arg( 'groups' ); 59 60 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 61 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 62 } else { 63 $search_value = bp_get_search_default_text( 'groups' ); 64 } 65 $form_id = 'search-groups-form'; 66 $label_for = 'groups_search'; 67 $input_id = 'groups_search_submit'; 68 69 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 70 71 /** 72 * Filters the HTML markup for the groups search form. 73 * 74 * @since 1.9.0 75 * 76 * @param string $search_form_html HTML markup for the search form. 77 */ 78 echo apply_filters( 'bp_directory_groups_search_form', $search_form_html ); 79 } 80 81 function bp_directory_members_search_form() { 82 83 $query_arg = bp_core_get_component_search_query_arg( 'members' ); 84 85 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 86 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 87 } else { 88 $search_value = bp_get_search_default_text( 'members' ); 89 } 90 $form_id = 'search-members-form'; 91 $label_for = 'members_search'; 92 $input_id = 'members_search_submit'; 93 94 $search_form_html = bp_get_dir_search_markup( $query_arg, $search_value, $form_id, $label_for, $input_id ); 95 96 /** 97 * Filters the Members component search form. 98 * 99 * @since 1.9.0 100 * 101 * @param string $search_form_html HTML markup for the member search form. 102 */ 103 echo apply_filters( 'bp_directory_members_search_form', $search_form_html ); 104 } 105 106 /** 107 * Provides the directory search form markup. 108 * 109 * @since 2.6.0 110 */ 111 function bp_get_dir_search_markup( $query_arg = '', $search_value = '', $form_id = '', $label_for = '', $input_id = '' ){ 112 113 ob_start(); ?> 114 <form action="" method="get" id="<?php echo $form_id; ?>"> 115 <label for="<?php echo $label_for; ?>"> 116 <input type="text" name="<?php esc_attr_e( $query_arg ) ;?>" id="<?php echo $label_for; ?>" placeholder="<?php esc_attr_e( $search_value ) ; ?>" /> 117 </label> 118 <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ); ?>" /> 119 </form> 120 121 <?php 122 return ob_get_clean(); 123 }