В доп.полях ссылки выводятся в сокращённом виде

This commit is contained in:
Krivchikov Dmitry 2016-04-30 13:58:35 +03:00
parent 79eddfec09
commit 8a31d5b7c1
2 changed files with 7 additions and 3 deletions

View File

@ -104,10 +104,14 @@ class Helper
return $string; return $string;
} }
static function replaceUrls($string) static function replaceUrls($string, $short = FALSE)
{ {
$pr = '((https{0,1}:\/\/[\da-z\.-]+\.[a-z]{2,6})([\/\w\?=&#%+,-]|(\.[^\s]))*\/?)'; $pr = '((https{0,1}:\/\/[\da-z\.-]+\.[a-z]{2,6})([\/\w\?=&#%+,-]|(\.[^\s]))*\/?)';
$rep = '<a href="/go/away/?url=$0" title="Ссылка откроется в новом окне" target="_blank">$0</a>'; if ($short) {
$rep = '<a href="/go/away/?url=$0" title="Ссылка откроется в новом окне" target="_blank">$1</a>';
} else {
$rep = '<a href="/go/away/?url=$0" title="Ссылка откроется в новом окне" target="_blank">$0</a>';
}
return preg_replace($pr, $rep, $string); return preg_replace($pr, $rep, $string);
} }

View File

@ -103,7 +103,7 @@ if ($pointsAirport && $usersAirport && $pointsAirport->id != $usersAirport->id){
print '<span style="display: none;" id="extraData' . $extraParam->id . '" class="extraData">' . Helper::replaceUrls($extraParam->value) . '</span>'; print '<span style="display: none;" id="extraData' . $extraParam->id . '" class="extraData">' . Helper::replaceUrls($extraParam->value) . '</span>';
print '</td>'; print '</td>';
} else { } else {
print '<td>' . Helper::replaceUrls($extraParam->value) . '</td>'; print '<td>' . Helper::replaceUrls($extraParam->value, TRUE) . '</td>';
} }
print '</tr>'; print '</tr>';
} }