Plugin Directory

Changeset 695650


Ignore:
Timestamp:
04/11/2013 03:31:04 AM (13 years ago)
Author:
zslabs
Message:

Updated to 0.5

Location:
wp-jquery-plus/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-jquery-plus/trunk/readme.txt

    r680232 r695650  
    33Tags: jquery,google
    44Requires at least: 3.5
    5 Tested up to: 3.5.1
    6 Stable tag: 0.4.2
     5Tested up to: 3.6-beta1
     6Stable tag: 0.5
    77License: GPLv2
    88
     
    2828== Changelog ==
    2929
     30= 0.5 =
     31* Added 3.6 check (since the jQuery handle was changed) and updated accordingly to work in both 3.5 and 3.6.
     32
    3033= 0.4.2 =
    3134* Source credits given for local fallback
  • wp-jquery-plus/trunk/wp-jquery-plus.php

    r680232 r695650  
    66Author: Zach Schnackel
    77Author URI: http://zslabs.com
    8 Version: 0.4.2
     8Version: 0.5
    99*/
    1010
     
    3737function wpjp_set_src() {
    3838
     39    global $wp_version;
     40
    3941    if ( !is_admin() ) {
    4042
    41         // Get current version of jQuery from WordPress core
    42         $wp_jquery_ver = $GLOBALS['wp_scripts']->registered['jquery']->ver;
     43        // Check to see if we're on 3.6 or newer (changed the jQuery handle)
     44        if ( version_compare( $wp_version, '3.6-alpha1', '>=' ) ) {
    4345
    44         // Set jQuery Google URL
    45         $jquery_google_url = '//ajax.googleapis.com/ajax/libs/jquery/'.$wp_jquery_ver.'/jquery.min.js';
     46            // Get current version of jQuery from WordPress core
     47            $wp_jquery_ver = $GLOBALS['wp_scripts']->registered['jquery-core']->ver;
    4648
    47         // De-register jQuery
    48         wp_deregister_script( 'jquery' );
     49            // Set jQuery Google URL
     50            $jquery_google_url = '//ajax.googleapis.com/ajax/libs/jquery/'.$wp_jquery_ver.'/jquery.min.js';
    4951
    50         // Register jQuery with Google URL
    51         wp_register_script( 'jquery', $jquery_google_url, '', null, false );
     52            // De-register jQuery
     53            wp_deregister_script( 'jquery-core' );
     54
     55            // Register jQuery with Google URL
     56            wp_register_script( 'jquery-core', $jquery_google_url, '', null, false );
     57
     58        }
     59        // Theeen we're on 3.5 (since the plugin will deactivate if any lower)
     60        else {
     61
     62            // Get current version of jQuery from WordPress core
     63            $wp_jquery_ver = $GLOBALS['wp_scripts']->registered['jquery']->ver;
     64
     65            // Set jQuery Google URL
     66            $jquery_google_url = '//ajax.googleapis.com/ajax/libs/jquery/'.$wp_jquery_ver.'/jquery.min.js';
     67
     68            // De-register jQuery
     69            wp_deregister_script( 'jquery' );
     70
     71            // Register jQuery with Google URL
     72            wp_register_script( 'jquery', $jquery_google_url, '', null, false );
     73
     74        }
    5275
    5376    }
     
    6588function wpjp_local_fallback( $src, $handle ) {
    6689
     90    global $wp_version;
     91
    6792    if ( !is_admin() ) {
    6893
     
    7499        }
    75100
    76         if ( $handle === 'jquery' ) {
    77             $add_jquery_fallback = true;
     101        // Check to see what version we're using (so we can use the appropriate handle)
     102        if ( version_compare( $wp_version, '3.6-alpha1', '>=' ) ) {
     103
     104            if ( $handle === 'jquery-core' ) {
     105                $add_jquery_fallback = true;
     106            }
     107
    78108        }
     109        else {
     110
     111            if ( $handle === 'jquery' ) {
     112                $add_jquery_fallback = true;
     113            }
     114        }
     115
    79116
    80117        return $src;
Note: See TracChangeset for help on using the changeset viewer.