{"id":390,"date":"2008-11-25T22:35:04","date_gmt":"2008-11-25T22:35:04","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/use-google-libraries\/"},"modified":"2017-05-03T23:42:14","modified_gmt":"2017-05-03T23:42:14","slug":"use-google-libraries","status":"publish","type":"plugin","link":"https:\/\/ca-valencia.wordpress.org\/plugins\/use-google-libraries\/","author":97662,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.6.2.3","stable_tag":"trunk","tested":"4.7.33","requires":"3.4","requires_php":"","requires_plugins":"","header_name":"Use Google Libraries","header_author":"Jason Penney","header_description":"","assets_banners_color":"","last_updated":"2017-11-28 05:16:59","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/jasonpenney.net\/donate","header_plugin_uri":"http:\/\/jasonpenney.net\/wordpress-plugins\/use-google-libraries\/","header_author_uri":"http:\/\/jasonpenney.net\/","rating":4.4,"author_block_rating":0,"active_installs":10000,"downloads":748328,"num_ratings":47,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.6.2.3":"<p>Changed supported version to &lt; WP 4.8<\/p>"},"ratings":{"1":6,"2":1,"3":1,"4":1,"5":38},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.5","1.0.6","1.0.6.1","1.0.7","1.0.7.1","1.0.9","1.0.9.1","1.0.9.2","1.1","1.1.0.1","1.1.2","1.2","1.2.1","1.5","1.5.1","1.5.2","1.5b1","1.6","1.6.1","1.6.2","1.6.2.1","1.6.2.2"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[3863,150,229,202,247],"plugin_category":[54,59],"plugin_contributors":[78096],"plugin_business_model":[],"class_list":["post-390","plugin","type-plugin","status-publish","hentry","plugin_tags-cdn","plugin_tags-google","plugin_tags-javascript","plugin_tags-jquery","plugin_tags-performance","plugin_category-security-and-spam-protection","plugin_category-utilities-and-tools","plugin_contributors-jczorkmid","plugin_committers-jczorkmid"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/use-google-libraries.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>A number of the javascript libraries distributed with Wordpress are also \nhosted on Google's <a href=\"http:\/\/code.google.com\/apis\/ajaxlibs\/\">AJAX Libraries API<\/a>.\nThis plugin allows your Wordpress site to use the content distribution \nnetwork side of Google's AJAX Library API, rather than serving these files from your WordPress install directly.<\/p>\n\n<p>This provides numerous potential performance benefits:<\/p>\n\n<ul>\n<li>increases the chance that a user already has these files cached<\/li>\n<li>takes load off your server<\/li>\n<li>uses compressed versions of the libraries (where available)<\/li>\n<li>Google's servers are set up to negotiate HTTP compression with the requesting browser<\/li>\n<\/ul>\n\n<p>For a more detailed look see Dave Ward's <a href=\"https:\/\/web-beta.archive.org\/web\/20101216143500\/encosia.com\/2008\/12\/10\/3-reasons-why-you-should-let-google-host-jquery-for-you\/\">3 reasons why you should let\nGoogle host jQuery for\nyou<\/a>.<\/p>\n\n<h4>Supported Libraries and Components<\/h4>\n\n<ul>\n<li><a href=\"http:\/\/dojotoolkit.org\/\">Dojo<\/a><\/li>\n<li><a href=\"http:\/\/jquery.com\/\">jQuery<\/a><\/li>\n<li><a href=\"http:\/\/ui.jquery.com\/\">jQuery UI<\/a><\/li>\n<li><a href=\"http:\/\/mootools.net\/\">MooTools<\/a><\/li>\n<li><a href=\"http:\/\/www.prototypejs.org\/\">Prototype<\/a><\/li>\n<li><a href=\"http:\/\/script.aculo.us\/\">script.aculo.us<\/a><\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/swfobject\/\">swfobject<\/a><\/li>\n<\/ul>\n\n<h4>Links<\/h4>\n\n<ul>\n<li><a href=\"http:\/\/jasonpenney.net\/wordpress-plugins\/use-google-libraries\/\">Use Google Libraries Home<\/a><\/li>\n<li><a href=\"http:\/\/github.com\/jpenney\/use-google-libraries\/issues\">Issue Tracker<\/a><\/li>\n<li><a href=\"http:\/\/github.com\/jpenney\/use-google-libraries\">GitHub Repository<\/a><\/li>\n<li><a href=\"http:\/\/wordpress.org\/support\/plugin\/use-google-libraries\">Support Forum<\/a><\/li>\n<\/ul>\n\n<h3>Incompatible Plugins<\/h3>\n\n<h4>Better WordPress Minify<\/h4>\n\n<p>Better WordPress Minify version 1.2.2 does not yet support\nprotocol-relative URLs, but <a href=\"http:\/\/wordpress.org\/support\/topic\/conflict-with-use-google-libraries-152\">the next release is supposed to correct\nthis<\/a>.<\/p>\n\n<h4>Gravity Forms<\/h4>\n\n<p>I've had reports of Gravity Forms breaking UGL, but I don't have\naccess to Gravity Forms, so I'm not sure what's going on.  If you need\nGravity Forms you might need to disable UGL, or it might be fine, I'm\nnot really sure.<\/p>\n\n<h4>WP-Minify<\/h4>\n\n<p>WP-Minify doesn't yet support protocol-relative URLs.  Add\n'\/\/ajax.googleapis.com\/' as a JS and CSS exclusion.<\/p>\n\n<h3>Incompatible Themes<\/h3>\n\n<h4>K2<\/h4>\n\n<p>I've had scattered reports that UGL is stepping out of the way when\nusing K2.<\/p>\n\n<h3>A Request<\/h3>\n\n<p>If you're going to flag the plugin as \"broken\" in the WordPress Plugin\nDirectory, please try and <a href=\"http:\/\/wordpress.org\/tags\/use-google-libraries?forum_id=10\">let me know <em>what<\/em> is\nbroken<\/a>.\nI'm not a mind reader.<\/p>\n\n<h3>Technical Details<\/h3>\n\n<p><strong>Use Google Libraries<\/strong> uses the following hooks (each with a priority of 1000).<\/p>\n\n<h4>wp_default_scripts<\/h4>\n\n<p><strong>Use Google Libraries<\/strong> compares it's list of supported scripts to those \nregistered, and replaces the standard registrations <code>src<\/code> with ones that \npoint to Google's servers.  Other attributes (like dependencies) are left \nintact.<\/p>\n\n<h4>script_loader_src<\/h4>\n\n<p><strong>Use Google Libraries<\/strong> removes the <code>ver=x.y.z<\/code> query string from the URL\nused to load the requested library <em>if<\/em> it is going to load the library from\n    ajax.googleapis.com.  Otherwise the URL is left unaltered.  This both \nimproves the chances of the given URL already being cached, and prevents \n<strong>script.aculo.us<\/strong> from including scripts multiple times.<\/p>\n\n<p>If jQuery is enqued <strong>Use Google Libraries<\/strong> will inject a bit of\njavascript before the next enqueued script enabling jQuery's <a href=\"http:\/\/docs.jquery.com\/Core\/jQuery.noConflict\">noConflict mode<\/a> as it would \nwith the standard WordPress version.<\/p>\n\n<h3>References<\/h3>\n\n<p>Parts of this plugin (specificly, the dropping of the micro number,\nwhich has since been removed for better caching performance) were \ninspired by John Blackbourn's \n<strong><a href=\"http:\/\/lud.icro.us\/wordpress-plugin-google-ajax-libraries\/\">Google AJAX Libraries<\/a><\/strong>, \nwhich has very similar goals to this plugin.<\/p>\n\n<h3>Future Plans<\/h3>\n\n<ul>\n<li>add ability to disable protocol relative URLs<\/li>\n<li>add ability to disable on frontend and\/or admin<\/li>\n<\/ul>\n\n<!--section=installation-->\nUpload the <code>use-google-libraries<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> folder.\n\nActivate <strong>Use Google Libraries<\/strong> through the 'Plugins' menu in WordPress.\n\nEr... That's it really.\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd>Upload the <code>use-google-libraries<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> folder.\n\nActivate <strong>Use Google Libraries<\/strong> through the 'Plugins' menu in WordPress.\n\nEr... That's it really.<\/dd>\n<dt>What happens when Google updates their library versions?<\/dt>\n<dd><p>Google has stated that they intend to keep every file they've hosted \navailable indefinitely, so you shouldn't need to worry about them \ndisappearing.<\/p><\/dd>\n<dt>Why isn't in doing anything?<\/dt>\n<dd><p>Firstly, if you are using a caching plugin, flush the cache or\ntemporarily disable it to be sure it's not doing anything.  That said,\nI've done my best to make <strong>Use Google Libraries<\/strong> gracefully step out\nof the way when things are not as expected.  While not, perhaps,\ngiving you the greatest benefit it helps ensure you site doesn't just\nflat out stop working.<\/p>\n\n<p>In general, anything that calls wp_register_script and\/or\nwp_eneque_script before 'init' causes trouble for <strong>Use Google\nLibraries<\/strong>.  I've made an effort to force it to try and run anyhow,\nso please report any issues with this.  If you have 'WP_DEBUG'\nenabled, a message will be logged letting you know this is happening.<\/p>\n\n<p>Please see the section on <strong>Incompatible Plugins<\/strong> and\n<strong>Incompatible Themes<\/strong> for specific information.<\/p><\/dd>\n<dt>How do I use the libraries supplied by Use Google Libraries?<\/dt>\n<dd><p>The same way you use them when Use Google Libraries isn't installed using \n'wp_enqueue_script'.  In fact you should develop your theme or plugin without\nUse Google Libraries being enabled at all, then test it both ways.<\/p><\/dd>\n<dt>Why do some scripts continue to use the WordPress supplied versions?<\/dt>\n<dd><p>Assuming some other plugin or theme isn't the cause, Use Google Libries does \nit's very best to ensure your site behaves as it should when using the stock \nWordPress scripts.  If WordPress is asking for a version of a script that \nGoogle isn't hosting, then it will continue to use the WordPress supplied \nversion.<\/p><\/dd>\n<dt>Can I always load the latest version of a hosted script?<\/dt>\n<dd><p>No. Use Google Libraries doesn't do that because it would almost certainly \nbreak WordPress. Even if it didn't, the less 'version specific' URLs supported \nby Google's CDN set a short term 'Expires' header, so there wouldn't be much\npoint.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.6.2.3<\/h4>\n\n<ul>\n<li>Updated supported version. <\/li>\n<li>used archive.org to get around link that's now malware<\/li>\n<\/ul>\n\n<h4>1.6.2.1<\/h4>\n\n<ul>\n<li>Bypass functionality when running under 4.2+ until next version to avoid breaking sites.<\/li>\n<\/ul>\n\n<h4>1.6.2<\/h4>\n\n<ul>\n<li>added some missing jQuery UI modules (hopefully fixes issues from support \nforums I couldn't reproduce previously).<\/li>\n<\/ul>\n\n<h4>1.6.1<\/h4>\n\n<ul>\n<li>same as 1.6 (due to SVN issue with 1.6)<\/li>\n<\/ul>\n\n<h4>1.6<\/h4>\n\n<ul>\n<li>Drop support for PHP4, and WordPress &lt; 3.4<\/li>\n<li>clean up PHP 5.x strict issues<\/li>\n<\/ul>\n\n<h4>1.5.2<\/h4>\n\n<ul>\n<li>using protocol-relative URLS with WordPress &gt;= 3.5<\/li>\n<li>use WordPress provided <code>is_ssl<\/code> rather than custom check (only for\nWordPress &lt; 3.5)<\/li>\n<li>Detect if 'jquery' is a meta-script registration, and actual jQuery\nis loaded as 'jquery-core' tag (WordPress 3.6 Beta).<\/li>\n<\/ul>\n\n<h4>1.5.1<\/h4>\n\n<ul>\n<li>fix bug in <code>is_ssl<\/code> check.<\/li>\n<\/ul>\n\n<h4>1.5<\/h4>\n\n<ul>\n<li>using <code>wp_remote_head<\/code> to query that the replacement URL is actually\nhosted by google.  If it's not, then the WordPress supplied version will be \nused.<\/li>\n<li>Using the Transient API to store the replacement URLS, rather than \nrecalculating and re-querying them every load.<\/li>\n<\/ul>\n\n<h4>1.2.1<\/h4>\n\n<ul>\n<li>Added check for WordPress including non-standard versions of scripts (fixes\nWordPress 3.2.2\/swfobject).<\/li>\n<li>Fixed incorrect case in HTTPS check.<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>Reworked handling for cases where multiple js files are combined\ninto one on Google's servers.  In the past this has been mostly a\nnon-issue because the dependencies took care of it, but due to changes\nin the latest jQuery UI this stopped working as expected.<\/li>\n<\/ul>\n\n<h4>1.1.2<\/h4>\n\n<ul>\n<li>Updated jQuery UI to work with WordPress 3.1rc1<\/li>\n<\/ul>\n\n<h4>1.1.0.1<\/h4>\n\n<ul>\n<li>Re-disable script concatenation.  Seemed to break widget admin page.<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>No longer disable script concatenation when using WordPress 3.0 or\ngreater<\/li>\n<li>Attempt to detect when another plugin or theme has called\n'wp_register_script' and\/or 'wp_enque_script' before 'init' and work\naround it.<\/li>\n<li>Limited debugging output when WP_DEBUG is enabled.<\/li>\n<\/ul>\n\n<h4>1.0.9.2<\/h4>\n\n<ul>\n<li>Hopefully fix issue with plugin loading for some users<\/li>\n<\/ul>\n\n<h4>1.0.9.1<\/h4>\n\n<ul>\n<li>Added <strong>Incompatible Plugins<\/strong> and <strong>Incompatible Themes<\/strong> sections\nto the README<\/li>\n<\/ul>\n\n<h4>1.0.9<\/h4>\n\n<ul>\n<li>more https detection<\/li>\n<li>inline jQuery.noConflict()<\/li>\n<\/ul>\n\n<h4>1.0.7.1<\/h4>\n\n<ul>\n<li>fix previous fix (whoops!)<\/li>\n<\/ul>\n\n<h4>1.0.7<\/h4>\n\n<ul>\n<li>Quick and dirty workaround for scriptaculous loading (thanks to\n<a href=\"https:\/\/twitter.com\/gregorylam\/statuses\/2279304842\">Gregory Lam for bringing it to my\nattention<\/a><\/li>\n<\/ul>\n\n<h4>1.0.6.1<\/h4>\n\n<ul>\n<li>moved location of the Changelog section in the README<\/li>\n<\/ul>\n\n<h4>1.0.6<\/h4>\n\n<ul>\n<li>Disables script concatenation in WordPress 2.8, since it seems to have\nissues when some of the dependencies are outside of the concatenation.<\/li>\n<li>Persists flag to load scripts in the footer in WordPress 2.8<\/li>\n<\/ul>\n\n<h4>1.0.5<\/h4>\n\n<p>Implemented a pair of\n<a href=\"http:\/\/jasonpenney.net\/wordpress-plugins\/use-google-libraries\/comment-page-1\/#comment-32427\">suggestions<\/a>\nfrom  <a href=\"http:\/\/peterwilson.cc\/\">Peter  Wilson<\/a>.<\/p>\n\n<ul>\n<li>It should detect when a page is loaded over https and load the libraries over https accordingly<\/li>\n<li>It no longer drops the micro version number from the url.  The reasons for this are twofold:\n\n<ul>\n<li>It ensures the version requested is the version received.<\/li>\n<li>Google's servers set the expires header for 12 months for these\nurls, as opposed to 1 hour.  This allows clients to cache the file\nfor up to a year without needing to retrieve it again from Google's\nservers.  If the version requested by your WordPress install\nchanges, so will the URL so there's no worry that you'll keep\nloading an old version.<\/li>\n<\/ul><\/li>\n<\/ul>","raw_excerpt":"Allows your site to use common javascript libraries from Google&#039;s AJAX Libraries CDN, rather than from WordPress&#039;s own copies.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=390"}],"author":[{"embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jczorkmid"}],"wp:attachment":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=390"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=390"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=390"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=390"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=390"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}