Skip to content
Snippets Groups Projects
Commit 0285590d authored by Krzysiek's avatar Krzysiek
Browse files

Is active plugin checker adjusted to multisite

parent 1eb5b19a
No related branches found
No related tags found
1 merge request!1Devel 1.10 - Wymagana wersja PHP i Wordpress
......@@ -251,7 +251,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return bool
*/
private function is_setting_set( $name, $value ) {
public static function is_setting_set( $name, $value ) {
return ini_get( $name ) === strval( $value );
}
......@@ -260,7 +260,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return bool
*/
private function is_module_active( $name ) {
public static function is_module_active( $name ) {
return extension_loaded( $name );
}
......@@ -308,7 +308,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return mixed
*/
private function is_php_at_least( $min_version ) {
public static function is_php_at_least( $min_version ) {
return version_compare( phpversion(), $min_version, '>=' );
}
......@@ -317,19 +317,25 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return bool
*/
private function is_wp_at_least( $min_version ) {
public static function is_wp_at_least( $min_version ) {
return version_compare( get_bloginfo( 'version' ), $min_version, '>=' );
}
/**
* Checks if plugin is active. Needs to be enabled in deferred way.
*
* @param string $plugin_name
* @param string $plugin_file
*
* @return bool
*/
private function is_wp_plugin_active( $plugin_name ) {
return in_array( $plugin_name, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
public static function is_wp_plugin_active( $plugin_file ) {
$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
}
return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
}
/**
......@@ -339,7 +345,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return bool
*/
private function is_wc_at_least( $min_version ) {
public static function is_wc_at_least( $min_version ) {
return defined(WC_VERSION) &&
version_compare( WC_VERSION, $min_version, '>=' );
}
......
......@@ -5,14 +5,13 @@ if ( ! defined( 'ABSPATH' ) ) {
} // Exit if accessed directly
if ( ! function_exists( 'wpdesk_is_plugin_active' ) ) {
/**
* @param $plugin_file
*
* @return bool
* @deprecated 1.10 Use requirement class
*/
function wpdesk_is_plugin_active( $plugin_file ) {
$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
}
return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
return WPDesk_Requirement_Checker_1_10::is_wp_plugin_active($plugin_file);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment