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

Contents of /contributions/modules/emfield/contrib/video_cck/providers/sevenload.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: +2 -2 lines
File MIME type: text/x-php
Corrected all errors registered by Coder module in preperation for D6 port
1 <?php
2 // $Id: sevenload.inc,v 1.3 2007/09/06 22:18:25 aaron Exp $
3
4 define('VIDEO_CCK_SEVENLOAD_MAIN_URL', 'http://www.sevenload.com/');
5
6 /**0
7 * hook video_cck_PROVIDER_info
8 * this returns information relevant to a specific 3rd party video provider
9 * @return
10 * an array of strings requested by various admin and other forms
11 * 'name' => the translated name of the provider
12 * 'url' => the url to the main page for the provider
13 * 'settings_description' => a description of the provider that will be posted in the admin settings form
14 */
15 function video_cck_sevenload_info() {
16 $name = t('Sevenload');
17 $features = array(
18 array(t('Autoplay'), t('No'), ''),
19 array(t('RSS Attachment'), t('No'), ''),
20 array(t('Thumbnails'), t('No'), ''),
21 );
22 return array(
23 'provider' => 'sevenload',
24 'name' => $name,
25 'url' => VIDEO_CCK_SEVENLOAD_MAIN_URL,
26 'settings_description' => t('These settings specifically affect videos displayed from !provider.', array('!provider' => l($name, VIDEO_CCK_SEVENLOAD_MAIN_URL, array('target' => '_blank')))),
27 'supported_features' => $features,
28 );
29 }
30
31 /**
32 * hook video_cck_PROVIDER_settings
33 * this should return a subform to be added to the video_cck_settings() admin settings page.
34 * note that a form field will already be provided, at $form['PROVIDER'] (such as $form['youtube'])
35 * so if you want specific provider settings within that field, you can add the elements to that form field.
36 */
37 function video_cck_sevenload_settings() {
38 $form = array();
39 return $form;
40 }
41
42 /**
43 * hook video_cck_PROVIDER_extract
44 * this is called to extract the video code from a pasted URL or embed code.
45 * @param $embed
46 * an optional string with the pasted URL or embed code
47 * @return
48 * either an array of regex expressions to be tested, or a string with the video code to be used
49 * if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array.
50 * otherwise, the calling function will handle testing the embed code against each regex string in the returned array.
51 */
52 function video_cck_sevenload_extract($embed = '') {
53 // src="http://de.sevenload.com/pl/zuh5KMt"
54 // http://de.sevenload.com/videos/zuh5KMt/Die-Zeit-rennt
55 // hint: de.sevenload.com can also be en.sevenload.com and probably other languages later
56 return array(
57 '@sevenload\.com/pl/([^"]*)"@i',
58 '@sevenload\.com/videos/(.*)/(.*)@i',
59 );
60 }
61
62 /**
63 * hook video_cck_PROVIDER_video_link($video_code)
64 * returns a link to view the video at the provider's site
65 * @param $video_code
66 * the string containing the video to watch
67 * @return
68 * a string containing the URL to view the video at the original provider's site
69 */
70 function video_cck_sevenload_video_link($video_code) {
71 return 'http://www.sevenload.com/videos/'. $video_code;
72 }
73
74 function video_cck_sevenload_thumbnail($field, $item, $formatter, $node, $width, $height) {
75 return '';
76 }
77
78 /**
79 * the embedded flash displaying the Sevenload video
80 */
81 function theme_video_cck_sevenload_flash($embed, $width, $height) {
82 if ($embed) {
83 $output .= "<object height=\"$height\" width=\"$width\"><param name=\"FlashVars\" value=\"slxml=en.sevenload.com\" /><param name=\"movie\" value=\"http://en.sevenload.com/pl/$embed/options/swf\" /><embed src=\"http://de.sevenload.com/pl/$embed/options/swf\" type=\"application/x-shockwave-flash\" width=\"$width\" height=\"$height\" FlashVars=\"slxml=en.sevenload.com\"></embed></object>";
84 }
85 return $output;
86 }
87
88 /**
89 * hook video_cck_PROVIDER_video
90 * this actually displays the full/normal-sized video we want, usually on the default page view
91 * @param $embed
92 * the video code for the video to embed
93 * @param $width
94 * the width to display the video
95 * @param $height
96 * the height to display the video
97 * @param $field
98 * the field info from the requesting node
99 * @param $item
100 * the actual content from the field
101 * @return
102 * the html of the embedded video
103 */
104 function video_cck_sevenload_video($embed, $width, $height, $field, $item) {
105 $output = theme('video_cck_sevenload_flash', $embed, $width, $height);
106 return $output;
107 }
108
109 /**
110 * hook video_cck_PROVIDER_video
111 * this actually displays the preview-sized video we want, commonly for the teaser
112 * @param $embed
113 * the video code for the video to embed
114 * @param $width
115 * the width to display the video
116 * @param $height
117 * the height to display the video
118 * @param $field
119 * the field info from the requesting node
120 * @param $item
121 * the actual content from the field
122 * @return
123 * the html of the embedded video
124 */
125 function video_cck_sevenload_preview($embed, $width, $height, $field, $item) {
126 $output = theme('video_cck_sevenload_flash', $embed, $width, $height);
127 return $output;
128 }
129

  ViewVC Help
Powered by ViewVC 1.1.2