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('loc_end_index', 'COA_albums'); |
---|
28 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
29 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
30 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
31 | add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu'); |
---|
32 | |
---|
33 | |
---|
34 | // +-----------------------------------------------------------------------+ |
---|
35 | // Functions |
---|
36 | // +-----------------------------------------------------------------------+ |
---|
37 | |
---|
38 | function COA_albums() |
---|
39 | { |
---|
40 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
41 | |
---|
42 | if ( |
---|
43 | $page['section'] == 'categories' AND isset($page['category']) AND |
---|
44 | ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 ) |
---|
45 | ) |
---|
46 | { |
---|
47 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
48 | { |
---|
49 | set_bbcode_bar(); |
---|
50 | } |
---|
51 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
52 | { |
---|
53 | set_smiliessupport(); |
---|
54 | } |
---|
55 | |
---|
56 | include(COA_PATH . 'include/coa_albums.php'); |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | function COA_comments_page() |
---|
61 | { |
---|
62 | global $template, $page, $conf; |
---|
63 | |
---|
64 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
65 | { |
---|
66 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | function COA_admin_intro() |
---|
71 | { |
---|
72 | global $page; |
---|
73 | |
---|
74 | if ($page['page'] == 'intro') |
---|
75 | { |
---|
76 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
77 | } |
---|
78 | } |
---|
79 | |
---|
80 | function COA_admin_comments() |
---|
81 | { |
---|
82 | global $page; |
---|
83 | |
---|
84 | if ($page['page'] == 'comments') |
---|
85 | { |
---|
86 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | function COA_admin_menu($menu) |
---|
91 | { |
---|
92 | array_push($menu, array( |
---|
93 | 'NAME' => 'Comments on Albums', |
---|
94 | 'URL' => COA_ADMIN |
---|
95 | )); |
---|
96 | return $menu; |
---|
97 | } |
---|
98 | |
---|
99 | ?> |
---|