Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/05/2016 04:26:30 AM (9 years ago)
Author:
boonebgorges
Message:

Move bp-core classes to their own files.

See #6870.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-admin.php

    r10497 r10518  
    1111defined( 'ABSPATH' ) || exit;
    1212
    13 if ( !class_exists( 'BP_Admin' ) ) :
    14 
    15 /**
    16  * Load BuddyPress plugin admin area.
    17  *
    18  * @todo Break this apart into each applicable Component.
    19  *
    20  * @since 1.6.0
    21  */
    22 class BP_Admin {
    23 
    24     /** Directory *************************************************************/
    25 
    26     /**
    27      * Path to the BuddyPress admin directory.
    28      *
    29      * @since 1.6.0
    30      * @var string $admin_dir
    31      */
    32     public $admin_dir = '';
    33 
    34     /** URLs ******************************************************************/
    35 
    36     /**
    37      * URL to the BuddyPress admin directory.
    38      *
    39      * @since 1.6.0
    40      * @var string $admin_url
    41      */
    42     public $admin_url = '';
    43 
    44     /**
    45      * URL to the BuddyPress images directory.
    46      *
    47      * @since 1.6.0
    48      * @var string $images_url
    49      */
    50     public $images_url = '';
    51 
    52     /**
    53      * URL to the BuddyPress admin CSS directory.
    54      *
    55      * @since 1.6.0
    56      * @var string $css_url
    57      */
    58     public $css_url = '';
    59 
    60     /**
    61      * URL to the BuddyPress admin JS directory.
    62      *
    63      * @since 1.6.0
    64      * @var string
    65      */
    66     public $js_url = '';
    67 
    68     /** Other *****************************************************************/
    69 
    70     /**
    71      * Notices used for user feedback, like saving settings.
    72      *
    73      * @since 1.9.0
    74      * @var array()
    75      */
    76     public $notices = array();
    77 
    78     /** Methods ***************************************************************/
    79 
    80     /**
    81      * The main BuddyPress admin loader.
    82      *
    83      * @since 1.6.0
    84      *
    85      * @uses BP_Admin::setup_globals() Setup the globals needed.
    86      * @uses BP_Admin::includes() Include the required files.
    87      * @uses BP_Admin::setup_actions() Setup the hooks and actions.
    88      */
    89     public function __construct() {
    90         $this->setup_globals();
    91         $this->includes();
    92         $this->setup_actions();
    93     }
    94 
    95     /**
    96      * Set admin-related globals.
    97      *
    98      * @since 1.6.0
    99      */
    100     private function setup_globals() {
    101         $bp = buddypress();
    102 
    103         // Paths and URLs
    104         $this->admin_dir  = trailingslashit( $bp->plugin_dir  . 'bp-core/admin' ); // Admin path.
    105         $this->admin_url  = trailingslashit( $bp->plugin_url  . 'bp-core/admin' ); // Admin url.
    106         $this->images_url = trailingslashit( $this->admin_url . 'images'        ); // Admin images URL.
    107         $this->css_url    = trailingslashit( $this->admin_url . 'css'           ); // Admin css URL.
    108         $this->js_url     = trailingslashit( $this->admin_url . 'js'            ); // Admin css URL.
    109 
    110         // Main settings page.
    111         $this->settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
    112 
    113         // Main capability.
    114         $this->capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
    115     }
    116 
    117     /**
    118      * Include required files.
    119      *
    120      * @since 1.6.0
    121      */
    122     private function includes() {
    123         require( $this->admin_dir . 'bp-core-admin-classes.php'    );
    124         require( $this->admin_dir . 'bp-core-admin-actions.php'    );
    125         require( $this->admin_dir . 'bp-core-admin-settings.php'   );
    126         require( $this->admin_dir . 'bp-core-admin-functions.php'  );
    127         require( $this->admin_dir . 'bp-core-admin-components.php' );
    128         require( $this->admin_dir . 'bp-core-admin-slugs.php'      );
    129         require( $this->admin_dir . 'bp-core-admin-tools.php'      );
    130     }
    131 
    132     /**
    133      * Set up the admin hooks, actions, and filters.
    134      *
    135      * @since 1.6.0
    136      *
    137      * @uses add_action() To add various actions.
    138      * @uses add_filter() To add various filters.
    139      */
    140     private function setup_actions() {
    141 
    142         /* General Actions ***************************************************/
    143 
    144         // Add some page specific output to the <head>.
    145         add_action( 'bp_admin_head',            array( $this, 'admin_head'  ), 999 );
    146 
    147         // Add menu item to settings menu.
    148         add_action( bp_core_admin_hook(),       array( $this, 'admin_menus' ), 5 );
    149 
    150         // Enqueue all admin JS and CSS.
    151         add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_styles' ), 1 );
    152         add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_scripts' ), 1 );
    153         add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    154 
    155         /* BuddyPress Actions ************************************************/
    156 
    157         // Load the BuddyPress metabox in the WP Nav Menu Admin UI.
    158         add_action( 'load-nav-menus.php', 'bp_admin_wp_nav_menu_meta_box' );
    159 
    160         // Add settings.
    161         add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) );
    162 
    163         // Add a link to BuddyPress About page to the admin bar.
    164         add_action( 'admin_bar_menu', array( $this, 'admin_bar_about_link' ), 15 );
    165 
    166         // Add a description of new BuddyPress tools in the available tools page.
    167         add_action( 'tool_box',            'bp_core_admin_available_tools_intro' );
    168         add_action( 'bp_network_tool_box', 'bp_core_admin_available_tools_intro' );
    169 
    170         // On non-multisite, catch.
    171         add_action( 'load-users.php', 'bp_core_admin_user_manage_spammers' );
    172 
    173         /* Filters ***********************************************************/
    174 
    175         // Add link to settings page.
    176         add_filter( 'plugin_action_links',               array( $this, 'modify_plugin_action_links' ), 10, 2 );
    177         add_filter( 'network_admin_plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 );
    178 
    179         // Add "Mark as Spam" row actions on users.php.
    180         add_filter( 'ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2 );
    181         add_filter( 'user_row_actions',    'bp_core_admin_user_row_actions', 10, 2 );
    182 
    183         // Emails
    184         add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
    185     }
    186 
    187     /**
    188      * Add the navigational menu elements.
    189      *
    190      * @since 1.6.0
    191      *
    192      * @uses add_management_page() To add the Recount page in Tools section.
    193      * @uses add_options_page() To add the Forums settings page in Settings
    194      *       section.
    195      */
    196     public function admin_menus() {
    197 
    198         // Bail if user cannot moderate.
    199         if ( ! bp_current_user_can( 'manage_options' ) ) {
    200             return;
    201         }
    202 
    203         // About.
    204         add_dashboard_page(
    205             __( 'Welcome to BuddyPress',  'buddypress' ),
    206             __( 'Welcome to BuddyPress',  'buddypress' ),
    207             'manage_options',
    208             'bp-about',
    209             array( $this, 'about_screen' )
    210         );
    211 
    212         // Credits.
    213         add_dashboard_page(
    214             __( 'Welcome to BuddyPress',  'buddypress' ),
    215             __( 'Welcome to BuddyPress',  'buddypress' ),
    216             'manage_options',
    217             'bp-credits',
    218             array( $this, 'credits_screen' )
    219         );
    220 
    221         $hooks = array();
    222 
    223         // Changed in BP 1.6 . See bp_core_admin_backpat_menu().
    224         $hooks[] = add_menu_page(
    225             __( 'BuddyPress', 'buddypress' ),
    226             __( 'BuddyPress', 'buddypress' ),
    227             $this->capability,
    228             'bp-general-settings',
    229             'bp_core_admin_backpat_menu',
    230             'div'
    231         );
    232 
    233         $hooks[] = add_submenu_page(
    234             'bp-general-settings',
    235             __( 'BuddyPress Help', 'buddypress' ),
    236             __( 'Help', 'buddypress' ),
    237             $this->capability,
    238             'bp-general-settings',
    239             'bp_core_admin_backpat_page'
    240         );
    241 
    242         // Add the option pages.
    243         $hooks[] = add_submenu_page(
    244             $this->settings_page,
    245             __( 'BuddyPress Components', 'buddypress' ),
    246             __( 'BuddyPress', 'buddypress' ),
    247             $this->capability,
    248             'bp-components',
    249             'bp_core_admin_components_settings'
    250         );
    251 
    252         $hooks[] = add_submenu_page(
    253             $this->settings_page,
    254             __( 'BuddyPress Pages', 'buddypress' ),
    255             __( 'BuddyPress Pages', 'buddypress' ),
    256             $this->capability,
    257             'bp-page-settings',
    258             'bp_core_admin_slugs_settings'
    259         );
    260 
    261         $hooks[] = add_submenu_page(
    262             $this->settings_page,
    263             __( 'BuddyPress Settings', 'buddypress' ),
    264             __( 'BuddyPress Settings', 'buddypress' ),
    265             $this->capability,
    266             'bp-settings',
    267             'bp_core_admin_settings'
    268         );
    269 
    270         // For consistency with non-Multisite, we add a Tools menu in
    271         // the Network Admin as a home for our Tools panel.
    272         if ( is_multisite() && bp_core_do_network_admin() ) {
    273             $tools_parent = 'network-tools';
    274 
    275             $hooks[] = add_menu_page(
    276                 __( 'Tools', 'buddypress' ),
    277                 __( 'Tools', 'buddypress' ),
    278                 $this->capability,
    279                 $tools_parent,
    280                 'bp_core_tools_top_level_item',
    281                 '',
    282                 24 // Just above Settings.
    283             );
    284 
    285             $hooks[] = add_submenu_page(
    286                 $tools_parent,
    287                 __( 'Available Tools', 'buddypress' ),
    288                 __( 'Available Tools', 'buddypress' ),
    289                 $this->capability,
    290                 'available-tools',
    291                 'bp_core_admin_available_tools_page'
    292             );
    293         } else {
    294             $tools_parent = 'tools.php';
    295         }
    296 
    297         $hooks[] = add_submenu_page(
    298             $tools_parent,
    299             __( 'BuddyPress Tools', 'buddypress' ),
    300             __( 'BuddyPress', 'buddypress' ),
    301             $this->capability,
    302             'bp-tools',
    303             'bp_core_admin_tools'
    304         );
    305 
    306         $hooks[] = add_theme_page(
    307             _x( 'Emails', 'screen heading', 'buddypress' ),
    308             _x( 'Emails', 'screen heading', 'buddypress' ),
    309             $this->capability,
    310             'bp-emails-customizer-redirect',
    311             'bp_email_redirect_to_customizer'
    312         );
    313 
    314         foreach( $hooks as $hook ) {
    315             add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
    316         }
    317     }
    318 
    319     /**
    320      * Register the settings.
    321      *
    322      * @since 1.6.0
    323      *
    324      * @uses add_settings_section() To add our own settings section.
    325      * @uses add_settings_field() To add various settings fields.
    326      * @uses register_setting() To register various settings.
    327      */
    328     public function register_admin_settings() {
    329 
    330         /* Main Section ******************************************************/
    331 
    332         // Add the main section.
    333         add_settings_section( 'bp_main', __( 'Main Settings', 'buddypress' ), 'bp_admin_setting_callback_main_section', 'buddypress' );
    334 
    335         // Hide toolbar for logged out users setting.
    336         add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
    337         register_setting( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
    338 
    339         // Only show 'switch to Toolbar' option if the user chose to retain the BuddyBar during the 1.6 upgrade.
    340         if ( (bool) bp_get_option( '_bp_force_buddybar', false ) ) {
    341             add_settings_field( '_bp_force_buddybar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_force_buddybar', 'buddypress', 'bp_main' );
    342             register_setting( 'buddypress', '_bp_force_buddybar', 'bp_admin_sanitize_callback_force_buddybar' );
    343         }
    344 
    345         // Allow account deletion.
    346         add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
    347         register_setting( 'buddypress', 'bp-disable-account-deletion', 'intval' );
    348 
    349         /* XProfile Section **************************************************/
    350 
    351         if ( bp_is_active( 'xprofile' ) ) {
    352 
    353             // Add the main section.
    354             add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' );
    355 
    356             // Avatars.
    357             add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile' );
    358             register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' );
    359 
    360             // Cover images.
    361             if ( bp_is_active( 'xprofile', 'cover_image' ) ) {
    362                 add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_xprofile' );
    363                 register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
    364             }
    365 
    366             // Profile sync setting.
    367             add_settings_field( 'bp-disable-profile-sync',   __( 'Profile Syncing',  'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' );
    368             register_setting  ( 'buddypress', 'bp-disable-profile-sync', 'intval' );
    369         }
    370 
    371         /* Groups Section ****************************************************/
    372 
    373         if ( bp_is_active( 'groups' ) ) {
    374 
    375             // Add the main section.
    376             add_settings_section( 'bp_groups', __( 'Groups Settings',  'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
    377 
    378             // Allow subscriptions setting.
    379             add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation',   'buddypress', 'bp_groups' );
    380             register_setting( 'buddypress', 'bp_restrict_group_creation', 'intval' );
    381 
    382             // Allow group avatars.
    383             add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' );
    384             register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' );
    385 
    386             // Allow group cover images.
    387             if ( bp_is_active( 'groups', 'cover_image' ) ) {
    388                 add_settings_field( 'bp-disable-group-cover-image-uploads', __( 'Group Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_cover_image_uploads', 'buddypress', 'bp_groups' );
    389                 register_setting( 'buddypress', 'bp-disable-group-cover-image-uploads', 'intval' );
    390             }
    391         }
    392 
    393         /* Forums ************************************************************/
    394 
    395         if ( bp_is_active( 'forums' ) ) {
    396 
    397             // Add the main section.
    398             add_settings_section( 'bp_forums', __( 'Legacy Group Forums', 'buddypress' ), 'bp_admin_setting_callback_bbpress_section', 'buddypress' );
    399 
    400             // Allow subscriptions setting.
    401             add_settings_field( 'bb-config-location', __( 'bbPress Configuration', 'buddypress' ), 'bp_admin_setting_callback_bbpress_configuration', 'buddypress', 'bp_forums' );
    402             register_setting( 'buddypress', 'bb-config-location', '' );
    403         }
    404 
    405         /* Activity Section **************************************************/
    406 
    407         if ( bp_is_active( 'activity' ) ) {
    408 
    409             // Add the main section.
    410             add_settings_section( 'bp_activity', __( 'Activity Settings', 'buddypress' ), 'bp_admin_setting_callback_activity_section', 'buddypress' );
    411 
    412             // Activity commenting on blog and forum posts.
    413             add_settings_field( 'bp-disable-blogforum-comments', __( 'Blog &amp; Forum Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
    414             register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' );
    415 
    416             // Activity Heartbeat refresh.
    417             add_settings_field( '_bp_enable_heartbeat_refresh', __( 'Activity auto-refresh', 'buddypress' ), 'bp_admin_setting_callback_heartbeat', 'buddypress', 'bp_activity' );
    418             register_setting( 'buddypress', '_bp_enable_heartbeat_refresh', 'intval' );
    419 
    420             // Allow activity akismet.
    421             if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
    422                 add_settings_field( '_bp_enable_akismet', __( 'Akismet', 'buddypress' ), 'bp_admin_setting_callback_activity_akismet', 'buddypress', 'bp_activity' );
    423                 register_setting( 'buddypress', '_bp_enable_akismet', 'intval' );
    424             }
    425         }
    426     }
    427 
    428     /**
    429      * Add a link to BuddyPress About page to the admin bar.
    430      *
    431      * @since 1.9.0
    432      *
    433      * @param WP_Admin_Bar $wp_admin_bar As passed to 'admin_bar_menu'.
    434      */
    435     public function admin_bar_about_link( $wp_admin_bar ) {
    436         if ( is_user_logged_in() ) {
    437             $wp_admin_bar->add_menu( array(
    438                 'parent' => 'wp-logo',
    439                 'id'     => 'bp-about',
    440                 'title'  => esc_html__( 'About BuddyPress', 'buddypress' ),
    441                 'href'   => add_query_arg( array( 'page' => 'bp-about' ), bp_get_admin_url( 'index.php' ) ),
    442             ) );
    443         }
    444     }
    445 
    446     /**
    447      * Add Settings link to plugins area.
    448      *
    449      * @since 1.6.0
    450      *
    451      * @param array  $links Links array in which we would prepend our link.
    452      * @param string $file  Current plugin basename.
    453      * @return array Processed links.
    454      */
    455     public function modify_plugin_action_links( $links, $file ) {
    456 
    457         // Return normal links if not BuddyPress.
    458         if ( plugin_basename( buddypress()->basename ) != $file ) {
    459             return $links;
    460         }
    461 
    462         // Add a few links to the existing links array.
    463         return array_merge( $links, array(
    464             'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>',
    465             'about'    => '<a href="' . esc_url( add_query_arg( array( 'page' => 'bp-about'      ), bp_get_admin_url( 'index.php'          ) ) ) . '">' . esc_html__( 'About',    'buddypress' ) . '</a>'
    466         ) );
    467     }
    468 
    469     /**
    470      * Add some general styling to the admin area.
    471      *
    472      * @since 1.6.0
    473      */
    474     public function admin_head() {
    475 
    476         // Settings pages.
    477         remove_submenu_page( $this->settings_page, 'bp-page-settings' );
    478         remove_submenu_page( $this->settings_page, 'bp-settings'      );
    479 
    480         // Network Admin Tools.
    481         remove_submenu_page( 'network-tools', 'network-tools' );
    482 
    483         // About and Credits pages.
    484         remove_submenu_page( 'index.php', 'bp-about'   );
    485         remove_submenu_page( 'index.php', 'bp-credits' );
    486     }
    487 
    488     /**
    489      * Add some general styling to the admin area.
    490      *
    491      * @since 1.6.0
    492      */
    493     public function enqueue_scripts() {
    494         wp_enqueue_style( 'bp-admin-common-css' );
    495     }
    496 
    497     /** About *****************************************************************/
    498 
    499     /**
    500      * Output the about screen.
    501      *
    502      * @since 1.7.0
    503      */
    504     public function about_screen() {
    505     ?>
    506 
    507         <div class="wrap about-wrap">
    508 
    509             <?php self::welcome_text(); ?>
    510 
    511             <?php self::tab_navigation( __METHOD__ ); ?>
    512 
    513             <?php if ( self::is_new_install() ) : ?>
    514 
    515                 <div id="welcome-panel" class="welcome-panel">
    516                     <div class="welcome-panel-content">
    517                         <h3 style="margin:0"><?php _e( 'Getting Started with BuddyPress', 'buddypress' ); ?></h3>
    518                         <div class="welcome-panel-column-container">
    519                             <div class="welcome-panel-column">
    520                                 <h4><?php _e( 'Configure BuddyPress', 'buddypress' ); ?></h4>
    521                                 <ul>
    522                                     <li><?php printf(
    523                                     '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Set Up Components', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) )
    524                                     ); ?></li>
    525                                     <li><?php printf(
    526                                     '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Assign Components to Pages', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), $this->settings_page ) ) )
    527                                     ); ?></li>
    528                                     <li><?php printf(
    529                                     '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Customize Settings', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), $this->settings_page ) ) )
    530                                     ); ?></li>
    531                                 </ul>
    532                                 <a class="button button-primary button-hero" style="margin-bottom:20px;margin-top:0;" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Get Started', 'buddypress' ); ?></a>
    533                             </div>
    534                             <div class="welcome-panel-column">
    535                                 <h4><?php _e( 'Administration Tools', 'buddypress' ); ?></h4>
    536                                 <ul>
    537                                     <?php if ( bp_is_active( 'members' ) ) : ?>
    538                                         <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add User Profile Fields', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-profile-setup' ), 'users.php' ) ) ) ); ?></li>
    539                                     <?php endif; ?>
    540                                     <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage User Signups', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-signups' ), 'users.php' ) ) ) ); ?></li>
    541                                     <?php if ( bp_is_active( 'activity' ) ) : ?>
    542                                         <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Moderate Activity Streams', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-activity' ), 'admin.php' ) ) ) ); ?></li>
    543                                     <?php endif; ?>
    544                                     <?php if ( bp_is_active( 'groups' ) ) : ?>
    545                                         <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage Groups', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-groups' ), 'admin.php' ) ) ) ); ?></li>
    546                                     <?php endif; ?>
    547                                     <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Repair Data', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), 'tools.php' ) ) ) ); ?>
    548                                     </li>
    549                                 </ul>
    550                             </div>
    551                             <div class="welcome-panel-column welcome-panel-last">
    552                                 <h4><?php _e( 'Community and Support', 'buddypress'  ); ?></h4>
    553                                 <p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Looking for help? The <a href="https://codex.buddypress.org/">BuddyPress Codex</a> has you covered.', 'buddypress' ) ?></p>
    554                                 <p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Can&#8217;t find what you need? Stop by <a href="https://buddypress.org/support/">our support forums</a>, where active BuddyPress users and developers are waiting to share tips and more.', 'buddypress' ) ?></p>
    555                             </div>
    556                         </div>
    557                     </div>
    558                 </div>
    559 
    560             <?php endif; ?>
    561 
    562             <div class="headline-feature">
    563                 <h3><?php esc_html_e( 'Cover Images For Members And Groups', 'buddypress' ); ?></h3>
    564 
    565                 <div class="featured-image">
    566                     <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/group-cover-image.png' ); ?>" alt="<?php esc_attr_e( 'Cover Images for Members and Groups', 'buddypress' ); ?>" width="843" height="377">
    567                 </div>
    568                 <div>
    569                      <p><?php printf( __( 'Your community can now upload cover photos for their user profiles and groups. <a href="%s">Learn more &rarr;</a>', 'buddypress' ), esc_url( 'https://codex.buddypress.org/themes/buddypress-cover-images/' ) ); ?></p>
    570                 </div>
    571                 <div class="clear"></div>
    572 
    573             </div>
    574 
    575             <hr>
    576 
    577             <div class="feature-section two-col">
    578                 <div>
    579                     <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/member-type-field.png' ); ?>" alt="<?php esc_attr_e( 'Profile Field for Member Type', 'buddypress' ); ?>">
    580                     <h3><?php esc_html_e( 'Profile Fields For Specific Member Types', 'buddypress' ); ?></h3>
    581                     <p><?php printf( __( 'You can create profile fields which are available to one or more <a href="%s">custom member types</a>.', 'buddypress' ), esc_url( 'https://codex.buddypress.org/developer/member-types/' ) ); ?></p>
    582                 </div>
    583                 <div class="last-feature">
    584                     <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/theme-stylesheets.png' ); ?>" alt="<?php esc_attr_e( 'BuddyPress Companion Stylesheets', 'buddypress' ); ?>">
    585                     <h3><?php esc_html_e( 'More Companion Stylesheets For Themes', 'buddypress' ); ?></h3>
    586                     <p><?php esc_html_e( 'BuddyPress looks and works better than ever with WordPress theme Twenty Thirteen, and the upcoming Twenty Sixteen.', 'buddypress' ); ?></p>
    587                 </div>
    588             </div>
    589 
    590             <div class="feature-section two-col">
    591                 <div>
    592                     <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/group-home-page.png' ); ?>" alt="<?php esc_attr_e( 'Customize your group home page', 'buddypress' ); ?>">
    593                     <h3><?php esc_html_e( 'Customizable Group Home Page', 'buddypress' ); ?></h3>
    594                     <p><?php esc_html_e( 'You can customize each and every Group\'s home page by using the new front page template hierarchy.', 'buddypress' ); ?> <a href="https://bpdevel.wordpress.com/2015/10/03/get-ready-2-4-0-will-introduce-important-changes-in-groups-homes/"><?php esc_html_e( 'Learn how &rarr;', 'buddypress' ); ?></a></p>
    595                 </div>
    596                 <div class="last-feature">
    597                     <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/accessibility.gif' ); ?>" alt="<?php esc_attr_e( 'Accessibility Upgrades', 'buddypress' ); ?>">
    598                     <h3><?php esc_html_e( 'Accessibility Upgrades', 'buddypress' ); ?></h3>
    599                     <p><?php _e( 'We\'re making BuddyPress more usable and accessible for everyone, from the frontend templates to the backend admin screens.', 'buddypress' ); ?></p>
    600                 </div>
    601 
    602             </div>
    603 
    604             <div class="changelog">
    605                 <h3><?php esc_html_e( 'Under The Hood', 'buddypress' ); ?></h3>
    606 
    607                 <div class="feature-section col two-col">
    608                     <div>
    609                         <h4><?php esc_html_e( 'User Experience', 'buddypress' ); ?></h4>
    610                         <p><?php esc_html_e( "Enhancements to the What's New form bring better user experience for your community, and make it easier for developers to add new features.", 'buddypress' ); ?></p>
    611 
    612                         <h4><?php esc_html_e( 'Cache Improvements', 'buddypress' ); ?></h4>
    613                         <p><?php esc_html_e( 'Continued object and query cache enhancements have been implemented across different components to improve performance.', 'buddypress' ); ?></p>
    614                     </div>
    615                     <div class="last-feature">
    616                         <h4><?php esc_html_e( 'Developer Reference', 'buddypress' ); ?></h4>
    617                         <p><?php esc_html_e( 'Regular updates to inline code documentation make it easier for developers to understand how BuddyPress works.', 'buddypress' ); ?></p>
    618 
    619                         <h4><?php esc_html_e( 'Constant Refinements', 'buddypress' ); ?></h4>
    620                         <p><?php esc_html_e( 'The BuddyPress codebase is continuously tested and updated with the latest WordPress enhancements and features.', 'buddypress' ); ?></p>
    621                     </div>
    622                 </div>
    623             </div>
    624 
    625             <p><?php _ex( 'Learn more:', 'About screen, website links', 'buddypress' ); ?> <a href="https://buddypress.org/blog/"><?php _ex( 'News', 'About screen, link to project blog', 'buddypress' ); ?></a> &bullet; <a href="https://buddypress.org/support/"><?php _ex( 'Support', 'About screen, link to support site', 'buddypress' ); ?></a> &bullet; <a href="https://codex.buddypress.org/"><?php _ex( 'Documentation', 'About screen, link to documentation', 'buddypress' ); ?></a> &bullet; <a href="https://bpdevel.wordpress.com/"><?php _ex( 'Development Blog', 'About screen, link to development blog', 'buddypress' ); ?></a></p>
    626             <p><?php _ex( 'Twitter:', 'official Twitter accounts:', 'buddypress' ); ?> <a href="https://twitter.com/buddypress/"><?php _ex( 'BuddyPress', '@buddypress twitter account name', 'buddypress' ); ?></a> &bullet; <a href="https://twitter.com/bptrac/"><?php _ex( 'Trac', '@bptrac twitter account name', 'buddypress' ); ?></a> &bullet; <a href="https://twitter.com/buddypressdev/"><?php _ex( 'Development', '@buddypressdev twitter account name', 'buddypress' ); ?></a></p>
    627 
    628         </div>
    629 
    630         <?php
    631     }
    632 
    633     /**
    634      * Output the credits screen.
    635      *
    636      * Hardcoding this in here is pretty janky. It's fine for now, but we'll
    637      * want to leverage api.wordpress.org eventually.
    638      *
    639      * @since 1.7.0
    640      */
    641     public function credits_screen() {
    642     ?>
    643 
    644         <div class="wrap about-wrap">
    645 
    646             <?php self::welcome_text(); ?>
    647 
    648             <?php self::tab_navigation( __METHOD__ ); ?>
    649 
    650             <p class="about-description"><?php _e( 'BuddyPress is created by a worldwide network of friendly folks like these.', 'buddypress' ); ?></p>
    651 
    652             <h3 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h3>
    653             <ul class="wp-people-group " id="wp-people-group-project-leaders">
    654                 <li class="wp-person" id="wp-person-johnjamesjacoby">
    655                     <a href="https://profiles.wordpress.org/johnjamesjacoby"><img src="//www.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=60" class="gravatar" alt="John James Jacoby" /></a>
    656                     <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby">John James Jacoby</a>
    657                     <span class="title"><?php _e( 'Project Lead', 'buddypress' ); ?></span>
    658                 </li>
    659                 <li class="wp-person" id="wp-person-boonebgorges">
    660                     <a href="https://profiles.wordpress.org/boonebgorges"><img src="//www.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=60" class="gravatar" alt="Boone B. Gorges" /></a>
    661                     <a class="web" href="https://profiles.wordpress.org/boonebgorges">Boone B. Gorges</a>
    662                     <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
    663                 </li>
    664                 <li class="wp-person" id="wp-person-djpaul">
    665                     <a href="https://profiles.wordpress.org/djpaul"><img src="//www.gravatar.com/avatar/3bc9ab796299d67ce83dceb9554f75df?s=60" class="gravatar" alt="Paul Gibbs" /></a>
    666                     <a class="web" href="https://profiles.wordpress.org/djpaul">Paul Gibbs</a>
    667                     <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
    668                 </li>
    669             </ul>
    670 
    671             <h3 class="wp-people-group"><?php _e( 'Core Team', 'buddypress' ); ?></h3>
    672             <ul class="wp-people-group " id="wp-people-group-core-team">
    673                 <li class="wp-person" id="wp-person-r-a-y">
    674                     <a href="https://profiles.wordpress.org/r-a-y"><img src="//www.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=60" class="gravatar" alt="Ray" /></a>
    675                     <a class="web" href="https://profiles.wordpress.org/r-a-y">Ray</a>
    676                     <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
    677                 </li>
    678                 <li class="wp-person" id="wp-person-imath">
    679                     <a href="https://profiles.wordpress.org/imath"><img src="//www.gravatar.com/avatar/8b208ca408dad63888253ee1800d6a03?s=60" class="gravatar" alt="Mathieu Viet" /></a>
    680                     <a class="web" href="https://profiles.wordpress.org/imath">Mathieu Viet</a>
    681                     <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
    682                 </li>
    683                 <li class="wp-person" id="wp-person-mercime">
    684                     <a href="https://profiles.wordpress.org/mercime"><img src="//www.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=60" class="gravatar" alt="Mercime" /></a>
    685                     <a class="web" href="https://profiles.wordpress.org/mercime">Mercime</a>
    686                     <span class="title"><?php _e( 'Navigator', 'buddypress' ); ?></span>
    687                 </li>
    688                 <li class="wp-person" id="wp-person-dcavins">
    689                     <a href="https://profiles.wordpress.org/dcavins"><img src="//www.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=60" class="gravatar" alt="David Cavins" /></a>
    690                     <a class="web" href="https://profiles.wordpress.org/dcavins">David Cavins</a>
    691                     <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
    692                 </li>
    693                 <li class="wp-person" id="wp-person-tw2113">
    694                     <a href="https://profiles.wordpress.org/tw2113"><img src="//www.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=60" class="gravatar" alt="Michael Beckwith" /></a>
    695                     <a class="web" href="https://profiles.wordpress.org/tw2113">Michael Beckwith</a>
    696                     <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
    697                 </li>
    698                 <li class="wp-person" id="wp-person-hnla">
    699                     <a href="https://profiles.wordpress.org/hnla"><img src="//www.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=60" class="gravatar" alt="Hugo Ashmore" /></a>
    700                     <a class="web" href="https://profiles.wordpress.org/hnla">Hugo</a>
    701                     <span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
    702                 </li>
    703             </ul>
    704 
    705             <h3 class="wp-people-group"><?php _e( '&#x1f31f;Recent Rockstars&#x1f31f;', 'buddypress' ); ?></h3>
    706             <ul class="wp-people-group " id="wp-people-group-rockstars">
    707                 <li class="wp-person" id="wp-person-henry-wright">
    708                     <a href="https://profiles.wordpress.org/henry.wright"><img src="//www.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=60" class="gravatar" alt="Henry Wright" /></a>
    709                     <a class="web" href="https://profiles.wordpress.org/henry.wright">Henry Wright</a>
    710                 </li>
    711                 <li class="wp-person" id="wp-person-danbp">
    712                     <a href="https://profiles.wordpress.org/danbp"><img src="//www.gravatar.com/avatar/0deae2e7003027fbf153500cd3fa5501?s=60" class="gravatar" alt="danbp" /></a>
    713                     <a class="web" href="https://profiles.wordpress.org/danbp">danbp</a>
    714                 </li>
    715                 <li class="wp-person" id="wp-person-shanebp">
    716                     <a href="https://profiles.wordpress.org/shanebp"><img src="//www.gravatar.com/avatar/ffd294ab5833ba14aaf175f9acc71cc4?s=60" class="gravatar" alt="shanebp" /></a>
    717                     <a class="web" href="https://profiles.wordpress.org/shanebp">shanebp</a>
    718                 </li>
    719                 <li class="wp-person" id="wp-person-netweb">
    720                     <a href="https://profiles.wordpress.org/netweb"><img src="//www.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=60" class="gravatar" alt="Stephen Edgar" /></a>
    721                     <a class="web" href="https://profiles.wordpress.org/netweb">Stephen Edgar</a>
    722                 </li>
    723                 <li class="wp-person" id="wp-person-dimensionmedia">
    724                     <a href="https://profiles.wordpress.org/dimensionmedia"><img src="//www.gravatar.com/avatar/7735aada1ec39d0c1118bd92ed4551f1?s=60" class="gravatar" alt="David Bisset" /></a>
    725                     <a class="web" href="https://profiles.wordpress.org/dimensionmedia">David Bisset</a>
    726                 </li>
    727 
    728             </ul>
    729 
    730             <h3 class="wp-people-group"><?php printf( esc_html__( 'Contributors to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h3>
    731             <p class="wp-credits-list">
    732                 <a href="https://profiles.wordpress.org/ankit-k-gupta/">Ankit K Gupta</a>,
    733                 <a href="https://profiles.wordpress.org/anthonyvalera/">anthonyvalera</a>,
    734                 <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
    735                 <a href="https://profiles.wordpress.org/thebrandonallen/">Brandon Allen (thebrandonallen)</a>,
    736                 <a href="https://profiles.wordpress.org/BuddyBoss/">BuddyBoss</a>,
    737                 <a href="https://profiles.wordpress.org/needle/">Christian Wach (needle)</a>,
    738                 <a href="https://profiles.wordpress.org/damland/">damland</a>,
    739                 <a href="https://profiles.wordpress.org/danbp/">danbp</a>,
    740                 <a href="https://profiles.wordpress.org/daniluk4000/">daniluk4000</a>,
    741                 <a href="https://profiles.wordpress.org/davidtcarson/">David Carson (davidtcarson)</a>,
    742                 <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
    743                 <a href="https://profiles.wordpress.org/valendesigns/">Derek Herman (valendesigns)</a>,
    744                 <a href="https://profiles.wordpress.org/ganesh641/">ganesh641</a>,
    745                 <a href="https://profiles.wordpress.org/hnla/">Hugo (hnla)</a>,
    746                 <a href="https://profiles.wordpress.org/jdgrimes/">J.D. Grimes</a>,
    747                 <a href="https://profiles.wordpress.org/JeffMatson/">JeffMatson</a>,
    748                 <a href="https://profiles.wordpress.org/jmarx75/">jmarx75</a>,
    749                 <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
    750                 <a href="https://profiles.wordpress.org/kahless/">Jon Breitenbucher (kahless)</a>,
    751                 <a href="https://profiles.wordpress.org/jbrinley/">Jonathan Brinley (jbrinley)</a>,
    752                 <a href="https://profiles.wordpress.org/dunhakdis/">Joseph G. (dunhakdis)</a>,
    753                 <a href="https://profiles.wordpress.org/lakrisgubben/">lakrisgubben</a>,
    754                 <a href="https://profiles.wordpress.org/landwire/">landwire</a>,
    755                 <a href="https://profiles.wordpress.org/Offereins">Laurens Offereins (Offereins)</a>
    756                 <a href="https://profiles.wordpress.org/lenasterg/">lenasterg</a>,
    757                 <a href="https://profiles.wordpress.org/mrk-1/">m@rk</a>,
    758                 <a href="https://profiles.wordpress.org/mahype/">mahype</a>,
    759                 <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
    760                 <a href="https://profiles.wordpress.org/mehulkaklotar/">mehulkaklotar</a>,
    761                 <a href="https://profiles.wordpress.org/mercime/">mercime</a>,
    762                 <a href="https://profiles.wordpress.org/tw2113/">Michael Beckwith (tw2113)</a>,
    763                 <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
    764                 <a href="https://profiles.wordpress.org/pareshradadiya/">paresh.radadiya (pareshradadiya)</a>,
    765                 <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
    766                 <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
    767                 <a href="https://profiles.wordpress.org/ramiy/">Rami Yushuvaev (ramiy)</a>,
    768                 <a href="https://profiles.wordpress.org/ritteshpatel/">Ritesh Patel (ritteshpatel)</a>,
    769                 <a href="https://profiles.wordpress.org/SergeyBiryukov/">Sergey Biryukov (SergeyBiryukov)</a>,
    770                 <a href="https://profiles.wordpress.org/shanebp/">shanebp</a>,
    771                 <a href="https://profiles.wordpress.org/slaffik/">Slava UA (slaffik)</a>,
    772                 <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
    773                 <a href="https://profiles.wordpress.org/svenl77/">svenl77</a>,
    774                 <a href="https://profiles.wordpress.org/tanner-m/">Tanner Moushey</a>,
    775                 <a href="https://profiles.wordpress.org/thomaslhotta/">thomaslhotta</a>,
    776                 <a href="https://profiles.wordpress.org/vnd/">vnd</a>,
    777                 <a href="https://profiles.wordpress.org/willgladstone/">willgladstone</a>.
    778             </p>
    779 
    780             <h3 class="wp-people-group"><?php _e( '&#x1f496;With our thanks to these Open Source projects&#x1f496;', 'buddypress' ); ?></h3>
    781             <p class="wp-credits-list">
    782                 <a href="https://github.com/ichord/At.js">At.js</a>,
    783                 <a href="https://bbpress.org">bbPress</a>,
    784                 <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
    785                 <a href="http://tedgoas.github.io/Cerberus/">Cerberus</a>,
    786                 <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
    787                 <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
    788                 <a href="https://wordpress.org">WordPress</a>.
    789             </p>
    790 
    791         </div>
    792 
    793         <?php
    794     }
    795 
    796     /**
    797      * Output welcome text and badge for What's New and Credits pages.
    798      *
    799      * @since 2.2.0
    800      */
    801     public static function welcome_text() {
    802 
    803         // Switch welcome text based on whether this is a new installation or not.
    804         $welcome_text = ( self::is_new_install() )
    805             ? __( 'Thank you for installing BuddyPress! BuddyPress helps you build any type of community website using WordPress, with member profiles, activity streams, user groups, messaging, and more.', 'buddypress' )
    806             : __( 'BuddyPress %s comes with a bunch of great improvements we think you&#8217;re really going to like.', 'buddypress' );
    807 
    808         ?>
    809 
    810         <h1><?php printf( esc_html__( 'Welcome to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h1>
    811 
    812         <div class="about-text">
    813             <?php
    814             if ( self::is_new_install() ) {
    815                 echo $welcome_text;
    816             } else {
    817                 printf( $welcome_text, self::display_version() );
    818             }
    819             ?>
    820         </div>
    821 
    822         <div class="bp-badge"></div>
    823 
    824         <?php
    825     }
    826 
    827     /**
    828      * Output tab navigation for `What's New` and `Credits` pages.
    829      *
    830      * @since 2.2.0
    831      *
    832      * @param string $tab Tab to highlight as active.
    833      */
    834     public static function tab_navigation( $tab = 'whats_new' ) {
    835     ?>
    836 
    837         <h2 class="nav-tab-wrapper">
    838             <a class="nav-tab <?php if ( 'BP_Admin::about_screen' === $tab ) : ?>nav-tab-active<?php endif; ?>" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>">
    839                 <?php esc_html_e( 'What&#8217;s New', 'buddypress' ); ?>
    840             </a><a class="nav-tab <?php if ( 'BP_Admin::credits_screen' === $tab ) : ?>nav-tab-active<?php endif; ?>" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>">
    841                 <?php esc_html_e( 'Credits', 'buddypress' ); ?>
    842             </a>
    843         </h2>
    844 
    845     <?php
    846     }
    847 
    848     /** Helpers ***************************************************************/
    849 
    850     /**
    851      * Return true/false based on whether a query argument is set.
    852      *
    853      * @see bp_do_activation_redirect()
    854      *
    855      * @since 2.2.0
    856      *
    857      * @return bool
    858      */
    859     public static function is_new_install() {
    860         return (bool) isset( $_GET['is_new_install'] );
    861     }
    862 
    863     /**
    864      * Return a user-friendly version-number string, for use in translations.
    865      *
    866      * @since 2.2.0
    867      *
    868      * @return string
    869      */
    870     public static function display_version() {
    871 
    872         // Use static variable to prevent recalculations.
    873         static $display = '';
    874 
    875         // Only calculate on first run.
    876         if ( '' === $display ) {
    877 
    878             // Get current version.
    879             $version = bp_get_version();
    880 
    881             // Check for prerelease hyphen.
    882             $pre     = strpos( $version, '-' );
    883 
    884             // Strip prerelease suffix.
    885             $display = ( false !== $pre )
    886                 ? substr( $version, 0, $pre )
    887                 : $version;
    888         }
    889 
    890         // Done!
    891         return $display;
    892     }
    893 
    894     /**
    895      * Add Emails menu item to custom menus array.
    896      *
    897      * Several BuddyPress components have top-level menu items in the Dashboard,
    898      * which all appear together in the middle of the Dashboard menu. This function
    899      * adds the Emails screen to the array of these menu items.
    900      *
    901      * @since 2.4.0
    902      *
    903      * @param array $custom_menus The list of top-level BP menu items.
    904      * @return array $custom_menus List of top-level BP menu items, with Emails added.
    905      */
    906     public function emails_admin_menu_order( $custom_menus = array() ) {
    907         array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
    908         return $custom_menus;
    909     }
    910 
    911     /**
    912      * Register styles commonly used by BuddyPress wp-admin screens.
    913      *
    914      * @since 2.5.0
    915      */
    916     public function admin_register_styles() {
    917         $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    918         $url = $this->css_url;
    919 
    920         /**
    921          * Filters the BuddyPress Core Admin CSS file path.
    922          *
    923          * @since 1.6.0
    924          *
    925          * @param string $file File path for the admin CSS.
    926          */
    927         $common_css = apply_filters( 'bp_core_admin_common_css', "{$url}common{$min}.css" );
    928 
    929         /**
    930          * Filters the BuddyPress admin stylesheet files to register.
    931          *
    932          * @since 2.5.0
    933          *
    934          * @param array $value Array of admin stylesheet file information to register.
    935          */
    936         $styles = apply_filters( 'bp_core_admin_register_styles', array(
    937             // Legacy.
    938             'bp-admin-common-css' => array(
    939                 'file'         => $common_css,
    940                 'dependencies' => array(),
    941             ),
    942 
    943             // 2.5
    944             'bp-customizer-controls' => array(
    945                 'file'         => "{$url}customizer-controls{$min}.css",
    946                 'dependencies' => array(),
    947             ),
    948         ) );
    949 
    950 
    951         $version = bp_get_version();
    952 
    953         foreach ( $styles as $id => $style ) {
    954             wp_register_style( $id, $style['file'], $style['dependencies'], $version );
    955             wp_style_add_data( $id, 'rtl', true );
    956 
    957             if ( $min ) {
    958                 wp_style_add_data( $id, 'suffix', $min );
    959             }
    960         }
    961     }
    962 
    963     /**
    964      * Register JS commonly used by BuddyPress wp-admin screens.
    965      *
    966      * @since 2.5.0
    967      */
    968     public function admin_register_scripts() {
    969         $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    970         $url = $this->js_url;
    971 
    972         /**
    973          * Filters the BuddyPress admin JS files to register.
    974          *
    975          * @since 2.5.0
    976          *
    977          * @param array $value Array of admin JS file information to register.
    978          */
    979         $scripts = apply_filters( 'bp_core_admin_register_scripts', array(
    980             // 2.5
    981             'bp-customizer-controls' => array(
    982                 'file'         => "{$url}customizer-controls{$min}.js",
    983                 'dependencies' => array( 'jquery' ),
    984                 'footer'       => true,
    985             ),
    986         ) );
    987 
    988         $version = bp_get_version();
    989 
    990         foreach ( $scripts as $id => $script ) {
    991             wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
    992         }
    993     }
    994 }
    995 endif; // End class_exists check.
     13require dirname( __FILE__ ) . '/classes/class-bp-admin.php';
    99614
    99715/**
Note: See TracChangeset for help on using the changeset viewer.