+/**
+ *
+ * @global string $wp_version
+ */
+function list_plugin_updates() {
+ global $wp_version;
+
+ $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
+
+ require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
+ $plugins = get_plugin_updates();
+ if ( empty( $plugins ) ) {
+ echo '<h2>' . __( 'Plugins' ) . '</h2>';
+ echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
+ return;
+ }
+ $form_action = 'update-core.php?action=do-plugin-upgrade';
+
+ $core_updates = get_core_updates();
+ if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
+ $core_update_version = false;
+ else
+ $core_update_version = $core_updates[0]->current;
+ ?>
+<h2><?php _e( 'Plugins' ); ?></h2>
+<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p>
+<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
+<?php wp_nonce_field('upgrade-core'); ?>
+<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
+<table class="widefat updates-table" id="update-plugins-table">
+ <thead>
+ <tr>
+ <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
+ <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
+ </tr>
+ </thead>
+
+ <tbody class="plugins">
+<?php
+ foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
+ // Get plugin compat for running version of WordPress.
+ if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
+ $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
+ } elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) {
+ $compat = $plugin_data->update->compatibility->{$cur_wp_version};
+ $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
+ } else {
+ $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
+ }
+ // Get plugin compat for updated version of WordPress.
+ if ( $core_update_version ) {
+ if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
+ $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
+ } elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {
+ $update_compat = $plugin_data->update->compatibility->{$core_update_version};
+ $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
+ } else {
+ $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
+ }
+ }
+ // Get the upgrade notice for the new plugin version.
+ if ( isset($plugin_data->update->upgrade_notice) ) {
+ $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
+ } else {
+ $upgrade_notice = '';
+ }
+
+ $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662');
+ $details = sprintf(
+ '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
+ esc_url( $details_url ),
+ /* translators: 1: plugin name, 2: version number */
+ esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
+ /* translators: %s: plugin version */
+ sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
+ );
+
+ $checkbox_id = "checkbox_" . md5( $plugin_data->Name );
+ ?>
+ <tr>
+ <td class="check-column">
+ <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
+ <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
+ /* translators: %s: plugin name */
+ printf( __( 'Select %s' ),
+ $plugin_data->Name
+ );
+ ?></label>
+ </td>
+ <td class="plugin-title"><p>
+ <strong><?php echo $plugin_data->Name; ?></strong>
+ <?php
+ /* translators: 1: plugin version, 2: new version */
+ printf( __( 'You have version %1$s installed. Update to %2$s.' ),
+ $plugin_data->Version,
+ $plugin_data->update->new_version
+ );
+ echo ' ' . $details . $compat . $upgrade_notice;
+ ?>
+ </p></td>
+ </tr>
+ <?php
+ }
+?>
+ </tbody>
+
+ <tfoot>
+ <tr>
+ <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
+ <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
+ </tr>
+ </tfoot>
+</table>
+<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
+</form>
+<?php
+}
+
+/**
+ * @since 2.9.0
+ */
+function list_theme_updates() {
+ $themes = get_theme_updates();
+ if ( empty( $themes ) ) {
+ echo '<h2>' . __( 'Themes' ) . '</h2>';
+ echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
+ return;
+ }
+
+ $form_action = 'update-core.php?action=do-theme-upgrade';
+?>
+<h2><?php _e( 'Themes' ); ?></h2>
+<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p>
+<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p>
+<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
+<?php wp_nonce_field('upgrade-core'); ?>
+<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
+<table class="widefat updates-table" id="update-themes-table">
+ <thead>
+ <tr>
+ <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
+ <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
+ </tr>
+ </thead>
+
+ <tbody class="plugins">
+<?php
+ foreach ( $themes as $stylesheet => $theme ) {
+ $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
+ ?>
+ <tr>
+ <td class="check-column">
+ <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
+ <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
+ /* translators: %s: theme name */
+ printf( __( 'Select %s' ),
+ $theme->display( 'Name' )
+ );
+ ?></label>
+ </td>
+ <td class="plugin-title"><p>
+ <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
+ <strong><?php echo $theme->display( 'Name' ); ?></strong>
+ <?php
+ /* translators: 1: theme version, 2: new version */
+ printf( __( 'You have version %1$s installed. Update to %2$s.' ),
+ $theme->display( 'Version' ),
+ $theme->update['new_version']
+ );
+ ?>
+ </p></td>
+ </tr>
+ <?php
+ }
+?>
+ </tbody>
+
+ <tfoot>
+ <tr>
+ <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
+ <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
+ </tr>
+ </tfoot>
+</table>
+<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
+</form>
+<?php
+}
+
+/**
+ * @since 3.7.0
+ */
+function list_translation_updates() {
+ $updates = wp_get_translation_updates();
+ if ( ! $updates ) {
+ if ( 'en_US' != get_locale() ) {
+ echo '<h2>' . __( 'Translations' ) . '</h2>';
+ echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
+ }
+ return;
+ }
+
+ $form_action = 'update-core.php?action=do-translation-upgrade';
+ ?>
+ <h2><?php _e( 'Translations' ); ?></h2>
+ <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
+ <p><?php _e( 'New translations are available.' ); ?></p>
+ <?php wp_nonce_field( 'upgrade-translations' ); ?>
+ <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
+ </form>
+ <?php
+}