Commit 14f229e7 authored by Robert Lyon's avatar Robert Lyon

Bug 1681974: Image description showing 'http://' in the text

Reverting the code change for Bug 1579145 where it tries to guess what
is a URL

behatnotneeded

Change-Id: I96440ce8eafa7fbd3ac6100b3a0ef1e3cd22d137
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 97a6406f
......@@ -3327,27 +3327,6 @@ function hsc ($text) {
return htmlspecialchars($text, ENT_COMPAT, 'UTF-8');
}
/**
* Returns a string of full formatted URLs
* www.something -> http://www.something
* something.[com|org] -> http://www.something.[com|org]
*
* @param string $urls
* @return string The full formatted URLs
*/
function add_http ($urls) {
$reg_exUrl = "/(\.*|(http|https|ftp|ftps)\:\/\/)([a-zA-Z0-9\-\.]+)\.[a-zA-Z]{2,3}(\/\S*)?/i";
if (preg_match_all($reg_exUrl, $urls, $m)) {
for ($i=0; $i < count($m[0]); $i++) {
if (empty($m[1][$i])) {
$urls = preg_replace("~{$m[0][$i]}~", "http://$0", $urls);
}
}
}
return $urls;
}
/**
* Builds the pieform for the search field in the page header
*/
......
......@@ -29,7 +29,7 @@
{if $file.description}
<div class="file-description">
<p class="text-small">
{$file.description|safe|add_http|clean_html}
{$file.description|safe|clean_html}
</p>
</div>
<script type="application/javascript">
......
......@@ -9,7 +9,7 @@
{if $showdescription && $image.title}
<div class="carousel-caption" id="description_{$instanceid}_{$k}">
{$image.title|safe|add_http|clean_html}
{$image.title|safe|clean_html}
</div>
{/if}
</div>
......
......@@ -6,7 +6,7 @@
</a>
{if $showdescription && $image.title}
<p class="text-small title">
{$image.title|truncate:60|safe|add_http|clean_html}
{$image.title|truncate:60|safe|clean_html}
</p>
{/if}
</div>
......
......@@ -6,7 +6,7 @@
</a>
{if $showdescription && $image.title}
<p class="text-small title">
{$image.title|truncate:60|safe|add_http|clean_html}
{$image.title|truncate:60|safe|clean_html}
</p>
{/if}
</div>
......
......@@ -7,7 +7,7 @@
{if $showdescription}
<div class="detail" itemprop="description">
{$description|safe|add_http|clean_html}
{$description|safe|clean_html}
</div>
{/if}
</div>
......
......@@ -16,7 +16,7 @@
{if $description}
<tr>
<th>{str tag=Description section=artefact.file}:</th>
<td>{$description|safe|add_http|clean_html}</td>
<td>{$description|safe|clean_html}</td>
</tr>
{/if}
{if $tags}
......
......@@ -50,7 +50,7 @@
{/if}
{if $child->description}
<p class="file-description text-small text-midtone">
{$child->description|safe|add_http|clean_html}
{$child->description|safe|clean_html}
</p>
<script type="application/javascript">
jQuery(".file-description a").addClass('inner-link');
......
......@@ -85,7 +85,7 @@
{/if}
</td>
<td class="filedescription hidden-xs">
{$file->description|safe|add_http|clean_html}
{$file->description|safe|clean_html}
{if $showtags}
{if $file->tags}
<div class="tags filetags text-small">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment