public static function parse($url) { $oembed = null; foreach (self::$providers as $p) { if ($p->check($url)) { $oembed = $p->parse($url); break; } } if (empty($oembed)) { self::$defaultProvider = empty(self::$defaultProvider) ? new OEmbedDefaultProvider() : self::$defaultProvider; $oembed = self::$defaultProvider->parse($url); } if (!empty($oembed)) { $oembed['href'] = $url; } return $oembed; }
public function __construct($url, $apikey, $maxwidth = null, $maxheight = null) { $endpoint = "http://api.embed.ly/1/oembed?key={$apikey}"; parent::__construct($url, $endpoint, false, $maxwidth, $maxheight, true); }
public function __construct($url, $maxwidth = null, $maxheight = null) { $endpoint = "http://oohembed.com/oohembed/"; parent::__construct($url, $endpoint, true, $maxwidth, $maxheight, true); }
<?php /* * PHP OEmbed provider/proxy - for details, visit * * http://code.google.com/p/php-oembed/ * * Copyright(C) by Adam Nemeth. Licensed under New BSD license. * * I would love to hear every feedback on aadaam at googlesmailservice * */ require_once "config.php"; $xml = simplexml_load_file("providers.xml"); foreach ($xml->provider as $provider) { // $x = new OEmbedProvider("http://*.flickr.com/*","http://www.flickr.com/services/oembed/"); $x = new OEmbedProvider($provider->url, $provider->endpoint); echo $x->url . ":\n"; if ($x->match("http://www.flickr.com/photos/bees/2341623661/")) { print_r($x->provide("http://www.flickr.com/photos/bees/2341623661/", "object")); } echo " " . $x->getUrlRegExp() . "\n"; echo " " . $x->getJsonEndpoint() . "\n"; echo " " . $x->getXmlEndpoint() . "\n"; }