当前位置: 首页>>代码示例>>PHP>>正文


PHP queryFeedHeadlines函数代码示例

本文整理汇总了PHP中queryFeedHeadlines函数的典型用法代码示例。如果您正苦于以下问题:PHP queryFeedHeadlines函数的具体用法?PHP queryFeedHeadlines怎么用?PHP queryFeedHeadlines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了queryFeedHeadlines函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter_test

 function filter_test($filter_type, $reg_exp, $action_id, $action_param, $filter_param, $inverse, $feed_id, $cat_id, $cat_filter)
 {
     $result = db_query($this->link, "SELECT name FROM ttrss_filter_types WHERE\n\t\t\tid = " . $filter_type);
     $type_name = db_fetch_result($result, 0, "name");
     $result = db_query($this->link, "SELECT name FROM ttrss_filter_actions WHERE\n\t\t\tid = " . $action_id);
     $action_name = db_fetch_result($result, 0, "name");
     $filter["reg_exp"] = $reg_exp;
     $filter["action"] = $action_name;
     $filter["type"] = $type_name;
     $filter["action_param"] = $action_param;
     $filter["filter_param"] = $filter_param;
     $filter["inverse"] = $inverse;
     $filters[$type_name] = array($filter);
     if ($feed_id) {
         $feed = $feed_id;
     } else {
         $feed = -4;
     }
     $regexp_valid = preg_match('/' . $filter['reg_exp'] . '/', $filter['reg_exp']) !== FALSE;
     print __("Articles matching this filter:");
     print "<div class=\"filterTestHolder\">";
     print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
     if ($regexp_valid) {
         $feed_title = getFeedTitle($this->link, $feed);
         $qfh_ret = queryFeedHeadlines($this->link, $cat_filter ? $cat_id : $feed, 30, "", $cat_filter, false, false, false, "date_entered DESC", 0, $_SESSION["uid"], $filter);
         $result = $qfh_ret[0];
         $articles = array();
         $found = 0;
         while ($line = db_fetch_assoc($result)) {
             $entry_timestamp = strtotime($line["updated"]);
             $entry_tags = get_article_tags($this->link, $line["id"], $_SESSION["uid"]);
             $content_preview = truncate_string(strip_tags($line["content_preview"]), 100, '...');
             if ($line["feed_title"]) {
                 $feed_title = $line["feed_title"];
             }
             print "<tr>";
             print "<td width='5%' align='center'><input\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" checked=\"1\"\n\t\t\t\t\tdisabled=\"1\" type=\"checkbox\"></td>";
             print "<td>";
             print $line["title"];
             print "&nbsp;(";
             print "<b>" . $feed_title . "</b>";
             print "):&nbsp;";
             print "<span class=\"insensitive\">" . $content_preview . "</span>";
             print " " . mb_substr($line["date_entered"], 0, 16);
             print "</td></tr>";
             $found++;
         }
         if ($found == 0) {
             print "<tr><td align='center'>" . __("No articles matching this filter has been found.") . "</td></tr>";
         }
     } else {
         print "<tr><td align='center' class='error'>" . __("Invalid regular expression.") . "</td></tr>";
     }
     print "</table>";
     print "</div>";
 }
开发者ID:4iji,项目名称:Tiny-Tiny-RSS,代码行数:56,代码来源:pref_filters.php

示例2: get_headlines

 function get_headlines($feed_id, $options)
 {
     /*$qfh_ret = queryFeedHeadlines(-4,
     		$options['limit'],
     		$this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
     		false,
     		$options['search'],
     		$options['search_mode'],
     		$options['override_order'],
     		$options['offset'],
     		$options['owner_uid'],
     		$options['filter'],
     		$options['since_id'],
     		$options['include_children'],
     		false,
     		"uuid != ''",
     		"ttrss_feeds.title AS feed_title,"); */
     $params = array("feed" => -4, "limit" => $options["limit"], "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles", "search" => $options['search'], "override_order" => $options['override_order'], "offset" => $options["offset"], "filter" => $options["filter"], "since_id" => $options["since_id"], "include_children" => $options["include_children"], "override_strategy" => "uuid != ''", "override_vfeed" => "ttrss_feeds.title AS feed_title,");
     $qfh_ret = queryFeedHeadlines($params);
     $qfh_ret[1] = __("Shared articles");
     return $qfh_ret;
 }
开发者ID:XelaRellum,项目名称:tt-rss,代码行数:22,代码来源:init.php

