function embed_extender_yahoo_embed($hook, $type, $returnvalue, $params) { $url = $params['url']; $guid = $params['guid']; $videowidth = $params['videowidth']; // only return if the url matches what we're doing if (strpos($url, 'video.yahoo.com') != false) { if (!preg_match('/(http:\\/\\/)?(video\\.yahoo\\.com\\/\\?vid=([0-9]*))/', $url, $matches)) { return $returnvalue; } $videourl = $matches[3]; if (!$videourl) { //malformed url return '<p><b>' . sprintf(elgg_echo('embedvideo:parseerror'), 'yahoo') . '</b></p>'; } videoembed_calc_size($videowidth, $videoheight, 425 / 320, 24); $embed_object = videoembed_add_css($guid, $videowidth, $videoheight); $embed_object .= "<embed src=\"http://d.yimg.com/nl/cbe/paas/player.swf\" wmode=\"opaque\" flashvars=\"vid={$videourl}\" type=\"application/x-shockwave-flash\" width=\"{$videowidth}\" height=\"{$videoheight}\"></embed>"; // returns our object code return $embed_object; } }
/** * main hulu interface * * @param string $url * @param integer $guid unique identifier of the widget * @param integer $videowidth optional override of admin set width * @return string css style, video div, and flash <object> */ function videoembed_hulu_handler($url, $guid, $videowidth) { // this extracts the core part of the url needed for embeding $videourl = videoembed_hulu_parse_url($url); if (is_numeric($videourl)) { if ($videourl == 1) { return '<p><b>Only embed supported for hulu.com</b></p>'; } else { return '<p><b>' . elgg_echo('embedvideo:parseerror', array('hulu.com')) . '</b></p>'; } } videoembed_calc_size($videowidth, $videoheight, 512 / 296, 0); $embed_object = videoembed_add_css($guid, $videowidth, $videoheight); $embed_object .= videoembed_add_object('hulu', $videourl, $guid, $videowidth, $videoheight); return $embed_object; }