Code Duplication    Length = 3-6 lines in 12 locations

includes/admin/donors/donor-actions.php 5 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;
@@ 199-203 (lines=5) @@
196
197
	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
198
199
	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
200
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
201
			'response' => 403,
202
		) );
203
	}
204
205
	if ( empty( $args ) ) {
206
		return false;
@@ 281-285 (lines=5) @@
278
279
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
280
281
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
282
		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
283
			'response' => 403,
284
		) );
285
	}
286
287
	if ( empty( $args ) ) {
288
		return false;
@@ 380-384 (lines=5) @@
377
378
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
379
380
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
381
		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
382
			'response' => 403,
383
		) );
384
	}
385
386
	if ( empty( $args ) ) {
387
		return false;
@@ 470-474 (lines=5) @@
467
function give_add_donor_email( $args ) {
468
	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
469
470
	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
471
		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array(
472
			'response' => 403,
473
		) );
474
	}
475
476
	$output = array();
477
	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {

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

@@ 154-158 (lines=5) @@
151
 */
152
function give_trigger_upgrades() {
153
154
	if ( ! current_user_can( 'manage_give_settings' ) ) {
155
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
156
			'response' => 403,
157
		) );
158
	}
159
160
	$give_version = get_option( 'give_version' );
161
@@ 192-196 (lines=5) @@
189
	/* @var Give_Updates $give_updates */
190
	$give_updates = Give_Updates::get_instance();
191
192
	if ( ! current_user_can( 'manage_give_settings' ) ) {
193
		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
194
			'response' => 403,
195
		) );
196
	}
197
198
	ignore_user_abort( true );
199

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

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

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