From 916b3e551e784fe27f083b76d7e4ab3d6d6ecb75 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Thu, 8 Nov 2018 10:24:47 -0500 Subject: [PATCH] format_network_name calls implement formatNetworkName function --- mod/hovercard.php | 3 ++- src/Model/Profile.php | 2 +- src/Module/Contact.php | 2 +- src/Util/Strings.php | 2 +- tests/include/TextTest.php | 16 ++++++++-------- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mod/hovercard.php b/mod/hovercard.php index 1e2e14afb6..d35de1a7fa 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -16,6 +16,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Util\Proxy as ProxyUtils; +use Friendica\Util\Strings; function hovercard_init(App $a) { @@ -104,7 +105,7 @@ function hovercard_content() 'location' => $contact['location'], 'gender' => $contact['gender'], 'about' => $contact['about'], - 'network' => format_network_name($contact['network'], $contact['url']), + 'network' => Strings::formatNetworkName($contact['network'], $contact['url']), 'tags' => $contact['keywords'], 'bd' => $contact['birthday'] <= '0001-01-01' ? '' : $contact['birthday'], 'account_type' => Contact::getAccountType($contact), diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b6a1e40a4e..4fc7b3ab4b 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -297,7 +297,7 @@ class Profile $profile['picdate'] = urlencode(defaults($profile, 'picdate', '')); if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) { - $profile['network_name'] = format_network_name($profile['network'], $profile['url']); + $profile['network_name'] = Strings::formatNetworkName($profile['network'], $profile['url']); } else { $profile['network_name'] = ''; } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 75e2af7b27..8600b115d6 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -78,7 +78,7 @@ class Contact extends BaseModule $a->data['contact'] = $contact; if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) { - $networkname = format_network_name($contact['network'], $contact['url']); + $networkname = Strings::formatNetworkName($contact['network'], $contact['url']); } else { $networkname = ''; } diff --git a/src/Util/Strings.php b/src/Util/Strings.php index 07acb4586d..34ca143644 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -151,7 +151,7 @@ class Strings * * @return string Formatted network name */ - public static function formatNetworkName($network, $url = 0) // format_network_name() + public static function formatNetworkName($network, $url = 0) { if ($network != "") { if ($url != "") { diff --git a/tests/include/TextTest.php b/tests/include/TextTest.php index d4c9c1ec47..f5da662f70 100644 --- a/tests/include/TextTest.php +++ b/tests/include/TextTest.php @@ -18,8 +18,8 @@ class TextTest extends TestCase */ public function testAutonameEven() { - $autoname1=autoname(10); - $autoname2=autoname(10); + $autoname1= Friendica\Util\Strings::getRandomName(10); + $autoname2= Friendica\Util\Strings::getRandomName(10); $this->assertNotEquals($autoname1, $autoname2); } @@ -29,8 +29,8 @@ class TextTest extends TestCase */ public function testAutonameOdd() { - $autoname1=autoname(9); - $autoname2=autoname(9); + $autoname1= Friendica\Util\Strings::getRandomName(9); + $autoname2= Friendica\Util\Strings::getRandomName(9); $this->assertNotEquals($autoname1, $autoname2); } @@ -40,7 +40,7 @@ class TextTest extends TestCase */ public function testAutonameNoLength() { - $autoname1=autoname(0); + $autoname1= Friendica\Util\Strings::getRandomName(0); $this->assertEquals(0, strlen($autoname1)); } @@ -51,7 +51,7 @@ class TextTest extends TestCase */ public function testAutonameNegativeLength() { - $autoname1=autoname(-23); + $autoname1= Friendica\Util\Strings::getRandomName(-23); $this->assertEquals(0, strlen($autoname1)); } @@ -60,10 +60,10 @@ class TextTest extends TestCase */ public function testAutonameLength1() { - $autoname1=autoname(1); + $autoname1= Friendica\Util\Strings::getRandomName(1); $this->assertEquals(1, strlen($autoname1)); - $autoname2=autoname(1); + $autoname2= Friendica\Util\Strings::getRandomName(1); $this->assertEquals(1, strlen($autoname2)); } -- 2.39.5