Пример #1
0
 /** Convert sitemap tree to a XML Sitemap list */
 function printNode(&$node)
 {
     global $Itemid, $mosConfig_live_site;
     $out = '';
     $len_live_site = strlen($mosConfig_live_site);
     $link = Xmap::getItemLink($node);
     $is_extern = 0 != strcasecmp(substr($link, 0, $len_live_site), $mosConfig_live_site);
     if (!isset($node->browserNav)) {
         $node->browserNav = 0;
     }
     if (!isset($node->priority)) {
         $node->priority = "0.5";
     }
     if (!isset($node->changefreq)) {
         $node->changefreq = 'daily';
     }
     if ($node->browserNav != 3 && !$is_extern && empty($this->_uids[$node->uid])) {
         // ignore links that have been added already
         $this->count++;
         $this->_uids[$node->uid] = 1;
         echo '<url>';
         echo '<loc>', $this->escapeURL($link), '</loc>';
         $timestamp = isset($node->modified) && $node->modified != FALSE && $node->modified != -1 ? $node->modified : time();
         $modified = gmdate('Y-m-d\\TH:i:s\\Z', $timestamp);
         echo '<lastmod>', $modified, '</lastmod>';
         echo '<changefreq>', $node->changefreq, '</changefreq>';
         echo '<priority>', $node->priority, '</priority>';
         echo '</url>', "\n";
     }
     return true;
 }
Пример #2
0
 /** 
  * Print one node of the sitemap
  */
 function printNode(&$node)
 {
     global $Itemid, $mosConfig_live_site;
     $out = '';
     $out .= $this->_closeItem;
     $out .= $this->_openList;
     $this->_openList = "";
     if ($Itemid == $node->id) {
         $out .= '<li class="active">';
     } else {
         $out .= '<li>';
     }
     $link = Xmap::getItemLink($node);
     if (!isset($node->browserNav)) {
         $node->browserNav = 0;
     }
     $node->name = htmlspecialchars($node->name);
     switch ($node->browserNav) {
         case 1:
             // open url in new window
             $ext_image = '';
             if ($this->sitemap->exlinks) {
                 $ext_image = '&nbsp;<img src="' . $mosConfig_live_site . '/components/com_xmap/images/' . $this->sitemap->ext_image . '" alt="' . _XMAP_SHOW_AS_EXTERN_ALT . '" title="' . _XMAP_SHOW_AS_EXTERN_ALT . '" border="0" />';
             }
             $out .= '<a href="' . $link . '" title="' . $node->name . '" target="_blank">' . $node->name . $ext_image . '</a>';
             break;
         case 2:
             // open url in javascript popup window
             $ext_image = '';
             if ($this->sitemap->exlinks) {
                 $ext_image = '&nbsp;<img src="' . $mosConfig_live_site . '/components/com_xmap/images/' . $this->sitemap->ext_image . '" alt="' . _XMAP_SHOW_AS_EXTERN_ALT . '" title="' . _XMAP_SHOW_AS_EXTERN_ALT . '" border="0" />';
             }
             $out .= '<a href="' . $link . '" title="' . $node->name . '" target="_blank" ' . "onClick=\"javascript: window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false;\">" . $node->name . $ext_image . "</a>";
             break;
         case 3:
             // no link
             $out .= '<span>' . $node->name . '</span>';
             break;
         default:
             // open url in parent window
             $out .= '<a href="' . $link . '" title="' . $node->name . '">' . $node->name . '</a>';
             break;
     }
     $this->_closeItem = "</li>\n";
     $this->_childs[$this->level]++;
     echo $out;
     $this->count++;
 }
Пример #3
0
 /** 
  * Print one node of the sitemap
  */
 function printNode(&$node)
 {
     $Itemid = JRequest::getInt('Itemid');
     $out = '';
     if ($this->sitemap->isExcluded($node->id, $node->uid) && !$this->_isAdmin) {
         return FALSE;
     }
     // To avoid duplicate children in the same parent
     if (!empty($this->_parent_children[$this->level][$node->uid])) {
         return FALSE;
     }
     //var_dump($this->_parent_children[$this->level]);
     $this->_parent_children[$this->level][$node->uid] = true;
     $out .= $this->_closeItem;
     $out .= $this->_openList;
     $this->_openList = "";
     if ($Itemid == $node->id) {
         $out .= '<li class="active">';
     } else {
         $out .= '<li>';
     }
     $link = Xmap::getItemLink($node);
     if (!isset($node->browserNav)) {
         $node->browserNav = 0;
     }
     $node->name = htmlspecialchars($node->name);
     switch ($node->browserNav) {
         case 1:
             // open url in new window
             $ext_image = '';
             if ($this->sitemap->exlinks) {
                 $ext_image = '&nbsp;<img src="' . $this->live_site . '/components/com_xmap/images/' . $this->sitemap->ext_image . '" alt="' . _XMAP_SHOW_AS_EXTERN_ALT . '" title="' . _XMAP_SHOW_AS_EXTERN_ALT . '" border="0" />';
             }
             $out .= '<a href="' . $link . '" title="' . htmlspecialchars($node->name) . '" target="_blank">' . $node->name . $ext_image . '</a>';
             break;
         case 2:
             // open url in javascript popup window
             $ext_image = '';
             if ($this->sitemap->exlinks) {
                 $ext_image = '&nbsp;<img src="' . $this->live_site . '/components/com_xmap/images/' . $this->sitemap->ext_image . '" alt="' . _XMAP_SHOW_AS_EXTERN_ALT . '" title="' . _XMAP_SHOW_AS_EXTERN_ALT . '" border="0" />';
             }
             $out .= '<a href="' . $link . '" title="' . $node->name . '" target="_blank" ' . "onClick=\"javascript: window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false;\">" . $node->name . $ext_image . "</a>";
             break;
         case 3:
             // no link
             $out .= '<span>' . $node->name . '</span>';
             break;
         default:
             // open url in parent window
             $out .= '<a href="' . $link . '" title="' . $node->name . '">' . $node->name . '</a>';
             break;
     }
     $this->_closeItem = "</li>\n";
     $this->_childs[$this->level]++;
     echo $out;
     if ($this->_isAdmin) {
         if ($this->sitemap->isExcluded($node->id, $node->uid)) {
             $img = '<img src="' . $this->live_site . '/administrator/images/publish_x.png" alt="' . _XMAP_EXT_PUBLISHED . '" title="' . _XMAP_EXT_UNPUBLISHED . '">';
             $class = 'xmapexclon';
         } else {
             $img = '<img src="' . $this->live_site . '/administrator/images/tick.png" alt="' . _XMAP_EXT_PUBLISHED . '" title="' . _XMAP_EXT_PUBLISHED . '" />';
             $class = 'xmapexcloff';
         }
         echo ' <a href= "#" class="xmapexcl ' . $class . '" rel="{uid:\'' . $node->uid . '\',itemid:' . $node->id . '}">' . $img . '</a>';
         # echo ' <a href= "#" class="xmapoptions" rel="{uid:\''.$node->uid.'\',itemid:'.$node->id.'}"><img src="'.$this->live_site.'/components/com_xmap/images/options.gif" border="0" alt="Options" title="Options" /></a>';
     }
     //echo $this->_last_child[$this->level-1] . ' ' . $this->_parent_children[$this->level]['parent'];
     $this->count++;
     $this->_last_child[$this->level] = $node->uid;
     return TRUE;
 }
