X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..784f914b1e4b1c62d6657e86397c2e83bcee4295:/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 8c484076..c9d32ceb 100644
--- a/wp-admin/includes/class-wp-upgrader-skins.php
+++ b/wp-admin/includes/class-wp-upgrader-skins.php
@@ -16,48 +16,93 @@
*/
class WP_Upgrader_Skin {
- var $upgrader;
- var $done_header = false;
- var $result = false;
+ public $upgrader;
+ public $done_header = false;
+ public $done_footer = false;
+ public $result = false;
+ public $options = array();
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct($args = array()) {
$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
$this->options = wp_parse_args($args, $defaults);
}
- function set_upgrader(&$upgrader) {
+ /**
+ * @param WP_Upgrader $upgrader
+ */
+ public function set_upgrader(&$upgrader) {
if ( is_object($upgrader) )
$this->upgrader =& $upgrader;
$this->add_strings();
}
- function add_strings() {
+ /**
+ * @access public
+ */
+ public function add_strings() {
}
- function set_result($result) {
+ /**
+ *
+ * @param string|false|WP_Error $result
+ */
+ public function set_result($result) {
$this->result = $result;
}
- function request_filesystem_credentials($error = false) {
+ /**
+ *
+ * @param bool $error
+ * @param string $context
+ * @param bool $allow_relaxed_file_ownership
+ * @return type
+ */
+ 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 );
}
- function header() {
- if ( $this->done_header )
+ /**
+ * @access public
+ */
+ public function header() {
+ if ( $this->done_header ) {
return;
+ }
$this->done_header = true;
echo '
';
- echo '
' . $this->options['title'] . '
';
+ echo '' . $this->options['title'] . '
';
}
- function footer() {
+
+ /**
+ * @access public
+ */
+ public function footer() {
+ if ( $this->done_footer ) {
+ return;
+ }
+ $this->done_footer = true;
echo '';
}
- function error($errors) {
+ /**
+ *
+ * @param string|WP_Error $errors
+ */
+ public function error($errors) {
if ( ! $this->done_header )
$this->header();
if ( is_string($errors) ) {
@@ -72,7 +117,11 @@ class WP_Upgrader_Skin {
}
}
- function feedback($string) {
+ /**
+ *
+ * @param string $string
+ */
+ public function feedback($string) {
if ( isset( $this->upgrader->strings[$string] ) )
$string = $this->upgrader->strings[$string];
@@ -89,8 +138,16 @@ class WP_Upgrader_Skin {
return;
show_message($string);
}
- function before() {}
- function after() {}
+
+ /**
+ * @access public
+ */
+ public function before() {}
+
+ /**
+ * @access public
+ */
+ public function after() {}
/**
* Output JavaScript that calls function to decrement the update counts.
@@ -104,14 +161,33 @@ class WP_Upgrader_Skin {
if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
return;
}
- echo '';
+ ';
+ } else {
+ echo '';
+ }
}
+
+ /**
+ * @access public
+ */
+ public function bulk_header() {}
+
+ /**
+ * @access public
+ */
+ public function bulk_footer() {}
}
/**
@@ -122,11 +198,15 @@ class WP_Upgrader_Skin {
* @since 2.8.0
*/
class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
- var $plugin = '';
- var $plugin_active = false;
- var $plugin_network_active = false;
+ public $plugin = '';
+ public $plugin_active = false;
+ public $plugin_network_active = false;
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct( $args = array() ) {
$defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
$args = wp_parse_args($args, $defaults);
@@ -138,17 +218,21 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
parent::__construct($args);
}
- function after() {
+ /**
+ * @access public
+ */
+ public function after() {
$this->plugin = $this->upgrader->plugin_info();
if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
- echo '';
+ // Currently used only when JS is off for a single plugin update?
+ echo '';
}
$this->decrement_update_count( 'plugin' );
$update_actions = array(
- 'activate_plugin' => '' . __('Activate Plugin') . '',
- 'plugins_page' => '' . __('Return to Plugins page') . ''
+ 'activate_plugin' => '' . __( 'Activate Plugin' ) . '',
+ 'plugins_page' => '' . __( 'Return to Plugins page' ) . ''
);
if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['activate_plugin'] );
@@ -176,25 +260,41 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
* @since 3.0.0
*/
class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
- var $in_loop = false;
- var $error = false;
+ public $in_loop = false;
+ /**
+ * @var string|false
+ */
+ public $error = false;
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct($args = array()) {
$defaults = array( 'url' => '', 'nonce' => '' );
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
- function add_strings() {
+ /**
+ * @access public
+ */
+ public function add_strings() {
$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');
+ /* translators: 1: Title of an update, 2: Error message */
+ $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s');
+ /* translators: 1: Title of an update */
$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').'.';
+ /* translators: 1: Title of an update */
+ $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.');
}
- function feedback($string) {
+ /**
+ * @param string $string
+ */
+ public function feedback($string) {
if ( isset( $this->upgrader->strings[$string] ) )
$string = $this->upgrader->strings[$string];
@@ -215,18 +315,30 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
echo "$string
\n";
}
- function header() {
+ /**
+ * @access public
+ */
+ public function header() {
// Nothing, This will be displayed within a iframe.
}
- function footer() {
+ /**
+ * @access public
+ */
+ public function footer() {
// Nothing, This will be displayed within a iframe.
}
- function error($error) {
+
+ /**
+ *
+ * @param string|WP_Error $error
+ */
+ public function error($error) {
if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
$this->error = $this->upgrader->strings[$error];
if ( is_wp_error($error) ) {
+ $messages = array();
foreach ( $error->get_error_messages() as $emessage ) {
if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
@@ -238,29 +350,44 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
echo '';
}
- function bulk_header() {
+ /**
+ * @access public
+ */
+ public function bulk_header() {
$this->feedback('skin_upgrade_start');
}
- function bulk_footer() {
+ /**
+ * @access public
+ */
+ public function bulk_footer() {
$this->feedback('skin_upgrade_end');
}
- function before($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function before($title = '') {
$this->in_loop = true;
- printf( '' . $this->upgrader->strings['skin_before_update_header'] . '
', $title, $this->upgrader->update_current, $this->upgrader->update_count);
+ printf( '' . $this->upgrader->strings['skin_before_update_header'] . '
', $title, $this->upgrader->update_current, $this->upgrader->update_count );
echo '';
echo '';
$this->flush_output();
}
- function after($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function after($title = '') {
echo '
';
if ( $this->error || ! $this->result ) {
- if ( $this->error )
- echo '' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '
';
- else
+ if ( $this->error ) {
+ echo '' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, '' . $this->error . '' ) . '
';
+ } else {
echo '' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '
';
+ }
echo '';
}
@@ -274,61 +401,56 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
$this->flush_output();
}
- function reset() {
+ /**
+ * @access public
+ */
+ public function reset() {
$this->in_loop = false;
$this->error = false;
}
- function flush_output() {
- wp_ob_end_flush_all();
- flush();
- }
-
/**
- * Output JavaScript that sends message to parent window to decrement the update counts.
- *
- * @since 3.9.0
- *
- * @param string $type Type of update count to decrement. Likely values include 'plugin',
- * 'theme', 'translation', etc.
+ * @access public
*/
- protected function decrement_update_count( $type ) {
- if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
- return;
- }
- echo '';
+ public function flush_output() {
+ wp_ob_end_flush_all();
+ flush();
}
}
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
- var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
-
- function __construct($args = array()) {
- parent::__construct($args);
- }
+ public $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
- function add_strings() {
+ public function add_strings() {
parent::add_strings();
$this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
}
- function before($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function before($title = '') {
parent::before($this->plugin_info['Title']);
}
- function after($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function after($title = '') {
parent::after($this->plugin_info['Title']);
$this->decrement_update_count( 'plugin' );
}
- function bulk_footer() {
+
+ /**
+ * @access public
+ */
+ public function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'plugins_page' => '' . __('Return to Plugins page') . '',
- 'updates_page' => '' . __('Return to WordPress Updates') . ''
+ 'plugins_page' => '' . __( 'Return to Plugins page' ) . '',
+ 'updates_page' => '' . __( 'Return to WordPress Updates page' ) . ''
);
if ( ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['plugins_page'] );
@@ -349,31 +471,38 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
}
class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
- var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
+ public $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
- function __construct($args = array()) {
- parent::__construct($args);
- }
-
- function add_strings() {
+ public function add_strings() {
parent::add_strings();
$this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
}
- function before($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function before($title = '') {
parent::before( $this->theme_info->display('Name') );
}
- function after($title = '') {
+ /**
+ *
+ * @param string $title
+ */
+ public function after($title = '') {
parent::after( $this->theme_info->display('Name') );
$this->decrement_update_count( 'theme' );
}
- function bulk_footer() {
+ /**
+ * @access public
+ */
+ public function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'themes_page' => '' . __('Return to Themes page') . '',
- 'updates_page' => '' . __('Return to WordPress Updates') . ''
+ 'themes_page' => '' . __( 'Return to Themes page' ) . '',
+ 'updates_page' => '' . __( 'Return to WordPress Updates page' ) . ''
);
if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
unset( $update_actions['themes_page'] );
@@ -401,10 +530,14 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
* @since 2.8.0
*/
class Plugin_Installer_Skin extends WP_Upgrader_Skin {
- var $api;
- var $type;
+ public $api;
+ public $type;
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
@@ -414,13 +547,18 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
parent::__construct($args);
}
- function before() {
+ /**
+ * @access public
+ */
+ public function before() {
if ( !empty($this->api) )
$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin %s %s.'), $this->api->name, $this->api->version);
}
- function after() {
-
+ /**
+ * @access public
+ */
+ public function after() {
$plugin_file = $this->upgrader->plugin_info();
$install_actions = array();
@@ -428,21 +566,22 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
if ( 'import' == $from )
- $install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . '';
+ $install_actions['activate_plugin'] = '' . __( 'Activate Plugin & Run Importer' ) . '';
else
- $install_actions['activate_plugin'] = '' . __('Activate Plugin') . '';
+ $install_actions['activate_plugin'] = '' . __( 'Activate Plugin' ) . '';
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
- $install_actions['network_activate'] = '' . __('Network Activate') . '';
+ $install_actions['network_activate'] = '' . __( 'Network Activate' ) . '';
unset( $install_actions['activate_plugin'] );
}
- if ( 'import' == $from )
- $install_actions['importers_page'] = '' . __('Return to Importers') . '';
- else if ( $this->type == 'web' )
- $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . '';
- else
- $install_actions['plugins_page'] = '' . __('Return to Plugins page') . '';
+ if ( 'import' == $from ) {
+ $install_actions['importers_page'] = '' . __( 'Return to Importers' ) . '';
+ } elseif ( $this->type == 'web' ) {
+ $install_actions['plugins_page'] = '' . __( 'Return to Plugin Installer' ) . '';
+ } 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'] );
@@ -476,10 +615,14 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
* @since 2.8.0
*/
class Theme_Installer_Skin extends WP_Upgrader_Skin {
- var $api;
- var $type;
+ public $api;
+ public $type;
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
@@ -489,12 +632,18 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
parent::__construct($args);
}
- function before() {
+ /**
+ * @access public
+ */
+ public function before() {
if ( !empty($this->api) )
$this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
}
- function after() {
+ /**
+ * @access public
+ */
+ public function after() {
if ( empty($this->upgrader->result['destination_name']) )
return;
@@ -506,12 +655,6 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$stylesheet = $this->upgrader->result['destination_name'];
$template = $theme_info->get_template();
- $preview_link = add_query_arg( array(
- 'preview' => 1,
- 'template' => urlencode( $template ),
- 'stylesheet' => urlencode( $stylesheet ),
- ), trailingslashit( home_url() ) );
-
$activate_link = add_query_arg( array(
'action' => 'activate',
'template' => urlencode( $template ),
@@ -520,17 +663,19 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
$install_actions = array();
- $install_actions['preview'] = '' . __('Preview') . '';
- $install_actions['preview'] .= '' . __('Live Preview') . '';
- $install_actions['activate'] = '' . __('Activate') . '';
+
+ if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+ $install_actions['preview'] = '' . __( 'Live Preview' ) . '' . sprintf( __( 'Live Preview “%s”' ), $name ) . '';
+ }
+ $install_actions['activate'] = '' . __( 'Activate' ) . '' . sprintf( __( 'Activate “%s”' ), $name ) . '';
if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
- $install_actions['network_enable'] = '' . __( 'Network Enable' ) . '';
+ $install_actions['network_enable'] = '' . __( 'Network Enable' ) . '';
if ( $this->type == 'web' )
- $install_actions['themes_page'] = '' . __('Return to Theme Installer') . '';
+ $install_actions['themes_page'] = '' . __( 'Return to Theme Installer' ) . '';
elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
- $install_actions['themes_page'] = '' . __('Return to Themes page') . '';
+ $install_actions['themes_page'] = '' . __( 'Return to Themes page' ) . '';
if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
unset( $install_actions['activate'], $install_actions['preview'] );
@@ -559,9 +704,13 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
* @since 2.8.0
*/
class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
- var $theme = '';
+ public $theme = '';
- function __construct($args = array()) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct($args = array()) {
$defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
$args = wp_parse_args($args, $defaults);
@@ -570,7 +719,10 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
parent::__construct($args);
}
- function after() {
+ /**
+ * @access public
+ */
+ public function after() {
$this->decrement_update_count( 'theme' );
$update_actions = array();
@@ -579,12 +731,6 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$stylesheet = $this->upgrader->result['destination_name'];
$template = $theme_info->get_template();
- $preview_link = add_query_arg( array(
- 'preview' => 1,
- 'template' => urlencode( $template ),
- 'stylesheet' => urlencode( $stylesheet ),
- ), trailingslashit( home_url() ) );
-
$activate_link = add_query_arg( array(
'action' => 'activate',
'template' => urlencode( $template ),
@@ -593,19 +739,21 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
if ( get_stylesheet() == $stylesheet ) {
- if ( current_user_can( 'edit_theme_options' ) )
- $update_actions['preview'] = '' . __('Customize') . '';
+ if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+ $update_actions['preview'] = '' . __( 'Customize' ) . '' . sprintf( __( 'Customize “%s”' ), $name ) . '';
+ }
} elseif ( current_user_can( 'switch_themes' ) ) {
- $update_actions['preview'] = '' . __('Preview') . '';
- $update_actions['preview'] .= '' . __('Live Preview') . '';
- $update_actions['activate'] = '' . __('Activate') . '';
+ if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+ $update_actions['preview'] = '' . __( 'Live Preview' ) . '' . sprintf( __( 'Live Preview “%s”' ), $name ) . '';
+ }
+ $update_actions['activate'] = '' . __( 'Activate' ) . '' . sprintf( __( 'Activate “%s”' ), $name ) . '';
}
if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
unset( $update_actions['preview'], $update_actions['activate'] );
}
- $update_actions['themes_page'] = '' . __('Return to Themes page') . '';
+ $update_actions['themes_page'] = '' . __( 'Return to Themes page' ) . '';
/**
* Filter the list of action links available following a single theme update.
@@ -630,42 +778,61 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
* @since 3.7.0
*/
class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
- var $language_update = null;
- var $done_header = false;
- var $display_footer_actions = true;
+ public $language_update = null;
+ public $done_header = false;
+ public $done_footer = false;
+ public $display_footer_actions = true;
- function __construct( $args = array() ) {
+ /**
+ *
+ * @param array $args
+ */
+ public function __construct( $args = array() ) {
$defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
$args = wp_parse_args( $args, $defaults );
if ( $args['skip_header_footer'] ) {
$this->done_header = true;
+ $this->done_footer = true;
$this->display_footer_actions = false;
}
parent::__construct( $args );
}
- function before() {
+ /**
+ * @access public
+ */
+ public function before() {
$name = $this->upgrader->get_name_for_update( $this->language_update );
echo '';
- printf( '
' . __( 'Updating translations for %1$s (%2$s)…' ) . '
', $name, $this->language_update->language );
+ printf( '
' . __( 'Updating translations for %1$s (%2$s)…' ) . '
', $name, $this->language_update->language );
}
- function error( $error ) {
+ /**
+ *
+ * @param string|WP_Error $error
+ */
+ public function error( $error ) {
echo '
';
parent::error( $error );
echo '
';
}
- function after() {
+ /**
+ * @access public
+ */
+ public function after() {
echo '
';
}
- function bulk_footer() {
+ /**
+ * @access public
+ */
+ public function bulk_footer() {
$this->decrement_update_count( 'translation' );
$update_actions = array();
- $update_actions['updates_page'] = '' . __( 'Return to WordPress Updates' ) . '';
+ $update_actions['updates_page'] = '' . __( 'Return to WordPress Updates page' ) . '';
/**
* Filter the list of action links available following a translations update.
@@ -678,8 +845,6 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
if ( $update_actions && $this->display_footer_actions )
$this->feedback( implode( ' | ', $update_actions ) );
-
- parent::footer();
}
}
@@ -696,29 +861,45 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
protected $messages = array();
- function request_filesystem_credentials( $error = false, $context = '' ) {
- if ( $context )
+ /**
+ *
+ * @param bool $error
+ * @param string $context
+ * @param bool $allow_relaxed_file_ownership
+ * @return bool
+ */
+ 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;
}
- function get_upgrade_messages() {
+ /**
+ * @access public
+ *
+ * @return array
+ */
+ public function get_upgrade_messages() {
return $this->messages;
}
- function feedback( $data ) {
- if ( is_wp_error( $data ) )
+ /**
+ * @param string|array|WP_Error $data
+ */
+ public function feedback( $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 ];
@@ -747,19 +928,19 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
$this->messages[] = $string;
}
- function header() {
+ /**
+ * @access public
+ */
+ public function header() {
ob_start();
}
- function footer() {
- $output = ob_get_contents();
+ /**
+ * @access public
+ */
+ public function footer() {
+ $output = ob_get_clean();
if ( ! empty( $output ) )
$this->feedback( $output );
- ob_end_clean();
}
-
- function bulk_header() {}
- function bulk_footer() {}
- function before() {}
- function after() {}
}