>>903 は失敗でつ。ごめんなさい
function readFramework($dir) {
 $handle = opendir($dir);
 if( !$handle ) { return; }
 
 while (false !== ($file = readdir($handle))) {
  if ($file == "." || $file == "..") { continue; }
   
  $file = $dir.$file;
  if (is_dir($file)) { readFramework($file.DS); }
  else {
   $reg = array();
   
   // phpファイルか調べる
   if (preg_match('/(.*)\.php$/', $file, $reg)) {
    
    // app_model と app_controller の場合はユーザーが再定義しているか調べる
    if (preg_match('/(app_model|app_controller)$/', $reg[1], $reg)) {
     $tmp = APP.$reg[1].'.php';
     if (is_file($tmp)) {
      $file = $tmp;
     }
    }
    
    require_once($file);
   }
  }
 }
 closedir($handle);
}