Пример #1
0
 /**
  * Function to auto load the required class files matching the directory pattern modules/xyz/types/Abc.php for class xyz_Abc_Type
  * @param <String> $className
  * @return <Boolean>
  */
 public static function autoLoad($className)
 {
     $parts = explode('_', $className);
     $noOfParts = count($parts);
     if ($noOfParts > 2) {
         $filePath = 'modules.';
         // Append modules and sub modules names to the path
         for ($i = 0; $i < $noOfParts - 2; ++$i) {
             $filePath .= $parts[$i] . '.';
         }
         $fileName = $parts[$noOfParts - 2];
         $fileComponentName = strtolower($parts[$noOfParts - 1]) . 's';
         $filePath .= $fileComponentName . '.' . $fileName;
         return Vtiger_Loader::includeOnce($filePath);
     }
     return false;
 }
Пример #2
0
 /**
  * Function to auto load the required class files matching the directory pattern modules/xyz/types/Abc.php for class xyz_Abc_Type
  * @param <String> $className
  * @return <Boolean>
  */
 public static function autoLoad($className)
 {
     $parts = explode('_', $className);
     $noOfParts = count($parts);
     if ($noOfParts > 2) {
         foreach (self::$loaderDirs as $filePath) {
             // Append modules and sub modules names to the path
             for ($i = 0; $i < $noOfParts - 2; ++$i) {
                 $filePath .= $parts[$i] . '.';
             }
             $fileName = $parts[$noOfParts - 2];
             $fileComponentName = strtolower($parts[$noOfParts - 1]) . 's';
             $filePath .= $fileComponentName . '.' . $fileName;
             if (file_exists(self::resolveNameToPath($filePath))) {
                 return Vtiger_Loader::includeOnce($filePath);
             }
         }
     }
     return false;
 }