• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP feed_to_label_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: renameLabel

 function renameLabel()
 {
     $caption = db_escape_string($_REQUEST["caption"]);
     $label_id = feed_to_label_id((int) db_escape_string($_REQUEST["label_id"]));
     if ($label_id != "" && $caption != "") {
         $this->dbh->query("UPDATE ttrss_labels2 SET caption = '{$caption}' WHERE id = '{$label_id}' AND owner_uid = " . $_SESSION["uid"]);
         return array(API::STATUS_OK);
     } else {
         return array(API::STATUS_ERR, array("error" => 'INCORRECT_USAGE'));
     }
 }
开发者ID:jangernert,项目名称:FeedReader,代码行数:11,代码来源:init.php


示例2: remove_feed

 static function remove_feed($id, $owner_uid)
 {
     if ($id > 0) {
         /* save starred articles in Archived feed */
         db_query("BEGIN");
         /* prepare feed if necessary */
         $result = db_query("SELECT feed_url FROM ttrss_feeds WHERE id = {$id}\n\t\t\t\tAND owner_uid = {$owner_uid}");
         $feed_url = db_escape_string(db_fetch_result($result, 0, "feed_url"));
         $result = db_query("SELECT id FROM ttrss_archived_feeds\n\t\t\t\tWHERE feed_url = '{$feed_url}' AND owner_uid = {$owner_uid}");
         if (db_num_rows($result) == 0) {
             $result = db_query("SELECT MAX(id) AS id FROM ttrss_archived_feeds");
             $new_feed_id = (int) db_fetch_result($result, 0, "id") + 1;
             db_query("INSERT INTO ttrss_archived_feeds\n\t\t\t\t\t(id, owner_uid, title, feed_url, site_url)\n\t\t\t\tSELECT {$new_feed_id}, owner_uid, title, feed_url, site_url from ttrss_feeds\n\t\t\t\tWHERE id = '{$id}'");
             $archive_id = $new_feed_id;
         } else {
             $archive_id = db_fetch_result($result, 0, "id");
         }
         db_query("UPDATE ttrss_user_entries SET feed_id = NULL,\n\t\t\t\torig_feed_id = '{$archive_id}' WHERE feed_id = '{$id}' AND\n\t\t\t\t\tmarked = true AND owner_uid = {$owner_uid}");
         /* Remove access key for the feed */
         db_query("DELETE FROM ttrss_access_keys WHERE\n\t\t\t\tfeed_id = '{$id}' AND owner_uid = {$owner_uid}");
         /* remove the feed */
         db_query("DELETE FROM ttrss_feeds\n\t\t\t\t\tWHERE id = '{$id}' AND owner_uid = {$owner_uid}");
         db_query("COMMIT");
         if (file_exists(ICONS_DIR . "/{$id}.ico")) {
             unlink(ICONS_DIR . "/{$id}.ico");
         }
         ccache_remove($id, $owner_uid);
     } else {
         label_remove(feed_to_label_id($id), $owner_uid);
         //ccache_remove($id, $owner_uid); don't think labels are cached
     }
 }
开发者ID:AHinMaine,项目名称:ttrss,代码行数:32,代码来源:feeds.php


示例3: setArticleLabel

 function setArticleLabel()
 {
     $article_ids = array_filter(explode(",", $this->dbh->escape_string($_REQUEST["article_ids"])), is_numeric);
     $label_id = (int) $this->dbh->escape_string($_REQUEST['label_id']);
     $assign = (bool) $this->dbh->escape_string($_REQUEST['assign']) == "true";
     $label = $this->dbh->escape_string(label_find_caption(feed_to_label_id($label_id), $_SESSION["uid"]));
     $num_updated = 0;
     if ($label) {
         foreach ($article_ids as $id) {
             if ($assign) {
                 label_add_article($id, $label, $_SESSION["uid"]);
             } else {
                 label_remove_article($id, $label, $_SESSION["uid"]);
             }
             ++$num_updated;
         }
     }
     $this->wrap(self::STATUS_OK, array("status" => "OK", "updated" => $num_updated));
 }
开发者ID:Verisor,项目名称:tt-rss,代码行数:19,代码来源:api.php


示例4: getFeedTitle

