Not signed in ( Sign In)


Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentTimeDec 5th 2009 edited
    I have implemented a very quick oEmbed plugin


    needs php5 and the json extension to work (because I'm lazy), bbcode (with inline html enabled) and extendedimg bbcode plugin (here on this forum)
    you can customize it by hand by the way, since it's very simple

    supports photo, video (and probably should work with rich and link as well). For more info... search for oEmbed wordpress 2.9 online and you should see how it works, or see the home page of oEmbed. Supported params for the [oembed] tag are those defined there for requests

    Plugin Name: oembed
    Version: 1.0
    Plugin URI:
    Description: Description for oembed
    Author: $AUTHOR$
    Author URI:

    * Code goes here

    function plugin_oembed_callback($action, $attr, $content, $params, $node_object) {
    $provider = '';
    $attr['url'] = $attr['default'];

    $query = http_build_query($attr);
    $json = file_get_contents(''.$query);

    $out = '';

    $obj = json_decode($json);
    switch ($obj->type) {

    case 'photo':
    $out = "[img={$obj->url}]"
    ."\"{$obj->title}\" by [url={$obj->author_url}]{$obj->author_url}[/url] "

    case 'video':
    case 'rich':
    case 'link':
    $out = $obj->html; break;

    default: if ($action=='validate') return false;

    return $out;


    function plugin_oembed_parse($text) {
    global $OEMBED_BBCODE;
    return $OEMBED_BBCODE->parse($text);

    function plugin_oembed_init() {
    global $OEMBED_BBCODE;
    $OEMBED_BBCODE = new StringParser_BBcode;
    array('inline', 'block'),
    $OEMBED_BBCODE->setCodeFlag('oembed', 'closetag', BBCODE_CLOSETAG_FORBIDDEN);

    add_filter('init', 'plugin_oembed_init');
    add_filter('content_save_pre', 'plugin_oembed_parse');