Continued a bit:
- recommended way is to use foreach() instead of own looping through arrays - even when you need the index: <?php foreach ($someArray as $key => $value) { // Handle $key/$value somehow } ?> Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
6db3d72ee3
commit
8824da8962
1 changed files with 5 additions and 5 deletions
10
mod/item.php
10
mod/item.php
|
@ -513,7 +513,7 @@ function item_post(App $a) {
|
||||||
// Fold multi-line [code] sequences
|
// Fold multi-line [code] sequences
|
||||||
$body = preg_replace('/\[\/code\]\s*\[code\]/ism', "\n", $body);
|
$body = preg_replace('/\[\/code\]\s*\[code\]/ism', "\n", $body);
|
||||||
|
|
||||||
$body = scale_external_images($body,false);
|
$body = scale_external_images($body, false);
|
||||||
|
|
||||||
// Setting the object type if not defined before
|
// Setting the object type if not defined before
|
||||||
if (!$objecttype) {
|
if (!$objecttype) {
|
||||||
|
@ -545,7 +545,7 @@ function item_post(App $a) {
|
||||||
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
|
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
|
||||||
|
|
||||||
if (!in_array($contact,$tags)) {
|
if (!in_array($contact,$tags)) {
|
||||||
$body = $contact.' '.$body;
|
$body = $contact . ' ' . $body;
|
||||||
$tags[] = $contact;
|
$tags[] = $contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ function item_post(App $a) {
|
||||||
$toplevel_contact = '@' . $toplevel_parent[0]['nick'] . '+' . $toplevel_parent[0]['id'];
|
$toplevel_contact = '@' . $toplevel_parent[0]['nick'] . '+' . $toplevel_parent[0]['id'];
|
||||||
} else {
|
} else {
|
||||||
$toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
|
$toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
|
||||||
$toplevel_contact = '@[url='.$toplevel_parent[0]['author-link'].']'.$toplevel_parent[0]['author-name'].'[/url]';
|
$toplevel_contact = '@[url=' . $toplevel_parent[0]['author-link'] . ']' . $toplevel_parent[0]['author-name'] . '[/url]';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($toplevel_contact, $tags)) {
|
if (!in_array($toplevel_contact, $tags)) {
|
||||||
|
@ -581,8 +581,8 @@ function item_post(App $a) {
|
||||||
* Robert Johnson should be first in the $tags array
|
* Robert Johnson should be first in the $tags array
|
||||||
*/
|
*/
|
||||||
$fullnametagged = false;
|
$fullnametagged = false;
|
||||||
for ($x = 0; $x < count($tagged); $x ++) {
|
foreach ($tagged as $nextTag) {
|
||||||
if (stristr($tagged[$x],$tag . ' ')) {
|
if (stristr($nextTag, $tag . ' ')) {
|
||||||
$fullnametagged = true;
|
$fullnametagged = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue