source: extensions/AdditionalPages/main.inc.php @ 9272

Last change on this file since 9272 was 9272, checked in by patdenice, 10 years ago

New functionalities

File size: 1.4 KB
Line 
1<?php
2/*
3Plugin Name: Additional Pages
4Version: auto
5Description: Add additional pages in menubar.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=153
7Author: P@t
8Author URI: http://www.gauchon.com
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable, $conf;
14
15define('AP_DIR' , basename(dirname(__FILE__)));
16define('AP_PATH' , PHPWG_PLUGINS_PATH . AP_DIR . '/');
17define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages');
18
19$conf['additional_pages'] = @unserialize($conf['additional_pages']);
20
21if ($conf['additional_pages'] === false)
22  include(AP_PATH.'admin/upgrade_from_21.php');
23
24function additional_pages_admin_menu($menu)
25{
26    array_push($menu, array(
27      'NAME' => 'Additional Pages',
28      'URL' => get_admin_plugin_menu_link(AP_PATH . 'admin/admin.php')));
29    return $menu;
30}
31
32function section_init_additional_page()
33{
34  global $tokens, $conf, $page;
35
36  $page['ap_homepage'] = (count($tokens) == 1 and empty($tokens[0]));
37
38  if (($tokens[0] == 'page' and !empty($tokens[1])) or ($page['ap_homepage'] and !is_null($conf['additional_pages']['homepage'])))
39    include(AP_PATH . 'additional_page.php');
40
41  if ($tokens[0] == 'additional_page' and !empty($tokens[1]))
42    redirect(make_index_url().'/page/'.$tokens[1]);
43}
44
45include(AP_PATH . 'index_menu.php');
46
47add_event_handler('get_admin_plugin_menu_links', 'additional_pages_admin_menu');
48add_event_handler('loc_end_section_init', 'section_init_additional_page');
49
50?>
Note: See TracBrowser for help on using the repository browser.