Show
Ignore:
Timestamp:
09/21/07 15:37:41 (16 months ago)
Author:
jepso
Message:

The autoload function is unnecessary

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/manual/new/index.php

    r2346 r2602  
    1010require_once('Doctrine.php'); 
    1111require_once('Sensei/Sensei.php'); 
     12require_once('Text/Wiki.php'); 
    1213 
    1314spl_autoload_register(array('Doctrine', 'autoload')); 
    1415spl_autoload_register(array('Sensei', 'autoload')); 
    15 spl_autoload_register('autoload'); 
    16  
    17 /** 
    18  * A generic autoload function 
    19  *  
    20  * Filename is generated from class name by replacing underscores with 
    21  * directory separators and by adding a '.php' extension. 
    22  *  
    23  * Then the filename is searched from include paths, and if found it is 
    24  * included with require_once(). 
    25  * 
    26  * @param $class string  class name to be loaded 
    27  * @return bool  true if a class was loaded, false otherwise 
    28  */ 
    29 function autoload($class) 
    30 { 
    31     if (class_exists($class, false)) { 
    32         return false; 
    33     } 
    34      
    35     $paths = explode(PATH_SEPARATOR, get_include_path()); 
    36     $filename = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; 
    37     
    38     foreach($paths as $path) { 
    39         if (file_exists($path . DIRECTORY_SEPARATOR . $filename)) { 
    40             require_once($filename); 
    41             return true; 
    42         } 
    43     } 
    44      
    45     return false; 
    46 } 
    4716 
    4817/**