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.

git-svn-id: https://develop.svn.wordpress.org/trunk@14360 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-05-03 05:49:19 +00:00
parent a49cbfa0b0
commit d5e5ccdd72
9 changed files with 34 additions and 21 deletions
+6 -9
View File
@@ -398,7 +398,7 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
switch( $show ) {
case 'home' : // DEPRECATED
case 'siteurl' : // DEPRECATED
_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' ) );
_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' ) );
case 'url' :
$output = home_url();
break;
@@ -458,11 +458,8 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
$output = str_replace('_', '-', $output);
break;
case 'text_direction':
global $wp_locale;
if ( isset( $wp_locale ) )
$output = $wp_locale->text_direction;
else
$output = 'ltr';
//_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()' ) );
return function_exists( 'is_rtl' ) ? is_rtl() : 'ltr';
break;
case 'name':
default:
@@ -1874,8 +1871,8 @@ function language_attributes($doctype = 'html') {
$attributes = array();
$output = '';
if ( $dir = get_bloginfo('text_direction') )
$attributes[] = "dir=\"$dir\"";
if ( function_exists( 'is_rtl' ) )
$attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"';
if ( $lang = get_bloginfo('language') ) {
if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
@@ -2112,7 +2109,7 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
}
echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
if ( 'rtl' == get_bloginfo( 'text_direction' ) )
if ( is_rtl() )
echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( "$file-rtl" ) . "' type='text/css' />\n", "$file-rtl" );
}