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

1,695 lines 55.3 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 <script type="text/javascript">
537 jQuery(document).ready(function() {
538
539 var bbp_topic_id = jQuery( '#bbp_topic_id' );
540
541 bbp_topic_id.suggest( ajaxurl + '?action=bbp_suggest_topic', {
542 onSelect: function() {
543 var value = this.value;
544 bbp_topic_id.val( value.substr( 0, value.indexOf( ' ' ) ) );
545 }
546 } );
547 });
548 </script>
549
550 <style type="text/css" media="screen">
551 /*<![CDATA[*/
552
553 /* Kludge for too-wide forums dropdown */
554 #poststuff #bbp_forum_attributes select#parent_id,
555 #poststuff #bbp_topic_attributes select#parent_id,
556 #poststuff #bbp_reply_attributes select#bbp_forum_id {
557 max-width: 170px;
558 }
559
560 /* Version Badge */
561
562 .bbp-badge {
563 padding-top: 142px;
564 height: 50px;
565 width: 173px;
566 color: #fafafa;
567 font-weight: bold;
568 font-size: 14px;
569 text-align: center;
570 margin: 0 -5px;
571 background: url('<?php echo $badge_url; ?>') no-repeat;
572 }
573
574 .about-wrap .bbp-badge {
575 position: absolute;
576 top: 0;
577 right: 0;
578 }
579
580 #bbp-dashboard-right-now p.sub,
581 #bbp-dashboard-right-now .table,
582 #bbp-dashboard-right-now .versions {
583 margin: -12px;
584 }
585
586 #bbp-dashboard-right-now .inside {
587 font-size: 12px;
588 padding-top: 20px;
589 margin-bottom: 0;
590 }
591
592 #bbp-dashboard-right-now p.sub {
593 padding: 5px 0 15px;
594 color: #8f8f8f;
595 font-size: 14px;
596 position: absolute;
597 top: -17px;
598 left: 15px;
599 }
600 body.rtl #bbp-dashboard-right-now p.sub {
601 right: 15px;
602 left: 0;
603 }
604
605 #bbp-dashboard-right-now .table {
606 margin: 0;
607 padding: 0;
608 position: relative;
609 }
610
611 #bbp-dashboard-right-now .table_content {
612 float: left;
613 border-top: #ececec 1px solid;
614 width: 45%;
615 }
616 body.rtl #bbp-dashboard-right-now .table_content {
617 float: right;
618 }
619
620 #bbp-dashboard-right-now .table_discussion {
621 float: right;
622 border-top: #ececec 1px solid;
623 width: 45%;
624 }
625 body.rtl #bbp-dashboard-right-now .table_discussion {
626 float: left;
627 }
628
629 #bbp-dashboard-right-now table td {
630 padding: 3px 0;
631 white-space: nowrap;
632 }
633
634 #bbp-dashboard-right-now table tr.first td {
635 border-top: none;
636 }
637
638 #bbp-dashboard-right-now td.b {
639 padding-right: 6px;
640 text-align: right;
641 font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
642 font-size: 14px;
643 width: 1%;
644 }
645 body.rtl #bbp-dashboard-right-now td.b {
646 padding-left: 6px;
647 padding-right: 0;
648 }
649
650 #bbp-dashboard-right-now td.b a {
651 font-size: 18px;
652 }
653
654 #bbp-dashboard-right-now td.b a:hover {
655 color: #d54e21;
656 }
657
658 #bbp-dashboard-right-now .t {
659 font-size: 12px;
660 padding-right: 12px;
661 padding-top: 6px;
662 color: #777;
663 }
664 body.rtl #bbp-dashboard-right-now .t {
665 padding-left: 12px;
666 padding-right: 0;
667 }
668
669 #bbp-dashboard-right-now .t a {
670 white-space: nowrap;
671 }
672
673 #bbp-dashboard-right-now .spam {
674 color: red;
675 }
676
677 #bbp-dashboard-right-now .waiting {
678 color: #e66f00;
679 }
680
681 #bbp-dashboard-right-now .approved {
682 color: green;
683 }
684
685 #bbp-dashboard-right-now .versions {
686 padding: 6px 10px 12px;
687 clear: both;
688 }
689
690 #bbp-dashboard-right-now .versions .b {
691 font-weight: bold;
692 }
693
694 #bbp-dashboard-right-now a.button {
695 float: right;
696 clear: right;
697 position: relative;
698 top: -5px;
699 }
700 body.rtl #bbp-dashboard-right-now a.button {
701 float: left;
702 clear: left;
703 }
704
705 /* Icon 32 */
706 #icon-edit.icon32-posts-<?php echo $forum_class; ?>,
707 #icon-edit.icon32-posts-<?php echo $topic_class; ?>,
708 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
709 background: url('<?php echo $icon32_url; ?>');
710 background-repeat: no-repeat;
711 }
712
713 /* Icon Positions */
714 #icon-edit.icon32-posts-<?php echo $forum_class; ?> {
715 background-position: -4px 0px;
716 }
717
718 #icon-edit.icon32-posts-<?php echo $topic_class; ?> {
719 background-position: -4px -90px;
720 }
721
722 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
723 background-position: -4px -180px;
724 }
725
726 /* Icon 32 2x */
727 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
728 #icon-edit.icon32-posts-<?php echo $forum_class; ?>,
729 #icon-edit.icon32-posts-<?php echo $topic_class; ?>,
730 #icon-edit.icon32-posts-<?php echo $reply_class; ?> {
731 background-image: url('<?php echo $icon32_url_2x; ?>');
732 background-size: 45px 255px;
733 }
734 }
735
736 /* Menu */
737 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image,
738 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image,
739 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image,
740
741 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
742 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
743 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
744
745 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
746 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
747 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
748 background: url('<?php echo $menu_icon_url; ?>');
749 background-repeat: no-repeat;
750 }
751
752 /* Menu Positions */
753 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image {
754 background-position: 0px -32px;
755 }
756 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
757 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image {
758 background-position: 0px 0px;
759 }
760 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image {
761 background-position: -70px -32px;
762 }
763 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
764 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image {
765 background-position: -70px 0px;
766 }
767 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image {
768 background-position: -35px -32px;
769 }
770 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
771 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
772 background-position: -35px 0px;
773 }
774
775 /* Menu 2x */
776 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
777 #menu-posts-<?php echo $forum_class; ?> .wp-menu-image,
778 #menu-posts-<?php echo $topic_class; ?> .wp-menu-image,
779 #menu-posts-<?php echo $reply_class; ?> .wp-menu-image,
780
781 #menu-posts-<?php echo $forum_class; ?>:hover .wp-menu-image,
782 #menu-posts-<?php echo $topic_class; ?>:hover .wp-menu-image,
783 #menu-posts-<?php echo $reply_class; ?>:hover .wp-menu-image,
784
785 #menu-posts-<?php echo $forum_class; ?>.wp-has-current-submenu .wp-menu-image,
786 #menu-posts-<?php echo $topic_class; ?>.wp-has-current-submenu .wp-menu-image,
787 #menu-posts-<?php echo $reply_class; ?>.wp-has-current-submenu .wp-menu-image {
788 background-image: url('<?php echo $menu_icon_url_2x; ?>');
789 background-size: 100px 64px;
790 }
791
792 .bbp-badge {
793 background-image: url('<?php echo $badge_url_2x; ?>');
794 background-size: 173px 194px;
795 }
796 }
797
798 <?php if ( 'bbpress' == get_user_option( 'admin_color' ) ) : ?>
799
800 /* Green Scheme Images */
801
802 .post-com-count {
803 background-image: url('<?php echo $wp_admin_url; ?>bubble_bg.gif');
804 }
805
806 .button,
807 .submit input,
808 .button-secondary {
809 background-image: url('<?php echo $wp_admin_url; ?>white-grad.png');
810 }
811
812 .button:active,
813 .submit input:active,
814 .button-secondary:active {
815 background-image: url('<?php echo $wp_admin_url; ?>white-grad-active.png');
816 }
817
818 .curtime #timestamp {
819 background-image: url('<?php echo $wp_admin_url; ?>date-button.gif');
820 }
821
822 .tagchecklist span a,
823 #bulk-titles div a {
824 background-image: url('<?php echo $wp_admin_url; ?>xit.gif');
825 }
826
827 .tagchecklist span a:hover,
828 #bulk-titles div a:hover {
829 background-image: url('<?php echo $wp_admin_url; ?>xit.gif');
830 }
831 #screen-meta-links a.show-settings {
832 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
833 }
834
835 #screen-meta-links a.show-settings.screen-meta-active {
836 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
837 }
838
839 #adminmenushadow,
840 #adminmenuback {
841 background-image: url('<?php echo $wp_admin_url; ?>menu-shadow.png');
842 }
843
844 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
845 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
846 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
847 }
848
849 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
850 #adminmenu .wp-menu-open .wp-menu-toggle {
851 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
852 }
853
854 #collapse-button div {
855 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
856 }
857
858 /* menu and screen icons */
859 .icon16.icon-dashboard,
860 #adminmenu .menu-icon-dashboard div.wp-menu-image {
861 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
862 }
863
864 #adminmenu .menu-icon-dashboard:hover div.wp-menu-image,
865 #adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,
866 #adminmenu .menu-icon-dashboard.current div.wp-menu-image {
867 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
868 }
869
870 .icon16.icon-post,
871 #adminmenu .menu-icon-post div.wp-menu-image {
872 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
873 }
874
875 #adminmenu .menu-icon-post:hover div.wp-menu-image,
876 #adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image {
877 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
878 }
879
880 .icon16.icon-media,
881 #adminmenu .menu-icon-media div.wp-menu-image {
882 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
883 }
884
885 #adminmenu .menu-icon-media:hover div.wp-menu-image,
886 #adminmenu .menu-icon-media.wp-has-current-submenu div.wp-menu-image {
887 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
888 }
889
890 .icon16.icon-links,
891 #adminmenu .menu-icon-links div.wp-menu-image {
892 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
893 }
894
895 #adminmenu .menu-icon-links:hover div.wp-menu-image,
896 #adminmenu .menu-icon-links.wp-has-current-submenu div.wp-menu-image {
897 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
898 }
899
900 .icon16.icon-page,
901 #adminmenu .menu-icon-page div.wp-menu-image {
902 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
903 }
904
905 #adminmenu .menu-icon-page:hover div.wp-menu-image,
906 #adminmenu .menu-icon-page.wp-has-current-submenu div.wp-menu-image {
907 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
908 }
909
910 .icon16.icon-comments,
911 #adminmenu .menu-icon-comments div.wp-menu-image {
912 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
913 }
914
915 #adminmenu .menu-icon-comments:hover div.wp-menu-image,
916 #adminmenu .menu-icon-comments.wp-has-current-submenu div.wp-menu-image,
917 #adminmenu .menu-icon-comments.current div.wp-menu-image {
918 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
919 }
920
921 .icon16.icon-appearance,
922 #adminmenu .menu-icon-appearance div.wp-menu-image {
923 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
924 }
925
926 #adminmenu .menu-icon-appearance:hover div.wp-menu-image,
927 #adminmenu .menu-icon-appearance.wp-has-current-submenu div.wp-menu-image {
928 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
929 }
930
931 .icon16.icon-plugins,
932 #adminmenu .menu-icon-plugins div.wp-menu-image {
933 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
934 }
935
936 #adminmenu .menu-icon-plugins:hover div.wp-menu-image,
937 #adminmenu .menu-icon-plugins.wp-has-current-submenu div.wp-menu-image {
938 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
939 }
940
941 .icon16.icon-users,
942 #adminmenu .menu-icon-users div.wp-menu-image {
943 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
944 }
945
946 #adminmenu .menu-icon-users:hover div.wp-menu-image,
947 #adminmenu .menu-icon-users.wp-has-current-submenu div.wp-menu-image,
948 #adminmenu .menu-icon-users.current div.wp-menu-image {
949 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
950 }
951
952 .icon16.icon-tools,
953 #adminmenu .menu-icon-tools div.wp-menu-image {
954 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
955 }
956
957 #adminmenu .menu-icon-tools:hover div.wp-menu-image,
958 #adminmenu .menu-icon-tools.wp-has-current-submenu div.wp-menu-image,
959 #adminmenu .menu-icon-tools.current div.wp-menu-image {
960 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
961 }
962
963 .icon16.icon-settings,
964 #adminmenu .menu-icon-settings div.wp-menu-image {
965 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
966 }
967
968 #adminmenu .menu-icon-settings:hover div.wp-menu-image,
969 #adminmenu .menu-icon-settings.wp-has-current-submenu div.wp-menu-image {
970 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
971 }
972
973 .icon16.icon-site,
974 #adminmenu .menu-icon-site div.wp-menu-image {
975 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
976 }
977
978 #adminmenu .menu-icon-site:hover div.wp-menu-image,
979 #adminmenu .menu-icon-site.wp-has-current-submenu div.wp-menu-image {
980 background-image: url('<?php echo $wp_admin_url; ?>menu.png?ver=20100531');
981 }
982 /* end menu and screen icons */
983
984 /* Screen Icons */
985 .icon32.icon-post,
986 #icon-edit,
987 #icon-post {
988 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
989 }
990
991 .icon32.icon-dashboard,
992 #icon-index {
993 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
994 }
995
996 .icon32.icon-media,
997 #icon-upload {
998 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
999 }
1000
1001 .icon32.icon-links,
1002 #icon-link-manager,
1003 #icon-link,
1004 #icon-link-category {
1005 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1006 }
1007
1008 .icon32.icon-page,
1009 #icon-edit-pages,
1010 #icon-page {
1011 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1012 }
1013
1014 .icon32.icon-comments,
1015 #icon-edit-comments {
1016 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1017 }
1018
1019 .icon32.icon-appearance,
1020 #icon-themes {
1021 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1022 }
1023
1024 .icon32.icon-plugins,
1025 #icon-plugins {
1026 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1027 }
1028
1029 .icon32.icon-users,
1030 #icon-users,
1031 #icon-profile,
1032 #icon-user-edit {
1033 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1034 }
1035
1036 .icon32.icon-tools,
1037 #icon-tools,
1038 #icon-admin {
1039 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1040 }
1041
1042 .icon32.icon-settings,
1043 #icon-options-general {
1044 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1045 }
1046
1047 .icon32.icon-site,
1048 #icon-ms-admin {
1049 background-image: url('<?php echo $wp_admin_url; ?>icons32.png?ver=20100531');
1050 }
1051 /* end screen icons */
1052
1053 .meta-box-sortables .postbox:hover .handlediv {
1054 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1055 }
1056
1057 .tablenav .tablenav-pages a {
1058 background-image: url('<?php echo $wp_admin_url; ?>menu-bits.gif?ver=20100610');
1059 }
1060
1061 .view-switch #view-switch-list {
1062 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1063 }
1064
1065 .view-switch .current #view-switch-list {
1066 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1067 }
1068
1069 .view-switch #view-switch-excerpt {
1070 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1071 }
1072
1073 .view-switch .current #view-switch-excerpt {
1074 background-image: url('<?php echo $wp_admin_url; ?>list.png');
1075 }
1076
1077 #header-logo {
1078 background-image: url('<?php echo $wp_admin_url; ?>wp-logo.png?ver=20110504');
1079 }
1080
1081 .sidebar-name-arrow {
1082 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1083 }
1084
1085 .sidebar-name:hover .sidebar-name-arrow {
1086 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1087 }
1088
1089 .item-edit {
1090 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1091 }
1092
1093 .item-edit:hover {
1094 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1095 }
1096
1097 .wp-badge {
1098 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png');
1099 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -ms-linear-gradient(top, #378aac, #165d84); /* IE10 */
1100 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -moz-linear-gradient(top, #378aac, #165d84); /* Firefox */
1101 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -o-linear-gradient(top, #378aac, #165d84); /* Opera */
1102 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -webkit-gradient(linear, left top, left bottom, from(#378aac), to(#165d84)); /* old Webkit */
1103 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), -webkit-linear-gradient(top, #378aac, #165d84); /* new Webkit */
1104 background-image: url('<?php echo $wp_admin_url; ?>wp-badge.png'), linear-gradient(top, #378aac, #165d84); /* proposed W3C Markup */
1105 }
1106
1107 .rtl .post-com-count {
1108 background-image: url('<?php echo $wp_admin_url; ?>bubble_bg-rtl.gif');
1109 }
1110
1111 /* Menu */
1112 .rtl #adminmenushadow,
1113 .rtl #adminmenuback {
1114 background-image: url('<?php echo $wp_admin_url; ?>menu-shadow-rtl.png');
1115 }
1116
1117 .rtl #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
1118 .rtl #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
1119 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1120 }
1121
1122 .rtl #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
1123 .rtl #adminmenu .wp-menu-open .wp-menu-toggle {
1124 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1125 }
1126
1127 .rtl .meta-box-sortables .postbox:hover .handlediv {
1128 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1129 }
1130
1131 .rtl .tablenav .tablenav-pages a {
1132 background-image: url('<?php echo $wp_admin_url; ?>menu-bits-rtl.gif?ver=20100610');
1133 }
1134
1135 .rtl .sidebar-name-arrow {
1136 background-image: url('<?php echo $wp_admin_url; ?>arrows.png');
1137 }
1138
1139 .rtl .sidebar-name:hover .sidebar-name-arrow {
1140 background-image: url('<?php echo $wp_admin_url; ?>arrows-dark.png');
1141 }
1142
1143 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
1144 .icon32.icon-post,
1145 #icon-edit,
1146 #icon-post,
1147 .icon32.icon-dashboard,
1148 #icon-index,
1149 .icon32.icon-media,
1150 #icon-upload,
1151 .icon32.icon-links,
1152 #icon-link-manager,
1153 #icon-link,
1154 #icon-link-category,
1155 .icon32.icon-page,
1156 #icon-edit-pages,
1157 #icon-page,
1158 .icon32.icon-comments,
1159 #icon-edit-comments,
1160 .icon32.icon-appearance,
1161 #icon-themes,
1162 .icon32.icon-plugins,
1163 #icon-plugins,
1164 .icon32.icon-users,
1165 #icon-users,
1166 #icon-profile,
1167 #icon-user-edit,
1168 .icon32.icon-tools,
1169 #icon-tools,
1170 #icon-admin,
1171 .icon32.icon-settings,
1172 #icon-options-general,
1173 .icon32.icon-site,
1174 #icon-ms-admin {
1175 background-image: url('<?php echo $wp_admin_url; ?>icons32-2x.png?ver=20120412') !important;
1176 background-size: <?php echo $icon32_size; ?>
1177 }
1178
1179 .icon16.icon-dashboard,
1180 .menu-icon-dashboard div.wp-menu-image,
1181 .icon16.icon-post,
1182 .menu-icon-post div.wp-menu-image,
1183 .icon16.icon-media,
1184 .menu-icon-media div.wp-menu-image,
1185 .icon16.icon-links,
1186 .menu-icon-links div.wp-menu-image,
1187 .icon16.icon-page,
1188 .menu-icon-page div.wp-menu-image,
1189 .icon16.icon-comments,
1190 .menu-icon-comments div.wp-menu-image,
1191 .icon16.icon-appearance,
1192 .menu-icon-appearance div.wp-menu-image,
1193 .icon16.icon-plugins,
1194 .menu-icon-plugins div.wp-menu-image,
1195 .icon16.icon-users,
1196 .menu-icon-users div.wp-menu-image,
1197 .icon16.icon-tools,
1198 .menu-icon-tools div.wp-menu-image,
1199 .icon16.icon-settings,
1200 .menu-icon-settings div.wp-menu-image,
1201 .icon16.icon-site,
1202 .menu-icon-site div.wp-menu-image {
1203 background-image: url('<?php echo $wp_admin_url; ?>menu-2x.png?ver=20120412') !important;
1204 background-size: 390px 64px;
1205 }
1206 }
1207 <?php endif; ?>
1208
1209 /*]]>*/
1210 </style>
1211
1212 <?php
1213 }
1214
1215 /**
1216 * Registers the bbPress admin color scheme
1217 *
1218 * Because wp-content can exist outside of the WordPress root there is no
1219 * way to be certain what the relative path of the admin images is.
1220 * We are including the two most common configurations here, just in case.
1221 *
1222 * @since bbPress (r2521)
1223 *
1224 * @uses wp_admin_css_color() To register the color scheme
1225 */
1226 public function register_admin_style () {
1227
1228 // Updated admin color scheme CSS
1229 if ( function_exists( 'wp_enqueue_media' ) ) {
1230 $green_scheme = $this->styles_url . 'green.css';
1231
1232 } else {
1233 $green_scheme = $this->styles_url . 'green-34.css';
1234 }
1235
1236 // Register the green scheme
1237 wp_admin_css_color( 'bbpress', esc_html_x( 'Green', 'admin color scheme', 'bbpress' ), $green_scheme, array( '#222222', '#006600', '#deece1', '#6eb469' ) );
1238 }
1239
1240 /**
1241 * Hide theme compat package selection if only 1 package is registered
1242 *
1243 * @since bbPress (r4315)
1244 *
1245 * @param array $sections Forums settings sections
1246 * @return array
1247 */
1248 public function hide_theme_compat_packages( $sections = array() ) {
1249 if ( count( bbpress()->theme_compat->packages ) <= 1 )
1250 unset( $sections['bbp_settings_theme_compat'] );
1251
1252 return $sections;
1253 }
1254
1255 /** Ajax ******************************************************************/
1256
1257 /**
1258 * Ajax action for facilitating the forum auto-suggest
1259 *
1260 * @since bbPress (r4261)
1261 *
1262 * @uses get_posts()
1263 * @uses bbp_get_topic_post_type()
1264 * @uses bbp_get_topic_id()
1265 * @uses bbp_get_topic_title()
1266 */
1267 public function suggest_topic() {
1268
1269 // TRy to get some topics
1270 $topics = get_posts( array(
1271 's' => like_escape( $_REQUEST['q'] ),
1272 'post_type' => bbp_get_topic_post_type()
1273 ) );
1274
1275 // If we found some topics, loop through and display them
1276 if ( ! empty( $topics ) ) {
1277 foreach ( (array) $topics as $post ) {
1278 echo sprintf( __( '%s - %s', 'bbpress' ), bbp_get_topic_id( $post->ID ), bbp_get_topic_title( $post->ID ) ) . "\n";
1279 }
1280 }
1281 die();
1282 }
1283
1284 /** About *****************************************************************/
1285
1286 /**
1287 * Output the about screen
1288 *
1289 * @since bbPress (r4159)
1290 */
1291 public function about_screen() {
1292
1293 list( $display_version ) = explode( '-', bbp_get_version() ); ?>
1294
1295 <div class="wrap about-wrap">
1296 <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
1297 <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>
1298 <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
1299
1300 <h2 class="nav-tab-wrapper">
1301 <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>">
1302 <?php _e( 'What&#8217;s New' ); ?>
1303 </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>">
1304 <?php _e( 'Credits' ); ?>
1305 </a>
1306 </h2>
1307
1308 <div class="changelog">
1309 <h3><?php _e( 'In-depth User Profiles', 'bbpress' ); ?></h3>
1310
1311 <div class="feature-section">
1312 <h4><?php _e( 'User Details', 'bbpress' ); ?></h4>
1313 <p><?php _e( 'Forum profiles include the details of your forum activity, including your topics and replies, subscriptions, and favorites.', 'bbpress' ); ?></p>
1314
1315 <h4><?php _e( 'Easy Updating', 'bbpress' ); ?></h4>
1316 <p><?php _e( 'You can easily update your profile without leaving bbPress.', 'bbpress' ); ?></p>
1317 </div>
1318 </div>
1319
1320 <div class="changelog">
1321 <h3><?php _e( 'Theme Compatability', 'bbpress' ); ?></h3>
1322
1323 <div class="feature-section">
1324 <h4><?php _e( 'Twenty Twelve', 'bbpress' ); ?></h4>
1325 <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>
1326 </div>
1327 </div>
1328
1329 <div class="changelog">
1330 <h3><?php _e( 'Improved User Management', 'bbpress' ); ?></h3>
1331
1332 <div class="feature-section">
1333 <h4><?php _e( 'Dynamic User Roles and Capabilities', 'bbpress' ); ?></h4>
1334 <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>
1335
1336 <h4><?php _e( 'Manage Forum Users from WordPress', 'bbpress' ); ?></h4>
1337 <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>
1338 </div>
1339 </div>
1340
1341 <div class="changelog">
1342 <h3><?php _e( 'Better BuddyPress Integration', 'bbpress' ); ?></h3>
1343
1344 <div class="feature-section">
1345 <h4><?php _e( 'Use bbPress for Your BuddyPress Group Forums', 'bbpress' ); ?></h4>
1346 <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>
1347
1348 <h4><?php _e( 'Activity Stream Syncing', 'bbpress' ); ?></h4>
1349 <p><?php _e( 'bbPress now keeps track of changes to topics and replies and keeps their corresponding BuddyPress Activity Stream updates synced.', 'bbpress' ); ?></p>
1350 </div>
1351 </div>
1352
1353 <div class="changelog">
1354 <h3><?php _e( 'Under the Hood', 'bbpress' ); ?></h3>
1355
1356 <div class="feature-section three-col">
1357 <div>
1358 <h4><?php _e( 'Template Logic', 'bbpress' ); ?></h4>
1359 <p><?php _e( 'New functions and template stacks are in place to help plugin developers extend bbPress further.', 'bbpress' ); ?></p>
1360
1361 <h4><?php _e( 'Plugin Directory Structure', 'bbpress' ); ?></h4>
1362 <p><?php _e( 'We simplified the bbPress plugin directory structure, making it easier for plugin developers to find the relevant code.', 'bbpress' ); ?></p>
1363 </div>
1364
1365 <div>
1366 <h4><?php _e( 'Autocomplete', 'bbpress' ); ?></h4>
1367 <p><?php _e( 'In WordPress Admin, you now select a parent forum or topic via autocomplete rather than a dropdown.', 'bbpress' ); ?></p>
1368
1369 <h4><?php _e( 'Fancy Editor Support', 'bbpress' ); ?></h4>
1370 <p><?php _e( 'We improved our support of the Fancy Editor, giving forum users a better experience.', 'bbpress' ); ?></p>
1371 </div>
1372
1373 <div class="last-feature">
1374 <h4><?php _e( 'WordPress 3.5-ready', 'bbpress' ); ?></h4>
1375 <p><?php _e( 'bbPress 2.2 has been thoroughly tested against the ongoing development of WordPress 3.5.', 'bbpress' ); ?></p>
1376 </div>
1377 </div>
1378 </div>
1379
1380 <div class="return-to-dashboard">
1381 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
1382 </div>
1383
1384 </div>
1385
1386 <?php
1387 }
1388
1389 /**
1390 * Output the credits screen
1391 *
1392 * Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll
1393 * want to leverage api.wordpress.org eventually.
1394 *
1395 * @since bbPress (r4159)
1396 */
1397 public function credits_screen() {
1398
1399 list( $display_version ) = explode( '-', bbp_get_version() ); ?>
1400
1401 <div class="wrap about-wrap">
1402 <h1><?php printf( __( 'Welcome to bbPress %s' ), $display_version ); ?></h1>
1403 <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>
1404 <div class="bbp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
1405
1406 <h2 class="nav-tab-wrapper">
1407 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
1408 <?php _e( 'What&#8217;s New' ); ?>
1409 </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
1410 <?php _e( 'Credits' ); ?>
1411 </a>
1412 </h2>
1413
1414 <p class="about-description"><?php _e( 'bbPress is created by a worldwide swarm of busy, busy bees.', 'bbpress' ); ?></p>
1415
1416 <h4 class="wp-people-group"><?php _e( 'Project Leaders', 'bbpress' ); ?></h4>
1417 <ul class="wp-people-group " id="wp-people-group-project-leaders">
1418 <li class="wp-person" id="wp-person-matt">
1419 <a href="http://profiles.wordpress.org/matt"><img src="http://0.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=60" class="gravatar" alt="Matt Mullenweg" /></a>
1420 <a class="web" href="http://profiles.wordpress.org/matt">Matt Mullenweg</a>
1421 <span class="title"><?php _e( 'Founding Developer', 'bbpress' ); ?></span>
1422 </li>
1423 <li class="wp-person" id="wp-person-johnjamesjacoby">
1424 <a href="http://profiles.wordpress.org/johnjamesjacoby"><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=60" class="gravatar" alt="John James Jacoby" /></a>
1425 <a class="web" href="http://profiles.wordpress.org/johnjamesjacoby">John James Jacoby</a>
1426 <span class="title"><?php _e( 'Lead Developer', 'bbpress' ); ?></span>
1427 </li>
1428 </ul>
1429
1430 <h4 class="wp-people-group"><?php _e( 'Contributing Developers', 'bbpress' ); ?></h4>
1431 <ul class="wp-people-group " id="wp-people-group-contributing-developers">
1432 <li class="wp-person" id="wp-person-jmdodd">
1433 <a href="http://profiles.wordpress.org/jmdodd"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Jennifer M. Dodd" /></a>
1434 <a class="web" href="http://profiles.wordpress.org/jmdodd">Jennifer M. Dodd</a>
1435 <span class="title"></span>
1436 </li>
1437 <li class="wp-person" id="wp-person-jaredatch">
1438 <a href="http://profiles.wordpress.org/jaredatch"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Jared Atchison" /></a>
1439 <a class="web" href="http://profiles.wordpress.org/jaredatch">Jared Atchison</a>
1440 <span class="title"></span>
1441 </li>
1442 <li class="wp-person" id="wp-person-gautamgupta">
1443 <a href="http://profiles.wordpress.org/gautamgupta"><img src="http://0.gravatar.com/avatar/b0810422cbe6e4eead4def5ae7a90b34?s=60" class="gravatar" alt="Gautam Gupta" /></a>
1444 <a class="web" href="http://profiles.wordpress.org/gautamgupta">Gautam Gupta</a>
1445 <span class="title"></span>
1446 </li>
1447 </ul>
1448
1449 <h4 class="wp-people-group"><?php _e( 'Codex Rockstars', 'bbpress' ); ?></h4>
1450 <ul class="wp-people-group " id="wp-people-group-codex-rockstars">
1451 <li class="wp-person" id="wp-person-masonjames">
1452 <a href="http://profiles.wordpress.org/masonjames"><img src="http://0.gravatar.com/avatar/99dee4d5287d0f9e26ff72e7228d97ac?s=60" class="gravatar" alt="Mason James" /></a>
1453 <a class="web" href="http://profiles.wordpress.org/masonjames">Mason James</a>
1454 <span class="title"></span>
1455 </li>
1456 <li class="wp-person" id="wp-person-wordsforwp">
1457 <a href="http://profiles.wordpress.org/wordsforwp"><img src="http://0.gravatar.com/avatar/5437119b446adad1af813c44944e6c9c?s=60" class="gravatar" alt="Siobhan McKeown" /></a>
1458 <a class="web" href="http://profiles.wordpress.org/wordsforwp">Siobhan McKeown</a>
1459 <span class="title"></span>
1460 </li>
1461 <li class="wp-person" id="wp-person-JarretC">
1462 <a href="http://profiles.wordpress.org/JarretC"><img src="http://0.gravatar.com/avatar/e00501bf782b42d5db19ff75fca14f6a?s=60" class="gravatar" alt="Jarret Cade" /></a>
1463 <a class="web" href="http://profiles.wordpress.org/JarretC">Jarret Cade</a>
1464 <span class="title"></span>
1465 </li>
1466 </ul>
1467
1468 <h4 class="wp-people-group"><?php _e( 'Core Contributors to bbPress 2.2', 'bbpress' ); ?></h4>
1469 <p class="wp-credits-list">
1470 <a href="http://profiles.wordpress.org/alexvorn2">alexvorn2</a>,
1471 <a href="http://profiles.wordpress.org/anointed">anointed</a>,
1472 <a href="http://profiles.wordpress.org/boonebgorges">boonebgorges</a>,
1473 <a href="http://profiles.wordpress.org/chexee">chexee</a>,
1474 <a href="http://profiles.wordpress.org/cnorris23">cnorris23</a>,
1475 <a href="http://profiles.wordpress.org/DanielJuhl">DanielJuhl</a>,
1476 <a href="http://profiles.wordpress.org/DanielJuhl">daveshine</a>,
1477 <a href="http://profiles.wordpress.org/dimadin">dimadin</a>,
1478 <a href="http://profiles.wordpress.org/DJPaul">DJPaul</a>,
1479 <a href="http://profiles.wordpress.org/duck_">duck_</a>,
1480 <a href="http://profiles.wordpress.org/gawain">gawain</a>,
1481 <a href="http://profiles.wordpress.org/iamzippy">iamzippy</a>,
1482 <a href="http://profiles.wordpress.org/isaacchapman">isaacchapman</a>,
1483 <a href="http://profiles.wordpress.org/jane">jane</a>,
1484 <a href="http://profiles.wordpress.org/jkudish">jkudish</a>,
1485 <a href="http://profiles.wordpress.org/mamaduka">mamaduka</a>,
1486 <a href="http://profiles.wordpress.org/mercime">mercime</a>,
1487 <a href="http://profiles.wordpress.org/mesayre">mesayre</a>,
1488 <a href="http://profiles.wordpress.org/mordauk">mordauk</a>,
1489 <a href="http://profiles.wordpress.org/MZAWeb">MZAWeb</a>,
1490 <a href="http://profiles.wordpress.org/netweb">netweb</a>,
1491 <a href="http://profiles.wordpress.org/nexia">nexia</a>,
1492 <a href="http://profiles.wordpress.org/Omicron7">Omicron7</a>,
1493 <a href="http://profiles.wordpress.org/otto42">otto42</a>,
1494 <a href="http://profiles.wordpress.org/pavelevap">pavelevap</a>,
1495 <a href="http://profiles.wordpress.org/plescheff">plescheff</a>,
1496 <a href="http://profiles.wordpress.org/scribu">scribu</a>,
1497 <a href="http://profiles.wordpress.org/sorich87">sorich87</a>,
1498 <a href="http://profiles.wordpress.org/SteveAtty">SteveAtty</a>,
1499 <a href="http://profiles.wordpress.org/tmoorewp">tmoorewp</a>,
1500 <a href="http://profiles.wordpress.org/tott">tott</a>,
1501 <a href="http://profiles.wordpress.org/tungdo">tungdo</a>,
1502 <a href="http://profiles.wordpress.org/vibol">vibol</a>,
1503 <a href="http://profiles.wordpress.org/wonderboymusic">wonderboymusic</a>,
1504 <a href="http://profiles.wordpress.org/westi">westi</a>,
1505 <a href="http://profiles.wordpress.org/xiosen">xiosen</a>,
1506 </p>
1507
1508 <div class="return-to-dashboard">
1509 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Forum Settings' ); ?></a>
1510 </div>
1511
1512 </div>
1513
1514 <?php
1515 }
1516
1517 /** Updaters **************************************************************/
1518
1519 /**
1520 * Update all bbPress forums across all sites
1521 *
1522 * @since bbPress (r3689)
1523 *
1524 * @global WPDB $wpdb
1525 * @uses get_blog_option()
1526 * @uses wp_remote_get()
1527 */
1528 public static function update_screen() {
1529
1530 // Get action
1531 $action = isset( $_GET['action'] ) ? $_GET['action'] : ''; ?>
1532
1533 <div class="wrap">
1534 <div id="icon-edit" class="icon32 icon32-posts-topic"><br /></div>
1535 <h2><?php _e( 'Update Forum', 'bbpress' ); ?></h2>
1536
1537 <?php
1538
1539 // Taking action
1540 switch ( $action ) {
1541 case 'bbp-update' :
1542
1543 // Run the full updater
1544 bbp_version_updater(); ?>
1545
1546 <p><?php _e( 'All done!', 'bbpress' ); ?></p>
1547 <a class="button" href="index.php?page=bbp-update"><?php _e( 'Go Back', 'bbpress' ); ?></a>
1548
1549 <?php
1550
1551 break;
1552
1553 case 'show' :
1554 default : ?>
1555
1556 <p><?php _e( 'You can update your forum through this page. Hit the link below to update.', 'bbpress' ); ?></p>
1557 <p><a class="button" href="index.php?page=bbp-update&amp;action=bbp-update"><?php _e( 'Update Forum', 'bbpress' ); ?></a></p>
1558
1559 <?php break;
1560
1561 } ?>
1562
1563 </div><?php
1564 }
1565
1566 /**
1567 * Update all bbPress forums across all sites
1568 *
1569 * @since bbPress (r3689)
1570 *
1571 * @global WPDB $wpdb
1572 * @uses get_blog_option()
1573 * @uses wp_remote_get()
1574 */
1575 public static function network_update_screen() {
1576 global $wpdb;
1577
1578 // Get action
1579 $action = isset( $_GET['action'] ) ? $_GET['action'] : ''; ?>
1580
1581 <div class="wrap">
1582 <div id="icon-edit" class="icon32 icon32-posts-topic"><br /></div>
1583 <h2><?php _e( 'Update Forums', 'bbpress' ); ?></h2>
1584
1585 <?php
1586
1587 // Taking action
1588 switch ( $action ) {
1589 case 'bbpress-update' :
1590
1591 // Site counter
1592 $n = isset( $_GET['n'] ) ? intval( $_GET['n'] ) : 0;
1593
1594 // Get blogs 5 at a time
1595 $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 );
1596
1597 // No blogs so all done!
1598 if ( empty( $blogs ) ) : ?>
1599
1600 <p><?php _e( 'All done!', 'bbpress' ); ?></p>
1601 <a class="button" href="update-core.php?page=bbpress-update"><?php _e( 'Go Back', 'bbpress' ); ?></a>
1602
1603 <?php break; ?>
1604
1605 <?php
1606
1607 // Still have sites to loop through
1608 else : ?>
1609
1610 <ul>
1611
1612 <?php foreach ( (array) $blogs as $details ) :
1613
1614 $siteurl = get_blog_option( $details['blog_id'], 'siteurl' ); ?>
1615
1616 <li><?php echo $siteurl; ?></li>
1617
1618 <?php
1619
1620 // Get the response of the bbPress update on this site
1621 $response = wp_remote_get(
1622 trailingslashit( $siteurl ) . 'wp-admin/index.php?page=bbp-update&action=bbp-update',
1623 array( 'timeout' => 30, 'httpversion' => '1.1' )
1624 );
1625
1626 // Site errored out, no response?
1627 if ( is_wp_error( $response ) )
1628 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() ) );
1629
1630 // Switch to the new blog
1631 switch_to_blog( $details[ 'blog_id' ] );
1632
1633 $basename = bbpress()->basename;
1634
1635 // Run the updater on this site
1636 if ( is_plugin_active_for_network( $basename ) || is_plugin_active( $basename ) ) {
1637 bbp_version_updater();
1638 }
1639
1640 // restore original blog
1641 restore_current_blog();
1642
1643 // Do some actions to allow plugins to do things too
1644 do_action( 'after_bbpress_upgrade', $response );
1645 do_action( 'bbp_upgrade_site', $details[ 'blog_id' ] );
1646
1647 endforeach; ?>
1648
1649 </ul>
1650
1651 <p>
1652 <?php _e( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:', 'bbpress' ); ?>
1653 <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>
1654 </p>
1655 <script type='text/javascript'>
1656 <!--
1657 function nextpage() {
1658 location.href = 'update-core.php?page=bbpress-update&action=bbpress-update&n=<?php echo ( $n + 5 ) ?>';
1659 }
1660 setTimeout( 'nextpage()', 250 );
1661 //-->
1662 </script><?php
1663
1664 endif;
1665
1666 break;
1667
1668 case 'show' :
1669 default : ?>
1670
1671 <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>
1672 <p><a class="button" href="update-core.php?page=bbpress-update&amp;action=bbpress-update"><?php _e( 'Update Forums', 'bbpress' ); ?></a></p>
1673
1674 <?php break;
1675
1676 } ?>
1677
1678 </div><?php
1679 }
1680 }
1681 endif; // class_exists check
1682
1683 /**
1684 * Setup bbPress Admin
1685 *
1686 * @since bbPress (r2596)
1687 *
1688 * @uses BBP_Admin
1689 */
1690 function bbp_admin() {
1691 bbpress()->admin = new BBP_Admin();
1692
1693 bbpress()->admin->converter = new BBP_Converter();
1694 }
1695