| 1 |
<?php |
| 2 |
|
| 3 |
class SimpleTags_Compatibility { |
| 4 |
/** |
| 5 |
* admin_init hook callback |
| 6 |
* |
| 7 |
* @since 0.1 |
| 8 |
*/ |
| 9 |
public static function admin_init() { |
| 10 |
// Not on ajax |
| 11 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 12 |
return; |
| 13 |
} |
| 14 |
|
| 15 |
// Check activation |
| 16 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 17 |
return; |
| 18 |
} |
| 19 |
|
| 20 |
trigger_error( sprintf( esc_html__('TaxoPress requires PHP version %s or greater to be activated.'), esc_html(STAGS_MIN_PHP_VERSION) ) ); |
| 21 |
|
| 22 |
// Deactive self |
| 23 |
deactivate_plugins( plugin_basename( STAGS_DIR . '/simple-tags.php' ) ); |
| 24 |
|
| 25 |
unset( $_GET['activate'] ); |
| 26 |
|
| 27 |
add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Notify the user about the incompatibility issue. |
| 32 |
*/ |
| 33 |
public static function admin_notices() { |
| 34 |
echo '<div class="notice error is-dismissible">'; |
| 35 |
echo '<p>' . esc_html( sprintf( esc_html__('TaxoPress require PHP version %s or greater to be activated. Your server is currently running PHP version %s.'), esc_html(STAGS_MIN_PHP_VERSION), esc_html(PHP_VERSION) ) ) . '</p>'; |
| 36 |
echo '</div>'; |
| 37 |
} |
| 38 |
} |
| 39 |
|