/[drupal]/contributions/modules/emfield/contrib/video_cck/providers/metacafe.inc
ViewVC logotype

Contents of /contributions/modules/emfield/contrib/video_cck/providers/metacafe.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Mon May 12 04:10:54 2008 UTC (18 months, 2 weeks ago) by alexua
Branch: MAIN
CVS Tags: DRUPAL-5--1-3, HEAD
Changes since 1.3: +7 -7 lines
File MIME type: text/x-php
Corrected all errors registered by Coder module in preperation for D6 port
1 <?php
2 // $Id: metacafe.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $
3
4 define('VIDEO_CCK_METACAFE_MAIN_URL', 'http://www.metacafe.com/');
5
6 function video_cck_metacafe_info() {
7 $name = t('MetaCafe');
8 $features = array(
9 array(t('Autoplay'), t('Yes'), ''),
10 array(t('RSS Attachment'), t('No'), ''),
11 array(t('Thumbnails'), t('Yes'), ''),
12 );
13 return array(
14 'provider' => 'metacafe',
15 'name' => $name,
16 'url' => VIDEO_CCK_METACAFE_MAIN_URL,
17 'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_METACAFE_MAIN_URL, array('target' => '_blank')))),
18 'supported_features' => $features,
19 );
20 }
21
22 function video_cck_metacafe_settings() {
23 $form = array();
24 return $form;
25 }
26
27 /**
28 * we're going to handle our own matches, unless someone can come up with a regex that will match this better
29 */
30 function video_cck_metacafe_extract($embed) {
31 // http://www.metacafe.com/watch/479957/gorilla_prank/
32 if ($embed && preg_match('@metacafe\.com/watch/(.[^/]*)/(.[^/]*)/@i', $embed, $matches)) {
33 return $matches[1] .'/'. $matches[2];
34 }
35 else if ($embed && preg_match('@metacafe\.com/watch/(.[^/]*)/(.*)@i', $embed, $matches)) {
36 return $matches[1] .'/'. $matches[2];
37 }
38 // <embed src="http://www.metacafe.com/fplayer/479957/gorilla_prank.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed><br><font size = 1><a href="http://www.metacafe.com/watch/479957/gorilla_prank/">Gorilla Prank</a> - <a href='http://www.metacafe.com/'>Celebrity bloopers here</a></font>
39 else if ($embed && preg_match('@metacafe\.com/fplayer/(.[^/]*)/(.[^\.]*)\.@i', $embed, $matches)) {
40 return $matches[1] .'/'. $matches[2];
41 }
42 return false;
43 }
44
45 function video_cck_metacafe_video_link($video_code) {
46 return 'http://www.metacafe.com/watch/'. $video_code .'/';
47 }
48
49 function theme_video_cck_metacafe_flash($embed, $width, $height, $autoplay) {
50 if ($embed) {
51 $autoplay = $autoplay ? '?playerVars=autoPlay=yes' : '';
52 $output .= '<embed src="http://www.metacafe.com/fplayer/'. $embed .'.swf'. $autoplay .'" width="'. $width .'" height="'. $height .'" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';
53 }
54 return $output;
55 }
56
57 function video_cck_metacafe_thumbnail($field, $item, $formatter, $node, $width, $height) {
58 $picturelink=substr($item['value'], 0, 6);
59 return 'http://www.metacafe.com/thumb/'. $picturelink .'.jpg';
60 }
61
62 function video_cck_metacafe_video($embed, $width, $height, $field, $item, $autoplay) {
63 $output = theme('video_cck_metacafe_flash', $embed, $width, $height, $autoplay);
64 return $output;
65 }
66
67 function video_cck_metacafe_preview($embed, $width, $height, $field, $item, $autoplay) {
68 $output = theme('video_cck_metacafe_flash', $embed, $width, $height, $autoplay);
69 return $output;
70 }
71

  ViewVC Help
Powered by ViewVC 1.1.2