getActiveCategories(); $saved_category = get_option( 'contai_site_category', '' ); $site_domain = wp_parse_url( home_url(), PHP_URL_HOST ); $default_email = 'info@' . preg_replace( '/^www\./', '', $site_domain ); // After a PRG redirect on validation error, the previously submitted values // arrive via the per-user transient (see contai_redirect_with_notice in // admin-ai-site-generator.php). The stash is already sanitized; re-display // directly without touching $_POST so the page works even after a refresh. $preserved_form_data = isset( $GLOBALS['contai_site_gen_preserved_form_data'] ) && is_array( $GLOBALS['contai_site_gen_preserved_form_data'] ) ? $GLOBALS['contai_site_gen_preserved_form_data'] : array(); $post = static function ( $key, $default = '' ) use ( $preserved_form_data ) { if ( isset( $preserved_form_data[ $key ] ) && $preserved_form_data[ $key ] !== '' ) { return $preserved_form_data[ $key ]; } return $default; }; $creditGuard = new ContaiCreditGuard(); $creditCheck = $creditGuard->validateCredits(); ?>