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 | // luciano doesn't show comments, display is very bad on Stripped & Collumns |
---|
32 | if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; |
---|
33 | |
---|
34 | add_event_handler('loc_end_index', 'COA_albums'); |
---|
35 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
36 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
37 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
38 | add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu'); |
---|
39 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | // +-----------------------------------------------------------------------+ |
---|
44 | // Functions |
---|
45 | // +-----------------------------------------------------------------------+ |
---|
46 | |
---|
47 | function COA_albums() |
---|
48 | { |
---|
49 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
50 | |
---|
51 | if ( |
---|
52 | $page['section'] == 'categories' AND isset($page['category']) AND |
---|
53 | ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 ) |
---|
54 | ) { |
---|
55 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
56 | { |
---|
57 | set_bbcode_bar(); |
---|
58 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
59 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
60 | { |
---|
61 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
62 | } |
---|
63 | } |
---|
64 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
65 | { |
---|
66 | set_smiliessupport(); |
---|
67 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
68 | } |
---|
69 | |
---|
70 | include(COA_PATH . 'include/coa_albums.php'); |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | function COA_comments_page() |
---|
75 | { |
---|
76 | global $template, $page, $conf, $user; |
---|
77 | |
---|
78 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
79 | { |
---|
80 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | function COA_admin_intro() |
---|
85 | { |
---|
86 | global $page; |
---|
87 | |
---|
88 | if ($page['page'] == 'intro') |
---|
89 | { |
---|
90 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | function COA_admin_comments() |
---|
95 | { |
---|
96 | global $page; |
---|
97 | |
---|
98 | if ($page['page'] == 'comments') |
---|
99 | { |
---|
100 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | function COA_admin_menu($menu) |
---|
105 | { |
---|
106 | array_push($menu, array( |
---|
107 | 'NAME' => 'Comments on Albums', |
---|
108 | 'URL' => COA_ADMIN |
---|
109 | )); |
---|
110 | return $menu; |
---|
111 | } |
---|
112 | |
---|
113 | function COA_register_stuffs_module($modules) |
---|
114 | { |
---|
115 | load_language('plugin.lang', COA_PATH); |
---|
116 | |
---|
117 | array_push($modules, array( |
---|
118 | 'path' => COA_PATH . '/stuffs_module', |
---|
119 | 'name' => l10n('Last comments on albums'), |
---|
120 | 'description' => l10n('Display last posted comments on albums'), |
---|
121 | )); |
---|
122 | |
---|
123 | return $modules; |
---|
124 | } |
---|
125 | |
---|
126 | |
---|
127 | ?> |
---|