-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.php
49 lines (40 loc) · 1.24 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
<?php
/**
* Plugin Name: Mapbox Track Block
* Plugin URI: https://chrisbibby.com.au
* Description: Display a GPX track on a MapBox Map
* Author: Chris Bibby
* Author URI: https://chrisbibby.com.au
* Version: 1.0.1
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
*
* @package Chrisbibby/MapboxTrackBlock
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Block Initializer.
*/
require_once plugin_dir_path( __FILE__ ) . 'src/options-page.php';
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';
/**
* Register activation hook and only activate plugin if we have v5 or greater
*/
function mbtb_activate() {
$wp_version = get_bloginfo( 'version' );
if ( ! version_compare( $wp_version, '5.0', '>=' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die( 'This plugin requires the block editor in WordPress v5.0 and above, please update to the latest WordPress version.' . version_compare( $wp_version, '5.0', '>=' ) );
}
}
register_activation_hook( __FILE__, 'mbtb_activate' );
/**
* Resgister uninstall hook and delete the options we created.
*/
function mbtb_uninstall() {
delete_option( 'mbtb_option_name' );
}
register_uninstall_hook( __FILE__, 'mbtb_deactivate' );