WordPress Version: 3.7
/**
* Register a new script.
*
* Registers a script to be linked later using the wp_enqueue_script() function.
*
* @see WP_Dependencies::add(), WP_Dependencies::add_data()
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
*
* @since 2.6.0
*
* @param string $handle Name of the script. Should be unique.
* @param string $src Path to the script from the WordPress root directory. Example: '/js/myscript.js'.
* @param array $deps Optional. An array of registered script handles this script depends on. Set to false if there
* are no dependencies. Default empty array.
* @param string|bool $ver Optional. String specifying script version number, if it has one, which is concatenated
* to end of path as a query string. If no version is specified or set to false, a version
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added. Default 'false'. Accepts 'false', 'null', or 'string'.
* @param bool $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
* Default 'false'. Accepts 'false' or 'true'.
*/
function wp_register_script($handle, $src, $deps = array(), $ver = false, $in_footer = false)
{
global $wp_scripts;
if (!is_a($wp_scripts, 'WP_Scripts')) {
if (!did_action('init')) {
_doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>'), '3.3');
}
$wp_scripts = new WP_Scripts();
}
$wp_scripts->add($handle, $src, $deps, $ver);
if ($in_footer) {
$wp_scripts->add_data($handle, 'group', 1);
}
}