Fall back to non-translated strings in _deprecated_*() if the translation function doesn't exist. This may be the case in sunrise, for example.

Fixes #24778 props SergeyBiryukov.


git-svn-id: http://core.svn.wordpress.org/trunk@24723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Westwood 2013-07-17 21:04:50 +00:00
parent 18a208af1b
commit b58e828475
1 changed files with 33 additions and 12 deletions

View File

@ -2864,10 +2864,17 @@ function _deprecated_function( $function, $version, $replacement = null ) {
// Allow plugin to filter the output error trigger
if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
if ( ! is_null($replacement) )
if ( function_exists( '__' ) ) {
if ( ! is_null( $replacement ) )
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
else
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
} else {
if ( ! is_null( $replacement ) )
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
else
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
}
}
}
@ -2904,10 +2911,17 @@ function _deprecated_file( $file, $version, $replacement = null, $message = '' )
// Allow plugin to filter the output error trigger
if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
$message = empty( $message ) ? '' : ' ' . $message;
if ( function_exists( '__' ) ) {
if ( ! is_null( $replacement ) )
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
else
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
} else {
if ( ! is_null( $replacement ) )
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
else
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
}
}
}
/**
@ -2948,10 +2962,17 @@ function _deprecated_argument( $function, $version, $message = null ) {
// Allow plugin to filter the output error trigger
if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
if ( function_exists( '__' ) ) {
if ( ! is_null( $message ) )
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
else
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
} else {
if ( ! is_null( $message ) )
trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
else
trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
}
}
}