| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Genesis Blocks |
| 4 |
* Plugin URI: https://studiopress.com/genesis-pro/ |
| 5 |
* Description: A beautiful collection of handy blocks to help you get started with the new WordPress editor. |
| 6 |
* Author: StudioPress |
| 7 |
* Author URI: https://www.studiopress.com/ |
| 8 |
* Version: 3.1.11 |
| 9 |
* License: GPL2+ |
| 10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 11 |
* |
| 12 |
* @package Genesis\Blocks |
| 13 |
*/ |
| 14 |
|
| 15 |
// Include Composer Autoloader. |
| 16 |
require __DIR__ . '/vendor/autoload.php'; |
| 17 |
|
| 18 |
/** |
| 19 |
* Instantiate Genesis Blocks Plugin. |
| 20 |
* |
| 21 |
* @since 1.0.0 |
| 22 |
*/ |
| 23 |
function genesis_blocks_load(): void { |
| 24 |
$context = [ |
| 25 |
'url' => plugin_dir_url( __FILE__ ), |
| 26 |
'path' => plugin_dir_path( __FILE__ ), |
| 27 |
'version' => get_file_data( __FILE__, [ 'Version' ] )[0], |
| 28 |
'theme' => sanitize_title( get_stylesheet() ), |
| 29 |
]; |
| 30 |
|
| 31 |
( new Genesis\Blocks\PluginLoader( $context ) )->init(); |
| 32 |
} |
| 33 |
add_action( 'plugins_loaded', 'genesis_blocks_load' ); |
| 34 |
|
| 35 |
function genesis_blocks_main_plugin_file(): string { |
| 36 |
return __FILE__; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Load the plugin textdomain |
| 41 |
*/ |
| 42 |
function genesis_blocks_text_domain() { |
| 43 |
load_plugin_textdomain( 'genesis-blocks', false, basename( __DIR__ ) . '/languages' ); |
| 44 |
} |
| 45 |
add_action( 'init', 'genesis_blocks_text_domain' ); |
| 46 |
|
| 47 |
/** |
| 48 |
* Check for Pro version. |
| 49 |
*/ |
| 50 |
function genesis_blocks_is_pro() { |
| 51 |
return function_exists( 'AtomicBlocksPro\atomic_blocks_pro_main_plugin_file' ) || function_exists( 'Genesis\PageBuilder\main_plugin_file' ); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Set up plugin updates from WP Engine. |
| 56 |
* |
| 57 |
* Only if the lib/PluginUpdater.php file exists. This file is not present in |
| 58 |
* the version released to the WordPress.org repository or in the Pro version, |
| 59 |
* "Genesis Page Builder" https://github.com/studiopress/genesis-page-builder/. |
| 60 |
*/ |
| 61 |
function genesis_blocks_check_for_upgrades() { |
| 62 |
if ( ! file_exists( __DIR__ . '/lib/PluginUpdater.php' ) ) { |
| 63 |
return; |
| 64 |
} |
| 65 |
|
| 66 |
$properties = array( |
| 67 |
'plugin_slug' => 'genesis-blocks', |
| 68 |
'plugin_basename' => plugin_basename( __FILE__ ), |
| 69 |
); |
| 70 |
|
| 71 |
require_once __DIR__ . '/lib/PluginUpdater.php'; |
| 72 |
new \Genesis\Blocks\PluginUpdater( $properties ); |
| 73 |
} |
| 74 |
add_action( 'admin_init', 'genesis_blocks_check_for_upgrades' ); |
| 75 |
|