| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Datafeedr API |
| 4 |
Plugin URI: https://www.datafeedr.com |
| 5 |
Description: Connect to the Datafeedr API and configure your API settings. |
| 6 |
Author: datafeedr.com |
| 7 |
Author URI: https://www.datafeedr.com |
| 8 |
Text Domain: datafeedr-api |
| 9 |
License: GPL v3 |
| 10 |
Requires PHP: 7.4 |
| 11 |
Requires at least: 3.8 |
| 12 |
Tested up to: 6.0-alpha |
| 13 |
Version: 1.3.1 |
| 14 |
|
| 15 |
Datafeedr API Plugin |
| 16 |
Copyright (C) 2022, Datafeedr - help@datafeedr.com |
| 17 |
|
| 18 |
This program is free software: you can redistribute it and/or modify |
| 19 |
it under the terms of the GNU General Public License as published by |
| 20 |
the Free Software Foundation, either version 3 of the License, or |
| 21 |
(at your option) any later version. |
| 22 |
|
| 23 |
This program is distributed in the hope that it will be useful, |
| 24 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 |
GNU General Public License for more details. |
| 27 |
|
| 28 |
You should have received a copy of the GNU General Public License |
| 29 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 30 |
*/ |
| 31 |
|
| 32 |
/** |
| 33 |
* Define constants. |
| 34 |
*/ |
| 35 |
define( 'DFRAPI_VERSION', '1.3.1' ); |
| 36 |
define( 'DFRAPI_URL', plugin_dir_url( __FILE__ ) ); // https://example.com/wp-content/plugins/datafeedr-api/ |
| 37 |
define( 'DFRAPI_PATH', plugin_dir_path( __FILE__ ) ); // /absolute/path/to/wp-content/plugins/datafeedr-api/ |
| 38 |
define( 'DFRAPI_BASENAME', plugin_basename( __FILE__ ) ); // datafeedr-api/datafeedr-api.php |
| 39 |
define( 'DFRAPI_PLUGIN_FILE', __FILE__ ); // /absolute/path/to/wp-content/plugins/datafeedr-api/datafeedr-api.php |
| 40 |
define( 'DFRAPI_DOMAIN', 'datafeedr-api' ); // Deprecated as of 2022-02-10 14:18:51 |
| 41 |
define( 'DFRAPI_HOME_URL', 'https://www.datafeedr.com' ); |
| 42 |
define( 'DFRAPI_KEYS_URL', 'https://members.datafeedr.com/api' ); |
| 43 |
define( 'DFRAPI_USER_URL', 'https://members.datafeedr.com/' ); |
| 44 |
define( 'DFRAPI_HELP_URL', 'https://datafeedr.me/contact' ); |
| 45 |
define( 'DFRAPI_BUG_REPORTS_URL', 'https://datafeedr.me/docs' ); |
| 46 |
define( 'DFRAPI_QNA_URL', 'https://datafeedr.me/docs' ); |
| 47 |
define( 'DFRAPI_DOCS_URL', 'https://datafeedr.me/docs' ); |
| 48 |
define( 'DFRAPI_REPORT_BUG_URL', 'https://datafeedr.me/contact' ); |
| 49 |
define( 'DFRAPI_ASK_QUESTION_URL', 'https://datafeedr.me/contact' ); |
| 50 |
define( 'DFRAPI_EMAIL_US_URL', 'https://datafeedr.me/contact' ); |
| 51 |
define( 'DFRAPI_COMPLEX_QUERY_SCORE', 10000 ); |
| 52 |
define( 'DFRAPI_EXCESSIVE_MERCHANT_COUNT', 1000 ); |
| 53 |
|
| 54 |
/** |
| 55 |
* Compatibility Check. |
| 56 |
* |
| 57 |
* @param bool $network_wide |
| 58 |
* |
| 59 |
* @return void |
| 60 |
*/ |
| 61 |
function dfrapi_register_activation( bool $network_wide ) { |
| 62 |
|
| 63 |
// Check that minimum WordPress requirement has been met. |
| 64 |
$version = get_bloginfo( 'version' ); |
| 65 |
if ( version_compare( $version, '3.8', '<' ) ) { |
| 66 |
deactivate_plugins( DFRAPI_BASENAME ); |
| 67 |
wp_die( __( |
| 68 |
'The Datafeedr API Plugin could not be activated because it requires WordPress version 3.8 or greater. Please upgrade your installation of WordPress.', |
| 69 |
'datafeedr-api' |
| 70 |
) ); |
| 71 |
} |
| 72 |
|
| 73 |
// Check that plugin is not being activated at the Network level on Multisite sites. |
| 74 |
if ( $network_wide && is_multisite() ) { |
| 75 |
deactivate_plugins( DFRAPI_BASENAME ); |
| 76 |
wp_die( __( |
| 77 |
'The Datafeedr API plugin cannot be activated at the Network-level. Please activate the Datafeedr API plugin at the Site-level instead.', |
| 78 |
'datafeedr-api' |
| 79 |
) ); |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
register_activation_hook( __FILE__, 'dfrapi_register_activation' ); |
| 84 |
|
| 85 |
/** |
| 86 |
* Load Functions |
| 87 |
*/ |
| 88 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/global.php'; |
| 89 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/upgrade.php'; |
| 90 |
|
| 91 |
/** |
| 92 |
* Load Libraries |
| 93 |
*/ |
| 94 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/libraries/datafeedr.php'; |
| 95 |
|
| 96 |
/** |
| 97 |
* Load files only if we're in the WordPress Admin Area of the site. |
| 98 |
*/ |
| 99 |
if ( is_admin() ) { |
| 100 |
|
| 101 |
// Core admin functions. |
| 102 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/functions/admin.php'; |
| 103 |
|
| 104 |
// Load required classes. |
| 105 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-env.php'; // Checks environment for any problems. |
| 106 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-configuration.php'; // Configuration page. |
| 107 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-networks.php'; // Networks page. |
| 108 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-merchants.php'; // Merchants page. |
| 109 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-tools.php'; // Tools page. |
| 110 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-export.php'; // Export page. |
| 111 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-import.php'; // Import page. |
| 112 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-account.php'; // Account page. |
| 113 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-help.php'; // Help tabs. |
| 114 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-initialize.php'; |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* Load Classes |
| 119 |
*/ |
| 120 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-plugin-dependency.php'; |
| 121 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-cron.php'; |
| 122 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-timer.php'; |
| 123 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-currency.php'; |
| 124 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-price.php'; |
| 125 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-datafeedr-image-importer.php'; |
| 126 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-image-data.php'; |
| 127 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-image-uploader.php'; |
| 128 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/classes/class-dfrapi-searchform.php'; // Search Form. |
| 129 |
|
| 130 |
/** |
| 131 |
* Global Hooks |
| 132 |
*/ |
| 133 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/global/emails.php'; |
| 134 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/global/affiliate-ids.php'; |
| 135 |
|
| 136 |
/** |
| 137 |
* Load Admin Hooks |
| 138 |
*/ |
| 139 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/admin-notices.php'; |
| 140 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/ajax.php'; |
| 141 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/debug-information.php'; |
| 142 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/enqueue-scripts.php'; |
| 143 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/interface.php'; |
| 144 |
require_once dirname( DFRAPI_PLUGIN_FILE ) . '/hooks/admin/merchants.php'; |
| 145 |
|