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);
$this->add_strings();
}
+ /**
+ * @access public
+ */
public function add_strings() {
}
+ /**
+ *
+ * @param string|false|WP_Error $result
+ */
public function set_result($result) {
$this->result = $result;
}
+ /**
+ *
+ * @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'];
if ( ! $context ) {
return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership );
}
+ /**
+ * @access public
+ */
public function header() {
if ( $this->done_header ) {
return;
}
$this->done_header = true;
echo '<div class="wrap">';
- echo '<h2>' . $this->options['title'] . '</h2>';
+ echo '<h1>' . $this->options['title'] . '</h1>';
}
+
+ /**
+ * @access public
+ */
public function footer() {
if ( $this->done_footer ) {
return;
echo '</div>';
}
+ /**
+ *
+ * @param string|WP_Error $errors
+ */
public function error($errors) {
if ( ! $this->done_header )
$this->header();
}
}
+ /**
+ *
+ * @param string $string
+ */
public function feedback($string) {
if ( isset( $this->upgrader->strings[$string] ) )
$string = $this->upgrader->strings[$string];
return;
show_message($string);
}
+
+ /**
+ * @access public
+ */
public function before() {}
+
+ /**
+ * @access public
+ */
public function after() {}
/**
}
}
+ /**
+ * @access public
+ */
public function bulk_header() {}
+
+ /**
+ * @access public
+ */
public function bulk_footer() {}
}
public $plugin_active = false;
public $plugin_network_active = false;
- public 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);
parent::__construct($args);
}
+ /**
+ * @access public
+ */
public function after() {
$this->plugin = $this->upgrader->plugin_info();
if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
$this->decrement_update_count( 'plugin' );
$update_actions = array(
- 'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
- 'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
+ 'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>',
+ 'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>'
);
if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['activate_plugin'] );
*/
public $error = false;
+ /**
+ *
+ * @param array $args
+ */
public function __construct($args = array()) {
$defaults = array( 'url' => '', 'nonce' => '' );
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
+ /**
+ * @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: <strong>%2$s</strong>');
echo "<p>$string</p>\n";
}
+ /**
+ * @access public
+ */
public function header() {
// Nothing, This will be displayed within a iframe.
}
+ /**
+ * @access public
+ */
public function footer() {
// Nothing, This will be displayed within a iframe.
}
+
+ /**
+ *
+ * @param string|WP_Error $error
+ */
public function error($error) {
if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
$this->error = $this->upgrader->strings[$error];
echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
}
+ /**
+ * @access public
+ */
public function bulk_header() {
$this->feedback('skin_upgrade_start');
}
+ /**
+ * @access public
+ */
public function bulk_footer() {
$this->feedback('skin_upgrade_end');
}
+ /**
+ *
+ * @param string $title
+ */
public function before($title = '') {
$this->in_loop = true;
printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . ' <span class="spinner waiting-' . $this->upgrader->update_current . '"></span></h4>', $title, $this->upgrader->update_current, $this->upgrader->update_count);
$this->flush_output();
}
+ /**
+ *
+ * @param string $title
+ */
public function after($title = '') {
echo '</p></div>';
if ( $this->error || ! $this->result ) {
$this->flush_output();
}
+ /**
+ * @access public
+ */
public function reset() {
$this->in_loop = false;
$this->error = false;
}
+ /**
+ * @access public
+ */
public function flush_output() {
wp_ob_end_flush_all();
flush();
$this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
}
+ /**
+ *
+ * @param string $title
+ */
public function before($title = '') {
parent::before($this->plugin_info['Title']);
}
+ /**
+ *
+ * @param string $title
+ */
public function after($title = '') {
parent::after($this->plugin_info['Title']);
$this->decrement_update_count( 'plugin' );
}
+
+ /**
+ * @access public
+ */
public function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>',
- 'updates_page' => '<a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+ 'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
+ 'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
);
if ( ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['plugins_page'] );
$this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
}
+ /**
+ *
+ * @param string $title
+ */
public function before($title = '') {
parent::before( $this->theme_info->display('Name') );
}
+ /**
+ *
+ * @param string $title
+ */
public function after($title = '') {
parent::after( $this->theme_info->display('Name') );
$this->decrement_update_count( 'theme' );
}
+ /**
+ * @access public
+ */
public function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'themes_page' => '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Go to themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>',
- 'updates_page' => '<a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+ 'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
+ 'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
);
if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
unset( $update_actions['themes_page'] );
public $api;
public $type;
+ /**
+ *
+ * @param array $args
+ */
public function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
+ /**
+ * @access public
+ */
public function before() {
if ( !empty($this->api) )
$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
}
+ /**
+ * @access public
+ */
public function after() {
-
$plugin_file = $this->upgrader->plugin_info();
$install_actions = array();
$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
if ( 'import' == $from )
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin & Run Importer') . '</a>';
+ $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin & Run Importer' ) . '</a>';
else
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
+ $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>';
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
- $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
+ $install_actions['network_activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&networkwide=1&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Network Activate' ) . '</a>';
unset( $install_actions['activate_plugin'] );
}
if ( 'import' == $from ) {
- $install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
+ $install_actions['importers_page'] = '<a href="' . admin_url( 'import.php' ) . '" target="_parent">' . __( 'Return to Importers' ) . '</a>';
} elseif ( $this->type == 'web' ) {
- $install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
+ $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '" target="_parent">' . __( 'Return to Plugin Installer' ) . '</a>';
} else {
- $install_actions['plugins_page'] = '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
+ $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>';
}
if ( ! $this->result || is_wp_error($this->result) ) {
public $api;
public $type;
+ /**
+ *
+ * @param array $args
+ */
public function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
+ /**
+ * @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);
}
+ /**
+ * @access public
+ */
public function after() {
if ( empty($this->upgrader->result['destination_name']) )
return;
$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 ),
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
$install_actions = array();
- $install_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview “%s”'), $name ) ) . '">' . __('Preview') . '</a>';
+
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
- $install_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview “%s”'), $name ) ) . '">' . __('Live Preview') . '</a>';
+ $install_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>';
}
- $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>';
+ $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>';
if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
- $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
+ $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
if ( $this->type == 'web' )
- $install_actions['themes_page'] = '<a href="' . self_admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
+ $install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>';
elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
- $install_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+ $install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
unset( $install_actions['activate'], $install_actions['preview'] );
class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
public $theme = '';
+ /**
+ *
+ * @param array $args
+ */
public function __construct($args = array()) {
$defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
+ /**
+ * @access public
+ */
public function after() {
$this->decrement_update_count( 'theme' );
$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 ),
if ( get_stylesheet() == $stylesheet ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
- $update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Customize “%s”'), $name ) ) . '">' . __('Customize') . '</a>';
+ $update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize “%s”' ), $name ) . '</span></a>';
}
} elseif ( current_user_can( 'switch_themes' ) ) {
- $update_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview “%s”'), $name ) ) . '">' . __('Preview') . '</a>';
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
- $update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview “%s”'), $name ) ) . '">' . __('Live Preview') . '</a>';
+ $update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>';
}
- $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>';
+ $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>';
}
if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
unset( $update_actions['preview'], $update_actions['activate'] );
}
- $update_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Return to Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+ $update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
/**
* Filter the list of action links available following a single theme update.
public $done_footer = false;
public $display_footer_actions = true;
+ /**
+ *
+ * @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 );
parent::__construct( $args );
}
+ /**
+ * @access public
+ */
public function before() {
$name = $this->upgrader->get_name_for_update( $this->language_update );
printf( '<h4>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h4>', $name, $this->language_update->language );
}
+ /**
+ *
+ * @param string|WP_Error $error
+ */
public function error( $error ) {
echo '<div class="lp-error">';
parent::error( $error );
echo '</div>';
}
+ /**
+ * @access public
+ */
public function after() {
echo '</div>';
}
+ /**
+ * @access public
+ */
public function bulk_footer() {
$this->decrement_update_count( 'translation' );
$update_actions = array();
- $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" title="' . esc_attr__( 'Go to WordPress Updates page' ) . '" target="_parent">' . __( 'Return to WordPress Updates' ) . '</a>';
+ $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
/**
* Filter the list of action links available following a translations update.
class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
protected $messages = array();
+ /**
+ *
+ * @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;
return $result;
}
+ /**
+ * @access public
+ *
+ * @return array
+ */
public function get_upgrade_messages() {
return $this->messages;
}
$this->messages[] = $string;
}
+ /**
+ * @access public
+ */
public function header() {
ob_start();
}
+ /**
+ * @access public
+ */
public function footer() {
- $output = ob_get_contents();
+ $output = ob_get_clean();
if ( ! empty( $output ) )
$this->feedback( $output );
- ob_end_clean();
}
-
- public function bulk_header() {}
- public function bulk_footer() {}
- public function before() {}
- public function after() {}
}