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

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

updated for Piwigo 2.4
new filters : name, author, level, hits

File size: 2.0 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');
19include_once(SMART_PATH.'include/functions.inc.php');
20
21if (script_basename() == 'index')
22{
23  add_event_handler('loc_end_section_init', 'smart_init_page_items');
24  include_once(SMART_PATH.'include/page_items.php');
25}
26else if (script_basename() == 'admin')
27{
28  global $conf;
29 
30  load_language('plugin.lang', SMART_PATH);
31  $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
32   
33  add_event_handler('loc_begin_cat_list', 'smart_cat_list');
34  include_once(SMART_PATH.'include/cat_list.php');
35 
36  add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu');
37  function smart_admin_menu($menu) 
38  {
39    array_push($menu, array(
40        'NAME' => 'SmartAlbums',
41        'URL' => SMART_ADMIN,
42      ));
43    return $menu;
44  }
45   
46  add_event_handler('loc_begin_admin_page', 'smart_add_admin_album_tab');
47  function smart_add_admin_album_tab()
48  {
49    global $page, $template;
50    if ($page['page'] != 'album') return;
51   
52    $template->set_prefilter('tabsheet', 'smart_add_admin_album_tab_prefilter');
53  }
54  function smart_add_admin_album_tab_prefilter($content)
55  {
56    $search = '{/foreach}';
57    $add = '
58  <li class="{if false}selected_tab{else}normal_tab{/if}">
59    <a href="'.SMART_ADMIN.'-album&amp;cat_id='.$_GET['cat_id'].'"><span>SmartAlbum</span></a>
60  </li>';
61    return str_replace($search, $search.$add, $content);
62  }
63}
64
65?>
Note: See TracBrowser for help on using the repository browser.