示例3: format_headlines_list

 private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false)
 {
     if (isset($_REQUEST["DevForceUpdate"])) {
         header("Content-Type: text/plain; charset=utf-8");
     }
     $disable_cache = false;
     $reply = array();
     $rgba_cache = array();
     $timing_info = microtime(true);
     $topmost_article_ids = array();
     if (!$offset) {
         $offset = 0;
     }
     if ($method == "undefined") {
         $method = "";
     }
     $method_split = explode(":", $method);
     if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
         // Update the feed if required with some basic flood control
         $result = $this->dbh->query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
         if ($this->dbh->num_rows($result) != 0) {
             $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
             $cache_images = sql_bool_to_bool($this->dbh->fetch_result($result, 0, "cache_images"));
             if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
                 include "rssfuncs.php";
                 update_rss_feed($feed, true, true);
             } else {
                 $this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed}'");
             }
         }
     }
     if ($method_split[0] == "MarkAllReadGR") {
         catchup_feed($method_split[1], false);
     }
     // FIXME: might break tag display?
     if (is_numeric($feed) && $feed > 0 && !$cat_view) {
         $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
         if ($this->dbh->num_rows($result) == 0) {
             $reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>";
         }
     }
     @($search = $this->dbh->escape_string($_REQUEST["query"]));
     if ($search) {
         $disable_cache = true;
     }
     @($search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]));
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H0", $timing_info);
     }
     //		error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
     if ($search_mode == '' && $method != '') {
         $search_mode = $method;
     }
     //		error_log("search_mode: " . $search_mode);
     if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
         $handler = PluginHost::getInstance()->get_feed_handler(PluginHost::feed_to_pfeed_id($feed));
         //	function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) {
         if ($handler) {
             $options = array("limit" => $limit, "view_mode" => $view_mode, "cat_view" => $cat_view, "search" => $search, "search_mode" => $search_mode, "override_order" => $override_order, "offset" => $offset, "owner_uid" => $_SESSION["uid"], "filter" => false, "since_id" => 0, "include_children" => $include_children);
             $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed), $options);
         }
     } else {
         $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order, $offset, 0, false, 0, $include_children);
     }
     $vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H1", $timing_info);
     }
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? make_local_datetime($qfh_ret[4], false) : __("Never");
     $highlight_words = $qfh_ret[5];
     $vgroup_last_feed = $vgr_last_feed;
     $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $search_mode, $view_mode, $last_error, $last_updated);
     $headlines_count = $this->dbh->num_rows($result);
     /* if (get_pref('COMBINED_DISPLAY_MODE')) {
     			$button_plugins = array();
     			foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
     				$pclass = "button_" . trim($p);
     
     				if (class_exists($pclass)) {
     					$plugin = new $pclass();
     					array_push($button_plugins, $plugin);
     				}
     			}
     		} */
     if ($offset == 0) {
         foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_BEFORE) as $p) {
             $reply['content'] .= $p->hook_headlines_before($feed, $cat_view, $qfh_ret);
         }
     }
     if ($this->dbh->num_rows($result) > 0) {
         $lnum = $offset;
         $num_unread = 0;
         $cur_feed_title = '';
         if ($_REQUEST["debug"]) {
             $timing_info = print_checkpoint("PS", $timing_info);
         }
//.........这里部分代码省略.........
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:101,代码来源:feeds.php

示例4: testFilter

 function testFilter()
 {
     $filter = array();
     $filter["enabled"] = true;
     $filter["match_any_rule"] = sql_bool_to_bool(checkbox_to_sql_bool(db_escape_string($_REQUEST["match_any_rule"])));
     $filter["rules"] = array();
     $result = db_query($this->link, "SELECT id,name FROM ttrss_filter_types");
     $filter_types = array();
     while ($line = db_fetch_assoc($result)) {
         $filter_types[$line["id"]] = $line["name"];
     }
     $rctr = 0;
     foreach ($_REQUEST["rule"] as $r) {
         $rule = json_decode($r, true);
         if ($rule && $rctr < 5) {
             $rule["type"] = $filter_types[$rule["filter_type"]];
             unset($rule["filter_type"]);
             if (strpos($rule["feed_id"], "CAT:") === 0) {
                 $rule["cat_id"] = (int) substr($rule["feed_id"], 4);
                 unset($rule["feed_id"]);
             }
             array_push($filter["rules"], $rule);
             ++$rctr;
         } else {
             break;
         }
     }
     $feed_title = getFeedTitle($this->link, $feed);
     $qfh_ret = queryFeedHeadlines($this->link, -4, 30, "", false, false, false, false, "date_entered DESC", 0, $_SESSION["uid"], $filter);
     $result = $qfh_ret[0];
     $articles = array();
     $found = 0;
     print __("Articles matching this filter:");
     print "<div class=\"filterTestHolder\">";
     print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
     while ($line = db_fetch_assoc($result)) {
         $entry_timestamp = strtotime($line["updated"]);
         $entry_tags = get_article_tags($this->link, $line["id"], $_SESSION["uid"]);
         $content_preview = truncate_string(strip_tags($line["content_preview"]), 100, '...');
         if ($line["feed_title"]) {
             $feed_title = $line["feed_title"];
         }
         print "<tr>";
         print "<td width='5%' align='center'><input\n\t\t\t\tdojoType=\"dijit.form.CheckBox\" checked=\"1\"\n\t\t\t\tdisabled=\"1\" type=\"checkbox\"></td>";
         print "<td>";
         print $line["title"];
         print "&nbsp;(";
         print "<b>" . $feed_title . "</b>";
         print "):&nbsp;";
         print "<span class=\"insensitive\">" . $content_preview . "</span>";
         print " " . mb_substr($line["date_entered"], 0, 16);
         print "</td></tr>";
         $found++;
     }
     if ($found == 0) {
         print "<tr><td align='center'>" . __("No recent articles matching this filter have been found.") . "</td></tr>";
     }
     print "</table></div>";
     print "<div style='text-align : center'>";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('filterTestDlg').hide()\">" . __('Close this window') . "</button>";
     print "</div>";
 }
开发者ID:rolfkleef,项目名称:Tiny-Tiny-RSS,代码行数:62,代码来源:filters.php

示例5: outputHeadlinesList

function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false)
{
    $disable_cache = false;
    $timing_info = getmicrotime();
    $topmost_article_ids = array();
    if (!$offset) {
        $offset = 0;
    }
    if ($subop == "undefined") {
        $subop = "";
    }
    $subop_split = split(":", $subop);
    if ($subop == "CatchupSelected") {
        $ids = split(",", db_escape_string($_REQUEST["ids"]));
        $cmode = sprintf("%d", $_REQUEST["cmode"]);
        catchupArticlesById($link, $ids, $cmode);
    }
    if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
        update_generic_feed($link, $feed, $cat_view, true);
    }
    if ($subop == "MarkAllRead") {
        catchup_feed($link, $feed, $cat_view);
        if (get_pref($link, 'ON_CATCHUP_SHOW_NEXT_FEED')) {
            if ($next_unread_feed) {
                $feed = $next_unread_feed;
            }
        }
    }
    if ($subop_split[0] == "MarkAllReadGR") {
        catchup_feed($link, $subop_split[1], false);
    }
    if ($feed_id > 0) {
        $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
        if (db_num_rows($result) == 0) {
            print "<div align='center'>" . __('Feed not found.') . "</div>";
            return;
        }
    }
    if (preg_match("/^-?[0-9][0-9]*\$/", $feed) != false) {
        $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds\n\t\t\t\tWHERE id = '{$feed}' AND owner_uid = " . $_SESSION["uid"]);
        if (db_num_rows($result) == 1) {
            $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
        } else {
            $rtl_content = false;
        }
        if ($rtl_content) {
            $rtl_tag = "dir=\"RTL\"";
        } else {
            $rtl_tag = "";
        }
    } else {
        $rtl_tag = "";
        $rtl_content = false;
    }
    $script_dt_add = get_script_dt_add();
    /// START /////////////////////////////////////////////////////////////////////////////////
    $search = db_escape_string($_REQUEST["query"]);
    if ($search) {
        $disable_cache = true;
    }
    $search_mode = db_escape_string($_REQUEST["search_mode"]);
    $match_on = db_escape_string($_REQUEST["match_on"]);
    if (!$match_on) {
        $match_on = "both";
    }
    $real_offset = $offset * $limit;
    if ($_REQUEST["debug"]) {
        $timing_info = print_checkpoint("H0", $timing_info);
    }
    $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order, $real_offset);
    if ($_REQUEST["debug"]) {
        $timing_info = print_checkpoint("H1", $timing_info);
    }
    $result = $qfh_ret[0];
    $feed_title = $qfh_ret[1];
    $feed_site_url = $qfh_ret[2];
    $last_error = $qfh_ret[3];
    $vgroup_last_feed = $vgr_last_feed;
    if ($feed == -2) {
        $feed_site_url = article_publish_url($link);
    }
    /// STOP //////////////////////////////////////////////////////////////////////////////////
    if (!$offset) {
        print "<div id=\"headlinesContainer\" {$rtl_tag}>";
        if (!$result) {
            print "<div align='center'>" . __("Could not display feed (query failed). Please check label match syntax or local configuration.") . "</div>";
            return;
        }
        print_headline_subtoolbar($link, $feed_site_url, $feed_title, $feed, $cat_view, $search, $match_on, $search_mode);
        print "<div id=\"headlinesInnerContainer\" onscroll=\"headlines_scroll_handler()\">";
    }
    $headlines_count = db_num_rows($result);
    if (db_num_rows($result) > 0) {
        #			print "\{$offset}";
        if (!get_pref($link, 'COMBINED_DISPLAY_MODE') && !$offset) {
            print "<table class=\"headlinesList\" id=\"headlinesList\" \n\t\t\t\t\tcellspacing=\"0\">";
        }
        $lnum = $limit * $offset;
        error_reporting(DEFAULT_ERROR_LEVEL);
        $num_unread = 0;
//.........这里部分代码省略.........
开发者ID:wangroot,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:functions.php

示例6: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $view_mode = false, $format = 'atom', $order = false, $orig_guid = false)
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 60;
     }
     $date_sort_field = "date_entered DESC, updated DESC";
     if ($feed == -2) {
         $date_sort_field = "last_published DESC";
     } else {
         if ($feed == -1) {
             $date_sort_field = "last_marked DESC";
         }
     }
     switch ($order) {
         case "title":
             $date_sort_field = "ttrss_entries.title";
             break;
         case "date_reverse":
             $date_sort_field = "date_entered, updated";
             break;
         case "feed_dates":
             $date_sort_field = "updated DESC";
             break;
     }
     $qfh_ret = queryFeedHeadlines($feed, 1, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     if ($this->dbh->num_rows($result) != 0) {
         $ts = strtotime($this->dbh->fetch_result($result, 0, "date_entered"));
         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) {
             header('HTTP/1.0 304 Not Modified');
             return;
         }
         $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT";
         header("Last-Modified: {$last_modified}", true);
     }
     $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id={$feed}&key=" . get_feed_access_key($feed, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     if ($format == 'atom') {
         $tpl = new MiniTemplator();
         $tpl->readTemplateFromFile("templates/generated_feed.txt");
         $tpl->setVariable('FEED_TITLE', $feed_title, true);
         $tpl->setVariable('VERSION', VERSION, true);
         $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
         if (PUBSUBHUBBUB_HUB && $feed == -2) {
             $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
             $tpl->addBlock('feed_hub');
         }
         $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
         $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
         while ($line = $this->dbh->fetch_assoc($result)) {
             foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
                 $line = $p->hook_query_headlines($line);
             }
             $tpl->setVariable('ARTICLE_ID', htmlspecialchars($orig_guid ? $line['link'] : get_self_url_prefix() . "/public.php?url=" . urlencode($line['link'])), true);
             $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
             $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true);
             $content = sanitize($line["content"], false, $owner_uid);
             if ($line['note']) {
                 $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
                 $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true);
             }
             $tpl->setVariable('ARTICLE_CONTENT', $content, true);
             $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
             $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true);
             $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title']), true);
             $tags = get_article_tags($line["id"], $owner_uid);
             foreach ($tags as $tag) {
                 $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
                 $tpl->addBlock('category');
             }
             $enclosures = get_article_enclosures($line["id"]);
             foreach ($enclosures as $e) {
                 $type = htmlspecialchars($e['content_type']);
                 $url = htmlspecialchars($e['content_url']);
                 $length = $e['duration'];
                 $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
                 $tpl->addBlock('enclosure');
             }
             $tpl->addBlock('entry');
         }
         $tmp = "";
         $tpl->addBlock('feed');
         $tpl->generateOutputToString($tmp);
         if (@(!$_REQUEST["noxml"])) {
             header("Content-Type: text/xml; charset=utf-8");
         } else {
//.........这里部分代码省略.........
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:101,代码来源:public.php

示例7: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $match_on, $view_mode = false, $format = 'atom')
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 100;
     }
     if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
         $date_sort_field = "updated";
     } else {
         $date_sort_field = "date_entered";
     }
     if ($feed == -2) {
         $date_sort_field = "last_read";
     }
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", $offset, $owner_uid, false, 0, false, true);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     if ($format == 'atom') {
         $tpl = new MiniTemplator();
         $tpl->readTemplateFromFile("templates/generated_feed.txt");
         $tpl->setVariable('FEED_TITLE', $feed_title, true);
         $tpl->setVariable('VERSION', VERSION, true);
         $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
         if (PUBSUBHUBBUB_HUB && $feed == -2) {
             $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
             $tpl->addBlock('feed_hub');
         }
         $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
         while ($line = db_fetch_assoc($result)) {
             $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
             $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
             $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
             $content = sanitize($this->link, $line["content_preview"], false, $owner_uid);
             if ($line['note']) {
                 $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
             }
             $tpl->setVariable('ARTICLE_CONTENT', $content, true);
             $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
             $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
             $tags = get_article_tags($this->link, $line["id"], $owner_uid);
             foreach ($tags as $tag) {
                 $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
                 $tpl->addBlock('category');
             }
             $enclosures = get_article_enclosures($this->link, $line["id"]);
             foreach ($enclosures as $e) {
                 $type = htmlspecialchars($e['content_type']);
                 $url = htmlspecialchars($e['content_url']);
                 $length = $e['duration'];
                 $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
                 $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
                 $tpl->addBlock('enclosure');
             }
             $tpl->addBlock('entry');
         }
         $tmp = "";
         $tpl->addBlock('feed');
         $tpl->generateOutputToString($tmp);
         if (@(!$_REQUEST["noxml"])) {
             header("Content-Type: text/xml; charset=utf-8");
         } else {
             header("Content-Type: text/plain; charset=utf-8");
         }
         print $tmp;
     } else {
         if ($format == 'json') {
             $feed = array();
             $feed['title'] = $feed_title;
             $feed['version'] = VERSION;
             $feed['feed_url'] = $feed_self_url;
             if (PUBSUBHUBBUB_HUB && $feed == -2) {
                 $feed['hub_url'] = PUBSUBHUBBUB_HUB;
             }
             $feed['self_url'] = get_self_url_prefix();
             $feed['articles'] = array();
             while ($line = db_fetch_assoc($result)) {
                 $article = array();
                 $article['id'] = $line['link'];
                 $article['link'] = $line['link'];
                 $article['title'] = $line['title'];
                 $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
                 $article['content'] = sanitize($this->link, $line["content_preview"], false, $owner_uid);
                 $article['updated'] = date('c', strtotime($line["updated"]));
                 if ($line['note']) {
                     $article['note'] = $line['note'];
                 }
                 if ($article['author']) {
                     $article['author'] = $line['author'];
                 }
                 $tags = get_article_tags($this->link, $line["id"], $owner_uid);
//.........这里部分代码省略.........
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:101,代码来源:public.php

示例8: api_get_headlines

 static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100, $check_first_id = false)
 {
     if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
         // Update the feed if required with some basic flood control
         $result = db_query("SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed_id}'");
         if (db_num_rows($result) != 0) {
             $last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));
             $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
             if (!$cache_images && time() - $last_updated > 120) {
                 include "rssfuncs.php";
                 update_rss_feed($feed_id, true, true);
             } else {
                 db_query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed_id}'");
             }
         }
     }
     /*$qfh_ret = queryFeedHeadlines($feed_id, $limit,
     		$view_mode, $is_cat, $search, false,
     		$order, $offset, 0, false, $since_id, $include_nested);*/
     //function queryFeedHeadlines($feed, $limit,
     // $view_mode, $cat_view, $search, $search_mode,
     // $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false,
     // $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
     $params = array("feed" => $feed_id, "limit" => $limit, "view_mode" => $view_mode, "cat_view" => $is_cat, "search" => $search, "override_order" => $order, "offset" => $offset, "since_id" => $since_id, "include_children" => $include_nested, "check_first_id" => $check_first_id, "api_request" => true);
     $qfh_ret = queryFeedHeadlines($params);
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $first_id = $qfh_ret[6];
     $headlines = array();
     $headlines_header = array('id' => $feed_id, 'first_id' => $first_id, 'is_cat' => $is_cat);
     if (!is_numeric($result)) {
         while ($line = db_fetch_assoc($result)) {
             $line["content_preview"] = truncate_string(strip_tags($line["content"]), $excerpt_length);
             foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
                 $line = $p->hook_query_headlines($line, $excerpt_length, true);
             }
             $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
             $tags = explode(",", $line["tag_cache"]);
             $label_cache = $line["label_cache"];
             $labels = false;
             if ($label_cache) {
                 $label_cache = json_decode($label_cache, true);
                 if ($label_cache) {
                     if ($label_cache["no-labels"] == 1) {
                         $labels = array();
                     } else {
                         $labels = $label_cache;
                     }
                 }
             }
             if (!is_array($labels)) {
                 $labels = get_article_labels($line["id"]);
             }
             //if (!$tags) $tags = get_article_tags($line["id"]);
             //if (!$labels) $labels = get_article_labels($line["id"]);
             $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags);
             if ($include_attachments) {
                 $headline_row['attachments'] = get_article_enclosures($line['id']);
             }
             if ($show_excerpt) {
                 $headline_row["excerpt"] = $line["content_preview"];
             }
             if ($show_content) {
                 if ($sanitize_content) {
                     $headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]);
                 } else {
                     $headline_row["content"] = $line["content"];
                 }
             }
             // unify label output to ease parsing
             if ($labels["no-labels"] == 1) {
                 $labels = array();
             }
             $headline_row["labels"] = $labels;
             $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
             $headline_row["comments_count"] = (int) $line["num_comments"];
             $headline_row["comments_link"] = $line["comments"];
             $headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]);
             $headline_row["author"] = $line["author"];
             $headline_row["score"] = (int) $line["score"];
             $headline_row["note"] = $line["note"];
             $headline_row["lang"] = $line["lang"];
             foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
                 $headline_row = $p->hook_render_article_api(array("headline" => $headline_row));
             }
             array_push($headlines, $headline_row);
         }
     } else {
         if (is_numeric($result) && $result == -1) {
             $headlines_header['first_id_changed'] = true;
         }
     }
     return array($headlines, $headlines_header);
 }
