WordPress.org

Make WordPress Core

Changeset 14879


Ignore:
Timestamp:
05/25/2010 01:57:06 PM (11 years ago)
Author:
dd32
Message:

Add Actions to the end of Bulk upgrades; Remove Spinners and instead show the individual upgrade steps (Then hidden upon completion for bulk upgrades). See #11232

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r14819 r14879  
    467467        }
    468468
    469         $this->skin->feedback('bulk_upgrade_start');
     469        $this->skin->bulk_header();
     470
    470471        $this->maintenance_mode(true);
    471472
     
    511512
    512513        $this->maintenance_mode(false);
    513         $this->skin->feedback('bulk_upgrade_end');
     514
     515        $this->skin->bulk_footer();
    514516
    515517        $this->skin->footer();
     
    709711        }
    710712
    711         $this->skin->feedback('bulk_upgrade_start');
     713        $this->skin->bulk_header();
     714
    712715        $this->maintenance_mode(true);
    713716
     
    753756
    754757        $this->maintenance_mode(false);
    755         $this->skin->feedback('bulk_upgrade_end');
     758
     759        $this->skin->bulk_footer();
     760
    756761        $this->skin->footer();
    757762
     
    10881093        else
    10891094            echo "<p>$string</p>\n";
     1095        $this->flush_output();
    10901096    }
    10911097
     
    11101116            $this->error = implode(', ', $messages);
    11111117        }
    1112         echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
     1118    }
     1119
     1120    function bulk_header() {
     1121        $this->feedback('bulk_upgrade_start');
     1122    }
     1123
     1124    function bulk_footer() {
     1125        $this->feedback('bulk_upgrade_end');
    11131126    }
    11141127
    11151128    function before($title = '') {
    11161129        $this->in_loop = true;
    1117         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);
    1118         echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
    1119         echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
     1130        printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . '</h4>',  $title, $this->upgrader->update_current, $this->upgrader->update_count);
     1131        echo '<div class="update-messages" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
    11201132        $this->flush_output();
    11211133    }
     
    11321144        }
    11331145        if ( !empty($this->result) && !is_wp_error($this->result) ) {
    1134             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>';
    1135             echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
    1136         }
     1146            echo '<div class="updated" id="finished-' . $this->upgrader->update_current . '"><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>';
     1147
     1148            if ( $this->upgrader->update_count > 1 ) // Only hide the update steps if multiple items are being updated.
     1149                echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
     1150            else
     1151                echo '<script type="text/javascript">jQuery(\'#finished-' . esc_js($this->upgrader->update_current) . '\ span\').toggle();</script>';
     1152        }
     1153
    11371154        $this->reset();
    11381155        $this->flush_output();
     
    11681185        parent::after($this->plugin_info['Title']);
    11691186    }
     1187    function bulk_footer() {
     1188        parent::bulk_footer();
     1189        $update_actions =  array(
     1190            'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>',
     1191            'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
     1192        );
     1193
     1194        $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
     1195        if ( ! empty($update_actions) )
     1196            $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
     1197    }
    11701198}
    11711199
     
    11871215    function after() {
    11881216        parent::after($this->theme_info['Name']);
     1217    }
     1218    function bulk_footer() {
     1219        parent::bulk_footer();
     1220        $update_actions =  array(
     1221            'themes_page' => '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Goto themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>',
     1222            'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Goto WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
     1223        );
     1224
     1225        $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
     1226        if ( ! empty($update_actions) )
     1227            $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
    11891228    }
    11901229}
     
    13421381    function after() {
    13431382
     1383        $update_actions = array();
    13441384        if ( !empty($this->upgrader->result['destination_name']) &&
    13451385            ($theme_info = $this->upgrader->theme_info()) &&
     
    13531393            $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
    13541394
    1355             $update_actions =  array(
    1356                 'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
    1357                 'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>',
    1358             );
     1395            $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
     1396            $update_actions['activate'] = '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
     1397
    13591398            if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() )
    13601399                unset($update_actions['preview'], $update_actions['activate']);
Note: See TracChangeset for help on using the changeset viewer.