| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
// Define integration type constants |
| 9 |
define('TABPX_INTEGRATION_WP', 'WP'); |
| 10 |
define('TABPX_INTEGRATION_WOOCOMMERCE', 'WOOCOMMERCE'); |
| 11 |
|
| 12 |
// Define hostname constants |
| 13 |
define('TABPX_THIRD_PARTY_CONNECT_HOST', 'https://ads.realizeperformance.com/'); |
| 14 |
define('TABPX_API_HOST', 'https://spfy-pxl.archive-digger.com/'); |
| 15 |
|
| 16 |
function tabpx_get_plugin_version() |
| 17 |
{ |
| 18 |
if (!function_exists('get_plugin_data')) { |
| 19 |
require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
| 20 |
} |
| 21 |
|
| 22 |
$plugin_file = plugin_dir_path(__DIR__) . 'taboola-pixel.php'; |
| 23 |
$plugin_data = get_plugin_data($plugin_file); |
| 24 |
|
| 25 |
return $plugin_data['Version']; |
| 26 |
} |
| 27 |
|
| 28 |
function tabpx_get_account_id() |
| 29 |
{ |
| 30 |
$options = get_option('taboola_pixel_settings'); |
| 31 |
return isset($options['account_id']) ? trim(esc_js($options['account_id'])) : ''; |
| 32 |
} |
| 33 |
|
| 34 |
function tabpx_is_woocommerce_active() |
| 35 |
{ |
| 36 |
return in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))); |
| 37 |
} |
| 38 |
|
| 39 |
function tabpx_get_integration_type() |
| 40 |
{ |
| 41 |
// Check if WooCommerce is active |
| 42 |
if (tabpx_is_woocommerce_active()) { |
| 43 |
return TABPX_INTEGRATION_WOOCOMMERCE; |
| 44 |
} |
| 45 |
return TABPX_INTEGRATION_WP; |
| 46 |
} |