开发者ID:Verisor,项目名称:tt-rss,代码行数:94,代码来源:api.php

示例9: api_get_headlines

function api_get_headlines($link, $feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id)
{
    /* do not rely on params below */
    $search = db_escape_string($_REQUEST["search"]);
    $search_mode = db_escape_string($_REQUEST["search_mode"]);
    $match_on = db_escape_string($_REQUEST["match_on"]);
    $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, $order, $offset, 0, false, $since_id);
    $result = $qfh_ret[0];
    $feed_title = $qfh_ret[1];
    $headlines = array();
    while ($line = db_fetch_assoc($result)) {
        $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
        $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => get_article_tags($link, $line["id"]));
        if ($include_attachments) {
            $headline_row['attachments'] = get_article_enclosures($link, $line['id']);
        }
        if ($show_excerpt) {
            $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
            $headline_row["excerpt"] = $excerpt;
        }
        if ($show_content) {
            $headline_row["content"] = $line["content_preview"];
        }
        array_push($headlines, $headline_row);
    }
    return $headlines;
}
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:27,代码来源:functions.php

示例10: get_headlines

 function get_headlines($feed_id, $options)
 {
     $qfh_ret = queryFeedHeadlines(-4, $options['limit'], $this->get_unread(-1) > 0 ? "adaptive" : "all_articles", false, $options['search'], $options['search_mode'], $options['override_order'], $options['offset'], $options['owner_uid'], $options['filter'], $options['since_id'], $options['include_children'], false, "uuid != ''", "ttrss_feeds.title AS feed_title,");
     $qfh_ret[1] = __("Shared articles");
     return $qfh_ret;
 }
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:6,代码来源:init.php