Пример #4
0
 /** Convert sitemap tree to a XML Sitemap list */
 function printNode(&$node)
 {
     // For news sitemaps only display news items
     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;
     }
     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 && !$is_extern && 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 '<url>' . "\n";
         # Removed escapeURL until a better solution for UTF-8 is found
         # echo '<loc>', $this->escapeURL($link) ,'</loc>'."\n";
         echo '<loc>', $link, '</loc>' . "\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) {
                 //If the current user is admin
                 echo '<uid>', $node->uid, '</uid>' . "\n";
                 echo '<itemid>', $node->id, '</itemid>' . "\n";
             }
             if ($this->isImages) {
                 foreach ($node->images as $image) {
                     echo '<image:image>', "\n";
                     echo '<image:loc>', $image->src, '</image:loc>', "\n";
                     if ($image->title) {
                         $image->title = str_replace('&', '&amp;', html_entity_decode($image->title, ENT_NOQUOTES, 'UTF-8'));
                         echo '<image:title>', $image->title, '</image:title>', "\n";
                     } else {
                         echo '<image:title />';
                     }
                     if (isset($image->license) && $image->license) {
                         echo '<image:license>', str_replace('&', '&amp;', html_entity_decode($image->license, ENT_NOQUOTES, 'UTF-8')), '</image:license>', "\n";
                     }
                     echo '</image:image>', "\n";
                 }
             } else {
                 echo '<lastmod>', $modified, '</lastmod>' . "\n";
                 echo '<changefreq>', $changefreq, '</changefreq>' . "\n";
                 echo '<priority>', $priority, '</priority>' . "\n";
             }
         } else {
             if (isset($node->keywords)) {
                 # $keywords = str_replace(array('&amp;','&'),array('&','&amp;'),$node->keywords);
                 # $keywords = str_replace('&','&amp;',$node->keywords);
                 $keywords = htmlspecialchars($node->keywords);
             } else {
                 $keywords = '';
             }
             echo "<n:news>\n";
             echo " <n:publication>\n";
             echo "   <n:name>", htmlspecialchars($this->sitename), "</n:name>\n";
             echo "   <n:language>", htmlspecialchars($this->language), "</n:language>\n";
             echo " </n:publication>\n";
             echo '<n:publication_date>', $modified, '</n:publication_date>' . "\n";
             echo '<n:title>', htmlspecialchars($node->name), "</n:title>\n";
             if ($keywords) {
                 echo '<n:keywords>', $keywords, '</n:keywords>' . "\n";
             }
             echo "</n:news>\n";
         }
         echo '</url>', "\n";
     }
     return true;
 }
Пример #5
0
 /** Convert sitemap tree to a XML Sitemap list */
 function printNode(&$node)
 {
     global $Itemid;
     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 && !$is_extern && 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 '<url>' . "\n";
         # Removed escapeURL until a better solution for UTF-8 is found
         # echo '<loc>', $this->escapeURL($link) ,'</loc>'."\n";
         echo '<loc>', $link, '</loc>' . "\n";
         if ($this->_isAdmin) {
             echo '<uid>', $node->uid, '</uid>' . "\n";
             echo '<itemid>', $node->id, '</itemid>' . "\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) {
             echo '<lastmod>', $modified, '</lastmod>' . "\n";
             echo '<changefreq>', $changefreq, '</changefreq>' . "\n";
             echo '<priority>', $priority, '</priority>' . "\n";
         } else {
             if (isset($node->keywords)) {
                 # $keywords = str_replace(array('&amp;','&'),array('&','&amp;'),$node->keywords);
                 # $keywords = str_replace('&','&amp;',$node->keywords);
                 $keywords = htmlspecialchars($node->keywords);
             } else {
                 $keywords = '';
             }
             echo "<news:news>\n";
             echo '<news:publication_date>', $modified, '</news:publication_date>' . "\n";
             if ($keywords) {
                 echo '<news:keywords>', $keywords, '</news:keywords>' . "\n";
             }
             echo "</news:news>\n";
         }
         echo '</url>', "\n";
     }
     return true;
 }