From 008c97c570ea62749a3f486b42c424365863d627 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 20 Dec 2017 21:15:13 +0000 Subject: [PATCH] Split the name in the hcard --- include/identity.php | 7 ++++--- src/Protocol/Diaspora.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/identity.php b/include/identity.php index 9a0900dc1f..eebb8fe51a 100644 --- a/include/identity.php +++ b/include/identity.php @@ -13,6 +13,7 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Model\Contact; +use Friendica\Protocol\Diaspora; require_once 'include/bbcode.php'; require_once 'mod/proxy.php'; @@ -374,9 +375,9 @@ function profile_sidebar($profile, $block = 0) $location = $pdesc = $gender = $marital = $homepage = $about = false; } - $firstname = ((strpos($profile['name'], ' ')) - ? trim(substr($profile['name'], 0, strpos($profile['name'], ' '))) : $profile['name']); - $lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'], strlen($firstname)))); + $splitted_name = Diaspora::splitName($profile['name']); + $firstname = $splitted_name['first']; + $lastname = $splitted_name['last']; if ($profile['guid'] != "") { $diaspora = array( diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 67167ac930..09899ffa6c 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3970,7 +3970,7 @@ class Diaspora * * @return array The array with "first" and "last" */ - private static function splitName($name) { + public static function splitName($name) { $name = trim($name); // Is the name longer than 64 characters? Then cut the rest of it. -- 2.39.5