(int) ($traffic['sessions'] ?? 0), 'users' => (int) ($traffic['users'] ?? 0), 'impressions' => (int) ($totals['impressions'] ?? 0), 'clicks' => (int) ($totals['clicks'] ?? 0), 'avg_position' => (float) ($totals['position'] ?? 0.0), 'total_keywords' => (int) (count($search['rows'] ?? [])), ]; } public function render(array $payload): string { $cells = [ __('Sessions', 'thinkrank') => number_format_i18n((int) $payload['sessions']), __('Users', 'thinkrank') => number_format_i18n((int) $payload['users']), __('Impressions', 'thinkrank') => number_format_i18n((int) $payload['impressions']), __('Clicks', 'thinkrank') => number_format_i18n((int) $payload['clicks']), __('Avg. Position', 'thinkrank') => number_format_i18n((float) $payload['avg_position'], 1), __('Tracked Keywords', 'thinkrank') => number_format_i18n((int) $payload['total_keywords']), ]; $html = '
| '
. ' ' . esc_html($label) . ' '
. '' . esc_html($value) . ' '
. ' | ';
$i++;
}
$html .= '
' . esc_html__('Data temporarily unavailable. Please check your connected integrations.', 'thinkrank') . '
'; } }