'string', 'sanitize_callback' => 'tarkle_send_sanitize_token', 'show_in_rest' => false, ) ); register_setting( 'tarkle-send-settings', 'tarkle_send_workspace_subdomain', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => false, ) ); register_setting( 'tarkle-send-settings', 'tarkle_send_custom_domain', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => false, ) ); add_settings_section( 'tarkle-send-settings', __( 'Workspace Configuration', 'tarkle-send' ), 'tarkle_send_settings_section_callback', 'tarkle-send-settings' ); add_settings_field( 'tarkle_send_connection_token', __( 'Secret Token', 'tarkle-send' ), 'tarkle_send_connection_token_field', 'tarkle-send-settings', 'tarkle-send-settings' ); add_settings_field( 'tarkle_send_workspace_subdomain', __( 'Workspace Subdomain', 'tarkle-send' ), 'tarkle_send_workspace_subdomain_field', 'tarkle-send-settings', 'tarkle-send-settings' ); add_settings_field( 'tarkle_send_custom_domain', __( 'Custom Domain (Optional)', 'tarkle-send' ), 'tarkle_send_custom_domain_field', 'tarkle-send-settings', 'tarkle-send-settings' ); } /** * Sanitize connection token input. * * @param string $value The input value. * @return string Sanitized value. */ function tarkle_send_sanitize_token( $value ) { if ( empty( $value ) ) { return ''; } // Allow only alphanumeric and underscores (standard for tokens) $sanitized = preg_replace( '/[^a-zA-Z0-9_]/', '', $value ); return trim( $sanitized ); } /** * Settings section callback. */ function tarkle_send_settings_section_callback() { echo wp_kses_post( sprintf( '
%s
', esc_html__( 'Paste your connection token from Tarkle Send Settings > Integrations > WordPress. This token securely connects your WordPress site to your Tarkle Send workspace.', 'tarkle-send' ) ) ); } /** * Connection token field callback. */ function tarkle_send_connection_token_field() { $value = esc_attr( get_option( 'tarkle_send_connection_token' ) ); ?>
.send.tarkle.com
[send_download slug="ABC123" text="Download" class="btn btn-primary"]
[send_transfer slug="ABC123" width="100%"]
[send_file_request slug="REQ456" width="100%" height="700px"]