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


PHP PluginHost::pfeed_to_feed_id方法代码示例

本文整理汇总了PHP中PluginHost::pfeed_to_feed_id方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginHost::pfeed_to_feed_id方法的具体用法?PHP PluginHost::pfeed_to_feed_id怎么用?PHP PluginHost::pfeed_to_feed_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginHost的用法示例。


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

示例1: makefeedtree

 function makefeedtree()
 {
     if ($_REQUEST['mode'] != 2) {
         $search = $_SESSION["prefs_feed_search"];
     } else {
         $search = "";
     }
     if ($search) {
         $search_qpart = " AND LOWER(title) LIKE LOWER('%{$search}%')";
     }
     $root = array();
     $root['id'] = 'root';
     $root['name'] = __('Feeds');
     $root['items'] = array();
     $root['type'] = 'category';
     $enable_cats = get_pref('ENABLE_FEED_CATS');
     if ($_REQUEST['mode'] == 2) {
         if ($enable_cats) {
             $cat = $this->feedlist_init_cat(-1);
         } else {
             $cat['items'] = array();
         }
         foreach (array(-4, -3, -1, -2, 0, -6) as $i) {
             array_push($cat['items'], $this->feedlist_init_feed($i));
         }
         /* Plugin feeds for -1 */
         $feeds = PluginHost::getInstance()->get_feeds(-1);
         if ($feeds) {
             foreach ($feeds as $feed) {
                 $feed_id = PluginHost::pfeed_to_feed_id($feed['id']);
                 $item = array();
                 $item['id'] = 'FEED:' . $feed_id;
                 $item['bare_id'] = (int) $feed_id;
                 $item['auxcounter'] = 0;
                 $item['name'] = $feed['title'];
                 $item['checkbox'] = false;
                 $item['error'] = '';
                 $item['icon'] = $feed['icon'];
                 $item['param'] = '';
                 $item['unread'] = 0;
                 //$feed['sender']->get_unread($feed['id']);
                 $item['type'] = 'feed';
                 array_push($cat['items'], $item);
             }
         }
         if ($enable_cats) {
             array_push($root['items'], $cat);
         } else {
             $root['items'] = array_merge($root['items'], $cat['items']);
         }
         $result = $this->dbh->query("SELECT * FROM\n\t\t\t\tttrss_labels2 WHERE owner_uid = " . $_SESSION['uid'] . " ORDER by caption");
         if ($this->dbh->num_rows($result) > 0) {
             if (get_pref('ENABLE_FEED_CATS')) {
                 $cat = $this->feedlist_init_cat(-2);
             } else {
                 $cat['items'] = array();
             }
             while ($line = $this->dbh->fetch_assoc($result)) {
                 $label_id = label_to_feed_id($line['id']);
                 $feed = $this->feedlist_init_feed($label_id, false, 0);
                 $feed['fg_color'] = $line['fg_color'];
                 $feed['bg_color'] = $line['bg_color'];
                 array_push($cat['items'], $feed);
             }
             if ($enable_cats) {
                 array_push($root['items'], $cat);
             } else {
                 $root['items'] = array_merge($root['items'], $cat['items']);
             }
         }
     }
     if ($enable_cats) {
         $show_empty_cats = $_REQUEST['force_show_empty'] || $_REQUEST['mode'] != 2 && !$search;
         $result = $this->dbh->query("SELECT id, title FROM ttrss_feed_categories\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
         while ($line = $this->dbh->fetch_assoc($result)) {
             $cat = array();
             $cat['id'] = 'CAT:' . $line['id'];
             $cat['bare_id'] = (int) $line['id'];
             $cat['auxcounter'] = 0;
             $cat['name'] = $line['title'];
             $cat['items'] = array();
             $cat['checkbox'] = false;
             $cat['type'] = 'category';
             $cat['unread'] = 0;
             $cat['child_unread'] = 0;
             $cat['items'] = $this->get_category_items($line['id']);
             $num_children = $this->calculate_children_count($cat);
             $cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', $num_children), $num_children);
             if ($num_children > 0 || $show_empty_cats) {
                 array_push($root['items'], $cat);
             }
             $root['param'] += count($cat['items']);
         }
         /* Uncategorized is a special case */
         $cat = array();
         $cat['id'] = 'CAT:0';
         $cat['bare_id'] = 0;
         $cat['auxcounter'] = 0;
         $cat['name'] = __("Uncategorized");
         $cat['items'] = array();
//.........这里部分代码省略.........
开发者ID:AHinMaine,项目名称:ttrss,代码行数:101,代码来源:feeds.php

示例2: getVirtCounters

function getVirtCounters()
{
    $ret_arr = array();
    for ($i = 0; $i >= -4; $i--) {
        $count = getFeedUnread($i);
        if ($i == 0 || $i == -1 || $i == -2) {
            $auxctr = getFeedArticles($i, false);
        } else {
            $auxctr = 0;
        }
        $cv = array("id" => $i, "counter" => (int) $count, "auxcounter" => $auxctr);
        //			if (get_pref('EXTENDED_FEEDLIST'))
        //				$cv["xmsg"] = getFeedArticles($i)." ".__("total");
        array_push($ret_arr, $cv);
    }
    $feeds = PluginHost::getInstance()->get_feeds(-1);
    if (is_array($feeds)) {
        foreach ($feeds as $feed) {
            $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), "counter" => $feed['sender']->get_unread($feed['id']));
            if (method_exists($feed['sender'], 'get_total')) {
                $cv["auxcounter"] = $feed['sender']->get_total($feed['id']);
            }
            array_push($ret_arr, $cv);
        }
    }
    return $ret_arr;
}
开发者ID:nota-ja,项目名称:tt-rss,代码行数:27,代码来源:functions.php


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