3
The class that every submodule should extend. A sub module must be php class, in a .php file of the same name.
6
abstract class Shoof_Submodule{
8
/** You must copy this line into your submodule class*/
9
private static $instance = false;
11
protected $loadTime = false;
13
protected $description;
15
protected function __construct()
17
$this->name = get_class($this);
18
$this->description = 'Submodule with no name, Hang him high';
19
$this->help = 'No help available';
23
In my current version of php (5.2.4-2), self does not behave as it is expect it to bo in case of inheritance. In fact it is never inherited, therefor self::$instance refers to self::$instance of this class instead of refering to child's variable. Instead of using some bad taste crazy workarounds that would make the code clumsy and become completly useless in case php guys decide to fix this, I chosed to define an abstract function. Sorry you'll have to copy paste the singleton code (commented below) in every submodule.
24
@return the current instance, creates it if it has to.
26
public abstract static function getInstance();
30
self::$instance = new self();
32
return self::$instance;
37
Performs final actions, default is nothing. This is automaticly called before outputing the final html
39
public function wrapUp()
44
Provides help about the submodule
47
public function help($print = true)
49
$h = $this->name.':<br>'.$this->help;
58
public function getName()
63
Get submodule description
65
public function getDecription()
67
return $this->name.':<br>'.$this->description;