beacon = $beacon;
}
/**
* Builds the notice data for the given license state.
*
* @param LicenseState $state The normalized license state.
* @param bool $is_legacy_payment_method Whether the license uses the legacy payment flow.
* @param bool $is_backwpup_main_screen Whether the notice is rendered on the main BackWPup screen.
*
* @return array{title:string, message:string} Title and message to be rendered.
*/
public function build(
LicenseState $state,
bool $is_legacy_payment_method,
bool $is_backwpup_main_screen
): array {
if ( $is_legacy_payment_method ) {
$link = $this->beacon->get_suggest(
'update-payment-method',
true,
[ 'bwu_event' => 'legacy_update_payment_method' ]
);
return [
'title' => sprintf(
// translators: 1: opening tag, 2: link opening tag, 3: link closing tag, 4: closing tag.
__( '⚠️ %1$sAction Required – %2$sUpdate Your Payment Method%3$s%4$s', 'backwpup' ),
'',
'',
'',
''
),
'message' => __( 'Your payment method is outdated. Update it to restore your Pro features.', 'backwpup' ),
];
}
switch ( $state->state() ) {
case LicenseState::STATE_NOT_ACTIVATED:
$message = $is_backwpup_main_screen
? sprintf(
// translators: 1: line break tag, 2: opening tag.
__(
'To unlock Pro features and receive updates, you need to activate your license.%1$s%1$sGo to %2$sAdvanced settings%3$s → License, then enter your API Key and Product ID and click Activate.%1$sOnce the details are valid, your license will be activated automatically.',
'backwpup'
),
' ',
''
)
: sprintf(
// translators: 1: line break tag, 2: opening tag, 3: closing tag.
__(
'To unlock Pro features and receive updates, you need to activate your license.%1$s%1$sGo to %2$sBackWPup Pro → Advanced settings → License%3$s, then enter your API Key and Product ID and click Activate.%1$sOnce the details are valid, your license will be activated automatically.',
'backwpup'
),
' ',
'',
''
);
return [
'title' => sprintf(
// translators: 1: opening tag, 2: closing tag.
__( '⚠️ %1$sYour BackWPup Pro license is not activated%2$s', 'backwpup' ),
'',
''
),
'message' => $message,
];
case LicenseState::STATE_LIMIT_REACHED:
$link = $this->beacon->get_suggest(
'user_account',
true,
[
'bwu_event' => 'license_activation_limit_reached',
]
);
return [
'title' => sprintf(
// translators: 1: opening tag, 2: closing tag.
__( '⚠️ %1$sAll allowed WordPress installations are in use%2$s', 'backwpup' ),
'',
''
),
'message' => sprintf(
// translators: 1: line break tag, 2: opening tag (Manage licenses / upgrade button), 3: closing tag.
__(
'You’ve reached the maximum number of websites allowed for your current plan.%1$sTo activate this site, please deactivate a license on another site or upgrade your plan.%1$s%1$s%2$sManage licenses or upgrade plan%3$s',
'backwpup'
),
' ',
'',
''
),
];
case LicenseState::STATE_EXPIRED:
case LicenseState::STATE_INVALID:
default:
$link = $this->beacon->get_suggest(
'update-payment-method',
true,
[
'bwu_event' => 'Expired license update payment method banner clicked',
'license_state' => $state->state(),
]
);
do_action( 'backwpup_track_expired_banner_shown', $state->state() );
return [
'title' => sprintf(
// translators: 1: opening tag, 2: closing tag.
__( '⚠️ %1$sYour BackWPup Pro Plan Has Expired%2$s', 'backwpup' ),
'',
''
),
'message' => sprintf(
// translators: 1: opening tag, 2: closing tag.
__( '%1$sRenew your subscription%2$s to continue receiving updates and Pro features.', 'backwpup' ),
'',
''
),
];
}
}
}