Browse Source

improve function getScanningLevel

master
filesite 3 years ago
parent
commit
8e58662b05
  1. 12
      lib/DirScanner.php
  2. 2
      themes/googleimage/views/site/index.php

12
lib/DirScanner.php

@ -200,14 +200,16 @@ Class DirScanner { @@ -200,14 +200,16 @@ Class DirScanner {
}
//根据路径和根目录获取当前扫描的目录深度
private function getScanningLevel($rootDir, $dirname) {
private function getScanningLevel($rootDir, $dir) {
$level = 0;
if ($dirname == $rootDir) {
$rootDir = realpath($rootDir);
$dir = realpath($dir);
if ($dir == $rootDir) {
$level = 1;
}else {
$dirname = preg_replace('/\/$/', '', $dirname);
$dirs = explode('/', str_replace($rootDir, '', $dirname));
$dirs = explode('/', str_replace($rootDir, '', $dir));
$level = count($dirs);
}
@ -467,7 +469,7 @@ Class DirScanner { @@ -467,7 +469,7 @@ Class DirScanner {
if (empty($this->rootDir)) {
$this->rootDir = realpath($dir);
}
$this->scanningDirLevel = $this->getScanningLevel($this->rootDir, realpath($dir));
$this->scanningDirLevel = $this->getScanningLevel($this->rootDir, $dir);
$nextLevels = $levels - $this->scanningDirLevel;
$files = scandir($dir);

2
themes/googleimage/views/site/index.php

@ -20,7 +20,7 @@ eof; @@ -20,7 +20,7 @@ eof;
<div class="modal-mask" id="modal_about">
<div class="modal-about">
<div class="modal-head">
<h3>皮肤GoogleImage</h3>
<h3>关于GoogleImage</h3>
<span class="btn-close" role="button"><svg width="24" height="24" viewBox="0 0 24 24" focusable="false" class=" NMm5M"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"></path></svg></span>
</div>
<div class="hr"></div>

Loading…
Cancel
Save