function _getOembed($url, $maxwidth = 500, $maxheight = 400) { require_once INSTALLDIR . '/extlib/Services/oEmbed.php'; $parameters = array('maxwidth' => $maxwidth, 'maxheight' => $maxheight); try { $oEmbed = new Services_oEmbed($url); $object = $oEmbed->getObject($parameters); return $object; } catch (Exception $e) { try { $oEmbed = new Services_oEmbed($url, array(Services_oEmbed::OPTION_API => common_config('oohembed', 'endpoint'))); $object = $oEmbed->getObject($parameters); return $object; } catch (Exception $ex) { return false; } } }
/** * Get the oEmbed object * * @param array $test The test object to fetch * * @return object Instance of {@link Services_oEmbed_Object} */ protected function getObject(array $test) { $oEmbed = new Services_oEmbed($test['url'], array(Services_oEmbed::OPTION_API => $test['api'])); return $oEmbed->getObject(); }