示例11: render_headlines

function render_headlines($link)
{
    $feed = db_escape_string($_GET["id"]);
    $limit = db_escape_string($_GET["limit"]);
    $view_mode = db_escape_string($_GET["viewmode"]);
    $cat_view = db_escape_string($_GET["cat"]);
    $subop = $_GET["subop"];
    $catchup_op = $_GET["catchup_op"];
    if (!$view_mode) {
        if ($_SESSION["mobile:viewmode"]) {
            $view_mode = $_SESSION["mobile:viewmode"];
        } else {
            $view_mode = "adaptive";
        }
    }
    $_SESSION["mobile:viewmode"] = $view_mode;
    if (!$limit) {
        $limit = 30;
    }
    if (!$feed) {
        $feed = 0;
    }
    if (preg_match("/^-?[0-9][0-9]*\$/", $feed) != false) {
        $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds\n\t\t\t\tWHERE id = '{$feed}' AND owner_uid = " . $_SESSION["uid"]);
        if (db_num_rows($result) == 1) {
            $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
        } else {
            $rtl_content = false;
        }
        if ($rtl_content) {
            $rtl_tag = "dir=\"RTL\"";
        } else {
            $rtl_tag = "";
        }
    } else {
        $rtl_content = false;
        $rtl_tag = "";
    }
    print "<div id=\"headlines\" {$rtl_tag}>";
    if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
        update_generic_feed($link, $feed, $cat_view, true);
    }
    if ($subop == "MarkAllRead" || $catchup_op == "feed") {
        catchup_feed($link, $feed, $cat_view);
    }
    if ($catchup_op == "selection") {
        if (is_array($_GET["sel_ids"])) {
            $ids_to_mark = array_keys($_GET["sel_ids"]);
            if ($ids_to_mark) {
                foreach ($ids_to_mark as $id) {
                    db_query($link, "UPDATE ttrss_user_entries SET \n\t\t\t\t\t\t\tunread = false,last_read = NOW()\n\t\t\t\t\t\t\tWHERE ref_id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
                }
            }
        }
    }
    if ($subop == "MarkPageRead" || $catchup_op == "page") {
        $ids_to_mark = $_SESSION["last_page_ids.{$feed}"];
        if ($ids_to_mark) {
            foreach ($ids_to_mark as $id) {
                db_query($link, "UPDATE ttrss_user_entries SET \n\t\t\t\t\t\tunread = false,last_read = NOW()\n\t\t\t\t\t\tWHERE ref_id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
            }
        }
    }
    /// START /////////////////////////////////////////////////////////////////////////////////
    $search = db_escape_string($_GET["query"]);
    $search_mode = db_escape_string($_GET["search_mode"]);
    $match_on = db_escape_string($_GET["match_on"]);
    if (!$match_on) {
        $match_on = "both";
    }
    $real_offset = $offset * $limit;
    if ($_GET["debug"]) {
        $timing_info = print_checkpoint("H0", $timing_info);
    }
    $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, false, $real_offset);
    if ($_GET["debug"]) {
        $timing_info = print_checkpoint("H1", $timing_info);
    }
    $result = $qfh_ret[0];
    $feed_title = $qfh_ret[1];
    $feed_site_url = $qfh_ret[2];
    $last_error = $qfh_ret[3];
    /// STOP //////////////////////////////////////////////////////////////////////////////////
    if (!$result) {
        print "<div align='center'>" . __("Could not display feed (query failed). Please check label match syntax or local configuration.") . "</div>";
        return;
    }
    print "<div id=\"heading\">";
    #		if (!$cat_view && file_exists("../icons/$feed.ico") && filesize("../icons/$feed.ico") > 0) {
    #			print "<img class=\"feedIcon\" src=\"../icons/$feed.ico\">";
    #		}
    print "{$feed_title} <span id=\"headingAddon\">(";
    print "<a href=\"index.php\">" . __("Back") . "</a>, ";
    print "<a href=\"index.php?go=sform&aid={$feed}&ic={$cat_view}\">" . __("Search") . "</a>, ";
    print "<a href=\"index.php?go=vf&id={$feed}&subop=ForceUpdate\">" . __("Update") . "</a>";
    #		print "Mark as read: ";
    #		print "<a href=\"index.php?go=vf&id=$feed&subop=MarkAsRead\">Page</a>, ";
    #		print "<a href=\"index.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a>";
    print ")</span>";
    print "&nbsp;" . __('View:');
//.........这里部分代码省略.........
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:101,代码来源:functions.php

示例12: get_headlines

 function get_headlines($feed_id, $options)
 {
     $qfh_ret = queryFeedHeadlines(-4, $options['limit'], $options['view_mode'], $options['cat_view'], $options['search'], $options['search_mode'], $options['override_order'], $options['offset'], $options['owner_uid'], $options['filter'], $options['since_id'], $options['include_children']);
     $qfh_ret[1] = 'Dummy feed';
     return $qfh_ret;
 }
开发者ID:GregThib,项目名称:Tiny-Tiny-RSS-Attic,代码行数:6,代码来源:init.php

示例13: generate_syndicated_feed

 private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $search, $search_mode, $match_on, $view_mode = false)
 {
     require_once "lib/MiniTemplator.class.php";
     $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;";
     if (!$limit) {
         $limit = 30;
     }
     if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) {
         $date_sort_field = "updated";
     } else {
         $date_sort_field = "date_entered";
     }
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", 0, $owner_uid);
     $result = $qfh_ret[0];
     $feed_title = htmlspecialchars($qfh_ret[1]);
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid);
     if (!$feed_site_url) {
         $feed_site_url = get_self_url_prefix();
     }
     $tpl = new MiniTemplator();
     $tpl->readTemplateFromFile("templates/generated_feed.txt");
     $tpl->setVariable('FEED_TITLE', $feed_title, true);
     $tpl->setVariable('VERSION', VERSION, true);
     $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
     if (PUBSUBHUBBUB_HUB && $feed == -2) {
         $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
         $tpl->addBlock('feed_hub');
     }
     $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
     while ($line = db_fetch_assoc($result)) {
         $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
         $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
         $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
         $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
         $content = sanitize($this->link, $line["content_preview"], false, $owner_uid);
         if ($line['note']) {
             $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content;
         }
         $tpl->setVariable('ARTICLE_CONTENT', $content, true);
         $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true);
         $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true);
         $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
         $tags = get_article_tags($this->link, $line["id"], $owner_uid);
         foreach ($tags as $tag) {
             $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
             $tpl->addBlock('category');
         }
         $enclosures = get_article_enclosures($this->link, $line["id"]);
         foreach ($enclosures as $e) {
             $type = htmlspecialchars($e['content_type']);
             $url = htmlspecialchars($e['content_url']);
             $length = $e['duration'];
             $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
             $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
             $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
             $tpl->addBlock('enclosure');
         }
         $tpl->addBlock('entry');
     }
     $tmp = "";
     $tpl->addBlock('feed');
     $tpl->generateOutputToString($tmp);
     print $tmp;
 }
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:66,代码来源:public.php

