From d376cd61426d151aaf59d01aef6f39d230599972 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sat, 12 Nov 2022 16:20:59 +0000 Subject: [PATCH] Address upcoming string interpolation deprecation. https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation --- classes/db/migrations.php | 10 +++++----- classes/diskcache.php | 2 +- classes/feeds.php | 6 +++--- classes/pluginhandler.php | 6 +++--- classes/pref/labels.php | 2 +- classes/pref/prefs.php | 2 +- lib/gettext/gettext.inc.php | 12 ++++++------ 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/classes/db/migrations.php b/classes/db/migrations.php index ffce2af5f..d63736987 100644 --- a/classes/db/migrations.php +++ b/classes/db/migrations.php @@ -17,7 +17,7 @@ class Db_Migrations { function initialize_for_plugin(Plugin $plugin, bool $base_is_latest = true, string $schema_suffix = "sql"): void { $plugin_dir = PluginHost::getInstance()->get_plugin_dir($plugin); - $this->initialize($plugin_dir . "/${schema_suffix}", + $this->initialize("{$plugin_dir}/{$schema_suffix}", strtolower("ttrss_migrations_plugin_" . get_class($plugin)), $base_is_latest); } @@ -31,7 +31,7 @@ class Db_Migrations { } private function set_version(int $version): void { - Debug::log("Updating table {$this->migrations_table} with version ${version}...", Debug::LOG_EXTENDED); + Debug::log("Updating table {$this->migrations_table} with version {$version}...", Debug::LOG_EXTENDED); $sth = $this->pdo->query("SELECT * FROM {$this->migrations_table}"); @@ -170,7 +170,7 @@ class Db_Migrations { try { $this->migrate_to($i); } catch (PDOException $e) { - user_error("Failed to apply migration ${i} for {$this->migrations_table}: " . $e->getMessage(), E_USER_WARNING); + user_error("Failed to apply migration {$i} for {$this->migrations_table}: " . $e->getMessage(), E_USER_WARNING); return false; //throw $e; } @@ -184,7 +184,7 @@ class Db_Migrations { */ private function get_lines(int $version) : array { if ($version > 0) - $filename = "{$this->migrations_path}/${version}.sql"; + $filename = "{$this->migrations_path}/{$version}.sql"; else $filename = "{$this->base_path}/{$this->base_filename}"; @@ -196,7 +196,7 @@ class Db_Migrations { fn($line) => strlen(trim($line)) > 0 && !in_array(strtolower($line), ["begin", "commit"])); } else { - user_error("Requested schema file ${filename} not found.", E_USER_ERROR); + user_error("Requested schema file {$filename} not found.", E_USER_ERROR); return []; } } diff --git a/classes/diskcache.php b/classes/diskcache.php index 01c713b99..1df8daf15 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -306,7 +306,7 @@ class DiskCache { if ($fake_extension) $fake_extension = ".$fake_extension"; - header("Content-Disposition: inline; filename=\"${filename}${fake_extension}\""); + header("Content-Disposition: inline; filename=\"{$filename}{$fake_extension}\""); return $this->send_local_file($this->get_full_path($filename)); } diff --git a/classes/feeds.php b/classes/feeds.php index 37ce77aa9..a063b9ed5 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1749,11 +1749,11 @@ class Feeds extends Handler_Protected { } if (!$allow_archived) { - $from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id), ttrss_feeds"; + $from_qpart = "{$ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id), ttrss_feeds"; $feed_check_qpart = "ttrss_user_entries.feed_id = ttrss_feeds.id AND"; } else { - $from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id) + $from_qpart = "{$ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id) LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)"; $feed_check_qpart = ""; } @@ -2238,7 +2238,7 @@ class Feeds extends Handler_Protected { * @return array{0: string, 1: array} [$search_query_part, $search_words] */ private static function _search_to_sql(string $search, string $search_language, int $owner_uid): array { - $keywords = str_getcsv(preg_replace('/(-?\w+)\:"(\w+)/', '"${1}:${2}', trim($search)), ' '); + $keywords = str_getcsv(preg_replace('/(-?\w+)\:"(\w+)/', '"{$1}:{$2}', trim($search)), ' '); $query_keywords = array(); $search_words = array(); $search_query_leftover = array(); diff --git a/classes/pluginhandler.php b/classes/pluginhandler.php index 5c73920e5..a6f0a4965 100644 --- a/classes/pluginhandler.php +++ b/classes/pluginhandler.php @@ -14,15 +14,15 @@ class PluginHandler extends Handler_Protected { if (validate_csrf($csrf_token) || $plugin->csrf_ignore($method)) { $plugin->$method(); } else { - user_error("Rejected ${plugin_name}->${method}(): invalid CSRF token.", E_USER_WARNING); + user_error("Rejected {$plugin_name}->{$method}(): invalid CSRF token.", E_USER_WARNING); print Errors::to_json(Errors::E_UNAUTHORIZED); } } else { - user_error("Rejected ${plugin_name}->${method}(): unknown method.", E_USER_WARNING); + user_error("Rejected {$plugin_name}->{$method}(): unknown method.", E_USER_WARNING); print Errors::to_json(Errors::E_UNKNOWN_METHOD); } } else { - user_error("Rejected ${plugin_name}->${method}(): unknown plugin.", E_USER_WARNING); + user_error("Rejected {$plugin_name}->{$method}(): unknown plugin.", E_USER_WARNING); print Errors::to_json(Errors::E_UNKNOWN_PLUGIN); } } diff --git a/classes/pref/labels.php b/classes/pref/labels.php index a50a85a66..2e128691e 100644 --- a/classes/pref/labels.php +++ b/classes/pref/labels.php @@ -61,7 +61,7 @@ class Pref_Labels extends Handler_Protected { if ($kind == "fg" || $kind == "bg") { $sth = $this->pdo->prepare("UPDATE ttrss_labels2 SET - ${kind}_color = ? WHERE id = ? + {$kind}_color = ? WHERE id = ? AND owner_uid = ?"); $sth->execute([$color, $id, $_SESSION['uid']]); diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 3285ce200..0c1b90213 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -240,7 +240,7 @@ class Pref_Prefs extends Handler_Protected { $user->full_name = clean($_POST['full_name']); if ($user->email != $new_email) { - Logger::log(E_USER_NOTICE, "Email address of user ".$user->login." has been changed to ${new_email}."); + Logger::log(E_USER_NOTICE, "Email address of user {$user->login} has been changed to {$new_email}."); if ($user->email) { $mailer = new Mailer(); diff --git a/lib/gettext/gettext.inc.php b/lib/gettext/gettext.inc.php index ef36924c7..60a41ddfa 100644 --- a/lib/gettext/gettext.inc.php +++ b/lib/gettext/gettext.inc.php @@ -88,18 +88,18 @@ function get_list_of_locales($locale) { if ($modifier) { if ($country) { if ($charset) - array_push($locale_names, "${lang}_$country.$charset@$modifier"); - array_push($locale_names, "${lang}_$country@$modifier"); + array_push($locale_names, "{$lang}_$country.$charset@$modifier"); + array_push($locale_names, "{$lang}_$country@$modifier"); } elseif ($charset) - array_push($locale_names, "${lang}.$charset@$modifier"); + array_push($locale_names, "{$lang}.$charset@$modifier"); array_push($locale_names, "$lang@$modifier"); } if ($country) { if ($charset) - array_push($locale_names, "${lang}_$country.$charset"); - array_push($locale_names, "${lang}_$country"); + array_push($locale_names, "{$lang}_$country.$charset"); + array_push($locale_names, "{$lang}_$country"); } elseif ($charset) - array_push($locale_names, "${lang}.$charset"); + array_push($locale_names, "{$lang}.$charset"); array_push($locale_names, $lang); }