WordPress.org

Support

Support » Plugins and Hacks » Google Analytics Dashboard for WP » [Resolved] Admin Widget javascript error with simple quotes

[Resolved] Admin Widget javascript error with simple quotes

  • 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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Admin Widget javascript error with simple quotes’ is closed to new replies.
Skip to toolbar