WordPress.org

Plugin Directory

Changeset 621541


Ignore:
Timestamp:
11/06/12 03:48:24 (18 months ago)
Author:
mdawaffe
Message:

Gravatar Hovercards: Don't manually call wp_print_script()

Use the correct hooks and wp_enqueue_script() calls to print the Hovercard scripts in the footer instead of manually doing wp_print_scripts() in the footer.

Props ericmann

Fixes #1600

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/gravatar-hovercards.php

    r585120 r621541  
    1010 
    1111function grofiles_hovercards_init() { 
    12     add_filter( 'get_avatar', 'grofiles_get_avatar', 10, 2 ); 
    13     add_action( 'wp_footer',  'grofiles_attach_cards' ); 
    14     add_action( 'wp_footer',  'grofiles_extra_data' ); 
    15     add_action( 'admin_init', 'grofiles_add_settings' ); 
     12    add_filter( 'get_avatar',          'grofiles_get_avatar', 10, 2 ); 
     13    add_action( 'wp_enqueue_scripts',  'grofiles_attach_cards' ); 
     14    add_action( 'wp_footer',           'grofiles_extra_data' ); 
     15    add_action( 'admin_init',          'grofiles_add_settings' ); 
    1616     
    1717    add_action( 'load-index.php',              'grofiles_admin_cards' ); 
     
    172172        return; 
    173173 
    174     wp_enqueue_script( 'grofiles-cards', ( is_ssl() ? 'https://secure' : 'http://s' ) . '.gravatar.com/js/gprofiles.js', array( 'jquery' ), GROFILES__CACHE_BUSTER ); 
    175     wp_enqueue_script( 'wpgroho', plugins_url( 'wpgroho.js', __FILE__ ), array( 'grofiles-cards' ) ); 
     174    wp_enqueue_script( 'grofiles-cards', ( is_ssl() ? 'https://secure' : 'http://s' ) . '.gravatar.com/js/gprofiles.js', array( 'jquery' ), GROFILES__CACHE_BUSTER, true ); 
     175    wp_enqueue_script( 'wpgroho', plugins_url( 'wpgroho.js', __FILE__ ), array( 'grofiles-cards' ), false, true ); 
    176176    if ( is_user_logged_in() ) { 
    177177        $cu = wp_get_current_user(); 
     
    183183    } 
    184184    wp_localize_script( 'wpgroho', 'WPGroHo', compact( 'my_hash' ) ); 
    185     wp_print_scripts( 'wpgroho' ); 
    186185} 
    187186 
Note: See TracChangeset for help on using the changeset viewer.