X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Ffunctions2.php;h=555aa04e9623dc20e3af5c166fbcd7806a91cfd4;hb=fafac207c5a7bb610c4a2ce473cc677eeca92e4e;hp=22c602362ccae81762293100719547c7ad5f1e6a;hpb=baaf4c3043f428ec009dd48b85e1c2d6cb8abee4;p=tt-rss.git diff --git a/include/functions2.php b/include/functions2.php index 22c60236..555aa04e 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -399,6 +399,7 @@ if ($search) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) { list($search_query_part, $search_words) = $plugin->hook_search($search); + break; } // fall back in case of no plugins @@ -425,8 +426,10 @@ // Try to check if SQL regexp implementation chokes on a valid regexp - $result = db_query("SELECT true AS true_val FROM ttrss_entries, - ttrss_user_entries, ttrss_feeds + $result = db_query("SELECT true AS true_val + FROM ttrss_entries + JOIN ttrss_user_entries ON ttrss_entries.id = ttrss_user_entries.ref_id + JOIN ttrss_feeds ON ttrss_feeds.id = ttrss_user_entries.feed_id WHERE $filter_query_part LIMIT 1", false); if ($result) { @@ -1744,7 +1747,7 @@ return $rv; } - function save_email_address($email) { + /* function save_email_address($email) { // FIXME: implement persistent storage of emails if (!$_SESSION['stored_emails']) @@ -1752,7 +1755,7 @@ if (!in_array($email, $_SESSION['stored_emails'])) array_push($_SESSION['stored_emails'], $email); - } + } */ function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { @@ -1845,8 +1848,17 @@ $result = get_article_enclosures($id); $rv = ''; - if (count($result) > 0) { + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ENCLOSURES) as $plugin) { + $retval = $plugin->hook_format_enclosures($rv, $result, $id, $always_display_enclosures, $article_content, $hide_images); + if (is_array($retval)) { + $rv = $retval[0]; + $result = $retval[1]; + } else { + $rv = $retval; + } + } + if ($rv === '' && !empty($result)) { $entries_html = array(); $entries = array(); $entries_inline = array(); @@ -1856,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"); @@ -1879,6 +1893,8 @@ $entry["filename"] = $filename; $entry["url"] = $url; $entry["title"] = $title; + $entry["width"] = $width; + $entry["height"] = $height; array_push($entries, $entry); } @@ -1893,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 } }