PHP Classes

File: Tool/index.php

Recommend this page to a friend!
  Classes of Tom Schaefer   Closure Table   Tool/index.php   Download  
File: Tool/index.php
Role: Auxiliary script
Content type: text/plain
Description: autoloader
Class: Closure Table
Manage transitive closure tables stored in MySQL
Author: By
Last change: change
Date: 14 years ago
Size: 580 bytes
 

Contents

Class file image Download
<?php

function toolAutoload($class) {
    if (
substr($class, 0, strlen("Tool_")) === 'Tool_') {
       
$file = dirname(__FILE__).DIRECTORY_SEPARATOR.strtr(substr($class, strlen("Tool_")), '_', DIRECTORY_SEPARATOR).'.php';
        if(
is_file($file)) {
            include
$file;
        } else {
            throw new
Exception("autoloading of class $class impossible.");
        }
    }
}
spl_autoload_register('toolAutoload');
set_include_path(get_include_path().PATH_SEPARATOR.realpath(dirname(__FILE__)));

include_once(
dirname(__FILE__).DIRECTORY_SEPARATOR."ClosureTable".DIRECTORY_SEPARATOR."index.php");