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 | ## TODO ## |
---|
12 | // compatibility with Simple when updated to 2.4 |
---|
13 | // compatibility with Gally when updated to 2.4 |
---|
14 | |
---|
15 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
16 | |
---|
17 | global $prefixeTable; |
---|
18 | |
---|
19 | // +-----------------------------------------------------------------------+ |
---|
20 | // Global variables |
---|
21 | // +-----------------------------------------------------------------------+ |
---|
22 | define('COA_DIR' , basename(dirname(__FILE__))); |
---|
23 | define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); |
---|
24 | define('COA_TABLE' , $prefixeTable . 'comments_categories'); |
---|
25 | define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR); |
---|
26 | |
---|
27 | |
---|
28 | // +-----------------------------------------------------------------------+ |
---|
29 | // Triggers |
---|
30 | // +-----------------------------------------------------------------------+ |
---|
31 | add_event_handler('init', 'coa_init'); |
---|
32 | function coa_init() |
---|
33 | { |
---|
34 | global $user; |
---|
35 | |
---|
36 | // luciano doesn't use comments |
---|
37 | // incompatible with dynamic display of Stripped & Collumns |
---|
38 | if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; |
---|
39 | |
---|
40 | add_event_handler('loc_begin_page_header', 'COA_albums'); |
---|
41 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
42 | add_event_handler('loc_begin_admin_page', 'COA_admin_intro'); |
---|
43 | add_event_handler('loc_end_admin', 'COA_admin_comments'); |
---|
44 | add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module'); |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | // +-----------------------------------------------------------------------+ |
---|
49 | // Functions |
---|
50 | // +-----------------------------------------------------------------------+ |
---|
51 | |
---|
52 | function COA_albums() |
---|
53 | { |
---|
54 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
55 | |
---|
56 | if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' ) |
---|
57 | { |
---|
58 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) |
---|
59 | { |
---|
60 | set_bbcode_bar(); |
---|
61 | $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); |
---|
62 | if (isset($pwg_loaded_plugins['SmiliesSupport'])) |
---|
63 | { |
---|
64 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
65 | } |
---|
66 | } |
---|
67 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) |
---|
68 | { |
---|
69 | set_smiliessupport(); |
---|
70 | $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter'); |
---|
71 | } |
---|
72 | |
---|
73 | trigger_action('loc_begin_coa'); |
---|
74 | include(COA_PATH . 'include/coa_albums.php'); |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | function COA_comments_page() |
---|
79 | { |
---|
80 | global $template, $page, $conf, $user; |
---|
81 | |
---|
82 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') |
---|
83 | { |
---|
84 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
85 | } |
---|
86 | } |
---|
87 | |
---|
88 | function COA_admin_intro() |
---|
89 | { |
---|
90 | global $page; |
---|
91 | |
---|
92 | if ($page['page'] == 'intro') |
---|
93 | { |
---|
94 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | function COA_admin_comments() |
---|
99 | { |
---|
100 | global $page; |
---|
101 | |
---|
102 | if ($page['page'] == 'comments') |
---|
103 | { |
---|
104 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | function COA_register_stuffs_module($modules) |
---|
109 | { |
---|
110 | load_language('plugin.lang', COA_PATH); |
---|
111 | |
---|
112 | array_push($modules, array( |
---|
113 | 'path' => COA_PATH . '/stuffs_module', |
---|
114 | 'name' => l10n('Last comments on albums'), |
---|
115 | 'description' => l10n('Display last posted comments on albums'), |
---|
116 | )); |
---|
117 | |
---|
118 | return $modules; |
---|
119 | } |
---|
120 | |
---|
121 | ?> |
---|