plugin_name = $plugin_name; $this->version = $version; } /** * Check whether Contact Express frontend assets are needed on the current request. */ private function should_enqueue_contact_assets() { if ( function_exists( 'aio_is_module_active' ) && ! aio_is_module_active( 'opt-module-contact' ) ) { return false; } return ! empty( aio_get_option( 'opt-enable-contact-button' ) ); } /** * Register the stylesheets for the public-facing side of the site. * * @since 1.0.0 */ public function aio_public_enqueue_styles() { if ( ! $this->should_enqueue_contact_assets() ) { return; } $css_path = AIO_PATH . 'assets/css/aio-tools-public.css'; $css_ver = file_exists( $css_path ) ? $this->version . '.' . (string) filemtime( $css_path ) : $this->version; wp_enqueue_style( $this->plugin_name . '-public', AIO_URL . 'assets/css/aio-tools-public.css', array(), $css_ver, 'all' ); } /** * Register the JavaScript for the public-facing side of the site. * * @since 1.0.0 */ public function aio_public_enqueue_scripts() { if ( ! $this->should_enqueue_contact_assets() ) { return; } $js_path = AIO_PATH . 'assets/js/aio-tools-public.js'; $js_ver = file_exists( $js_path ) ? $this->version . '.' . (string) filemtime( $js_path ) : $this->version; wp_enqueue_script( $this->plugin_name . '-public', AIO_URL . 'assets/js/aio-tools-public.js', array(), $js_ver, true ); } }