PluginProbe
bbPress / 2.0.1
bbPress v2.0.1
trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.2.2 All 71 releases
bbpress / bbp-admin / bbp-admin.php

bbp-admin.php in bbPress 2.0.1, at bbp-admin/bbp-admin.php

701 lines 23.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Main bbPress Admin Class
5 *
6 * @package bbPress
7 * @subpackage Administration
8 */
9
10 // Exit if accessed directly
11 if ( !defined( 'ABSPATH' ) ) exit;
12
13 if ( !class_exists( 'BBP_Admin' ) ) :
14 /**
15 * Loads bbPress plugin admin area
16 *
17 * @package bbPress
18 * @subpackage Administration
19 * @since bbPress (r2464)
20 */
21 class BBP_Admin {
22
23 /** Directory *************************************************************/
24
25 /**
26 * @var string Path to the bbPress admin directory
27 */
28 public $admin_dir = '';
29
30 /** URLs ******************************************************************/
31
32 /**
33 * @var string URL to the bbPress admin directory
34 */
35 public $admin_url = '';
36
37 /**
38 * @var string URL to the bbPress images directory
39 */
40 public $images_url = '';
41
42 /**
43 * @var string URL to the bbPress admin styles directory
44 */
45 public $styles_url = '';
46
47 /** Recounts **************************************************************/
48
49 /**
50 * @var bool Enable recounts in Tools area
51 */
52 public $enable_recounts = false;
53
54 /** Admin Scheme **********************************************************/
55
56 /**
57 * @var int Depth of custom WP_CONTENT_DIR difference
58 */
59 public $content_depth = 0;
60
61 /** Functions *************************************************************/
62
63 /**
64 * The main bbPress admin loader
65 *
66 * @since bbPress (r2515)
67 *
68 * @uses BBP_Admin::setup_globals() Setup the globals needed
69 * @uses BBP_Admin::includes() Include the required files
70 * @uses BBP_Admin::setup_actions() Setup the hooks and actions
71 */
72 public function __construct() {
73 $this->setup_globals();
74 $this->includes();
75 $this->setup_actions();
76 }
77
78 /**
79 * Setup the admin hooks, actions and filters
80 *
81 * @since bbPress (r2646)
82 * @access private
83 *
84 * @uses add_action() To add various actions
85 * @uses add_filter() To add various filters
86 */
87 private function setup_actions() {
88
89 /** General Actions ***************************************************/
90
91 // Attach the bbPress admin_init action to the WordPress admin_init action.
92 add_action( 'admin_init', array( $this, 'admin_init' ) );
93
94 // Add some general styling to the admin area
95 add_action( 'admin_head', array( $this, 'admin_head' ) );
96
97 // Add menu item to settings menu
98 add_action( 'admin_menu', array( $this, 'admin_menus' ) );
99
100 // Add notice if not using a bbPress theme
101 add_action( 'admin_notices', array( $this, 'activation_notice' ) );
102
103 // Add importers
104 add_action( 'bbp_admin_init', array( $this, 'register_importers' ) );
105
106 // Add green admin style
107 add_action( 'bbp_admin_init', array( $this, 'register_admin_style' ) );
108
109 // Add settings
110 add_action( 'bbp_admin_init', array( $this, 'register_admin_settings' ) );
111
112 // Forums 'Right now' Dashboard widget
113 add_action( 'wp_dashboard_setup', array( $this, 'dashboard_widget_right_now' ) );
114
115 /** Filters ***********************************************************/
116
117 // Add link to settings page
118 add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
119
120 // Add sample permalink filter
121 add_filter( 'post_type_link', 'bbp_filter_sample_permalink', 10, 4 );
122 }
123
124 /**
125 * Include required files
126 *
127 * @since bbPress (r2646)
128 * @access private
129 */
130 private function includes() {
131
132 // Include the files
133 require( $this->admin_dir . 'bbp-tools.php' );
134 require( $this->admin_dir . 'bbp-settings.php' );
135 require( $this->admin_dir . 'bbp-functions.php' );
136 require( $this->admin_dir . 'bbp-metaboxes.php' );
137 require( $this->admin_dir . 'bbp-forums.php' );
138 require( $this->admin_dir . 'bbp-topics.php' );
139 require( $this->admin_dir . 'bbp-replies.php' );
140 }
141
142 /**
143 * Admin globals
144 *
145 * @since bbPress (r2646)
146 * @access private
147 */
148 private function setup_globals() {
149 global $bbp;
150
151 // Admin url
152 $this->admin_dir = trailingslashit( $bbp->plugin_dir . 'bbp-admin' );
153
154 // Admin url
155 $this->admin_url = trailingslashit( $bbp->plugin_url . 'bbp-admin' );
156
157 // Admin images URL
158 $this->images_url = trailingslashit( $this->admin_url . 'images' );
159
160 // Admin images URL
161 $this->styles_url = trailingslashit( $this->admin_url . 'styles' );
162 }
163
164 /**
165 * Add the navigational menu elements
166 *
167 * @since bbPress (r2646)
168 *
169 * @uses add_management_page() To add the Recount page in Tools section
170 * @uses add_options_page() To add the Forums settings page in Settings
171 * section
172 */
173 public function admin_menus() {
174
175 // Recounts
176 if ( is_super_admin() || !empty( $this->enable_recounts ) )
177 add_management_page( __( 'Recount', 'bbpress' ), __( 'Recount', 'bbpress' ), 'manage_options', 'bbp-recount', 'bbp_admin_tools' );
178
179 // Forums settings
180 add_options_page ( __( 'Forums', 'bbpress' ), __( 'Forums', 'bbpress' ), 'manage_options', 'bbpress', 'bbp_admin_settings' );
181 }
182
183 /**
184 * Register the settings
185 *
186 * @since bbPress (r2737)
187 *
188 * @uses add_settings_section() To add our own settings section
189 * @uses add_settings_field() To add various settings fields
190 * @uses register_setting() To register various settings
191 * @uses do_action() Calls 'bbp_register_admin_settings'
192 */
193 public function register_admin_settings() {
194
195 /** Main Section ******************************************************/
196
197 // Add the main section
198 add_settings_section( 'bbp_main', __( 'Main Settings', 'bbpress' ), 'bbp_admin_setting_callback_main_section', 'bbpress' );
199
200 // Edit lock setting
201 add_settings_field( '_bbp_edit_lock', __( 'Lock post editing after', 'bbpress' ), 'bbp_admin_setting_callback_editlock', 'bbpress', 'bbp_main' );
202 register_setting ( 'bbpress', '_bbp_edit_lock', 'intval' );
203
204 // Throttle setting
205 add_settings_field( '_bbp_throttle_time', __( 'Throttle time', 'bbpress' ), 'bbp_admin_setting_callback_throttle', 'bbpress', 'bbp_main' );
206 register_setting ( 'bbpress', '_bbp_throttle_time', 'intval' );
207
208 // Allow topic and reply revisions
209 add_settings_field( '_bbp_allow_revisions', __( 'Allow Revisions', 'bbpress' ), 'bbp_admin_setting_callback_revisions', 'bbpress', 'bbp_main' );
210 register_setting ( 'bbpress', '_bbp_allow_revisions', 'intval' );
211
212 // Allow favorites setting
213 add_settings_field( '_bbp_enable_favorites', __( 'Allow Favorites', 'bbpress' ), 'bbp_admin_setting_callback_favorites', 'bbpress', 'bbp_main' );
214 register_setting ( 'bbpress', '_bbp_enable_favorites', 'intval' );
215
216 // Allow subscriptions setting
217 add_settings_field( '_bbp_enable_subscriptions', __( 'Allow Subscriptions', 'bbpress' ), 'bbp_admin_setting_callback_subscriptions', 'bbpress', 'bbp_main' );
218 register_setting ( 'bbpress', '_bbp_enable_subscriptions', 'intval' );
219
220 // Allow anonymous posting setting
221 add_settings_field( '_bbp_allow_anonymous', __( 'Allow Anonymous Posting', 'bbpress' ), 'bbp_admin_setting_callback_anonymous', 'bbpress', 'bbp_main' );
222 register_setting ( 'bbpress', '_bbp_allow_anonymous', 'intval' );
223
224 // Allow global access setting
225 if ( is_multisite() ) {
226 add_settings_field( '_bbp_allow_global_access', __( 'Allow Global Access', 'bbpress' ), 'bbp_admin_setting_callback_global_access', 'bbpress', 'bbp_main' );
227 register_setting ( 'bbpress', '_bbp_allow_global_access', 'intval' );
228 }
229
230 /** Per Page Section **************************************************/
231
232 // Add the per page section
233 add_settings_section( 'bbp_per_page', __( 'Per Page', 'bbpress' ), 'bbp_admin_setting_callback_per_page_section', 'bbpress' );
234
235 // Topics per page setting
236 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_page', 'bbpress', 'bbp_per_page' );
237 register_setting ( 'bbpress', '_bbp_topics_per_page', 'intval' );
238
239 // Replies per page setting
240 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_page', 'bbpress', 'bbp_per_page' );
241 register_setting ( 'bbpress', '_bbp_replies_per_page', 'intval' );
242
243 /** Per RSS Page Section **********************************************/
244
245 // Add the per page section
246 add_settings_section( 'bbp_per_rss_page', __( 'Per RSS Page', 'bbpress' ), 'bbp_admin_setting_callback_per_rss_page_section', 'bbpress' );
247
248 // Topics per page setting
249 add_settings_field( '_bbp_topics_per_page', __( 'Topics', 'bbpress' ), 'bbp_admin_setting_callback_topics_per_rss_page', 'bbpress', 'bbp_per_rss_page' );
250 register_setting ( 'bbpress', '_bbp_topics_per_rss_page', 'intval' );
251
252 // Replies per page setting
253 add_settings_field( '_bbp_replies_per_page', __( 'Replies', 'bbpress' ), 'bbp_admin_setting_callback_replies_per_rss_page', 'bbpress', 'bbp_per_rss_page' );
254 register_setting ( 'bbpress', '_bbp_replies_per_rss_page', 'intval' );
255
256 /** Front Slugs *******************************************************/
257
258 // Add the per page section
259 add_settings_section( 'bbp_root_slug', __( 'Archive Slugs', 'bbpress' ), 'bbp_admin_setting_callback_root_slug_section', 'bbpress' );
260
261 // Root slug setting
262 add_settings_field ( '_bbp_root_slug', __( 'Forums base', 'bbpress' ), 'bbp_admin_setting_callback_root_slug', 'bbpress', 'bbp_root_slug' );
263 register_setting ( 'bbpress', '_bbp_root_slug', 'esc_sql' );
264
265 // Topic archive setting
266 add_settings_field ( '_bbp_topic_archive_slug', __( 'Topics base', 'bbpress' ), 'bbp_admin_setting_callback_topic_archive_slug', 'bbpress', 'bbp_root_slug' );
267 register_setting ( 'bbpress', '_bbp_topic_archive_slug', 'esc_sql' );
268
269 /** Single slugs ******************************************************/
270
271 // Add the per page section
272 add_settings_section( 'bbp_single_slugs', __( 'Single Slugs', 'bbpress' ), 'bbp_admin_setting_callback_single_slug_section', 'bbpress' );
273
274 // Include root setting
275 add_settings_field( '_bbp_include_root', __( 'Forum Prefix', 'bbpress' ), 'bbp_admin_setting_callback_include_root', 'bbpress', 'bbp_single_slugs' );
276 register_setting ( 'bbpress', '_bbp_include_root', 'intval' );
277
278 // Forum slug setting
279 add_settings_field( '_bbp_forum_slug', __( 'Forum slug', 'bbpress' ), 'bbp_admin_setting_callback_forum_slug', 'bbpress', 'bbp_single_slugs' );
280 register_setting ( 'bbpress', '_bbp_forum_slug', 'sanitize_title' );
281
282 // Topic slug setting
283 add_settings_field( '_bbp_topic_slug', __( 'Topic slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_slug', 'bbpress', 'bbp_single_slugs' );
284 register_setting ( 'bbpress', '_bbp_topic_slug', 'sanitize_title' );
285
286 // Topic tag slug setting
287 add_settings_field( '_bbp_topic_tag_slug', __( 'Topic tag slug', 'bbpress' ), 'bbp_admin_setting_callback_topic_tag_slug', 'bbpress', 'bbp_single_slugs' );
288 register_setting ( 'bbpress', '_bbp_topic_tag_slug', 'sanitize_title' );
289
290 // Reply slug setting
291 add_settings_field( '_bbp_reply_slug', __( 'Reply slug', 'bbpress' ), 'bbp_admin_setting_callback_reply_slug', 'bbpress', 'bbp_single_slugs' );
292 register_setting ( 'bbpress', '_bbp_reply_slug', 'sanitize_title' );
293
294 /** Other slugs *******************************************************/
295
296 // User slug setting
297 add_settings_field( '_bbp_user_slug', __( 'User base', 'bbpress' ), 'bbp_admin_setting_callback_user_slug', 'bbpress', 'bbp_single_slugs' );
298 register_setting ( 'bbpress', '_bbp_user_slug', 'sanitize_title' );
299
300 // View slug setting
301 add_settings_field( '_bbp_view_slug', __( 'View base', 'bbpress' ), 'bbp_admin_setting_callback_view_slug', 'bbpress', 'bbp_single_slugs' );
302 register_setting ( 'bbpress', '_bbp_view_slug', 'sanitize_title' );
303
304 do_action( 'bbp_register_admin_settings' );
305 }
306
307 /**
308 * Register the importers
309 *
310 * @since bbPress (r2737)
311 *
312 * @uses do_action() Calls 'bbp_register_importers'
313 * @uses apply_filters() Calls 'bbp_importer_path' filter to allow plugins
314 * to customize the importer script locations.
315 */
316 public function register_importers() {
317
318 // Leave if we're not in the import section
319 if ( !defined( 'WP_LOAD_IMPORTERS' ) )
320 return;
321
322 // Load Importer API
323 require_once( ABSPATH . 'wp-admin/includes/import.php' );
324
325 // Load our importers
326 $importers = apply_filters( 'bbp_importers', array( 'bbpress' ) );
327
328 // Loop through included importers
329 foreach ( $importers as $importer ) {
330
331 // Allow custom importer directory
332 $import_dir = apply_filters( 'bbp_importer_path', $this->admin_dir . 'importers', $importer );
333
334 // Compile the importer path
335 $import_file = trailingslashit( $import_dir ) . $importer . '.php';
336
337 // If the file exists, include it
338 if ( file_exists( $import_file ) ) {
339 require( $import_file );
340 }
341 }
342
343 // Don't do anything we wouldn't do
344 do_action( 'bbp_register_importers' );
345 }
346
347 /**
348 * Admin area activation notice
349 *
350 * Shows a nag message in admin area about the theme not supporting bbPress
351 *
352 * @since bbPress (r2743)
353 *
354 * @global bbPress $bbp
355 *
356 * @uses current_user_can() To check notice should be displayed.
357 * @uses current_theme_supports() To check theme for bbPress support
358 */
359 public function activation_notice() {
360 global $bbp, $pagenow;
361
362 // Bail if not on admin theme page
363 if ( 'themes.php' != $pagenow )
364 return;
365
366 // Bail if user cannot change the theme
367 if ( !current_user_can( 'switch_themes' ) )
368 return;
369
370 // Set $bbp->theme_compat to true to bypass nag
371 if ( !empty( $bbp->theme_compat->theme ) && !current_theme_supports( 'bbpress' ) ) : ?>
372
373 <div id="message" class="updated fade">
374 <p style="line-height: 150%"><?php printf( __( "Your active theme does not include bbPress template files. Your forums are using the default styling included with bbPress.", 'bbpress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=bbpress&tab=search' ) ) ?></p>
375 </div>
376
377 <?php endif;
378 }
379
380 /**
381 * Add Settings link to plugins area
382 *
383 * @since bbPress (r2737)
384 *
385 * @param array $links Links array in which we would prepend our link
386 * @param string $file Current plugin basename
387 * @return array Processed links
388 */
389 public function add_settings_link( $links, $file ) {
390 global $bbp;
391
392 if ( plugin_basename( $bbp->file ) == $file ) {
393 $settings_link = '<a href="' . add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) . '">' . __( 'Settings', 'bbpress' ) . '</a>';
394 array_unshift( $links, $settings_link );
395 }
396
397 return $links;
398 }
399
400 /**
401 * bbPress's dedicated admin init action
402 *
403 * @since bbPress (r2464)
404 *
405 * @uses do_action() Calls 'bbp_admin_init'
406 */
407 public function admin_init() {
408 do_action( 'bbp_admin_init' );
409 }
410
411 /**
412 * Add the 'Right now in Forums' dashboard widget
413 *
414 * @since bbPress (r2770)
415 *
416 * @uses wp_add_dashboard_widget() To add the dashboard widget
417 */
418 public function dashboard_widget_right_now() {
419 wp_add_dashboard_widget( 'bbp-dashboard-right-now', __( 'Right Now in Forums', 'bbpress' ), 'bbp_dashboard_widget_right_now' );
420 }
421
422 /**
423 * Add some general styling to the admin area
424 *
425 * @since bbPress (r2464)
426 *
427 * @uses bbp_get_forum_post_type() To get the forum post type
428 * @uses bbp_get_topic_post_type() To get the topic post type
429 * @uses bbp_get_reply_post_type() To get the reply post type
430 * @uses sanitize_html_class() To sanitize the classes
431 * @uses do_action() Calls 'bbp_admin_head'
432 */
433 public function admin_head() {
434
435 // Icons for top level admin menus
436 $menu_icon_url = $this->images_url . 'menu.png';
437 $icon32_url = $this->images_url . 'icons32.png';
438
439 // Top level menu classes
440 $forum_class = sanitize_html_class( bbp_get_forum_post_type() );
441 $topic_class = sanitize_html_class( bbp_get_topic_post_type() );
442 $reply_class = sanitize_html_class( bbp_get_reply_post_type() ); ?>
443
444 <style type="text/css" media="screen">
445 /*<![CDATA[*/
446
447 #bbp-dashboard-right-now p.sub,
448 #bbp-dashboard-right-now .table,
449 #bbp-dashboard-right-now .versions {
450 margin: -12px;
451 }
452
453 #bbp-dashboard-right-now .inside {
454 font-size: 12px;
455 padding-top: 20px;
456 margin-bottom: 0;
457 }
458
459 #bbp-dashboard-right-now p.sub {
460 padding: 5px 0 15px;
461 color: #8f8f8f;
462 font-size: 14px;
463 position: absolute;
464 top: -17px;
465
466 <?php if ( is_rtl() ) : ?>
467
468 right: 15px;
469
470 <?php else : ?>
471
472 left: 15px;
473
474 <?php endif; ?>
475
476 }
477
478 #bbp-dashboard-right-now .table {
479 margin: 0;
480 padding: 0;
481 position: relative;
482 }
483
484 #bbp-dashboard-right-now .table_content {
485
486 <?php if ( is_rtl() ) : ?>
487
488 float: right;
489
490 <?php else : ?>
491
492 float: left;
493
494 <?php endif; ?>
495
496 border-top: #ececec 1px solid;
497 width: 45%;
498 }
499
500 #bbp-dashboard-right-now .table_discussion {
501
502 <?php if ( is_rtl() ) : ?>
503
504 float: left;
505
506 <?php else : ?>
507
508 float: right;
509
510 <?php endif; ?>
511
512 border-top: #ececec 1px solid;
513 width: 45%;
514 }
515
516 #bbp-dashboard-right-now table td {
517 padding: 3px 0;
518 white-space: nowrap;
519 }
520
521 #bbp-dashboard-right-now table tr.first td {
522 border-top: none;
523 }
524
525 #bbp-dashboard-right-now td.b {
526
527 <?php if ( is_rtl() ) : ?>
528
529 padding-left: 6px;
530
531 <?php else : ?>
532
533 padding-right: 6px;
534
535 <?php endif; ?>
536
537 text-align: right;
538 font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
539 font-size: 14px;
540 width: 1%;
541 }
542
543 #bbp-dashboard-right-now td.b a {
544 font-size: 18px;
545 }
546
547 #bbp-dashboard-right-now td.b a:hover {
548 color: #d54e21;
549 }
550
551 #bbp-dashboard-right-now .t {
552 font-size: 12px;
553
554 <?php if ( is_rtl() ) : ?>
555
556 padding-left: 12px;
557
558 <?php else : ?>
559
560 padding-right: 12px;
561
562 <?php endif; ?>
563
564 padding-top: 6px;
565 color: #777;
566 }
567
568 #bbp-dashboard-right-now .t a {
569 white-space: nowrap;
570 }
571
572 #bbp-dashboard-right-now .spam {
573 color: red;
574 }
575
576 #bbp-dashboard-right-now .waiting {
577 color: #e66f00;
578 }
579
580 #bbp-dashboard-right-now .approved {
581 color: green;
582 }
583
584 #bbp-dashboard-right-now .versions {
585 padding: 6px 10px 12px;
586 clear: both;
587 }
588
589 #bbp-dashboard-right-now .versions .b {
590 font-weight: bold;
591 }
592
593 #bbp-dashboard-right-now a.button {
594
595 <?php if ( is_rtl() ) : ?>
596
597 float: left;
598 clear: left;
599
600 <?php else : ?>
601
602 float: right;
603 clear: right;
604
605 <?php endif; ?>
606
607 position: relative;
608 top: -5px;
609 }
610
611 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image {
612 background: url(<?php echo $menu_icon_url; ?>) no-repeat 0px -32px;
613 }
614 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
615 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image {
616 background: url(<?php echo $menu_icon_url; ?>) no-repeat 0px 0px;
617 }
618 #icon-edit.icon32-posts-<?php echo $forum_class; ?> {
619 background: url(<?php echo $icon32_url; ?>) no-repeat -4px 0px;
620 }
621
622 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image {
623 background: url(<?php echo $menu_icon_url; ?>) no-repeat -70px -32px;
624 }
625 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
626 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image {
627 background: url(<?php echo $menu_icon_url; ?>) no-repeat -70px 0px;
628 }
629 #icon-edit.icon32-posts-<?php echo $topic_class; ?> {
630 background: url(<?php echo $icon32_url; ?>) no-repeat -4px -90px;
631 }
632
633 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image {
634 background: url(<?php echo $menu_icon_url; ?>) no-repeat -35px -32px;
635 }
636 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
637 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
638 background: url(<?php echo $menu_icon_url; ?>) no-repeat -35px 0px;
639 }
640 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
641 background: url(<?php echo $icon32_url; ?>) no-repeat -4px -180px;
642 }
643
644 /*]]>*/
645 </style>
646
647 <?php
648
649 // Add extra actions to bbPress admin header area
650 do_action( 'bbp_admin_head' );
651 }
652
653 /**
654 * Registers the bbPress admin color scheme
655 *
656 * Because wp-content can exist outside of the WordPress root there is no
657 * way to be certain what the relative path of the admin images is.
658 * We are including the two most common configurations here, just in case.
659 *
660 * @since bbPress (r2521)
661 *
662 * @uses wp_admin_css_color() To register the color scheme
663 */
664 public function register_admin_style () {
665
666 // Normal wp-content dir
667 if ( 0 === $this->content_depth )
668 $css_file = $this->styles_url . 'admin.css';
669
670 // Custom wp-content dir is 1 level away
671 elseif ( 1 === $this->content_depth )
672 $css_file = $this->styles_url . 'admin-1.css';
673
674 // Custom wp-content dir is 1 level away
675 elseif ( 2 === $this->content_depth )
676 $css_file = $this->styles_url . 'admin-2.css';
677
678 // Load the admin CSS styling
679 wp_admin_css_color( 'bbpress', __( 'Green', 'bbpress' ), $css_file, array( '#222222', '#006600', '#deece1', '#6eb469' ) );
680 }
681 }
682 endif; // class_exists check
683
684 /**
685 * Setup bbPress Admin
686 *
687 * @since bbPress (r2596)
688 *
689 * @uses BBP_Admin
690 */
691 function bbp_admin() {
692 global $bbp;
693
694 $bbp->admin = new BBP_Admin();
695
696 if ( defined( 'BBP_CONTENT_DEPTH' ) )
697 $bbp->admin->content_depth = (int) BBP_CONTENT_DEPTH;
698 }
699
700 ?>
701