1
|
|
|
<?php |
2
|
|
|
namespace BulkWP\BulkDelete\Core\Posts; |
3
|
|
|
|
4
|
|
|
use BulkWP\BulkDelete\Core\Base\BaseMetabox; |
5
|
|
|
|
6
|
1 |
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Metabox for deleting posts. |
10
|
|
|
* |
11
|
|
|
* @since 6.0.0 |
12
|
|
|
*/ |
13
|
|
|
abstract class PostsMetabox extends BaseMetabox { |
14
|
|
|
public function filter_js_array( $js_array ) { |
15
|
|
|
$js_array['msg']['deletePostsWarning'] = __( 'Are you sure you want to delete all the posts based on the selected option?', 'bulk-delete' ); |
16
|
|
|
$js_array['msg']['selectPostOption'] = __( 'Please select posts from at least one option', 'bulk-delete' ); |
17
|
|
|
|
18
|
|
|
$js_array['validators']['delete_posts_by_category'] = 'validateSelect2'; |
19
|
|
|
$js_array['error_msg']['delete_posts_by_category'] = 'selectCategory'; |
20
|
|
|
$js_array['msg']['selectCategory'] = __( 'Please select at least one category', 'bulk-delete' ); |
21
|
|
|
|
22
|
|
|
$js_array['validators']['delete_posts_by_tag'] = 'validateSelect2'; |
23
|
|
|
$js_array['error_msg']['delete_posts_by_category'] = 'selectTag'; |
24
|
|
|
$js_array['msg']['selectTag'] = __( 'Please select at least one tag', 'bulk-delete' ); |
25
|
|
|
|
26
|
|
|
$js_array['validators']['delete_posts_by_url'] = 'validateUrl'; |
27
|
|
|
$js_array['error_msg']['delete_posts_by_url'] = 'enterUrl'; |
28
|
|
|
$js_array['msg']['enterUrl'] = __( 'Please enter at least one post url', 'bulk-delete' ); |
29
|
|
|
|
30
|
|
|
$js_array['dt_iterators'][] = '_cats'; |
31
|
|
|
$js_array['dt_iterators'][] = '_tags'; |
32
|
|
|
$js_array['dt_iterators'][] = '_taxs'; |
33
|
|
|
$js_array['dt_iterators'][] = '_types'; |
34
|
|
|
$js_array['dt_iterators'][] = '_post_status'; |
35
|
|
|
|
36
|
|
|
return $js_array; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Delete sticky posts. |
41
|
|
|
* |
42
|
|
|
* @param bool $force_delete Whether to bypass trash and force deletion. |
43
|
|
|
* |
44
|
|
|
* @return the deteted post count. |
|
|
|
|
45
|
|
|
*/ |
46
|
|
|
public function delete_sticky_posts( $force_delete ) { |
47
|
|
|
$sticky_post_ids = get_option( 'sticky_posts' ); |
48
|
|
|
|
49
|
|
|
foreach ( $sticky_post_ids as $sticky_post_id ) { |
50
|
|
|
wp_delete_post( $sticky_post_id, $force_delete ); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return count( $sticky_post_ids ); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get the list of post statuses. |
58
|
|
|
* |
59
|
|
|
* This includes all custom post status, but excludes built-in private posts. |
60
|
|
|
* |
61
|
|
|
* @return array List of post status objects. |
62
|
|
|
*/ |
63
|
|
|
public function get_post_statuses(){ |
64
|
|
|
return bd_get_post_statuses(); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths