Plugin_Helpers.php
2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Wpo\Core;
use \Wpo\Core\Extensions_Helpers;
use \Wpo\Services\Options_Service;
// Prevent public access to this script
defined( 'ABSPATH' ) or die();
if ( !class_exists( '\Wpo\Core\Plugin_Helpers' ) ) {
class Plugin_Helpers {
/**
* Helper to check if a premium WPO365 plugin edition is active.
*/
public static function is_premium_edition_active( $slug = null ) {
if ( empty( $slug ) ) {
$extensions = Extensions_Helpers::get_extensions();
foreach ( $extensions as $slug => $extension ) {
if ( true === $extension[ 'activated' ] ) {
return true;
}
}
return false;
}
if ( false === function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return \is_plugin_active( $slug );
}
/**
* WPMU aware wp filter extension to show the action link on the plugins page. Will add
* the wpo365 configuration action link depending on the WPMU configuration
*
* @since 7.3
*
* @param Array $links The current action link collection
*
* @return Array The new action link collection
*/
public static function get_configuration_action_link( $links ) {
// Don't show the configuration link for subsite admin if subsite options shouldn't be used
if ( is_multisite() && !is_network_admin() && false === Options_Service::mu_use_subsite_options() )
return $links;
$wizard_link = '<a href="admin.php?page=wpo365-wizard">' . __( 'Configuration', 'wpo365-login' ) . '</a>';
array_push( $links, $wizard_link );
return $links;
}
}
}