mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-24 07:21:27 +00:00
23 lines
467 B
PHP
23 lines
467 B
PHP
<?php
|
|
|
|
namespace App\Util\Lexer;
|
|
|
|
class Nickname
|
|
{
|
|
public static function normalizeProfileUrl($url)
|
|
{
|
|
if (starts_with($url, 'acct:')) {
|
|
$url = str_replace('acct:', '', $url);
|
|
}
|
|
|
|
if(starts_with($url, '@')) {
|
|
$url = substr($url, 1);
|
|
}
|
|
|
|
$parts = explode('@', $url);
|
|
$username = $parts[0];
|
|
$domain = $parts[1];
|
|
|
|
return ['domain' => $domain, 'username' => $username];
|
|
}
|
|
}
|