Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/24/2021 04:16:17 AM (3 years ago)
Author:
espellcaste
Message:

Making PHPDoc Improvements to the BP Friends (component) files.

Also, adding several minor PHP changes.

See #8553

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-cache.php

    r11949 r13092  
    2424 */
    2525function friends_clear_friend_object_cache( $friendship_id ) {
    26     if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) )
     26    $friendship = new BP_Friends_Friendship( $friendship_id );
     27    if ( ! $friendship ) {
    2728        return false;
     29    }
    2830
    29     wp_cache_delete( 'friends_friend_ids_' .    $friendship->initiator_user_id, 'bp' );
    30     wp_cache_delete( 'friends_friend_ids_' .    $friendship->friend_user_id,    'bp' );
     31    wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' );
     32    wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' );
    3133}
    3234
    3335// List actions to clear object caches on.
    3436add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' );
    35 add_action( 'friends_friendship_deleted',  'friends_clear_friend_object_cache' );
     37add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' );
    3638
    3739/**
     
    4345 * @param int $initiator_user_id ID of the first user.
    4446 * @param int $friend_user_id    ID of the second user.
    45  * @return bool
    4647 */
    4748function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiator_user_id, $friend_user_id ) {
    4849    // Clear friendship ID cache for each user.
    4950    wp_cache_delete( $initiator_user_id, 'bp_friends_friendships_for_user' );
    50     wp_cache_delete( $friend_user_id,    'bp_friends_friendships_for_user' );
     51    wp_cache_delete( $friend_user_id, 'bp_friends_friendships_for_user' );
    5152
    5253    // Clear the friendship object cache.
     
    6061}
    6162add_action( 'friends_friendship_requested', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
    62 add_action( 'friends_friendship_accepted',  'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
    63 add_action( 'friends_friendship_deleted',   'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
     63add_action( 'friends_friendship_accepted', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
     64add_action( 'friends_friendship_deleted', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
    6465
    6566/**
     
    6970 *
    7071 * @param int                   $friendship_id The friendship ID.
    71  * @param BP_Friends_Friendship $friendship Friendship object.
     72 * @param BP_Friends_Friendship $friendship    The friendship object.
    7273 */
    73 function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id, BP_Friends_Friendship $friendship ) {
     74function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id, $friendship ) {
    7475    // Clear friendship ID cache for each user.
    7576    wp_cache_delete( $friendship->initiator_user_id, 'bp_friends_friendships_for_user' );
    76     wp_cache_delete( $friendship->friend_user_id,    'bp_friends_friendships_for_user' );
     77    wp_cache_delete( $friendship->friend_user_id, 'bp_friends_friendships_for_user' );
    7778
    7879    // Clear the friendship object cache.
     
    8384}
    8485add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
    85 add_action( 'friends_friendship_rejected',  'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
     86add_action( 'friends_friendship_rejected', 'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
    8687
    8788/**
     
    111112}
    112113add_action( 'friends_friendship_requested', 'bp_friends_clear_request_cache_on_save', 10, 3 );
    113 add_action( 'friends_friendship_accepted',  'bp_friends_clear_request_cache_on_save', 10, 3 );
     114add_action( 'friends_friendship_accepted', 'bp_friends_clear_request_cache_on_save', 10, 3 );
    114115
    115116/**
     
    121122 *
    122123 * @param int                   $friendship_id The friendship ID.
    123  * @param BP_Friends_Friendship $friendship Friendship object.
     124 * @param BP_Friends_Friendship $friendship    The friendship object.
    124125 */
    125 function bp_friends_clear_request_cache_on_remove( $friendship_id, BP_Friends_Friendship $friendship ) {
     126function bp_friends_clear_request_cache_on_remove( $friendship_id, $friendship ) {
    126127    bp_friends_clear_request_cache( $friendship->friend_user_id );
    127128}
    128129add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_request_cache_on_remove', 10, 2 );
    129 add_action( 'friends_friendship_rejected',  'bp_friends_clear_request_cache_on_remove', 10, 2 );
     130add_action( 'friends_friendship_rejected', 'bp_friends_clear_request_cache_on_remove', 10, 2 );
    130131
    131132/**
     
    134135 * @since 3.0.0
    135136 *
    136  * @param BP_Friends_Friendship $friendship Friendship object.
     137 * @param BP_Friends_Friendship $friendship The friendship object.
    137138 */
    138139function bp_friends_delete_cached_friendships_on_friendship_save( $friendship ) {
Note: See TracChangeset for help on using the changeset viewer.