From 2d91aa7a4d2cf43ad02e518b289d78f1e5891bbd Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Tue, 16 Jul 2024 12:01:25 +0300 Subject: [PATCH] fix: `tsdk_support_url` fatal crash on cron --- includes/admin/class-rop-admin.php | 2 +- includes/class-rop-i18n.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-rop-admin.php b/includes/admin/class-rop-admin.php index 0fd4d1f7..4c7fef05 100644 --- a/includes/admin/class-rop-admin.php +++ b/includes/admin/class-rop-admin.php @@ -348,7 +348,7 @@ public function enqueue_scripts() { $rop_api_settings['license_data_view'] = $global_settings->get_license_data_view(); $rop_api_settings['license_type'] = $global_settings->license_type(); $rop_api_settings['fb_domain_toast_display'] = $this->facebook_exception_toast_display(); - $rop_api_settings['labels'] = Rop_I18n::get_labels(); + $rop_api_settings['labels'] = Rop_I18n::get_labels_frontend(); $rop_api_settings['upsell_link'] = Rop_I18n::UPSELL_LINK; $rop_api_settings['pro_installed'] = ( defined( 'ROP_PRO_VERSION' ) ) ? true : false; $rop_api_settings['show_li_app_btn'] = $li_service->rop_show_li_app_btn(); diff --git a/includes/class-rop-i18n.php b/includes/class-rop-i18n.php index a51b10bc..4049a2e9 100644 --- a/includes/class-rop-i18n.php +++ b/includes/class-rop-i18n.php @@ -384,7 +384,7 @@ public static function get_labels( $key = '' ) { 'tweet-old-post' ), 'rop_support' => __( 'Get Support', 'tweet-old-post' ), - 'rop_support_url' => defined( 'ROP_PRO_BASEFILE' ) ? tsdk_support_link( ROP_PRO_BASEFILE ) : '', + 'rop_support_url' => '', 'rop_facebook_domain_toast' => __( 'You need to verify your website domain with Facebook so your shares can show as article posts on Facebook. [ Read this doc ] for more information', 'tweet-old-post' @@ -502,5 +502,17 @@ public static function get_labels( $key = '' ) { return ''; } + /** + * Get the labels for the frontend (e.g. dashboard). + * + * @return array Localized labels. + */ + public static function get_labels_frontend() { + $labels = self::get_labels(); + // NOTE: `tsdk_support_link` must be run after `init` hook run and SDK Licenser module loading. + $labels['general']['rop_support_url'] = defined( 'ROP_PRO_BASEFILE' ) ? tsdk_support_link( ROP_PRO_BASEFILE ) : ''; + + return $labels; + } }