' . esc_html__( 'Settings', 'rootcue' ) . '' ); return $links; } public static function settings(): void { register_setting( 'rootcue', RootCue_Settings::OPTION, array( 'type' => 'array', 'sanitize_callback' => array( 'RootCue_Settings', 'sanitize' ), 'show_in_rest' => false, ) ); } public static function privacy(): void { if ( function_exists( 'wp_add_privacy_policy_content' ) ) { wp_add_privacy_policy_content( 'RootCue', wp_kses_post( '
' . __( 'When a customer places an order or sends an enquiry, this site shares their name, phone number, email, the order reference and amount with RootCue (by RootPro Technologies) so that the business can follow up. RootCue does not send messages to customers on its own.', 'rootcue' ) . '
' ) ); } } public static function test_connection(): void { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Not allowed.', 'rootcue' ), 403 ); } check_admin_referer( 'rootcue_test' ); $r = RootCue_Client::post( array( 'type' => 'rootcue.ping' ) ); if ( $r['ok'] ) { $code = 'ok'; } elseif ( 401 === $r['status'] ) { $code = 'signature'; } elseif ( 0 === $r['status'] ) { $code = 'unreachable'; } else { $code = 'error'; } wp_safe_redirect( add_query_arg( array( 'page' => 'rootcue', 'rootcue_test' => $code, 'rootcue_status' => (int) $r['status'] ), admin_url( 'options-general.php' ) ) ); exit; } public static function page(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } $s = RootCue_Settings::all(); $test = isset( $_GET['rootcue_test'] ) ? sanitize_key( wp_unslash( $_GET['rootcue_test'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $msgs = array( 'ok' => array( 'success', __( 'Connected. RootCue accepted a signed test request.', 'rootcue' ) ), 'signature' => array( 'error', __( 'RootCue rejected the signature. Check that the signing secret matches the one shown in RootCue.', 'rootcue' ) ), 'unreachable' => array( 'error', __( 'Couldn\'t reach RootCue from this server. Check the webhook URL and that your host allows outgoing HTTPS.', 'rootcue' ) ), 'error' => array( 'error', __( 'RootCue returned an error. Check the webhook URL.', 'rootcue' ) ), ); $log = get_option( RootCue_Client::LOG_OPTION, array() ); ?> |