source: extensions/Comments_on_Albums/main.inc.php @ 11267

Last change on this file since 11267 was 11267, checked in by mistic100, 13 years ago

big code cleaning

File size: 2.7 KB
Line 
1<?php
2/*
3Plugin Name: Comments on Albums
4Version: auto
5Description: Activate comments on albums pages
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15// +-----------------------------------------------------------------------+
16//          Global variables
17// +-----------------------------------------------------------------------+
18define('COA_DIR' , basename(dirname(__FILE__)));
19define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
20define('COA_TABLE' , $prefixeTable . 'comments_categories');
21define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
22
23
24// +-----------------------------------------------------------------------+
25//          Triggers
26// +-----------------------------------------------------------------------+
27add_event_handler('loc_end_index', 'COA_albums');
28add_event_handler('loc_after_page_header', 'COA_comments_page');
29add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
30add_event_handler('loc_end_admin', 'COA_admin_comments');
31add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
32
33
34// +-----------------------------------------------------------------------+
35//          Functions
36// +-----------------------------------------------------------------------+
37
38function COA_albums() 
39{
40  global $template, $page, $conf, $pwg_loaded_plugins;
41 
42  if (
43    $page['section'] == 'categories' AND isset($page['category']) AND 
44    ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 )
45    ) 
46  {   
47    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) 
48    {
49      set_bbcode_bar();
50    }
51    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) 
52    {
53      set_smiliessupport();
54    }
55   
56    include(COA_PATH . 'include/coa_albums.php');
57  }
58}
59
60function COA_comments_page() 
61{
62  global $template, $page, $conf;
63 
64  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
65  {
66    include(COA_PATH . 'include/coa_comments_page.php');
67  }
68}
69
70function COA_admin_intro() 
71{
72  global $page;
73 
74  if ($page['page'] == 'intro') 
75  { 
76    include(COA_PATH . 'include/coa_admin_intro.php');
77  } 
78}
79
80function COA_admin_comments() 
81{
82  global $page;
83 
84  if ($page['page'] == 'comments') 
85  { 
86    include(COA_PATH . 'include/coa_admin_comments.php');
87  }
88}
89
90function COA_admin_menu($menu) 
91{
92  array_push($menu, array(
93    'NAME' => 'Comments on Albums',
94    'URL' => COA_ADMIN
95  ));
96  return $menu;
97}
98
99?>
Note: See TracBrowser for help on using the repository browser.