source: extensions/SmartAlbums/main.inc.php @ 27153

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

update for Piwigo 2.6

File size: 1.8 KB
Line 
1<?php
2/*
3Plugin Name: SmartAlbums
4Version: auto
5Description: Easily create dynamic albums with tags, date and other criteria
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $prefixeTable;
14
15define('SMART_ID',      'SmartAlbums');
16define('SMART_PATH',    PHPWG_PLUGINS_PATH . SMART_ID . '/');
17define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters');
18define('SMART_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SMART_ID);
19define('SMART_VERSION', 'auto');
20// define('SMART_DEBUG',   true);
21
22
23add_event_handler('init', 'smart_init');
24add_event_handler('init', 'smart_periodic_update');
25add_event_handler('delete_categories', 'smart_delete_categories');
26
27if (defined('IN_ADMIN'))
28{
29  include_once(SMART_PATH.'include/events_admin.inc.php');
30  add_event_handler('loc_begin_cat_list', 'smart_cat_list');
31  add_event_handler('tabsheet_before_select','smart_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
32  add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu');
33}
34
35include_once(SMART_PATH.'include/events.inc.php');
36include_once(SMART_PATH.'include/functions.inc.php');
37
38
39/**
40 * update plugin & unserialize conf & load language
41 */
42function smart_init()
43{
44  global $conf;
45
46  include_once(SMART_PATH . 'maintain.inc.php');
47  $maintain = new SmartAlbums_maintain(SMART_ID);
48  $maintain->autoUpdate(SMART_VERSION, 'install');
49
50  if (defined('IN_ADMIN'))
51  {
52    load_language('plugin.lang', SMART_PATH);
53  }
54  $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
55
56  if (script_basename() == 'index' and $conf['SmartAlbums']['smart_is_forbidden'])
57  {
58    add_event_handler('loc_end_section_init', 'smart_init_page_items');
59  }
60
61  if ($conf['SmartAlbums']['update_on_upload'])
62  {
63    add_event_handler('invalidate_user_cache', 'smart_make_all_associations');
64  }
65}
Note: See TracBrowser for help on using the repository browser.