]> git.mxchange.org Git - friendica.git/blobdiff - include/tags.php
Fix autolink regular expression to include accents
[friendica.git] / include / tags.php
index 50fe1e49096b5c0687eedd703f510a13c9e0666f..4b45510b200d1a45c2d8b840e221e03bdd79eb30 100644 (file)
@@ -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)) {
@@ -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) {