1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: File Uploader |
---|
4 | Version: auto |
---|
5 | Description: Upload files to the galleries folder and synchronise them with database |
---|
6 | Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=3906 |
---|
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 | global $conf; |
---|
14 | |
---|
15 | define('FILE_UPLOADER_DIR' , basename(dirname(__FILE__))); |
---|
16 | define('FILE_UPLOADER_PATH' , PHPWG_PLUGINS_PATH.FILE_UPLOADER_DIR.'/'); |
---|
17 | define('FILE_UPLOADER_ADMIN', get_root_url() . 'admin.php?page=plugin-File_Uploader'); |
---|
18 | define('FILE_UPLOADER_PDF2TAB_PATH' , FILE_UPLOADER_PATH.'pdf2tab/'); |
---|
19 | |
---|
20 | /* +-----------------------------------------------------------------------+ |
---|
21 | * | Plugin admin | |
---|
22 | * +-----------------------------------------------------------------------+ */ |
---|
23 | |
---|
24 | // Add an entry to the plugins menu |
---|
25 | add_event_handler('get_admin_plugin_menu_links', 'file_uploader_admin_menu'); |
---|
26 | |
---|
27 | function file_uploader_admin_menu($menu) { |
---|
28 | array_push( |
---|
29 | $menu, array( |
---|
30 | 'NAME' => 'File Uploader', |
---|
31 | 'URL' => FILE_UPLOADER_ADMIN, |
---|
32 | ) |
---|
33 | ); |
---|
34 | return $menu; |
---|
35 | } |
---|
36 | |
---|
37 | /* +-----------------------------------------------------------------------+ |
---|
38 | * | Plugin code | |
---|
39 | * +-----------------------------------------------------------------------+ */ |
---|
40 | $conf_file_uploader = unserialize($conf['file_uploader']); |
---|
41 | if ($conf_file_uploader['new_tab'] == 1) { |
---|
42 | load_language('plugin.lang', FILE_UPLOADER_PATH); |
---|
43 | include_once(FILE_UPLOADER_PDF2TAB_PATH.'thumbnails.php'); |
---|
44 | include_once(FILE_UPLOADER_PDF2TAB_PATH.'picture.php'); |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | /* +-----------------------------------------------------------------------+ |
---|
49 | * | CSS Style | |
---|
50 | * +-----------------------------------------------------------------------+ */ |
---|
51 | |
---|
52 | add_event_handler('loc_end_page_header', 'file_uploader_css'); |
---|
53 | |
---|
54 | function file_uploader_css() { |
---|
55 | global $template; |
---|
56 | |
---|
57 | //add a stylesheet |
---|
58 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PATH.'admin/admin.css">'); |
---|
59 | } |
---|
60 | ?> |
---|