* Blip.tv shortcode is: [blip.tv url-or-something-else] * */ function blip_embed_to_shortcode( $content ) { if ( false === stripos( $content, '/blip.tv/play/' ) ) return $content; $regexp = '!|>\s*)!'; $regexp_ent = str_replace( '&#0*58;', '&#0*58;|�*58;', htmlspecialchars( $regexp, ENT_NOQUOTES ) ); foreach ( array( 'regexp', 'regexp_ent' ) as $reg ) { if ( !preg_match_all( $$reg, $content, $matches, PREG_SET_ORDER ) ) continue; foreach ( $matches as $match ) { $src = 'http://' . html_entity_decode( $match[2] ); $params = $match[1] . $match[3]; if ( 'regexp_ent' == $reg ) { $src = html_entity_decode( $src ); $params = html_entity_decode( $params ); } $params = wp_kses_hair( $params, array( 'http' ) ); if ( ! isset( $params['type'] ) || 'application/x-shockwave-flash' != $params['type']['value'] ) continue; $content = str_replace( $match[0], "[blip.tv $src]", $content ); } } return $content; } add_filter( 'pre_kses', 'blip_embed_to_shortcode' ); // [blip.tv ?posts_id=4060324&dest=-1] // [blip.tv http://blip.tv/play/hpZTgffqCAI%2Em4v] // WLS function blip_shortcode( $atts ) { if ( ! isset( $atts[0] ) ) return ''; $src = $atts[0]; if ( preg_match( '/^\?posts_id=(\d+)&[^d]*dest=(-?\d+)$/', $src, $matches ) ) return ""; elseif ( preg_match( '|^http://blip.tv/play/[.\w]+$|', urldecode( $src ) ) ) // WLS return ""; return ""; } add_shortcode( 'blip.tv', 'blip_shortcode' );