Code Duplication    Length = 3-6 lines in 14 locations

includes/admin/donors/donor-actions.php 6 locations

@@ 30-34 (lines=5) @@
27
28
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
29
30
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
32
			'response' => 403,
33
		) );
34
	}
35
36
	if ( empty( $args ) ) {
37
		return false;
@@ 410-414 (lines=5) @@
407
	$donor_id = '';
408
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
409
410
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
411
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
412
			'response' => 403,
413
		) );
414
	}
415
416
	$output = array();
417
	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
@@ 136-140 (lines=5) @@
133
134
	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
135
136
	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
137
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
138
			'response' => 403,
139
		) );
140
	}
141
142
	if ( empty( $args ) ) {
143
		return false;
@@ 218-222 (lines=5) @@
215
216
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
217
218
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
219
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
220
			'response' => 403,
221
		) );
222
	}
223
224
	if ( empty( $args ) ) {
225
		return false;
@@ 317-321 (lines=5) @@
314
315
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
316
317
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
318
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
319
			'response' => 403,
320
		) );
321
	}
322
323
	if ( empty( $args ) ) {
324
		return false;
@@ 591-595 (lines=5) @@
588
589
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
590
591
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
592
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
593
			'response' => 403,
594
		) );
595
	}
596
597
	$give_message     = array();
598
	$donor_ids        = ( is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();

includes/admin/payments/actions.php 2 locations

@@ 383-385 (lines=3) @@
380
		return;
381
	}
382
383
	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
384
		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
385
	}
386
387
	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
388
@@ 405-407 (lines=3) @@
402
 */
403
function give_ajax_delete_payment_note() {
404
405
	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
406
		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
407
	}
408
409
	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
410
		die( '1' );

includes/api/class-give-api.php 1 location

@@ 1835-1840 (lines=6) @@
1832
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1833
				'response' => 403,
1834
			) );
1835
		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1836
			wp_die( sprintf( /* translators: %s: process */
1837
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1838
				'response' => 403,
1839
			) );
1840
		}
1841
1842
		switch ( $process ) {
1843
			case 'generate':

includes/admin/tools/export/pdf-reports.php 1 location

@@ 38-40 (lines=3) @@
35
		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
36
	}
37
38
	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
40
	}
41
42
	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
43

includes/admin/reports/reports.php 1 location

@@ 142-144 (lines=3) @@
139
 */
140
function give_reports_tab_reports() {
141
142
	if( ! current_user_can( 'view_give_reports' ) ) {
143
		wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
144
	}
145
146
	$current_view = 'earnings';
147
	$views        = give_reports_default_views();

includes/admin/payments/view-payment-details.php 1 location

@@ 17-21 (lines=5) @@
14
	exit;
15
}
16
17
if ( ! current_user_can('view_give_payments') ) {
18
	wp_die( __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
		'response' => 403,
20
	) );
21
}
22
23
/**
24
 * View Order Details Page

includes/admin/upgrades/upgrade-functions.php 2 locations

@@ 260-264 (lines=5) @@
257
 */
258
function give_trigger_upgrades() {
259
260
	if ( ! current_user_can( 'manage_give_settings' ) ) {
261
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
262
			'response' => 403,
263
		) );
264
	}
265
266
	$give_version = get_option( 'give_version' );
267
@@ 298-302 (lines=5) @@
295
	/* @var Give_Updates $give_updates */
296
	$give_updates = Give_Updates::get_instance();
297
298
	if ( ! current_user_can( 'manage_give_settings' ) ) {
299
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
300
			'response' => 403,
301
		) );
302
	}
303
304
	ignore_user_abort( true );
305