Turnstile Configuration Test

CHECKER_CAPTCHA_HELPER class not found. Please ensure the helper file is loaded.

'; return; } ?>

Turnstile Configuration Check

'checker', 'post_status' => 'publish', 'numberposts' => -1 ]); $total_checkers = count($checkers); $turnstile_enabled = 0; $turnstile_configured = 0; $results = []; echo "

Testing $total_checkers checkers...

"; foreach ($checkers as $checker) { $checker_id = $checker->ID; $checker_title = get_the_title($checker_id); $checker_data = get_post_meta($checker_id, 'checker', true); // Initialize result for this checker $result = [ 'id' => $checker_id, 'title' => $checker_title, 'has_security' => false, 'has_turnstile' => false, 'turnstile_enabled' => false, 'has_site_key' => false, 'has_secret_key' => false, 'site_key_format' => false ]; // Check if security data exists if (isset($checker_data['security'])) { $result['has_security'] = true; // Check if Turnstile data exists if (isset($checker_data['security']['turnstile'])) { $result['has_turnstile'] = true; $turnstile_data = $checker_data['security']['turnstile']; // Check if enabled if (isset($turnstile_data['enabled']) && $turnstile_data['enabled'] === 'yes') { $result['turnstile_enabled'] = true; $turnstile_enabled++; // Check site key if (isset($turnstile_data['site_key']) && !empty($turnstile_data['site_key'])) { $result['has_site_key'] = true; $site_key = $turnstile_data['site_key']; // Check format if (preg_match('/^0x4AAA[a-zA-Z0-9_-]{33}$/', $site_key)) { $result['site_key_format'] = true; $turnstile_configured++; } } // Check secret key if (isset($turnstile_data['secret_key']) && !empty($turnstile_data['secret_key'])) { $result['has_secret_key'] = true; } } } } $results[] = $result; } // Display summary echo "
"; echo "

Summary:

"; echo ""; echo "
"; // Display detailed results echo "

Detailed Results

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; foreach ($results as $result) { echo ""; echo ""; // Security Data echo ""; // Turnstile Data echo ""; // Turnstile Enabled echo ""; // Site Key echo ""; // Secret Key echo ""; // Key Format echo ""; echo ""; } echo ""; echo "
CheckerSecurity DataTurnstile DataTurnstile EnabledSite KeySecret KeyKey Format
" . esc_html($result['title']) . " (ID: {$result['id']})"; echo $result['has_security'] ? ' Yes' : ' No'; echo ""; echo $result['has_turnstile'] ? ' Yes' : ' No'; echo ""; echo $result['turnstile_enabled'] ? ' Enabled' : ' Disabled'; echo ""; if ($result['has_site_key']) { echo ' Present'; } else { echo ' Missing'; } echo ""; if ($result['has_secret_key']) { echo ' Present'; } else { echo ' Missing'; } echo ""; if ($result['site_key_format']) { echo ' Valid'; } else { echo ' Invalid'; } echo "
"; // Test helper methods echo "

CAPTCHA Helper Test

"; if ($turnstile_enabled > 0) { echo "

Testing CAPTCHA helper methods with first Turnstile-enabled checker...

"; // Find first Turnstile-enabled checker $test_checker = null; foreach ($results as $result) { if ($result['turnstile_enabled']) { $test_checker = $result; break; } } if ($test_checker) { echo "

Testing Checker: " . esc_html($test_checker['title']) . "

"; // Test get_captcha_config if (class_exists('CHECKER_CAPTCHA_HELPER')) { $config = CHECKER_CAPTCHA_HELPER::get_captcha_config($test_checker['id']); echo "
CAPTCHA Config:
"; echo "
";
                        print_r($config);
                        echo "
"; // Test validate_captcha_config $validation = CHECKER_CAPTCHA_HELPER::validate_captcha_config($test_checker['id']); echo "
Validation Result:
"; echo "
";
                        print_r($validation);
                        echo "
"; } } } else { echo "

No checkers with Turnstile enabled found to test.

"; } // Show debug info echo "

Debug Information

"; echo "

WordPress Version: " . get_bloginfo('version') . "

"; echo "

PHP Version: " . PHP_VERSION . "

"; echo "

Plugin Version: " . defined('SHEET_CHECKER_PRO_VERSION') ? SHEET_CHECKER_PRO_VERSION : 'Unknown' . "

"; // Check WordPress debug mode echo "

WordPress Debug: " . (WP_DEBUG ? 'Enabled' : 'Disabled') . "

"; echo "

WordPress Debug Log: " . (WP_DEBUG_LOG ? 'Enabled' : 'Disabled') . "

"; // Show last few error log entries if (WP_DEBUG && WP_DEBUG_LOG) { $log_file = WP_CONTENT_DIR . '/debug.log'; if (file_exists($log_file) && is_readable($log_file)) { echo "

Last 10 lines from debug log:

"; echo "
";
                    $lines = file($log_file);
                    $last_lines = array_slice($lines, -10);
                    echo htmlspecialchars(implode('', $last_lines));
                    echo "
"; } } ?>

Troubleshooting Tips

  1. If Turnstile appears enabled but not configured, check that both site key and secret key are set.
  2. If key format is invalid, ensure the key starts with "0x4AAA" and is 40 characters long.
  3. Check WordPress debug log for any errors related to Turnstile.
  4. Verify the Turnstile keys are correctly copied from the Cloudflare dashboard.
  5. If security data is missing, try resaving the checker settings.