-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependency.php
118 lines (102 loc) · 4.41 KB
/
dependency.php
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* Check if the class does not exits then only allow the file to add
*/
if( ! class_exists( 'buddypress' ) ) {
class AcrossWP_BuddyPress_Platform_Dependency extends AcrossWP_Plugins_Dependency {
/**
* Load this function on plugin load hook
* Example: _e('<strong>BuddyBoss Sorting Option In Network Search</strong></a> requires the BuddyPress plugin to work. Please <a href="https://wordpress.org/plugins/buddypress/" target="_blank">install BuddyPress</a> first.', 'sorting-option-in-network-search-for-buddyboss');
*/
function constant_not_define_text(){
printf(
__(
'<strong>%s</strong></a> requires the BuddyPress plugin to work. Please <a href="https://wordpress.org/plugins/buddypress/" target="_blank">install BuddyPress</a> first.',
'acrosswp'
),
$this->get_plugin_name()
);
}
/**
* Load this function on plugin load hook
* Example: printf( __('<strong>BuddyBoss Sorting Option In Network Search</strong></a> requires BuddyPress plugin version %s or higher to work. Please update BuddyPress.', 'sorting-option-in-network-search-for-buddyboss'), $this->mini_version() );
*/
function constant_mini_version_text() {
printf(
__(
'<strong>%s</strong></a> requires BuddyPress plugin version %s or higher to work. Please update BuddyPress.',
'acrosswp'
),
$this->get_plugin_name(),
$this->mini_version()
);
}
/**
* Load this function on plugin load hook
* Example: printf( __('<strong>BuddyBoss Sorting Option In Network Search</strong></a> requires BuddyPress plugin version %s or higher to work. Please update BuddyPress.', 'sorting-option-in-network-search-for-buddyboss'), $this->mini_version() );
*/
function component_required_text() {
$bb_components = bp_core_get_components();
$component_required = $this->component_required();
$active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
$component_required_label = array();
foreach( $bb_components as $key => $bb_component ) {
if( in_array( $key, $component_required ) ) {
$component_required_label[] = '<strong>' . $bb_component['title'] . '</strong>';
}
}
if( count( $component_required_label ) > 1 ) {
$last = array_pop( $component_required_label );
$component_required_label = implode( ', ', $component_required_label ) . ' and ' . $last;
} else {
$component_required_label = $component_required_label[0];
}
printf(
__(
'<strong>%s</strong></a> requires BuddyPress %s Component to work. Please Active the mentions Component.',
'acrosswp'
),
$this->get_plugin_name(),
$component_required_label
);
}
/**
* Load this function on plugin load hook
*/
function constant_name(){
return 'BP_VERSION';
}
/**
* Load this function on plugin load hook
*/
function mini_version(){
return '11.3.1';
}
/**
* Load this function on plugin load hook
*/
public function component_required() {
return array();
}
/**
* Check if the Required Component is Active
*/
public function required_component_is_active() {
$is_active = false;
$component_required = $this->component_required();
// Active components.
$active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
foreach( $component_required as $component_require ) {
if( isset( $active_components[ $component_require ] ) ) {
$is_active = true;
} else {
$is_active = false;
break;
}
}
return $is_active;
}
}
}