PluginProbe
PayPlug for WooCommerce (Official) / 2.5.3
PayPlug for WooCommerce (Official) v2.5.3
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.5.3, at payplug.php

86 lines 2.5 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.5.3
11 * WC tested up to: 7.7.0
12 * License: GPLv3 or later
13 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
14 */
15
16
17 namespace Payplug\PayplugWoocommerce;
18
19 // Exit if accessed directly
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24
25 define( 'PAYPLUG_GATEWAY_VERSION', '2.5.3' );
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 /**
31 * Plugin bootstrap function.
32 */
33
34 /**
35 * $mo is the Mo object used to parse the English translations
36 *
37 * @var \MO
38 */
39 global $mo;
40 $mo = new \MO();
41
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();
48
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);
52 }
53
54 function create_lock_table(){
55 init();
56 \Payplug\PayplugWoocommerce\Model\Lock::create_lock_table();
57 }
58
59 add_action( 'plugins_loaded', __NAMESPACE__ . '\\create_lock_table' );
60 register_deactivation_hook( __FILE__, __NAMESPACE__ .'\\PayplugWoocommerceHelper::plugin_deactivation' );
61
62 /**
63 * A fail-safe in case a transltion does not exist shows the default translation (English)
64 *
65 * @param $msgstr string Translated text (Usually starts with "payplug_")
66 * @param $msgid string Text to translate (irrelevant because it is equal to $msgstr in this case)
67 * @param $domain string the domain is always = "payplug" (filter "gettext_payplug" is only for payplug translation domain)
68 *
69 * @return string
70 */
71 function wpdocs_translate_text($msgstr, $msgid, $domain)
72 {
73 $pattern = '/^payplug_.+/';
74
75 if (preg_match($pattern, $msgstr) === 1) {
76 if(isset($GLOBALS["mo"]->entries[$msgstr]))
77 return $GLOBALS["mo"]->entries[$msgstr]->translations[0];
78 }
79
80 return $msgstr;
81 }
82 add_filter('gettext_payplug', __NAMESPACE__ . '\\wpdocs_translate_text', 10, 3);
83
84
85
86