function getFeedTitle($id, $cat = false)
{
    if ($cat) {
        return getCategoryTitle($id);
    } else {
        if ($id == -1) {
            return __("Starred articles");
        } else {
            if ($id == -2) {
                return __("Published articles");
            } else {
                if ($id == -3) {
                    return __("Fresh articles");
                } else {
                    if ($id == -4) {
                        return __("All articles");
                    } else {
                        if ($id === 0 || $id === "0") {
                            return __("Archived articles");
                        } else {
                            if ($id == -6) {
                                return __("Recently read");
                            } else {
                                if ($id < LABEL_BASE_INDEX) {
                                    $label_id = feed_to_label_id($id);
                                    $result = db_query("SELECT caption FROM ttrss_labels2 WHERE id = '{$label_id}'");
                                    if (db_num_rows($result) == 1) {
                                        return db_fetch_result($result, 0, "caption");
                                    } else {
                                        return "Unknown label ({$label_id})";
                                    }
                                } else {
                                    if (is_numeric($id) && $id > 0) {
                                        $result = db_query("SELECT title FROM ttrss_feeds WHERE id = '{$id}'");
                                        if (db_num_rows($result) == 1) {
                                            return db_fetch_result($result, 0, "title");
                                        } else {
                                            return "Unknown feed ({$id})";
                                        }
                                    } else {
                                        return $id;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:nota-ja,项目名称:tt-rss,代码行数:51,代码来源:functions.php


示例5: view

 function view()
 {
     $timing_info = microtime(true);
     $reply = array();
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("0", $timing_info);
     }
     $feed = $this->dbh->escape_string($_REQUEST["feed"]);
     $method = $this->dbh->escape_string($_REQUEST["m"]);
     $view_mode = $this->dbh->escape_string($_REQUEST["view_mode"]);
     $limit = 30;
     @($cat_view = $_REQUEST["cat"] == "true");
     @($next_unread_feed = $this->dbh->escape_string($_REQUEST["nuf"]));
     @($offset = $this->dbh->escape_string($_REQUEST["skip"]));
     @($vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]));
     $order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
     if (is_numeric($feed)) {
         $feed = (int) $feed;
     }
     /* Feed -5 is a special case: it is used to display auxiliary information
      * when there's nothing to load - e.g. no stuff in fresh feed */
     if ($feed == -5) {
         print json_encode($this->generate_dashboard_feed());
         return;
     }
     $result = false;
     if ($feed < LABEL_BASE_INDEX) {
         $label_feed = feed_to_label_id($feed);
         $result = $this->dbh->query("SELECT id FROM ttrss_labels2 WHERE\n\t\t\t\t\t\t\tid = '{$label_feed}' AND owner_uid = " . $_SESSION['uid']);
     } else {
         if (!$cat_view && is_numeric($feed) && $feed > 0) {
             $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE\n\t\t\t\t\t\t\tid = '{$feed}' AND owner_uid = " . $_SESSION['uid']);
         } else {
             if ($cat_view && is_numeric($feed) && $feed > 0) {
                 $result = $this->dbh->query("SELECT id FROM ttrss_feed_categories WHERE\n\t\t\t\t\t\t\tid = '{$feed}' AND owner_uid = " . $_SESSION['uid']);
             }
         }
     }
     if ($result && $this->dbh->num_rows($result) == 0) {
         print json_encode($this->generate_error_feed(__("Feed not found.")));
         return;
     }
     /* Updating a label ccache means recalculating all of the caches
      * so for performance reasons we don't do that here */
     if ($feed >= 0) {
         ccache_update($feed, $_SESSION["uid"], $cat_view);
     }
     set_pref("_DEFAULT_VIEW_MODE", $view_mode);
     set_pref("_DEFAULT_VIEW_ORDER_BY", $order_by);
     /* bump login timestamp if needed */
     if (time() - $_SESSION["last_login_update"] > 3600) {
         $this->dbh->query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]);
         $_SESSION["last_login_update"] = time();
     }
     if (!$cat_view && is_numeric($feed) && $feed > 0) {
         $this->dbh->query("UPDATE ttrss_feeds SET last_viewed = NOW()\n\t\t\t\t\t\t\tWHERE id = '{$feed}' AND owner_uid = " . $_SESSION["uid"]);
     }
     $reply['headlines'] = array();
     if (!$next_unread_feed) {
         $reply['headlines']['id'] = $feed;
     } else {
         $reply['headlines']['id'] = $next_unread_feed;
     }
     $reply['headlines']['is_cat'] = (bool) $cat_view;
     $override_order = false;
     switch ($order_by) {
         case "title":
             $override_order = "ttrss_entries.title";
             break;
         case "date_reverse":
             $override_order = "score DESC, date_entered, updated";
             break;
         case "feed_dates":
             $override_order = "updated DESC";
             break;
     }
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("04", $timing_info);
     }
     $ret = $this->format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgroup_last_feed, $override_order, true);
     //$topmost_article_ids = $ret[0];
     $headlines_count = $ret[1];
     /* $returned_feed = $ret[2]; */
     $disable_cache = $ret[3];
     $vgroup_last_feed = $ret[4];
     $reply['headlines']['content'] =& $ret[5]['content'];
     $reply['headlines']['toolbar'] =& $ret[5]['toolbar'];
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("05", $timing_info);
     }
     $reply['headlines-info'] = array("count" => (int) $headlines_count, "vgroup_last_feed" => $vgroup_last_feed, "disable_cache" => (bool) $disable_cache);
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("30", $timing_info);
     }
     $reply['runtime-info'] = make_runtime_info();
     print json_encode($reply);
 }
开发者ID:zamentur,项目名称:ttrss_ynh,代码行数:97,代码来源:feeds.php


示例6: queryFeedHeadlines

 /**
  * Private function which executes the SQL query. Mapped on the same-named function in
  * the official TT-RSS API, removing un-needed parts.
  */
 function queryFeedHeadlines($feed, $limit, $view_mode, $offset = 0, $since_id = 0)
 {
     $owner_uid = $_SESSION["uid"];
     $ext_tables_part = "";
     $search_query_part = "";
     $filter_query_part = "";
     if ($since_id) {
         $since_id_part = "ttrss_entries.id > {$since_id} AND ";
     } else {
         $since_id_part = "";
     }
     $view_query_part = "";
     if ($view_mode == "adaptive") {
         if ($feed != -1) {
             $unread = getFeedUnread($feed, false);
             if ($unread > 0) {
                 $view_query_part = " unread = true AND ";
             }
         }
     } else {
         if ($view_mode == "marked") {
             $view_query_part = " marked = true AND ";
         } else {
             if ($view_mode == "has_note") {
                 $view_query_part = " (note IS NOT NULL AND note != '') AND ";
             } else {
                 if ($view_mode == "published") {
                     $view_query_part = " published = true AND ";
                 } else {
                     if ($view_mode == "unread" && $feed != -6) {
                         $view_query_part = " unread = true AND ";
                     }
                 }
             }
         }
     }
     if ($limit > 0) {
         $limit_query_part = "LIMIT " . $limit;
     }
     $allow_archived = false;
     // override query strategy and enable feed display when searching globally
     if (!is_numeric($feed)) {
         $query_strategy_part = "true";
     } else {
         if ($feed > 0) {
             $query_strategy_part = "feed_id = '{$feed}'";
         } else {
             if ($feed == 0) {
                 // archive virtual feed
                 $query_strategy_part = "feed_id IS NULL";
                 $allow_archived = true;
             } else {
                 if ($feed == -1) {
                     // starred virtual feed
                     $query_strategy_part = "marked = true";
                     $allow_archived = true;
                     $override_order = "last_marked DESC, date_entered DESC, updated DESC";
                 } else {
                     if ($feed == -2) {
                         // published virtual feed OR labels category
                         $query_strategy_part = "published = true";
                         $allow_archived = true;
                         $override_order = "last_published DESC, date_entered DESC, updated DESC";
                     } else {
                         if ($feed == -6) {
                             // recently read
                             $query_strategy_part = "unread = false AND last_read IS NOT NULL";
                             $allow_archived = true;
                             $override_order = "last_read DESC";
                         } else {
                             if ($feed == -3) {
                                 // fresh virtual feed
                                 $query_strategy_part = "unread = true AND score >= 0";
                                 $intl = get_pref("FRESH_ARTICLE_MAX_AGE", $owner_uid);
                                 if (DB_TYPE == "pgsql") {
                                     $query_strategy_part .= " AND date_entered > NOW() - INTERVAL '{$intl} hour' ";
                                 } else {
                                     $query_strategy_part .= " AND date_entered > DATE_SUB(NOW(), INTERVAL {$intl} HOUR) ";
                                 }
                             } else {
                                 if ($feed == -4) {
                                     // all articles virtual feed
                                     $allow_archived = true;
                                     $query_strategy_part = "true";
                                 } else {
                                     if ($feed <= LABEL_BASE_INDEX) {
                                         // labels
                                         $label_id = feed_to_label_id($feed);
                                         $query_strategy_part = "label_id = '{$label_id}' AND\n\t\t\t\tttrss_labels2.id = ttrss_user_labels2.label_id AND\n\t\t\t\tttrss_user_labels2.article_id = ref_id";
                                         $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
                                         $allow_archived = true;
                                     } else {
                                         $query_strategy_part = "true";
                                     }
                                 }
                             }
//.........这里部分代码省略.........
开发者ID:jacobtaj,项目名称:tt-rss-newsplus-plugin,代码行数:101,代码来源:init.php


示例7: queryFeedHeadlines


//.........这里部分代码省略.........
                                } else {
                                    if ($feed == -6) {
                                        // recently read
                                        $query_strategy_part = "unread = false AND last_read IS NOT NULL";
                                        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                        $allow_archived = true;
                                        if (!$override_order) {
                                            $override_order = "last_read DESC";
                                        }
                                        /*			} else if ($feed == -7) { // shared
                                        				$query_strategy_part = "uuid != ''";
                                        				$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                        				$allow_archived = true; */
                                    } else {
                                        if ($feed == -3) {
                                            // fresh virtual feed
                                            $query_strategy_part = "unread = true AND score >= 0";
                                            $intl = get_pref("FRESH_ARTICLE_MAX_AGE", $owner_uid);
                                            if (DB_TYPE == "pgsql") {
                                                $query_strategy_part .= " AND date_entered > NOW() - INTERVAL '{$intl} hour' ";
                                            } else {
                                                $query_strategy_part .= " AND date_entered > DATE_SUB(NOW(), INTERVAL {$intl} HOUR) ";
                                            }
                                            $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                        } else {
                                            if ($feed == -4) {
                                                // all articles virtual feed
                                                $allow_archived = true;
                                                $query_strategy_part = "true";
                                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                            } else {
                                                if ($feed <= LABEL_BASE_INDEX) {
                                                    // labels
                                                    $label_id = feed_to_label_id($feed);
                                                    $query_strategy_part = "label_id = '{$label_id}' AND\n\t\t\t\t\tttrss_labels2.id = ttrss_user_labels2.label_id AND\n\t\t\t\t\tttrss_user_labels2.article_id = ref_id";
                                                    $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                                    $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
                                                    $allow_archived = true;
                                                } else {
                                                    $query_strategy_part = "true";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $order_by = "score DESC, date_entered DESC, updated DESC";
    if ($view_mode == "unread_first") {
        $order_by = "unread DESC, {$order_by}";
    }
    if ($override_order) {
        $order_by = $override_order;
    }
    if ($override_strategy) {
        $query_strategy_part = $override_strategy;
    }
    if ($override_vfeed) {
        $vfeed_query_part = $override_vfeed;
    }
    $feed_title = "";
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:67,代码来源:functions.php


示例8: queryFeedHeadlines


//.........这里部分代码省略.........
                                // recently read
                                $query_strategy_part = "unread = false AND last_read IS NOT NULL";
                                if (DB_TYPE == "pgsql") {
                                    $query_strategy_part .= " AND date_entered > NOW() - INTERVAL '1 DAY' ";
                                } else {
                                    $query_strategy_part .= " AND date_entered > DATE_SUB(NOW(), INTERVAL 1 DAY) ";
                                }
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                $allow_archived = true;
                                $ignore_vfeed_group = true;
                                if (!$override_order) {
                                    $override_order = "last_read DESC";
                                }
                            } else {
                                if ($feed == -3) {
                                    // fresh virtual feed
                                    $query_strategy_part = "unread = true AND score >= 0";
                                    $intl = get_pref("FRESH_ARTICLE_MAX_AGE", $owner_uid);
                                    if (DB_TYPE == "pgsql") {
                                        $query_strategy_part .= " AND date_entered > NOW() - INTERVAL '{$intl} hour' ";
                                    } else {
                                        $query_strategy_part .= " AND date_entered > DATE_SUB(NOW(), INTERVAL {$intl} HOUR) ";
                                    }
                                    $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                } else {
                                    if ($feed == -4) {
                                        // all articles virtual feed
                                        $allow_archived = true;
                                        $query_strategy_part = "true";
                                        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                    } else {
                                        if ($feed <= LABEL_BASE_INDEX) {
                                            // labels
                                            $label_id = feed_to_label_id($feed);
                                            $query_strategy_part = "label_id = '{$label_id}' AND\n\t\t\t\t\tttrss_labels2.id = ttrss_user_labels2.label_id AND\n\t\t\t\t\tttrss_user_labels2.article_id = ref_id";
                                            $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                                            $ext_tables_part = "ttrss_labels2,ttrss_user_labels2,";
                                            $allow_archived = true;
                                        } else {
                                            $query_strategy_part = "true";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $order_by = "score DESC, date_entered DESC, updated DESC";
    if ($override_order) {
        $order_by = $override_order;
    }
    if ($override_strategy) {
        $query_strategy_part = $override_strategy;
    }
    if ($override_vfeed) {
        $vfeed_query_part = $override_vfeed;
    }
    $feed_title = "";
    if ($search) {
        $feed_title = T_sprintf("Search results: %s", $search);
    } else {
        if ($cat_view) {
            $feed_title = getCategoryTitle($feed);
开发者ID:Verisor,项目名称:tt-rss,代码行数:67,代码来源:functions2.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP feedback函数代码示例发布时间:2022-05-15
下一篇:
PHP feed_publish函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap