/** * Get raw structure in json and organize it to proper output for ElggBatch results * @param mixed $data * @return stdClass|boolean */ private static function handlePluginProjectsRssResult($data) { $data = simplexml_load_string($data); if ($data === false) { throw new IOException("Invalid XML structure received!"); } // var_dump($data->getDocNamespaces(), $data->getNamespaces()); $channel = $data->xpath('channel/item'); if (is_array($channel)) { $result = array(); foreach ($channel as $item) { // var_dump($item->saveXML()); $ent = new ElggRemotePluginProject(); $ent->loadFromRss($item); $result[] = $ent; // $result[] = (object)array( // 'title' => (string)$item->title, // 'description' => (string)$item->description, // 'rssGuid' => (string)$item->guid, // 'rssLink' => (string)$item->link, // 'updatedTs' => strtotime($item->pubDate), // ); } return $result; } return false; }