public static function class_from_filename($file, $check_realpath = false)
{
if ($check_realpath) {
$file = realpath($file);
}
foreach (self::get_plugin_classes() as $plugin) {
$class = new \ReflectionClass($plugin);
$classfile = str_replace('\\', '/', $class->getFileName());
if ($classfile == $file) {
return $plugin;
}
}
// if we haven't found the plugin class, try again with realpath resolution:
if ($check_realpath) {
// really can't find it
return false;
} else {
return self::class_from_filename($file, true);
}
}