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 | if (mobile_theme()) |
---|
13 | return; |
---|
14 | |
---|
15 | global $prefixeTable; |
---|
16 | |
---|
17 | define('PIWECARD_ROOT', dirname(__FILE__)); |
---|
18 | define('PIWECARD_DIR', basename(dirname(__FILE__))); |
---|
19 | define('PIWECARD_PATH', PHPWG_PLUGINS_PATH.PIWECARD_DIR.'/'); |
---|
20 | define('PIWECARD_INC_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/include/'); |
---|
21 | define('PIWECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/install/'); |
---|
22 | define('PIWECARD_MAIL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/mail/'); |
---|
23 | define('PIWECARD_TABLE', $prefixeTable . 'piwecard'); |
---|
24 | define('PIWECARD_ADMIN', get_root_url() . 'admin.php?page=plugin-'.PIWECARD_DIR); |
---|
25 | |
---|
26 | include_once(PIWECARD_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', PIWECARD_PATH); |
---|
33 | |
---|
34 | $piwecard = new Piwecard(); |
---|
35 | |
---|
36 | // Add ecard to picture page |
---|
37 | add_event_handler('loc_end_picture', array(&$piwecard, 'display_ecard_to_picture')); |
---|
38 | |
---|
39 | add_event_handler('loc_end_section_init', array(&$piwecard, 'section_init_ecard')); |
---|
40 | add_event_handler('loc_end_index', array(&$piwecard, 'index_ecard')); |
---|
41 | |
---|
42 | set_plugin_data($plugin['id'], $piwecard); |
---|
43 | |
---|
44 | /* +-----------------------------------------------------------------------+ |
---|
45 | * | Plugin admin | |
---|
46 | * +-----------------------------------------------------------------------+ */ |
---|
47 | add_event_handler('get_admin_plugin_menu_links', 'piwecard_admin_menu'); |
---|
48 | |
---|
49 | function piwecard_admin_menu($menu) { |
---|
50 | array_push( |
---|
51 | $menu, array( |
---|
52 | 'NAME' => 'Piwecard', |
---|
53 | 'URL' => PIWECARD_ADMIN, |
---|
54 | ) |
---|
55 | ); |
---|
56 | return $menu; |
---|
57 | } |
---|
58 | |
---|
59 | /* +-----------------------------------------------------------------------+ |
---|
60 | * | CSS/JS Style | |
---|
61 | * +-----------------------------------------------------------------------+ */ |
---|
62 | add_event_handler('loc_end_page_header', 'piwecard_css_js'); |
---|
63 | |
---|
64 | function piwecard_css_js() { |
---|
65 | global $template; |
---|
66 | |
---|
67 | if (defined('IN_ADMIN') and IN_ADMIN) |
---|
68 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PIWECARD_PATH . 'css/admin.css">'); |
---|
69 | |
---|
70 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PIWECARD_PATH . 'css/piwecard.css">'); |
---|
71 | } |
---|
72 | |
---|
73 | /* +-----------------------------------------------------------------------+ |
---|
74 | * | AJAX Methods | |
---|
75 | * +-----------------------------------------------------------------------+ */ |
---|
76 | add_event_handler('ws_add_methods', 'piwecard_ws_add_methods'); |
---|
77 | |
---|
78 | function piwecard_ws_add_methods($arr) { |
---|
79 | require_once('ws/ws_functions.inc.php'); |
---|
80 | } |
---|
81 | ?> |
---|