Passed
Push — dev/6.0.0 ( 3ea23f...b70299 )
by Sudar
06:46
created

DeletePostsPage::add_plugin_action_links()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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