api_base_url); } public static function get_instance() { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; } private function __construct() { // Check if cooldown expired and reset word count add_action('init', [$this, 'check_cooldown_expiry']); // Admin notices for cooldown add_action('admin_notices', [$this, 'show_cooldown_notices']); // Admin notices for license expired add_action('admin_notices', [$this, 'show_license_expired_notice']); // Word limit usage notices (80% warning + review nudge / 100% blocking warning) add_action('admin_notices', [$this, 'show_word_limit_notices']); // AJAX handler for dismissing license expired notice add_action('wp_ajax_aitrfoel_dismiss_license_expired', [$this, 'dismiss_license_expired_notice']); // AJAX handlers for dismissing word limit notices add_action('wp_ajax_aitrfoel_dismiss_80_notice', [$this, 'dismiss_80_notice']); add_action('wp_ajax_aitrfoel_dismiss_100_notice', [$this, 'dismiss_100_notice']); // Freemius activation hooks (initialize user in remote DB) add_action('aitrfoel_fs_loaded', [$this, 'init_freemius_hooks']); // Auto-register Free/unlicensed site in remote DB (once per month) add_action('admin_init', [$this, 'maybe_auto_register_free_user']); // Auto-sync plan on admin pages (checks once per hour) add_action('admin_init', [$this, 'maybe_sync_plan']); // AJAX handler for manual plan sync add_action('wp_ajax_aitrfoel_sync_plan', [$this, 'ajax_sync_plan']); } /** * Initialize Freemius hooks after SDK is loaded */ public function init_freemius_hooks() { if (function_exists('eatp_fs') && is_object(eatp_fs()) && method_exists(eatp_fs(), 'add_action')) { // When user opts in (connects Freemius account) - Free plan eatp_fs()->add_action('after_account_connection', [$this, 'on_freemius_connected']); // When user activates a paid license eatp_fs()->add_action('after_license_activation', [$this, 'on_license_activated']); // When user changes plan (upgrade/downgrade) eatp_fs()->add_action('after_plan_change', [$this, 'on_plan_changed'], 10, 2); // When license or plan is synced (e.g. "Sync License" button, cron, or account sync) eatp_fs()->add_action('after_account_plan_sync', [$this, 'on_account_plan_synced']); eatp_fs()->add_action('after_license_change', [$this, 'on_license_changed'], 10, 2); eatp_fs()->add_action('after_plans_sync', [$this, 'clear_status_cache']); } } /** * Get plan name directly from local Freemius SDK if active */ public function get_freemius_plan_name() { if (!function_exists('eatp_fs') || !is_object(eatp_fs())) { return null; } try { if (method_exists(eatp_fs(), 'is_registered') && eatp_fs()->is_registered()) { // Method 1: Check active license plan_id if (method_exists(eatp_fs(), '_get_license')) { $license = eatp_fs()->_get_license(); if ($license && !empty($license->plan_id) && method_exists(eatp_fs(), '_get_plan_by_id')) { $plan = eatp_fs()->_get_plan_by_id($license->plan_id); if ($plan && !empty($plan->name)) { return $plan->name; } } } // Method 2: Check get_plan_name() if (method_exists(eatp_fs(), 'get_plan_name')) { $plan_name = eatp_fs()->get_plan_name(); if (!empty($plan_name) && strtolower($plan_name) !== 'free' && strtolower($plan_name) !== 'plan_name') { return $plan_name; } } // Method 3: Check get_plan() if (method_exists(eatp_fs(), 'get_plan')) { $plan = eatp_fs()->get_plan(); if ($plan && !empty($plan->name)) { return $plan->name; } } } } catch (Exception $e) { // Ignore } return null; } /** * Get license key from Freemius (with caching to avoid repeated SDK calls) */ public function get_license_key() { // Return cached value if available if ($this->cached_license_key !== null) { return $this->cached_license_key; } // During background translation AJAX, avoid calling Freemius SDK $is_translation_ajax = defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action']) && in_array($_POST['action'], ['aitrfoel_translate_page', 'aitrfoel_process_bulk_batch']); if ($is_translation_ajax) { // Use cached value from WordPress options (set during admin page load) $cached_key = get_option('aitrfoel_cached_license_key', ''); $this->cached_license_key = $cached_key ?: null; return $this->cached_license_key; } // Normal flow: Get from Freemius (only in admin context) if (function_exists('eatp_fs') && is_object(eatp_fs()) && method_exists(eatp_fs(), 'is_registered') && eatp_fs()->is_registered()) { try { $license = eatp_fs()->_get_license(); if ($license && isset($license->secret_key)) { $this->cached_license_key = $license->secret_key; // Cache in WordPress options for AJAX use update_option('aitrfoel_cached_license_key', $this->cached_license_key, false); return $this->cached_license_key; } } catch (Exception $e) { if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Could not get Freemius license: ' . $e->getMessage(), 'warning'); } } } $this->cached_license_key = null; return null; } /** * Clear cached license status so the next call to get_license_status() re-fetches from server. */ public function clear_status_cache() { $this->cached_license_status = null; $this->cached_license_key = null; delete_transient('aitrfoel_license_status_cache'); delete_transient('aitrfoel_last_plan_sync_check'); delete_option('aitrfoel_cached_license_key'); } /** * Get current license status from server */ public function get_license_status() { // Return cached result if already fetched this request if ($this->cached_license_status !== null) { return $this->cached_license_status; } // PERFORMANCE: Check if there is a transient cache $cached = get_transient('aitrfoel_license_status_cache'); if ($cached !== false && is_array($cached)) { // Check if Freemius locally upgraded to a paid tier while transient was cached as Free $fs_plan = $this->get_freemius_plan_name(); $cached_is_free = empty($cached['plan']) || strtolower($cached['plan']) === 'free'; $fs_is_paid = !empty($fs_plan) && strtolower($fs_plan) !== 'free'; if ($fs_is_paid && $cached_is_free) { // Cache is stale - bust it $this->clear_status_cache(); } else { $this->cached_license_status = $cached; return $this->cached_license_status; } } $plan_name = 'Free'; $word_limit = 7200; // Get license key (uses cache during AJAX) $license_key = $this->get_license_key(); // Get REAL usage AND plan from server (server is source of truth) $server_usage = $this->get_usage_from_server($license_key); // Use plan and limit from server if available if (isset($server_usage['plan'])) { $plan_name = $server_usage['plan']; } // AUTHORITY OVERRIDE: If Freemius locally is registered with a verified paid plan, // but the remote server returned 'Free' or empty (e.g. before webhook arrival or delay), // Freemius's verified paid plan takes precedence! $fs_plan = $this->get_freemius_plan_name(); if (!empty($fs_plan) && strtolower($fs_plan) !== 'free') { if (empty($plan_name) || strtolower($plan_name) === 'free' || (strtolower($fs_plan) === 'agency lifetime' && strtolower($plan_name) !== 'agency lifetime')) { $plan_name = $fs_plan; // Dispatch update to remote server so DB is synced immediately if (!empty($license_key)) { $this->update_plan_in_remote_db($plan_name, $license_key); } } } if (isset($server_usage['word_limit']) && strtolower($plan_name) === strtolower($server_usage['plan'] ?? '')) { $word_limit = $server_usage['word_limit']; } else { // Calculate from authoritative plan name $word_limit = $this->get_word_limit_for_plan($plan_name); } // Add addon words to the effective limit when the 50K addon is active. $addon_words = 0; if (!empty($server_usage['addon_active']) && isset($server_usage['addon_words'])) { $addon_words = intval($server_usage['addon_words']); if ($word_limit !== -1) { $word_limit += $addon_words; } } $words_used = $server_usage['words_used']; $words_left = $word_limit === -1 ? -1 : max(0, $word_limit - $words_used); $is_unlimited = ($word_limit === -1 || strtolower($plan_name) === 'agency lifetime'); $cooldown_end = (int) get_option('aitrfoel_cooldown_end_date', 0); $cooldown_active = false; if (!$is_unlimited && strtolower($plan_name) === 'free') { $cooldown_active = isset($server_usage['cooldown_active']) ? (bool) $server_usage['cooldown_active'] : ($cooldown_end > 0 && $cooldown_end > time() && $words_used >= $word_limit); } $this->cached_license_status = [ 'plan' => $plan_name, 'word_limit' => $word_limit, 'words_used' => $words_used, 'words_left' => $words_left, 'license_key' => $license_key, 'unlimited' => $is_unlimited, 'is_unlimited' => $is_unlimited, 'freemius_validated' => isset($server_usage['freemius_validated']) ? $server_usage['freemius_validated'] : false, 'license_expired' => isset($server_usage['license_expired']) ? $server_usage['license_expired'] : false, 'addon_active' => isset($server_usage['addon_active']) ? (bool) $server_usage['addon_active'] : false, 'addon_words' => $addon_words, 'cooldown_active' => $cooldown_active, 'social_bonus_claimed' => isset($server_usage['social_bonus_claimed']) ? (bool) $server_usage['social_bonus_claimed'] : (bool) get_option('aitrfoel_share_bonus_claimed', false), ]; // Cache for 10 minutes to prevent excessive server requests on general page loads set_transient('aitrfoel_license_status_cache', $this->cached_license_status, 10 * MINUTE_IN_SECONDS); return $this->cached_license_status; } /** * Get usage from translation server */ private function get_usage_from_server($license_key = null) { try { $request_data = [ 'license_key' => $license_key, 'site_url' => home_url() ]; // Include addon license key if the 50K Words Pack addon is active if (function_exists('e50wp_fs')) { $addon_fs = e50wp_fs(); if (method_exists($addon_fs, '_get_license')) { $addon_license = $addon_fs->_get_license(); if ($addon_license && !empty($addon_license->secret_key)) { $request_data['addon_license_key'] = $addon_license->secret_key; } } } if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('🔍 Requesting usage from server: ' . $this->api_base_url . '/get-usage', 'info'); AITRFOEL_Logger::log('📦 Request data: ' . json_encode($request_data), 'info'); } $response = wp_remote_post($this->api_base_url . '/get-usage', [ 'timeout' => 5, 'body' => json_encode($request_data), 'headers' => [ 'Content-Type' => 'application/json' ] ]); if (is_wp_error($response)) { $error_msg = $response->get_error_message(); error_log('EAT: ❌ API Error: ' . $error_msg); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('❌ Failed to get usage from server: ' . $error_msg, 'warning'); } // Fallback to local cache $fallback_words = get_option('aitrfoel_words_used_this_month', 0); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('📊 Using local fallback: ' . $fallback_words . ' words', 'info'); } return ['words_used' => $fallback_words]; } $body = wp_remote_retrieve_body($response); $status_code = wp_remote_retrieve_response_code($response); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('📡 Server response status: ' . $status_code, 'info'); AITRFOEL_Logger::log('📄 Server response body: ' . $body, 'info'); } $data = json_decode($body, true); if (isset($data['success']) && $data['success']) { $words_used = isset($data['words_used']) ? intval($data['words_used']) : 0; if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('✅ Server returned words_used: ' . $words_used, 'info'); } // Cache the result locally for performance update_option('aitrfoel_words_used_this_month', $words_used); // Return full data including plan and word_limit from server $result = ['words_used' => $words_used]; if (isset($data['plan'])) { $result['plan'] = $data['plan']; } if (isset($data['word_limit'])) { $result['word_limit'] = intval($data['word_limit']); } // NEW: Handle Freemius validation fields if (isset($data['freemius_validated'])) { $result['freemius_validated'] = (bool) $data['freemius_validated']; } if (isset($data['license_expired'])) { $result['license_expired'] = (bool) $data['license_expired']; // If license expired, show admin notice if ($data['license_expired']) { set_transient('aitrfoel_license_expired', true, HOUR_IN_SECONDS); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('⚠️ License expired - downgraded to Free plan', 'warning'); } } else { // License is valid, clear any expired notice delete_transient('aitrfoel_license_expired'); } } // Handle addon boost fields if (isset($data['addon_active'])) { $result['addon_active'] = (bool) $data['addon_active']; } if (isset($data['addon_words'])) { $result['addon_words'] = intval($data['addon_words']); } // Sync social share bonus status from server (auto-heals any prior failed local locks) if (isset($data['social_bonus_claimed'])) { $result['social_bonus_claimed'] = (bool) $data['social_bonus_claimed']; if ($data['social_bonus_claimed'] === true) { if (!get_option('aitrfoel_share_bonus_claimed', false)) { update_option('aitrfoel_share_bonus_claimed', time()); } } elseif ($data['social_bonus_claimed'] === false && get_option('aitrfoel_share_bonus_claimed', false)) { delete_option('aitrfoel_share_bonus_claimed'); } } // Handle cooldown status from server (syncs when admin resets usage) if (isset($data['cooldown_active'])) { $result['cooldown_active'] = (bool) $data['cooldown_active']; if ($data['cooldown_active'] === true && isset($data['cooldown_ends_at'])) { // Server says cooldown is active - sync to local $cooldown_end = strtotime($data['cooldown_ends_at']); if ($cooldown_end && $cooldown_end > time()) { update_option('aitrfoel_cooldown_end_date', $cooldown_end); } } elseif ($data['cooldown_active'] === false) { // Server says NO cooldown - clear local (admin reset usage) $local_cooldown = get_option('aitrfoel_cooldown_end_date', 0); if ($local_cooldown > 0) { delete_option('aitrfoel_cooldown_end_date'); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('✅ Cooldown cleared - server confirmed no active cooldown', 'info'); } } } } return $result; } // Fallback to local cache $fallback_words = get_option('aitrfoel_words_used_this_month', 0); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('⚠️ Server response not successful, using local fallback: ' . $fallback_words . ' words', 'warning'); } return ['words_used' => $fallback_words]; } catch (Exception $e) { error_log('EAT: ❌ Exception: ' . $e->getMessage()); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('❌ Error getting usage from server: ' . $e->getMessage(), 'error'); } return ['words_used' => get_option('aitrfoel_words_used_this_month', 0)]; } } /** * Get total usage for a license across all sites (for multi-site licenses) * * @param string $license_key The license key to check * @return array Array with total_words_used, word_limit, active_sites, plan */ public function get_total_usage_for_license($license_key) { if (empty($license_key)) { return [ 'total_words_used' => 0, 'word_limit' => 7200, 'active_sites' => 1, 'plan' => 'Free' ]; } try { $response = wp_remote_post($this->api_base_url . '/get-license-usage', [ 'body' => json_encode(['license_key' => $license_key]), 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => $this->api_key ], 'timeout' => 15 ]); if (is_wp_error($response)) { AITRFOEL_Logger::log('❌ Error getting license usage: ' . $response->get_error_message(), 'error'); return [ 'total_words_used' => 0, 'word_limit' => 7200, 'active_sites' => 1, 'plan' => 'Free' ]; } $body = wp_remote_retrieve_body($response); $data = json_decode($body, true); if (isset($data['success']) && $data['success']) { return [ 'total_words_used' => $data['total_words_used'] ?? 0, 'word_limit' => $data['word_limit'] ?? 7200, 'active_sites' => $data['active_sites'] ?? 1, 'plan' => $data['plan'] ?? 'Free' ]; } return [ 'total_words_used' => 0, 'word_limit' => 7200, 'active_sites' => 1, 'plan' => 'Free' ]; } catch (Exception $e) { AITRFOEL_Logger::log('❌ Exception getting license usage: ' . $e->getMessage(), 'error'); return [ 'total_words_used' => 0, 'word_limit' => 7200, 'active_sites' => 1, 'plan' => 'Free' ]; } } /** * Translate text via your server */ public function translate_via_server($text, $source_language, $target_language) { // Get license info $license_status = $this->get_license_status(); // Prepare request data $request_data = [ 'text' => $text, 'source_language' => $source_language, 'target_language' => $target_language, 'site_url' => home_url(), 'plan' => $license_status['plan'], 'license_key' => $license_status['license_key'] ]; if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Sending translation request to server', 'info', [ 'word_count' => AITRFOEL_Translation_Engine::count_words($text), 'plan' => $license_status['plan'], 'text_preview' => substr($text, 0, 100) . '...' ]); } // Make request to hosted API $response = wp_remote_post($this->api_base_url . '/translate', [ 'headers' => [ 'Content-Type' => 'application/json', 'User-Agent' => 'ai-translator-for-elementor-and-polylang/' . (defined('AITRFOEL_VERSION') ? AITRFOEL_VERSION : '1.0') ], 'body' => json_encode($request_data), 'timeout' => 60 ]); if (is_wp_error($response)) { $error_msg = __('Failed to connect to translation service: ', 'ai-translator-for-elementor-and-polylang') . $response->get_error_message(); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log($error_msg, 'error'); } throw new Exception(esc_html($error_msg)); } $response_code = wp_remote_retrieve_response_code($response); $response_body = wp_remote_retrieve_body($response); // Log raw response for debugging if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('🔍 Translation API Response Status: ' . $response_code, 'info'); AITRFOEL_Logger::log('📄 Translation API Response Body: ' . $response_body, 'info'); } if ($response_code !== 200) { $error_data = json_decode($response_body, true); $error_message = isset($error_data['error']) ? $error_data['error'] : __('Translation service error', 'ai-translator-for-elementor-and-polylang'); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Translation API Error', 'error', [ 'status_code' => $response_code, 'error' => $error_message, 'full_response' => $response_body ]); } throw new Exception(esc_html($error_message)); } $data = json_decode($response_body, true); if (!isset($data['success']) || !$data['success']) { $error_msg = isset($data['error']) ? $data['error'] : __('Invalid response from translation service', 'ai-translator-for-elementor-and-polylang'); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Translation API Invalid Response', 'error', [ 'response_data' => $data, 'error' => $error_msg ]); } throw new Exception(esc_html($error_msg)); } if (!isset($data['translated_text'])) { $error_msg = __('No translated text in response', 'ai-translator-for-elementor-and-polylang'); if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Translation API Missing Field', 'error', [ 'response_data' => $data ]); } throw new Exception(esc_html($error_msg)); } // Update local cache with server usage if (isset($data['total_words_used'])) { if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('💾 Updating local cache: total_words_used = ' . $data['total_words_used'], 'info'); } update_option('aitrfoel_words_used_this_month', $data['total_words_used']); // Clear status cache to force fresh data on next read $this->clear_status_cache(); } else { if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('⚠️ WARNING: translate response missing "total_words_used" field!', 'warning'); AITRFOEL_Logger::log('📋 Available fields in response: ' . implode(', ', array_keys($data)), 'info'); } } if (class_exists('AITRFOEL_Logger')) { AITRFOEL_Logger::log('Translation completed successfully', 'info', [ 'words_used' => $data['words_used'] ?? 0, 'total_words_used' => $data['total_words_used'] ?? 0, 'translated_preview' => substr($data['translated_text'], 0, 100) . '...' ]); } return $data['translated_text']; } /** * Get word limit for plan */ private function get_word_limit_for_plan($plan_name) { $normalized = strtolower(trim((string) $plan_name)); $limits = [ 'free' => 7200, // Free: 7,200 words/month (1 site) 'starter' => 18000, // Starter: 18,000 words/month (1 site) 'professional' => 60000, // Professional: 60,000 words/month 'agency' => 89000, // Agency: 89,000 words/month (up to 10 sites, shared) 'agency lifetime' => -1, // Agency Lifetime: unlimited words (up to 50 sites) 'enterprise' => 355000, // Enterprise: 355,000 words/month (up to 50 sites, shared) ]; return $limits[$normalized] ?? 7200; } /** * Check if monthly cooldown expired and reset word count for free users * Also clear cooldown for paid plan users (they shouldn't have cooldown) */ public function check_cooldown_expiry() { $cooldown_end = get_option('aitrfoel_cooldown_end_date', 0); // If cooldown exists, check if user is on paid plan if ($cooldown_end > 0) { $license_status = $this->get_license_status(); $is_free_plan = ($license_status['plan'] === 'Free'); // IMPORTANT: Paid plans should NEVER have cooldown if (!$is_free_plan) { // Clear cooldown immediately for paid users delete_option('aitrfoel_cooldown_end_date'); return; } // For free users, check if cooldown expired if ($cooldown_end <= time()) { // Cooldown expired - the server is the source of truth for usage (monthly quota); // local count is only cleared if the server confirms words_used === 0. delete_option('aitrfoel_cooldown_end_date'); // Notify server about the reset $this->notify_server_of_cooldown_reset(); } } } /** * Notify server that monthly cooldown reset occurred */ private function notify_server_of_cooldown_reset() { try { $response = wp_remote_post($this->api_base_url . '/reset-usage', [ 'timeout' => 5, 'body' => json_encode([ 'site_url' => home_url(), 'reset_date' => gmdate('Y-m-d H:i:s'), 'event' => 'cooldown_reset' ]), 'headers' => [ 'Content-Type' => 'application/json' ] ]); if (!is_wp_error($response)) { $status_code = wp_remote_retrieve_response_code($response); $body = wp_remote_retrieve_body($response); $data = json_decode($body, true); // Handle server response - clear cooldown when server confirms reset if (isset($data['success']) && $data['success'] && isset($data['words_used']) && $data['words_used'] === 0) { delete_option('aitrfoel_cooldown_end_date'); update_option('aitrfoel_words_used_this_month', 0); } } else { error_log('EAT: Failed to notify server of reset: ' . $response->get_error_message()); } } catch (Exception $e) { error_log('EAT: Exception notifying server of reset: ' . $e->getMessage()); } } /** * Show cooldown admin notices */ public function show_cooldown_notices() { // If user has a paid/unlimited license, cooldown notices don't apply. // This handles the case where a site has both a free entry and a paid // license on the server — the free entry may trigger cooldown but the // paid license should take priority. $status = $this->get_license_status(); if ($status && ( (isset($status['word_limit']) && $status['word_limit'] === -1) || (isset($status['plan']) && $status['plan'] !== 'Free' && $status['plan'] !== 'Free User') )) { // Paid plan — clear any stale cooldown state and skip notice delete_transient('aitrfoel_cooldown_activated'); delete_option('aitrfoel_cooldown_end_date'); return; } // Check if cooldown was just activated if (get_transient('aitrfoel_cooldown_activated')) { delete_transient('aitrfoel_cooldown_activated'); $cooldown_end = get_option('aitrfoel_cooldown_end_date', 0); $days_left = ceil(($cooldown_end - time()) / DAY_IN_SECONDS); $upgrade_url = (function_exists('eatp_fs') && is_object(eatp_fs()) && method_exists(eatp_fs(), 'is_registered') && eatp_fs()->is_registered()) ? eatp_fs()->get_upgrade_url() : ((defined('AITRFOEL_VERSION_TYPE') && AITRFOEL_VERSION_TYPE === 'pro') ? 'https://meeptech.com/products/ai-translator-for-elementor-polylang/?utm_source=wp-plugin&utm_medium=free-plugin&utm_campaign=pro-upgrade#pricing' : 'https://meeptech.com/products/ai-translator-for-elementor-polylang/?utm_source=wp-plugin&utm_medium=cooldown-notice&utm_campaign=pro-upgrade#pricing'); echo '
' . esc_html__('Meep Translator: Monthly Limit Reached', 'ai-translator-for-elementor-and-polylang') . '
'; echo '' . sprintf( /* translators: %d: Number of days until word count resets */ esc_html__('You have used all 7,200 words in your free plan this month. Your word count will reset in %d days, or you can ', 'ai-translator-for-elementor-and-polylang'), absint($days_left) ); echo '' . esc_html__('upgrade now', 'ai-translator-for-elementor-and-polylang') . ''; echo ' ' . esc_html__('for immediate access to more words.', 'ai-translator-for-elementor-and-polylang') . '
'; echo '