WordPress.org

Forums

Google Analytics Dashboard for WP
[resolved] Admin Widget javascript error with simple quotes (2 posts)

  1. 3pepe3
    Member
    Posted 11 months ago #

    The admin widget is not working when some links had simple quotes in the variable $ga_dash_top_referrers

    This simple quote will trigger the next error:

    SyntaxError: missing ] after element list
    
    .../fr.wikipedia.org/wiki/Pierre_Morel-A-L'Huissier"target="_blank">fr.wikipedia.or...

    The code triggering the error :
    dashboar_widgets.php on line 563

    var datar = google.visualization.arrayToDataTable([' . "
    			  ['" . __ ( "Top Referrers", 'ga-dash' ) . "', '" . __ ( "Visits", 'ga-dash' ) . "']," . $ga_dash_top_referrers . "
    			]);

    To fix this you can modify gapi.php and replace line 366

    from this :
    $ga_dash_data .= "['<a href=\"http://".$data ['rows'] [$i] [1]."\"target=\"_blank\">" . str_replace ( array (

    to this:
    $ga_dash_data .= "['<a href=\"http://".addslashes($data ['rows'] [$i] [1])."\"target=\"_blank\">" . str_replace ( array (

    Voila voila.... problem solved

    https://wordpress.org/plugins/google-analytics-dashboard-for-wp/

  2. Alin Marcu
    Member
    Plugin Author

    Posted 11 months ago #

    Thanks, I'll fix that!

Reply

You must log in to post.

About this Plugin

  • Google Analytics Dashboard for WP
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.