getFileName(), -3, 3) == 'php') { scanFile($file->getPathname()); } } $events = array_unique($events); sort($events); print_r($events); function scanFile($fileName) { global $events; $contents = file_get_contents($fileName); $regex = '/(.*)new[[:space:]]+PluginEvent[[:space:]]*\([[:space:]]*[\'"]+(.*)[\'"]+/'; $count = preg_match_all($regex, $contents, $matches); if ($count > 0) { $events = array_merge($events, $matches[2]); } } ?>