PluginProbe
Private groups / trunk
Private groups vtrunk
trunk 1.5 1.6 1.7 1.8 1.8.1 1.9.1 1.9.2 2.0 2.0.1 2.2 2.3 2.4 2.5 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 116 releases
bbp-private-groups / includes / plugin-info.php

plugin-info.php in Private groups trunk, at includes/plugin-info.php

394 lines 9.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function pg_plugin_info() {
3 //get the info (thanks Pascal for this code !)
4
5 $sysinfo = array();
6
7 // wp version
8 $newarray = array ( 'WP version' => get_bloginfo('version') );
9 $sysinfo = array_merge($sysinfo, $newarray);
10
11 // theme
12 $mytheme = wp_get_theme();
13 $newarray = array ( 'Theme' => $mytheme["Name"].' '.$mytheme["Version"] );
14 $sysinfo = array_merge($sysinfo, $newarray);
15
16 // PHP version
17 $newarray = array ( 'PHP version' => phpversion() );
18 $sysinfo = array_merge($sysinfo, $newarray);
19
20 // bbpress version
21 if (function_exists('bbPress')) {
22 $bbp = bbpress();
23 } else {
24 global $bbp;
25 }
26 if (isset($bbp->version)) {
27 $bbpversion = $bbp->version;
28 } else {
29 $bbpversion = '???';
30 }
31 $newarray = array ( 'bbPress version' => $bbpversion );
32 $sysinfo = array_merge($sysinfo, $newarray);
33
34 // site url
35 $newarray = array ( 'site url' => get_bloginfo('url') );
36 $sysinfo = array_merge($sysinfo, $newarray);
37
38 // Active plugins
39 $newarray = array ( 'Active Plugins' => 'Name and Version' );
40 $sysinfo = array_merge($sysinfo, $newarray);
41 $plugins=get_plugins();
42 $activated_plugins=array();
43 $i = 1;
44 foreach (get_option('active_plugins') as $p){
45 if(isset($plugins[$p])){
46 $linetoadd = $plugins[$p]["Name"] . ' ' . $plugins[$p]["Version"] . '<br>';
47 $newarray = array ( '- p'.$i => $linetoadd );
48 $sysinfo = array_merge($sysinfo, $newarray);
49 $i = $i + 1;
50 }
51 }
52
53
54 //start output
55 global $rpg_settingsf ;
56 global $rpg_settingsg ;
57 global $rpg_groups ;
58 global $rpg_disable_groups ;
59 global $rpg_topic_permissions ;
60 echo '<h3>'; _e('Plugin Information', 'bbp-private-groups'); echo'</h3>';
61 echo '<table >';
62 array_walk($sysinfo, 'rpg_list_1') ;
63 ?>
64 <tr>
65 </tr>
66 <tr>
67 <th>
68 <?php echo 'Forum Visibility Settings' ?>
69 </th>
70 </tr>
71 <tr>
72 <td>
73 <?php echo 'Visibility Activated :' ?>
74 </td>
75 <td>
76 <?php $item = (!empty($rpg_settingsf['set_forum_visibility'] ) ? 'true' : 'false');
77 echo $item ; ?>
78 </td>
79 </tr>
80
81 <tr>
82 <td>
83 <?php echo 'URL of redirect page for LOGGED-IN user :' ?>
84 </td>
85 <td>
86 <?php $item = (!empty($rpg_settingsf['redirect_page1'] ) ? $rpg_settingsf['redirect_page1'] : '');
87 echo $item ; ?>
88 </td>
89 </tr>
90
91 <tr>
92 <td>
93 <?php echo 'URL of redirect page for NON-LOGGED-IN user:' ?>
94 </td>
95 <td>
96 <?php $item = (!empty($rpg_settingsf['redirect_page2'] ) ? $rpg_settingsf['redirect_page2'] : '');
97 echo $item ; ?>
98 </td>
99 </tr>
100
101
102
103 <tr>
104 <td>
105 <?php echo 'Freshness Settings Activated :' ?>
106 </td>
107 <td>
108 <?php $item = (!empty($rpg_settingsf['set_freshness_message'] ) ? 'true' : 'false');
109 echo $item ; ?>
110 </td>
111 </tr>
112
113 <tr>
114 <td>
115 <?php echo 'Freshness Message :' ?>
116 </td>
117 <td>
118 <?php $item = (!empty($rpg_settingsf['freshness_message'] ) ? $rpg_settingsf['freshness_message'] : '');
119 echo $item ; ?>
120 </td>
121 </tr>
122
123 <tr>
124 </tr>
125 <tr>
126 <th>
127 <?php echo 'General Settings' ?>
128 </th>
129 </tr>
130
131 <tr>
132 <td>
133 <?php echo 'Hide topic and reply counts :' ?>
134 </td>
135 <td>
136 <?php $item = (!empty($rpg_settingsg['hide_counts'] ) ? 'true' : 'false');
137 echo $item ; ?>
138 </td>
139 </tr>
140
141
142 <tr>
143 <td>
144 <?php echo 'List Sub-forums in column :' ?>
145 </td>
146 <td>
147 <?php $item = (!empty($rpg_settingsg['list_sub_forums_as_column'] ) ? 'true' : 'false');
148 echo $item ; ?>
149 </td>
150 </tr>
151
152 <tr>
153 <td>
154 <?php echo 'Show sub-forum content (Descriptions) :' ?>
155 </td>
156 <td>
157 <?php $item = (!empty($rpg_settingsg['activate_descriptions']) ? 'true' : 'false');
158 echo $item ; ?>
159 </td>
160 </tr>
161
162 <tr>
163 <td>
164 <?php echo 'Remove Private prefix :' ?>
165 </td>
166 <td>
167 <?php $item = (!empty($rpg_settingsg['activate_remove_private_prefix'] ) ? 'true' : 'false');
168 echo $item ; ?>
169 </td>
170 </tr>
171
172 <tr>
173 </tr>
174 <tr>
175 <th>
176 <?php echo 'Topic Permissions' ?>
177 </th>
178 </tr>
179
180 <tr>
181 <td>
182 <?php echo 'Topic Permissions activated :' ?>
183 </td>
184 <td>
185 <?php $item = (!empty($rpg_topic_permissions ) ? 'true' : 'false');
186 echo $item ; ?>
187 </td>
188 </tr>
189
190 <tr>
191 </tr>
192 </table>
193 <table>
194 <tr>
195 <th>
196 <?php echo 'Groups' ?>
197 </th>
198 </tr>
199 <tr>
200 <td><b>Group</b></td>
201 <td><b>Name</b></td>
202 <td><b>No users in this group</b></td>
203 <td><b>Forums in this group</b></td>
204 </tr>
205 <tr>
206
207 <?php
208 $count=count ($rpg_groups) ;
209 for ($i = 0 ; $i < $count ; ++$i) {
210 $g=$i+1 ;
211 $display=__( 'Group', 'bbp-private-groups' ).$g ;
212 $name="group".$g ;
213 $item="rpg_groups[".$name."]" ;
214
215 ?>
216 <!------------------------- Group --------------------------------------------->
217
218 <td valign="top">
219 <?php echo $display ;
220 if (!empty($rpg_disable_groups[$name])) {
221 echo ' <i>' ;
222 _e('Disabled', 'bbp-private-groups') ;
223 echo '</i>' ;
224 }
225 ?>
226 </td>
227
228 <td valign="top">
229 <?php echo esc_html( $rpg_groups[$name] ) ; ?>
230 </td>
231
232 <td valign="top">
233 <?php
234 global $wpdb;
235 $users=$wpdb->get_col("select ID from $wpdb->users") ;
236 $countu=0 ;
237 foreach ($users as $user) {
238
239 $check= get_user_meta( $user, 'private_group',true);
240 //single user check
241 if ($check==$name) $countu++ ;
242 //multiple group set
243 if (strpos($check, '*'.$name.'*') !== FALSE) $countu++;
244 }
245 echo $countu ;
246 ?>
247 </td>
248
249
250 <td>
251 <?php
252 echo '<i>' ;
253 $forum = bbp_get_forum_post_type() ;
254 $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ;
255 $countu=0 ;
256
257 foreach ($forums as $forum) {
258 $meta = (array)get_post_meta( $forum, '_private_group', false );
259 foreach ($meta as $meta2) {
260 if ($meta2==$name) {
261 $ftitle=bbp_forum_title($forum) ;
262 echo $ftitle.'<br>' ;
263 $countu++ ;
264 }
265 }
266
267 }
268 echo '</i></td></tr>' ;
269 ?>
270 <!------------------------- FORUMS --------------------------------------------->
271 <?php }
272 ?>
273 </table><table>
274 <tr>
275 </tr>
276
277 <tr>
278 <th>
279 <?php echo 'Forums' ?>
280 </th>
281 <th style="width:200px">
282 <?php echo 'Groups' ?>
283 </th>
284 <?php if (!empty ($rpg_topic_permissions) ) echo '<th>Topic Permissions</th>' ; ?>
285 </tr>
286
287 <?php if ( bbp_has_forums() ) :
288
289 while ( bbp_forums() ) : bbp_the_forum();
290 ?>
291 <tr>
292 <td style="vertical-align:top">
293 <?php bbp_forum_title() ; ?>
294 </td>
295
296 <td>
297 <?php
298 $id = get_the_ID () ;
299 $meta = get_post_meta( $id, '_private_group', false );
300 foreach ( $rpg_groups as $group => $details ) {
301 if ( is_array( $meta ) && in_array( $group, $meta ) ) {
302 $groupname=__('Group','bbp-private-groups').substr($group,5,strlen($group)) ;
303 $tp = '_private_group_'.$group ;
304 $perm = get_post_meta($id, $tp, true) ;
305 $value = (!empty ($perm ) ? $perm : '4' );
306
307 $valuename1 = __('Only View Topics/Replies', 'bbp-private-groups') ;
308 $valuename2 = __('Create/Edit Topics (and view all topics/replies)', 'bbp-private-groups') ;
309 $valuename3 = __('Create/Edit Replies (and view all topics/replies)', 'bbp-private-groups') ;
310 $valuename4 = __('Create/Edit Topics and Replies (and view all topics/replies)', 'bbp-private-groups') ;
311 $valuename5 = __('Create/Edit/view OWN Topics, create/edit Replies to those topics and view any Replies to those topics', 'bbp-private-groups') ;
312 $valuex = 'valuename'.$value ;
313 $valuename = $$valuex ;
314 echo $groupname.' '.$details ;
315 if (!empty ($rpg_topic_permissions) ) echo '<td>'.$valuename.'</td>' ;
316 echo '</td></tr><tr><td></td><td>';
317 } // end of if is in array $meta
318 } // end of foreach $rpg groups
319 //now display non logged in users
320 $valuename0 = __('No visibility or access to this forum', 'bbp-private-groups') ;
321 if (bbp_allow_anonymous()) {
322
323 $desc = __('Non-logged in & Anonymous Users', 'bbp-private-groups');
324 }
325 else {
326 $desc = __('Non-logged in users', 'bbp-private-groups');
327 }
328 echo '<tr><td></td><td>' ;
329 echo $desc ;
330 echo '</td><td>' ;
331 $perm = get_post_meta($id ,'_private_group_nonloggedin', true) ;
332 $value = (!empty ($perm ) ? $perm : '0' );
333 $valuex = 'valuename'.$value ;
334 $valuename = $$valuex ;
335 echo $valuename ;
336 ?>
337 </td>
338 </tr>
339
340
341 <?php
342 $sub_forums = bbp_forum_get_subforums() ;
343 if (!empty ($sub_forums) ) {
344 foreach ( $sub_forums as $sub_forum ) {
345 $id = $sub_forum->ID ;
346 $title = bbp_get_forum_title( $sub_forum->ID );
347 echo '<tr><td style="vertical-align:top"><i>'.$title.'</i></td><td>' ; ?>
348 <?php global $rpg_topic_permissions ;
349 $meta = get_post_meta( $sub_forum->ID, '_private_group', false );
350 foreach ( $rpg_groups as $group => $details ) {
351 if ( is_array( $meta ) && in_array( $group, $meta ) ) {
352 $groupname=__('Group','bbp-private-groups').substr($group,5,strlen($group)) ;
353 $tp = '_private_group_'.$group ;
354 $perm = get_post_meta($id, $tp, true) ;
355 $value = (!empty ($perm ) ? $perm : '4' );
356 $valuename1 = __('Only View Topics/Replies', 'bbp-private-groups') ;
357 $valuename2 = __('Create/Edit Topics (and view all topics/replies)', 'bbp-private-groups') ;
358 $valuename3 = __('Create/Edit Replies (and view all topics/replies)', 'bbp-private-groups') ;
359 $valuename4 = __('Create/Edit Topics and Replies (and view all topics/replies)', 'bbp-private-groups') ;
360 $valuename5 = __('Create/Edit/view OWN Topics, create/edit Replies to those topics and view any Replies to those topics', 'bbp-private-groups') ;
361 $valuex = 'valuename'.$value ;
362 $valuename = $$valuex ;
363 echo $groupname.' '.$details ;
364 if (!empty ($rpg_topic_permissions) ) echo '<td>'.$valuename.'</td>' ;
365 echo '</td></tr><tr><td></td><td>';
366 } // end of if is in array $meta
367 } // end of foreach $rpg groups
368 ?>
369 </td>
370 </tr>
371 <?php
372
373 } //end of foreach sub forums
374 } //end of !empty sub forums
375 ?>
376
377
378
379
380
381 <?php
382 endwhile;
383
384 endif;
385
386 echo '</table>';
387
388 }
389
390 function rpg_list_1 ($item1, $key) {
391 echo '<tr><td>'.$key.'</td><td>'.$item1.'</td></tr>' ;
392
393 }
394 ?>