/*
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 27 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!
You won’t get to third base with these songs unless you’ve lived life, not unafraid, but unafraid to live.
A few hours ago my friend Nathan emailed to me gifts. Gifts of new music are always welcome around here (Thanks Mr. K). And as I ride eastward from Chicago aboard a bustling Amtrak train towards East Lansing Nathan’s latest release Methodist Girls is the perfect traveling companion.
Methodist Girls opens with Sloppy Love. For me this doleful beauty elicits a poignant depiction of our human hearts. How emotions get jostled from lover to lover. Eventually we grow jaded, lovelorn and even cynical. But we plod on hoping and searching for love, and at times we find it no matter how fleeting or lopsided. Continue reading “nathan k. | methodist girls”
It’s official, I got a girl crush. Kitten is the band. Chloe Chaidez is the object of my affection. I got it bad ya’ll. Yeah, I know and I am just as surprised too. Let’s get this straight. I am not some floosy easily enamored by a demi-rock Pop-goddess with the stage presence of a modern day Madge Ciccone (but with prettier and softer edges than M. Sorry Ms. Material Girl). At first brush Kitten is Madonna, Taylor Dane and Cyndi Lauper-ish, but with extra sprinkles and sweeter glitter. Yet, her sound isn’t as simplistic as it seems. There exists depths of influence and elements with deep roots from the late 60’s and 70’s. A heavy dose of the bands stemming from the British Invasion. Along with a spattering of divergent elements as well. I musn’t forget her supporting cast. Guitarist Andy Miller and bassist Chris Vogel bring the goods and then some. Kitten is purely hard candy-Pop with an independent spirit. It’s at times a funkier, more often than not a post-punkier scope and orchestration. She’s like a jawbreaker or an all-day Day-Glo sucker. Kitten’s self-titled debut album is an alt sort of Pop too, which doesn’t don primary colors. No, hers is an ultraviolet and star splashed fluorescent patina. Yes, I have a genuine and unapologetic girl crush indeed. Continue reading “I Was There: The Shelter, Detroit, Michigan | Kitten”
A cathedral of sound where within a soul can finally know rest.
Cloud Boat is a duo of two (Sam Ricketts & Tom Clarke), but they bring together the pieces of countless souls. Tom Clarke has a voice chiseled from the light just reaching us after light years of travel. His is a voice alive with dead things. It is the relic of hope and fear, it is a sweet drop of sound which enters our collective ears and ignites the spark of life. A sound particle on which the first steps of resilience are built Continue reading “cloud boat | model of you | our sunday best”
Instant classic Hip Hop duo The Other Guys sync up with Von Pea and Donwill of Tanya Morgan for the offical video of their latest single, Blow My Mind. The track is one of 13 from their upcoming HiPNOTT Records debut album titled Seeds of Ambition. Production credit by The Other Guys. Blow My Mind has Isaiah verbally sparing with Von Pea and Donwill over mellow fellow beats, making the track sound effortless and giving listeners a glimpse of what’s to come on the forthcoming album. Continue reading “the other guys | blow my mind | official video”
Jessy Lanza gives good head over heels music. Her crystalline and skittish beats, within seconds the bass drops all rubbery and buoyant. Then, at last her dreamy vocals kick in all sexy ala Janet Jackson-esque and it’s giving me goosebumps on my frontal cortex. Dip me in this all day every day. Continue reading “jessy lanza | you and me | hyperbub 10.2 | 2nd 10th anniversary compilation”
PS I Love You are a couple of guys (Paul Saulnier and Benjamin Nelson) from Ontario, Canada who have a tendency of wearing their northern hearts on their northern sleeves. And for lots of reasons, it is a good and noble thing to do. Why? Well, for starters as listeners we get the end results of their lived lives. How they interpret the seconds, hours and days of their existence. It’s all there, the piteous lows and the dizzying highs. An artist’s thoughts dipped into the ink; the blood, sweat and tears written into musical journal entries. Continue reading “ps i love you | for those who stay | remix ep”
Fractures (Mark Zito) delivers a sure hit with his latest Won’t Win.. The lead single, from the upcoming Fractures EP release, ebbs with tension which feels like a slight constriction about one’s heart. Surely, there is trouble in the kingdom of love. And as I watched the vid I noticed a lot of the frames are back-lit wit red (passion), green (jealousy) and blue (peace and tranquility). The subtext can be easily read as the color spectrum representation of human relationships. No? And get this, the Fractures EP drops July 4th, the day in the U.S where the literal fireworks fly. Is this all some sort of mad coincidence? No matter. Continue reading “fractures | fractures ep | won’t win | official video”
Melbourne, Australia-based Cut Copy have made us very happy as of late. Firstly, the forthcoming release of the deluxe re-issue of the bands classic Free Your Mind album. The release features 5-additional tracks, and if that ain’t reason to clap your hands together, then what is? Continue reading “cut copy | free your mind | deluxe version”
An incredible debut album. Your ears and heart have no chance.
Wiscinsonites have reason to puff out their collective chests. Why? Well fellow brothers (and sister Monica Martin) in arms PHOX just released their beautiful self-titled debut album and it is an ode to joy. And if you heard, and fell head over heels with PHOX’s previous Confetti EP, expect more of the same here. No, not really expect more and more is exactly what their beautifully well structured album delivers. Continue reading “phox | phox”
Space Flakes have been laying low for a long minute, and now I know what they’ve been up to. I suspect in their public absence they have been busy gathering new material. A bit of star dust here and a little magic there. Musicians are alchemists of sorts, turning sound into pure gold.
The production duo comprised of Sjaak Kassies and Mark Stahli are masters at crafting dynamic and propulsive music. Music which understands you more than you understand it. Their latest, Stage The Stage is a perfect example of what they do best. So, let the music play. Peace. Continue reading “space flakes | stage the stage | official video”