Example #1
0
 public static function xml2array($xmlObject, $out = array())
 {
     foreach ((array) $xmlObject as $index => $node) {
         $index = XMLHelper::dashesToCamelCase($index);
         $out[$index] = is_object($node) || is_array($node) ? XMLHelper::xml2array($node) : trim($node);
     }
     return $out;
 }
Example #2
0
 public static function getData($game)
 {
     $data = LoadHelper::loadCached('https://promoterapp.com/dopresskit/' . $game->promoter['product'], PROMOTER_CACHE_DURATION);
     if ($data == null) {
         return;
     }
     $promoterxml = simplexml_load_string($data);
     $promoter = XMLHelper::xml2array($promoterxml);
     XMLHelper::collapse($promoter, 'reviews', 'review');
     if (!isset($promoter['reviews'])) {
         return;
     }
     if (PROMOTER_OVERWRITE || !isset($game->quotes)) {
         $game->quotes = array();
     }
     foreach ($promoter['reviews'] as $review) {
         $game->quotes[] = array('link' => $review['url'], 'description' => $review['quote'], 'name' => $review['reviewerName'], 'website' => $review['publicationName']);
     }
 }