source: tags/build-A01/plugins/add_index/main.admin.inc.php @ 20384

Last change on this file since 20384 was 1705, checked in by rvelices, 17 years ago

Plugins: new way of adding links and content to administration pages...

File size: 4.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net              |
7// +-----------------------------------------------------------------------+
8// | branch        : BSF (Best So Far)
9// | file          : $RCSfile$
10// | last update   : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
11// | last modifier : $Author: rub $
12// | revision      : $Revision: 1481 $
13// +-----------------------------------------------------------------------+
14// | This program is free software; you can redistribute it and/or modify  |
15// | it under the terms of the GNU General Public License as published by  |
16// | the Free Software Foundation                                          |
17// |                                                                       |
18// | This program is distributed in the hope that it will be useful, but   |
19// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
20// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
21// | General Public License for more details.                              |
22// |                                                                       |
23// | You should have received a copy of the GNU General Public License     |
24// | along with this program; if not, write to the Free Software           |
25// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
26// | USA.                                                                  |
27// +-----------------------------------------------------------------------+
28
29if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
30{
31  die('Hacking attempt!');
32}
33
34class AdminAddIndex extends AddIndex
35{
36  var $my_id;
37  function load_params()
38  {
39    global $conf;
40    // Name of index file (index.php or index.htm or index.html)
41    if (!isset($conf['add_index_filename']))
42    {
43      $conf['add_index_filename'] = 'index.php';
44    }
45    // Name of index file (index.php or index.htm or index.html)
46    if (!isset($conf['add_index_source_directory_path']))
47    {
48      // Name of the directoty use in order to copy index file
49      $conf['add_index_source_directory_path'] = PHPWG_ROOT_PATH.'include/';
50    }
51  }
52
53  function loading_lang()
54  {
55    global $lang;
56
57    include(get_language_filepath('plugin.lang.php', $this->path));
58  }
59
60  function get_admin_advanced_features_links($advanced_features)
61  {
62    array_push($advanced_features,
63      array
64      (
65        'CAPTION' => l10n('Advanced_Add_Index'),
66        'URL' => get_admin_plugin_menu_link($this->my_id, 'admin/main_page').'&amp;overwrite'
67      ));
68
69    return $advanced_features;
70  }
71
72  function get_admins_site_links($site_manager_plugin_links, $site_id, $is_remote)
73  {
74    if (!$is_remote)
75    {
76      array_push($site_manager_plugin_links,
77        array
78        (
79          'U_HREF' => get_admin_plugin_menu_link($this->my_id, 'admin/main_page').'&amp;site_id='.$site_id,
80          'U_CAPTION' => l10n('Manager_Add_Index'),
81          'U_HINT' => l10n('Add_Index')
82        ));
83    }
84
85    return $site_manager_plugin_links;
86  }
87
88  function plugin_admin_menu($menu)
89  {
90    array_push($menu,
91        array(
92          'NAME' => l10n('Menu_Add_Index'),
93          'URL' => get_admin_plugin_menu_link($this->my_id, 'admin/admin_menu')
94        )
95      );
96    return $menu;
97  }
98}
99
100// Create object
101$add_index = new AdminAddIndex();
102$add_index->my_id = $plugin['id'];
103
104// Load Add Index parameters
105$add_index->load_params();
106
107// Add events
108add_event_handler('loading_lang', array(&$add_index, 'loading_lang'));
109add_event_handler('get_admin_advanced_features_links', array(&$add_index, 'get_admin_advanced_features_links'));
110add_event_handler('get_admins_site_links', array(&$add_index, 'get_admins_site_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
111add_event_handler('get_admin_plugin_menu_links', array(&$add_index, 'plugin_admin_menu') );
112
113?>
Note: See TracBrowser for help on using the repository browser.