Classes

File content/feed/FeedsCat.class.php

File content/feed/FeedsCat.class.php

 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 
<?php
/**
 * Describes a feed by building a category tree
 * @package     Content
 * @subpackage  Feed
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Loic ROUCHON <horn@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2014 12 22
 * @since       PHPBoost 3.0 - 2009 02 25
*/

class FeedsCat
{
    private $id = 0;
    private $cat_name = '';
    private $module_id = '';
    private $children = array();

    /**
     * Builds a FeedsCat Object
     * @param string $module_id the feed module id
     * @param int $category_id the category id
     * @param string $category_name the category name
     */
    public function __construct($module_id, $category_id, $category_name)
    {
        $this->id = $category_id;
        $this->module_id = $module_id;
        $this->cat_name = $category_name;
    }

    /**
     * Returns the feed url
     * @param string $feed_type The feed type
     * @return string the feed url
     */
    public function get_url($feed_type = '')
    {
        $url = DispatchManager::get_url('/syndication', '/rss/' . $this->module_id . '/' . $this->id . '/' . $feed_type . '/');
        return $url->relative();
    }

    /**
     * Returns the module id
     * @return string the module id
     */
    public function get_module_id()
    {
        return $this->module_id;
    }


    /**
     * Returns the category id
     * @return int the category id
     */
    public function get_category_id()
    {
        return $this->id;
    }

    /**
     * Returns the category name
     * @return string the category name
     */
    public function get_category_name()
    {
        return $this->cat_name;
    }

    /**
     * Adds a FeedsCat child to the current FeedsCat object
     * @param FeedsCat $child The element to add
     */
    public function add_child($child)
    {
        $this->children[] = $child;
    }

    /**
     * Returns the current category children
     * @return FeedsCat[] The current category children
     */
    public function get_children()
    {
        return $this->children;
    }
}
?>
Annonces