Code Duplication    Length = 3-9 lines in 12 locations

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/api/class-give-api.php 1 location

@@ 1880-1885 (lines=6) @@
1877
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1878
				'response' => 403,
1879
			) );
1880
		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1881
			wp_die( sprintf( /* translators: %s: process */
1882
				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1883
				'response' => 403,
1884
			) );
1885
		}
1886
1887
		switch ( $process ) {
1888
			case 'generate':

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

@@ 179-183 (lines=5) @@
176
177
	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
178
179
	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
180
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
181
			'response' => 403,
182
		) );
183
	}
184
185
	if ( empty( $args ) ) {
186
		return false;
@@ 262-266 (lines=5) @@
259
260
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
261
262
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
263
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
264
			'response' => 403,
265
		) );
266
	}
267
268
	if ( empty( $args ) ) {
269
		return false;
@@ 355-359 (lines=5) @@
352
	$donor_id = '';
353
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
354
355
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
356
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
357
			'response' => 403,
358
		) );
359
	}
360
361
	$output = array();
362
	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
@@ 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( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array(
32
			'response' => 403,
33
		) );
34
	}
35
36
	if ( empty( $args ) ) {
37
		return false;
@@ 536-544 (lines=9) @@
533
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
534
535
	// Verify user capabilities to proceed for deleting donor.
536
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
537
		wp_die(
538
			esc_html__( 'You do not have permission to delete donors.', 'give' ),
539
			esc_html__( 'Error', 'give' ),
540
			array(
541
				'response' => 403,
542
			)
543
		);
544
	}
545
546
	$nonce_action = '';
547
	if ( 'delete_bulk_donor' === $args['give_action'] ) {

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 donation details page

includes/admin/payments/actions.php 1 location

@@ 458-460 (lines=3) @@
455
		return;
456
	}
457
458
	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
459
		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
460
	}
461
462
	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
463

includes/admin/upgrades/upgrade-functions.php 1 location

@@ 405-409 (lines=5) @@
402
 */
403
function give_trigger_upgrades() {
404
405
	if ( ! current_user_can( 'manage_give_settings' ) ) {
406
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
407
			'response' => 403,
408
		) );
409
	}
410
411
	$give_version = get_option( 'give_version' );
412