source: extensions/MyPiwiShop/main.inc.php @ 27758

Last change on this file since 27758 was 27743, checked in by Miklfe, 10 years ago

Version de lancement

File size: 2.9 KB
Line 
1<?php 
2/*
3Plugin Name: MyPiwiShop
4Version: auto
5Description: a litle shop for your piwigo.
6Plugin URI: auto
7Author: Miklfe
8Author URI: http://piwitheme.fr
9*/
10
11
12
13defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
14
15global $prefixeTable;
16
17
18// +-----------------------------------------------------------------------+
19// | Define plugin constants                                               |
20// +-----------------------------------------------------------------------+
21define('MPS_ID',                        basename(dirname(__FILE__)));
22define('MPS_PATH' ,                     PHPWG_PLUGINS_PATH . MPS_ID . '/');
23define('MPS_PRODUCT_TABLE',     $prefixeTable . 'mps_product');
24define('MPS_PROD_IMG_TABLE',    $prefixeTable . 'mps_prod_img');
25define('MPS_PROD_OPT_TABLE',    $prefixeTable . 'mps_prod_opt');
26define('MPS_CONF_TABLE',                $prefixeTable . 'mps_conf');
27define('MPS_OPTION_TABLE',              $prefixeTable . 'mps_option');
28define('MPS_OPT_VAL_TABLE',     $prefixeTable . 'mps_opt_val');
29define('MPS_ADMIN',                     get_root_url() . 'admin.php?page=plugin-' . MPS_ID);
30define('MPS_PUBLIC',            get_absolute_root_url() . make_index_url(array('section' => 'MyPiwiShop')) . '/');
31define('MPS_DIR',               PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'MyPiwiShop/');
32define('MPS_VERSION',           'auto');
33
34// init the plugin
35add_event_handler('init', 'mps_init');
36
37if (defined('IN_ADMIN'))
38{
39  include_once(MPS_PATH . 'include/admin_events.inc.php');
40 
41  // admin plugins menu link
42  add_event_handler('get_admin_plugin_menu_links', 'mps_admin_plugin_menu_links');
43 
44 
45  // new action in Batch Manager
46  add_event_handler('loc_end_element_set_global', 'mps_loc_end_element_set_global');
47  add_event_handler('element_set_global_action', 'mps_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
48  add_event_handler('loc_end_element_set_unit', 'mps_loc_end_element_set_unit');
49
50}
51else
52{
53  // file containing all public handlers functions
54  include_once(MPS_PATH . 'include/public_events.inc.php');
55 
56  // add button on album and photos pages
57  add_event_handler('loc_end_index', 'mps_add_button');
58  add_event_handler('loc_end_picture', 'mps_add_button');
59 
60  // form on photo page
61  add_event_handler('loc_end_picture', 'mps_prepar_tpl');
62  add_event_handler('loc_end_picture', 'mps_loc_end_picture');
63}
64
65// files containing specific plugin functions
66include_once(MPS_PATH . 'include/functions.inc.php');
67
68 function mps_init()
69{
70  global $prefixeTable;
71 
72  // apply upgrade if needed
73  include_once(MPS_PATH . 'maintain.inc.php');
74  $maintain = new MyPiwiShop_maintain(MPS_ID);
75  $maintain->autoUpdate(MPS_VERSION, 'install');
76 
77        $query='SELECT * FROM '.MPS_CONF_TABLE.';';
78        if(pwg_db_num_rows(pwg_query($query))==0){
79      single_insert(
80       $prefixeTable."mps_conf",
81       array(
82        'currency' => 'EUR',
83        )
84      );
85        }
86 
87  // load plugin language file
88  load_language('plugin.lang', MPS_PATH);
89 
90}
91
92
93
94 
95 
96
97
98
99 
100 
101 
102 
103 
104 
105 
106 
Note: See TracBrowser for help on using the repository browser.