Wednesday, April 24, 2013

"Please stop hotlinking my easing script - Start using a real CDN" Warning

One of my clients has a website for his car coating business in Bucharest, running on WordPress with Clockstone theme installed. The theme is using the slider plugin  Accordion slider that in turn uses a javascript function for easing. The author of the script, as I found out on this zen cart forum thread, is getting a lot of traffic and complaints from his hosting service, and he decided to make a pop-up appear on any page using the script remotely, that looks like this:

Please stop hotlinking my easing script — use a real CDN instead. Many thanks
Please stop hotlinking my easing script — use a real CDN instead. Many thanks

To solve this issue, one has to first download the jquery easing script (choose same version as one used currently remote ) and place it in the js folder of the plugin, in this case:
wp-content/plugins/wp-accordion-slider/js/jquery.easing.1.3.js
Next, the reference for this script must be changed, so that it's no longer called in the header directly from:
http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js
instead you should have it load from your server:
<script type='text/javascript' src='http://www.yourserver.com/wp/wp-content/plugins/wp-accordion-slider//js/jquery.easing.1.3.js?ver=3.5.1'></script>
 To do this, first locate which file loads the remote script. In my case the call was being made from the file:
wp-content/plugins/wp-accordion-slider/includes/scripts.php
in the first lines, I changed:
wp_register_script( 'jquery_easing', 'http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js'); 
with
wp_register_script( 'jquery_easing', WP_ACCORDION_URL.'/js/jquery.easing.1.3.js'); 
 I noticed afterwards that the jquery.easing.1.3.js was already provided, although not in the minified version, but the reference was not updated. I presume this would have been the responsibility of the theme or plugin developers.

Feel free to donate by visiting our sponsors on the right ;) and I hope this helps you get rid of the warning "Please stop hotlinking my easing script - use a real CDN instead".