source: extensions/File_Uploader/main.inc.php @ 26374

Last change on this file since 26374 was 20299, checked in by julien1311, 12 years ago

[file_uploader] minor fix

  • Property svn:eol-style set to LF
File size: 2.5 KB
Line 
1<?php
2/*
3Plugin Name: File Uploader
4Version: auto
5Description: Upload files to the galleries folder and synchronise them with database
6Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=661
7Author: Julien1311
8*/
9
10//Check whether we are indeed included by Piwigo.
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13if (mobile_theme())
14        return;
15
16global $conf;
17
18define('FILE_UPLOADER_DIR' , basename(dirname(__FILE__)));
19define('FILE_UPLOADER_PATH' , PHPWG_PLUGINS_PATH.FILE_UPLOADER_DIR.'/');
20define('FILE_UPLOADER_ADMIN',   get_root_url() . 'admin.php?page=plugin-'.FILE_UPLOADER_DIR);
21define('FILE_UPLOADER_PDF2TAB_PATH' , FILE_UPLOADER_PATH.'/plugin_pdf2tab/');
22define('FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH' , dirname(__FILE__).'/plugin_pdf2tab/');
23
24/* +-----------------------------------------------------------------------+
25 * | Plugin admin                                                          |
26 * +-----------------------------------------------------------------------+ */
27
28// Add an entry to the plugins menu
29add_event_handler('get_admin_plugin_menu_links', 'file_uploader_admin_menu');
30
31function file_uploader_admin_menu($menu) {
32        array_push(
33                $menu, array(
34                        'NAME'  => 'File Uploader',
35                        'URL'   => FILE_UPLOADER_ADMIN,
36                )
37        );     
38        return $menu;
39}
40
41/* +-----------------------------------------------------------------------+
42 * | Plugin code                                                           |
43 * +-----------------------------------------------------------------------+ */
44$conf_file_uploader = unserialize($conf['file_uploader']);
45if (isset($conf_file_uploader['new_tab']) && $conf_file_uploader['new_tab'] == 1) {
46        load_language('plugin.lang', FILE_UPLOADER_PATH);
47        include_once(FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'include/thumbnails.inc.php');
48        include_once(FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'include/picture.inc.php');
49}
50
51       
52/* +-----------------------------------------------------------------------+
53 * | CSS Style                                                             |
54 * +-----------------------------------------------------------------------+ */
55
56add_event_handler('loc_end_page_header', 'file_uploader_css');
57
58function file_uploader_css() {
59        global $template;
60
61        if (defined('IN_ADMIN') and IN_ADMIN) {
62                $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PATH.'admin/admin.css">');
63                $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PDF2TAB_PATH.'css/admin.css">');
64        }
65}
66?>
Note: See TracBrowser for help on using the repository browser.