<?php function exkmo_scripts() { wp_enqueue_style('exkmo-style', get_stylesheet_uri(), [], '2.9.0'); } add_action('wp_enqueue_scripts', 'exkmo_scripts'); add_action('wp_ajax_nopriv_exkmo_contact', 'exkmo_contact_handler'); add_action('wp_ajax_exkmo_contact', 'exkmo_contact_handler'); function exkmo_contact_handler() { check_ajax_referer('exkmo_contact_nonce', 'nonce'); $name = sanitize_text_field($_POST['name'] ?? ''); $email = sanitize_email($_POST['email'] ?? ''); $service = sanitize_text_field($_POST['service'] ?? ''); $message = sanitize_textarea_field($_POST['message'] ?? ''); if (!$name || !is_email($email) || !$message) { wp_send_json_error(['message' => 'Invalid data']); } $to = 'contact@exkmo.com'; $subject = "New Project Inquiry: {$service} — {$name}"; $body = "Name: {$name}\nEmail: {$email}\nService: {$service}\n\nMessage:\n{$message}"; $headers = ['Content-Type: text/plain; charset=UTF-8', "Reply-To: {$email}"]; $sent = wp_mail($to, $subject, $body, $headers); if ($sent) { wp_send_json_success(); } else { wp_send_json_error(); } } add_theme_support('title-tag'); add_theme_support('html5', ['search-form', 'comment-form', 'gallery', 'caption']); add_theme_support('post-thumbnails'); // ── AutoPost Client Dashboard API ────────────────────────────────────────── // Prevent LiteSpeed from caching our REST endpoints add_action('init', function() { if (!empty($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/wp-json/autopost/') !== false) { do_action('litespeed_control_set_nocache', 'autopost_api'); } }); add_action('rest_api_init', function() { register_rest_route('autopost/v1', '/dashboard', [ 'methods' => 'GET', 'callback' => 'autopost_get_dashboard', 'permission_callback' => '__return_true', ]); register_rest_route('autopost/v1', '/status', [ 'methods' => 'POST', 'callback' => 'autopost_update_status', 'permission_callback' => '__return_true', ]); register_rest_route('autopost/v1', '/register', [ 'methods' => 'POST', 'callback' => 'autopost_register_client', 'permission_callback' => function($r) { return sanitize_text_field($r->get_param('admin_key') ?? '') === 'ap_admin_ex77k'; }, ]); }); function autopost_get_dashboard($request) { $token = sanitize_text_field($request->get_param('token')); if (empty($token)) return new WP_Error('missing_token', 'Token required', ['status' => 400]); $clients = get_option('autopost_clients', []); if (!isset($clients[$token])) return new WP_Error('invalid_token', 'Invalid token', ['status' => 401]); $client = $clients[$token]; $data = get_option('autopost_status_' . md5($token), []); $pending = ['status' => 'pending']; $response = new WP_REST_Response([ 'success' => true, 'client' => ['name' => $client['name'], 'tier' => $client['tier'], 'since' => $client['since']], 'workflows' => [ 'blog' => $data['blog'] ?? $pending, 'cre' => $data['cre'] ?? $pending, 'youtube' => $data['youtube'] ?? $pending, ], ], 200); $response->header('Cache-Control', 'no-store, no-cache, must-revalidate'); $response->header('Pragma', 'no-cache'); return $response; } function autopost_update_status($request) { $token = sanitize_text_field($request->get_param('token')); $workflow = sanitize_text_field($request->get_param('workflow')); $status = sanitize_text_field($request->get_param('status')); $message = sanitize_text_field($request->get_param('message') ?? ''); $last_run = sanitize_text_field($request->get_param('last_run') ?? ''); if (!$token || !$workflow || !$status) return new WP_Error('missing_params', 'token, workflow, status required', ['status' => 400]); $clients = get_option('autopost_clients', []); if (!isset($clients[$token])) return new WP_Error('invalid_token', 'Invalid token', ['status' => 401]); if (!in_array($workflow, ['blog','cre','youtube'])) return new WP_Error('invalid_workflow', 'workflow must be blog|cre|youtube', ['status' => 400]); $key = 'autopost_status_' . md5($token); $data = get_option($key, []); $data[$workflow] = [ 'status' => $status, 'message' => $message, 'last_run' => $last_run, 'updated_at' => gmdate('Y-m-d H:i:s'), ]; update_option($key, $data); return ['success' => true, 'workflow' => $workflow, 'status' => $status]; } function autopost_register_client($request) { $name = sanitize_text_field($request->get_param('name') ?? ''); $email = sanitize_email($request->get_param('email') ?? ''); $tier = sanitize_text_field($request->get_param('tier') ?? 'pro'); if (!$name || !$email) return new WP_Error('missing_params', 'name and email required', ['status' => 400]); $token = wp_generate_password(40, false); $clients = get_option('autopost_clients', []); $clients[$token] = ['name' => $name, 'email' => $email, 'tier' => $tier, 'since' => gmdate('Y-m-d')]; update_option('autopost_clients', $clients); return [ 'success' => true, 'token' => $token, 'dashboard_url' => home_url('/autopost-dashboard/?token=' . $token), ]; } // ============================================ // HOOK CRÍTICO: Fix links Kiwify /autopost/ // Substitui links antigos por novos antes de renderizar // Adicionado 30/Mai/2026 - OBRIGATÓRIO MANTER // ============================================ add_action('template_redirect', function() { if (!is_page('autopost') && !is_page(113)) return; // Substituir NO BUFFER ANTES de enviar ao navegador ob_start(function($buffer) { // Links PT $buffer = str_replace('AH2vSl7', 'Prh2dQE', $buffer); $buffer = str_replace('vHa9SRf', 'vAcMz1O', $buffer); $buffer = str_replace('rPjVl8A', 'fzm7slE', $buffer); // Preços $buffer = str_replace('R$147', 'R$147', $buffer); // manter PT return $buffer; }); }, -1); https://exkmo.com/post-sitemap.xml 2026-05-20T10:00:09+00:00 https://exkmo.com/page-sitemap.xml 2026-05-15T00:09:32+00:00 https://exkmo.com/category-sitemap.xml 2026-05-20T10:00:09+00:00