PluginProbe
TablePress – Tables in WordPress made easy / 2.3
TablePress – Tables in WordPress made easy v2.3
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / controllers / environment-checks.php

environment-checks.php in TablePress – Tables in WordPress made easy 2.3, at controllers/environment-checks.php

88 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TablePress environment compatibility check.
4 *
5 * Note: This file must not contain PHP code that does not run on PHP < 7.2!
6 *
7 * @package TablePress
8 * @author Tobias Bäthge
9 * @since 2.2.0
10 */
11
12 // Prohibit direct script loading.
13 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
14
15 /**
16 * Check if the site is using WordPress 6.0 or newer.
17 */
18 require ABSPATH . WPINC . '/version.php'; // Include an unmodified $wp_version.
19 if ( version_compare( str_replace( '-src', '', $wp_version ), '6.0', '<' ) ) { // @phpstan-ignore-line
20 /**
21 * Show an error notice to admins, if the installed version of WordPress is not supported.
22 *
23 * @since 2.2.0
24 */
25 function tablepress_admin_error_notice_minimum_version_wp() /* No return type declaration, due to required PHP compatibility! */ {
26 ?>
27 <div class="notice notice-error notice-alt notice-large">
28 <h3><em>
29 <span aria-hidden="true" class="dashicons dashicons-warning" style="color:#d63638;vertical-align:bottom"></span>
30 <?php _e( 'Attention: Unfortunately, there is a problem!', 'tablepress' ); ?>
31 </em></h3>
32 <p style="font-size:14px">
33 <?php _e( 'The installed version of WordPress is too old for the TablePress plugin! TablePress requires an up-to-date version!', 'tablepress' ); ?>
34 </p>
35 <p style="font-size:14px">
36 <strong>
37 <?php
38 if ( current_user_can( 'update_core' ) ) {
39 printf( __( 'Please <a href="%1$s">update your WordPress installation</a> to at least version %2$s!', 'tablepress' ), esc_url( self_admin_url( 'update-core.php' ) ), '6.0' );
40 } else {
41 printf( __( 'Please ask your site’s administrator to update WordPress to at least version %1$s!', 'tablepress' ), '6.0' );
42 }
43 ?>
44 </strong>
45 </p>
46 </div>
47 <?php
48 }
49 add_action( 'admin_notices', 'tablepress_admin_error_notice_minimum_version_wp' );
50
51 // Exit TablePress early.
52 return false;
53 }
54
55 /**
56 * Check if the server is running PHP 7.2 or newer.
57 */
58 if ( PHP_VERSION_ID < 70200 ) {
59 /**
60 * Show an error notice to admins, if the installed version of PHP is not supported.
61 *
62 * @since 2.2.0
63 */
64 function tablepress_admin_error_notice_minimum_version_php() /* No return type declaration, due to required PHP compatibility! */ {
65 ?>
66 <div class="notice notice-error notice-alt notice-large">
67 <h3><em>
68 <span aria-hidden="true" class="dashicons dashicons-warning" style="color:#d63638;vertical-align:bottom"></span>
69 <?php _e( 'Attention: Unfortunately, there is a problem!', 'tablepress' ); ?>
70 </em></h3>
71 <p style="font-size:14px">
72 <?php printf( __( 'Your server is running a version of PHP that is too old for the TablePress plugin to work. TablePress requires PHP %s or newer, where newer versions are recommended.', 'tablepress' ), '7.2' ); ?>
73 </p>
74 <p style="font-size:14px">
75 <strong><?php printf( __( '<a href="%s">Learn more about updating PHP</a> or contact your server administrator.', 'tablepress' ), esc_url( wp_get_update_php_url() ) ); ?></strong>
76 </p>
77 </div>
78 <?php
79 }
80 add_action( 'admin_notices', 'tablepress_admin_error_notice_minimum_version_php' );
81
82 // Exit TablePress early.
83 return false;
84 }
85
86 // All environment checks passed.
87 return true;
88