示例#1
0
文件: APIC.php 项目: noikiy/owaspbwa
 /**
  * APIC::importData()
  * 
  * @param $class
  * @param unknown $module
  * @return 
  **/
 function importData($class, $module = NULL)
 {
     $packagename = APIClassRegistry::extractPackageName($class);
     $path = APIClassRegistry::convertToPath($class, $module);
     if (APIClassRegistry::isClass($class)) {
         // extracting class name
         $classname = APIClassRegistry::extractClassName($class);
         // loadclass
         $path .= '.php';
         if (isset($path) && is_file($path)) {
             // register
             APIClassRegistry::register($packagename, $classname);
             include $path;
         }
     }
 }
示例#2
0
 /**
  *	importing a unique class or an entire package
  *	@param	string  a class name or a package name
  *  @param	string $module nom du module ou trouver la class a charger
  *	@return void
  *	@access public
  */
 function import($package, $module = NULL)
 {
     // already registered ?
     if (APIClassRegistry::isRegistered($package)) {
         return;
     }
     // extracting package name
     $packagename = APIClassRegistry::extractPackageName($package);
     $path = APIClassRegistry::convertToPath($package, $module);
     if (APIClassRegistry::isPackage($package)) {
         // filtering php class and running parser
         if (isset($path) && is_dir($path)) {
             APIClassRegistry::register($package);
             $handle = opendir($path);
             while ($file = readdir($handle)) {
                 if ($file !== '.' && $file !== '..' && preg_match('/(\\.php)$/i', $file) > 0) {
                     require_once $path . $file;
                     APIClassRegistry::register($packagename, substr($file, 0, strlen($file) - 4));
                 }
             }
             closedir($handle);
         }
     } else {
         if (APIClassRegistry::isClass($package)) {
             // extracting class name
             $classname = APIClassRegistry::extractClassName($package);
             // loadclass
             $path .= '.php';
             if (isset($path) && is_file($path)) {
                 // register
                 APIClassRegistry::register($packagename, $classname);
                 require_once $path;
             }
         }
     }
 }