PluginProbe
bbPress / 2.2.2
bbPress v2.2.2
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 / includes / admin / admin.php

admin.php in bbPress 2.2.2, at includes/admin/admin.php

1,703 lines 55.5 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 /** Capability ************************************************************/
48
49 /**
50 * @var bool Minimum capability to access Tools and Settings
51 */
52 public $minimum_capability = 'manage_options';
53
54 /** Functions *************************************************************/
55
56 /**
57 * The main bbPress admin loader
58 *
59 * @since bbPress (r2515)
60 *
61 * @uses BBP_Admin::setup_globals() Setup the globals needed
62 * @uses BBP_Admin::includes() Include the required files
63 * @uses BBP_Admin::setup_actions() Setup the hooks and actions
64 */
65 public function __construct() {
66 $this->setup_globals();
67 $this->includes();
68 $this->setup_actions();
69 }
70
71 /**
72 * Admin globals
73 *
74 * @since bbPress (r2646)
75 * @access private
76 */
77 private function setup_globals() {
78 $bbp = bbpress();
79 $this->admin_dir = trailingslashit( $bbp->includes_dir . 'admin' ); // Admin path
80 $this->admin_url = trailingslashit( $bbp->includes_url . 'admin' ); // Admin url
81 $this->images_url = trailingslashit( $this->admin_url . 'images' ); // Admin images URL
82 $this->styles_url = trailingslashit( $this->admin_url . 'styles' ); // Admin styles URL
83 }
84
85 /**
86 * Include required files
87 *
88 * @since bbPress (r2646)
89 * @access private
90 */
91 private function includes() {
92 require( $this->admin_dir . 'tools.php' );
93 require( $this->admin_dir . 'converter.php' );
94 require( $this->admin_dir . 'settings.php' );
95 require( $this->admin_dir . 'functions.php' );
96 require( $this->admin_dir . 'metaboxes.php' );
97 require( $this->admin_dir . 'forums.php' );
98 require( $this->admin_dir . 'topics.php' );
99 require( $this->admin_dir . 'replies.php' );
100 require( $this->admin_dir . 'users.php' );
101 }
102
103 /**
104 * Setup the admin hooks, actions and filters
105 *
106 * @since bbPress (r2646)
107 * @access private
108 *
109 * @uses add_action() To add various actions
110 * @uses add_filter() To add various filters
111 */
112 private function setup_actions() {
113
114 // Bail to prevent interfering with the deactivation process
115 if ( bbp_is_deactivation() )
116 return;
117
118 /** General Actions ***************************************************/
119
120 add_action( 'bbp_admin_menu', array( $this, 'admin_menus' ) ); // Add menu item to settings menu
121 add_action( 'bbp_admin_head', array( $this, 'admin_head' ) ); // Add some general styling to the admin area
122 add_action( 'bbp_admin_notices', array( $this, 'activation_notice' ) ); // Add notice if not using a bbPress theme
123 add_action( 'bbp_register_admin_style', array( $this, 'register_admin_style' ) ); // Add green admin style
124 add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings' ) ); // Add settings
125 add_action( 'bbp_activation', array( $this, 'new_install' ) ); // Add menu item to settings menu
126 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Add enqueued JS and CSS
127 add_action( 'wp_dashboard_setup', array( $this, 'dashboard_widget_right_now' ) ); // Forums 'Right now' Dashboard widget
128
129 /** Ajax **************************************************************/
130
131 add_action( 'wp_ajax_bbp_suggest_topic', array( $this, 'suggest_topic' ) );
132 add_action( 'wp_ajax_nopriv_bbp_suggest_topic', array( $this, 'suggest_topic' ) );
133
134 /** Filters ***********************************************************/
135
136 // Modify bbPress's admin links
137 add_filter( 'plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 );
138
139 // Map settings capabilities
140 add_filter( 'bbp_map_meta_caps', array( $this, 'map_settings_meta_caps' ), 10, 4 );
141
142 // Hide the theme compat package selection
143 add_filter( 'bbp_admin_get_settings_sections', array( $this, 'hide_theme_compat_packages' ) );
144
145 /** Network Admin *****************************************************/
146
147 // Add menu item to settings menu
148 add_action( 'network_admin_menu', array( $this, 'network_admin_menus' ) );
149
150 /** Dependencies ******************************************************/
151
152 // Allow plugins to modify these actions
153 do_action_ref_array( 'bbp_admin_loaded', array( &$this ) );
154 }
155
156 /**
157 * Add the admin menus
158 *
159 * @since bbPress (r2646)
160 *
161 * @uses add_management_page() To add the Recount page in Tools section
162 * @uses add_options_page() To add the Forums settings page in Settings
163 * section
164 */
165 public function admin_menus() {
166
167 $hooks = array();
168
169 // These are later removed in admin_head
170 if ( current_user_can( 'bbp_tools_page' ) ) {
171 if ( current_user_can( 'bbp_tools_repair_page' ) ) {
172 $hooks[] = add_management_page(
173 __( 'Repair Forums', 'bbpress' ),
174 __( 'Forum Repair', 'bbpress' ),
175 $this->minimum_capability,
176 'bbp-repair',
177 'bbp_admin_repair'
178 );
179 }
180
181 if ( current_user_can( 'bbp_tools_import_page' ) ) {
182 $hooks[] = add_management_page(
183 __( 'Import Forums', 'bbpress' ),
184 __( 'Forum Import', 'bbpress' ),
185 $this->minimum_capability,
186 'bbp-converter',
187 'bbp_converter_settings'
188 );
189 }
190
191 if ( current_user_can( 'bbp_tools_reset_page' ) ) {
192 $hooks[] = add_management_page(
193 __( 'Reset Forums', 'bbpress' ),
194 __( 'Forum Reset', 'bbpress' ),
195 $this->minimum_capability,
196 'bbp-reset',
197 'bbp_admin_reset'
198 );
199 }
200
201 // Fudge the highlighted subnav item when on a bbPress admin page
202 foreach( $hooks as $hook ) {
203 add_action( "admin_head-$hook", 'bbp_tools_modify_menu_highlight' );
204 }
205
206 // Forums Tools Root
207 add_management_page(
208 __( 'Forums', 'bbpress' ),
209 __( 'Forums', 'bbpress' ),
210 $this->minimum_capability,
211 'bbp-repair',
212 'bbp_admin_repair'
213 );
214 }
215
216 // Are settings enabled?
217 if ( current_user_can( 'bbp_settings_page' ) ) {
218 add_options_page(
219 __( 'Forums', 'bbpress' ),
220 __( 'Forums', 'bbpress' ),
221 $this->minimum_capability,
222 'bbpress',
223 'bbp_admin_settings'
224 );
225 }
226
227 // These are later removed in admin_head
228 if ( current_user_can( 'bbp_about_page' ) ) {
229
230 // About
231 add_dashboard_page(
232 __( 'Welcome to bbPress', 'bbpress' ),
233 __( 'Welcome to bbPress', 'bbpress' ),
234 $this->minimum_capability,
235 'bbp-about',
236 array( $this, 'about_screen' )
237 );
238
239 // Credits
240 add_dashboard_page(
241 __( 'Welcome to bbPress', 'bbpress' ),
242 __( 'Welcome to bbPress', 'bbpress' ),
243 $this->minimum_capability,
244 'bbp-credits',
245 array( $this, 'credits_screen' )
246 );
247 }
248
249 // Bail if plugin is not network activated
250 if ( ! is_plugin_active_for_network( bbpress()->basename ) )
251 return;
252
253 add_submenu_page(
254 'index.php',
255 __( 'Update Forums', 'bbpress' ),
256 __( 'Update Forums', 'bbpress' ),
257 'manage_network',
258 'bbp-update',
259 array( $this, 'update_screen' )
260 );
261 }
262
263 /**
264 * Add the network admin menus
265 *
266 * @since bbPress (r3689)
267 * @uses add_submenu_page() To add the Update Forums page in Updates
268 */
269 public function network_admin_menus() {
270
271 // Bail if plugin is not network activated
272 if ( ! is_plugin_active_for_network( bbpress()->basename ) )
273 return;
274
275 add_submenu_page(
276 'upgrade.php',
277 __( 'Update Forums', 'bbpress' ),
278 __( 'Update Forums', 'bbpress' ),
279 'manage_network',
280 'bbpress-update',
281 array( $this, 'network_update_screen' )
282 );
283 }
284
285 /**
286 * If this is a new installation, create some initial forum content.
287 *
288 * @since bbPress (r3767)
289 * @return type
290 */
291 public static function new_install() {
292 if ( !bbp_is_install() )
293 return;
294
295 bbp_create_initial_content();
296 }
297
298 /**
299 * Register the settings
300 *
301 * @since bbPress (r2737)
302 *
303 * @uses add_settings_section() To add our own settings section
304 * @uses add_settings_field() To add various settings fields
305 * @uses register_setting() To register various settings
306 * @todo Put fields into multidimensional array
307 */
308 public static function register_admin_settings() {
309
310 // Bail if no sections available
311 $sections = bbp_admin_get_settings_sections();
312 if ( empty( $sections ) )
313 return false;
314
315 // Loop through sections
316 foreach ( (array) $sections as $section_id => $section ) {
317
318 // Only proceed if current user can see this section
319 if ( ! current_user_can( $section_id ) )
320 continue;
321
322 // Only add section and fields if section has fields
323 $fields = bbp_admin_get_settings_fields_for_section( $section_id );
324 if ( empty( $fields ) )
325 continue;
326
327 // Add the section
328 add_settings_section( $section_id, $section['title'], $section['callback'], $section['page'] );
329
330 // Loop through fields for this section
331 foreach ( (array) $fields as $field_id => $field ) {
332
333 // Add the field
334 add_settings_field( $field_id, $field['title'], $field['callback'], $section['page'], $section_id, $field['args'] );
335
336 // Register the setting
337 register_setting( $section['page'], $field_id, $field['sanitize_callback'] );
338 }
339 }
340 }
341
342 /**
343 * Maps settings capabilities
344 *
345 * @since bbPress (r4242)
346 *
347 * @param array $caps Capabilities for meta capability
348 * @param string $cap Capability name
349 * @param int $user_id User id
350 * @param mixed $args Arguments
351 * @uses get_post() To get the post
352 * @uses get_post_type_object() To get the post type object
353 * @uses apply_filters() Calls 'bbp_map_meta_caps' with caps, cap, user id and
354 * args
355 * @return array Actual capabilities for meta capability
356 */
357 public static function map_settings_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
358
359 // What capability is being checked?
360 switch ( $cap ) {
361
362 // BuddyPress
363 case 'bbp_settings_buddypress' :
364 if ( ( is_plugin_active( 'buddypress/bp-loader.php' ) && defined( 'BP_VERSION' ) ) && is_super_admin() ) {
365 $caps = array( bbpress()->admin->minimum_capability );
366 } else {
367 $caps = array( 'do_not_allow' );
368 }
369
370 break;
371
372 // Akismet
373 case 'bbp_settings_akismet' :
374 if ( ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) && is_super_admin() ) {
375 $caps = array( bbpress()->admin->minimum_capability );
376 } else {
377 $caps = array( 'do_not_allow' );
378 }
379
380 break;
381
382 // bbPress
383 case 'bbp_about_page' : // About and Credits
384 case 'bbp_tools_page' : // Tools Page
385 case 'bbp_tools_repair_page' : // Tools - Repair Page
386 case 'bbp_tools_import_page' : // Tools - Import Page
387 case 'bbp_tools_reset_page' : // Tools - Reset Page
388 case 'bbp_settings_page' : // Settings Page
389 case 'bbp_settings_main' : // Settings - General
390 case 'bbp_settings_theme_compat' : // Settings - Theme compat
391 case 'bbp_settings_root_slugs' : // Settings - Root slugs
392 case 'bbp_settings_single_slugs' : // Settings - Single slugs
393 case 'bbp_settings_per_page' : // Settings - Single slugs
394 case 'bbp_settings_per_page_rss' : // Settings - Single slugs
395 $caps = array( bbpress()->admin->minimum_capability );
396 break;
397 }
398
399 return apply_filters( 'bbp_map_settings_meta_caps', $caps, $cap, $user_id, $args );
400 }
401
402 /**
403 * Register the importers
404 *
405 * @since bbPress (r2737)
406 *
407 * @uses apply_filters() Calls 'bbp_importer_path' filter to allow plugins
408 * to customize the importer script locations.
409 */
410 public function register_importers() {
411
412 // Leave if we're not in the import section
413 if ( !defined( 'WP_LOAD_IMPORTERS' ) )
414 return;
415
416 // Load Importer API
417 require_once( ABSPATH . 'wp-admin/includes/import.php' );
418
419 // Load our importers
420 $importers = apply_filters( 'bbp_importers', array( 'bbpress' ) );
421
422 // Loop through included importers
423 foreach ( $importers as $importer ) {
424
425 // Allow custom importer directory
426 $import_dir = apply_filters( 'bbp_importer_path', $this->admin_dir . 'importers', $importer );
427
428 // Compile the importer path
429 $import_file = trailingslashit( $import_dir ) . $importer . '.php';
430
431 // If the file exists, include it
432 if ( file_exists( $import_file ) ) {
433 require( $import_file );
434 }
435 }
436 }
437
438 /**
439 * Admin area activation notice
440 *
441 * Shows a nag message in admin area about the theme not supporting bbPress
442 *
443 * @since bbPress (r2743)
444 *
445 * @uses current_user_can() To check notice should be displayed.
446 */
447 public function activation_notice() {
448 // @todo - something fun
449 }
450
451 /**
452 * Add Settings link to plugins area
453 *
454 * @since bbPress (r2737)
455 *
456 * @param array $links Links array in which we would prepend our link
457 * @param string $file Current plugin basename
458 * @return array Processed links
459 */
460 public static function modify_plugin_action_links( $links, $file ) {
461
462 // Return normal links if not bbPress
463 if ( plugin_basename( bbpress()->file ) != $file )
464 return $links;
465
466 // Add a few links to the existing links array
467 return array_merge( $links, array(
468 'settings' => '<a href="' . add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) . '">' . esc_html__( 'Settings', 'bbpress' ) . '</a>',
469 'about' => '<a href="' . add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) . '">' . esc_html__( 'About', 'bbpress' ) . '</a>'
470 ) );
471 }
472
473 /**
474 * Add the 'Right now in Forums' dashboard widget
475 *
476 * @since bbPress (r2770)
477 *
478 * @uses wp_add_dashboard_widget() To add the dashboard widget
479 */
480 public static function dashboard_widget_right_now() {
481 wp_add_dashboard_widget( 'bbp-dashboard-right-now', __( 'Right Now in Forums', 'bbpress' ), 'bbp_dashboard_widget_right_now' );
482 }
483
484 /**
485 * Enqueue any admin scripts we might need
486 * @since bbPress (4260)
487 */
488 public function enqueue_scripts() {
489 wp_enqueue_script( 'suggest' );
490 }
491
492 /**
493 * Add some general styling to the admin area
494 *
495 * @since bbPress (r2464)
496 *
497 * @uses bbp_get_forum_post_type() To get the forum post type
498 * @uses bbp_get_topic_post_type() To get the topic post type
499 * @uses bbp_get_reply_post_type() To get the reply post type
500 * @uses sanitize_html_class() To sanitize the classes
501 */
502 public function admin_head() {
503
504 // Remove the individual recount and converter menus.
505 // They are grouped together by h2 tabs
506 remove_submenu_page( 'tools.php', 'bbp-repair' );
507 remove_submenu_page( 'tools.php', 'bbp-converter' );
508 remove_submenu_page( 'tools.php', 'bbp-reset' );
509 remove_submenu_page( 'index.php', 'bbp-about' );
510 remove_submenu_page( 'index.php', 'bbp-credits' );
511
512 // The /wp-admin/images/ folder
513 $wp_admin_url = admin_url( 'images/' );
514
515 // Icons for top level admin menus
516 $version = bbp_get_version();
517 $menu_icon_url = $this->images_url . 'menu.png?ver=' . $version;
518 $icon32_url = $this->images_url . 'icons32.png?ver=' . $version;
519 $menu_icon_url_2x = $this->images_url . 'menu-2x.png?ver=' . $version;
520 $icon32_url_2x = $this->images_url . 'icons32-2x.png?ver=' . $version;
521 $badge_url = $this->images_url . 'badge.png?ver=' . $version;
522 $badge_url_2x = $this->images_url . 'badge-2x.png?ver=' . $version;
523
524 // The image size changed in WordPress 3.5
525 if ( function_exists( 'wp_enqueue_media' ) ) {
526 $icon32_size = '756px 45px';
527 } else {
528 $icon32_size = '708px 45px';
529 }
530
531 // Top level menu classes
532 $forum_class = sanitize_html_class( bbp_get_forum_post_type() );
533 $topic_class = sanitize_html_class( bbp_get_topic_post_type() );
534 $reply_class = sanitize_html_class( bbp_get_reply_post_type() );
535
536 if ( ( 'post' == get_current_screen()->base ) && ( bbp_get_reply_post_type() == get_current_screen()->post_type ) ) : ?>
537
538 <script type="text/javascript">
539 jQuery(document).ready(function() {
540
541 var bbp_topic_id = jQuery( '#bbp_topic_id' );
542
543 bbp_topic_id.suggest( ajaxurl + '?action=bbp_suggest_topic', {
544 onSelect: function() {
545 var value = this.value;
546 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) );
547 }
548 } );
549 });
550 </script>
551
552 <?php endif; ?>
553
554 <style type="text/css" media="screen">
555 /*<![CDATA[*/
556
557 /* Kludge for too-wide forums dropdown */
558 #poststuff #bbp_forum_attributes select#parent_id,
559 #poststuff #bbp_topic_attributes select#parent_id,
560 #poststuff #bbp_reply_attributes select#bbp_forum_id {
561 max-width: 170px;
562 }
563
564 /* Version Badge */
565
566 .bbp-badge {
567 padding-top: 142px;
568 height: 50px;
569 width: 173px;
570 color: #fafafa;
571 font-weight: bold;
572 font-size: 14px;
573 text-align: center;
574 margin: 0 -5px;
575 background: url('<?php echo $badge_url; ?>') no-repeat;
576 }
577
578 .about-wrap .bbp-badge {
579 position: absolute;
580 top: 0;
581 right: 0;
582 }
583 body.rtl .about-wrap .bbp-badge {
584 right: auto;
585 left: 0;
586 }
587
588 #bbp-dashboard-right-now p.sub,
589 #bbp-dashboard-right-now .table,
590 #bbp-dashboard-right-now .versions {
591 margin: -12px;
592 }
593
594 #bbp-dashboard-right-now .inside {
595 font-size: 12px;
596 padding-top: 20px;
597 margin-bottom: 0;
598 }
599
600 #bbp-dashboard-right-now p.sub {
601 padding: 5px 0 15px;
602 color: #8f8f8f;
603 font-size: 14px;
604 position: absolute;
605 top: -17px;
606 left: 15px;
607 }
608 body.rtl #bbp-dashboard-right-now p.sub {
609 right: 15px;
610 left: 0;
611 }
612
613 #bbp-dashboard-right-now .table {
614 margin: 0;
615 padding: 0;
616 position: relative;
617 }
618
619 #bbp-dashboard-right-now .table_content {
620 float: left;
621 border-top: #ececec 1px solid;
622 width: 45%;
623 }
624 body.rtl #bbp-dashboard-right-now .table_content {
625 float: right;
626 }
627
628 #bbp-dashboard-right-now .table_discussion {
629 float: right;
630 border-top: #ececec 1px solid;
631 width: 45%;
632 }
633 body.rtl #bbp-dashboard-right-now .table_discussion {
634 float: left;
635 }
636
637 #bbp-dashboard-right-now table td {
638 padding: 3px 0;
639 white-space: nowrap;
640 }
641
642 #bbp-dashboard-right-now table tr.first td {
643 border-top: none;
644 }
645
646 #bbp-dashboard-right-now td.b {
647 padding-right: 6px;
648 text-align: right;
649 font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
650 font-size: 14px;
651 width: 1%;
652 }
653 body.rtl #bbp-dashboard-right-now td.b {
654 padding-left: 6px;
655 padding-right: 0;
656 }
657
658 #bbp-dashboard-right-now td.b a {
659 font-size: 18px;
660 }
661
662 #bbp-dashboard-right-now td.b a:hover {
663 color: #d54e21;
664 }
665
666 #bbp-dashboard-right-now .t {
667 font-size: 12px;
668 padding-right: 12px;
669 padding-top: 6px;
670 color: #777;
671 }
672 body.rtl #bbp-dashboard-right-now .t {
673 padding-left: 12px;
674 padding-right: 0;
675 }
676
677 #bbp-dashboard-right-now .t a {
678 white-space: nowrap;
679 }
680
681 #bbp-dashboard-right-now .spam {
682 color: red;
683 }
684
685 #bbp-dashboard-right-now .waiting {
686 color: #e66f00;
687 }
688
689 #bbp-dashboard-right-now .approved {
690 color: green;
691 }
692
693 #bbp-dashboard-right-now .versions {
694 padding: 6px 10px 12px;
695 clear: both;
696 }
697
698 #bbp-dashboard-right-now .versions .b {
699 font-weight: bold;
700 }
701
702 #bbp-dashboard-right-now a.button {
703 float: right;
704 clear: right;
705 position: relative;
706 top: -5px;
707 }
708 body.rtl #bbp-dashboard-right-now a.button {
709 float: left;
710 clear: left;
711 }
712
713 /* Icon 32 */
714 #icon-edit.icon32-posts-<?php echo $forum_class; ?>,
715 #icon-edit.icon32-posts-<?php echo $topic_class; ?>,
716 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
717 background: url('<?php echo $icon32_url; ?>');
718 background-repeat: no-repeat;
719 }
720
721 /* Icon Positions */
722 #icon-edit.icon32-posts-<?php echo $forum_class; ?> {
723 background-position: -4px 0px;
724 }
725
726 #icon-edit.icon32-posts-<?php echo $topic_class; ?> {
727 background-position: -4px -90px;
728 }
729
730 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
731 background-position: -4px -180px;
732 }
733
734 /* Icon 32 2x */
735 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
736 #icon-edit.icon32-posts-<?php echo $forum_class; ?>,
737 #icon-edit.icon32-posts-<?php echo $topic_class; ?>,
738 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
739 background-image: url('<?php echo $icon32_url_2x; ?>');
740 background-size: 45px 255px;
741 }
742 }
743
744 /* Menu */
745 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image,
746 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image,
747 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image,
748
749 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
750 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
751 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
752
753 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
754 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
755 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
756 background: url('<?php echo $menu_icon_url; ?>');
757 background-repeat: no-repeat;
758 }
759
760 /* Menu Positions */
761 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image {
762 background-position: 0px -32px;
763 }
764 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
765 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image {
766 background-position: 0px 0px;
767 }
768 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image {
769 background-position: -70px -32px;
770 }
771 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
772 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image {
773 background-position: -70px 0px;
774 }
775 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image {
776 background-position: -35px -32px;
777 }
778 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
779 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
780 background-position: -35px 0px;
781 }
782
783 /* Menu 2x */
784 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
785 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image,
786 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image,
787 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image,
788
789 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
790 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
791 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
792
793 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
794 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
795 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
796 background-image: url('<?php echo $menu_icon_url_2x; ?>');
797 background-size: 100px 64px;
798 }
799
800 .bbp-badge {
801 background-image: url('<?php echo $badge_url_2x; ?>');
802 background-size: 173px 194px;
803 }
804 }
805
806 <?php if ( 'bbpress' == get_user_option( 'admin_color' ) ) : ?>
807
808 /* Green Scheme Images */
809
810 .post-com-count {
811 background-image: url('<?php echo $wp_admin_url; ?>bubble_bg.gif');
812 }
813
814 .button,
815 .submit input,
816 .button-secondary {
817 background-image: url('<?php echo $wp_admin_url; ?>white-grad.png');
818 }
819
820 .button:active,
821 .submit input:active,
822 .button-secondary:active {
823 background-image: url('<?php echo $wp_admin_url; ?>white-grad-active.png');
824 }
825
826 .curtime #timestamp {
827 background-image: url('<?php echo $wp_admin_url; ?>date-button.gif');
828 }
829
830 .tagchecklist span a,
831 #bulk-titles div a {
832 background-image: url('<?php echo $wp_admin_url; ?>xit.gif');
833 }
834
835 .tagchecklist span a:hover,
836 #bulk-titles div a:hover {
837 background-image: url('<?php echo $wp_admin_url; ?>xit.gif');
838 }
839 #screen-meta-links a.show-settings {
840 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
841 }
842
843 #screen-meta-links a.show-settings.screen-meta-active {
844 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
845 }
846
847 #adminmenushadow,
848 #adminmenuback {
849 background-image: url('<?php echo $wp_admin_url; ?>menu-shadow.png');
850 }
851
852 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
853 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
854 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
855 }
856
857 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
858 #adminmenu .wp-menu-open .wp-menu-toggle {
859 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
860 }
861
862 #collapse-button div {
863 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
864 }
865
866 /* menu and screen icons */
867 .icon16.icon-dashboard,
868 #adminmenu .menu-icon-dashboard div.wp-menu-image {
869 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
870 }
871
872 #adminmenu .menu-icon-dashboard:hover div.wp-menu-image,
873 #adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,
874 #adminmenu .menu-icon-dashboard.current div.wp-menu-image {
875 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
876 }
877
878 .icon16.icon-post,
879 #adminmenu .menu-icon-post div.wp-menu-image {
880 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
881 }
882
883 #adminmenu .menu-icon-post:hover div.wp-menu-image,
884 #adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image {
885 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
886 }
887
888 .icon16.icon-media,
889 #adminmenu .menu-icon-media div.wp-menu-image {
890 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
891 }
892
893 #adminmenu .menu-icon-media:hover div.wp-menu-image,
894 #adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image {
895 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
896 }
897
898 .icon16.icon-links,
899 #adminmenu .menu-icon-links div.wp-menu-image {
900 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
901 }
902
903 #adminmenu .menu-icon-links:hover div.wp-menu-image,
904 #adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image {
905 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
906 }
907
908 .icon16.icon-page,
909 #adminmenu .menu-icon-page div.wp-menu-image {
910 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
911 }
912
913 #adminmenu .menu-icon-page:hover div.wp-menu-image,
914 #adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image {
915 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
916 }
917
918 .icon16.icon-comments,
919 #adminmenu .menu-icon-comments div.wp-menu-image {
920 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
921 }
922
923 #adminmenu .menu-icon-comments:hover div.wp-menu-image,
924 #adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,
925 #adminmenu .menu-icon-comments.current div.wp-menu-image {
926 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
927 }
928
929 .icon16.icon-appearance,
930 #adminmenu .menu-icon-appearance div.wp-menu-image {
931 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
932 }
933
934 #adminmenu .menu-icon-appearance:hover div.wp-menu-image,
935 #adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image {
936 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
937 }
938
939 .icon16.icon-plugins,
940 #adminmenu .menu-icon-plugins div.wp-menu-image {
941 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
942 }
943
944 #adminmenu .menu-icon-plugins:hover div.wp-menu-image,
945 #adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image {
946 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
947 }
948
949 .icon16.icon-users,
950 #adminmenu .menu-icon-users div.wp-menu-image {
951 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
952 }
953
954 #adminmenu .menu-icon-users:hover div.wp-menu-image,
955 #adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image,
956 #adminmenu .menu-icon-users.current div.wp-menu-image {
957 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
958 }
959
960 .icon16.icon-tools,
961 #adminmenu .menu-icon-tools div.wp-menu-image {
962 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
963 }
964
965 #adminmenu .menu-icon-tools:hover div.wp-menu-image,
966 #adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image,
967 #adminmenu .menu-icon-tools.current div.wp-menu-image {
968 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
969 }
970
971 .icon16.icon-settings,
972 #adminmenu .menu-icon-settings div.wp-menu-image {
973 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
974 }
975
976 #adminmenu .menu-icon-settings:hover div.wp-menu-image,
977 #adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image {
978 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
979 }
980
981 .icon16.icon-site,
982 #adminmenu .menu-icon-site div.wp-menu-image {
983 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
984 }
985
986 #adminmenu .menu-icon-site:hover div.wp-menu-image,
987 #adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image {
988 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
989 }
990 /* end menu and screen icons */
991
992 /* Screen Icons */
993 .icon32.icon-post,
994 #icon-edit,
995 #icon-post {
996 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
997 }
998
999 .icon32.icon-dashboard,
1000 #icon-index {
1001 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1002 }
1003
1004 .icon32.icon-media,
1005 #icon-upload {
1006 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1007 }
1008
1009 .icon32.icon-links,
1010 #icon-link-manager,
1011 #icon-link,
1012 #icon-link-category {
1013 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1014 }
1015
1016 .icon32.icon-page,
1017 #icon-edit-pages,
1018 #icon-page {
1019 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1020 }
1021
1022 .icon32.icon-comments,
1023 #icon-edit-comments {
1024 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1025 }
1026
1027 .icon32.icon-appearance,
1028 #icon-themes {
1029 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1030 }
1031
1032 .icon32.icon-plugins,
1033 #icon-plugins {
1034 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1035 }
1036
1037 .icon32.icon-users,
1038 #icon-users,
1039 #icon-profile,
1040 #icon-user-edit {
1041 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1042 }
1043
1044 .icon32.icon-tools,
1045 #icon-tools,
1046 #icon-admin {
1047 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1048 }
1049
1050 .icon32.icon-settings,
1051 #icon-options-general {
1052 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1053 }
1054
1055 .icon32.icon-site,
1056 #icon-ms-admin {
1057 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1058 }
1059 /* end screen icons */
1060
1061 .meta-box-sortables .postbox:hover .handlediv {
1062 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1063 }
1064
1065 .tablenav .tablenav-pages a {
1066 background-image: url('<?php echo $wp_admin_url; ?>menu-bits.gif?ver=20100610');
1067 }
1068
1069 .view-switch #view-switch-list {
1070 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1071 }
1072
1073 .view-switch .current #view-switch-list {
1074 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1075 }
1076
1077 .view-switch #view-switch-excerpt {
1078 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1079 }
1080
1081 .view-switch .current #view-switch-excerpt {
1082 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1083 }
1084
1085 #header-logo {
1086 background-image: url('<?php echo $wp_admin_url; ?>wp-logo.png?ver=20110504');
1087 }
1088
1089 .sidebar-name-arrow {
1090 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1091 }
1092
1093 .sidebar-name:hover .sidebar-name-arrow {
1094 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1095 }
1096
1097 .item-edit {
1098 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1099 }
1100
1101 .item-edit:hover {
1102 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1103 }
1104
1105 .wp-badge {
1106 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png');
1107 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -ms-linear-gradient(top, #378aac, #165d84); /* IE10 */
1108 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -moz-linear-gradient(top, #378aac, #165d84); /* Firefox */
1109 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -o-linear-gradient(top, #378aac, #165d84); /* Opera */
1110 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -webkit-gradient(linear, left top, left bottom, from(#378aac), to(#165d84)); /* old Webkit */
1111 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -webkit-linear-gradient(top, #378aac, #165d84); /* new Webkit */
1112 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), linear-gradient(top, #378aac, #165d84); /* proposed W3C Markup */
1113 }
1114
1115 .rtl .post-com-count {
1116 background-image: url('<?php echo $wp_admin_url; ?>bubble_bg-rtl.gif');
1117 }
1118
1119 /* Menu */
1120 .rtl #adminmenushadow,
1121 .rtl #adminmenuback {
1122 background-image: url('<?php echo $wp_admin_url; ?>menu-shadow-rtl.png');
1123 }
1124
1125 .rtl #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
1126 .rtl #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
1127 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1128 }
1129
1130 .rtl #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
1131 .rtl #adminmenu .wp-menu-open .wp-menu-toggle {
1132 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1133 }
1134
1135 .rtl .meta-box-sortables .postbox:hover .handlediv {
1136 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1137 }
1138
1139 .rtl .tablenav .tablenav-pages a {
1140 background-image: url('<?php echo $wp_admin_url; ?>menu-bits-rtl.gif?ver=20100610');
1141 }
1142
1143 .rtl .sidebar-name-arrow {
1144 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1145 }
1146
1147 .rtl .sidebar-name:hover .sidebar-name-arrow {
1148 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1149 }
1150
1151 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
1152 .icon32.icon-post,
1153 #icon-edit,
1154 #icon-post,
1155 .icon32.icon-dashboard,
1156 #icon-index,
1157 .icon32.icon-media,
1158 #icon-upload,
1159 .icon32.icon-links,
1160 #icon-link-manager,
1161 #icon-link,
1162 #icon-link-category,
1163 .icon32.icon-page,
1164 #icon-edit-pages,
1165 #icon-page,
1166 .icon32.icon-comments,
1167 #icon-edit-comments,
1168 .icon32.icon-appearance,
1169 #icon-themes,
1170 .icon32.icon-plugins,
1171 #icon-plugins,
1172 .icon32.icon-users,
1173 #icon-users,
1174 #icon-profile,
1175 #icon-user-edit,
1176 .icon32.icon-tools,
1177 #icon-tools,
1178 #icon-admin,
1179 .icon32.icon-settings,
1180 #icon-options-general,
1181 .icon32.icon-site,
1182 #icon-ms-admin {
1183 background-image: url('<?php echo $wp_admin_url; ?>icons32-2x.png?ver=20120412') !important;
1184 background-size: <?php echo $icon32_size; ?>
1185 }
1186
1187 .icon16.icon-dashboard,
1188 .menu-icon-dashboard div.wp-menu-image,
1189 .icon16.icon-post,
1190 .menu-icon-post div.wp-menu-image,
1191 .icon16.icon-media,
1192 .menu-icon-media div.wp-menu-image,
1193 .icon16.icon-links,
1194 .menu-icon-links div.wp-menu-image,
1195 .icon16.icon-page,
1196 .menu-icon-page div.wp-menu-image,
1197 .icon16.icon-comments,
1198 .menu-icon-comments div.wp-menu-image,
1199 .icon16.icon-appearance,
1200 .menu-icon-appearance div.wp-menu-image,
1201 .icon16.icon-plugins,
1202 .menu-icon-plugins div.wp-menu-image,
1203 .icon16.icon-users,
1204 .menu-icon-users div.wp-menu-image,
1205 .icon16.icon-tools,
1206 .menu-icon-tools div.wp-menu-image,
1207 .icon16.icon-settings,
1208 .menu-icon-settings div.wp-menu-image,
1209 .icon16.icon-site,
1210 .menu-icon-site div.wp-menu-image {
1211 background-image: url('<?php echo $wp_admin_url; ?>menu-2x.png?ver=20120412') !important;
1212 background-size: 390px 64px;
1213 }
1214 }
1215 <?php endif; ?>
1216
1217 /*]]>*/
1218 </style>
1219
1220 <?php
1221 }
1222
1223 /**
1224 * Registers the bbPress admin color scheme
1225 *
1226 * Because wp-content can exist outside of the WordPress root there is no
1227 * way to be certain what the relative path of the admin images is.
1228 * We are including the two most common configurations here, just in case.
1229 *
1230 * @since bbPress (r2521)
1231 *
1232 * @uses wp_admin_css_color() To register the color scheme
1233 */
1234 public function register_admin_style () {
1235
1236 // Updated admin color scheme CSS
1237 if ( function_exists( 'wp_enqueue_media' ) ) {
1238 $green_scheme = $this->styles_url . 'green.css';
1239
1240 } else {
1241 $green_scheme = $this->styles_url . 'green-34.css';
1242 }
1243
1244 // Register the green scheme
1245 wp_admin_css_color( 'bbpress', esc_html_x( 'Green', 'admin color scheme', 'bbpress' ), $green_scheme, array( '#222222', '#006600', '#deece1', '#6eb469' ) );
1246 }
1247
1248 /**
1249 * Hide theme compat package selection if only 1 package is registered
1250 *
1251 * @since bbPress (r4315)
1252 *
1253 * @param array $sections Forums settings sections
1254 * @return array
1255 */
1256 public function hide_theme_compat_packages( $sections = array() ) {
1257 if ( count( bbpress()->theme_compat->packages ) <= 1 )
1258 unset( $sections['bbp_settings_theme_compat'] );
1259
1260 return $sections;
1261 }
1262
1263 /** Ajax ******************************************************************/
1264
1265 /**
1266 * Ajax action for facilitating the forum auto-suggest
1267 *
1268 * @since bbPress (r4261)
1269 *
1270 * @uses get_posts()
1271 * @uses bbp_get_topic_post_type()
1272 * @uses bbp_get_topic_id()
1273 * @uses bbp_get_topic_title()
1274 */
1275 public function suggest_topic() {
1276
1277 // TRy to get some topics
1278 $topics = get_posts( array(
1279 's' => like_escape( $_REQUEST['q'] ),
1280 'post_type' => bbp_get_topic_post_type()
1281 ) );
1282
1283 // If we found some topics, loop through and display them
1284 if ( ! empty( $topics ) ) {
1285 foreach ( (array) $topics as $post ) {
1286 echo sprintf( __( '%s - %s', 'bbpress' ), bbp_get_topic_id( $post->ID ), bbp_get_topic_title( $post->ID ) ) . "\n";
1287 }
1288 }
1289 die();
1290 }
1291
1292 /** About *****************************************************************/
1293
1294 /**
1295 * Output the about screen
1296 *
1297 * @since bbPress (r4159)
1298 */
1299 public function about_screen() {
1300
1301 list( $display_version ) = explode( '-', bbp_get_version() ); ?>
1302
1303 <div class="wrap about-wrap">
1304 <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
1305 <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div>
1306 <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
1307
1308 <h2 class="nav-tab-wrapper">
1309 <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>">
1310 <?php _e( 'What&#8217;s New' ); ?>
1311 </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>">
1312 <?php _e( 'Credits' ); ?>
1313 </a>
1314 </h2>
1315
1316 <div class="changelog">
1317 <h3><?php _e( 'In-depth User Profiles', 'bbpress' ); ?></h3>
1318
1319 <div class="feature-section">
1320 <h4><?php _e( 'User Details', 'bbpress' ); ?></h4>
1321 <p><?php _e( 'Forum profiles include the details of your forum activity, including your topics and replies, subscriptions, and favorites.', 'bbpress' ); ?></p>
1322
1323 <h4><?php _e( 'Easy Updating', 'bbpress' ); ?></h4>
1324 <p><?php _e( 'You can easily update your profile without leaving bbPress.', 'bbpress' ); ?></p>
1325 </div>
1326 </div>
1327
1328 <div class="changelog">
1329 <h3><?php _e( 'Theme Compatability', 'bbpress' ); ?></h3>
1330
1331 <div class="feature-section">
1332 <h4><?php _e( 'Twenty Twelve', 'bbpress' ); ?></h4>
1333 <p><?php _e( 'Updated default templates are now Twenty Twelve compatible, and we refreshed our CSS to better integrate with other popular themes, too.', 'bbpress' ); ?></p>
1334 </div>
1335 </div>
1336
1337 <div class="changelog">
1338 <h3><?php _e( 'Improved User Management', 'bbpress' ); ?></h3>
1339
1340 <div class="feature-section">
1341 <h4><?php _e( 'Dynamic User Roles and Capabilities', 'bbpress' ); ?></h4>
1342 <p><?php _e( 'bbPress now includes some fancy user-roles with smart default capabilities to help you manage your forums. New roles include Key Master (for complete administrative access), Moderator, and Participant for regular forum users.', 'bbpress' ); ?></p>
1343
1344 <h4><?php _e( 'Manage Forum Users from WordPress', 'bbpress' ); ?></h4>
1345 <p><?php _e( 'You can assign Forums roles to users individually, or bulk update them from the WordPress Users page. Users automatically start out as forum participants.', 'bbpress' ); ?></p>
1346 </div>
1347 </div>
1348
1349 <div class="changelog">
1350 <h3><?php _e( 'Better BuddyPress Integration', 'bbpress' ); ?></h3>
1351
1352 <div class="feature-section">
1353 <h4><?php _e( 'Use bbPress for Your BuddyPress Group Forums', 'bbpress' ); ?></h4>
1354 <p><?php _e( 'You can now use bbPress to manage your BuddyPress Group Forums, allowing for seamless integration and improved plugin performance. Plugins developed for bbPress can now be extended to improve the BuddyPress Group Forums experience.', 'bbpress' ); ?></p>
1355
1356 <h4><?php _e( 'Activity Stream Syncing', 'bbpress' ); ?></h4>
1357 <p><?php _e( 'bbPress now keeps track of changes to topics and replies and keeps their corresponding BuddyPress Activity Stream updates synced.', 'bbpress' ); ?></p>
1358 </div>
1359 </div>
1360
1361 <div class="changelog">
1362 <h3><?php _e( 'Under the Hood', 'bbpress' ); ?></h3>
1363
1364 <div class="feature-section three-col">
1365 <div>
1366 <h4><?php _e( 'Template Logic', 'bbpress' ); ?></h4>
1367 <p><?php _e( 'New functions and template stacks are in place to help plugin developers extend bbPress further.', 'bbpress' ); ?></p>
1368
1369 <h4><?php _e( 'Plugin Directory Structure', 'bbpress' ); ?></h4>
1370 <p><?php _e( 'We simplified the bbPress plugin directory structure, making it easier for plugin developers to find the relevant code.', 'bbpress' ); ?></p>
1371 </div>
1372
1373 <div>
1374 <h4><?php _e( 'Autocomplete', 'bbpress' ); ?></h4>
1375 <p><?php _e( 'In WordPress Admin, you now select a parent forum or topic via autocomplete rather than a dropdown.', 'bbpress' ); ?></p>
1376
1377 <h4><?php _e( 'Fancy Editor Support', 'bbpress' ); ?></h4>
1378 <p><?php _e( 'We improved our support of the Fancy Editor, giving forum users a better experience.', 'bbpress' ); ?></p>
1379 </div>
1380
1381 <div class="last-feature">
1382 <h4><?php _e( 'WordPress 3.5-ready', 'bbpress' ); ?></h4>
1383 <p><?php _e( 'bbPress 2.2 has been thoroughly tested against the ongoing development of WordPress 3.5.', 'bbpress' ); ?></p>
1384 </div>
1385 </div>
1386 </div>
1387
1388 <div class="return-to-dashboard">
1389 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
1390 </div>
1391
1392 </div>
1393
1394 <?php
1395 }
1396
1397 /**
1398 * Output the credits screen
1399 *
1400 * Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll
1401 * want to leverage api.wordpress.org eventually.
1402 *
1403 * @since bbPress (r4159)
1404 */
1405 public function credits_screen() {
1406
1407 list( $display_version ) = explode( '-', bbp_get_version() ); ?>
1408
1409 <div class="wrap about-wrap">
1410 <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
1411 <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! bbPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div>
1412 <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
1413
1414 <h2 class="nav-tab-wrapper">
1415 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
1416 <?php _e( 'What&#8217;s New' ); ?>
1417 </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
1418 <?php _e( 'Credits' ); ?>
1419 </a>
1420 </h2>
1421
1422 <p class="about-description"><?php _e( 'bbPress is created by a worldwide swarm of busy, busy bees.', 'bbpress' ); ?></p>
1423
1424 <h4 class="wp-people-group"><?php _e( 'Project Leaders', 'bbpress' ); ?></h4>
1425 <ul class="wp-people-group " id="wp-people-group-project-leaders">
1426 <li class="wp-person" id="wp-person-matt">
1427 <a href="http://profiles.wordpress.org/matt"><img src="http://0.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=60" class="gravatar" alt="Matt Mullenweg" /></a>
1428 <a class="web" href="http://profiles.wordpress.org/matt">Matt Mullenweg</a>
1429 <span class="title"><?php _e( 'Founding Developer', 'bbpress' ); ?></span>
1430 </li>
1431 <li class="wp-person" id="wp-person-johnjamesjacoby">
1432 <a href="http://profiles.wordpress.org/johnjamesjacoby"><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=60" class="gravatar" alt="John James Jacoby" /></a>
1433 <a class="web" href="http://profiles.wordpress.org/johnjamesjacoby">John James Jacoby</a>
1434 <span class="title"><?php _e( 'Lead Developer', 'bbpress' ); ?></span>
1435 </li>
1436 </ul>
1437
1438 <h4 class="wp-people-group"><?php _e( 'Contributing Developers', 'bbpress' ); ?></h4>
1439 <ul class="wp-people-group " id="wp-people-group-contributing-developers">
1440 <li class="wp-person" id="wp-person-jmdodd">
1441 <a href="http://profiles.wordpress.org/jmdodd"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Jennifer M. Dodd" /></a>
1442 <a class="web" href="http://profiles.wordpress.org/jmdodd">Jennifer M. Dodd</a>
1443 <span class="title"></span>
1444 </li>
1445 <li class="wp-person" id="wp-person-jaredatch">
1446 <a href="http://profiles.wordpress.org/jaredatch"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Jared Atchison" /></a>
1447 <a class="web" href="http://profiles.wordpress.org/jaredatch">Jared Atchison</a>
1448 <span class="title"></span>
1449 </li>
1450 <li class="wp-person" id="wp-person-gautamgupta">
1451 <a href="http://profiles.wordpress.org/gautamgupta"><img src="http://0.gravatar.com/avatar/b0810422cbe6e4eead4def5ae7a90b34?s=60" class="gravatar" alt="Gautam Gupta" /></a>
1452 <a class="web" href="http://profiles.wordpress.org/gautamgupta">Gautam Gupta</a>
1453 <span class="title"></span>
1454 </li>
1455 </ul>
1456
1457 <h4 class="wp-people-group"><?php _e( 'Codex Rockstars', 'bbpress' ); ?></h4>
1458 <ul class="wp-people-group " id="wp-people-group-codex-rockstars">
1459 <li class="wp-person" id="wp-person-masonjames">
1460 <a href="http://profiles.wordpress.org/masonjames"><img src="http://0.gravatar.com/avatar/99dee4d5287d0f9e26ff72e7228d97ac?s=60" class="gravatar" alt="Mason James" /></a>
1461 <a class="web" href="http://profiles.wordpress.org/masonjames">Mason James</a>
1462 <span class="title"></span>
1463 </li>
1464 <li class="wp-person" id="wp-person-wordsforwp">
1465 <a href="http://profiles.wordpress.org/wordsforwp"><img src="http://0.gravatar.com/avatar/5437119b446adad1af813c44944e6c9c?s=60" class="gravatar" alt="Siobhan McKeown" /></a>
1466 <a class="web" href="http://profiles.wordpress.org/wordsforwp">Siobhan McKeown</a>
1467 <span class="title"></span>
1468 </li>
1469 <li class="wp-person" id="wp-person-JarretC">
1470 <a href="http://profiles.wordpress.org/JarretC"><img src="http://0.gravatar.com/avatar/e00501bf782b42d5db19ff75fca14f6a?s=60" class="gravatar" alt="Jarret Cade" /></a>
1471 <a class="web" href="http://profiles.wordpress.org/JarretC">Jarret Cade</a>
1472 <span class="title"></span>
1473 </li>
1474 </ul>
1475
1476 <h4 class="wp-people-group"><?php _e( 'Core Contributors to bbPress 2.2', 'bbpress' ); ?></h4>
1477 <p class="wp-credits-list">
1478 <a href="http://profiles.wordpress.org/alexvorn2">alexvorn2</a>,
1479 <a href="http://profiles.wordpress.org/anointed">anointed</a>,
1480 <a href="http://profiles.wordpress.org/boonebgorges">boonebgorges</a>,
1481 <a href="http://profiles.wordpress.org/chexee">chexee</a>,
1482 <a href="http://profiles.wordpress.org/cnorris23">cnorris23</a>,
1483 <a href="http://profiles.wordpress.org/DanielJuhl">DanielJuhl</a>,
1484 <a href="http://profiles.wordpress.org/daveshine">daveshine</a>,
1485 <a href="http://profiles.wordpress.org/dimadin">dimadin</a>,
1486 <a href="http://profiles.wordpress.org/DJPaul">DJPaul</a>,
1487 <a href="http://profiles.wordpress.org/duck_">duck_</a>,
1488 <a href="http://profiles.wordpress.org/gawain">gawain</a>,
1489 <a href="http://profiles.wordpress.org/iamzippy">iamzippy</a>,
1490 <a href="http://profiles.wordpress.org/isaacchapman">isaacchapman</a>,
1491 <a href="http://profiles.wordpress.org/jane">jane</a>,
1492 <a href="http://profiles.wordpress.org/jkudish">jkudish</a>,
1493 <a href="http://profiles.wordpress.org/mamaduka">mamaduka</a>,
1494 <a href="http://profiles.wordpress.org/mercime">mercime</a>,
1495 <a href="http://profiles.wordpress.org/mesayre">mesayre</a>,
1496 <a href="http://profiles.wordpress.org/mordauk">mordauk</a>,
1497 <a href="http://profiles.wordpress.org/MZAWeb">MZAWeb</a>,
1498 <a href="http://profiles.wordpress.org/netweb">netweb</a>,
1499 <a href="http://profiles.wordpress.org/nexia">nexia</a>,
1500 <a href="http://profiles.wordpress.org/Omicron7">Omicron7</a>,
1501 <a href="http://profiles.wordpress.org/otto42">otto42</a>,
1502 <a href="http://profiles.wordpress.org/pavelevap">pavelevap</a>,
1503 <a href="http://profiles.wordpress.org/plescheff">plescheff</a>,
1504 <a href="http://profiles.wordpress.org/scribu">scribu</a>,
1505 <a href="http://profiles.wordpress.org/sorich87">sorich87</a>,
1506 <a href="http://profiles.wordpress.org/SteveAtty">SteveAtty</a>,
1507 <a href="http://profiles.wordpress.org/tmoorewp">tmoorewp</a>,
1508 <a href="http://profiles.wordpress.org/tott">tott</a>,
1509 <a href="http://profiles.wordpress.org/tungdo">tungdo</a>,
1510 <a href="http://profiles.wordpress.org/vibol">vibol</a>,
1511 <a href="http://profiles.wordpress.org/wonderboymusic">wonderboymusic</a>,
1512 <a href="http://profiles.wordpress.org/westi">westi</a>,
1513 <a href="http://profiles.wordpress.org/xiosen">xiosen</a>,
1514 </p>
1515
1516 <div class="return-to-dashboard">
1517 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
1518 </div>
1519
1520 </div>
1521
1522 <?php
1523 }
1524
1525 /** Updaters **************************************************************/
1526
1527 /**
1528 * Update all bbPress forums across all sites
1529 *
1530 * @since bbPress (r3689)
1531 *
1532 * @global WPDB $wpdb
1533 * @uses get_blog_option()
1534 * @uses wp_remote_get()
1535 */
1536 public static function update_screen() {
1537
1538 // Get action
1539 $action = isset( $_GET['action'] ) ? $_GET['action'] : ''; ?>
1540
1541 <div class="wrap">
1542 <div id="icon-edit" class="icon32 icon32-posts-topic"><br /></div>
1543 <h2><?php _e( 'Update Forum', 'bbpress' ); ?></h2>
1544
1545 <?php
1546
1547 // Taking action
1548 switch ( $action ) {
1549 case 'bbp-update' :
1550
1551 // Run the full updater
1552 bbp_version_updater(); ?>
1553
1554 <p><?php _e( 'All done!', 'bbpress' ); ?></p>
1555 <a class="button" href="index.php?page=bbp-update"><?php _e( 'Go Back', 'bbpress' ); ?></a>
1556
1557 <?php
1558
1559 break;
1560
1561 case 'show' :
1562 default : ?>
1563
1564 <p><?php _e( 'You can update your forum through this page. Hit the link below to update.', 'bbpress' ); ?></p>
1565 <p><a class="button" href="index.php?page=bbp-update&amp;action=bbp-update"><?php _e( 'Update Forum', 'bbpress' ); ?></a></p>
1566
1567 <?php break;
1568
1569 } ?>
1570
1571 </div><?php
1572 }
1573
1574 /**
1575 * Update all bbPress forums across all sites
1576 *
1577 * @since bbPress (r3689)
1578 *
1579 * @global WPDB $wpdb
1580 * @uses get_blog_option()
1581 * @uses wp_remote_get()
1582 */
1583 public static function network_update_screen() {
1584 global $wpdb;
1585
1586 // Get action
1587 $action = isset( $_GET['action'] ) ? $_GET['action'] : ''; ?>
1588
1589 <div class="wrap">
1590 <div id="icon-edit" class="icon32 icon32-posts-topic"><br /></div>
1591 <h2><?php _e( 'Update Forums', 'bbpress' ); ?></h2>
1592
1593 <?php
1594
1595 // Taking action
1596 switch ( $action ) {
1597 case 'bbpress-update' :
1598
1599 // Site counter
1600 $n = isset( $_GET['n'] ) ? intval( $_GET['n'] ) : 0;
1601
1602 // Get blogs 5 at a time
1603 $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
1604
1605 // No blogs so all done!
1606 if ( empty( $blogs ) ) : ?>
1607
1608 <p><?php _e( 'All done!', 'bbpress' ); ?></p>
1609 <a class="button" href="update-core.php?page=bbpress-update"><?php _e( 'Go Back', 'bbpress' ); ?></a>
1610
1611 <?php break; ?>
1612
1613 <?php
1614
1615 // Still have sites to loop through
1616 else : ?>
1617
1618 <ul>
1619
1620 <?php foreach ( (array) $blogs as $details ) :
1621
1622 $siteurl = get_blog_option( $details['blog_id'], 'siteurl' ); ?>
1623
1624 <li><?php echo $siteurl; ?></li>
1625
1626 <?php
1627
1628 // Get the response of the bbPress update on this site
1629 $response = wp_remote_get(
1630 trailingslashit( $siteurl ) . 'wp-admin/index.php?page=bbp-update&action=bbp-update',
1631 array( 'timeout' => 30, 'httpversion' => '1.1' )
1632 );
1633
1634 // Site errored out, no response?
1635 if ( is_wp_error( $response ) )
1636 wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: <em>%2$s</em>', 'bbpress' ), $siteurl, $response->get_error_message() ) );
1637
1638 // Switch to the new blog
1639 switch_to_blog( $details[ 'blog_id' ] );
1640
1641 $basename = bbpress()->basename;
1642
1643 // Run the updater on this site
1644 if ( is_plugin_active_for_network( $basename ) || is_plugin_active( $basename ) ) {
1645 bbp_version_updater();
1646 }
1647
1648 // restore original blog
1649 restore_current_blog();
1650
1651 // Do some actions to allow plugins to do things too
1652 do_action( 'after_bbpress_upgrade', $response );
1653 do_action( 'bbp_upgrade_site', $details[ 'blog_id' ] );
1654
1655 endforeach; ?>
1656
1657 </ul>
1658
1659 <p>
1660 <?php _e( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:', 'bbpress' ); ?>
1661 <a class="button" href="update-core.php?page=bbpress-update&amp;action=bbpress-update&amp;n=<?php echo ( $n + 5 ); ?>"><?php _e( 'Next Forums', 'bbpress' ); ?></a>
1662 </p>
1663 <script type='text/javascript'>
1664 <!--
1665 function nextpage() {
1666 location.href = 'update-core.php?page=bbpress-update&action=bbpress-update&n=<?php echo ( $n + 5 ) ?>';
1667 }
1668 setTimeout( 'nextpage()', 250 );
1669 //-->
1670 </script><?php
1671
1672 endif;
1673
1674 break;
1675
1676 case 'show' :
1677 default : ?>
1678
1679 <p><?php _e( 'You can update all the forums on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update.', 'bbpress' ); ?></p>
1680 <p><a class="button" href="update-core.php?page=bbpress-update&amp;action=bbpress-update"><?php _e( 'Update Forums', 'bbpress' ); ?></a></p>
1681
1682 <?php break;
1683
1684 } ?>
1685
1686 </div><?php
1687 }
1688 }
1689 endif; // class_exists check
1690
1691 /**
1692 * Setup bbPress Admin
1693 *
1694 * @since bbPress (r2596)
1695 *
1696 * @uses BBP_Admin
1697 */
1698 function bbp_admin() {
1699 bbpress()->admin = new BBP_Admin();
1700
1701 bbpress()->admin->converter = new BBP_Converter();
1702 }
1703