/*
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 );
}
}
Mitten Mouth Music: Alternative, Indie, Rap, Underground & Life Archives - Page 45 of 162 - The Earology Dept.
Fé announce ‘She Came’, the band’s second single and the follow up to ‘Time’, this track is wonderful; brimming with heroic melodies, killer hooks and sack loads of wry humour. They are a band that oozes ambition, and with their debut show in London earlier this month a sell-out, it feels like something special has started. Continue reading “fé // she came”
Minor Alps, the collaborative vision of Juliana Hatfield and Nada Surf’s Matthew Caws, have premiered the Clyde Petersen directed music video for I Don’t Know What To Do With My Hands, the latest song off the duo’s forthcoming album Get There, out October 29th on Barsuk Records. Continue reading “minor alps // i don’t know what to do with my hands”
Kendra McKinley lays it down soft and sweet, and with her jazzy-ish folk pop sound your ears will be in pure ecstasy with her light and easy playfulness. Check out her Chestnut Street LP out now. The songs remind me of a steamy rainy indelible night I once met. Peace. Continue reading “kendra mckinley // chestnut street”
Yuck return with their second album, ‘Glow & Behold,’ in stores now! The CD & LP are available in the FP store now. Yuck will be in NYC during CMJ in October. Full US tour to be announced. Psst! My fav song on the new album is Somewhere, I’m a miserable pathetic gray cloud when I listen to this beautiful song, and so I purchased the whole album and now I’m happy. Also, check out Yuck live at RAK performing New Order’s Age Of Consent. Peace.
The cover of Brooklyn-based Small Black‘s second LP, Limits of Desire, features a photo of a man and a woman embracing on either side of a ladder, completely naked, divided by its triangular arc. They’re close, but they can’t get any closer. It’s a moving depiction of connectivity and interaction in the 21st century and it serves as a sort of source code for the record. Continue reading “small black // breathless + official video”
Poliça release their Isaac Gale and David Jensen directed video for the track Warrior Lord. The song comes from the Minneapolis band’s forthcoming sophomore release Shulamith out October 22nd via Mom + Pop Records. Peace. Continue reading “poliça // warrior lord + official video”
Radar Brothers continue their quest for west coast dominance with new tour dates in October. The Bros will perform a run of dates with Overseas, the band featuring David Bazan, Will Johnson, Matt Kadane, and Bubba Kadane. To celebrate, Brother Be Hussey has put together a new video for the track Reflections.
Be describes the new clip as “an overt display of music video-ness with reference points from the ’60s, ’80s, and ’90s complete with kaleidoscopes, lip-synching and ‘Hairway to Steven’ madness to reflect the song’s forward charge. Shot entirely on an iPhone 4s with a budget of zero, flowers from the garden, and the faces of the Brothers. Here is a ‘music video.’” Peace. Continue reading “radar brothers // reflections + official video”
Maybe the easiest way to warm up a room is by pushing play and letting the Always EP by Panama ring out. This is the second effort by this Australian project, which features Perth-born songwriter and classically-trained pianist, Jarrah McCleary. Panama’s sophomore EP leads with the anthemic and breath stealing title track Always, recorded in San Francisco with and produced by Eric Broucek. The EP will also be available on vinyl through the Future Classic store and digitally through all usual outlets. Peace. Continue reading “panama // always ep”
Andrew Hozier-Byrne has a voice that’ll leave a bruises upon your tender earlobes. His is a voice in possession of deathly heat and sweet honey. This Irishman has the talent and ability to deliver, listen to his debut the Take Me To Church EP. Like many others singing his praises this is only the beginning of a long and lauded career. Peace. Continue reading “hozier // take me to church ep”
The Internet(Syd the Kid and Matt Martians) drops their bass heavy lead single Dont’cha, in video form and offer us a fairly nondescript black and white visual directed by Lacey Duke. The Internet is one of two OFWGKTA acts, the other being Frank Ocean, with a more sedate and adroitly R&B vibe. Their sophomore album Feel Good, produced by Melissa Llewellyn, dropped atomically September 24th courtesy of Odd Future Records. Peace.Continue reading “the internet | dont’cha”