| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Carousel Slider Block |
| 4 |
* Plugin URI: https://wordpress.org/plugins/carousel-block |
| 5 |
* Description: A responsive carousel slider for the Gutenberg block editor. Add any type of block to your slides. |
| 6 |
* Author: Virgiliu Diaconu |
| 7 |
* Author URI: http://virgiliudiaconu.com/ |
| 8 |
* Version: 2.1.0 |
| 9 |
* License: GPL2+ |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
| 11 |
* |
| 12 |
* @package carousel-block |
| 13 |
*/ |
| 14 |
|
| 15 |
namespace CarouselSliderBlock; |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; // Exit if accessed directly. |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Plugin version |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
define( 'CB_VERSION', '2.1.0' ); |
| 27 |
|
| 28 |
/** |
| 29 |
* Directory path of this plugin without trailing slash. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
define( 'CB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Base URL of this plugin without trailing slash. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
define( 'CB_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); |
| 41 |
|
| 42 |
// Load blocks. |
| 43 |
require_once CB_PLUGIN_DIR . '/blocks/class-carousel-legacy.php'; |
| 44 |
require_once CB_PLUGIN_DIR . '/blocks/class-carousel.php'; |
| 45 |
|
| 46 |
// Load admin settings. |
| 47 |
require_once CB_PLUGIN_DIR . '/admin/class-settings-page.php'; |
| 48 |
|
| 49 |
// Block filters. |
| 50 |
require_once CB_PLUGIN_DIR . '/admin/class-block-filters.php'; |
| 51 |
|
| 52 |
// Load settings utils. |
| 53 |
require_once CB_PLUGIN_DIR . '/admin/class-settings-utils.php'; |
| 54 |
|
| 55 |
// Load block patterns. |
| 56 |
require_once CB_PLUGIN_DIR . '/patterns/class-patterns.php'; |
| 57 |
|
| 58 |
use CarouselSliderBlock\Blocks\Carousel_Legacy; |
| 59 |
use CarouselSliderBlock\Blocks\Carousel; |
| 60 |
use CarouselSliderBlock\Admin\Settings_Page; |
| 61 |
use CarouselSliderBlock\Admin\Block_Filters; |
| 62 |
use CarouselSliderBlock\Patterns\Patterns; |
| 63 |
|
| 64 |
/** |
| 65 |
* Main plugin initializer class. |
| 66 |
*/ |
| 67 |
class Main { |
| 68 |
/** |
| 69 |
* Initialize the plugin. |
| 70 |
*/ |
| 71 |
public static function init() { |
| 72 |
add_action( 'init', [ self::class, 'register_blocks' ] ); |
| 73 |
Patterns::init(); |
| 74 |
Settings_Page::init(); |
| 75 |
Block_Filters::init(); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Register blocks. |
| 80 |
*/ |
| 81 |
public static function register_blocks() { |
| 82 |
( new Carousel_Legacy() )->register(); |
| 83 |
( new Carousel() )->register(); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
// Initialize the plugin. |
| 88 |
Main::init(); |
| 89 |
|