Browse Source

Cleanup

pull/674/head
danpros 1 year ago
parent
commit
80b2eefba1
2 changed files with 20 additions and 36 deletions
  1. +11
    -27
      system/htmly.php
  2. +9
    -9
      system/includes/functions.php

+ 11
- 27
system/htmly.php View File

@ -2836,30 +2836,14 @@ get('/:static', function ($static) {
header("Location: $url"); 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') { 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; die;
} elseif ($static === 'admin') { } elseif ($static === 'admin') {
if (login()) { if (login()) {
@ -2981,7 +2965,11 @@ get('/:static', function ($static) {
} }
$post = find_page($static); $post = find_page($static);
if (!$post) {
not_found();
}
if (array_key_exists('prev', $post)) { if (array_key_exists('prev', $post)) {
$prev = $post['prev']; $prev = $post['prev'];
} else { } else {
@ -2994,10 +2982,6 @@ get('/:static', function ($static) {
$next = array(); $next = array();
} }
if (!$post) {
not_found();
}
$post = $post['current']; $post = $post['current'];
if (config("views.counter") == "true") { if (config("views.counter") == "true") {


+ 9
- 9
system/includes/functions.php View File

@ -2802,7 +2802,7 @@ function generate_sitemap($str)
echo '<?xml version="1.0" encoding="UTF-8"?>'; 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">'; echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
@ -2840,7 +2840,7 @@ function generate_sitemap($str)
echo '</sitemapindex>'; echo '</sitemapindex>';
} elseif ($str == 'base') {
} elseif ($str == 'base.xml') {
$priority = (config('sitemap.priority.base')) ? config('sitemap.priority.base') : '1.0'; $priority = (config('sitemap.priority.base')) ? config('sitemap.priority.base') : '1.0';
@ -2852,7 +2852,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'post') {
} elseif ($str == 'post.xml') {
$priority = (config('sitemap.priority.post')) ? config('sitemap.priority.post') : $default_priority; $priority = (config('sitemap.priority.post')) ? config('sitemap.priority.post') : $default_priority;
@ -2870,7 +2870,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'static') {
} elseif ($str == 'static.xml') {
$priority = (config('sitemap.priority.static')) ? config('sitemap.priority.static') : $default_priority; $priority = (config('sitemap.priority.static')) ? config('sitemap.priority.static') : $default_priority;
@ -2888,7 +2888,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'tag') {
} elseif ($str == 'tag.xml') {
$priority = (config('sitemap.priority.tag')) ? config('sitemap.priority.tag') : $default_priority; $priority = (config('sitemap.priority.tag')) ? config('sitemap.priority.tag') : $default_priority;
@ -2928,7 +2928,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'archive') {
} elseif ($str == 'archive.xml') {
$priorityDay = (config('sitemap.priority.archiveDay')) ? config('sitemap.priority.archiveDay') : $default_priority; $priorityDay = (config('sitemap.priority.archiveDay')) ? config('sitemap.priority.archiveDay') : $default_priority;
$priorityMonth = (config('sitemap.priority.archiveMonth')) ? config('sitemap.priority.archiveMonth') : $default_priority; $priorityMonth = (config('sitemap.priority.archiveMonth')) ? config('sitemap.priority.archiveMonth') : $default_priority;
@ -2971,7 +2971,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'author') {
} elseif ($str == 'author.xml') {
$priority = (config('sitemap.priority.author')) ? config('sitemap.priority.author') : $default_priority; $priority = (config('sitemap.priority.author')) ? config('sitemap.priority.author') : $default_priority;
@ -2997,7 +2997,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'category') {
} elseif ($str == 'category.xml') {
$priority = (config('sitemap.priority.category')) ? config('sitemap.priority.category') : $default_priority; $priority = (config('sitemap.priority.category')) ? config('sitemap.priority.category') : $default_priority;
@ -3035,7 +3035,7 @@ function generate_sitemap($str)
echo '</urlset>'; echo '</urlset>';
} elseif ($str == 'type') {
} elseif ($str == 'type.xml') {
$priority = (config('sitemap.priority.type')) ? config('sitemap.priority.type') : $default_priority; $priority = (config('sitemap.priority.type')) ? config('sitemap.priority.type') : $default_priority;


Loading…
Cancel
Save