Changeset 2263
- Timestamp:
- 01/10/2016 12:18:50 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-js-warnings/wporg-gp-js-warnings.php
r2123 r2263 14 14 * - Translate the warning strings 15 15 * - Match warning error strings between GlotPress & this plugin? 16 *17 * @author dd3218 16 */ 19 17 class WPorg_GP_JS_Translation_Warnings { 20 18 21 19 function __construct() { 22 add_action( 'wp_ print_scripts', array( $this, 'replace_editor_with_our_own' ), 100);20 add_action( 'wp_default_scripts', array( $this, 'replace_editor_with_our_own' ), 11 ); 23 21 } 24 22 … … 27 25 * 28 26 * This allows us to be output whenever `gp-editor` is. 27 * 28 * @param WP_Scripts $scripts WP_Scripts object. 29 29 */ 30 function replace_editor_with_our_own( ) {31 $query = wp_scripts()->query( 'gp-editor', 'registered' );30 function replace_editor_with_our_own( $scripts ) { 31 $query = $scripts->query( 'gp-editor', 'registered' ); 32 32 if ( ! $query ) { 33 33 return; 34 34 } 35 35 36 wp_register_script( 'wporg-gp-editor', $query->src, $query->deps, $query->ver );36 $scripts->add( 'wporg-gp-editor', $query->src, $query->deps, $query->ver ); 37 37 if ( isset( $query->extra['l10n'] ) ) { 38 wp_localize_script( 'wporg-gp-editor', $query->extra['l10n'][0], $query->extra['l10n'][1] );38 $scripts->localize( 'wporg-gp-editor', $query->extra['l10n'][0], $query->extra['l10n'][1] ); 39 39 } 40 40 41 wp_deregister_script( 'gp-editor' );42 wp_register_script( 'gp-editor', plugins_url( '/wporg-gp-js-warnings.js', __FILE__ ), array( 'wporg-gp-editor', 'jquery' ), '2015-11-14' );41 $scripts->remove( 'gp-editor' ); 42 $scripts->add( 'gp-editor', plugins_url( '/wporg-gp-js-warnings.js', __FILE__ ), array( 'wporg-gp-editor', 'jquery' ), '2015-11-14' ); 43 43 } 44 44
Note: See TracChangeset
for help on using the changeset viewer.