-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpopup-notices-for-woocommerce.php
79 lines (73 loc) · 2.6 KB
/
popup-notices-for-woocommerce.php
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
<?php
/**
* Plugin Name: Popups for WooCommerce: Add to Cart, Checkout & More
* Plugin URI: https://wordpress.org/plugins/popup-notices-for-woocommerce
* Description: Turn your WooCommerce Notices into Popups
* Version: 1.5.0
* Author: WPFactory
* Author URI: https://wpfactory.com
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: popup-notices-for-woocommerce
* Domain Path: /src/languages
* Copyright: © 2024 WPFactory
* WC requires at least: 3.0.0
* WC tested up to: 9.1
* Requires Plugins: woocommerce
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
// Handle is_plugin_active function.
if ( ! function_exists( 'ttt_pnwc_is_plugin_active' ) ) {
/**
* ttt_pnwc_is_plugin_active.
*
* @version 1.3.5
* @since 1.3.5
*/
function ttt_pnwc_is_plugin_active( $plugin ) {
return ( function_exists( 'is_plugin_active' ) ? is_plugin_active( $plugin ) :
(
in_array( $plugin, apply_filters( 'active_plugins', ( array ) get_option( 'active_plugins', array() ) ) ) ||
( is_multisite() && array_key_exists( $plugin, ( array ) get_site_option( 'active_sitewide_plugins', array() ) ) )
)
);
}
}
// Check for active plugins.
if (
! ttt_pnwc_is_plugin_active( 'woocommerce/woocommerce.php' ) ||
(
'popup-notices-for-woocommerce.php' === basename( __FILE__ ) &&
ttt_pnwc_is_plugin_active( 'popup-notices-for-woocommerce-pro/popup-notices-for-woocommerce-pro.php' ) &&
! empty( $wp_plugin_dir = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, trailingslashit( WP_PLUGIN_DIR ) ) ) &&
! empty( $plugin_parent_dir = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, trailingslashit( dirname( __FILE__, 2 ) ) ) ) &&
$plugin_parent_dir === $wp_plugin_dir
)
) {
if ( class_exists( '\WPFactory\PNWC\Core' ) ) {
$plugin = \WPFactory\PNWC\Core::instance();
if ( method_exists( $plugin, 'set_free_version_filesystem_path' ) ) {
$plugin->set_free_version_filesystem_path( __FILE__ );
}
}
return;
}
// Composer.
if ( ! class_exists( '\WPFactory\PNWC\Core' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
}
// Autoloader.
$autoloader = new WPFactory\WPFactory_Autoloader\WPFactory_Autoloader();
$autoloader->add_namespace( 'WPFactory\PNWC', plugin_dir_path( __FILE__ ) . '/src/php' );
do_action( 'pnwc_autoloader', $autoloader );
$autoloader->init();
// Starts plugin.
$plugin = \WPFactory\PNWC\Core::instance();
$plugin->setup( array(
'path' => __FILE__
) );
if ( true === apply_filters( 'ttt_pnwc_init', true ) ) {
$plugin->init();
}