PluginProbe
Cashfree for WooCommerce / 4.8.1
Cashfree for WooCommerce v4.8.1
4.8.1 4.8.0 trunk 1.0 1.2 4.2.1 4.2.2 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.5.0 4.5.1 All 42 releases
cashfree / includes / class-wc-cashfree-api.php

class-wc-cashfree-api.php in Cashfree for WooCommerce 4.8.1, at includes/class-wc-cashfree-api.php

45 lines 800 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cashfree Api
4 */
5
6 defined( 'ABSPATH' ) || exit;
7
8 /**
9 * Cashfree Api dispatcher class.
10 */
11 class WC_Cashfree_Api {
12
13 /**
14 * Constructor.
15 *
16 * @param string $id Api identifier.
17 */
18 private $id;
19
20 public function __construct( $id ) {
21 $this->id = $id;
22
23 add_action( 'woocommerce_api_' . $this->id, array( $this, 'dispatch' ) );
24 }
25
26 /**
27 * Dispatch request.
28 */
29 public function dispatch() {
30 if ( ! empty( $_GET['action'] ) && ! empty( $_GET['order_key'] ) ) {
31 $tag = 'api_' . $this->id . '_' . wc_clean( wp_unslash( $_GET['action'] ) );
32 if ( has_action( $tag ) ) {
33 do_action(
34 $tag,
35 wc_clean( wp_unslash( $_REQUEST ) ),
36 wc_clean( wp_unslash( $_GET['order_key'] ) )
37 );
38 exit;
39 }
40 }
41
42 wp_die( esc_html__( 'Invalid URL.', 'cashfree' ) );
43 }
44 }
45