Ignore:
Timestamp:
Aug 4, 2012, 4:15:54 PM (12 years ago)
Author:
mistic100
Message:
  • simplify add page
  • simplify migration task
  • add option to add film effect on element edition page
Location:
extensions/gvideo/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/include/functions.inc.php

    r17311 r17383  
    4040      $json = json_decode($json, true);
    4141      $video = array_merge($video, array(
     42        'url' => 'http://youtube.com/watch?v='.$video['id'],
    4243        'title' => $json['entry']['title']['$t'],
    4344        'description' => $json['entry']['media$group']['media$description']['$t'],
     
    6263      $json = json_decode($json, true);
    6364      $video = array_merge($video, array(
     65        'url' => 'http://vimeo.com/'.$video['id'],
    6466        'title' => $json[0]['title'],
    6567        'description' => $json[0]['description'],
     
    8890      $video = array_merge($video, array(
    8991        'id' => $json['id'],
     92        'url' => 'http://dailymotion.com/video/'.$json['id'],
    9093        'title' => $json['title'],
    9194        'description' => $json['description'],
     
    108111      $video['id'] = $matches[1];
    109112     
     113      $video['url'] = $source_url;
     114     
    110115      preg_match('#<meta name="name" content="([^">]*)" />#', $html, $matches);
    111116      $video['title'] = $matches[1];
     
    131136      $html = download_remote_file($source_url, true);
    132137      if ($html === false or $html == 'file_error') return false;
    133            
     138     
     139      $video['url'] = 'http://wideo.fr/video/'.$video['id'].'.html';
     140     
    134141      preg_match('#<meta property="og:title" content="([^">]*)" />#', $html, $matches);
    135142      $video['title'] = $matches[1];
     
    166173      $html = download_remote_file($source_url, true);
    167174      if ($html === false or $html == 'file_error') return false;
    168            
     175     
     176      $video['url'] = 'http://www.videobb.com/video/'.$video['id'];
     177     
    169178      preg_match('#<meta content="videobb - ([^">]*)"  name="title" property="" />#', $html, $matches);
    170179      $video['title'] = $matches[1];
  • extensions/gvideo/include/gvideo.inc.php

    r17307 r17383  
    7070
    7171/**
    72  * add message on edition page
     72 * add message and link on edition page
    7373 */
    7474function gvideo_photo_edit()
    7575{
    76   global $page;
     76  global $page, $template, $conf;
    7777 
    7878  if ($page['page'] != 'photo') return;
     
    8585  $result = pwg_query($query);
    8686 
    87   if (pwg_db_num_rows($result))
     87  if (!pwg_db_num_rows($result)) return;
     88   
     89  $video = pwg_db_fetch_assoc($result);
     90   
     91  array_push($page['warnings'], l10n('This element is a video added with "Embedded Video"'));
     92 
     93  if (function_exists('imagecreatetruecolor'))
    8894  {
    89     array_push($page['warnings'], l10n('This element is a video added with "Embedded Video"'));
     95    if (isset($_GET['add_film_frame']))
     96    {
     97      include_once(GVIDEO_PATH . '/include/functions.inc.php');
     98      include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
     99     
     100      $image_infos = pwg_db_fetch_assoc(pwg_query('SELECT path, file FROM '.IMAGES_TABLE.' WHERE id = '.$_GET['image_id'].';'));
     101      $thumb_source = $conf['data_location'].$image_infos['file'];
     102     
     103      add_film_frame($image_infos['path'], $thumb_source);
     104      add_uploaded_file($thumb_source, $image_infos['file'], null, null, $_GET['image_id']);
     105      $template->assign('TN_UPDATE', true);
     106    }
     107   
     108    $admin_photo_base_url = get_root_url().'admin.php?page=photo-'.$_GET['image_id'];
     109    $admin_url_start = $admin_photo_base_url.'-properties';
     110    $admin_url_start.= isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '';
     111   
     112    $template->assign('U_ADD_FILM_FRAME', $admin_url_start.'&amp;add_film_frame=1');
     113    $template->set_prefilter('picture_modify', 'gvideo_photo_edit_prefilter');
    90114  }
    91115}
    92116
     117function gvideo_photo_edit_prefilter($content)
     118{
     119  $search[0] = '{if !url_is_remote($PATH)}';
     120  $replace[0] = '<li><a href="{$U_ADD_FILM_FRAME}" id="refresh_video">{\'Add film effect\'|@translate}</a></li>'.$search[0];
     121 
     122  $search[1] = '{$TN_SRC}';
     123  $replace[1] = $search[1].'{if $TN_UPDATE}?'.time().'{/if}';
     124 
     125  return str_replace($search, $replace, $content);
     126}
     127
    93128?>
Note: See TracChangeset for help on using the changeset viewer.