Plugin Directory

Changeset 3225972


Ignore:
Timestamp:
01/21/2025 07:30:27 AM (15 months ago)
Author:
ksherdev
Message:

add-nonce-and-support-woocommerce-block

Location:
ksher-payment
Files:
43 added
5 edited

Legend:

Unmodified
Added
Removed
  • ksher-payment/trunk/assets/js/upload.js

    r3206808 r3225972  
    6363          form_data.append("file", ksherPrivateKey);
    6464          form_data.append("action", "file_upload");
     65          form_data.append("security", ul.nonce);
    6566
    6667          $.ajax({
  • ksher-payment/trunk/ksher.php

    r3206808 r3225972  
    44    * Plugin URI:  https://www.ksher.com
    55    * Description: Ksher Gateway Plugin is a WordPress plugin designed specifically for WooCommerce. The plugin adds support for Ksher Payment Gateway payment method to WooCommerce.
    6     * Version:     1.1.2
     6    * Version:     1.1.3
    77    * Author:      Ksher
    88    * Text Domain: ksher
     
    6161    include('payment/set-payment.php');
    6262    include('order-received/order-received.php');
     63
     64    add_action('before_woocommerce_init', 'ksher_cart_checkout_blocks_compatibility');
     65    function ksher_cart_checkout_blocks_compatibility() {
     66        // Check if the required class exists
     67        if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) {
     68            // Declare compatibility for 'cart_checkout_blocks'
     69            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('cart_checkout_blocks', __FILE__, true);
     70        }
     71    }
     72
     73    add_action( 'woocommerce_blocks_loaded', 'ksher_register_order_approval_payment_method_type' );
     74    function ksher_register_order_approval_payment_method_type() {
     75        if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
     76            return;
     77        }
     78
     79        require_once plugin_dir_path(__FILE__) . 'ksher-block.php';
     80
     81        add_action(
     82            'woocommerce_blocks_payment_method_type_registration',
     83            function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     84                // Register an instance of My_Custom_Gateway_Blocks
     85                $payment_method_registry->register( new Ksher_Gateway_Blocks );
     86            }
     87        );
     88    }
     89
    6390}
  • ksher-payment/trunk/payment/set-payment.php

    r3206808 r3225972  
    1414    }
    1515
    16     if (get_option('ksher_connection') == 'success') {
     16   
    1717        // SET PAYMENT IN WOOCOMMARCE.
    18         add_filter( 'woocommerce_payment_gateways', 'ksher_add_gateway_class' );
    19         function ksher_add_gateway_class( $gateways )
    20         {
    21             $gateways[] = 'WC_Ksher_Gateway';
    22             return $gateways;
    23         }
    24 
    25         add_action( 'plugins_loaded', 'ksher_init_gateway_class' );
    26         function ksher_init_gateway_class()
    27         {
     18    add_filter( 'woocommerce_payment_gateways', 'ksher_add_gateway_class' );
     19    function ksher_add_gateway_class( $gateways )
     20    {
     21        $gateways[] = 'WC_Ksher_Gateway';
     22        return $gateways;
     23    }
     24
     25    add_action( 'plugins_loaded', 'ksher_init_gateway_class' );
     26    function ksher_init_gateway_class()
     27    {
    2828
    2929            class WC_Ksher_Gateway extends WC_Payment_Gateway
     
    7373
    7474                    $this->ktc_instal = $this->get_option( 'ktc_instal' );
    75           $this->instal_fee_payer = $this->get_option( 'instal_fee_payer' );
     75                    $this->instal_fee_payer = $this->get_option( 'instal_fee_payer' );
    7676                    $this->ktc_installment_period = $this->get_option( 'ktc_installment_period');
    7777
     
    8787                    $this->baybank_deeplink = $this->get_option( 'baybank_deeplink' );
    8888
    89                    
     89           
    9090
    9191                    add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
     
    611611                }
    612612            }
    613         }
    614613    }
     614   
    615615?>
  • ksher-payment/trunk/readme.txt

    r3206808 r3225972  
    66Requires PHP: 7.0
    77WooCommerce up to: 9.0.0
    8 Stable tag: 1.1.2
     8Stable tag: 1.1.3
    99License: GPLv2 or later
    1010
  • ksher-payment/trunk/setting/setting.php

    r3206808 r3225972  
    136136    {
    137137
     138        check_ajax_referer('ksher_nonce', 'security');
     139
     140
     141
    138142    if (!current_user_can('manage_options')) {
    139143        wp_die('Unauthorized', '403 Forbidden', ['response' => 403]);
Note: See TracChangeset for help on using the changeset viewer.