[Plugin: jQuery Lightbox] Encoding js options using wp_enqueue_script
-
I have an interesting url encoding issue using ‘wp_enqueue_script’ to apply options to the current version (1.3.5) of the jquery lightbox plugin:
this code
wp_enqueue_script('jquerylightbox', $path.'/jquery.lightbox.packed.js?download_link=false&show_linkback=false&text.info=Photo&text.closeInfo=Click anywhere outside image to close', array('jquery'), '1.3.5');
translates into this on the page:
<script type='text/javascript' src='[...]/wp-content/plugins/jquery-lightbox-balupton-edition/js/jquery.lightbox.packed.js?download_link=false&show_linkback=false&text_info=Photo&text_closeInfo=Click+anywhere+outside+image+to+close&ver=1.3.5'></script>
‘wp_enqueue_script’ is doing some url encoding of its own – although you can’t see it in this example because the forum is eating the ampersand conversions, the ampersands are in fact converted to “& # 3 8 ; ” and spaces become “+” (as you can see). Unfortunately, it also converts the dots between ‘text.info’ and ‘text.closeInfo’ to underscores. Strangely, it leaves alone the dots in the file path at the beginning and in the version info at the end of the string – it just eats the ones in the options part. I need the dots to apply the options to the page – how can I make sure they stay dots and won’t be converted to underscores?
Is this a problem with my code, or with wp_enqueue_script, or with the jquery plugin?
Note: The jquery plugin options are explained here:
https://www.balupton.com/sandbox/jquery_lightbox/jquery_lightbox/readme.txtP.S. This forum is eating the encodings too ?? I’ve added some spaces to illustrate my point.
- The topic ‘[Plugin: jQuery Lightbox] Encoding js options using wp_enqueue_script’ is closed to new replies.