Code Duplication    Length = 3-7 lines in 17 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;
@@ 434-438 (lines=5) @@
431
	$donor_id = '';
432
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
433
434
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
435
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
436
			'response' => 403,
437
		) );
438
	}
439
440
	$output = array();
441
	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
@@ 154-158 (lines=5) @@
151
152
	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
153
154
	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
155
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
156
			'response' => 403,
157
		) );
158
	}
159
160
	if ( empty( $args ) ) {
161
		return false;
@@ 236-240 (lines=5) @@
233
234
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
235
236
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
237
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
238
			'response' => 403,
239
		) );
240
	}
241
242
	if ( empty( $args ) ) {
243
		return false;
@@ 335-339 (lines=5) @@
332
333
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
334
335
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
336
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
337
			'response' => 403,
338
		) );
339
	}
340
341
	if ( empty( $args ) ) {
342
		return false;
@@ 615-619 (lines=5) @@
612
613
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
614
615
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
616
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
617
			'response' => 403,
618
		) );
619
	}
620
621
	$give_args            = array();
622
	$donor_ids            = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();

includes/admin/payments/actions.php 3 locations

@@ 30-32 (lines=3) @@
27
 */
28
function give_update_payment_details( $data ) {
29
30
	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
32
	}
33
34
	check_admin_referer( 'give_update_payment_details_nonce' );
35
@@ 394-396 (lines=3) @@
391
		return;
392
	}
393
394
	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
395
		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
396
	}
397
398
	$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'] ) );
399
@@ 416-418 (lines=3) @@
413
 */
414
function give_ajax_delete_payment_note() {
415
416
	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
417
		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
418
	}
419
420
	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
421
		die( '1' );

includes/emails/actions.php 1 location

@@ 55-57 (lines=3) @@
52
		return;
53
	}
54
55
	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) {
56
		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
57
	}
58
59
	give_email_donation_receipt( $purchase_id, false );
60

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

@@ 1815-1820 (lines=6) @@
1812
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1813
				'response' => 403,
1814
			) );
1815
		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1816
			wp_die( sprintf( /* translators: %s: process */
1817
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1818
				'response' => 403,
1819
			) );
1820
		}
1821
1822
		switch ( $process ) {
1823
			case 'generate':

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/upgrades/upgrade-functions.php 2 locations

@@ 184-188 (lines=5) @@
181
 */
182
function give_trigger_upgrades() {
183
184
	if ( ! current_user_can( 'manage_give_settings' ) ) {
185
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
186
			'response' => 403,
187
		) );
188
	}
189
190
	$give_version = get_option( 'give_version' );
191
@@ 222-226 (lines=5) @@
219
	/* @var Give_Updates $give_updates */
220
	$give_updates = Give_Updates::get_instance();
221
222
	if ( ! current_user_can( 'manage_give_settings' ) ) {
223
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
224
			'response' => 403,
225
		) );
226
	}
227
228
	ignore_user_abort( true );
229