-
Notifications
You must be signed in to change notification settings - Fork 0
/
bp-checkins-enhanced-admin-tab.php
214 lines (204 loc) · 13.9 KB
/
bp-checkins-enhanced-admin-tab.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
//$checkins_enhanced_activated = (int)bp_get_option( 'bp-checkins-enhanced-activate-component' );
function bp_checkins_enhanced_admin_tabs( $tabs, $admin_page ) {
if(!empty($tabs) && is_array($tabs)){
$href = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-checkins-admin' , 'tab' => 'enhanced'), $admin_page ) );
$tabs[] = array( 'href' => $href, 'name' => __( 'BP Checkins Enhanced', 'bp-checkins-enhanced' ) );
}
return $tabs;
}
add_filter('bp_checkins_admin_tabs','bp_checkins_enhanced_admin_tabs', 10, 2);
function bp_checkins_enhanced_set_active_tab($active, $tab){
if( !empty( $tab ) && $tab == 'enhanced' )
$active = __( 'BP Checkins Enhanced', 'bp-checkins-enhanced' );
return $active;
}
add_filter('bp_checkins_admin_tabs', 'bp_checkins_enhanced_set_active_tab', 10, 2);
function bp_checkins_enhanced_settings_admin( $tab, $admin_page ){
global $bp_checkins_logs_slug;
$buddy_settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
?>
<?php if( $tab == 'enhanced' ):?>
<?php if( !(int)bp_get_option( 'bp-checkins-activate-component' ) || '' == bp_get_option( 'bp-checkins-activate-component' ) ):?>
<p>
<?php printf( __('If you want to use this feature, you need to activate the Checkins and Places component, to do so use <a href="%s">the appropriate tab</a>', 'bp-checkins'), bp_get_admin_url( add_query_arg( array( 'page' => 'bp-checkins-admin', 'tab' => 'component' ), $admin_page ) ) );?>
</p>
<?php elseif( !(int)bp_get_option( 'bp-checkins-enhanced-activate-component' ) || '' == bp_get_option( 'bp-checkins-enhanced-activate-component' ) ):?>
<input type="hidden" name="bpci-admin[bp-checkins-enhanced-activate-component]" value="1">
<p>
<?php _e('If you want to activate this component, simply click on the 'Save Settings' button, then you will be able to edit its behavior', 'bp-checkins');?>
</p>
<?php else:?>
<h3><?php _e('BP Checkins Enhanced Component', 'bp-checkins');?></h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php _e( 'Places and Events post type and rewrite enabled', 'bp-checkins-enhanced' ) ?></th>
<td>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-places-events]"<?php if ( (int)bp_get_option( 'bp-checkins-enhanced-places-events' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-places-events-yes" value="1" /> <?php _e( 'Yes', 'bp-checkins' ) ?>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-places-events]"<?php if ( !(int)bp_get_option( 'bp-checkins-enhanced-places-events' ) || '' == bp_get_option( 'bp-checkins-enhanced-places-events' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-places-events-no" value="0" /> <?php _e( 'No', 'bp-checkins' ) ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Event Calendar Widget', 'bp-checkins-enhanced' ) ?></th>
<td>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-event-calendar]"<?php if ( (int)bp_get_option( 'bp-checkins-enhanced-event-calendar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-event-calendar-yes" value="1" /> <?php _e( 'Yes', 'bp-checkins' ) ?>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-event-calendar]"<?php if ( !(int)bp_get_option( 'bp-checkins-enhanced-event-calendar' ) || '' == bp_get_option( 'bp-checkins-enhanced-event-calendar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-event-calendar-no" value="0" /> <?php _e( 'No', 'bp-checkins' ) ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Ajax Registration Form', 'bp-checkins-enhanced' ) ?></th>
<td>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-ajax-registration]"<?php if ( (int)bp_get_option( 'bp-checkins-enhanced-ajax-registration' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-ajax-registration-yes" value="1" /> <?php _e( 'Yes', 'bp-checkins' ) ?>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-ajax-registration]"<?php if ( !(int)bp_get_option( 'bp-checkins-enhanced-ajax-registration' ) || '' == bp_get_option( 'bp-checkins-enhanced-ajax-registration' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-ajax-registration-no" value="0" /> <?php _e( 'No', 'bp-checkins' ) ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Map Type', 'bp-checkins-enhanced' ) ?> (n/a)</th>
<td>
<select name="bpci-admin[bp-checkins-enhanced-maptype]" id="bp-checkins-enhanced-maptype">
<option value="<?php _e('ROADMAP', 'bp-checkins-enhanced');?>" <?php selected( bp_get_option( 'bp-checkins-enhanced-maptype' ), 'ROADMAP' );?>><?php _e('ROADMAP', 'bp-checkins-enhanced');?></option>
<option value="<?php _e('SATELLITE', 'bp-checkins-enhanced');?>" <?php selected( bp_get_option( 'bp-checkins-enhanced-maptype' ), 'SATELLITE' );?>><?php _e('SATELLITE', 'bp-checkins-enhanced');?></option>
<option value="<?php _e('TERRAIN', 'bp-checkins-enhanced');?>" <?php selected( bp_get_option( 'bp-checkins-enhanced-maptype' ), 'TERRAIN' );?>><?php _e('TERRAIN', 'bp-checkins-enhanced');?></option>
<option value="<?php _e('HYBRID', 'bp-checkins-enhanced');?>" <?php selected( bp_get_option( 'bp-checkins-enhanced-maptype' ), 'HYBRID' );?>><?php _e('HYBRID', 'bp-checkins-enhanced');?></option>
</select>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Clustering', 'bp-checkins' ) ?> (n/a)</th>
<td>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-clustering]"<?php if ( (int)bp_get_option( 'bp-checkins-enhanced-clustering' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-clustering-yes" value="1" /> <?php _e( 'Yes', 'bp-checkins' ) ?>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-clustering]"<?php if ( !(int)bp_get_option( 'bp-checkins-enhanced-clustering' ) || '' == bp_get_option( 'bp-checkins-enhanced-clustering' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-clustering-no" value="0" /> <?php _e( 'No', 'bp-checkins' ) ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Markers', 'bp-checkins' ) ?> (n/a)</th>
<td>
<input type="text" name="bpci-admin[bp-checkins-enhanced-default-pin]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-default-pin' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-default-pin' ) .'"';
} else {
echo 'value="'.dirname( __FILE__ ) . '/images/pin.png"';
}
?>
id="bp-checkins-enhanced-default-pin"/> <?php _e( 'Default Pin', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-black-pin]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-black-pin' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-black-pin' ) .'"';
} else {
echo 'value="'.dirname( __FILE__ ) . '/images/blackpin.png"';
}
?>
id="bp-checkins-enhanced-black-pin"/> <?php _e( 'Current Pin', 'bp-checkins-enhanced' );?><br />
<?php if( (int)bp_get_option( 'bp-checkins-enhanced-clustering' ) && '' != bp_get_option( 'bp-checkins-enhanced-clustering' ) ):?>
<input type="text" size="5" name="bpci-admin[bp-checkins-enhanced-cluster-radius]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-radius' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-radius' ) .'"';
} else {
echo 'value="50"';
}
?>
id="bp-checkins-enhanced-place-cluster-radius"/> <?php _e( 'Cluster Radius', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-cluster-1-pin]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-1-pin' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-1-pin' ) .'"';
} else {
echo 'value="'.dirname( __FILE__ ) . '/images/cluster-1.png"';
}
?>
id="bp-checkins-enhanced-place-cluster-1-pin"/> <?php _e( 'Cluster 1', 'bp-checkins-enhanced' );?>
<input type="text" size="4" name="bpci-admin[bp-checkins-enhanced-cluster-1-size]" id="bp-checkins-enhanced-place-cluster-1-size"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-1-size' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-1-size' ) .'"';
} else {
echo 'value="0"';
}
?>/> <?php _e( 'size', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-cluster-2-pin]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-2-pin' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-2-pin' ) .'"';
} else {
echo 'value="'.dirname( __FILE__ ) . '/images/cluster-2.png"';
}
?>
id="bp-checkins-enhanced-place-cluster-2-pin"/> <?php _e( 'Cluster 2', 'bp-checkins-enhanced' );?>
<input type="text" size="4" name="bpci-admin[bp-checkins-enhanced-cluster-2-size]" id="bp-checkins-enhanced-place-cluster-2-size"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-2-size' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-2-size' ) .'"';
} else {
echo 'value="5"';
}
?>/> <?php _e( 'size', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-cluster-3-pin]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-3-pin' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-3-pin' ) .'"';
} else {
echo 'value="'.dirname( __FILE__ ) . '/images/cluster-3.png"';
}
?>
id="bp-checkins-enhanced-place-cluster-3-pin"/> <?php _e( 'Cluster 3', 'bp-checkins-enhanced' );?>
<input type="text" size="4" name="bpci-admin[bp-checkins-enhanced-cluster-3-size]" id="bp-checkins-enhanced-place-cluster-3-size"
<?php if ( bp_get_option( 'bp-checkins-enhanced-cluster-3-size' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-cluster-3-size' ) .'"';
} else {
echo 'value="10"';
}
?>/> <?php _e( 'size', 'bp-checkins-enhanced' );?><br />
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Infowindow', 'bp-checkins-enhanced' ) ?> (n/a)</th>
<td>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-infowindow]"<?php if ( (int)bp_get_option( 'bp-checkins-enhanced-infowindow' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-infowindow-yes" value="1" /> <?php _e( 'Yes', 'bp-checkins' ) ?>
<input type="radio" name="bpci-admin[bp-checkins-enhanced-infowindow]"<?php if ( !(int)bp_get_option( 'bp-checkins-enhanced-infowindow' ) || '' == bp_get_option( 'bp-checkins-enhanced-infowindow' ) ) : ?> checked="checked"<?php endif; ?> id="bp-checkins-enhanced-infowindow-no" value="0" /> <?php _e( 'No', 'bp-checkins' ) ?>
</td>
</tr>
<?php if( (int)bp_get_option( 'bp-checkins-enhanced-places-events' ) && '' != bp_get_option( 'bp-checkins-enhanced-places-events' ) ):?>
<tr>
<th scope="row"><?php _e( 'DOM Selectors', 'bp-checkins-enhanced' );?></th>
<td>
<input type="text" name="bpci-admin[bp-checkins-enhanced-place-post-selector]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-post-selector' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-post-selector' ) .'"';
} else {
echo 'value=".blog-post"';
}
?>
id="bp-checkins-enhanced-place-post-selector"/> <?php _e( 'Place post container', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-place-title-selector]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-title-selector' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-title-selector' ) .'"';
} else {
echo 'value=".post-title"';
}
?>
id="bp-checkins-enhanced-place-title-selector"/> <?php _e( 'Place title container', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-place-thumb-selector]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-thumb-selector' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-thumb-selector' ) .'"';
} else {
echo 'value=".thumbnail"';
}
?>
id="bp-checkins-enhanced-place-thumb-selector"/> <?php _e( 'Place thumbnail container', 'bp-checkins-enhanced' );?><br />
<input type="text" name="bpci-admin[bp-checkins-enhanced-place-text-selector]"
<?php if ( bp_get_option( 'bp-checkins-enhanced-place-text-selector' ) ){
echo 'value="'. bp_get_option( 'bp-checkins-enhanced-place-text-selector' ) .'"';
} else {
echo 'value=".text"';
}
?>
id="bp-checkins-enhanced-place-text-selector"/> <?php _e( 'Place text container', 'bp-checkins-enhanced' );?><br />
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?>
<?php endif; ?>
<?php
}
add_action('bp_checkins_admin_screen_tab', 'bp_checkins_enhanced_settings_admin', 10, 2);