示例14: db_escape_string

     break;
 case "getHeadlines":
     $feed_id = db_escape_string($_REQUEST["feed_id"]);
     $limit = (int) db_escape_string($_REQUEST["limit"]);
     $offset = (int) db_escape_string($_REQUEST["skip"]);
     $filter = db_escape_string($_REQUEST["filter"]);
     $is_cat = (bool) db_escape_string($_REQUEST["is_cat"]);
     $show_excerpt = (bool) db_escape_string($_REQUEST["show_excerpt"]);
     $show_content = (bool) db_escape_string($_REQUEST["show_content"]);
     /* all_articles, unread, adaptive, marked, updated */
     $view_mode = db_escape_string($_REQUEST["view_mode"]);
     /* do not rely on params below */
     $search = db_escape_string($_REQUEST["search"]);
     $search_mode = db_escape_string($_REQUEST["search_mode"]);
     $match_on = db_escape_string($_REQUEST["match_on"]);
     $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, false, $offset);
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $headlines = array();
     while ($line = db_fetch_assoc($result)) {
         $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
         $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "updated" => strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"]);
         if ($show_excerpt) {
             $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
             $headline_row["excerpt"] = $excerpt;
         }
         if ($show_content) {
             $headline_row["content"] = $line["content_preview"];
         }
         array_push($headlines, $headline_row);
     }
