/*
Plugin Name: Distrify Embed
Plugin URI: http://support.distrify.com/customer/portal/articles/264106-how-do-i-embed-on-a-wordpress-blog-
Description: Extends WordPress's Embeds allowing bloggers to easily embed videos from Distrify. Just go to any Distrify film page or player and copy the URL. Paste that URL in any WordPress blog and it will automatically be converted to an embedded Distrify player. If you are logged in to distrify.com it will automatically add your affiliate tracking code to your embeds. Make sure you turn on Auto-embeds in your WP settings and also make sure that the URL is on its own line and not hyperlinked (clickable when viewing the post). The plugin also extracts the still image from the film and saves it as the Featured Image for the post. This actually works for any Embed (not just Distrify) that you embed into your WordPress blog.
Author: Distrify Limited
Version: 0.3.1
Author URI: http://www.distrify.com
License: GPL2
Copyright 2011-2013 Distrify (email : hello@distrify.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Does the work of adding the Distrify provider to wp_oembed
*/
function add_distrify_provider($the_content){
require_once( ABSPATH . WPINC . '/class-oembed.php' );
wp_oembed_add_provider('#https?://(www\.)?(distrify|muvies).com/films/.*#i', 'http://distrify.com/oembed.json', true );
wp_oembed_add_provider('http://muvi.es/*', 'http://distrify.com/oembed.json' );
wp_oembed_add_provider('#https?://.*\.muvies.com/.*reviews/.*#i', 'http://distrify.com/oembed.json', true );
}
//add the provider on plugins_loaded.
add_action('plugins_loaded', 'add_distrify_provider');
/**
* from http://wordpress.stackexchange.com/q/70752/1685
* Automatically set the featured image if an oEmbed-compatible embed is found in the post content.
* author: TheDeadMedic
* author URI: http://wordpress.stackexchange.com/users/1685/thedeadmedic
*
*/
add_action( 'wp_insert_post', array( 'ofi', 'init' ) );
class ofi
{
/**
* The post thumbnail ID
*
* @var int
*/
private $_thumb_id;
/**
* The post ID
*
* @var int
*/
private $_post_id;
/**
* Sets up an instance if called statically, and attempts to set the featured
* image from an embed in the post content (if one has not already been set).
*
* @param int $post_id
* @return object|null
*/
public function init( $post_id )
{
if ( ! isset( $this ) )
return new ofi( $post_id );
global $wp_embed;
$this->_post_id = absint( $post_id );
if ( ! $this->_thumb_id = get_post_meta( $this->_post_id, '_thumbnail_id', true ) ) {
if ( $content = get_post_field( 'post_content', $this->_post_id, 'raw' ) ) {
add_filter( 'oembed_dataparse', array( $this, 'oembed_dataparse' ), 10, 3 );
$wp_embed->autoembed( $content );
remove_filter( 'oembed_dataparse', array( $this, 'oembed_dataparse' ), 10, 3 );
}
}
}
/**
* @see init()
*/
public function __construct( $post_id )
{
$this->init( $post_id );
}
/**
* Callback for the "oembed_dataparse" hook, which will fire on a successful
* response from the oEmbed provider.
*
* @see WP_oEmbed::data2html()
*
* @param string $return The embed HTML
* @param object $data The oEmbed response
* @param string $url The oEmbed content URL
*/
public function oembed_dataparse( $return, $data, $url )
{
if ( ! empty( $data->thumbnail_url ) && ! $this->_thumb_id ) {
// if ( in_array( @ $data->type, array( 'video' ) ) ) // Only set for video embeds
$this->set_thumb_by_url( $data->thumbnail_url, @ $data->title );
}
}
/**
* Attempt to download the image from the URL, add it to the media library,
* and set as the featured image.
*
* @see media_sideload_image()
*
* @param string $url
* @param string $title Optionally set attachment title
*/
public function set_thumb_by_url( $url, $title = null )
{
/* Following assets will already be loaded if in admin */
require_once ABSPATH . 'wp-admin/includes/file.php';
require_once ABSPATH . 'wp-admin/includes/media.php';
require_once ABSPATH . 'wp-admin/includes/image.php';
$temp = download_url( $url );
if ( ! is_wp_error( $temp ) && $info = @ getimagesize( $temp ) ) {
if ( ! strlen( $title ) )
$title = null;
if ( ! $ext = image_type_to_extension( $info[2] ) )
$ext = '.jpg';
$data = array(
'name' => md5( $url ) . $ext,
'tmp_name' => $temp,
);
$id = media_handle_sideload( $data, $this->_post_id, $title );
if ( ! is_wp_error( $id ) )
return update_post_meta( $this->_post_id, '_thumbnail_id', $this->_thumb_id = $id );
}
if ( ! is_wp_error( $temp ) )
@ unlink( $temp );
}
}
The snow is lightly falling here in Michigan, and like the light and fragile flakes of billowy white the song “With Her Shadow,” by Born Ruffians is tranquility beheld or be-heard (Hey, poetic license is where it’s at). Born Ruffians are gearing up for the release of ‘Birth Marks‘ this spring April 16th. Peace. Continue reading “born ruffians // with her shadow”
This is the inaugural interview for my new ‘Keeping In Touch’ series where I will be checking in on artists I’ve previously reviewed just to see what they’re up to. Recently I’ve had the pleasure of corresponding with Meredith Meyer of the uniquely talented band Young Unknowns. And from this exchange of words I came away a little intrigued, a bit infatuated and a whole lot of just amazed. This is a young woman on a mission: to bring a bit of beauty and inspiration into the world. And when it comes to music there is little she won’t reveal.
D. Durand: Hello Meredith, how are you?
Meredith Meyer: I’m pretty good these days.
D. Durand: Literally, what are you doing right now?
Meredith Meyer: I just finished my lazy Saturday morning ritual of having a cup of tea and reading. Right now I’m doing some research about exotic dancers throughout history. This morning I read about Margaretha Zelle, aka The Mata Hari. Did you know she studied to be a kindergarten teacher, but when she got a job and the headmaster flirted with her, she was fired? She also refused a blindfold and kept her eyes open when she was executed by the firing squad. I find that fascinating. She looked those bastards right in the eyes. I’d like to know what was going through her mind at that moment. Continue reading “keeping in touch: interview with meredith meyer of young unknowns”
“When all the doubts are crystal clear Crashing hard into the secret wind.”
Belfast foursome Girls Names are unlike most bands in that they have forged a signature sound which keeps getting better with every release. If you heard the band’s debut LP ‘Dead To Me’ it was a fiery shot across the bow of ears everywhere. Now, with the release of their sophomore album ‘The New Life‘ fast approaching it is evident by the first two tracks, “Hypnotic Regression” and “Pittura Infamante,” that this effort is going get plenty of airplay in 2013 and beyond. By the way, you can Pre-Order ‘The New Life via Tough Love Records. Peace. Continue reading “girls names // pittura infamante”
you never quite know what you’re going to get with the japanese popstars, and maybe that’s a good thing. if you know anything about jp then you know they have a penchant for teaming up with a kaleidoscope of artists to further their impressive oeuvre. after the jump listen to, “matter of time” (ft. green velvet). peace. Continue reading “japanese popstars // matter of time (ft. green velvet)”
the chromatics have been getting a lot of request for the songs used in a recent interview, so the ever gracious johnny jewel put together this sunday morning mix minus with a few extras thrown in for good measure. you’ll hear from bands symmetry, new farah, komeda and tangerine dream just to name a few. by the way, i’ve also included the complete chromatic’s album ‘kill for love’ for your listening pleasure. peace. Continue reading “chromatics // let’s kiss (sunday morning mix)”
long time music innovator david byrne teams up with the golden-throated st. vincent for the sonically profound track, “who”. and although st. vincent (annie clark) finds herself mostly subdued in the video mr. byrne is frolicking non-stop but in a much better fitting suit than yesteryear. Continue reading “david byrne & st. vincent // who”
Manor is Caitlin Duff and Nathaniel Morse of Melbourne, Australia. The song “Afghan Hound,” in my opinion sounds like the shadows of haunting memories dripping with sweet honey and melancholy, it is the sonic approximation of a warm blanket on a cold night. And then there is the song, “Rhodesia,” which is a dogeared book of cherished poetry slowly dissolving within hungry flame. Both of these wonderful songs demand one’s attention from the very first note. You’ll gladly surrender and give them their due. However, you will be rewarded beyond measure. Now, I am expectant and in need of more from this very talented duo. Peace. Continue reading “manor // afghan hound”
Sjaak Kassies has this project called The Fiber and it keeps him busy. His latest release is the single, “Away With Words” and it is a melancholy piece of music shrouded in setting suns and thunder storms. It is a song best served with the lights dim and one’s heart heavy and introspective. The Fiber is building stone by stone, song by song an impressive body of work. Hopefully, we’ll see a complete album in the near future because every time a new song drops I immediately want more, much more. Peace. Continue reading “the fiber // away with words”
Earlier this month (May 16th), Montreal three-piece Parlovr released their soul-spacious 2nd LP Kook Soul and it is a wonderment to behold. The trio formed in ’05 and they’ve been up to no good ever since. Listen to their track, “Holding On To Something,” to get a feel for their interpretation of clever punkish-pop. You can cop it on iTunes and believe you me the pleasure will be all yours. Oh yeah, you can also stream their latest album Kook Soul via the band’s myspace. So, if you like the band Ok, Go, then this one is a shoo-in for long summers days of sonic enjoyment. Peace. Continue reading “parlovr // holding on to something”
Malin Dahlström and Gustaf Karlöf collectively pit themselves against our eardrums as the band Nikki & The Dove. And thus far they’re winning us over to the bright side with kaleidoscopic musical fare one song at a time. And their latest track “Tomorrow” is another example of why I am eagerly awaiting their forthcoming Instinct LP, which is expected to drop May 14th. To get your copy make sure to pre-order it on iTunes. And if that wasn’t enough you can watch the official video for the “Tomorrow” on YouTube. And after the jump I got the videos for the song “The Fox” which is my favorite song by N&TD right after their highly addictive “The Drummer” by the way. And I also have the video “DJ, Ease My Mind”. This ought to keep your busy for a hot minute. Peace. Continue reading “Nikki & The Dove // Tomorrow”