]> git.mxchange.org Git - friendica.git/commitdiff
Split the name in the hcard
authorMichael <heluecht@pirati.ca>
Wed, 20 Dec 2017 21:15:13 +0000 (21:15 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 20 Dec 2017 21:15:13 +0000 (21:15 +0000)
include/identity.php
src/Protocol/Diaspora.php

index 9a0900dc1f14db2fe74bf50d02228985a84c2291..eebb8fe51af68b2c0749f8f42e0ae74c6406aa88 100644 (file)
@@ -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(
index 67167ac930846c90c8278904a8d3cc5d5e9dc8a2..09899ffa6caa297aedce9788508befed94408105 100644 (file)
@@ -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.