Split the name in the hcard

This commit is contained in:
Michael 2017-12-20 21:15:13 +00:00
parent fb88d78862
commit 008c97c570
2 changed files with 5 additions and 4 deletions

View file

@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Protocol\Diaspora;
require_once 'include/bbcode.php'; require_once 'include/bbcode.php';
require_once 'mod/proxy.php'; require_once 'mod/proxy.php';
@ -374,9 +375,9 @@ function profile_sidebar($profile, $block = 0)
$location = $pdesc = $gender = $marital = $homepage = $about = false; $location = $pdesc = $gender = $marital = $homepage = $about = false;
} }
$firstname = ((strpos($profile['name'], ' ')) $splitted_name = Diaspora::splitName($profile['name']);
? trim(substr($profile['name'], 0, strpos($profile['name'], ' '))) : $profile['name']); $firstname = $splitted_name['first'];
$lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'], strlen($firstname)))); $lastname = $splitted_name['last'];
if ($profile['guid'] != "") { if ($profile['guid'] != "") {
$diaspora = array( $diaspora = array(

View file

@ -3970,7 +3970,7 @@ class Diaspora
* *
* @return array The array with "first" and "last" * @return array The array with "first" and "last"
*/ */
private static function splitName($name) { public static function splitName($name) {
$name = trim($name); $name = trim($name);
// Is the name longer than 64 characters? Then cut the rest of it. // Is the name longer than 64 characters? Then cut the rest of it.