Merge pull request #8520 from annando/term2tag

We now store tags in "tag"
This commit is contained in:
Hypolite Petovan 2020-04-22 22:56:07 -04:00 committed by GitHub
commit 43b8bdea07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 561 additions and 71 deletions

View file

@ -2107,7 +2107,7 @@ class BBCode
$ret = [];
// Convert hashtag links to hashtags
$string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2', $string);
$string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2 ', $string);
// ignore anything in a code block
$string = preg_replace('/\[code.*?\].*?\[\/code\]/sm', '', $string);

View file

@ -25,6 +25,7 @@ use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Term;
/**
* TagCloud widget
@ -45,7 +46,7 @@ class TagCloud
* @return string HTML formatted output.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getHTML($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG)
public static function getHTML($uid, $count = 0, $owner_id = 0, $flags = '', $type = Term::HASHTAG)
{
$o = '';
$r = self::tagadelic($uid, $count, $owner_id, $flags, $type);
@ -84,7 +85,7 @@ class TagCloud
* @return array Alphabetical sorted array of used tags of an user.
* @throws \Exception
*/
private static function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG)
private static function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = Term::HASHTAG)
{
$sql_options = Item::getPermissionsSQLByUserId($uid);
$limit = $count ? sprintf('LIMIT %d', intval($count)) : '';
@ -109,7 +110,7 @@ class TagCloud
GROUP BY `term` ORDER BY `total` DESC $limit",
$uid,
$type,
TERM_OBJ_POST
Term::OBJECT_TYPE_POST
);
if (!DBA::isResult($tag_stmt)) {
return [];