protected function GAFeed::sanitizeAccount in Google Analytics Reports 6
Same name and namespace in other branches
- 7 GAFeed.lib.inc \GAFeed::sanitizeAccount()
Sanitize account data
1 call to GAFeed::sanitizeAccount()
- GAFeed::queryAccountFeed in ./
GAFeed.lib.inc - Query and sanitize account data
File
- ./
GAFeed.lib.inc, line 250 - Provides the GAFeed object type and associated methods.
Class
- GAFeed
- GAFeed class to authorize access to and request data from the Google Analytics Data Export API.
Code
protected function sanitizeAccount() {
$xml = simplexml_load_string($this->response->data);
$this->results = NULL;
$results = array();
$meta = array();
/* Save meta info */
$meta['updated'] = check_plain(strval($xml->updated));
$meta['generator'] = check_plain(strval($xml->generator));
$meta['generatorVersion'] = check_plain(strval($xml->generator
->attributes()));
$opensearch = $xml
->children('http://a9.com/-/spec/opensearchrss/1.0/');
foreach ($opensearch as $key => $open_search_result) {
$meta[$key] = intval($open_search_result);
}
/* Save results */
foreach ($xml->entry as $entry) {
$properties = array();
foreach ($entry
->children('http://schemas.google.com/analytics/2009')->property as $property) {
$properties[str_replace('ga:', '', check_plain($property
->attributes()->name))] = check_plain(strval($property
->attributes()->value));
}
$properties['title'] = check_plain(strval($entry->title));
$properties['updated'] = check_plain(strval($entry->updated));
$results[$properties['profileId']] = $properties;
}
$this->meta = $meta;
$this->results = $results;
}