Changeset 8453 for trunk/src/bp-core/bp-core-cssjs.php
- Timestamp:
- 05/27/2014 05:10:54 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-cssjs.php
r8091 r8453 9 9 // Exit if accessed directly 10 10 if ( !defined( 'ABSPATH' ) ) exit; 11 12 /** 13 * Register scripts commonly used by BuddyPress plugins and themes. 14 * 15 * @since BuddyPress (2.1.0) 16 */ 17 function bp_core_register_common_scripts() { 18 19 // Whether or not to use minified versions 20 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js'; 21 22 // Get the version for busting caches 23 $ver = bp_get_version(); 24 25 // Get the common core JS URL 26 $url = buddypress()->plugin_url . 'bp-core/js/'; 27 28 // Array of common scripts 29 $scripts = apply_filters( 'bp_core_register_common_scripts', array( 30 'bp-confirm' => 'confirm', 31 'bp-widget-members' => 'widget-members', 32 'bp-jquery-query' => 'jquery-query', 33 'bp-jquery-cookie' => 'jquery-cookie', 34 'bp-jquery-scroll-to' => 'jquery-scroll-to', 35 ) ); 36 37 // Register scripts commonly used by BuddyPress themes 38 foreach ( $scripts as $id => $file ) { 39 wp_register_script( $id, $url . $file . $min, array( 'jquery' ), $ver ); 40 } 41 } 42 add_action( 'bp_enqueue_scripts', 'bp_core_register_common_scripts', 1 ); 11 43 12 44 /** … … 18 50 } 19 51 20 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 21 wp_enqueue_script( 'bp-confirm', buddypress()->plugin_url . "bp-core/js/confirm{$min}.js", array( 'jquery' ), bp_get_version() ); 52 wp_enqueue_script( 'bp-confirm' ); 22 53 23 54 wp_localize_script( 'bp-confirm', 'BP_Confirm', array( … … 26 57 27 58 } 28 add_action( ' wp_enqueue_scripts', 'bp_core_confirmation_js' );59 add_action( 'bp_enqueue_scripts', 'bp_core_confirmation_js' ); 29 60 add_action( 'admin_enqueue_scripts', 'bp_core_confirmation_js' ); 30 61 … … 70 101 jQuery('#avatar-to-crop').Jcrop({ 71 102 onChange: showPreview, 72 onSelect: showPreview,73 103 onSelect: updateCoords, 74 104 aspectRatio: <?php echo $aspect_ratio; ?>, … … 154 184 return apply_filters( 'bp_core_ajax_url', admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ) ); 155 185 } 186 187 /** 188 * Get the javascript dependencies for buddypress.js. 189 * 190 * @since BuddyPress (2.0.0) 191 * 192 * @uses apply_filters() to allow other component to load extra dependencies 193 * 194 * @return array The javascript dependencies. 195 */ 196 function bp_core_get_js_dependencies() { 197 return apply_filters( 'bp_core_get_js_dependencies', array( 198 'jquery', 199 'bp-confirm', 200 'bp-widget-members', 201 'bp-jquery-query', 202 'bp-jquery-cookie', 203 'bp-jquery-scroll-to' 204 ) ); 205 }
Note: See TracChangeset
for help on using the changeset viewer.