Error();
$this->name = false;
$this->hooks = array();
}
/**
* GetHooks() - get list of hooks to subscribe to.
*
* @return array List of strings.
*/
function GetHooks() {
return $this->hooks;
}
/**
* _addHooks() - add a hook to the list of hooks.
*
* @return string
*/
function _addHook($name) {
return $this->hooks[]=$name;
}
/**
* GetName() - get plugin name.
*
* @return string the plugin name.
*/
function GetName() {
return $this->name;
}
/**
* GetInstallDir() - get installation dir for the plugin.
*
* @return string the directory where the plugin should be linked.
*/
function GetInstallDir() {
if (isset($this->installdir) && $this->installdir)
return $this->installdir;
else
return 'plugins/'.$this->name;
}
/**
* provide() - return true if plugin provides the feature.
*
* @return bool if feature is provided or not.
*/
function provide($feature) {
return (isset($this->provides[$feature]) && $this->provides[$feature]);
}
/**
* Added for Codendi compatibility
* getPluginPath() - get installation dir for the plugin.
*
* @return the directory where the plugin should be linked.
*/
function getPluginPath() {
if (isset($this->installdir) && $this->installdir)
return $this->installdir;
else
return 'plugins/'.$this->name;
}
/**
* CallHook() - call a particular hook.
*
* @param string the "handle" of the hook.
* @param array array of parameters to pass the hook.
* @return bool true only
*/
function CallHook($hookname, &$params) {
return true;
}
/**
* getGroups - get a list of all groups using a plugin.
*
* @return array array containing group objects.
*/
function getGroups() {
$result = array();
$res = db_query_params('SELECT group_plugin.group_id
FROM group_plugin, plugins
WHERE group_plugin.plugin_id=plugins.plugin_id
AND plugins.plugin_name=$1
ORDER BY group_plugin.group_id ASC',
array($this->name));
$rows = db_numrows($res);
for ($i=0; $i<$rows; $i++) {
$group_id = db_result($res,$i,'group_id');
$result[] = group_get_object ($group_id);
}
return $result;
}
function getThemePath(){
return util_make_url('plugins/'.$this->name.'/themes/default');
}
function registerRoleValues(&$params, $values) {
$role =& $params['role'];
}
function groupisactivecheckbox(&$params) {
//Check if the group is active
// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
$display = 1;
$title = _('current plugin status is:').' '.forge_get_config('plugin_status', $this->name);
$imgStatus = 'plugin_status_valid.png';
if ( forge_get_config('plugin_status',$this->name) !== 'valid' ) {
$display = 0;
$imgStatus = 'plugin_status_broken.png';
}
if ( forge_get_config('installation_environment') === 'development' ) {
$display = 1;
}
if ($display) {
$group = group_get_object($params['group']);
$flag = strtolower('use_'.$this->name);
echo '
';
}
}
/*
* @return bool actually only true ...
*/
function groupisactivecheckboxpost(&$params) {
// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
$group = group_get_object($params['group']);
$flag = strtolower('use_'.$this->name);
if ( getIntFromRequest($flag) == 1 ) {
$group->setPluginUse($this->name);
} else {
$group->setPluginUse($this->name, false);
}
return true;
}
function userisactivecheckbox(&$params) {
//check if user is active
// this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin
$display = 1;
$title = _('current plugin status is:').' '.forge_get_config('plugin_status', $this->name);
$imgStatus = 'plugin_status_valid.png';
if ( forge_get_config('plugin_status', $this->name) !== 'valid' ) {
$display = 0;
$imgStatus = 'plugin_status_broken.png';
}
if ( forge_get_config('installation_environment') === 'development' ) {
$display = 1;
}
if ($display) {
$user = $params['user'];
$flag = strtolower('use_'.$this->name);
echo '