Hotfix - Version 1.0

Version Description

  • Lets you update Twenty Twelve if it is shown as "broken" after installing 3.5
Download this release

Release Info

Developer nacin
Plugin Icon wp plugin Hotfix
Version 1.0
Comparing to
See all releases

Code changes from version 0.9 to 1.0

Files changed (2) hide show
  1. hotfix.php +67 -1
  2. readme.txt +11 -6
hotfix.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Hotfix
4
  Description: Provides "hotfixes" for selected WordPress bugs, so you don't have to wait for the next WordPress core release. Keep the plugin updated!
5
- Version: 0.9
6
  Author: Mark Jaquith
7
  Author URI: http://coveredwebservices.com/
8
  */
@@ -34,6 +34,9 @@ function wp_hotfix_init() {
34
  $hotfixes = array();
35
 
36
  switch ( $wp_version ) {
 
 
 
37
  case '3.4.2' :
38
  $hotfixes = array( '342_custom_fields' );
39
  break;
@@ -151,3 +154,66 @@ function wp_hotfix_342_custom_fields_action() {
151
  </script>
152
  <?php
153
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  Plugin Name: Hotfix
4
  Description: Provides "hotfixes" for selected WordPress bugs, so you don't have to wait for the next WordPress core release. Keep the plugin updated!
5
+ Version: 1.0
6
  Author: Mark Jaquith
7
  Author URI: http://coveredwebservices.com/
8
  */
34
  $hotfixes = array();
35
 
36
  switch ( $wp_version ) {
37
+ case '3.5' :
38
+ $hotfixes = array( '350_twentytwelve' );
39
+ break;
40
  case '3.4.2' :
41
  $hotfixes = array( '342_custom_fields' );
42
  break;
154
  </script>
155
  <?php
156
  }
157
+
158
+ function wp_hotfix_350_twentytwelve() {
159
+ add_action( 'pre_http_request', 'wp_hotfix_350_twentytwelve_pre_http_request', 10, 3 );
160
+ add_action( 'load-themes.php', 'wp_hotfix_350_twentytwelve_themes_php' );
161
+ add_action( 'load-update-core.php', 'wp_hotfix_350_twentytwelve_update_core_php', 9 );
162
+ }
163
+
164
+ function wp_hotfix_350_twentytwelve_update_core_php() {
165
+ if ( ! empty( $_GET['action'] ) )
166
+ return;
167
+
168
+ $theme = wp_get_theme('twentytwelve');
169
+ if ( ! $theme->exists() || ! $theme->errors() )
170
+ return;
171
+
172
+ delete_site_transient( 'update_themes' );
173
+ }
174
+
175
+ function wp_hotfix_350_twentytwelve_themes_php() {
176
+ $theme = wp_get_theme('twentytwelve');
177
+ if ( ! $theme->exists() || ! $theme->errors() )
178
+ return;
179
+
180
+ // Non-English installs weren't affected. Saves us the need to translate!
181
+ if ( 'en_US' != get_locale() )
182
+ return;
183
+
184
+ if ( current_user_can( 'update_themes' ) )
185
+ add_action( 'admin_notices', 'wp_hotfix_350_twentytwelve_notice' );
186
+ }
187
+
188
+ function wp_hotfix_350_twentytwelve_notice() {
189
+ printf( '<div class="error"><p><strong>Looking for Twenty Twelve?</strong> You will need to first update it at <a href="%s">Dashboard &rarr; Updates</a>.</p></div>',
190
+ self_admin_url( 'update-core.php' ) );
191
+ }
192
+
193
+ function wp_hotfix_350_twentytwelve_pre_http_request( $return, $args, $url ) {
194
+ if ( $url != 'http://api.wordpress.org/themes/update-check/1.0/' )
195
+ return $return;
196
+
197
+ if ( ! empty( $args['_twentytwelve_hijack'] ) )
198
+ return $return;
199
+
200
+ $theme = wp_get_theme('twentytwelve');
201
+ if ( ! $theme->exists() || ! $theme->errors() )
202
+ return $return;
203
+
204
+ $args['_twentytwelve_hijack'] = true;
205
+
206
+ $themes = unserialize( $args['body']['themes'] );
207
+ $themes['twentytwelve'] = array(
208
+ 'Name' => 'Twenty Twelve',
209
+ 'Title' => 'Twenty Twelve',
210
+ 'Version' => '1.0',
211
+ 'Author' => 'the WordPress team',
212
+ 'Author URI' => 'http://wordpress.org/',
213
+ 'Template' => 'twentytwelve',
214
+ 'Stylesheet' => 'twentytwelve',
215
+ );
216
+ $args['body']['themes'] = serialize( $themes );
217
+ return wp_remote_post( $url, $args );
218
+ }
219
+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: markjaquith, nacin
3
  Tags: hotfix, bugs, wordpress, update
4
  Requires at least: 3.0
5
- Tested up to: 3.4.2
6
- Stable tag: 0.9
7
 
8
  Provides unofficial fixes for selected WordPress bugs, so you don't have to wait for the next WordPress core release.
9
 
@@ -13,13 +13,12 @@ This unofficial plugin provides fixes for selected WordPress bugs, so you don't
13
 
14
  Recent fixes:
15
 
 
 
 
16
  * **WordPress 3.4.2**
17
  * Fix adding and updating Custom Fields
18
 
19
- * **WordPress 3.3**
20
- * Prevent plugin and theme styles from bleeding into the dashboard
21
- * Work around a bug for people without built-in JSON support
22
-
23
  Fixes are specific to your version of WordPress. It may be that your version of WordPress has no fixes. That's fine. Keep the plugin activated and updated, in case you need it for a subsequent version of WordPress!
24
 
25
  == Installation ==
@@ -35,6 +34,9 @@ Fixes are specific to your version of WordPress. It may be that your version of
35
  Read the "Complete Hotfix List" section in the description. A later version of the plugin may list the hotfixes in a special WordPress admin page.
36
 
37
  == Changelog ==
 
 
 
38
  = 0.9 =
39
  * Fix adding and updating Custom Fields.
40
 
@@ -89,6 +91,9 @@ If you're not running WordPress 3.0.5 and you're getting a "Line 19" error, this
89
  Allows you to see safe HTML in the admin.
90
 
91
  == Complete Hotfix List ==
 
 
 
92
  * **WordPress 3.4.2**
93
  * Fix adding and updating Custom Fields
94
 
2
  Contributors: markjaquith, nacin
3
  Tags: hotfix, bugs, wordpress, update
4
  Requires at least: 3.0
5
+ Tested up to: 3.5
6
+ Stable tag: 1.0
7
 
8
  Provides unofficial fixes for selected WordPress bugs, so you don't have to wait for the next WordPress core release.
9
 
13
 
14
  Recent fixes:
15
 
16
+ * **WordPress 3.5**
17
+ * Lets you update Twenty Twelve if it is shown as "broken" after installing 3.5
18
+
19
  * **WordPress 3.4.2**
20
  * Fix adding and updating Custom Fields
21
 
 
 
 
 
22
  Fixes are specific to your version of WordPress. It may be that your version of WordPress has no fixes. That's fine. Keep the plugin activated and updated, in case you need it for a subsequent version of WordPress!
23
 
24
  == Installation ==
34
  Read the "Complete Hotfix List" section in the description. A later version of the plugin may list the hotfixes in a special WordPress admin page.
35
 
36
  == Changelog ==
37
+ = 1.0 =
38
+ * Lets you update Twenty Twelve if it is shown as "broken" after installing 3.5
39
+
40
  = 0.9 =
41
  * Fix adding and updating Custom Fields.
42
 
91
  Allows you to see safe HTML in the admin.
92
 
93
  == Complete Hotfix List ==
94
+ * **WordPress 3.5**
95
+ * Lets you update Twenty Twelve if it is shown as "broken" after installing 3.5
96
+
97
  * **WordPress 3.4.2**
98
  * Fix adding and updating Custom Fields
99