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

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

remove "safe mode" checkbox, now fully automatic

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