Version: 1.13.0 Author URI: http://getadmiral.com/ */ if (!defined('ADMIRAL_PLUGIN_VERSION')) { define('ADMIRAL_PLUGIN_VERSION', '1.13.0'); } if (!function_exists('add_action')) { exit; } require_once("AdmiralAdBlockAnalytics.php"); // Find the property ID on the install page of https://app.getadmiral.com // Then do one of the following: // - Add to wp-config.php as `ADMIRAL_PROPERTY_ID` // https://wordpress.org/documentation/article/editing-wp-config-php/ // e.g. `define('ADMIRAL_PROPERTY_ID', '');` // // - Setup in WordPress VIP Environment as `ADMIRAL_PROPERTY_ID` // https://docs.wpvip.com/how-tos/manage-environment-variables/#managing-environment-variables-with-vip-cli // e.g. `vip [@site] config envvar set ADMIRAL_PROPERTY_ID` // // - Configure the property id in the WordPress admin UI. \wp\AdmiralAdBlockAnalytics::setClientIDSecret("41c528e5f0d2c6b4cc93", "2y41c528e5f0d2c6b4cc930001912b9ea79d22eaadaeed70b7183d99ff0cfc2f7f652c1336"); function admiraladblock_load_settings() { try { $env = (defined('VIP_GO_APP_ENVIRONMENT') && VIP_GO_APP_ENVIRONMENT) || 'production'; $didInitialize = \wp\AdmiralAdBlockAnalytics::initialize("wp", ADMIRAL_PLUGIN_VERSION, $env); $isLogin = strpos($_SERVER['SCRIPT_NAME'], '/wp-login.php') !== false; if ($didInitialize && (!function_exists('is_admin') || !is_admin()) && !$isLogin) { add_action('wp_print_scripts', function() { $embed = \wp\AdmiralAdBlockAnalytics::getEmbed(); if (!empty($embed) && !\wp\AdmiralAdBlockAnalytics::getHasEmbedded()) { \wp\AdmiralAdBlockAnalytics::setHasEmbedded(); echo $embed; } }); } } catch (\Exception $e) { error_log("Error loading settings: " . $e->getMessage()); } } // Set `Activated_Admiral` when the plugin is activated so that we can check this // later to redirect to the plugin settings page. register_activation_hook( __FILE__, function() { if (!empty($_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'], '/wp-admin/plugins.php') !== false) { add_option('Activated_Admiral', true); } }); admiraladblock_load_settings(); // always include the admin section require_once('adminHooks.php'); // only load the protect hooks if protect is on if (\wp\AdmiralAdBlockAnalytics::isProtectEnabled()) { require_once('protectHooks.php'); } // only load the first-party mode hooks if first-party mode is on if (\wp\AdmiralAdBlockAnalytics::isFirstPartyModeEnabled()) { require_once('firstPartyModeHooks.php'); } /* EOF */