- // Whitelist: known API endpoints for sites that don't provide discovery...
- if (array_key_exists($host, self::$apiMap)) {
- $api = self::$apiMap[$host];
- } else {
- try {
- $api = self::discover($url);
- } catch (Exception $e) {
- // Discovery failed... fall back to oohembed if enabled.
- $oohembed = common_config('oohembed', 'endpoint');
- if ($oohembed) {
- $api = $oohembed;
- } else {
- throw $e;
+ // You can fiddle with the order of discovery -- either skipping
+ // some types or re-ordering them.
+
+ $order = common_config('oembed', 'order');
+
+ foreach ($order as $method) {
+
+ switch ($method) {
+ case 'built-in':
+ common_log(LOG_INFO, 'Considering built-in oEmbed methods...');
+ // Blacklist: systems with no oEmbed API of their own, which are
+ // either missing from or broken on oohembed.com's proxy.
+ // we know how to look data up in another way...
+ if (array_key_exists($host, self::$functionMap)) {
+ common_log(LOG_INFO, 'We have a built-in method for ' . $host);
+ $func = self::$functionMap[$host];
+ return call_user_func($func, $url, $params);
+ }
+ break;
+ case 'well-known':
+ common_log(LOG_INFO, 'Considering well-known oEmbed endpoints...');
+ // Whitelist: known API endpoints for sites that don't provide discovery...
+ if (array_key_exists($host, self::$apiMap)) {
+ $api = self::$apiMap[$host];
+ common_log(LOG_INFO, 'Using well-known endpoint "' . $api . '" for "' . $host . '"');
+ break 2;