Code Duplication    Length = 16-17 lines in 3 locations

src/includes/functions.php 3 locations

@@ 809-825 (lines=17) @@
806
	// Group avatar uploads can be disabled.
807
	// The group avatar upload action was added to BuddyPress in 2.8.0.
808
	// See https://buddypress.trac.wordpress.org/changeset/11314.
809
	if ( ! bp_disable_group_avatar_uploads() && version_compare( buddypress()->version, '2.8.0-alpha', '>=' ) ) {
810
811
		$events->register(
812
			'bp_group_avatar_upload'
813
			, 'WordPoints_BP_Hook_Event_Group_Avatar_Upload'
814
			, array(
815
				'actions' => array(
816
					'toggle_on'  => 'bp_group_avatar_set',
817
					'toggle_off' => 'bp_group_avatar_delete',
818
				),
819
				'args' => array(
820
					'bp_group'     => 'WordPoints_Hook_Arg',
821
					'current:user' => 'WordPoints_BP_Hook_Arg_User_Uploading',
822
				),
823
			)
824
		);
825
	}
826
827
	// Cover image uploads can be disabled.
828
	// The cover image delete action was only added in BuddyPress 2.8.0.
@@ 830-846 (lines=17) @@
827
	// Cover image uploads can be disabled.
828
	// The cover image delete action was only added in BuddyPress 2.8.0.
829
	// See https://buddypress.trac.wordpress.org/ticket/7409.
830
	if ( ! bp_disable_group_cover_image_uploads() && version_compare( buddypress()->version, '2.8.0-alpha', '>=' ) ) {
831
832
		$events->register(
833
			'bp_group_cover_image_upload'
834
			, 'WordPoints_BP_Hook_Event_Group_Cover_Image_Upload'
835
			, array(
836
				'actions' => array(
837
					'toggle_on'  => 'bp_group_cover_image_set',
838
					'toggle_off' => 'bp_group_cover_image_delete',
839
				),
840
				'args' => array(
841
					'bp_group'     => 'WordPoints_Hook_Arg',
842
					'current:user' => 'WordPoints_BP_Hook_Arg_User_Uploading',
843
				),
844
			)
845
		);
846
	}
847
848
	if ( bp_is_active( 'activity' ) ) {
849
@@ 1349-1364 (lines=16) @@
1346
	// Cover image uploads can be disabled.
1347
	// The cover image delete action was only added in BuddyPress 2.8.0.
1348
	// See https://buddypress.trac.wordpress.org/ticket/7409.
1349
	if ( ! bp_disable_cover_image_uploads() && version_compare( buddypress()->version, '2.8.0-alpha', '>=' ) ) {
1350
1351
		$events->register(
1352
			'bp_xprofile_cover_image_upload'
1353
			, 'WordPoints_BP_Hook_Event_XProfile_Cover_Image_Upload'
1354
			, array(
1355
				'actions' => array(
1356
					'toggle_on'  => 'bp_xprofile_cover_image_set',
1357
					'toggle_off' => 'bp_xprofile_cover_image_delete',
1358
				),
1359
				'args' => array(
1360
					'user' => 'WordPoints_Hook_Arg',
1361
				),
1362
			)
1363
		);
1364
	}
1365
}
1366
1367
// EOF