Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin-template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
Library
plugin-template
Commits
0285590d
Commit
0285590d
authored
7 years ago
by
Krzysiek
Browse files
Options
Downloads
Patches
Plain Diff
Is active plugin checker adjusted to multisite
parent
1eb5b19a
No related branches found
No related tags found
1 merge request
!1
Devel 1.10 - Wymagana wersja PHP i Wordpress
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/wpdesk/class-requirement-checker.php
+14
-8
14 additions, 8 deletions
classes/wpdesk/class-requirement-checker.php
classes/wpdesk/functions.php
+7
-8
7 additions, 8 deletions
classes/wpdesk/functions.php
with
21 additions
and
16 deletions
classes/wpdesk/class-requirement-checker.php
+
14
−
8
View file @
0285590d
...
...
@@ -251,7 +251,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return bool
*/
p
rivate
function
is_setting_set
(
$name
,
$value
)
{
p
ublic
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
*/
p
rivate
function
is_module_active
(
$name
)
{
p
ublic
static
function
is_module_active
(
$name
)
{
return
extension_loaded
(
$name
);
}
...
...
@@ -308,7 +308,7 @@ if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
*
* @return mixed
*/
p
rivate
function
is_php_at_least
(
$min_version
)
{
p
ublic
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
*/
p
rivate
function
is_wp_at_least
(
$min_version
)
{
p
ublic
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_
nam
e
* @param string $plugin_
fil
e
*
* @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
*/
p
rivate
function
is_wc_at_least
(
$min_version
)
{
p
ublic
static
function
is_wc_at_least
(
$min_version
)
{
return
defined
(
WC_VERSION
)
&&
version_compare
(
WC_VERSION
,
$min_version
,
'>='
);
}
...
...
This diff is collapsed.
Click to expand it.
classes/wpdesk/functions.php
+
7
−
8
View file @
0285590d
...
...
@@ -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
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment