/*
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 );
}
}
Continue reading "sally shapiro // if it doesn’t rain tonight (digits remix)"
The post sally shapiro // if it doesn’t rain tonight (digits remix) appeared first on The Earology Dept..
]]>The post sally shapiro // if it doesn’t rain tonight (digits remix) appeared first on The Earology Dept..
]]>Continue reading "postiljonen // supreme + video"
The post postiljonen // supreme + video appeared first on The Earology Dept..
]]>On a hot summer day there is nothing like being doused with a chilled tidal wave of Swedish synthpop group Postiljonen. The good vibes aren’t too far away with the good and icy sounds of their single Supreme rippling through your speakers. The track comes from their debut LP Skyer via Best Fit Recordings. Their album drops worldwide July 22nd. You can also pre-order the Skyer below, just click the iTunes button. Peace.
Tracklist
1. Intro
2. Help
3. We Raise Our Hearts
4. On The Run
5. Plastic Panorama
6. Supreme
7. Rivers
8. Skying High
9. All That We Had Is Lost
10. Atlantis
The post postiljonen // supreme + video appeared first on The Earology Dept..
]]>Continue reading "shout of louds // walking in your footsteps + lissvik remix + north american tour"
The post shout of louds // walking in your footsteps + lissvik remix + north american tour appeared first on The Earology Dept..
]]>The Stockholm, Sweden band of five, Shout Out Louds, kick off their North American Tour in support of their enthusiastically received new album Optica. And, as an especial treat the band, along with Merge Records, tapped Prins Thomas Diskomiks to reassemble their loop-to-loop and very dreamy single Illusions. It’s a match made in remix heaven. Make your 2013 a memorable one and catch the band out on tour this summer, and please remember to give ’em my best. Peace.
The post shout of louds // walking in your footsteps + lissvik remix + north american tour appeared first on The Earology Dept..
]]>Continue reading "sibille attar // julian i want to be a dancer"
The post sibille attar // julian i want to be a dancer appeared first on The Earology Dept..
]]>At times the unorthodox approach can yield unusually tantalizing results. Sibille Attar is an apt example of the quirky and offbeat set to music, but what music it is! The Stockholm-based musical roustabout chants her brand of sonic voodoo with the voice of a classically trained chanteuse (seemingly so). Her music is alive with a vibrancy I’m growing more and more partial to with every listen. Julian I Want To Be A Dancer is crisp as a new dew strewn day, and as bouncy as a bumble bee, fat and flying flower head to flower head. Check it out. Peace.
The post sibille attar // julian i want to be a dancer appeared first on The Earology Dept..
]]>Continue reading "the knife // a tooth for an eye + official video & remix"
The post the knife // a tooth for an eye + official video & remix appeared first on The Earology Dept..
]]>Recently, the Stockholm, Sweden band The Knife released Shaking The Habitual courtesy of Rabid Records. This is the sound collectives first studio album since Silent Shout and it’s absurdly fluent in the poly-rhythmic aural nutrients their known for, that’s a compliment. What or who do sound like? Well, if you’re a fan of Gang Gang Dance and the Tune Yards you’ll be happy as a clam with The Knife. After the jump check out the official video for the track A Tooth For An Eye and the Pursuit Grooves Remix. Peace.
The post the knife // a tooth for an eye + official video & remix appeared first on The Earology Dept..
]]>Continue reading "with a light heart // lost at sea ep (our sunday best)"
The post with a light heart // lost at sea ep (our sunday best) appeared first on The Earology Dept..
]]>The Lost At Sea EP by the Swedish band With A Light Heart is a basket full of songs perfect for a walk along coastal environs or a languid drive without any specific destination in mind. Also, this release of four simple, yet beautiful songs feels bigger than the some of its parts. The songs have a sweeping and epic character which rolls like a cleansing and rising tide in the bowl of your eardrums. Here, in the endless diameter of sound is human intimacy radiating gloriously. Each song is imbued with the spectacular essence of the warming sunrise, and by the albums end the moon too is full to bursting with solemn thanks of gratitude. Word is the band recorded it’s new EP in a loft and in a church in Bua, a small quaint village on the west coast of Sweden. How fitting then or telling because these songs have the inner-workings of hymnals and a spirituality which touches your soul like the soothing hand of grace. You can get you own copy via the With a Light Heart’s bandcamp. Peace.
The post with a light heart // lost at sea ep (our sunday best) appeared first on The Earology Dept..
]]>Continue reading "junip // line of fire"
The post junip // line of fire appeared first on The Earology Dept..
]]>New material from the Gothenburg, Sweden-based Junip is always reason to get up out of your seat and shout heavenward. 2013 is off to a pretty good start when you can listen to José González and company performing their first single release “Line Of Fire“. The track is taken from the bands highly anticipated self-titled sophomore spring release which is expected to drop April 23rd. You and everybody else can also download it for free just because. Here’s to new songs from a perennial favorite. Peace.
The post junip // line of fire appeared first on The Earology Dept..
]]>The post the deer tracks // lazarus appeared first on The Earology Dept..
]]>Swedish electro-pop duo, The Deer Tracks, recently premiered the song “Lazarus,” courtesy of We Are Hunted. In the coming weeks you can expect a series of remixes too. Also you can look for the album ‘The Archer Trilogy Pt. 3‘, via The Control Group. It drops on February 12th. Peace.
The post the deer tracks // lazarus appeared first on The Earology Dept..
]]>Continue reading "nima khak // searching all around (for you)"
The post nima khak // searching all around (for you) appeared first on The Earology Dept..
]]>Nima Khak is a resident of Sweden but after listening to his productions you’ll swear up and down he’s an interstellar time traveler. Listen to Nima Khak’s ‘Searching All Around (For You)‘ release via 1:53.2 Records, and it is all one needs to get the night headed in the right direction. The release also features the tracks, “Bitter Sweet” and unconventional “A Tribe Called Quest“. In this posting I’ve also included a September 2012 mix session featuring not only Nima Khak but also fellow DJ alum Bryan Chapman on the Future Underground Show. Peace.
The post nima khak // searching all around (for you) appeared first on The Earology Dept..
]]>Continue reading "kate boy // northern lights"
The post kate boy // northern lights appeared first on The Earology Dept..
]]>the electro swedish-based trio known as kate boy proves once again there is always room aplenty for another synth-based band. the band’s inaugural first toe in the water is the song “northern lights” and it as good to listen to as it is to watch their beautifully shot video. definitely looking forward to more, and of course for the initiated, it is shows that threesomes almost always satisfy. peace.
The post kate boy // northern lights appeared first on The Earology Dept..
]]>