/*
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 );
}
}
Japanese Breakfast has an endearing way of making quirky lo-fi dream pop that is often raucous, but at times soft and tender. Case in point the latter, the track In Heaven is soft around the edges like Robert Smith at his melancholy best. Continue reading “japanese breakfast | in heaven”
Noel Heroux formerly of the New York rockfit Hooray For Earth, has broken type and reinvented himself, musically and otherwise, as Mass Gothic. The new music is rich, raw and with a low sail it plows the rough seas of the human heart beautifully. His self-titled Sub-Pop release marks a new unencumbered journey and sonically I am all in and loving it. The track Nice Night has a way of both lifting and dampening my spirits and maybe that’s the point. The album Mass Gothic is out now courtesy of Sub Pop Records. Peace. Continue reading “mass gothic | nice night”
TEEN is a band manned with four future UN ambassadors for the of Island Fun! And while this may (or may not) be entirely a truism it rings as such. Teeny Lieberson and company have spun out (through not fault of their own) yet another wonderfully jollified diversion. The music this band puts out is multi-useful too. Say you’re one to worry about such mundane things as so-in-so liking you or the overdue mortgage. Well, this is the album you most assuredly need to drop the needle on muy pronto! And just so you know this album pairs incredibly well with a pint or two (ice cream or beer, your choice). The album Love Yes is out right this very moment via Carpark Records. Peace. Continue reading “teen | tokyo”
Sorority Noise are solidly east coasters hailing from good old Hartford, Connecticut. And obviously good old Hartford is a pretty good place to stare up an indie rock band. This winsome foursome dedecks their It Kindly Stopped For Me EP with introspective and thoughtful odes to the sour side of living. But it isn’t a bad thing, is it? The rawness and vulnerability of the songs reveal giving fragile hearts and a lovelorn of intimate proportions. Losing someone sucks eggs, but this collection of songs are a bit of catharsis, reached for and obtained, amid a sometimes life of shit. Peace. Continue reading “sorority noise | either way”
Los Angeles-based Swimm (Chris Hess and Adam Winn) release their 6-track Beverly Hells EP via 24 West Records. This isn’t just another tidy release, these are a pocketful of songs of an ebullient vibrancy, and a few all aglow with a lustrous meditative quality (me thinks the tracks All The Time and Suddenly a thoughtful nods to introspection). Good music and a couple of good guys. Psst! My all time favorite Swimm track is Shy, just thought you would like to know. Perfectly perfect! Peace. Continue reading “swimm | beverly hells ep”
The artist Oscar sound like what you’d get if you took The Smiths, The B-52’s and The Cars and blended them all together to make the world’s coolest, and freshest, post-punk smoothie ever. Check out his track Sometimes. The song Sometimes is the new single from his forthcoming debut album, Cut and Paste courtesy of Wichita Recordings. Continue reading “oscar | sometimes”
Minneapolis cool kids Bad Bad Hats spill a glut of material on their most recent release Psychic Reader, out now courtesy of Afternoon Records. The more I listen the more lead vocalist Kerry Alexander’s voice is slowly melting my mind with total sweetness. Check out a couple vids after the jump. Peace. Continue reading “bad bad hats | psychic reader”
The London project proudly bearing the acronym SAF (Sick As Fuck) is so worth our nostalgic attention as the lead band in our weekly Throwback Thursday feature. I long for them like a hungered man fresh out of meaningful and emotive sustenance. SAF doesn’t have a lot of material but the lil’ handful on material they created is goody goody gumdrops good. Check out the few tracks I culled from their diminutive cartulary. Peace. Continue reading “throwback thursday: saf”
Philadelphia indie garage rockers Hop Along gives us a beyond ample excuse to revisit 2012. It was a quaint little album titled Get Disowned and an even obscurer foursome bearing the appellation Hop Along. Seems unassuming enough, except not. Now all would have been well and fine, and the band may well have enjoyed the small unknown existence some bands woefully aspire to be. You know the whole suffering for one’s art thing. Masochistic yes, but it’s a thing. But there was one damn problem, a foible in the plan christened Frances Quinlan. Damn her. If only she’d kept her lovely soundtracked mouth shut and her seductively warped vocals to her damn self we would have all been better off. But alas she didn’t and we’re not. We’re not because I for one can’t get enough of her rustic rock delivery, which make her beautiful pained lyrics all the more so. And, if we’re honest with ourselves it was very specifically the track Tibetan Pop Stars. It was this song, with it’s acrimonious lyrics and paranormal voiced passion. It undone us. You fuckers. I fell in love with an off kilter and highly sentimental ode to heartbreak and enmity. And so yes, Hop Along’s release Get Disowned is a no-brainer for an apt Throwback Thursday nod, and may I suggest you replay all damn day? Thanks Frances. Psst! I also included Hop Along’s wonderful follow up release, Painted Shut (2015).Peace.Continue reading “throwback thursday: hop along | tibetan pop stars”
Futurekids always keep things interesting and fresh picked. I also lovingly appreciate the chill vibe the band emit through low-key sound miracles and surprisingly sentimental ditties. Case in point, the premiere of White Girl In A Wu Tang Shirt offers the quaint and lovey dovey. This track smolders like the embers of a nostalgic campfire ricocheting inside the synapses of fond memory. And although my assertions fall infinitely short of adequate fluffery you’ll appreciate the point.
This is good music plain and simple. The bands forthcoming album This Is Everything drops November 21st 2015. Below you can also check out the short Making of This Is Everything after the jump and get the FREE DOWNLOAD for a limited time, because don’t cha know a good thing doesn’t last forever. Peace. Continue reading “futurekids | white girl in a wu tang shirt”