wp_prototype_before_jquery

Definition:
function wp_prototype_before_jquery( $js_array ) {}

Reorder JavaScript scripts array to place prototype before jQuery.

Parameters

  • array $js_array: JavaScript scripts array

Return values

returns:Reordered array, if needed.

Source code

function wp_prototype_before_jquery( $js_array ) {

	if ( false === $jquery = array_search( 'jquery', $js_array, true ) )

		return $js_array;



	if ( false === $prototype = array_search( 'prototype', $js_array, true ) )

		return $js_array;



	if ( $prototype < $jquery )

		return $js_array;



	unset($js_array[$prototype]);



	array_splice( $js_array, $jquery, 0, 'prototype' );



	return $js_array;

}

4007

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: