PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 3.2.0
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v3.2.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
← All changes | slider-blocks.php +58 -85 2.5.4 → 3.2.0 View file →
@@ -1,105 +1,78 @@
1 1 <?php
2 2 /**
3 - * Plugin Name: GutSlider - All in One Block Slider
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: 2.5.4
8 - * Author: Zakaria Binsaifullah
9 - * Author URI: https://makegutenblock.com
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
10 9 * License: GPLv2 or later
11 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 11 * Text Domain: slider-blocks
13 12 *
13 + * @package GutSlider
14 14 */
15 15
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit;
18 +}
16 19
17 -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
20 +/**
21 + * Plugin version constant.
22 + *
23 + * @since 1.0.0
24 + * @var string
25 + */
26 +define( 'GUTSLIDER_VERSION', '3.2.0' );
18 27
19 28 /**
20 - * Blocks Final Class
21 - * return GutSliderBlocks
29 + * Plugin directory URL with trailing slash.
30 + *
31 + * @since 1.0.0
32 + * @var string
22 33 */
23 - if( ! class_exists('GutSliderBlocks') ) {
34 +define( 'GUTSLIDER_URL', plugin_dir_url( __FILE__ ) );
24 35
25 - final class GutSliderBlocks {
36 +/**
37 + * Plugin directory path with trailing slash.
38 + *
39 + * @since 1.0.0
40 + * @var string
41 + */
42 +define( 'GUTSLIDER_DIR_PATH', plugin_dir_path( __FILE__ ) );
26 43
27 - private static $instance = null;
44 +/**
45 + * Plugin directory path without trailing slash.
46 + *
47 + * @since 1.0.0
48 + * @var string
49 + */
50 +define( 'GUTSLIDER_DIR', __DIR__ );
28 51
29 - /**
30 - * Constructor
31 - * return void
32 - */
33 - public function __construct() {
34 - $this->define_constants();
35 - $this->includes();
52 +// Load PSR-4 autoloader.
53 +require_once GUTSLIDER_DIR . '/includes/Autoloader.php';
54 +( new GutSlider_Autoloader( GUTSLIDER_DIR . '/includes/' ) )->register();
36 55
37 - // redirecting
38 - register_activation_hook( __FILE__, [ $this, 'set_activation_redirect' ] );
39 - add_action( 'admin_init', [ $this, 'redirect_to_welcome_page' ] );
40 - }
41 -
42 - /**
43 - * Define the plugin constants
44 - * return void
45 - */
46 - private function define_constants() {
47 - define( 'GUTSLIDER_VERSION', '2.5.4' );
48 - define( 'GUTSLIDER_URL', plugin_dir_url( __FILE__ ) );
49 - define('GUTSLIDER_DIR_PATH', plugin_dir_path(__FILE__));
50 - define( 'GUTSLIDER_DIR', __DIR__ );
51 - }
56 +// Load backward-compatibility global functions.
57 +require_once GUTSLIDER_DIR . '/includes/compat.php';
52 58
53 - /**
54 - * Initialize the plugin
55 - * return GutSliderBlocks
56 - */
57 - public static function init() {
58 - if( is_null( self::$instance ) ) {
59 - self::$instance = new self();
60 - }
61 - return self::$instance;
62 - }
59 +// Load admin (outside refactoring scope).
60 +require_once GUTSLIDER_DIR . '/admin/admin.php';
63 61
64 - /**
65 - * Include the files
66 - * return void
67 - */
68 - public function includes() {
69 - require_once trailingslashit( GUTSLIDER_DIR ) . '/includes/init.php';
70 - require_once trailingslashit( GUTSLIDER_DIR ) . '/admin/admin.php';
71 - }
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' ) );
72 65
73 - /**
74 - * Set the activation redirect
75 - * return void
76 - */
77 - public function set_activation_redirect() {
78 - add_option( 'gutsliderblocks_do_activation_redirect', true );
79 - }
66 +/**
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();
75 +}
80 76
81 - /**
82 - * Redirect to the welcome page
83 - * return void
84 - */
85 - public function redirect_to_welcome_page() {
86 - if ( is_admin() && get_option( 'gutsliderblocks_do_activation_redirect', false ) ) {
87 - delete_option( 'gutsliderblocks_do_activation_redirect' );
88 - wp_safe_redirect( admin_url( 'admin.php?page=gutslider-blocks' ) );
89 - }
90 - }
91 -
92 - }
93 -
94 - }
95 -
96 - /**
97 - * Initialize the GutSliderBlocks
98 - * return GutSliderBlocks
99 - */
100 - function gutsliderblocks() {
101 - return GutSliderBlocks::init();
102 - }
103 -
104 - // kick-off the plugin
105 - gutsliderblocks();
77 +// Boot the plugin.
78 +gutsliderblocks();