Yoast\WP\SEO\Actions\Wincher
Wincher_Account_Action::get_upgrade_campaign
Gets the upgrade campaign.
Метод класса: Wincher_Account_Action{}
Хуков нет.
Возвращает
Объект. The response object.
Использование
$Wincher_Account_Action = new Wincher_Account_Action(); $Wincher_Account_Action->get_upgrade_campaign();
Код Wincher_Account_Action::get_upgrade_campaign() Wincher Account Action::get upgrade campaign Yoast 27.8
public function get_upgrade_campaign() {
try {
$result = $this->client->get( self::UPGRADE_CAMPAIGN_URL );
$type = ( $result['type'] ?? null );
$months = ( $result['months'] ?? null );
$discount = ( $result['value'] ?? null );
// We display upgrade discount only if it's a rate discount and positive months/discount.
if ( $type === 'RATE' && $months && $discount ) {
return (object) [
'discount' => $discount,
'months' => $months,
'status' => 200,
];
}
return (object) [
'discount' => null,
'months' => null,
'status' => 200,
];
} catch ( Exception $e ) {
return (object) [
'status' => $e->getCode(),
'error' => $e->getMessage(),
];
}
}