This little PHP library provides a roughly OEmbed - http://oembed.com - compatible interface for javascript and PHP clients to consume. It can deal with OEmbed providers by acting as a proxy, and it has a plugin system where you can add your own embed-providers.
Embeds are useful when you don't want a whole page to load something (namely, a resource), you just want the content itself: being a youtube video, a flickr photo, a calendar entry, or anything else.
A YouTube plugin is boundled.
Demo:
http://aadaam.dev.ischmerosok.hu/oembed/Embed.php?url=www.youtube.com/watch?v=8SUtE_HF-88&format=xml
http://aadaam.dev.ischmerosok.hu/oembed/tests/ForumTest.html
Usage:
$manager = ProviderManager::getInstance();
$manager->provide($url,$format)Where format is a string and one of:
xml json array serialized object
Usage of object is recommended.
There's a template for objects to render HTML direcltly (with my own LazyTemplateEngine which is about 10-20 lines of code, and included :), you can use it like:
$manager = ProviderManager::getInstance();
$obj=$manager->provide("http://www.youtube.com/watch? v=EQqJSAOOmGI","object");
$html=$obj->renderClass();You can add more providers in the providers.xml file. A non-OEmbed provider gets his XML node as a SimpleXML element in constructor, and must implement the
boolean match(string url) and mixed provide(string url,string format) functions.
Oh! Requires PHP5 I guess, and uses json_encode() function...
Ohloh computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Ohloh cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Ohloh can generate statistics! It's fast and easy - try it and see!
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.