PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 2.9.7
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v2.9.7
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 2.6.1 All 56 releases
← All changes | slider-blocks.php +55 -17 2.3.02.9.7 View file →
@@ -1,13 +1,13 @@
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.3.0
8 - * Author: Zakaria Binsaifullah
9 - * Author URI: https://makegutenblock.com
3 + * Plugin Name: GutSlider - All in One Block Slider 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: 2.9.7
8 + * Author: Gutenbergkits
9 + * Author URI: https://gutenbergkits.com
10 10 * License: GPLv2 or later
11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 12 * Text Domain: slider-blocks
13 13 *
@@ -12,9 +12,8 @@
12 12 * Text Domain: slider-blocks
13 13 *
14 14 */
15 15
16 -
17 16 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
18 17
19 18 /**
20 19 * Blocks Final Class
@@ -19,9 +18,9 @@
19 18 /**
20 19 * Blocks Final Class
21 20 * return GutSliderBlocks
22 21 */
23 - if( ! class_exists('GutSliderBlocks') ) {
22 + if( ! class_exists( 'GutSliderBlocks' ) ) {
24 23
25 24 final class GutSliderBlocks {
26 25
27 26 private static $instance = null;
@@ -26,16 +25,15 @@
26 25
27 26 private static $instance = null;
28 27
29 28 /**
30 - * Constructor
31 - * return void
29 + * The constructor function initializes constants, includes necessary files, loads a text domain, and
30 + * sets up activation redirection for a PHP class.
32 31 */
33 - public function __construct() {
32 + private function __construct() {
34 33 $this->define_constants();
35 34 $this->includes();
36 -
37 - // redirecting
35 + add_action( 'init', [ $this, 'load_textdomain' ] );
38 36 register_activation_hook( __FILE__, [ $this, 'set_activation_redirect' ] );
39 37 add_action( 'admin_init', [ $this, 'redirect_to_welcome_page' ] );
40 38 }
41 39
@@ -43,9 +41,9 @@
43 41 * Define the plugin constants
44 42 * return void
45 43 */
46 44 private function define_constants() {
47 - define( 'GUTSLIDER_VERSION', '2.3.0' );
45 + define( 'GUTSLIDER_VERSION', '2.9.7' );
48 46 define( 'GUTSLIDER_URL', plugin_dir_url( __FILE__ ) );
49 47 define('GUTSLIDER_DIR_PATH', plugin_dir_path(__FILE__));
50 48 define( 'GUTSLIDER_DIR', __DIR__ );
51 49 }
@@ -65,13 +63,21 @@
65 63 * Include the files
66 64 * return void
67 65 */
68 66 public function includes() {
69 - require_once trailingslashit( GUTSLIDER_DIR ) . '/includes/init.php';
70 - require_once trailingslashit( GUTSLIDER_DIR ) . '/admin/admin.php';
67 + require_once GUTSLIDER_DIR . '/includes/init.php';
68 + require_once GUTSLIDER_DIR . '/admin/admin.php';
71 69 }
72 70
73 71 /**
72 + * Load the plugin text domain
73 + * return void
74 + */
75 + public function load_textdomain() {
76 + load_plugin_textdomain( 'slider-blocks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
77 + }
78 +
79 + /**
74 80 * Set the activation redirect
75 81 * return void
76 82 */
77 83 public function set_activation_redirect() {
@@ -85,10 +91,42 @@
85 91 public function redirect_to_welcome_page() {
86 92 if ( is_admin() && get_option( 'gutsliderblocks_do_activation_redirect', false ) ) {
87 93 delete_option( 'gutsliderblocks_do_activation_redirect' );
88 94 wp_safe_redirect( admin_url( 'admin.php?page=gutslider-blocks' ) );
95 + exit; // Added exit after redirect
89 96 }
90 97 }
98 +
99 + /**
100 + * Cleanup the plugin data
101 + * return void
102 + */
103 + public static function cleanup() {
104 + $upload_dir = wp_upload_dir();
105 + $css_dir = $upload_dir['basedir'] . '/gutslider-styles';
106 +
107 + if ( file_exists( $css_dir ) ) {
108 + global $wp_filesystem;
109 + if ( empty( $wp_filesystem ) ) {
110 + require_once( ABSPATH . '/wp-admin/includes/file.php' );
111 + WP_Filesystem();
112 + }
113 +
114 + $files = glob( $css_dir . '/*' );
115 + foreach ( $files as $file ) {
116 + if ( is_file( $file ) ) {
117 + $wp_filesystem->delete( $file );
118 + }
119 + }
120 + $wp_filesystem->rmdir( $css_dir );
121 + }
122 +
123 + // Remove parent directory if it's empty
124 + $parent_dir = dirname( $css_dir );
125 + if ( file_exists( $parent_dir ) && ( count( glob( "$parent_dir/*" ) ) === 0 ) ) {
126 + $wp_filesystem->rmdir( $parent_dir );
127 + }
128 + }
91 129
92 130 }
93 131
94 132 }