Passed
Push — 671-feature/add-mutisite-suppo... ( 7c9bd5...e10db6 )
by Sudar
05:24
created

DeletePostsPage::get_bulkwp_menu_position()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Posts;
4
5
use BulkWP\BulkDelete\Core\Base\BaseDeletePage;
6
7
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
8
9
/**
10
 * Bulk Delete Posts Page.
11
 *
12
 * Shows the list of modules that allows you to delete posts.
13
 *
14
 * @since 6.0.0
15
 */
16
class DeletePostsPage extends BaseDeletePage {
17
18
	/**
19
	 * Initialize and setup variables.
20
	 */
21
	protected function initialize() {
22
		$this->page_slug = 'bulk-delete-posts';
23
		$this->item_type = 'posts';
24
25
		$this->label = array(
26
			'page_title' => __( 'Bulk Delete Posts', 'bulk-delete' ),
27
			'menu_title' => __( 'Bulk Delete Posts', 'bulk-delete' ),
28
		);
29
30
		$this->messages = array(
31
			'warning_message' => __( 'WARNING: Posts deleted once cannot be retrieved back. Use with caution.', 'bulk-delete' ),
32
		);
33
34
		$this->show_link_in_plugin_list = true;
35
	}
36
37
	public function register() {
38
		add_menu_page(
39
			__( 'Bulk WP', 'bulk-delete' ),
40
			__( 'Bulk WP', 'bulk-delete' ),
41
			$this->capability,
42
			$this->page_slug,
43
			array( $this, 'render_page' ),
44
			'dashicons-trash',
45
			$this->get_bulkwp_menu_position()
46
		);
47
48
		parent::register();
49
	}
50
51
	/**
52
	 * Add Help tabs.
53
	 *
54
	 * @param array $help_tabs Help tabs.
55
	 *
56
	 * @return array Modified list of tabs.
57
	 */
58
	protected function add_help_tab( $help_tabs ) {
59
		$overview_tab = array(
60
			'title'    => __( 'Overview', 'bulk-delete' ),
61
			'id'       => 'overview_tab',
62
			'content'  => '<p>' . __( 'This screen contains different modules that allows you to delete posts or schedule them for deletion.', 'bulk-delete' ) . '</p>',
63
			'callback' => false,
64
		);
65
66
		$help_tabs['overview_tab'] = $overview_tab;
67
68
		return $help_tabs;
69
	}
70
}
71