File: /storage/v6964/testingff/public_html/fdfctr/wp-content/plugins/listdom/app/includes/ads.php
<?php
// no direct access
defined('ABSPATH') or die();
if(!class_exists('LSD_Ads')):
/**
* Listdom Ads Class.
*
* @class LSD_Ads
* @version 1.0.0
*/
class LSD_Ads extends LSD_Base
{
/**
* Constructor method
*/
public function __construct()
{
parent::__construct();
}
public static function display($position)
{
$html = LSD_Ads::get($position);
if($html) echo ($html);
}
public static function get($position)
{
$ads = get_transient('lsd_ads');
if(!$ads)
{
$JSON = LSD_File::download('https://totalery.com/api/ads.php');
if(!$JSON or !trim($JSON)) return false;
$response = json_decode($JSON, true);
$ads = ((isset($response['ads']) and is_array($response['ads'])) ? $response['ads'] : false);
set_transient('lsd_ads', $ads, DAY_IN_SECONDS);
}
$html = '';
if(is_array($ads) and isset($ads[$position]) and trim($ads[$position])) $html = $ads[$position];
return $html;
}
}
endif;