ID; } } return array_values( array_unique( array_filter( $ids ) ) ); } function aizone_is_investor_context() { if ( is_admin() ) { return false; } if ( is_front_page() ) { return true; } return is_page( aizone_investor_target_page_ids() ); } add_filter( 'body_class', function( $classes ) { if ( aizone_is_investor_context() ) { $classes[] = 'aizone-investor-active'; } return $classes; } ); add_action( 'wp_enqueue_scripts', function() { if ( ! aizone_is_investor_context() ) { return; } wp_enqueue_style( 'aizone-investor', content_url( 'mu-plugins/aizone-investor.css' ), [], filemtime( WPMU_PLUGIN_DIR . '/aizone-investor.css' ) ); }, 40 ); function aizone_investor_current_url() { $scheme = is_ssl() ? 'https://' : 'http://'; $host = $_SERVER['HTTP_HOST'] ?? parse_url( home_url(), PHP_URL_HOST ); $uri = $_SERVER['REQUEST_URI'] ?? '/'; return $scheme . $host . $uri; } function aizone_investor_deck_success_url() { $target = wp_get_referer(); if ( ! $target ) { $request_page = get_page_by_path( 'request-deck', OBJECT, 'page' ); $target = $request_page ? get_permalink( $request_page ) : home_url( '/request-deck/' ); } return add_query_arg( 'deck', 'requested', $target ); } function aizone_handle_deck_request_submission() { if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ?? '' ) ) { return; } if ( empty( $_POST['aizone_deck_form_submitted'] ) ) { return; } if ( empty( $_POST['aizone_deck_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['aizone_deck_nonce'] ) ), 'aizone_deck_request' ) ) { wp_die( esc_html__( 'Security check failed. Please refresh the page and try again.', 'twentytwentyfive' ) ); } $name = sanitize_text_field( wp_unslash( $_POST['name'] ?? '' ) ); $email = sanitize_email( wp_unslash( $_POST['email'] ?? '' ) ); $firm = sanitize_text_field( wp_unslash( $_POST['firm'] ?? '' ) ); $role = sanitize_text_field( wp_unslash( $_POST['role'] ?? '' ) ); $check_size = sanitize_text_field( wp_unslash( $_POST['check_size'] ?? '' ) ); $focus = sanitize_text_field( wp_unslash( $_POST['focus'] ?? '' ) ); $message = sanitize_textarea_field( wp_unslash( $_POST['message'] ?? '' ) ); if ( '' === $name || '' === $firm || ! is_email( $email ) ) { wp_safe_redirect( add_query_arg( 'deck', 'invalid', aizone_investor_current_url() ) ); exit; } $post_id = wp_insert_post( [ 'post_type' => 'lead_capture', 'post_status' => 'private', 'post_title' => trim( $firm . ' â ' . $name, ' â' ), ], true ); if ( is_wp_error( $post_id ) ) { wp_die( esc_html__( 'We could not save your request. Please try again.', 'twentytwentyfive' ) ); } update_post_meta( $post_id, '_lead_name', $name ); update_post_meta( $post_id, '_lead_email', $email ); update_post_meta( $post_id, '_lead_phone', '' ); update_post_meta( $post_id, '_lead_company', $firm ); update_post_meta( $post_id, '_lead_role', $role ); update_post_meta( $post_id, '_lead_check_size', $check_size ); update_post_meta( $post_id, '_lead_focus', $focus ); update_post_meta( $post_id, '_lead_message', $message ); update_post_meta( $post_id, '_lead_source', 'Investor deck request' ); wp_safe_redirect( aizone_investor_deck_success_url() ); exit; } add_action( 'init', 'aizone_handle_deck_request_submission', 60 ); function aizone_investor_deck_form_shortcode() { $status = sanitize_key( $_GET['deck'] ?? '' ); ob_start(); ?>