|
|
@ -562,9 +562,20 @@ Class DirScanner { |
|
|
|
if (empty($this->scanResults[$id])) {return [];} |
|
|
|
if (empty($this->scanResults[$id])) {return [];} |
|
|
|
$file = $this->scanResults[$id]; |
|
|
|
$file = $this->scanResults[$id]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$content = @file_get_contents($file['realpath']); |
|
|
|
|
|
|
|
if (empty($content)) {return [];} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# standardize line breaks |
|
|
|
|
|
|
|
$content = str_replace(array("\r\n", "\r"), "\n", $content); |
|
|
|
|
|
|
|
# remove surrounding line breaks |
|
|
|
|
|
|
|
$content = trim($content, "\n"); |
|
|
|
|
|
|
|
# split text into lines |
|
|
|
|
|
|
|
$lines = explode("\n", $content); |
|
|
|
|
|
|
|
|
|
|
|
$titles = []; |
|
|
|
$titles = []; |
|
|
|
$content = file_get_contents($file['realpath']); |
|
|
|
if (!empty($lines)) { |
|
|
|
preg_match_all('/#(.+)/u', $content, $matches); |
|
|
|
foreach($lines as $line) { |
|
|
|
|
|
|
|
preg_match_all('/^#(.+)/u', $line, $matches); |
|
|
|
if (!empty($matches[1])) { |
|
|
|
if (!empty($matches[1])) { |
|
|
|
foreach($matches[1] as $title) { |
|
|
|
foreach($matches[1] as $title) { |
|
|
|
$num = substr_count($title, '#'); |
|
|
|
$num = substr_count($title, '#'); |
|
|
@ -574,6 +585,8 @@ Class DirScanner { |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $titles; |
|
|
|
return $titles; |
|
|
|
} |
|
|
|
} |
|
|
|