Changeset 2435700 for wp-jquery-update-test
- Timestamp:
- 12/09/2020 04:07:47 PM (5 years ago)
- Location:
- wp-jquery-update-test/trunk
- Files:
-
- 2 added
- 3 deleted
- 3 edited
-
assets/jquery-1.12.4-wp.min.js (added)
-
assets/jquery-3.5.1.js (deleted)
-
assets/jquery-migrate-1.4.1.js (added)
-
assets/jquery-migrate-3.3.2.js (deleted)
-
assets/ui (deleted)
-
class_wp_jquery_update_test.php (modified) (11 diffs)
-
readme.txt (modified) (3 diffs)
-
wp-jquery-update-test.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-jquery-update-test/trunk/class_wp_jquery_update_test.php
r2431602 r2435700 12 12 13 13 private static $plugin_dir_name; 14 private static $is_supported; 15 16 private static $default_settings = array( 17 'version' => 'default', 18 'migrate' => 'default', 19 'plugin_version' => '2.0', 20 ); 21 14 22 private function __construct() {} 15 23 16 24 public static function init_actions() { 25 self::$plugin_dir_name = basename( __DIR__ ); 26 27 // Support WP version 5.6 and 5.7 alpha/beta/RC. 28 self::$is_supported = version_compare( $GLOBALS['wp_version'], '5.7', '<' ); 29 30 // Add a link to the plugin's settings in the plugins list table. 31 add_filter( 'plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 ); 32 add_filter( 'network_admin_plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 ); 33 34 add_action( 'admin_menu', array( __CLASS__, 'add_menu_item' ) ); 35 add_action( 'network_admin_menu', array( __CLASS__, 'add_menu_item' ) ); 36 37 if ( ! self::$is_supported ) { 38 return; 39 } 40 17 41 // To be able to replace the src, scripts should not be concatenated. 18 42 if ( ! defined( 'CONCATENATE_SCRIPTS' ) ) { … … 22 46 $GLOBALS['concatenate_scripts'] = false; 23 47 24 self::$plugin_dir_name = basename( __DIR__ );25 26 48 add_action( 'wp_default_scripts', array( __CLASS__, 'replace_scripts' ), -1 ); 27 28 add_action( 'admin_menu', array( __CLASS__, 'add_menu_item' ) );29 add_action( 'network_admin_menu', array( __CLASS__, 'add_menu_item' ) );30 31 // Add a link to the plugin's settings in the plugins list table.32 add_filter( 'plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 );33 add_filter( 'network_admin_plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 );34 49 35 50 add_action( 'admin_init', array( __CLASS__, 'save_settings' ) ); … … 41 56 42 57 public static function replace_scripts( $scripts ) { 58 $settings = self::parse_settings(); 59 60 if ( 'default' === $settings['version'] ) { 61 if ( 'disable' === $settings['migrate'] ) { 62 // Register jQuery without jquery-migrate.js. 63 self::set_script( $scripts, 'jquery', false, array( 'jquery-core' ), '3.5.1' ); 64 } 65 } elseif ( '1.12.4' === $settings['version'] ) { 66 $assets_url = plugins_url( 'assets/', __FILE__ ); 67 68 // Set 'jquery-core' to 1.12.4-wp. 69 self::set_script( $scripts, 'jquery-core', $assets_url . 'jquery-1.12.4-wp.min.js', array(), '1.12.4-wp' ); 70 // Set 'jquery-migrate' to 1.4.1. 71 self::set_script( $scripts, 'jquery-migrate', $assets_url . 'jquery-migrate-1.4.1.js', array(), '1,4,1' ); 72 73 $deps = array( 'jquery-core' ); 74 75 if ( 'disable' !== $settings['migrate'] ) { 76 $deps[] = 'jquery-migrate'; 77 } 78 79 self::set_script( $scripts, 'jquery', false, $deps, '1.12.4-wp' ); 80 } 81 } 82 83 private static function parse_settings() { 43 84 $settings = get_site_option( 'wp-jquery-test-settings', array() ); 44 $defaults = array( 45 'version' => 'default', 46 'migrate' => 'disable', 47 'uiversion' => 'default', 48 ); 49 50 $settings = wp_parse_args( $settings, $defaults ); 51 52 if ( 'default' === $settings['version'] ) { 53 // If Migrate is disabled 54 if ( 'disable' === $settings['migrate'] ) { 55 // Register jQuery without jquery-migrate.js. For WordPress 5.4 and 5.5-alpha. 56 self::set_script( $scripts, 'jquery', false, array( 'jquery-core' ), '1.12.4-wp' ); 57 } else { 58 // For 5.5-beta1 or newer. 59 self::set_script( $scripts, 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4-wp' ); 60 } 61 } elseif ( '3.5.1' === $settings['version'] ) { 62 $assets_url = plugins_url( 'assets/', __FILE__ ); 63 64 if ( 'disable' === $settings['migrate'] ) { 65 // Register jQuery without jquery-migrate.js 66 self::set_script( $scripts, 'jquery', false, array( 'jquery-core' ), '3.5.1' ); 67 68 // Set 'jquery-core' to 3.5.1 69 self::set_script( $scripts, 'jquery-core', $assets_url . 'jquery-3.5.1.js', array(), '3.5.1' ); 70 71 // Reset/remove 'jquery-migrate' 72 // TBD: needed? 73 self::set_script( $scripts, 'jquery-migrate', false, array() ); 74 } else { 75 self::set_script( $scripts, 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.5.1' ); 76 self::set_script( $scripts, 'jquery-core', $assets_url . 'jquery-3.5.1.js', array(), '3.5.1' ); 77 self::set_script( $scripts, 'jquery-migrate', $assets_url . 'jquery-migrate-3.3.2.js', array(), '3.3.2' ); 78 } 79 80 if ( '1.12.1' === $settings['uiversion'] ) { 81 self::jquery_ui_1121( $scripts ); 82 } 83 } 84 } 85 86 // Replace UI 1.11.4 with 1.12.1 87 private static function jquery_ui_1121( $scripts ) { 88 $assets_url = plugins_url( 'assets/ui', __FILE__ ); 89 $dev_suffix = wp_scripts_get_suffix( 'dev' ); 90 91 // The core.js in 1.12.1 only defines dependencies. 92 // Here it is concatenated using another build task in Grunt. 93 // The separate jQuery UI core parts are still present for AMD compatibility (is this needed?), 94 // but are not registered in script-loader as all of them are in ui/core.js. 95 self::set_script( $scripts, 'jquery-ui-core', "{$assets_url}/core{$dev_suffix}.js", array( 'jquery' ), '1.12.1', true ); 96 self::set_script( $scripts, 'jquery-effects-core', "{$assets_url}/effect{$dev_suffix}.js", array( 'jquery' ), '1.12.1', true ); 97 98 self::set_script( $scripts, 'jquery-effects-blind', "{$assets_url}/effect-blind{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 99 self::set_script( $scripts, 'jquery-effects-bounce', "{$assets_url}/effect-bounce{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 100 self::set_script( $scripts, 'jquery-effects-clip', "{$assets_url}/effect-clip{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 101 self::set_script( $scripts, 'jquery-effects-drop', "{$assets_url}/effect-drop{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 102 self::set_script( $scripts, 'jquery-effects-explode', "{$assets_url}/effect-explode{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 103 self::set_script( $scripts, 'jquery-effects-fade', "{$assets_url}/effect-fade{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 104 self::set_script( $scripts, 'jquery-effects-fold', "{$assets_url}/effect-fold{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 105 self::set_script( $scripts, 'jquery-effects-highlight', "{$assets_url}/effect-highlight{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 106 self::set_script( $scripts, 'jquery-effects-puff', "{$assets_url}/effect-puff{$dev_suffix}.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.12.1', true ); 107 self::set_script( $scripts, 'jquery-effects-pulsate', "{$assets_url}/effect-pulsate{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 108 self::set_script( $scripts, 'jquery-effects-scale', "{$assets_url}/effect-scale{$dev_suffix}.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.12.1', true ); 109 self::set_script( $scripts, 'jquery-effects-shake', "{$assets_url}/effect-shake{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 110 self::set_script( $scripts, 'jquery-effects-size', "{$assets_url}/effect-size{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 111 self::set_script( $scripts, 'jquery-effects-slide', "{$assets_url}/effect-slide{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 112 self::set_script( $scripts, 'jquery-effects-transfer', "{$assets_url}/effect-transfer{$dev_suffix}.js", array( 'jquery-effects-core' ), '1.12.1', true ); 113 114 self::set_script( $scripts, 'jquery-ui-accordion', "{$assets_url}/accordion{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.12.1', true ); 115 self::set_script( $scripts, 'jquery-ui-autocomplete', "{$assets_url}/autocomplete{$dev_suffix}.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.12.1', true ); 116 self::set_script( $scripts, 'jquery-ui-button', "{$assets_url}/button{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-controlgroup', 'jquery-ui-checkboxradio' ), '1.12.1', true ); 117 self::set_script( $scripts, 'jquery-ui-datepicker', "{$assets_url}/datepicker{$dev_suffix}.js", array( 'jquery-ui-core' ), '1.12.1', true ); 118 self::set_script( $scripts, 'jquery-ui-dialog', "{$assets_url}/dialog{$dev_suffix}.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.12.1', true ); 119 self::set_script( $scripts, 'jquery-ui-draggable', "{$assets_url}/draggable{$dev_suffix}.js", array( 'jquery-ui-mouse' ), '1.12.1', true ); 120 self::set_script( $scripts, 'jquery-ui-droppable', "{$assets_url}/droppable{$dev_suffix}.js", array( 'jquery-ui-draggable' ), '1.12.1', true ); 121 self::set_script( $scripts, 'jquery-ui-menu', "{$assets_url}/menu{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.12.1', true ); 122 self::set_script( $scripts, 'jquery-ui-mouse', "{$assets_url}/mouse{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.12.1', true ); 123 self::set_script( $scripts, 'jquery-ui-position', "{$assets_url}/position{$dev_suffix}.js", array( 'jquery' ), '1.12.1', true ); 124 self::set_script( $scripts, 'jquery-ui-progressbar', "{$assets_url}/progressbar{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.12.1', true ); 125 self::set_script( $scripts, 'jquery-ui-resizable', "{$assets_url}/resizable{$dev_suffix}.js", array( 'jquery-ui-mouse' ), '1.12.1', true ); 126 self::set_script( $scripts, 'jquery-ui-selectable', "{$assets_url}/selectable{$dev_suffix}.js", array( 'jquery-ui-mouse' ), '1.12.1', true ); 127 self::set_script( $scripts, 'jquery-ui-selectmenu', "{$assets_url}/selectmenu{$dev_suffix}.js", array( 'jquery-ui-menu' ), '1.12.1', true ); 128 self::set_script( $scripts, 'jquery-ui-slider', "{$assets_url}/slider{$dev_suffix}.js", array( 'jquery-ui-mouse' ), '1.12.1', true ); 129 self::set_script( $scripts, 'jquery-ui-sortable', "{$assets_url}/sortable{$dev_suffix}.js", array( 'jquery-ui-mouse' ), '1.12.1', true ); 130 self::set_script( $scripts, 'jquery-ui-spinner', "{$assets_url}/spinner{$dev_suffix}.js", array( 'jquery-ui-button' ), '1.12.1', true ); 131 self::set_script( $scripts, 'jquery-ui-tabs', "{$assets_url}/tabs{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.12.1', true ); 132 self::set_script( $scripts, 'jquery-ui-tooltip', "{$assets_url}/tooltip{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.12.1', true ); 133 self::set_script( $scripts, 'jquery-ui-widget', "{$assets_url}/widget{$dev_suffix}.js", array( 'jquery' ), '1.12.1', true ); 134 135 // New in 1.12.1 136 self::set_script( $scripts, 'jquery-ui-checkboxradio', "{$assets_url}/checkboxradio{$dev_suffix}.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.12.1', true ); 137 self::set_script( $scripts, 'jquery-ui-controlgroup', "{$assets_url}/controlgroup{$dev_suffix}.js", array( 'jquery-ui-widget' ), '1.12.1', true ); 85 86 // Reset the settings for v2.0. 87 if ( empty( $settings['plugin_version'] ) ) { 88 $settings = array(); 89 } 90 91 return wp_parse_args( $settings, self::$default_settings ); 138 92 } 139 93 … … 170 124 171 125 if ( 172 ! current_user_can( ' install_plugins' ) ||126 ! current_user_can( 'manage_options' ) || 173 127 ! wp_verify_nonce( $_POST['wp-jquery-test-save'], 'wp-jquery-test-settings' ) 174 128 ) { … … 183 137 'enable', 184 138 'disable', 185 '3.5.1', 186 '1.12.1', 139 '1.12.4', 187 140 ); 188 141 … … 190 143 'version', 191 144 'migrate', 192 'uiversion',193 145 ); 194 146 … … 203 155 } 204 156 157 $settings['plugin_version'] = '2.0'; 158 205 159 update_site_option( 'wp-jquery-test-settings', $settings ); 206 160 … … 212 166 // Plugin UI 213 167 public static function settings_ui() { 214 $settings = get_site_option( 'wp-jquery-test-settings', array() ); 215 $defaults = array( 216 'version' => 'default', 217 'migrate' => 'disable', 218 'uiversion' => 'default', 219 ); 220 221 $settings = wp_parse_args( $settings, $defaults ); 168 $settings = self::parse_settings(); 222 169 223 170 ?> … … 226 173 <h1><?php _e( 'Test jQuery Updates', 'wp-jquery-update-test' ); ?></h1> 227 174 228 <?php if ( isset( $_GET['jqtest-settings-saved'] ) ) { ?> 229 <div class="notice notice-success is-dismissible"> 230 <p><strong><?php _e( 'Settings saved.', 'wp-jquery-update-test' ); ?></strong></p> 231 </div> 232 <?php } ?> 233 234 <p> 235 <?php _e( 'This plugin is intended for testing of different versions of jQuery and jQuery UI before updating them in WordPress.', 'wp-jquery-update-test' ); ?> 236 <?php _e( 'It is not intended for use in production.', 'wp-jquery-update-test' ); ?> 237 </p> 238 239 <p> 240 <?php _e( 'It includes jQuery 3.5.1, jQuery Migrate 3.3.2, and jQuery UI 1.12.1.', 'wp-jquery-update-test' ); ?> 241 <?php _e( 'jQuery UI has been re-built for full backwards compatibility with WordPress.', 'wp-jquery-update-test' ); ?> 242 </p> 243 244 <p> 245 <?php _e( 'To test:', 'wp-jquery-update-test' ); ?> 246 </p> 247 248 <ol> 249 <li> 250 <?php _e( 'Use the current version of jQuery in WordPress but disable jQuery Migrate.', 'wp-jquery-update-test' ); ?> 251 <?php _e( 'This is planned for WordPress 5.5 and is the default setting.', 'wp-jquery-update-test' ); ?> 252 </li> 253 <li> 254 <?php _e( 'Latest jQuery with the latest jQuery Migrate.', 'wp-jquery-update-test' ); ?> 255 <?php _e( 'More information:', 'wp-jquery-update-test' ); ?> 175 <?php if ( ! self::$is_supported ) { ?> 176 <div class="notice notice-error"> 177 <p><strong><?php _e( 'WordPress version not supported.', 'wp-jquery-update-test' ); ?></strong></p> 178 </div> 179 <p> 180 <?php _e( 'This plugin is intended for testing of jQuery and jQuery Migrate in WordPress 5.6.', 'wp-jquery-update-test' ); ?> 181 <?php 182 183 printf( 184 __( 'However your WordPress version appears to be %s.', 'wp-jquery-update-test' ), 185 esc_html( $GLOBALS['wp_version'] ) 186 ); 187 188 ?> 189 </p> 190 <p> 191 <?php _e( 'For testing in WordPress 5.5 or earlier please install version 1.0.2 of the plugin.', 'wp-jquery-update-test' ); ?> 192 <?php _e( 'WordPress version 5.7 and newer are not supported yet.', 'wp-jquery-update-test' ); ?> 193 </p> 194 <?php } else { ?> 195 196 <?php if ( isset( $_GET['jqtest-settings-saved'] ) ) { ?> 197 <div class="notice notice-success is-dismissible"> 198 <p><strong><?php _e( 'Settings saved.', 'wp-jquery-update-test' ); ?></strong></p> 199 </div> 200 <?php } ?> 201 202 <p> 203 <?php _e( 'This plugin is intended for testing of jQuery and jQuery Migrate in WordPress 5.6.', 'wp-jquery-update-test' ); ?> 204 <strong><?php _e( 'It is not intended for use in production.', 'wp-jquery-update-test' ); ?></strong> 205 <?php 206 207 printf( 208 __( 'If you have installed Test jQuery Updates on a live website, please uninstall it and use <a href="%s">Enable jQuery Migrate Helper</a> instead.', 'wp-jquery-update-test' ), 209 esc_url( 'https://wordpress.org/plugins/enable-jquery-migrate-helper/' ) 210 ); 211 212 ?> 213 </p> 214 215 <p> 256 216 <?php 257 217 printf( 258 __( ' <a href="%s">jQuery Core 3.0 Upgrade Guide</a>,', 'wp-jquery-update-test' ),259 'https:// jquery.com/upgrade-guide/3.0/'218 __( 'If you find a jQuery related bug <a href="%s">please report it</a>.', 'wp-jquery-update-test' ), 219 'https://github.com/WordPress/wp-jquery-update-test' 260 220 ); 261 221 ?> 262 222 <?php 263 223 printf( 264 __( ' <a href="%s">jQuery Core 3.5 Upgrade Guide</a>.', 'wp-jquery-update-test' ),265 'https:// jquery.com/upgrade-guide/3.5/'224 __( 'If the bug is in a jQuery plugin please also check if there is <a href="%s">a new version on NPM</a>.', 'wp-jquery-update-test' ), 225 'https://www.npmjs.com/search?q=keywords:jquery-plugin' 266 226 ); 267 227 ?> 268 </li> 269 <li> 270 <?php _e( 'Latest jQuery with latest jQuery Migrate and latest jQuery UI.', 'wp-jquery-update-test' ); ?> 271 <?php _e( 'This is tentatively planned for WordPress 5.6 depending on test results.', 'wp-jquery-update-test' ); ?> 272 </li> 273 <li> 274 <?php _e( 'Latest jQuery (without jQuery Migrate), and latest jQuery UI.', 'wp-jquery-update-test' ); ?> 275 <?php _e( 'This is tentatively planned for WordPress 5.7 or later depending on test results.', 'wp-jquery-update-test' ); ?> 276 </li> 277 </ol> 278 279 <p> 280 <?php 281 printf( 282 __( 'If you find a jQuery related bug <a href="%s">please report it</a>.', 'wp-jquery-update-test' ), 283 'https://github.com/WordPress/wp-jquery-update-test' 284 ); 285 ?> 286 <?php 287 printf( 288 __( 'If the bug is in a jQuery plugin please also check if there is <a href="%s">a new version on NPM</a>.', 'wp-jquery-update-test' ), 289 'https://www.npmjs.com/search?q=keywords:jquery-plugin' 290 ); 291 ?> 292 <?php _e( 'When reporting an issue please include the versions of jQuery, jQuery Migrate, and jQuery UI.', 'wp-jquery-update-test' ); ?> 293 <?php _e( 'This plugin outputs these versions in the browser console.', 'wp-jquery-update-test' ); ?> 294 </p> 295 296 <form method="post"> 297 <?php wp_nonce_field( 'wp-jquery-test-settings', 'wp-jquery-test-save' ); ?> 298 <table class="form-table"> 299 <tr class="classic-editor-user-options"> 300 <th scope="row"><?php _e( 'jQuery version', 'wp-jquery-update-test' ); ?></th> 301 <td> 302 <p> 303 <input type="radio" name="jquery-test-version" id="version-default" value="default" 304 <?php checked( $settings['version'] === 'default' ); ?> 305 /> 306 <label for="version-default"><?php _e( 'Default', 'wp-jquery-update-test' ); ?></label> 307 </p> 308 <p> 309 <input type="radio" name="jquery-test-version" id="version-351" value="3.5.1" 310 <?php checked( $settings['version'] === '3.5.1' ); ?> 311 /> 312 <label for="version-351">3.5.1</label> 313 </p> 314 </td> 315 </tr> 316 317 <tr> 318 <th scope="row"><?php _e( 'jQuery Migrate', 'wp-jquery-update-test' ); ?></th> 319 <td> 320 <p> 321 <input type="radio" name="jquery-test-migrate" id="migrate-enable" value="enable" 322 <?php checked( $settings['migrate'] === 'enable' ); ?> 323 /> 324 <label for="migrate-enable"><?php _e( 'Enable', 'wp-jquery-update-test' ); ?></label> 325 </p> 326 <p> 327 <input type="radio" name="jquery-test-migrate" id="migrate-disable" value="disable" 328 <?php checked( $settings['migrate'] === 'disable' ); ?> 329 /> 330 <label for="migrate-disable"><?php _e( 'Disable', 'wp-jquery-update-test' ); ?></label> 331 </p> 332 </td> 333 </tr> 334 335 <tr class="classic-editor-user-options"> 336 <th scope="row"><?php _e( 'jQuery UI version', 'wp-jquery-update-test' ); ?></th> 337 <td> 338 <p> 339 <input type="radio" name="jquery-test-uiversion" id="uiversion-default" value="default" 340 <?php checked( $settings['uiversion'] === 'default' ); ?> 341 /> 342 <label for="uiversion-default"><?php _e( 'Default', 'wp-jquery-update-test' ); ?></label> 343 </p> 344 <p> 345 <input type="radio" name="jquery-test-uiversion" id="uiversion-1121" value="1.12.1" 346 <?php checked( $settings['uiversion'] === '1.12.1' ); ?> 347 /> 348 <label for="uiversion-1121">1.12.1</label> 349 </p> 350 </td> 351 </tr> 352 </table> 353 <?php submit_button(); ?> 354 </form> 355 </div> 356 <?php 228 <?php _e( 'When reporting an issue please include the versions of jQuery, jQuery Migrate, and jQuery UI.', 'wp-jquery-update-test' ); ?> 229 <?php _e( 'This plugin outputs these versions in the browser console.', 'wp-jquery-update-test' ); ?> 230 </p> 231 232 <form method="post"> 233 <?php wp_nonce_field( 'wp-jquery-test-settings', 'wp-jquery-test-save' ); ?> 234 <table class="form-table"> 235 <tr class="classic-editor-user-options"> 236 <th scope="row"><?php _e( 'jQuery version', 'wp-jquery-update-test' ); ?></th> 237 <td> 238 <p> 239 <input type="radio" name="jquery-test-version" id="version-default" value="default" 240 <?php checked( $settings['version'] === 'default' ); ?> 241 /> 242 <label for="version-default"><?php _e( 'Default', 'wp-jquery-update-test' ); ?></label> 243 </p> 244 <p> 245 <input type="radio" name="jquery-test-version" id="version-1.12.4" value="1.12.4" 246 <?php checked( $settings['version'] === '1.12.4' ); ?> 247 /> 248 <label for="version-1.12.4">1.12.4</label> 249 </p> 250 </td> 251 </tr> 252 253 <tr> 254 <th scope="row"><?php _e( 'jQuery Migrate', 'wp-jquery-update-test' ); ?></th> 255 <td> 256 <p> 257 <input type="radio" name="jquery-test-migrate" id="migrate-enable" value="enable" 258 <?php checked( $settings['migrate'] === 'enable' || $settings['migrate'] === 'default' ); ?> 259 /> 260 <label for="migrate-enable"><?php _e( 'Enable', 'wp-jquery-update-test' ); ?></label> 261 </p> 262 <p> 263 <input type="radio" name="jquery-test-migrate" id="migrate-disable" value="disable" 264 <?php checked( $settings['migrate'] === 'disable' ); ?> 265 /> 266 <label for="migrate-disable"><?php _e( 'Disable', 'wp-jquery-update-test' ); ?></label> 267 </p> 268 </td> 269 </tr> 270 </table> 271 <?php submit_button(); ?> 272 </form> 273 </div> 274 <?php } 357 275 } 358 276 359 277 public static function add_menu_item() { 360 278 $menu_title = __( 'Test jQuery Updates', 'wp-jquery-update-test' ); 361 add_plugins_page( $menu_title, $menu_title, ' install_plugins', self::$plugin_dir_name, array( __CLASS__, 'settings_ui' ) );279 add_plugins_page( $menu_title, $menu_title, 'manage_options', self::$plugin_dir_name, array( __CLASS__, 'settings_ui' ) ); 362 280 } 363 281 … … 365 283 $plugin_basename = self::$plugin_dir_name . '/wp-jquery-update-test.php'; 366 284 367 if ( $file === $plugin_basename && current_user_can( ' install_plugins' ) ) {285 if ( $file === $plugin_basename && current_user_can( 'manage_options' ) ) { 368 286 // Prevent PHP warnings when a plugin uses this filter incorrectly. 369 $links = (array) $links; 370 $url = self_admin_url( 'plugins.php?page=' . self::$plugin_dir_name ); 371 $links[] = sprintf( '<a href="%s">%s</a>', $url, __( 'Settings', 'wp-jquery-update-test' ) ); 287 $links = (array) $links; 288 289 if ( ! self::$is_supported ) { 290 $text = __( 'WordPress version not supported.', 'wp-jquery-update-test' ); 291 $links['wp-jquery-update-test button-link-delete'] = $text; 292 } else { 293 $url = self_admin_url( 'plugins.php?page=' . self::$plugin_dir_name ); 294 $text = sprintf( '<a href="%s">%s</a>', $url, __( 'Settings', 'wp-jquery-update-test' ) ); 295 $links['wp-jquery-update-test'] = $text; 296 } 372 297 } 373 298 … … 381 306 register_uninstall_hook( __FILE__, array( __CLASS__, 'uninstall' ) ); 382 307 383 $defaults = array( 384 'version' => 'default', 385 'migrate' => 'disable', 386 'uiversion' => 'default', 387 ); 388 389 add_site_option( 'wp-jquery-test-settings', $defaults ); 308 add_site_option( 'wp-jquery-test-settings', self::$default_settings ); 390 309 } 391 310 -
wp-jquery-update-test/trunk/readme.txt
r2431602 r2435700 2 2 Contributors: wordpressdotorg, azaozz 3 3 Tags: jquery 4 Requires at least: 5. 45 Tested up to: 5. 56 Stable tag: 1.0.24 Requires at least: 5.6 5 Tested up to: 5.6 6 Stable tag: 2.0.0 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 13 13 == Description == 14 14 15 Test jQuery Updates is an official plugin by the WordPress team that is intended for testing of different versions ofjQuery and jQuery UI before updating them in WordPress. It is not intended for use in production.15 Test jQuery Updates is an official plugin by the WordPress team that is intended for testing of jQuery and jQuery UI before updating them in WordPress. It is not intended for use in production. 16 16 17 It includes jQuery 3.5.1, jQuery Migrate 3.3.2, and jQuery UI 1.12.1. jQuery UI has been re-built for full backwards compatibility with WordPress. 18 19 To test: 20 21 1. Use the current version of jQuery in WordPress but disable jQuery Migrate. 22 2. Latest jQuery, currently 3.5.1, with the latest jQuery Migrate. 23 3. Latest jQuery with the latest jQuery Migrate and latest jQuery UI. 24 4. As above without jQuery Migrate. 17 Version 2.0 of the plugin is intended for testing in WordPress 5.6. It can disable jQuery Migrate in preparation for removing it in the future. 25 18 26 19 If you find a bug in a jQuery related script [please report it](https://github.com/WordPress/wp-jquery-update-test). Instructions are available at the plugin's settings page. … … 28 21 = Default settings = 29 22 30 When activated this plugin will not replace the current jQuery but will disable jQuery Migrate. For more information about jQuery Migrate please visit: [https://github.com/jquery/jquery-migrate/](https://github.com/jquery/jquery-migrate/).23 When activated this plugin will not disable jQuery Migrate. When testing it can be disabled from the plugin settings screen. For more information about jQuery Migrate please visit: [https://github.com/jquery/jquery-migrate/](https://github.com/jquery/jquery-migrate/). 31 24 32 25 == Changelog == 33 26 27 = 2.0 = 28 * Update for use in WordPress 5.6. 29 * Remove testing of different versions of jQuery UI. 30 * Change the default for jQuery Migrate to "enabled". 31 34 32 = 1.0.2 = 35 33 * Update jQuery Migrate to 3.3.2. 36 * Use the non-minified, debug versions of jQuery 3.5.1 and jQuery Migrate to3.3.2.34 * Use the non-minified, debug versions of jQuery 3.5.1 and jQuery Migrate 3.3.2. 37 35 38 36 = 1.0.1 = -
wp-jquery-update-test/trunk/wp-jquery-update-test.php
r2431602 r2435700 3 3 * Plugin Name: Test jQuery Updates 4 4 * Plugin URI: https://wordpress.org/plugins/wp-jquery-update-test 5 * Description: A feature plugin to help with testing updates of the jQuery and jQuery UI JavaScript libraries(not intended for use in production).6 * Version: 1.0.27 * Requires at least: 5. 48 * Tested up to: 5. 55 * Description: A feature plugin to help with testing updates of the jQuery JavaScript library (not intended for use in production). 6 * Version: 2.0.0 7 * Requires at least: 5.6-alpha 8 * Tested up to: 5.6 9 9 * Requires PHP: 5.6 10 10 * Author: The WordPress Team … … 21 21 } 22 22 23 // Only for WP 5. 5.x or lower (for now)24 if ( version_compare( $GLOBALS['wp_version'], '5.6-alpha', ' <' ) ) {23 // Only for WP 5.6.x 24 if ( version_compare( $GLOBALS['wp_version'], '5.6-alpha', '>' ) ) { 25 25 include_once __DIR__ . '/class_wp_jquery_update_test.php'; 26 26 }
Note: See TracChangeset
for help on using the changeset viewer.