default_xml_user.php
3.03 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
<?php
/**
* @package JMAP::SITEMAP::components::com_jmap
* @subpackage views
* @subpackage sitemap
* @subpackage tmpl
* @author Joomla! Extensions Store
* @copyright (C) 2015 - Joomla! Extensions Store
* @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
*/
defined ( '_JEXEC' ) or die ( 'Restricted access' );
$priority = $this->sourceparams->get ( 'priority', '0.5' );
$changefreq = $this->sourceparams->get ( 'changefreq', 'daily' );
// Include common template init
include 'default_common_user.php';
if (count ( $this->source->data ) != 0) {
foreach ( $this->source->data as $elm ) {
$title = isset($titleIdentifier) && $titleIdentifier != '' ? $elm->{$titleIdentifier} : null;
// Manage modified date if exists
$modified = null;
if(isset($elm->modified) && $elm->modified && $elm->modified != -1 && $elm->modified != ('0000-00-00 00:00:00')) {
$timestamp = strtotime($elm->modified);
$modified = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
} elseif(isset($elm->publish_up) && $elm->publish_up && $elm->publish_up != -1 && $elm->publish_up != ('0000-00-00 00:00:00')) {
$timestamp = strtotime($elm->publish_up);
$modified = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
}
// Additional fields
$additionalQueryStringFromObjectProp = null;
$objectVars = array_diff_key(get_object_vars($elm), $arrayKeysDiff);
// Filter URL safe alias fields id/catid
if(isset($objectVars[$idIdentifier]) && $idURLFilter) {
$objectVars[$idIdentifier] = JFilterOutput::stringURLSafe($objectVars[$idIdentifier]);
}
if(isset($objectVars[$catidIdentifier]) && $catidURLFilter) {
$objectVars[$catidIdentifier] = JFilterOutput::stringURLSafe($objectVars[$catidIdentifier]);
}
if(is_array($objectVars) && count($objectVars)) {
$additionalQueryStringFromObjectProp = '&' . http_build_query($objectVars);
}
if(isset($supportedRouterHelperAdapters[$targetOption]) && $supportedRouterHelperAdapters[$targetOption]) {
include 'adapters/'.$targetOption.'.php';
} else {
$guessedItemid = null;
if($guessItemid) {
$guessedItemid = JMapRouteHelper::getItemRoute($targetOption, $targetViewName, $elm->{$idIdentifier}, $elm, $mainTable);
if($guessedItemid) {
$guessedItemid = '&Itemid=' . $guessedItemid;
}
}
$seflink = JRoute::_ ( 'index.php?option=' . $targetOption . $targetView . $additionalQueryStringFromObjectProp . $additionalQueryStringParams . $guessedItemid);
}
// Manage SEF links replacements
if($sefLinksReplacements) {
$seflink = str_replace($sefLinksReplacements['source'], $sefLinksReplacements['target'], $seflink);
}
// Skip outputting
if(array_key_exists($seflink, $this->outputtedLinksBuffer)) {
continue;
}
// Else store to prevent duplication
$this->outputtedLinksBuffer[$seflink] = true;
?>
<url>
<loc><?php echo $this->liveSite . $seflink; ?></loc>
<?php if(isset($modified) && trim($modified)):?>
<lastmod><?php echo $modified; ?></lastmod>
<?php endif; ?>
<changefreq><?php echo $changefreq;?></changefreq>
<priority><?php echo $priority;?></priority>
</url>
<?php
}
}