WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r23800 r24524  
    156156    do_action( 'pre_get_search_form' );
    157157
    158     $format = apply_filters( 'search_form_format', 'xhtml' );
     158    $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
     159    $format = apply_filters( 'search_form_format', $format );
    159160
    160161    $search_form_template = locate_template( 'searchform.php' );
     
    164165        $form = ob_get_clean();
    165166    } else {
    166         $type        = ( 'html5' === $format ) ? 'search' : 'text';
    167         $placeholder = ( 'html5' === $format ) ? 'placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" ' : '';
    168 
    169         $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
    170             <div>
    171                 <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
    172                 <input type="' . $type . '" ' . $placeholder . 'value="' . get_search_query() . '" name="s" id="s" />
    173                 <input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
    174             </div>
    175         </form>';
     167        if ( 'html5' == $format ) {
     168            $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
     169                <label>
     170                    <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
     171                    <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . _x( 'Search for:', 'label' ) . '" />
     172                </label>
     173                <input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
     174            </form>';
     175        } else {
     176            $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
     177                <div>
     178                    <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
     179                    <input type="text" value="' . get_search_query() . '" name="s" id="s" />
     180                    <input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
     181                </div>
     182            </form>';
     183        }
    176184    }
    177185
     
    214222 * Returns the Log Out URL.
    215223 *
    216  * Returns the URL that allows the user to log out of the site
     224 * Returns the URL that allows the user to log out of the site.
    217225 *
    218226 * @since 2.7.0
    219  * @uses wp_nonce_url() To protect against CSRF
    220  * @uses site_url() To generate the log in URL
    221  * @uses apply_filters() calls 'logout_url' hook on final logout url
     227 * @uses wp_nonce_url() To protect against CSRF.
     228 * @uses site_url() To generate the log out URL.
     229 * @uses apply_filters() calls 'logout_url' hook on final logout URL.
    222230 *
    223231 * @param string $redirect Path to redirect to on logout.
     
    239247 * Returns the Log In URL.
    240248 *
    241  * Returns the URL that allows the user to log in to the site
     249 * Returns the URL that allows the user to log in to the site.
    242250 *
    243251 * @since 2.7.0
    244  * @uses site_url() To generate the log in URL
    245  * @uses apply_filters() calls 'login_url' hook on final login url
     252 * @uses site_url() To generate the log in URL.
     253 * @uses apply_filters() calls 'login_url' hook on final login URL.
    246254 *
    247255 * @param string $redirect Path to redirect to on login.
     
    259267
    260268    return apply_filters('login_url', $login_url, $redirect);
     269}
     270
     271/**
     272 * Returns the user registration URL.
     273 *
     274 * Returns the URL that allows the user to register on the site.
     275 *
     276 * @since 3.6.0
     277 * @uses site_url() To generate the registration URL.
     278 * @uses apply_filters() calls 'register_url' hook on final URL.
     279 *
     280 * @return string
     281 */
     282function wp_registration_url() {
     283    return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
    261284}
    262285
     
    354377    if ( ! is_user_logged_in() ) {
    355378        if ( get_option('users_can_register') )
    356             $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
     379            $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
    357380        else
    358381            $link = '';
     
    15591582 */
    15601583function the_weekday_date($before='',$after='') {
    1561     global $wp_locale, $day, $previousweekday;
     1584    global $wp_locale, $currentday, $previousweekday;
    15621585    $the_weekday_date = '';
    15631586    if ( $currentday != $previousweekday ) {
     
    23172340 */
    23182341function wp_heartbeat_settings( $settings ) {
     2342    if ( ! is_admin() )
     2343        $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
     2344
    23192345    if ( is_user_logged_in() )
    23202346        $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
Note: See TracChangeset for help on using the changeset viewer.