getRequest('statistics')->result;
foreach ($api_response as $i) {
if (!isset($i->program->name))
continue;
$tracking_url = $this->tracking_url($i->program->id);
$output[] = array(
'name' => trim($i->program->name),
'category' => '-',
'tracking_url' => $tracking_url,
'network' => 'Adrecord',
);
}
return $output;
}
/**
* Connect with service API and
* return an array of transactions.
*
* @string: name
* @int: transaction
* @date: click_date
* @date: event_date
* @int: commission
* @string: currency
* @string: network
* @return array
*/
public function transactions() {
$output = array();
$api_response = $this->getRequest('transactions', array(
'start' => $this->from_date,
'stop' => $this->to_date,
));
if (!isset($api_response) OR !isset($api_response->result))
return $output;
foreach ($api_response->result as $i) {
if (!isset($i->program->name) OR
!isset($i->commissionName) OR
!isset($i->type) OR
!isset($i->click) OR
!isset($i->changes[0]->date) OR
!isset($i->commission))
continue;
$output[] = array(
'name' => $i->program->name,
'transaction' => $i->commissionName . ' - ' . $i->type,
'click_date' => $this->dateToString($i->click),
'event_date' => $this->dateToString($i->changes[0]->date),
'commission' => $i->commission / 100,
'currency' => 'SEK',
'network' => 'Adrecord',
);
}
return $output;
}
/**
* Options
* Create admin menu options
*/
public function Options() {
if (!$this->isConfigured())
return false;
global $ymas;
$ymas->admin_settings_advanced_tab->createOption( array(
'name' => $this->name,
'type' => 'heading',
'toggle' => true,
));
$ymas->admin_settings_advanced_tab->createOption( array(
'name' => __('Clean links', 'ymas'),
'id' => $this->slug . '_enabled_cleanlinks',
'type' => 'checkbox',
'default' => true,
'desc' => __('Enable clean links', 'ymas') . '
' . __('Clean links is a technique to link to an advertiser with "regular links",
example directly to http://example.com instead of http://click.adrecord.com/?p=19&c=235.', 'ymas') . '
' . __('Read more','ymas') . '