Skip to content

Commit

Permalink
PROD-8099 Code reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-yudhisthir committed Jan 8, 2025
1 parent e03a487 commit 92fcc8b
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 121 deletions.
8 changes: 3 additions & 5 deletions src/bp-friends/classes/class-bp-friends-component.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
return;
}

$access = bp_core_can_edit_settings();
$slug = bp_get_friends_slug();
$friends_link = trailingslashit( $user_domain . $slug );
$enable_count = bb_member_directory_count_enable();

$access = bp_core_can_edit_settings();
$slug = bp_get_friends_slug();
$friends_link = trailingslashit( $user_domain . $slug );
$main_nav_name = __( 'Connections', 'buddyboss' );

$main_nav = array(
Expand Down
10 changes: 5 additions & 5 deletions src/bp-media/bp-media-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ function bp_media_get_total_media_count() {
*
* @return int album count of the user.
*/
function bp_media_get_total_album_count() {
function bb_media_get_total_album_count() {

add_filter( 'bp_ajax_querystring', 'bp_media_object_template_results_media_personal_scope', 20 );
bp_has_albums( bp_ajax_querystring( 'albums' ) );
Expand All @@ -858,13 +858,13 @@ function bp_media_get_total_album_count() {
remove_filter( 'bp_ajax_querystring', 'bp_media_object_template_results_media_personal_scope', 20 );

/**
* Filters the total media count for a given user.
* Filters the total media album count for a given user.
*
* @param int $count Total media count for a given user.
* @since BuddyBoss [BBVERSION]
*
* @since BuddyBoss 1.0.0
* @param int $count Total media album count for a given user.
*/
return apply_filters( 'bp_media_get_total_album_count', (int) $count );
return apply_filters( 'bb_media_get_total_album_count', (int) $count );
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/bp-templates/bp-nouveau/buddypress-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,20 @@ public function localize_scripts() {
'wpTimezone' => bp_get_option( 'timezone_string' ),
'dir_labels' => array(
'members' => array(
'singular' => esc_html( 'Member', 'buddyboss' ),
'plural' => esc_html( 'Members', 'buddyboss' ),
'singular' => esc_html__( 'Member', 'buddyboss' ),
'plural' => esc_html__( 'Members', 'buddyboss' ),
),
'followers' => array(
'singular' => esc_html( 'Follower', 'buddyboss' ),
'plural' => esc_html( 'Followers', 'buddyboss' ),
'singular' => esc_html__( 'Follower', 'buddyboss' ),
'plural' => esc_html__( 'Followers', 'buddyboss' ),
),
),
);

if ( bp_is_active( 'friends' ) ) {
$params['dir_labels']['connections'] = array(
'singular' => esc_html( 'Connection', 'buddyboss' ),
'plural' => esc_html( 'Connections', 'buddyboss' ),
'singular' => esc_html__( 'Connection', 'buddyboss' ),
'plural' => esc_html__( 'Connections', 'buddyboss' ),
);
}

Expand Down
12 changes: 10 additions & 2 deletions src/bp-templates/bp-nouveau/buddypress/groups/single/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$is_send_ajax_request = bb_is_send_ajax_request();
bp_get_template_part( 'groups/single/parts/members-subnav' );
$enable_count = bb_member_directory_count_enable();
$count = $enable_count ? groups_get_total_member_count( bp_get_current_group_id () ) : false;
$count = $enable_count ? groups_get_total_member_count( bp_get_current_group_id() ) : false;
if ( false !== $count ) {
bp_nouveau_search_form();
?>
Expand All @@ -20,7 +20,15 @@

/* translators: %d is the members count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Member', '<span class="bb-count">%d</span> Members', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
wp_kses(
_n(
'<span class="bb-count">%d</span> Member',
'<span class="bb-count">%d</span> Members',
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
}
Expand Down
10 changes: 9 additions & 1 deletion src/bp-templates/bp-nouveau/buddypress/groups/single/videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@

/* translators: %d is the video count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Video', '<span class="bb-count">%d</span> Videos', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
wp_kses(
_n(
'<span class="bb-count">%d</span> Video',
'<span class="bb-count">%d</span> Videos',
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@

/* translators: %d is the courses count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Course', '<span class="bb-count">%d</span> Courses', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
wp_kses(
_n(
'<span class="bb-count">%d</span> Course',
'<span class="bb-count">%d</span> Courses',
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
?>
Expand Down
64 changes: 30 additions & 34 deletions src/bp-templates/bp-nouveau/buddypress/members/single/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,44 @@
bp_get_template_part( 'members/single/parts/item-subnav' );
}

switch ( bp_current_action() ) :
case 'my-groups':
$count = bp_get_total_group_count_for_user( bp_displayed_user_id() );
?>
<div class="bb-item-count">
<?php
if ( ! $is_send_ajax_request ) {
$bp_current_action = bp_current_action();
$count = false;

/* translators: %d is the group count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Group', '<span class="bb-count">%d</span> Groups', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
$count
);
}
?>
</div>
<?php
break;
case 'invites':
$count = groups_get_invite_count_for_user( bp_displayed_user_id() );
?>
<div class="bb-item-count">
<?php
if ( ! $is_send_ajax_request ) {
if ( 'my-groups' === $bp_current_action ) {
$count = bp_get_total_group_count_for_user( bp_displayed_user_id() );
} elseif ( 'invites' === $bp_current_action ) {
$count = groups_get_invite_count_for_user( bp_displayed_user_id() );
}

/* translators: %d is the Invite count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Invite', '<span class="bb-count">%d</span> Invites', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
$count
);
}
?>
</div>
if ( false !== $count ) {
?>
<div class="bb-item-count">
<?php
break;
endswitch;
if ( ! $is_send_ajax_request ) {
/* translators: %d is the count */
printf(
wp_kses(
_n(
'<span class="bb-count">%d</span> ' . ( 'invites' === $bp_current_action ? 'Invite' : 'Group' ),
'<span class="bb-count">%d</span> ' . ( 'invites' === $bp_current_action ? 'Invites' : 'Groups' ),
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
}
?>
</div>
<?php
}

if ( ! bp_is_current_action( 'invites' ) ) {
bp_get_template_part( 'common/search-and-filters-bar' );
}

switch ( bp_current_action() ) :
switch ( $bp_current_action ) :

// Home/My Groups
case 'my-groups':
Expand Down
63 changes: 30 additions & 33 deletions src/bp-templates/bp-nouveau/buddypress/members/single/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,39 @@
*/

$is_send_ajax_request = bb_is_send_ajax_request();
$bp_current_action = bp_current_action();
if ( bp_is_user() ) {
switch ( bp_current_action() ) :
case 'my-media':
$count = bp_media_get_total_media_count();
?>
<div class="bb-item-count">
<?php
if ( ! $is_send_ajax_request ) {
$count = false;

/* translators: %d is the photo count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Photo', '<span class="bb-count">%d</span> Photos', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
$count
);
}
?>
</div>
if ( 'my-media' === $bp_current_action ) {
$count = $count = bp_media_get_total_media_count();
} elseif ( 'albums' === $bp_current_action && ! bp_is_single_album() ) {
$count = bb_media_get_total_album_count();
}

if ( false !== $count ) {
?>
<div class="bb-item-count">
<?php
break;
case 'albums':
if ( ! bp_is_single_album() ) {
$count = bp_media_get_total_album_count();
?>
<div class="bb-item-count">
<?php
/* translators: %d is the album count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Album', '<span class="bb-count">%d</span> Albums', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
$count
);
?>
</div>
<?php
if ( ! $is_send_ajax_request ) {
/* translators: %d is the count */
printf(
wp_kses(
_n(
'<span class="bb-count">%d</span> ' . ( 'albums' === $bp_current_action ? 'Album' : 'Photo' ),
'<span class="bb-count">%d</span> ' . ( 'albums' === $bp_current_action ? 'Albums' : 'Photos' ),
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
}
break;
endswitch;
?>
</div>
<?php
}
}
?>
<div class="bb-media-container member-media">
Expand All @@ -57,7 +54,7 @@
}
bp_get_template_part( 'document/theatre' );

switch ( bp_current_action() ) :
switch ( $bp_current_action ) :

// Home/Media.
case 'my-media':
Expand Down
47 changes: 25 additions & 22 deletions src/bp-templates/bp-nouveau/buddypress/members/single/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,33 @@
*/

$is_send_ajax_request = bb_is_send_ajax_request();

$bp_current_action = bp_current_action();
if ( bp_is_user() ) {
switch ( bp_current_action() ) :
case 'my-video':
$count = bp_video_get_total_video_count( bp_displayed_user_id() );
?>
<div class="bb-item-count">
<?php
if ( ! $is_send_ajax_request ) {

/* translators: %d is the video count */
printf(
wp_kses( _n( '<span class="bb-count">%d</span> Video', '<span class="bb-count">%d</span> Videos', $count, 'buddyboss' ), array( 'span' => array( 'class' => true ) ) ),
$count
);
}
?>
</div>
if ( 'my-video' === $bp_current_action ) {
$count = bp_video_get_total_video_count();
?>
<div class="bb-item-count">
<?php
break;
case 'albums':
break;
endswitch;
if ( ! $is_send_ajax_request ) {

/* translators: %d is the video count */
printf(
wp_kses(
_n(
'<span class="bb-count">%d</span> Video',
'<span class="bb-count">%d</span> Videos',
$count,
'buddyboss'
),
array( 'span' => array( 'class' => true ) )
),
$count
);
}
?>
</div>
<?php
}
}
?>
<div class="bb-video-container bb-media-container member-video">
Expand All @@ -42,7 +45,7 @@
bp_get_template_part( 'media/theatre' );
bp_get_template_part( 'document/theatre' );

switch ( bp_current_action() ) :
switch ( $bp_current_action ) :

// Home/Video.
case 'my-video':
Expand Down
4 changes: 2 additions & 2 deletions src/bp-templates/bp-nouveau/includes/groups/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ function bp_nouveau_groups_disallow_all_members_invites( $default = false ) {
function bp_nouveau_groups_localize_scripts( $params = array() ) {

$params['dir_labels']['groups'] = array(
'singular' => esc_html( 'Group', 'buddyboss' ),
'plural' => esc_html( 'Groups', 'buddyboss' ),
'singular' => esc_html__( 'Group', 'buddyboss' ),
'plural' => esc_html__( 'Groups', 'buddyboss' ),
);

if ( ! bp_is_group_invites() && ! ( bp_is_group_create() && bp_is_group_creation_step( 'group-invites' ) ) ) {
Expand Down
12 changes: 6 additions & 6 deletions src/bp-templates/bp-nouveau/includes/media/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ function bp_nouveau_media_localize_scripts( $params = array() ) {
$params['dir_labels'],
array(
'video' => array(
'singular' => esc_html( 'Video', 'buddyboss' ),
'plural' => esc_html( 'Videos', 'buddyboss' ),
'singular' => esc_html__( 'Video', 'buddyboss' ),
'plural' => esc_html__( 'Videos', 'buddyboss' ),
),
'album' => array(
'singular' => esc_html( 'Album', 'buddyboss' ),
'plural' => esc_html( 'Albums', 'buddyboss' ),
'singular' => esc_html__( 'Album', 'buddyboss' ),
'plural' => esc_html__( 'Albums', 'buddyboss' ),
),
'media' => array(
'singular' => esc_html( 'Photo', 'buddyboss' ),
'plural' => esc_html( 'Photos', 'buddyboss' ),
'singular' => esc_html__( 'Photo', 'buddyboss' ),
'plural' => esc_html__( 'Photos', 'buddyboss' ),
),
)
);
Expand Down
3 changes: 1 addition & 2 deletions src/bp-templates/bp-nouveau/includes/members/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* @return array An associative array of nav items.
*/
function bp_nouveau_get_members_directory_nav_items() {
$enable_count = bb_member_directory_count_enable();
$nav_items = array();
$nav_items = array();

$nav_items['all'] = array(
'component' => 'members',
Expand Down
Loading

0 comments on commit 92fcc8b

Please sign in to comment.