DeletePostsPage::get_bulkwp_menu_position()   A
last analyzed

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 0
Metric Value
cc 1
eloc 1
c 0
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
	 * Position in which the Bulk WP menu should appear.
19
	 */
20
	const MENU_POSITION = '26';
21
22
	/**
23
	 * Initialize and setup variables.
24
	 */
25
	protected function initialize() {
26
		$this->page_slug = 'bulk-delete-posts';
27
		$this->item_type = 'posts';
28
29
		$this->label = array(
30
			'page_title' => __( 'Bulk Delete Posts', 'bulk-delete' ),
31
			'menu_title' => __( 'Bulk Delete Posts', 'bulk-delete' ),
32
		);
33
34
		$this->messages = array(
35
			'warning_message' => __( 'WARNING: Posts deleted once cannot be retrieved back. Use with caution.', 'bulk-delete' ),
36
		);
37
38
		$this->show_link_in_plugin_list = true;
39
	}
40
41
	public function register() {
42
		add_menu_page(
43
			__( 'Bulk WP', 'bulk-delete' ),
44
			__( 'Bulk WP', 'bulk-delete' ),
45
			$this->capability,
46
			$this->page_slug,
47
			array( $this, 'render_page' ),
48
			'dashicons-trash',
49
			$this->get_bulkwp_menu_position()
50
		);
51
52
		parent::register();
53
	}
54
55
	/**
56
	 * Get the Menu position of BulkWP menu.
57
	 *
58
	 * @return int Menu position.
59
	 */
60
	protected function get_bulkwp_menu_position() {
61
		/**
62
		 * Bulk WP Menu position.
63
		 *
64
		 * @since 6.0.0
65
		 *
66
		 * @param int Menu Position.
67
		 */
68
		return apply_filters( 'bd_bulkwp_menu_position', self::MENU_POSITION );
69
	}
70
71
	/**
72
	 * Add Help tabs.
73
	 *
74
	 * @param array $help_tabs Help tabs.
75
	 *
76
	 * @return array Modified list of tabs.
77
	 */
78
	protected function add_help_tab( $help_tabs ) {
79
		$overview_tab = array(
80
			'title'    => __( 'Overview', 'bulk-delete' ),
81
			'id'       => 'overview_tab',
82
			'content'  => '<p>' . __( 'This screen contains different modules that allows you to delete posts or schedule them for deletion.', 'bulk-delete' ) . '</p>',
83
			'callback' => false,
84
		);
85
86
		$help_tabs['overview_tab'] = $overview_tab;
87
88
		return $help_tabs;
89
	}
90
}
91