Version Description
Download this release
Release Info
Developer | chrisbliss18 |
Plugin | Easy Theme and Plugin Upgrades |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- history.txt +2 -0
- init.php +1 -1
- modify-installer.php +62 -27
- readme.txt +4 -3
- show-maintenance-message.php +1 -1
history.txt
CHANGED
@@ -4,3 +4,5 @@
|
|
4 |
Fixed an issue with running upgrades on multisite networks
|
5 |
1.0.2 - 2013-08-20 - Chris Jean
|
6 |
Removed a stray <i> tag in the Install Plugins screen that caused problems with installing plugins on WPEngine sites.
|
|
|
|
4 |
Fixed an issue with running upgrades on multisite networks
|
5 |
1.0.2 - 2013-08-20 - Chris Jean
|
6 |
Removed a stray <i> tag in the Install Plugins screen that caused problems with installing plugins on WPEngine sites.
|
7 |
+
1.0.3 - 2014-04-18 - Chris Jean
|
8 |
+
Bug Fix: Fixed issue with theme upgrades working properly in WordPress 3.9.
|
init.php
CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Easy Theme and Plugin Upgrades
|
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/easy-theme-and-plugin-upgrades/
|
6 |
Description: This plugin allows for installed themes to be upgraded by using the Appearance > Add New Themes > Upload feature of WordPress. Without this plugin, themes can only be installed using this method, requiring you to first delete the theme before installing the newer version. Now features the same easy upgrading for plugins via the Plugins > Add New > Upload page.
|
7 |
Author: Chris Jean
|
8 |
-
Version: 1.0.
|
9 |
Author URI: http://ithemes.com/
|
10 |
*/
|
11 |
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/easy-theme-and-plugin-upgrades/
|
6 |
Description: This plugin allows for installed themes to be upgraded by using the Appearance > Add New Themes > Upload feature of WordPress. Without this plugin, themes can only be installed using this method, requiring you to first delete the theme before installing the newer version. Now features the same easy upgrading for plugins via the Plugins > Add New > Upload page.
|
7 |
Author: Chris Jean
|
8 |
+
Version: 1.0.3
|
9 |
Author URI: http://ithemes.com/
|
10 |
*/
|
11 |
|
modify-installer.php
CHANGED
@@ -8,26 +8,26 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
8 |
|
9 |
|
10 |
function ETUModifyInstaller() {
|
11 |
-
if ( preg_match( '
|
12 |
-
if ( 'upload-theme' === $_REQUEST['action'] )
|
13 |
$this->_type = 'theme';
|
14 |
-
else if ( 'upload-plugin' === $_REQUEST['action'] )
|
15 |
$this->_type = 'plugin';
|
|
|
16 |
|
17 |
-
if ( ! empty( $this->_type ) )
|
18 |
-
add_action( 'admin_init', array(
|
|
|
19 |
}
|
20 |
|
21 |
-
add_action(
|
22 |
-
add_action(
|
23 |
-
add_action( "install_plugins_upload", array( &$this, 'start_plugin_output_buffering' ), 0 );
|
24 |
-
add_action( "install_plugins_upload", array( &$this, 'end_output_buffering' ), 20 );
|
25 |
}
|
26 |
|
27 |
function filter_output( $output ) {
|
28 |
-
$text = "<div style='width:600px;'>\n";
|
29 |
$text .= "<p><i>By default, the installer will not overwrite an existing {$this->_type}. Change the following option to \"Yes\" to allow this installer to perform upgrades as well.</i></p>";
|
30 |
-
$text .= "<p>Upgrade existing {$this->_type}? <select name='
|
31 |
$text .= "<p>If a {$this->_type} is upgraded, the following process will be used:</p>\n";
|
32 |
$text .= "<ol>\n";
|
33 |
$text .= "<li>A backup zip of the existing {$this->_type} will be created and added to the <a href='" . admin_url( 'upload.php' ) . "'>Media Library</a>.</li>\n";
|
@@ -38,30 +38,47 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
38 |
$text .= "</ol><br />\n";
|
39 |
$text .= "</div>\n";
|
40 |
|
41 |
-
$output = preg_replace( '
|
42 |
|
43 |
return $output;
|
44 |
}
|
45 |
|
46 |
function start_theme_output_buffering() {
|
47 |
$this->_type = 'theme';
|
48 |
-
ob_start( array(
|
49 |
}
|
50 |
|
51 |
function start_plugin_output_buffering() {
|
52 |
$this->_type = 'plugin';
|
53 |
-
ob_start( array(
|
54 |
}
|
55 |
|
56 |
-
function
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
function _get_theme_data( $directory ) {
|
61 |
$data = array();
|
62 |
|
63 |
-
$themes =
|
64 |
-
$active_theme =
|
65 |
$current_theme = array();
|
66 |
|
67 |
foreach ( (array) $themes as $theme_name => $theme_data ) {
|
@@ -95,12 +112,15 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
95 |
$current_plugin = array();
|
96 |
|
97 |
foreach ( (array) $plugins as $plugin_path_file => $plugin_data ) {
|
98 |
-
|
|
|
99 |
$current_plugin = array( 'path' => $plugin_path_file, 'data' => $plugin_data );
|
|
|
100 |
}
|
101 |
|
102 |
-
if ( empty( $current_plugin ) )
|
103 |
return $data;
|
|
|
104 |
|
105 |
$data['version'] = $current_plugin['data']['Version'];
|
106 |
$data['name'] = $current_plugin['data']['Name'];
|
@@ -111,9 +131,24 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
111 |
}
|
112 |
|
113 |
function handle_upgrades() {
|
114 |
-
if (
|
115 |
-
$this->_errors[] = "
|
116 |
-
add_action( 'admin_notices', array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
return;
|
119 |
}
|
@@ -167,7 +202,7 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
167 |
|
168 |
if ( 0 == $zip_result ) {
|
169 |
$this->_errors[] = "Unable to make a backup of the existing {$this->_type}. Will not proceed with the upgrade.";
|
170 |
-
add_action( 'admin_notices', array(
|
171 |
|
172 |
return;
|
173 |
}
|
@@ -193,14 +228,14 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
193 |
|
194 |
if ( ! WP_Filesystem() ) {
|
195 |
$this->_errors[] = 'Unable to initialize WP_Filesystem. Will not proceed with the upgrade.';
|
196 |
-
add_action( 'admin_notices', array(
|
197 |
|
198 |
return;
|
199 |
}
|
200 |
|
201 |
if ( ! $wp_filesystem->delete( $data['directory'], true ) ) {
|
202 |
$this->_errors[] = "Unable to remove the existing {$this->_type} directory. Will not proceed with the upgrade.";
|
203 |
-
add_action( 'admin_notices', array(
|
204 |
|
205 |
return;
|
206 |
}
|
@@ -208,7 +243,7 @@ if ( ! class_exists( 'ETUModifyInstaller' ) ) {
|
|
208 |
|
209 |
$this->_zip_url = $zip_url;
|
210 |
|
211 |
-
add_action( 'all_admin_notices', array(
|
212 |
}
|
213 |
|
214 |
function show_message() {
|
8 |
|
9 |
|
10 |
function ETUModifyInstaller() {
|
11 |
+
if ( preg_match( '/update\.php/', $_SERVER['REQUEST_URI'] ) && isset( $_REQUEST['action'] ) ) {
|
12 |
+
if ( 'upload-theme' === $_REQUEST['action'] ) {
|
13 |
$this->_type = 'theme';
|
14 |
+
} else if ( 'upload-plugin' === $_REQUEST['action'] ) {
|
15 |
$this->_type = 'plugin';
|
16 |
+
}
|
17 |
|
18 |
+
if ( ! empty( $this->_type ) ) {
|
19 |
+
add_action( 'admin_init', array( $this, 'handle_upgrades' ), 100 );
|
20 |
+
}
|
21 |
}
|
22 |
|
23 |
+
add_action( 'load-theme-install.php', array( $this, 'start_theme_output_buffering' ) );
|
24 |
+
add_action( 'load-plugin-install.php', array( $this, 'start_plugin_output_buffering' ) );
|
|
|
|
|
25 |
}
|
26 |
|
27 |
function filter_output( $output ) {
|
28 |
+
$text = "<div style='max-width:600px;'>\n";
|
29 |
$text .= "<p><i>By default, the installer will not overwrite an existing {$this->_type}. Change the following option to \"Yes\" to allow this installer to perform upgrades as well.</i></p>";
|
30 |
+
$text .= "<p>Upgrade existing {$this->_type}? <select name='caj_etu_upgrade_existing'><option value=''>No</option><option value='yes'>Yes</option></select></p>\n";
|
31 |
$text .= "<p>If a {$this->_type} is upgraded, the following process will be used:</p>\n";
|
32 |
$text .= "<ol>\n";
|
33 |
$text .= "<li>A backup zip of the existing {$this->_type} will be created and added to the <a href='" . admin_url( 'upload.php' ) . "'>Media Library</a>.</li>\n";
|
38 |
$text .= "</ol><br />\n";
|
39 |
$text .= "</div>\n";
|
40 |
|
41 |
+
$output = preg_replace( '/(<input [^>]*name="(?:theme|plugin)zip".+?\n)/', "\$1$text", $output );
|
42 |
|
43 |
return $output;
|
44 |
}
|
45 |
|
46 |
function start_theme_output_buffering() {
|
47 |
$this->_type = 'theme';
|
48 |
+
ob_start( array( $this, 'filter_output' ) );
|
49 |
}
|
50 |
|
51 |
function start_plugin_output_buffering() {
|
52 |
$this->_type = 'plugin';
|
53 |
+
ob_start( array( $this, 'filter_output' ) );
|
54 |
}
|
55 |
|
56 |
+
function _get_themes() {
|
57 |
+
global $wp_themes;
|
58 |
+
|
59 |
+
if ( isset( $wp_themes ) ) {
|
60 |
+
return $wp_themes;
|
61 |
+
}
|
62 |
+
|
63 |
+
$themes = wp_get_themes();
|
64 |
+
$wp_themes = array();
|
65 |
+
|
66 |
+
foreach ( $themes as $theme ) {
|
67 |
+
$name = $theme->get( 'Name' );
|
68 |
+
if ( isset( $wp_themes[$name] ) )
|
69 |
+
$wp_themes[$name . '/' . $theme->get_stylesheet()] = $theme;
|
70 |
+
else
|
71 |
+
$wp_themes[$name] = $theme;
|
72 |
+
}
|
73 |
+
|
74 |
+
return $wp_themes;
|
75 |
}
|
76 |
|
77 |
function _get_theme_data( $directory ) {
|
78 |
$data = array();
|
79 |
|
80 |
+
$themes = $this->_get_themes();
|
81 |
+
$active_theme = wp_get_theme();
|
82 |
$current_theme = array();
|
83 |
|
84 |
foreach ( (array) $themes as $theme_name => $theme_data ) {
|
112 |
$current_plugin = array();
|
113 |
|
114 |
foreach ( (array) $plugins as $plugin_path_file => $plugin_data ) {
|
115 |
+
$path_parts = explode( '/', $plugin_path_file );
|
116 |
+
if ( $directory === reset( $path_parts ) ) {
|
117 |
$current_plugin = array( 'path' => $plugin_path_file, 'data' => $plugin_data );
|
118 |
+
}
|
119 |
}
|
120 |
|
121 |
+
if ( empty( $current_plugin ) ) {
|
122 |
return $data;
|
123 |
+
}
|
124 |
|
125 |
$data['version'] = $current_plugin['data']['Version'];
|
126 |
$data['name'] = $current_plugin['data']['Name'];
|
131 |
}
|
132 |
|
133 |
function handle_upgrades() {
|
134 |
+
if ( empty( $_POST['caj_etu_upgrade_existing'] ) ) {
|
135 |
+
$this->_errors[] = "The Easy Theme and Plugin Upgrades plugin was unable to handle requests for this upgrade. Unfortunately, this setup may be incompatible with the plugin.";
|
136 |
+
add_action( 'admin_notices', array( $this, 'show_upgrade_option_error_message' ) );
|
137 |
+
|
138 |
+
return;
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( 'yes' !== $_POST['caj_etu_upgrade_existing'] ) {
|
142 |
+
if ( 'plugin' == $this->_type ) {
|
143 |
+
$link = admin_url( "plugin-install.php?tab=upload" );
|
144 |
+
} else if ( version_compare( $GLOBALS['wp_version'], '3.8.9', '>' ) ) {
|
145 |
+
$link = admin_url( "theme-install.php" );
|
146 |
+
} else {
|
147 |
+
$link = admin_url( "theme-install.php?tab=upload" );
|
148 |
+
}
|
149 |
+
|
150 |
+
$this->_errors[] = "You must select \"Yes\" from the \"Upgrade existing {$this->_type}?\" dropdown option in order to upgrade an existing {$this->_type}. <a href=\"$link\">Try again</a>.";
|
151 |
+
add_action( 'admin_notices', array( $this, 'show_upgrade_option_error_message' ) );
|
152 |
|
153 |
return;
|
154 |
}
|
202 |
|
203 |
if ( 0 == $zip_result ) {
|
204 |
$this->_errors[] = "Unable to make a backup of the existing {$this->_type}. Will not proceed with the upgrade.";
|
205 |
+
add_action( 'admin_notices', array( $this, 'show_upgrade_option_error_message' ) );
|
206 |
|
207 |
return;
|
208 |
}
|
228 |
|
229 |
if ( ! WP_Filesystem() ) {
|
230 |
$this->_errors[] = 'Unable to initialize WP_Filesystem. Will not proceed with the upgrade.';
|
231 |
+
add_action( 'admin_notices', array( $this, 'show_upgrade_option_error_message' ) );
|
232 |
|
233 |
return;
|
234 |
}
|
235 |
|
236 |
if ( ! $wp_filesystem->delete( $data['directory'], true ) ) {
|
237 |
$this->_errors[] = "Unable to remove the existing {$this->_type} directory. Will not proceed with the upgrade.";
|
238 |
+
add_action( 'admin_notices', array( $this, 'show_upgrade_option_error_message' ) );
|
239 |
|
240 |
return;
|
241 |
}
|
243 |
|
244 |
$this->_zip_url = $zip_url;
|
245 |
|
246 |
+
add_action( 'all_admin_notices', array( $this, 'show_message' ) );
|
247 |
}
|
248 |
|
249 |
function show_message() {
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: chrisbliss18
|
3 |
Tags: upload, plugins, themes, upgrade
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 1.0.
|
7 |
|
8 |
-
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -47,3 +47,4 @@ __Easy Theme and Plugin Upgrades__ was created to make the life of WordPress use
|
|
47 |
* 1.0.0 - 2011-07-06 - Initial release version
|
48 |
* 1.0.1 - 2011-09-28 - Fixed an issue with the "The site is being updated and will be back in a few minutes" message showing on the frontend of the site for a few minutes after an upgrade. This only happened on multisite networks.
|
49 |
* 1.0.2 - 2013-08-20 - Removed a stray <i> tag in the Install Plugins screen that caused problems with installing plugins on WPEngine sites.
|
|
2 |
Contributors: chrisbliss18
|
3 |
Tags: upload, plugins, themes, upgrade
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 3.9
|
6 |
+
Stable tag: 1.0.3
|
7 |
|
8 |
+
Easily upgrade your themes and plugins using zip files without removing the theme or plugin first.
|
9 |
|
10 |
== Description ==
|
11 |
|
47 |
* 1.0.0 - 2011-07-06 - Initial release version
|
48 |
* 1.0.1 - 2011-09-28 - Fixed an issue with the "The site is being updated and will be back in a few minutes" message showing on the frontend of the site for a few minutes after an upgrade. This only happened on multisite networks.
|
49 |
* 1.0.2 - 2013-08-20 - Removed a stray <i> tag in the Install Plugins screen that caused problems with installing plugins on WPEngine sites.
|
50 |
+
* 1.0.3 - 2014-04-18 - Added compatibility for theme upgrades in WordPress 3.9.
|
show-maintenance-message.php
CHANGED
@@ -5,7 +5,7 @@ if ( ! class_exists( 'ETUShowMaintenanceMessage' ) ) {
|
|
5 |
class ETUShowMaintenanceMessage {
|
6 |
function ETUShowMaintenanceMessage() {
|
7 |
if ( false !== get_transient( 'etu-in-maintenance-mode' ) )
|
8 |
-
add_action( 'template_redirect', array(
|
9 |
}
|
10 |
|
11 |
function show_message() {
|
5 |
class ETUShowMaintenanceMessage {
|
6 |
function ETUShowMaintenanceMessage() {
|
7 |
if ( false !== get_transient( 'etu-in-maintenance-mode' ) )
|
8 |
+
add_action( 'template_redirect', array( $this, 'show_message' ) );
|
9 |
}
|
10 |
|
11 |
function show_message() {
|