PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 1.0.0
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v1.0.0
3.2.0 3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 All 57 releases
slider-blocks / includes / Loader.php

Loader.php in GutSlider – All in One Slider and Carousel Blocks for Gutenberg 1.0.0, at includes/Loader.php

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace GutSliders;
4 use GutSliders\Admin\Admin;
5 use GutSliders\RegisterBlocks\RegisterBlocks;
6 use GutSliders\EnqueueAssets\EnqueueAssets;
7 use GutSliders\FontsLoader\FontsLoader;
8
9 // Exit if accessed directly.
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 class Loader {
15
16 // Constructor
17 public function __construct() {
18 // register blocks category
19 if( version_compare( $GLOBALS['wp_version'], '5.7', '<' ) ) {
20 add_filter( 'block_categories', [ $this, 'register_block_category' ], 10, 2, 9999 );
21 } else {
22 add_filter( 'block_categories_all', [ $this, 'register_block_category' ], 10, 2, 9999 );
23 }
24
25 // init
26 $this->init();
27 }
28
29 /**
30 * Register Block Category
31 */
32 public function register_block_category( $categories, $post ) {
33 return array_merge(
34 array(
35 array(
36 'slug' => 'gutsliders',
37 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
38 ),
39 ),
40 $categories,
41 );
42 }
43
44 /**
45 * Init
46 */
47 public function init() {
48 // admin
49 new Admin();
50 // register blocks
51 new RegisterBlocks();
52 // enqueue assets
53 new EnqueueAssets();
54 // fonts loader
55 new FontsLoader();
56 }
57 }