protected static function readDirectory($directory) { if (!empty(self::$cache)) { return self::$cache; } $langs = array(); if ($handle = opendir($directory)) { while ($lang = readdir($handle)) { if (strpos($lang, ".php") !== false) { $langKey = str_replace('.php', '', $lang); $langs[$langKey] = (include $directory . '/' . $lang); } } closedir($handle); } self::$cache = $langs; return $langs; }