From e4ad359f5a91a01fa18d3ad09ca6bc868e9c373c Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 23 Mar 2017 22:51:52 +0100 Subject: [PATCH] added curely braces + TODO for maybe avoiding multi-lined if() blocks as it confuses #3254 Signed-off-by: Roland Haeder --- include/dfrn.php | 7 ++++--- include/ostatus.php | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/include/dfrn.php b/include/dfrn.php index 1e1b82e39b..34cd33c339 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -2159,8 +2159,8 @@ class dfrn { $title = $attributes->textContent; } } - if (($rel != "") AND ($href != "")) - switch($rel) { + if (($rel != "") AND ($href != "")) { + switch ($rel) { case "alternate": $item["plink"] = $href; break; @@ -2170,9 +2170,10 @@ class dfrn { $item["attach"] .= ","; } - $item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'" title="'.$title.'"[/attach]'; + $item["attach"] .= '[attach]href="' . $href . '" length="' . $length . '" type="' . $type . '" title="' . $title . '"[/attach]'; break; } + } } } diff --git a/include/ostatus.php b/include/ostatus.php index 2c4b677a53..6061ef9e11 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -411,43 +411,51 @@ class ostatus { if ($attributes->name == "title") $title = $attributes->textContent; } - if (($rel != "") AND ($href != "")) - switch($rel) { + if (($rel != "") AND ($href != "")) { + switch ($rel) { case "alternate": $item["plink"] = $href; + /// @TODO These multi-lines can confuse, let's avoid them if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) OR - ($item["object-type"] == ACTIVITY_OBJ_EVENT)) + ($item["object-type"] == ACTIVITY_OBJ_EVENT)) { $item["body"] .= add_page_info($href); + } break; case "ostatus:conversation": $conversation = $href; break; case "enclosure": $enclosure = $href; - if(strlen($item["attach"])) + if (strlen($item["attach"])) { $item["attach"] .= ','; + } - $item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'" title="'.$title.'"[/attach]'; + $item["attach"] .= '[attach]href="' . $href . '" length="' . $length . '" type="' . $type . '" title="' . $title . '"[/attach]'; break; case "related": if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) { - if (!isset($item["parent-uri"])) + if (!isset($item["parent-uri"])) { $item["parent-uri"] = $href; + } - if ($related == "") + if ($related == "") { $related = $href; - } else + } + } else { $item["body"] .= add_page_info($href); + } break; case "self": $self = $href; break; case "mentioned": // Notification check - if ($importer["nurl"] == normalise_link($href)) + if ($importer["nurl"] == normalise_link($href)) { $mention = true; + } break; } + } } } -- 2.39.5