-
Notifications
You must be signed in to change notification settings - Fork 0
/
woocommerce-store-wide-discount.php
60 lines (49 loc) · 1.58 KB
/
woocommerce-store-wide-discount.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
<?php
/**
* Plugin Name: WooCommerce Store-wide Discount
* Version: 3.0.0
* Description: Add a discount to all your products!
* Author: Emil Kjær Eriksen <[email protected]>
* Text Domain: wcswd
* Domain Path: /languages/
* License: GPL v3
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
require __DIR__ . '/includes/Functions.php';
/**
* Return plugin container.
*/
// @codingStandardsIgnoreLine
function WCSWD() {
static $container = null;
if ( is_null( $container ) ) {
$container = new \Pimple\Container();
}
return $container;
}
WCSWD()['version'] = '3.0.0';
WCSWD()['textdomain'] = 'wcswd';
WCSWD()['plugin_path'] = untrailingslashit( plugin_dir_path( __FILE__ ) );
WCSWD()['plugin_url'] = untrailingslashit( plugins_url( '/', __FILE__ ) );
WCSWD()['languages_path'] = WCSWD()['plugin_path'] . '/languages/';
WCSWD()['localizer'] = function( $c ) {
return new \WCSWD\Localizer( $c['textdomain'], $c['languages_path'] );
};
add_action( 'plugins_loaded', array( WCSWD()['localizer'], 'load_plugin_textdomain' ) );
WCSWD()['discounter'] = function( $c ) {
return new \WCSWD\Frontend\Discounter();
};
add_action( 'woocommerce_init', array( WCSWD()['discounter'], 'init' ) );
WCSWD()['admin_settings'] = function( $c ) {
return new \WCSWD\Admin\Settings\StoreWideDiscount();
};
add_filter( 'woocommerce_get_settings_pages', function( $settings ) {
$settings[] = WCSWD()['admin_settings'];
} );
do_action( 'wcswd_init', WCSWD() );