Ignore:
Timestamp:
Aug 2, 2012, 2:13:19 PM (12 years ago)
Author:
mistic100
Message:

new version for Piwigo 2.4 (renamed into 'Embedded Videos')

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/main.inc.php

    r13114 r17307  
    1 <?php
     1<?php 
    22/*
    3 Plugin Name: PY GVideo
     3Plugin Name: Embedded Videos
    44Version: auto
    5 Description: Adds some videos from Google Video, Dailymotion, Youtube, Wideo, Vimeo or Wat.
     5Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo, videobb and Wat.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=136
    7 Author: PYwaie & P@t
     7Author: Mistic & P@t
     8Author URI: http://www.strangeplanet.fr
    89*/
    910
    1011if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    11 define('GVIDEO_DIR' , basename(dirname(__FILE__)));
    12 define('GVIDEO_PATH' , PHPWG_PLUGINS_PATH . GVIDEO_DIR . '/');
    1312
    14 global $conf, $py_addext;
    15 $py_addext = array("gvideo", "dm", "ytube", "wideo", "vimeo", "wat");
    16 $conf['file_ext'] = array_merge($conf['file_ext'], $py_addext);
     13global $prefixeTable;
    1714
    18 function gvideoadd($content)
     15define('GVIDEO_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
     16define('GVIDEO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
     17define('GVIDEO_TABLE', $prefixeTable.'image_video');
     18
     19include(GVIDEO_PATH . 'include/gvideo.inc.php');
     20
     21add_event_handler('render_element_content', 'gvideo_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2);
     22
     23if (defined('IN_ADMIN'))
    1924{
    20   global $page, $picture, $template, $py_addext, $conf;
     25  add_event_handler('delete_elements', 'gvideo_delete_elements');
     26  add_event_handler('loc_begin_admin_page', 'gvideo_photo_edit');
     27  add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
    2128
    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;
     29  function gvideo_admin_menu($menu)
     30  {
     31    array_push($menu, array(
     32      'NAME' => 'Embedded Videos',
     33      'URL' => GVIDEO_ADMIN,
     34    ));
     35    return $menu;
     36  }
    3337}
    3438
    35 
    36 add_event_handler('get_thumbnail_location', 'py_mimetype', 60, 2);
    37 function 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 
    51 add_event_handler('get_mimetype_location', 'py_mimetype_location', 60, 2);
    52 function 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 
    62 if (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 
    75 add_event_handler('render_element_content', 'gvideoadd');
    76 add_event_handler('get_thumbnail_location', 'py_mimetype', 60, 2);
    77 
    7839?>
Note: See TracChangeset for help on using the changeset viewer.