-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplugin.php
More file actions
53 lines (47 loc) · 1.41 KB
/
plugin.php
File metadata and controls
53 lines (47 loc) · 1.41 KB
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
<?php
/**
* Plugin Name: C9 Blocks
* Plugin URI: https://www.covertnine.com
* Description: 10 new Gutenberg blocks with block templates. With C9, the agency is in the code.
* Author: COVERT NINE
* Author URI: https://www.covertnine.com
* Version: 1.7.7
* License: GPLv3
* Text Domain: c9-blocks
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
*
* @package C9 Blocks
*/
// Exit if accessed directly.
if (!defined('ABSPATH')) {
exit;
}
/**
* Block Initializer.
*/
require_once plugin_dir_path(__FILE__) . 'src/init.php';
/**
* Adds a redirect option during plugin activation on non-multisite installs.
*
* @param bool $network_wide Whether or not the plugin is being network activated.
*/
function c9_blocks_activate($network_wide = false)
{
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only used to do a redirect. False positive.
if (!$network_wide && !isset($_GET['activate-multi'])) {
add_option('c9_blocks_do_activation_redirect', true);
}
}
register_activation_hook(__FILE__, 'c9_blocks_activate');
/**
* Redirect to the C9 Blocks Getting Started page on single plugin activation.
*/
function c9_blocks_redirect()
{
if (get_option('c9_blocks_do_activation_redirect', false)) {
delete_option('c9_blocks_do_activation_redirect');
wp_safe_redirect(esc_url(admin_url('themes.php?page=c9-blocks-getting-started')));
exit;
}
}
add_action('admin_init', 'c9_blocks_redirect');