/*
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 Earology Dept. - Page 7 of 173 - Where the food sounds good, and the music is pretty tasty too.
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
caleb groh | let it groh
calab groh | let it groh
Caleb Groh may currently reside in the new alt music Mecca of Nashville, Tennessee but what does that really mean? Perhaps it means and meant everything, because no matter what anyone says a change in locale can make (and it most certainly has) a world of difference. The musical evolution of Caleb Groh is so evident even the hearding impaired can tell the difference between now and post Bottomless Coffee . The damning evidence is in plain sight on his 4-track Hot Pop EP and continues on with his current Let It Groh release. Here’s to change, both physical and philosophical. Peace. Continue reading “caleb groh | let it groh”
Radiohead surprises fans by sharing a shelved project originally penned for the James Bond 007 film Spectre. According to the Radiohead camp, “Last year we were asked to write a theme tune for the Bond movie Spectre. Yes we were. It didn’t work out, but became something of our own, which we love very much.As the year closes we thought you might like to hear it. Merry Christmas. May the force be with you.” Not really sure why but this would have been a great addition to the Spectre Soundtrack but their lose is our gain. Get the FREE DOWNLOAD after the jump. Makes me happy. Peace. Continue reading “radiohead | spectre”
Don’t sleep on Kalis Uchis. Wake up and smell this especial blend of Colombian transplanted neo-pop candy. But this isn’t just confection sweet (more like a side of sweet) it’s a bit more grown up and complicated for adolescent mentalities alone. There is plenty protein and carbs on this plate and there’s enough for seconds too. What else is cooking on the stove.? Continue reading “kalis uchis | por vida”
Check out the latest single Miranda In Her Room a collaborative duet between The Davenports’ Scott Klass and Shirley Simms (of Magnetic Fields fame). This folkish and waltzy ode is like a fine sip of bourbon on a rainy day. Also, Brooklyn band The Davenports lead vocalists Scott Klass sings semi-doleful lyrics within the sketch work of the beautifully arranged track Away From Me. The single is one of several the band has released this year including 15 Steps + Away From Me EP. Here’s hoping for a proper (and new) album in the coming year. Peace. Continue reading “the davenports | miranda in her room”
Tove Lo & G. Weber give us their platinum take on superstar R&B rocker The Weeknd’s track Real Life. I love the lost in the groove club feel with its heavy synths and thudding bass that makes your body work. For more of Tove Lo make sure you check out her impressive debut the Queen of the Clouds album out now courtesy of Universal Music AB. Peace. Continue reading “tove lo & g. weber | real life | the weeknd cover”
Devon Welsh is the principle song writer and lead vocalist of Majical Cloudz. But in many ways he is the beating heart of the outfit. Take the title track track Are You Alone is a sparkling gem of solemn blue. The kind of song you keep tucked inside the folded creases of a heavy blanket when you want to hide away from the world. The Majical Cloudz album Are You Alone is out now courtesy of Matador Records. Peace. Continue reading “majical cloudz | are you alone”
The band TEEN releases the first single All About Us and immediately I am smitten. The track is riddled with 80s sound references. All About Us exudes a presence kinda like Prince met Devo and crafted magic smears of colorful pills, that ain’t a bad thang at all. According to their label Car Park Records the TEEN’s new album Love Yes, explores the disharmony and empowerment that both sexuality and spirituality can create within the modern woman’s psyche. Universal ideas of loyalty, pleasure, purity, power, aging, and love are confronted with a knowable specificity. There is a quality of wholesomeness, but also an edge—a kind of wise anger and electricity.
Look for the forthcoming release to hit the ground running February 19th 2016 courtesy of Car Park Records. Peace. Continue reading “teen | all about us”
Every decade or so out of the sheer need for something new, profound and genre amplifying the psychedelic rock scene gets reshuffled (or re-imagined). San Francisco psyche rock outfit Heron Oblivion is the result of this newly dealt hand. The music is rare grade euphoria. The self-titled album Heron Oblivion is seven quality songs that’ll transport you into the low light of full moons and the way heavy depths of deep thought. Look for their Heron Oblivion to drop March 4th 2016 courtesy of Sub Pop Records. After the jump you’ll notice I included the 13 minute and 34 second splendor of Fernwood. Peace.
Natalie Prass is a favorite here at The Earology Dept. And honestly it is hard not to fall head over heels for her beautifully nuanced voice. On her latest release the Side By Side EP she explores and interprets several songs. She unfurls creativity: searching those interesting and clever facets only she can see and tease out. And that voice… it’s as pure as the faultless snow atop of the Himalayan mountains. After the jump check out her impressive take on Simon & Garfunkel classic Sound of Silence. And just because I think you ought to know I am also introducing to what is perhaps the greatest cover of Janet Jackson’s Any Time, Any Place. The track appears as the B-Side on her Bird of Prey single release. Peace. Continue reading “natalie prass | sound of silence”
Last night we attended the annual Honda Christmas Party and just wow! Although it was a chilly evening in The D inside the Honda event tent DJ Scout kept the mood live and poppin’! We mingled with other bloggers, journalists and various automotive industry glitterati. Key Honda/Acura personal were clear and present too, they shook hands and answered lots of questions. So, my favorite blogger and I grabbed a drink and ventured forth to see what we could see.
Acura NSX 2017
And as we donned our media badges I looked around and lo and behold! LAWD HELP ME! Front and center was a dark and sparkling dream come true: the utterly irresistible Acura NSX. But this isn’t just 100% pure eye candy either. The all new 2017 Acura NSX has got equally impressive stats and with 500+ horsepower it has more than enough to swing its way out of any modern era automotive fight club. This luxurious land-based rocket ship priced at a modest 156K and you definitely get your monies worth and then some. Last night Honda had a big surprise (among many surprises) and revealed that the first production car off of the line will be up for grabs, for anyone. That’s right. VIN 001 for the 2017 Acura NSX will be auctioned off for charity at Barrett-Jackson in January. To see this beautiful beast up close and personal make sure to mark your calendar and attend the North American International Auto Show Detroit January 11th 2016.
Okay. The Acura NSX news was good intel but there’s more. It was a night of exciting reveals and here is another little gold nugget about the up and coming fourth generation Honda Ridgeline. I can’t say divulge much and some I can’t even mention until NAIAS. But, I will say this, we got a special “no cameras allowed preview” of the beautifully made Honda Ridgeline 2016, and it is a handsome son of a gun too. When the curtains pulled back and it rolled out onto center stage we all oohed and aahed like the automotive junkies that we are. Honda says the newly designed mid-size truck will offers, “incredible packaging and fuel efficiency.” But let me say this: incredible packaging and fuel efficiency aren’t the only things the all new Honda Ridgeline has offer but for now though mums the word. Sorry. Not sorry.
Honda Ridgeline 2016
Okay here IS something I can talk about and that’s the teaser image for the Acura Performance Concept (check it out below). It looks like something born out of Elon Monk’s wet dream but surely it’s gonna’ impress all of us. And again we’re going to have to collectively hold our breath until the North American International Auto Show Detroit for the big reveal. I spoke with Acura Design Chief Jon Ikedo and he is very excited (understatement) about what we’re going to see and experience in January.
Acura Performance Concept 2017
We had a great time and the take away is this, never under estimate the beauty, innovation and top quality products from the Honda team. See you at NAIAS January 11th. Get your tickets HERE. Oh I almost forgot! A big thank you to DriveShop USA for the invite. Peace.