iwa-panda2

Manage Weather Data by International Weather Agency (Version 2)
Log | Files | Refs | README

autoloader.php (548B)


      1 <?php
      2 
      3 spl_autoload_register(function ($class_name) {
      4     if (DIRECTORY_SEPARATOR != "\\") {
      5         $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
      6     }
      7 
      8     $sr = DIRECTORY_SEPARATOR;
      9     $filename = $class_name . '.php';
     10     if (!file_exists($filename)) {
     11         $filename = 'Model' . $sr . $class_name . '.php';
     12         if (!file_exists($filename)) {
     13             return false;
     14         } else {
     15             include 'Model' . $sr . $class_name . '.php';
     16         }
     17     } else {
     18         include $class_name . '.php';
     19     }
     20 });