loadById($id); if ($format == 'json') { $data = new \stdClass(); } else { $data = new \SimpleXMLElement( '' . '' ); } $data->type = 'rich'; $data->version = '1.0'; $data->provider_name = 'phorkie'; $data->provider_url = Tools::fullUrl(); $data->title = $repo->getTitle(); $author = $repo->getOwner(); $data->author_name = $author['name']; $data->cache_age = 86400; $data->width = $maxWidth; $data->height = $maxHeight; $data->html = render('oembed', array('repo' => $repo), true); if ($format == 'json') { header('Content-type: application/json'); echo json_encode($data) . "\n"; } else { header('Content-type: text/xml'); echo $data->asXML();; } ?>