Skip to content

Commit

Permalink
Allowed backslash '\' - is required for regular expressions
Browse files Browse the repository at this point in the history
git-svn-id: http://gapi-google-analytics-php-interface.googlecode.com/svn/trunk@23 ec20e588-3894-11de-96ab-f16d9912eac9
  • Loading branch information
stig@sdm.co.nz committed Jun 6, 2009
1 parent 4dcae5f commit f8d453a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gapi.class.php
Expand Up @@ -231,7 +231,7 @@ protected function processFilter($filter)
$valid_operators = '(!~|=~|==|!=|>|<|>=|<=|=@|!@)';

$filter = preg_replace('/\s\s+/',' ',trim($filter)); //Clean duplicate whitespace
$filter = str_replace(array(',',';','\\'),array('\,','\;','\\\\'),$filter); //Escape Google Analytics reserved characters
$filter = str_replace(array(',',';'),array('\,','\;'),$filter); //Escape Google Analytics reserved characters
$filter = preg_replace('/(&&\s*|\|\|\s*|^)([a-z]+)(\s*' . $valid_operators . ')/i','$1ga:$2$3',$filter); //Prefix ga: to metrics and dimensions
$filter = preg_replace('/[\'\"]/i','',$filter); //Clear invalid quote characters
$filter = preg_replace(array('/\s*&&\s*/','/\s*\|\|\s*/','/\s*' . $valid_operators . '\s*/'),array(';',',','$1'),$filter); //Clean up operators
Expand Down

0 comments on commit f8d453a

Please sign in to comment.