. namespace App\Util; abstract class Common { public static function config(string $section, string $field) { } public static function normalizePath(string $path): string { if (\DIRECTORY_SEPARATOR !== '/') { $path = strtr($path, DIRECTORY_SEPARATOR, '/'); } return $path; } public static function pluginFromPath(string $path): ?string { $plug = strpos($path, '/plugins/'); if ($plug === false) { return null; } $cut = $plug + strlen('/plugins/'); $cut2 = strpos($path, '/', $cut); if ($cut2) { $final = substr($path, $cut, $cut2 - $cut); } else { // We might be running directly from the plugins dir? // If so, there's no place to store locale info. Log::error('The GNU social install dir seems to contain a piece named plugin'); return false; } return $final; } }