(Archive URL) http://www.twitch.tv/paperbat/v/323486192
*/
function wpcom_twitchtv_shortcode( $attr, $content = NULL ) {
$attr = extract( shortcode_atts( array(
'height' => 378,
'width' => 620,
'url' => '',
'autoplay' => false
), $attr ) );
if ( empty( $url ) )
return;
preg_match( '|^http://www.twitch.tv/([^/?]+)(/v/(\d+))?|i', $url, $match );
$width = (int) $width;
$height = (int) $height;
$autoplay = var_export( filter_var( $autoplay, FILTER_VALIDATE_BOOLEAN ), true );
$user_id = esc_attr( $match[1] );
$video_id = 0;
if ( !empty( $match[3] ) )
$video_id = (int) $match[3];
/** This action is documented in modules/widgets/social-media-icons.php */
do_action( 'jetpack_bump_stats_extras', 'twitchtv', 'shortcode' );
if ( $video_id > 0 ) {
// Archive video
return "";
}
$html = "";
return $html;
}
add_shortcode( 'twitch', 'wpcom_twitchtv_shortcode' );
add_shortcode( 'twitchtv', 'wpcom_twitchtv_shortcode' );