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

Last change on this file since 27589 was 27589, checked in by Miklfe, 10 years ago
File size: 2.7 KB
Line 
1<?php 
2/*
3Plugin Name: MyPiwiShop
4Version: auto
5Description: a litle shop for your piwigo.
6Plugin URI: auto
7Author: Miklfe/Harry
8Author URI: http://piwitheme.fr
9*/
10
11
12
13defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
14
15global $prefixeTable, $template, $conf;
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
35// init the plugin
36add_event_handler('init', 'mps_init');
37
38if (defined('IN_ADMIN'))
39{
40  include_once(MPS_PATH . 'include/admin_events.inc.php');
41 
42  // admin plugins menu link
43  add_event_handler('get_admin_plugin_menu_links', 'mps_admin_plugin_menu_links');
44 
45 
46  // new action in Batch Manager
47  add_event_handler('loc_end_element_set_global', 'mps_loc_end_element_set_global');
48  add_event_handler('element_set_global_action', 'mps_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
49  add_event_handler('loc_end_element_set_unit', 'mps_loc_end_element_set_unit');
50
51}
52else
53{
54  // file containing all public handlers functions
55  include_once(MPS_PATH . 'include/public_events.inc.php');
56 
57  // add button on album and photos pages
58  add_event_handler('loc_end_index', 'mps_add_button');
59  add_event_handler('loc_end_picture', 'mps_add_button');
60 
61  // form on photo page
62  add_event_handler('loc_end_picture', 'mps_prepar_tpl');
63  add_event_handler('loc_end_picture', 'mps_loc_end_picture');
64}
65
66// files containing specific plugin functions
67include_once(MPS_PATH . 'include/functions.inc.php');
68
69/**
70 * plugin initialization
71 */
72function mps_init()
73{
74  global $conf, $template;
75 
76  // apply upgrade if needed
77  include_once(MPS_PATH . 'maintain.inc.php');
78  $maintain = new mps_maintain(MPS_ID);
79  $maintain->autoUpdate(MPS_VERSION, 'install');
80 
81 
82  // load plugin language file
83  load_language('plugin.lang', MPS_PATH);
84 
85 
86
87}
88
89
90 
91 
92 
93 
94 
95 
96 
97 
Note: See TracBrowser for help on using the repository browser.