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

Last change on this file since 17688 was 17688, checked in by mistic100, 8 years ago

next release is 2.4.e

File size: 2.6 KB
Line 
1<?php 
2/*
3Plugin Name: Embedded Videos
4Version: auto
5Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo, videobb and Wat.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=136
7Author: Mistic & P@t
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15define('GVIDEO_PATH',    PHPWG_PLUGINS_PATH . 'gvideo/');
16define('GVIDEO_ADMIN',   get_root_url() . 'admin.php?page=plugin-gvideo');
17define('GVIDEO_TABLE',   $prefixeTable.'image_video');
18define('GVIDEO_VERSION', '2.4.e');
19
20
21add_event_handler('init', 'gvideo_init');
22add_event_handler('picture_pictures_data', 'gvideo_prepare_picture');
23add_event_handler('render_element_content', 'gvideo_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2);
24
25if (defined('IN_ADMIN'))
26{
27  add_event_handler('delete_elements', 'gvideo_delete_elements');
28  add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
29  add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); 
30}
31
32include_once(GVIDEO_PATH . 'include/gvideo.inc.php');
33
34
35/**
36 * update & load language
37 */
38function gvideo_init()
39{
40  global $pwg_loaded_plugins;
41 
42  if (
43    $pwg_loaded_plugins['gvideo']['version'] == 'auto' or
44    version_compare($pwg_loaded_plugins['gvideo']['version'], GVIDEO_VERSION, '<')
45  )
46  {
47    include_once(GVIDEO_PATH . 'include/install.inc.php');
48    gvideo_install();
49   
50    if ($pwg_loaded_plugins['gvideo']['version'] != 'auto')
51    {
52      $query = '
53UPDATE '. PLUGINS_TABLE .'
54SET version = "'. GVIDEO_VERSION .'"
55WHERE id = "gvideo"';
56      pwg_query($query);
57     
58      $pwg_loaded_plugins['gvideo']['version'] = GVIDEO_VERSION;
59     
60      if (defined('IN_ADMIN'))
61      {
62        $_SESSION['page_infos'][] = 'Embedded Videos updated to version '. GVIDEO_VERSION;
63      }
64    }
65  }
66 
67  load_language('plugin.lang', GVIDEO_PATH);
68}
69
70/**
71 * admin plugins menu
72 */
73function gvideo_admin_menu($menu) 
74{
75  array_push($menu, array(
76    'NAME' => 'Embedded Videos',
77    'URL' => GVIDEO_ADMIN,
78  ));
79  return $menu;
80}
81
82/**
83 * special tabs
84 */
85function gvideo_tab($sheets, $id)
86{
87  if ($id != 'photo') return $sheets;
88 
89  $query = '
90SELECT *
91  FROM '.GVIDEO_TABLE.'
92  WHERE picture_id = '.$_GET['image_id'].'
93;';
94  $result = pwg_query($query);
95
96  if (!pwg_db_num_rows($result)) return $sheets;
97 
98  global $gvideo;
99  $gvideo = pwg_db_fetch_assoc($result);
100 
101  $sheets['gvideo'] = array(
102    'caption' => l10n('Video properties'),
103    'url' => GVIDEO_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
104    );
105  unset($sheets['coi'], $sheets['update']);
106 
107  return $sheets;
108}
109
110?>
Note: See TracBrowser for help on using the repository browser.