@@ -28,7 +28,7 @@ function parse_dir( $dir, $url ) {
28
28
while ( false !== ( $ file = readdir ( $ handle ) ) ) {
29
29
30
30
// Check if this file needs to be ignored, if so, skip it.
31
- if ( in_array ( $ file , $ ignore ) )
31
+ if ( in_array ( utf8_encode ( $ file ) , $ ignore ) )
32
32
continue ;
33
33
34
34
if ( is_dir ( $ file ) ) {
@@ -41,7 +41,11 @@ function parse_dir( $dir, $url ) {
41
41
if ( in_array ( $ fileinfo ['extension ' ], $ filetypes ) ) {
42
42
43
43
// Create a W3C valid date for use in the XML sitemap based on the file modification time
44
- $ mod = date ( 'c ' , filemtime ( $ dir . $ file ) );
44
+ if (filemtime ( $ dir .'/ ' . $ file )==FALSE ) {
45
+ $ mod = date ( 'c ' , filectime ( $ dir . $ file ) );
46
+ } else {
47
+ $ mod = date ( 'c ' , filemtime ( $ dir . $ file ) );
48
+ }
45
49
46
50
// Replace the file with it's replacement from the settings, if needed.
47
51
if ( in_array ( $ file , $ replace ) )
@@ -51,7 +55,7 @@ function parse_dir( $dir, $url ) {
51
55
?>
52
56
53
57
<url>
54
- <loc><?php echo $ url . $ file ?> </loc>
58
+ <loc><?php echo $ url . rawurlencode ( $ file ); ?> </loc>
55
59
<lastmod><?php echo $ mod ; ?> </lastmod>
56
60
<changefreq><?php echo $ chfreq ; ?> </changefreq>
57
61
<priority><?php echo $ prio ; ?> </priority>
@@ -66,4 +70,4 @@ function parse_dir( $dir, $url ) {
66
70
parse_dir ( SITEMAP_DIR , SITEMAP_DIR_URL );
67
71
?>
68
72
69
- </urlset>
73
+ </urlset>
0 commit comments