plugin_path( 'assets/css/templates/' . $file_name ) ); $time = $frontend_file->get_meta( 'time' ); if ( ! $time ) { $frontend_file->update(); } $style_url = $frontend_file->get_url(); } else { $style_url = jet_blocks()->plugin_url( 'assets/css/' . $file_name ); } wp_enqueue_style( 'jet-blocks', $style_url, false, $has_custom_file ? null : jet_blocks()->get_version() ); } /** * Enqueue plugin scripts only with elementor scripts * * @return void */ public function enqueue_scripts() { $min_suffix = jet_blocks_tools()->is_script_debug() ? '' : '.min'; wp_enqueue_script( 'jet-blocks', jet_blocks()->plugin_url( 'assets/js/jet-blocks' . $min_suffix . '.js' ), array( 'jquery', 'elementor-frontend' ), jet_blocks()->get_version(), true ); $localize_data = apply_filters( 'jet-blocks/frontend/localize-data', array() ); if ( ! empty( $localize_data ) ) { wp_localize_script( 'jet-blocks', 'jetBlocksData', $localize_data ); } } /** * Enqueue elemnetor editor-related styles * * @return void */ public function editor_styles() { wp_enqueue_style( 'jet-blocks-editor', jet_blocks()->plugin_url( 'assets/css/jet-blocks-editor.css' ), array(), jet_blocks()->get_version() ); } /** * Enqueue plugin scripts only with elementor scripts * * @return void */ public function editor_scripts() { $min_suffix = jet_blocks_tools()->is_script_debug() ? '' : '.min'; wp_enqueue_script( 'jet-blocks-editor', jet_blocks()->plugin_url( 'assets/js/jet-blocks-editor' . $min_suffix . '.js' ), array( 'jquery' ), jet_blocks()->get_version(), true ); } /** * Add responsive css templates. * * @param array $templates CSS templates. * * @return array */ function add_responsive_css_templates( $templates = array() ) { $templates_paths = glob( jet_blocks()->plugin_path( 'assets/css/templates' ) . '*.css' ); foreach ( $templates_paths as $template_path ) { $file_name = 'custom-' . basename( $template_path ); $templates[ $file_name ] = $template_path; } return $templates; } /** * Returns the instance. * * @since 1.0.0 * @return object */ public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } } } /** * Returns instance of Jet_Blocks_Assets * * @return object */ function jet_blocks_assets() { return Jet_Blocks_Assets::get_instance(); }