1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Comments on Albums |
---|
4 | Version: 1.1 |
---|
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_NAME' , 'Comments on Albums'); |
---|
19 | define('COA_VERSION', '1.0'); |
---|
20 | define('COA_DIR' , basename(dirname(__FILE__))); |
---|
21 | define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); |
---|
22 | define('COA_TABLE' , $prefixeTable . 'comments_categories'); |
---|
23 | define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR); |
---|
24 | |
---|
25 | |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | // Triggers |
---|
28 | // +-----------------------------------------------------------------------+ |
---|
29 | add_event_handler('loc_end_index', 'COA_index'); |
---|
30 | add_event_handler('loc_after_page_header', 'COA_comments_page'); |
---|
31 | add_event_handler('loc_end_admin', 'COA_admin'); |
---|
32 | add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu'); |
---|
33 | |
---|
34 | |
---|
35 | // +-----------------------------------------------------------------------+ |
---|
36 | // Functions |
---|
37 | // +-----------------------------------------------------------------------+ |
---|
38 | |
---|
39 | function COA_index() { |
---|
40 | global $template, $page, $conf, $pwg_loaded_plugins; |
---|
41 | |
---|
42 | if ($page['section'] == 'categories' AND isset($page['category']) |
---|
43 | AND (!isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0)) |
---|
44 | { |
---|
45 | |
---|
46 | if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar(); |
---|
47 | else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport(); |
---|
48 | |
---|
49 | include(COA_PATH . 'include/coa_albums.php'); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | function COA_comments_page() { |
---|
54 | global $template, $page, $conf; |
---|
55 | |
---|
56 | if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') { |
---|
57 | include(COA_PATH . 'include/coa_comments_page.php'); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | function COA_admin() { |
---|
62 | global $template, $page, $conf; |
---|
63 | |
---|
64 | if ($page['page'] == 'comments') { |
---|
65 | include(COA_PATH . 'include/coa_admin_comments.php'); |
---|
66 | } else if ($page['page'] == 'intro') { |
---|
67 | include(COA_PATH . 'include/coa_admin_intro.php'); |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | function COA_admin_menu($menu) { |
---|
72 | array_push($menu, array( |
---|
73 | 'NAME' => COA_NAME, |
---|
74 | 'URL' => COA_ADMIN |
---|
75 | )); |
---|
76 | return $menu; |
---|
77 | } |
---|
78 | |
---|
79 | ?> |
---|