source: extensions/PWG_Stuffs/main.inc.php @ 8677

Last change on this file since 8677 was 7402, checked in by plg, 13 years ago

modification: home page is not the same as the root category. This way you can
hide the root category main block on homepage without forbidding access to the
root category.

File size: 1.5 KB
Line 
1<?php
2/*
3Plugin Name: PWG Stuffs
4Version: 2.0.q
5Description: Insert modules on your gallery
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=190
7Author: P@t
8Author URI: http://www.gauchon.com
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15define('STUFFS_DIR' , basename(dirname(__FILE__)));
16define('STUFFS_PATH' , PHPWG_PLUGINS_PATH . STUFFS_DIR . '/');
17define('STUFFS_TABLE' , $prefixeTable . 'stuffs');
18
19function stuffs_admin_menu($menu)
20{
21    array_push($menu, array(
22      'NAME' => 'PWG Stuffs',
23      'URL' => get_admin_plugin_menu_link(STUFFS_PATH . 'admin/admin.php')));
24    return $menu;
25}
26
27function set_stuffs_on_index()
28{
29        global $page;
30
31  if (isset($page['section']) and $page['section'] == 'categories')
32  {
33    include_once(STUFFS_PATH . 'include/stuffs.inc.php');
34        }
35}
36
37function set_stuffs_on_picture()
38{
39        include_once(STUFFS_PATH . 'include/stuffs.inc.php');
40}
41
42add_event_handler('get_admin_plugin_menu_links', 'stuffs_admin_menu');
43add_event_handler('loc_begin_index', 'set_stuffs_on_index');
44add_event_handler('loc_begin_picture', 'set_stuffs_on_picture');
45
46function set_is_homepage()
47{
48  global $tokens, $page;
49
50  $next_token = 0;
51  $parsed_url = parse_section_url($tokens, $next_token);
52  if (!isset($parsed_url['section']) and !isset($page['chronology_field']))
53  {
54    $page['is_homepage'] = true;
55  }
56  else
57  {
58    $page['is_homepage'] = false;
59  }
60}
61add_event_handler('loc_end_section_init', 'set_is_homepage');
62?>
Note: See TracBrowser for help on using the repository browser.