-
+ D8000256CC4303E265E02409547860113408E20EF6E19BB6B484A22104D4356519365B2BB827566B6D2310E3549E7B1075C7419324A9EB5721401AB322FA4313mp-wp/wp-includes/functions.wp-scripts.php(0 . 0)(1 . 99)
94534 <?php
94535 /**
94536 * BackPress script procedural API.
94537 *
94538 * @package BackPress
94539 * @since r16
94540 */
94541
94542 /**
94543 * Prints script tags in document head.
94544 *
94545 * Called by admin-header.php and by wp_head hook. Since it is called by wp_head
94546 * on every page load, the function does not instantiate the WP_Scripts object
94547 * unless script names are explicitly passed. Does make use of already
94548 * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
94549 * register/enqueue new scripts.
94550 *
94551 * @since r16
94552 * @see WP_Scripts::print_scripts()
94553 */
94554 function wp_print_scripts( $handles = false ) {
94555 do_action( 'wp_print_scripts' );
94556 if ( '' === $handles ) // for wp_head
94557 $handles = false;
94558
94559 global $wp_scripts;
94560 if ( !is_a($wp_scripts, 'WP_Scripts') ) {
94561 if ( !$handles )
94562 return array(); // No need to instantiate if nothing's there.
94563 else
94564 $wp_scripts = new WP_Scripts();
94565 }
94566
94567 return $wp_scripts->do_items( $handles );
94568 }
94569
94570 /**
94571 * Register new JavaScript file.
94572 *
94573 * @since r16
94574 * @see WP_Scripts::add() For parameter information.
94575 */
94576 function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
94577 global $wp_scripts;
94578 if ( !is_a($wp_scripts, 'WP_Scripts') )
94579 $wp_scripts = new WP_Scripts();
94580
94581 $wp_scripts->add( $handle, $src, $deps, $ver );
94582 }
94583
94584 /**
94585 * Localizes a script.
94586 *
94587 * Localizes only if script has already been added.
94588 *
94589 * @since r16
94590 * @see WP_Script::localize()
94591 */
94592 function wp_localize_script( $handle, $object_name, $l10n ) {
94593 global $wp_scripts;
94594 if ( !is_a($wp_scripts, 'WP_Scripts') )
94595 return false;
94596
94597 return $wp_scripts->localize( $handle, $object_name, $l10n );
94598 }
94599
94600 /**
94601 * Remove a registered script.
94602 *
94603 * @since r16
94604 * @see WP_Scripts::remove() For parameter information.
94605 */
94606 function wp_deregister_script( $handle ) {
94607 global $wp_scripts;
94608 if ( !is_a($wp_scripts, 'WP_Scripts') )
94609 $wp_scripts = new WP_Scripts();
94610
94611 $wp_scripts->remove( $handle );
94612 }
94613
94614 /**
94615 * Enqueues script.
94616 *
94617 * Registers the script if src provided (does NOT overwrite) and enqueues.
94618 *
94619 * @since r16
94620 * @see WP_Script::add(), WP_Script::enqueue()
94621 */
94622 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
94623 global $wp_scripts;
94624 if ( !is_a($wp_scripts, 'WP_Scripts') )
94625 $wp_scripts = new WP_Scripts();
94626
94627 if ( $src ) {
94628 $_handle = explode('?', $handle);
94629 $wp_scripts->add( $_handle[0], $src, $deps, $ver );
94630 }
94631 $wp_scripts->enqueue( $handle );
94632 }