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

Last change on this file since 9369 was 9369, checked in by patdenice, 13 years ago

Plugins can add their own modules.

File size: 1.6 KB
Line 
1<?php
2/*
3Plugin Name: PWG Stuffs
4Version: auto
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
11define('STUFFS_VERSION', '2.1.m');
12
13if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
14
15global $prefixeTable;
16
17define('STUFFS_DIR' , basename(dirname(__FILE__)));
18define('STUFFS_PATH' , PHPWG_PLUGINS_PATH . STUFFS_DIR . '/');
19define('STUFFS_TABLE' , $prefixeTable . 'stuffs');
20
21// Need upgrade?
22if ($plugin['version'] != STUFFS_VERSION)
23  include('admin/upgrade.inc.php');
24
25function stuffs_admin_menu($menu)
26{
27    array_push($menu, array(
28      'NAME' => 'PWG Stuffs',
29      'URL' => get_admin_plugin_menu_link(STUFFS_PATH . 'admin/admin.php')));
30    return $menu;
31}
32
33function set_stuffs_on_index()
34{
35  global $page;
36
37  if (isset($page['section']) and $page['section'] == 'categories')
38  {
39    include_once(STUFFS_PATH . 'include/stuffs.inc.php');
40  }
41}
42
43function set_stuffs_on_picture()
44{
45  include_once(STUFFS_PATH . 'include/stuffs.inc.php');
46}
47
48add_event_handler('get_admin_plugin_menu_links', 'stuffs_admin_menu');
49add_event_handler('loc_begin_index', 'set_stuffs_on_index');
50add_event_handler('loc_begin_picture', 'set_stuffs_on_picture');
51
52function set_is_homepage()
53{
54  global $tokens, $page;
55
56  $next_token = 0;
57  $parsed_url = parse_section_url($tokens, $next_token);
58  if (!isset($parsed_url['section']) and !isset($page['chronology_field']))
59  {
60    $page['is_homepage'] = true;
61  }
62  else
63  {
64    $page['is_homepage'] = false;
65  }
66}
67add_event_handler('loc_end_section_init', 'set_is_homepage');
68?>
Note: See TracBrowser for help on using the repository browser.