Make WordPress Core

Changeset 12066


Ignore:
Timestamp:
10/20/2009 04:11:59 PM (15 years ago)
Author:
ryan
Message:

Start roughing in GUU. see #10973

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r11933 r12066  
    146146}
    147147
     148function get_plugin_updates() {
     149    $all_plugins = get_plugins();
     150    $upgrade_plugins = array();
     151    $current = get_transient( 'update_plugins' );
     152    foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
     153        if ( isset( $current->response[ $plugin_file ] ) ) {
     154            $upgrade_plugins[ $plugin_file ] = (object) $plugin_data;
     155            $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ];
     156        }
     157    }
     158
     159    return $upgrade_plugins;
     160}
     161
    148162function wp_plugin_update_rows() {
    149163    $plugins = get_transient( 'update_plugins' );
     
    192206}
    193207
     208function get_theme_updates() {
     209    $themes = get_themes();
     210    $current = get_transient('update_themes');
     211    $update_themes = array();
     212
     213    foreach ( $themes as $theme ) {
     214        $theme = (object) $theme;
     215        if ( isset($current->response[ $theme->Stylesheet ]) ) {
     216            $update_themes[$theme->Stylesheet] = $theme;
     217            $update_themes[$theme->Stylesheet]->update = $current->response[ $theme->Stylesheet ];
     218        }
     219    }
     220
     221    return $update_themes;
     222}
     223
    194224function wp_update_theme($theme, $feedback = '') {
    195225
  • trunk/wp-admin/update-core.php

    r11669 r12066  
    128128    dismissed_updates();
    129129    echo '</div>';
    130 }
    131 
     130
     131    list_plugin_updates();
     132    list_theme_updates();
     133}
     134
     135function list_plugin_updates() {
     136    $plugins = get_plugin_updates();
     137    if ( empty($plugins) )
     138        return;
     139?>
     140<h3><?php _e('Plugins'); ?></h3>
     141<table class="widefat" cellspacing="0" id="update-plugins-table">
     142    <thead>
     143    <tr>
     144        <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
     145        <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     146    </tr>
     147    </thead>
     148
     149    <tfoot>
     150    <tr>
     151        <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
     152        <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     153    </tr>
     154    </tfoot>
     155    <tbody class="plugins">
     156<?php
     157    foreach ( (array) $plugins as $plugin_file => $plugin_data) {
     158        echo "
     159    <tr class='active'>
     160        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
     161        <td class='plugin-title'><strong>{$plugin_data->Name}</strong></td>
     162    </tr>";
     163    }
     164?>
     165    </tbody>
     166</table>
     167<?php
     168}
     169
     170function list_theme_updates() {
     171    $themes = get_theme_updates();
     172    if ( empty($themes) )
     173        return;
     174?>
     175<h3><?php _e('Themes'); ?></h3>
     176<table class="widefat" cellspacing="0" id="update-themes-table">
     177    <thead>
     178    <tr>
     179        <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
     180        <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     181    </tr>
     182    </thead>
     183
     184    <tfoot>
     185    <tr>
     186        <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
     187        <th scope="col" class="manage-column"><?php _e('Name'); ?></th>
     188    </tr>
     189    </tfoot>
     190    <tbody class="plugins">
     191<?php
     192    foreach ( (array) $themes as $stylesheet => $theme_data) {
     193        echo "
     194    <tr class='active'>
     195        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' /></th>
     196        <td class='plugin-title'><strong>{$theme_data->Name}</strong></td>
     197    </tr>";
     198    }
     199?>
     200    </tbody>
     201</table>
     202<?php
     203}
    132204
    133205/**
Note: See TracChangeset for help on using the changeset viewer.