PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.0.38
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.0.38
2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 All 108 releases
b-blocks / includes / EnqueueScripts.php

EnqueueScripts.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.0.38, at includes/EnqueueScripts.php

75 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( !defined( 'ABSPATH' ) ) { exit; }
3
4 if( !class_exists('BBlocksEnqueueScripts') ){
5 class BBlocksEnqueueScripts{
6 function __construct(){
7 add_action( 'enqueue_block_editor_assets', [$this, 'enqueueBlockEditorAssets'] );
8 add_action( 'enqueue_block_assets', [$this, 'enqueueBockAssets'] );
9 add_action( 'wp_enqueue_scripts', [$this, 'enqueueScripts'] );
10 add_filter( 'script_loader_tag', [$this, 'scriptLoaderTag'], 10, 3 );
11 }
12
13 function enqueueBlockEditorAssets(){
14 wp_enqueue_script( 'b-blocks-template-library-script', B_BLOCKS_BUILD . 'template-library.js', [ 'wp-api', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-i18n', 'wp-util', 'react', 'react-dom' ], B_BLOCKS_VERSION, false );
15 wp_set_script_translations( 'b-blocks-template-library-script', 'b-blocks', B_BLOCKS_DIR_PATH . 'languages' );
16
17 wp_enqueue_style( 'b-blocks-template-library-style', B_BLOCKS_BUILD . 'template-library.css', [], B_BLOCKS_VERSION );
18
19 wp_enqueue_script( 'b-blocks-index-script', B_BLOCKS_BUILD . 'index.js', [ 'wp-api', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-rich-text', 'wp-util', 'jquery', 'jquery-ui-draggable', 'aos', 'modelViewer', 'easyTicker', 'swiper', 'dotLottiePlayer', 'lottieInteractivity', 'chartJS', 'plyr', 'textillate', 'goodShare' ], B_BLOCKS_VERSION, false );
20 wp_set_script_translations( 'b-blocks-index-script', 'b-blocks', B_BLOCKS_DIR_PATH . 'languages' );
21
22 $disabledBlocks = get_option( 'bBlocksDisabledBlocks', [] );
23 $disabledBlocks = is_array( $disabledBlocks ) ? $disabledBlocks : [];
24 wp_localize_script( 'b-blocks-index-script', 'bBlocksDisabledBlocks', $disabledBlocks );
25
26 wp_enqueue_style( 'b-blocks-index-style', B_BLOCKS_BUILD . 'index.css', [ 'fontAwesome', 'b-blocks-style' ], B_BLOCKS_VERSION );
27
28 wp_add_inline_script('b-blocks-index-script', 'const bBlocksPremiumChecker = ' . wp_json_encode( BBlocks\Inc\Utils::isPro() ) . '; ', 'before' );
29 }
30
31 function enqueueBockAssets(){
32 wp_register_script( 'easyTicker', B_BLOCKS_ASSETS . 'js/easy-ticker.min.js', [ 'jquery' ], '3.2.1', true ); // Posts
33 wp_register_script( 'swiper', B_BLOCKS_ASSETS . 'js/swiper.min.js', [], '8.0.7', true ); // Slider
34 wp_register_script( 'dotLottiePlayer', B_BLOCKS_ASSETS . 'js/dotlottie-player.js', [], '1.5.7', true ); // Lottie Player
35 wp_register_script( 'lottieInteractivity', B_BLOCKS_ASSETS . 'js/lottie-interactivity.min.js', [ 'dotLottiePlayer' ], '1.5.2', true ); // Lottie Player
36 wp_register_script( 'chartJS', B_BLOCKS_ASSETS . 'js/chart.min.js', [], '3.5.1', true ); // Chart
37 wp_register_script( 'plyr', B_BLOCKS_ASSETS . 'js/plyr.js', [], '3.7.2', true ); // Video
38 wp_register_script( 'textillate', B_BLOCKS_ASSETS . 'js/jquery.textillate.min.js', [ 'jquery' ], '0.6.1', true ); // Animated Text
39 wp_register_script( 'goodShare', B_BLOCKS_ASSETS . 'js/goodshare.min.js', [], B_BLOCKS_VERSION, true ); // Social Share
40 wp_register_script( 'modelViewer', B_BLOCKS_ASSETS . 'js/model-viewer.min.js', [], B_BLOCKS_VERSION, true ); // 3D Viewer
41 wp_register_script( 'aos', B_BLOCKS_ASSETS . 'js/aos.js', [], '3.0.0', true ); // Button
42 wp_register_script( 'fancybox', B_BLOCKS_ASSETS . 'js/fancybox.min.js', [], '4.0', true ); // Image Gallery
43 wp_register_script( 'mailtoui', B_BLOCKS_ASSETS . 'js/mailtoui-min.js', [], '1.0.3', true ); // Mailto
44 // wp_register_script( 'facebookEmbbed', B_BLOCKS_ASSETS . 'js/facebook-embbed.js', [], B_BLOCKS_VERSION, true ); // Facebook Embbed
45 // wp_register_script( 'facebookPage', B_BLOCKS_ASSETS . 'js/facebook-page.js', [], B_BLOCKS_VERSION, true ); // Facebook Page
46
47 //Accordion
48 wp_register_script('zebra_accordion', B_BLOCKS_ASSETS . 'js/zebra_accordion.min.js', ['jquery'], B_BLOCKS_VERSION, true);
49
50 wp_register_style( 'fontAwesome', B_BLOCKS_ASSETS . 'css/font-awesome.min.css', [], '6.4.2' ); // Icon
51 wp_register_style( 'swiper', B_BLOCKS_ASSETS . 'css/swiper.min.css', [], '8.0.7' ); // Slider
52 wp_register_style( 'animate', B_BLOCKS_ASSETS . 'css/animate.min.css', [], '4.1.1' ); // Animated Text
53 wp_register_style( 'plyr', B_BLOCKS_ASSETS . 'css/plyr.css', [], '3.7.2' ); // Video
54 wp_register_style( 'aos', B_BLOCKS_ASSETS . 'css/aos.css', [], '3.0.0' ); // Button
55 wp_register_style( 'fancybox', B_BLOCKS_ASSETS . 'css/fancybox.min.css', '', '4.0', 'all' ); // Image Gallery
56
57 wp_enqueue_style( 'b-blocks-style', B_BLOCKS_BUILD . 'script.css', [], B_BLOCKS_VERSION ); // Style
58 }
59
60 function enqueueScripts(){
61 wp_enqueue_script( 'b-blocks-advanced-script', B_BLOCKS_BUILD . 'advanced.js', [], B_BLOCKS_VERSION, true );
62 wp_enqueue_script( 'b-blocks-script', B_BLOCKS_BUILD . 'script.js', [], B_BLOCKS_VERSION, true );
63 wp_add_inline_script('b-blocks-script', 'const bBlocksPremiumChecker = ' . wp_json_encode( BBlocks\Inc\Utils::isPro() ) . '; ', 'before' );
64 }
65
66 function scriptLoaderTag( $tag, $handle, $src ){
67 if ( 'modelViewer' !== $handle ) {
68 return $tag;
69 }
70 $tag = '<script type="module" src="' . esc_url( $src ) . '"></script>';
71 return $tag;
72 }
73 }
74 new BBlocksEnqueueScripts();
75 }