source: extensions/Piwecard/main.inc.php @ 31085

Last change on this file since 31085 was 30184, checked in by plg, 10 years ago

compatibility Piwigo 2.7

set the config during activation, instead of loading it from default
config file on each page reload.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
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
10if (!defined('PHPWG_ROOT_PATH'))  die('Hacking attempt!');
11
12if (mobile_theme())
13        return;
14
15global $prefixeTable;
16
17define('PIWECARD_ROOT', dirname(__FILE__));
18define('PIWECARD_DIR', basename(dirname(__FILE__)));
19define('PIWECARD_PATH', PHPWG_PLUGINS_PATH.PIWECARD_DIR.'/');
20define('PIWECARD_INC_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/include/');
21define('PIWECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/install/');
22define('PIWECARD_MAIL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/mail/');
23define('PIWECARD_TABLE', $prefixeTable . 'piwecard');
24define('PIWECARD_ADMIN',   get_root_url() . 'admin.php?page=plugin-'.PIWECARD_DIR);
25
26include_once(PIWECARD_INC_PATH.'piwecard.class.php');
27include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
28include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
29global $page, $template;
30
31$piwecard = new Piwecard();
32
33// Add ecard to picture page
34add_event_handler('loc_end_picture', array(&$piwecard, 'display_ecard_to_picture')); 
35
36add_event_handler('loc_end_section_init', array(&$piwecard, 'section_init_ecard'));
37add_event_handler('loc_end_index', array(&$piwecard, 'index_ecard'));
38
39set_plugin_data($plugin['id'], $piwecard);
40
41add_event_handler('init', 'piwecard_init');
42function piwecard_init()
43{
44  load_language('plugin.lang', PIWECARD_PATH);
45}
46
47/* +-----------------------------------------------------------------------+
48 * | Plugin admin                                                          |
49 * +-----------------------------------------------------------------------+ */
50add_event_handler('get_admin_plugin_menu_links', 'piwecard_admin_menu');
51
52function 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 * +-----------------------------------------------------------------------+ */
65add_event_handler('loc_end_page_header', 'piwecard_css_js');
66
67function 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 * +-----------------------------------------------------------------------+ */
79add_event_handler('ws_add_methods', 'piwecard_ws_add_methods');
80
81function piwecard_ws_add_methods($arr) {
82        require_once('ws/ws_functions.inc.php');
83}
Note: See TracBrowser for help on using the repository browser.