src/Web2All/Manager/Main.class.php
public static function includeClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) {
    // $path will be the relative path to the classfile by exploding the namespace
    $path = '';
    $filename = $classname;
    // support namespaces
    if(strpos($classname,'\\')){
      // ok, contains namespace
      $path_parts = explode('\\',$classname);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      $classname_without_namespaces = $filename;
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }else{
      $classname_without_namespaces = $classname;
    }
    
    if ($loadscheme!='PLAIN')
    {
      $path_parts = explode("_",$classname_without_namespaces);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }
    
    // depending on the scheme, select the suffix
    // PEAR class files do not have the .class in the name.
    // The Web2All scheme historically used ".class.php", but for 
    // better compatibility we now also support the plain ".php".
    $classfilesuffixes=array('.class.php','.php');
    switch($loadscheme){
      case 'PEAR':
      case 'PLAIN':
        $classfilesuffixes=array('.php');
        break;
      case 'INC':
        $classfilesuffixes=array('.inc.php');
        break;
    }
    
    foreach(self::$frameworkRoots as $include_path){
      if ($package) {
        $include_path.=$package.DIRECTORY_SEPARATOR;
      }
      foreach($classfilesuffixes as $classfilesuffix){
        if(is_readable($include_path.$path.$filename.$classfilesuffix)){
          // if set_includedir is true, then we have the include path of the package to
          // the PHP environment include path
          if ($set_includedir) {
            $pathArray = explode( PATH_SEPARATOR, get_include_path() );
            // only add the path if its not already in the include path
            if (!in_array($include_path,$pathArray)) {
              $pathArray[]=$include_path;
              set_include_path(implode(PATH_SEPARATOR,$pathArray));
            }
          }
          include_once($include_path.$path.$filename.$classfilesuffix);
          // ok once we found a file, we are done
          return;
        }
      }
    }
  }
public static function includeClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) {
    // $path will be the relative path to the classfile by exploding the namespace
    $path = '';
    $filename = $classname;
    // support namespaces
    if(strpos($classname,'\\')){
      // ok, contains namespace
      $path_parts = explode('\\',$classname);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      $classname_without_namespaces = $filename;
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }else{
      $classname_without_namespaces = $classname;
    }
    
    if ($loadscheme!='PLAIN')
    {
      $path_parts = explode("_",$classname_without_namespaces);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }
    
    // depending on the scheme, select the suffix
    // PEAR class files do not have the .class in the name.
    // The Web2All scheme historically used ".class.php", but for 
    // better compatibility we now also support the plain ".php".
    $classfilesuffixes=array('.class.php','.php');
    switch($loadscheme){
      case 'PEAR':
      case 'PLAIN':
        $classfilesuffixes=array('.php');
        break;
      case 'INC':
        $classfilesuffixes=array('.inc.php');
        break;
    }
    
    foreach(self::$frameworkRoots as $include_path){
      if ($package) {
        $include_path.=$package.DIRECTORY_SEPARATOR;
      }
      foreach($classfilesuffixes as $classfilesuffix){
        if(is_readable($include_path.$path.$filename.$classfilesuffix)){
          // if set_includedir is true, then we have the include path of the package to
          // the PHP environment include path
          if ($set_includedir) {
            $pathArray = explode( PATH_SEPARATOR, get_include_path() );
            // only add the path if its not already in the include path
            if (!in_array($include_path,$pathArray)) {
              $pathArray[]=$include_path;
              set_include_path(implode(PATH_SEPARATOR,$pathArray));
            }
          }
          include_once($include_path.$path.$filename.$classfilesuffix);
          // ok once we found a file, we are done
          return;
        }
      }
    }
  }
public static function includeClass ( $ classname , $ loadscheme = 'Web2All' , $ package = '' , $ set_includedir = false ) { // $path will be the relative path to the classfile by exploding the namespace
 $ path = '' ; $ filename = $ classname ; // support namespaces
 if ( strpos ( $ classname , '\\' ) ) { // ok, contains namespace
 $ path_parts = explode ( '\\' , $ classname ) ; $ part_count = count ( $ path_parts ) ; $ filename = $ path_parts [ $ part_count - 1 ] ; $ classname_without_namespaces = $ filename ; for ( $ i = 0 ; ( $ i < $ part_count - 1 ) ; $ i ++ ) { $ path .= $ path_parts [ $ i ] . DIRECTORY_SEPARATOR ; } } else { $ classname_without_namespaces = $ classname ; } if ( $ loadscheme != 'PLAIN' ) { $ path_parts = explode ( "_" , $ classname_without_namespaces ) ; $ part_count = count ( $ path_parts ) ; $ filename = $ path_parts [ $ part_count - 1 ] ; for ( $ i = 0 ; ( $ i < $ part_count - 1 ) ; $ i ++ ) { $ path .= $ path_parts [ $ i ] . DIRECTORY_SEPARATOR ; } } // depending on the scheme, select the suffix
 // PEAR class files do not have the .class in the name.
 // The Web2All scheme historically used ".class.php", but for 
 // better compatibility we now also support the plain ".php".
 $ classfilesuffixes = array ( '.class.php' , '.php' ) ; switch ( $ loadscheme ) { case 'PEAR' : case 'PLAIN' : $ classfilesuffixes = array ( '.php' ) ; break ; case 'INC' : $ classfilesuffixes = array ( '.inc.php' ) ; break ; } foreach ( self :: $ frameworkRoots as $ include_path ) { if ( $ package ) { $ include_path .= $ package . DIRECTORY_SEPARATOR ; } foreach ( $ classfilesuffixes as $ classfilesuffix ) { if ( is_readable ( $ include_path . $ path . $ filename . $ classfilesuffix ) ) { // if set_includedir is true, then we have the include path of the package to
 // the PHP environment include path
 if ( $ set_includedir ) { $ pathArray = explode ( PATH_SEPARATOR , get_include_path ( ) ) ; // only add the path if its not already in the include path
 if ( ! in_array ( $ include_path , $ pathArray ) ) { $ pathArray [ ] = $ include_path ; set_include_path ( implode ( PATH_SEPARATOR , $ pathArray ) ) ; } } include_once ( $ include_path . $ path . $ filename . $ classfilesuffix ) ; // ok once we found a file, we are done
 return ; } } } }
Load the classfile for the given class

This method will blindly include the first php file which it finds
for the given classname. It will not throw exceptions and won't indicate if the
operation succeeded. It is used by both the autoloader and the loadClass() method,
which is historically the method used to load a class.

@param string  $classname
@param string  $loadscheme     [optional (Web2All|PEAR|INC|PLAIN) defaults to Web2All]
@param string  $package        [optional packagename]
@param boolean $set_includedir [optional bool, set true to add the package dir to include path]
Load the classfile for the given class