Support » Plugins » [Plugin: ICS Calendar] unterminated string literal

  • Hi

    I got an “unterminated string literal” error message at the following part:

    56 jQuery(document).ready(function() {
    57 jQuery("a.ics-nav-button").click(function() {
    58 jQuery.get("

    in the cal-functions.php file’s line 21
    jQuery.get("' . ICSCALENDAR_URLPATH . 'ajax-load.php?showMonth="+jQuery(this).attr("month")+"'.$urlString.'", function(data) {

    and none of the next/previous month buttons works
    any idea, what’s wrong?

Viewing 15 replies - 1 through 15 (of 18 total)
  • I’m getting the same problem,

    I put an extra “in at the end of $urlString.'”, so now it reads

    jQuery.get("' . ICSCALENDAR_URLPATH . 'ajax-load.php?showMonth="+jQuery(this).attr("month")+"'.$urlString.'"", function(data) {

    Now I see that, in the function, the Quotes are being replaced with HTML entities.

    So you figured out how to fix the problem ?

    no, for some reason if that JQuery string is too long, the special characters will be replaced by html entities. if you shorten the line, aka remove the $urlString from the code, it will show correctly the quote – but then the plugin won’t work 🙂

    Fixing this error is not hard, but it took me almost a good hour of poking around and angrily banging on my keyboard 🙂

    jQuery.get("' . ICSCALENDAR_URLPATH . 'ajax-load.php?showMonth="+jQuery(this).attr("month")+base64_decode("'.base64_encode($urlString).'"), function(data) {

    And that should work fine 🙂 What we did here is encoded our long $urlString in base64 and that is what JavaScript now sees, the encoded string. Once user clicks on the next/prev. buttons, that string gets decoded by base64_decode function.

    Of course, base64_decode is not an actual function in javascript. Here is where to get one:
    For base64_decode you will also need utf8_decode, get it here:

    I hope this helps 🙂

    To the author: this will be a good thing to include in the next release 😉

    I am not much of a php expert…could you provide more details on how to add the base64_decode code and the utf8_decode code? Or better yet, could someone (the plug-in author perhaps?) post a new version of the cal-functions.php file? I love this plugin but the Next and Previous month buttons not working is a pretty major bug.

    Thanks for the great work!

    Like mm911, I’ would also appreciate a hand to get this fixed. Terrific plugin though.


    Hello, and sorry for such a cryptic explanation.

    More specific instructions:

    1) Get new cal-functions.php here:

    2) Replace existing cal-functions.php with this new one

    3) Get following two files and place them into the ICS Calendar plugin directory:

    4) Enjoy!

    Thanks very much! It works.

    I can’t get it to work even after applying those patches. Anyone else having the same problem? Thanks. -Brian

    … Ok, it’s working now, don’t know what I did wrong… anyway, thanks for the fix and God bless you. -Brian

    Thank you for the quick fix!

    Is this the same problem that is discussed here?

    Thank you very much!
    It’s working for me.

    I have fixed this issue and will upload v1.2 later today. The problem was with the long string in the jQuery ajax function. I am not sure why that is an issue.

    However, the way grigory fixed the problem is not ideal. What I ended up doing is modifying the PHP to print out a Javascript Object then used that in the AJAX function. This seems to have cleared up the issue without the need for extra include files.


    $calContent = '<script type="text/javascript">
    	jQuery(document).ready(function() {
    		$urlArray = '';
    		$calContent .= 'var options = {';
    		foreach($options as $k=>$o) {
    			$urlArray[] = '"'.$k.'" : \''.$o.'\'';
    		$calContent .= implode(", \n",$urlArray);
    		$calContent .= '};';
    $calContent .= '				jQuery("a.ics-nav-button").click(function() {
    			jQuery.get("' . ICSCALENDAR_URLPATH . 'ajax-load.php?showMonth="+jQuery(this).attr("month")+"", options, function(data) {
    				jQuery("#ics-calendar-uid > div").unbind();
    	//	alert("Stop it!");

    I tried v1.2.2 and still couldn’t get previous/next to work. But I must say thanks anyway because the plugin is exactly what I needed. (you did create it, yes?)

    Your method got it to work. Thanks.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: ICS Calendar] unterminated string literal’ is closed to new replies.