Issue 35: Fixed problem with the plugin manager.
Esse commit está contido em:
@@ -1,4 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Class related to Plugin Objects
|
||||
* @author Felipe Nascimento
|
||||
* @name Plugin
|
||||
* @package framework
|
||||
*/
|
||||
class Plugin
|
||||
{
|
||||
public $name= '';
|
||||
@@ -71,7 +77,13 @@
|
||||
$this->load($pluginName);
|
||||
}
|
||||
|
||||
static function getPlugin($cod, $usr)
|
||||
/**
|
||||
* Loads the information of one plugin
|
||||
* @name getPlugin
|
||||
* @param $cod the name of the plugins, itself
|
||||
* @return Plugin Object
|
||||
*/
|
||||
static function getPlugin($cod)
|
||||
{
|
||||
GLOBAL $_MIND;
|
||||
$d = dir($_MIND['rootDir'].$_MIND['pluginDir']);
|
||||
@@ -90,6 +102,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the list of plugins
|
||||
* @name getPlugins
|
||||
* @author Felipe Nacimento
|
||||
* @return Numeric Array of Plugin objects
|
||||
*/
|
||||
static function getPlugins()
|
||||
{
|
||||
GLOBAL $_MIND;
|
||||
@@ -109,6 +127,12 @@
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the Plugin Object
|
||||
* @param $ar with the data to be used
|
||||
* @author Felipe Nascimento
|
||||
*/
|
||||
function populate($ar)
|
||||
{
|
||||
$this->code($ar['name']);
|
||||
@@ -123,6 +147,12 @@
|
||||
$this->conf['status']= $ar['status'];
|
||||
$this->conf['useIcon']= $ar['useIcon'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a specific plugin data (conf and info)
|
||||
* @param $plugin Object
|
||||
* @author Felipe Nascimento
|
||||
*/
|
||||
function load($plugin)
|
||||
{
|
||||
$flagActive = false;
|
||||
@@ -157,6 +187,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current situation of the instance
|
||||
* @param [$obj] Optionaly, you can send other object to save
|
||||
*/
|
||||
function save($obj=false)
|
||||
{
|
||||
$obj= ($obj)? $obj: $this;
|
||||
@@ -196,7 +231,9 @@
|
||||
|
||||
/**
|
||||
* Disable a Plugin (Just add dot(".") in the begin of folder)
|
||||
*@param String $pluginName - The name of a Plugin
|
||||
* @name disable
|
||||
* @author Felipe Nascimento
|
||||
* @return void
|
||||
*/
|
||||
function disable(){
|
||||
GLOBAL $_MIND;
|
||||
@@ -206,23 +243,30 @@
|
||||
|
||||
/**
|
||||
* Remove a Plugin (Delete the folder)
|
||||
*@param String $pluginName - The name of a Plugin
|
||||
* @name remove
|
||||
* @author Felipe Nascimento
|
||||
* @return boolean
|
||||
*/
|
||||
function remove(){
|
||||
GLOBAL $_MIND;
|
||||
$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/';
|
||||
if(!file_exists($dir))
|
||||
$dir= '.'.$dir;
|
||||
if(!file_exists($dir))
|
||||
return false;
|
||||
$_MIND['fw']->deleteDirectory($dir.$this->code());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a Plugin (Just remove the dot(".") in the begin of folder)
|
||||
*@param String $pluginName - The name of a Plugin
|
||||
* @name enable
|
||||
* @author Felipe Nascimento
|
||||
* @return void
|
||||
*/
|
||||
function enable(){
|
||||
GLOBAL $_MIND;
|
||||
$dir= $_MIND['rootDir'].$_MIND['pluginDir'].'/';
|
||||
rename($dir.".".$this->code(), $dir.$this->code());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário