Skip to:
Content

BuddyPress.org

Ticket #6844: 6844-06.patch

File 6844-06.patch, 10.2 KB (added by hnla, 8 years ago)

-06 replaces -05 & includes missing unversioned dir-search-form.php file.

  • src/bp-core/bp-core-functions.php

     
    854854 * @param string $component Component name.
    855855 * @return string|bool Query argument on success. False on failure.
    856856 */
    857 function bp_core_get_component_search_query_arg( $component ) {
     857function bp_core_get_component_search_query_arg( $component = null ) {
     858        if ( ! $component ) {
     859                $component = bp_current_component();
     860        }
     861
    858862        $query_arg = false;
     863
    859864        if ( isset( buddypress()->{$component}->search_query_arg ) ) {
    860865                $query_arg = sanitize_title( buddypress()->{$component}->search_query_arg );
    861866        }
  • src/bp-core/bp-core-template.php

     
    585585}
    586586
    587587/**
     588        * Output the 'name' attribute for search form input element.
     589        *
     590        * @since 2.7.0
     591        *
     592        * @param string $component See {@link bp_get_search_input_name()}.
     593        */
     594function bp_search_input_name( $component = '' ) {
     595        echo esc_attr( bp_get_search_input_name( $component ) );
     596}
     597
     598/**
     599        * Get the 'name' attribute for the search form input element.
     600        *
     601        * @since 2.7.0
     602        *
     603        * @param string $component Component name. Defaults to current component.
     604        * @return string Text for the 'name' attribute.
     605        */
     606function bp_get_search_input_name( $component = '' ) {
     607
     608        if ( ! $component ) {
     609                $component = bp_current_component();
     610        }
     611
     612        $bp = buddypress();
     613
     614        $name = '';
     615        if ( isset( $bp->{$component}->id ) ) {
     616                $name = $bp->{$component}->id . '_search';
     617        }
     618
     619        return $name;
     620}
     621
     622/**
     623        * Output the placeholder text for the search box for a given component.
     624        *
     625        * @since 2.7.0
     626        *
     627        * @param string $component See {@link bp_get_search_placeholder()}.
     628        */
     629function bp_search_placeholder( $component = '' ) {
     630        echo esc_attr( bp_get_search_placeholder( $component ) );
     631}
     632
     633/**
     634        * Get the placeholder text for the search box for a given component.
     635        *
     636        * @since 2.7.0
     637        *
     638        * @param string $component Component name. Defaults to current component.
     639        * @return string Placeholder text for the search field.
     640        */
     641function bp_get_search_placeholder( $component = '' ) {
     642        $query_arg = bp_core_get_component_search_query_arg( $component );
     643
     644        if ( $query_arg && ! empty( $_REQUEST[ $query_arg ] ) ) {
     645                $placeholder = wp_unslash( $_REQUEST[ $query_arg ] );
     646        } else {
     647                $placeholder = bp_get_search_default_text( $component );
     648        }
     649
     650        return $placeholder;
     651}
     652
     653/**
    588654 * Output the default text for the search box for a given component.
    589655 *
    590656 * @since 1.5.0
  • src/bp-templates/bp-legacy/buddypress/blogs/index.php

     
    3333         */
    3434        do_action( 'bp_before_directory_blogs_content' ); ?>
    3535
    36         <div id="blog-dir-search" class="dir-search" role="search">
    37                 <?php bp_directory_blogs_search_form(); ?>
    38         </div><!-- #blog-dir-search -->
     36 <?php if ( has_filter( 'bp_directory_blogs_search_form' ) ) : ?>
    3937
     38         <div id="blog-dir-search" class="dir-search" role="search">
     39          <?php bp_directory_blogs_search_form(); ?>
     40         </div><!-- #blog-dir-search -->
     41
     42        <?php else : ?>
     43
     44         <?php bp_get_template_part( 'common/search/dir-search-form' ); ?>
     45
     46        <?php endif; ?>
     47
    4048        <?php
    4149
    4250        /**
  • src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php

     
     1<?php
     2/**
     3        * Output the search form markup.
     4        *
     5        * @since 2.7.0
     6        *
     7        * @return string html.
     8        */
     9?>
     10<div id="<?php echo esc_attr( bp_current_component() ); ?>-dir-search" class="dir-search" role="search">
     11 <form action="" method="get" id="search-<?php  echo esc_attr( bp_current_component() ); ?>-form">
     12  <label for="<?php bp_search_input_name(); ?>" class="bp-screen-reader-text"><?php bp_search_placeholder(); ?></label>
     13    <input type="text" name="<?php echo esc_attr( bp_core_get_component_search_query_arg() ); ?>" id="<?php bp_search_input_name(); ?>" placeholder="<?php bp_search_placeholder(); ?>" />
     14    <input type="submit" id="<?php echo esc_attr( bp_get_search_input_name() ); ?>_submit" name="<?php bp_search_input_name(); ?>_submit" value="<?php echo esc_html( 'Search', 'buddypress' ); ?>" />
     15 </form>
     16</div><!-- #<?php esc_attr_e( bp_current_component() ); ?>-dir-search -->
  • src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php

    Property changes on: src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1<?php
     2/**
     3        * Output the search form markup.
     4        *
     5        * @since 2.7.0
     6        *
     7        * @return string html.
     8        */
     9?>
     10<div id="<?php echo esc_attr( bp_current_component() ); ?>-dir-search" class="dir-search" role="search">
     11 <form action="" method="get" id="search-<?php  echo esc_attr( bp_current_component() ); ?>-form">
     12  <label for="<?php bp_search_input_name(); ?>" class="bp-screen-reader-text"><?php bp_search_placeholder(); ?></label>
     13    <input type="text" name="<?php echo esc_attr( bp_core_get_component_search_query_arg() ); ?>" id="<?php bp_search_input_name(); ?>" placeholder="<?php bp_search_placeholder(); ?>" />
     14    <input type="submit" id="<?php echo esc_attr( bp_get_search_input_name() ); ?>_submit" name="<?php bp_search_input_name(); ?>_submit" value="<?php echo esc_html( 'Search', 'buddypress' ); ?>" />
     15 </form>
     16</div><!-- #<?php esc_attr_e( bp_current_component() ); ?>-dir-search -->
  • src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php

    Property changes on: src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1<?php
     2/**
     3        * Output the search form markup.
     4        *
     5        * @since 2.7.0
     6        *
     7        * @return string html.
     8        */
     9?>
     10<div id="<?php echo esc_attr( bp_current_component() ); ?>-dir-search" class="dir-search" role="search">
     11 <form action="" method="get" id="search-<?php  echo esc_attr( bp_current_component() ); ?>-form">
     12  <label for="<?php bp_search_input_name(); ?>" class="bp-screen-reader-text"><?php bp_search_placeholder(); ?></label>
     13    <input type="text" name="<?php echo esc_attr( bp_core_get_component_search_query_arg() ); ?>" id="<?php bp_search_input_name(); ?>" placeholder="<?php bp_search_placeholder(); ?>" />
     14    <input type="submit" id="<?php echo esc_attr( bp_get_search_input_name() ); ?>_submit" name="<?php bp_search_input_name(); ?>_submit" value="<?php echo esc_html( 'Search', 'buddypress' ); ?>" />
     15 </form>
     16</div><!-- #<?php esc_attr_e( bp_current_component() ); ?>-dir-search -->
  • src/bp-templates/bp-legacy/buddypress/forums/index.php

    Property changes on: src/bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
    2929                 */
    3030                do_action( 'bp_before_directory_forums_content' ); ?>
    3131
     32        <?php if ( has_filter( 'bp_directory_forums_search_form' ) ) : ?>
     33
    3234                <div id="forums-dir-search" class="dir-search" role="search">
     35                                <?php bp_directory_forums_search_form(); ?>
     36                </div>
    3337
    34                         <?php bp_directory_forums_search_form(); ?>
     38                <?php else: ?>
    3539
    36                 </div>
     40                        <?php bp_get_template_part( 'common/search/dir-search-form' ); ?>
     41
     42                <?php endif; ?>
     43
    3744        </form>
    3845
    3946        <?php
  • src/bp-templates/bp-legacy/buddypress/groups/index.php

     
    3333         */
    3434        do_action( 'bp_before_directory_groups_content' ); ?>
    3535
     36        <?php if ( has_filter( 'bp_directory_groups_search_form' ) ) : ?>
     37
    3638        <div id="group-dir-search" class="dir-search" role="search">
    3739                <?php bp_directory_groups_search_form(); ?>
    3840        </div><!-- #group-dir-search -->
    3941
     42        <?php else: ?>
     43
     44                <?php bp_get_template_part( 'common/search/dir-search-form' ); ?>
     45
     46        <?php endif; ?>
     47
    4048        <form action="" method="post" id="groups-directory-form" class="dir-form">
    4149
    4250                <?php
  • src/bp-templates/bp-legacy/buddypress/members/index.php

     
    3333         */
    3434        do_action( 'bp_before_directory_members_content' ); ?>
    3535
     36        <?php if ( has_filter( 'bp_directory_members_search_form' ) ) : ?>
     37
    3638        <div id="members-dir-search" class="dir-search" role="search">
    3739                <?php bp_directory_members_search_form(); ?>
    3840        </div><!-- #members-dir-search -->
    3941
     42        <?php else: ?>
     43
     44                <?php bp_get_template_part( 'common/search/dir-search-form' ); ?>
     45
     46        <?php endif; ?>
     47
    4048        <?php
    41 
    4249        /**
    4350         * Fires before the display of the members list tabs.
    4451         *