I wanted to get the list of providers from the oembed whitelist to use in the NFB Video Plugin’s next update for WordPress 3.0.
The global $OEMBED is the variable that stores all my other variables in the plugin, that’s why it’s there.
There’s probably a function somewhere that does this, but I didn’t find it. So, if there’s anyone else who was having difficulty with it, as a temporary solution you could go with something like this:
$INCLUDE_EXTERNAL_BASE_PATH = dirname(dirname(dirname(dirname(__FILE__))));
require_once($INCLUDE_EXTERNAL_BASE_PATH . ‘/wp-includes/class-oembed.php’);
function populate_list_from_wp_oembed_whitelist(){
global $OEMBED;
$wp_oembed = new WP_oEmbed();
$OEMBED->whitelist = array();
foreach($wp_oembed->providers as $provider=>$oembed_url):
array_push($OEMBED->whitelist, $provider);
endforeach;
return $OEMBED->whitelist;
}
$providers = populate_list_from_wp_oembed_whitelist();
** I would have put it in code tags, but apparently it’s not working correctly at the moment.
Working on the next change to the NFB Video Plugin. I’m writing it here, because to be honest we don’t have our official page up yet. Once the page is done, you’ll find more information on the NFB.ca website. Until then! This is what’s coming up…
An issue that came up a few times is how many times the links are being read by the plug-in. Correct, it is a lot of times. So, we’re going to cut down on that if the user so chooses. So the question is…do you want to keep track of your embeds?
1 – I don’t want to keep track of them.
[WARNING : Choosing this option means the plug-in will verify the link every time.]
2 – I’d like to keep them, but leave my oe links tidy when editing my posts.
3 – I’d like to automatically replace my oe links by the embed code
[WARNING : If you don't know HTML or you don't care to go back and have to fix individual posts, you should set your caption options first.]
The second addition I’d like to add in this version hopefully is a separate tab where you can see a list of the last 10/20/30/50/100 links that you embedded on your blog, what post it belongs to and the date. For multiple links on your site, it will indent and show them in Maroon. Why do I want to do this? It’s so you can see if you have duplicate content on your site. Which you don’t want if you like SEO.
Anyways, update more later on the progress.
WARNING : Currently only for NFB (National Film Board of Canada) and Vimeo. As more video sites add oEmbed to their sites and allow auto-discovery, you can use their URLs too.
Woot! Okay, so I finally finished the first version of my plugin. It’s for the National Film Board of Canada, so it’s not hosted with me, but I’ll give you the links you need for it!
Firstly, if you want to download the zip, you’ll find it here.
Basically how it works, you extract it to your plugins directory on your WordPress, activate it, then in settings, you can modify the width/height and let the plugin know if you want to show title/author/provider of the video.
To use it. You post a URL of a film page from http://www.nfb.ca/ or from http://www.vimeo.com/ and the plugin will read the URL when you load the post. It should not mess with URL’s in a link and links without oembed will not try to show the video.
Will be presenting at Wordcamp Montreal 2009.
To see the download/upload the code here.
To find out more about what oEmbed is, visit the website.