ADD подсветка урлов в доп. информаци

This commit is contained in:
Krivchikov Dmitry 2016-01-06 15:00:11 +03:00
parent fd58b965d1
commit 68e576d441
2 changed files with 8 additions and 1 deletions

View File

@ -96,6 +96,13 @@ class Helper
return $string;
}
static function replaceUrls($string)
{
$pr = '((https{0,1}:\/\/[\da-z\.-]+\.[a-z]{2,6})([\/\w\?=&#%+,-]|(\.[^\s]))*\/?)';
$rep = '<a href="$0" title="Ссылка откроется в новом окне" target="_blank">$0</a>';
return preg_replace($pr, $rep, $string);
}
public static function getFirstImg($string)
{
preg_match_all("(\[img[\|]#(\d+)\])", $string, $images);

View File

@ -84,7 +84,7 @@ $index = 0;
<?php foreach ($extraParams as $extraParam) {
print '<tr>';
print '<td>'.$extraParam->name.'</td>';
print '<td>'.$extraParam->value.'</td>';
print '<td>'. Helper::replaceUrls($extraParam->value).'</td>';
print '</tr>';
}
?>