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

Revision 15640, 3.6 KB checked in by mistic100, 8 years ago (diff)
  • sql bug comments page
  • add trigger_action for other plugins
RevLine 
[9624]1<?php
2/*
[9641]3Plugin Name: Comments on Albums
[14528]4Version: auto
[9641]5Description: Activate comments on albums pages
[9624]6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
[14528]11## TODO ##
12// compatibility with Simple when updated to 2.4
13// compatibility with Gally when updated to 2.4
14
[9624]15if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
16
17global $prefixeTable;
18
19// +-----------------------------------------------------------------------+
[10984]20//          Global variables
[9624]21// +-----------------------------------------------------------------------+
22define('COA_DIR' , basename(dirname(__FILE__)));
23define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
24define('COA_TABLE' , $prefixeTable . 'comments_categories');
[9641]25define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
[9624]26
27
28// +-----------------------------------------------------------------------+
[10984]29//          Triggers
[9624]30// +-----------------------------------------------------------------------+
[12618]31add_event_handler('init', 'coa_init');
32function coa_init()
33{
34  global $user;
[14528]35 
36  // luciano doesn't use comments
37  // incompatible with dynamic display of Stripped & Collumns
[12618]38  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
39 
[14528]40  add_event_handler('loc_begin_page_header', 'COA_albums');
[12618]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}
[9624]46
47
48// +-----------------------------------------------------------------------+
[10984]49//          Functions
[9624]50// +-----------------------------------------------------------------------+
51
[11267]52function COA_albums() 
53{
[10984]54  global $template, $page, $conf, $pwg_loaded_plugins;
55 
[14528]56  if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )
57  {
[11267]58    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) 
59    {
60      set_bbcode_bar();
[11291]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      }
[11267]66    }
67    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) 
68    {
69      set_smiliessupport();
[11291]70      $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
[11267]71    }
[10984]72   
[15640]73    trigger_action('loc_begin_coa');
[10984]74    include(COA_PATH . 'include/coa_albums.php');
75  }
[9624]76}
77
[11267]78function COA_comments_page() 
79{
[11327]80  global $template, $page, $conf, $user;
[10984]81 
[11267]82  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
83  {
[10984]84    include(COA_PATH . 'include/coa_comments_page.php');
85  }
[9634]86}
87
[11267]88function COA_admin_intro() 
89{
90  global $page;
[10984]91 
[11267]92  if ($page['page'] == 'intro') 
93  { 
[10984]94    include(COA_PATH . 'include/coa_admin_intro.php');
95  } 
[9624]96}
97
[11267]98function COA_admin_comments() 
99{
100  global $page;
101 
102  if ($page['page'] == 'comments') 
103  { 
104    include(COA_PATH . 'include/coa_admin_comments.php');
105  }
106}
107
[12381]108function COA_register_stuffs_module($modules) 
109{
110  load_language('plugin.lang', COA_PATH);
111 
112  array_push($modules, array(
113    'path' => COA_PATH . '/stuffs_module',
114    'name' => l10n('Last comments on albums'),
115    'description' => l10n('Display last posted comments on albums'),
116  ));
117
118  return $modules;
119}
120
[9624]121?>
Note: See TracBrowser for help on using the repository browser.