]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
Issue 2122: Make sure to always return the correct number of entries
[friendica.git] / include / text.php
index 0b826b626fd6282d89798f6088ec63573513bbad..1b03c39d26775b08fc4c30231bbab7bb956c7d59 100644 (file)
@@ -943,6 +943,9 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
        if($class)
                $class = ' ' . $class;
 
+       if ($contact["addr"] == "")
+               $contact["addr"] = $contact["url"];
+
        $url = $contact['url'];
        $sparkle = '';
        $redir = false;
@@ -966,7 +969,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                        . (($click) ? ' fakelink' : '') . '" '
                        . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click
-                       . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
+                       . '" title="' . $contact['name'] . ' [' . $contact['addr'] . ']" alt="' . $contact['name']
                        . '" >'. $contact['name'] . '</a></div>' . "\r\n";
        }
        else {
@@ -974,7 +977,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                        . (($click) ? ' fakelink' : '') . '" '
                        . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
-                       . proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
+                       . proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['addr'] . ']" alt="' . $contact['name']
                        . '" /></a></div>' . "\r\n";
        }
 }}
@@ -2286,32 +2289,23 @@ function formatBytes($bytes, $precision = 2) {
 }
 
 /**
- * @brief Translate the PAGE type flags in human readable string
+ * @brief translate and format the networkname of a contact
  * 
- * @param int $page_type
- * @return string $trans_type
+ * @param string $network
+ *     Networkname of the contact (e.g. dfrn, rss and so on)
+ * @param sting $url
+ *     The contact url
+ * @return string
  */
-function page_type_translate($page_type) {
+function format_network_name($network, $url = 0) {
+       if ($network != "") {
+               require_once('include/contact_selectors.php');
+               if ($url != "")
+                       $network_name = '<a href="'.$url.'">'.network_to_name($network, $url)."</a>";
+               else
+                       $network_name = network_to_name($network);
 
-       // ToDo: we need a good interpretable translation for PAGE_SOAPBOX
-       // and PAGE_PRVGROUP
-       switch ($page_type) {
-               case PAGE_NORMAL:
-                       $trans_type = t('Normal Account');
-                       break;
-               case PAGE_SOAPBOX:
-                       $trans_type = t('Fan Page');
-                       break;
-               case PAGE_COMMUNITY:
-                       $trans_type = t('Community Forum');
-                       break;
-               case PAGE_FREELOVE:
-                       $trans_type = t('Open Forum');
-                       break;
-               case PAGE_PRVGROUP:
-                       $trans_type = t('Private Forum');
-                       break;
+               return $network_name;
        }
 
-       return $trans_type;
 }