Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/01/2015 04:18:13 AM (10 years ago)
Author:
tw2113
Message:

First pass of documentation cleanup for the XProfile Component.

See #6406.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-loader.php

    r10157 r10163  
    1616
    1717    /**
    18      * Profile field types
     18     * Profile field types.
    1919     *
    2020     * @since 1.5.0
     
    3333
    3434    /**
    35      * Start the xprofile component creation process
     35     * Start the xprofile component creation process.
    3636     *
    3737     * @since 1.5.0
     
    5151
    5252    /**
    53      * Include files
     53     * Include files.
     54     *
     55     * @param array $includes
    5456     */
    5557    public function includes( $includes = array() ) {
     
    7678
    7779    /**
    78      * Setup globals
     80     * Setup globals.
    7981     *
    8082     * The BP_XPROFILE_SLUG constant is deprecated, and only used here for
     
    8284     *
    8385     * @since 1.5.0
     86     *
     87     * @param array $args Array of globals to set up.
    8488     */
    8589    public function setup_globals( $args = array() ) {
    8690        $bp = buddypress();
    8791
    88         // Define a slug, if necessary
     92        // Define a slug, if necessary.
    8993        if ( !defined( 'BP_XPROFILE_SLUG' ) ) {
    9094            define( 'BP_XPROFILE_SLUG', 'profile' );
     
    9397        // Assign the base group and fullname field names to constants
    9498        // to use in SQL statements.
    95         // Defined conditionally to accommodate unit tests
     99        // Defined conditionally to accommodate unit tests.
    96100        if ( ! defined( 'BP_XPROFILE_BASE_GROUP_NAME' ) ) {
    97101            define( 'BP_XPROFILE_BASE_GROUP_NAME', stripslashes( bp_core_get_root_option( 'avatar_default' ) ) );
     
    113117        // 'option' is a special case. It is not a top-level field, so
    114118        // does not have an associated BP_XProfile_Field_Type class,
    115         // but it must be whitelisted
     119        // but it must be whitelisted.
    116120        $this->field_types[] = 'option';
    117121
    118         // Register the visibility levels. See bp_xprofile_get_visibility_levels() to filter
     122        // Register the visibility levels. See bp_xprofile_get_visibility_levels() to filter.
    119123        $this->visibility_levels = array(
    120124            'public' => array(
     
    139143        }
    140144
    141         // Tables
     145        // Tables.
    142146        $global_tables = array(
    143147            'table_name_data'   => $bp->table_prefix . 'bp_xprofile_data',
     
    168172     *
    169173     * @global BuddyPress $bp The one true BuddyPress instance
     174     *
     175     * @param array $main_nav Array of main nav items to set up.
     176     * @param array $sub_nav  Array of sub nav items to set up.
    170177     */
    171178    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    172179
    173         // Determine user to use
     180        // Determine user to use.
    174181        if ( bp_displayed_user_domain() ) {
    175182            $user_domain = bp_displayed_user_domain();
     
    184191        $profile_link = trailingslashit( $user_domain . $slug );
    185192
    186         // Add 'Profile' to the main navigation
     193        // Add 'Profile' to the main navigation.
    187194        $main_nav = array(
    188195            'name'                => _x( 'Profile', 'Profile header menu', 'buddypress' ),
     
    194201        );
    195202
    196         // Add the subnav items to the profile
     203        // Add the subnav items to the profile.
    197204        $sub_nav[] = array(
    198205            'name'            => _x( 'View', 'Profile header sub menu', 'buddypress' ),
     
    204211        );
    205212
    206         // Edit Profile
     213        // Edit Profile.
    207214        $sub_nav[] = array(
    208215            'name'            => _x( 'Edit','Profile header sub menu', 'buddypress' ),
     
    215222        );
    216223
    217         // Change Avatar
     224        // Change Avatar.
    218225        if ( buddypress()->avatar->show_avatars ) {
    219226            $sub_nav[] = array(
     
    242249
    243250        // The Settings > Profile nav item can only be set up after
    244         // the Settings component has run its own nav routine
     251        // the Settings component has run its own nav routine.
    245252        add_action( 'bp_settings_setup_nav', array( $this, 'setup_settings_nav' ) );
    246253
     
    261268        }
    262269
    263         // Determine user to use
     270        // Determine user to use.
    264271        if ( bp_displayed_user_domain() ) {
    265272            $user_domain = bp_displayed_user_domain();
     
    270277        }
    271278
    272         // Get the settings slug
     279        // Get the settings slug.
    273280        $settings_slug = bp_get_settings_slug();
    274281
     
    285292
    286293    /**
    287      * Set up the Toolbar
     294     * Set up the Admin Bar.
     295     *
     296     * @param array $wp_admin_nav Admin Bar items.
    288297     */
    289298    public function setup_admin_bar( $wp_admin_nav = array() ) {
    290299
    291         // Menus for logged in user
     300        // Menus for logged in user.
    292301        if ( is_user_logged_in() ) {
    293302
    294             // Profile link
     303            // Profile link.
    295304            $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );
    296305
    297             // Add the "Profile" sub menu
     306            // Add the "Profile" sub menu.
    298307            $wp_admin_nav[] = array(
    299308                'parent' => buddypress()->my_account_menu_id,
     
    303312            );
    304313
    305             // View Profile
     314            // View Profile.
    306315            $wp_admin_nav[] = array(
    307316                'parent' => 'my-account-' . $this->id,
     
    311320            );
    312321
    313             // Edit Profile
     322            // Edit Profile.
    314323            $wp_admin_nav[] = array(
    315324                'parent' => 'my-account-' . $this->id,
     
    319328            );
    320329
    321             // Edit Avatar
     330            // Edit Avatar.
    322331            if ( buddypress()->avatar->show_avatars ) {
    323332                $wp_admin_nav[] = array(
     
    352361
    353362    /**
    354      * Sets up the title for pages and <title>
     363     * Sets up the title for pages and <title>.
    355364     */
    356365    public function setup_title() {
     
    375384
    376385    /**
    377      * Setup cache groups
     386     * Setup cache groups.
    378387     *
    379388     * @since 2.2.0
     
    381390    public function setup_cache_groups() {
    382391
    383         // Global groups
     392        // Global groups.
    384393        wp_cache_add_global_groups( array(
    385394            'bp_xprofile',
     
    398407     *
    399408     * @param array $wp_admin_nav The settings adminbar nav array.
     409     *
    400410     * @return array
    401411     */
    402412    public function setup_settings_admin_nav( $wp_admin_nav ) {
    403413
    404         // Setup the logged in user variables
     414        // Setup the logged in user variables.
    405415        $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() );
    406416
    407         // Add the "Profile" subnav item
     417        // Add the "Profile" subnav item.
    408418        $wp_admin_nav[] = array(
    409419            'parent' => 'my-account-' . buddypress()->settings->id,
Note: See TracChangeset for help on using the changeset viewer.