Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('plugins_loaded','add_cbs_embed');
- function add_cbs_embed() {
- wp_embed_register_handler( 'cbsvideo', '#https?://(www\.)?cbs.com/.*?/video/\?pid=([^&]*).*#i', 'wp_embed_handler_cbsvideo' );
- }
- function wp_embed_handler_cbsvideo( $matches, $attr, $url, $rawattr ) {
- $pid = $matches[2];
- if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
- $width = (int) $rawattr['width'];
- $height = (int) $rawattr['height'];
- } else {
- list( $width, $height ) = wp_expand_dimensions( 400, 300, $attr['width'], $attr['height'] );
- }
- return apply_filters( 'embed_cbsvideo', "<object width='400' height='300'><param name='movie' value='http://www.cbs.com/e/".esc_attr($pid)."/cbs/1/'></param><param name='allowFullScreen' value='true'></param><param name='allowScriptAccess' value='always'></param><param name='FlashVars' value='config=http://www.cbs.com/thunder/player/1_0/partner/cbs/skin_cbs_norelated'></param><embed width='".esc_attr($width)."' height='".esc_attr($height)."' src='http://www.cbs.com/e/".esc_attr($pid)."/cbs/1/' allowfullscreen='true' allowScriptAccess='always' type='application/x-shockwave-flash' FlashVars='config=http://www.cbs.com/thunder/player/1_0/partner/cbs/skin_cbs_norelated'></embed></object>", $matches, $attr, $url, $rawattr );
- }
Advertisement
Add Comment
Please, Sign In to add comment