/** * Возвращает сгенерированный URI * @return array */ public static function getPath() { if (self::$aPath === false) { self::$aPath = explode("/", substr($_SERVER['REQUEST_URI'], defined('URL_PREFIX') ? strlen(URL_PREFIX) : 1)); if (self::$aPath[0] == 'admin') { self::$isAdmin = true; array_shift(self::$aPath); } if (count(self::$aPath)) { $lastChunk = explode("?", self::$aPath[count(self::$aPath) - 1]); self::$aPath[count(self::$aPath) - 1] = $lastChunk[0]; for ($i = 0, $pathCount = count(self::$aPath); $i < $pathCount; $i++) { preg_match("/^page([0-9]+)\$/", self::$aPath[$i], $matches); if (count($matches) > 0 && (int) $matches[1] > 0) { MySQL::setPage((int) $matches[1]); unset(self::$aPath[$i]); break; } } } if (count(self::$aPath) && self::$aPath[count(self::$aPath) - 1] == '') { array_pop(self::$aPath); } } //var_dump(self::$aPath); exit; return self::$aPath; }