do not apply regex replacements if there is no @ character #5
1 changed files with 4 additions and 5 deletions
|
@ -16,11 +16,10 @@ function hook_clickat_render_linklist($data)
|
|||
'/\ @([\w\d]+)@([\w\d_\-\.]+)/' => ' <a href="https://\2/@\1">@\1</a>',
|
||||
'/\ @([\w\d]+)/' => ' <a href="https://twitter.com/\1">@\1</a>'
|
||||
);
|
||||
foreach ($data['links'] as &$value) {
|
||||
foreach($patterns as $nic => $link) {
|
||||
foreach ($data['links'] as &$value)
|
||||
if (strpos($value['description'],' @') !== false)
|
||||
foreach($patterns as $nic => $link)
|
||||
$value['description'] = preg_replace($nic, $link, $value['description']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue