__autoload

Autoloader compatibility callback.

Description

autoload( (string) $className ); 

Parameters (1)

0. $classname (string)
The classname.

Usage

  1. if ( !function_exists( 'autoload' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-billogram-integration/class-billogram2-api.php'; 
  3.  
  4. // The classname. 
  5. $classname = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = autoload($classname); 
  9.  

Defined (1)

The function is defined in the following location(s).

/class-billogram2-api.php  
  1. function autoload($className) 
  2. $className = ltrim($className, '\\'); 
  3. $fileName = ''; 
  4. $namespace = ''; 
  5. if ($lastNsPos = strrpos($className, '\\')) { 
  6. $namespace = substr($className, 0, $lastNsPos); 
  7. $className = substr($className, $lastNsPos + 1); 
  8. $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . 
  9. DIRECTORY_SEPARATOR; 
  10. $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';  
  11. $fileName = dirname(__FILE__).'/'.$fileName; 
  12.  
  13. if(file_exists($fileName)) 
  14. include $fileName;