Changeset 20809


Ignore:
Timestamp:
Feb 18, 2013, 2:45:55 PM (7 years ago)
Author:
mistic100
Message:

better handle of private videos, show info about privacy

Location:
extensions/gvideo
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/admin/template/add.tpl

    r20804 r20809  
    1313  maxWidth: '300px',
    1414  defaultPosition: 'right'
     15});
     16jQuery(".showProvidersInfo").click(function() {
     17  $(".providersInfo").toggle();
    1518});
    1619{/literal}{/footer_script}
     
    101104      <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/youtube.png">
    102105      <a href="http://www.youtube.com" target="_blank">YouTube</a>
     106      <span class="providersInfo">{'Videos can be unlisted but not private.'|@translate}<br></span>
    103107    </li>
    104108    <li>
    105109      <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png">
    106110      <a href="http://www.vimeo.com" target="_blank">Vimeo</a>
     111      <span class="providersInfo">{'Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).'|@translate}<br></span>
    107112    </li>
    108113    <li>
    109114      <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png">
    110115      <a href="http://www.dailymotion.com" target="_blank">Dailymotion</a>
     116      <span class="providersInfo">{'Videos can be private if you use the private permalink.'|@translate}<br></span>
    111117    </li>
    112118    <li>
    113119      <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/wat.png">
    114120      <a href="http://www.wat.tv" target="_blank">Wat</a>
     121      <span class="providersInfo" style="font-style:italic;">{'No privacy option.'|@translate}<br></span>
    115122    </li>
    116123    <li>
    117124      <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/wideo.png">
    118125      <a href="http://www.wideo.fr" target="_blank">Wideo</a>
     126      <span class="providersInfo" style="font-style:italic;">{'No privacy option.'|@translate}<br></span>
     127    </li>
     128    <li>
     129      <a class="showProvidersInfo">{'Show privacy details'|@translate}</a>
    119130    </li>
    120131  </ul>
  • extensions/gvideo/admin/template/style.css

    r19056 r20809  
    6666  font-weight:bold;
    6767}
     68
     69.providersInfo {
     70  display:none;
     71}
     72.showProvidersInfo {
     73  font-style:italic;
     74  font-size:0.9em;
     75}
  • extensions/gvideo/include/functions.inc.php

    r20804 r20809  
    4343     
    4444      $video['url'] = 'http://youtube.com/watch?v='.$video['video_id'];
     45      $video['title'] = 'YouTube #'.$video['video_id'];
    4546     
    4647      if (!$safe_mode)
    4748      {
    48         $fields = 'entry(id,author,media:group(media:title(text()),media:description(text()),media:thumbnail(@url),media:keywords))';
    49         $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json&fields='.$fields;
     49        $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json';
    5050        $json = gvideo_download_remote_file($api_url, true);
    5151       
    5252        if ($json===false || $json=='file_error') return false;
     53        if (strip_tags($json) == 'GDataInvalidRequestUriExceptionInvalid id') return false; // unknown video
     54        if (strip_tags($json) == 'GDataServiceForbiddenExceptionPrivate video') return false; // private video
    5355       
    5456        $json = json_decode($json, true);
     
    5658          'title' => $json['entry']['media$group']['media$title']['$t'],
    5759          'description' => $json['entry']['media$group']['media$description']['$t'],
    58           'thumbnail' => $json['entry']['media$group']['media$thumbnail'][0]['url'],
     60          'thumbnail' => $json['entry']['media$group']['media$thumbnail'][2]['url'],
    5961          'author' => $json['entry']['author'][0]['name']['$t'],
    6062          ));
     
    6466        }
    6567      }
    66       else
    67       {
    68         $video['title'] = 'YouTube #'.$video['video_id'];
    69       }
    7068     
    7169      break;
     
    8179     
    8280      $video['url'] = 'http://vimeo.com/'.$video['video_id'];
     81      $video['title'] = 'Vimeo #'.$video['video_id'];
    8382     
    8483      if (!$safe_mode)
     
    116115        }
    117116      }
    118       else
    119       {
    120         $video['title'] = 'Vimeo #'.$video['video_id'];
    121       }
    122117     
    123118      break;
     
    134129     
    135130      $video['url'] = 'http://dailymotion.com/video/'.$video['video_id'];
     131      $video['title'] = $video['video_id'];
    136132     
    137133      if (!$safe_mode)
     
    143139       
    144140        $json = json_decode($json, true);
     141        if (@$json['error']['type'] == 'access_forbidden') return false; // private video
    145142        $json['thumbnail_large_url'] = preg_replace('#\?([0-9]+)$#', null, $json['thumbnail_large_url']);
    146143       
     
    153150          ));
    154151      }
    155       else
    156       {
    157         $video['title'] = $video['video_id'];
    158       }
    159152     
    160153      break;
     
    164157    case 'wat':
    165158    {
     159      if (!$safe_mode) return false; // no safe_mode for wat.tv, must connect to get the video id
     160     
    166161      $video['type'] = 'wat';
    167162     
    168       // no safe_mode for wat.tv
    169163      $html = gvideo_download_remote_file($source_url, true);
    170164     
     
    202196     
    203197      $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html';
     198      $video['title'] = $video['video_id'];
    204199     
    205200      if (!$safe_mode)
     
    223218        preg_match('#<meta name="keywords" content="([^">]+)" />#', $html, $matches);
    224219        $video['tags'] = $matches[1];
    225       }
    226       else
    227       {
    228         $video['title'] = $video['video_id'];
    229220      }
    230221     
  • extensions/gvideo/language/en_UK/plugin.lang.php

    r19213 r20809  
    3030$lang['In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'] = 'In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.';
    3131$lang['Video properties'] = 'Video properties';
     32$lang['Show privacy details' = 'Show privacy details';
     33$lang['Videos can be unlisted but not private.' = 'Videos can be unlisted but not private.';
     34$lang['Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).' = 'Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).';
     35$lang['Videos can be private if you use the private permalink.' = 'Videos can be private if you use the private permalink.';
     36$lang['No privacy option.' = 'No privacy option.';
     37$lang[''] = '';
    3238
    3339?>
  • extensions/gvideo/language/fr_FR/plugin.lang.php

    r19213 r20809  
    3030$lang['In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'] = 'En mode sans échec, le plugin n\'essaye pas de contacter l\'hébergeur de la vidéo, utile sur certains sites où les connexions externes sont bloquées.';
    3131$lang['Video properties'] = 'Propriétés vidéo';
     32$lang['Show privacy details'] = 'A propos des vidéos privées';
     33$lang['Videos can be unlisted but not private.'] = 'Les vidéos peuvent être hors listing mais pas privées.';
     34$lang['Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).'] = 'Les vidéos peuvent être hors-listing et privées si le domaine de la galerie fait partie des domaines autorisés (PRO).';
     35$lang['Videos can be private if you use the private permalink.'] = 'Les videos peuvent être privées si vous utilisez le permalink privé.';
     36$lang['No privacy option.'] = 'Pas d\'option de privacité.';
    3237
    3338?>
Note: See TracChangeset for help on using the changeset viewer.