PHP Classes

File: Autoload.php

Recommend this page to a friend!
  Classes of MARY Matthieu   Files_DirectoryListing   Autoload.php   Download  
File: Autoload.php
Role: Auxiliary script
Content type: text/plain
Description: loader
Class: Files_DirectoryListing
Browse directories and their files
Author: By
Last change:
Date: 16 years ago
Size: 963 bytes
 

Contents

Class file image Download
<?php
/**
 * $Id: Autoload.php 1595 2007-05-03 20:11:32Z matthieu $
 */
if (!function_exists('__autoload')) {
   
/**
     * load class
     * @param string $className : the class to load
     * @throw Exception
     */
   
function __autoload($className) {
        if (
class_exists('Zend', false)) {
            if (
is_int(strrpos($className, '_Interface'))) {
               
Zend :: loadClass($className);
            } else {
               
Zend :: loadInterface($className);
            }
        } else {
            if (!
defined('__CLASS_PATH__')) {
               
define('__CLASS_PATH__', realpath(dirname(__FILE__)));
            }
           
$file = __CLASS_PATH__ . '/' . str_replace('_', '/', $className) . '.php';
            if (!
file_exists($file)) {
                throw new
Exception('Cannot load class file ' . $className);
            } else {
                require_once
$file;
            }
        }
    }
}