1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<?php
require_once('classes/Plugin.php');
class GuiControl extends Plugin {
/**
* Attributes
*/
protected $name = 'GuiControl';
protected $lang;
protected $conf;
/**
* Constructor
* Call parent constructor, passing the language that will be used.
* @param $language Current phpPgAdmin language. If it was not found in the plugin, English will be used.
*/
function __construct($language) {
parent::__construct($language);
}
/**
* This method returns the functions that will hook in the phpPgAdmin core.
* To do include a function just put in the $hooks array the following code:
* 'hook' => array('function1', 'function2').
*
* Example:
* $hooks = array(
* 'toplinks' => array('add_plugin_toplinks'),
* 'tabs' => array('add_tab_entry'),
* 'action_buttons' => array('add_more_an_entry')
* );
*
* @return $hooks
*/
function get_hooks() {
$hooks = array(
'toplinks' => array('filer_toplinks'),
'tabs' => array('filter_tabs'),
'trail' => array('filter_trail'),
'navlinks' => array('filter_navlinks'),
'actionbuttons' => array('filter_actionbuttons'),
'tree' => array('filter_tree')
);
return $hooks;
}
/**
* This method returns the functions that will be used as actions.
* To do include a function that will be used as action, just put in the $actions array the following code:
*
* $actions = array(
* 'show_page',
* 'show_error',
* );
*
* @return $actions
*/
function get_actions() {
$actions = array(
'filer_toplinks',
'filter_tabs',
'filter_trail',
'filter_navlinks',
'filter_actionbuttons',
'filter_tree',
);
return $actions;
}
function filer_toplinks(&$f_params) {
if (!isset($this->conf['top_links']))
return;
$top_links = &$f_params['toplinks'];
foreach ($this->conf['top_links'] as $link => $enabled)
if (isset ($top_links[$link])
&& ($enabled === false)
)
unset($top_links[$link]);
return;
}
function filter_tabs(&$f_params) {
$section = $f_params['section'];
$tabs = &$f_params['tabs'];
if (!isset($this->conf['tab_links'][$section]))
return;
foreach ($this->conf['tab_links'][$section] as $link => $enabled)
if (isset ($tabs[$link])
&& ($enabled === false)
)
unset($tabs[$link]);
return;
}
function filter_trail(&$f_params) {
if (!isset($this->conf['trail_links']))
return;
if ($this->conf['trail_links'] === false)
$f_params['trail'] = array();
return;
}
function filter_navlinks(&$f_params) {
$place = $f_params['place'];
$navlinks = &$f_params['navlinks'];
if (! isset($this->conf['navlinks'][$place]))
return;
foreach ($this->conf['navlinks'][$place] as $link => $enabled)
if (isset ($navlinks[$link])
&& ($enabled === false)
)
unset($navlinks[$link]);
return;
}
function filter_actionbuttons(&$f_params) {
$place = $f_params['place'];
$actions = &$f_params['actionbuttons'];
if (! isset($this->conf['actionbuttons'][$place]))
return;
foreach ($this->conf['actionbuttons'][$place] as $link => $enabled)
if (isset ($actions[$link])
&& ($enabled === false)
)
unset($actions[$link]);
return;
}
function filter_tree() {
return;
}
}
?>
|