1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Subscribe To Comments |
---|
4 | Version: auto |
---|
5 | Description: This plugin allows to subscribe to comments by email. |
---|
6 | Plugin URI: auto |
---|
7 | Author: Mistic |
---|
8 | Author URI: http://www.strangeplanet.fr |
---|
9 | */ |
---|
10 | |
---|
11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
12 | |
---|
13 | global $prefixeTable; |
---|
14 | |
---|
15 | define('SUBSCRIBE_TO_ID', basename(dirname(__FILE__))); |
---|
16 | define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/'); |
---|
17 | define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments'); |
---|
18 | define('SUBSCRIBE_TO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . SUBSCRIBE_TO_ID); |
---|
19 | |
---|
20 | |
---|
21 | add_event_handler('init', 'stc_init'); |
---|
22 | |
---|
23 | |
---|
24 | function stc_init() |
---|
25 | { |
---|
26 | global $conf, $user; |
---|
27 | |
---|
28 | // no comments on luciano |
---|
29 | if ($user['theme'] == 'luciano') |
---|
30 | { |
---|
31 | return; |
---|
32 | } |
---|
33 | |
---|
34 | load_language('plugin.lang', SUBSCRIBE_TO_PATH); |
---|
35 | $conf['Subscribe_to_Comments'] = safe_unserialize($conf['Subscribe_to_Comments']); |
---|
36 | |
---|
37 | include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php'); |
---|
38 | include_once(SUBSCRIBE_TO_PATH.'include/events.inc.php'); |
---|
39 | |
---|
40 | |
---|
41 | if (!defined('IN_ADMIN')) |
---|
42 | { |
---|
43 | // subscribe |
---|
44 | add_event_handler('loc_end_picture', 'stc_on_picture'); |
---|
45 | add_event_handler('loc_end_coa', 'stc_on_album'); |
---|
46 | |
---|
47 | // management |
---|
48 | add_event_handler('loc_end_section_init', 'stc_detect_section'); |
---|
49 | add_event_handler('loc_begin_page_header', 'stc_load_section'); |
---|
50 | |
---|
51 | // profile link |
---|
52 | add_event_handler('loc_begin_profile', 'stc_profile_link'); |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | // config page |
---|
57 | add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu'); |
---|
58 | } |
---|
59 | |
---|
60 | // send mails |
---|
61 | add_event_handler('user_comment_insertion', 'stc_comment_insertion'); |
---|
62 | add_event_handler('user_comment_validation', 'stc_comment_validation', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
63 | |
---|
64 | // items deletion |
---|
65 | add_event_handler('begin_delete_elements', 'stc_delete_elements'); |
---|
66 | add_event_handler('delete_categories', 'stc_delete_categories'); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | function stc_admin_menu($menu) |
---|
71 | { |
---|
72 | $menu[] = array( |
---|
73 | 'NAME' => 'Subscribe to Comments', |
---|
74 | 'URL' => SUBSCRIBE_TO_ADMIN, |
---|
75 | ); |
---|
76 | return $menu; |
---|
77 | } |
---|