*/ class Adscout_Public { /** * The ID of this plugin. * * @since 2.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private string $plugin_name; /** * The version of this plugin. * * @since 2.0.0 * @access private * @var string $version The current version of this plugin. */ private string $version; /** * Initialize the class and set its properties. * * @param string $plugin_name The name of the plugin. * @param string $version The version of this plugin. * @since 2.0.0 */ public function __construct($plugin_name, $version) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the public-facing side of the site. * As of version 2.0.0. this is just a placeholder for future development, * should one be needed. * * @since 2.0.0 */ public function enqueue_styles(): void { /** * * An instance of this class should be passed to the run() function * defined in AdScout_Loader as all of the hooks are defined * in that particular class. * * The AdScout_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ // wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/adscout-public.css', array(), $this->version, 'all' ); } /** * Register the JavaScript for the public-facing side of the site. * As of version 2.0.0. this is just a placeholder for future development, * should one be needed. * * @since 2.0.0 */ public function enqueue_scripts(): void { /** * * An instance of this class should be passed to the run() function * defined in AdScout_Loader as all of the hooks are defined * in that particular class. * * The AdScout_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ $plugin = new AdScout(); if ($plugin->woocommerce) { wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/adscout-public.js', array('jquery'), $this->version, array( 'strategy' => 'defer', 'in_footer' => true, )); wp_localize_script($this->plugin_name, 'adscout_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'))); } $options = (new AdScout_Options()); $base_url = 'https://scoutefy.com/'; if($options::get_option('adscout_api_endpoint') and $options::get_option('adscout_api_endpoint') !== '') { $base_url = $options::get_option('adscout_api_endpoint'); } $hex = $options::get_option('adscout_partner_domain_hex'); if ($hex) { wp_enqueue_script('adscout-main', $base_url . 'script/' . $hex, array(), ADSCOUT_VERSION, array('strategy' => 'async', 'in_footer' => true)); } if ($plugin->woocommerce and !is_admin() and is_wc_endpoint_url('order-received')) { wp_enqueue_script('adscout-order-received', plugin_dir_url(__FILE__) . 'js/adscout-order-received.js', array('adscout-main'), ADSCOUT_VERSION, array('strategy' => 'async', 'in_footer' => true)); } } }