Advertisement
kimparsell

WordPress Beta Tester 0.97 fix

Aug 14th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.41 KB | None | 0 0
  1. Index: trunk/wp-beta-tester.php
  2. ===================================================================
  3. --- trunk/wp-beta-tester.php (revision 756094)
  4. +++ trunk/wp-beta-tester.php (working copy)
  5. @@ -8,7 +8,7 @@
  6. Author URI: http://blog.ftwr.co.uk/
  7. License: GPL v2 or later
  8. */
  9. -/* Copyright 2009-2011 Peter Westwood (email : peter.westwood@ftwr.co.uk)
  10. +/* Copyright 2009-2013 Peter Westwood (email : peter.westwood@ftwr.co.uk)
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License, version 2, as
  14. @@ -26,7 +26,7 @@
  15. class wp_beta_tester {
  16. var $real_wp_version;
  17. var $real_wpmu_version = false;
  18. -
  19. +
  20. function wp_beta_tester() {
  21. add_action('admin_init', array(&$this, 'action_admin_init'));
  22. add_action('admin_menu', array(&$this, 'action_admin_menu'));
  23. @@ -36,7 +36,7 @@
  24. add_action('admin_head-plugins.php', array(&$this, 'action_admin_head_plugins_php'));
  25. add_action('admin_head-update-core.php', array(&$this, 'action_admin_head_plugins_php'));
  26. }
  27. -
  28. +
  29. function action_admin_head_plugins_php() {
  30. // Workaround the check throttling in wp_version_check()
  31. $st = get_site_transient( 'update_core' );
  32. @@ -48,28 +48,28 @@
  33. //Can output an error here if current config drives version backwards
  34. if ( $this->check_if_settings_downgrade() ) {
  35. ?>
  36. - <div id="message" class="error"><p><?php printf( __('<strong>Error:</strong> Your current <a href="%1$s">WordPress Beta Tester plugin configuration</a> will downgrade your install to a previous version - Please reconfigure it.', 'wp-beta-tester'), admin_url('tools.php?page=wp_beta_tester') ) ?></p></div>
  37. + <div id="message" class="error"><p><?php printf( __('<strong>Error:</strong> Your current <a href="%1$s">WordPress Beta Tester plugin configuration</a> will downgrade your install to a previous version - please reconfigure it.', 'wp-beta-tester'), admin_url('tools.php?page=wp_beta_tester') ) ?></p></div>
  38. <?php
  39. }
  40. }
  41. -
  42. +
  43. function action_admin_init() {
  44. register_setting( 'wp_beta_tester_options', 'wp_beta_tester_stream', array(&$this,'validate_setting') );
  45. }
  46. -
  47. +
  48. function action_admin_menu() {
  49. add_management_page(__('Beta Testing WordPress','wp-beta-tester'), __('Beta Testing','wp-beta-tester'), 'update_plugins', 'wp_beta_tester', array(&$this,'display_page'));
  50. }
  51. -
  52. +
  53. function action_init() {
  54. // Load our textdomain
  55. load_plugin_textdomain('wp-beta-tester', false , basename(dirname(__FILE__)).'/languages');
  56. }
  57. -
  58. +
  59. function filter_http_request($result, $args, $url) {
  60. if ( $result || isset($args['_beta_tester']) )
  61. return $result;
  62. - if ( 0 !== strpos($url, 'http://api.wordpress.org/') )
  63. + if ( 0 !== strpos($url, 'http://api.wordpress.org/core/version-check/') )
  64. return $result;
  65.  
  66. // It's a core-update request.
  67. @@ -81,7 +81,7 @@
  68. $url = str_replace('version=' . $wp_version, 'version=' . $this->mangle_wp_version(), $url);
  69. if ( !empty($wpmu_version) ) // old 2.9.2 WPMU
  70. $url = str_replace('wpmu_version=' . $wpmu_version, 'wpmu_version=' . $this->mangle_wp_version(), $url);
  71. -
  72. +
  73. return wp_remote_get($url, $args);
  74. } elseif ( 0 !== strpos( $url, 'https://api.wordpress.org/plugins/' ) ) {
  75. return wp_remote_post($url, $args);
  76. @@ -91,12 +91,12 @@
  77.  
  78. return $result;
  79. }
  80. -
  81. +
  82. function action_update_option_wp_beta_tester_stream() {
  83. //Our option has changed so update the cached information pronto.
  84. do_action('wp_version_check');
  85. }
  86. -
  87. +
  88. function _get_preferred_from_update_core() {
  89. if (!function_exists('get_preferred_from_update_core') )
  90. require_once(ABSPATH . 'wp-admin/includes/update.php');
  91. @@ -109,7 +109,7 @@
  92. }
  93. return $preferred;
  94. }
  95. -
  96. +
  97. function mangle_wp_version(){
  98. $stream = get_option('wp_beta_tester_stream','point');
  99. $preferred = $this->_get_preferred_from_update_core();
  100. @@ -137,7 +137,7 @@
  101. }
  102. return $wp_version;
  103. }
  104. -
  105. +
  106. function check_if_settings_downgrade() {
  107. global $wp_version;
  108. $wp_real_version = explode('-', $wp_version);
  109. @@ -144,7 +144,7 @@
  110. $wp_mangled_version = explode('-', $this->mangle_wp_version());
  111. return version_compare($wp_mangled_version[0], $wp_real_version[0], 'lt');
  112. }
  113. -
  114. +
  115. function validate_setting($setting) {
  116. if (!in_array($setting, array('point','unstable')))
  117. {
  118. @@ -164,23 +164,23 @@
  119. <div class="wrap"><?php screen_icon(); ?>
  120. <h2><?php _e('Beta Testing WordPress','wp-beta-tester')?></h2>
  121. <div class="updated fade">
  122. - <p><?php _e('<strong>Please note:</strong> Once you have switched your blog to one of these beta versions of software it will not always be possible to downgrade as the database structure maybe updated during the development of a major release.', 'wp-beta-tester'); ?></p>
  123. + <p><?php _e('<strong>Please note:</strong> Once you have switched your blog to one of these beta versions of software, it will not always be possible to downgrade, as the database structure may be updated during the development of a major release.', 'wp-beta-tester'); ?></p>
  124. </div>
  125. <?php if ('development' != $preferred->response) : ?>
  126. <div class="updated fade">
  127. - <p><?php _e('<strong>Please note:</strong> There are no development builds of the beta stream you have choosen available so you will receieve normal update notifications.', 'wp-beta-tester'); ?></p>
  128. + <p><?php _e('<strong>Please note:</strong> There are no development builds of the beta stream you have choosen available, so you will receive normal update notifications.', 'wp-beta-tester'); ?></p>
  129. </div>
  130. <?php endif;?>
  131. <?php $this->action_admin_head_plugins_php(); //Check configuration?>
  132. <div>
  133. - <p><?php echo sprintf(__( 'By their nature these releases are unstable and should not be used anyplace where your data is important. So please <a href="%1$s">backup your database</a> before upgrading to a test release. In order to hear about the latest beta releases your best bet is to watch the <a href="%2$s">development blog</a> and the <a href="%3$s">beta forum</a>','wp-beta-tester'),
  134. + <p><?php echo sprintf(__( 'By their nature, these releases are unstable and should not be used anyplace where your data is important. So please <a href="%1$s">back up your database</a> before upgrading to a test release. In order to hear about the latest beta releases, your best bet is to watch the <a href="%2$s">development blog</a> and the <a href="%3$s">beta forum</a>.','wp-beta-tester'),
  135. _x('http://codex.wordpress.org/Backing_Up_Your_Database', 'Url to database backup instructions', 'wp-beta-tester'),
  136. - _x('http://wordpress.org/development/', 'Url to development blog','wp-beta-tester'),
  137. + _x('http://make.wordpress.org/core/', 'Url to development blog','wp-beta-tester'),
  138. _x('http://wordpress.org/support/forum/12', 'Url to beta support forum', 'wp-beta-tester') ); ?></p>
  139. - <p><?php echo sprintf(__( 'Thank you for helping in testing WordPress please <a href="%s">report any bugs you find</a>.', 'wp-beta-tester'),
  140. - _x('http://core.trac.wordpress.org/newticket', 'Url to raise a new trac ticket', 'wp-beta-tester') ); ?></p>
  141. -
  142. - <p><?php _e('By default your WordPress install uses the stable update stream, to return to this please deactivate this plugin', 'wp-beta-tester'); ?></p>
  143. + <p><?php echo sprintf(__( 'Thank you for helping by testing WordPress. Please <a href="%s">report any bugs you find</a>.', 'wp-beta-tester'),
  144. + _x('http://core.trac.wordpress.org/newticket', 'Url to create a new trac ticket', 'wp-beta-tester') ); ?></p>
  145. +
  146. + <p><?php _e('By default, your WordPress install uses the stable update stream. To return to this, please deactivate this plugin.', 'wp-beta-tester'); ?></p>
  147. <form method="post" action="options.php"><?php settings_fields('wp_beta_tester_options'); ?>
  148. <fieldset><legend><?php _e('Please select the update stream you would like this blog to use:','wp-beta-tester')?></legend>
  149. <?php
  150. @@ -191,7 +191,7 @@
  151. <th><label><input name="wp_beta_tester_stream"
  152. id="update-stream-point-nightlies" type="radio" value="point"
  153. class="tog" <?php checked('point', $stream); ?> /><?php _e('Point release nightlies','wp-beta-tester');?></label></th>
  154. - <td><?php _e('This contains the work that is occuring on a branch in preperation for a x.x.x point release. This should also be fairly stable but will be available before the branch is ready for beta.','wp-beta-tester'); ?></td>
  155. + <td><?php _e('This contains the work that is occurring on a branch in preparation for a x.x.x point release. This should also be fairly stable but will be available before the branch is ready for beta.','wp-beta-tester'); ?></td>
  156. </tr>
  157. <tr>
  158. <th><label><input name="wp_beta_tester_stream"
  159. @@ -204,7 +204,7 @@
  160. <p class="submit"><input type="submit" class="button-primary"
  161. value="<?php _e('Save Changes') ?>" /></p>
  162. </form>
  163. - <p><?php echo sprintf(__( 'Why don\'t you <a href="%s">head on over and upgrade now</a>.','wp-beta-tester' ), 'update-core.php'); ?></p>
  164. + <p><?php echo sprintf(__( 'Why don\'t you <a href="%s">head on over and upgrade now</a>.','wp-beta-tester' ), 'update-core.php'); ?></p>
  165. </div>
  166. </div>
  167. <?php
  168. @@ -219,4 +219,4 @@
  169. }
  170. register_activation_hook( __FILE__, 'wordpress_beta_tester_deactivate_or_activate' );
  171. register_deactivation_hook( __FILE__, 'wordpress_beta_tester_deactivate_or_activate' );
  172. -?>
  173. +?>
  174. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement