Plugin.php

Go to the documentation of this file.
00001 <?PHP
00002 
00006 abstract class Plugin {
00007 
00008     # ----- PUBLIC INTERFACE -------------------------------------------------
00009 
00014     abstract function Register();
00015 
00023     function Initialize()
00024     {
00025         return NULL;
00026     }
00027 
00035     function HookEvents()
00036     {
00037         return array();
00038     }
00039 
00044     function DeclareEvents()
00045     {
00046         return array();
00047     }
00048 
00055     function Install()
00056     {
00057         return NULL;
00058     }
00059 
00068     function Upgrade($PreviousVersion)
00069     {
00070         return NULL;
00071     }
00072 
00080     function Uninstall($RemoveData)
00081     {
00082         return NULL;
00083     }
00084 
00089     final function GetAttributes()
00090     {
00091         return array(
00092                 "Name" => $this->Name,
00093                 "Version" => $this->Version,
00094                 "Description" => $this->Description,
00095                 "Author" => $this->Author,
00096                 "Url" => $this->Url,
00097                 "Email" => $this->Email,
00098                 "EnabledByDefault" => $this->EnabledByDefault,
00099                 "Requires" => $this->Requires,
00100                 "CfgSetup" => $this->CfgSetup,
00101                 "CfgPage" => $this->CfgPage,
00102                 );
00103     }
00104 
00112     final function ConfigSetting($SettingName, $NewValue = NULL)
00113     {
00114         if (func_num_args() > 1)
00115         {
00116             if ($NewValue === NULL)
00117             {
00118                 unset($this->Cfg[$SettingName]);
00119             }
00120             else
00121             {
00122                 $this->Cfg[$SettingName] = $NewValue;
00123             }
00124             if (is_callable($this->CfgSaveCallback))
00125             {
00126                 call_user_func_array($this->CfgSaveCallback, 
00127                         array(get_class($this), $this->Cfg));
00128             }
00129         }
00130         return isset($this->Cfg[$SettingName]) ? $this->Cfg[$SettingName] : NULL;
00131     }
00132 
00133 
00134     # ----- PROTECTED INTERFACE ----------------------------------------------
00135 
00137     protected $Name = NULL;
00139     protected $Version = NULL;
00141     protected $Description = NULL;
00143     protected $Author = NULL;
00145     protected $Url = NULL;
00147     protected $Email = NULL;
00149     protected $EnabledByDefault = FALSE;
00150 
00158     protected $Requires = array();
00159 
00167     protected $CfgSetup = array();
00168 
00172     protected $CfgPage = NULL;
00173 
00174 
00175     # ----- PRIVATE INTERFACE ------------------------------------------------
00176 
00178     private $Cfg;
00180     private $CfgSaveCallback;
00181 
00187     final public function SetAllCfg($NewValues)
00188     {
00189         $this->Cfg = $NewValues;
00190     }
00199     final public function SetCfgSaveCallback($Callback)
00200     {
00201         $this->CfgSaveCallback = $Callback;
00202     }
00204 }
00205 
00206 ?>