view = 'xml';
$this->uids = array();
$app = JFactory::getApplication();
$this->sitename = $app->getCfg('sitename');
$this->language = preg_replace('/-.*/','',$app->getCfg('language'));
Xmap::Xmap($config, $sitemap);
}
/** Convert sitemap tree to a XML Sitemap list */
function printNode( &$node ) {
if ($this->isNews && (!isset($node->newsItem) || !$node->newsItem) ) {
return true;
}
static $live_site,$len_live_site;
if ( !isset($live_site) ) {
$live_site = substr_replace(JURI::root(), "", -1, 1);
$len_live_site = strlen( $live_site );
}
$out = '';
$link = Xmap::getItemLink($node);
$is_extern = ( 0 != strcasecmp( substr($link, 0, $len_live_site), $live_site ) );
if ( !isset($node->browserNav) )
$node->browserNav = 0;
if ( $node->browserNav != 3 // ignore "no link"
&& !$is_extern // ignore external links
&& empty($this->_links[$link]) ) { // ignore links that have been added already
$this->count++;
$this->_links[$link] = 1;
if( !isset($node->priority) )
$node->priority = "0.5";
if( !isset($node->changefreq) )
$node->changefreq = 'daily';
$changefreq = $this->sitemap->getProperty('changefreq',$node->changefreq,$node->id,'xml',$node->uid);
$priority = $this->sitemap->getProperty('priority',$node->priority,$node->id,'xml',$node->uid);
echo ''."\n";
# Removed escapeURL until a better solution for UTF-8 is found
# echo '', $this->escapeURL($link) ,''."\n";
echo '', $link ,''."\n";
$timestamp = (isset($node->modified) && $node->modified != FALSE && $node->modified != -1) ? $node->modified : time();
$modified = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
if ( !$this->isNews ) {
if ($this->_isAdmin) {
echo '', $node->uid ,''."\n";
echo '',$node->id,''."\n";
}
if (isset($node->images)) {
foreach ($node->images as $image) {
echo '',"\n";
echo '',$image->src,'',"\n";
if ($image->title) {
echo '',htmlentities($image->title),'',"\n";
} else {
echo '';
}
if ($image->license) {
echo '',htmlentities($image->license),'',"\n";
}
echo '',"\n";
}
}
echo '',$modified,''."\n";
echo '',$changefreq,''."\n";
echo '',$priority,''."\n";
} else {
if ( isset($node->keywords) ) {
# $keywords = str_replace(array('&','&'),array('&','&'),$node->keywords);
# $keywords = str_replace('&','&',$node->keywords);
$keywords = htmlspecialchars($node->keywords);
} else {
$keywords = '';
}
echo "\n";
echo " \n";
echo " ",htmlspecialchars($this->sitename),"\n";
echo " ",htmlspecialchars($this->language),"\n";
echo " \n";
echo '',$modified,''."\n";
echo '',htmlspecialchars($node->name),"\n";
if ( $keywords ) {
echo '',$keywords,''."\n";
}
echo "\n";
}
echo '',"\n";
}
return true;
}
function escapeURL($str) {
static $xTrans;
if (!isset($xTrans)) {
$xTrans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
foreach ($xTrans as $key => $value)
$xTrans[$key] = ''.ord($key).';';
// dont translate the '&' in case it is part of &xxx;
$xTrans[chr(38)] = '&';
}
return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/","&" , strtr($str, $xTrans));
}
function changeLevel($level) {
return true;
}
function startOutput( &$menus, &$config ) {
$live_site = substr_replace(JURI::root(), "", -1, 1);
$this->isNews = JRequest::getInt('news',0);
// Don't compress something if the server is going todo it anyway. Waste of time.
$this->doCompression = ($this->sitemap->compress_xml && !ini_get('zlib.output_compression') && ini_get('output_handler')!='ob_gzhandler');
@ob_end_clean();
if ($this->doCompression ) {
$encoding = JResponse::_clientEncoding();
header('Content-Encoding: ' . $encoding);
header('X-Content-Encoded-By: Joomla! 1.5');
ob_start();
}
header('Content-type: application/xml; charset=utf-8');
echo ''."\n";
if (!$config->exclude_xsl && !$this->isNews ) {
$user =& JFactory::getUser();
if ($user->get('gid') == "25") {
echo ''."\n";
} else {
echo ''."\n";
}
}
echo 'isNews? ' xmlns:n="http://www.google.com/schemas/sitemap-news/0.9"':'').
">\n";
}
function endOutput( &$menus ) {
echo "\n";
if ($this->doCompression) {
$data = ob_get_contents();
@ob_end_clean();
echo JResponse::_compress($data);
}
}
function startMenu(&$menu) {
return true;
}
function endMenu(&$menu) {
return true;
}
}