]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge pull request #6550 from tobiasd/20190129-lng
[friendica.git] / include / conversation.php
index 5125b3d1e8d7851050bd003f2b515a72193070e6..d7e3d54808ed77640c15662a9bc28ae4de40b2b6 100644 (file)
@@ -176,6 +176,7 @@ function localize_item(&$item)
 
                $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
 
+               $bodyverb = '';
                if (activity_match($item['verb'], ACTIVITY_LIKE)) {
                        $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
                } elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
@@ -209,8 +210,8 @@ function localize_item(&$item)
                foreach ($links->link as $l) {
                        $atts = $l->attributes();
                        switch ($atts['rel']) {
-                               case "alternate": $Blink = $atts['href'];
-                               case "photo": $Bphoto = $atts['href'];
+                               case "alternate": $Blink = $atts['href']; break;
+                               case "photo": $Bphoto = $atts['href']; break;
                        }
                }
 
@@ -1045,23 +1046,19 @@ function format_like($cnt, array $arr, $type, $id) {
 
        if ($cnt > 1) {
                $total = count($arr);
-               if ($total >= MAX_LIKERS) {
-                       $arr = array_slice($arr, 0, MAX_LIKERS - 1);
-               }
                if ($total < MAX_LIKERS) {
                        $last = L10n::t('and') . ' ' . $arr[count($arr)-1];
                        $arr2 = array_slice($arr, 0, -1);
-                       $str = implode(', ', $arr2) . ' ' . $last;
-               }
-               if ($total >= MAX_LIKERS) {
-                       $str = implode(', ', $arr);
-                       $str .= L10n::t('and %d other people', $total - MAX_LIKERS);
+                       $likers = implode(', ', $arr2) . ' ' . $last;
+               } else  {
+                       $arr = array_slice($arr, 0, MAX_LIKERS - 1);
+                       $likers = implode(', ', $arr);
+                       $likers .= L10n::t('and %d other people', $total - MAX_LIKERS);
                }
 
-               $likers = $str;
-
                $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
 
+               $explikers = '';
                switch ($type) {
                        case 'like':
                                $phrase = L10n::t('<span  %1$s>%2$d people</span> like this', $spanatts, $cnt);
@@ -1449,7 +1446,7 @@ function sort_thr_created_rev(array $a, array $b)
  *
  * @param array $a
  * @param array $b
- * @return int|lt
+ * @return int
  */
 function sort_thr_commented(array $a, array $b)
 {
@@ -1466,7 +1463,7 @@ function render_location_dummy(array $item) {
        }
 }
 
-function get_responses(array $conv_responses, array $response_verbs, $ob, array $item) {
+function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) {
        $ret = [];
        foreach ($response_verbs as $v) {
                $ret[$v] = [];
@@ -1497,6 +1494,7 @@ function get_responses(array $conv_responses, array $response_verbs, $ob, array
 
 function get_response_button_text($v, $count)
 {
+       $return = '';
        switch ($v) {
                case 'like':
                        $return = L10n::tt('Like', 'Likes', $count);