primo commit
This commit is contained in:
		
							
								
								
									
										45
									
								
								components/com_osmap/views/xml/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								components/com_osmap/views/xml/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package   OSMap | ||||
|  * @contact   www.joomlashack.com, help@joomlashack.com | ||||
|  * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. | ||||
|  * @copyright 2016-2024 Joomlashack.com. All rights reserved. | ||||
|  * @license   https://www.gnu.org/licenses/gpl.html GNU/GPL | ||||
|  * | ||||
|  * This file is part of OSMap. | ||||
|  * | ||||
|  * OSMap is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 2 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * OSMap is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with OSMap.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| use Joomla\CMS\Language\Language; | ||||
|  | ||||
| defined('_JEXEC') or die(); | ||||
|  | ||||
| /** | ||||
|  * @var OsmapViewXml $this | ||||
|  * @var object       $template | ||||
|  * @var string       $layout | ||||
|  * @var string       $layoutTemplate | ||||
|  * @var Language     $lang | ||||
|  * @var string       $filetofind | ||||
|  */ | ||||
|  | ||||
| echo sprintf('<?xml version="1.0" encoding="%s"?>' . "\n", $this->_charset); | ||||
|  | ||||
| if (empty($this->message)) { | ||||
|     echo $this->loadTemplate($this->type); | ||||
|  | ||||
| } else { | ||||
|     echo '<message>' . $this->message . '</message>'; | ||||
| } | ||||
							
								
								
									
										56
									
								
								components/com_osmap/views/xml/tmpl/default.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								components/com_osmap/views/xml/tmpl/default.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <metadata> | ||||
|     <layout title="COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_TITLE"> | ||||
|         <message> | ||||
|             <![CDATA[COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_DESC]]> | ||||
|         </message> | ||||
|     </layout> | ||||
|  | ||||
|     <fields name="request"> | ||||
|         <fieldset name="request" | ||||
|                   addfieldpath="/administrator/components/com_osmap/form/fields"> | ||||
|  | ||||
|             <field name="id" | ||||
|                    type="osmap.sitemaps" | ||||
|                    required="true" | ||||
|                    label="COM_OSMAP_SITEMAP"/> | ||||
|  | ||||
|             <field name="format" | ||||
|                    type="hidden" | ||||
|                    default="xml"/> | ||||
|         </fieldset> | ||||
|     </fields> | ||||
|  | ||||
|     <fields name="params"> | ||||
|         <fieldset name="basic" | ||||
|                   label="COM_OSMAP_FIELDSET_SITEMAP_SETTINGS_LABEL"> | ||||
|  | ||||
|             <field name="add_styling" | ||||
|                    type="radio" | ||||
|                    class="btn-group btn-group-yesno" | ||||
|                    layout="joomla.form.field.radio.switcher" | ||||
|                    label="COM_OSMAP_OPTION_ADD_STYLING_LABEL" | ||||
|                    description="COM_OSMAP_OPTION_ADD_STYLING_DESC" | ||||
|                    default="1"> | ||||
|                 <option value="0">JNO</option> | ||||
|                 <option value="1">JYES</option> | ||||
|             </field> | ||||
|  | ||||
|             <field name="debug" | ||||
|                    type="radio" | ||||
|                    class="btn-group btn-group-yesno" | ||||
|                    layout="joomla.form.field.radio.switcher" | ||||
|                    label="COM_OSMAP_OPTION_DEBUG_LABEL" | ||||
|                    description="COM_OSMAP_OPTION_DEBUG_DESC" | ||||
|                    default="0"> | ||||
|                 <option value="0">JNO</option> | ||||
|                 <option value="1">JYES</option> | ||||
|             </field> | ||||
|  | ||||
|             <field name="news_publication_name" | ||||
|                    type="text" | ||||
|                    label="COM_OSMAP_NEWS_PUBLICATION_NAME_LABEL" | ||||
|                    description="COM_OSMAP_NEWS_PUBLICATION_NAME_DESC"/> | ||||
|         </fieldset> | ||||
|     </fields> | ||||
| </metadata> | ||||
							
								
								
									
										93
									
								
								components/com_osmap/views/xml/tmpl/default_images.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								components/com_osmap/views/xml/tmpl/default_images.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,93 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package   OSMap | ||||
