X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=sitemap.php;h=41d22771139f713eaa08f3084c28ae2dad671c79;hb=542cadd33c0fbf672192ce3e16b69b2a285ea421;hp=37e57a75a580d5dfa53a072e49ec59b8c251cdd6;hpb=adc4d382a4279466a2c85b98449f301e592387d2;p=quix0rs-gnu-social.git
diff --git a/sitemap.php b/sitemap.php
index 37e57a75a5..41d2277113 100644
--- a/sitemap.php
+++ b/sitemap.php
@@ -32,15 +32,13 @@ function index_map() {
$index_urls .= url(
array(
'url' => $output_url . $file_name,
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '1',
)
);
}
- $index_path = $output_dir . $output_paths['index_file'];
-
- write_file($index_path, urlset($index_urls));
+ write_file($output_paths['index_file'], urlset($index_urls));
}
@@ -51,7 +49,7 @@ function standard_map() {
$standard_map_urls .= url(
array(
'url' => common_local_url('public'),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '1',
)
);
@@ -59,7 +57,7 @@ function standard_map() {
$standard_map_urls .= url(
array(
'url' => common_local_url('publicrss'),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '0.3',
)
);
@@ -102,8 +100,8 @@ function notices_map() {
$notice = array(
'url' => $notices->uri,
- 'lastmod' => preg_replace('/ /', 'T', $notices->modified), # W3C DTF requires "T" separator
- 'changefreq' => 'hourly',
+ 'lastmod' => w3cdate($notices->modified),
+ 'changefreq' => 'daily',
'priority' => '1',
);
@@ -140,37 +138,37 @@ function user_map() {
# Define parameters for generating elements.
$user = array(
'url' => common_local_url('showstream', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '1',
);
$user_rss = array(
'url' => common_local_url('userrss', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '0.3',
);
$all = array(
'url' => common_local_url('all', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '1',
);
$all_rss = array(
'url' => common_local_url('allrss', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '0.3',
);
$replies = array(
'url' => common_local_url('replies', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '1',
);
$replies_rss = array(
'url' => common_local_url('repliesrss', $user_args),
- 'changefreq' => 'hourly',
+ 'changefreq' => 'daily',
'priority' => '0.3',
);
@@ -228,10 +226,10 @@ function avatar_map() {
$avatar_count = 0;
$map_count++;
}
-
+w3cdate($avatars->modified);
$image = array(
'url' => $avatars->url,
- 'lastmod' => preg_replace('/ /', 'T', $avatars->modified), # W3C DTF requires "T" separator
+ 'lastmod' => w3cdate($avatars->modified),
'changefreq' => 'monthly',
'priority' => '0.2',
);
@@ -281,9 +279,9 @@ function url($url_args) {
# Generate a element.
function urlset($urlset_text) {
- $urlset = ''.
- ''.
- $urlset_text.
+ $urlset = '' . "\n" .
+ '' . "\n" .
+ $urlset_text .
'';
return $urlset;
@@ -293,11 +291,13 @@ function urlset($urlset_text) {
function array_to_map($url_list, $filename_prefix) {
global $output_paths;
- # $map_urls is a long string containing concatenated elements.
- while (list($map_idx, $map_urls) = each($url_list)) {
- $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
-
- write_file($urlset_path, urlset($map_urls));
+ if ($url_list) {
+ # $map_urls is a long string containing concatenated elements.
+ while (list($map_idx, $map_urls) = each($url_list)) {
+ $urlset_path = $output_paths['output_dir'] . "$filename_prefix-$map_idx.xml";
+
+ write_file($urlset_path, urlset($map_urls));
+ }
}
}
@@ -310,7 +310,7 @@ function parse_args() {
$args = getopt('f:d:u:');
if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) {
- error('Mandatory arguments: -f -d