1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Module: XoopsTube |
5
|
|
|
* @param $returnsource |
6
|
|
|
* @return |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
function xtube_returnsource($returnsource) |
10
|
|
|
{ |
11
|
|
|
$returnsource = match ($returnsource) { |
12
|
|
|
0 => _AM_XTUBE_YOUTUBE, |
|
|
|
|
13
|
|
|
1 => _AM_XTUBE_METACAFE, |
|
|
|
|
14
|
|
|
2 => _AM_XTUBE_IFILM, |
|
|
|
|
15
|
|
|
3 => _AM_XTUBE_PHOTOBUCKET, |
|
|
|
|
16
|
|
|
4 => _AM_XTUBE_VIDDLER, |
|
|
|
|
17
|
|
|
100 => _AM_XTUBE_GOOGLEVIDEO, |
|
|
|
|
18
|
|
|
101 => _AM_XTUBE_MYSPAVETV, |
|
|
|
|
19
|
|
|
102 => _AM_XTUBE_DAILYMOTION, |
|
|
|
|
20
|
|
|
103 => _AM_XTUBE_BLIPTV, |
|
|
|
|
21
|
|
|
104 => _AM_XTUBE_CLIPFISH, |
|
|
|
|
22
|
|
|
105 => _AM_XTUBE_LIVELEAK, |
|
|
|
|
23
|
|
|
106 => _AM_XTUBE_MAKTOOB, |
|
|
|
|
24
|
|
|
107 => _AM_XTUBE_VEOH, |
|
|
|
|
25
|
|
|
108 => _AM_XTUBE_VIMEO, |
|
|
|
|
26
|
|
|
109 => _AM_XTUBE_MEGAVIDEO, |
|
|
|
|
27
|
|
|
200 => _AM_XTUBE_XOOPSTUBE, |
|
|
|
|
28
|
|
|
default => $returnsource, |
29
|
|
|
}; |
30
|
|
|
|
31
|
|
|
return $returnsource; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
// ******************************************************* |
35
|
|
|
// Function for determining source for creating screenshot |
36
|
|
|
// ******************************************************* |
37
|
|
|
/** |
38
|
|
|
* @param $vidid |
39
|
|
|
* @param $title |
40
|
|
|
* @param $source |
41
|
|
|
* @param $picurl |
42
|
|
|
* @param $screenshot |
43
|
|
|
* @param string $width |
44
|
|
|
* @param string $height |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
|
|
function xtube_videothumb($vidid, $title, $source, $picurl, $screenshot, $width = '', $height = '') |
48
|
|
|
{ |
49
|
|
|
global $xoopsModuleConfig; |
50
|
|
|
if ('' == $width || '' == $height) { |
51
|
|
|
$width = $xoopsModuleConfig['shotwidth']; |
52
|
|
|
$height = $xoopsModuleConfig['shotheight']; |
53
|
|
|
} |
54
|
|
|
$thumb = ''; |
55
|
|
|
switch ($source) { |
56
|
|
|
// YouTube |
57
|
|
|
case 0: |
58
|
|
|
$thumb = '<img src="https://img.youtube.com/vi/' . $vidid . '/default.jpg" title="' . $title . '" alt="' . $title . '" width="' . $width . '" height="' . $height . '" style="padding: 0px; border-style: none;" />'; |
59
|
|
|
break; |
60
|
|
|
|
61
|
|
|
// MetaCafe |
62
|
|
|
case 1: |
63
|
|
|
[$metaclip] = preg_split('[/]', (string) $vidid); |
64
|
|
|
$videothumb['metathumb'] = $metaclip; |
|
|
|
|
65
|
|
|
$thumb = '<img src="https://www.metacafe.com/thumb/' . $videothumb['metathumb'] . '.jpg" title="' . $title . '" alt="' . $title . '" width="' . $width . '" height="' . $height . '" style="padding: 0px; border-style: none;" />'; |
66
|
|
|
break; |
67
|
|
|
|
68
|
|
|
// iFilm/Spike |
69
|
|
|
case 2: |
70
|
|
|
$thumb = '<img src="https://img3.ifilmpro.com/resize/image/stills/films/resize/istd/' . $vidid . '.jpg?width=' . $width . '" title="' . $title . '" alt="' . $title . '" style="padding: 0px; border-style: none;" />'; |
71
|
|
|
break; |
72
|
|
|
|
73
|
|
|
// Photobucket |
74
|
|
|
case 3: |
75
|
|
|
$thumb = '<img src="https://i153.photobucket.com/albums/' . $vidid . '.jpg" width="' . $width . '" height="' . $height . '" title="' . $title . '" alt="' . $title . '" style="padding: 0px; border-style: none;" />'; |
76
|
|
|
break; |
77
|
|
|
|
78
|
|
|
// Photobucket |
79
|
|
|
case 4: |
80
|
|
|
$thumb = '<img src="https://cdn-thumbs.viddler.com/thumbnail_2_' . $vidid . '.jpg" width="' . $width . '" height="' . $height . '" title="' . $title . '" alt="' . $title . '" style="padding: 0px; border-style: none;" />'; |
81
|
|
|
break; |
82
|
|
|
|
83
|
|
|
// Google Video, MySpace TV, DailyMotion, BrightCove, Blip.tv, ClipFish, LiveLeak, Maktoob, Veoh |
84
|
|
|
case 100: |
85
|
|
|
case 101: |
86
|
|
|
case 102: |
87
|
|
|
case 103: |
88
|
|
|
case 104: |
89
|
|
|
case 105: |
90
|
|
|
case 106: |
91
|
|
|
case 107: |
92
|
|
|
case 108: |
93
|
|
|
case 109: |
94
|
|
|
$thumb = '<img src="' . $picurl . '" width="' . $width . '" height="' . $height . '" title="' . $title . '" alt="' . $title . '" style="padding: 0px; border-style: none;" />'; |
95
|
|
|
break; |
96
|
|
|
|
97
|
|
|
// Determine if video source is XoopsTube for thumbnail |
98
|
|
|
case 200: |
99
|
|
|
$thumb = '<img src="' . XOOPS_URL . '/' . $screenshot . '" width="' . $width . '" height="' . $height . '" title="' . $title . '" alt="' . $title . '" style="padding: 0px; border-style: none;" />'; |
100
|
|
|
break; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return $thumb; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
// ********************************** |
107
|
|
|
// Function for determining publisher |
108
|
|
|
// ********************************** |
109
|
|
|
/** |
110
|
|
|
* @param $vidid |
111
|
|
|
* @param $publisher |
112
|
|
|
* @param int $source |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
function xtube_videopublisher($vidid, $publisher, $source = 0) |
116
|
|
|
{ |
117
|
|
|
switch ($source) { |
118
|
|
|
// Determine if video source YouTube for publisher |
119
|
|
|
case 0: |
120
|
|
|
$publisher = '<a href="https://www.youtube.com/profile?user=' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
121
|
|
|
break; |
122
|
|
|
|
123
|
|
|
// Determine if video source MetaCafe for publisher |
124
|
|
|
case 1: |
125
|
|
|
$publisher = '<a href="https://www.metacafe.com/channels/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
126
|
|
|
break; |
127
|
|
|
|
128
|
|
|
// Determine if video source iFilm/Spike for publisher |
129
|
|
|
case 2: |
130
|
|
|
$publisher = '<a href="https://www.ifilm.com/profile/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
131
|
|
|
break; |
132
|
|
|
|
133
|
|
|
// Determine if video source Photobucket for publisher |
134
|
|
|
case 3: |
135
|
|
|
$string = 'th_'; |
136
|
|
|
[$photobucket] = explode($string, (string) $vidid); |
137
|
|
|
$ppublisher['ppublisher'] = $photobucket; |
|
|
|
|
138
|
|
|
$publisher = '<a href="https://s39.photobucket.com/albums/' . $ppublisher['ppublisher'] . '" target="_blank">' . $publisher . '</a>'; |
139
|
|
|
break; |
140
|
|
|
|
141
|
|
|
// Determine if video source is Viddler for publisher |
142
|
|
|
case 4: |
143
|
|
|
$publisher = '<a href="https://www.viddler.com/explore/' . $publisher . '/" target="_blank">' . $publisher . '</a>'; |
144
|
|
|
break; |
145
|
|
|
|
146
|
|
|
// Determine if video source is Google Video for publisher |
147
|
|
|
case 100: |
148
|
|
|
case 101: |
149
|
|
|
case 103: |
150
|
|
|
case 106: |
151
|
|
|
case 108: |
152
|
|
|
case 109: |
153
|
|
|
$publisher = $publisher; |
154
|
|
|
break; |
155
|
|
|
|
156
|
|
|
// Determine if video source is DailyMotion for publisher |
157
|
|
|
case 102: |
158
|
|
|
$publisher = '<a href="https://www.dailymotion.com/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
159
|
|
|
break; |
160
|
|
|
|
161
|
|
|
// Determine if video source is ClipFish for publisher |
162
|
|
|
case 104: |
163
|
|
|
$publisher = '<a href="https://www.clipfish.de/user/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
164
|
|
|
break; |
165
|
|
|
|
166
|
|
|
// Determine if video source is LiveLeak for publisher |
167
|
|
|
case 105: |
168
|
|
|
$publisher = '<a href="https://www.liveleak.com/user/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
169
|
|
|
break; |
170
|
|
|
|
171
|
|
|
// Determine if video source is Veoh for publisher |
172
|
|
|
case 107: |
173
|
|
|
$publisher = '<a href="https://www.veoh.com/users/' . $publisher . '" target="_blank">' . $publisher . '</a>'; |
174
|
|
|
break; |
175
|
|
|
|
176
|
|
|
// Determine if video source is XoopsTube for publisher |
177
|
|
|
case 200: |
178
|
|
|
$publisher = $publisher; |
179
|
|
|
break; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
return $publisher; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
// ************************************************ |
186
|
|
|
//Function for displaying videoclip (embedded code) |
187
|
|
|
// ************************************************ |
188
|
|
|
/** |
189
|
|
|
* @param $vidid |
190
|
|
|
* @param $source |
191
|
|
|
* @param $screenshot |
192
|
|
|
* @param $picurl |
193
|
|
|
* @return string |
194
|
|
|
*/ |
195
|
|
|
function xtube_showvideo($vidid, $source, $screenshot, $picurl) |
196
|
|
|
{ |
197
|
|
|
global $xoopsModule, $xoopsModuleConfig; |
198
|
|
|
$showvideo = ''; |
199
|
|
|
$autoplay = $xoopsModuleConfig['autoplay']; |
200
|
|
|
if ($xoopsModuleConfig['autoplay']) { |
201
|
|
|
$autoplay2 = 'yes'; |
202
|
|
|
$autoplay3 = 'true'; |
203
|
|
|
$photobucket = '&ap=1'; |
204
|
|
|
$google = 'FlashVars="autoPlay=true"'; |
205
|
|
|
$viddler = 'flashvars="autoplay=t"'; |
206
|
|
|
} else { |
207
|
|
|
$autoplay2 = 'no'; |
208
|
|
|
$autoplay3 = 'false'; |
209
|
|
|
$photobucket = ''; |
210
|
|
|
$google = ''; |
211
|
|
|
$viddler = ''; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
// $hquality = ''; |
215
|
|
|
// if ($hq == 1) { |
216
|
|
|
// $hquality = '&ap=%2526fmt%3D18&'; |
217
|
|
|
// } |
218
|
|
|
|
219
|
|
|
switch ($source) { |
220
|
|
|
// YouTube |
221
|
|
|
case 0: |
222
|
|
|
// $showvideo = '<object width="480" height="295"><param name="movie" value="https://www.youtube.com/v/' . $vidid . '&ap=%2526fmt%3D18&&autoplay=' . $autoplay . '&rel=1&fs=1&color1=0x999999&color2=0x999999&border=0&loop=0"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/' . $vidid . '&ap=%2526fmt%3D18&&autoplay=' . $autoplay . '&rel=1&fs=1&color1=0x999999&color2=0x999999&border=0&loop=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="480" height="295"></embed></object>'; |
223
|
|
|
$showvideo = '<embed src="https://www.youtube.com/v/' . $vidid . '&autoplay=' . $autoplay . '&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="853" height="480"></embed>'; |
224
|
|
|
break; |
225
|
|
|
|
226
|
|
|
// MetaCafe |
227
|
|
|
case 1: |
228
|
|
|
$showvideo = '<embed flashVars="playerVars=showStats=no|autoPlay=' . $autoplay2 . '" src="https://www.metacafe.com/fplayer/' . $vidid . '.swf" width="853" height="480" wmode="transparent" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'; |
229
|
|
|
break; |
230
|
|
|
|
231
|
|
|
// iFilm/Spike |
232
|
|
|
case 2: |
233
|
|
|
$showvideo = '<embed width="853" height="480" src="https://www.spike.com/efp" quality="high" bgcolor="000000" name="efp" align="middle" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" flashvars="flvbaseclip=' . $vidid . '" allowfullscreen="true"> </embed>'; |
234
|
|
|
break; |
235
|
|
|
|
236
|
|
|
// Photobucket |
237
|
|
|
case 3: |
238
|
|
|
$vidid = str_replace('th_', '', (string) $vidid); |
239
|
|
|
$showvideo = '<embed width="853" height="480" type="application/x-shockwave-flash" wmode="transparent" src="https://i51.photobucket.com/player.swf?file=https://vid51.photobucket.com/albums/' . $vidid . '.flv' . $photobucket . '"></embed>'; |
240
|
|
|
break; |
241
|
|
|
|
242
|
|
|
// Viddler |
243
|
|
|
case 4: |
244
|
|
|
$showvideo = '<embed src="https://www.viddler.com/player/' . $vidid . '/" width="853" height="480" type="application/x-shockwave-flash" ' . $viddler . ' allowScriptAccess="always" allowFullScreen="true" name="viddler_' . $vidid . '" ></embed>'; |
245
|
|
|
break; |
246
|
|
|
|
247
|
|
|
// Google Video |
248
|
|
|
case 100: |
249
|
|
|
$showvideo = '<embed style="width:480px; height:295px;" id="VideoPlayback" type="application/x-shockwave-flash" src="https://video.google.com/googleplayer.swf?docId=' . $vidid . '&hl=en" ' . $google . '> </embed>'; |
250
|
|
|
break; |
251
|
|
|
|
252
|
|
|
// MySpace TV |
253
|
|
|
case 101: |
254
|
|
|
$showvideo = '<embed src="https://mediaservices.myspace.com/services/media/embed.aspx/m=' . $vidid . ',t=1,mt=video,ap=' . $autoplay . '" width="480" height="295" allowFullScreen="true" type="application/x-shockwave-flash"></embed>'; |
255
|
|
|
break; |
256
|
|
|
|
257
|
|
|
// DailyMotion |
258
|
|
|
case 102: |
259
|
|
|
$showvideo = '<embed src="https://www.dailymotion.com/swf/' . $vidid . '&autoPlay=' . $autoplay . '" type="application/x-shockwave-flash" width="480" height="295" allowFullScreen="true" allowScriptAccess="always"></embed>'; |
260
|
|
|
break; |
261
|
|
|
|
262
|
|
|
// Blip.tv |
263
|
|
|
case 103: |
264
|
|
|
$showvideo = '<embed src="https://blip.tv/play/' . $vidid . '" type="application/x-shockwave-flash" width="480" height="295" allowscriptaccess="always" allowfullscreen="true" flashvars="autostart=' . $autoplay3 . '"></embed>'; |
265
|
|
|
break; |
266
|
|
|
|
267
|
|
|
// ClipFish |
268
|
|
|
case 104: |
269
|
|
|
$showvideo = '<embed src="https://www.clipfish.de/videoplayer.swf?as=' . $autoplay . '&videoid=' . $vidid . '==&r=1&c=0067B3" quality="high" bgcolor="#0067B3" width="464" height="380" name="player" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"></embed>'; // Change c=0067B3 for different player color |
270
|
|
|
break; |
271
|
|
|
|
272
|
|
|
// LiveLeak |
273
|
|
|
case 105: |
274
|
|
|
$showvideo = '<embed src="https://www.liveleak.com/e/' . $vidid . '" type="application/x-shockwave-flash" flashvars="autostart=' . $autoplay3 . '" wmode="transparent" width="450" height="370"></embed>'; |
275
|
|
|
break; |
276
|
|
|
|
277
|
|
|
// Maktoob |
278
|
|
|
case 106: |
279
|
|
|
$showvideo = '<embed width="448" height="320" align="middle" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="flvplayer" bgcolor="#ffffff" devicefont="true" wmode="transparent" quality="high" src="https://clipat.maktoob.com/flvplayerOurJS.swf?file=https://' . $vidid . '.flv&enablejs=true&image=' . $picurl . '&lightcolor=0x557722&backcolor=0x000000&frontcolor=0xCCCCCC&showfsbutton=true&autostart=' . $autoplay3 . '&logo=https://clipat.maktoob.com/language/ar_sa/images/clipat-icon.png&displaywidth=448" />'; |
280
|
|
|
break; |
281
|
|
|
|
282
|
|
|
// Veoh |
283
|
|
|
case 107: |
284
|
|
|
$showvideo = '<embed src="https://www.veoh.com/veohplayer.swf?permalinkId=' . $vidid . '&id=anonymous&player=videodetailsembedded&affiliateId=&videoAutoPlay=' . $autoplay . '" allowFullScreen="true" width="480" height="295" bgcolor="#FFFFFF" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"></embed>'; |
285
|
|
|
break; |
286
|
|
|
|
287
|
|
|
// Vimeo |
288
|
|
|
case 108: |
289
|
|
|
$showvideo = '<embed src="https://vimeo.com/moogaloop.swf?clip_id=' . $vidid . '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1&autoplay=' . $autoplay . '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" quality="best" width="400" height="321"></embed>'; |
290
|
|
|
break; |
291
|
|
|
|
292
|
|
|
// Megavideo |
293
|
|
|
case 109: |
294
|
|
|
$showvideo = '<object width="640" height="363"><param name="movie" value="https://www.megavideo.com/v/' . $vidid . '"></param><param name="allowFullScreen" value="true"></param><embed src="https://www.megavideo.com/v/' . $vidid . '" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="363"></embed></object>'; |
295
|
|
|
break; |
296
|
|
|
|
297
|
|
|
// XoopsTube |
298
|
|
|
case 200: |
299
|
|
|
$showvideo = '<embed src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/include/mediaplayer.swf" width="425" height="350" allowScriptAccess="always" allowFullScreen="true" flashvars="width=425&height=350&file=' . XOOPS_URL . '/' . $xoopsModuleConfig['videodir'] . '/' . $vidid . '&image=' . XOOPS_URL . '/' . $xoopsModuleConfig['videoimgdir'] . '/' . $screenshot . '&autostart=' . $autoplay3 . '"></embed>'; |
300
|
|
|
break; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
return $showvideo; |
304
|
|
|
} |
305
|
|
|
|