diff --git a/gapi.class.php b/gapi.class.php index c704301..5d168ac 100644 --- a/gapi.class.php +++ b/gapi.class.php @@ -237,8 +237,8 @@ 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 = preg_replace('/(&&\s*|\|\|\s*|^)([a-z0-9]+)(\s*' . $valid_operators . ')/i','$1ga:$2$3',$filter); //Prefix ga: to metrics and dimensions + $filter = preg_replace('/([,;]){1}(?!ga\:)/', '\\\\$1', $filter); //Escape Google Analytics reserved characters $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 @@ -850,4 +850,4 @@ private function fopenRequest($get_variables=null, $post_variables=null, $header return array('body'=>$response!==false?$response:'Request failed, consider using php5-curl module for more information.', 'code'=>$response!==false?'200':'400'); } -} \ No newline at end of file +}