| @@ -1,63 +1,78 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Plugin Name: GutSlider Blocks | |
| 4 | - * Description: A collection of custom Gutenberg Slider Blocks to slide your post or custom content. | |
| 5 | - * Requires at least: 5.7 | |
| 6 | - * Requires PHP: 7.0 | |
| 7 | - * Version: 1.0.0 | |
| 8 | - * Author: Zakaria Binsaifullah | |
| 9 | - * Author URI: https://makegutenblock.com | |
| 10 | - * License: GPL-2.0-or-later | |
| 3 | + * Plugin Name: GutSlider - All in One Slider Blocks for Gutenberg | |
| 4 | + * Description: A collection of custom Gutenberg Slider Blocks to slide your content. | |
| 5 | + * Requires at least: 6.5 | |
| 6 | + * Requires PHP: 7.4 | |
| 7 | + * Version: 3.2.0 | |
| 8 | + * Author: Binsaifullah | |
| 9 | + * License: GPLv2 or later | |
| 11 | 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 12 | - * Text Domain: gutsliders | |
| 11 | + * Text Domain: slider-blocks | |
| 13 | 12 | * |
| 13 | + * @package GutSlider | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -// Stop Direct Access | |
| 17 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | 17 | exit; |
| 19 | 18 | } |
| 20 | 19 | |
| 21 | -// require autoload | |
| 22 | -require_once __DIR__ . '/vendor/autoload.php'; | |
| 20 | +/** | |
| 21 | + * Plugin version constant. | |
| 22 | + * | |
| 23 | + * @since 1.0.0 | |
| 24 | + * @var string | |
| 25 | + */ | |
| 26 | +define( 'GUTSLIDER_VERSION', '3.2.0' ); | |
| 23 | 27 | |
| 24 | -use GutSliders\Traits\Singleton; | |
| 28 | +/** | |
| 29 | + * Plugin directory URL with trailing slash. | |
| 30 | + * | |
| 31 | + * @since 1.0.0 | |
| 32 | + * @var string | |
| 33 | + */ | |
| 34 | +define( 'GUTSLIDER_URL', plugin_dir_url( __FILE__ ) ); | |
| 25 | 35 | |
| 26 | 36 | /** |
| 27 | - * Blocks Final Class | |
| 37 | + * Plugin directory path with trailing slash. | |
| 38 | + * | |
| 39 | + * @since 1.0.0 | |
| 40 | + * @var string | |
| 28 | 41 | */ |
| 42 | +define( 'GUTSLIDER_DIR_PATH', plugin_dir_path( __FILE__ ) ); | |
| 29 | 43 | |
| 30 | -final class GutSliderBlocks { | |
| 44 | +/** | |
| 45 | + * Plugin directory path without trailing slash. | |
| 46 | + * | |
| 47 | + * @since 1.0.0 | |
| 48 | + * @var string | |
| 49 | + */ | |
| 50 | +define( 'GUTSLIDER_DIR', __DIR__ ); | |
| 31 | 51 | |
| 32 | - // Singleton Trait | |
| 33 | - use Singleton; | |
| 52 | +// Load PSR-4 autoloader. | |
| 53 | +require_once GUTSLIDER_DIR . '/includes/Autoloader.php'; | |
| 54 | +( new GutSlider_Autoloader( GUTSLIDER_DIR . '/includes/' ) )->register(); | |
| 34 | 55 | |
| 35 | - // Constructor | |
| 36 | - public function __construct() { | |
| 37 | - // loader | |
| 38 | - new GutSliders\Loader(); | |
| 39 | - // define constants | |
| 40 | - $this->define_constants(); | |
| 41 | - } | |
| 56 | +// Load backward-compatibility global functions. | |
| 57 | +require_once GUTSLIDER_DIR . '/includes/compat.php'; | |
| 42 | 58 | |
| 43 | - /** | |
| 44 | - * Define the plugin constants | |
| 45 | - */ | |
| 46 | - private function define_constants() { | |
| 47 | - define( 'GUTSLIDERS_VERSION', '1.0.0' ); | |
| 48 | - define( 'GUTSLIDERS_URL', plugin_dir_url( __FILE__ ) ); | |
| 49 | - define('GUTSLIDERS_DIR_PATH', plugin_dir_path(__FILE__)); | |
| 50 | - define( 'GUTSLIDERS_PATH', __DIR__ ); | |
| 51 | - } | |
| 59 | +// Load admin (outside refactoring scope). | |
| 60 | +require_once GUTSLIDER_DIR . '/admin/admin.php'; | |
| 52 | 61 | |
| 53 | -} | |
| 62 | +// Register activation and deactivation hooks. | |
| 63 | +register_activation_hook( __FILE__, array( GutSlider\Plugin::class, 'on_activation' ) ); | |
| 64 | +register_deactivation_hook( __FILE__, array( GutSlider\Plugin::class, 'cleanup' ) ); | |
| 54 | 65 | |
| 55 | 66 | /** |
| 56 | - * Kickoff | |
| 57 | -*/ | |
| 58 | -function gut_slider_blocks() { | |
| 59 | - return GutSliderBlocks::init(); | |
| 67 | + * Return the main plugin singleton instance. | |
| 68 | + * | |
| 69 | + * @since 1.0.0 | |
| 70 | + * | |
| 71 | + * @return GutSlider\Plugin The plugin instance. | |
| 72 | + */ | |
| 73 | +function gutsliderblocks(): GutSlider\Plugin { | |
| 74 | + return GutSlider\Plugin::get_instance(); | |
| 60 | 75 | } |
| 61 | 76 | |
| 62 | -// Let's start it | |
| 63 | -gut_slider_blocks(); | |
| 77 | +// Boot the plugin. | |
| 78 | +gutsliderblocks(); | |