<?php
                    /**
                    * ###############################################
                    *
                    * SWIFT Framework
                    * _______________________________________________
                    *
                    * @package        SWIFT
                    * @copyright    Copyright (c) 2001-2014, Kayako
                    * @license        http://www.kayako.com/license
                    * @link        http://www.kayako.com
                    *
                    * ###############################################
                    */

                       abstract class SWIFT_Base { protected $_errorMsg = array(); protected $_classLoaded = false; protected $_clusterBaseDirectory;   protected $Database = false;  protected $Registry = false;  protected $Interface = false;  protected $App = false;  protected $Language = false;  protected $Template = false;  protected $Session = false;  protected $Settings = false;  protected $Cache = false;  protected $Router = false;  protected $View = false;  protected $Cookie = false;  protected $Console = false;  protected $Log = false;  protected $System = false;  protected $Controller = false;  protected $UserInterface = false;  protected $Hook = false;   public $Server = false;  public $ServerMaster = false;  public $Cluster = false;  protected $JobQueueMessage = false;  protected $DynectSession = false;  protected $JavaScript = false;  public $Load = false;  public $Input = false; protected $_instanceID = false; static private $_instanceCount = 0;  const CLASS_PREFIX = 'SWIFT_';  protected function __construct() { $this->SetIsClassLoaded(true); $this->ProcessInstanceID(); }  public function __destruct() { return true; }  private function ProcessInstanceID() { $this->_instanceID = ++self::$_instanceCount; return true; }  public function GetInstanceID() { return $this->_instanceID; }  protected function Initialize() { $_SWIFT = SWIFT::GetInstance(); $_classInitializationList = array( 'Database' => 'SWIFT_Database', 'Registry' => 'SWIFT_Registry', 'Interface' => 'SWIFT_Interface', 'App' => 'SWIFT_App', 'Language' => 'SWIFT_LanguageEngine', 'Template' => 'SWIFT_TemplateEngine', 'Session' => 'SWIFT_Session', 'Settings' => 'SWIFT_Settings', 'Console' => 'SWIFT_Console', 'System' => 'SWIFT_System', 'Cache' => 'SWIFT_CacheStore', 'Router' => 'SWIFT_Router', 'Cookie' => 'SWIFT_Cookie', 'Hook' => 'SWIFT_Hook', 'Log' => 'SWIFT_Log', 'UserInterface' => 'SWIFT_UserInterface', 'FirePHP' => 'SWIFT_FirePHP', 'JavaScript' => 'SWIFT_JavaScript', 'Input' => 'SWIFT_Input',  'Server' => 'SWIFT_Server', 'ServerMaster' => 'SWIFT_Server', 'JobQueueMessage' => 'SWIFT_JobQueueMessage' ); foreach ($_classInitializationList as $_key => $_val) { if ($_SWIFT instanceof SWIFT && is_object($_SWIFT)) { if (!isset($_SWIFT->{$_key})) { continue; } $_objectReference = $_SWIFT->{$_key}; if ($_objectReference instanceof SWIFT_Base) { if (get_class($_objectReference) == $_val && $_objectReference->GetIsClassLoaded()) { $this->$_key = $_objectReference; } else { $this->$_key = &$_SWIFT->$_key; } }  } else { if (isset($_SWIFT->$_key)) { $this->$_key = &$_SWIFT->$_key; } } } $this->Load = new SWIFT_Loader($this); foreach (SWIFT::GetObjectMap() as $_SWIFT_BaseObject) { if ($_SWIFT_BaseObject instanceof SWIFT_Base && $_SWIFT_BaseObject->GetisClassLoaded()) { $_className = get_class($_SWIFT_BaseObject); $_chunkClassName = substr($_className, strlen('SWIFT_')); if (isset($this->$_chunkClassName) && is_object($this->$_chunkClassName)) { continue; } $this->$_chunkClassName = $_SWIFT_BaseObject; } } return true; }  protected function OverrideObjects( SWIFT_Interface $_SWIFT_InterfaceObject, SWIFT_App $_SWIFT_AppObject, SWIFT_Router $_SWIFT_RouterObject) { if ($_SWIFT_InterfaceObject instanceof SWIFT_Interface && $_SWIFT_InterfaceObject->GetIsClassLoaded()) { $this->Interface = $_SWIFT_InterfaceObject; } if ($_SWIFT_AppObject instanceof SWIFT_App && $_SWIFT_AppObject->GetIsClassLoaded()) { $this->App = $_SWIFT_AppObject; } if ($_SWIFT_RouterObject instanceof SWIFT_Router && $_SWIFT_RouterObject->GetIsClassLoaded()) { $this->Router = $_SWIFT_RouterObject; } return true; }  public function UpdateObject($_objectName, $_objectPointer) { $_objectName = Clean($_objectName); if (empty($_objectName)) { return false; } if ($_objectPointer instanceof SWIFT_Base && $_objectPointer->GetIsClassLoaded()) { $this->$_objectName = $_objectPointer; return true; } return false; }  public function SetIsClassLoaded($_classLoaded) { $this->_classLoaded = $_classLoaded; return $_classLoaded; }  public function GetIsClassLoaded() { return $this->_classLoaded; }  public function GetErrorMessage() { return $this->_errorMsg[(count($this->_errorMsg) - 1)][0]; }  public function GetErrorMessageArray() { return $this->_errorMsg; }  public function GetErrorNumber() { return $this->_errorMsg[(count($this->_errorMsg) - 1)][1]; }  public function Log($_logMessage, $_messageType = false, $_messagePrefix = '') { if (!$this->GetIsClassLoaded()) { throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED); } else { if (!$this->Log instanceof SWIFT_Log) { return false; } } if (empty($_messagePrefix)) { $_messagePrefix = get_class($this); } if (empty($_messageType)) { $_messageType = SWIFT_Log::TYPE_NONE; } $this->Log->Log($_logMessage, $_messageType, $_messagePrefix); return true; } } ?>