'Plugin Name'));
if (false !== stripos($headers['name'], 'Dynamic Pricing Pro')) {
return true;
}
}
return false;
}
}
if (awdp_free_is_pro_active()) {
// Pro reads the same rules and settings, so pause instead of loading a second copy.
add_action('admin_notices', function () {
if (!current_user_can('activate_plugins')) {
return;
}
echo '
' . esc_html__('Dynamic Pricing Pro is active, so the free version of Dynamic Pricing With Discount Rules is paused. Your pricing rules are being used by Pro, and you can deactivate the free version.', 'aco-woo-dynamic-pricing') . '
';
});
return;
}
defined('AWDP_POST_TYPE') || define('AWDP_POST_TYPE', 'awdp_pt_rules');
defined('AWDP_PRODUCT_LIST') || define('AWDP_PRODUCT_LIST', 'awdp_pt_products');
defined('AWDP_WC_PRODUCTS') || define('AWDP_WC_PRODUCTS', 'product');
defined('AWDP_TOKEN') || define('AWDP_TOKEN', 'awdp');
defined('AWDP_VERSION') || define('AWDP_VERSION', '5.1.1');
defined('AWDP_FILE') || define('AWDP_FILE', __FILE__);
defined('AWDP_PLUGIN_NAME') || define('AWDP_PLUGIN_NAME', 'Acowebs Woocommerce Dynamic Pricing');
defined('AWDP_PRODUCTS_TRANSIENT_KEY') || define('AWDP_PRODUCTS_TRANSIENT_KEY', 'awdp_product_list');
defined('AWDP_PRODUCTS_LANG_TRANSIENT_KEY') || define('AWDP_PRODUCTS_LANG_TRANSIENT_KEY', 'awdp_product_lang_list');
defined('AWDP_STORE_URL') || define('AWDP_STORE_URL', 'https://api.acowebs.com');
defined('AWDP_FOLDER_PATH') || define('AWDP_FOLDER_PATH', plugin_dir_url( __FILE__ ));
defined('AWDP_Wordpress_Version') || define('AWDP_Wordpress_Version', get_bloginfo('version'));
defined('AWDP_Feed_Attribute') || define('AWDP_Feed_Attribute', 'acowdp_sale_price');
require_once(realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR . 'includes/helpers.php');
if (!function_exists('awdp_init')) {
function awdp_init()
{
$plugin_rel_path = basename(dirname(__FILE__)) . '/languages'; /* Relative to WP_PLUGIN_DIR */
load_plugin_textdomain('aco-woo-dynamic-pricing', false, $plugin_rel_path);
new AWDP_Api();
$discount = new AWDP_Discount();
new AWDP_Front_End($discount, __FILE__, AWDP_VERSION);
}
}
if (!function_exists('awdp_autoloader')) {
function awdp_autoloader($class_name)
{
if (0 === strpos($class_name, 'AWDP')) {
$classes_dir = realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR;
$class_file = 'class-' . str_replace('_', '-', strtolower($class_name)) . '.php';
if (0 === strpos($class_name, 'AWDP_Discount_')) {
$discount_file = $classes_dir . 'discount' . DIRECTORY_SEPARATOR . $class_file;
if (file_exists($discount_file)) {
require_once $discount_file;
return;
}
}
// Leave classes we do not ship (e.g. from another AWDP plugin) to other autoloaders.
if (file_exists($classes_dir . $class_file)) {
require_once $classes_dir . $class_file;
}
}
}
}
if (!function_exists('AWDP')) {
function AWDP()
{
$instance = AWDP_Backend::instance(__FILE__, AWDP_VERSION);
return $instance;
}
}
// add_action('plugins_loaded', 'awdp_init');
add_action('init', 'awdp_init');
spl_autoload_register('awdp_autoloader');
if (is_admin()) {
AWDP();
}