Blocks
6 months ago
Contracts
1 year ago
Database
4 months ago
Integrations
3 months ago
Libraries
3 months ago
Models
3 months ago
Seeds
1 year ago
Services
3 months ago
Support
4 months ago
config
4 months ago
lib
4 months ago
Activator.php
1 year ago
Attachment.php
4 months ago
Controller.php
1 year ago
Core.php
1 year ago
Deactivator.php
1 year ago
Factory.php
3 months ago
Files.php
1 year ago
Playlist.php
1 year ago
Plugin.php
9 months ago
Requirements.php
1 year ago
support.php
1 year ago
Requirements.php
72 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 = array( |
| 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 | parent::__construct( 'Presto Player', PRESTO_PLAYER_PLUGIN_FILE, 'presto-player', self::REQUIREMENTS ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Retrieves an array of requirement specifications. |
| 27 | * |
| 28 | * @return array { |
| 29 | * An array of requirements checks. |
| 30 | * |
| 31 | * @type string $enable_key An index in the $install_requirements array to switch the check on and off. |
| 32 | * @type callable $check A function returning true if the check was successful, false otherwise. |
| 33 | * @type callable $notice A function displaying an appropriate error notice. |
| 34 | * } |
| 35 | */ |
| 36 | protected function get_requirements() { |
| 37 | $requirements = parent::get_requirements(); |
| 38 | $requirements[] = array( |
| 39 | 'enable_key' => 'wp', |
| 40 | 'check' => array( $this, 'check_wp_support' ), |
| 41 | 'notice' => array( $this, 'admin_notices_wp_incompatible' ), |
| 42 | ); |
| 43 | |
| 44 | return $requirements; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Checks for availability of the GD extension. |
| 49 | * |
| 50 | * @return bool |
| 51 | */ |
| 52 | protected function check_wp_support() { |
| 53 | global $wp_version; |
| 54 | return version_compare( $wp_version, '5.6', '>=' ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Prints 'WordPress Update' admin notice |
| 59 | * |
| 60 | * @return void |
| 61 | */ |
| 62 | public function admin_notices_wp_incompatible() { |
| 63 | $this->display_error_notice( |
| 64 | /* translators: 1: plugin name 2: WordPress update documentation URL */ |
| 65 | \__( 'The activated plugin %1$s requires WordPress 5.6 or higher. Please update WordPress.', 'presto-player' ), |
| 66 | '<strong>Presto Player</strong>', |
| 67 | /* translators: URL with WordPress installation instructions */ |
| 68 | \__( 'https://wordpress.org/support/article/updating-wordpress/', 'presto-player' ) |
| 69 | ); |
| 70 | } |
| 71 | } |
| 72 |