[wp-hackers] Re: Plugin interference

Alex King lists at alexking.org
Thu Apr 10 17:03:44 GMT 2008


Add this function (included in WP 2.3 I think) in your plugins to  
enforce this:

if (!function_exists('wp_prototype_before_jquery')) {
     function wp_prototype_before_jquery( $js_array ) {
         if ( false === $jquery = array_search( 'jquery', $js_array ) )
             return $js_array;

         if ( false === $prototype = array_search( 'prototype',  
$js_array ) )
             return $js_array;

         if ( $prototype < $jquery )
             return $js_array;

         unset($js_array[$prototype]);

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

         return $js_array;
     }

     add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
}

Cheers,
--Alex

Personal   http://alexking.org
Business   http://crowdfavorite.com
Schedule   http://alex.myfreebusy.com



On Apr 10, 2008, at 10:43 AM, gbellucci wrote:
> Other gotch's include NOT injecting jQuery.js before Prototype.js



More information about the wp-hackers mailing list