mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 13:36:22 +05:30
Cleaning up
This commit is contained in:
parent
416ce7e270
commit
5804cbcdd7
7 changed files with 28 additions and 28 deletions
|
|
@ -1325,16 +1325,16 @@ function get_keyword($keyword, $page, $perpage)
|
|||
|
||||
foreach ($posts as $index => $v) {
|
||||
|
||||
$filepath = $v['dirname'] . '/' . $v['basename'];
|
||||
$filepath = $v['dirname'] . '/' . $v['basename'];
|
||||
|
||||
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
|
||||
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
|
||||
|
||||
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
|
||||
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
|
||||
|
||||
$lines = file($filepath);
|
||||
$lines = file($filepath);
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match ($findRx, $line)) {
|
||||
if (preg_match ($findRx, $line)) {
|
||||
if (!in_array($v, $tmp)) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
|
|
@ -1519,21 +1519,21 @@ function keyword_count($keyword)
|
|||
|
||||
foreach ($posts as $index => $v) {
|
||||
|
||||
$filepath = $v['dirname'] . '/' . $v['basename'];
|
||||
$filepath = $v['dirname'] . '/' . $v['basename'];
|
||||
|
||||
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
|
||||
$findRxWhole = '\b' . preg_quote($keyword, '~') . '\b'; // Add word boundaries (find whole-words only)
|
||||
|
||||
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
|
||||
$findRx = "~{$findRxWhole}~iu"; // Case-insensitive and UTF-8 mode
|
||||
|
||||
$lines = file($filepath);
|
||||
$lines = file($filepath);
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match ($findRx, $line)) {
|
||||
if (!in_array($v, $tmp)) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match ($findRx, $line)) {
|
||||
if (!in_array($v, $tmp)) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = array_unique($tmp, SORT_REGULAR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue