-
Notifications
You must be signed in to change notification settings - Fork 24
/
plugin.php
85 lines (76 loc) · 3.33 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Plugin Name: GenerateBlocks
* Plugin URI: https://generateblocks.com
* Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything.
* Author: Tom Usborne
* Author URI: https://tomusborne.com
* Version: 1.9.1
* Requires at least: 5.9
* Requires PHP: 7.2
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: generateblocks
*
* @package GenerateBlocks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
define( 'GENERATEBLOCKS_VERSION', '1.9.1' );
define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) );
define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );
// Load necessary files.
require_once GENERATEBLOCKS_DIR . 'includes/functions.php';
require_once GENERATEBLOCKS_DIR . 'includes/general.php';
require_once GENERATEBLOCKS_DIR . 'includes/defaults.php';
// Utils.
require_once GENERATEBLOCKS_DIR . 'includes/utils/class-singleton.php';
require_once GENERATEBLOCKS_DIR . 'includes/utils/class-dto.php';
// General.
require_once GENERATEBLOCKS_DIR . 'includes/class-do-css.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-enqueue-css.php';
require_once GENERATEBLOCKS_DIR . 'includes/dashboard.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-settings.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-plugin-update.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-query-loop.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-dynamic-content.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-render-blocks.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-rest.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-legacy-attributes.php';
require_once GENERATEBLOCKS_DIR . 'includes/class-map-deprecated-attributes.php';
// Pattern library.
require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-libraries.php';
require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-library-dto.php';
require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-pattern-library-rest.php';
// Blocks.
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-container.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button-container.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-grid.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-headline.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-image.php';
require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-query-loop.php';
add_action( 'plugins_loaded', 'generateblocks_load_plugin_textdomain' );
/**
* Load GenerateBlocks textdomain.
*
* @since 1.0
*/
function generateblocks_load_plugin_textdomain() {
load_plugin_textdomain( 'generateblocks' );
}
/**
* Adds a redirect option during plugin activation on non-multisite installs.
*
* @since 0.1
*
* @param bool $network_wide Whether or not the plugin is being network activated.
*/
function generateblocks_do_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'] ) ) {
update_option( 'generateblocks_do_activation_redirect', true );
}
}
register_activation_hook( __FILE__, 'generateblocks_do_activate' );