mirror of
https://github.com/friendica/friendica
synced 2024-11-10 07:42:53 +00:00
Add ensureQueryParameter method to Util\Strings
This commit is contained in:
parent
3020b9cb06
commit
a20fa6a3a9
1 changed files with 16 additions and 0 deletions
|
@ -312,4 +312,20 @@ class Strings
|
|||
{
|
||||
return (strcasecmp(self::normaliseLink($a), self::normaliseLink($b)) === 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensures the provided URI has its query string punctuation in order.
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
public static function ensureQueryParameter($uri)
|
||||
{
|
||||
if (strpos($uri, '?') === false && ($pos = strpos($uri, '&')) !== false) {
|
||||
$uri = substr($uri, 0, $pos) . '?' . substr($uri, $pos + 1);
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue