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

Last change on this file since 3609 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.6 KB
Line 
1<?php
2/*
3Plugin Name: PY GVideo
4Version: 2.0.g
5Description: Adds some videos from Google Video, Dailymotion, Youtube, Wideo or Vimeo.
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");
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
36function py_mimetype($path, $element_info)
37{
38  global $py_addext;
39       
40  $extension = strtolower(get_extension($element_info['path']));
41  if (empty($element_info['tn_ext']) and in_array($extension, $py_addext))
42        {
43    $path = GVIDEO_PATH . 'mimetypes/' . $extension . '.png';
44        }
45  return $path;
46}
47
48if (script_basename() == 'admin')
49{
50        add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
51       
52        function gvideo_admin_menu($menu)
53        {
54                array_push($menu, array(
55                        'NAME' => 'PY GVideo',
56                        'URL' => get_admin_plugin_menu_link( GVIDEO_PATH . '/admin/pywaie_admin.php')));
57                return $menu;
58        }
59}
60
61add_event_handler('render_element_content', 'gvideoadd');
62add_event_handler('get_thumbnail_url', 'py_mimetype', 60, 2);
63
64?>
Note: See TracBrowser for help on using the repository browser.