Exemplo n.º 1
0
 /**
  * Return a single instance of this class
  *
  * @return object 
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 /**
  * Load the OIK_Autoload logic
  * 
  * You might think that the fact that you invoke oik_require_lib( "oik_autoload" ); 
  * would be enough to tell the autoload library that you'll be using autoloading for your classes.
  * But I think it's better to implicitely invoke either oik_require_class() or oik_autoload() to instantiate the
  * autoloading logic when you know that OO code will be used.
  * 
  * Notice we use oik_require_file() to load a class file manually
  */
 function oik_autoload()
 {
     if (!class_exists("OIK_Autoload")) {
         //echo "Loading OIK_Autoload" ;
         oik_require_file("class-oik-autoload.php", "oik-autoload");
     }
     if (class_exists("OIK_Autoload")) {
         $oik_autoload = OIK_Autoload::instance();
     } else {
         bw_trace2("Class OIK_Autoload does not exist");
         die;
     }
     return $oik_autoload;
 }