|  * @contact   www.joomlashack.com, help@joomlashack.com | ||||
|  * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. | ||||
|  * @copyright 2016-2024 Joomlashack.com. All rights reserved. | ||||
|  * @license   https://www.gnu.org/licenses/gpl.html GNU/GPL | ||||
|  * | ||||
|  * This file is part of OSMap. | ||||
|  * | ||||
|  * OSMap is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 2 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * OSMap is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with OSMap.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| use Alledia\OSMap\Sitemap\Item; | ||||
| use Joomla\CMS\Language\Language; | ||||
| use Joomla\Utilities\ArrayHelper; | ||||
|  | ||||
| defined('_JEXEC') or die(); | ||||
|  | ||||
| /** | ||||
|  * @var OSMapViewXml $this | ||||
|  * @var string       $template | ||||
|  * @var string       $layout | ||||
|  * @var string       $layoutTemplate | ||||
|  * @var Language     $lang | ||||
|  * @var string       $filetofind | ||||
|  */ | ||||
|  | ||||
| $ignoreDuplicates = (int)$this->osmapParams->get('ignore_duplicated_uids', 1); | ||||
|  | ||||
| $printNodeCallback = function (Item $node) use ($ignoreDuplicates) { | ||||
|     $display = !$node->ignore | ||||
|         && $node->published | ||||
|         && (!$node->duplicate || !$ignoreDuplicates) | ||||
|         && $node->visibleForRobots | ||||
|         && $node->parentIsVisibleForRobots | ||||
|         && $node->visibleForXML | ||||
|         && $node->isInternal | ||||
|         && trim($node->fullLink) != '' | ||||
|         && $node->hasCompatibleLanguage(); | ||||
|  | ||||
|     if ($display && !empty($node->images)) { | ||||
|         echo '<url>'; | ||||
|         echo sprintf('<loc><![CDATA[%s]]></loc>', $node->fullLink); | ||||
|  | ||||
|         foreach ($node->images as $image) { | ||||
|             if (!empty($image->src)) { | ||||
|                 echo '<image:image>'; | ||||
|                 echo '<image:loc><![CDATA[' . $image->src . ']]></image:loc>'; | ||||
|                 echo empty($image->title) | ||||
|                     ? '<image:title/>' | ||||
|                     : '<image:title><![CDATA[' . $image->title . ']]></image:title>'; | ||||
|  | ||||
|                 if (!empty($image->license)) { | ||||
|                     echo '<image:license><![CDATA[' . $image->license . ']]></image:license>'; | ||||
|                 } | ||||
|  | ||||
|                 echo '</image:image>'; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         echo '</url>'; | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|      * Return true if there were no images | ||||
|      * so any child nodes will get checked | ||||
|      */ | ||||
|     return $display || empty($node->images); | ||||
| }; | ||||
|  | ||||
| echo $this->addStylesheet(); | ||||
|  | ||||
| $attributes = [ | ||||
|     'xmlns'       => 'http://www.sitemaps.org/schemas/sitemap/0.9', | ||||
|     'xmlns:image' => 'http://www.google.com/schemas/sitemap-image/1.1' | ||||
| ]; | ||||
| echo sprintf('<urlset %s>', ArrayHelper::toString($attributes)); | ||||
|  | ||||
| $this->sitemap->traverse($printNodeCallback); | ||||
|  | ||||
| echo '</urlset>'; | ||||
							
								
								
									
										98
									
								
								components/com_osmap/views/xml/tmpl/default_news.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								components/com_osmap/views/xml/tmpl/default_news.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,98 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package   OSMap | ||||
|  * @contact   www.joomlashack.com, help@joomlashack.com | ||||
|  * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. | ||||
|  * @copyright 2016-2024 Joomlashack.com. All rights reserved. | ||||
|  * @license   https://www.gnu.org/licenses/gpl.html GNU/GPL | ||||
|  * | ||||
|  * This file is part of OSMap. | ||||
|  * | ||||
|  * OSMap is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 2 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * OSMap is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with OSMap.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| use Alledia\OSMap\Sitemap\Item; | ||||
| use Joomla\CMS\Language\Language; | ||||
| use Joomla\Utilities\ArrayHelper; | ||||
|  | ||||
| defined('_JEXEC') or die(); | ||||
|  | ||||
| /** | ||||
|  * @var OSMapViewXml $this | ||||
|  * @var string       $template | ||||
|  * @var string       $layout | ||||
|  * @var string       $layoutTemplate | ||||
|  * @var Language     $lang | ||||
|  * @var string       $filetofind | ||||
|  */ | ||||
|  | ||||
| $debug = $this->params->get('debug', 0) ? "\n" : ''; | ||||
|  | ||||
| $printNodeCallback = function (Item $node) { | ||||
|     $display = !$node->ignore | ||||
|         && $node->published | ||||
|         && (!$node->duplicate || !$this->osmapParams->get('ignore_duplicated_uids', 1)) | ||||
|         && isset($node->newsItem) | ||||
|         && !empty($node->newsItem) | ||||
|         && $node->visibleForRobots | ||||
|         && $node->parentIsVisibleForRobots | ||||
|         && $node->visibleForXML | ||||
|         && $node->isInternal | ||||
|         && trim($node->fullLink) != '' | ||||
|         && $node->hasCompatibleLanguage(); | ||||
|  | ||||
|     /** @var DateTime $publicationDate */ | ||||
|     $publicationDate = $this->isNewsPublication($node); | ||||
|     if ($display && $publicationDate) { | ||||
|         echo '<url>'; | ||||
|         echo sprintf('<loc><![CDATA[%s]]></loc>', $node->fullLink); | ||||
|         echo '<news:news>'; | ||||
|  | ||||
|         echo '<news:publication>'; | ||||
|         echo ($publicationName = $this->params->get('news_publication_name', '')) | ||||
|             ? '<news:name><![CDATA[' . $publicationName . ']]></news:name>' | ||||
|             : '<news:name/>'; | ||||
|  | ||||
|         if (empty($node->language) || $node->language == '*') { | ||||
|             $node->language = $this->language; | ||||
|         } | ||||
|         echo '<news:language>' . $node->language . '</news:language>'; | ||||
|         echo '</news:publication>'; | ||||
|  | ||||
|         echo '<news:publication_date>' . $publicationDate->format('Y-m-d\TH:i:s\Z') . '</news:publication_date>'; | ||||
|         echo '<news:title><![CDATA[' . $node->name . ']]></news:title>'; | ||||
|  | ||||
|         if (!empty($node->keywords)) { | ||||
|             echo '<news:keywords><![CDATA[' . $node->keywords . ']]></news:keywords>'; | ||||
|         } | ||||
|  | ||||
|         echo '</news:news>'; | ||||
|         echo '</url>'; | ||||
|     } | ||||
|  | ||||
|     return $display; | ||||
| }; | ||||
|  | ||||
| echo $this->addStylesheet(); | ||||
|  | ||||
| $attribs = [ | ||||
|     'xmlns'      => 'http://www.sitemaps.org/schemas/sitemap/0.9', | ||||
|     'xmlns:news' => 'http://www.google.com/schemas/sitemap-news/0.9' | ||||
| ]; | ||||
|  | ||||
| echo sprintf($debug . '<urlset %s>' . $debug, ArrayHelper::toString($attribs)); | ||||
|  | ||||
| $this->sitemap->traverse($printNodeCallback); | ||||
|  | ||||
| echo '</urlset>'; | ||||
							
								
								
									
										90
									
								
								components/com_osmap/views/xml/tmpl/default_standard.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								components/com_osmap/views/xml/tmpl/default_standard.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,90 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package   OSMap | ||||
|  * @contact   www.joomlashack.com, help@joomlashack.com | ||||
|  * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. | ||||
|  * @copyright 2016-2024 Joomlashack.com. All rights reserved. | ||||
|  * @license   https://www.gnu.org/licenses/gpl.html GNU/GPL | ||||
|  * | ||||
|  * This file is part of OSMap. | ||||
|  * | ||||
|  * OSMap is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 2 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * OSMap is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with OSMap.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| use Alledia\OSMap\Helper\General; | ||||
| use Alledia\OSMap\Sitemap\Item; | ||||
| use Joomla\CMS\Language\Language; | ||||
|  | ||||
| defined('_JEXEC') or die(); | ||||
|  | ||||
| /** | ||||
|  * @var OSMapViewXml $this | ||||
|  * @var string       $template | ||||
|  * @var string       $layout | ||||
|  * @var string       $layoutTemplate | ||||
|  * @var Language     $lang | ||||
|  * @var string       $filetofind | ||||
|  */ | ||||
|  | ||||
| $showExternalLinks = (int)$this->osmapParams->get('show_external_links', 0); | ||||
| $ignoreDuplicates  = (int)$this->osmapParams->get('ignore_duplicated_uids', 1); | ||||
| $debug             = $this->params->get('debug', 0) ? "\n" : ''; | ||||
|  | ||||
| $printNodeCallback = function (Item $node) use ($showExternalLinks, $ignoreDuplicates, $debug) { | ||||
|     $display = !$node->ignore | ||||
|         && $node->published | ||||
|         && (!$node->duplicate || !$ignoreDuplicates) | ||||
|         && $node->visibleForRobots | ||||
|         && $node->parentIsVisibleForRobots | ||||
|         && $node->visibleForXML | ||||
|         && trim($node->fullLink) != ''; | ||||
|  | ||||
|     if ($display && !$node->isInternal) { | ||||
|         // Show external links | ||||
|         $display = $showExternalLinks === 1; | ||||
|     } | ||||
|  | ||||
|     if (!$node->hasCompatibleLanguage()) { | ||||
|         $display = false; | ||||
|     } | ||||
|  | ||||
|     if (!$display) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     echo $debug; | ||||
|  | ||||
|     echo '<url>'; | ||||
|     echo '<loc><![CDATA[' . $node->fullLink . ']]></loc>'; | ||||
|  | ||||
|     if (!General::isEmptyDate($node->modified)) { | ||||
|         echo '<lastmod>' . $node->modified . '</lastmod>'; | ||||
|     } | ||||
|  | ||||
|     echo '<changefreq>' . $node->changefreq . '</changefreq>'; | ||||
|     echo '<priority>' . $node->priority . '</priority>'; | ||||
|     echo '</url>'; | ||||
|  | ||||
|     echo $debug; | ||||
|  | ||||
|     return true; | ||||
| }; | ||||
|  | ||||
| echo $this->addStylesheet(); | ||||
|  | ||||
| echo $debug . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . $debug; | ||||
|  | ||||
| $this->sitemap->traverse($printNodeCallback); | ||||
|  | ||||
| echo '</urlset>'; | ||||
		Reference in New Issue
	
	Block a user