Plugin Directory

Changeset 3256094


Ignore:
Timestamp:
03/14/2025 07:15:48 PM (13 months ago)
Author:
EmranAhmed
Message:

Release 3.1.0

Location:
woo-2checkout
Files:
111 added
57 edited

Legend:

Unmodified
Added
Removed
  • woo-2checkout/trunk/README.txt

    r3140508 r3256094  
    22Contributors: EmranAhmed, getwooplugins
    33Tags: 2checkout, 2checkout for woocommerce, 2checkout payment gateway, payment gateway, woocommerce payment gateway
    4 Stable tag: 3.0.3
     4Stable tag: 3.1.0
    55Requires PHP: 7.4
    6 Requires at least: 6.1
    7 Tested up to: 6.5
     6Requires at least: 6.4
     7Tested up to: 6.7
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1414
    1515=== How To Set up 2Checkout Payment Gateway for WooCommerce In WordPress  ===
     16
     17***NOTE:** 2Checkout MUST HAVE ENABLED **Dynamic Checkout** from their end. This Plugin Doesn't support 2Checkout **2Monetize** package*
    1618
    1719[youtube https://www.youtube.com/watch?v=zev3t0HnYyI]
     
    100102== Changelog ==
    101103
     104= 3.1.0 =
     105
     106* Add: WC 9.7+ compatibility.
     107* Add: WP 6.7+ compatibility.
     108
    102109= 3.0.3 =
    103110
  • woo-2checkout/trunk/build/convert-plus-block.asset.php

    r3140508 r3256094  
    1 <?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '3feed1c8c9f5d2c504d6');
     1<?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'b62da3c50bb637134eea');
  • woo-2checkout/trunk/build/convert-plus-block.js

    r3140508 r3256094  
    1 (()=>{"use strict";var e={20:(e,t,o)=>{var n=o(609),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,o){var n,s={},u=null,p=null;for(n in void 0!==o&&(u=""+o),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(p=t.ref),t)c.call(t,n)&&!a.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:r,type:e,key:u,ref:p,props:s,_owner:i.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},848:(e,t,o)=>{e.exports=o(20)},609:e=>{e.exports=window.React}},t={};const o=window.wp.i18n,n=window.wc.wcBlocksRegistry,r=window.wp.htmlEntities,s=window.wc.wcSettings,c="woo-2checkout",i=window.wp.element;var a=function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}(848);const u=(0,s.getPaymentMethodData)(c,{}),p=(0,r.decodeEntities)(u?.title||(0,o.__)("2Checkout","woo-2checkout")),d=(0,r.decodeEntities)(u?.order_button_text||(0,o.__)("Proceed to 2Checkout","woo-2checkout")),l=u?.icon_uri,_=u?.is_demo;function w(e){const{PaymentMethodLabel:t}=e.components;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t,{text:p})," ",(0,a.jsx)("img",{alt:p,className:"woo-2checkout-gateway-pay-image",src:l})]})}function f(e){return function(e){const{eventRegistration:t,emitResponse:o}=e,{onCheckoutFail:n}=t;(0,i.useEffect)((()=>{const e=n((({processingResponse:e})=>{const{paymentDetails:t,paymentStatus:n}=e;return"failure"!==n||{type:o.responseTypes.ERROR,message:t?.messages,messageContext:o.noticeContexts.PAYMENTS,retry:!0}}));return()=>{e()}}),[o.responseTypes.ERROR,o.responseTypes.SUCCESS,o.noticeContexts.PAYMENTS,n])}(e),(0,a.jsx)(m,{})}function m(){const e=(0,r.decodeEntities)(u.description||"");return _?(0,a.jsxs)(a.Fragment,{children:[e,(0,a.jsx)("br",{}),(0,a.jsx)("strong",{children:(0,o.__)("DEMO MODE ENABLED.","woo-2checkout")})," ",(0,o.__)("Use a","woo-2checkout")," ",(0,a.jsx)("a",{target:"_blank",href:"https://verifone.cloud/docs/2checkout/Documentation/09Test_ordering_system/01Test_payment_methods",rel:"noreferrer",children:(0,o.__)("test payment cards","woo-2checkout")})]}):e}function y(){return(0,a.jsx)(m,{})}const x={name:c,label:(0,a.jsx)(w,{}),content:(0,a.jsx)(f,{}),edit:(0,a.jsx)(y,{}),canMakePayment:function(){return!0},placeOrderButtonLabel:d,icons:null,ariaLabel:p,supports:{features:u.supports}};(0,n.registerPaymentMethod)(x)})();
     1(()=>{"use strict";var e={20:(e,t,o)=>{var n=o(609),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,o){var n,s={},u=null,p=null;for(n in void 0!==o&&(u=""+o),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(p=t.ref),t)c.call(t,n)&&!i.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:r,type:e,key:u,ref:p,props:s,_owner:a.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},609:e=>{e.exports=window.React},848:(e,t,o)=>{e.exports=o(20)}},t={};const o=window.wp.i18n,n=window.wc.wcBlocksRegistry,r=window.wp.htmlEntities,s=window.wc.wcSettings,c="woo-2checkout",a=window.wp.element;var i=function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}(848);const u=(0,s.getPaymentMethodData)(c,{}),{icon_uri:p,is_demo:l,title:_=(0,o.__)("2Checkout","woo-2checkout"),order_button_text:d=(0,o.__)("Proceed to 2Checkout","woo-2checkout"),description:w}=u,f=(0,r.decodeEntities)(_);function m(e){const{PaymentMethodLabel:t}=e.components;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t,{text:f})," ",(0,i.jsx)("img",{alt:f,className:"woo-2checkout-gateway-pay-image",src:p})]})}function y(){return l?(0,i.jsxs)(i.Fragment,{children:[w,(0,i.jsx)("br",{}),(0,i.jsx)("strong",{children:(0,o.__)("DEMO MODE ENABLED.","woo-2checkout")})," ",(0,o.__)("Use a","woo-2checkout")," ",(0,i.jsx)("a",{target:"_blank",href:"https://verifone.cloud/docs/2checkout/Documentation/09Test_ordering_system/01Test_payment_methods",rel:"noreferrer",children:(0,o.__)("test payment cards","woo-2checkout")})]}):w}function x(e){return function(e){const{eventRegistration:t,emitResponse:o}=e,{onCheckoutFail:n}=t;(0,a.useEffect)((()=>{const e=n((({processingResponse:e})=>{const{paymentDetails:t,paymentStatus:n}=e;return"failure"!==n||{type:o.responseTypes.ERROR,message:t?.messages,messageContext:o.noticeContexts.PAYMENTS,retry:!0}}));return()=>{e()}}),[o.responseTypes.ERROR,o.responseTypes.SUCCESS,o.noticeContexts.PAYMENTS,n])}(e),(0,i.jsx)(y,{})}function h(){return(0,i.jsx)(y,{})}const g={name:c,label:(0,i.jsx)(m,{}),content:(0,i.jsx)(x,{}),edit:(0,i.jsx)(h,{}),canMakePayment:function(){return!0},placeOrderButtonLabel:d,icons:null,ariaLabel:f,supports:{features:u.supports}};(0,n.registerPaymentMethod)(g)})();
  • woo-2checkout/trunk/changelog.txt

    r3140508 r3256094  
    1 == Payment Gateway - 2Checkout for WooCommerce ==
     1*** Payment Gateway - 2Checkout for WooCommerce ***
    22
    3 = 3.0.3 - 2024-08-21 =
     32025-03-15 - version 3.1.0
     4* Add - WC 9.7+ compatibility.
     5* Add - WP 6.7+ compatibility.
    46
     72024-08-21 - version 3.0.3
    58* Add - WC 9.1+ compatibility.
    69* Add - WP 6.6+ compatibility.
    710
    8 = 3.0.2 - 2024-05-05 =
    9 
     112024-05-05 - version 3.0.2
    1012* Add - WC 8.8+ compatibility.
    1113
    12 = 3.0.1 - 2024-04-17 =
    13 
     142024-04-17 - version 3.0.1
    1415* Add - WC 8.7+ compatibility.
    1516
    16 = 3.0.0 - 2024-02-29 =
    17 
     172024-02-29 - version 3.0.0
    1818* Add - Support WooCommerce High-performance order storage.
    1919* Add - Support WooCommerce Checkout Block.
  • woo-2checkout/trunk/includes/API.php

    r3140508 r3256094  
    11<?php
     2/**
     3 * 2Checkout Payment Gateway Integration.
     4 * This file contains the API class for integrating with the Verifone (2Checkout) payment gateway.
     5 * It provides functionality for secure payment processing, webhook handling, and signature validation
     6 * within the WordPress environment.
     7 *
     8 * @package    \StorePress\TwoCheckoutPaymentGateway
     9 * @version    1.0.0
     10 * @link       https://verifone.cloud/docs/2checkout/API-Integration
     11 * @since      1.0.0
     12 */
     13
     14declare( strict_types=1 );
    215
    316namespace StorePress\TwoCheckoutPaymentGateway;
    417
    518defined( 'ABSPATH' ) || die( 'Keep Silent' );
    6 
     19/**
     20 * API Class for 2Checkout Payment Gateway Integration
     21 *
     22 * This class handles API communication with the Verifone (2Checkout) payment gateway
     23 * within the WordPress environment. It handles API communication with the Verifone (2Checkout) payment gateway.
     24 *  Provides comprehensive functionality for payment processing, including:
     25 *  - JWT token generation
     26 *  - Signature validation
     27 *  - IPN (Instant Payment Notification) handling
     28 *  - LCN (License Change Notification) processing
     29 *  - Buy link generation
     30 *  - Security hash verification
     31 *
     32 *  This class supports modern hashing algorithms (SHA256/SHA3-256) and maintains
     33 *  backwards compatibility with legacy MD5 hashing where required.
     34 *
     35 * @package    StorePress\TwoCheckoutPaymentGateway
     36 * @since      1.0.0
     37 * @author     StorePress
     38 * @link       https://verifone.cloud/docs/2checkout/API-Integration/01Start-using-the-2Checkout-API/2Checkout-API-general-information/Migration_guide_SHA2_SHA3
     39 */
    740class API {
    841
    9     const POST   = 'POST';
    10     const GET    = 'GET';
    11     const PUT    = 'PUT';
     42
     43    use Common;
     44
     45    /**
     46     * HTTP POST method constant
     47     *
     48     * Used for creating new resources via the API.
     49     *
     50     * @var string
     51     */
     52    const POST = 'POST';
     53    /**
     54     * HTTP GET method constant
     55     *
     56     * Used for retrieving resources via the API.
     57     *
     58     * @var string
     59     */
     60    const GET = 'GET';
     61    /**
     62     * HTTP PUT method constant
     63     *
     64     * Used for updating existing resources via the API.
     65     *
     66     * @var string
     67     */
     68    const PUT = 'PUT';
     69    /**
     70     * HTTP DELETE method constant
     71     *
     72     * Used for removing resources via the API.
     73     *
     74     * @var string
     75     */
    1276    const DELETE = 'DELETE';
    1377
    14     protected $merchant_code;
    15 
    16     protected $secret_key;
    17 
    18     // https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/IPN_and_LCN_URL_settings
    19     // https://verifone.cloud/docs/2checkout/API-Integration/01Start-using-the-2Checkout-API/2Checkout-API-general-information/Migration_guide_SHA2_SHA3
    20     // protected $hashing_algorithm = 'md5'; // md5 is old and not recommended. use sha256 or sha3-256
    21 
    22     public function __construct( $merchant_code, $secret_key ) {
     78    /**
     79     * Merchant code for API authentication
     80     *
     81     * The unique identifier provided by 2Checkout/Verifone for merchant authentication.
     82     *
     83     * @var string
     84     * @access protected
     85     */
     86    protected string $merchant_code;
     87
     88    /**
     89     * Secret key for API authentication
     90     *
     91     * The secret key provided by 2Checkout/Verifone for secure API communication.
     92     *
     93     * @var string
     94     * @access protected
     95     */
     96    protected string $secret_key;
     97
     98    /**
     99     * Initialize the API client
     100     *
     101     * Creates a new instance of the API client with the provided authentication credentials.
     102     * This class supports modern hashing algorithms (SHA256/SHA3-256) for enhanced security,
     103     * deprecating the legacy MD5 hashing method.
     104     *
     105     * @param string $merchant_code The merchant code provided by Verifone/2Checkout.
     106     * @param string $secret_key   The secret key for API authentication.
     107     *
     108     * @see https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/IPN_and_LCN_URL_settings
     109     */
     110    public function __construct( string $merchant_code, string $secret_key ) {
    23111        $this->merchant_code = $merchant_code;
    24112        $this->secret_key    = $secret_key;
    25113    }
    26114
    27     public static function instance( $merchant_code, $secret_key ) {
     115    /**
     116     * Return singleton instance of Class.
     117     * The instance will be created if it does not exist yet.
     118     *
     119     * @param string $merchant_code The merchant code provided by Verifone/2Checkout.
     120     * @param string $secret_key The secret key for API authentication.
     121     *
     122     * @return self The main instance.
     123     * @since 1.0.0
     124     */
     125    public static function instance( string $merchant_code, string $secret_key ): self {
    28126        static $instance = null;
    29127
     
    35133    }
    36134
    37     public function get_hashing_algorithm( $data = false ) {
    38 
    39         if ( $data && ! empty( $data['SIGNATURE_SHA2_256'] ) ) {
     135    /**
     136     * Get the hashing algorithm based on signature presence
     137     *
     138     * Determines which hashing algorithm to use based on the presence of
     139     * different signature types in the provided data.
     140     *
     141     * @param array<string, string> $data The data array containing signature information or false.
     142     *
     143     * @return string The hashing algorithm to use ('sha256', 'sha3-256', or 'md5')
     144     * @since 1.0.0
     145     */
     146    public function get_hashing_algorithm( array $data = array() ): string {
     147
     148        if ( ! empty( $data['SIGNATURE_SHA2_256'] ) ) {
    40149            return 'sha256';
    41150        }
    42151
    43         if ( $data && ! empty( $data['SIGNATURE_SHA3_256'] ) ) {
     152        if ( ! empty( $data['SIGNATURE_SHA3_256'] ) ) {
    44153            return 'sha3-256';
    45154        }
     
    48157    }
    49158
    50     public function get_returned_hash( $data = false ) {
    51 
    52         if ( $data && ! empty( $data['SIGNATURE_SHA2_256'] ) ) {
     159    /**
     160     * Get the returned hash from the data
     161     *
     162     * Retrieves the appropriate hash value from the data array based on
     163     * available signature types.
     164     *
     165     * @param array<string, string> $data The data array containing hash information or false.
     166     *
     167     * @return string The hash value if found, null otherwise
     168     * @since 1.0.0
     169     */
     170    public function get_returned_hash( array $data = array() ): string {
     171
     172        if ( ! empty( $data['SIGNATURE_SHA2_256'] ) ) {
    53173            return $data['SIGNATURE_SHA2_256'];
    54174        }
    55175
    56         if ( $data && ! empty( $data['SIGNATURE_SHA3_256'] ) ) {
     176        if ( ! empty( $data['SIGNATURE_SHA3_256'] ) ) {
    57177            return $data['SIGNATURE_SHA3_256'];
    58178        }
     
    61181    }
    62182
    63     // https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/How-to-generate-a-JSON-Web-Token-JWT
    64     public function generate_jwt_token( $merchant_id, $iat, $exp, $buy_link_secret_word ) {
     183    /**
     184     *  Creates a JWT token using HS512 algorithm for secure API communication.
     185     *  The token includes header, payload, and signature components.
     186     *
     187     *  WooCommerce "JsonWebToken" Class can only generate token using HS256 algorithm.
     188     *
     189     * @param string $merchant_id Merchant ID.
     190     * @param int    $iat issued at, must be current timestamp since the UNIX epoch.
     191     * @param int    $exp expiration time, must be in UNIX timestamp format from future.
     192     * @param string $buy_link_secret_word Buy-link Secret Word.
     193     *
     194     * @return string
     195     * @see: https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/How-to-generate-a-JSON-Web-Token-JWT
     196     */
     197    public function generate_jwt_token( string $merchant_id, int $iat, int $exp, string $buy_link_secret_word ): string {
    65198
    66199        $header    = $this->encode(
     
    93226    }
    94227
    95     private function encode( $data ) {
     228    /**
     229     * Encode data for JWT token generation
     230     *
     231     * Encodes the provided data using base64 and replaces specific characters
     232     * to make it URL safe.
     233     *
     234     * @param string $data The data to encode.
     235     *
     236     * @return string The encoded data.
     237     * @access private
     238     * @since 1.0.0
     239     */
     240    private function encode( string $data ): string {
    96241
    97242        return str_replace(
     
    102247    }
    103248
    104     // https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/ConvertPlus_URL_parameters
    105     // https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/ConvertPlus_Buy-Links_Signature
    106     public function convertplus_buy_link_signature( $params, $buy_link_secret_word ) {
     249    /**
     250     * Generate signature for ConvertPlus buy link parameters
     251     *
     252     * Creates a signature for ConvertPlus buy link parameters using SHA256.
     253     * Only specific parameters are included in signature generation.
     254     *
     255     * @param array<string, mixed> $params               Array of buy link parameters.
     256     * @param string               $buy_link_secret_word Secret word for signature generation.
     257     *
     258     * @return string Generated signature hash
     259     *
     260     * @link https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/ConvertPlus_URL_parameters
     261     * @link https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/ConvertPlus_Buy-Links_Signature
     262     */
     263    public function convertplus_buy_link_signature( array $params, string $buy_link_secret_word ): string {
    107264
    108265        // ConvertPlus parameters that require a signature.
     
    110267            'return-url',
    111268            'return-type',
    112             //'back-url',
     269            // 'back-url',
    113270            'expiration',
    114271            'order-ext-ref',
     
    122279            'price',
    123280            'qty',
    124             //'tangible',
     281            // 'tangible',
    125282            'type',
    126283            'opt',
     
    145302    }
    146303
    147     public function convertplus_buy_link( $params, $merchant_code, $buy_link_secret_word ) {
     304    /**
     305     * Generate complete ConvertPlus buy link URL.
     306     *
     307     * Creates a complete checkout URL with all necessary parameters and signature.
     308     * Automatically sets expiration time if not provided.
     309     *
     310     * @param array<string, mixed> $params               Parameters for the buy link.
     311     * @param string               $merchant_code        Merchant identifier.
     312     * @param string               $buy_link_secret_word Secret word for signature.
     313     *
     314     * @return string Complete checkout URL
     315     */
     316    public function convertplus_buy_link( array $params, string $merchant_code, string $buy_link_secret_word ): string {
    148317
    149318        $pre_data = array( 'merchant' => $merchant_code );
     
    159328    }
    160329
    161     // https://knowledgecenter.2checkout.com/Documentation/07Commerce/2Checkout-ConvertPlus/How-to-use-2Checkout-Signature-Generation-API-Endpoint#PHP_23
    162     public function get_signature( $params, $buy_link_secret_word ) {
     330    /**
     331     * Get signature from 2Checkout API
     332     *
     333     * Retrieves a signature from the 2Checkout API using JWT authentication.
     334     * Handles error responses and notifications.
     335     *
     336     * @param array<string, mixed> $params               Parameters to be signed.
     337     * @param string               $buy_link_secret_word Secret word for JWT generation.
     338     *
     339     * @return string|false Signature if successful, false on failure
     340     *
     341     * @link https://knowledgecenter.2checkout.com/Documentation/07Commerce/2Checkout-ConvertPlus/How-to-use-2Checkout-Signature-Generation-API-Endpoint#PHP_23
     342     */
     343    public function get_signature( array $params, string $buy_link_secret_word ) {
    163344
    164345        $jwt_token = $this->generate_jwt_token( $this->merchant_code, time(), time() + 3600, $buy_link_secret_word );
     
    172353                    'merchant-token' => $jwt_token,
    173354                ),
    174                 'body'    => json_encode( $params ),
     355                'body'    => wp_json_encode( $params ),
    175356            )
    176357        );
     
    194375    }
    195376
    196     public function convertplus_serialize( $params ) {
     377    /**
     378     * Serialize parameters for signature generation
     379     *
     380     * Creates a serialized string from parameters for signature generation.
     381     * Sorts parameters by key and prepends length to values.
     382     *
     383     * @param array<string, mixed> $params Parameters to serialize.
     384     *
     385     * @return string Serialized parameter string
     386     */
     387    public function convertplus_serialize( array $params ): string {
    197388
    198389        ksort( $params );
     
    200391        $map_data = array_map(
    201392            function ( $value ) {
    202                 return strlen( $value ) . $value;
     393                $str_value = (string) $value;
     394                return strlen( $str_value ) . $str_value;
    203395            },
    204396            $params
     
    208400    }
    209401
    210     // https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/06Instant_Payment_Notification_%2528IPN%2529/Calculate-the-IPN-HASH-signature
    211     public function is_valid_ipn_lcn_hash( $post_data, $secret_key ) {
     402    /**
     403     * Validate IPN/LCN hash signature
     404     *
     405     * Verifies the authenticity of IPN (Instant Payment Notification) or
     406     * LCN (License Change Notification) requests.
     407     *
     408     * @param array<string, mixed> $post_data  POST data from the notification.
     409     * @param string               $secret_key Secret key for hash verification.
     410     *
     411     * @return bool True if hash is valid, false otherwise
     412     *
     413     * @link https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/06Instant_Payment_Notification_%2528IPN%2529/Calculate-the-IPN-HASH-signature
     414     */
     415    public function is_valid_ipn_lcn_hash( array $post_data, string $secret_key ): bool {
    212416
    213417        $ipn_hash = $this->get_returned_hash( $post_data );
     
    221425    }
    222426
    223     public function generate_base_string_for_hash( $params ) {
     427    /**
     428     * Generate base string for hash calculation
     429     *
     430     * Creates a base string from parameters for hash calculation.
     431     * Handles nested arrays and excludes hash-related parameters.
     432     *
     433     * @param array<string, mixed> $params Parameters to process.
     434     *
     435     * @return string Generated base string
     436     */
     437    public function generate_base_string_for_hash( array $params ): string {
    224438
    225439        $string = '';
     
    239453    }
    240454
    241     public function kses_receipt_response_allowed_html() {
     455    /**
     456     * Get allowed HTML tags for receipt response
     457     *
     458     * Defines the allowed HTML tags and their attributes for use in
     459     * receipt response sanitization.
     460     *
     461     * @return array<string, mixed>
     462     * @since 1.0.0
     463     */
     464    public function kses_receipt_response_allowed_html(): array {
    242465        return array(
    243466            'epayment' => array(),
     
    249472    }
    250473
    251     // https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/08License_Change_Notification_%2528LCN%2529/LCN-read-receipt-response-for-2Checkout
    252     // https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/IPN_and_LCN_URL_settings
    253     // https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/06Instant_Payment_Notification_%2528IPN%2529/Calculate-the-IPN-HASH-signature
    254     public function ipn_receipt_response( $post_data, $secret_key = false ) {
     474    /**
     475     * Generate IPN receipt response
     476     *
     477     * Creates a receipt response for IPN notifications in XML format.
     478     * Supports multiple hash algorithms (MD5, SHA256, SHA3-256).
     479     *
     480     * @param array<string, mixed> $post_data   POST data from the IPN.
     481     * @param string|bool          $secret_key Optional secret key, uses instance key if false.
     482     *
     483     * @return string|false XML receipt response or false on failure
     484     *
     485     * @link https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/08License_Change_Notification_%2528LCN%2529/LCN-read-receipt-response-for-2Checkout
     486     * @link https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/IPN_and_LCN_URL_settings
     487     * @link https://verifone.cloud/docs/2checkout/API-Integration/Webhooks/06Instant_Payment_Notification_%2528IPN%2529/Calculate-the-IPN-HASH-signature
     488     */
     489    public function ipn_receipt_response( array $post_data, $secret_key = false ) {
    255490        // <EPAYMENT>DATE|HASH</EPAYMENT>
    256491        // <sig algo="sha256" date="DATE">HASH</sig>
     
    261496        }
    262497
    263         // Response issuing date (server time) in the YmdHis format (ex: 20081117145935)
     498        // Response issuing date (server time) in the YmdHis format (ex: 20081117145935).
     499
    264500        $receipt_date = gmdate( 'YmdHis' );
    265501
     
    268504            $post_data['IPN_PNAME'][0],
    269505            $post_data['IPN_DATE'],
    270             // IPN date in the YmdHis format (ex: 20081117145935)
     506            // IPN date in the YmdHis format (ex: 20081117145935).
    271507            $receipt_date,
    272508        );
    273509
    274         // CUSTOM IPN AND LCN CONFIGURATIONS
     510        // CUSTOM IPN AND LCN CONFIGURATIONS.
    275511        if ( ! $secret_key ) {
    276512            $secret_key = $this->secret_key;
     
    296532            }
    297533
    298             // sha256 and sha3-256 .
     534            // sha256 and sha3-256.
    299535            return sprintf( '<sig algo="%s" date="%s">%s</sig>', $get_algo, $receipt_date, $receipt_hash );
    300536
     
    304540    }
    305541
    306     // https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/Signature_validation_for_return_URL_via_ConvertPlus
    307     // https://verifone.cloud/docs/2checkout/Documentation/07Commerce/InLine-Checkout-Guide/Signature_validation_for_return_URL_via_InLine_checkout
    308 
    309     public function generate_return_signature( $params, $buy_link_secret_word ) {
     542    /**
     543     * Generate return URL signature
     544     *
     545     * Creates a signature for return URL validation using SHA256.
     546     *
     547     * @param array<string, mixed> $params               Return URL parameters.
     548     * @param string               $buy_link_secret_word Secret word for signature.
     549     *
     550     * @return string|false Generated signature or false if parameters invalid.
     551     *
     552     * @link https://verifone.cloud/docs/2checkout/Documentation/07Commerce/2Checkout-ConvertPlus/Signature_validation_for_return_URL_via_ConvertPlus
     553     * @link https://verifone.cloud/docs/2checkout/Documentation/07Commerce/InLine-Checkout-Guide/Signature_validation_for_return_URL_via_InLine_checkout
     554     */
     555    public function generate_return_signature( array $params, string $buy_link_secret_word ) {
    310556
    311557        if ( empty( $params ) || empty( $params['signature'] ) ) {
     
    321567    }
    322568
    323     public function is_valid_return_signature( $params, $buy_link_secret_word ) {
     569    /**
     570     * Validate return URL signature
     571     *
     572     * Verifies the authenticity of return URL signatures.
     573     *
     574     * @param array<string, mixed> $params               Return URL parameters including signature.
     575     * @param string               $buy_link_secret_word Secret word for signature validation.
     576     *
     577     * @return bool True if signature is valid, false otherwise.
     578     *
     579     * @link https://verifone.cloud/docs/2checkout/Documentation/07Commerce/InLine-Checkout-Guide/Signature_validation_for_return_URL_via_InLine_checkout
     580     */
     581    public function is_valid_return_signature( array $params, string $buy_link_secret_word ): bool {
    324582
    325583        if ( empty( $params ) || empty( $params['signature'] ) ) {
  • woo-2checkout/trunk/includes/Common.php

    r3044506 r3256094  
    33 * Common Methods for Classes.
    44 *
    5  * @package    \StorePress\TwoCheckoutPaymentGateway
    6  * @since      1.0.0
     5 * @package    StorePress/TwoCheckoutPaymentGateway
     6 * @since      0.1.0
     7 * @version    0.1.0
    78 */
    89
     10declare( strict_types=1 );
     11
    912namespace StorePress\TwoCheckoutPaymentGateway;
    1013
     
    1215
    1316trait Common {
    14     /**
    15      * Return singleton instance of Class.
    16      * The instance will be created if it does not exist yet.
    17      *
    18      * @return self The main instance.
    19      * @since 1.0.0
    20      */
    21     final public static function instance(): self {
    22         static $instance = null;
    23         if ( is_null( $instance ) ) {
    24             $instance = new self();
    25         }
    26 
    27         return $instance;
     17
     18    /**
     19     * Get data if set, otherwise return a default value or null. Prevents notices when data is not set.
     20     *
     21     * @param mixed $variable      Variable.
     22     * @param mixed $default_value Default value.
     23     *
     24     * @return mixed
     25     * @since  1.0.0
     26     */
     27    public function get_var( $variable, $default_value = null ) {
     28        return true === isset( $variable ) ? $variable : $default_value;
     29    }
     30
     31    /**
     32     * Get $_GET data if set, otherwise return a default value or null. Prevents notices when data is not set.
     33     *
     34     * @param string $variable      Variable.
     35     * @param mixed  $default_value Default value.
     36     *
     37     * @return mixed
     38     * @since  1.0.0
     39     */
     40    public function http_get_var( string $variable = '', $default_value = null ) {
     41        $get_data = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     42        if ( $this->is_empty_string( $variable ) ) {
     43            return $this->is_empty_array( $get_data ) ? false : $get_data;
     44        }
     45        return $this->get_var( $get_data[ $variable ], $default_value );
     46    }
     47
     48    /**
     49     * Get $_POST data if set, otherwise return a default value or null. Prevents notices when data is not set.
     50     *
     51     * @param string $variable      Variable.
     52     * @param mixed  $default_value Default value.
     53     *
     54     * @return mixed
     55     * @since  1.0.0
     56     */
     57    public function http_post_var( string $variable = '', $default_value = null ) {
     58        $post_data = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing
     59        if ( $this->is_empty_string( $variable ) ) {
     60            return $this->is_empty_array( $post_data ) ? false : $post_data;
     61        }
     62        return $this->get_var( $post_data[ $variable ], $default_value );
    2863    }
    2964
     
    3166     * Create HTML Attributes from given array
    3267     *
    33      * @param array $attributes Attribute array.
    34      * @param array $exclude    Exclude attribute. Default array.
    35      *
    36      * @return string
     68     * @param array<string, mixed> $attributes Attribute array.
     69     * @param string[]             $exclude    Exclude attribute. Default array.
     70     *
     71     * @return string
     72     * @since  1.0.0
    3773     */
    3874    public function get_html_attributes( array $attributes, array $exclude = array() ): string {
    39 
    40         $attrs = array_map(
    41             function ( $key ) use ( $attributes, $exclude ) {
    42 
    43                 // Exclude attribute.
    44                 if ( in_array( $key, $exclude, true ) ) {
    45                     return '';
    46                 }
    47 
    48                 $value = $attributes[ $key ];
    49 
    50                 // If attribute value is null.
    51                 if ( is_null( $value ) ) {
    52                     return '';
    53                 }
    54 
    55                 // If attribute value is boolean.
    56                 if ( is_bool( $value ) ) {
    57                     return $value ? $key : '';
    58                 }
    59 
    60                 // If attribute value is array.
    61                 if ( is_array( $value ) ) {
    62                     $value = $this->get_css_classes( $value );
    63                 }
    64 
    65                 return sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $value ) );
    66             },
    67             array_keys( $attributes )
    68         );
    69 
    70         return implode( ' ', $attrs );
     75        $attrs = array();
     76
     77        foreach ( $attributes as $attribute_name => $attribute_value ) {
     78            // Exclude attribute.
     79            if ( in_array( $attribute_name, $exclude, true ) ) {
     80                continue;
     81            }
     82
     83            // Skip if attribute value is blank.
     84            if ( is_string( $attribute_value ) && $this->is_empty_string( $attribute_value ) ) {
     85                continue;
     86            }
     87
     88            // Skip if attribute value is null.
     89            if ( is_null( $attribute_value ) ) {
     90                continue;
     91            }
     92
     93            // Skip if attribute value is boolean false.
     94            if ( false === $attribute_value ) {
     95                continue;
     96            }
     97
     98            // If attribute is class and value is array.
     99            if ( is_array( $attribute_value ) ) {
     100                if ( 'class' === $attribute_name ) {
     101                    $attribute_value = $this->get_css_classes( $attribute_value );
     102                } else {
     103                    $attribute_value = wp_json_encode( $attribute_value );
     104                }
     105            }
     106
     107            // If attribute is boolean true only use attribute name.
     108            if ( true === $attribute_value ) {
     109                $attrs[] = sprintf( '%s', esc_attr( $attribute_name ) );
     110                continue;
     111            }
     112
     113            $attrs[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) );
     114        }
     115
     116        return implode( ' ', array_unique( $attrs ) );
    71117    }
    72118
     
    75121     * Generate Inline Style from array
    76122     *
    77      * @param array $inline_styles_array Inline style as array.
    78      *
    79      * @return string
    80      * @since      1.0.0
     123     * @param array<string, mixed> $inline_styles_array Inline style as array.
     124     *
     125     * @return string
     126     * @since  1.0.0
    81127     */
    82128    public function get_inline_styles( array $inline_styles_array = array() ): string {
    83 
    84129        $styles = array();
    85130
     
    88133                continue;
    89134            }
     135            if ( is_bool( $value ) ) {
     136                continue;
     137            }
     138
     139            if ( is_array( $value ) ) {
     140                continue;
     141            }
     142
     143            if ( is_string( $value ) && $this->is_empty_string( $value ) ) {
     144                continue;
     145            }
     146
    90147            $styles[] = sprintf( '%s: %s;', esc_attr( $property ), esc_attr( $value ) );
    91148        }
    92149
    93         return implode( ' ', $styles );
     150        return implode( ' ', array_unique( $styles ) );
    94151    }
    95152
     
    97154     * Array to css class.
    98155     *
    99      * @param array $classes_array css classes array.
    100      *
    101      * @return string
    102      * @since      1.0.0
     156     * @param array<int|string, ?mixed> $classes_array css classes array.
     157     *
     158     * @return string
     159     * @since  1.0.0
     160     * @example
     161     * <code>
     162     *   ['class-a', 'class-b']
     163     *   // or
     164     *   ['class-a'=>true, 'class-b'=>false, 'class-c'=>'', 'class-e'=>null, 'class-d'=>'hello']
     165     * </code>
    103166     */
    104167    public function get_css_classes( array $classes_array = array() ): string {
    105 
    106168        $classes = array();
    107 
    108169        foreach ( $classes_array as $class_name => $should_include ) {
    109 
    110             if ( empty( $should_include ) ) {
    111                 continue;
    112             }
    113 
    114             $classes[] = esc_attr( $class_name );
     170            // Is class assign by numeric array. Like: ['class-a', 'class-b'].
     171            if ( is_int( $class_name ) ) {
     172                if ( ! is_string( $should_include ) ) {
     173                    continue;
     174                }
     175
     176                if ( $this->is_empty_string( $should_include ) ) {
     177                    continue;
     178                }
     179
     180                $classes[] = $should_include;
     181                continue;
     182            }
     183
     184            if ( false === $should_include ) {
     185                continue;
     186            }
     187
     188            if ( is_string( $should_include ) && $this->is_empty_string( $should_include ) ) {
     189                continue;
     190            }
     191
     192            if ( is_null( $should_include ) ) {
     193                continue;
     194            }
     195
     196            if ( is_array( $should_include ) && $this->is_empty_array( $should_include ) ) {
     197                continue;
     198            }
     199
     200            // Is class assign by associative array.
     201            // Like: ['class-a'=>true, 'class-b'=>false, class-c'=>'', 'class-d'=>'hello', 'class-x'=>null, 'class-y'=>array()].
     202            $classes[] = $class_name;
    115203        }
    116204
     
    119207
    120208    /**
     209     * Check is string is empty.
     210     *
     211     * @param string $check_value Check value.
     212     *
     213     * @return bool
     214     */
     215    public function is_empty_string( string $check_value = '' ): bool {
     216        return 0 === strlen( trim( $check_value ) );
     217    }
     218
     219    /**
     220     * Check is array is all empty values.
     221     *
     222     * @param array<int|string, ?mixed> $items Check array.
     223     *
     224     * @return bool
     225     */
     226    public function is_array_each_empty_value( array $items = array() ): bool {
     227        $checked = array_map(
     228            function ( $value ) {
     229                if ( is_array( $value ) && ! $this->is_array_each_empty_value( $value ) ) {
     230                    return true;
     231                }
     232
     233                if ( is_string( $value ) && ! $this->is_empty_string( $value ) ) {
     234                    return true;
     235                }
     236
     237                if ( true === $value ) {
     238                    return true;
     239                }
     240
     241                return false;
     242            },
     243            $items
     244        );
     245
     246        return ! in_array( true, array_unique( $checked ), true );
     247    }
     248
     249    /**
     250     * Check numeric array is empty.
     251     *
     252     * @param array<int|string, ?mixed> $items Check array.
     253     *
     254     * @return bool
     255     */
     256    public function is_empty_array( array $items = array() ): bool {
     257        return 0 === count( $items );
     258    }
     259
     260    /**
     261     * Converts a bool to a 'yes' or 'no'.
     262     *
     263     * @param mixed $check_value Bool to convert. If a string is passed it will first be converted to a bool.
     264     *
     265     * @return string
     266     * @since 1.0.0
     267     */
     268    public function boolean_to_string( $check_value ): string {
     269        $value = $this->string_to_boolean( $check_value );
     270
     271        return true === $value ? 'yes' : 'no';
     272    }
     273
     274    /**
    121275     * Converts a string (e.g. 'yes' or 'no') to a bool.
    122      *
    123      * @param string|bool $value String to convert. If a bool is passed it will be returned as-is.
     276     * Recognizing words like Yes, No, Off, On, both string and native types of true and false,
     277     * and is not case-sensitive when validating strings.
     278     *
     279     * @param mixed $check_value String to convert. If a bool is passed it will be returned as-is.
    124280     *
    125281     * @return boolean
    126282     * @since      1.0.0
    127283     */
    128     public function string_to_boolean( $value ): bool {
    129         $value = $value ?? '';
    130 
    131         return is_bool( $value ) ? $value : ( 'yes' === strtolower( $value ) || 1 === $value || 'true' === strtolower( $value ) || '1' === $value );
    132     }
    133 
    134     /**
    135      * Converts a bool to a 'yes' or 'no'.
    136      *
    137      * @param bool|string $value Bool to convert. If a string is passed it will first be converted to a bool.
    138      *
    139      * @return string
    140      * @since 1.0.0
    141      */
    142     public function boolean_to_string( $value ): string {
    143         if ( ! is_bool( $value ) ) {
    144             $value = $this->string_to_boolean( $value );
    145         }
    146 
    147         return true === $value ? 'yes' : 'no';
    148     }
    149 
    150     /**
    151      * Generates a user-level error/warning/notice/deprecation message.
    152      *
    153      * Generates the message when `WP_DEBUG` is true.
    154      *
    155      * @param string $function_name The function that triggered the error.
    156      * @param string $message       The message explaining the error.
    157      *                              The message can contain allowed HTML 'a' (with href), 'code',
    158      *                              'br', 'em', and 'strong' tags and http or https protocols.
    159      *                              If it contains other HTML tags or protocols, the message should be escaped
    160      *                              before passing to this function to avoid being stripped {@see wp_kses()}.
    161      *
    162      * @since 1.0.0
    163      */
    164     public function trigger_error( string $function_name, string $message ) {
    165 
    166         // Bail out if WP_DEBUG is not turned on.
    167         if ( ! WP_DEBUG ) {
    168             return;
    169         }
    170 
    171         if ( function_exists( 'wp_trigger_error' ) ) {
    172             wp_trigger_error( $function_name, $message );
    173         } else {
    174 
    175             if ( ! empty( $function_name ) ) {
    176                 $message = sprintf( '%s(): %s', $function_name, $message );
    177             }
    178 
    179             $message = wp_kses(
    180                 $message,
    181                 array(
    182                     'a' => array( 'href' ),
    183                     'br',
    184                     'code',
    185                     'em',
    186                     'strong',
    187                 ),
    188                 array( 'http', 'https' )
    189             );
    190 
    191             // phpcs:ignore
    192             trigger_error( $message );
    193         }
    194     }
    195 
    196     /**
    197      * Prevent cloning.
    198      */
    199     private function __clone() {
    200     }
    201 
    202     /**
    203      * Prevent unserializing.
    204      */
    205     final public function __wakeup() {
    206         $this->trigger_error( __FUNCTION__, esc_html__( 'Unserializing instances of this class is forbidden.', 'woo-2checkout' ) );
    207         die();
     284    public function string_to_boolean( $check_value ): bool {
     285        return filter_var( $check_value, FILTER_VALIDATE_BOOLEAN );
    208286    }
    209287}
  • woo-2checkout/trunk/includes/ConvertPlus/ConvertPlus_Block.php

    r3044506 r3256094  
    66 * @since      1.0.0
    77 */
     8
     9declare( strict_types=1 );
    810
    911namespace StorePress\TwoCheckoutPaymentGateway\ConvertPlus;
     
    3032     * Selected Gateway
    3133     *
    32      * @var ConvertPlus_Gateway|ConvertPlus_Gateway_Pro Convert plus gateway class.
     34     * @var ConvertPlus_Gateway Convert plus gateway class.
    3335     */
    3436    protected $gateway;
     
    3638    /**
    3739     * Initializes the payment method type.
     40     *
     41     * @return void
    3842     */
    3943    public function initialize() {
    4044        $option         = sprintf( 'woocommerce_%s_settings', $this->get_name() );
    4145        $this->settings = get_option( $option, array() );
    42         $gateways       = WC()->payment_gateways->payment_gateways();
     46        $gateways       = WC()->payment_gateways()->payment_gateways();
    4347        $this->gateway  = $gateways[ $this->get_name() ];
    4448    }
     
    4650    /**
    4751     * Get gateway instance.
     52     *
     53     * @return ConvertPlus_Gateway
    4854     */
    4955    public function get_gateway() {
     
    6369     * Returns an array of key=>value pairs of data made available to the payment methods script.
    6470     *
    65      * @return array
     71     * @return array<string, mixed>
    6672     */
    6773    public function get_payment_method_data(): array {
     
    7076        return array(
    7177            'is_demo'           => wc_string_to_bool( $this->get_setting( 'demo', 'yes' ) ),
    72             // 'icon_width'        => $this->get_setting( 'icon_width', '50' ),
    7378            'icon_uri'          => $this->get_gateway()->get_icon_url(),
    7479            'order_button_text' => $this->get_setting( 'order_button_text', esc_html__( 'Proceed to 2Checkout', 'woo-2checkout' ) ),
     
    9398     * the frontend context
    9499     *
    95      * @return array
     100     * @return string[]
    96101     */
    97102    public function get_payment_method_script_handles(): array {
     103
    98104        $script_asset_path = woo_2checkout()->build_path() . '/convert-plus-block.asset.php';
    99105
  • woo-2checkout/trunk/includes/ConvertPlus/ConvertPlus_Gateway.php

    r3140508 r3256094  
    77 */
    88
     9declare( strict_types=1 );
     10
    911namespace StorePress\TwoCheckoutPaymentGateway\ConvertPlus;
    1012
    1113defined( 'ABSPATH' ) || die( 'Keep Silent' );
    1214
     15use StorePress\TwoCheckoutPaymentGateway\Common;
    1316use StorePress\TwoCheckoutPaymentGateway\Payment_Gateway;
    1417use WC_Order;
     18use WC_Order_Item_Product;
    1519
    1620/**
     
    2024 *
    2125 * @class       ConvertPlus_Gateway
    22  * @extends     Payment_Gateway
    2326 */
    2427class ConvertPlus_Gateway extends Payment_Gateway {
    2528
     29    use Common;
     30
    2631    /**
    2732     * Process after gateway redirect.
     
    3136    public function process_gateway_redirect() {
    3237
    33         $data = stripslashes_deep( $_GET ); // phpcs:ignore.
     38        $data = stripslashes_deep( $this->http_get_var() );
    3439
    3540        do_action( 'woo_2checkout_process_gateway_redirect', $data, $this );
     
    3843        nocache_headers();
    3944
    40         $this->log( "Gateway Redirect Response \n" . print_r( $data, true ) ); // phpcs:ignore.
     45        $this->log( 'Gateway Redirect Response:', $data );
    4146
    4247        if ( empty( $data['order-ext-ref'] ) ) {
     
    5459            }
    5560
    56             $this->log( "Gateway Return Signature: \n" . print_r( // phpcs:ignore.
    57                     array(
    58                         'wc generated' => $this->get_api()->generate_return_signature( $data, $this->buy_link_secret_word ),
    59                         '2co returned' => $data['signature'],
    60                     ), true ) );
     61            $this->log(
     62                'Gateway Return Signature',
     63                array(
     64                    'wc generated' => $this->get_api()->generate_return_signature( $data, $this->buy_link_secret_word ),
     65                    '2co returned' => $data['signature'],
     66                )
     67            );
    6168
    6269            if ( ! $this->get_api()->is_valid_return_signature( $data, $this->buy_link_secret_word ) ) {
     
    8895    public function process_gateway_ipn_response() {
    8996
    90         if ( ! $_POST ) { // phpcs:ignore
     97        if ( ! $this->http_post_var() ) {
    9198            return;
    9299        }
    93100
    94101        // Don't alter any value otherwise 2checkout hash won't be matched.
    95         $data = stripslashes_deep( $_POST ); // phpcs:ignore
     102        $data = stripslashes_deep( $this->http_post_var() );
    96103
    97104        do_action( 'woo_2checkout_gateway_process_ipn_response', $data, $this );
     
    104111        $ipn_receipt          = $this->get_api()->ipn_receipt_response( $data );
    105112
    106         // $this->log( "IPN Base String For Hash: \n" . print_r( $base_string_for_hash, true ) ); // phpcs:ignore
    107         $this->log( "IPN Response: \n" . print_r( $data, true ), 'info' ); // phpcs:ignore
    108         $this->log( "IPN receipt_response: \n" . print_r( $ipn_receipt, true ), 'info' ); // phpcs:ignore
     113        $this->log( 'IPN Response:', $data );
     114        $this->log( 'IPN receipt_response:', array( 'ipn_receipt' => $ipn_receipt ) );
    109115
    110116        if ( $ipn_receipt ) {
     
    117123                echo wp_kses( $ipn_receipt, $this->get_api()->kses_receipt_response_allowed_html() );
    118124                do_action( 'woo_2checkout_gateway_process_ipn_response_invalid_order', $data, $this );
    119                 $this->log( sprintf( 'Order# %d is not available.', $order_id ), 'error' );
     125                $this->log( sprintf( 'Order# %d is not available.', $order_id ) );
    120126                exit();
    121127            }
     
    171177
    172178                    default:
    173                         $this->log( sprintf( "IPN Response: ORDERSTATUS = %s \n", $data['ORDERSTATUS'] ) . print_r( $data, true ), 'info' ); // phpcs:ignore
     179                        $this->log( sprintf( "IPN Response: ORDERSTATUS = %s \n", $data['ORDERSTATUS'] ), $data );
    174180                        break;
    175181                }
     
    178184            echo wp_kses( $ipn_receipt, $this->get_api()->kses_receipt_response_allowed_html() );
    179185        } else {
    180             $this->log( 'No IPN Receipt Response Code Generated.', 'error' );
     186            $this->log( 'No IPN Receipt Response Code Generated.' );
    181187            echo 'No IPN Receipt Generated.';
    182188        }
     
    189195     * @param WC_Order $order Order.
    190196     *
    191      * @return mixed|null
    192      */
    193     public function get_checkout_order_received_url( WC_Order $order ) {
    194         $order_received_url = wc_get_endpoint_url( 'downloads', $order->get_id(), wc_get_page_permalink( 'my-account' ) );
     197     * @return string
     198     */
     199    public function get_checkout_order_received_url( WC_Order $order ): string {
     200        $order_received_url = wc_get_endpoint_url( 'downloads', (string) $order->get_id(), wc_get_page_permalink( 'my-account' ) );
    195201
    196202        if ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) || is_ssl() ) {
     
    206212     * Get Generated ConvertPlus URL.
    207213     *
    208      * @param array $parameters url params.
     214     * @param array<string, mixed> $parameters url params.
    209215     *
    210216     * @return string
     
    219225     * @param WC_Order $order Order.
    220226     *
    221      * @return mixed|null
    222      */
    223     public function payment_args( WC_Order $order ) {
    224 
    225         $ship_to_different_address = ! empty( $_POST['ship_to_different_address'] ) && ! wc_ship_to_billing_address_only(); // phpcs:ignore.
     227     * @return array<string, mixed>
     228     */
     229    public function payment_args( WC_Order $order ): array {
     230
     231        $is_ship_to_different_address = wc_string_to_bool( $this->http_post_var( 'ship_to_different_address', false ) );
     232
     233        $ship_to_different_address = $is_ship_to_different_address && ! wc_ship_to_billing_address_only();
    226234
    227235        $args = array();
     
    259267
    260268        if ( $order->has_billing_address() ) {
    261             $args['address']  = esc_html( $order->get_billing_address_1() );
    262             if( $order->get_billing_address_2() ){
     269            $args['address'] = esc_html( $order->get_billing_address_1() );
     270            if ( $order->get_billing_address_2() ) {
    263271                $args['address2'] = esc_html( $order->get_billing_address_2() );
    264272            }
     
    342350            foreach ( $order->get_items() as $item ) {
    343351
    344                 // $item = new WC_Order_Item_Product(); // WC_Order_Item
    345 
    346                 $product = $item->get_product();
     352                $item_id    = $item->get_id();
     353                $order_item = new WC_Order_Item_Product( $item_id );
     354                $product    = $order_item->get_product();
    347355
    348356                if ( ! $product ) {
     
    352360                $product_info['prod'][]  = $this->format_item_name( $item->get_name() );
    353361                $product_info['price'][] = $this->format_item_price( $order->get_item_total( $item ) );
    354                 $product_info['qty'][]   = $item->get_quantity(); // get_item_total
     362                $product_info['qty'][]   = $item->get_quantity();
    355363
    356364                if ( $product->is_downloadable() || $product->is_virtual() ) {
     
    388396            foreach ( $order->get_fees() as $item ) {
    389397
    390                 // new WC_Order_Item_Fee()
     398                // Item will be "new WC_Order_Item_Fee()".
     399
    391400                $product_info['type'][]         = 'tax';
    392401                $product_info['prod'][]         = $this->format_item_name( $item->get_name() );
     
    436445     * @param int $order_id Order ID.
    437446     *
    438      * @return array
     447     * @return array<string, mixed>
    439448     */
    440449    public function process_payment( $order_id ): array {
     
    443452        $parameters = $this->payment_args( $order );
    444453
    445         ksort( $parameters);
    446 
    447         $this->log( "PAYMENT ARGS:\n" . print_r( $parameters, true ) ); // phpcs:ignore.
     454        ksort( $parameters );
     455
     456        $this->log( 'PAYMENT ARGS:', $parameters );
    448457
    449458        $payment_url = $this->get_payment_url( $parameters );
    450459
    451         $this->log( "PAYMENT LINK:\n" . $payment_url ); // phpcs:ignore.
     460        $this->log( 'Generated PAYMENT LINK:', array( 'payment_link' => $payment_url ) );
    452461
    453462        if ( ! empty( $payment_url ) ) {
     463
    454464            return array(
    455465                'result'   => 'success',
  • woo-2checkout/trunk/includes/Extended_Plugin_Upgrade_Notice.php

    r3044506 r3256094  
    66 * @since      1.0.0
    77 */
     8
     9declare( strict_types=1 );
    810
    911namespace StorePress\TwoCheckoutPaymentGateway;
     
    3840     */
    3941    public function plugin_file(): string {
    40         return 'woo-2checkout-pro/woo-2checkout-pro.php';
     42        return woo_2checkout()->get_pro_plugin_file();
    4143    }
    4244
     
    5658     */
    5759    public function deactivate_incompatible(): bool {
    58         return false;
     60        return true;
    5961    }
    6062
  • woo-2checkout/trunk/includes/Payment_Gateway.php

    r3081706 r3256094  
    66 */
    77
     8declare( strict_types=1 );
     9
    810namespace StorePress\TwoCheckoutPaymentGateway;
    911
     
    2022 *
    2123 * @class       Payment_Gateway
    22  * @extends     WC_Payment_Gateway
    2324 */
    2425class Payment_Gateway extends WC_Payment_Gateway {
     
    136137    public function hook() {
    137138
     139        // @phpstan-ignore-next-line
    138140        add_action(
    139141            'woocommerce_update_options_payment_gateways_woo-2checkout',
     
    211213        $icon_url = $this->get_icon_url();
    212214
    213         return sprintf( '<img class="woo-2checkout-gateway-pay-image" alt="%s" src="%s" style="width: %d%%" />', esc_attr( $this->order_button_text ), esc_url( $icon_url ), absint( $this->icon_width ) );
     215        return sprintf( '<img class="woo-2checkout-gateway-pay-image" alt="%s" src="%s" style="width: %d%%" />', esc_attr( $this->order_button_text ), esc_url( $icon_url ), absint( $this->icon_width ) ); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
    214216    }
    215217
     
    227229     *
    228230     * Add an array of fields to be displayed on the gateway's settings screen.
     231     *
     232     * @return void
    229233     */
    230234    public function init_form_fields() {
     
    354358     * Generate Select HTML.
    355359     *
    356      * @param string $key  Field key.
    357      * @param array  $data Field data.
     360     * @param string               $key  Field key.
     361     * @param array<string, mixed> $data Field data.
    358362     *
    359363     * @return string
     
    381385        <tr>
    382386            <th scope="row" class="titledesc">
    383                 <label
    384                     for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?><?php echo $this->get_tooltip_html( $data ); // phpcs:ignore ?></label>
     387                <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?><?php echo $this->get_tooltip_html( $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label>
    385388            </th>
    386389            <td class="forminp">
    387390                <fieldset>
    388                     <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span>
    389                     </legend>
     391                    <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
    390392                    <select class="select <?php echo esc_attr( $data['class'] ); ?>"
    391393                            name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>"
    392                             style="<?php echo esc_attr( $data['css'] ); ?>" <?php echo $this->get_custom_attribute_html( $data ); // phpcs:ignore ?>>
     394                            style="<?php echo esc_attr( $data['css'] ); ?>" <?php echo $this->get_custom_attribute_html( $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
    393395                        <?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
    394396                            <option
    395                                 <?php
    396                                 disabled( $data['disabled'], true );
    397                                 ?>
     397                                <?php disabled( $data['disabled'] ); ?>
    398398                                value="<?php echo esc_attr( $option_key ); ?>"
    399                                 <?php
    400                                 selected( (string) $option_key, esc_attr( $value ) );
    401                                 ?>
     399                                <?php selected( (string) $option_key, esc_attr( $value ) ); ?>
    402400                            ><?php echo esc_html( $option_value ); ?></option>
    403401                        <?php endforeach; ?>
    404402                    </select>
    405                     <?php echo $this->get_description_html( $data ); // phpcs:ignore ?>
     403                    <?php echo $this->get_description_html( $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
    406404                </fieldset>
    407405            </td>
     
    640638    /** Log
    641639     *
    642      * @param string $message log message.
    643      * @param string $level   log label.
    644      *                        'emergency': System is unusable.
    645      *                        'alert': Action must be taken immediately.
    646      *                        'critical': Critical conditions.
    647      *                        'error': Error conditions.
    648      *                        'warning': Warning conditions.
    649      *                        'notice': Normal but significant condition.
    650      *                        'info': Informational messages.
    651      *                        'debug': Debug-level messages.
    652      */
    653     public function log( string $message, string $level = 'info' ) {
    654 
     640     * @param string                   $title   log title.
     641     * @param array<string|int, mixed> $message log message.
     642     *
     643     * @return void
     644     */
     645    public function log( string $title, array $message = array() ) {
    655646        if ( ! $this->debug ) {
    656647            return;
    657648        }
    658649
    659         $context = array( 'source' => $this->get_id() );
    660 
    661         $this->log->log( $level, $message, $context );
     650        $context = array(
     651            'source' => $this->get_id(),
     652        );
     653
     654        wc_get_logger()->info( $title, array_merge( $message, $context ) );
    662655    }
    663656
     
    770763        $secret_key           = sprintf( 'woocommerce_%s_secret_key', $this->get_id() );
    771764        $buy_link_secret_word = sprintf( 'woocommerce_%s_buy_link_secret_word', $this->get_id() );
    772         $data                 = stripslashes_deep( $_POST ); // phpcs:ignore
     765        $data                 = stripslashes_deep( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
    773766
    774767        if ( ! empty( $data[ $merchant_code ] ) && ! empty( $data[ $secret_key ] ) && ! empty( $data[ $buy_link_secret_word ] ) ) {
     
    828821     */
    829822    public function process_gateway_ins_response() {
    830         $data = stripslashes_deep( $_POST ); // phpcs:ignore
    831         $this->log( "INS Response: \n" . print_r( $data, true ), 'info' ); // phpcs:ignore
     823        $data = stripslashes_deep( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
     824        $this->log( 'INS Response:', $data );
    832825        do_action( 'woo_2checkout_gateway_process_ins_response', $data, $this );
    833826    }
  • woo-2checkout/trunk/includes/Plugin.php

    r3140508 r3256094  
    66 * @since      1.0.0
    77 */
     8
     9declare( strict_types=1 );
    810
    911namespace StorePress\TwoCheckoutPaymentGateway;
     
    4749     */
    4850    protected function __construct() {
     51
    4952        try {
    5053            $this->includes();
     
    5255            $this->init();
    5356        } catch ( Exception $e ) {
    54             $this->trigger_error( __METHOD__, $e->getMessage() );
     57
     58            $message = sprintf( '<strong>%s:</strong> %s', $this->name(), $e->getMessage() );
     59            add_action(
     60                'admin_notices',
     61                function () use ( $message ) {
     62                    printf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_data( $message ) );
     63                },
     64                50
     65            );
    5566        }
    5667
     
    5869         * Action to signal that Plugin has finished loading.
    5970         *
    60          * @param Plugin $this Plugin Object.
     71         * @param Plugin $instance Plugin Object.
    6172         *
    6273         * @since 1.0.0
     
    7687
    7788    /**
     89     * Plugin Absolute File for PRO Plugin.
     90     *
     91     * @return string
     92     * @since 1.0.0
     93     */
     94    public function get_pro_plugin_file(): string {
     95        return woo_2checkout_pro_plugin_file();
     96    }
     97
     98    /**
    7899     * Get Compatible Extended Plugin Version.
    79100     *
     
    82103     */
    83104    public function get_compatible_extended_version(): string {
    84         return constant( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION' );
     105        return woo_2checkout_compatible_pro_version();
    85106    }
    86107
     
    101122    }
    102123
    103 
    104     /**
    105      * Set constant if not defined and prevent reassign
    106      *
    107      * @param string $name  Constant name.
    108      * @param mixed  $value Constant value.
    109      *
    110      * @return void.
    111      * @since 1.0.0
    112      */
    113     public function define( string $name, $value ) {
    114         if ( ! defined( $name ) ) {
    115             // phpcs:ignore
    116             define( $name, $value );
    117         }
     124    /**
     125     * Get Plugin Name.
     126     *
     127     * @return string
     128     * @since 1.0.0
     129     */
     130    public function name(): string {
     131        static $names;
     132
     133        if ( is_null( $names ) ) {
     134            $names = get_file_data( $this->get_plugin_file(), array( 'Plugin Name' ) );
     135        }
     136
     137        return esc_attr( $names[0] );
    118138    }
    119139
     
    122142     *
    123143     * @throws Exception When class files loading fails.
     144     * @return void
    124145     * @since 1.0.0
    125146     */
     
    132153        }
    133154
    134         throw new Exception( '"vendor/autoload_packages.php" file missing. Please run `composer install`' );
     155        throw new Exception( '<em>vendor/autoload_packages.php</em> file missing. Please run <code>composer install</code>' );
    135156    }
    136157
     
    139160     *
    140161     * @since 1.0.0
     162     * @return void
    141163     */
    142164    public function init() {
     
    153175    public function hooks() {
    154176        // Register with hook.
    155         add_action( 'init', array( $this, 'language' ), 1 );
     177
     178        add_action( 'init', array( $this, 'load_translations' ) );
    156179
    157180        add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
     
    163186        add_filter( 'plugin_action_links_' . $this->plugin_basename(), array( $this, 'plugin_action_links' ) );
    164187
    165         add_filter(
    166             'woocommerce_no_available_payment_methods_message',
    167             array(
    168                 $this,
    169                 'available_payment_methods_message',
    170             )
    171         );
     188        add_filter( 'woocommerce_no_available_payment_methods_message', array( $this, 'available_payment_methods_message' ) );
     189    }
     190
     191    /**
     192     * Load Plugin Translation Files.
     193     *
     194     * @return void
     195     */
     196    public function load_translations() {
     197        load_plugin_textdomain( 'woo-2checkout', false, $this->plugin_dirname() . '/languages' );
    172198    }
    173199
     
    189215
    190216    /**
    191      * Language
    192      *
    193      * @return void
    194      * @since 1.0.0
    195      */
    196     public function language() {
    197         load_plugin_textdomain( 'woo-2checkout', false, $this->plugin_path() . '/languages' );
    198     }
    199 
    200     /**
    201217     * Get Plugin basename directory name
    202218     *
     
    341357
    342358    /**
    343      * Generates a user-level error/warning/notice/deprecation message.
    344      *
    345      * Generates the message when `WP_DEBUG` is true.
    346      *
    347      * @param string $function_name The function that triggered the error.
    348      * @param string $message       The message explaining the error.
    349      *                              The message can contain allowed HTML 'a' (with href), 'code',
    350      *                              'br', 'em', and 'strong' tags and http or https protocols.
    351      *                              If it contains other HTML tags or protocols, the message should be escaped
    352      *                              before passing to this function to avoid being stripped {@see wp_kses()}.
    353      *
    354      * @since 1.0.0
    355      */
    356     public function trigger_error( string $function_name, string $message ) {
    357 
    358         // Bail out if WP_DEBUG is not turned on.
    359         if ( ! WP_DEBUG ) {
    360             return;
    361         }
    362 
    363         if ( function_exists( 'wp_trigger_error' ) ) {
    364             wp_trigger_error( $function_name, $message );
    365         } else {
    366 
    367             if ( ! empty( $function_name ) ) {
    368                 $message = sprintf( '%s(): %s', $function_name, $message );
    369             }
    370 
    371             $message = wp_kses(
    372                 $message,
    373                 array(
    374                     'a' => array( 'href' ),
    375                     'br',
    376                     'code',
    377                     'em',
    378                     'strong',
    379                 ),
    380                 array( 'http', 'https' )
    381             );
    382 
    383             // phpcs:ignore
    384             trigger_error( $message );
    385         }
    386     }
    387 
    388     // Add Features...
    389     // Happy Coding.
    390 
    391     /**
    392359     * Get payment gateway class name by checkout type.
    393360     *
     
    411378     * Add gateway class name.
    412379     *
    413      * @param array $methods gateway names.
    414      *
    415      * @return array
     380     * @param string[] $methods gateway names.
     381     *
     382     * @return string[]
    416383     */
    417384    public function add_gateways( array $methods ): array {
     
    465432     * Add new action link.
    466433     *
    467      * @param array $links available action links.
    468      *
    469      * @return array
     434     * @param array<string, string> $links available action links.
     435     *
     436     * @return array<string, string>
    470437     */
    471438    public function plugin_action_links( array $links ): array {
     
    487454    }
    488455
     456
    489457    /**
    490458     * Get Gateway class instance.
     
    494462    public function get_gateway(): Payment_Gateway {
    495463        $gateway_id       = 'woo-2checkout';
    496         $payment_gateways = WC()->payment_gateways->payment_gateways();
     464        $payment_gateways = WC()->payment_gateways()->payment_gateways();
    497465
    498466        return $payment_gateways[ $gateway_id ];
     
    501469    /**
    502470     * Loads the dependency injection container.
     471     *
     472     * @return void
    503473     */
    504474    public function register_dependencies() {
     
    518488     * Loads the dependency injection container.
    519489     *
    520      * @return Container;
     490     * @return Container
    521491     */
    522492    public function container(): Container {
  • woo-2checkout/trunk/includes/functions.php

    r3044506 r3256094  
    77 */
    88
     9declare( strict_types=1 );
     10
    911namespace StorePress\TwoCheckoutPaymentGateway;
    1012
  • woo-2checkout/trunk/languages/woo-2checkout.pot

    r3140508 r3256094  
    1 # Copyright (C) 2024 Emran Ahmed
     1# Copyright (C) 2025 Emran Ahmed
    22# This file is distributed under the GPL v3 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Payment Gateway - 2Checkout for WooCommerce 3.0.3\n"
    6 "Report-Msgid-Bugs-To: https://getwooplugins.com/new-ticket/\n"
     5"Project-Id-Version: WC Paddle by StorePress 3.1.0\n"
     6"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-2checkout\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    88"Language-Team: LANGUAGE <LL@li.org>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-08-23T18:38:11+00:00\n"
     12"POT-Creation-Date: 2025-03-14T19:08:15+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
    15 "language-team: LANGUAGE <EMAIL@ADDRESS>\n"
    1615"X-Domain: woo-2checkout\n"
    1716
     
    4140msgstr ""
    4241
    43 #: includes/Common.php:206
    44 msgid "Unserializing instances of this class is forbidden."
    45 msgstr ""
    46 
    47 #: includes/ConvertPlus/ConvertPlus_Block.php:74
     42#: includes/ConvertPlus/ConvertPlus_Block.php:79
     43#: includes/Payment_Gateway.php:103
     44#: includes/Payment_Gateway.php:264
     45#: build/convert-plus-block.js:1593
     46#: src/convert-plus-block.js:22
     47#: build/convert-plus-block.js:1457
     48msgid "Proceed to 2Checkout"
     49msgstr ""
     50
     51#: includes/ConvertPlus/ConvertPlus_Block.php:80
     52#: includes/Payment_Gateway.php:101
     53#: includes/Payment_Gateway.php:249
     54#: build/convert-plus-block.js:1592
     55#: src/convert-plus-block.js:21
     56#: build/convert-plus-block.js:1456
     57msgid "2Checkout"
     58msgstr ""
     59
     60#: includes/ConvertPlus/ConvertPlus_Block.php:81
    4861#: includes/Payment_Gateway.php:102
    49 #: includes/Payment_Gateway.php:260
    50 #: build/convert-plus-block.js:1
    51 msgid "Proceed to 2Checkout"
    52 msgstr ""
    53 
    54 #: includes/ConvertPlus/ConvertPlus_Block.php:75
    55 #: includes/Payment_Gateway.php:100
    56 #: includes/Payment_Gateway.php:245
    57 #: build/convert-plus-block.js:1
    58 msgid "2Checkout"
    59 msgstr ""
    60 
    61 #: includes/ConvertPlus/ConvertPlus_Block.php:76
    62 #: includes/Payment_Gateway.php:101
    63 #: includes/Payment_Gateway.php:253
     62#: includes/Payment_Gateway.php:257
    6463msgid "Pay via 2Checkout. Accept Credit Cards, PayPal and Debit Cards."
    6564msgstr ""
    6665
    6766#. translators: Shipping Method Name
    68 #: includes/ConvertPlus/ConvertPlus_Gateway.php:403
     67#: includes/ConvertPlus/ConvertPlus_Gateway.php:412
    6968msgid "Shipping via %s"
    7069msgstr ""
    7170
    72 #: includes/ConvertPlus/ConvertPlus_Gateway.php:460
     71#: includes/ConvertPlus/ConvertPlus_Gateway.php:470
    7372msgid "Failed to Generate 2Checkout ConvertPlus URL."
    7473msgstr ""
    7574
    7675#. translators: 1: Extended Plugin Name. 2: Extended Plugin Version. 3: Extended Plugin Compatible Version.
    77 #: includes/Extended_Plugin_Upgrade_Notice.php:68
     76#: includes/Extended_Plugin_Upgrade_Notice.php:70
    7877msgid "You are using an incompatible version of <strong>%1$s - (%2$s)</strong>. Please upgrade to version <strong>%3$s</strong> or upper."
    7978msgstr ""
    8079
    81 #: includes/Payment_Gateway.php:90
     80#: includes/Payment_Gateway.php:91
    8281msgid "2Checkout Payment Gateway"
    8382msgstr ""
    8483
    85 #: includes/Payment_Gateway.php:91
     84#: includes/Payment_Gateway.php:92
    8685msgid "2Checkout accept mobile and online payments from customers worldwide."
    8786msgstr ""
    8887
    8988#. translators: Demo mode test payment. %s: Test payment card link.
    90 #: includes/Payment_Gateway.php:117
     89#: includes/Payment_Gateway.php:118
    9190msgid "<strong>DEMO MODE ENABLED.</strong> Use a %s"
    9291msgstr ""
    9392
    94 #: includes/Payment_Gateway.php:235
     93#: includes/Payment_Gateway.php:239
    9594msgid "Enable/Disable"
    9695msgstr ""
    9796
    98 #: includes/Payment_Gateway.php:237
     97#: includes/Payment_Gateway.php:241
    9998msgid "Enable 2Checkout Payment Gateway"
    10099msgstr ""
    101100
    102 #: includes/Payment_Gateway.php:242
     101#: includes/Payment_Gateway.php:246
    103102msgid "Title"
    104103msgstr ""
    105104
    106 #: includes/Payment_Gateway.php:244
     105#: includes/Payment_Gateway.php:248
    107106msgid "This controls the title which the user sees during checkout."
    108107msgstr ""
    109108
    110 #: includes/Payment_Gateway.php:250
     109#: includes/Payment_Gateway.php:254
    111110msgid "Description"
    112111msgstr ""
    113112
    114 #: includes/Payment_Gateway.php:252
     113#: includes/Payment_Gateway.php:256
    115114msgid "This controls the description which the user sees during checkout."
    116115msgstr ""
    117116
    118 #: includes/Payment_Gateway.php:257
     117#: includes/Payment_Gateway.php:261
    119118msgid "Order button text"
    120119msgstr ""
    121120
    122 #: includes/Payment_Gateway.php:259
     121#: includes/Payment_Gateway.php:263
    123122msgid "Checkout order button text."
    124123msgstr ""
    125124
    126 #: includes/Payment_Gateway.php:265
     125#: includes/Payment_Gateway.php:269
    127126msgid "Read How to Setup"
    128127msgstr ""
    129128
    130 #: includes/Payment_Gateway.php:271
     129#: includes/Payment_Gateway.php:275
    131130msgid "Merchant Code"
    132131msgstr ""
    133132
    134133#. translators: Webhook URL
    135 #: includes/Payment_Gateway.php:275
     134#: includes/Payment_Gateway.php:279
    136135msgid "Please enter 2Checkout <strong>Merchant Code</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > API Section</a>."
    137136msgstr ""
    138137
    139 #: includes/Payment_Gateway.php:279
     138#: includes/Payment_Gateway.php:283
    140139msgid "Secret Key"
    141140msgstr ""
    142141
    143142#. translators: Webhook URL
    144 #: includes/Payment_Gateway.php:281
     143#: includes/Payment_Gateway.php:285
    145144msgid "Please enter 2Checkout <strong>Secret Key</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > API Section</a>"
    146145msgstr ""
    147146
    148 #: includes/Payment_Gateway.php:287
     147#: includes/Payment_Gateway.php:291
    149148msgid "Buy Link Secret Word"
    150149msgstr ""
    151150
    152151#. translators: Webhook URL
    153 #: includes/Payment_Gateway.php:289
     152#: includes/Payment_Gateway.php:293
    154153msgid "Please enter 2Checkout <strong>Buy link secret word</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > Secret word</a> section"
    155154msgstr ""
    156155
    157 #: includes/Payment_Gateway.php:295
     156#: includes/Payment_Gateway.php:299
    158157msgid "Demo Mode"
    159158msgstr ""
    160159
    161 #: includes/Payment_Gateway.php:297
     160#: includes/Payment_Gateway.php:301
    162161msgid "Enable Demo Mode"
    163162msgstr ""
    164163
    165 #: includes/Payment_Gateway.php:299
     164#: includes/Payment_Gateway.php:303
    166165msgid "This mode allows you to test your setup to make sure everything works as expected without take real payment."
    167166msgstr ""
    168167
    169 #: includes/Payment_Gateway.php:303
     168#: includes/Payment_Gateway.php:307
    170169msgid "Debug Log"
    171170msgstr ""
    172171
    173 #: includes/Payment_Gateway.php:305
     172#: includes/Payment_Gateway.php:309
    174173msgid "Enable Logging"
    175174msgstr ""
    176175
    177176#. translators: WooCommerce Log URL
    178 #: includes/Payment_Gateway.php:307
     177#: includes/Payment_Gateway.php:311
    179178msgid "Log 2Checkout events, <strong>DON'T ALWAYS ENABLE THIS.</strong> You can check this log in %s."
    180179msgstr ""
    181180
    182181#. translators: WooCommerce Log URL
    183 #: includes/Payment_Gateway.php:307
     182#: includes/Payment_Gateway.php:311
    184183msgid "System Status &gt; Logs"
    185184msgstr ""
    186185
    187 #: includes/Payment_Gateway.php:311
     186#: includes/Payment_Gateway.php:315
    188187msgid "Gateway Icon Style"
    189188msgstr ""
    190189
    191 #: includes/Payment_Gateway.php:314
     190#: includes/Payment_Gateway.php:318
    192191msgid "Choose Gateway a Icon Style"
    193192msgstr ""
    194193
    195 #: includes/Payment_Gateway.php:316
     194#: includes/Payment_Gateway.php:320
    196195msgid "Dark"
    197196msgstr ""
    198197
    199 #: includes/Payment_Gateway.php:317
     198#: includes/Payment_Gateway.php:321
    200199msgid "Light"
    201200msgstr ""
    202201
    203 #: includes/Payment_Gateway.php:323
     202#: includes/Payment_Gateway.php:327
    204203msgid "Gateway Icon Width"
    205204msgstr ""
    206205
    207 #: includes/Payment_Gateway.php:325
     206#: includes/Payment_Gateway.php:329
    208207msgid "Gateway Icon Width in %. Limit: 1-100"
    209208msgstr ""
    210209
    211 #: includes/Payment_Gateway.php:336
    212 #: includes/Payment_Gateway.php:339
     210#: includes/Payment_Gateway.php:340
     211#: includes/Payment_Gateway.php:343
    213212msgid "Choose checkout type"
    214213msgstr ""
    215214
    216 #: includes/Payment_Gateway.php:341
     215#: includes/Payment_Gateway.php:345
    217216msgid "Standard Checkout ( Process on 2Checkout Site )"
    218217msgstr ""
    219218
    220 #: includes/Payment_Gateway.php:342
     219#: includes/Payment_Gateway.php:346
    221220msgid "Popup After Checkout - Inline Checkout - PRO FEATURE"
    222221msgstr ""
    223222
    224 #: includes/Payment_Gateway.php:343
     223#: includes/Payment_Gateway.php:347
    225224msgid "Popup During Checkout - Inline Checkout - PRO FEATURE"
    226225msgstr ""
    227226
    228 #: includes/Payment_Gateway.php:344
     227#: includes/Payment_Gateway.php:348
    229228msgid "On Page Credit Card Only - PRO FEATURE"
    230229msgstr ""
    231230
    232231#. translators: %s: WebHook link.
    233 #: includes/Payment_Gateway.php:421
     232#: includes/Payment_Gateway.php:419
    234233msgid "<strong>Webhook endpoint: </strong> <code style=\"background-color:#ddd;\">%s</code> to your <a href=\"https://secure.2checkout.com/cpanel/ipn_settings.php\" target=\"_blank\">2Checkout IPN settings</a>"
    235234msgstr ""
    236235
    237 #: includes/Payment_Gateway.php:746
     236#: includes/Payment_Gateway.php:739
    238237msgid "Item"
    239238msgstr ""
    240239
    241 #: includes/Payment_Gateway.php:778
     240#: includes/Payment_Gateway.php:771
    242241msgid "Payment Gateway - 2Checkout for WooCommerce disabled"
    243242msgstr ""
    244243
    245 #: includes/Payment_Gateway.php:778
     244#: includes/Payment_Gateway.php:771
    246245msgid "You must fill the \"Merchant Code\" and the \"Secret Key\" and \"Buy Link Secret Word\" fields."
    247246msgstr ""
    248247
    249 #: includes/Payment_Gateway.php:787
     248#: includes/Payment_Gateway.php:780
    250249msgid "Billing Currency not supported. Payment Gateway - 2Checkout for WooCommerce disabled"
    251250msgstr ""
    252251
    253 #: includes/Payment_Gateway.php:787
     252#: includes/Payment_Gateway.php:780
    254253msgid "2Checkout does not support your store currency."
    255254msgstr ""
    256255
    257 #: includes/Payment_Gateway.php:812
     256#: includes/Payment_Gateway.php:805
    258257msgid "Should override on child class."
    259258msgstr ""
    260259
    261 #: includes/Plugin.php:181
     260#: includes/Plugin.php:207
    262261msgid "Payment Gateway - 2Checkout for WooCommerce - Pro "
    263262msgstr ""
    264263
    265264#. translators: %s: Pro version link.
    266 #: includes/Plugin.php:185
     265#: includes/Plugin.php:211
    267266msgid "Upgrade to %s to get WooCommerce Subscriptions payments, issue refunds from wp admin, inline popup checkout and more."
    268267msgstr ""
    269268
    270 #: includes/Plugin.php:484
     269#: includes/Plugin.php:451
    271270msgid "Settings"
    272271msgstr ""
    273272
    274 #: woo-2checkout.php:82
    275 msgid "WooCommerce"
    276 msgstr ""
    277 
    278 #: woo-2checkout.php:94
    279 msgid "<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is an add-on of "
    280 msgstr ""
    281 
    282 #: build/convert-plus-block.js:1
     273#: build/convert-plus-block.js:1621
     274#: src/convert-plus-block.js:57
     275#: build/convert-plus-block.js:1492
    283276msgid "DEMO MODE ENABLED."
    284277msgstr ""
    285278
    286 #: build/convert-plus-block.js:1
     279#: build/convert-plus-block.js:1622
     280#: src/convert-plus-block.js:59
     281#: build/convert-plus-block.js:1494
    287282msgid "Use a"
    288283msgstr ""
    289284
    290 #: build/convert-plus-block.js:1
     285#: build/convert-plus-block.js:1626
     286#: src/convert-plus-block.js:66
     287#: build/convert-plus-block.js:1501
    291288msgid "test payment cards"
    292289msgstr ""
  • woo-2checkout/trunk/vendor/autoload.php

    r3140508 r3256094  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d::getLoader();
     25return ComposerAutoloaderInit5791497c48068042a99c211c9c489769::getLoader();
  • woo-2checkout/trunk/vendor/autoload_packages.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/CHANGELOG.md

    r3140508 r3256094  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [5.0.3] - 2025-03-12
     9### Changed
     10- Internal updates.
     11
     12## [5.0.2] - 2025-02-24
     13### Changed
     14- Internal updates.
     15
     16## [5.0.1] - 2025-01-20
     17### Changed
     18- Code: Use function-style exit() and die() with a default status code of 0. [#41167]
     19
     20## [5.0.0] - 2024-11-25
     21### Removed
     22- Drop support for Composer <2.2. [#40297]
     23- Remove support for WordPress 6.5 and earlier. [#40200]
     24
     25## [4.0.0] - 2024-11-14
     26### Removed
     27- General: Update minimum PHP version to 7.2. [#40147]
     28
     29## [3.1.3] - 2024-11-04
     30### Added
     31- Enable test coverage. [#39961]
     32
     33## [3.1.2] - 2024-10-15
     34### Changed
     35- Internal updates.
     36
     37## [3.1.1] - 2024-10-10
     38### Changed
     39- Internal updates.
     40
     41## [3.1.0] - 2024-09-06
     42### Added
     43- Add logic for debugging issues caused by conflicting Composer autoloaders, enabled by setting the `JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS` constant. [#38995]
     44- Add logic for debugging issues caused by early class loads, enabled by setting the `JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS` constant. [#38995]
     45
     46## [3.0.10] - 2024-08-26
     47### Changed
     48- Updated package dependencies. [#39004]
    749
    850## [3.0.9] - 2024-07-10
     
    369411- Add Custom Autoloader
    370412
     413[5.0.3]: https://github.com/Automattic/jetpack-autoloader/compare/v5.0.2...v5.0.3
     414[5.0.2]: https://github.com/Automattic/jetpack-autoloader/compare/v5.0.1...v5.0.2
     415[5.0.1]: https://github.com/Automattic/jetpack-autoloader/compare/v5.0.0...v5.0.1
     416[5.0.0]: https://github.com/Automattic/jetpack-autoloader/compare/v4.0.0...v5.0.0
     417[4.0.0]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.3...v4.0.0
     418[3.1.3]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.2...v3.1.3
     419[3.1.2]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.1...v3.1.2
     420[3.1.1]: https://github.com/Automattic/jetpack-autoloader/compare/v3.1.0...v3.1.1
     421[3.1.0]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.10...v3.1.0
     422[3.0.10]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.9...v3.0.10
    371423[3.0.9]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.8...v3.0.9
    372424[3.0.8]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.7...v3.0.8
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/README.md

    r3140508 r3256094  
    4747
    4848
     49Autoloader Limitations and Caveats
     50-----
     51
     52### Plugin Updates
     53
     54When moving a package class file, renaming a package class file, or changing a package class namespace, make sure that the class will not be loaded after a plugin update.
     55
     56The autoloader builds the in memory classmap as soon as the autoloader is loaded. The package class file paths in the map are not updated after a plugin update. If a plugins's package class files are moved during a plugin update and a moved file is autoloaded after the update, an error will occur.
     57
     58### Moving classes to a different package
     59
     60Jetpack Autoloader determines the hierarchy of class versions by package version numbers. It can cause problems if a class is moved to a newer package with a lower version number, it will get overshadowed by the old package.
     61
     62For instance, if your newer version of a class comes from a new package versioned 0.1.0, and the older version comes from a different package with a greater version number 2.0.1, the newer class will not get loaded.
     63
     64### Jetpack Autoloader uses transient cache
     65
     66This is a caveat to be aware of when dealing with issues. The JP Autoloader uses transients to cache a list of available plugins to speed up the lookup process. This can sometimes mask problems that arise when loading code too early. See the [Debugging](#debugging) section for more information on how to detect situations like this.
     67
     68Debugging
     69-----
     70
     71A common cause of confusing errors is when a plugin autoloads classes during the plugin load, before the 'plugins_loaded' hook. If that plugin has an older version of the class, that older version may be loaded before a plugin providing the newer version of the class has a chance to register. Even more confusingly, this will likely be intermittent, only showing up when the autoloader's plugin cache is invalidated. To debug this situation, you can set the `JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS` constant to true.
     72
     73Another common cause of confusing errors is when a plugin registers its own autoloader at a higher priority than the Jetpack Autoloader, and that autoloader would load packages that should be handled by the Jetpack Autoloader. Setting the `JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS` constant to true will check for standard Composer autoloaders with such a conflict.
     74
     75
    4976Autoloading Standards
    5077----
     
    6491Supports PSR-4 autoloading. PSR-0 namespaces are converted to classmaps.
    6592
    66 
    67 Autoloader Limitations
    68 -----
    69 
    70 Plugin Updates
    71 
    72 When moving a package class file, renaming a package class file, or changing a package class namespace, make sure that the class will not be loaded after a plugin update.
    73 
    74 The autoloader builds the in memory classmap as soon as the autoloader is loaded. The package class file paths in the map are not updated after a plugin update. If a plugins's package class files are moved during a plugin update and a moved file is autoloaded after the update, an error will occur.
    75 
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/composer.json

    r3140508 r3256094  
    1313    ],
    1414    "require": {
    15         "php": ">=7.0",
    16         "composer-plugin-api": "^1.1 || ^2.0"
     15        "php": ">=7.2",
     16        "composer-plugin-api": "^2.2"
    1717    },
    1818    "require-dev": {
    19         "composer/composer": "^1.1 || ^2.0",
    20         "yoast/phpunit-polyfills": "1.1.0",
    21         "automattic/jetpack-changelogger": "^4.2.5"
     19        "composer/composer": "^2.2",
     20        "yoast/phpunit-polyfills": "^1.1.1",
     21        "automattic/jetpack-changelogger": "^6.0.1",
     22        "automattic/phpunit-select-config": "^1.0.0"
    2223    },
    2324    "autoload": {
     
    3132    "scripts": {
    3233        "phpunit": [
    33             "./vendor/phpunit/phpunit/phpunit --colors=always"
     34            "phpunit-select-config phpunit.#.xml.dist --colors=always"
     35        ],
     36        "test-coverage": [
     37            "php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"./tests/php/tmp/coverage-report.php\"",
     38            "php ./tests/php/bin/test-coverage.php \"$COVERAGE_DIR/php.cov\""
    3439        ],
    3540        "test-php": [
     
    5055        },
    5156        "branch-alias": {
    52             "dev-trunk": "3.0.x-dev"
     57            "dev-trunk": "5.0.x-dev"
    5358        }
    5459    }
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php

    r3140508 r3256094  
    2222class AutoloadGenerator {
    2323
    24     const VERSION = '3.0.9';
     24    const VERSION = '5.0.3';
    2525
    2626    /**
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php

    r3140508 r3256094  
    105105            $this->io->writeError( 'The project\'s composer.json or composer environment set a non-default vendor directory.', true );
    106106            $this->io->writeError( 'The default composer vendor directory must be used.</error>', true );
    107             exit();
     107            exit( 0 );
    108108        }
    109109
     
    175175        if ( empty( $requires ) ) {
    176176            $this->io->writeError( "\n<error>The package is not required and this should never happen?</error>", true );
    177             exit();
     177            exit( 0 );
    178178        }
    179179
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/class-autoloader.php

    r3140508 r3256094  
    7878        $hook_manager->add_action( 'shutdown', new Shutdown_Handler( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) );
    7979
     80        // Register a plugins_loaded handler to check for conflicting autoloaders.
     81        $hook_manager->add_action( 'plugins_loaded', array( $guard, 'check_for_conflicting_autoloaders' ), 1 );
     82
    8083        // phpcs:enable Generic.Commenting.DocComment.MissingShort
    8184    }
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php

    r3140508 r3256094  
    7676        return false;
    7777    }
     78
     79    /**
     80     * Check for conflicting autoloaders.
     81     *
     82     * A common source of strange and confusing problems is when another plugin
     83     * registers a Composer autoloader at a higher priority that us. If enabled,
     84     * check for this problem and warn about it.
     85     *
     86     * Called from the plugins_loaded hook.
     87     *
     88     * @since 3.1.0
     89     * @return void
     90     */
     91    public function check_for_conflicting_autoloaders() {
     92        if ( ! defined( 'JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS' ) || ! JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS ) {
     93            return;
     94        }
     95
     96        global $jetpack_autoloader_loader;
     97        if ( ! isset( $jetpack_autoloader_loader ) ) {
     98            return;
     99        }
     100        $prefixes = array();
     101        foreach ( ( $jetpack_autoloader_loader->get_class_map() ?? array() ) as $classname => $data ) {
     102            $parts = explode( '\\', trim( $classname, '\\' ) );
     103            array_pop( $parts );
     104            while ( $parts ) {
     105                $prefixes[ implode( '\\', $parts ) . '\\' ] = true;
     106                array_pop( $parts );
     107            }
     108        }
     109        foreach ( ( $jetpack_autoloader_loader->get_psr4_map() ?? array() ) as $prefix => $data ) {
     110            $parts = explode( '\\', trim( $prefix, '\\' ) );
     111            while ( $parts ) {
     112                $prefixes[ implode( '\\', $parts ) . '\\' ] = true;
     113                array_pop( $parts );
     114            }
     115        }
     116
     117        $autoload_chain = spl_autoload_functions();
     118        if ( ! $autoload_chain ) {
     119            return;
     120        }
     121
     122        foreach ( $autoload_chain as $autoloader ) {
     123            // No need to check anything after us.
     124            if ( is_array( $autoloader ) && is_string( $autoloader[0] ) && substr( $autoloader[0], 0, strlen( __NAMESPACE__ ) + 1 ) === __NAMESPACE__ . '\\' ) {
     125                break;
     126            }
     127
     128            // We can check Composer autoloaders easily enough.
     129            if ( is_array( $autoloader ) && $autoloader[0] instanceof \Composer\Autoload\ClassLoader && is_callable( array( $autoloader[0], 'getPrefixesPsr4' ) ) ) {
     130                $composer_autoloader = $autoloader[0];
     131                foreach ( $composer_autoloader->getClassMap() as $classname => $path ) {
     132                    if ( $jetpack_autoloader_loader->find_class_file( $classname ) ) {
     133                        $msg = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the classes we handle (e.g. $classname => $path). This may cause strange and confusing problems.";
     134                        wp_trigger_error( '', $msg );
     135                        continue 2;
     136                    }
     137                }
     138                foreach ( $composer_autoloader->getPrefixesPsr4() as $prefix => $paths ) {
     139                    if ( isset( $prefixes[ $prefix ] ) ) {
     140                        $path = array_pop( $paths );
     141                        $msg  = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems.";
     142                        wp_trigger_error( '', $msg );
     143                        continue 2;
     144                    }
     145                }
     146                foreach ( $composer_autoloader->getPrefixes() as $prefix => $paths ) {
     147                    if ( isset( $prefixes[ $prefix ] ) ) {
     148                        $path = array_pop( $paths );
     149                        $msg  = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems.";
     150                        wp_trigger_error( '', $msg );
     151                        continue 2;
     152                    }
     153                }
     154            }
     155        }
     156    }
    78157}
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php

    r3140508 r3256094  
    8080        }
    8181
     82        // A common source of strange and confusing problems is when a vendor
     83        // file is autoloaded before all plugins have had a chance to register
     84        // with the autoloader. Detect that, if a development constant is set.
     85        if ( defined( 'JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS' ) && JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS &&
     86            ( strpos( $file, '/vendor/' ) !== false || strpos( $file, '/jetpack_vendor/' ) !== false ) &&
     87            is_callable( 'did_action' ) && ! did_action( 'plugins_loaded' )
     88        ) {
     89            // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_wp_debug_backtrace_summary -- This is a debug log message.
     90            $msg = "Jetpack Autoloader: Autoloading `$class_name` before the plugins_loaded hook may cause strange and confusing problems. " . wp_debug_backtrace_summary( '', 1 );
     91            wp_trigger_error( '', $msg );
     92        }
     93
    8294        require $file;
    8395        return true;
  • woo-2checkout/trunk/vendor/automattic/jetpack-autoloader/src/class-version-loader.php

    r3140508 r3256094  
    4848        $this->psr4_map         = $psr4_map;
    4949        $this->filemap          = $filemap;
     50    }
     51
     52    /**
     53     * Fetch the classmap.
     54     *
     55     * @since 3.1.0
     56     * @return array<string, array>
     57     */
     58    public function get_class_map() {
     59        return $this->classmap;
     60    }
     61
     62    /**
     63     * Fetch the psr-4 mappings.
     64     *
     65     * @since 3.1.0
     66     * @return array<string, array>
     67     */
     68    public function get_psr4_map() {
     69        return $this->psr4_map;
    5070    }
    5171
     
    116136     */
    117137    private function find_psr4_file( $class_name ) {
    118         if ( ! isset( $this->psr4_map ) ) {
     138        if ( empty( $this->psr4_map ) ) {
    119139            return null;
    120140        }
  • woo-2checkout/trunk/vendor/composer/autoload_real.php

    r3140508 r3256094  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d
     5class ComposerAutoloaderInit5791497c48068042a99c211c9c489769
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit5791497c48068042a99c211c9c489769', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit5791497c48068042a99c211c9c489769', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitfbd493a17f366db9959bbabb6910870d::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit5791497c48068042a99c211c9c489769::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • woo-2checkout/trunk/vendor/composer/autoload_static.php

    r3140508 r3256094  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitfbd493a17f366db9959bbabb6910870d
     7class ComposerStaticInit5791497c48068042a99c211c9c489769
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    6262    {
    6363        return \Closure::bind(function () use ($loader) {
    64             $loader->prefixLengthsPsr4 = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$prefixLengthsPsr4;
    65             $loader->prefixDirsPsr4 = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$prefixDirsPsr4;
    66             $loader->classMap = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$classMap;
     64            $loader->prefixLengthsPsr4 = ComposerStaticInit5791497c48068042a99c211c9c489769::$prefixLengthsPsr4;
     65            $loader->prefixDirsPsr4 = ComposerStaticInit5791497c48068042a99c211c9c489769::$prefixDirsPsr4;
     66            $loader->classMap = ComposerStaticInit5791497c48068042a99c211c9c489769::$classMap;
    6767
    6868        }, null, ClassLoader::class);
  • woo-2checkout/trunk/vendor/composer/installed.json

    r3140508 r3256094  
    33        {
    44            "name": "automattic/jetpack-autoloader",
    5             "version": "v3.0.9",
    6             "version_normalized": "3.0.9.0",
     5            "version": "v5.0.3",
     6            "version_normalized": "5.0.3.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/Automattic/jetpack-autoloader.git",
    10                 "reference": "a571038214fc3e142e10f38d1bb97e470fa7b0ec"
     10                "reference": "108cc708cfc7b7a0e730b2bf12f389593f56f0a5"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/a571038214fc3e142e10f38d1bb97e470fa7b0ec",
    15                 "reference": "a571038214fc3e142e10f38d1bb97e470fa7b0ec",
     14                "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/108cc708cfc7b7a0e730b2bf12f389593f56f0a5",
     15                "reference": "108cc708cfc7b7a0e730b2bf12f389593f56f0a5",
    1616                "shasum": ""
    1717            },
    1818            "require": {
    19                 "composer-plugin-api": "^1.1 || ^2.0",
    20                 "php": ">=7.0"
     19                "composer-plugin-api": "^2.2",
     20                "php": ">=7.2"
    2121            },
    2222            "require-dev": {
    23                 "automattic/jetpack-changelogger": "^4.2.5",
    24                 "composer/composer": "^1.1 || ^2.0",
    25                 "yoast/phpunit-polyfills": "1.1.0"
     23                "automattic/jetpack-changelogger": "^6.0.1",
     24                "automattic/phpunit-select-config": "^1.0.0",
     25                "composer/composer": "^2.2",
     26                "yoast/phpunit-polyfills": "^1.1.1"
    2627            },
    27             "time": "2024-07-10T07:51:07+00:00",
     28            "time": "2025-03-12T19:15:00+00:00",
    2829            "type": "composer-plugin",
    2930            "extra": {
     31                "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin",
    3032                "autotagger": true,
    31                 "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin",
    3233                "mirror-repo": "Automattic/jetpack-autoloader",
     34                "branch-alias": {
     35                    "dev-trunk": "5.0.x-dev"
     36                },
    3337                "changelogger": {
    3438                    "link-template": "https://github.com/Automattic/jetpack-autoloader/compare/v${old}...v${new}"
     
    3640                "version-constants": {
    3741                    "::VERSION": "src/AutoloadGenerator.php"
    38                 },
    39                 "branch-alias": {
    40                     "dev-trunk": "3.0.x-dev"
    4142                }
    4243            },
     
    6465            ],
    6566            "support": {
    66                 "source": "https://github.com/Automattic/jetpack-autoloader/tree/v3.0.9"
     67                "source": "https://github.com/Automattic/jetpack-autoloader/tree/v5.0.3"
    6768            },
    6869            "install-path": "../automattic/jetpack-autoloader"
     
    7071        {
    7172            "name": "storepress/admin-utils",
    72             "version": "1.8.8",
    73             "version_normalized": "1.8.8.0",
     73            "version": "1.8.10",
     74            "version_normalized": "1.8.10.0",
    7475            "source": {
    7576                "type": "git",
    7677                "url": "https://github.com/EmranAhmed/storepress-admin-utils.git",
    77                 "reference": "69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837"
     78                "reference": "ec593e9e23a4fbed90acee384b61b9846cb9d968"
    7879            },
    7980            "dist": {
    8081                "type": "zip",
    81                 "url": "https://api.github.com/repos/EmranAhmed/storepress-admin-utils/zipball/69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837",
    82                 "reference": "69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837",
     82                "url": "https://api.github.com/repos/EmranAhmed/storepress-admin-utils/zipball/ec593e9e23a4fbed90acee384b61b9846cb9d968",
     83                "reference": "ec593e9e23a4fbed90acee384b61b9846cb9d968",
    8384                "shasum": ""
    8485            },
    8586            "require-dev": {
    86                 "automattic/vipwpcs": "^3.0",
    87                 "php-stubs/woocommerce-stubs": "^9.0",
     87                "automattic/vipwpcs": "^3.0.1",
     88                "php-stubs/woocommerce-stubs": "^v9.5.0",
    8889                "phpcompatibility/phpcompatibility-wp": "^2.1.5",
    89                 "phpstan/extension-installer": "^1.4",
    90                 "phpstan/phpstan-strict-rules": "^1.6",
    91                 "szepeviktor/phpstan-wordpress": "^1.3",
     90                "phpstan/extension-installer": "^1.4.3",
     91                "phpstan/phpstan-strict-rules": "^1.6.1",
     92                "szepeviktor/phpstan-wordpress": "^v1.3.5",
    9293                "woocommerce/woocommerce-sniffs": "^1.0.0",
    93                 "wp-cli/i18n-command": "^v2.6.0",
     94                "wp-cli/i18n-command": "^v2.6.3",
    9495                "wp-coding-standards/wpcs": "^3.1.0"
    9596            },
    96             "time": "2024-07-01T12:29:55+00:00",
     97            "time": "2024-12-26T18:43:48+00:00",
    9798            "type": "library",
    9899            "installation-source": "dist",
     
    125126            "support": {
    126127                "issues": "https://github.com/EmranAhmed/storepress-admin-utils/issues",
    127                 "source": "https://github.com/EmranAhmed/storepress-admin-utils/tree/1.8.8"
     128                "source": "https://github.com/EmranAhmed/storepress-admin-utils/tree/1.8.10"
    128129            },
    129130            "install-path": "../storepress/admin-utils"
  • woo-2checkout/trunk/vendor/composer/installed.php

    r3140508 r3256094  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'be918cf066aec0cb8d530068b20d3f1ec069e8a8',
     6        'reference' => '0c594ebe19edf55472ff16a0323e94cff99b909e',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'automattic/jetpack-autoloader' => array(
    14             'pretty_version' => 'v3.0.9',
    15             'version' => '3.0.9.0',
    16             'reference' => 'a571038214fc3e142e10f38d1bb97e470fa7b0ec',
     14            'pretty_version' => 'v5.0.3',
     15            'version' => '5.0.3.0',
     16            'reference' => '108cc708cfc7b7a0e730b2bf12f389593f56f0a5',
    1717            'type' => 'composer-plugin',
    1818            'install_path' => __DIR__ . '/../automattic/jetpack-autoloader',
     
    2121        ),
    2222        'storepress/admin-utils' => array(
    23             'pretty_version' => '1.8.8',
    24             'version' => '1.8.8.0',
    25             'reference' => '69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837',
     23            'pretty_version' => '1.8.10',
     24            'version' => '1.8.10.0',
     25            'reference' => 'ec593e9e23a4fbed90acee384b61b9846cb9d968',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../storepress/admin-utils',
     
    3232            'pretty_version' => 'dev-master',
    3333            'version' => 'dev-master',
    34             'reference' => 'be918cf066aec0cb8d530068b20d3f1ec069e8a8',
     34            'reference' => '0c594ebe19edf55472ff16a0323e94cff99b909e',
    3535            'type' => 'wordpress-plugin',
    3636            'install_path' => __DIR__ . '/../../',
  • woo-2checkout/trunk/vendor/composer/jetpack_autoload_classmap.php

    r3140508 r3256094  
    88return array(
    99    'Autoloader' => array(
    10         'version' => '3.0.9',
     10        'version' => '5.0.3',
    1111        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-autoloader.php'
    1212    ),
    1313    'Autoloader_Handler' => array(
    14         'version' => '3.0.9',
     14        'version' => '5.0.3',
    1515        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-autoloader-handler.php'
    1616    ),
    1717    'Autoloader_Locator' => array(
    18         'version' => '3.0.9',
     18        'version' => '5.0.3',
    1919        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-autoloader-locator.php'
    2020    ),
    2121    'Automattic\\Jetpack\\Autoloader\\AutoloadFileWriter' => array(
    22         'version' => '3.0.9',
     22        'version' => '5.0.3',
    2323        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadFileWriter.php'
    2424    ),
    2525    'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => array(
    26         'version' => '3.0.9',
     26        'version' => '5.0.3',
    2727        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php'
    2828    ),
    2929    'Automattic\\Jetpack\\Autoloader\\AutoloadProcessor' => array(
    30         'version' => '3.0.9',
     30        'version' => '5.0.3',
    3131        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadProcessor.php'
    3232    ),
    3333    'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => array(
    34         'version' => '3.0.9',
     34        'version' => '5.0.3',
    3535        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php'
    3636    ),
    3737    'Automattic\\Jetpack\\Autoloader\\ManifestGenerator' => array(
    38         'version' => '3.0.9',
     38        'version' => '5.0.3',
    3939        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/ManifestGenerator.php'
    4040    ),
    4141    'Container' => array(
    42         'version' => '3.0.9',
     42        'version' => '5.0.3',
    4343        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-container.php'
    4444    ),
    4545    'Hook_Manager' => array(
    46         'version' => '3.0.9',
     46        'version' => '5.0.3',
    4747        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-hook-manager.php'
    4848    ),
    4949    'Latest_Autoloader_Guard' => array(
    50         'version' => '3.0.9',
     50        'version' => '5.0.3',
    5151        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php'
    5252    ),
    5353    'Manifest_Reader' => array(
    54         'version' => '3.0.9',
     54        'version' => '5.0.3',
    5555        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-manifest-reader.php'
    5656    ),
    5757    'PHP_Autoloader' => array(
    58         'version' => '3.0.9',
     58        'version' => '5.0.3',
    5959        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-php-autoloader.php'
    6060    ),
    6161    'Path_Processor' => array(
    62         'version' => '3.0.9',
     62        'version' => '5.0.3',
    6363        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-path-processor.php'
    6464    ),
    6565    'Plugin_Locator' => array(
    66         'version' => '3.0.9',
     66        'version' => '5.0.3',
    6767        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-plugin-locator.php'
    6868    ),
    6969    'Plugins_Handler' => array(
    70         'version' => '3.0.9',
     70        'version' => '5.0.3',
    7171        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-plugins-handler.php'
    7272    ),
    7373    'Shutdown_Handler' => array(
    74         'version' => '3.0.9',
     74        'version' => '5.0.3',
    7575        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-shutdown-handler.php'
    7676    ),
    7777    'StorePress\\AdminUtils\\Common' => array(
    78         'version' => '1.8.8.0',
     78        'version' => '1.8.10.0',
    7979        'path'    => $vendorDir . '/storepress/admin-utils/includes/Common.php'
    8080    ),
    8181    'StorePress\\AdminUtils\\Field' => array(
    82         'version' => '1.8.8.0',
     82        'version' => '1.8.10.0',
    8383        'path'    => $vendorDir . '/storepress/admin-utils/includes/Field.php'
    8484    ),
    8585    'StorePress\\AdminUtils\\Fields' => array(
    86         'version' => '1.8.8.0',
     86        'version' => '1.8.10.0',
    8787        'path'    => $vendorDir . '/storepress/admin-utils/includes/Fields.php'
    8888    ),
    8989    'StorePress\\AdminUtils\\Menu' => array(
    90         'version' => '1.8.8.0',
     90        'version' => '1.8.10.0',
    9191        'path'    => $vendorDir . '/storepress/admin-utils/includes/Menu.php'
    9292    ),
    9393    'StorePress\\AdminUtils\\REST_API' => array(
    94         'version' => '1.8.8.0',
     94        'version' => '1.8.10.0',
    9595        'path'    => $vendorDir . '/storepress/admin-utils/includes/REST_API.php'
    9696    ),
    9797    'StorePress\\AdminUtils\\Section' => array(
    98         'version' => '1.8.8.0',
     98        'version' => '1.8.10.0',
    9999        'path'    => $vendorDir . '/storepress/admin-utils/includes/Section.php'
    100100    ),
    101101    'StorePress\\AdminUtils\\Settings' => array(
    102         'version' => '1.8.8.0',
     102        'version' => '1.8.10.0',
    103103        'path'    => $vendorDir . '/storepress/admin-utils/includes/Settings.php'
    104104    ),
    105105    'StorePress\\AdminUtils\\Updater' => array(
    106         'version' => '1.8.8.0',
     106        'version' => '1.8.10.0',
    107107        'path'    => $vendorDir . '/storepress/admin-utils/includes/Updater.php'
    108108    ),
    109109    'StorePress\\AdminUtils\\Upgrade_Notice' => array(
    110         'version' => '1.8.8.0',
     110        'version' => '1.8.10.0',
    111111        'path'    => $vendorDir . '/storepress/admin-utils/includes/Upgrade_Notice.php'
    112112    ),
     
    140140    ),
    141141    'Version_Loader' => array(
    142         'version' => '3.0.9',
     142        'version' => '5.0.3',
    143143        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-version-loader.php'
    144144    ),
    145145    'Version_Selector' => array(
    146         'version' => '3.0.9',
     146        'version' => '5.0.3',
    147147        'path'    => $vendorDir . '/automattic/jetpack-autoloader/src/class-version-selector.php'
    148148    ),
  • woo-2checkout/trunk/vendor/composer/platform_check.php

    r3140508 r3256094  
    55$issues = array();
    66
    7 if (!(PHP_VERSION_ID >= 70000)) {
    8     $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.';
     7if (!(PHP_VERSION_ID >= 70200)) {
     8    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
    99}
    1010
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-autoloader-handler.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-autoloader-locator.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-autoloader.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
     
    8686        $hook_manager->add_action( 'shutdown', new Shutdown_Handler( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) );
    8787
     88        // Register a plugins_loaded handler to check for conflicting autoloaders.
     89        $hook_manager->add_action( 'plugins_loaded', array( $guard, 'check_for_conflicting_autoloaders' ), 1 );
     90
    8891        // phpcs:enable Generic.Commenting.DocComment.MissingShort
    8992    }
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-container.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-hook-manager.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-latest-autoloader-guard.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
     
    8484        return false;
    8585    }
     86
     87    /**
     88     * Check for conflicting autoloaders.
     89     *
     90     * A common source of strange and confusing problems is when another plugin
     91     * registers a Composer autoloader at a higher priority that us. If enabled,
     92     * check for this problem and warn about it.
     93     *
     94     * Called from the plugins_loaded hook.
     95     *
     96     * @since 3.1.0
     97     * @return void
     98     */
     99    public function check_for_conflicting_autoloaders() {
     100        if ( ! defined( 'JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS' ) || ! JETPACK_AUTOLOAD_DEBUG_CONFLICTING_LOADERS ) {
     101            return;
     102        }
     103
     104        global $jetpack_autoloader_loader;
     105        if ( ! isset( $jetpack_autoloader_loader ) ) {
     106            return;
     107        }
     108        $prefixes = array();
     109        foreach ( ( $jetpack_autoloader_loader->get_class_map() ?? array() ) as $classname => $data ) {
     110            $parts = explode( '\\', trim( $classname, '\\' ) );
     111            array_pop( $parts );
     112            while ( $parts ) {
     113                $prefixes[ implode( '\\', $parts ) . '\\' ] = true;
     114                array_pop( $parts );
     115            }
     116        }
     117        foreach ( ( $jetpack_autoloader_loader->get_psr4_map() ?? array() ) as $prefix => $data ) {
     118            $parts = explode( '\\', trim( $prefix, '\\' ) );
     119            while ( $parts ) {
     120                $prefixes[ implode( '\\', $parts ) . '\\' ] = true;
     121                array_pop( $parts );
     122            }
     123        }
     124
     125        $autoload_chain = spl_autoload_functions();
     126        if ( ! $autoload_chain ) {
     127            return;
     128        }
     129
     130        foreach ( $autoload_chain as $autoloader ) {
     131            // No need to check anything after us.
     132            if ( is_array( $autoloader ) && is_string( $autoloader[0] ) && substr( $autoloader[0], 0, strlen( __NAMESPACE__ ) + 1 ) === __NAMESPACE__ . '\\' ) {
     133                break;
     134            }
     135
     136            // We can check Composer autoloaders easily enough.
     137            if ( is_array( $autoloader ) && $autoloader[0] instanceof \Composer\Autoload\ClassLoader && is_callable( array( $autoloader[0], 'getPrefixesPsr4' ) ) ) {
     138                $composer_autoloader = $autoloader[0];
     139                foreach ( $composer_autoloader->getClassMap() as $classname => $path ) {
     140                    if ( $jetpack_autoloader_loader->find_class_file( $classname ) ) {
     141                        $msg = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the classes we handle (e.g. $classname => $path). This may cause strange and confusing problems.";
     142                        wp_trigger_error( '', $msg );
     143                        continue 2;
     144                    }
     145                }
     146                foreach ( $composer_autoloader->getPrefixesPsr4() as $prefix => $paths ) {
     147                    if ( isset( $prefixes[ $prefix ] ) ) {
     148                        $path = array_pop( $paths );
     149                        $msg  = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems.";
     150                        wp_trigger_error( '', $msg );
     151                        continue 2;
     152                    }
     153                }
     154                foreach ( $composer_autoloader->getPrefixes() as $prefix => $paths ) {
     155                    if ( isset( $prefixes[ $prefix ] ) ) {
     156                        $path = array_pop( $paths );
     157                        $msg  = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems.";
     158                        wp_trigger_error( '', $msg );
     159                        continue 2;
     160                    }
     161                }
     162            }
     163        }
     164    }
    86165}
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-manifest-reader.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-path-processor.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-php-autoloader.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
     
    8888        }
    8989
     90        // A common source of strange and confusing problems is when a vendor
     91        // file is autoloaded before all plugins have had a chance to register
     92        // with the autoloader. Detect that, if a development constant is set.
     93        if ( defined( 'JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS' ) && JETPACK_AUTOLOAD_DEBUG_EARLY_LOADS &&
     94            ( strpos( $file, '/vendor/' ) !== false || strpos( $file, '/jetpack_vendor/' ) !== false ) &&
     95            is_callable( 'did_action' ) && ! did_action( 'plugins_loaded' )
     96        ) {
     97            // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_wp_debug_backtrace_summary -- This is a debug log message.
     98            $msg = "Jetpack Autoloader: Autoloading `$class_name` before the plugins_loaded hook may cause strange and confusing problems. " . wp_debug_backtrace_summary( '', 1 );
     99            wp_trigger_error( '', $msg );
     100        }
     101
    90102        require $file;
    91103        return true;
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-plugin-locator.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-plugins-handler.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-shutdown-handler.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-version-loader.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
     
    5656        $this->psr4_map         = $psr4_map;
    5757        $this->filemap          = $filemap;
     58    }
     59
     60    /**
     61     * Fetch the classmap.
     62     *
     63     * @since 3.1.0
     64     * @return array<string, array>
     65     */
     66    public function get_class_map() {
     67        return $this->classmap;
     68    }
     69
     70    /**
     71     * Fetch the psr-4 mappings.
     72     *
     73     * @since 3.1.0
     74     * @return array<string, array>
     75     */
     76    public function get_psr4_map() {
     77        return $this->psr4_map;
    5878    }
    5979
     
    124144     */
    125145    private function find_psr4_file( $class_name ) {
    126         if ( ! isset( $this->psr4_map ) ) {
     146        if ( empty( $this->psr4_map ) ) {
    127147            return null;
    128148        }
  • woo-2checkout/trunk/vendor/jetpack-autoloader/class-version-selector.php

    r3140508 r3256094  
    66 */
    77
    8 namespace Automattic\Jetpack\Autoloader\jpfbd493a17f366db9959bbabb6910870d\al3_0_9;
     8namespace Automattic\Jetpack\Autoloader\jp5791497c48068042a99c211c9c489769\al5_0_3;
    99
    1010 // phpcs:ignore
  • woo-2checkout/trunk/vendor/storepress/admin-utils/README.md

    r3140508 r3256094  
    4444            'settings_updated_message_text' => 'Settings Saved',
    4545            'settings_deleted_message_text' => 'Settings Reset',
     46            'settings_error_message_text'   => 'Settings Not saved.',
    4647        );
    4748    }
     
    6162     }
    6263    */
    63    
    64    
    6564    public function menu_title(): string {
    6665        return 'Plugin A Menu';
     
    106105        return 'v2';
    107106    }
     107   
     108    // Adding custom scripts.
     109    public function enqueue_scripts() {
     110        parent::enqueue_scripts();
     111        if ( $this->has_field_type( 'wc-enhanced-select' ) ) {
     112            wp_enqueue_style( 'woocommerce_admin_styles' );
     113            wp_enqueue_script( 'wc-enhanced-select' );
     114        }
     115    }
     116   
     117   
     118    // Adding Custom TASK:
     119   
     120    public function get_custom_action_uri(): string {
     121       return wp_nonce_url( $this->get_settings_uri( array( 'action' => 'custom-action' ) ), $this->get_nonce_action() );
     122    }
     123
     124  // Task: 02
     125    public function process_actions($current_action){
     126   
     127        parent::process_actions($current_action);
     128     
     129        if ( 'custom-action' === $current_action ) {
     130          $this->process_action_custom();
     131        }
     132    }
     133
     134
     135    // Task: 03
     136    public function process_action_custom(){
     137        check_admin_referer( $this->get_nonce_action() );
     138       
     139       
     140       
     141        // Process your task.
     142       
     143       
     144       
     145        wp_safe_redirect( $this->get_action_uri( array( 'message' => 'custom-action-done' ) ) );
     146        exit;
     147    }
     148
     149  // Task: 04
     150  public function settings_messages(){
     151     
     152      parent::settings_messages();
     153     
     154      $message = $this->get_message_query_arg_value();
     155     
     156      if ( 'custom-action-done' === $message ) {
     157          $this->add_settings_message( 'Custom action done successfully.' );
     158      }
     159     
     160      if ( 'custom-action-fail' === $message ) {
     161          $this->add_settings_message( 'Custom action failed.', 'error' );
     162      }
     163  }
    108164}
    109165```
     
    153209                'description' => 'Input desc of 01',
    154210                'placeholder' => 'Abcd',
    155                 'default'     => 'ok'
     211                'default'     => 'ok',
     212                'html_datalist'=>array('yes','no'),
    156213            ),
    157214            array(
     
    314371array(
    315372    'id'          => 'input3', // Field ID.
    316     'type'        => 'text', // text, code, small-text, tiny-text, large-text, textarea, email, url, number, color, select, select2, radio, checkbox
     373    'type'        => 'text', // text, toggle, code, small-text, tiny-text, large-text, textarea, email, url, number, color, select, wc-enhanced-select, radio, checkbox
    317374    'title'       => 'Input Label',
    318375   
     
    326383    'placeholder' => '' // Placeholder
    327384    'suffix'      => '' // Field suffix.
    328     'html_attributes' => array('min'=>10) // Field suffix.
     385    'html_attributes' => array('min' => 10) // Custom html attributes.
     386    'html_datalist'   => array('value 1', 'value 2') // HTML Datalist for suggestion.
    329387    'required'    => true, // If field is required and cannot be empty.
    330388    'private'     => true, // Private field does not delete from db during reset all action trigger.
     
    341399        'y' => 'Home Y',
    342400        'z' => 'Home Z',
     401        'new'   => array(
     402            'label' => 'New',
     403            'description' => 'New Item',
     404        ),
    343405    )
    344406),
  • woo-2checkout/trunk/vendor/storepress/admin-utils/build/admin-settings-rtl.css

    r3140508 r3256094  
    1 .select2-results__option--highlighted{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.select2-results__option--highlighted{--wp-admin-border-width-focus:1.5px}}[data-gwp_dependency]:not(.dependency-show){display:none!important}.storepress-settings-wrapper h2{font-size:1.3em;margin-bottom:10px}.storepress-settings-wrapper .nav-tab-wrapper{clear:both;display:flex;margin-block-start:20px;padding:0}.storepress-settings-wrapper .nav-tab{align-items:center;display:flex;gap:5px;justify-content:center}.storepress-settings-wrapper .storepress-settings-content-wrapper{border-bottom:1px solid #c3c4c7;display:flex;gap:10px;padding-block:20px}.storepress-settings-wrapper .storepress-settings-main{box-sizing:border-box;flex-basis:auto;flex-grow:9999}.storepress-settings-wrapper .storepress-settings-sidebar{background-color:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;flex-basis:20%;flex-grow:1;padding:10px}@media screen and (max-width:960px){.storepress-settings-wrapper .storepress-settings-sidebar{display:none}}.storepress-settings-wrapper .storepress-admin-form-table{background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);margin:0;position:relative}.storepress-settings-wrapper .storepress-admin-form-table.has-section{margin:15px 0 0}.storepress-settings-wrapper .storepress-admin-form-table tr{border-bottom:1px solid #eee;display:table-row;vertical-align:top}.storepress-settings-wrapper .storepress-admin-form-table th{min-width:280px;padding:20px}.storepress-settings-wrapper .storepress-admin-form-table td{padding:20px}.storepress-settings-wrapper .storepress-admin-form-table tr:nth-child(2n){background:#fcfcfc}.storepress-settings-wrapper .storepress-admin-form-table label{cursor:pointer}.storepress-settings-wrapper .group-input-wrapper{align-items:flex-start;display:flex;flex-direction:column;gap:1.5rem}.storepress-settings-wrapper .group-input-wrapper .input-wrapper{align-items:center;display:flex;gap:.5rem;margin:0}.storepress-settings-wrapper .help-tip{color:#666;cursor:help;display:inline-block;font-size:1.1em;font-style:normal;height:16px;line-height:1;margin:0 5px;padding:0;position:relative;vertical-align:middle;width:16px}.storepress-settings-wrapper .help-tip:after{font-family:dashicons;speak:never;font-variant:normal;font-weight:400;line-height:1;text-transform:none;-webkit-font-smoothing:antialiased;content:"";cursor:help;height:100%;right:0;margin:0;position:absolute;text-align:center;text-indent:0;top:0;width:100%}.storepress-settings-wrapper td [for*=__group]{min-width:10em;vertical-align:baseline}.storepress-settings-wrapper input.large-text,.storepress-settings-wrapper textarea.large-text{width:90%}
     1.select2-results__option--highlighted{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.select2-results__option--highlighted{--wp-admin-border-width-focus:1.5px}}[data-gwp_dependency]:not(.dependency-show){display:none!important}.storepress-settings-wrapper h2{font-size:1.3em;margin-bottom:10px}.storepress-settings-wrapper .nav-tab-wrapper{clear:both;display:flex;margin-block-start:20px;padding:0}.storepress-settings-wrapper .nav-tab{align-items:center;display:flex;gap:5px;justify-content:center}.storepress-settings-wrapper .storepress-settings-content-wrapper{border-bottom:1px solid #c3c4c7;display:flex;gap:10px;padding-block:20px}.storepress-settings-wrapper .storepress-settings-main{box-sizing:border-box;flex-basis:auto;flex-grow:9999}.storepress-settings-wrapper .storepress-settings-sidebar{background-color:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;flex-basis:20%;flex-grow:1;padding:10px}@media(max-width:960px){.storepress-settings-wrapper .storepress-settings-sidebar{display:none}}.storepress-settings-wrapper .storepress-admin-form-table{background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);margin:0;position:relative}.storepress-settings-wrapper .storepress-admin-form-table.has-section{margin:15px 0 0}.storepress-settings-wrapper .storepress-admin-form-table tr{border-bottom:1px solid #eee;display:table-row;vertical-align:top}.storepress-settings-wrapper .storepress-admin-form-table th{min-width:280px;padding:20px}.storepress-settings-wrapper .storepress-admin-form-table td{padding:20px}.storepress-settings-wrapper .storepress-admin-form-table tr:nth-child(2n){background:#fcfcfc}.storepress-settings-wrapper .storepress-admin-form-table label{cursor:pointer}.storepress-settings-wrapper .input-label-wrapper{align-items:center;display:flex;gap:4px}.storepress-settings-wrapper .group-input-wrapper{align-items:flex-start;display:flex;flex-direction:column;gap:1.5rem}.storepress-settings-wrapper .group-input-wrapper .input-wrapper{align-items:center;display:flex;gap:.5rem;margin:0}.storepress-settings-wrapper .help-modal{margin-right:auto}.storepress-settings-wrapper .help-tooltip{color:#666;cursor:help;display:flex;font-size:1.1rem;font-style:normal;line-height:1;padding:0;position:relative;vertical-align:middle}.storepress-settings-wrapper .help-tooltip:after{font-family:dashicons;speak:never;font-variant:normal;font-weight:400;line-height:1;text-transform:none;-webkit-font-smoothing:antialiased;content:"";cursor:help;height:100%;margin:0;position:relative;text-align:center;text-indent:0;width:100%}.storepress-settings-wrapper td [for*=__group]{min-width:10em;vertical-align:baseline}.storepress-settings-wrapper input{line-height:normal}.storepress-settings-wrapper input.large-text,.storepress-settings-wrapper textarea.large-text{width:90%}.storepress-settings-wrapper input.toggle{--_width:2.5em;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:1px solid #8c8f94;border-radius:1em;box-sizing:content-box;color:inherit;font-size:inherit;height:calc(var(--_width)/2);margin:auto;position:relative;vertical-align:middle;width:var(--_width)}.storepress-settings-wrapper input.toggle:disabled{opacity:.4}.storepress-settings-wrapper input.toggle:before{background-color:#2f2f2f;border:1px solid #fff;border-radius:50%;box-sizing:border-box;content:"";height:calc(var(--_width)/2);right:0;margin:0;position:absolute;left:auto;top:50%;transform:translateY(-50%);width:calc(var(--_width)/2)}.storepress-settings-wrapper input.toggle:checked{background-color:#3682c4;border-color:#3682c4}.storepress-settings-wrapper input.toggle:checked:before{background-color:#fff;border-color:#3682c4;right:auto;left:0}.storepress-settings-wrapper input.toggle+span{margin-inline-start:5px}@media(max-width:782px){.storepress-settings-wrapper input.toggle{--_width:3.5em}}.storepress-settings-wrapper.has-rtl input.toggle:before{right:auto;left:0}.storepress-settings-wrapper.has-rtl input.toggle:checked:before{right:0;left:auto}.storepress-settings-wrapper input[type=color]{border-radius:50%;--_width:2.1rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;block-size:var(--_width);border:1px solid #999;inline-size:var(--_width);padding:3px}@media(max-width:782px){.storepress-settings-wrapper input[type=color]{--_width:3rem}}.storepress-settings-wrapper input[type=color]::-webkit-color-swatch-wrapper{padding:1px}.storepress-settings-wrapper input[type=color]::-webkit-color-swatch{border-radius:50%}.storepress-settings-wrapper input[type=color]::-moz-color-swatch{border-radius:50%}.storepress-settings-wrapper .input-container{align-items:center;display:flex;gap:0}.storepress-settings-wrapper:not(.has-rtl) .input-container.has-suffix input{border-bottom-left-radius:0;border-left:0;border-top-left-radius:0;margin-left:0}.storepress-settings-wrapper:not(.has-rtl) .input-container.has-suffix .input-suffix{background-color:#dcdcde;border:1px solid #8c8f94;border-radius:4px 0 0 4px;box-shadow:0 0 0 transparent;color:#2c3338;line-height:2;padding:0 8px}.storepress-settings-wrapper.has-rtl .input-container.has-suffix input{border-bottom-right-radius:0;border-right:0;border-top-right-radius:0;margin-right:0}.storepress-settings-wrapper.has-rtl .input-container.has-suffix .input-suffix{background-color:#dcdcde;border:1px solid #8c8f94;border-radius:0 4px 4px 0;box-shadow:0 0 0 transparent;color:#2c3338;line-height:2;padding:0 8px}span[data-storepress-tooltip]{--tooltip-edge:20px}[data-storepress-tooltip]{font-weight:400}[dir=rtl] [data-storepress-tooltip]{--_arrow-x:50%;--_content-x:calc(50% + var(--_tooltip-position))}[data-storepress-tooltip]{--_arrow-x:-50%;--_content-x:calc(-50% + var(--_tooltip-position));position:relative;--tooltip-angle:5px;--tooltip-font-size:0.8rem;--tooltip-text-color:#fff;--tooltip-background-color:#333;--tooltip-max-width:150px;--tooltip-min-height:35px;--tooltip-padding:10px;--tooltip-offset:5px;--tooltip-edge:2px;--_tooltip-position:0px}[data-storepress-tooltip]:after,[data-storepress-tooltip]:before{box-sizing:border-box;display:none;opacity:0;position:absolute;transition-behavior:allow-discrete;transition-duration:.5s;transition-property:opacity,display;z-index:999}@media(prefers-reduced-motion:reduce){[data-storepress-tooltip]:after,[data-storepress-tooltip]:before{transition-behavior:unset;transition-duration:0s;transition-property:none}}[data-storepress-tooltip]:focus-visible:after,[data-storepress-tooltip]:focus-visible:before,[data-storepress-tooltip]:hover:after,[data-storepress-tooltip]:hover:before{display:block;opacity:1}@starting-style{[data-storepress-tooltip]:focus-visible:after,[data-storepress-tooltip]:focus-visible:before,[data-storepress-tooltip]:hover:after,[data-storepress-tooltip]:hover:before{display:block;opacity:0}}[data-storepress-tooltip]:before{background-color:var(--tooltip-background-color);border-radius:3px;box-shadow:0 1px 3px rgba(0,0,0,.2);color:var(--tooltip-text-color);content:attr(data-storepress-tooltip);font-size:var(--tooltip-font-size);max-width:var(--tooltip-max-width);min-height:var(--tooltip-min-height);padding:var(--tooltip-padding);text-align:center;width:-moz-max-content;width:max-content;--x:var(--_content-x);--y:calc((100% + var(--tooltip-angle) + var(--tooltip-offset))*-1);right:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip]:after{border-top-color:transparent;content:"";--x:var(--_arrow-x);--y:calc((var(--tooltip-angle) + var(--tooltip-offset))*-1);border:var(--tooltip-angle) solid transparent;border-top:var(--tooltip-angle) solid var(--tooltip-background-color);right:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-top:before{--x:var(--_content-x);--y:calc((100% + var(--tooltip-angle) + var(--tooltip-offset))*-1);right:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-top:after{--x:var(--_arrow-x);--y:calc((var(--tooltip-angle) + var(--tooltip-offset))*-1);border-top-color:var(--tooltip-background-color);right:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-bottom:before{--x:var(--_content-x);--y:calc(100% + var(--tooltip-angle) + var(--tooltip-offset));bottom:0;right:50%;top:auto;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-bottom:after{--x:var(--_arrow-x);--y:calc(var(--tooltip-angle) + var(--tooltip-offset));border-bottom-color:var(--tooltip-background-color);border-top-color:transparent;bottom:0;right:50%;top:auto;translate:var(--x) var(--y)}
  • woo-2checkout/trunk/vendor/storepress/admin-utils/build/admin-settings.asset.php

    r3140508 r3256094  
    1 <?php return array('dependencies' => array(), 'version' => '108721bec6926dc56a3c');
     1<?php return array('dependencies' => array('storepress-utils', 'wp-dom-ready'), 'version' => '69751bf50127a8de8b24');
  • woo-2checkout/trunk/vendor/storepress/admin-utils/build/admin-settings.css

    r3140508 r3256094  
    1 .select2-results__option--highlighted{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.select2-results__option--highlighted{--wp-admin-border-width-focus:1.5px}}[data-gwp_dependency]:not(.dependency-show){display:none!important}.storepress-settings-wrapper h2{font-size:1.3em;margin-bottom:10px}.storepress-settings-wrapper .nav-tab-wrapper{clear:both;display:flex;margin-block-start:20px;padding:0}.storepress-settings-wrapper .nav-tab{align-items:center;display:flex;gap:5px;justify-content:center}.storepress-settings-wrapper .storepress-settings-content-wrapper{border-bottom:1px solid #c3c4c7;display:flex;gap:10px;padding-block:20px}.storepress-settings-wrapper .storepress-settings-main{box-sizing:border-box;flex-basis:auto;flex-grow:9999}.storepress-settings-wrapper .storepress-settings-sidebar{background-color:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;flex-basis:20%;flex-grow:1;padding:10px}@media screen and (max-width:960px){.storepress-settings-wrapper .storepress-settings-sidebar{display:none}}.storepress-settings-wrapper .storepress-admin-form-table{background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);margin:0;position:relative}.storepress-settings-wrapper .storepress-admin-form-table.has-section{margin:15px 0 0}.storepress-settings-wrapper .storepress-admin-form-table tr{border-bottom:1px solid #eee;display:table-row;vertical-align:top}.storepress-settings-wrapper .storepress-admin-form-table th{min-width:280px;padding:20px}.storepress-settings-wrapper .storepress-admin-form-table td{padding:20px}.storepress-settings-wrapper .storepress-admin-form-table tr:nth-child(2n){background:#fcfcfc}.storepress-settings-wrapper .storepress-admin-form-table label{cursor:pointer}.storepress-settings-wrapper .group-input-wrapper{align-items:flex-start;display:flex;flex-direction:column;gap:1.5rem}.storepress-settings-wrapper .group-input-wrapper .input-wrapper{align-items:center;display:flex;gap:.5rem;margin:0}.storepress-settings-wrapper .help-tip{color:#666;cursor:help;display:inline-block;font-size:1.1em;font-style:normal;height:16px;line-height:1;margin:0 5px;padding:0;position:relative;vertical-align:middle;width:16px}.storepress-settings-wrapper .help-tip:after{font-family:dashicons;speak:never;font-variant:normal;font-weight:400;line-height:1;text-transform:none;-webkit-font-smoothing:antialiased;content:"";cursor:help;height:100%;left:0;margin:0;position:absolute;text-align:center;text-indent:0;top:0;width:100%}.storepress-settings-wrapper td [for*=__group]{min-width:10em;vertical-align:baseline}.storepress-settings-wrapper input.large-text,.storepress-settings-wrapper textarea.large-text{width:90%}
     1.select2-results__option--highlighted{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.select2-results__option--highlighted{--wp-admin-border-width-focus:1.5px}}[data-gwp_dependency]:not(.dependency-show){display:none!important}.storepress-settings-wrapper h2{font-size:1.3em;margin-bottom:10px}.storepress-settings-wrapper .nav-tab-wrapper{clear:both;display:flex;margin-block-start:20px;padding:0}.storepress-settings-wrapper .nav-tab{align-items:center;display:flex;gap:5px;justify-content:center}.storepress-settings-wrapper .storepress-settings-content-wrapper{border-bottom:1px solid #c3c4c7;display:flex;gap:10px;padding-block:20px}.storepress-settings-wrapper .storepress-settings-main{box-sizing:border-box;flex-basis:auto;flex-grow:9999}.storepress-settings-wrapper .storepress-settings-sidebar{background-color:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;flex-basis:20%;flex-grow:1;padding:10px}@media(max-width:960px){.storepress-settings-wrapper .storepress-settings-sidebar{display:none}}.storepress-settings-wrapper .storepress-admin-form-table{background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04);margin:0;position:relative}.storepress-settings-wrapper .storepress-admin-form-table.has-section{margin:15px 0 0}.storepress-settings-wrapper .storepress-admin-form-table tr{border-bottom:1px solid #eee;display:table-row;vertical-align:top}.storepress-settings-wrapper .storepress-admin-form-table th{min-width:280px;padding:20px}.storepress-settings-wrapper .storepress-admin-form-table td{padding:20px}.storepress-settings-wrapper .storepress-admin-form-table tr:nth-child(2n){background:#fcfcfc}.storepress-settings-wrapper .storepress-admin-form-table label{cursor:pointer}.storepress-settings-wrapper .input-label-wrapper{align-items:center;display:flex;gap:4px}.storepress-settings-wrapper .group-input-wrapper{align-items:flex-start;display:flex;flex-direction:column;gap:1.5rem}.storepress-settings-wrapper .group-input-wrapper .input-wrapper{align-items:center;display:flex;gap:.5rem;margin:0}.storepress-settings-wrapper .help-modal{margin-left:auto}.storepress-settings-wrapper .help-tooltip{color:#666;cursor:help;display:flex;font-size:1.1rem;font-style:normal;line-height:1;padding:0;position:relative;vertical-align:middle}.storepress-settings-wrapper .help-tooltip:after{font-family:dashicons;speak:never;font-variant:normal;font-weight:400;line-height:1;text-transform:none;-webkit-font-smoothing:antialiased;content:"";cursor:help;height:100%;margin:0;position:relative;text-align:center;text-indent:0;width:100%}.storepress-settings-wrapper td [for*=__group]{min-width:10em;vertical-align:baseline}.storepress-settings-wrapper input{line-height:normal}.storepress-settings-wrapper input.large-text,.storepress-settings-wrapper textarea.large-text{width:90%}.storepress-settings-wrapper input.toggle{--_width:2.5em;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:1px solid #8c8f94;border-radius:1em;box-sizing:content-box;color:inherit;font-size:inherit;height:calc(var(--_width)/2);margin:auto;position:relative;vertical-align:middle;width:var(--_width)}.storepress-settings-wrapper input.toggle:disabled{opacity:.4}.storepress-settings-wrapper input.toggle:before{background-color:#2f2f2f;border:1px solid #fff;border-radius:50%;box-sizing:border-box;content:"";height:calc(var(--_width)/2);left:0;margin:0;position:absolute;right:auto;top:50%;transform:translateY(-50%);width:calc(var(--_width)/2)}.storepress-settings-wrapper input.toggle:checked{background-color:#3682c4;border-color:#3682c4}.storepress-settings-wrapper input.toggle:checked:before{background-color:#fff;border-color:#3682c4;left:auto;right:0}.storepress-settings-wrapper input.toggle+span{margin-inline-start:5px}@media(max-width:782px){.storepress-settings-wrapper input.toggle{--_width:3.5em}}.storepress-settings-wrapper.has-rtl input.toggle:before{left:auto;right:0}.storepress-settings-wrapper.has-rtl input.toggle:checked:before{left:0;right:auto}.storepress-settings-wrapper input[type=color]{border-radius:50%;--_width:2.1rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;block-size:var(--_width);border:1px solid #999;inline-size:var(--_width);padding:3px}@media(max-width:782px){.storepress-settings-wrapper input[type=color]{--_width:3rem}}.storepress-settings-wrapper input[type=color]::-webkit-color-swatch-wrapper{padding:1px}.storepress-settings-wrapper input[type=color]::-webkit-color-swatch{border-radius:50%}.storepress-settings-wrapper input[type=color]::-moz-color-swatch{border-radius:50%}.storepress-settings-wrapper .input-container{align-items:center;display:flex;gap:0}.storepress-settings-wrapper:not(.has-rtl) .input-container.has-suffix input{border-bottom-right-radius:0;border-right:0;border-top-right-radius:0;margin-right:0}.storepress-settings-wrapper:not(.has-rtl) .input-container.has-suffix .input-suffix{background-color:#dcdcde;border:1px solid #8c8f94;border-radius:0 4px 4px 0;box-shadow:0 0 0 transparent;color:#2c3338;line-height:2;padding:0 8px}.storepress-settings-wrapper.has-rtl .input-container.has-suffix input{border-bottom-left-radius:0;border-left:0;border-top-left-radius:0;margin-left:0}.storepress-settings-wrapper.has-rtl .input-container.has-suffix .input-suffix{background-color:#dcdcde;border:1px solid #8c8f94;border-radius:4px 0 0 4px;box-shadow:0 0 0 transparent;color:#2c3338;line-height:2;padding:0 8px}span[data-storepress-tooltip]{--tooltip-edge:20px}[data-storepress-tooltip]{font-weight:400}[dir=rtl] [data-storepress-tooltip]{--_arrow-x:50%;--_content-x:calc(50% + var(--_tooltip-position))}[data-storepress-tooltip]{--_arrow-x:-50%;--_content-x:calc(-50% + var(--_tooltip-position));position:relative;--tooltip-angle:5px;--tooltip-font-size:0.8rem;--tooltip-text-color:#fff;--tooltip-background-color:#333;--tooltip-max-width:150px;--tooltip-min-height:35px;--tooltip-padding:10px;--tooltip-offset:5px;--tooltip-edge:2px;--_tooltip-position:0px}[data-storepress-tooltip]:after,[data-storepress-tooltip]:before{box-sizing:border-box;display:none;opacity:0;position:absolute;transition-behavior:allow-discrete;transition-duration:.5s;transition-property:opacity,display;z-index:999}@media(prefers-reduced-motion:reduce){[data-storepress-tooltip]:after,[data-storepress-tooltip]:before{transition-behavior:unset;transition-duration:0s;transition-property:none}}[data-storepress-tooltip]:focus-visible:after,[data-storepress-tooltip]:focus-visible:before,[data-storepress-tooltip]:hover:after,[data-storepress-tooltip]:hover:before{display:block;opacity:1}@starting-style{[data-storepress-tooltip]:focus-visible:after,[data-storepress-tooltip]:focus-visible:before,[data-storepress-tooltip]:hover:after,[data-storepress-tooltip]:hover:before{display:block;opacity:0}}[data-storepress-tooltip]:before{background-color:var(--tooltip-background-color);border-radius:3px;box-shadow:0 1px 3px rgba(0,0,0,.2);color:var(--tooltip-text-color);content:attr(data-storepress-tooltip);font-size:var(--tooltip-font-size);max-width:var(--tooltip-max-width);min-height:var(--tooltip-min-height);padding:var(--tooltip-padding);text-align:center;width:-moz-max-content;width:max-content;--x:var(--_content-x);--y:calc((100% + var(--tooltip-angle) + var(--tooltip-offset))*-1);left:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip]:after{border-top-color:transparent;content:"";--x:var(--_arrow-x);--y:calc((var(--tooltip-angle) + var(--tooltip-offset))*-1);border:var(--tooltip-angle) solid transparent;border-top:var(--tooltip-angle) solid var(--tooltip-background-color);left:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-top:before{--x:var(--_content-x);--y:calc((100% + var(--tooltip-angle) + var(--tooltip-offset))*-1);left:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-top:after{--x:var(--_arrow-x);--y:calc((var(--tooltip-angle) + var(--tooltip-offset))*-1);border-top-color:var(--tooltip-background-color);left:50%;top:0;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-bottom:before{--x:var(--_content-x);--y:calc(100% + var(--tooltip-angle) + var(--tooltip-offset));bottom:0;left:50%;top:auto;translate:var(--x) var(--y)}[data-storepress-tooltip].storepress-tooltip-position-bottom:after{--x:var(--_arrow-x);--y:calc(var(--tooltip-angle) + var(--tooltip-offset));border-bottom-color:var(--tooltip-background-color);border-top-color:transparent;bottom:0;left:50%;top:auto;translate:var(--x) var(--y)}
  • woo-2checkout/trunk/vendor/storepress/admin-utils/build/admin-settings.js

    r3140508 r3256094  
    1 ({init(){this.promptBeforeExit()},handleBeforeTabSwitch:e=>(e.preventDefault(),StorePressAdminUtilsSettingsParams.unsaved_warning_text),promptBeforeExit(){let e=!1;document.querySelectorAll('input:not(.ignore-change):not([type="hidden"]):not([type="submit"]), select:not(.ignore-change), textarea:not(.ignore-change)').forEach((t=>{t.addEventListener("input",(()=>{e||(e=!0,window.addEventListener("beforeunload",this.handleBeforeTabSwitch))}))})),document.querySelectorAll('input[type="submit"], .storepress-settings-reset-action-link').forEach((e=>{e.addEventListener("click",(e=>{if(window.removeEventListener("beforeunload",this.handleBeforeTabSwitch),e.target.classList.contains("storepress-settings-reset-action-link")&&!window.confirm(StorePressAdminUtilsSettingsParams.reset_warning_text))return e.preventDefault(),!1}))}))}}).init();
     1(()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{const e=window.StorePress.Utils;function o(t){const e=()=>{this.$element.style.removeProperty("--_tooltip-position"),this.$element.classList.remove("storepress-tooltip-position-top","storepress-tooltip-position-bottom");const t=this.$element.getBoundingClientRect(),e=window.getComputedStyle(this.$element),o=window.getComputedStyle(this.$element,"before"),n=parseInt(o.getPropertyValue("width"),10),s=parseInt(o.getPropertyValue("height"),10),i=parseInt(e.getPropertyValue("--tooltip-angle"),10),r=parseInt(e.getPropertyValue("--tooltip-edge"),10),l=s+i+r+parseInt(e.getPropertyValue("--tooltip-offset"),10)+parseInt(e.getPropertyValue("--tooltip-padding"),10);this.$element.classList.toggle("storepress-tooltip-position-bottom",t.top<l),this.$element.classList.toggle("storepress-tooltip-position-top",t.top>l);const p=n/2,a=t.left+t.width/2,d=p-a,c=p>a,m=p+a,u=document.body.clientWidth<m,h=document.body.clientWidth-m;c&&this.$element.style.setProperty("--_tooltip-position",`${d+r}px`),u&&this.$element.style.setProperty("--_tooltip-position",h-r+"px")},o=()=>{this.$element.addEventListener("focusin",e),this.$element.addEventListener("pointerenter",e)},n=()=>{this.$element.style.removeProperty("--_tooltip-position"),this.$element.classList.remove("storepress-tooltip-position-top","storepress-tooltip-position-bottom"),this.$element.removeEventListener("focusin",e),this.$element.removeEventListener("pointerenter",e)},s=()=>{n()};return(()=>(this.$element=t,o(),{unregister:s}))()}function n(){const t={getInstance:t=>(0,e.createPluginInstance)(t,!1,o),initWith(t="[data-storepress-tooltip]"){for(const{element:e,unregister:o}of this.getInstance(t))e.addEventListener("destroy",o)},init(){for(const{element:t,unregister:e}of this.getInstance("[data-storepress-tooltip]"))t.addEventListener("destroy",e)},destroy(){for(const{destroy:t}of this.getInstance("[data-storepress-tooltip]"))t()},destroyWith(t="[data-storepress-tooltip]"){for(const{destroy:e}of this.getInstance(t))e()}};document.addEventListener("storepress_tooltip_init",(()=>{t.init()})),document.addEventListener("storepress_tooltip_destroy",(()=>{t.destroy()})),document.addEventListener("storepress_tooltip_init_with",(e=>{const o=e.detail?.element;t.initWith(o)})),document.addEventListener("storepress_tooltip_destroy_with",(e=>{const o=e.detail?.element;t.destroyWith(o)}))}document.addEventListener("DOMContentLoaded",(()=>{n(),(0,e.triggerEvent)(document,"storepress_tooltip_init")}));const s=n,i=window.wp.domReady;var r=t.n(i);const l={init(){this.promptBeforeExit(),this.initTooltip()},handleBeforeTabSwitch:t=>(t.preventDefault(),t.returnValue=StorePressAdminUtilsSettingsParams.unsaved_warning_text,StorePressAdminUtilsSettingsParams.unsaved_warning_text),promptBeforeExit(){let t=!1;document.querySelectorAll('input:not(.ignore-change):not([type="hidden"]):not([type="submit"]), select:not(.ignore-change), textarea:not(.ignore-change)').forEach((e=>{e.addEventListener("input",(()=>{t||(t=!0,window.addEventListener("beforeunload",this.handleBeforeTabSwitch))}))})),document.querySelectorAll('input[type="submit"], .storepress-settings-reset-action-link').forEach((t=>{t.addEventListener("click",(t=>{if(window.removeEventListener("beforeunload",this.handleBeforeTabSwitch),t.target.classList.contains("storepress-settings-reset-action-link")&&!window.confirm(StorePressAdminUtilsSettingsParams.reset_warning_text))return t.preventDefault(),!1}))}))},initTooltip(){s()}};r()((function(){l.init()}))})()})();
  • woo-2checkout/trunk/vendor/storepress/admin-utils/composer.json

    r3140508 r3256094  
    22    "name" : "storepress/admin-utils",
    33    "description" : "Utility Classes for WordPress Plugin Projects.",
    4     "version" : "1.8.8",
     4    "version" : "1.8.10",
    55    "license" : "GPL-2.0-or-later",
    66    "type" : "library",
     
    2121    ],
    2222    "homepage" : "https://github.com/EmranAhmed/storepress-admin-utils#readme",
    23     "minimum-stability" : "dev",
     23    "minimum-stability" : "stable",
    2424    "require-dev" : {
    25         "automattic/vipwpcs" : "^3.0",
     25        "automattic/vipwpcs" : "^3.0.1",
    2626        "phpcompatibility/phpcompatibility-wp" : "^2.1.5",
    2727        "woocommerce/woocommerce-sniffs" : "^1.0.0",
    28         "wp-cli/i18n-command" : "^v2.6.0",
     28        "wp-cli/i18n-command" : "^v2.6.3",
    2929        "wp-coding-standards/wpcs" : "^3.1.0",
    30         "php-stubs/woocommerce-stubs" : "^9.0",
    31         "phpstan/extension-installer" : "^1.4",
    32         "phpstan/phpstan-strict-rules" : "^1.6",
    33         "szepeviktor/phpstan-wordpress" : "^1.3"
     30        "php-stubs/woocommerce-stubs" : "^v9.5.0",
     31        "phpstan/extension-installer" : "^1.4.3",
     32        "phpstan/phpstan-strict-rules" : "^1.6.1",
     33        "szepeviktor/phpstan-wordpress" : "^v1.3.5"
    3434    },
    3535    "autoload" : {
     
    3939    },
    4040    "config" : {
     41        "lock" : false,
    4142        "optimize-autoloader" : true,
    4243        "sort-packages" : true,
     
    4849    "scripts" : {
    4950        "phpstan" : "./vendor/bin/phpstan analyse . --memory-limit=2G -vvv",
    50         "phpstan-report" : "./vendor/bin/phpstan analyse . --memory-limit=2G -vvv > phpstan.report.txt",
     51        "phpstan-report" : "./vendor/bin/phpstan analyse . --memory-limit=2G -vvv > phpstan-report.txt",
    5152        "format" : "./vendor/bin/phpcbf --standard=phpcs.xml",
    52         "lint" : "./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=6 --report-summary --report-source --ignore-annotations --report-full=phpcs-report.txt"
     53        "lint-report" : "./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=6 --report-summary --report-source --ignore-annotations --report-full=phpcs-report.txt",
     54        "lint" : "./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=6 --report-summary --report-source"
    5355    }
    5456}
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Common.php

    r3140508 r3256094  
    3535
    3636            // Skip if attribute value is blank.
    37             if ( is_string( $attribute_value )
    38                 && $this->is_empty_string( $attribute_value )
    39             ) {
     37            if ( is_string( $attribute_value ) && $this->is_empty_string( $attribute_value ) ) {
    4038                continue;
    4139            }
     
    261259        $defaults = wp_kses_allowed_html( 'post' );
    262260
    263         $allowed_attributes = array( 'disabled', 'type', 'width', 'size', 'id', 'class', 'style', 'checked', 'selected', 'multiple', 'name', 'required', 'label', 'aria-label', 'aria-describedby', 'value', 'step', 'mix', 'max', 'placeholder' );
     261        $allowed_attributes = array( 'list', 'disabled', 'type', 'width', 'size', 'id', 'class', 'style', 'checked', 'selected', 'multiple', 'name', 'required', 'label', 'aria-label', 'aria-describedby', 'value', 'step', 'mix', 'max', 'placeholder' );
    264262        $tags               = array(
    265263            'input'    => $allowed_attributes,
     
    268266            'option'   => $allowed_attributes,
    269267            'select'   => $allowed_attributes,
     268            'datalist' => $allowed_attributes,
    270269        );
    271270
     
    279278        );
    280279
    281         return array_merge( $defaults, $allowed_args, $args );
     280        $extra_args = array_reduce(
     281            array_keys( $args ),
     282            function ( $carry, $tag ) use ( $args ) {
     283                $carry[ $tag ] = array_fill_keys( $args[ $tag ], true );
     284                return $carry;
     285            },
     286            array()
     287        );
     288
     289
     290        return array_merge( $defaults, $allowed_args, $extra_args );
    282291    }
    283292
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Field.php

    r3140508 r3256094  
    155155         * Get default value.
    156156         *
    157          * @return string|string[]|bool|numeric|null
     157         * @return bool|string|numeric|string[]|null
    158158         */
    159159        public function get_default_value() {
     
    337337
    338338        /**
     339         * Get datalist id.
     340         *
     341         * @return string
     342         */
     343        public function get_datalist_id(): string {
     344            return sprintf( '%s-datalist', $this->get_id() );
     345        }
     346
     347        /**
    339348         * Get available field sizes.
    340349         *
     
    404413            return $this->get_attribute( 'suffix' );
    405414        }
     415        /**
     416         * Has field suffix.
     417         *
     418         * @return bool
     419         */
     420        public function has_suffix(): bool {
     421            return $this->has_attribute( 'suffix' );
     422        }
    406423
    407424        /**
     
    478495         */
    479496        public function group_inputs(): array {
    480             return array( 'radio', 'checkbox', 'group' );
     497            return array( 'radio', 'checkbox', 'toggle', 'group' );
    481498        }
    482499
     
    490507         */
    491508        public function get_input_attributes( array $attrs, array $additional_attrs = array() ): string {
    492 
    493509            $attributes = wp_parse_args( $additional_attrs, $attrs );
    494 
    495510            return $this->get_html_attributes( $attributes );
    496511        }
     
    510525
    511526            $message = sprintf( 'Field: "%s" not implemented. Please add "Settings::custom_field" method to implement.', $type );
    512             wp_trigger_error( '', $message );
     527            wp_trigger_error( __METHOD__, $message );
    513528
    514529            return '';
     
    537552            }
    538553
     554            if ( 'color' === $raw_type ) {
     555                $system_class[] = 'color';
     556            }
     557
    539558            $attributes = array(
    540559                'id'    => $id,
     
    545564            );
    546565
     566            if ( $this->has_attribute( 'html_datalist' ) ) {
     567                $attributes['list'] = $this->get_datalist_id();
     568            }
     569
    547570            if ( $this->has_attribute( 'description' ) ) {
    548571                $attributes['aria-describedby'] = sprintf( '%s-description', $id );
     
    557580            }
    558581
    559             return sprintf( '<input %s /> %s', $this->get_input_attributes( $attributes, $additional_attributes ), $this->get_suffix() );
     582            return sprintf( '<div class="input-container %s"><span class="input-field"><input %s /></span><span class="input-suffix">%s</span></div>', ( $this->has_suffix() ? 'has-suffix' : '' ), $this->get_input_attributes( $attributes, $additional_attributes ), $this->get_suffix() );
    560583        }
    561584
     
    606629        public function check_input(): string {
    607630
    608             $id      = $this->get_id();
    609             $type    = $this->get_type();
    610             $title   = $this->get_title();
    611             $name    = $this->get_name();
    612             $value   = $this->get_value();
    613             $options = $this->get_options();
     631            $id       = $this->get_id();
     632            $type     = $this->get_type();
     633            $title    = $this->get_title();
     634            $name     = $this->get_name();
     635            $value    = $this->get_value();
     636            $options  = $this->get_options();
     637            $raw_type = $this->get_raw_type();
     638
     639            $is_toggle   = 'toggle' === $raw_type;
     640            $is_checkbox = 'checkbox' === $type;
    614641
    615642            // Group checkbox. Options will be an array.
    616             if ( 'checkbox' === $type && count( $options ) > 1 ) {
     643            if ( $is_checkbox && count( $options ) > 1 ) {
    617644                $name = $this->get_name( true );
    618645            }
    619646
    620647            // Single checkbox. Option will be string.
    621             if ( 'checkbox' === $type && $this->is_empty_array( $options ) ) {
     648            if ( $is_checkbox && $this->is_empty_array( $options ) ) {
    622649                $options = array( 'yes' => $title );
    623650            }
     
    626653            if ( 'radio' === $type && $this->is_empty_array( $options ) ) {
    627654                $message = sprintf( 'Input Field: "%s". Title: "%s" need options to choose. "option"=>["key"=>"value"]', $id, $title );
    628                 wp_trigger_error( '', $message );
     655                wp_trigger_error( __METHOD__, $message );
    629656
    630657                return '';
     
    649676                );
    650677
    651                 $inputs[] = sprintf( '<label for="%s"><input %s /><span>%s</span></label>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ) );
     678                $option_description = '';
     679                if ( is_array( $option_value ) && isset( $option_value['label'] ) && isset( $option_value['description'] ) ) {
     680
     681                    $option_description = sprintf( '<p class="description" id="%s-description">%s</p>', $uniq_id, $option_value['description'] );
     682                    $option_value       = $option_value['label'];
     683                }
     684
     685
     686
     687                if ( $is_toggle ) {
     688                    $attributes['class'] = array( 'toggle' );
     689                }
     690
     691                $inputs[] = sprintf( '<label for="%s"><input %s /><span>%s</span></label> %s', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ), wp_kses_post( $option_description ) );
    652692            }
    653693
     
    679719            }
    680720
     721            if ( 'wc-enhanced-select' === $raw_type ) {
     722                $system_class[] = 'wc-enhanced-select';
     723            }
     724
    681725            $attributes = array(
    682726                'id'       => $id,
    683                 'type'     => 'select',
     727                // 'type'     => 'select',
    684728                'name'     => $name,
    685729                'class'    => $this->prepare_classes( $class, $system_class ),
     
    830874                $field_title       = $field->get_title();
    831875                $field_type        = $field->get_type();
     876                $raw_field_type    = $field->get_raw_type();
    832877                $field_name        = $field->get_name();
    833878                $field_options     = $field->get_options();
     
    850895                );
    851896
     897                $is_toggle   = 'toggle' === $raw_field_type;
     898                $is_checkbox = ( 'checkbox' === $field_type );
     899
     900                if ( $is_checkbox ) {
     901                    $attributes['type'] = 'checkbox';
     902                }
     903
    852904                // Group checkbox name.
    853                 if ( 'checkbox' === $field_type && count( $field_options ) > 1 ) {
     905                if ( $is_checkbox && count( $field_options ) > 1 ) {
    854906                    $attributes['name'] = $field->get_name( true );
    855907                }
     
    860912
    861913                    // Single checkbox.
    862                     if ( 'checkbox' === $field_type && $this->is_empty_array( $field_options ) ) {
     914                    if ( $is_checkbox && $this->is_empty_array( $field_options ) ) {
    863915                        $attributes['value']   = 'yes';
    864916                        $attributes['checked'] = 'yes' === $field_value;
     917
     918                        if ( $is_toggle ) {
     919                            $attributes['class'][] = 'toggle';
     920                        }
    865921
    866922                        $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><input %s /><span>%s</span></label></p>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $field_title ) );
     
    881937                        $attributes['checked'] = is_array( $field_value ) ? in_array( $option_key, $field_value, true ) : $option_key == $field_value;
    882938                        $attributes['id']      = $uniq_id;
    883                         $inputs[]              = sprintf( '<li><label for="%s"><input %s /><span>%s</span></label></li>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ) );
     939
     940                        if ( $is_toggle ) {
     941                            $attributes['class'][] = 'toggle';
     942                        }
     943
     944                        $inputs[] = sprintf( '<li><label for="%s"><input %s /><span>%s</span></label></li>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ) );
    884945                    }
    885946                    $inputs[] = '</ul>';
    886947
    887948                } elseif ( 'textarea' === $field_type ) {
    888                     // Input box.
     949                        // Input box.
    889950                        $attributes['value'] = false;
    890951                        $inputs[]            = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <textarea %s>%s</textarea></p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_input_attributes( $attributes, $field_attributes ), $field_value );
    891952                } else {
    892                     $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <input %s /> %s</p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_input_attributes( $attributes, $field_attributes ), esc_html( $field_suffix ) );
     953
     954                    $datalist_markup = '';
     955                    if ( $field->has_attribute( 'html_datalist' ) ) {
     956
     957                        $datalist_id        = sprintf( '%s-datalist', $uniq_id );
     958                        $attributes['list'] = $datalist_id;
     959
     960                        $datalist_markup = sprintf( '<datalist id="%s">', $datalist_id );
     961                        foreach ( $field->get_attribute( 'html_datalist' ) as $value ) {
     962                            $datalist_markup .= sprintf( '<option value="%s"></option>', $value );
     963                        }
     964                        $datalist_markup .= '</datalist>';
     965                    }
     966
     967
     968                    // @todo: add has suffix class
     969                    $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <span class="input-container %s"><span class="input-field"><input %s /></span><span class="input-suffix">%s</span></span>%s</p>', esc_attr( $uniq_id ), esc_html( $field_title ), ( $field->has_suffix() ? 'has-suffix' : '' ), $this->get_input_attributes( $attributes, $field_attributes ), esc_html( $field_suffix ), $datalist_markup );
    893970                }
    894971            }
     
    9261003                case 'number':
    9271004                    return 'number';
     1005                case 'toggle':
    9281006                case 'checkbox':
    9291007                    return $is_single ? 'string' : 'array';
    9301008                case 'select2':
    9311009                case 'select':
     1010                case 'wc-enhanced-select':
    9321011                    return $is_multiple ? 'array' : 'string';
    9331012                case 'group':
     
    9461025        public function get_label_markup(): string {
    9471026
    948             $id    = $this->get_id();
    949             $title = $this->get_title();
    950             $type  = $this->get_type();
     1027            $id             = $this->get_id();
     1028            $title          = sprintf( '<span class="input-label">%s</span>', $this->get_title() );
     1029            $type           = $this->get_type();
     1030            $tooltip_markup = $this->get_tooltip_markup();
    9511031
    9521032            if ( in_array( $type, $this->group_inputs(), true ) ) {
    953                 return $title;
    954             }
    955             $required_markup = '';
    956             if ( $this->has_attribute( 'required' ) ) {
    957                 $required_markup = '<span class="required">*</span>';
    958             }
    959 
    960             return sprintf( '<label for="%s">%s %s</label>', esc_attr( $id ), esc_html( $title ), $required_markup );
     1033                return sprintf( '<span class="input-label-wrapper">%s %s</span>', $title, $tooltip_markup );
     1034            }
     1035
     1036            $required_markup = $this->get_required_markup();
     1037
     1038
     1039            return sprintf( '<label for="%s"><span class="input-label-wrapper">%s %s %s</span></label>', esc_attr( $id ), $title, $required_markup, $tooltip_markup );
    9611040        }
    9621041
     
    9691048
    9701049            return array(
    971                 'tiny-text'    => 'text',
    972                 'small-text'   => 'text',
    973                 'regular-text' => 'text',
    974                 'large-text'   => 'text',
    975                 'code'         => 'text',
    976                 'select2'      => 'select',
     1050                'tiny-text'          => 'text',
     1051                'small-text'         => 'text',
     1052                'regular-text'       => 'text',
     1053                'large-text'         => 'text',
     1054                'code'               => 'text',
     1055                'select2'            => 'select',
     1056                'wc-enhanced-select' => 'select',
     1057                'toggle'             => 'checkbox',
    9771058            );
    9781059        }
     
    9841065         * @todo Add More Fields
    9851066         * @see  Settings::sanitize_fields()
    986          * @example: input, code, textarea, select, select2, regular-text, small-text, tiny-text, large-text, color
     1067         * @example: text, range, search, url, color, number, code, textarea, select, select2, wc-enhanced-select, regular-text, small-text, tiny-text, large-text, color
    9871068         */
    9881069        public function get_input_markup(): string {
     
    9931074                case 'regular-text':
    9941075                case 'code':
     1076                case 'range':
     1077                case 'search':
     1078                case 'url':
    9951079                    return $this->text_input();
    9961080                case 'color':
     
    10041088                case 'radio':
    10051089                case 'checkbox':
     1090                case 'toggle':
    10061091                    return $this->check_input();
    10071092                case 'select':
    10081093                case 'select2':
     1094                case 'wc-enhanced-select':
    10091095                    return $this->select_input();
    10101096                case 'group':
     
    10271113            return $this->has_attribute( 'description' ) ? sprintf( '<p class="description" id="%s-description">%s</p>', esc_attr( $id ), wp_kses_post( $this->get_attribute( 'description' ) ) ) : '';
    10281114        }
     1115        /**
     1116         * Get field tooltip markup.
     1117         *
     1118         * @return string
     1119         */
     1120        public function get_tooltip_markup(): string {
     1121            return $this->has_attribute( 'tooltip' ) ? sprintf( '<span data-storepress-tooltip="%s"><span class="help-tooltip"></span></span>', esc_html( $this->get_attribute( 'tooltip' ) ) ) : '';
     1122        }
     1123        /**
     1124         * Get field required markup.
     1125         *
     1126         * @return string
     1127         */
     1128        public function get_required_markup(): string {
     1129            return $this->has_attribute( 'required' ) ? '<span class="required">*</span>' : '';
     1130        }
     1131        /**
     1132         * Get field description markup.
     1133         *
     1134         * @return string
     1135         */
     1136        public function get_datalist_markup(): string {
     1137
     1138            $type = $this->get_type();
     1139
     1140            if ( in_array( $type, array( 'select', 'checkbox', 'radio' ), true ) ) {
     1141                return '';
     1142            }
     1143
     1144            $datalist_id         = $this->get_datalist_id();
     1145            $datalist_attributes = $this->get_attribute( 'html_datalist', array() );
     1146
     1147            $datalist_markup = '';
     1148            if ( ! $this->is_empty_array( $datalist_attributes ) ) {
     1149                $datalist_markup = sprintf( '<datalist id="%s">', $datalist_id );
     1150                foreach ( $datalist_attributes as  $value ) {
     1151                    $datalist_markup .= sprintf( '<option value="%s"></option>', $value );
     1152                }
     1153                $datalist_markup .= '</datalist>';
     1154            }
     1155
     1156            return $datalist_markup;
     1157        }
    10291158
    10301159        /**
     
    10371166            $description = $this->get_description_markup();
    10381167            $input       = $this->get_input_markup();
    1039 
    1040             $full_width = $this->get_attribute( 'full_width', false );
    1041 
    1042             // <span class="help-tip"></span>
     1168            $full_width  = $this->get_attribute( 'full_width', false );
     1169            $datalist    = $this->get_datalist_markup();
     1170
     1171            // <span class="help-tooltip"></span>
     1172            // <span class="help-modal"></span>
    10431173            if ( $full_width ) {
    1044                 return sprintf( '<tr><td colspan="2" class="td-full">%s %s</td></tr>', $input, $description );
    1045             }
    1046 
    1047             return sprintf( '<tr><th scope="row">%s </th><td>%s %s</td></tr>', $label, $input, $description );
     1174                return sprintf( '<tr><td colspan="2" class="td-full">%s %s %s</td></tr>', $input, $datalist, $description );
     1175            }
     1176
     1177            return sprintf( '<tr><th scope="row">%s</th><td>%s %s %s</td></tr>', $label, $input, $datalist, $description );
    10481178        }
    10491179    }
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Fields.php

    r3140508 r3256094  
    2525
    2626        /**
     27         * Setting.
     28         *
     29         * @var Settings
     30         */
     31        private Settings $settings;
     32
     33        /**
    2734         * Sections.
    2835         *
     
    4451         */
    4552        public function __construct( array $fields, Settings $settings ) {
     53
     54            $this->settings = $settings;
    4655
    4756            /**
     
    8190                }
    8291            }
     92        }
     93
     94        /**
     95         * Get Settings
     96         *
     97         * @return Settings
     98         */
     99        public function get_settings(): Settings {
     100            return $this->settings;
    83101        }
    84102
     
    141159        public function display() {
    142160
    143             $allowed_input_html = $this->get_kses_allowed_input_html();
     161            $allowed_input_html = $this->get_kses_allowed_input_html( $this->get_settings()->allowed_tags() );
     162
    144163            /**
    145164             * Section Instance.
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Menu.php

    r3140508 r3256094  
    132132                                return;
    133133                            }
    134 
    135134                            $this->settings_page_init();
    136135                        }
     
    159158                'admin_init',
    160159                function () {
    161 
    162160                    // Process Settings Actions.
    163161                    $this->settings_actions();
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Settings.php

    r3140508 r3256094  
    160160        public function register_admin_scripts() {
    161161
    162             if ( $this->is_admin_page() ) {
    163                 $plugin_dir_url  = untrailingslashit( plugin_dir_url( $this->get_plugin_file() ) );
    164                 $plugin_dir_path = untrailingslashit( plugin_dir_path( $this->get_plugin_file() ) );
    165 
    166                 $script_src_url    = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.js';
    167                 $style_src_url     = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.css';
    168                 $script_asset_file = $plugin_dir_path . '/vendor/storepress/admin-utils/build/admin-settings.asset.php';
    169                 $script_assets     = include $script_asset_file;
    170 
    171                 wp_register_script( 'storepress-admin-settings', $script_src_url, $script_assets['dependencies'], $script_assets['version'], true );
    172                 wp_register_style( 'storepress-admin-settings', $style_src_url, array(), $script_assets['version'] );
    173                 wp_localize_script( 'storepress-admin-settings', 'StorePressAdminUtilsSettingsParams', $this->localize_strings() );
    174             }
     162            if ( ! $this->is_admin_page() ) {
     163                return;
     164            }
     165
     166            $plugin_dir_url  = untrailingslashit( plugin_dir_url( $this->get_plugin_file() ) );
     167            $plugin_dir_path = untrailingslashit( plugin_dir_path( $this->get_plugin_file() ) );
     168
     169            $admin_settings_script_url        = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.js';
     170            $admin_settings_style_url         = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.css';
     171            $admin_settings_script_asset_file = $plugin_dir_path . '/vendor/storepress/admin-utils/build/admin-settings.asset.php';
     172            $admin_settings_script_assets     = include $admin_settings_script_asset_file;
     173
     174
     175            $storepress_utils_script_url = $plugin_dir_url . '/vendor/storepress/admin-utils/build/storepress-utils.js';
     176            wp_register_script( 'storepress-utils', $storepress_utils_script_url, array(), $admin_settings_script_assets['version'], true );
     177
     178            wp_register_script( 'storepress-admin-settings', $admin_settings_script_url, $admin_settings_script_assets['dependencies'], $admin_settings_script_assets['version'], true );
     179            wp_register_style( 'storepress-admin-settings', $admin_settings_style_url, array(), $admin_settings_script_assets['version'] );
     180            wp_localize_script( 'storepress-admin-settings', 'StorePressAdminUtilsSettingsParams', $this->localize_strings() );
    175181        }
    176182
     
    183189            wp_enqueue_script( 'storepress-admin-settings' );
    184190            wp_enqueue_style( 'storepress-admin-settings' );
     191
     192            if ( $this->has_field_type( 'wc-enhanced-select' ) ) {
     193                wp_enqueue_style( 'woocommerce_admin_styles' );
     194                wp_enqueue_script( 'wc-enhanced-select' );
     195            }
    185196        }
    186197
     
    340351                $page_fn_name   = sprintf( $this->page_callback_fn_name_convention, $current_tab );
    341352                $message        = sprintf( 'Should return fields array from "<strong>%s()</strong>". Or For custom page create "<strong>%s()</strong>"', $fields_fn_name, $page_fn_name );
    342                 wp_trigger_error( '', $message );
     353                wp_trigger_error( __METHOD__, $message );
    343354            }
    344355        }
     
    484495                            continue;
    485496                        }
     497
    486498                        $_field = ( new Field( $field ) )->add_settings( $this );
    487499
     
    492504
    493505            return $all_fields;
     506        }
     507
     508        /**
     509         * Get Field Types
     510         *
     511         * @return string[]
     512         */
     513        public function get_registered_field_types(): array {
     514            $tabs = $this->get_tabs();
     515
     516            $all_types = array();
     517
     518            foreach ( $tabs as $tab ) {
     519
     520                $fields_callback = $tab['fields_callback'];
     521
     522                if ( is_callable( $fields_callback ) ) {
     523                    $fields = call_user_func( $fields_callback );
     524                    foreach ( $fields as $field ) {
     525                        $all_types[] = $field['type'];
     526                    }
     527                }
     528            }
     529
     530            return array_unique( $all_types );
    494531        }
    495532
     
    749786
    750787        /**
     788         * Get message query argument value.
     789         *
     790         * @return false|string
     791         */
     792        final public function get_message_query_arg_value() {
     793            // We are just checking message query args request from uri redirect.
     794            if ( ! isset( $_GET['message'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     795                return false;
     796            }
     797
     798            return sanitize_text_field( $_GET['message'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     799        }
     800
     801        /**
    751802         * Settings messages
    752803         *
     
    759810
    760811            // We are just checking message request from uri redirect.
    761             if ( ! isset( $_GET['message'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     812            if ( ! $this->get_message_query_arg_value() ) {
    762813                return;
    763814            }
     
    765816            $strings = $this->localize_strings();
    766817
    767             $message = sanitize_text_field( $_GET['message'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     818            $message = $this->get_message_query_arg_value();
    768819
    769820            if ( 'updated' === $message ) {
     
    904955         * @return Field|null
    905956         */
    906         private function get_field( string $field_id ): ?Field {
     957        public function get_field( string $field_id ): ?Field {
    907958            $fields = $this->get_all_fields();
    908959
    909960            return $fields[ $field_id ] ?? null;
     961        }
     962
     963        /**
     964         * Get field.
     965         *
     966         * @param string $field_type Field Type.
     967         *
     968         * @return bool
     969         */
     970        public function has_field_type( string $field_type ): bool {
     971            $types = $this->get_registered_field_types();
     972            return in_array( $field_type, $types, true );
    910973        }
    911974
     
    11701233            return ( is_admin() && isset( $_GET['page'] ) && $this->get_current_page_slug() === $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    11711234        }
     1235
     1236        /**
     1237         * Add new allowed tag on Fields markup
     1238         *
     1239         * @return array<string, mixed>
     1240         */
     1241        public function allowed_tags(): array {
     1242            return array();
     1243        }
    11721244    }
    11731245}
  • woo-2checkout/trunk/vendor/storepress/admin-utils/includes/templates/classic-template.php

    r3140508 r3256094  
    1010
    1111    defined( 'ABSPATH' ) || die( 'Keep Silent' );
     12
     13    $storepress_rtl_class = is_rtl() ? 'has-rtl' : '';
    1214?>
    13 <div class="wrap storepress-settings-wrapper">
     15<div class="wrap storepress-settings-wrapper <?php echo esc_attr( $storepress_rtl_class ); ?>">
    1416    <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
    1517
  • woo-2checkout/trunk/woo-2checkout.php

    r3140508 r3256094  
    1010 * Description:          2Checkout Payment Gateway for WooCommerce.
    1111 * Author:               Emran Ahmed
    12  * Version:              3.0.3
     12 * Version:              3.1.0
    1313 * Requires PHP:         7.4
    14  * Requires at least:    6.1
    15  * Tested up to:         6.6
     14 * Requires at least:    6.4
     15 * Tested up to:         6.7
    1616 * WC requires at least: 8.1
    17  * WC tested up to:      9.2
     17 * WC tested up to:      9.7
    1818 * Text Domain:          woo-2checkout
    1919 * Author URI:           https://getwooplugins.com/
     
    2323 */
    2424
     25declare( strict_types=1 );
     26
    2527defined( 'ABSPATH' ) || die( 'Keep Silent' );
    2628
    2729use StorePress\TwoCheckoutPaymentGateway\Plugin;
     30use StorePress\TwoCheckoutPaymentGateway\Plugin_Extended;
    2831
    2932if ( ! defined( 'STOREPRESS_TWO_CHECKOUT_PLUGIN_FILE' ) ) {
     
    3235
    3336if ( ! defined( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION' ) ) {
    34     define( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION', '3.0.0' );
    35 }
    36 
    37 // Include the Plugin class.
    38 if ( ! class_exists( '\StorePress\TwoCheckoutPaymentGateway\Plugin' ) ) {
    39     require_once plugin_dir_path( __FILE__ ) . 'includes/Plugin.php';
     37    define( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION', '3.1.0' );
    4038}
    4139
     
    5048
    5149/**
     50 * Get Pro Plugin File
     51 *
     52 * @return string
     53 */
     54function woo_2checkout_pro_plugin_file(): string {
     55    return defined( 'STOREPRESS_TWO_CHECKOUT_PRO_PLUGIN_FILE' ) ? constant( 'STOREPRESS_TWO_CHECKOUT_PRO_PLUGIN_FILE' ) : 'woo-2checkout-pro/woo-2checkout-pro.php';
     56}
     57
     58/**
    5259 * The main function that returns the Plugin class
    5360 *
    54  * @return Plugin|false
    55  * @since 2.1.0
     61 * @return Plugin|Plugin_Extended
     62 * @since 1.0.0
    5663 */
    5764function woo_2checkout() {
    58     // Include the main class.
    59 
    60     if ( ! class_exists( 'WooCommerce' ) ) {
    61         return false;
     65    // Include the Plugin class.
     66    if ( ! class_exists( '\StorePress\TwoCheckoutPaymentGateway\Plugin' ) ) {
     67        require_once plugin_dir_path( __FILE__ ) . 'includes/Plugin.php';
    6268    }
    6369
    64     if ( function_exists( 'woo_2checkout_pro' ) ) {
     70    if ( function_exists( 'woo_2checkout_pro' ) && function_exists( 'woo_2checkout_pro_is_compatible' ) && woo_2checkout_pro_is_compatible() ) {
    6571        return woo_2checkout_pro();
    6672    }
     
    6975}
    7076
    71 // Get the plugin running.
    72 add_action( 'plugins_loaded', 'woo_2checkout' );
    73 
    7477/**
    75  * Admin Notice for required plugin.
     78 * Init to hook.
    7679 *
    7780 * @return void
    7881 */
    79 function woo_2checkout_requirements_notice() {
    80     if ( ! class_exists( 'WooCommerce' ) ) {
    81 
    82         $text = esc_html__( 'WooCommerce', 'woo-2checkout' );
    83 
    84         $plugin_args = array(
    85             'tab'       => 'plugin-information',
    86             'plugin'    => 'woocommerce',
    87             'TB_iframe' => 'true',
    88             'width'     => '640',
    89             'height'    => '500',
    90         );
    91 
    92         $link = add_query_arg( $plugin_args, admin_url( 'plugin-install.php' ) );
    93 
    94         $message = __( '<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is an add-on of ', 'woo-2checkout' );
    95 
    96         printf( '<div class="%1$s"><p>%2$s <a class="thickbox open-plugin-details-modal" href="%3$s"><strong>%4$s</strong></a></p></div>', 'notice notice-error', wp_kses_post( $message ), esc_url( $link ), esc_html( $text ) );
    97     }
     82function woo_2checkout_init() {
     83    woo_2checkout();
    9884}
    9985
    100 add_action( 'admin_notices', 'woo_2checkout_requirements_notice' );
    101 
    102 // Deactivate too old extended plugin.
    103 add_action(
    104     'admin_init',
    105     function () {
    106 
    107         $plugin_file = 'woo-2checkout-pro/woo-2checkout-pro.php';
    108 
    109         $file   = wp_normalize_path( $plugin_file );
    110         $plugin = plugin_basename( $file );
    111 
    112         $abs_file = trailingslashit( WP_PLUGIN_DIR ) . $plugin;
    113 
    114         if ( ! file_exists( $abs_file ) ) {
    115             return;
    116         }
    117 
    118         $data             = get_plugin_data( $abs_file );
    119         $required_version = woo_2checkout_compatible_pro_version();
    120         $current_version  = sanitize_text_field( $data['Version'] );
    121 
    122         if ( is_plugin_inactive( $plugin_file ) ) {
    123             return;
    124         }
    125 
    126         // Yes. Compatible.
    127         if ( version_compare( $current_version, $required_version, '>=' ) ) {
    128             return;
    129         }
    130 
    131         // Deactivate the plugin silently, Prevent deactivation hooks from running.
    132         deactivate_plugins( $plugin_file, true );
    133     },
    134     12
    135 );
     86// Get the plugin running.
     87add_action( 'plugins_loaded', 'woo_2checkout_init' );
Note: See TracChangeset for help on using the changeset viewer.