diff --git a/classes/DiskCache.php b/classes/DiskCache.php index 249079b36..c52759a75 100644 --- a/classes/DiskCache.php +++ b/classes/DiskCache.php @@ -301,8 +301,11 @@ class DiskCache implements Cache_Adapter { if ($this->exists($local_filename) && !$force) return true; - $data = UrlHelper::fetch(array_merge(["url" => $url, - "max_size" => Config::get(Config::MAX_CACHE_FILE_SIZE)], $options)); + $data = UrlHelper::fetch([ + 'url' => $url, + 'max_size' => Config::get(Config::MAX_CACHE_FILE_SIZE), + ...$options, + ]); if ($data) return $this->put($local_filename, $data) > 0; diff --git a/classes/PluginHost.php b/classes/PluginHost.php index cc81bc9c0..9a8fa32c2 100644 --- a/classes/PluginHost.php +++ b/classes/PluginHost.php @@ -851,14 +851,12 @@ class PluginHost { */ function get_method_url(Plugin $sender, string $method, array $params = []): string { return Config::get_self_url() . "/backend.php?" . - http_build_query( - array_merge( - [ - "op" => "pluginhandler", - "plugin" => strtolower(get_class($sender)), - "method" => $method - ], - $params)); + http_build_query([ + 'op' => 'pluginhandler', + 'plugin' => strtolower(get_class($sender)), + 'method' => $method, + ...$params, + ]); } // shortcut syntax (disabled for now) @@ -880,12 +878,10 @@ class PluginHost { function get_public_method_url(Plugin $sender, string $method, array $params = []): ?string { if ($sender->is_public_method($method)) { return Config::get_self_url() . "/public.php?" . - http_build_query( - array_merge( - [ - "op" => strtolower(get_class($sender) . self::PUBLIC_METHOD_DELIMITER . $method), - ], - $params)); + http_build_query([ + 'op' => strtolower(get_class($sender) . self::PUBLIC_METHOD_DELIMITER . $method), + ...$params, + ]); } user_error("get_public_method_url: requested method '$method' of '" . get_class($sender) . "' is private."); return null; diff --git a/include/controls.php b/include/controls.php index 5c6174e3d..8932dd048 100755 --- a/include/controls.php +++ b/include/controls.php @@ -56,21 +56,21 @@ * @param array $attributes */ function number_spinner_tag(string $name, string $value, array $attributes = [], string $id = ""): string { - return input_tag($name, $value, "text", array_merge(["dojoType" => "dijit.form.NumberSpinner"], $attributes), $id); + return input_tag($name, $value, 'text', ['dojoType' => 'dijit.form.NumberSpinner', ...$attributes], $id); } /** * @param array $attributes */ function submit_tag(string $value, array $attributes = []): string { - return button_tag($value, "submit", array_merge(["class" => "alt-primary"], $attributes)); + return button_tag($value, 'submit', ['class' => 'alt-primary', ...$attributes]); } /** * @param array $attributes */ function cancel_dialog_tag(string $value, array $attributes = []): string { - return button_tag($value, "", array_merge(["onclick" => "App.dialogOf(this).hide()"], $attributes)); + return button_tag($value, '', ['onclick' => 'App.dialogOf(this).hide()', ...$attributes]); } /** diff --git a/include/controls_compat.php b/include/controls_compat.php index 5a2a9f2ba..d22f7fc3c 100644 --- a/include/controls_compat.php +++ b/include/controls_compat.php @@ -5,15 +5,13 @@ */ function stylesheet_tag(string $filename, array $attributes = []): string { - $attributes_str = \Controls\attributes_to_string( - array_merge( - [ - "href" => "$filename?" . filemtime($filename), - "rel" => "stylesheet", - "type" => "text/css", - "data-orig-href" => $filename - ], - $attributes)); + $attributes_str = \Controls\attributes_to_string([ + 'href' => "$filename?" . filemtime($filename), + 'rel' => 'stylesheet', + 'type' => 'text/css', + 'data-orig-href' => $filename, + ...$attributes, + ]); return "\n"; } @@ -22,14 +20,12 @@ function stylesheet_tag(string $filename, array $attributes = []): string { * @param array $attributes */ function javascript_tag(string $filename, array $attributes = []): string { - $attributes_str = \Controls\attributes_to_string( - array_merge( - [ - "src" => "$filename?" . filemtime($filename), - "type" => "text/javascript", - "charset" => "utf-8" - ], - $attributes)); + $attributes_str = \Controls\attributes_to_string([ + 'src' => "$filename?" . filemtime($filename), + 'type' => 'text/javascript', + 'charset' => 'utf-8', + ...$attributes, + ]); return "\n"; }