Code Duplication    Length = 3-7 lines in 15 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;
@@ 143-147 (lines=5) @@
140
141
	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
142
143
	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
144
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
145
			'response' => 403,
146
		) );
147
	}
148
149
	if ( empty( $args ) ) {
150
		return false;
@@ 225-229 (lines=5) @@
222
223
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
224
225
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
226
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
227
			'response' => 403,
228
		) );
229
	}
230
231
	if ( empty( $args ) ) {
232
		return false;
@@ 324-328 (lines=5) @@
321
322
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
323
324
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
325
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
326
			'response' => 403,
327
		) );
328
	}
329
330
	if ( empty( $args ) ) {
331
		return false;
@@ 417-421 (lines=5) @@
414
	$donor_id = '';
415
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
416
417
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
418
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
419
			'response' => 403,
420
		) );
421
	}
422
423
	$output = array();
424
	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
@@ 598-602 (lines=5) @@
595
596
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
597
598
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
599
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
600
			'response' => 403,
601
		) );
602
	}
603
604
	$give_args            = array();
605
	$donor_ids            = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();

includes/admin/tools/export/pdf-reports.php 2 locations

@@ 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
@@ 30-32 (lines=3) @@
27
 */
28
function give_generate_pdf( $data ) {
29
30
	if ( ! current_user_can( 'view_give_reports' ) ) {
31
		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
32
	}
33
34
	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );

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

includes/admin/payments/actions.php 2 locations

@@ 385-387 (lines=3) @@
382
		return;
383
	}
384
385
	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
386
		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
387
	}
388
389
	$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'] ) );
390
@@ 407-409 (lines=3) @@
404
 */
405
function give_ajax_delete_payment_note() {
406
407
	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
408
		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
409
	}
410
411
	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
412
		die( '1' );

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

@@ 1845-1850 (lines=6) @@
1842
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1843
				'response' => 403,
1844
			) );
1845
		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1846
			wp_die( sprintf( /* translators: %s: process */
1847
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1848
				'response' => 403,
1849
			) );
1850
		}
1851
1852
		switch ( $process ) {
1853
			case 'generate':

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

@@ 330-334 (lines=5) @@
327
 */
328
function give_trigger_upgrades() {
329
330
	if ( ! current_user_can( 'manage_give_settings' ) ) {
331
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
332
			'response' => 403,
333
		) );
334
	}
335
336
	$give_version = get_option( 'give_version' );
337
@@ 368-372 (lines=5) @@
365
	/* @var Give_Updates $give_updates */
366
	$give_updates = Give_Updates::get_instance();
367
368
	if ( ! current_user_can( 'manage_give_settings' ) ) {
369
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
370
			'response' => 403,
371
		) );
372
	}
373
374
	give_ignore_user_abort();
375