source: extensions/Comments_on_Albums/main.inc.php @ 15999

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

move some code to BBCode Bar and Smilies Support

File size: 2.9 KB
Line 
1<?php
2/*
3Plugin Name: Comments on Albums
4Version: auto
5Description: Activate comments on albums pages
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15// +-----------------------------------------------------------------------+
16//          Global variables
17// +-----------------------------------------------------------------------+
18define('COA_DIR' , basename(dirname(__FILE__)));
19define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
20define('COA_TABLE' , $prefixeTable . 'comments_categories');
21define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
22
23
24// +-----------------------------------------------------------------------+
25//          Triggers
26// +-----------------------------------------------------------------------+
27add_event_handler('init', 'coa_init');
28function coa_init()
29{
30  global $user;
31 
32  // luciano doesn't use comments
33  // incompatible with dynamic display of Stripped & Collumns
34  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
35 
36  add_event_handler('loc_after_page_header', 'COA_albums');
37  add_event_handler('loc_after_page_header', 'COA_comments_page');
38  add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
39  add_event_handler('loc_end_admin', 'COA_admin_comments');
40  add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module');
41}
42
43
44// +-----------------------------------------------------------------------+
45//          Functions
46// +-----------------------------------------------------------------------+
47
48function COA_albums() 
49{
50  global $template, $page, $conf, $pwg_loaded_plugins;
51 
52  if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )
53  {   
54    trigger_action('loc_begin_coa');
55    include(COA_PATH . 'include/coa_albums.php');
56  }
57}
58
59function COA_comments_page() 
60{
61  global $template, $page, $conf, $user;
62 
63  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
64  {
65    include(COA_PATH . 'include/coa_comments_page.php');
66  }
67}
68
69function COA_admin_intro() 
70{
71  global $page;
72 
73  if ($page['page'] == 'intro') 
74  { 
75    include(COA_PATH . 'include/coa_admin_intro.php');
76  } 
77}
78
79function COA_admin_comments() 
80{
81  global $page;
82 
83  if ($page['page'] == 'comments') 
84  { 
85    include(COA_PATH . 'include/coa_admin_comments.php');
86  }
87}
88
89function COA_register_stuffs_module($modules) 
90{
91  load_language('plugin.lang', COA_PATH);
92 
93  array_push($modules, array(
94    'path' => COA_PATH . '/stuffs_module',
95    'name' => l10n('Last comments on albums'),
96    'description' => l10n('Display last posted comments on albums'),
97  ));
98
99  return $modules;
100}
101
102?>
Note: See TracBrowser for help on using the repository browser.