diff --git a/maps-block-apple.php b/maps-block-apple.php index 495121c..3c93979 100644 --- a/maps-block-apple.php +++ b/maps-block-apple.php @@ -11,7 +11,6 @@ * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html * Text Domain: maps-block-apple - * Domain Path: /languages * * @package tenup\Maps_Block_Apple */ @@ -25,7 +24,22 @@ define( 'MAPS_BLOCK_APPLE_INC', MAPS_BLOCK_APPLE_PATH . 'includes/' ); define( 'MAPS_BLOCK_APPLE_BASENAME', plugin_basename( __FILE__ ) ); -add_action( 'init', __NAMESPACE__ . '\add_options' ); +/** + * Require WP version 5.2+ beacuse of hooks. + * PHP 5.6 errors should be caught in the sandbox during activation. + */ +register_activation_hook( + __FILE__, + function() { + if ( ! version_compare( $GLOBALS['wp_version'], '5.2', '>=' ) ) { + wp_die( + esc_html__( 'Block for Apple Maps requires WordPress version 5.2 or greater.', 'maps-block-apple' ), + esc_html__( 'Error Activating', 'maps-block-apple' ) + ); + } + } +); + /** * Add options */ @@ -34,6 +48,7 @@ function add_options() { add_option( 'maps_block_apple_key_id' ); add_option( 'maps_block_apple_private_key' ); } +add_action( 'init', __NAMESPACE__ . '\add_options' ); require_once MAPS_BLOCK_APPLE_INC . 'block-assets.php'; require_once MAPS_BLOCK_APPLE_INC . 'rest-routes.php';