Skip to:
Content

BuddyPress.org

Changeset 9124


Ignore:
Timestamp:
11/05/2014 03:16:44 PM (11 years ago)
Author:
boonebgorges
Message:

Simplify default argument parsing in bp_core_fetch_avatar().

  • Refrain from setting a couple of unnecessary variables.
  • Remove comments, which are redundant with the docblock.

Props dcavins.
See #5958.

File:
1 edited

Legend:

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

    r8677 r9124  
    182182    global $current_blog;
    183183
    184     $bp = buddypress();
    185 
    186     // Set a few default variables
    187     $def_object = 'user';
    188     $def_type   = 'thumb';
    189     $def_class  = 'avatar';
    190 
    191     // Set the default variables array
     184    // Set the default variables array and parse it against incoming $args array.
    192185    $params = wp_parse_args( $args, array(
    193186        'item_id'    => false,
    194         'object'     => $def_object, // user/group/blog/custom type (if you use filters)
    195         'type'       => $def_type,   // thumb or full
    196         'avatar_dir' => false,       // Specify a custom avatar directory for your object
    197         'width'      => false,       // Custom width (int)
    198         'height'     => false,       // Custom height (int)
    199         'class'      => $def_class,  // Custom <img> class (string)
    200         'css_id'     => false,       // Custom <img> ID (string)
    201         'alt'        => '',          // Custom <img> alt (string)
    202         'email'      => false,       // Pass the user email (for gravatar) to prevent querying the DB for it
    203         'no_grav'    => false,       // If there is no avatar found, return false instead of a grav?
    204         'html'       => true,        // Wrap the return img URL in <img />
    205         'title'      => ''           // Custom <img> title (string)
     187        'object'     => 'user',
     188        'type'       => 'thumb',
     189        'avatar_dir' => false,
     190        'width'      => false,
     191        'height'     => false,
     192        'class'      => 'avatar',
     193        'css_id'     => false,
     194        'alt'        => '',
     195        'email'      => false,
     196        'no_grav'    => false,
     197        'html'       => true,
     198        'title'      => '',
    206199    ) );
    207200    extract( $params, EXTR_SKIP );
Note: See TracChangeset for help on using the changeset viewer.