fraudlabs-pro-for-woocommerce
Last commit date
assets
3 months ago
includes
1 week ago
vendor
5 years ago
init.php
1 week ago
license.txt
9 years ago
readme.txt
1 week ago
init.php
98 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: FraudLabs Pro for WooCommerce |
| 4 | * Plugin URI: https://www.fraudlabspro.com |
| 5 | * Description: This plugin is an add-on for WooCommerce plugin that help you to screen your order transaction, such as credit card transaction, for online fraud. |
| 6 | * Author: FraudLabs Pro |
| 7 | * Author URI: https://www.fraudlabspro.com/ |
| 8 | * Version: 2.24.2 |
| 9 | * Requires Plugins: woocommerce |
| 10 | * Text Domain: fraudlabs-pro-for-woocommerce |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | if ( ! defined( 'ABSPATH' ) ) { |
| 28 | exit; |
| 29 | } |
| 30 | |
| 31 | if ( ! defined( 'WC_FLP_DIR' ) ) { |
| 32 | define( 'WC_FLP_DIR', __FILE__ ); |
| 33 | } |
| 34 | |
| 35 | if ( ! function_exists( 'wc_fraudlabspro' ) ) : |
| 36 | |
| 37 | add_action( 'plugins_loaded', 'wc_fraudlabspro' ); |
| 38 | |
| 39 | function wc_fraudlabspro() { |
| 40 | if ( ! function_exists( 'WC' ) ) { |
| 41 | class FraudLabsProWc { |
| 42 | function __construct() { |
| 43 | add_action( 'admin_init', array( $this, 'check_wc_install' ) ); |
| 44 | if ( ! function_exists( 'WC' ) ) { |
| 45 | return; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | static function activation_check() { |
| 50 | if ( ! function_exists( 'WC' ) ) { |
| 51 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | function check_wc_install() { |
| 56 | if ( ! function_exists( 'WC' ) ) { |
| 57 | if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
| 58 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 59 | add_action( 'admin_notices', array( $this, 'admin_notice_flp' ) ); |
| 60 | if ( isset( $_GET['activate'] ) ) { |
| 61 | unset( $_GET['activate'] ); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | function admin_notice_flp() { |
| 68 | $current_screen = get_current_screen(); |
| 69 | if ( 'plugins' == $current_screen->parent_base ) { |
| 70 | echo ' |
| 71 | <div id="fraudlabspro-notice" class="error notice"> |
| 72 | <p> |
| 73 | ' . __( 'Please install and activate WooCommerce plugin before activating FraudLabs Pro for WooCommerce plugin.', 'woocommerce-fraudlabs-pro' ) . ' |
| 74 | </p> |
| 75 | </div>'; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | function wc_fraudlabspro() { |
| 80 | require_once plugin_dir_path( __FILE__ ) . 'includes' . DIRECTORY_SEPARATOR . 'class.wc-fraudlabspro.php'; |
| 81 | WC_FraudLabs_Pro::get_instance(); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | global $flpwc; |
| 86 | $flpwc = new FraudLabsProWc(); |
| 87 | |
| 88 | register_activation_hook( __FILE__, array( 'FraudLabsProWc', 'activation_check' ) ); |
| 89 | } else { |
| 90 | require_once plugin_dir_path( __FILE__ ) . 'includes' . DIRECTORY_SEPARATOR . 'class.wc-fraudlabspro.php'; |
| 91 | WC_FraudLabs_Pro::get_instance(); |
| 92 | } |
| 93 | |
| 94 | } |
| 95 | |
| 96 | endif; |
| 97 | |
| 98 |