|
@@ -418,7 +418,7 @@ class Autolink extends Regex
|
|
if(Str::startsWith($entity['screen_name'], '@')) {
|
|
if(Str::startsWith($entity['screen_name'], '@')) {
|
|
$text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex);
|
|
$text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex);
|
|
} else {
|
|
} else {
|
|
- $text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex + 1);
|
|
|
|
|
|
+ $text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
$text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex);
|
|
$text .= StringUtils::substr($tweet, $beginIndex, $entity['indices'][0] - $beginIndex);
|
|
@@ -708,16 +708,17 @@ class Autolink extends Regex
|
|
{
|
|
{
|
|
$attributes = [];
|
|
$attributes = [];
|
|
|
|
|
|
|
|
+ $screen_name = $entity['screen_name'];
|
|
if (!empty($entity['list_slug'])) {
|
|
if (!empty($entity['list_slug'])) {
|
|
// Replace the list and username
|
|
// Replace the list and username
|
|
- $linkText = $entity['screen_name'];
|
|
|
|
|
|
+ $linkText = Str::startsWith($screen_name, '@') ? $screen_name : '@'.$screen_name;
|
|
$class = $this->class_list;
|
|
$class = $this->class_list;
|
|
- $url = $this->url_base_list.$linkText;
|
|
|
|
|
|
+ $url = $this->url_base_list.$screen_name;
|
|
} else {
|
|
} else {
|
|
// Replace the username
|
|
// Replace the username
|
|
- $linkText = $entity['screen_name'];
|
|
|
|
|
|
+ $linkText = Str::startsWith($screen_name, '@') ? $screen_name : '@'.$screen_name;
|
|
$class = $this->class_user;
|
|
$class = $this->class_user;
|
|
- $url = $this->url_base_user.$linkText;
|
|
|
|
|
|
+ $url = $this->url_base_user.$screen_name;;
|
|
}
|
|
}
|
|
if (!empty($class)) {
|
|
if (!empty($class)) {
|
|
$attributes['class'] = $class;
|
|
$attributes['class'] = $class;
|