public function get_feeds_list()
 {
     global $LANG;
     require_once PATH_TO_ROOT . '/wiki/wiki_functions.php';
     $cats_tree = new FeedsCat('wiki', 0, $LANG['root']);
     $categories = WikiCategoriesCache::load()->get_categories();
     build_wiki_cat_children($cats_tree, array_values($categories));
     $feeds = new FeedsList();
     $feeds->add_feed($cats_tree, Feed::DEFAULT_FEED_NAME);
     return $feeds;
 }
示例#2
0
function build_wiki_cat_children($cats_tree, $cats, $id_parent = 0)
{
    if (!empty($cats)) {
        $i = 0;
        $nb_cats = count($cats);
        $children = array();
        while ($i <= $nb_cats) {
            if (isset($cats[$i]) && $cats[$i]['id_parent'] == $id_parent) {
                $id = $cats[$i]['id'];
                $feeds_cat = new FeedsCat('wiki', $id, stripslashes($cats[$i]['title']));
                // Decrease the complexity
                unset($cats[$i]);
                $cats = array_merge($cats);
                // re-index the array
                $nb_cats = count($cats);
                build_wiki_cat_children($feeds_cat, $cats, $id);
                $cats_tree->add_child($feeds_cat);
            } else {
                $i++;
            }
        }
    }
}