includes/class-wp-requirements.php
protected function validate_wordpress( $wordpress ) {
		global $wp_version;

		$result = $required = array();

		foreach ( $wordpress as $type => $data ) {
			switch ( $type ) {
				case 'version':
					$result[ $type ]   = version_compare( $wp_version, $data, '>=' );
					$required[ $type ] = $data;
					break;

				case 'plugins':
					if ( ! function_exists( 'is_plugin_active' ) ) {
						/* @noinspection PhpIncludeInspection */
						include_once ABSPATH . 'wp-admin/includes/plugin.php';
					}

					foreach ( (array) $data as $plugin => $required_version ) {
						if ( $plugin && is_string( $plugin ) ) {
							$required[ $type ][ $plugin ] = $required_version;

							$is_plugin_active = is_plugin_active( $plugin );

							if ( is_bool( $required_version ) ) {

								/**
								 * When the required version is specified
								 * as a Boolean (`true` or `false`),
								 * then we do not need to check the version number,
								 * just active or not.
								 */
								$result[ $type ][ $plugin ] =
									( $is_plugin_active === $required_version );

							} else {

								/**
								 * Check that the plugin is active and
								 * that its version matches the requirements.
								 */

								$raw_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin,
									false, false
								);

								// If the plugin does not have a version (?!) then
								// we consider the version is OK.
								$is_plugin_version_ok = (
									! isset( $raw_data['Version'] ) ||
									version_compare(
										$raw_data['Version'],
										$required_version,
										$this->version_compare_operator
									)
								);

								$result[ $type ][ $plugin ] = $is_plugin_active && $is_plugin_version_ok;
							}
						}
					}

					break;

				case 'theme':
					$theme = (array) $data;

					$current_theme = wp_get_theme();

					// Now check the theme: user defined slug can be either template
					// (parent theme) or stylesheet (currently active theme).
					foreach ( $theme as $slug => $required_version ) {
						if (
							( $current_theme->get_template() === $slug ||
							  $current_theme->get_stylesheet() === $slug ) &&
							version_compare( $current_theme->get( 'Version' ), $required_version, $this->version_compare_operator )
						) {
							$result[ $type ][ $slug ] = true;
						} else {
							$result[ $type ][ $slug ] = false;
						}

						$required[ $type ][ $slug ] = $required_version;
					}

					break;
			}
		}

		$this->results['wordpress']  = $result;
		$this->required['wordpress'] = $required;
	}
protected function validate_wordpress( $wordpress ) {
		global $wp_version;

		$result = $required = array();

		foreach ( $wordpress as $type => $data ) {
			switch ( $type ) {
				case 'version':
					$result[ $type ]   = version_compare( $wp_version, $data, '>=' );
					$required[ $type ] = $data;
					break;

				case 'plugins':
					if ( ! function_exists( 'is_plugin_active' ) ) {
						/* @noinspection PhpIncludeInspection */
						include_once ABSPATH . 'wp-admin/includes/plugin.php';
					}

					foreach ( (array) $data as $plugin => $required_version ) {
						if ( $plugin && is_string( $plugin ) ) {
							$required[ $type ][ $plugin ] = $required_version;

							$is_plugin_active = is_plugin_active( $plugin );

							if ( is_bool( $required_version ) ) {

								/**
								 * When the required version is specified
								 * as a Boolean (`true` or `false`),
								 * then we do not need to check the version number,
								 * just active or not.
								 */
								$result[ $type ][ $plugin ] =
									( $is_plugin_active === $required_version );

							} else {

								/**
								 * Check that the plugin is active and
								 * that its version matches the requirements.
								 */

								$raw_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin,
									false, false
								);

								// If the plugin does not have a version (?!) then
								// we consider the version is OK.
								$is_plugin_version_ok = (
									! isset( $raw_data['Version'] ) ||
									version_compare(
										$raw_data['Version'],
										$required_version,
										$this->version_compare_operator
									)
								);

								$result[ $type ][ $plugin ] = $is_plugin_active && $is_plugin_version_ok;
							}
						}
					}

					break;

				case 'theme':
					$theme = (array) $data;

					$current_theme = wp_get_theme();

					// Now check the theme: user defined slug can be either template
					// (parent theme) or stylesheet (currently active theme).
					foreach ( $theme as $slug => $required_version ) {
						if (
							( $current_theme->get_template() === $slug ||
							  $current_theme->get_stylesheet() === $slug ) &&
							version_compare( $current_theme->get( 'Version' ), $required_version, $this->version_compare_operator )
						) {
							$result[ $type ][ $slug ] = true;
						} else {
							$result[ $type ][ $slug ] = false;
						}

						$required[ $type ][ $slug ] = $required_version;
					}

					break;
			}
		}

		$this->results['wordpress']  = $result;
		$this->required['wordpress'] = $required;
	}
protected function validate_wordpress ( $ wordpress ) { global $ wp_version ; $ result = $ required = array ( ) ; foreach ( $ wordpress as $ type => $ data ) { switch ( $ type ) { case 'version' : $ result [ $ type ] = version_compare ( $ wp_version , $ data , '>=' ) ; $ required [ $ type ] = $ data ; break ; case 'plugins' : if ( ! function_exists ( 'is_plugin_active' ) ) { /* @noinspection PhpIncludeInspection */ include_once ABSPATH . 'wp-admin/includes/plugin.php' ; } foreach ( ( array ) $ data as $ plugin => $ required_version ) { if ( $ plugin && is_string ( $ plugin ) ) { $ required [ $ type ] [ $ plugin ] = $ required_version ; $ is_plugin_active = is_plugin_active ( $ plugin ) ; if ( is_bool ( $ required_version ) ) { /**
								 * When the required version is specified
								 * as a Boolean (`true` or `false`),
								 * then we do not need to check the version number,
								 * just active or not.
								 */ $ result [ $ type ] [ $ plugin ] = ( $ is_plugin_active === $ required_version ) ; } else { /**
								 * Check that the plugin is active and
								 * that its version matches the requirements.
								 */ $ raw_data = get_plugin_data ( WP_PLUGIN_DIR . '/' . $ plugin , false , false ) ; // If the plugin does not have a version (?!) then // we consider the version is OK. $ is_plugin_version_ok = ( ! isset ( $ raw_data [ 'Version' ] ) || version_compare ( $ raw_data [ 'Version' ] , $ required_version , $ this -> version_compare_operator ) ) ; $ result [ $ type ] [ $ plugin ] = $ is_plugin_active && $ is_plugin_version_ok ; } } } break ; case 'theme' : $ theme = ( array ) $ data ; $ current_theme = wp_get_theme ( ) ; // Now check the theme: user defined slug can be either template // (parent theme) or stylesheet (currently active theme). foreach ( $ theme as $ slug => $ required_version ) { if ( ( $ current_theme -> get_template ( ) === $ slug || $ current_theme -> get_stylesheet ( ) === $ slug ) && version_compare ( $ current_theme -> get ( 'Version' ) , $ required_version , $ this -> version_compare_operator ) ) { $ result [ $ type ] [ $ slug ] = true ; } else { $ result [ $ type ] [ $ slug ] = false ; } $ required [ $ type ] [ $ slug ] = $ required_version ; } break ; } } $ this -> results [ 'wordpress' ] = $ result ; $ this -> required [ 'wordpress' ] = $ required ; }
Check all WordPress related data, like version, plugins and theme

@param array $wordpress WordPress requirements.
Check all WordPress related data like version plugins and theme