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 563var 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=\"https://".$data ['rows'] [$i] [1]."\"target=\"_blank\">" . str_replace ( array (
to this:
$ga_dash_data .= "['<a href=\"https://".addslashes($data ['rows'] [$i] [1])."\"target=\"_blank\">" . str_replace ( array (
Voila voila…. problem solved
https://www.ads-software.com/plugins/google-analytics-dashboard-for-wp/
- The topic ‘Admin Widget javascript error with simple quotes’ is closed to new replies.