Skip to content
Snippets Groups Projects
Commit 0bf88147 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

do not show ads if no results are available

parent a7444968
No related branches found
No related tags found
2 merge requests!2229Development,!2228Resolve "Refactor some properties away from sumas.json"
...@@ -97,7 +97,7 @@ class MetaGer ...@@ -97,7 +97,7 @@ class MetaGer
$this->domainsBlacklisted = explode("\n", $tmp); $this->domainsBlacklisted = explode("\n", $tmp);
$tmp = file_get_contents(config_path() . "/blacklistUrl.txt"); $tmp = file_get_contents(config_path() . "/blacklistUrl.txt");
$lines = explode("\n", $tmp); $lines = explode("\n", $tmp);
$filtered_lines = array_filter($lines, function($line) { $filtered_lines = array_filter($lines, function ($line) {
return strpos(trim($line), '#') !== 0; return strpos(trim($line), '#') !== 0;
}); });
# Re-index the array (array_filter preserves keys by default) # Re-index the array (array_filter preserves keys by default)
...@@ -1315,7 +1315,7 @@ class MetaGer ...@@ -1315,7 +1315,7 @@ class MetaGer
public function popAd() public function popAd()
{ {
if (count($this->ads) > 0) { if (count($this->results) > 0 && count($this->ads) > 0) {
return array_shift($this->ads); return array_shift($this->ads);
} else { } else {
return null; return null;
......
@if(isset($ad) && !app(\App\Models\Authorization\Authorization::class)->canDoAuthenticatedSearch()) @if(!empty($ad) && !app(\App\Models\Authorization\Authorization::class)->canDoAuthenticatedSearch())
<div class="result" <div class="result" role="listitem" @if(array_key_exists('ad_data', $ad->additionalInformation))
role="listitem" data-yiid="{{ $ad->additionalInformation['ad_data']['yiid'] }}" @if($ad->additionalInformation['ad_data']['appns'] !== null && $ad->additionalInformation['ad_data']['k'] !== null)
@if(array_key_exists('ad_data', $ad->additionalInformation)) data-appns="{{ $ad->additionalInformation['ad_data']['appns'] }}"
data-yiid="{{ $ad->additionalInformation['ad_data']['yiid'] }}" data-k="{{ $ad->additionalInformation['ad_data']['k'] }}" @endif @endif>
@if($ad->additionalInformation['ad_data']['appns'] !== null && $ad->additionalInformation['ad_data']['k'] !== null)
data-appns="{{ $ad->additionalInformation['ad_data']['appns'] }}"
data-k="{{ $ad->additionalInformation['ad_data']['k'] }}"
@endif
@endif>
<div class="result-header"> <div class="result-header">
<div class="result-headline"> <div class="result-headline">
<h2 class="result-title"> <h2 class="result-title">
...@@ -15,15 +10,16 @@ ...@@ -15,15 +10,16 @@
{{ $ad->titel }} {{ $ad->titel }}
</a> </a>
</h2> </h2>
<a class="result-hoster" href="{{ $ad->gefVonLink[0] }}" target="{{ $metager->getNewtab() }}" rel="noopener" referrerpolicy="no-referrer-when-downgrade">{{ trans('result.gefVon') . " " . $ad->gefVon[0] }} </a> <a class="result-hoster" href="{{ $ad->gefVonLink[0] }}" target="{{ $metager->getNewtab() }}" rel="noopener"
referrerpolicy="no-referrer-when-downgrade">{{ trans('result.gefVon') . " " . $ad->gefVon[0] }} </a>
</div> </div>
<div class="result-subheadline"> <div class="result-subheadline">
<a class="result-link" href="{{ $ad->link }}" target="_blank" referrerpolicy="no-referrer-when-downgrade"> <a class="result-link" href="{{ $ad->link }}" target="_blank" referrerpolicy="no-referrer-when-downgrade">
<span>{{ $ad->anzeigeLink }}</span> <span>{{ $ad->anzeigeLink }}</span>
@if(\App\Localization::getLanguage() === "de") @if(\App\Localization::getLanguage() === "de")
<img src="/img/100-de.svg" alt="Mark"> <img src="/img/100-de.svg" alt="Mark">
@else @else
<img src="/img/100-en.svg" alt="Mark"> <img src="/img/100-en.svg" alt="Mark">
@endif @endif
</a> </a>
</div> </div>
...@@ -34,12 +30,14 @@ ...@@ -34,12 +30,14 @@
</div> </div>
</div> </div>
<div class="result-footer"> <div class="result-footer">
<a class="result-open-newtab" href="{{ $ad->link }}" target="_blank" rel="noopener" referrerpolicy="no-referrer-when-downgrade" aria-hidden="true" tabindex="-1"> <a class="result-open-newtab" href="{{ $ad->link }}" target="_blank" rel="noopener"
{!! trans('result.options.6') !!} referrerpolicy="no-referrer-when-downgrade" aria-hidden="true" tabindex="-1">
</a> {!! trans('result.options.6') !!}
<a class="result-open-key" title="@lang('result.metagerkeytext')" href="{{ app(\App\Models\Authorization\Authorization::class)->getAdfreeLink() }}" target="_blank"> </a>
@lang('result.options.8') <a class="result-open-key" title="@lang('result.metagerkeytext')"
</a> href="{{ app(\App\Models\Authorization\Authorization::class)->getAdfreeLink() }}" target="_blank">
</div> @lang('result.options.8')
</a>
</div>
</div> </div>
@endif @endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment