mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 11:36:20 +05:30
Update functions.php
This commit is contained in:
parent
a473482da8
commit
a18d234bc2
1 changed files with 21 additions and 6 deletions
|
|
@ -3483,11 +3483,26 @@ function generate_json($posts)
|
|||
// TRUE if the current page is an index page like frontpage, tag index, archive index and search index.
|
||||
function is_index()
|
||||
{
|
||||
$req = $_SERVER['REQUEST_URI'];
|
||||
if (stripos($req, '/category/') !== false || stripos($req, '/archive/') !== false || stripos($req, '/tag/') !== false || stripos($req, '/search/') !== false || stripos($req, '/type/') !== false || stripos($req, '/' . blog_path()) !== false || $req == site_path() . '/' || stripos($req, site_path() . '/?page') !== false) {
|
||||
return true;
|
||||
if (blog_path() == permalink_type()) {
|
||||
$req = rtrim(strtok($_SERVER["REQUEST_URI"], '?'), '/') . '/';
|
||||
$in = explode('/' . blog_path(), $req);
|
||||
if (isset($in[1])) {
|
||||
if ($in[1] == '/') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (stripos($req, '/category/') !== false || stripos($req, '/archive/') !== false || stripos($req, '/tag/') !== false || stripos($req, '/search/') !== false || stripos($req, '/type/') !== false || $req == site_path() . '/') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
$req = strtok($_SERVER["REQUEST_URI"], '?');
|
||||
if (stripos($req, '/category/') !== false || stripos($req, '/archive/') !== false || stripos($req, '/tag/') !== false || stripos($req, '/search/') !== false || stripos($req, '/type/') !== false || stripos($req, '/' . blog_path()) !== false || $req == site_path() . '/') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3496,7 +3511,7 @@ function permalink_type()
|
|||
{
|
||||
$permalink = config('permalink.type');
|
||||
if (!is_null($permalink) && !empty($permalink)) {
|
||||
return strtolower($permalink);
|
||||
return strtolower(str_replace('/', '', $permalink));
|
||||
}
|
||||
return 'default';
|
||||
}
|
||||
|
|
@ -3506,7 +3521,7 @@ function blog_path()
|
|||
{
|
||||
$path = config('blog.path');
|
||||
if (!is_null($path) && !empty($path)) {
|
||||
return $path;
|
||||
return strtolower(str_replace('/', '', $path));
|
||||
}
|
||||
return 'blog';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue