mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-28 02:36:50 +00:00
Merge pull request #576 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
67251287c5
2 changed files with 1 additions and 29 deletions
|
@ -98,7 +98,6 @@ class Extractor extends Regex
|
||||||
$entities = array_merge($entities, $this->extractURLsWithIndices($tweet));
|
$entities = array_merge($entities, $this->extractURLsWithIndices($tweet));
|
||||||
$entities = array_merge($entities, $this->extractHashtagsWithIndices($tweet, false));
|
$entities = array_merge($entities, $this->extractHashtagsWithIndices($tweet, false));
|
||||||
$entities = array_merge($entities, $this->extractMentionsOrListsWithIndices($tweet));
|
$entities = array_merge($entities, $this->extractMentionsOrListsWithIndices($tweet));
|
||||||
$entities = array_merge($entities, $this->extractCashtagsWithIndices($tweet));
|
|
||||||
$entities = $this->removeOverlappingEntities($entities);
|
$entities = $this->removeOverlappingEntities($entities);
|
||||||
|
|
||||||
return $entities;
|
return $entities;
|
||||||
|
@ -303,33 +302,6 @@ class Extractor extends Regex
|
||||||
*/
|
*/
|
||||||
public function extractCashtagsWithIndices($tweet = null)
|
public function extractCashtagsWithIndices($tweet = null)
|
||||||
{
|
{
|
||||||
if (is_null($tweet)) {
|
|
||||||
$tweet = $this->tweet;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match('/\$/iu', $tweet)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
preg_match_all(self::$patterns['valid_cashtag'], $tweet, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
|
||||||
$tags = [];
|
|
||||||
|
|
||||||
foreach ($matches as $match) {
|
|
||||||
list($all, $before, $dollar, $cash_text, $outer) = array_pad($match, 3, ['', 0]);
|
|
||||||
$start_position = $dollar[1] > 0 ? StringUtils::strlen(substr($tweet, 0, $dollar[1])) : $dollar[1];
|
|
||||||
$end_position = $start_position + StringUtils::strlen($dollar[0].$cash_text[0]);
|
|
||||||
|
|
||||||
if (preg_match(self::$patterns['end_hashtag_match'], $outer[0])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tags[] = [
|
|
||||||
'cashtag' => $cash_text[0],
|
|
||||||
'indices' => [$start_position, $end_position],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white">
|
<div class="bg-white">
|
||||||
<div class="container d-flex justify-content-center">
|
<div class="container d-flex justify-content-center">
|
||||||
<div class="card" style="width:500px;margin-top:-20px;">
|
<div class="card" style="width:500px;margin-top:-30px;">
|
||||||
<div class="card-header d-inline-flex align-items-center bg-white">
|
<div class="card-header d-inline-flex align-items-center bg-white">
|
||||||
<img src="/storage/avatars/default.png" width="32px" height="32px" style="border-radius: 32px; border: 1px solid #ccc">
|
<img src="/storage/avatars/default.png" width="32px" height="32px" style="border-radius: 32px; border: 1px solid #ccc">
|
||||||
<span class="username font-weight-bold pl-2 text-dark">
|
<span class="username font-weight-bold pl-2 text-dark">
|
||||||
|
|
Loading…
Reference in a new issue