-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreddit-for-woocommerce.php
More file actions
89 lines (74 loc) · 2.6 KB
/
Copy pathreddit-for-woocommerce.php
File metadata and controls
89 lines (74 loc) · 2.6 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
<?php
/**
* Plugin Name: Reddit for WooCommerce
* Description: Seamlessly integrates your WooCommerce store with Reddit's powerful advertising platform, enabling you to reach millions of potential customers through engaging visual ads.
* Version: 1.0.3
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: reddit-for-woocommerce
* Domain Path: /languages
* Requires Plugins: woocommerce
* Requires PHP: 7.4
* PHP tested up to: 8.4
* Requires at least: 6.9
* Tested up to: 7.0
* WC requires at least: 10.8
* WC tested up to: 11.0
* Woo:
*
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*
* @package reddit-for-woocommerce
*/
use RedditForWooCommerce\Utils\Storage\Options;
use RedditForWooCommerce\Utils\Storage\OptionDefaults;
use RedditForWooCommerce\ServiceContainer;
use RedditForWooCommerce\ServiceKey;
defined( 'ABSPATH' ) || exit;
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_VERSION' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_VERSION', '1.0.3' ); // WRCS: DEFINED_VERSION.
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_FILE' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_FILE', __FILE__ );
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_DIR' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_URL' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_BUILD_PATH' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_PLUGIN_BUILD_PATH', REDDIT_FOR_WOOCOMMERCE_PLUGIN_DIR . 'js/build/' );
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_BUILD_URL' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_BUILD_URL', REDDIT_FOR_WOOCOMMERCE_PLUGIN_URL . 'js/build/' );
}
if ( ! defined( 'REDDIT_FOR_WOOCOMMERCE_DEBUG' ) ) {
define( 'REDDIT_FOR_WOOCOMMERCE_DEBUG', false );
}
require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload_packages.php';
$export_service = ServiceContainer::get( ServiceKey::PRODUCT_EXPORT_SERVICE );
register_activation_hook(
__FILE__,
function () use ( $export_service ) {
Options::preload_defaults();
// Schedule recurring CSV export task when the plugin is activated.
if ( 'connected' === Options::get( OptionDefaults::ONBOARDING_STATUS ) ) {
$export_service->maybe_schedule_recurring_export();
}
}
);
register_deactivation_hook(
__FILE__,
function () use ( $export_service ) {
// Unschedule all tasks related to product catalog export.
$export_service->maybe_unschedule_export_jobs();
}
);
add_action(
'woocommerce_loaded',
function () {
\RedditForWooCommerce\Plugin::init();
}
);