get_products();
if ( empty( $products ) ) :
return;
endif;
$slug = Charitable_Addons_Directory::get_current_plan_slug();
$is_legacy = Charitable_Addons_Directory::is_current_plan_legacy();
if ( false !== $slug && strtolower( $slug ) !== 'lite' && ! $is_legacy ) {
// there is a valid legacy license present
$new_tab_notification =
'
' .
sprintf(
wp_kses(
/* translators: %s - charitable.com upgrade URL. */
__( 'You already have a non-legacy license activate on this install, which you can deactivate in the "General" tab.', 'charitable' ),
[
'a' => [
'href' => [],
'class' => [],
'target' => [],
'rel' => [],
],
'br' => [],
'strong' => [],
]
),
esc_url( admin_url( 'admin.php?page=charitable-settings&tab=general' ) )
) .
'
';
?>
' .
sprintf(
wp_kses(
/* translators: %s - charitable.com upgrade URL. */
__( 'If you have purchased your license key for Basic, Plus, Pro, or Agency recently, please enter your Chariable license key in the "General" tab.', 'charitable' ),
[
'a' => [
'href' => [],
'class' => [],
'target' => [],
'rel' => [],
],
'br' => [],
'strong' => [],
]
),
esc_url( admin_url( 'admin.php?page=charitable-settings&tab=general' ) )
) .
'';
?>
$product ) :
$license = $helper->get_license_details( $key );
// set a default invalid message.
$invalid_message = __( 'This is an invalid license.', 'charitable' );
if ( is_array( $license ) ) {
if ( isset( $license['expiration_date'] ) && false !== $license['expiration_date'] && isset( $license['valid'] ) && false !== $license['valid'] ) {
$is_active = $license['valid'];
$license_key = $license['license'];
} else {
$is_active = false;
$license_key = false;
// this is different because we try to avoid just a BAD license vs. an invalid-but-could-be-expired license.
$referer = wp_get_referer();
if ( admin_url( 'admin.php?page=charitable-settings&tab=advanced' ) === $referer ) {
if ( false !== $_charitable_legacy_license_info && is_array( $_charitable_legacy_license_info ) && array_key_exists( $key, $_charitable_legacy_license_info ) && '' !== trim( $_charitable_legacy_license_info[ $key ] ) ) {
$invalid_message = __( 'The license was not valid.', 'charitable' );
} else {
$invalid_message = false;
}
} else {
$invalid_message = false;
}
}
} else {
$is_active = false;
$license_key = $license;
}
?>