Exemple #1
0
 /**
  * Constructor
  * @praam int $category_id
  */
 public function __construct($category_id = false, $recurse = true)
 {
     parent::__construct();
     if (filter_var($category_id, FILTER_VALIDATE_INT)) {
         $this->id = $category_id;
     } else {
         $this->id = self::getIdFromSlug($category_id);
     }
     if (filter_var($this->id, FILTER_VALIDATE_INT)) {
         $this->mckey = sprintf("railpage.links.category=%d", $this->id);
         if (!($row = $this->Memcached->fetch($this->mckey))) {
             $row = $this->db->fetchRow("SELECT * FROM nuke_links_categories WHERE cid = ?", $this->id);
             if (!empty($row)) {
                 $this->Memcached->save($this->mckey, $row);
             }
         }
         $this->name = $row['title'];
         $this->desc = $row['cdescription'];
         $this->parent_id = $row['parentid'];
         $this->slug = $row['slug'];
         $this->url = $this->makePermalink($this->id);
         if ($this->parent_id > 0 && $recurse) {
             $this->parent = new Category($this->parent_id);
         }
     }
 }
Exemple #2
0
 /**
  * Constructor
  * @since Version 3.7.5
  * @var int $link_id
  */
 public function __construct($link_id = false)
 {
     parent::__construct();
     if ($link_id) {
         $this->id = $link_id;
         $this->fetch();
     }
 }