-
Notifications
You must be signed in to change notification settings - Fork 18
/
woocommerce-address-book.php
80 lines (73 loc) · 2.64 KB
/
woocommerce-address-book.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
80
<?php
/**
* Plugin Name: WooCommerce Address Book
* Description: Gives your customers the option to store multiple shipping and/or billing addresses and retrieve them on checkout.
* Version: 3.0.2.12
* Author: CrossPeak
* Author URI: https://www.crosspeaksoftware.com/
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: woo-address-book
* WC tested up to: 8.9.1
* Requires PHP: 7.4
* Requires at least: 6.0
*
* @package WooCommerce Address Book
*/
namespace CrossPeakSoftware\WooCommerce\AddressBook;
// Prevent direct access data leaks.
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Declare HPOS compatibility.
*
* @see https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#declaring-extension-incompatibility
*/
add_action(
'before_woocommerce_init',
function () {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false );
}
}
);
if ( ! function_exists( __NAMESPACE__ . '\woocommerce_notice_error' ) ) {
/**
* Add Notice if WooCommerce is not active.
*
* @return void
*/
function woocommerce_notice_error() {
$class = 'notice notice-error';
$message = __( 'WooCommerce Address Book requires WooCommerce to be active.', 'woo-address-book' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_attr( $message ) );
}
/**
* Check if WooCommerce is active.
*
* @return void
*/
function woocommerce_check() {
if ( ! class_exists( 'WooCommerce', false ) ) {
add_action( 'admin_notices', __NAMESPACE__ . '\woocommerce_notice_error' );
add_action( 'network_admin_notices', __NAMESPACE__ . '\woocommerce_notice_error' );
}
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\woocommerce_check' );
}
if ( ! function_exists( '\CrossPeakSoftware\WooCommerce\AddressBook\get_address_book' ) ) {
require __DIR__ . '/includes/class-address-book.php';
require __DIR__ . '/includes/address-book.php';
require __DIR__ . '/includes/general.php';
require __DIR__ . '/includes/validation.php';
require __DIR__ . '/includes/nickname.php';
require __DIR__ . '/includes/ajax.php';
require __DIR__ . '/includes/import.php';
require __DIR__ . '/includes/export.php';
require __DIR__ . '/includes/subscriptions.php';
require __DIR__ . '/includes/api.php';
require __DIR__ . '/includes/settings.php';
require __DIR__ . '/deprecations/class-wc-address-book.php';
}