Skip to content

Commit

Permalink
Merge pull request #50 from 10up/add/wp-min-version
Browse files Browse the repository at this point in the history
Require WP 5.2+
  • Loading branch information
jeffpaul authored Jun 25, 2020
2 parents 60be1c7 + 7bfef35 commit 078951e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions maps-block-apple.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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';

0 comments on commit 078951e

Please sign in to comment.