public static function getIcons() { if (self::$icons === null) { $path = waConfig::get('wa_path_root') . '/wa-content/img/users/'; if (!file_exists($path) || !is_dir($path)) { $list = array(); } if (!($dh = opendir($path))) { $list = array(); } $list = array(); while (false !== ($file = readdir($dh))) { if ($file == '.' || $file == '..') { continue; } if (is_dir($path . '/' . $file)) { continue; } else { $list[] = $file; } } closedir($dh); foreach ($list as &$l) { $p = strpos($l, '.png'); if ($p !== false) { $l = substr($l, 0, $p); } } unset($l); natsort($list); self::$icons = array_values($list); } return self::$icons; }