source: extensions/UserCollections/main.inc.php @ 25678

Last change on this file since 25678 was 25678, checked in by mistic100, 10 years ago

very big update for Piwigo 2.6

File size: 2.6 KB
Line 
1<?php
2/*
3Plugin Name: User Collections
4Version: auto
5Description: Registered users can select pictures from the gallery and save them into collections, like advanced favorites.
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13if (mobile_theme())
14{
15  return;
16}
17
18global $conf, $prefixeTable;
19
20define('USER_COLLEC_ID',          basename(dirname(__FILE__)));
21define('USER_COLLEC_PATH',        PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/');
22define('COLLECTIONS_TABLE',       $prefixeTable.'collections');
23define('COLLECTION_IMAGES_TABLE', $prefixeTable.'collection_images');
24define('COLLECTION_SHARES_TABLE', $prefixeTable.'collection_shares');
25define('USER_COLLEC_ADMIN',       get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID);
26define('USER_COLLEC_PUBLIC',      get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/');
27define('USER_COLLEC_VERSION',    'auto');
28
29add_event_handler('init', 'user_collections_init');
30
31add_event_handler('ws_add_methods', 'user_collections_ws_add_methods');
32
33if (defined('IN_ADMIN'))
34{
35  add_event_handler('get_admin_plugin_menu_links', 'user_collections_admin_menu');
36}
37else
38{
39  // collections page
40  add_event_handler('loc_end_section_init', 'user_collections_section_init');
41  add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10);
42
43  // thumbnails actions
44  add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2);
45
46  // picture action
47  add_event_handler('loc_end_picture', 'user_collections_picture_page');
48}
49
50// menu
51add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock');
52add_event_handler('blockmanager_apply', 'user_collections_applymenu');
53
54require_once(USER_COLLEC_PATH . 'include/ws_functions.inc.php');
55require_once(USER_COLLEC_PATH . 'include/functions.inc.php');
56require_once(USER_COLLEC_PATH . 'include/UserCollection.class.php');
57require_once(USER_COLLEC_PATH . 'include/events.inc.php');
58
59
60/**
61 * update plugin & load language
62 */
63function user_collections_init()
64{
65  global $conf;
66
67  include_once(USER_COLLEC_PATH . 'maintain.inc.php');
68  $maintain = new UserCollections_maintain(USER_COLLEC_ID);
69  $maintain->autoUpdate(USER_COLLEC_VERSION, 'install');
70
71  load_language('plugin.lang', USER_COLLEC_PATH);
72
73  $conf['user_collections'] = unserialize($conf['user_collections']);
74}
75
76/**
77 * admin plugins menu
78 */
79function user_collections_admin_menu($menu)
80{
81  $menu[] = array(
82    'NAME' => 'User Collections',
83    'URL' => USER_COLLEC_ADMIN,
84    );
85
86  return $menu;
87}
Note: See TracBrowser for help on using the repository browser.