From 8ad783ff4c73698706d602a821631d819812154b Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 26 Oct 2020 00:27:06 +0000 Subject: [PATCH] be more snake_case --- core/extension.php | 4 ++-- core/polyfills.php | 4 ++-- core/send_event.php | 4 ++-- core/util.php | 7 ------- ext/upload/main.php | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/core/extension.php b/core/extension.php index 6409267e..eb15c56a 100644 --- a/core/extension.php +++ b/core/extension.php @@ -243,7 +243,7 @@ abstract class ExtensionInfo public static function load_all_extension_info() { - foreach (getSubclassesOf("ExtensionInfo") as $class) { + foreach (get_subclasses_of("ExtensionInfo") as $class) { $extension_info = new $class(); if (array_key_exists($extension_info->key, self::$all_info_by_key)) { throw new ScoreException("Extension Info $class with key $extension_info->key has already been loaded"); @@ -439,7 +439,7 @@ abstract class DataHandlerExtension extends Extension public static function get_all_supported_mimes(): array { $arr = []; - foreach (getSubclassesOf("DataHandlerExtension") as $handler) { + foreach (get_subclasses_of("DataHandlerExtension") as $handler) { $handler = (new $handler()); $arr = array_merge($arr, $handler->SUPPORTED_MIME); } diff --git a/core/polyfills.php b/core/polyfills.php index 04d0e793..d4299a28 100644 --- a/core/polyfills.php +++ b/core/polyfills.php @@ -222,7 +222,7 @@ if (!function_exists('http_parse_headers')) { * HTTP Headers can sometimes be lowercase which will cause issues. * In cases like these, we need to make sure to check for them if the camelcase version does not exist. */ -function findHeader(array $headers, string $name): ?string +function find_header(array $headers, string $name): ?string { if (!is_array($headers)) { return null; @@ -260,7 +260,7 @@ if (!function_exists('mb_strlen')) { } /** @noinspection PhpUnhandledExceptionInspection */ -function getSubclassesOf(string $parent) +function get_subclasses_of(string $parent) { $result = []; foreach (get_declared_classes() as $class) { diff --git a/core/send_event.php b/core/send_event.php index 469e514c..9d072844 100644 --- a/core/send_event.php +++ b/core/send_event.php @@ -35,7 +35,7 @@ function _set_event_listeners(): void global $_shm_event_listeners; $_shm_event_listeners = []; - foreach (getSubclassesOf("Extension") as $class) { + foreach (get_subclasses_of("Extension") as $class) { /** @var Extension $extension */ $extension = new $class(); @@ -61,7 +61,7 @@ function _dump_event_listeners(array $event_listeners, string $path): void { $p = "<"."?php\n"; - foreach (getSubclassesOf("Extension") as $class) { + foreach (get_subclasses_of("Extension") as $class) { $p .= "\$$class = new $class(); "; } diff --git a/core/util.php b/core/util.php index 23149cdf..85ace0eb 100644 --- a/core/util.php +++ b/core/util.php @@ -20,13 +20,6 @@ use function MicroHTML\TD; const DATA_DIR = "data"; -function mtimefile(string $file): string -{ - $data_href = get_base_href(); - $mtime = filemtime($file); - return "$data_href/$file?$mtime"; -} - function get_theme(): string { global $config; diff --git a/ext/upload/main.php b/ext/upload/main.php index 2a538960..ab693109 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -418,7 +418,7 @@ class Upload extends Extension // transload() returns Array or Bool, depending on the transload_engine. $headers = transload($url, $tmp_filename); - $s_filename = is_array($headers) ? findHeader($headers, 'Content-Disposition') : null; + $s_filename = is_array($headers) ? find_header($headers, 'Content-Disposition') : null; $h_filename = ($s_filename ? preg_replace('/^.*filename="([^ ]+)"/i', '$1', $s_filename) : null); $filename = $h_filename ?: basename($url);