public static function getUrl($article) { return URLSITE . 'post/' . $article->getCategory() . '/' . sha1(serialize($article)) . '/' . Inflector::slugify($article->getTitle()); }
private function _getAllNavItems($dir, $i = 0, $url = "") { $nav = []; $l = $i + 1; foreach (glob($dir . "/*") as $file) { if (is_dir($file)) { $item = []; $item["name"] = basename($file); $item["level"] = $l; $item["position"] = false; $nameParts = explode(". ", $item["name"], 2); if (count($nameParts) > 1 && is_numeric($nameParts[0])) { $item["name"] = trim($nameParts[1]); $item["position"] = (int) $nameParts[0] - 1; } $item["file"] = $file . "/index.md.php"; $item["uri"] = \Inflector::slugify($item["name"]); $thisURL = $url . "/" . $item["uri"]; $item["href"] = $thisURL; $current = "/" . implode("/", $this->path); $item["active"] = strpos($current, $item["href"]) === 0 ? true : false; if ($item["active"] && $l == 1) { $item["data"] = $this->_getFileDate($item["file"]); $this->first = $item; } $item["current"] = $current === $item["href"] ? true : false; $item["children"] = $this->_getAllNavItems($file, $l, $thisURL); $item["data"] = $this->_getFileDate($item["file"]); $nav[] = $item; if ($item["current"]) { $this->current = $item; } if ($item["active"] && $l == 2) { $this->section = $item; } } } return $nav; }