override_i18n($map);
// Some SDK connect strings deliberately use the default SDK slug. Scope their
// official override to our own admin pages, never other products or the site front.
if(self::page())fs_override_i18n($map,'freemius');
},5);
add_action('admin_menu',static function()use($sdk){
if(!current_user_can('manage_options'))return;
global $_registered_pages;$hook=get_plugin_page_hookname('abece-booking-pricing','abece-booking');
if(!isset($_registered_pages[$hook]))add_submenu_page('abece-booking',__('Upgrade ABeCe Booking','abece-booking'),__('Upgrade ABeCe Booking','abece-booking'),'manage_options','abece-booking-pricing',static function()use($sdk){$sdk->_pricing_page_render();});
},PHP_INT_MAX);
// Pricing is rendered by the SDK. Never gate its pricing or checkout templates
// on our own interpretation of the public pricing API response.
$sdk->add_filter('templates/pricing.php',static fn($html)=>self::upgrade($sdk,$html));
add_action('admin_notices',static function()use($sdk){if(!self::page()||!current_user_can('manage_options')||!$sdk->is_premium()||$sdk->is_registered())return;echo '
'.esc_html__('Use a customer license key here. A developer secret key (sk_) is not a license key.','abece-booking').'
';});
}
private static function page():bool {return isset($_GET['page'])&&is_string($_GET['page'])&&str_starts_with(sanitize_key(wp_unslash($_GET['page'])),'abece-booking');}
/** Keys and printf placeholders verified against SDK 2.13.4 connect/account templates. */
private static function strings():array {return [
'skip'=>__('Skip','abece-booking'),
'skipping-wait'=>__('Skipping, please wait','abece-booking'),
'activate-license'=>__('Activate License','abece-booking'),
'license-key'=>__('License key','abece-booking'),
'connect-header'=>__('Never miss an important update','abece-booking'),
'opt-in-connect'=>__('Allow & Continue','abece-booking'),
'contact-for-updates'=>__("Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:",'abece-booking'),
'send-updates'=>__('send me security & feature updates, educational content and offers.','abece-booking'),
/* translators: %1$s: opening emphasis markup; %2$s: closing emphasis markup. The SDK supplies these wrappers. */
'do-not-send-updates'=>__('do %1$sNOT%2$s send me security & feature updates, educational content and offers.','abece-booking'),
/* translators: %s: plugin or theme product type supplied by Freemius. */
'connect-message'=>__('Optional sharing helps improve compatibility of the %s and sends update information and occasional offers. Lite bookings also work with Skip; no marketing permission is required. Review the permissions below.','abece-booking'),
/* translators: %s: product name supplied by Freemius. */
'thanks-for-purchasing'=>__('Welcome to %s! To get started, please enter your license key:','abece-booking'),
];}
/** Production purchase destinations; prices and availability remain owned by Freemius. */
public static function checkoutUrls():array {
return [
'starter'=>'https://checkout.freemius.com/plugin/41783/plan/72573/',
'club'=>'https://checkout.freemius.com/plugin/41783/plan/72574/',
'pro'=>'https://checkout.freemius.com/plugin/41783/plan/72575/',
];
}
/** Keep native pricing intact, with ordinary links usable after Skip or API failure. */
public static function upgrade(\Freemius $sdk,string $html):string {
if(!current_user_can('manage_options'))return ''.esc_html__('You do not have permission to manage this site.','abece-booking').'
';
$notice='';
// SDK loading modals must not cover the independent purchase links or WP navigation.
// Paint containment scopes fixed overlays to this pricing area without editing vendor CSS.
return $notice.''.$html.'
';
}
}