--- a/wp/wp-admin/includes/class-wp-upgrader-skin.php Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/includes/class-wp-upgrader-skin.php Mon Oct 14 18:28:13 2019 +0200
@@ -25,25 +25,29 @@
* @since 2.8.0
* @var string|bool|WP_Error
*/
- public $result = false;
+ public $result = false;
public $options = array();
/**
- *
* @param array $args
*/
- public function __construct($args = array()) {
- $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
- $this->options = wp_parse_args($args, $defaults);
+ public function __construct( $args = array() ) {
+ $defaults = array(
+ 'url' => '',
+ 'nonce' => '',
+ 'title' => '',
+ 'context' => false,
+ );
+ $this->options = wp_parse_args( $args, $defaults );
}
/**
- *
* @param WP_Upgrader $upgrader
*/
- public function set_upgrader(&$upgrader) {
- if ( is_object($upgrader) )
+ public function set_upgrader( &$upgrader ) {
+ if ( is_object( $upgrader ) ) {
$this->upgrader =& $upgrader;
+ }
$this->add_strings();
}
@@ -84,8 +88,8 @@
if ( ! $context ) {
$context = $this->options['context'];
}
- if ( !empty($this->options['nonce']) ) {
- $url = wp_nonce_url($url, $this->options['nonce']);
+ if ( ! empty( $this->options['nonce'] ) ) {
+ $url = wp_nonce_url( $url, $this->options['nonce'] );
}
$extra_fields = array();
@@ -115,44 +119,46 @@
}
/**
- *
* @param string|WP_Error $errors
*/
- public function error($errors) {
- if ( ! $this->done_header )
+ public function error( $errors ) {
+ if ( ! $this->done_header ) {
$this->header();
- if ( is_string($errors) ) {
- $this->feedback($errors);
- } elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
+ }
+ if ( is_string( $errors ) ) {
+ $this->feedback( $errors );
+ } elseif ( is_wp_error( $errors ) && $errors->has_errors() ) {
foreach ( $errors->get_error_messages() as $message ) {
- if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) )
- $this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
- else
- $this->feedback($message);
+ if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) {
+ $this->feedback( $message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
+ } else {
+ $this->feedback( $message );
+ }
}
}
}
/**
- *
* @param string $string
*/
- public function feedback($string) {
- if ( isset( $this->upgrader->strings[$string] ) )
- $string = $this->upgrader->strings[$string];
+ public function feedback( $string ) {
+ if ( isset( $this->upgrader->strings[ $string ] ) ) {
+ $string = $this->upgrader->strings[ $string ];
+ }
- if ( strpos($string, '%') !== false ) {
+ if ( strpos( $string, '%' ) !== false ) {
$args = func_get_args();
- $args = array_splice($args, 1);
+ $args = array_splice( $args, 1 );
if ( $args ) {
- $args = array_map( 'strip_tags', $args );
- $args = array_map( 'esc_html', $args );
- $string = vsprintf($string, $args);
+ $args = array_map( 'strip_tags', $args );
+ $args = array_map( 'esc_html', $args );
+ $string = vsprintf( $string, $args );
}
}
- if ( empty($string) )
+ if ( empty( $string ) ) {
return;
- show_message($string);
+ }
+ show_message( $string );
}
/**
@@ -185,7 +191,7 @@
} else {
echo '<script type="text/javascript">
(function( wp ) {
- if ( wp && wp.updates.decrementCount ) {
+ if ( wp && wp.updates && wp.updates.decrementCount ) {
wp.updates.decrementCount( "' . $type . '" );
}
})( window.wp );