plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the public side of the site. * * @since 1.0.0 */ public function enqueue_styles() { wp_enqueue_style( $this->plugin_name, ABFW_URL . 'src/Frontend/css/frontend.css', array(), $this->asset_version( 'src/Frontend/css/frontend.css' ) ); } /** * Register the scripts for the public side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { wp_enqueue_script( $this->plugin_name, ABFW_URL . 'src/Frontend/js/frontend.js', array( 'jquery' ), $this->asset_version( 'src/Frontend/js/frontend.js' ), true ); wp_localize_script( $this->plugin_name, 'abfwStrings', array( 'nights' => __( 'nights', 'abogo-booking' ), 'days' => __( 'days', 'abogo-booking' ), 'arrival' => __( 'Arrival', 'abogo-booking' ), 'date' => __( 'Date', 'abogo-booking' ), 'reversed' => __( 'The end date cannot come before the start date.', 'abogo-booking' ), 'currency' => sprintf( get_woocommerce_price_format(), get_woocommerce_currency_symbol(), '%s' ), 'decimals' => wc_get_price_decimals(), ) ); } /** * Version stamp of an asset, so a changed file is never served from a cache. * * @since 1.0.0 * @param string $relative Path inside the plugin. * @return string */ private function asset_version( $relative ) { $file = ABFW_PATH . $relative; return file_exists( $file ) ? (string) filemtime( $file ) : $this->version; } }