SHOW:
|
|
- or go back to the newest paste.
| 1 | add_action('plugins_loaded','add_cbs_embed');
| |
| 2 | function add_cbs_embed() {
| |
| 3 | wp_embed_register_handler( 'cbsvideo', '#https?://(www\.)?cbs.com/.*?/video/\?pid=([^&]*).*#i', 'wp_embed_handler_cbsvideo' ); | |
| 4 | } | |
| 5 | ||
| 6 | function wp_embed_handler_cbsvideo( $matches, $attr, $url, $rawattr ) {
| |
| 7 | $pid = $matches[2]; | |
| 8 | if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
| |
| 9 | $width = (int) $rawattr['width']; | |
| 10 | $height = (int) $rawattr['height']; | |
| 11 | } else {
| |
| 12 | list( $width, $height ) = wp_expand_dimensions( 400, 300, $attr['width'], $attr['height'] ); | |
| 13 | } | |
| 14 | ||
| 15 | - | 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 ); |
| 15 | + | return apply_filters( 'embed_cbsvideo', "<object width='".esc_attr($width)."' height='".esc_attr($height)."'><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 ); |
| 16 | } |