Plugin Directory

Changeset 3350251


Ignore:
Timestamp:
08/26/2025 09:50:08 AM (6 months ago)
Author:
neebplugins
Message:

Release 4.2.7

Location:
wc-thanks-redirect
Files:
286 added
7 edited

Legend:

Unmodified
Added
Removed
  • wc-thanks-redirect/trunk/readme.txt

    r3345455 r3350251  
    77Requires at least: 6.2
    88Tested up to: 6.8
    9 Stable tag: 4.2.6
    10 Version: 4.2.6
     9Stable tag: 4.2.7
     10Version: 4.2.7
    1111Requires PHP: 7.4
    1212License: GPLv2 or later
     
    656513- GTM DataLayer for Google Analytics
    6666
    67 14- Compatibility with PixelYourSite Facebook
     6714- Compatible with **PixelYourSite** Facebook
     68
     6915- **SandBox Payment Gateway** only available to administrators for simulating test order
    6870
    6971
     
    102104
    10310516 - **Optionally, you can choose between a classic or modern template for order details:**
    104 * For the classic template (default), use: **[TRFW_ORDER_DETAILS template="classic"]**
    105 * For the modern template, use: **[TRFW_ORDER_DETAILS template="modern"]**
     106For the classic template (default), use: **[TRFW_ORDER_DETAILS template="classic"]**
     107For the modern template, use: **[TRFW_ORDER_DETAILS template="modern"]**
    106108
    107109For complete documentation, please visit the <a target=_blank href="https://nitin247.com/docs/thank-you-page/">documentation page</a>.
     
    115117
    116118**Supercharge Your WooCommerce Order Approval Process!**
    117 Transform how you manage your orders with the <a target="_blank" href="https://wordpress.org/plugins/approve-orders/">Approve Orders for WooCommerce plugin</a>
     119Transform how you manage your orders with the <a target="_blank" href="https://wordpress.org/plugins/approve-orders/">Approve Orders for WooCommerce</a> plugin
    118120Easily **approve or reject orders** and streamline your workflow like never before.
    119121
     
    194196== Changelog ==
    195197
     198**V 4.2.7**
     199SandBox Payment Gateway for test payments
     200FIX per product redirect
     201PixelYourSite integration indicator
     202
    196203**V 4.2.6**
    197204Compatibility with PixelYourSite Facebook
     
    284291== Upgrade Notice ==
    285292
    286 = 4.2.6 =
    287 Compatibility with PixelYourSite Facebook
     293= 4.2.7 =
     294SandBox Payment Gateway + FIX per product redirect
  • wc-thanks-redirect/trunk/src/Admin.php

    r3245519 r3350251  
    3030    }
    3131
     32    /**
     33     * Constructor
     34     *
     35     * @since 4.1.6
     36     */
    3237    public function __construct() {
    3338
     
    4853        // Add Filter to append body class
    4954        add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
    50 
    51     }
    52 
     55    }
     56
     57    /**
     58     * Submenu entry
     59     *
     60     * @since 4.1.6
     61     *
     62     * @return void
     63     */
    5364    public function submenu_entry() {
    5465        add_submenu_page(
     
    6980    }
    7081
     82    /**
     83     * Settings Page
     84     *
     85     * @since 4.1.6
     86     *
     87     * @return string ob_get_clean
     88     */
    7189    public function settings_page( $settings, $current_section ) {
    7290        ob_start();
     
    7997        $tab = str_replace( 'wctr-', '', $tab );
    8098
    81         if ( $current_section === 'wctr' ) { //phpcs:ig
     99        if ( $current_section === 'wctr' ) { //phpcs:ignore
    82100
    83101            $settings_url = $setting_fields = $settings_end = array();
    84102
     103            $wctr_pys_active = class_exists( '\PixelYourSite\PYS' ) ? __( 'PixelYourSite integration is active, nothing needs to be done!', 'wc-thanks-redirect-pro' ) :__( 'Activate PixelYourSite to enable automatic PixelYourSite Integration', 'wc-thanks-redirect-pro' );         
     104           
    85105            $settings_tab = admin_url( 'admin.php?page=wc-settings&tab=products&section=wctr&wctr-tab=settings' );
    86106            $rules_tab    = admin_url( 'admin.php?page=wc-settings&tab=products&section=wctr&wctr-tab=rules' );
     
    145165
    146166                $settings_url[] = array(
     167                    'name'     => __( 'PixelYourSite Integration', 'wc-thanks-redirect-pro' ),
     168                    'desc_tip' => __( 'This will automatically activate the PixelYourSite Integration with Thank You Page', 'wc-thanks-redirect-pro' ),
     169                    'type'     => 'checkbox',
     170                    'default'  => class_exists( '\PixelYourSite\PYS' ) ? 'yes' : 'no',
     171                    'desc'     => $wctr_pys_active,
     172                    'disabled' => true,
     173                );
     174
     175                $settings_url[] = array(
    147176                    'name'              => __( 'WPML Translated URL', 'wc-thanks-redirect' ),
    148                     'desc_tip'          => __( 'WPML Translated URL is a PAID Feature. Please upgrade to <a href="' . esc_url( $wc_thanks_redirect_fs->get_upgrade_url() ) . '">PRO</a>', 'wc-thanks-redirect' ),
     177                    'desc_tip'          => __( 'WPML Translated URL is a PAID Feature. Please upgrade to <a href="' . esc_url( $wc_thanks_redirect_fs->get_upgrade_url() ) . '">Thank You Page PRO</a>', 'wc-thanks-redirect' ),
    149178                    'id'                => 'wctr_wpml_active',
    150179                    'type'              => 'checkbox',
     
    275304
    276305        ob_get_clean();
    277 
    278     }
    279 
     306    }
     307
     308    /**
     309     * Save custom settings
     310     *
     311     * @since 4.1.6
     312     *
     313     * @return void
     314     */
    280315    public function save_custom_settings( $post_id ) {
    281316
     
    304339    }
    305340
     341    /**
     342     * Admin Scripts
     343     *
     344     * @since 4.1.6
     345     *
     346     * @return void
     347     */
    306348    public function admin_scripts() {
    307349
    308         if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && isset( $_GET['section'] ) && 'wctr' === $_GET['section'] ) {
     350        if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && isset( $_GET['section'] ) && 'wctr' === $_GET['section'] ) { // phpcs:ignore
    309351
    310352            wp_enqueue_style( 'wctr-bootstrap', WCTR_PLUGIN_URL . 'assets/css/bootstrap.min.css', array(), '5.0.2' );
     
    342384    }
    343385
     386    /**
     387     * Remove WooCommerce Save Button
     388     *
     389     * @since 4.1.6
     390     *
     391     * @return void
     392     */
    344393    public function remove_woocommerce_save_button() {
    345394
    346         if ( isset( $_GET['page'] ) && isset( $_GET['wctr-tab'] ) && 'wc-settings' === $_GET['page'] ) {
     395        if ( isset( $_GET['page'] ) && isset( $_GET['wctr-tab'] ) && 'wc-settings' === $_GET['page'] ) { // phpcs:ignore
    347396            echo '<style> .notice, .update-nag { display: none !important; } </style>';
    348397
    349             if ( 'rules' === $_GET['wctr-tab'] ) {
     398            if ( 'rules' === $_GET['wctr-tab'] ) { // phpcs:ignore
    350399                echo '<style> .woocommerce-save-button { display: none; } </style>';
    351400            }
     
    353402    }
    354403
     404    /**
     405     * Settings products page
     406     *
     407     * @since 4.1.6
     408     *
     409     * @return void
     410     */
    355411    public function settings_products_page() {
    356412
     
    396452    }
    397453
     454    /**
     455     * Add body class
     456     *
     457     * @since 4.1.6
     458     *
     459     * @return string $classes
     460     */
    398461    public function admin_body_class( $classes ) {
    399462        $classes .= ' wctr-admin';
    400463        return $classes;
    401464    }
    402 
    403465}
  • wc-thanks-redirect/trunk/src/Api.php

    r3172621 r3350251  
    4949            array( $this, 'register_routes' )
    5050        );
    51 
    52     }
    53 
     51    }
     52
     53    /**
     54     * Register routes
     55     *
     56     * @since 4.1.6
     57     * @return void
     58     */
    5459    public function register_routes() {
    5560
     
    145150            )
    146151        );
    147 
    148     }
    149 
     152    }
     153
     154    /**
     155     * Save TY Rules
     156     *
     157     * @since 4.1.6
     158     *
     159     * @param \WP_REST_Request $request
     160     * @return \WP_REST_Response
     161     */
    150162    public function save_ty_rules( \WP_REST_Request $request ) {
    151163
     
    156168
    157169        return new \WP_REST_Response( $tyrules, 200 );
    158 
    159     }
    160 
     170    }
     171
     172    /**
     173     * Search product
     174     *
     175     * @since 4.1.6
     176     *
     177     * @return array @products
     178     */
    161179    public function search_product() {
    162180
    163         $keyword         = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : '';
    164         $variations_only = isset( $_GET['variations_only'] ) ? sanitize_text_field( $_GET['variations_only'] ) : false;
     181        $keyword         = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : ''; // phpcs:ignore
     182        $variations_only = isset( $_GET['variations_only'] ) ? sanitize_text_field( $_GET['variations_only'] ) : false; // phpcs:ignore
    165183
    166184        $products = Helper::search_product( $keyword, $variations_only );
    167185        return $products;
    168 
    169     }
    170 
     186    }
     187
     188    /**
     189     * Search category
     190     *
     191     * @since 4.1.6
     192     *
     193     * @return array @products
     194     */
    171195    public function search_category() {
    172196
    173         $keyword   = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : '';
    174         $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : 'post';
     197        $keyword   = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : ''; // phpcs:ignore
     198        $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : 'post'; // phpcs:ignore
    175199
    176200        $products = Helper::search_categories( $keyword, $post_type );
    177201        return $products;
    178 
    179     }
    180 
     202    }
     203
     204    /**
     205     * Search tags
     206     *
     207     * @since 4.1.6
     208     *
     209     * @return array @products
     210     */
    181211    public function search_tags() {
    182212
    183         $keyword   = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : '';
    184         $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : 'post';
     213        $keyword   = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : ''; // phpcs:ignore
     214        $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : 'post'; // phpcs:ignore
    185215
    186216        $products = Helper::search_tags( $keyword, $post_type );
    187217        return $products;
    188 
    189     }
    190 
     218    }
     219
     220    /**
     221     * Product details
     222     *
     223     * @since 4.1.6
     224     *
     225     * @param \WP_REST_Request $request
     226     * @return array \WP_REST_Response
     227     */
    191228    public function product_details( \WP_REST_Request $request ) {
    192229        // Get the product IDs from the request
     
    217254    }
    218255
     256    /**
     257     * Get post terms
     258     *
     259     * @since 4.1.6
     260     *
     261     * @param \WP_REST_Request $request
     262     * @return array \WP_REST_Response
     263     */
    219264    public function get_postterms( \WP_REST_Request $request ) {
    220265        // Get the product IDs from the request
     
    246291    }
    247292
     293    /**
     294     * Fetch TY Rules
     295     *
     296     * @since 4.1.6
     297     *
     298     * @return \WP_REST_Response
     299     */
    248300    public function fetch_ty_rules() {
    249301
    250302        $tyrules = get_option( $this->option, array() );
    251303        return new \WP_REST_Response( array( 'data' => $tyrules ), 200 );
    252 
    253     }
    254 
     304    }
     305
     306    /**
     307     * Get write api permission check
     308     *
     309     * @since 4.1.6
     310     *
     311     * @return boolean
     312     */
    255313    public function get_write_api_permission_check() {
    256314        return current_user_can( 'manage_options' ) ? true : false;
    257315    }
    258 
    259316}
    260 
  • wc-thanks-redirect/trunk/src/Front.php

    r3345455 r3350251  
    88namespace NeeBPlugins\Wctr;
    99
    10 // use NeeBPlugins\Wctr\Modules\Rules as TY_rules;
    1110use NeeBPlugins\Wctr\Compatibility\PYS_Tracking as Wctr_PYS;
     11use NeeBPlugins\Wctr\Modules\SandBoxPayment as WCTR_SandBoxPayment;
    1212
    1313class Front {
     
    2929    }
    3030
     31    /**
     32     * Constructor
     33     *
     34     * @since 4.1.6
     35     */
    3136    public function __construct() {
    3237        /* Add Plugin shortcode */
     
    3641        /* Add action for Footer */
    3742        add_action( 'wp_footer', array( $this, 'datalayer_purchase_event' ) );
     43        // Add the SandBox Payment gateway to the list of available payment gateways
     44        add_filter( 'woocommerce_payment_gateways', array( $this, 'add_sandbox_gateway' ) );
    3845        // Load tracking
    3946        $this->load_tracking();
     
    192199        $order_status = $order->get_status();
    193200
     201        $order_items = $order->get_items();
     202        $redirects   = array();
     203        $priority    = array();
     204
     205        foreach ($order_items as $key => $_item) { // phpcs:ignore
     206            $product_id              = $_item->get_product_id();
     207            $product_meta_thanks_url = get_post_meta( $product_id, 'wc_thanks_redirect_custom_thankyou', true );
     208
     209            if ( ! empty( $product_meta_thanks_url ) ) {
     210                $order_string  = "&order_key=$order_key";
     211                $thank_you_url = wp_parse_url( get_post_meta( $product_id, 'wc_thanks_redirect_custom_thankyou', true ) );
     212                $url_priority  = get_post_meta( $product_id, 'wc_thanks_redirect_url_priority', true );
     213
     214                $product_thanks = $thank_you_url['scheme'] . '://' . $thank_you_url['host'] . $thank_you_url['path'] . '?' . ( ! empty( $thank_you_url['query'] ) ? $thank_you_url['query'] : '' ) . $order_string;
     215                $product_failed = get_post_meta( $product_id, 'wc_thanks_redirect_custom_failure', true );
     216
     217                $priority['thankyou'] = $product_thanks;
     218                $priority['failed']   = $product_failed;
     219                $priority['priority'] = $url_priority;
     220
     221                $redirects[] = $priority;
     222
     223            }
     224        }
     225
     226        if ( ! empty( $redirects ) ) {
     227
     228            array_multisort( array_column( $redirects, 'priority' ), SORT_ASC, $redirects );
     229
     230            if ( $order_status !== 'failed' ) {
     231                    // Check If URL is valid
     232                if ( filter_var( $redirects[0]['thankyou'], FILTER_VALIDATE_URL ) ) {
     233                    wp_redirect( $redirects[0]['thankyou'] );
     234                    exit;
     235                }
     236            } else {
     237                // Check If URL is valid
     238                if ( filter_var( $redirects[0]['failed'], FILTER_VALIDATE_URL ) ) {
     239                    wp_redirect( $redirects[0]['failed'] );
     240                    exit;
     241                }
     242            }
     243        }
     244
    194245        if ( isset( $wctr_global ) && strtolower( $wctr_global ) === 'yes' ) {
    195246            $thank_you_url = get_option( 'wctr_thanks_redirect_url' );
     
    211262                exit;
    212263            }
    213         } else {
    214 
    215             $order_items = $order->get_items();
    216             $redirects   = array();
    217             $priority    = array();
    218 
    219             foreach ($order_items as $key => $_item) { // phpcs:ignore
    220                 $product_id              = $_item->get_product_id();
    221                 $product_meta_thanks_url = get_post_meta( $product_id, 'wc_thanks_redirect_custom_thankyou', true );
    222 
    223                 if ( ! empty( $product_meta_thanks_url ) ) {
    224                     $order_string  = "&order_key=$order_key";
    225                     $thank_you_url = wp_parse_url( get_post_meta( $product_id, 'wc_thanks_redirect_custom_thankyou', true ) );
    226                     $url_priority  = get_post_meta( $product_id, 'wc_thanks_redirect_url_priority', true );
    227 
    228                     $product_thanks = $thank_you_url['scheme'] . '://' . $thank_you_url['host'] . $thank_you_url['path'] . '?' . ( ! empty( $thank_you_url['query'] ) ? $thank_you_url['query'] : '' ) . $order_string;
    229                     $product_failed = get_post_meta( $product_id, 'wc_thanks_redirect_custom_failure', true );
    230 
    231                     $priority['thankyou'] = $product_thanks;
    232                     $priority['failed']   = $product_failed;
    233                     $priority['priority'] = $url_priority;
    234 
    235                     $redirects[] = $priority;
    236 
    237                 }
    238             }
    239 
    240             if ( ! empty( $redirects ) ) {
    241 
    242                 array_multisort( array_column( $redirects, 'priority' ), SORT_ASC, $redirects );
    243 
    244                 if ( $order_status !== 'failed' ) {
    245                         // Check If URL is valid
    246                     if ( filter_var( $redirects[0]['thankyou'], FILTER_VALIDATE_URL ) ) {
    247                         wp_redirect( $redirects[0]['thankyou'] );
    248                         exit;
    249                     }
    250                 } else {
    251                     // Check If URL is valid
    252                     if ( filter_var( $redirects[0]['failed'], FILTER_VALIDATE_URL ) ) {
    253                         wp_redirect( $redirects[0]['failed'] );
    254                         exit;
    255                     }
    256                 }
    257             }
    258264        }
    259265    }
     
    279285
    280286        // Fetch order data
    281         $order_items    = $order->get_items();
    282         $items_data     = array();
    283         $fb_content_ids = array();
    284         $fb_contents    = array();
     287        $order_items = $order->get_items();
     288        $items_data  = array();
    285289
    286290        foreach ( $order_items as $item_id => $item ) { // phpcs:ignore
     
    360364        }
    361365    }
     366
     367    /**
     368     * Add the SandBox gateway to the list of available payment gateways.
     369     *
     370     * @param array $gateways The list of available payment gateways.
     371     * @return array The list of available payment gateways with the SandBox gateway added.
     372     */
     373    public function add_sandbox_gateway( $gateways ) {
     374        $gateways[] = WCTR_SandBoxPayment::class;
     375        return $gateways;
     376    }
    362377}
  • wc-thanks-redirect/trunk/src/Helper.php

    r3172621 r3350251  
    8585    }
    8686
     87    /**
     88     * Get payment gateways
     89     *
     90     * @since 4.1.6
     91     * @return array
     92     */
    8793    public function get_payment_gateways() {
    8894        // Get available payment gateways
     
    105111    }
    106112
     113    /**
     114     * Search products
     115     *
     116     * @since 4.1.6
     117     * @param string $keyword
     118     * @param bool $variations_only
     119     * @return array
     120     */
    107121    public static function search_product( $keyword = '', $variations_only = false ) {
    108122        global $wpdb;
     
    188202    }
    189203
     204    /**
     205     * Search categories
     206     *
     207     * @since 4.1.6
     208     * @param string $search_term
     209     * @param string $post_type
     210     * @return array
     211     */
    190212    public static function search_categories( $search_term, $post_type = 'post' ) {
    191213
     
    211233    }
    212234
     235    /**
     236     * Search tags
     237     *
     238     * @since 4.1.6
     239     * @param string $search_term
     240     * @param string $post_type
     241     * @return array
     242     */
    213243    public static function search_tags( $search_term, $post_type = 'product' ) {
    214244
     
    242272    }
    243273
     274    /**
     275     * Search posts
     276     *
     277     * @since 4.1.6
     278     * @param string $search_term
     279     * @param string $post_type
     280     * @return array
     281     */
     282    public static function search_posts( $search_term, $post_type = 'product' ) {
     283
     284        // Sanitize the search term
     285        $search_term = sanitize_text_field( $search_term );
     286
     287        // Determine the taxonomy based on the post type
     288        $taxonomy = ( 'product' === $post_type ) ? 'product_tag' : 'post_tag';
     289
     290        // Get tags that match the search term
     291        $tags = get_terms(
     292            array(
     293                'taxonomy'   => $taxonomy,
     294                'name__like' => $search_term,
     295                'hide_empty' => false,
     296            )
     297        );
     298
     299        $results = array();
     300
     301        if ( ! empty( $tags ) ) {
     302            foreach ( $tags as $tag ) {
     303                $results[] = array(
     304                    'id'   => $tag->term_id,
     305                    'text' => $tag->name,
     306                );
     307            }
     308        }
     309
     310        return $results;
     311    }
     312
     313    /**
     314     * Product details
     315     *
     316     * @since 4.1.6
     317     * @param array $ids
     318     * @return array
     319     */
    244320    public static function product_details( $ids ) {
    245321        $products = array();
     
    268344
    269345        }
    270 
    271     }
    272 
     346    }
     347
     348    /**
     349     * Term details
     350     *
     351     * @since 4.1.6
     352     * @param array $ids
     353     * @param string $taxonomy
     354     * @return array
     355     */
    273356    public static function term_details( $ids, $taxonomy = 'product_cat' ) {
    274        
     357
    275358        $results  = array();
    276359        $term_ids = $ids;
     
    293376
    294377        return $results;
    295 
    296     }
    297 
     378    }
     379
     380    /**
     381     * Shorten array
     382     *
     383     * @since 4.1.6
     384     * @param array $input_array
     385     * @param string $key_field
     386     * @param string $value_field
     387     * @return array
     388     */
    298389    public function shorten( $input_array, $key_field, $value_field ) {
    299390        $shortened_array = array();
     
    307398        return $shortened_array;
    308399    }
    309 
    310400}
  • wc-thanks-redirect/trunk/src/Modules/Rules.php

    r3172621 r3350251  
    3232    }
    3333
     34    /**
     35     * Constructor
     36     *
     37     * @since 4.1.6
     38     */
    3439    public function __construct() {
    3540        // Define options and option groups
     
    140145    }
    141146
     147    /**
     148     * Create dropdown pages
     149     *
     150     * @since 4.1.6
     151     * @return string $html
     152     */
    142153    public function create_dropdown_pages() {
    143154        $html  = '<select name="rule_pages" class="form-select url-dropdown" required>';
  • wc-thanks-redirect/trunk/wc-thanks-redirect.php

    r3345455 r3350251  
    2727use NeeBPlugins\Wctr\Front as WctrFront;
    2828use NeeBPlugins\Wctr\Api as WctrApi;
     29use NeeBPlugins\Wctr\Compatibility\SandBoxPaymentBlocksSupport as WCTR_BlocksSupport;
    2930
    3031// Exit if accessed directly
    3132defined( 'ABSPATH' ) || die( 'WordPress Error! Opening plugin file directly' );
    3233
    33 defined( 'WCTR_VERSION' ) || define( 'WCTR_VERSION', '4.2.6' );
     34defined( 'WCTR_VERSION' ) || define( 'WCTR_VERSION', '4.2.7' );
    3435defined( 'WCTR_DIR' ) || define( 'WCTR_DIR', plugin_dir_path( __DIR__ ) );
    3536defined( 'WCTR_FILE' ) || define( 'WCTR_FILE', __FILE__ );
     
    114115        }
    115116
     117        /**
     118         * Constructor
     119         *
     120         * @since 4.1.7
     121         */
    116122        public function __construct() {
    117123            // Init plugin
     
    123129            // PRO Plugin Action links
    124130            add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
    125         }
    126 
     131            // Hook the custom function to the 'woocommerce_blocks_loaded' action
     132            add_action( 'woocommerce_blocks_loaded', array( $this, 'sandbox_payment_gateway' ) );
     133            // Hook the custom function to the 'woocommerce_blocks_loaded' action
     134            add_action( 'plugins_loaded', array( $this, 'load_backend' ) );
     135        }
     136
     137        /**
     138         * Before Plugin Load
     139         *
     140         * @since 4.1.7
     141         */
    127142        public function before_plugin_load() {
    128143
     
    138153        }
    139154
     155        /**
     156         * Run Plugin
     157         *
     158         * @since 4.1.7
     159         */
    140160        public function run_plugin() {
    141161            // Initialize Plugin Admin
     
    147167        }
    148168
     169        /**
     170         * HPOS Support
     171         *
     172         * @since 4.1.7
     173         * @return void
     174         */
    149175        public function hpos_support() {
    150176            if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     
    153179        }
    154180
     181        /**
     182         * Action Links
     183         *
     184         * @param array $links
     185         *
     186         * @return array
     187         * @since 4.1.7
     188         */
    155189        public function action_links( $links ) {
    156190            $upgrade_url = wc_thanks_redirect_fs()->get_upgrade_url();
     
    167201        }
    168202
     203        /**
     204         * Multisite admin notice
     205         *
     206         * @return void
     207         * @since 4.2.7
     208         * @access public
     209         */
    169210        public function multisite_admin_notice() {
    170211            echo '<div class="notice notice-error">';
    171212            echo '<p>' . wp_kses_post( __( 'Thank You Page for WooCommerce is not designed for Multisite, you may need to buy this short plugin. <a target="_blank" href="https://bit.ly/2RwaIQB">Thank You Page for WooCommerce PRO</a>!', 'wc-thanks-redirect' ) ) . '</p>';
    172213            echo '</div>';
     214        }
     215
     216        /**
     217         * SandBox Payment Gateway
     218         *
     219         * @return void
     220         * @since 4.2.7
     221         * @access public
     222         */
     223        public function sandbox_payment_gateway() {
     224            // Check if the required class exists
     225            if ( ! class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
     226                return;
     227            }
     228
     229            // Hook the registration function to the 'woocommerce_blocks_payment_method_type_registration' action
     230            add_action(
     231                'woocommerce_blocks_payment_method_type_registration',
     232                function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
     233                    // Register an instance of Pre Order Gateway
     234                    $payment_method_registry->register( new WCTR_BlocksSupport() );
     235                }
     236            );
     237        }
     238
     239        /**
     240         * Load Backend
     241         *
     242         * @return void
     243         * @since 4.2.7
     244         * @access public
     245         */
     246        public function load_backend() {
     247            add_filter(
     248                'woocommerce_payment_gateways',
     249                function ( $gateways ) {
     250                    $gateways[] = 'NeeBPlugins\Wctr\Modules\SandBoxPayment';
     251                    return $gateways;
     252                }
     253            );
    173254        }
    174255    }
Note: See TracChangeset for help on using the changeset viewer.