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                 "Instructions" => $this->Instructions,
    00106                 );
    00107     }
    00108
    00116     final function ConfigSetting($SettingName, $NewValue = NULL)
    00117     {
    00118         if (func_num_args() > 1)
    00119         {
    00120             if ($NewValue === NULL)
    00121             {
    00122                 unset($this->Cfg[$SettingName]);
    00123             }
    00124             else
    00125             {
    00126                 $this->Cfg[$SettingName] = $NewValue;
    00127             }
    00128             if (is_callable($this->CfgSaveCallback))
    00129             {
    00130                 call_user_func_array($this->CfgSaveCallback,
    00131                         array(get_class($this), $this->Cfg));
    00132             }
    00133         }
    00134         return isset($this->Cfg[$SettingName]) ? $this->Cfg[$SettingName] : NULL;
    00135     }
    00136
    00137
    00138     # ----- PROTECTED INTERFACE ----------------------------------------------
    00139
    00141     protected $Name = NULL;
    00143     protected $Version = NULL;
    00145     protected $Description = NULL;
    00147     protected $Author = NULL;
    00149     protected $Url = NULL;
    00151     protected $Email = NULL;
    00155     protected $Instructions = NULL;
    00157     protected $EnabledByDefault = FALSE;
    00158
    00166     protected $Requires = array();
    00167
    00175     protected $CfgSetup = array();
    00176
    00180     protected $CfgPage = NULL;
    00181
    00182
    00183     # ----- PRIVATE INTERFACE ------------------------------------------------
    00184
    00186     private $Cfg;
    00188     private $CfgSaveCallback;
    00189
    00195     final public function SetAllCfg($NewValues)
    00196     {
    00197         $this->Cfg = $NewValues;
    00198     }
    00207     final public function SetCfgSaveCallback($Callback)
    00208     {
    00209         $this->CfgSaveCallback = $Callback;
    00210     }
    00212 }
    00213
    00214 ?>