mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 06:07:29 +02:00
Use the spread operator instead of 'array_merge' in more places.
PHP 8.1 introduced support for merging string-key arrays (last array with a wins).
This commit is contained in:
parent
d5b1258d29
commit
1742fb65c5
@ -301,8 +301,11 @@ class DiskCache implements Cache_Adapter {
|
|||||||
if ($this->exists($local_filename) && !$force)
|
if ($this->exists($local_filename) && !$force)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
$data = UrlHelper::fetch(array_merge(["url" => $url,
|
$data = UrlHelper::fetch([
|
||||||
"max_size" => Config::get(Config::MAX_CACHE_FILE_SIZE)], $options));
|
'url' => $url,
|
||||||
|
'max_size' => Config::get(Config::MAX_CACHE_FILE_SIZE),
|
||||||
|
...$options,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($data)
|
if ($data)
|
||||||
return $this->put($local_filename, $data) > 0;
|
return $this->put($local_filename, $data) > 0;
|
||||||
|
@ -851,14 +851,12 @@ class PluginHost {
|
|||||||
*/
|
*/
|
||||||
function get_method_url(Plugin $sender, string $method, array $params = []): string {
|
function get_method_url(Plugin $sender, string $method, array $params = []): string {
|
||||||
return Config::get_self_url() . "/backend.php?" .
|
return Config::get_self_url() . "/backend.php?" .
|
||||||
http_build_query(
|
http_build_query([
|
||||||
array_merge(
|
'op' => 'pluginhandler',
|
||||||
[
|
'plugin' => strtolower(get_class($sender)),
|
||||||
"op" => "pluginhandler",
|
'method' => $method,
|
||||||
"plugin" => strtolower(get_class($sender)),
|
...$params,
|
||||||
"method" => $method
|
]);
|
||||||
],
|
|
||||||
$params));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shortcut syntax (disabled for now)
|
// shortcut syntax (disabled for now)
|
||||||
@ -880,12 +878,10 @@ class PluginHost {
|
|||||||
function get_public_method_url(Plugin $sender, string $method, array $params = []): ?string {
|
function get_public_method_url(Plugin $sender, string $method, array $params = []): ?string {
|
||||||
if ($sender->is_public_method($method)) {
|
if ($sender->is_public_method($method)) {
|
||||||
return Config::get_self_url() . "/public.php?" .
|
return Config::get_self_url() . "/public.php?" .
|
||||||
http_build_query(
|
http_build_query([
|
||||||
array_merge(
|
'op' => strtolower(get_class($sender) . self::PUBLIC_METHOD_DELIMITER . $method),
|
||||||
[
|
...$params,
|
||||||
"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.");
|
user_error("get_public_method_url: requested method '$method' of '" . get_class($sender) . "' is private.");
|
||||||
return null;
|
return null;
|
||||||
|
@ -56,21 +56,21 @@
|
|||||||
* @param array<string, mixed> $attributes
|
* @param array<string, mixed> $attributes
|
||||||
*/
|
*/
|
||||||
function number_spinner_tag(string $name, string $value, array $attributes = [], string $id = ""): string {
|
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<string, mixed> $attributes
|
* @param array<string, mixed> $attributes
|
||||||
*/
|
*/
|
||||||
function submit_tag(string $value, array $attributes = []): string {
|
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<string, mixed> $attributes
|
* @param array<string, mixed> $attributes
|
||||||
*/
|
*/
|
||||||
function cancel_dialog_tag(string $value, array $attributes = []): string {
|
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,15 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
function stylesheet_tag(string $filename, array $attributes = []): string {
|
function stylesheet_tag(string $filename, array $attributes = []): string {
|
||||||
|
|
||||||
$attributes_str = \Controls\attributes_to_string(
|
$attributes_str = \Controls\attributes_to_string([
|
||||||
array_merge(
|
'href' => "$filename?" . filemtime($filename),
|
||||||
[
|
'rel' => 'stylesheet',
|
||||||
"href" => "$filename?" . filemtime($filename),
|
'type' => 'text/css',
|
||||||
"rel" => "stylesheet",
|
'data-orig-href' => $filename,
|
||||||
"type" => "text/css",
|
...$attributes,
|
||||||
"data-orig-href" => $filename
|
]);
|
||||||
],
|
|
||||||
$attributes));
|
|
||||||
|
|
||||||
return "<link $attributes_str/>\n";
|
return "<link $attributes_str/>\n";
|
||||||
}
|
}
|
||||||
@ -22,14 +20,12 @@ function stylesheet_tag(string $filename, array $attributes = []): string {
|
|||||||
* @param array<string, mixed> $attributes
|
* @param array<string, mixed> $attributes
|
||||||
*/
|
*/
|
||||||
function javascript_tag(string $filename, array $attributes = []): string {
|
function javascript_tag(string $filename, array $attributes = []): string {
|
||||||
$attributes_str = \Controls\attributes_to_string(
|
$attributes_str = \Controls\attributes_to_string([
|
||||||
array_merge(
|
'src' => "$filename?" . filemtime($filename),
|
||||||
[
|
'type' => 'text/javascript',
|
||||||
"src" => "$filename?" . filemtime($filename),
|
'charset' => 'utf-8',
|
||||||
"type" => "text/javascript",
|
...$attributes,
|
||||||
"charset" => "utf-8"
|
]);
|
||||||
],
|
|
||||||
$attributes));
|
|
||||||
|
|
||||||
return "<script $attributes_str></script>\n";
|
return "<script $attributes_str></script>\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user