开发者ID:buggithubs,项目名称:Tiny-Tiny-RSS,代码行数:31,代码来源:index.php

示例15: api_get_headlines

 static function api_get_headlines($feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, $search = "", $search_mode = "", $include_nested = false, $sanitize_content = true)
 {
     $qfh_ret = queryFeedHeadlines($feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $order, $offset, 0, false, $since_id, $include_nested);
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $headlines = array();
     while ($line = db_fetch_assoc($result)) {
         $line["content_preview"] = truncate_string(strip_tags($line["content"]), 100);
         foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
             $line = $p->hook_query_headlines($line, 100, true);
         }
         $is_updated = $line["last_read"] == "" && ($line["unread"] != "t" && $line["unread"] != "1");
         $tags = explode(",", $line["tag_cache"]);
         $labels = json_decode($line["label_cache"], true);
         //if (!$tags) $tags = get_article_tags($line["id"]);
         //if (!$labels) $labels = get_article_labels($line["id"]);
         $headline_row = array("id" => (int) $line["id"], "unread" => sql_bool_to_bool($line["unread"]), "marked" => sql_bool_to_bool($line["marked"]), "published" => sql_bool_to_bool($line["published"]), "updated" => (int) strtotime($line["updated"]), "is_updated" => $is_updated, "title" => $line["title"], "link" => $line["link"], "feed_id" => $line["feed_id"], "tags" => $tags);
         if ($include_attachments) {
             $headline_row['attachments'] = get_article_enclosures($line['id']);
         }
         if ($show_excerpt) {
             $headline_row["excerpt"] = $line["content_preview"];
         }
         if ($show_content) {
             if ($sanitize_content) {
                 $headline_row["content"] = sanitize($line["content"], sql_bool_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]);
             } else {
                 $headline_row["content"] = $line["content"];
             }
         }
         // unify label output to ease parsing
         if ($labels["no-labels"] == 1) {
             $labels = array();
         }
         $headline_row["labels"] = $labels;
         $headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] : $feed_title;
         $headline_row["comments_count"] = (int) $line["num_comments"];
         $headline_row["comments_link"] = $line["comments"];
         $headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]);
         $headline_row["author"] = $line["author"];
         $headline_row["score"] = (int) $line["score"];
         $headline_row["note"] = $line["note"];
         $headline_row["lang"] = $line["lang"];
         foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
             $headline_row = $p->hook_render_article_api(array("headline" => $headline_row));
         }
         array_push($headlines, $headline_row);
     }
     return $headlines;
 }
开发者ID:fathorse,项目名称:Tiny-Tiny-RSS,代码行数:50,代码来源:api.php


注:本文中的queryFeedHeadlines函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。