Skip to content

Commit

Permalink
fix PathPrefixs-Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyuexrow committed Sep 8, 2016
1 parent a691dcb commit 10fad71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
27 changes: 27 additions & 0 deletions classes/xrowsitemaptools.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,33 @@ public static function addNode( xrowSitemap $sitemap, eZContentObjectTreeNode $n
$extensions[] = new xrowSitemapItemModified( $node->attribute( 'modified_subnode' ) );

$url = $node->attribute( 'url_alias' );

// Remove PathPrefix if needed
if ($ini->hasVariable( 'SitemapSettings', 'PathPrefix' ) )
{
$pathPrefixs = $ini->variable( 'SitemapSettings', 'PathPrefix' );
foreach ( $pathPrefixs as $pathPrefix_item )
{
$pathPrefix_to_access = explode( ';', $pathPrefix_item );
$accessname_item = $pathPrefix_to_access[1];
$pathPrefix_temp = $pathPrefix_to_access[0];
if ( $accessname_item == $GLOBALS['eZCurrentAccess']['name'] )
{
$pathPrefix = $pathPrefix_temp;
break;
} else {
$pathPrefix = "";
}
}
if ( $url != '' && $pathPrefix != '' )
{
$pathPrefix .= '/';
if ( strncmp( $url, $pathPrefix, strlen( $pathPrefix ) ) == 0 )
{
$url = substr( $url, strlen( $pathPrefix ) );
}
}
}
$urlAlias = $url;

//Ticket #10114 - correction URLs
Expand Down
5 changes: 5 additions & 0 deletions settings/xrowsitemap.ini.append.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
#HostUriMatchMapItems[]=www.xxxxxxxx.de;;xx_de
MainNodeOnly=false
# If any site accesses use the PathPrefix setting, enter them here
#PathPrefix[]
#PathPrefix[]=XXXX;x_de
#PathPrefix[]=YYYY;x_en
# include or exclude objects of classes listed in ClassFilterArray
#ClassFilterType=exclude
Expand Down

0 comments on commit 10fad71

Please sign in to comment.