Skip to content
Snippets Groups Projects
Select Git revision
  • 2a233d0ec59f5d2b236e9fc88c3e80a5d028ae97
  • master default protected
  • bugfix/wordpress-review
  • bugfix/prevent-error-notice
  • remove-arrow
  • feature/update-message
  • feature/minimum-plugin-version-check-demo1
  • feature/plugin-name
  • 3.7.1
  • 3.7.0
  • 3.6.3
  • 3.6.2
  • 3.6.1
  • 3.6.0
  • 3.6.0-beta3
  • 3.6.0-beta2
  • 3.6.0-beta1
  • 3.5.2
  • 3.5.1
  • 3.5.0
  • 3.4.0
  • 3.3.0
  • 3.2.8
  • 3.2.7
  • 3.2.6
  • 3.2.5
  • 3.2.4
  • 3.2.3
28 results

Basic_Requirement_Checker.php

Blame
  • Basic_Requirement_Checker.php 15.06 KiB
    <?php
    
    if ( ! interface_exists( 'WPDesk_Requirement_Checker' ) ) {
    	require_once 'Requirement_Checker.php';
    }
    
    if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
    	/**
    	 * Checks requirements for plugin
    	 * have to be compatible with PHP 5.3.x
    	 */
    	class WPDesk_Basic_Requirement_Checker implements WPDesk_Requirement_Checker {
    		const EXTENSION_NAME_OPENSSL = 'openssl';
    		const HOOK_ADMIN_NOTICES_ACTION = 'admin_notices';
    
    		const PLUGIN_INFO_KEY_NICE_NAME = 'nice_name';
    		const PLUGIN_INFO_KEY_NAME = 'name';
    
    		/** @var string */
    		protected $plugin_name;
    		/** @var string */
    		private $plugin_file;
    		/** @var string */
    		private $min_php_version;
    		/** @var string */
    		private $min_wp_version;
    		/** @var string|null */
    		private $min_wc_version = null;
    		/** @var int|null */
    		private $min_openssl_version = null;
    		/** @var array */
    		protected $plugin_require;
    		/** @var array */
    		private $module_require;
    		/** @var array */
    		private $setting_require;
    		/** @var array */
    		protected $notices;
    		/** @var @string */
    		private $text_domain;
    
    		/**
    		 * @param string $plugin_file
    		 * @param string $plugin_name
    		 * @param string $text_domain
    		 * @param string $php_version
    		 * @param string $wp_version
    		 */
    		public function __construct( $plugin_file, $plugin_name, $text_domain, $php_version, $wp_version ) {
    			$this->plugin_file = $plugin_file;
    			$this->plugin_name = $plugin_name;
    			$this->text_domain = $text_domain;
    
    			$this->set_min_php_require( $php_version );
    			$this->set_min_wp_require( $wp_version );
    
    			$this->plugin_require  = array();
    			$this->module_require  = array();
    			$this->setting_require = array();
    			$this->notices         = array();
    		}
    
    		/**
    		 * @param string $version
    		 *
    		 * @return $this
    		 */
    		public function set_min_php_require( $version ) {
    			$this->min_php_version = $version;