mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 21:46:22 +05:30
Fix username posts count
If username has underscore
This commit is contained in:
parent
7e0ac03d95
commit
29c65d9659
2 changed files with 12 additions and 6 deletions
|
|
@ -894,7 +894,7 @@ get('/admin/mine', function () {
|
|||
|
||||
$posts = get_profile_posts($name, $page, $perpage);
|
||||
|
||||
$total = get_count($name, 'dirname');
|
||||
$total = get_count('/'.$name.'/', 'dirname');
|
||||
|
||||
$author = get_author($name);
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ function get_posts($posts, $page = 1, $perpage = 0)
|
|||
} else {
|
||||
$post->url = site_url() . date('Y/m', $post->date) . '/' . str_replace('.md', '', $arr[2]);
|
||||
}
|
||||
|
||||
|
||||
$post->slug = str_replace('.md', '', $arr[2]);
|
||||
|
||||
$post->file = $filepath;
|
||||
|
|
@ -1321,10 +1321,16 @@ function get_count($var, $str)
|
|||
$tmp = array();
|
||||
|
||||
foreach ($posts as $index => $v) {
|
||||
$arr = explode('_', $v[$str]);
|
||||
$url = $arr[0];
|
||||
if (stripos($url, "$var") !== false) {
|
||||
$tmp[] = $v;
|
||||
if ($str === 'basename') {
|
||||
$arr = explode('_', $v[$str]);
|
||||
$url = $arr[0];
|
||||
if (stripos($url, "$var") !== false) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
} else {
|
||||
if (stripos($v[$str], $var) !== false) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue