2008-02-11 00:45:54 -05:00
|
|
|
<?php
|
2008-08-16 03:27:34 -04:00
|
|
|
/**
|
2009-04-19 15:36:28 -04:00
|
|
|
* Update/Install Plugin/Theme administration panel.
|
2008-08-16 03:27:34 -04:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Administration
|
|
|
|
*/
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
|
2010-12-10 13:25:18 -05:00
|
|
|
define( 'IFRAME_REQUEST', true );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2010-10-18 13:58:36 -04:00
|
|
|
|
2008-08-16 03:27:34 -04:00
|
|
|
/** WordPress Administration Bootstrap */
|
2013-09-24 20:18:11 -04:00
|
|
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
2008-02-11 00:45:54 -05:00
|
|
|
|
2016-08-31 12:31:29 -04:00
|
|
|
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( isset( $_GET['action'] ) ) {
|
|
|
|
$plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
|
|
|
|
$theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : '';
|
|
|
|
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
|
2008-12-09 13:03:31 -05:00
|
|
|
|
2010-03-06 03:39:50 -05:00
|
|
|
if ( 'update-selected' == $action ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2010-03-06 03:39:50 -05:00
|
|
|
|
|
|
|
check_admin_referer( 'bulk-update-plugins' );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( isset( $_GET['plugins'] ) ) {
|
|
|
|
$plugins = explode( ',', stripslashes( $_GET['plugins'] ) );
|
|
|
|
} elseif ( isset( $_POST['checked'] ) ) {
|
2010-03-06 03:39:50 -05:00
|
|
|
$plugins = (array) $_POST['checked'];
|
2017-11-30 18:11:00 -05:00
|
|
|
} else {
|
2010-03-06 03:39:50 -05:00
|
|
|
$plugins = array();
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2010-03-06 03:39:50 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$plugins = array_map( 'urldecode', $plugins );
|
2010-03-06 03:39:50 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
|
2010-03-06 03:39:50 -05:00
|
|
|
$nonce = 'bulk-update-plugins';
|
|
|
|
|
2014-02-26 01:55:14 -05:00
|
|
|
wp_enqueue_script( 'updates' );
|
2010-03-06 03:39:50 -05:00
|
|
|
iframe_header();
|
|
|
|
|
|
|
|
$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
|
|
|
|
$upgrader->bulk_upgrade( $plugins );
|
|
|
|
|
|
|
|
iframe_footer();
|
2010-03-17 12:27:25 -04:00
|
|
|
|
2010-03-06 03:39:50 -05:00
|
|
|
} elseif ( 'upgrade-plugin' == $action ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
|
|
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
check_admin_referer( 'upgrade-plugin_' . $plugin );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Update Plugin' );
|
|
|
|
$parent_file = 'plugins.php';
|
2009-04-19 15:36:28 -04:00
|
|
|
$submenu_file = 'plugins.php';
|
2014-02-26 01:55:14 -05:00
|
|
|
|
|
|
|
wp_enqueue_script( 'updates' );
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
|
|
|
$nonce = 'upgrade-plugin_' . $plugin;
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
|
|
|
|
$upgrader->upgrade( $plugin );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
} elseif ( 'activate-plugin' == $action ) {
|
|
|
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
|
|
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
check_admin_referer( 'activate-plugin_' . $plugin );
|
|
|
|
if ( ! isset( $_GET['failure'] ) && ! isset( $_GET['success'] ) ) {
|
|
|
|
wp_redirect( admin_url( 'update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce'] ) );
|
2010-10-27 09:40:14 -04:00
|
|
|
activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
|
2017-11-30 18:11:00 -05:00
|
|
|
wp_redirect( admin_url( 'update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce'] ) );
|
2008-03-21 19:02:00 -04:00
|
|
|
die();
|
|
|
|
}
|
2017-11-30 18:11:00 -05:00
|
|
|
iframe_header( __( 'Plugin Reactivation' ), true );
|
|
|
|
if ( isset( $_GET['success'] ) ) {
|
|
|
|
echo '<p>' . __( 'Plugin reactivated successfully.' ) . '</p>';
|
|
|
|
}
|
2008-03-21 19:02:00 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( isset( $_GET['failure'] ) ) {
|
|
|
|
echo '<p>' . __( 'Plugin failed to reactivate due to a fatal error.' ) . '</p>';
|
2009-12-12 04:20:07 -05:00
|
|
|
|
2011-04-12 05:21:13 -04:00
|
|
|
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
|
2017-11-30 18:11:00 -05:00
|
|
|
@ini_set( 'display_errors', true ); //Ensure that Fatal errors are displayed.
|
2014-02-10 18:00:15 -05:00
|
|
|
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
|
|
|
|
include( WP_PLUGIN_DIR . '/' . $plugin );
|
2008-03-21 19:02:00 -04:00
|
|
|
}
|
2008-10-13 19:39:56 -04:00
|
|
|
iframe_footer();
|
2009-04-19 15:36:28 -04:00
|
|
|
} elseif ( 'install-plugin' == $action ) {
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2014-05-19 01:04:16 -04:00
|
|
|
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2015-09-26 11:50:25 -04:00
|
|
|
check_admin_referer( 'install-plugin_' . $plugin );
|
2017-11-30 18:11:00 -05:00
|
|
|
$api = plugins_api(
|
|
|
|
'plugin_information', array(
|
|
|
|
'slug' => $plugin,
|
|
|
|
'fields' => array(
|
|
|
|
'short_description' => false,
|
|
|
|
'sections' => false,
|
|
|
|
'requires' => false,
|
|
|
|
'rating' => false,
|
|
|
|
'ratings' => false,
|
|
|
|
'downloaded' => false,
|
|
|
|
'last_updated' => false,
|
|
|
|
'added' => false,
|
|
|
|
'tags' => false,
|
|
|
|
'compatibility' => false,
|
|
|
|
'homepage' => false,
|
|
|
|
'donate_link' => false,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
2015-09-26 11:50:25 -04:00
|
|
|
|
|
|
|
if ( is_wp_error( $api ) ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
wp_die( $api );
|
2015-09-26 11:50:25 -04:00
|
|
|
}
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Plugin Installation' );
|
|
|
|
$parent_file = 'plugins.php';
|
2009-04-19 15:36:28 -04:00
|
|
|
$submenu_file = 'plugin-install.php';
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = sprintf( __( 'Installing Plugin: %s' ), $api->name . ' ' . $api->version );
|
2009-04-19 15:36:28 -04:00
|
|
|
$nonce = 'install-plugin_' . $plugin;
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
|
|
|
|
if ( isset( $_GET['from'] ) ) {
|
|
|
|
$url .= '&from=' . urlencode( stripslashes( $_GET['from'] ) );
|
|
|
|
}
|
2010-05-27 07:04:08 -04:00
|
|
|
|
2009-04-19 15:36:28 -04:00
|
|
|
$type = 'web'; //Install plugin type, From Web or an Upload.
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) );
|
|
|
|
$upgrader->install( $api->download_link );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
|
|
|
} elseif ( 'upload-plugin' == $action ) {
|
|
|
|
|
2014-08-26 21:32:18 -04:00
|
|
|
if ( ! current_user_can( 'upload_plugins' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
2014-08-26 21:32:18 -04:00
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
check_admin_referer( 'plugin-upload' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Upload Plugin' );
|
|
|
|
$parent_file = 'plugins.php';
|
2009-04-19 15:36:28 -04:00
|
|
|
$submenu_file = 'plugin-install.php';
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = sprintf( __( 'Installing Plugin from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) );
|
2009-04-19 15:36:28 -04:00
|
|
|
$nonce = 'plugin-upload';
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-plugin' );
|
|
|
|
$type = 'upload'; //Install plugin type, From Web or an Upload.
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) );
|
|
|
|
$result = $upgrader->install( $file_upload->package );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $result || is_wp_error( $result ) ) {
|
2011-08-28 01:51:38 -04:00
|
|
|
$file_upload->cleanup();
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2011-08-27 23:51:35 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2008-12-09 13:03:31 -05:00
|
|
|
} elseif ( 'upgrade-theme' == $action ) {
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'update_themes' ) ) {
|
|
|
|
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
check_admin_referer( 'upgrade-theme_' . $theme );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2014-02-26 01:55:14 -05:00
|
|
|
wp_enqueue_script( 'updates' );
|
2012-04-09 22:25:03 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Update Theme' );
|
|
|
|
$parent_file = 'themes.php';
|
2009-04-19 15:36:28 -04:00
|
|
|
$submenu_file = 'themes.php';
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
|
|
|
$nonce = 'upgrade-theme_' . $theme;
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) );
|
|
|
|
$upgrader->upgrade( $theme );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2010-03-12 22:59:40 -05:00
|
|
|
} elseif ( 'update-selected-themes' == $action ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'update_themes' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2010-03-12 22:59:40 -05:00
|
|
|
check_admin_referer( 'bulk-update-themes' );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( isset( $_GET['themes'] ) ) {
|
|
|
|
$themes = explode( ',', stripslashes( $_GET['themes'] ) );
|
|
|
|
} elseif ( isset( $_POST['checked'] ) ) {
|
2010-03-12 22:59:40 -05:00
|
|
|
$themes = (array) $_POST['checked'];
|
2017-11-30 18:11:00 -05:00
|
|
|
} else {
|
2010-03-12 22:59:40 -05:00
|
|
|
$themes = array();
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2010-03-12 22:59:40 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$themes = array_map( 'urldecode', $themes );
|
2010-03-12 22:59:40 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
|
2010-03-12 22:59:40 -05:00
|
|
|
$nonce = 'bulk-update-themes';
|
|
|
|
|
2014-02-26 01:55:14 -05:00
|
|
|
wp_enqueue_script( 'updates' );
|
2010-03-12 22:59:40 -05:00
|
|
|
iframe_header();
|
|
|
|
|
|
|
|
$upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
|
|
|
|
$upgrader->bulk_upgrade( $themes );
|
|
|
|
|
|
|
|
iframe_footer();
|
2009-04-19 15:36:28 -04:00
|
|
|
} elseif ( 'install-theme' == $action ) {
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! current_user_can( 'install_themes' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2008-02-11 00:45:54 -05:00
|
|
|
|
2016-08-31 12:31:29 -04:00
|
|
|
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
|
|
|
|
|
2014-04-14 21:16:14 -04:00
|
|
|
check_admin_referer( 'install-theme_' . $theme );
|
2017-11-30 18:11:00 -05:00
|
|
|
$api = themes_api(
|
|
|
|
'theme_information', array(
|
|
|
|
'slug' => $theme,
|
|
|
|
'fields' => array(
|
|
|
|
'sections' => false,
|
|
|
|
'tags' => false,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
); //Save on a bit of bandwidth.
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-10-09 12:04:48 -04:00
|
|
|
if ( is_wp_error( $api ) ) {
|
|
|
|
wp_die( $api );
|
|
|
|
}
|
2012-04-09 22:25:03 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Install Themes' );
|
|
|
|
$parent_file = 'themes.php';
|
2010-03-19 04:03:52 -04:00
|
|
|
$submenu_file = 'themes.php';
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = sprintf( __( 'Installing Theme: %s' ), $api->name . ' ' . $api->version );
|
2009-04-19 15:36:28 -04:00
|
|
|
$nonce = 'install-theme_' . $theme;
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
|
|
|
|
$type = 'web'; //Install theme type, From Web or an Upload.
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) );
|
|
|
|
$upgrader->install( $api->download_link );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2009-04-20 14:18:39 -04:00
|
|
|
|
2009-04-19 15:36:28 -04:00
|
|
|
} elseif ( 'upload-theme' == $action ) {
|
|
|
|
|
2014-08-26 21:32:18 -04:00
|
|
|
if ( ! current_user_can( 'upload_themes' ) ) {
|
2016-06-29 11:16:29 -04:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
2014-08-26 21:32:18 -04:00
|
|
|
}
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
check_admin_referer( 'theme-upload' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$file_upload = new File_Upload_Upgrader( 'themezip', 'package' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = __( 'Upload Theme' );
|
|
|
|
$parent_file = 'themes.php';
|
2009-04-19 15:36:28 -04:00
|
|
|
$submenu_file = 'theme-install.php';
|
2012-04-09 22:25:03 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$title = sprintf( __( 'Installing Theme from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) );
|
2009-04-19 15:36:28 -04:00
|
|
|
$nonce = 'theme-upload';
|
2017-11-30 18:11:00 -05:00
|
|
|
$url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-theme' );
|
|
|
|
$type = 'upload'; //Install plugin type, From Web or an Upload.
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) );
|
|
|
|
$result = $upgrader->install( $file_upload->package );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $result || is_wp_error( $result ) ) {
|
2011-08-28 01:51:38 -04:00
|
|
|
$file_upload->cleanup();
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2011-08-27 23:51:35 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
2009-04-19 15:36:28 -04:00
|
|
|
|
|
|
|
} else {
|
2013-10-27 14:37:09 -04:00
|
|
|
/**
|
|
|
|
* Fires when a custom plugin or theme update request is received.
|
|
|
|
*
|
2014-11-30 06:42:24 -05:00
|
|
|
* The dynamic portion of the hook name, `$action`, refers to the action
|
2013-10-27 14:37:09 -04:00
|
|
|
* provided in the request for wp-admin/update.php. Can be used to
|
|
|
|
* provide custom update functionality for themes and plugins.
|
|
|
|
*
|
|
|
|
* @since 2.8.0
|
|
|
|
*/
|
|
|
|
do_action( "update-custom_{$action}" );
|
2009-04-19 15:36:28 -04:00
|
|
|
}
|
2010-04-29 21:54:32 -04:00
|
|
|
}
|