X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ftags.php;h=4b45510b200d1a45c2d8b840e221e03bdd79eb30;hb=c4d3ab68785122ff070c65a444aaa0833b746b2b;hp=584ed30e5b09a8239d74d5443c84aec4f2e1c7a9;hpb=9a3e773a9a0464a309e4891f40c1105c8e2fed33;p=friendica.git diff --git a/include/tags.php b/include/tags.php index 584ed30e5b..4b45510b20 100644 --- a/include/tags.php +++ b/include/tags.php @@ -51,7 +51,7 @@ function create_tags_from_item($itemid) // ignore anything in a code block $data = preg_replace('/\[code\](.*?)\[\/code\]/sm', '', $data); - $tags = array(); + $tags = []; $pattern = '/\W\#([^\[].*?)[\s\'".,:;\?!\[\]\/]/ism'; if (preg_match_all($pattern, $data, $matches)) { @@ -97,7 +97,7 @@ function create_tags_from_item($itemid) $global = (count($isglobal) > 0); } - $r = q("INSERT INTO `term` (`uid`, `oid`, `otype`, `type`, `term`, `url`, `guid`, `created`, `received`, `global`) + q("INSERT INTO `term` (`uid`, `oid`, `otype`, `type`, `term`, `url`, `guid`, `created`, `received`, `global`) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', %d)", intval($message['uid']), intval($itemid), intval(TERM_OBJ_POST), intval($type), dbesc($term), dbesc($link), dbesc($message['guid']), dbesc($message['created']), dbesc($message['received']), intval($global)); @@ -204,7 +204,7 @@ function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA TERM_OBJ_POST ); if (!DBM::is_result($r)) { - return array(); + return []; } return tag_calc($r); @@ -226,12 +226,7 @@ function wtagblock($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA $o = ''; $r = tagadelic($uid, $count, $owner_id, $flags, $type); if (count($r)) { - $contact = dba::select( - 'contact', - array('url'), - array('id' => $uid), - array('limit' => 1) - ); + $contact = dba::selectFirst('contact', ['url'], ['id' => $uid]); $url = System::removedBaseUrl($contact['url']); foreach ($r as $rr) { @@ -243,10 +238,10 @@ function wtagblock($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA } $tpl = get_markup_template('tagblock_widget.tpl'); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$title' => t('Tags'), '$tags' => $tags - )); + ]); } return $o; } @@ -259,13 +254,13 @@ function wtagblock($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA */ function tag_calc($arr) { - $tags = array(); + $tags = []; $min = 1e9; $max = -1e9; $x = 0; if (!$arr) { - return array(); + return []; } foreach ($arr as $rr) {