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

Last change on this file since 17039 was 17013, checked in by mistic100, 12 years ago

clean up table when a category is deleted

File size: 1.9 KB
Line 
1<?php
2/*
3Plugin Name: SmartAlbums
4Version: auto
5Description: Easily create dynamic albums with tags, date and other criteria
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=544
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12global $prefixeTable;
13
14define('SMART_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
15define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters');
16define('SMART_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
17
18add_event_handler('invalidate_user_cache', 'smart_make_all_associations');
19add_event_handler('init', 'smart_init');
20
21include_once(SMART_PATH.'include/functions.inc.php');
22
23function smart_init()
24{
25  global $conf;
26 
27  load_language('plugin.lang', SMART_PATH);
28  $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
29 
30  if ( script_basename() == 'index' and $conf['SmartAlbums']['smart_is_forbidden'] )
31  {
32    add_event_handler('loc_end_section_init', 'smart_init_page_items');
33    include_once(SMART_PATH.'include/page_items.php');
34  }
35  else if (script_basename() == 'admin')
36  {
37    include_once(SMART_PATH.'include/cat_list.php');
38   
39    add_event_handler('loc_begin_cat_list', 'smart_cat_list');
40    add_event_handler('tabsheet_before_select','smart_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 
41    add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu');
42    add_event_handler('delete_categories', 'smart_delete_categories');
43  }
44}
45
46function smart_tab($sheets, $id)
47{
48  if ($id == 'album')
49  {
50    $sheets['smartalbum'] = array(
51      'caption' => 'SmartAlbum',
52      'url' => SMART_ADMIN.'-album&amp;cat_id='.$_GET['cat_id'],
53      );
54  }
55 
56  return $sheets;
57}
58
59function smart_admin_menu($menu) 
60{
61  array_push($menu, array(
62      'NAME' => 'SmartAlbums',
63      'URL' => SMART_ADMIN,
64    ));
65  return $menu;
66}
67
68?>
Note: See TracBrowser for help on using the repository browser.