AAAAuids = array(); $this->defaultLanguage = strtolower(JFactory::getLanguage()->getTag()); if (preg_match('/^([a-z]+)-.*/',$this->defaultLanguage,$matches) && !in_array($this->defaultLanguage, array(' zh-cn',' zh-tw')) ) { $this->defaultLanguage = $matches[1]; } $this->showTitle = JRequest::getBool('filter_showtitle', 0); $this->showExcluded = JRequest::getBool('filter_showexcluded', 0); $db = JFactory::getDbo(); $this->nullDate = $db->getNullDate(); } /** * Prints an XML node for the sitemap * * @param stdclass $node */ function printNode($node) { $node->isExcluded = false; if ($this->isExcluded($node->id,$node->uid)) { if (!$this->showExcluded || !$this->canEdit) { return false; } $node->isExcluded = true; } if ($this->isNews && (!isset($node->newsItem) || !$node->newsItem)) { return true; } // For images sitemaps only display pages with images if ($this->isImages && (!isset($node->images) || !count($node->images))) { return true; } // Get the item's URL $link = JRoute::_($node->link, true, @$node->secure==0? -1: $node->secure); if (!isset($node->browserNav)) $node->browserNav = 0; if ($node->browserNav != 3 // ignore "no link" && 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'; // Get the chancefrequency and priority for this item $changefreq = $this->getProperty('changefreq', $node->changefreq, $node->id, 'xml', $node->uid); $priority = $this->getProperty('priority', $node->priority, $node->id, 'xml', $node->uid); echo '' . "\n"; echo '', $link, '' . "\n"; if ($this->canEdit) { if ($this->showTitle) { echo '<![CDATA['.$node->name.']]>' . "\n"; } if ($this->showExcluded) { echo '',($node->isExcluded? 'excluded':''),''; } echo '', $node->uid, '' . "\n"; echo '', $node->id, '' . "\n"; } $modified = (isset($node->modified) && $node->modified != FALSE && $node->modified != $this->nullDate && $node->modified != -1) ? $node->modified : NULL; if (!$modified && $this->isNews) { $modified = time(); } if ($modified && !is_numeric($modified)){ $date = new JDate($modified); $modified = $date->toUnix(); } if ($modified) { $modified = gmdate('Y-m-d\TH:i:s\Z', $modified); } // If this is not a news sitemap if (!$this->isNews) { if ($this->isImages) { foreach ($node->images as $image) { echo '', "\n"; echo '', $image->src, '', "\n"; if ($image->title) { $image->title = str_replace('&', '&', html_entity_decode($image->title, ENT_NOQUOTES, 'UTF-8')); echo '', $image->title, '', "\n"; } else { echo ''; } if (isset($image->license) && $image->license) { echo '',str_replace('&', '&',html_entity_decode($image->license, ENT_NOQUOTES, 'UTF-8')),'',"\n"; } echo '', "\n"; } } else { if ($modified){ echo '', $modified, '' . "\n"; } echo '', $changefreq, '' . "\n"; echo '', $priority, '' . "\n"; } } else { if (isset($node->keywords)) { $keywords = htmlspecialchars($node->keywords); } else { $keywords = ''; } if (!isset($node->language) || $node->language == '*') { $node->language = $this->defaultLanguage; } echo "\n"; echo ''."\n"; echo ' '.(htmlspecialchars($this->sitemap->params->get('news_publication_name'))).''."\n"; echo ' '.$node->language.''."\n"; echo ''."\n"; echo '', $modified, '' . "\n"; echo 'name.']]>' . "\n"; if ($keywords) { echo '', $keywords, '' . "\n"; } echo "\n"; } echo '', "\n"; } else { return empty($this->_links[$link]); } return true; } /** * * @param string $property The property that is needed * @param string $value The default value if the property is not found * @param int $Itemid The menu item id * @param string $view (xml / html) * @param int $uid Unique id of the element on the sitemap * (the id asigned by the extension) * @return string */ function getProperty($property, $value, $Itemid, $view, $uid) { if (isset($this->jview->sitemapItems[$view][$Itemid][$uid][$property])) { return $this->jview->sitemapItems[$view][$Itemid][$uid][$property]; } return $value; } /** * Called on every level change * * @param int $level * @return boolean */ function changeLevel($level) { return true; } /** * Function called before displaying the menu * * @param stdclass $menu The menu node item * @return boolean */ function startMenu($menu) { return true; } /** * Function called after displaying the menu * * @param stdclass $menu The menu node item * @return boolean */ function endMenu($menu) { return true; } }