-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemap.php
More file actions
executable file
·105 lines (97 loc) · 3.59 KB
/
sitemap.php
File metadata and controls
executable file
·105 lines (97 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
# ------------------ BEGIN LICENSE BLOCK ------------------
#
# This file is part of PluXml : http://pluxml.org
#
# Copyright (c) 2010-2011 Stephane Ferrari and contributors
# Copyright (c) 2008-2009 Florent MONTHEL and contributors
# Copyright (c) 2006-2008 Anthony GUERIN
# Licensed under the GPL license.
# See http://www.gnu.org/licenses/gpl.html
#
# ------------------- END LICENSE BLOCK -------------------
define('PLX_ROOT', './');
define('PLX_CORE', PLX_ROOT.'core/');
define('PLX_PLUGINS', PLX_ROOT.'plugins/');
define('PLX_CONF', PLX_ROOT.'data/configuration/parametres.xml');
# On verifie que PluXml est installé
if(!file_exists(PLX_CONF)) {
header('Location: '.PLX_ROOT.'install.php');
exit;
}
# On inclut les librairies nécessaires
include(PLX_ROOT.'config.php');
include(PLX_CORE.'lib/class.plx.date.php');
include(PLX_CORE.'lib/class.plx.glob.php');
include(PLX_CORE.'lib/class.plx.utils.php');
include(PLX_CORE.'lib/class.plx.capcha.php');
include(PLX_CORE.'lib/class.plx.erreur.php');
include(PLX_CORE.'lib/class.plx.record.php');
include(PLX_CORE.'lib/class.plx.motor.php');
include(PLX_CORE.'lib/class.plx.plugins.php');
# On impose le charset
header('Content-Type: text/xml; charset='.PLX_CHARSET);
# Creation de l'objet principal et lancement du traitement
$plxMotor = new plxMotor(PLX_CONF);
# Chargement du fichier de langue
loadLang(PLX_CORE.'lang/'.$plxMotor->aConf['default_lang'].'/core.php');
$plxMotor->prechauffage();
$plxMotor->demarrage();
# Entête XML
echo '<?xml version="1.0" encoding="'.strtolower(PLX_CHARSET).'" ?>'."\n";
?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc><?php echo $plxMotor->urlRewrite() ?></loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<?php
# Les pages statiques
foreach($plxMotor->aStats as $stat_num => $stat_info) {
if($stat_info['active'] != 1 OR $stat_info['menu'] != 'oui') continue;
echo "\n";
echo "\t<url>\n";
echo "\t\t<loc>".$plxMotor->urlRewrite("?static".intval($stat_num)."/".$stat_info['url'])."</loc>\n";
echo "\t\t<changefreq>monthly</changefreq>\n";
echo "\t\t<priority>0.8</priority>\n";
$plxMotor->plxPlugins->callHook('SitemapStatics');
echo "\t</url>\n";
}
# Les catégories
foreach($plxMotor->aCats as $cat_num => $cat_info) {
if($cat_info['menu'] != 'oui' OR $cat_info['articles'] == 0) continue;
echo "\n";
echo "\t<url>\n";
echo "\t\t<loc>".$plxMotor->urlRewrite("?categorie".intval($cat_num)."/".$cat_info['url'])."</loc>\n";
echo "\t\t<changefreq>weekly</changefreq>\n";
echo "\t\t<priority>0.8</priority>\n";
$plxMotor->plxPlugins->callHook('SitemapCategories');
echo "\t</url>\n";
}
# Les articles
if($aFiles = $plxMotor->plxGlob_arts->query('/^[0-9]{4}.([0-9,|home]*).[0-9]{3}.[0-9]{12}.[a-z0-9-]+.xml$/','art','rsort', 0, false, 'before')) {
$plxRecord_arts = false;
$array=array();
foreach($aFiles as $k=>$v) { # On parcourt tous les fichiers
$array[ $k ] = $plxMotor->parseArticle(PLX_ROOT.$plxMotor->aConf['racine_articles'].$v);
}
# On stocke les enregistrements dans un objet plxRecord
$plxRecord_arts = new plxRecord($array);
if($plxRecord_arts) {
# On boucle sur nos articles
while($plxRecord_arts->loop()) {
$num = intval($plxRecord_arts->f('numero'));
echo "\n";
echo "\t<url>\n";
echo "\t\t<loc>".$plxMotor->urlRewrite("?article".$num."/".plxUtils::strCheck($plxRecord_arts->f('url')))."</loc>\n";
echo "\t\t<lastmod>".$plxRecord_arts->f('date')."</lastmod>\n";
echo "\t\t<changefreq>monthly</changefreq>\n";
echo "\t\t<priority>0.5</priority>\n";
$plxMotor->plxPlugins->callHook('SitemapArticles');
echo "\t</url>\n";
}
}
}
?>
</urlset>