Changeset 26469
- Timestamp:
- Jan 6, 2014, 4:33:59 PM (10 years ago)
- Location:
- extensions/gvideo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/include/functions.inc.php
r20809 r26469 1 1 <?php 2 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 4 function parse_video_url($source_url, $safe_mode=false) 5 5 { 6 $source_url = 'http://'.preg_replace('#^http(s?)://#', null, $source_url);6 $source_url = 'http://'.preg_replace('#^http(s?)://#', null, trim($source_url)); 7 7 8 8 $url = parse_url($source_url); … … 38 38 if (empty($video['video_id'])) 39 39 { 40 if ($url['host'][1] != 'be') return false; 40 41 $url['path'] = explode('/', $url['path']); 41 42 $video['video_id'] = $url['path'][1]; … … 122 123 case 'dailymotion': 123 124 { 124 $video['type'] = 'dailymotion';125 126 125 $url['path'] = explode('/', $url['path']); 127 126 if ($url['path'][1] != 'video') return false; 128 127 $video['video_id'] = $url['path'][2]; 128 } 129 130 case 'dai': // dai.ly (short-url service) 131 { 132 $video['type'] = 'dailymotion'; 133 134 if (empty($video['video_id'])) 135 { 136 if ($url['host'][1] != 'ly') return false; 137 $video['video_id'] = ltrim($url['path'], '/'); 138 } 129 139 130 140 $video['url'] = 'http://dailymotion.com/video/'.$video['video_id']; 131 $video['title'] = $video['video_id'];141 $video['title'] = 'Dailymotion #'.$video['video_id']; 132 142 133 143 if (!$safe_mode) … … 157 167 case 'wat': 158 168 { 159 if (!$safe_mode) return false; // no safe_mode for wat.tv, must connect to get the video id 169 if ($safe_mode) return false; 170 171 $html = gvideo_download_remote_file($source_url, true); 172 173 if ($html===false || $html=='file_error') return false; 160 174 161 175 $video['type'] = 'wat'; 162 163 $html = gvideo_download_remote_file($source_url, true); 164 165 if ($html===false || $html=='file_error') return false; 166 167 preg_match('#<meta property="og:video" content="http://www.wat.tv/swf2/([^"/>]+)" />#', $html, $matches); 176 $video['url'] = $source_url; 177 178 preg_match('#<meta name="twitter:player" content="https://www.wat.tv/embedframe/([^">]+)">#', $html, $matches); 168 179 if (empty($matches[1])) return false; 169 180 $video['video_id'] = $matches[1]; 170 171 $video['url'] = $source_url; 172 173 preg_match('#<meta name="name" content="([^">]*)" />#', $html, $matches); 181 182 preg_match('#<meta property="og:title" content="([^">]*)">#', $html, $matches); 174 183 $video['title'] = $matches[1]; 175 184 176 preg_match('#< p class="description"(?:[^>]*)>(.*?)</p>#s', $html, $matches);185 preg_match('#<meta property="og:description" content="([^">]*)">#s', $html, $matches); 177 186 $video['description'] = $matches[1]; 178 187 179 preg_match('#<meta property="og:image" content="([^">]+)" />#', $html, $matches);188 preg_match('#<meta property="og:image" content="([^">]+)">#', $html, $matches); 180 189 $video['thumbnail'] = $matches[1]; 181 190 182 $video['author'] = null; 183 184 preg_match_all('#<meta property="video:tag" content="([^">]+)" />#', $html, $matches); 191 preg_match('#<meta property="video:director" content="http://www.wat.tv/([^">]+)">#', $html, $matches); 192 $video['author'] = $matches[1]; 193 194 preg_match_all('#<meta property="video:tag" content="([^">]+)">#', $html, $matches); 185 195 $video['tags'] = implode(',', $matches[1]); 196 186 197 break; 187 198 } … … 196 207 197 208 $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html'; 198 $video['title'] = $video['video_id'];209 $video['title'] = 'Wideo #'.$video['video_id']; 199 210 200 211 if (!$safe_mode) … … 207 218 $video['title'] = $matches[1]; 208 219 209 preg_match('#<meta property="og:description" content="([^">]*)" /># ', $html, $matches);220 preg_match('#<meta property="og:description" content="([^">]*)" />#s', $html, $matches); 210 221 $video['description'] = $matches[1]; 211 222 … … 222 233 break; 223 234 } 224 235 225 236 default: 226 237 return false; … … 267 278 $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext; 268 279 $thumb_source = $conf['data_location'].$thumb_name; 269 if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true ) 280 281 if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true) 270 282 { 271 283 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg'; … … 287 299 ); 288 300 289 if ( $config['sync_description'] and !empty($video['description']))301 if ($config['sync_description'] and !empty($video['description'])) 290 302 { 291 303 $updates['comment'] = pwg_db_real_escape_string($video['description']); 292 304 } 293 305 294 if ( $config['sync_tags'] and !empty($video['tags']))306 if ($config['sync_tags'] and !empty($video['tags'])) 295 307 { 296 308 $tags = pwg_db_real_escape_string($video['tags']); … … 306 318 307 319 // register video 308 if ( !preg_match('#^([0-9]*)$#', $config['width']) or !preg_match('#^([0-9]*)$#', $config['height']))320 if (!preg_match('#^([0-9]*)$#', $config['width']) or !preg_match('#^([0-9]*)$#', $config['height'])) 309 321 { 310 322 $config['width'] = $config['height'] = ''; 311 323 } 312 if ( $config['autoplay']!='0' and $config['autoplay']!='1')324 if ($config['autoplay']!='0' and $config['autoplay']!='1') 313 325 { 314 326 $config['autoplay'] = ''; … … 362 374 $return = ($dest === true) ? true : false; 363 375 364 array_push($headers, 'Accept-language: en');376 $headers[] = 'Accept-language: en'; 365 377 366 378 /* curl */ … … 385 397 if (strpos($src, 'https://') !== false) 386 398 { 387 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);388 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);399 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 400 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 389 401 } 390 402 if (!$return) … … 394 406 else 395 407 { 396 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);408 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 397 409 } 398 410 … … 454 466 * and film frame to an image (need GD library) 455 467 * @param: string source 456 * @param: string destination (if null, the source simodified)468 * @param: string destination (if null, the source is modified) 457 469 * @return: void 458 470 */ … … 553 565 } 554 566 } 555 556 ?> -
extensions/gvideo/template/video_dailymotion.tpl
r17307 r26469 1 <iframe src="http://www.dailymotion.com/embed/video/{$GVIDEO.video_id}?auto play={$GVIDEO.autoplay}&info={$GVIDEO.config.dailymotion.title}&logo={$GVIDEO.config.dailymotion.logo}&{$GVIDEO.config.dailymotion.color}"1 <iframe src="http://www.dailymotion.com/embed/video/{$GVIDEO.video_id}?autoPlay={$GVIDEO.autoplay}&info={$GVIDEO.config.dailymotion.title}&logo={$GVIDEO.config.dailymotion.logo}&{$GVIDEO.config.dailymotion.color}" 2 2 width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> -
extensions/gvideo/template/video_wideo.tpl
r17307 r26469 9 9 <video poster="http://api.kewego.com/video/getHTML5Thumbnail/?playerKey=0df9b773a15b&sig={$GVIDEO.video_id}" height="{$GVIDEO.width}" width="{$GVIDEO.height}" preload="none" controls="controls"></video> 10 10 <script src="http://sa.kewego.com/embed/assets/kplayer-standalone.js"></script> 11 <script defer="defer">kitd.html5loader("flash_kplayer_{$GVIDEO.video_id}" );</script>11 <script defer="defer">kitd.html5loader("flash_kplayer_{$GVIDEO.video_id}","http://api.kewego.com/video/getHTML5Thumbnail/?playerKey=0df9b773a15b&sig={$GVIDEO.video_id}");</script> 12 12 </object> -
extensions/gvideo/template/video_youtube.tpl
r17307 r26469 1 <iframe src="http://www.youtube .com/embed/{$GVIDEO.video_id}?autoplay={$GVIDEO.autoplay}" width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>1 <iframe src="http://www.youtube-nocookie.com/embed/{$GVIDEO.video_id}?autoplay={$GVIDEO.autoplay}" width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
Note: See TracChangeset
for help on using the changeset viewer.