mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 10:09:47 +01:00
Better error messages. Props DD32. see #7875
git-svn-id: http://svn.automattic.com/wordpress/trunk@11080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c56f7027d
commit
0fad23034c
@ -722,19 +722,25 @@ class WP_Upgrader_Skin {
|
|||||||
if ( is_string($errors) ) {
|
if ( is_string($errors) ) {
|
||||||
$this->feedback($errors);
|
$this->feedback($errors);
|
||||||
} elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
|
} elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
|
||||||
foreach ( $errors->get_error_messages() as $message )
|
foreach ( $errors->get_error_messages() as $message ) {
|
||||||
|
if ( $errors->get_error_data() )
|
||||||
|
$this->feedback($message . ' ' . $errors->get_error_data() );
|
||||||
|
else
|
||||||
$this->feedback($message);
|
$this->feedback($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function feedback($string) {
|
function feedback($string) {
|
||||||
if ( isset( $this->upgrader->strings[$string]) )
|
if ( isset( $this->upgrader->strings[$string]) )
|
||||||
$string = $this->upgrader->strings[$string];
|
$string = $this->upgrader->strings[$string];
|
||||||
|
|
||||||
|
if ( strpos($string, '%') !== false ) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$args = array_splice($args, 1);
|
$args = array_splice($args, 1);
|
||||||
if ( !empty($args) )
|
if ( !empty($args) )
|
||||||
$string = vsprintf($string, $args);
|
$string = vsprintf($string, $args);
|
||||||
|
}
|
||||||
if ( empty($string) )
|
if ( empty($string) )
|
||||||
return;
|
return;
|
||||||
show_message($string);
|
show_message($string);
|
||||||
|
Loading…
Reference in New Issue
Block a user