source: extensions/Subscribe_to_comments/main.inc.php @ 30848

Last change on this file since 30848 was 28851, checked in by mistic100, 10 years ago

use new maintain class

File size: 2.0 KB
Line 
1<?php
2/*
3Plugin Name: Subscribe To Comments
4Version: auto
5Description: This plugin allows to subscribe to comments by email.
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $prefixeTable;
14
15define('SUBSCRIBE_TO_ID',      basename(dirname(__FILE__)));
16define('SUBSCRIBE_TO_PATH' ,   PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/');
17define('SUBSCRIBE_TO_TABLE',   $prefixeTable . 'subscribe_to_comments');
18define('SUBSCRIBE_TO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SUBSCRIBE_TO_ID);
19
20
21add_event_handler('init', 'stc_init');
22
23
24function 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
70function stc_admin_menu($menu)
71{
72  $menu[] = array(
73    'NAME' => 'Subscribe to Comments',
74    'URL' => SUBSCRIBE_TO_ADMIN,
75    );
76  return $menu;
77}
Note: See TracBrowser for help on using the repository browser.