Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
josark2005 committed Sep 11, 2019
1 parent db27d67 commit 8377fc9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .own_navi.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


# 名称
TITLE="子目录显示名称"
TITLE=NO

# 标记 hot vip new recommend
MARK=new
Expand Down
14 changes: 12 additions & 2 deletions nav.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// 版本信息
const NAV_VERSION = '1.2.0';
const NAV_VERSION = '1.2.1';

// 配置文件最低兼容版本
const NAV_CONF_VERSION_OLDEST = 1;
Expand Down Expand Up @@ -88,6 +88,13 @@
$dirs = getConf($dirs);
}

// 清理导航列表
foreach ($dirs as $group => $dir) {
if (count($dirs[$group]) <= 0) {
unset($dirs[$group]);
}
}

/**
* 获取文件
* @param string $filename
Expand Down Expand Up @@ -142,6 +149,9 @@ function getConf(array $dirs) : array {
unset($dirs[c('NAV_DEFAULT_GROUP', '默认分组')][$dir]);
}
foreach ($confs as $key => $value) {
if ($key === 'TITLE' && $value === '') {
$value = $dir;
}
$dirs[$cur_group][$dir][strtolower($key)] = $value;
}
}
Expand Down Expand Up @@ -183,7 +193,7 @@ function c(string $key, $default = false) {
if (isset($GLOBALS['config'][$key])) {
return $GLOBALS['config'][$key];
}else{
return defined($key) ? constant($key) : false;
return defined($key) ? constant($key) : $default;
}
}

Expand Down

0 comments on commit 8377fc9

Please sign in to comment.