]> git.mxchange.org Git - friendica.git/commitdiff
format_network_name calls
authorAdam Magness <adam.magness@gmail.com>
Thu, 8 Nov 2018 15:24:47 +0000 (10:24 -0500)
committerAdam Magness <adam.magness@gmail.com>
Thu, 8 Nov 2018 15:24:47 +0000 (10:24 -0500)
implement formatNetworkName function

mod/hovercard.php
src/Model/Profile.php
src/Module/Contact.php
src/Util/Strings.php
tests/include/TextTest.php

index 1e2e14afb634b8bd74151c31df8881be0ae4e189..d35de1a7fa6856fa6cbf9472da0efd5ce3098c4c 100644 (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),
index b6a1e40a4e72c22dbd71dc39c520d84f4d158baf..4fc7b3ab4bcfb4dc9bf295bd72d499a9529de06c 100644 (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'] = '';
                }
index 75e2af7b2769000d5e91da246025fcda2d93139a..8600b115d6f0c1184bba57f0d9e386774dcda1d6 100644 (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 = '';
                        }
index 07acb4586deabfe90c4c78edf73aa17fa31adc59..34ca143644efd90fb04f58a87ccd197883d77eca 100644 (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 != "") {
index d4c9c1ec471588bbfb97840b82522da5a9a3bcfc..f5da662f70a92106ef36be9662bfa44defb7ae92 100644 (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));
        }