X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..7f1521bf193b382565eb753043c161f4cb3fcda7:/wp-admin/includes/class-wp-upgrader-skins.php
diff --git a/wp-admin/includes/class-wp-upgrader-skins.php b/wp-admin/includes/class-wp-upgrader-skins.php
index 8fcee68f..942542e0 100644
--- a/wp-admin/includes/class-wp-upgrader-skins.php
+++ b/wp-admin/includes/class-wp-upgrader-skins.php
@@ -20,12 +20,16 @@ class WP_Upgrader_Skin {
public $done_header = false;
public $done_footer = false;
public $result = false;
+ public $options = array();
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) )
$this->upgrader =& $upgrader;
@@ -39,12 +43,18 @@ class WP_Upgrader_Skin {
$this->result = $result;
}
- public function request_filesystem_credentials($error = false) {
+ public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
$url = $this->options['url'];
- $context = $this->options['context'];
- if ( !empty($this->options['nonce']) )
+ if ( ! $context ) {
+ $context = $this->options['context'];
+ }
+ if ( !empty($this->options['nonce']) ) {
$url = wp_nonce_url($url, $this->options['nonce']);
- return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
+ }
+
+ $extra_fields = array();
+
+ return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership );
}
public function header() {
@@ -127,6 +137,9 @@ class WP_Upgrader_Skin {
';
}
}
+
+ public function bulk_header() {}
+ public function bulk_footer() {}
}
/**
@@ -192,6 +205,9 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
*/
class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
public $in_loop = false;
+ /**
+ * @var string|false
+ */
public $error = false;
public function __construct($args = array()) {
@@ -205,10 +221,13 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
$this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.');
$this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s');
$this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
- $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').''.__('Hide Details').'.';
+ $this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' ) . ' ' . __( 'Show Details' ) . '' . __( 'Hide Details' ) . '';
$this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
}
+ /**
+ * @param string $string
+ */
public function feedback($string) {
if ( isset( $this->upgrader->strings[$string] ) )
$string = $this->upgrader->strings[$string];
@@ -304,10 +323,6 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
public $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
- public function __construct($args = array()) {
- parent::__construct($args);
- }
-
public function add_strings() {
parent::add_strings();
$this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
@@ -348,10 +363,6 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
public $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
- public function __construct($args = array()) {
- parent::__construct($args);
- }
-
public function add_strings() {
parent::add_strings();
$this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
@@ -434,12 +445,13 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
unset( $install_actions['activate_plugin'] );
}
- if ( 'import' == $from )
+ if ( 'import' == $from ) {
$install_actions['importers_page'] = '' . __('Return to Importers') . '';
- else if ( $this->type == 'web' )
+ } elseif ( $this->type == 'web' ) {
$install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . '';
- else
+ } else {
$install_actions['plugins_page'] = '' . __('Return to Plugins page') . '';
+ }
if ( ! $this->result || is_wp_error($this->result) ) {
unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
@@ -698,13 +710,14 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
protected $messages = array();
- public function request_filesystem_credentials( $error = false, $context = '' ) {
- if ( $context )
+ public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
+ if ( $context ) {
$this->options['context'] = $context;
+ }
// TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
// This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
ob_start();
- $result = parent::request_filesystem_credentials( $error );
+ $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
ob_end_clean();
return $result;
}
@@ -713,14 +726,17 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
return $this->messages;
}
+ /**
+ * @param string|array|WP_Error $data
+ */
public function feedback( $data ) {
- if ( is_wp_error( $data ) )
+ if ( is_wp_error( $data ) ) {
$string = $data->get_error_message();
- else if ( is_array( $data ) )
+ } elseif ( is_array( $data ) ) {
return;
- else
+ } else {
$string = $data;
-
+ }
if ( ! empty( $this->upgrader->strings[ $string ] ) )
$string = $this->upgrader->strings[ $string ];