Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- File List
- File Members

# 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
    00047     function DeclareEvents()
    00048     {
    00049         return array();
    00050     }
    00051
    00058     function Install()
    00059     {
    00060         return NULL;
    00061     }
    00062
    00071     function Upgrade($PreviousVersion)
    00072     {
    00073         return NULL;
    00074     }
    00075
    00083     function Uninstall($RemoveData)
    00084     {
    00085         return NULL;
    00086     }
    00087
    00092     final function GetAttributes()
    00093     {
    00094         return array(
    00095                 "Name" => $this->Name,
    00096                 "Version" => $this->Version,
    00097                 "Description" => $this->Description,
    00098                 "Author" => $this->Author,
    00099                 "Url" => $this->Url,
    00100                 "Email" => $this->Email,
    00101                 "EnabledByDefault" => $this->EnabledByDefault,
    00102                 "Requires" => $this->Requires,
    00103                 "CfgSetup" => $this->CfgSetup,
    00104                 "CfgPage" => $this->CfgPage,
    00105                 );
    00106     }
    00107
    00115     final function ConfigSetting($SettingName, $NewValue = NULL)
    00116     {
    00117         if (func_num_args() > 1)
    00118         {
    00119             if ($NewValue === NULL)
    00120             {
    00121                 unset($this->Cfg[$SettingName]);
    00122             }
    00123             else
    00124             {
    00125                 $this->Cfg[$SettingName] = $NewValue;
    00126             }
    00127             if (is_callable($this->CfgSaveCallback))
    00128             {
    00129                 call_user_func_array($this->CfgSaveCallback,
    00130                         array(get_class($this), $this->Cfg));
    00131             }
    00132         }
    00133         return isset($this->Cfg[$SettingName]) ? $this->Cfg[$SettingName] : NULL;
    00134     }
    00135
    00136
    00137     # ----- PROTECTED INTERFACE ----------------------------------------------
    00138
    00140     protected $Name = NULL;
    00142     protected $Version = NULL;
    00144     protected $Description = NULL;
    00146     protected $Author = NULL;
    00148     protected $Url = NULL;
    00150     protected $Email = NULL;
    00152     protected $EnabledByDefault = FALSE;
    00153
    00161     protected $Requires = array();
    00162
    00170     protected $CfgSetup = array();
    00171
    00175     protected $CfgPage = NULL;
    00176
    00177
    00178     # ----- PRIVATE INTERFACE ------------------------------------------------
    00179
    00181     private $Cfg;
    00183     private $CfgSaveCallback;
    00184
    00190     final public function SetAllCfg($NewValues)
    00191     {
    00192         $this->Cfg = $NewValues;
    00193     }
    00202     final public function SetCfgSaveCallback($Callback)
    00203     {
    00204         $this->CfgSaveCallback = $Callback;
    00205     }
    00207 }
    00208
    00209 ?>