-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatafeedr-api.php
147 lines (130 loc) · 6.33 KB
/
datafeedr-api.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/*
Plugin Name: Datafeedr API
Plugin URI: https://www.datafeedr.com
Description: Connect to the Datafeedr API and configure your API settings.
Author: datafeedr.com
Author URI: https://www.datafeedr.com
Text Domain: datafeedr-api
License: GPL v3
Requires PHP: 7.4
Requires at least: 3.8
Tested up to: 6.7
Version: 1.3.25
Datafeedr API Plugin
Copyright (C) 2025, Datafeedr - [email protected]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Define constants.
*/
define( 'DFRAPI_VERSION', '1.3.25' );
define( 'DFRAPI_URL', plugin_dir_url( __FILE__ ) ); // https://example.com/wp-content/plugins/datafeedr-api/
define( 'DFRAPI_PATH', plugin_dir_path( __FILE__ ) ); // /absolute/path/to/wp-content/plugins/datafeedr-api/
define( 'DFRAPI_BASENAME', plugin_basename( __FILE__ ) ); // datafeedr-api/datafeedr-api.php
define( 'DFRAPI_PLUGIN_FILE', __FILE__ ); // /absolute/path/to/wp-content/plugins/datafeedr-api/datafeedr-api.php
define( 'DFRAPI_DOMAIN', 'datafeedr-api' ); // Deprecated as of 2022-02-10 14:18:51
define( 'DFRAPI_HOME_URL', 'https://www.datafeedr.com' );
define( 'DFRAPI_KEYS_URL', 'https://datafeedr.me/api' );
define( 'DFRAPI_USER_URL', 'https://datafeedr.me/dashboard' );
define( 'DFRAPI_HELP_URL', 'https://datafeedr.me/contact' );
define( 'DFRAPI_BUG_REPORTS_URL', 'https://datafeedr.me/docs' );
define( 'DFRAPI_QNA_URL', 'https://datafeedr.me/docs' );
define( 'DFRAPI_DOCS_URL', 'https://datafeedr.me/docs' );
define( 'DFRAPI_DOCS_SEARCH_URL', 'https://datafeedrapi.helpscoutdocs.com/search?query=' );
define( 'DFRAPI_REPORT_BUG_URL', 'https://datafeedr.me/contact' );
define( 'DFRAPI_ASK_QUESTION_URL', 'https://datafeedr.me/contact' );
define( 'DFRAPI_EMAIL_US_URL', 'https://datafeedr.me/contact' );
define( 'DFRAPI_SUPPORT_EMAIL', '[email protected]' );
define( 'DFRAPI_COMPLEX_QUERY_SCORE', 10000 );
define( 'DFRAPI_EXCESSIVE_MERCHANT_COUNT', 1000 );
/**
* Compatibility Check.
*
* @param bool $network_wide
*
* @return void
*/
function dfrapi_register_activation( bool $network_wide ) {
// Check that minimum WordPress requirement has been met.
$version = get_bloginfo( 'version' );
if ( version_compare( $version, '3.8', '<' ) ) {
deactivate_plugins( DFRAPI_BASENAME );
wp_die( __(
'The Datafeedr API Plugin could not be activated because it requires WordPress version 3.8 or greater. Please upgrade your installation of WordPress.',
'datafeedr-api'
) );
}
// Check that plugin is not being activated at the Network level on Multisite sites.
if ( $network_wide && is_multisite() ) {
deactivate_plugins( DFRAPI_BASENAME );
wp_die( __(
'The Datafeedr API plugin cannot be activated at the Network-level. Please activate the Datafeedr API plugin at the Site-level instead.',
'datafeedr-api'
) );
}
}
register_activation_hook( __FILE__, 'dfrapi_register_activation' );
/**
* Load Functions
*/
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/global.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/upgrade.php';
/**
* Load Libraries
*/
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/libraries/datafeedr.php';
/**
* Load files only if we're in the WordPress Admin Area of the site.
*/
if ( is_admin() ) {
// Core admin functions.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/admin.php';
// Load required classes.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-env.php'; // Checks environment for any problems.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-configuration.php'; // Configuration page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-networks.php'; // Networks page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-merchants.php'; // Merchants page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-tools.php'; // Tools page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-export.php'; // Export page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-import.php'; // Import page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-account.php'; // Account page.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-help.php'; // Help tabs.
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-initialize.php';
}
/**
* Load Classes
*/
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-plugin-dependency.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-cron.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-timer.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-currency.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-price.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-image-importer.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-image-data.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-image-uploader.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-searchform.php'; // Search Form.
/**
* Global Hooks
*/
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/global/emails.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/global/affiliate-ids.php';
/**
* Load Admin Hooks
*/
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/admin-notices.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/ajax.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/debug-information.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/enqueue-scripts.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/interface.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/merchants.php';
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/networks.php';