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

Last change on this file since 14600 was 14528, checked in by mistic100, 12 years ago

update for 2.4
delete useless admin page
now compatible with RV Thumb Scroller

File size: 3.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
11## TODO ##
12// compatibility with Simple when updated to 2.4
13// compatibility with Gally when updated to 2.4
14
15if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
16
17global $prefixeTable;
18
19// +-----------------------------------------------------------------------+
20//          Global variables
21// +-----------------------------------------------------------------------+
22define('COA_DIR' , basename(dirname(__FILE__)));
23define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
24define('COA_TABLE' , $prefixeTable . 'comments_categories');
25define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
26
27
28// +-----------------------------------------------------------------------+
29//          Triggers
30// +-----------------------------------------------------------------------+
31add_event_handler('init', 'coa_init');
32function coa_init()
33{
34  global $user;
35 
36  // luciano doesn't use comments
37  // incompatible with dynamic display of Stripped & Collumns
38  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
39 
40  add_event_handler('loc_begin_page_header', 'COA_albums');
41  add_event_handler('loc_after_page_header', 'COA_comments_page');
42  add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
43  add_event_handler('loc_end_admin', 'COA_admin_comments');
44  add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module');
45}
46
47
48// +-----------------------------------------------------------------------+
49//          Functions
50// +-----------------------------------------------------------------------+
51
52function COA_albums() 
53{
54  global $template, $page, $conf, $pwg_loaded_plugins;
55 
56  if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )
57  {
58    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) 
59    {
60      set_bbcode_bar();
61      $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); 
62      if (isset($pwg_loaded_plugins['SmiliesSupport']))
63      {
64        $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
65      }
66    }
67    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) 
68    {
69      set_smiliessupport();
70      $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
71    }
72   
73    include(COA_PATH . 'include/coa_albums.php');
74  }
75}
76
77function COA_comments_page() 
78{
79  global $template, $page, $conf, $user;
80 
81  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
82  {
83    include(COA_PATH . 'include/coa_comments_page.php');
84  }
85}
86
87function COA_admin_intro() 
88{
89  global $page;
90 
91  if ($page['page'] == 'intro') 
92  { 
93    include(COA_PATH . 'include/coa_admin_intro.php');
94  } 
95}
96
97function COA_admin_comments() 
98{
99  global $page;
100 
101  if ($page['page'] == 'comments') 
102  { 
103    include(COA_PATH . 'include/coa_admin_comments.php');
104  }
105}
106
107function COA_register_stuffs_module($modules) 
108{
109  load_language('plugin.lang', COA_PATH);
110 
111  array_push($modules, array(
112    'path' => COA_PATH . '/stuffs_module',
113    'name' => l10n('Last comments on albums'),
114    'description' => l10n('Display last posted comments on albums'),
115  ));
116
117  return $modules;
118}
119
120?>
Note: See TracBrowser for help on using the repository browser.