[27568] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: MyPiwiShop |
---|
| 4 | Version: auto |
---|
| 5 | Description: a litle shop for your piwigo. |
---|
| 6 | Plugin URI: auto |
---|
| 7 | Author: Miklfe/Harry |
---|
| 8 | Author URI: http://piwitheme.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 14 | |
---|
| 15 | global $prefixeTable, $template, $conf; |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | // +-----------------------------------------------------------------------+ |
---|
| 19 | // | Define plugin constants | |
---|
| 20 | // +-----------------------------------------------------------------------+ |
---|
| 21 | define('MPS_ID', basename(dirname(__FILE__))); |
---|
| 22 | define('MPS_PATH' , PHPWG_PLUGINS_PATH . MPS_ID . '/'); |
---|
| 23 | define('MPS_PRODUCT_TABLE', $prefixeTable . 'mps_product'); |
---|
| 24 | define('MPS_PROD_IMG_TABLE', $prefixeTable . 'mps_prod_img'); |
---|
| 25 | define('MPS_PROD_OPT_TABLE', $prefixeTable . 'mps_prod_opt'); |
---|
| 26 | define('MPS_CONF_TABLE', $prefixeTable . 'mps_conf'); |
---|
| 27 | define('MPS_OPTION_TABLE', $prefixeTable . 'mps_option'); |
---|
| 28 | define('MPS_OPT_VAL_TABLE', $prefixeTable . 'mps_opt_val'); |
---|
| 29 | define('MPS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . MPS_ID); |
---|
| 30 | define('MPS_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'MyPiwiShop')) . '/'); |
---|
| 31 | define('MPS_DIR', PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'MyPiwiShop/'); |
---|
| 32 | define('MPS_VERSION', 'auto'); |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | // init the plugin |
---|
| 36 | add_event_handler('init', 'mps_init'); |
---|
| 37 | |
---|
| 38 | if (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 | } |
---|
| 52 | else |
---|
| 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 |
---|
| 67 | include_once(MPS_PATH . 'include/functions.inc.php'); |
---|
| 68 | |
---|
| 69 | /** |
---|
| 70 | * plugin initialization |
---|
| 71 | */ |
---|
| 72 | function 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 | |
---|