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

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

use new maintain class

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