/** * This method can be used by other plugins. It will expand an URL to an oembed object (or null if not supported). * @param string $url The url to be expanded * @param string $maxwidth Maximum width of returned object (if service supports this). May be left empty * @param string $maxheight Maximum height of returned object (if service supports this). May be left empty * @return OEmbed or null */ function expand($url, $maxwidth = null, $maxheight = null) { $obj = OEmbedDatabase::load_oembed($url); if (empty($obj)) { $config = array('audioboo_tpl' => $this->get_config('audioboo_player', 'wordpress')); $manager = ProviderManager::getInstance($maxwidth, $maxheight, $config); try { $obj = $manager->provide($url, "object"); if (isset($obj)) { if (!empty($obj->error)) { $obj = null; } } if (!isset($obj)) { $obj = $this->expand_by_general_provider($url, $maxwidth, $maxheight); if (isset($obj)) { if (!empty($obj->error)) { $obj = null; } } } if (isset($obj)) { $obj = OEmbedDatabase::save_oembed($url, $obj); } } catch (ErrorException $e) { // Timeout in most cases //return $e; //print_r($e); } } return $obj; }