ed due to this is just checking for a set specific value. return isset( $_REQUEST['wcpay_mc_meta_helper'] ) && 1 === intval( $_REQUEST['wcpay_mc_meta_helper'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended } /** * Confirms that we should be working on this order. * * @param int|\WC_Order $order The order we're working with. * * @return bool|\WC_Order|\WC_Order_Refund Returns false or the order we're working with. */ private function confirm_actions( $order ) { // If the feature is not enabled, exit. if ( ! $this->is_feature_enabled() ) { return false; } // If it's actually not an order, or if it's not in a status that accepted a payment, exit. $order = wc_get_order( $order ); $paid_statuses = array_merge( wc_get_is_paid_statuses(), [ 'refunded' ] ); if ( ! $order || ! in_array( $order->get_status(), $paid_statuses, true ) ) { return false; } // If the store currency and the order currency match, do not display the box. $store_currency = get_woocommerce_currency(); $order_currency = $order->get_currency(); if ( $store_currency === $order_currency ) { return false; } return $order; } /** * Adds an error to the stack for us. * * @param string $error The error to add to the stack. * * @return void */ private function add_error( $error ) { // Refresh the errors, then add the new one. $this->get_errors(); $this->errors[] = $error; // Update the errors option. update_option( '_wcpay_multi_currency_order_meta_helper_errors', $this->errors ); } /** * Gets the errors from the options table. * * @return array The array of errors. */ private function get_errors(): array { // Get any errors from the database. $errors = array_filter( (array) get_option( '_wcpay_multi_currency_order_meta_helper_errors' ) ); // If we have any errors currently in our object, add those. if ( 0 < count( $this->errors ) ) { $errors = array_merge( $errors, $this->errors ); } // Add all the errors to the object, and return them. $this->errors = array_unique( $errors ); return $this->errors; } /** * Checks if we have any errors. * * @return bool */ private function has_errors(): bool { return 0 < count( $this->get_errors() ); } /** * Removes the errors from the object and deletes the database option. * * @return void */ private function clear_errors() { $this->errors = []; delete_option( '_wcpay_multi_currency_order_meta_helper_errors' ); } }