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 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
47 | { |
---|
48 | set_bbcode_bar(); |
---|
49 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
50 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
51 | { |
---|
52 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
53 | } |
---|
54 | } |
---|
55 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
56 | { |
---|
57 | set_smiliessupport(); |
---|
58 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
59 | } |
---|
60 | |
---|
61 | include(COA_PATH . 'include/coa_albums.php'); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | function COA_comments_page() |
---|
66 | { |
---|
67 | global $template, $page, $conf, $user; |
---|
68 | |
---|
69 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
70 | { |
---|
71 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | function COA_admin_intro() |
---|
76 | { |
---|
77 | global $page; |
---|
78 | |
---|
79 | if ($page['page'] == 'intro') |
---|
80 | { |
---|
81 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
82 | } |
---|
83 | } |
---|
84 | |
---|
85 | function COA_admin_comments() |
---|
86 | { |
---|
87 | global $page; |
---|
88 | |
---|
89 | if ($page['page'] == 'comments') |
---|
90 | { |
---|
91 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
92 | } |
---|
93 | } |
---|
94 | |
---|
95 | function COA_admin_menu($menu) |
---|
96 | { |
---|
97 | array_push($menu, array( |
---|
98 | 'NAME' => 'Comments on Albums', |
---|
99 | 'URL' => COA_ADMIN |
---|
100 | )); |
---|
101 | return $menu; |
---|
102 | } |
---|
103 | |
---|
104 | ?> |
---|