CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Plugin.php
Go to the documentation of this file.
1 <?PHP
2
6 abstract class Plugin {
7
8 # ----- PUBLIC INTERFACE -------------------------------------------------
9
14 abstract function Register();
15
23 function Initialize()
24 {
25 return NULL;
26 }
27
35 function HookEvents()
36 {
37 return array();
38 }
39
47 function DeclareEvents()
48 {
49 return array();
50 }
51
58 function Install()
59 {
60 return NULL;
61 }
62
71 function Upgrade($PreviousVersion)
72 {
73 return NULL;
74 }
75
81 function Uninstall()
82 {
83 return NULL;
84 }
85
90 final function GetAttributes()
91 {
92 return array(
93 "Name" => $this->Name,
94 "Version" => $this->Version,
95 "Description" => $this->Description,
96 "Author" => $this->Author,
97 "Url" => $this->Url,
98 "Email" => $this->Email,
99 "EnabledByDefault" => $this->EnabledByDefault,
100 "Requires" => $this->Requires,
101 "CfgSetup" => $this->CfgSetup,
102 "CfgPage" => $this->CfgPage,
103 "Instructions" => $this->Instructions,
104 );
105 }
106
114 final function ConfigSetting($SettingName, $NewValue = NULL)
115 {
116 if (func_num_args() > 1)
117 {
118 if ($NewValue === NULL)
119 {
120 unset($this->Cfg[$SettingName]);
121 }
122 else
123 {
124 $this->Cfg[$SettingName] = $NewValue;
125 }
126 if (is_callable($this->CfgSaveCallback))
127 {
128 call_user_func_array($this->CfgSaveCallback,
129 array(get_class($this), $this->Cfg));
130 }
131 }
132 return isset($this->Cfg[$SettingName]) ? $this->Cfg[$SettingName] : NULL;
133 }
134
135
136 # ----- PROTECTED INTERFACE ----------------------------------------------
137
139 protected $Name = NULL;
141 protected $Version = NULL;
143 protected $Description = NULL;
145 protected $Author = NULL;
147 protected $Url = NULL;
149 protected $Email = NULL;
153 protected $Instructions = NULL;
155 protected $EnabledByDefault = FALSE;
156
164 protected $Requires = array();
165
173 protected $CfgSetup = array();
174
178 protected $CfgPage = NULL;
179
180
181 # ----- PRIVATE INTERFACE ------------------------------------------------
182
184 private $Cfg;
186 private $CfgSaveCallback;
187
193 final public function SetAllCfg($NewValues)
194 {
195 $this->Cfg = $NewValues;
196 }
205 final public function SetCfgSaveCallback($Callback)
206 {
207 $this->CfgSaveCallback = $Callback;
208 }
210 }
211
212 ?>