1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Comments on Albums |
---|
4 | Version: auto |
---|
5 | Description: Activate comments on albums pages |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512 |
---|
7 | Author: Mistic |
---|
8 | Author URI: http://www.strangeplanet.fr |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | |
---|
13 | global $prefixeTable; |
---|
14 | |
---|
15 | // +-----------------------------------------------------------------------+ |
---|
16 | // Global variables |
---|
17 | // +-----------------------------------------------------------------------+ |
---|
18 | define('COA_DIR' , basename(dirname(__FILE__))); |
---|
19 | define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); |
---|
20 | define('COA_TABLE' , $prefixeTable . 'comments_categories'); |
---|
21 | define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR); |
---|
22 | |
---|
23 | |
---|
24 | // +-----------------------------------------------------------------------+ |
---|
25 | // Triggers |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | add_event_handler('init', 'coa_init'); |
---|
28 | function 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 | |
---|
48 | function 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 | |
---|
59 | function 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 | |
---|
69 | function 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 | |
---|
79 | function 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 | |
---|
89 | function 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 | ?> |
---|