Remove the Gutenberg Dependency Check from Blockbase and bump required version to 5.9 (#5823)
This commit is contained in:
parent
0e09eaeccf
commit
8d9e78c5fb
3 changed files with 3 additions and 66 deletions
|
@ -189,6 +189,4 @@ require get_template_directory() . '/inc/block-patterns.php';
|
|||
// Add the child theme patterns if they exist.
|
||||
if ( file_exists( get_stylesheet_directory() . '/inc/block-patterns.php' ) ) {
|
||||
require_once get_stylesheet_directory() . '/inc/block-patterns.php';
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/gutenberg-dependency-check.php';
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
add_action( 'admin_notices', 'show_admin_messages' );
|
||||
|
||||
function print_admin_message( $version ) {
|
||||
echo '<div id="message" class="error"><p><strong>';
|
||||
printf( __( 'The installed theme requires <a href="https://wordpress.org/plugins/gutenberg/">Gutenberg</a> version %s or higher.', 'blockbase' ), $version );
|
||||
echo '</strong></p></div>';
|
||||
}
|
||||
|
||||
function show_admin_messages() {
|
||||
|
||||
if ( is_child_theme() ) {
|
||||
$metadata = file_get_contents( get_template_directory() . '/style.css' );
|
||||
preg_match( '/(?<=Requires Gutenberg:).+/', $metadata, $match );
|
||||
|
||||
if ( sizeof( $match ) > 0 ) {
|
||||
$version = trim( $match[0] );
|
||||
}
|
||||
}
|
||||
|
||||
$metadata = file_get_contents( get_stylesheet_directory() . '/style.css' );
|
||||
preg_match( '/(?<=Requires Gutenberg:).+/', $metadata, $match );
|
||||
|
||||
if ( ! isset( $version ) || ( sizeof( $match ) > 0 && version_compare( $version, trim( $match[0] ) ) < 0 ) ) {
|
||||
$version = trim( $match[0] );
|
||||
}
|
||||
|
||||
if ( ! isset( $version ) ) {
|
||||
return; // Gutenberg is not required
|
||||
}
|
||||
|
||||
if ( ! defined( 'IS_GUTENBERG_PLUGIN' ) ) {
|
||||
print_admin_message( $version ); // Gutenberg is not activated
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine Gutenberg version from defined constant
|
||||
if ( defined( 'GUTENBERG_VERSION' ) ) {
|
||||
if ( version_compare( GUTENBERG_VERSION, $version ) < 0 ) {
|
||||
print_admin_message( $version );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// We have confirmed that Gutenberg is installed and activated, however we cannot use the GUTENBERG_VERSION constant
|
||||
// (probably because we are in development mode)
|
||||
// we'll use the metadata from get_plugins() to determine the version of Gutenberg
|
||||
$plugins = get_plugins();
|
||||
foreach ( $plugins as $plugin ) {
|
||||
if ( 'Gutenberg' === $plugin['Name'] ) {
|
||||
if ( version_compare( trim( $plugin['Version'] ), $version ) < 0 ) {
|
||||
print_admin_message( $version );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We weren't able to confirm the version, however we do know that it's installed and activated so we'll just hope for the best!
|
||||
}
|
|
@ -4,10 +4,9 @@ Theme URI: https://github.com/Automattic/themes/tree/trunk/blockbase
|
|||
Author: Automattic
|
||||
Author URI: https://automattic.com/
|
||||
Description: Blockbase is a simple theme that supports full-site editing. It comes with a set of minimal templates and design settings that can be manipulated through Global Styles. Use it to build something beautiful.
|
||||
Requires at least: 5.7
|
||||
Tested up to: 5.8
|
||||
Requires at least: 5.8
|
||||
Tested up to: 5.9
|
||||
Requires PHP: 5.7
|
||||
Requires Gutenberg: 12.8
|
||||
Version: 2.0.31
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
|
Loading…
Add table
Reference in a new issue