mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 11:36:20 +05:30
Cleanup
This commit is contained in:
parent
d0283113a3
commit
80b2eefba1
2 changed files with 20 additions and 36 deletions
|
|
@ -2836,30 +2836,14 @@ get('/:static', function ($static) {
|
|||
header("Location: $url");
|
||||
}
|
||||
|
||||
if ($static === 'sitemap.xml' || $static === 'sitemap.base.xml' || $static === 'sitemap.post.xml' || $static === 'sitemap.static.xml' || $static === 'sitemap.tag.xml' || $static === 'sitemap.archive.xml' || $static === 'sitemap.author.xml' || $static === 'sitemap.category.xml' || $static === 'sitemap.type.xml') {
|
||||
|
||||
header('Content-Type: text/xml');
|
||||
|
||||
if (strpos($static, ".xml") !== false) {
|
||||
if ($static === 'sitemap.xml') {
|
||||
generate_sitemap('index');
|
||||
} elseif ($static === 'sitemap.base.xml') {
|
||||
generate_sitemap('base');
|
||||
} elseif ($static === 'sitemap.post.xml') {
|
||||
generate_sitemap('post');
|
||||
} elseif ($static === 'sitemap.static.xml') {
|
||||
generate_sitemap('static');
|
||||
} elseif ($static === 'sitemap.tag.xml') {
|
||||
generate_sitemap('tag');
|
||||
} elseif ($static === 'sitemap.archive.xml') {
|
||||
generate_sitemap('archive');
|
||||
} elseif ($static === 'sitemap.author.xml') {
|
||||
generate_sitemap('author');
|
||||
} elseif ($static === 'sitemap.category.xml') {
|
||||
generate_sitemap('category');
|
||||
} elseif ($static === 'sitemap.type.xml') {
|
||||
generate_sitemap('type');
|
||||
$sitemap = 'index.xml';
|
||||
} else {
|
||||
$sitemap = str_replace('sitemap.', '', $static);
|
||||
}
|
||||
|
||||
header('Content-Type: text/xml');
|
||||
generate_sitemap($sitemap);
|
||||
die;
|
||||
} elseif ($static === 'admin') {
|
||||
if (login()) {
|
||||
|
|
@ -2981,7 +2965,11 @@ get('/:static', function ($static) {
|
|||
}
|
||||
|
||||
$post = find_page($static);
|
||||
|
||||
|
||||
if (!$post) {
|
||||
not_found();
|
||||
}
|
||||
|
||||
if (array_key_exists('prev', $post)) {
|
||||
$prev = $post['prev'];
|
||||
} else {
|
||||
|
|
@ -2994,10 +2982,6 @@ get('/:static', function ($static) {
|
|||
$next = array();
|
||||
}
|
||||
|
||||
if (!$post) {
|
||||
not_found();
|
||||
}
|
||||
|
||||
$post = $post['current'];
|
||||
|
||||
if (config("views.counter") == "true") {
|
||||
|
|
|
|||
|
|
@ -2802,7 +2802,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
|
||||
if ($str == 'index') {
|
||||
if ($str == 'index.xml') {
|
||||
|
||||
echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
||||
|
||||
|
|
@ -2840,7 +2840,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</sitemapindex>';
|
||||
|
||||
} elseif ($str == 'base') {
|
||||
} elseif ($str == 'base.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.base')) ? config('sitemap.priority.base') : '1.0';
|
||||
|
||||
|
|
@ -2852,7 +2852,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'post') {
|
||||
} elseif ($str == 'post.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.post')) ? config('sitemap.priority.post') : $default_priority;
|
||||
|
||||
|
|
@ -2870,7 +2870,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'static') {
|
||||
} elseif ($str == 'static.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.static')) ? config('sitemap.priority.static') : $default_priority;
|
||||
|
||||
|
|
@ -2888,7 +2888,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'tag') {
|
||||
} elseif ($str == 'tag.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.tag')) ? config('sitemap.priority.tag') : $default_priority;
|
||||
|
||||
|
|
@ -2928,7 +2928,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'archive') {
|
||||
} elseif ($str == 'archive.xml') {
|
||||
|
||||
$priorityDay = (config('sitemap.priority.archiveDay')) ? config('sitemap.priority.archiveDay') : $default_priority;
|
||||
$priorityMonth = (config('sitemap.priority.archiveMonth')) ? config('sitemap.priority.archiveMonth') : $default_priority;
|
||||
|
|
@ -2971,7 +2971,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'author') {
|
||||
} elseif ($str == 'author.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.author')) ? config('sitemap.priority.author') : $default_priority;
|
||||
|
||||
|
|
@ -2997,7 +2997,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'category') {
|
||||
} elseif ($str == 'category.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.category')) ? config('sitemap.priority.category') : $default_priority;
|
||||
|
||||
|
|
@ -3035,7 +3035,7 @@ function generate_sitemap($str)
|
|||
|
||||
echo '</urlset>';
|
||||
|
||||
} elseif ($str == 'type') {
|
||||
} elseif ($str == 'type.xml') {
|
||||
|
||||
$priority = (config('sitemap.priority.type')) ? config('sitemap.priority.type') : $default_priority;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue