source: extensions/Media_Icon/main.inc.php

Last change on this file was 32691, checked in by ddtddt, 2 years ago

[media_icon] piwigo 12

  • Property svn:eol-style set to LF
File size: 2.1 KB
Line 
1<?php
2/*
3Plugin Name: Media Icon
4Version: auto
5Description: add an icon to non-picture files
6Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=654
7Author: Julien1311
8Has Settings: true
9*/
10
11//Check whether we are indeed included by Piwigo.
12if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
13
14define('MEDIA_ICON_DIR' , basename(dirname(__FILE__)));
15define('MEDIA_ICON_PATH' , PHPWG_PLUGINS_PATH.MEDIA_ICON_DIR.'/');
16define('MEDIA_ICON_ABSOLUTE_PATH' , dirname(__FILE__).'/');
17define('MEDIA_ICON_ADMIN',   get_root_url() . 'admin.php?page=plugin-'.MEDIA_ICON_DIR);
18
19/* +-----------------------------------------------------------------------+
20 * | Plugin admin                                                          |
21 * +-----------------------------------------------------------------------+ */
22
23// Add an entry to the plugins menu
24add_event_handler('get_admin_plugin_menu_links', 'media_icon_admin_menu');
25
26function media_icon_admin_menu($menu) {
27        array_push(
28                $menu, array(
29                        'NAME'  => 'Media Icon',
30                        'URL'   => MEDIA_ICON_ADMIN,
31                )
32        );     
33        return $menu;
34}
35
36/* +-----------------------------------------------------------------------+
37 * | Plugin code                                                           |
38 * +-----------------------------------------------------------------------+ */
39       
40include_once(MEDIA_ICON_PATH.'include/thumbnails.inc.php');
41
42/* +-----------------------------------------------------------------------+
43 * | CSS Style                                                             |
44 * +-----------------------------------------------------------------------+ */
45
46add_event_handler('loc_end_page_header', 'media_icon_css');
47
48function media_icon_css() {
49        global $template, $conf;
50       
51        $conf_media_icon_general = unserialize($conf['media_icon_general']);
52
53        //add a stylesheet
54        $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'template/media_icon.css">');
55        if (defined('IN_ADMIN') and IN_ADMIN)
56                $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'admin/admin.css">');
57}
58?>
Note: See TracBrowser for help on using the repository browser.