X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Ffunctions2.php;h=deeaaf2109f5c93479e2d61f4042a60c451189d5;hb=ae962a96fdba3fcc14b60d48f0db48bb7f3b243e;hp=d6a399ffcdd9a1fd4db9a5c7740abfe9ceb4d00d;hpb=3e0f2090bfe90756b6a0a8f803ec5c407b50c41e;p=tt-rss.git diff --git a/include/functions2.php b/include/functions2.php index d6a399ff..deeaaf21 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -1868,6 +1868,8 @@ $url = $line["content_url"]; $ctype = $line["content_type"]; $title = $line["title"]; + $width = $line["width"]; + $height = $line["height"]; if (!$ctype) $ctype = __("unknown type"); @@ -1891,6 +1893,8 @@ $entry["filename"] = $filename; $entry["url"] = $url; $entry["title"] = $title; + $entry["width"] = $width; + $entry["height"] = $height; array_push($entries, $entry); } @@ -1905,9 +1909,15 @@ preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) { if (!$hide_images) { + $encsize = ''; + if ($entry['height'] > 0) + $encsize .= ' height="' . intval($entry['width']) . '"'; + if ($entry['width'] > 0) + $encsize .= ' width="' . intval($entry['height']) . '"'; $rv .= "

\"".htmlspecialchars($entry["filename"])."\"

"; + src=\"" .htmlspecialchars($entry["url"]) . "\" + " . $encsize . " />

"; } else { $rv .= "

= filemtime("js/$js.js")) { + if (file_exists($cached_file) && is_readable($cached_file) && filemtime($cached_file) >= filemtime("js/$js.js")) { - $rv .= file_get_contents($cached_file); + list($header, $contents) = explode("\n", file_get_contents($cached_file), 2); - } else { - $minified = JShrink\Minifier::minify(file_get_contents("js/$js.js")); - file_put_contents($cached_file, $minified); - $rv .= $minified; + if ($header && $contents) { + list($htag, $hversion) = explode(":", $header); + + if ($htag == "tt-rss" && $hversion == VERSION) { + $rv .= $contents; + continue; + } + } } + + $minified = JShrink\Minifier::minify(file_get_contents("js/$js.js")); + file_put_contents($cached_file, "tt-rss:" . VERSION . "\n" . $minified); + $rv .= $minified; + } else { - $rv .= file_get_contents("js/$js.js"); + $rv .= file_get_contents("js/$js.js"); // no cache in debug mode } }