Commit f6008ca7 authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '1071-ad-contains-html-tag' into 'development'

Resolve "ad contains html tag"

Closes #1071

See merge request !1796
parents 97f11bca 271d6aff
......@@ -33,6 +33,8 @@ class Result
public $new = true;
public $changed = false;
const DESCRIPTION_LENGTH = 150;
# Erstellt ein neues Ergebnis
public function __construct($provider, $titel, $link, $anzeigeLink, $descr, $gefVon, $gefVonLink, $sourceRank, $additionalInformation = [])
{
......@@ -44,10 +46,10 @@ class Result
$this->descr = strip_tags(trim($descr), '<p>');
$this->descr = preg_replace("/\n+/si", " ", $this->descr);
$this->longDescr = $this->descr;
if (strlen($this->descr) > 150) {
$this->descr = wordwrap($this->descr, 150);
if (strlen($this->descr) > self::DESCRIPTION_LENGTH) {
$this->descr = wordwrap($this->descr, self::DESCRIPTION_LENGTH);
$this->descr = substr($this->descr, 0, strpos($this->descr, "\n"));
$this->descr .= "&#8230;"; // Ellipsis character
$this->descr .= ""; // Ellipsis character
}
$this->gefVon[] = trim($gefVon);
$this->gefVonLink[] = trim($gefVonLink);
......
......@@ -35,10 +35,10 @@ class Overture extends Searchengine
$this->totalResults = $resultCount;
$results = $content->xpath('//Results/ResultSet[@id="inktomi"]/Listing');
foreach ($results as $result) {
$title = $result["title"];
$title = html_entity_decode($result["title"]);
$link = $result->{"ClickUrl"}->__toString();
$anzeigeLink = $result["siteHost"];
$descr = $result["description"];
$descr = html_entity_decode($result["description"]);
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
......@@ -56,10 +56,10 @@ class Overture extends Searchengine
# Nun noch die Werbeergebnisse:
$ads = $content->xpath('//Results/ResultSet[@id="searchResults"]/Listing');
foreach ($ads as $ad) {
$title = $ad["title"];
$title = html_entity_decode($ad["title"]);
$link = $ad->{"ClickUrl"}->__toString();
$anzeigeLink = $ad["siteHost"];
$descr = $ad["description"];
$descr = html_entity_decode($ad["description"]);
$this->counter++;
$this->ads[] = new \App\Models\Result(
$this->engine,
......
......@@ -27,10 +27,10 @@ class OvertureAds extends Searchengine
$ads = $content->xpath('//Results/ResultSet[@id="searchResults"]/Listing');
foreach ($ads as $ad) {
$title = $ad["title"];
$title = html_entity_decode($ad["title"]);
$link = $ad->{"ClickUrl"}->__toString();
$anzeigeLink = $ad["siteHost"];
$descr = $ad["description"];
$descr = html_entity_decode($ad["description"]);
$this->counter++;
$this->ads[] = new \App\Models\Result(
$this->engine,
......
......@@ -47,7 +47,7 @@
</div>
@else
<div class="result-description">
{!! $result->descr !!}
{{ $result->descr }}
</div>
@endif
</div>
......
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