generateblocks
Last commit date
assets
3 years ago
dist
2 years ago
includes
2 years ago
src
2 years ago
plugin.php
2 years ago
readme.txt
2 years ago
plugin.php
86 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: GenerateBlocks |
| 4 | * Plugin URI: https://generateblocks.com |
| 5 | * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. |
| 6 | * Author: Tom Usborne |
| 7 | * Author URI: https://tomusborne.com |
| 8 | * Version: 1.9.0 |
| 9 | * Requires at least: 5.9 |
| 10 | * Requires PHP: 7.2 |
| 11 | * License: GPL2+ |
| 12 | * License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
| 13 | * Text Domain: generateblocks |
| 14 | * |
| 15 | * @package GenerateBlocks |
| 16 | */ |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; // Exit if accessed directly. |
| 20 | } |
| 21 | |
| 22 | define( 'GENERATEBLOCKS_VERSION', '1.9.0' ); |
| 23 | define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); |
| 24 | define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 25 | |
| 26 | // Load necessary files. |
| 27 | require_once GENERATEBLOCKS_DIR . 'includes/functions.php'; |
| 28 | require_once GENERATEBLOCKS_DIR . 'includes/general.php'; |
| 29 | require_once GENERATEBLOCKS_DIR . 'includes/defaults.php'; |
| 30 | |
| 31 | // Utils. |
| 32 | require_once GENERATEBLOCKS_DIR . 'includes/utils/class-singleton.php'; |
| 33 | require_once GENERATEBLOCKS_DIR . 'includes/utils/class-dto.php'; |
| 34 | |
| 35 | // General. |
| 36 | require_once GENERATEBLOCKS_DIR . 'includes/class-do-css.php'; |
| 37 | require_once GENERATEBLOCKS_DIR . 'includes/class-enqueue-css.php'; |
| 38 | require_once GENERATEBLOCKS_DIR . 'includes/dashboard.php'; |
| 39 | require_once GENERATEBLOCKS_DIR . 'includes/class-settings.php'; |
| 40 | require_once GENERATEBLOCKS_DIR . 'includes/class-plugin-update.php'; |
| 41 | require_once GENERATEBLOCKS_DIR . 'includes/class-query-loop.php'; |
| 42 | require_once GENERATEBLOCKS_DIR . 'includes/class-dynamic-content.php'; |
| 43 | require_once GENERATEBLOCKS_DIR . 'includes/class-render-blocks.php'; |
| 44 | require_once GENERATEBLOCKS_DIR . 'includes/class-rest.php'; |
| 45 | require_once GENERATEBLOCKS_DIR . 'includes/class-legacy-attributes.php'; |
| 46 | require_once GENERATEBLOCKS_DIR . 'includes/class-map-deprecated-attributes.php'; |
| 47 | |
| 48 | // Pattern library. |
| 49 | require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-libraries.php'; |
| 50 | require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-library-dto.php'; |
| 51 | require_once GENERATEBLOCKS_DIR . 'includes/pattern-library/class-pattern-library-rest.php'; |
| 52 | |
| 53 | // Blocks. |
| 54 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button.php'; |
| 55 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-container.php'; |
| 56 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button-container.php'; |
| 57 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-grid.php'; |
| 58 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-headline.php'; |
| 59 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-image.php'; |
| 60 | require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-query-loop.php'; |
| 61 | |
| 62 | add_action( 'plugins_loaded', 'generateblocks_load_plugin_textdomain' ); |
| 63 | /** |
| 64 | * Load GenerateBlocks textdomain. |
| 65 | * |
| 66 | * @since 1.0 |
| 67 | */ |
| 68 | function generateblocks_load_plugin_textdomain() { |
| 69 | load_plugin_textdomain( 'generateblocks' ); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Adds a redirect option during plugin activation on non-multisite installs. |
| 74 | * |
| 75 | * @since 0.1 |
| 76 | * |
| 77 | * @param bool $network_wide Whether or not the plugin is being network activated. |
| 78 | */ |
| 79 | function generateblocks_do_activate( $network_wide = false ) { |
| 80 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only used to do a redirect. False positive. |
| 81 | if ( ! $network_wide && ! isset( $_GET['activate-multi'] ) ) { |
| 82 | update_option( 'generateblocks_do_activation_redirect', true ); |
| 83 | } |
| 84 | } |
| 85 | register_activation_hook( __FILE__, 'generateblocks_do_activate' ); |
| 86 |