-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcyfer-automatic-discount-per-payment-method.php
More file actions
91 lines (82 loc) · 3.42 KB
/
Copy pathcyfer-automatic-discount-per-payment-method.php
File metadata and controls
91 lines (82 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
*
* @link https://github.com/fernandocyfer/Dynamic-Payment-Discounts
* @since 1.0.0
* @package Cyfer_Desconto_Automatico_Por_Metodo_De_Pagamento
*
* @wordpress-plugin
* Plugin Name: Desconto Automático por Método de Pagamento | Cyfer
* Plugin URI: https://github.com/fernandocyfer/Dynamic-Payment-Discounts
* Description: Aplica descontos automáticos baseados no método de pagamento selecionado no WooCommerce.
* Version: 1.0.0
* Author: Cyfer Development
* Author URI: https://www.cyfer.com.br/
* Contributors: cyferweb
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: cyfer-automatic-discount-per-payment-method
* Domain Path: /languages
* Requires at least: 5.0
* Requires PHP: 7.0
* WC requires at least: 5.0
* WC tested up to: 8.0
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
/**
* Currently plugin version.
*/
define('CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_VERSION', '1.0.0');
define('CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_FILE', __FILE__ );
define('CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_URL', plugin_dir_url(__FILE__));
/**
* The code that runs during plugin activation.
*/
function cyfer_desconto_automatico_por_metodo_de_pagamento_activate() {
require_once CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_DIR . 'includes/class-cyfer-desconto-automatico-por-metodo-de-pagamento-activator.php';
Cyfer_Desconto_Automatico_Por_Metodo_De_Pagamento_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
*/
function cyfer_desconto_automatico_por_metodo_de_pagamento_deactivate() {
require_once CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_DIR . 'includes/class-cyfer-desconto-automatico-por-metodo-de-pagamento-deactivator.php';
Cyfer_Desconto_Automatico_Por_Metodo_De_Pagamento_Deactivator::deactivate();
}
register_activation_hook(__FILE__, 'cyfer_desconto_automatico_por_metodo_de_pagamento_activate');
register_deactivation_hook(__FILE__, 'cyfer_desconto_automatico_por_metodo_de_pagamento_deactivate');
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require CYFER_DESCONTO_AUTOMATICO_POR_METODO_DE_PAGAMENTO_PLUGIN_DIR . 'includes/class-cyfer-desconto-automatico-por-metodo-de-pagamento.php';
/**
* Begins execution of the plugin.
*/
function cyfer_desconto_automatico_por_metodo_de_pagamento_run() {
$plugin = new Cyfer_Desconto_Automatico_Por_Metodo_De_Pagamento();
$plugin->run();
}
// Verifica se o WooCommerce está ativo
function cyfer_desconto_check_woocommerce() {
if (!class_exists('WooCommerce')) {
add_action('admin_notices', 'cyfer_desconto_woocommerce_notice');
return;
}
cyfer_desconto_automatico_por_metodo_de_pagamento_run();
}
add_action('plugins_loaded', 'cyfer_desconto_check_woocommerce');
/**
* Admin notice for WooCommerce dependency
*/
function cyfer_desconto_woocommerce_notice() {
?>
<div class="error">
<p><?php esc_html_e('Cyfer Automatic Discount requires WooCommerce to be active to work.', 'cyfer-automatic-discount-per-payment-method'); ?></p>
</div>
<?php
}