예제 #1
0
 /**
  * Retrieve singleton instance
  *
  * @return Yaf_Loader
  */
 public static function getInstance($library = null, $globalLibrary = null)
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
         $instance = self::$_instance;
         if ($library != null) {
             $instance->setLibraryPath($library, false);
         }
         if ($globalLibrary != null) {
             $instance->setLibraryPath($globalLibrary, true);
         } else {
             if ($library != null) {
                 $instance->setLibraryPath($library, true);
             }
         }
         if (phpversion() >= "5.3") {
             spl_autoload_register(array($instance, 'autoload'), true, false);
         } else {
             spl_autoload_register(array($instance, 'autoload'), true);
         }
     } else {
         $instance = self::$_instance;
         if ($library != null) {
             $instance->setLibraryPath($library, false);
         }
         if ($globalLibrary != null) {
             $instance->setLibraryPath($globalLibrary, true);
         }
     }
     return self::$_instance;
 }