PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 1.2.2
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v1.2.2
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
blockspare / src / welcome.php

welcome.php in BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites 1.2.2, at src/welcome.php

89 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /********************************************************************************************
4 * Activation & PHP version checks.
5 ********************************************************************************************/
6
7 if ( !function_exists( 'blockspare_php_requirement_activation_check' ) ) {
8 /**
9 * Upon activation, check if we have the proper PHP version.
10 * Show an error if needed and don't continue with the plugin.
11 *
12 * @since 1.0.0
13 */
14 function blockspare_php_requirement_activation_check()
15 {
16
17 if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
18 deactivate_plugins( basename( __FILE__ ) );
19 wp_die( sprintf(
20 __( '%s"Blockspare" can not be activated. %s It requires PHP version 5.3.0 or higher, but PHP version %s is used on the site. Please upgrade your PHP version first %s Back %s', 'blockspare' ),
21 '<strong>',
22 '</strong><br><br>',
23 PHP_VERSION,
24 '<br /><br /><a href="' . esc_url( get_dashboard_url( get_current_user_id(), 'plugins.php' ) ) . '" class="button button-primary">',
25 '</a>'
26 ) );
27 }
28
29 }
30
31 register_activation_hook( __FILE__, 'blockspare_php_requirement_activation_check' );
32 }
33
34 /**
35 * Always check the PHP version at the start.
36 * If the PHP version isn't sufficient, don't continue to prevent any unwanted errors.
37 *
38 * @since 1.0.0
39 */
40
41 if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
42 if ( !function_exists( 'blockspare_php_requirement_notice' ) ) {
43 function blockspare_php_requirement_notice()
44 {
45 printf( '<div class="notice notice-error"><p>%s</p></div>', sprintf( __( '"Blockspare" requires PHP version 5.3.0 or higher, but PHP version %s is used on the site.', 'blockspare' ), PHP_VERSION ) );
46 }
47
48 }
49 add_action( 'admin_notices', 'blockspare_php_requirement_notice' );
50 return;
51 }
52
53 /**
54 * Always keep note of the Blockspare version.
55 *
56 * @since 1.0.0
57 */
58
59 if ( !function_exists( 'blockspare_version_upgrade_check' ) ) {
60 function blockspare_version_upgrade_check()
61 {
62 // This is triggered only when V1 was previously activated, and this is the first time V2 is activated.
63 // Will not trigger after successive V2 activations.
64 if ( get_option( 'blockspare_activation_date' ) && !get_option( 'blockspare_current_version_installed' ) ) {
65 update_option( 'blockspare_current_version_installed', '1' );
66 }
67 // Always check the current version installed. Trigger if it changes.
68
69 if ( get_option( 'blockspare_current_version_installed' ) !== BLOCKSPARE_VERSION ) {
70 do_action( 'blockspare_version_upgraded', get_option( 'blockspare_current_version_installed' ), BLOCKSPARE_VERSION );
71 update_option( 'blockspare_current_version_installed', BLOCKSPARE_VERSION );
72 }
73
74 }
75
76 add_action( 'admin_menu', 'blockspare_version_upgrade_check', 1 );
77 }
78
79 /**
80 * END Activation & PHP version checks.
81 */
82
83 /**
84 * Ready for Welcome screen.
85 */
86
87 include(BLOCKSPARE_PLUGIN_DIR . '/src/admin/admin-init.php');
88 include(BLOCKSPARE_PLUGIN_DIR . '/src/admin/admin-block-list.php');
89