| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Insert Special Characters |
| 4 |
* Plugin URI: https://github.com/10up/insert-special-characters |
| 5 |
* Description: A Special Character inserter for the WordPress block editor (Gutenberg). |
| 6 |
* Version: 1.1.3 |
| 7 |
* Requires at least: 6.5 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: 10up |
| 10 |
* Author URI: https://10up.com |
| 11 |
* License: GPLv2 |
| 12 |
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 13 |
* Text Domain: insert-special-characters |
| 14 |
* |
| 15 |
* @package insert-special-characters |
| 16 |
*/ |
| 17 |
|
| 18 |
namespace InsertSpecialCharacters; |
| 19 |
|
| 20 |
define( 'ISC_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 21 |
define( 'ISC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 22 |
|
| 23 |
/** |
| 24 |
* Get the minimum version of PHP required by this plugin. |
| 25 |
* |
| 26 |
* @since 1.0.8 |
| 27 |
* |
| 28 |
* @return string Minimum version required. |
| 29 |
*/ |
| 30 |
function minimum_php_requirement() { |
| 31 |
return '7.4'; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Whether PHP installation meets the minimum requirements |
| 36 |
* |
| 37 |
* @since 1.0.8 |
| 38 |
* |
| 39 |
* @return bool True if meets minimum requirements, false otherwise. |
| 40 |
*/ |
| 41 |
function site_meets_php_requirements() { |
| 42 |
return version_compare( phpversion(), minimum_php_requirement(), '>=' ); |
| 43 |
} |
| 44 |
|
| 45 |
// Try to load the plugin files, ensuring our PHP version is met first. |
| 46 |
if ( ! site_meets_php_requirements() ) { |
| 47 |
add_action( |
| 48 |
'admin_notices', |
| 49 |
function() { |
| 50 |
?> |
| 51 |
<div class="notice notice-error"> |
| 52 |
<p> |
| 53 |
<?php |
| 54 |
echo wp_kses_post( |
| 55 |
sprintf( |
| 56 |
/* translators: %s: Minimum required PHP version */ |
| 57 |
__( 'Insert Special Characters requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'insert-special-characters' ), |
| 58 |
esc_html( minimum_php_requirement() ) |
| 59 |
) |
| 60 |
); |
| 61 |
?> |
| 62 |
</p> |
| 63 |
</div> |
| 64 |
<?php |
| 65 |
} |
| 66 |
); |
| 67 |
return; |
| 68 |
} |
| 69 |
|
| 70 |
if ( ! site_meets_php_requirements() ) { |
| 71 |
return; |
| 72 |
} |
| 73 |
|
| 74 |
require_once __DIR__ . '/inc/plugin.php'; |
| 75 |
|