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 | $piwecard = new Piwecard(); |
---|
32 | |
---|
33 | // Add ecard to picture page |
---|
34 | add_event_handler('loc_end_picture', array(&$piwecard, 'display_ecard_to_picture')); |
---|
35 | |
---|
36 | add_event_handler('loc_end_section_init', array(&$piwecard, 'section_init_ecard')); |
---|
37 | add_event_handler('loc_end_index', array(&$piwecard, 'index_ecard')); |
---|
38 | |
---|
39 | set_plugin_data($plugin['id'], $piwecard); |
---|
40 | |
---|
41 | add_event_handler('init', 'piwecard_init'); |
---|
42 | function piwecard_init() |
---|
43 | { |
---|
44 | load_language('plugin.lang', PIWECARD_PATH); |
---|
45 | } |
---|
46 | |
---|
47 | /* +-----------------------------------------------------------------------+ |
---|
48 | * | Plugin admin | |
---|
49 | * +-----------------------------------------------------------------------+ */ |
---|
50 | add_event_handler('get_admin_plugin_menu_links', 'piwecard_admin_menu'); |
---|
51 | |
---|
52 | function piwecard_admin_menu($menu) { |
---|
53 | array_push( |
---|
54 | $menu, array( |
---|
55 | 'NAME' => 'Piwecard', |
---|
56 | 'URL' => PIWECARD_ADMIN, |
---|
57 | ) |
---|
58 | ); |
---|
59 | return $menu; |
---|
60 | } |
---|
61 | |
---|
62 | /* +-----------------------------------------------------------------------+ |
---|
63 | * | CSS/JS Style | |
---|
64 | * +-----------------------------------------------------------------------+ */ |
---|
65 | add_event_handler('loc_end_page_header', 'piwecard_css_js'); |
---|
66 | |
---|
67 | function piwecard_css_js() { |
---|
68 | global $template; |
---|
69 | |
---|
70 | if (defined('IN_ADMIN') and IN_ADMIN) |
---|
71 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PIWECARD_PATH . 'css/admin.css">'); |
---|
72 | |
---|
73 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PIWECARD_PATH . 'css/piwecard.css">'); |
---|
74 | } |
---|
75 | |
---|
76 | /* +-----------------------------------------------------------------------+ |
---|
77 | * | AJAX Methods | |
---|
78 | * +-----------------------------------------------------------------------+ */ |
---|
79 | add_event_handler('ws_add_methods', 'piwecard_ws_add_methods'); |
---|
80 | |
---|
81 | function piwecard_ws_add_methods($arr) { |
---|
82 | require_once('ws/ws_functions.inc.php'); |
---|
83 | } |
---|