From ed0d858f98babfa7b02e92186ea747b92605aad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 26 Jan 2017 16:01:56 +0100 Subject: [PATCH] added spaces + some curly braces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- include/contact_widgets.php | 9 +++++---- include/conversation.php | 24 +++++++++++++++--------- include/dfrn.php | 4 ++-- include/ostatus.php | 2 +- include/security.php | 3 ++- include/text.php | 3 ++- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 7a5fd6f5f6..0f78d5bf5c 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -172,10 +172,11 @@ function categories_widget($baseurl,$selected = '') { $matches = false; $terms = array(); - $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER); - if ($cnt) { - foreach ($matches as $mtch) { - $unescaped = xmlify(file_tag_decode($mtch[1])); + $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER); + + if ($cnt) { + foreach ($matches as $mtch) { + $unescaped = xmlify(file_tag_decode($mtch[1])); $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : '')); } } diff --git a/include/conversation.php b/include/conversation.php index d29b434504..d3e4c6e4ab 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -309,8 +309,9 @@ function localize_item(&$item){ $matches = null; if (preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) { foreach ($matches as $mtch) { - if (! strpos($mtch[1],'zrl=')) + if (! strpos($mtch[1],'zrl=')) { $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']); + } } } @@ -1360,20 +1361,25 @@ function conv_sort($arr,$order) { $arr = $newarr; - foreach ($arr as $x) - if ($x['id'] == $x['parent']) - $parents[] = $x; + foreach ($arr as $x) { + if ($x['id'] == $x['parent']) { + $parents[] = $x; + } + } - if (stristr($order,'created')) + if (stristr($order,'created')) { usort($parents,'sort_thr_created'); - elseif (stristr($order,'commented')) + } elseif (stristr($order,'commented')) { usort($parents,'sort_thr_commented'); + } - if (count($parents)) - foreach ($parents as $i=>$_x) + if (count($parents)) { + foreach($parents as $i=>$_x) { $parents[$i]['children'] = get_item_children($arr, $_x); + } + } - /*foreach ($arr as $x) { + /*foreach($arr as $x) { if ($x['id'] != $x['parent']) { $p = find_thread_parent_index($parents,$x); if ($p !== false) diff --git a/include/dfrn.php b/include/dfrn.php index 37df682a1b..7d5020425b 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -1277,7 +1277,7 @@ class dfrn { $href = ""; $width = 0; foreach ($avatar->attributes AS $attributes) { - /// @TODO Rewrite these similar if() to one switch + /// @TODO Rewrite these similar if () to one switch if ($attributes->name == "href") { $href = $attributes->textContent; } @@ -2122,7 +2122,7 @@ class dfrn { $title = ""; foreach ($links AS $link) { foreach ($link->attributes AS $attributes) { - /// @TODO Rewrite these repeated (same) if() statements to a switch() + /// @TODO Rewrite these repeated (same) if () statements to a switch() if ($attributes->name == "href") { $href = $attributes->textContent; } diff --git a/include/ostatus.php b/include/ostatus.php index 996fdbfd75..26be15a020 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -1138,7 +1138,7 @@ class ostatus { continue; } - /// @TODO One statment is okay (until if() ) + /// @TODO One statment is okay (until if () ) $arr = array(); $arr["network"] = $details["network"]; $arr["uri"] = $single_conv->id; diff --git a/include/security.php b/include/security.php index 6049700a38..63a6b9574f 100644 --- a/include/security.php +++ b/include/security.php @@ -358,8 +358,9 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null) $gs = '<<>>'; // should be impossible to match if (is_array($groups) && count($groups)) { - foreach ($groups as $g) + foreach ($groups as $g) { $gs .= '|<' . intval($g) . '>'; + } } $sql = sprintf( diff --git a/include/text.php b/include/text.php index 2f2f1b3201..a02021e03c 100644 --- a/include/text.php +++ b/include/text.php @@ -421,8 +421,9 @@ function expand_acl($s) { $t = str_replace('<','',$s); $a = explode('>',$t); foreach ($a as $aa) { - if (intval($aa)) + if (intval($aa)) { $ret[] = intval($aa); + } } } return $ret;