[10871] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: SmartAlbums |
---|
| 4 | Version: auto |
---|
[10980] | 5 | Description: Easily create dynamic albums with tags, date and other criteria |
---|
| 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=544 |
---|
[10871] | 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | global $prefixeTable; |
---|
| 13 | |
---|
[16104] | 14 | define('SMART_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
| 15 | define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters'); |
---|
| 16 | define('SMART_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__))); |
---|
[10871] | 17 | |
---|
[11376] | 18 | add_event_handler('invalidate_user_cache', 'smart_make_all_associations'); |
---|
[16939] | 19 | add_event_handler('init', 'smart_init'); |
---|
[16126] | 20 | |
---|
[11376] | 21 | include_once(SMART_PATH.'include/functions.inc.php'); |
---|
| 22 | |
---|
[16126] | 23 | function smart_init() |
---|
| 24 | { |
---|
[16104] | 25 | global $conf; |
---|
| 26 | |
---|
[11290] | 27 | load_language('plugin.lang', SMART_PATH); |
---|
[16104] | 28 | $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']); |
---|
[16939] | 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'); |
---|
[16104] | 38 | |
---|
[16939] | 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'); |
---|
[17013] | 42 | add_event_handler('delete_categories', 'smart_delete_categories'); |
---|
[16939] | 43 | } |
---|
[10871] | 44 | } |
---|
| 45 | |
---|
[16938] | 46 | function smart_tab($sheets, $id) |
---|
| 47 | { |
---|
[17207] | 48 | if ($id != 'album') return $sheets; |
---|
| 49 | |
---|
| 50 | global $category; |
---|
| 51 | |
---|
| 52 | if ($category['dir'] == null) |
---|
[16938] | 53 | { |
---|
| 54 | $sheets['smartalbum'] = array( |
---|
| 55 | 'caption' => 'SmartAlbum', |
---|
| 56 | 'url' => SMART_ADMIN.'-album&cat_id='.$_GET['cat_id'], |
---|
| 57 | ); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | return $sheets; |
---|
| 61 | } |
---|
| 62 | |
---|
[16126] | 63 | function smart_admin_menu($menu) |
---|
| 64 | { |
---|
| 65 | array_push($menu, array( |
---|
| 66 | 'NAME' => 'SmartAlbums', |
---|
| 67 | 'URL' => SMART_ADMIN, |
---|
| 68 | )); |
---|
| 69 | return $menu; |
---|
| 70 | } |
---|
| 71 | |
---|
[10871] | 72 | ?> |
---|