| Server IP : 144.76.79.100 / Your IP : 216.73.216.103 [ Web Server : Apache System : Linux ch05.wehostwebserver.com 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64 User : razzlestore ( 1092) PHP Version : 8.2.29 Disable Function : NONE Domains : 343 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/cwd/wp-content/plugins/woo-stripe-payment/src/ |
Upload File : |
<?php
namespace PaymentPlugins\Stripe;
class RequestContext {
const CART = 'cart';
const CHECKOUT = 'checkout';
const ORDER_PAY = 'order_pay';
const ADD_PAYMENT_METHOD = 'add_payment_method';
const PRODUCT = 'product';
const SHOP = 'shop';
private $context;
private $props = [];
public function __construct( $context = '' ) {
$this->context = $context;
if ( ! $this->context ) {
$this->initialize();
}
}
public function initialize() {
if ( is_cart() ) {
$this->context = 'cart';
} elseif ( is_checkout() ) {
if ( is_checkout_pay_page() ) {
$this->context = self::ORDER_PAY;
} else {
$this->context = self::CHECKOUT;
}
} elseif ( is_add_payment_method_page() ) {
$this->context = self::ADD_PAYMENT_METHOD;
} elseif ( is_product() ) {
$this->context = self::PRODUCT;
} elseif ( is_shop() ) {
$this->context = self::SHOP;
}
}
public function set_prop( $key, $value ) {
$this->props[ $key ] = $value;
}
public function has_prop( $key ) {
return array_key_exists( $key, $this->props );
}
public function set_props( $props ) {
foreach ( $props as $key => $value ) {
$this->set_prop( $key, $value );
}
}
public function get_prop( $key ) {
if ( $this->has_prop( $key ) ) {
return $this->props[ $key ];
}
return null;
}
public function get_context() {
return $this->context;
}
public function is_cart() {
return $this->context === self::CART;
}
public function is_checkout() {
return $this->context === self::CHECKOUT;
}
public function is_order_pay() {
return $this->context === self::ORDER_PAY;
}
public function is_product() {
return $this->context === self::PRODUCT;
}
public function is_shop() {
return $this->context === self::SHOP;
}
public function is_add_payment_method() {
return $this->context === self::ADD_PAYMENT_METHOD;
}
}