@@ -23,7 +23,7 @@ class Optml_Admin {
2323
2424 const IMAGE_DATA_COLLECTED_BATCH = 100 ;
2525
26- const BF_PROMO_DISMISS_KEY = 'optml_bf24_notice_dismiss ' ;
26+ const BF_PROMO_DISMISS_KEY = 'optml_bf25_notice_dismiss ' ;
2727
2828 const SPC_BANNER_DISMISS_KEY = 'optml_spc_banner_dismiss ' ;
2929
@@ -711,6 +711,7 @@ public function should_show_upgrade() {
711711 */
712712 public static function get_upgrade_base_link () {
713713 $ base_url = 'https://optimole.com/upgrade ' ;
714+ $ base_url = tsdk_translate_link ( $ base_url );
714715 $ email = self ::get_account_email ();
715716
716717 if ( ! empty ( $ email ) ) {
@@ -1553,11 +1554,12 @@ private function get_spc_status() {
15531554 */
15541555 public function get_bf_notices ( $ user_plan ) {
15551556
1557+ $ notices = [];
15561558 $ has_free_plan = 'free ' === $ user_plan ;
15571559 $ has_monthly_plan = strpos ( $ user_plan , '-yearly ' ) === false && ! $ has_free_plan ;
15581560
15591561 if ( ! $ has_free_plan && ! $ has_monthly_plan ) {
1560- return [] ;
1562+ return $ notices ;
15611563 }
15621564
15631565 /**
@@ -1568,7 +1570,7 @@ public function get_bf_notices( $user_plan ) {
15681570 $ is_black_friday = apply_filters ( 'themeisle_sdk_is_black_friday_sale ' , false );
15691571
15701572 if ( ! $ is_black_friday ) {
1571- return [] ;
1573+ return $ notices ;
15721574 }
15731575
15741576 /**
@@ -1588,47 +1590,58 @@ public function get_bf_notices( $user_plan ) {
15881590 $ end ->modify ( '+7 days ' );
15891591 $ end ->setTime ( 23 , 59 , 59 );
15901592
1593+ $ promo_code = 'BFCM2525 ' ;
1594+
1595+ if ( $ has_free_plan ) {
1596+ $ notices ['sidebar ' ] = [
1597+ 'title ' => sprintf (
1598+ '<span class="text-promo-orange">%1$s:</span> %2$s - %3$s ' ,
1599+ __ ( 'Private Sale ' , 'optimole-wp ' ),
1600+ $ sale_start ->format ( 'j M ' ),
1601+ $ end ->format ( 'j M ' )
1602+ ),
1603+ 'subtitle ' => sprintf (
1604+ /* translators: %1$s is the promo code, %2$s is the discount amount ('25 off') */
1605+ __ ( 'Use code %1$s for an instant %2$s ' , 'optimole-wp ' ),
1606+ '<span class="border-b border-0 border-white border-dashed text-promo-orange"> ' . $ promo_code .'</span> ' ,
1607+ '<span class="text-promo-orange uppercase"> ' . __ ( '25% off ' , 'optimole-wp ' ) . '</span> '
1608+ ),
1609+ 'cta_link ' => esc_url_raw ( tsdk_utmify ( tsdk_translate_link ( self ::get_upgrade_base_link () ), 'bfcm25 ' , 'sidebarnotice ' ) ),
1610+ ];
1611+ }
1612+
1613+ if ( get_option ( self ::BF_PROMO_DISMISS_KEY ) === 'yes ' ) {
1614+ return $ notices ;
1615+ }
1616+
15911617 $ message = sprintf (
1592- /* translators: 1 is the promo code, 2 is the discount amount ('25 off') */
1618+ // translators: $1$s is the promo code, $2$s is the discount amount ('25% off')
15931619 __ ( 'Use coupon code %1$s for an instant %2$s on your first billing cycle on Optimole plan. ' , 'optimole-wp ' ),
1594- '<span class="border-b border-0 border-white border-dashed text-promo-orange">BFCM2525 </span> ' ,
1620+ '<span class="border-b border-0 border-white border-dashed text-promo-orange"> ' . $ promo_code . ' </span> ' ,
15951621 '<span class="text-promo-orange uppercase"> ' . __ ( '25% off ' , 'optimole-wp ' ) . '</span> '
15961622 );
1597- $ cta_link = esc_url_raw ( tsdk_utmify ( tsdk_translate_link ( self ::get_upgrade_base_link () ), 'bfcm25 ' , 'notice ' ) );
1623+ $ cta_link = esc_url_raw ( tsdk_utmify ( self ::get_upgrade_base_link (), 'bfcm25 ' , 'notice ' ) );
15981624 $ cta_text = __ ( 'Claim now ' , 'optimole-wp ' );
15991625
16001626 if ( $ has_monthly_plan ) {
16011627 $ message = sprintf (
1602- /* translators: 1 is the promo code, 2 is the discount amount ('25 off') */
1628+ // translators: %1$s is opening span tag, %2$s is closing span tag, %3$s is the discount amount ('15% off')
16031629 __ ( '%1$sSwitch to a yearly plan%2$s and get an instant %3$s on your payment. Contact us to reedem your deal ' , 'optimole-wp ' ),
16041630 '<span class=" text-promo-orange"> ' ,
16051631 '</span> ' ,
16061632 '<span class="text-promo-orange uppercase"> ' . __ ( '15% off ' , 'optimole-wp ' ) . '</span> '
16071633 );
1608- $ cta_link = esc_url_raw ( tsdk_utmify ( tsdk_translate_link ( self ::get_contact_base_link () ), 'bfcm25 ' , 'notice ' ) );
1634+ $ cta_link = esc_url_raw ( tsdk_utmify ( self ::get_contact_base_link (), 'bfcm25 ' , 'notice ' ) );
1635+ $ cta_link = add_query_arg (
1636+ [
1637+ 'contact_subject ' => rawurlencode ( 'Upgrade to yearly plan - Black Friday offer ' ),
1638+ 'contact_website ' => rawurlencode ( home_url () ),
1639+ ],
1640+ $ cta_link
1641+ );
16091642 $ cta_text = __ ( 'Contact us ' , 'optimole-wp ' );
16101643 }
16111644
1612- $ notices = [
1613- 'sidebar ' => [
1614- 'title ' => sprintf (
1615- '<span class="text-promo-orange">%1$s:</span> ' ,
1616- __ ( 'Private Sale ' , 'optimole-wp ' ),
1617- ),
1618- 'subtitle ' => sprintf (
1619- /* translators: 1 is the promo code, 2 is the discount amount ('25 off') */
1620- __ ( 'Use code %1$s for %2$s on yearly plans. ' , 'optimole-wp ' ),
1621- '<span class="border-b border-0 border-white border-dashed text-promo-orange">BFCM2425</span> ' ,
1622- '<span class="text-promo-orange uppercase"> ' . __ ( '25% off ' , 'optimole-wp ' ) . '</span> '
1623- ),
1624- 'cta_link ' => esc_url_raw ( tsdk_utmify ( tsdk_translate_link ( self ::get_upgrade_base_link () ), 'bfcm24 ' , 'sidebarnotice ' ) ),
1625- ],
1626- ];
1627-
1628- if ( get_option ( self ::BF_PROMO_DISMISS_KEY ) === 'yes ' ) {
1629- return $ notices ;
1630- }
1631-
16321645 $ notices ['banner ' ] = [
16331646 /* translators: number of days left */
16341647 'urgency ' => sprintf ( __ ( 'Hurry up! only %s left ' , 'optimole-wp ' ), human_time_diff ( $ end ->getTimestamp (), $ now ->getTimestamp () ) ),
0 commit comments