source: extensions/gvideo/main.inc.php @ 29816

Last change on this file since 29816 was 29627, checked in by mistic100, 10 years ago

remove "safe mode" checkbox, now fully automatic

File size: 2.1 KB
RevLine 
[17307]1<?php 
[3609]2/*
[17307]3Plugin Name: Embedded Videos
[3697]4Version: auto
[20804]5Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo and Wat.
[26470]6Plugin URI: auto
7Author: Mistic
[17307]8Author URI: http://www.strangeplanet.fr
[3609]9*/
10
[26470]11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
[3609]12
[28842]13global $prefixeTable, $conf;
[3609]14
[26470]15define('GVIDEO_ID',      basename(dirname(__FILE__)));
[20804]16define('GVIDEO_PATH',    PHPWG_PLUGINS_PATH . GVIDEO_ID . '/');
17define('GVIDEO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . GVIDEO_ID);
[17661]18define('GVIDEO_TABLE',   $prefixeTable.'image_video');
[3609]19
[28842]20include_once(GVIDEO_PATH . 'include/events.inc.php');
[3609]21
[28842]22
23$conf['gvideo'] = safe_unserialize($conf['gvideo']);
24
25
[17678]26add_event_handler('picture_pictures_data', 'gvideo_prepare_picture');
[3609]27
[28842]28add_event_handler('delete_elements', 'gvideo_delete_elements');
29
[17307]30if (defined('IN_ADMIN'))
[3609]31{
[17307]32  add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
[28268]33  add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2);
34 
35  add_event_handler('get_batch_manager_prefilters', 'gvideo_add_prefilter');
[28301]36  add_event_handler('perform_batch_manager_prefilters', 'gvideo_apply_prefilter', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
[17661]37}
38
39
40/**
41 * admin plugins menu
42 */
43function gvideo_admin_menu($menu) 
44{
[26470]45  $menu[] = array(
[17661]46    'NAME' => 'Embedded Videos',
47    'URL' => GVIDEO_ADMIN,
[26470]48    );
[17661]49  return $menu;
50}
51
52/**
53 * special tabs
54 */
55function gvideo_tab($sheets, $id)
56{
57  if ($id != 'photo') return $sheets;
[17626]58 
[17661]59  $query = '
[17626]60SELECT *
61  FROM '.GVIDEO_TABLE.'
62  WHERE picture_id = '.$_GET['image_id'].'
63;';
[17661]64  $result = pwg_query($query);
65
66  if (!pwg_db_num_rows($result)) return $sheets;
[17626]67 
[28268]68  global $gvideo, $page;
[29627]69 
70  load_language('plugin.lang', GVIDEO_PATH);
[28268]71
72  if ($page['tab'] == 'properties')
73  {
[29627]74    $page['infos'][] = l10n('This element is a video added with "Embedded Video"');
[28268]75  }
76 
[17661]77  $gvideo = pwg_db_fetch_assoc($result);
78 
79  $sheets['gvideo'] = array(
80    'caption' => l10n('Video properties'),
81    'url' => GVIDEO_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
82    );
83  unset($sheets['coi'], $sheets['update']);
84 
85  return $sheets;
[13114]86}
Note: See TracBrowser for help on using the repository browser.