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

Last change on this file since 14974 was 13114, checked in by rvelices, 12 years ago

gvideo mimetype thumbs compatible with 2.4 (compatibility with 2.3 ok)

File size: 2.0 KB
Line 
1<?php
2/*
3Plugin Name: PY GVideo
4Version: auto
5Description: Adds some videos from Google Video, Dailymotion, Youtube, Wideo, Vimeo or Wat.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=136
7Author: PYwaie & P@t
8*/
9
10if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
11define('GVIDEO_DIR' , basename(dirname(__FILE__)));
12define('GVIDEO_PATH' , PHPWG_PLUGINS_PATH . GVIDEO_DIR . '/');
13
14global $conf, $py_addext;
15$py_addext = array("gvideo", "dm", "ytube", "wideo", "vimeo", "wat");
16$conf['file_ext'] = array_merge($conf['file_ext'], $py_addext);
17
18function gvideoadd($content)
19{
20  global $page, $picture, $template, $py_addext, $conf;
21
22  if (!isset($picture['current']['file']))
23        {
24                return $content;
25        }
26  $extension = strtolower(get_extension($picture['current']['file']));
27  if (!in_array($extension, $py_addext) or $page['slideshow'])
28        {
29    return $content;
30        }
31        include_once( GVIDEO_PATH . '/gvideo.php');
32  return $content;
33}
34
35
36add_event_handler('get_thumbnail_location', 'py_mimetype', 60, 2);
37function py_mimetype($location, $element_info)
38{
39  if ( empty( $element_info['tn_ext'] ) )
40  {
41    global $py_addext;
42    $extension = strtolower(get_extension($element_info['path']));
43    if (in_array($extension, $py_addext))
44    {
45      $location= 'plugins/' . GVIDEO_DIR . '/mimetypes/' . $extension . '.png';
46    }
47  }
48  return $location;
49}
50
51add_event_handler('get_mimetype_location', 'py_mimetype_location', 60, 2);
52function py_mimetype_location($location, $ext)
53{
54  global $py_addext;
55  if (in_array($ext, $py_addext))
56  {
57    $location= 'plugins/' . GVIDEO_DIR . '/mimetypes/' . $ext . '.png';
58  }
59  return $location;
60}
61
62if (script_basename() == 'admin')
63{
64        add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
65       
66        function gvideo_admin_menu($menu)
67        {
68                array_push($menu, array(
69                        'NAME' => 'PY GVideo',
70                        'URL' => get_admin_plugin_menu_link( GVIDEO_PATH . '/admin/pywaie_admin.php')));
71                return $menu;
72        }
73}
74
75add_event_handler('render_element_content', 'gvideoadd');
76add_event_handler('get_thumbnail_location', 'py_mimetype', 60, 2);
77
78?>
Note: See TracBrowser for help on using the repository browser.