Changeset 19056 for extensions/gvideo
- Timestamp:
- Nov 17, 2012, 5:05:32 PM (12 years ago)
- Location:
- extensions/gvideo
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/admin.php
r17626 r19056 4 4 global $template, $page, $conf; 5 5 6 $conf['gvideo'] = unserialize($conf['gvideo']); 6 if (is_string($conf['gvideo'])) 7 { 8 $conf['gvideo'] = unserialize($conf['gvideo']); 9 } 7 10 8 11 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'add'; -
extensions/gvideo/admin/add.php
r17488 r19056 20 20 { 21 21 // download thumbnail 22 $thumb_name = $video['type'].'-'.$video[' id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);22 $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']); 23 23 $thumb_source = $conf['data_location'].$thumb_name; 24 24 if (download_remote_file($video['thumbnail'], $thumb_source) !== true) … … 38 38 $updates = array( 39 39 'name' => pwg_db_real_escape_string($video['title']), 40 'comment' => pwg_db_real_escape_string($video['description']),41 40 'author' => pwg_db_real_escape_string($video['author']), 42 41 'is_gvideo' => 1, 43 42 ); 43 44 if ( $_POST['sync_description'] and !empty($video['description']) ) 45 { 46 $updates['comment'] = pwg_db_real_escape_string($video['description']); 47 } 48 if ( $_POST['sync_tags'] and !empty($video['tags']) ) 49 { 50 set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id); 51 } 44 52 45 53 single_update( … … 55 63 $_POST['width'] = $_POST['height'] = ''; 56 64 } 65 else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) ) 66 { 67 array_push($page['errors'], l10n('Width and height must be integers')); 68 $_POST['width'] = $_POST['height'] = ''; 69 } 57 70 if ($_POST['autoplay_common'] == 'true') 58 71 { … … 64 77 'url' => $video['url'], 65 78 'type' => $video['type'], 66 'video_id' => $video[' id'],79 'video_id' => $video['video_id'], 67 80 'width' => $_POST['width'], 68 81 'height' => $_POST['height'], -
extensions/gvideo/admin/config.php
r17307 r19056 5 5 { 6 6 $conf['gvideo'] = array( 7 'autoplay' => $_POST['autoplay'], 8 'width' => $_POST['width'], 9 'height' => $_POST['height'], 7 'autoplay' => (int)$_POST['autoplay'], 8 'width' => (int)$_POST['width'], 9 'height' => (int)$_POST['height'], 10 'sync_description' => (int)$_POST['sync_description'], 11 'sync_tags' => (int)$_POST['sync_tags'], 10 12 'vimeo' => array( 11 13 'title' => (int)isset($_POST['vimeo']['title']), … … 24 26 'videobb' => array(), 25 27 ); 26 28 27 29 conf_update_param('gvideo', serialize($conf['gvideo'])); 28 30 array_push($page['infos'], l10n('Information data registered in database')); -
extensions/gvideo/admin/photo.php
r17687 r19056 70 70 array_push($page['errors'], l10n('Please fill the video URL')); 71 71 } 72 if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'])) === false ) 73 { 74 array_push($page['errors'], l10n('Unable to contact host server')); 72 else if ($gvideo['url']!=$_POST['url']) 73 { 74 if( ($video = parse_video_url($_POST['url'])) === false ) 75 { 76 array_push($page['errors'], l10n('Unable to contact host server')); 77 } 78 } 79 else 80 { 81 $video = $gvideo; 75 82 } 76 83 … … 82 89 { 83 90 // download thumbnail 84 $thumb_name = $video['type'].'-'.$video[' id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);91 $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']); 85 92 $thumb_source = $conf['data_location'].$thumb_name; 86 93 if (download_remote_file($video['thumbnail'], $thumb_source) !== true) … … 95 102 $updates = array( 96 103 'name' => pwg_db_real_escape_string($video['title']), 97 'comment' => pwg_db_real_escape_string($video['description']),98 104 'author' => pwg_db_real_escape_string($video['author']), 99 105 'is_gvideo' => 1, 100 106 ); 107 108 if ( $_POST['sync_description'] and !empty($video['description']) ) 109 { 110 $updates['comment'] = pwg_db_real_escape_string($video['description']); 111 } 112 else 113 { 114 $updates['comment'] = null; 115 } 116 if ( $_POST['sync_tags'] and !empty($video['tags']) ) 117 { 118 set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id); 119 } 101 120 102 121 single_update( … … 126 145 'url' => $video['url'], 127 146 'type' => $video['type'], 128 'video_id' => $video[' id'],147 'video_id' => $video['video_id'], 129 148 'width' => $_POST['width'], 130 149 'height' => $_POST['height'], … … 199 218 $gvideo['autoplay_common'] = 'true'; 200 219 } 220 $gvideo['sync_description'] = $conf['gvideo']['sync_description']; 221 $gvideo['sync_tags'] = $conf['gvideo']['sync_tags']; 201 222 202 223 if (function_exists('imagecreatetruecolor')) -
extensions/gvideo/admin/template/add.tpl
r17626 r19056 74 74 <label><input type="radio" name="autoplay" value="1" {if $POST.autoplay == '1'}checked="checked"{/if}> {'Yes'|@translate}</label> 75 75 </li> 76 <li> 77 <span class="property">{'Get video description'|@translate}</span> 78 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label> 79 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|@translate}</label> 80 </li> 81 <li> 82 <span class="property">{'Get video tags'|@translate}</span> 83 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label> 84 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|@translate}</label> 85 </li> 76 86 </ul> 77 87 </fieldset> … … 104 114 <a href="http://www.wideo.fr" target="_blank">Wideo</a> 105 115 </li> 106 <li>107 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/videobb.png">108 <a href="http://www.videobb.com" target="_blank">videobb</a>109 </li>110 116 </ul> 111 117 </fieldset> -
extensions/gvideo/admin/template/config.tpl
r17307 r19056 18 18 <ul> 19 19 <li> 20 <label> 21 <span class="property">{'Video size'|@translate}</span> 22 <input type="text" name="width" value="{$gvideo.width}" size="4"> × 23 <input type="text" name="height" value="{$gvideo.height}" size="4"> px 24 </label> 20 <span class="property">{'Video size'|@translate}</span> 21 <input type="text" name="width" value="{$gvideo.width}" size="4"> × 22 <input type="text" name="height" value="{$gvideo.height}" size="4"> px 25 23 </li> 26 24 <li> 27 <label> 28 <span class="property">{'Autoplay'|@translate}</span> 29 <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'|@translate}</label> 30 <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'|@translate}</label> 31 </label> 25 <span class="property">{'Autoplay'|@translate}</span> 26 <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'|@translate}</label> 27 <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'|@translate}</label> 28 </li> 29 <li> 30 <span class="property">{'Get video description'|@translate}</span> 31 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label> 32 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|@translate}</label> 33 </li> 34 <li> 35 <span class="property">{'Get video tags'|@translate}</span> 36 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label> 37 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|@translate}</label> 32 38 </li> 33 39 </ul> … … 35 41 36 42 <div class="left"><fieldset> 37 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo '|@translate}</legend>43 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo player'|@translate}</legend> 38 44 39 45 <ul> … … 45 51 </li> 46 52 <li> 47 <label> 48 <span class="property">{'Display'|@translate}</span> 49 <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'|@translate}</label> 50 <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'|@translate}</label> 51 <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'|@translate}</label> 52 </label> 53 <span class="property">{'Display'|@translate}</span> 54 <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'|@translate}</label> 55 <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'|@translate}</label> 56 <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'|@translate}</label> 53 57 </li> 54 58 </ul> … … 56 60 57 61 <div class="right"><fieldset> 58 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion '|@translate}</legend>62 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion player'|@translate}</legend> 59 63 60 64 <ul> … … 66 70 </li> 67 71 <li> 68 <label> 69 <span class="property">{'Display'|@translate}</span> 70 <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'|@translate}</label> 71 <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'|@translate}</label> 72 </label> 72 <span class="property">{'Display'|@translate}</span> 73 <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'|@translate}</label> 74 <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'|@translate}</label> 73 75 </li> 74 76 </ul> -
extensions/gvideo/admin/template/photo.tpl
r17687 r19056 17 17 if ($(this).val() != "{$GVIDEO.url}") {ldelim} 18 18 $(this).css('border', '1px solid #c00'); 19 $(" #change_warning").show();19 $(".video_update").show(); 20 20 } else {ldelim} 21 21 $(this).css('border', border); 22 $(" #change_warning").hide();22 $(".video_update").hide(); 23 23 } 24 24 }); … … 60 60 <b>{'Video URL'|@translate}</b> 61 61 <input type="text" name="url" value="{$GVIDEO.url}" style="width:400px;"> 62 <span id="change_warning" style="display:none;">{'Changing the url will reset video description, name and thumbnail'|@translate}</span>62 <span class="video_update warning" style="display:none;"> {'Changing the url will reset video description, name and thumbnail'|@translate}</span> 63 63 </p> 64 64 65 <p class="video_update"> 66 <b>{'Get video description'|@translate}</b> 67 <label><input type="radio" name="sync_description" value="1" {if $GVIDEO.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label> 68 <label><input type="radio" name="sync_description" value="0" {if not $GVIDEO.sync_description}checked="checked"{/if}> {'No'|@translate}</label> 69 </p> 70 71 <p class="video_update"> 72 <b>{'Get video tags'|@translate}</b> 73 <label><input type="radio" name="sync_tags" value="1" {if $GVIDEO.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label> 74 <label><input type="radio" name="sync_tags" value="0" {if not $GVIDEO.sync_tags}checked="checked"{/if}> {'No'|@translate}</label> 75 </p> 76 65 77 <p> 66 78 <b>{'Video size'|@translate}</b> -
extensions/gvideo/admin/template/style.css
r17626 r19056 9 9 10 10 FORM.properties SPAN.property { 11 width:1 50px;11 width:180px; 12 12 } 13 13 … … 58 58 } 59 59 60 #change_warning { 60 .video_update { 61 display:none; 62 } 63 .video_update.warning { 61 64 display:block; 62 65 color:#c00; -
extensions/gvideo/include/functions.inc.php
r17661 r19056 21 21 if (empty($url['query']['v'])) return false; 22 22 23 $video[' id'] = $url['query']['v'];23 $video['video_id'] = $url['query']['v']; 24 24 } 25 25 … … 31 31 32 32 $url['path'] = explode('/', $url['path']); 33 $video[' id'] = $url['path'][1];34 } 35 36 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video[' id'].'?v=2&alt=json';33 $video['video_id'] = $url['path'][1]; 34 } 35 36 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json'; 37 37 $json = download_remote_file($api_url, true); 38 38 if ($json === false or $json == 'file_error') return false; … … 40 40 $json = json_decode($json, true); 41 41 $video = array_merge($video, array( 42 'url' => 'http://youtube.com/watch?v='.$video[' id'],42 'url' => 'http://youtube.com/watch?v='.$video['video_id'], 43 43 'title' => $json['entry']['title']['$t'], 44 44 'description' => $json['entry']['media$group']['media$description']['$t'], 45 45 'thumbnail' => $json['entry']['media$group']['media$thumbnail'][2]['url'], 46 46 'author' => $json['entry']['author'][0]['name']['$t'], 47 'tags' => null, 47 48 )); 48 49 break; … … 55 56 56 57 $url['path'] = explode('/', $url['path']); 57 $video[' id'] = $url['path'][1];58 59 $api_url = 'http://vimeo.com/api/v2/video/'.$video[' id'].'.json';58 $video['video_id'] = $url['path'][1]; 59 60 $api_url = 'http://vimeo.com/api/v2/video/'.$video['video_id'].'.json'; 60 61 $json = download_remote_file($api_url, true); 61 62 if ($json === false or $json == 'file_error') return false; … … 63 64 $json = json_decode($json, true); 64 65 $video = array_merge($video, array( 65 'url' => 'http://vimeo.com/'.$video[' id'],66 'url' => 'http://vimeo.com/'.$video['video_id'], 66 67 'title' => $json[0]['title'], 67 68 'description' => $json[0]['description'], 68 69 'thumbnail' => $json[0]['thumbnail_large'], 69 70 'author' => $json[0]['user_name'], 71 'tags' => array_map('trim', explode(',', $json[0]['tags'])), 70 72 )); 71 73 break; … … 79 81 $url['path'] = explode('/', $url['path']); 80 82 if ($url['path'][1] != 'video') return false; 81 $video[' id'] = $url['path'][2];82 83 $api_url = 'https://api.dailymotion.com/video/'.$video[' id'].'?fields=description,id,thumbnail_large_url,title,owner.username'; // DM doesn't accept non secure connection83 $video['video_id'] = $url['path'][2]; 84 85 $api_url = 'https://api.dailymotion.com/video/'.$video['video_id'].'?fields=description,thumbnail_large_url,title,owner.username,tags'; // DM doesn't accept non secure connection 84 86 $json = download_remote_file($api_url, true); 85 87 if ($json === false or $json == 'file_error') return false; … … 89 91 90 92 $video = array_merge($video, array( 91 'id' => $json['id'], 92 'url' => 'http://dailymotion.com/video/'.$json['id'], 93 'url' => 'http://dailymotion.com/video/'.$video['video_id'], 93 94 'title' => $json['title'], 94 95 'description' => $json['description'], 95 96 'thumbnail' => $json['thumbnail_large_url'], 96 97 'author' => $json['owner.username'], 98 'tags' => $json['tags'], 97 99 )); 98 100 break; … … 109 111 preg_match('#<meta property="og:video" content="http://www.wat.tv/swf2/([^"/>]+)" />#', $html, $matches); 110 112 if (empty($matches[1])) return false; 111 $video[' id'] = $matches[1];113 $video['video_id'] = $matches[1]; 112 114 113 115 $video['url'] = $source_url; … … 116 118 $video['title'] = $matches[1]; 117 119 118 preg_match('#<p class="description"( [^>]*)>(.*?)</p>#s', $html, $matches);119 $video['description'] = $matches[ 2];120 preg_match('#<p class="description"(?:[^>]*)>(.*?)</p>#s', $html, $matches); 121 $video['description'] = $matches[1]; 120 122 121 123 preg_match('#<meta property="og:image" content="([^">]+)" />#', $html, $matches); … … 123 125 124 126 $video['author'] = null; 127 128 preg_match_all('#<meta property="video:tag" content="([^">]+)" />#', $html, $matches); 129 $video['tags'] = $matches[1]; 125 130 break; 126 131 } … … 132 137 133 138 $url['path'] = explode('/', $url['path']); 134 $video[' id'] = rtrim($url['path'][2], '.html');139 $video['video_id'] = rtrim($url['path'][2], '.html'); 135 140 136 141 $html = download_remote_file($source_url, true); 137 142 if ($html === false or $html == 'file_error') return false; 138 143 139 $video['url'] = 'http://wideo.fr/video/'.$video[' id'].'.html';144 $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html'; 140 145 141 146 preg_match('#<meta property="og:title" content="([^">]*)" />#', $html, $matches); … … 148 153 $video['thumbnail'] = $matches[1]; 149 154 150 preg_match('#<li id="li_author">Auteur : <a href="\#"([^>]*)><span>(.*?)</span></a>#', $html, $matches); 151 $video['author'] = $matches[2]; 152 break; 153 } 154 155 /* videobb */ 156 case 'videobb': 157 { 158 $video['type'] = 'videobb'; 159 160 if (!empty($url['query'])) 161 { 162 parse_str($url['query'], $url['query']); 163 if (empty($url['query']['v'])) return false; 164 $video['id'] = $url['query']['v']; 165 } 166 else 167 { 168 $url['path'] = explode('/', $url['path']); 169 if ($url['path'][1] != 'video') return false; 170 $video['id'] = $url['path'][2]; 171 } 172 173 $html = download_remote_file($source_url, true); 174 if ($html === false or $html == 'file_error') return false; 175 176 $video['url'] = 'http://www.videobb.com/video/'.$video['id']; 177 178 preg_match('#<meta content="videobb - ([^">]*)" name="title" property="" />#', $html, $matches); 179 $video['title'] = $matches[1]; 180 181 $video['description'] = null; 182 183 preg_match('#<link rel="image_src" href="([^">]+)" type="image/jpeg" />#', $html, $matches); 184 $video['thumbnail'] = $matches[1]; 185 186 $video['author'] = null; 155 preg_match('#<li id="li_author">Auteur : <a href=(?:[^>]*)><span>(.*?)</span></a>#', $html, $matches); 156 $video['author'] = $matches[1]; 157 158 preg_match('#<meta name="keywords" content="([^">]+)" />#', $html, $matches); 159 $video['tags'] = array_map('trim', explode(',', $matches[1])); 187 160 break; 188 161 } -
extensions/gvideo/include/gvideo.inc.php
r17678 r19056 41 41 global $page, $picture, $template, $conf; 42 42 43 $conf['gvideo'] = unserialize($conf['gvideo']); 43 if (is_string($conf['gvideo'])) 44 { 45 $conf['gvideo'] = unserialize($conf['gvideo']); 46 } 44 47 45 48 -
extensions/gvideo/include/install.inc.php
r17684 r19056 22 22 'width' => 640, 23 23 'height' => 360, 24 'sync_description' => 1, 25 'sync_tags' => 1, 24 26 'vimeo' => array( 25 27 'title' => 1, … … 36 38 'wat' => array(), 37 39 'wideo' => array(), 38 'videobb' => array(),39 40 )); 40 41 41 42 conf_update_param('gvideo', $gvideo_default_config); 42 43 $conf['gvideo'] = $gvideo_default_config; 44 } 45 else 46 { 47 if (is_string($conf['gvideo'])) 48 { 49 $conf['gvideo'] = unserialize($conf['gvideo']); 50 } 51 52 if (!isset($conf['gvideo']['sync_description'])) 53 { 54 $conf['gvideo']['sync_description'] = 1; 55 $conf['gvideo']['sync_tags'] = 1; 56 57 conf_update_param('gvideo', serialize($conf['gvideo'])); 58 } 43 59 } 44 60 -
extensions/gvideo/language/en_UK/plugin.lang.php
r17626 r19056 22 22 $lang['Video successfully updated'] = 'Video successfully updated'; 23 23 $lang['Changing the url will reset video description, name and thumbnail'] = 'Changing the url will reset video description, name and thumbnail'; 24 $lang['Get video description'] = 'Get video description'; 25 $lang['Get video tags'] = 'Get video tags'; 26 $lang['Vimeo player'] = 'Vimeo player'; 27 $lang['Dailymotion player'] = 'Dailymotion player'; 24 28 25 29 ?> -
extensions/gvideo/language/fr_FR/plugin.lang.php
r17626 r19056 22 22 $lang['Video successfully updated'] = 'Vidéo mise à jour'; 23 23 $lang['Changing the url will reset video description, name and thumbnail'] = 'Changer l\'url réinitialisera le nom, la description et la miniature de la vidéo'; 24 $lang['Get video description'] = 'Récupérer la description'; 25 $lang['Get video tags'] = 'Récupérer les tags'; 26 $lang['Vimeo player'] = 'Lecteur Vimeo'; 27 $lang['Dailymotion player'] = 'Lecteur Dailymotion'; 24 28 25 29 ?> -
extensions/gvideo/main.inc.php
r17688 r19056 16 16 define('GVIDEO_ADMIN', get_root_url() . 'admin.php?page=plugin-gvideo'); 17 17 define('GVIDEO_TABLE', $prefixeTable.'image_video'); 18 define('GVIDEO_VERSION', ' 2.4.e');18 define('GVIDEO_VERSION', 'auto'); 19 19 20 20 … … 41 41 42 42 if ( 43 GVIDEO_VERSION == 'auto' or 43 44 $pwg_loaded_plugins['gvideo']['version'] == 'auto' or 44 45 version_compare($pwg_loaded_plugins['gvideo']['version'], GVIDEO_VERSION, '<') … … 48 49 gvideo_install(); 49 50 50 if ( $pwg_loaded_plugins['gvideo']['version'] != 'auto')51 if ( $pwg_loaded_plugins['gvideo']['version'] != 'auto' and GVIDEO_VERSION !='auto' ) 51 52 { 52 53 $query = '
Note: See TracChangeset
for help on using the changeset viewer.