Update WP and plugins

This commit is contained in:
Oliver Davies 2019-04-16 20:56:22 +01:00
parent 10a4713229
commit 1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions

View file

@ -25,25 +25,29 @@ class WP_Upgrader_Skin {
* @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 @@ class WP_Upgrader_Skin {
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 @@ class WP_Upgrader_Skin {
}
/**
*
* @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 @@ class WP_Upgrader_Skin {
} 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 );