1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BulkWP\BulkDelete\Deprecated\Addons; |
4
|
|
|
|
5
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Adds backward compatibility for Bulk Delete From Trash add-on v0.3 or below. |
9
|
|
|
* |
10
|
|
|
* This module will eventually be removed once the add-on is updated. |
11
|
|
|
* |
12
|
|
|
* @since 6.0.0 |
13
|
|
|
*/ |
14
|
|
|
class DeleteFromTrashModule extends DeprecatedModule { |
15
|
|
|
protected function initialize() { |
16
|
|
|
$this->addon_class_name = 'Bulk_Delete_From_Trash'; |
17
|
|
|
$this->addon_slug = 'bulk-delete-from-trash'; |
18
|
|
|
|
19
|
|
|
$this->item_type = 'posts'; |
20
|
|
|
$this->field_slug = 'trash'; |
21
|
|
|
$this->meta_box_slug = 'bd_posts_from_trash'; |
22
|
|
|
$this->action = 'delete_pages_from_trash'; |
23
|
|
|
$this->cron_hook = ''; |
24
|
|
|
$this->scheduler_url = ''; |
25
|
|
|
$this->messages = array( |
26
|
|
|
'box_label' => __( 'Delete Posts from Trash', 'bulk-delete' ), |
27
|
|
|
'scheduled' => '', |
28
|
|
|
'cron_label' => '', |
29
|
|
|
); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Set the item type of the module. |
34
|
|
|
* The item type determines in which page the module will be displayed. |
35
|
|
|
* |
36
|
|
|
* @param string $item_type Item type. Possible vales are posts or pages. |
37
|
|
|
*/ |
38
|
|
|
public function set_item_type( $item_type ) { |
39
|
|
|
$this->item_type = $item_type; |
40
|
|
|
$this->action = "delete_{$item_type}_from_trash"; |
41
|
|
|
$this->meta_box_slug = "bd_{$item_type}_from_trash"; |
42
|
|
|
|
43
|
|
|
if ( 'pages' === $item_type ) { |
44
|
|
|
$this->messages['box_label'] = __( 'Delete Pages from Trash', 'bulk-delete' ); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Call the appropriate action to render the add-on. |
50
|
|
|
*/ |
51
|
|
|
public function render() { |
52
|
|
|
if ( 'posts' === $this->item_type ) { |
53
|
|
|
/** |
54
|
|
|
* Render delete posts from trash box. |
55
|
|
|
* |
56
|
|
|
* @since 5.4 |
57
|
|
|
*/ |
58
|
|
|
do_action( 'bd_render_delete_posts_from_trash' ); |
59
|
|
|
} elseif ( 'pages' === $this->item_type ) { |
60
|
|
|
/** |
61
|
|
|
* Render delete pages from trash box. |
62
|
|
|
* |
63
|
|
|
* @since 5.4 |
64
|
|
|
*/ |
65
|
|
|
do_action( 'bd_render_delete_pages_from_trash' ); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|