[19284] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Media Icon |
---|
[19311] | 4 | Version: auto |
---|
[19284] | 5 | Description: add an icon to non-picture files |
---|
| 6 | Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=654 |
---|
| 7 | Author: Julien1311 |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | //Check whether we are indeed included by Piwigo. |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | define('MEDIA_ICON_DIR' , basename(dirname(__FILE__))); |
---|
| 14 | define('MEDIA_ICON_PATH' , PHPWG_PLUGINS_PATH.MEDIA_ICON_DIR.'/'); |
---|
[19427] | 15 | define('MEDIA_ICON_ABSOLUTE_PATH' , dirname(__FILE__).'/'); |
---|
[19647] | 16 | define('MEDIA_ICON_ADMIN', get_root_url() . 'admin.php?page=plugin-'.MEDIA_ICON_DIR); |
---|
[19284] | 17 | |
---|
| 18 | /* +-----------------------------------------------------------------------+ |
---|
| 19 | * | Plugin admin | |
---|
| 20 | * +-----------------------------------------------------------------------+ */ |
---|
| 21 | |
---|
| 22 | // Add an entry to the plugins menu |
---|
| 23 | add_event_handler('get_admin_plugin_menu_links', 'media_icon_admin_menu'); |
---|
| 24 | |
---|
| 25 | function media_icon_admin_menu($menu) { |
---|
| 26 | array_push( |
---|
| 27 | $menu, array( |
---|
| 28 | 'NAME' => 'Media Icon', |
---|
[19325] | 29 | 'URL' => MEDIA_ICON_ADMIN, |
---|
[19284] | 30 | ) |
---|
| 31 | ); |
---|
| 32 | return $menu; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /* +-----------------------------------------------------------------------+ |
---|
[19352] | 36 | * | Plugin code | |
---|
[19284] | 37 | * +-----------------------------------------------------------------------+ */ |
---|
| 38 | |
---|
[19631] | 39 | include_once(MEDIA_ICON_PATH.'include/thumbnails.inc.php'); |
---|
[19338] | 40 | |
---|
| 41 | /* +-----------------------------------------------------------------------+ |
---|
[19352] | 42 | * | CSS Style | |
---|
[19338] | 43 | * +-----------------------------------------------------------------------+ */ |
---|
| 44 | |
---|
| 45 | add_event_handler('loc_end_page_header', 'media_icon_css'); |
---|
| 46 | |
---|
| 47 | function 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">'); |
---|
[19876] | 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">'); |
---|
[19338] | 56 | } |
---|
[19284] | 57 | ?> |
---|