be more snake_case

This commit is contained in:
Shish 2020-10-26 00:27:06 +00:00
parent 5816aa3084
commit 8ad783ff4c
5 changed files with 7 additions and 14 deletions

View file

@ -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);
}

View file

@ -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) {

View file

@ -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(); ";
}

View file

@ -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;

View file

@ -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);