source: extensions/GuestBook/main.inc.php @ 16567

Last change on this file since 16567 was 16347, checked in by mistic100, 12 years ago

replace all CRLF by LF

File size: 2.2 KB
Line 
1<?php
2/*
3Plugin Name: GuestBook
4Version: auto
5Description: Add a guestbook to the gallery
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=609
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15
16define('GUESTBOOK_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
17define('GUESTBOOK_TABLE' , $prefixeTable . 'guestbook');
18define('GUESTBOOK_URL', make_index_url(array('section' => 'guestbook')));
19define('GUESTBOOK_ADMIN', get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__)));
20
21add_event_handler('init', 'gb_init');
22
23function gb_init()
24{
25  global $conf;
26 
27  load_language('plugin.lang', GUESTBOOK_PATH);
28  $conf['guestbook'] = unserialize($conf['guestbook']);
29 
30  // menubar
31  if (script_basename() != 'admin')
32  {
33    add_event_handler('blockmanager_apply', 'gb_menubar_apply', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
34  }
35  else
36  {
37    add_event_handler('get_admin_plugin_menu_links', 'gb_admin_menu');
38  }
39 
40  // guestbook section
41  add_event_handler('loc_end_section_init', 'gb_section_init');
42  add_event_handler('loc_end_index', 'gb_index');
43 
44  // stuff
45  // add_event_handler('get_stuffs_modules', 'gb_register_stuffs_module')
46}
47
48function gb_menubar_apply($menu_ref_arr)
49{
50  $menu = &$menu_ref_arr[0];
51 
52  if ( ($block = $menu->get_block('mbMenu')) != null )
53  {
54    array_push($block->data, array(
55      'URL' => GUESTBOOK_URL,
56      'TITLE' => l10n('GuestBook'),
57      'NAME' => l10n('GuestBook')
58    ));
59  }
60}
61
62function gb_section_init()
63{
64  global $tokens, $page;
65
66  if ($tokens[0] == 'guestbook')
67  {
68    $page['section'] = 'guestbook';
69    $page['title'] = l10n('GuestBook');
70  }
71}
72
73function gb_index() 
74{
75  global $template, $page, $conf;
76
77  if (isset($page['section']) and $page['section'] == 'guestbook')
78  {
79    include(GUESTBOOK_PATH . '/include/guestbook.inc.php');
80  }
81}
82
83/*function gb_register_stuffs_module($modules)
84{
85  array_push($modules, array(
86    'path' => GUESTBOOK_PATH . '/stuffs_module',
87    'name' => GB_NAME,
88    'description' => l10n('gb_stuffs_desc'),
89  ));
90
91  return $modules;
92}*/
93
94function gb_admin_menu($menu) 
95{
96  array_push($menu, array(
97    'NAME' => 'GuestBook',
98    'URL' => GUESTBOOK_ADMIN,
99  ));
100  return $menu;
101}
102
103?>
Note: See TracBrowser for help on using the repository browser.