diff --git a/classes/xrowsitemaptools.php b/classes/xrowsitemaptools.php index dd9903e..0babbd5 100644 --- a/classes/xrowsitemaptools.php +++ b/classes/xrowsitemaptools.php @@ -261,10 +261,15 @@ public static function addNode( xrowSitemap $sitemap, eZContentObjectTreeNode $n $urlAlias = $url; //Ticket #10114 - correction URLs - if (strpos($GLOBALS['eZCurrentAccess']['name'], 'hi_') !== false) { - $cur_access = explode('_', $GLOBALS['eZCurrentAccess']['name']); - $language_code = $cur_access[1]; - $url = $language_code . '/' . $url; + if ( $ini->hasVariable( 'SitemapSettings', 'HostUriMatchMapItems' ) ) + { + $host_uri = self::getUri($ini->variable( 'SitemapSettings', 'HostUriMatchMapItems' )); + } elseif ( $site_ini->hasVariable( 'SiteAccessSettings', 'HostUriMatchMapItems' )) + { + $host_uri = self::getUri($site_ini->variable( 'SiteAccessSettings', 'HostUriMatchMapItems' )); + } + if ( $host_uri !== '') { + $url = $host_uri . '/' . $url; } // $urlAlias is kept 'as is' to be able to generate these links @@ -1679,6 +1684,31 @@ public static function checkAccess( eZContentObject $contentobject, eZUser $user } } } + + /*! + get URI for the current object + return the URI + */ + public static function getUri( $urimatchMapitems ) + { + foreach ( $urimatchMapitems as $hostUriMap ) + { + $hostUri = explode( ';', $hostUriMap ); + if ( count( $hostUri ) < 3 ) + { + $accessname = $hostUri[1]; + $uri = ''; + } else { + $accessname = $hostUri[2]; + $uri = $hostUri[1]; + } + if ( $accessname == $GLOBALS['eZCurrentAccess']['name'] ) + { + break; + } + } + return $uri; + } } ?> diff --git a/cronjobs/sitemap.php b/cronjobs/sitemap.php index 02d4040..94f39a3 100644 --- a/cronjobs/sitemap.php +++ b/cronjobs/sitemap.php @@ -16,6 +16,18 @@ ); } +if ( $xrowsitemapINI->hasVariable( 'Settings', 'ExcludeSiteaccess' ) ) +{ + $exclude_array = $xrowsitemapINI->variable( 'Settings', 'ExcludeSiteaccess' ); + foreach ($siteAccessArray as $key=>$siteaccess_item) + { + if (in_array($siteaccess_item, $exclude_array)) + { + unset($siteAccessArray[$key]); + } + } +} + if ( $xrowsitemapINI->hasVariable( 'SitemapSettings', 'HostUriMatchMapItems' ) ) { $hostArrays = $xrowsitemapINI->variable( 'SitemapSettings', 'HostUriMatchMapItems' ); diff --git a/settings/xrowsitemap.ini.append.php b/settings/xrowsitemap.ini.append.php index e868d75..fe57ee9 100644 --- a/settings/xrowsitemap.ini.append.php +++ b/settings/xrowsitemap.ini.append.php @@ -40,9 +40,10 @@ # AvailableSiteAccessList[] # AvailableSiteAccessList[]=ger # AvailableSiteAccessList[]=eng +# Each entry consists of the hostname;uri;accessname[;start|end|part|strict] #HostUriMatchMapItems[] -#HostUriMatchMapItems[]=www.xxxxxxxx.de;x_de -#HostUriMatchMapItems[]=www.xxxxxxxx.de;xx_de +#HostUriMatchMapItems[]=www.xxxxxxxx.de;de;x_de +#HostUriMatchMapItems[]=www.xxxxxxxx.de;;xx_de MainNodeOnly=false # include or exclude objects of classes listed in ClassFilterArray