Make WordPress Core

Changeset 13604


Ignore:
Timestamp:
03/06/2010 09:12:49 AM (16 years ago)
Author:
dd32
Message:

First pass at completing the Themes component of the GUU. See #12528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/update-core.php

    r13602 r13604  
    153153
    154154        list_plugin_updates();
    155         //list_theme_updates();
     155        list_theme_updates();
    156156        do_action('core_upgrade_preamble');
    157157        echo '</div>';
     
    240240        if ( empty($themes) )
    241241                return;
     242
     243        $form_action = 'update-core.php?action=do-theme-upgrade';
     244
    242245?>
    243246<h3><?php _e('Themes'); ?></h3>
     247<p><?php _e('The following themes have new versions available. Check the ones you want to update and then click "Update Themes".'); ?></p>
     248<p><?php _e('<strong>Please Note:</strong> Any customizations you have made to the Themes files will be lost. Please consider using <a href="%s">Child Themes</a> for modifications.'); ?></p>
     249<form method="post" action="<?php echo $form_action; ?>" name="upgrade-themes" class="upgrade">
     250<?php wp_nonce_field('upgrade-core'); ?>
     251<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
    244252<table class="widefat" cellspacing="0" id="update-themes-table">
    245253        <thead>
    246254        <tr>
    247255                <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
    248                 <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     256                <th scope="col" class="manage-column"><?php _e('Theme'); ?></th>
    249257        </tr>
    250258        </thead>
     
    253261        <tr>
    254262                <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
    255                 <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     263                <th scope="col" class="manage-column"><?php _e('Theme'); ?></th>
    256264        </tr>
    257265        </tfoot>
     
    259267<?php
    260268        foreach ( (array) $themes as $stylesheet => $theme_data) {
     269                $screenshot = $theme_data->{'Theme Root URI'} . '/' . $stylesheet . '/' . $theme_data->Screenshot;
     270               
    261271                echo "
    262272        <tr class='active'>
    263273                <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' /></th>
    264                 <td class='plugin-title'><strong>{$theme_data->Name}</strong></td>
     274                <td class='plugin-title'><img src='$screenshot' width='64' height='64' style='float:left; padding: 5px' /><strong>{$theme_data->Name}</strong>" .  sprintf(__('You are running version %1$s. Update to %2$s.'), $theme_data->Version, $theme_data->update['new_version']) . "</td>
    265275        </tr>";
    266276        }
     
    268278        </tbody>
    269279</table>
     280<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
     281</form>
    270282<?php
    271283}
     
    394406                $plugins = (array) $_POST['checked'];
    395407        } else {
    396                 wp_redirect('plugins.php');
     408                wp_redirect('update-core.php');
    397409                exit;
    398410        }
     
    409421        echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
    410422        echo '</div>';
     423} elseif ( 'do-theme-upgrade' == $action ) {
     424        check_admin_referer('upgrade-core');
     425
     426        if ( isset( $_GET['themes'] ) ) {
     427                $themes = explode( ',', $_GET['themes'] );
     428        } elseif ( isset( $_POST['checked'] ) ) {
     429                $themes = (array) $_POST['checked'];
     430        } else {
     431                wp_redirect('update-core.php');
     432                exit;
     433        }
     434
     435        $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
     436        $url = wp_nonce_url($url, 'bulk-update-themes');
     437
     438        $title = __('Update Themes');
     439
     440        require_once('admin-header.php');
     441        echo '<div class="wrap">';
     442        screen_icon('themes');
     443        echo '<h2>' . esc_html__('Update Themes') . '</h2>';
     444        echo "<p>@TODO: Sorry, This part of the functionality hasnt been written yet.</p>";
     445        echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
     446        echo '</div>';
    411447}
    412448
Note: See TracChangeset for help on using the changeset viewer.