Location: PHPKode > scripts > Strategy based serializable object registry > strategy-based-serializable-object-registry/cimporter.php
<?php
define(ALLOW_EXEC,1);
require_once("cconfiguration.php");
class CImporter{
    protected static $instance = __CLASS__;
    private function __construct(){
    }
    public static function getInstance(){
        return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance);
    }
    public function import($type,$name){
        unset($toimport);
        try{
            switch($type){
                case 'driver':
                $toimport = CConfiguration::drivers_path;
                break;
                case 'library':
                $toimport = CConfiguration::libraries_path;
                break;
                default:
                throw new Exception("no such type");
            }
            $toimport .="/".$name;
            require_once($toimport);
        }
        catch (Exception $e){
            echo $e->getMessage();
            exit;
        }
    }
};
?>
Return current item: Strategy based serializable object registry