PluginProbe
PayPlug for WooCommerce (Official) / 2.15.0
PayPlug for WooCommerce (Official) v2.15.0
3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 All 101 releases
payplug / payplug.php

payplug.php in PayPlug for WooCommerce (Official) 2.15.0, at payplug.php

101 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: PayPlug pour WooCommerce (Officiel)
4 * Plugin URI: https://www.payplug.com/modules/woocommerce
5 * Description: The online payment solution combining simplicity and first-rate support to boost your sales.
6 * Author: PayPlug
7 * Author URI: https://www.payplug.com/
8 * Text Domain: payplug
9 * Domain Path: /languages
10 * Version: 2.15.0
11 * WC tested up to: 10.3.4
12 * Requires plugins: woocommerce
13 * License: GPLv3 or later
14 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
15 */
16
17
18 namespace Payplug\PayplugWoocommerce;
19
20 // Exit if accessed directly
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit;
23 }
24
25
26 define( 'PAYPLUG_GATEWAY_VERSION', '2.15.0' );
27 define( 'PAYPLUG_GATEWAY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
28 define( 'PAYPLUG_GATEWAY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
29 define( 'PAYPLUG_GATEWAY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
30
31 /**
32 * Plugin bootstrap function.
33 */
34
35 /**
36 * $mo is the Mo object used to parse the English translations
37 *
38 * @var \MO
39 */
40 global $mo;
41 $mo = new \MO();
42
43 function init() {
44 if ( file_exists( plugin_dir_path( __FILE__ ) . '/vendor/autoload.php' ) ) {
45 require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php';
46 }
47
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);
58 }
59
60 function create_lock_table(){
61 init();
62 \Payplug\PayplugWoocommerce\Model\Lock::create_lock_table();
63 }
64
65 add_action( 'upgrader_process_complete', __NAMESPACE__ . '\\create_lock_table', 10, 2 );
66 add_action( 'activated_plugin', __NAMESPACE__ . '\\create_lock_table', 10, 2 );
67 add_action( 'plugins_loaded', __NAMESPACE__ . '\\init' );
68
69 add_action( 'before_woocommerce_init', function() {
70 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
71 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
72 }
73 } );
74
75 register_deactivation_hook( __FILE__, __NAMESPACE__ .'\\PayplugWoocommerceHelper::plugin_deactivation' );
76
77 /**
78 * A fail-safe in case a transltion does not exist shows the default translation (English)
79 *
80 * @param $msgstr string Translated text (Usually starts with "payplug_")
81 * @param $msgid string Text to translate (irrelevant because it is equal to $msgstr in this case)
82 * @param $domain string the domain is always = "payplug" (filter "gettext_payplug" is only for payplug translation domain)
83 *
84 * @return string
85 */
86 function wpdocs_translate_text($msgstr, $msgid, $domain)
87 {
88 $pattern = '/^payplug_.+/';
89
90 if (preg_match($pattern, $msgstr) === 1) {
91 if(isset($GLOBALS["mo"]->entries[$msgstr]))
92 return $GLOBALS["mo"]->entries[$msgstr]->translations[0];
93 }
94
95 return $msgstr;
96 }
97 add_filter('gettext_payplug', __NAMESPACE__ . '\\wpdocs_translate_text', 10, 3);
98
99
100
101