diff --git a/include/controls.php b/include/controls.php
index b65a166c2..a1a1bc59b 100755
--- a/include/controls.php
+++ b/include/controls.php
@@ -2,7 +2,7 @@
namespace Controls;
function attributes_to_string(array $attributes) {
- $rv = "";
+ $rv = [];
foreach ($attributes as $k => $v) {
@@ -10,10 +10,10 @@
if ($k === "disabled" && !sql_bool_to_bool($v))
continue;
- $rv .= "$k=\"" . htmlspecialchars($v) . "\"";
+ array_push($rv, "$k=\"" . htmlspecialchars($v) . "\"");
}
- return $rv;
+ return implode(" ", $rv);
}
// shortcut syntax (disabled)
diff --git a/include/controls_compat.php b/include/controls_compat.php
index a4e9ad73f..d1c2c12b5 100644
--- a/include/controls_compat.php
+++ b/include/controls_compat.php
@@ -1,27 +1,32 @@
"$filename?" . filemtime($filename),
+ "rel" => "stylesheet",
+ "type" => "text/css",
+ "data-orig-href" => $filename
+ ],
+ $attributes));
- return "\n";
+ return "\n";
}
-function javascript_tag($filename) {
- $query = "";
+function javascript_tag($filename, $attributes = []) {
+ $attributes_str = \Controls\attributes_to_string(
+ array_merge(
+ [
+ "src" => "$filename?" . filemtime($filename),
+ "type" => "text/javascript",
+ "charset" => "utf-8"
+ ],
+ $attributes));
- if (!(strpos($filename, "?") === false)) {
- $query = substr($filename, strpos($filename, "?")+1);
- $filename = substr($filename, 0, strpos($filename, "?"));
- }
-
- $timestamp = filemtime($filename);
-
- if ($query) $timestamp .= "&$query";
-
- return "\n";
+ return "\n";
}
function format_warning($msg, $id = "") {
@@ -47,268 +52,3 @@ function print_warning($msg) {
function print_error($msg) {
return print format_error($msg);
}
-
-// the following is deprecated and will be eventually removed
-
-/*function print_select($id, $default, $values, $attributes = "", $name = "") {
- if (!$name) $name = $id;
-
- print "";
-}
-
-function print_select_hash($id, $default, $values, $attributes = "", $name = "") {
- if (!$name) $name = $id;
-
- print "";
-}
-
-function format_hidden($name, $value) {
- return "";
-}
-
-function print_hidden($name, $value) {
- print format_hidden($name, $value);
-}
-
-function format_checkbox($id, $checked, $value = "", $attributes = "") {
- $checked_str = $checked ? "checked" : "";
- $value_str = $value ? "value=\"$value\"" : "";
-
- return "";
-}
-
-function print_checkbox($id, $checked, $value = "", $attributes = "") {
- print format_checkbox($id, $checked, $value, $attributes);
-}
-
-function format_button($type, $value, $attributes = "") {
- return "";
-}
-
-function print_button($type, $value, $attributes = "") {
- print format_button($type, $value, $attributes);
-}
-
-function print_feed_multi_select($id, $default_ids = [],
- $attributes = "", $include_all_feeds = true,
- $root_id = null, $nest_level = 0) {
-
- $pdo = Db::pdo();
-
- print_r(in_array("CAT:6",$default_ids));
-
- if (!$root_id) {
- print "";
- }
-}
-
-function print_feed_cat_select($id, $default_id, $attributes, $include_all_cats = true,
- $root_id = null, $nest_level = 0) {
-
- print format_feed_cat_select($id, $default_id, $attributes, $include_all_cats, $root_id, $nest_level);
-}
-
-function format_feed_cat_select($id, $default_id, $attributes, $include_all_cats = true,
- $root_id = null, $nest_level = 0) {
-
- $ret = "";
-
- if (!$root_id) {
- $ret .= "";
- }
-
- return $ret;
-}
-
-function print_label_select($name, $value, $attributes = "") {
-
- $pdo = Db::pdo();
-
- $sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
- WHERE owner_uid = ? ORDER BY caption");
- $sth->execute([$_SESSION['uid']]);
-
- print "";
-
-
-}
-*/
diff --git a/index.php b/index.php
index 573df98ac..ba6e03376 100644
--- a/index.php
+++ b/index.php
@@ -31,7 +31,7 @@
'theme_css']);
}
} ?>
diff --git a/prefs.php b/prefs.php
index dd3d3a4b0..3f6eb47c6 100644
--- a/prefs.php
+++ b/prefs.php
@@ -23,7 +23,7 @@
'theme_css']);
}
} ?>