Bulk_Delete_Posts   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 84
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A delete_posts_by_taxonomy() 0 4 1
A delete_posts_by_status() 0 4 1
A delete_posts_by_category() 0 4 1
A delete_posts_by_post_type() 0 4 1
A delete_posts_by_tag() 0 4 1
1
<?php
2
3
use BulkWP\BulkDelete\Core\Posts\Modules\DeletePostsByCategoryModule;
4
use BulkWP\BulkDelete\Core\Posts\Modules\DeletePostsByPostTypeModule;
5
use BulkWP\BulkDelete\Core\Posts\Modules\DeletePostsByStatusModule;
6
use BulkWP\BulkDelete\Core\Posts\Modules\DeletePostsByTagModule;
7
use BulkWP\BulkDelete\Core\Posts\Modules\DeletePostsByTaxonomyModule;
8
9
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
10
11
/**
12
 * Utility class for deleting posts.
13
 *
14
 * All the methods from this class has been migrated to individual metabox module classes.
15
 * This class is still present for backward compatibility purpose, since some of the old add-ons still depend on this class.
16
 *
17
 * @since 6.0.0 Deprecated.
18
 */
19
class Bulk_Delete_Posts {
20
	/**
21
	 * Delete posts by post status - drafts, pending posts, scheduled posts etc.
22
	 *
23
	 * @since  5.0
24
	 * @since 6.0.0 Deprecated.
25
	 * @static
26
	 *
27
	 * @param array $delete_options Options for deleting posts.
28
	 *
29
	 * @return int $posts_deleted  Number of posts that were deleted
30
	 */
31
	public static function delete_posts_by_status( $delete_options ) {
32
		$metabox = new DeletePostsByStatusModule();
33
34
		return $metabox->delete( $delete_options );
35
	}
36
37
	/**
38
	 * Delete posts by category.
39
	 *
40
	 * @since  5.0
41
	 * @since 6.0.0 Deprecated.
42
	 * @static
43
	 *
44
	 * @param array $delete_options Options for deleting posts.
45
	 *
46
	 * @return int $posts_deleted  Number of posts that were deleted
47
	 */
48
	public static function delete_posts_by_category( $delete_options ) {
49
		$metabox = new DeletePostsByCategoryModule();
50
51
		return $metabox->delete( $delete_options );
52
	}
53
54
	/**
55
	 * Delete posts by tag.
56
	 *
57
	 * @since  5.0
58
	 * @since 6.0.0 Deprecated.
59
	 * @static
60
	 *
61
	 * @param array $delete_options Options for deleting posts.
62
	 *
63
	 * @return int $posts_deleted  Number of posts that were deleted
64
	 */
65
	public static function delete_posts_by_tag( $delete_options ) {
66
		$metabox = new DeletePostsByTagModule();
67
68
		return $metabox->delete( $delete_options );
69
	}
70
71
	/**
72
	 * Delete posts by taxonomy.
73
	 *
74
	 * @since  5.0
75
	 * @since 6.0.0 Deprecated.
76
	 * @static
77
	 *
78
	 * @param array $delete_options Options for deleting posts.
79
	 *
80
	 * @return int $posts_deleted  Number of posts that were deleted
81
	 */
82
	public static function delete_posts_by_taxonomy( $delete_options ) {
83
		$metabox = new DeletePostsByTaxonomyModule();
84
85
		return $metabox->delete( $delete_options );
86
	}
87
88
	/**
89
	 * Delete posts by post type.
90
	 *
91
	 * @since  5.0
92
	 * @since 6.0.0 Deprecated.
93
	 * @static
94
	 *
95
	 * @param array $delete_options Options for deleting posts.
96
	 *
97
	 * @return int $posts_deleted  Number of posts that were deleted
98
	 */
99
	public static function delete_posts_by_post_type( $delete_options ) {
100
		$metabox = new DeletePostsByPostTypeModule();
101
102
		return $metabox->delete( $delete_options );
103
	}
104
}
105