Blocks
2 years ago
Contracts
5 years ago
Database
3 years ago
Integrations
2 years ago
Libraries
5 years ago
Models
2 years ago
Seeds
4 years ago
Services
2 years ago
Support
2 years ago
config
2 years ago
Activator.php
5 years ago
Attachment.php
4 years ago
Controller.php
5 years ago
Core.php
5 years ago
Deactivator.php
3 years ago
Factory.php
5 years ago
Files.php
5 years ago
Playlist.php
2 years ago
Plugin.php
5 years ago
Requirements.php
4 years ago
support.php
4 years ago
Requirements.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PrestoPlayer; |
| 4 | |
| 5 | use \PrestoPlayer\Mundschenk\WP_Requirements; |
| 6 | |
| 7 | class Requirements extends WP_Requirements |
| 8 | { |
| 9 | const REQUIREMENTS = [ |
| 10 | 'php' => '7.3', |
| 11 | 'multibyte' => false, |
| 12 | 'utf-8' => false, |
| 13 | 'wp' => '5.6', |
| 14 | ]; |
| 15 | |
| 16 | /** |
| 17 | * Creates a new requirements instance. |
| 18 | * |
| 19 | * @since 2.1.0 Parameter $plugin_file replaced with AVATAR_PRIVACY_PLUGIN_FILE constant. |
| 20 | */ |
| 21 | public function __construct() |
| 22 | { |
| 23 | parent::__construct('Presto Player', PRESTO_PLAYER_PLUGIN_FILE, 'presto-player', self::REQUIREMENTS); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Retrieves an array of requirement specifications. |
| 28 | * |
| 29 | * @return array { |
| 30 | * An array of requirements checks. |
| 31 | * |
| 32 | * @type string $enable_key An index in the $install_requirements array to switch the check on and off. |
| 33 | * @type callable $check A function returning true if the check was successful, false otherwise. |
| 34 | * @type callable $notice A function displaying an appropriate error notice. |
| 35 | * } |
| 36 | */ |
| 37 | protected function get_requirements() |
| 38 | { |
| 39 | $requirements = parent::get_requirements(); |
| 40 | $requirements[] = [ |
| 41 | 'enable_key' => 'wp', |
| 42 | 'check' => [$this, 'check_wp_support'], |
| 43 | 'notice' => [$this, 'admin_notices_wp_incompatible'], |
| 44 | ]; |
| 45 | |
| 46 | return $requirements; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Checks for availability of the GD extension. |
| 51 | * |
| 52 | * @return bool |
| 53 | */ |
| 54 | protected function check_wp_support() |
| 55 | { |
| 56 | global $wp_version; |
| 57 | return version_compare($wp_version, '5.6', '>='); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Prints 'WordPress Update' admin notice |
| 62 | * |
| 63 | * @return void |
| 64 | */ |
| 65 | public function admin_notices_wp_incompatible() |
| 66 | { |
| 67 | $this->display_error_notice( |
| 68 | /* translators: 1: plugin name 2: WordPress update documentation URL */ |
| 69 | \__('The activated plugin %1$s requires WordPress 5.6 or higher. Please update WordPress.', 'presto-player'), |
| 70 | '<strong>Presto Player</strong>', |
| 71 | /* translators: URL with WordPRess installation instructions */ |
| 72 | \__('https://wordpress.org/support/article/updating-wordpress/', 'presto-player') |
| 73 | ); |
| 74 | } |
| 75 | } |
| 76 |