| @@ -6,28 +6,28 @@ | ||
| 6 | 6 | * Author: PayPlug |
| 7 | 7 | * Author URI: https://www.payplug.com/ |
| 8 | 8 | * Text Domain: payplug |
| 9 | 9 | * Domain Path: /languages |
| 10 | - * Version: 2.18.0 | |
| 11 | - * WC tested up to: 10.6.1 | |
| 12 | - * Requires plugins: woocommerce | |
| 10 | + * Version: 2.9.0 | |
| 11 | + * WC tested up to: 9.3.3 | |
| 13 | 12 | * License: GPLv3 or later |
| 14 | 13 | * License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 15 | 14 | */ |
| 16 | 15 | |
| 16 | + | |
| 17 | 17 | namespace Payplug\PayplugWoocommerce; |
| 18 | 18 | |
| 19 | 19 | // Exit if accessed directly |
| 20 | -if (!defined('ABSPATH')) { | |
| 21 | - exit; | |
| 20 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 21 | + exit; | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -define('PAYPLUG_GATEWAY_VERSION', '2.18.0'); | |
| 25 | -define('PAYPLUG_MAX_VERSION_FOR_UPGRADE', '2.16.1'); | |
| 26 | -define('PAYPLUG_GATEWAY_PLUGIN_DIR', plugin_dir_path(__FILE__)); | |
| 27 | -define('PAYPLUG_GATEWAY_PLUGIN_URL', plugin_dir_url(__FILE__)); | |
| 28 | -define('PAYPLUG_GATEWAY_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 29 | 24 | |
| 25 | +define( 'PAYPLUG_GATEWAY_VERSION', '2.9.0' ); | |
| 26 | +define( 'PAYPLUG_GATEWAY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); | |
| 27 | +define( 'PAYPLUG_GATEWAY_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); | |
| 28 | +define( 'PAYPLUG_GATEWAY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); | |
| 29 | + | |
| 30 | 30 | /** |
| 31 | 31 | * Plugin bootstrap function. |
| 32 | 32 | */ |
| 33 | 33 | |
| @@ -38,43 +38,36 @@ | ||
| 38 | 38 | */ |
| 39 | 39 | global $mo; |
| 40 | 40 | $mo = new \MO(); |
| 41 | 41 | |
| 42 | -function init() | |
| 43 | -{ | |
| 44 | - if (file_exists(plugin_dir_path(__FILE__) . '/vendor/autoload.php')) { | |
| 45 | - require_once plugin_dir_path(__FILE__) . '/vendor/autoload.php'; | |
| 46 | - } | |
| 42 | +function init() { | |
| 43 | + if ( file_exists( plugin_dir_path( __FILE__ ) . '/vendor/autoload.php' ) ) { | |
| 44 | + require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'; | |
| 45 | + } | |
| 46 | + PayplugWoocommerceHelper::load_plugin_textdomain( plugin_basename( dirname( __FILE__ ) ) . '/languages' ); | |
| 47 | + PayplugWoocommerce::get_instance(); | |
| 47 | 48 | |
| 48 | - if (file_exists(plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'payplug-config.php')) { | |
| 49 | - require_once plugin_dir_path(__FILE__) . DIRECTORY_SEPARATOR . 'payplug-config.php'; | |
| 50 | - } | |
| 51 | - | |
| 52 | - PayplugWoocommerceHelper::load_plugin_textdomain(plugin_basename(dirname(__FILE__)) . '/languages'); | |
| 53 | - PayplugWoocommerce::get_instance(); | |
| 54 | - | |
| 55 | - // parse the English translation file | |
| 56 | - $path = WP_PLUGIN_DIR . '/' . plugin_basename(dirname(__FILE__)) . '/languages/payplug-en_US.mo'; | |
| 57 | - $GLOBALS['mo']->import_from_file($path); | |
| 49 | + // parse the English translation file | |
| 50 | + $path = WP_PLUGIN_DIR . '/' . plugin_basename( dirname( __FILE__ ) ) . '/languages/payplug-en_US.mo'; | |
| 51 | + $GLOBALS["mo"]->import_from_file($path); | |
| 58 | 52 | } |
| 59 | 53 | |
| 60 | -function create_lock_table() | |
| 61 | -{ | |
| 62 | - init(); | |
| 63 | - \Payplug\PayplugWoocommerce\Model\Lock::create_lock_table(); | |
| 54 | +function create_lock_table(){ | |
| 55 | + init(); | |
| 56 | + \Payplug\PayplugWoocommerce\Model\Lock::create_lock_table(); | |
| 64 | 57 | } |
| 65 | 58 | |
| 66 | -add_action('upgrader_process_complete', __NAMESPACE__ . '\\create_lock_table', 10, 2); | |
| 67 | -add_action('activated_plugin', __NAMESPACE__ . '\\create_lock_table', 10, 2); | |
| 68 | -add_action('plugins_loaded', __NAMESPACE__ . '\\init'); | |
| 59 | +add_action( 'upgrader_process_complete', __NAMESPACE__ . '\\create_lock_table', 10, 2 ); | |
| 60 | +add_action( 'activated_plugin', __NAMESPACE__ . '\\create_lock_table', 10, 2 ); | |
| 61 | +add_action( 'plugins_loaded', __NAMESPACE__ . '\\init' ); | |
| 69 | 62 | |
| 70 | -add_action('before_woocommerce_init', function () { | |
| 71 | - if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { | |
| 72 | - \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true); | |
| 73 | - } | |
| 74 | -}); | |
| 63 | +add_action( 'before_woocommerce_init', function() { | |
| 64 | + if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { | |
| 65 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); | |
| 66 | + } | |
| 67 | +} ); | |
| 75 | 68 | |
| 76 | -register_deactivation_hook(__FILE__, __NAMESPACE__ . '\\PayplugWoocommerceHelper::plugin_deactivation'); | |
| 69 | +register_deactivation_hook( __FILE__, __NAMESPACE__ .'\\PayplugWoocommerceHelper::plugin_deactivation' ); | |
| 77 | 70 | |
| 78 | 71 | /** |
| 79 | 72 | * A fail-safe in case a transltion does not exist shows the default translation (English) |
| 80 | 73 | * |
| @@ -85,15 +78,17 @@ | ||
| 85 | 78 | * @return string |
| 86 | 79 | */ |
| 87 | 80 | function wpdocs_translate_text($msgstr, $msgid, $domain) |
| 88 | 81 | { |
| 89 | - $pattern = '/^payplug_.+/'; | |
| 82 | + $pattern = '/^payplug_.+/'; | |
| 90 | 83 | |
| 91 | - if (preg_match($pattern, $msgstr) === 1) { | |
| 92 | - if (isset($GLOBALS['mo']->entries[$msgstr])) { | |
| 93 | - return $GLOBALS['mo']->entries[$msgstr]->translations[0]; | |
| 94 | - } | |
| 95 | - } | |
| 84 | + if (preg_match($pattern, $msgstr) === 1) { | |
| 85 | + if(isset($GLOBALS["mo"]->entries[$msgstr])) | |
| 86 | + return $GLOBALS["mo"]->entries[$msgstr]->translations[0]; | |
| 87 | + } | |
| 96 | 88 | |
| 97 | - return $msgstr; | |
| 89 | + return $msgstr; | |
| 98 | 90 | } |
| 99 | 91 | add_filter('gettext_payplug', __NAMESPACE__ . '\\wpdocs_translate_text', 10, 3); |
| 92 | + | |
| 93 | + | |
| 94 | + | |