be more snake_case
This commit is contained in:
parent
5816aa3084
commit
8ad783ff4c
5 changed files with 7 additions and 14 deletions
|
@ -243,7 +243,7 @@ abstract class ExtensionInfo
|
||||||
|
|
||||||
public static function load_all_extension_info()
|
public static function load_all_extension_info()
|
||||||
{
|
{
|
||||||
foreach (getSubclassesOf("ExtensionInfo") as $class) {
|
foreach (get_subclasses_of("ExtensionInfo") as $class) {
|
||||||
$extension_info = new $class();
|
$extension_info = new $class();
|
||||||
if (array_key_exists($extension_info->key, self::$all_info_by_key)) {
|
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");
|
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
|
public static function get_all_supported_mimes(): array
|
||||||
{
|
{
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach (getSubclassesOf("DataHandlerExtension") as $handler) {
|
foreach (get_subclasses_of("DataHandlerExtension") as $handler) {
|
||||||
$handler = (new $handler());
|
$handler = (new $handler());
|
||||||
$arr = array_merge($arr, $handler->SUPPORTED_MIME);
|
$arr = array_merge($arr, $handler->SUPPORTED_MIME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ if (!function_exists('http_parse_headers')) {
|
||||||
* HTTP Headers can sometimes be lowercase which will cause issues.
|
* 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.
|
* 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)) {
|
if (!is_array($headers)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -260,7 +260,7 @@ if (!function_exists('mb_strlen')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @noinspection PhpUnhandledExceptionInspection */
|
/** @noinspection PhpUnhandledExceptionInspection */
|
||||||
function getSubclassesOf(string $parent)
|
function get_subclasses_of(string $parent)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach (get_declared_classes() as $class) {
|
foreach (get_declared_classes() as $class) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ function _set_event_listeners(): void
|
||||||
global $_shm_event_listeners;
|
global $_shm_event_listeners;
|
||||||
$_shm_event_listeners = [];
|
$_shm_event_listeners = [];
|
||||||
|
|
||||||
foreach (getSubclassesOf("Extension") as $class) {
|
foreach (get_subclasses_of("Extension") as $class) {
|
||||||
/** @var Extension $extension */
|
/** @var Extension $extension */
|
||||||
$extension = new $class();
|
$extension = new $class();
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ function _dump_event_listeners(array $event_listeners, string $path): void
|
||||||
{
|
{
|
||||||
$p = "<"."?php\n";
|
$p = "<"."?php\n";
|
||||||
|
|
||||||
foreach (getSubclassesOf("Extension") as $class) {
|
foreach (get_subclasses_of("Extension") as $class) {
|
||||||
$p .= "\$$class = new $class(); ";
|
$p .= "\$$class = new $class(); ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,6 @@ use function MicroHTML\TD;
|
||||||
const DATA_DIR = "data";
|
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
|
function get_theme(): string
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
|
@ -418,7 +418,7 @@ class Upload extends Extension
|
||||||
// transload() returns Array or Bool, depending on the transload_engine.
|
// transload() returns Array or Bool, depending on the transload_engine.
|
||||||
$headers = transload($url, $tmp_filename);
|
$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);
|
$h_filename = ($s_filename ? preg_replace('/^.*filename="([^ ]+)"/i', '$1', $s_filename) : null);
|
||||||
$filename = $h_filename ?: basename($url);
|
$filename = $h_filename ?: basename($url);
|
||||||
|
|
||||||
|
|
Reference in a new issue