-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.php
60 lines (51 loc) · 1.54 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/*
Plugin Name: Kenzap Gallery
Description: Easily create and customize gallery blocks on your website
Author: Kenzap
Version: 1.1.0
Author URI: http://kenzap.com
License: GPL2+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: kenzap-gallery
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define("KENZAP_GALLERY", __DIR__);
//Check plugin requirements
if ( version_compare(PHP_VERSION, '5.6', '<') || !function_exists('register_block_type') ) {
if (! function_exists('kenzap_gallery_disable_plugin')) {
/**
* Disable plugin
*
* @return void
*/
function kenzap_gallery_disable_plugin(){
if (current_user_can('activate_plugins') && is_plugin_active(plugin_basename(__FILE__))) {
deactivate_plugins(__FILE__);
unset($_GET['activate']);
}
}
}
if (! function_exists('kenzap_gallery_show_error')) {
/**
* Show error
*
* @return void
*/
function kenzap_gallery_show_error(){
echo '<div class="error"><p><strong>Kenzap gallery</strong> needs at least PHP 5.6 version and WordPress 5.0, please update before installing the plugin.</p></div>';
}
}
//Add actions
add_action('admin_init', 'kenzap_gallery_disable_plugin');
add_action('admin_notices', 'kenzap_gallery_show_error');
//Do not load anything more
return;
}
/**
* Block Initializer.
*/
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';