Plugin Directory

Changeset 3044506


Ignore:
Timestamp:
03/03/2024 03:02:21 PM (2 years ago)
Author:
EmranAhmed
Message:

Update to 3.0.0

Location:
woo-2checkout
Files:
114 added
4 edited

Legend:

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

    r2587161 r3044506  
    22Contributors: EmranAhmed, getwooplugins
    33Tags: 2checkout, 2checkout for woocommerce, 2checkout payment gateway, payment gateway, woocommerce payment gateway
    4 Stable tag: trunk
    5 Requires PHP: 7.0
    6 Requires at least: 5.5
    7 Tested up to: 5.8
    8 WC requires at least: 5.2
    9 WC tested up to: 5.6
     4Stable tag: 3.0.0
     5Requires PHP: 7.4
     6Requires at least: 6.1
     7Tested up to: 6.4
    108License: GPLv3
    119License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1513== Description ==
    1614
    17 === How To Setup 2Checkout Payment Gateway for WooCommerce In WordPress  ===
     15=== How To Set up 2Checkout Payment Gateway for WooCommerce In WordPress  ===
    1816
    1917[youtube https://www.youtube.com/watch?v=zev3t0HnYyI]
     
    2725Withdrawing fund is easy in 2Checkout. You can get paid many of currencies and plenty of methods including Electronic Funds Transfer that goes directly to your bank accounts, international Wire Transfer, or a 2Checkout branded Payoneer MasterCard.
    2826
     27= Basic Features =
    2928
    30 = Basic Feature =
    31 
     29* 2Checkout SHA2/SHA3 algorithm supported.
     30* WooCommerce Checkout Block supported.
     31* WooCommerce High-performance order storage supported.
    3232* Enable Standard Checkout.
    3333* Enable/Disable 2Checkout Payment Gateway
     
    4949[youtube https://www.youtube.com/watch?v=4US5YeUK_5k]
    5050
     51* WooCommerce Checkout Block supported.
    5152* Support WooCommerce Subscription. Both simple and variable subscription.
    52 * Support multiple subscription payment on a single checkout.
    5353* Enable Inline/Popup Checkout.
    5454* Refund Sales from WordPress Admin
     
    5757== Installation ==
    5858
    59 ### Automatic Install From WordPress Dashboard
     59### Automatic Installation From WordPress Dashboard
    6060
    61 1. Login to your the admin panel
     611. Login to your WordPress admin panel
    62622. Navigate to Plugins -> Add New
    63633. Search **Payment Gateway - 2Checkout for WooCommerce**
    64644. Click install and activate respectively.
    6565
    66 ### Manual Install From WordPress Dashboard
     66### Manual Installation From WordPress Dashboard
    6767
    6868If your server is not connected to the Internet, then you can use this method-
     
    8585
    8686== Changelog ==
     87
     88= 3.0.0 =
     89
     90* WooCommerce High-performance order storage Supported.
     91* WooCommerce Checkout Block Supported.
     92* Add: Support SHA2/SHA3 algorithm. 2Checkout will stop supporting the MD5 algorithm in their platform on the 15th of April, 2024.
     93* Add: WP 6.4+ and WC 8.6+ compatibility
    8794
    8895= 2.0.7 =
  • woo-2checkout/trunk/includes/functions.php

    r2587148 r3044506  
    11<?php
     2/**
     3 * Utility Functions.
     4 *
     5 * @package    StorePress\TwoCheckoutPaymentGateway;
     6 * @since      1.0.0
     7 */
    28
    3 defined( 'ABSPATH' ) or die( 'Keep Silent' );
     9namespace StorePress\TwoCheckoutPaymentGateway;
    410
    5 add_filter( 'woocommerce_no_available_payment_methods_message', function ( $no_gateways_message ) {
    6 
    7     $pro_url             = 'https://getwooplugins.com/plugins/woocommerce-2checkout/?utm_source=woo-2checkout-user&utm_medium=checkout-page&utm_campaign=woo-2checkout';
    8     $pro_text            = esc_html__( 'Payment Gateway - 2Checkout for WooCommerce - Pro ', 'woo-2checkout' );
    9     $pro_link            = sprintf( '<a target="_blank" href="%s">%s</a>', $pro_url, $pro_text );
    10     $no_gateways_message = '<strong>' . sprintf( esc_html__( 'Upgrade to %s to get WooCommerce Subscriptions payments, issue refunds from backend, inline popup checkout and more.', 'woo-2checkout' ), $pro_link ) . '</strong>';
    11 
    12     return $no_gateways_message;
    13 } );
     11defined( 'ABSPATH' ) || die( 'Keep Silent' );
  • woo-2checkout/trunk/languages/woo-2checkout.pot

    r2587148 r3044506  
    1 # Copyright (C) 2021 Payment Gateway - 2Checkout for WooCommerce
    2 # This file is distributed under the same license as the Payment Gateway - 2Checkout for WooCommerce package.
     1# Copyright (C) 2024 Emran Ahmed
     2# This file is distributed under the GPL v3 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Payment Gateway - 2Checkout for WooCommerce\n"
     5"Project-Id-Version: Payment Gateway - 2Checkout for WooCommerce 3.0.0\n"
     6"Report-Msgid-Bugs-To: https://getwooplugins.com/new-ticket/\n"
     7"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     8"Language-Team: LANGUAGE <LL@li.org>\n"
    69"MIME-Version: 1.0\n"
    710"Content-Type: text/plain; charset=UTF-8\n"
    811"Content-Transfer-Encoding: 8bit\n"
    9 "Language-Team: Emran Ahmed\n"
    10 "X-Poedit-Basepath: ..\n"
    11 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
    12 "X-Poedit-SearchPath-0: .\n"
    13 "X-Poedit-SearchPathExcluded-0: *.js\n"
    14 "X-Poedit-SourceCharset: UTF-8\n"
    15 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
    16 
    17 #: ../includes/class-woo-2checkout-gateway.php:23
     12"POT-Creation-Date: 2024-03-03T14:56:24+00:00\n"
     13"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     14"X-Generator: WP-CLI 2.10.0\n"
     15"language-team: LANGUAGE <EMAIL@ADDRESS>\n"
     16"X-Domain: woo-2checkout\n"
     17
     18#. Plugin Name of the plugin
     19#: woo-2checkout.php
     20msgid "Payment Gateway - 2Checkout for WooCommerce"
     21msgstr ""
     22
     23#. Plugin URI of the plugin
     24#: woo-2checkout.php
     25msgid "https://wordpress.org/plugins/woo-2checkout/"
     26msgstr ""
     27
     28#. Description of the plugin
     29#: woo-2checkout.php
     30msgid "2Checkout Payment Gateway for WooCommerce. Requires WooCommerce 5.5+"
     31msgstr ""
     32
     33#. Author of the plugin
     34#: woo-2checkout.php
     35msgid "Emran Ahmed"
     36msgstr ""
     37
     38#. Author URI of the plugin
     39#: woo-2checkout.php
     40msgid "https://getwooplugins.com/"
     41msgstr ""
     42
     43#: includes/Common.php:206
     44msgid "Unserializing instances of this class is forbidden."
     45msgstr ""
     46
     47#: includes/ConvertPlus/ConvertPlus_Block.php:74
     48#: includes/Payment_Gateway.php:102
     49#: includes/Payment_Gateway.php:260
     50#: src/convert-plus-block.js:27
     51msgid "Proceed to 2Checkout"
     52msgstr ""
     53
     54#: includes/ConvertPlus/ConvertPlus_Block.php:75
     55#: includes/Payment_Gateway.php:100
     56#: includes/Payment_Gateway.php:245
     57#: src/convert-plus-block.js:23
     58msgid "2Checkout"
     59msgstr ""
     60
     61#: includes/ConvertPlus/ConvertPlus_Block.php:76
     62#: includes/Payment_Gateway.php:101
     63#: includes/Payment_Gateway.php:253
     64msgid "Pay via 2Checkout. Accept Credit Cards, PayPal and Debit Cards."
     65msgstr ""
     66
     67#. translators: Shipping Method Name
     68#: includes/ConvertPlus/ConvertPlus_Gateway.php:401
     69msgid "Shipping via %s"
     70msgstr ""
     71
     72#: includes/ConvertPlus/ConvertPlus_Gateway.php:454
     73msgid "Failed to Generate 2Checkout ConvertPlus URL."
     74msgstr ""
     75
     76#. translators: 1: Extended Plugin Name. 2: Extended Plugin Version. 3: Extended Plugin Compatible Version.
     77#: includes/Extended_Plugin_Upgrade_Notice.php:68
     78msgid "You are using an incompatible version of <strong>%1$s - (%2$s)</strong>. Please upgrade to version <strong>%3$s</strong> or upper."
     79msgstr ""
     80
     81#: includes/Payment_Gateway.php:90
    1882msgid "2Checkout Payment Gateway"
    1983msgstr ""
    2084
    21 #: ../includes/class-woo-2checkout-gateway.php:24
     85#: includes/Payment_Gateway.php:91
    2286msgid "2Checkout accept mobile and online payments from customers worldwide."
    2387msgstr ""
    2488
    25 #: ../includes/class-woo-2checkout-gateway.php:33, ../includes/class-woo-2checkout-gateway.php:121
    26 msgid "2Checkout"
    27 msgstr ""
    28 
    29 #: ../includes/class-woo-2checkout-gateway.php:34, ../includes/class-woo-2checkout-gateway.php:129
    30 msgid "Pay via 2Checkout. Accept Credit Cards, PayPal and Debit Cards"
    31 msgstr ""
    32 
    33 #: ../includes/class-woo-2checkout-gateway.php:35, ../includes/class-woo-2checkout-gateway.php:136
    34 msgid "Proceed to 2Checkout"
    35 msgstr ""
    36 
    37 #: ../includes/class-woo-2checkout-gateway.php:111
     89#. translators: Demo mode test payment. %s: Test payment card link.
     90#: includes/Payment_Gateway.php:117
     91msgid "<strong>DEMO MODE ENABLED.</strong> Use a %s"
     92msgstr ""
     93
     94#: includes/Payment_Gateway.php:235
    3895msgid "Enable/Disable"
    3996msgstr ""
    4097
    41 #: ../includes/class-woo-2checkout-gateway.php:113
     98#: includes/Payment_Gateway.php:237
    4299msgid "Enable 2Checkout Payment Gateway"
    43100msgstr ""
    44101
    45 #: ../includes/class-woo-2checkout-gateway.php:118
     102#: includes/Payment_Gateway.php:242
    46103msgid "Title"
    47104msgstr ""
    48105
    49 #: ../includes/class-woo-2checkout-gateway.php:120
     106#: includes/Payment_Gateway.php:244
    50107msgid "This controls the title which the user sees during checkout."
    51108msgstr ""
    52109
    53 #: ../includes/class-woo-2checkout-gateway.php:126
     110#: includes/Payment_Gateway.php:250
    54111msgid "Description"
    55112msgstr ""
    56113
    57 #: ../includes/class-woo-2checkout-gateway.php:128
     114#: includes/Payment_Gateway.php:252
    58115msgid "This controls the description which the user sees during checkout."
    59116msgstr ""
    60117
    61 #: ../includes/class-woo-2checkout-gateway.php:133
     118#: includes/Payment_Gateway.php:257
    62119msgid "Order button text"
    63120msgstr ""
    64121
    65 #: ../includes/class-woo-2checkout-gateway.php:135
     122#: includes/Payment_Gateway.php:259
    66123msgid "Checkout order button text."
    67124msgstr ""
    68125
    69 #: ../includes/class-woo-2checkout-gateway.php:141
     126#: includes/Payment_Gateway.php:265
    70127msgid "Read How to Setup"
    71128msgstr ""
    72129
    73 #: ../includes/class-woo-2checkout-gateway.php:148
     130#: includes/Payment_Gateway.php:271
    74131msgid "Merchant Code"
    75132msgstr ""
    76133
    77 #: ../includes/class-woo-2checkout-gateway.php:152
     134#. translators: Webhook URL
     135#: includes/Payment_Gateway.php:275
    78136msgid "Please enter 2Checkout <strong>Merchant Code</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > API Section</a>."
    79137msgstr ""
    80138
    81 #: ../includes/class-woo-2checkout-gateway.php:156
     139#: includes/Payment_Gateway.php:279
    82140msgid "Secret Key"
    83141msgstr ""
    84142
    85 #: ../includes/class-woo-2checkout-gateway.php:158
     143#. translators: Webhook URL
     144#: includes/Payment_Gateway.php:281
    86145msgid "Please enter 2Checkout <strong>Secret Key</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > API Section</a>"
    87146msgstr ""
    88147
    89 #: ../includes/class-woo-2checkout-gateway.php:164
     148#: includes/Payment_Gateway.php:287
    90149msgid "Buy Link Secret Word"
    91150msgstr ""
    92151
    93 #: ../includes/class-woo-2checkout-gateway.php:166
     152#. translators: Webhook URL
     153#: includes/Payment_Gateway.php:289
    94154msgid "Please enter 2Checkout <strong>Buy link secret word</strong> from <a target=\"_blank\" href=\"%s\">Integrations > Webhooks &amp; API > Secret word</a> section"
    95155msgstr ""
    96156
    97 #: ../includes/class-woo-2checkout-gateway.php:172
     157#: includes/Payment_Gateway.php:295
    98158msgid "Demo Mode"
    99159msgstr ""
    100160
    101 #: ../includes/class-woo-2checkout-gateway.php:174
     161#: includes/Payment_Gateway.php:297
    102162msgid "Enable Demo Mode"
    103163msgstr ""
    104164
    105 #: ../includes/class-woo-2checkout-gateway.php:176
     165#: includes/Payment_Gateway.php:299
    106166msgid "This mode allows you to test your setup to make sure everything works as expected without take real payment."
    107167msgstr ""
    108168
    109 #: ../includes/class-woo-2checkout-gateway.php:180
     169#: includes/Payment_Gateway.php:303
    110170msgid "Debug Log"
    111171msgstr ""
    112172
    113 #: ../includes/class-woo-2checkout-gateway.php:182
     173#: includes/Payment_Gateway.php:305
    114174msgid "Enable Logging"
    115175msgstr ""
    116176
    117 #: ../includes/class-woo-2checkout-gateway.php:184
     177#. translators: WooCommerce Log URL
     178#: includes/Payment_Gateway.php:307
    118179msgid "Log 2Checkout events, <strong>DON'T ALWAYS ENABLE THIS.</strong> You can check this log in %s."
    119180msgstr ""
    120181
    121 #: ../includes/class-woo-2checkout-gateway.php:184
     182#. translators: WooCommerce Log URL
     183#: includes/Payment_Gateway.php:307
    122184msgid "System Status &gt; Logs"
    123185msgstr ""
    124186
    125 #: ../includes/class-woo-2checkout-gateway.php:189
     187#: includes/Payment_Gateway.php:311
    126188msgid "Gateway Icon Style"
    127189msgstr ""
    128190
    129 #: ../includes/class-woo-2checkout-gateway.php:192
     191#: includes/Payment_Gateway.php:314
    130192msgid "Choose Gateway a Icon Style"
    131193msgstr ""
    132194
    133 #: ../includes/class-woo-2checkout-gateway.php:194
     195#: includes/Payment_Gateway.php:316
    134196msgid "Dark"
    135197msgstr ""
    136198
    137 #: ../includes/class-woo-2checkout-gateway.php:195
     199#: includes/Payment_Gateway.php:317
    138200msgid "Light"
    139201msgstr ""
    140202
    141 #: ../includes/class-woo-2checkout-gateway.php:201
     203#: includes/Payment_Gateway.php:323
    142204msgid "Gateway Icon Width"
    143205msgstr ""
    144206
    145 #: ../includes/class-woo-2checkout-gateway.php:203
     207#: includes/Payment_Gateway.php:325
    146208msgid "Gateway Icon Width in %. Limit: 1-100"
    147209msgstr ""
    148210
    149 #: ../includes/class-woo-2checkout-gateway.php:219
    150 msgid "Standard Checkout ( Process on 2Checkout site )"
    151 msgstr ""
    152 
    153 #: ../includes/class-woo-2checkout-gateway.php:220
     211#: includes/Payment_Gateway.php:336
     212#: includes/Payment_Gateway.php:339
     213msgid "Choose checkout type"
     214msgstr ""
     215
     216#: includes/Payment_Gateway.php:341
     217msgid "Standard Checkout ( Process on 2Checkout Site )"
     218msgstr ""
     219
     220#: includes/Payment_Gateway.php:342
    154221msgid "Popup After Checkout - Inline Checkout - PRO FEATURE"
    155222msgstr ""
    156223
    157 #: ../includes/class-woo-2checkout-gateway.php:221
     224#: includes/Payment_Gateway.php:343
    158225msgid "Popup During Checkout - Inline Checkout - PRO FEATURE"
    159226msgstr ""
    160227
    161 #: ../includes/class-woo-2checkout-gateway.php:222
     228#: includes/Payment_Gateway.php:344
    162229msgid "On Page Credit Card Only - PRO FEATURE"
    163230msgstr ""
    164231
    165 #: ../includes/class-woo-2checkout-gateway.php:273
     232#. translators: %s: WebHook link.
     233#: includes/Payment_Gateway.php:421
    166234msgid "<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>"
    167235msgstr ""
    168236
    169 #: ../includes/class-woo-2checkout-gateway.php:516
     237#: includes/Payment_Gateway.php:746
    170238msgid "Item"
    171239msgstr ""
    172240
    173 #: ../includes/class-woo-2checkout-gateway.php:682
    174 msgid "Shipping via %s"
    175 msgstr ""
    176 
    177 #: ../includes/class-woo-2checkout-gateway.php:884, ../includes/class-woo-2checkout-gateway.php:888
     241#: includes/Payment_Gateway.php:778
    178242msgid "Payment Gateway - 2Checkout for WooCommerce disabled"
    179243msgstr ""
    180244
    181 #: ../includes/class-woo-2checkout-gateway.php:884
     245#: includes/Payment_Gateway.php:778
    182246msgid "You must fill the \"Merchant Code\" and the \"Secret Key\" and \"Buy Link Secret Word\" fields."
    183247msgstr ""
    184248
    185 #: ../includes/class-woo-2checkout-gateway.php:888
     249#: includes/Payment_Gateway.php:787
     250msgid "Billing Currency not supported. Payment Gateway - 2Checkout for WooCommerce disabled"
     251msgstr ""
     252
     253#: includes/Payment_Gateway.php:787
    186254msgid "2Checkout does not support your store currency."
    187255msgstr ""
    188256
    189 #: ../includes/class-woo-2checkout-gateway.php:896
    190 msgid "<strong>DEMO MODE ENABLED.</strong> Use a %s"
    191 msgstr ""
    192 
    193 #: ../includes/functions.php:8
     257#: includes/Payment_Gateway.php:812
     258msgid "Should override on child class."
     259msgstr ""
     260
     261#: includes/Plugin.php:177
    194262msgid "Payment Gateway - 2Checkout for WooCommerce - Pro "
    195263msgstr ""
    196264
    197 #: ../includes/functions.php:10
    198 msgid "Upgrade to %s to get WooCommerce Subscriptions payments, issue refunds from backend, inline popup checkout and more."
    199 msgstr ""
    200 
    201 #: ../woo-2checkout.php:134
     265#. translators: %s: Pro version link.
     266#: includes/Plugin.php:181
     267msgid "Upgrade to %s to get WooCommerce Subscriptions payments, issue refunds from wp admin, inline popup checkout and more."
     268msgstr ""
     269
     270#: includes/Plugin.php:480
    202271msgid "Settings"
    203272msgstr ""
    204273
    205 #: ../woo-2checkout.php:150
    206 msgid "Currently, you are using older version of WooCommerce. It's recommended to use latest version of WooCommerce to work with %s."
    207 msgstr ""
    208 
    209 #: ../woo-2checkout.php:150
    210 msgid "WooCommerce 2Checkout Payment Gateway"
    211 msgstr ""
    212 
    213 #: ../woo-2checkout.php:158
    214 msgid "Please check PHP version requirement."
    215 msgstr ""
    216 
    217 #: ../woo-2checkout.php:160
    218 msgid "It's required to use latest version of PHP to use <strong>Payment Gateway - 2Checkout for WooCommerce</strong>."
    219 msgstr ""
    220 
    221 #: ../woo-2checkout.php:172
     274#: woo-2checkout.php:83
    222275msgid "WooCommerce"
    223276msgstr ""
    224277
    225 #: ../woo-2checkout.php:180
    226 msgid "<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is a payment gateway plugin of "
    227 msgstr ""
    228 
    229 #: ../woo-2checkout.php:241
    230 msgid "Read Documentation"
    231 msgstr ""
    232 
    233 #: ../woo-2checkout.php:242
    234 msgid "Facing issue?"
    235 msgstr ""
    236 
    237 #: ../woo-2checkout.php:242
    238 msgid "Please open a ticket."
    239 msgstr ""
     278#: woo-2checkout.php:95
     279msgid "<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is an add-on of "
     280msgstr ""
     281
     282#: src/convert-plus-block.js:89
     283msgid "DEMO MODE ENABLED."
     284msgstr ""
     285
     286#: src/convert-plus-block.js:91
     287msgid "Use a"
     288msgstr ""
     289
     290#: src/convert-plus-block.js:98
     291msgid "test payment cards"
     292msgstr ""
  • woo-2checkout/trunk/woo-2checkout.php

    r2587148 r3044506  
    11<?php
    22/**
    3  * Plugin Name: Payment Gateway - 2Checkout for WooCommerce
    4  * Plugin URI: https://wordpress.org/plugins/woo-2checkout/
    5  * Description: 2Checkout Payment Gateway for WooCommerce. Requires WooCommerce 5.5+
    6  * Author: Emran Ahmed
    7  * Version: 2.0.7
    8  * Domain Path: /languages
    9  * Requires PHP: 7.0
    10  * Requires at least: 5.5
    11  * Tested up to: 5.8
    12  * WC requires at least: 5.2
    13  * WC tested up to: 5.6
    14  * Text Domain: woo-2checkout
    15  * Author URI: https://getwooplugins.com/
     3 * Payment Gateway - 2Checkout for WooCommerce
     4 *
     5 * @package    StorePress\PaymentGateway
     6 *
     7 * @wordpress-plugin
     8 * Plugin Name:          Payment Gateway - 2Checkout for WooCommerce
     9 * Plugin URI:           https://wordpress.org/plugins/woo-2checkout/
     10 * Description:          2Checkout Payment Gateway for WooCommerce. Requires WooCommerce 5.5+
     11 * Author:               Emran Ahmed
     12 * Version:              3.0.0
     13 * Requires PHP:         7.4
     14 * Requires at least:    6.1
     15 * Tested up to:         6.4
     16 *
     17 * WC requires at least: 8.1
     18 * WC tested up to:      8.6
     19 * Text Domain:          woo-2checkout
     20 * Author URI:           https://getwooplugins.com/
     21 * License:              GPL v3 or later
     22 * License URI:          https://www.gnu.org/licenses/gpl-3.0.html
     23 * Domain Path:          /languages
    1624 */
    1725
    18 defined( 'ABSPATH' ) or die( 'Keep Silent' );
     26defined( 'ABSPATH' ) || die( 'Keep Silent' );
    1927
    20 if ( ! class_exists( 'Woo_2Checkout' ) ):
     28use StorePress\TwoCheckoutPaymentGateway\Plugin;
    2129
    22     final class Woo_2Checkout {
     30if ( ! defined( 'STOREPRESS_TWO_CHECKOUT_PLUGIN_FILE' ) ) {
     31    define( 'STOREPRESS_TWO_CHECKOUT_PLUGIN_FILE', __FILE__ );
     32}
    2333
    24         protected $_version = '2.0.7';
    25         protected static $_instance = null;
     34if ( ! defined( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION' ) ) {
     35    define( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION', '3.0.0' );
     36}
    2637
    27         public static function instance() {
    28             if ( is_null( self::$_instance ) ) {
    29                 self::$_instance = new self();
    30             }
     38// Include the Plugin class.
     39if ( ! class_exists( '\StorePress\TwoCheckoutPaymentGateway\Plugin' ) ) {
     40    require_once plugin_dir_path( __FILE__ ) . 'includes/Plugin.php';
     41}
    3142
    32             return self::$_instance;
     43/**
     44 * Get compatible version of extended plugin.
     45 *
     46 * @return string
     47 */
     48function woo_2checkout_compatible_pro_version(): string {
     49    return constant( 'STOREPRESS_TWO_CHECKOUT_COMPATIBLE_EXTENDED_VERSION' );
     50}
     51
     52/**
     53 * The main function that returns the Plugin class
     54 *
     55 * @return Plugin|false
     56 * @since 2.1.0
     57 */
     58function woo_2checkout() {
     59    // Include the main class.
     60
     61    if ( ! class_exists( 'WooCommerce' ) ) {
     62        return false;
     63    }
     64
     65    if ( function_exists( 'woo_2checkout_pro' ) ) {
     66        return woo_2checkout_pro();
     67    }
     68
     69    return Plugin::instance();
     70}
     71
     72// Get the plugin running.
     73add_action( 'plugins_loaded', 'woo_2checkout' );
     74
     75/**
     76 * Admin Notice for required plugin.
     77 *
     78 * @return void
     79 */
     80function woo_2checkout_requirements_notice() {
     81    if ( ! class_exists( 'WooCommerce' ) ) {
     82
     83        $text = esc_html__( 'WooCommerce', 'woo-2checkout' );
     84
     85        $plugin_args = array(
     86            'tab'       => 'plugin-information',
     87            'plugin'    => 'woocommerce',
     88            'TB_iframe' => 'true',
     89            'width'     => '640',
     90            'height'    => '500',
     91        );
     92
     93        $link = add_query_arg( $plugin_args, admin_url( 'plugin-install.php' ) );
     94
     95        $message = __( '<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is an add-on of ', 'woo-2checkout' );
     96
     97        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 ) );
     98    }
     99}
     100
     101add_action( 'admin_notices', 'woo_2checkout_requirements_notice' );
     102
     103// Deactivate too old extended plugin.
     104add_action(
     105    'admin_init',
     106    function () {
     107
     108        $plugin_file = 'woo-2checkout-pro/woo-2checkout-pro.php';
     109
     110        $file   = wp_normalize_path( $plugin_file );
     111        $plugin = plugin_basename( $file );
     112
     113        $abs_file = trailingslashit( WP_PLUGIN_DIR ) . $plugin;
     114
     115        if ( ! file_exists( $abs_file ) ) {
     116            return;
    33117        }
    34118
    35         public function __construct() {
    36             $this->constants();
    37             $this->language();
    38             $this->includes();
    39             $this->hooks();
    40             do_action( 'woo_2checkout_loaded', $this );
     119        $data             = get_plugin_data( $abs_file );
     120        $required_version = woo_2checkout_compatible_pro_version();
     121        $current_version  = sanitize_text_field( $data['Version'] );
     122
     123        if ( is_plugin_inactive( $plugin_file ) ) {
     124            return;
    41125        }
    42126
    43         public function define( $name, $value, $case_insensitive = false ) {
    44             if ( ! defined( $name ) ) {
    45                 define( $name, $value, $case_insensitive );
    46             }
     127        // Yes. Compatible.
     128        if ( version_compare( $current_version, $required_version, '>=' ) ) {
     129            return;
    47130        }
    48131
    49         public function constants() {
    50             $this->define( 'WOO_2CO_PLUGIN_URI', plugin_dir_url( __FILE__ ) );
    51             $this->define( 'WOO_2CO_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    52             $this->define( 'WOO_2CO_VERSION', $this->version() );
    53             $this->define( 'WOO_2CO_PLUGIN_INCLUDE_PATH', trailingslashit( plugin_dir_path( __FILE__ ) . 'includes' ) );
    54             $this->define( 'WOO_2CO_PLUGIN_DIRNAME', dirname( plugin_basename( __FILE__ ) ) );
    55             $this->define( 'WOO_2CO_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    56             $this->define( 'WOO_2CO_PLUGIN_FILE', __FILE__ );
    57             $this->define( 'WOO_2CO_IMAGES_URI', trailingslashit( plugin_dir_url( __FILE__ ) . 'images' ) );
    58             $this->define( 'WOO_2CO_ASSETS_URI', trailingslashit( plugin_dir_url( __FILE__ ) . 'assets' ) );
    59         }
    60 
    61         public function includes() {
    62             if ( $this->is_required_php_version() && $this->is_wc_active() ) {
    63                 require_once $this->include_path( 'class-woo-2checkout-gateway.php' );
    64                 require_once $this->include_path( 'class-woo-2checkout-gateway-api.php' );
    65                 require_once $this->include_path( 'functions.php' );
    66             }
    67         }
    68 
    69         public function is_pro_active() {
    70             return class_exists( 'Woo_2Checkout_Pro' );
    71         }
    72 
    73         public function get_pro_link( $medium = 'go-pro' ) {
    74 
    75             $affiliate_id = apply_filters( 'gwp_affiliate_id', 0 );
    76 
    77             $link_args = array();
    78 
    79             if ( ! empty( $affiliate_id ) ) {
    80                 $link_args['ref'] = esc_html( $affiliate_id );
    81             }
    82 
    83             $link_args['utm_source']   = 'wp-admin-plugins';
    84             $link_args['utm_medium']   = esc_attr( $medium );
    85             $link_args['utm_campaign'] = 'woo-2checkout';
    86             $link_args['utm_term']     = sanitize_title( $this->get_parent_theme_name() );
    87 
    88             $link_args = apply_filters( 'wvs_get_pro_link_args', $link_args );
    89 
    90             return esc_url( add_query_arg( $link_args, 'https://getwooplugins.com/plugins/woocommerce-2checkout/' ) );
    91         }
    92 
    93         public function include_path( $file ) {
    94             $file = ltrim( $file, '/' );
    95 
    96             return WOO_2CO_PLUGIN_INCLUDE_PATH . $file;
    97         }
    98 
    99         public function hooks() {
    100             add_action( 'admin_notices', array( $this, 'php_requirement_notice' ) );
    101             add_action( 'admin_notices', array( $this, 'wc_requirement_notice' ) );
    102             add_action( 'admin_notices', array( $this, 'wc_version_requirement_notice' ) );
    103             add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
    104 
    105             if ( $this->is_required_php_version() && $this->is_wc_active() ) {
    106 
    107                 add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway' ) );
    108 
    109                 add_filter( 'plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
    110             }
    111         }
    112 
    113         public function add_gateway( $methods ) {
    114 
    115             $methods[] = $this->get_gateway_class_name();
    116 
    117             return $methods;
    118         }
    119 
    120         public function get_gateway_class_name() {
    121             return apply_filters( 'woo_2checkout_get_gateway_class_name', 'Woo_2Checkout_Gateway', $this );
    122         }
    123 
    124         public function plugin_action_links( $links ) {
    125 
    126             $new_links = array();
    127 
    128             $settings_link = esc_url( add_query_arg( array(
    129                 'page'    => 'wc-settings',
    130                 'tab'     => 'checkout',
    131                 'section' => 'woo-2checkout'
    132             ), admin_url( 'admin.php' ) ) );
    133 
    134             $new_links['settings'] = sprintf( '<a href="%1$s" title="%2$s">%2$s</a>', $settings_link, esc_attr__( 'Settings', 'woo-2checkout' ) );
    135 
    136             return array_merge( $links, $new_links );
    137         }
    138 
    139         public function is_required_php_version() {
    140             return version_compare( PHP_VERSION, '5.6.0', '>=' );
    141         }
    142 
    143         public function is_required_wc_version() {
    144             return version_compare( WC_VERSION, '3.5', '>' );
    145         }
    146 
    147         public function wc_version_requirement_notice() {
    148             if ( $this->is_wc_active() && ! $this->is_required_wc_version() ) {
    149                 $class   = 'notice notice-error';
    150                 $message = sprintf( esc_html__( "Currently, you are using older version of WooCommerce. It's recommended to use latest version of WooCommerce to work with %s.", 'woo-2checkout' ), esc_html__( 'WooCommerce 2Checkout Payment Gateway', 'woo-2checkout' ) );
    151                 printf( '<div class="%1$s"><p><strong>%2$s</strong></p></div>', $class, $message );
    152             }
    153         }
    154 
    155         public function php_requirement_notice() {
    156             if ( ! $this->is_required_php_version() ) {
    157                 $class   = 'notice notice-error';
    158                 $text    = esc_html__( 'Please check PHP version requirement.', 'woo-2checkout' );
    159                 $link    = esc_url( 'https://docs.woocommerce.com/document/server-requirements/' );
    160                 $message = wp_kses( __( "It's required to use latest version of PHP to use <strong>Payment Gateway - 2Checkout for WooCommerce</strong>.", 'woo-2checkout' ), array( 'strong' => array() ) );
    161 
    162                 printf( '<div class="%1$s"><p>%2$s <a target="_blank" href="%3$s">%4$s</a></p></div>', $class, $message, $link, $text );
    163             }
    164         }
    165 
    166         public function wc_requirement_notice() {
    167 
    168             if ( ! $this->is_wc_active() ) {
    169 
    170                 $class = 'notice notice-error';
    171 
    172                 $text    = esc_html__( 'WooCommerce', 'woo-2checkout' );
    173                 $link    = esc_url( add_query_arg( array(
    174                     'tab'       => 'plugin-information',
    175                     'plugin'    => 'woocommerce',
    176                     'TB_iframe' => 'true',
    177                     'width'     => '640',
    178                     'height'    => '500',
    179                 ), admin_url( 'plugin-install.php' ) ) );
    180                 $message = wp_kses( __( "<strong>Payment Gateway - 2Checkout for WooCommerce</strong> is a payment gateway plugin of ", 'woo-2checkout' ), array( 'strong' => array() ) );
    181 
    182                 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>', $class, $message, $link, $text );
    183             }
    184         }
    185 
    186         public function language() {
    187             load_plugin_textdomain( 'woo-2checkout', false, trailingslashit( WOO_2CO_PLUGIN_DIRNAME ) . 'languages' );
    188         }
    189 
    190         public function is_wc_active() {
    191             return class_exists( 'WooCommerce' );
    192         }
    193 
    194         public function basename() {
    195             return WOO_2CO_PLUGIN_BASENAME;
    196         }
    197 
    198         public function dirname() {
    199             return WOO_2CO_PLUGIN_DIRNAME;
    200         }
    201 
    202         public function version() {
    203             return esc_attr( $this->_version );
    204         }
    205 
    206         public function plugin_path() {
    207             return untrailingslashit( plugin_dir_path( __FILE__ ) );
    208         }
    209 
    210         public function plugin_uri() {
    211             return untrailingslashit( plugins_url( '/', __FILE__ ) );
    212         }
    213 
    214         public function images_uri( $file ) {
    215             $file = ltrim( $file, '/' );
    216 
    217             return WOO_2CO_IMAGES_URI . $file;
    218         }
    219 
    220         public function assets_uri( $file ) {
    221             $file = ltrim( $file, '/' );
    222 
    223             return WOO_2CO_ASSETS_URI . $file;
    224         }
    225 
    226         public function plugin_row_meta( $links, $file ) {
    227             if ( $file == $this->basename() ) {
    228 
    229                 $report_url = add_query_arg( array(
    230                     'utm_source'   => 'wp-admin-plugins',
    231                     'utm_medium'   => 'row-meta-link',
    232                     'utm_campaign' => 'woo-2checkout'
    233                 ), 'https://getwooplugins.com/tickets/' );
    234 
    235                 $documentation_url = add_query_arg( array(
    236                     'utm_source'   => 'wp-admin-plugins',
    237                     'utm_medium'   => 'row-meta-link',
    238                     'utm_campaign' => 'woo-2checkout'
    239                 ), 'https://getwooplugins.com/documentation/woocommerce-2checkout/' );
    240 
    241                 $row_meta['documentation'] = sprintf( '<a target="_blank" href="%1$s" title="%2$s">%2$s</a>', esc_url( $documentation_url ), esc_html__( 'Read Documentation', 'woo-2checkout' ) );
    242                 $row_meta['issues']        = sprintf( '%2$s <a target="_blank" href="%1$s">%3$s</a>', esc_url( $report_url ), esc_html__( 'Facing issue?', 'woo-2checkout' ), '<span style="color: red">' . esc_html__( 'Please open a ticket.', 'woo-2checkout' ) . '</span>' );
    243 
    244                 return array_merge( $links, $row_meta );
    245             }
    246 
    247             return (array) $links;
    248         }
    249 
    250         public function get_theme_name() {
    251             return wp_get_theme()->get( 'Name' );
    252         }
    253 
    254         public function get_theme_dir() {
    255             return strtolower( basename( get_template_directory() ) );
    256         }
    257 
    258         public function get_parent_theme_name() {
    259             return wp_get_theme( get_template() )->get( 'Name' );
    260         }
    261 
    262         public function get_parent_theme_dir() {
    263             return strtolower( basename( get_stylesheet_directory() ) );
    264         }
    265     }
    266 
    267     function woo_2checkout() {
    268         return Woo_2Checkout::instance();
    269     }
    270 
    271     add_action( 'plugins_loaded', 'woo_2checkout' );
    272 
    273 endif;
     132        // Deactivate the plugin silently, Prevent deactivation hooks from running.
     133        deactivate_plugins( $plugin_file, true );
     134    },
     135    12
     136);
Note: See TracChangeset for help on using the changeset viewer.