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

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

code cleanup

File size: 2.5 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_index');
28add_event_handler('loc_after_page_header', 'COA_comments_page');
29add_event_handler('loc_end_admin', 'COA_admin');
30add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
31
32
33// +-----------------------------------------------------------------------+
34//          Functions
35// +-----------------------------------------------------------------------+
36
37function COA_index() {
38  global $template, $page, $conf, $pwg_loaded_plugins;
39 
40  if ($page['section'] == 'categories' AND isset($page['category']) 
41    AND (!isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0)) 
42  { 
43   
44    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar();
45    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport();
46   
47    include(COA_PATH . 'include/coa_albums.php');
48  }
49}
50
51function COA_comments_page() {
52  global $template, $page, $conf;
53 
54  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') {
55    include(COA_PATH . 'include/coa_comments_page.php');
56  }
57}
58
59function COA_admin() {
60  global $template, $page, $conf;
61 
62  if ($page['page'] == 'comments') { 
63    include(COA_PATH . 'include/coa_admin_comments.php');
64  } else if ($page['page'] == 'intro') { 
65    include(COA_PATH . 'include/coa_admin_intro.php');
66  } 
67}
68
69function COA_admin_menu($menu) {
70  array_push($menu, array(
71    'NAME' => 'Comments on Albums',
72    'URL' => COA_ADMIN
73  ));
74  return $menu;
75}
76
77?>
Note: See TracBrowser for help on using the repository browser.