format_network_name calls

implement formatNetworkName function
This commit is contained in:
Adam Magness 2018-11-08 10:24:47 -05:00
parent b99925060a
commit 916b3e551e
5 changed files with 13 additions and 12 deletions

View File

@ -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),

View File

@ -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'] = '';
}

View File

@ -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 = '';
}

View File

@ -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 != "") {

View File

@ -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));
}