- function footer() {
- // Nothing, This will be displayed within a iframe.
- }
- function error($error) {
- if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
- $this->error = $this->upgrader->strings[$error];
-
- if ( is_wp_error($error) ) {
- foreach ( $error->get_error_messages() as $emessage ) {
- if ( $error->get_error_data() )
- $messages[] = $emessage . ' ' . $error->get_error_data();
- else
- $messages[] = $emessage;
- }
- $this->error = implode(', ', $messages);
- }
- echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
- }
-
- function bulk_header() {
- $this->feedback('skin_upgrade_start');
- }
-
- function bulk_footer() {
- $this->feedback('skin_upgrade_end');
- }
-
- function before($title = '') {
- $this->in_loop = true;
- printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . ' <img alt="" src="' . admin_url( 'images/wpspin_light.gif' ) . '" class="hidden waiting-' . $this->upgrader->update_current . '" style="vertical-align:middle;" /></h4>', $title, $this->upgrader->update_current, $this->upgrader->update_count);
- echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
- echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
- $this->flush_output();
- }
-
- function after($title = '') {
- echo '</p></div>';
- if ( $this->error || ! $this->result ) {
- if ( $this->error )
- echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '</p></div>';
- else
- echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '</p></div>';
-
- echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
- }
- if ( !empty($this->result) && !is_wp_error($this->result) ) {
- echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
- echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
- }
-
- $this->reset();
- $this->flush_output();
- }
-
- function reset() {
- $this->in_loop = false;
- $this->error = false;
- }
-
- 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 Plugin_Upgrader_Skin($args = array()) {
- parent::__construct($args);
- }
-
- function add_strings() {
- parent::add_strings();
- $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
- }
-
- function before() {
- parent::before($this->plugin_info['Title']);
- }
-
- function after() {
- parent::after($this->plugin_info['Title']);
- }
- function bulk_footer() {
- parent::bulk_footer();
- $update_actions = array(
- 'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>',
- 'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
- );
-
- $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
- if ( ! empty($update_actions) )
- $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
- }
-}
-
-class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
- var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
- function Theme_Upgrader_Skin($args = array()) {
- parent::__construct($args);
- }
-
- function add_strings() {
- parent::add_strings();
- $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
- }
-
- function before() {
- parent::before($this->theme_info['Name']);
- }
-
- function after() {
- parent::after($this->theme_info['Name']);
- }
- function bulk_footer() {
- parent::bulk_footer();
- $update_actions = array(
- 'themes_page' => '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Goto themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>',
- 'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
- );
-
- $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
- if ( ! empty($update_actions) )
- $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
- }
-}
-
-/**
- * Plugin Installer Skin for WordPress Plugin Installer.
- *
- * @TODO More Detailed docs, for methods as well.
- *
- * @package WordPress
- * @subpackage Upgrader
- * @since 2.8.0
- */
-class Plugin_Installer_Skin extends WP_Upgrader_Skin {
- var $api;
- var $type;
-
- function Plugin_Installer_Skin($args = array()) {
- return $this->__construct($args);
- }
-
- function __construct($args = array()) {
- $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
- $args = wp_parse_args($args, $defaults);
-
- $this->type = $args['type'];
- $this->api = isset($args['api']) ? $args['api'] : array();
-
- parent::__construct($args);
- }
-
- 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);
- }
-
- function after() {
-
- $plugin_file = $this->upgrader->plugin_info();
-
- $install_actions = array();
-
- $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins';
-
- if ( 'import' == $from )
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&from=import&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin & Run Importer') . '</a>';
- else
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" 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=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
-
- 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>';
- else if ( $this->type == 'web' )
- $install_actions['plugins_page'] = '<a href="' . admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
- else
- $install_actions['plugins_page'] = '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
-
-
- if ( ! $this->result || is_wp_error($this->result) ) {
- unset( $install_actions['activate_plugin'] );
- unset( $install_actions['network_activate'] );
- }
- $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
- if ( ! empty($install_actions) )
- $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
- }
-}
-
-/**
- * Theme Installer Skin for the WordPress Theme Installer.
- *
- * @TODO More Detailed docs, for methods as well.
- *
- * @package WordPress
- * @subpackage Upgrader
- * @since 2.8.0
- */
-class Theme_Installer_Skin extends WP_Upgrader_Skin {
- var $api;
- var $type;
-
- function Theme_Installer_Skin($args = array()) {
- return $this->__construct($args);
- }
-
- function __construct($args = array()) {
- $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
- $args = wp_parse_args($args, $defaults);
-
- $this->type = $args['type'];
- $this->api = isset($args['api']) ? $args['api'] : array();
-
- parent::__construct($args);