WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/03/2010 05:49:19 AM (10 years ago)
Author:
nacin
Message:

Introduce is_rtl(). Use it in core. It only becomes defined when locale is loaded, so it's impossible to use it too early. Deprecate the get_bloginfo('text_direction') call. fixes #13206.

File:
1 edited

Legend:

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

    r14347 r14360  
    399399        case 'home' : // DEPRECATED
    400400        case 'siteurl' : // DEPRECATED
    401             _deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%1$s</code> option is deprecated for the family of <code>bloginfo()</code> functions. Use the <code>%2$s</code> option instead.'), $show, 'url' ) );
     401            _deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> option instead.' ), 'url' ) );
    402402        case 'url' :
    403403            $output = home_url();
     
    459459            break;
    460460        case 'text_direction':
    461             global $wp_locale;
    462             if ( isset( $wp_locale ) )
    463                 $output = $wp_locale->text_direction;
    464             else
    465                 $output = 'ltr';
     461            //_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> function instead.' ), 'is_rtl()'  ) );
     462            return function_exists( 'is_rtl' ) ? is_rtl() : 'ltr';
    466463            break;
    467464        case 'name':
     
    18751872    $output = '';
    18761873
    1877     if ( $dir = get_bloginfo('text_direction') )
    1878         $attributes[] = "dir=\"$dir\"";
     1874    if ( function_exists( 'is_rtl' ) )
     1875        $attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"';
    18791876
    18801877    if ( $lang = get_bloginfo('language') ) {
     
    21132110
    21142111    echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
    2115     if ( 'rtl' == get_bloginfo( 'text_direction' ) )
     2112    if ( is_rtl() )
    21162113        echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( "$file-rtl" ) . "' type='text/css' />\n", "$file-rtl" );
    21172114}
Note: See TracChangeset for help on using the changeset viewer.