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

Last change on this file since 27932 was 27781, checked in by Miklfe, 10 years ago
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  include_once(MPS_PATH . 'include/admin_events.inc.php');
39 
40  // admin plugins menu link
41  add_event_handler('get_admin_plugin_menu_links', 'mps_admin_plugin_menu_links');
42 
43 
44  // new action in Batch Manager
45  add_event_handler('loc_end_element_set_global', 'mps_loc_end_element_set_global');
46  add_event_handler('element_set_global_action', 'mps_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
47  add_event_handler('loc_end_element_set_unit', 'mps_loc_end_element_set_unit');
48} else {
49  // file containing all public handlers functions
50  include_once(MPS_PATH . 'include/public_events.inc.php');
51 
52  // add button on album and photos pages
53  add_event_handler('loc_end_index', 'mps_add_button');
54  add_event_handler('loc_end_picture', 'mps_add_button');
55 
56  // form on photo page
57  add_event_handler('loc_end_picture', 'mps_prepar_tpl');
58  add_event_handler('loc_end_picture', 'mps_init_form_picture');
59}
60
61// files containing specific plugin functions
62include_once(MPS_PATH . 'include/functions.inc.php');
63
64 function mps_init() {
65  global $prefixeTable;
66 
67  // apply upgrade if needed
68  include_once(MPS_PATH . 'maintain.inc.php');
69  $maintain = new MyPiwiShop_maintain(MPS_ID);
70  $maintain->autoUpdate(MPS_VERSION, 'install');
71 
72  $query='
73  SELECT *
74  FROM '.MPS_CONF_TABLE.'
75  ;';
76       
77  if(pwg_db_num_rows(pwg_query($query))==0) {
78   single_insert(
79    $prefixeTable."mps_conf",
80    array(
81     'currency' => 'EUR',
82    )
83   );
84  }
85 
86  // load plugin language file
87  load_language('plugin.lang', MPS_PATH);
88}
89
90
91
92 
93 
94
95
96
97 
98 
99 
100 
101 
102 
103 
104 
Note: See TracBrowser for help on using the repository browser.