source: extensions/Media_Icon/main.inc.php @ 31939

Last change on this file since 31939 was 19876, checked in by julien1311, 12 years ago

[media_icon] load admin.css only on admin pages

  • 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
8*/
9
10//Check whether we are indeed included by Piwigo.
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('MEDIA_ICON_DIR' , basename(dirname(__FILE__)));
14define('MEDIA_ICON_PATH' , PHPWG_PLUGINS_PATH.MEDIA_ICON_DIR.'/');
15define('MEDIA_ICON_ABSOLUTE_PATH' , dirname(__FILE__).'/');
16define('MEDIA_ICON_ADMIN',   get_root_url() . 'admin.php?page=plugin-'.MEDIA_ICON_DIR);
17
18/* +-----------------------------------------------------------------------+
19 * | Plugin admin                                                          |
20 * +-----------------------------------------------------------------------+ */
21
22// Add an entry to the plugins menu
23add_event_handler('get_admin_plugin_menu_links', 'media_icon_admin_menu');
24
25function media_icon_admin_menu($menu) {
26        array_push(
27                $menu, array(
28                        'NAME'  => 'Media Icon',
29                        'URL'   => MEDIA_ICON_ADMIN,
30                )
31        );     
32        return $menu;
33}
34
35/* +-----------------------------------------------------------------------+
36 * | Plugin code                                                           |
37 * +-----------------------------------------------------------------------+ */
38       
39include_once(MEDIA_ICON_PATH.'include/thumbnails.inc.php');
40
41/* +-----------------------------------------------------------------------+
42 * | CSS Style                                                             |
43 * +-----------------------------------------------------------------------+ */
44
45add_event_handler('loc_end_page_header', 'media_icon_css');
46
47function media_icon_css() {
48        global $template, $conf;
49       
50        $conf_media_icon_general = unserialize($conf['media_icon_general']);
51
52        //add a stylesheet
53        $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'template/media_icon.css">');
54        if (defined('IN_ADMIN') and IN_ADMIN)
55                $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'admin/admin.css">');
56}
57?>
Note: See TracBrowser for help on using the repository browser.