added spaces + some curly braces

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 16:01:56 +01:00 committed by Roland Haeder
parent d529125c8e
commit ed0d858f98
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
6 changed files with 27 additions and 18 deletions

View file

@ -173,6 +173,7 @@ function categories_widget($baseurl,$selected = '') {
$matches = false; $matches = false;
$terms = array(); $terms = array();
$cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER); $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER);
if ($cnt) { if ($cnt) {
foreach ($matches as $mtch) { foreach ($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1])); $unescaped = xmlify(file_tag_decode($mtch[1]));

View file

@ -309,10 +309,11 @@ function localize_item(&$item){
$matches = null; $matches = null;
if (preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) { if (preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
foreach ($matches as $mtch) { 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']); $item['body'] = str_replace($mtch[0],'@[url=' . zrl($mtch[1]). ']',$item['body']);
} }
} }
}
// add zrl's to public images // add zrl's to public images
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is"; $photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
@ -1360,20 +1361,25 @@ function conv_sort($arr,$order) {
$arr = $newarr; $arr = $newarr;
foreach ($arr as $x) foreach ($arr as $x) {
if ($x['id'] == $x['parent']) if ($x['id'] == $x['parent']) {
$parents[] = $x; $parents[] = $x;
}
}
if (stristr($order,'created')) if (stristr($order,'created')) {
usort($parents,'sort_thr_created'); usort($parents,'sort_thr_created');
elseif (stristr($order,'commented')) } elseif (stristr($order,'commented')) {
usort($parents,'sort_thr_commented'); usort($parents,'sort_thr_commented');
}
if (count($parents)) if (count($parents)) {
foreach ($parents as $i=>$_x) foreach($parents as $i=>$_x) {
$parents[$i]['children'] = get_item_children($arr, $_x); $parents[$i]['children'] = get_item_children($arr, $_x);
}
}
/*foreach ($arr as $x) { /*foreach($arr as $x) {
if ($x['id'] != $x['parent']) { if ($x['id'] != $x['parent']) {
$p = find_thread_parent_index($parents,$x); $p = find_thread_parent_index($parents,$x);
if ($p !== false) if ($p !== false)

View file

@ -1277,7 +1277,7 @@ class dfrn {
$href = ""; $href = "";
$width = 0; $width = 0;
foreach ($avatar->attributes AS $attributes) { 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") { if ($attributes->name == "href") {
$href = $attributes->textContent; $href = $attributes->textContent;
} }
@ -2122,7 +2122,7 @@ class dfrn {
$title = ""; $title = "";
foreach ($links AS $link) { foreach ($links AS $link) {
foreach ($link->attributes AS $attributes) { 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") { if ($attributes->name == "href") {
$href = $attributes->textContent; $href = $attributes->textContent;
} }

View file

@ -1138,7 +1138,7 @@ class ostatus {
continue; continue;
} }
/// @TODO One statment is okay (until if() ) /// @TODO One statment is okay (until if () )
$arr = array(); $arr = array();
$arr["network"] = $details["network"]; $arr["network"] = $details["network"];
$arr["uri"] = $single_conv->id; $arr["uri"] = $single_conv->id;

View file

@ -358,9 +358,10 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
$gs = '<<>>'; // should be impossible to match $gs = '<<>>'; // should be impossible to match
if (is_array($groups) && count($groups)) { if (is_array($groups) && count($groups)) {
foreach ($groups as $g) foreach ($groups as $g) {
$gs .= '|<' . intval($g) . '>'; $gs .= '|<' . intval($g) . '>';
} }
}
$sql = sprintf( $sql = sprintf(
/*" AND ( private = 0 OR ( private in (1,2) AND wall = 1 AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' ) /*" AND ( private = 0 OR ( private in (1,2) AND wall = 1 AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' )

View file

@ -421,10 +421,11 @@ function expand_acl($s) {
$t = str_replace('<','',$s); $t = str_replace('<','',$s);
$a = explode('>',$t); $a = explode('>',$t);
foreach ($a as $aa) { foreach ($a as $aa) {
if (intval($aa)) if (intval($aa)) {
$ret[] = intval($aa); $ret[] = intval($aa);
} }
} }
}
return $ret; return $ret;
}} }}