Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix: create valid substring from locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Marian Ruberg committed Sep 17, 2021
1 parent 38eece6 commit 3a3bf30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xmlsitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,12 @@ private static function getHreflangFromLocale( string $locale ) : string {
// Clean (.whatever@whatever)
$x = strrpos( $locale, '.', 0 );
if ( $x != false ) {
$locale = substr( $locale, 0, -$x );
$locale = substr( $locale, 0, $x );
}
// More clean (just in case @whatever)
$y = strrpos( $locale, '@', 0 );
if ( $y != false ) {
$locale = substr( $locale, 0, -$y );
$locale = substr( $locale, 0, $y );
}
// Huzzah! $locale is now sanitized (which is not the same as canonicalization)
// Ensure hyphens not underscores
Expand Down

0 comments on commit 3a3bf30

Please sign in to comment.