Code Duplication    Length = 7-7 lines in 8 locations

wp-admin/edit-tags.php 6 locations

@@ 24-30 (lines=7) @@
21
   wp_die( __( 'Sorry, you are not allowed to manage these items.' ) );
22
}
23
24
if ( ! current_user_can( $tax->cap->manage_terms ) ) {
25
	wp_die(
26
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
27
		'<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>',
28
		403
29
	);
30
}
31
32
/**
33
 * $post_type is set when the WP_Terms_List_Table instance is created
@@ 71-77 (lines=7) @@
68
69
	check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
70
71
	if ( ! current_user_can( $tax->cap->edit_terms ) ) {
72
		wp_die(
73
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
74
			'<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>',
75
			403
76
		);
77
	}
78
79
	$ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
80
	$location = 'edit-tags.php?taxonomy=' . $taxonomy;
@@ 111-117 (lines=7) @@
108
	$tag_ID = (int) $_REQUEST['tag_ID'];
109
	check_admin_referer( 'delete-tag_' . $tag_ID );
110
111
	if ( ! current_user_can( $tax->cap->delete_terms ) ) {
112
		wp_die(
113
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
114
			'<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
115
			403
116
		);
117
	}
118
119
	wp_delete_term( $tag_ID, $taxonomy );
120
@@ 128-134 (lines=7) @@
125
case 'bulk-delete':
126
	check_admin_referer( 'bulk-tags' );
127
128
	if ( ! current_user_can( $tax->cap->delete_terms ) ) {
129
		wp_die(
130
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
131
			'<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
132
			403
133
		);
134
	}
135
136
	$tags = (array) $_REQUEST['delete_tags'];
137
	foreach ( $tags as $tag_ID ) {
@@ 171-177 (lines=7) @@
168
	$tag_ID = (int) $_POST['tag_ID'];
169
	check_admin_referer( 'update-tag_' . $tag_ID );
170
171
	if ( ! current_user_can( $tax->cap->edit_terms ) ) {
172
		wp_die(
173
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
174
			'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
175
			403
176
		);
177
	}
178
179
	$tag = get_term( $tag_ID, $taxonomy );
180
	if ( ! $tag )
@@ 297-303 (lines=7) @@
294
295
require_once( ABSPATH . 'wp-admin/admin-header.php' );
296
297
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
298
	wp_die(
299
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
300
		'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
301
		403
302
	);
303
}
304
305
/** Also used by the Edit Tag  form */
306
require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' );

wp-admin/edit.php 1 location

@@ 37-43 (lines=7) @@
34
if ( ! $post_type_object )
35
	wp_die( __( 'Invalid post type.' ) );
36
37
if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
38
	wp_die(
39
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
40
		'<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
41
		403
42
	);
43
}
44
45
$wp_list_table = _get_list_table('WP_Posts_List_Table');
46
$pagenum = $wp_list_table->get_pagenum();

wp-admin/post-new.php 1 location

@@ 57-63 (lines=7) @@
54
55
$editing = true;
56
57
if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
58
	wp_die(
59
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
60
		'<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>',
61
		403
62
	);
63
}
64
65
// Schedule auto-draft cleanup
66
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )