1 | <?php |
---|
2 | /* |
---|
3 | * Plugin Name: Piwecard |
---|
4 | * Version: auto |
---|
5 | * Description: envoi de Cartes Virtuelles |
---|
6 | * Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=487 |
---|
7 | * Author: Tiico & Julien1311 |
---|
8 | * */ |
---|
9 | |
---|
10 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
11 | |
---|
12 | global $prefixeTable; |
---|
13 | |
---|
14 | define('ECARD_VERSION', '1.1.0'); |
---|
15 | |
---|
16 | define('ECARD_ROOT', dirname(__FILE__)); |
---|
17 | define('ECARD_DIR', basename(dirname(__FILE__))); |
---|
18 | define('ECARD_PATH', PHPWG_PLUGINS_PATH.ECARD_DIR.'/'); |
---|
19 | define('ECARD_INC_PATH', PHPWG_PLUGINS_PATH . ECARD_DIR . '/include/'); |
---|
20 | define('ECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH . ECARD_DIR . '/install/'); |
---|
21 | define('ECARD_TABLE', $prefixeTable . 'piwecard'); |
---|
22 | define('ECARD_ADMIN', get_root_url() . 'admin.php?page=plugin-'.ECARD_DIR); |
---|
23 | |
---|
24 | load_language('plugin.lang', ECARD_PATH); |
---|
25 | |
---|
26 | include_once(ECARD_INC_PATH.'piwecard.class.php'); |
---|
27 | include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); |
---|
28 | include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); |
---|
29 | global $page, $template; |
---|
30 | |
---|
31 | // Load language files |
---|
32 | load_language('plugin.lang', ECARD_PATH); |
---|
33 | |
---|
34 | $ecard = new Piwecard(); |
---|
35 | |
---|
36 | // Add ecard to picture page |
---|
37 | add_event_handler('loc_end_picture', array(&$ecard, 'display_ecard_to_picture')); |
---|
38 | |
---|
39 | add_event_handler('loc_end_section_init', array(&$ecard, 'section_init_ecard')); |
---|
40 | add_event_handler('loc_end_index', array(&$ecard, 'index_ecard')); |
---|
41 | |
---|
42 | add_event_handler('loc_end_page_header', 'css_js_ecard'); |
---|
43 | |
---|
44 | set_plugin_data($plugin['id'], $ecard); |
---|
45 | |
---|
46 | /* +-----------------------------------------------------------------------+ |
---|
47 | * | Plugin admin | |
---|
48 | * +-----------------------------------------------------------------------+ */ |
---|
49 | |
---|
50 | // Add an entry to the plugins menu |
---|
51 | add_event_handler('get_admin_plugin_menu_links', 'ecard_admin_menu'); |
---|
52 | |
---|
53 | function ecard_admin_menu($menu) { |
---|
54 | array_push( |
---|
55 | $menu, array( |
---|
56 | 'NAME' => 'Piwecard', |
---|
57 | 'URL' => ECARD_ADMIN, |
---|
58 | ) |
---|
59 | ); |
---|
60 | return $menu; |
---|
61 | } |
---|
62 | |
---|
63 | /* +-----------------------------------------------------------------------+ |
---|
64 | * | CSS/JS Style | |
---|
65 | * +-----------------------------------------------------------------------+ */ |
---|
66 | |
---|
67 | function css_js_ecard() { |
---|
68 | global $template; |
---|
69 | |
---|
70 | if (defined('IN_ADMIN') and IN_ADMIN) |
---|
71 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.ECARD_PATH . 'css/admin.css">'); |
---|
72 | |
---|
73 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.ECARD_PATH . 'css/piwecard.css">'); |
---|
74 | } |
---|
75 | ?> |
---|