|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Post Addons related functions. |
|
4
|
|
|
* |
|
5
|
|
|
* @since 5.5 |
|
6
|
|
|
* @author Sudar |
|
7
|
|
|
* @package BulkDelete\Addon |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Register post related addons. |
|
14
|
|
|
* |
|
15
|
|
|
* @since 5.5 |
|
16
|
|
|
*/ |
|
17
|
|
|
function bd_register_post_addons() { |
|
18
|
|
|
$bd = BULK_DELETE(); |
|
19
|
|
|
|
|
20
|
|
|
add_meta_box( Bulk_Delete::BOX_CUSTOM_FIELD , __( 'By Custom Field' , 'bulk-delete' ) , 'bd_render_delete_posts_by_custom_field_box' , $bd->posts_page , 'advanced' ); |
|
21
|
|
|
add_meta_box( Bulk_Delete::BOX_TITLE , __( 'By Title' , 'bulk-delete' ) , 'bd_render_delete_posts_by_title_box' , $bd->posts_page , 'advanced' ); |
|
22
|
|
|
add_meta_box( Bulk_Delete::BOX_DUPLICATE_TITLE , __( 'By Duplicate Title' , 'bulk-delete' ) , 'bd_render_delete_posts_by_duplicate_title_box' , $bd->posts_page , 'advanced' ); |
|
23
|
|
|
add_meta_box( Bulk_Delete::BOX_POST_BY_ROLE , __( 'By User Role' , 'bulk-delete' ) , 'bd_render_delete_posts_by_user_role_box' , $bd->posts_page , 'advanced' ); |
|
24
|
|
|
add_meta_box( Bulk_Delete::BOX_POST_FROM_TRASH , __( 'Posts in Trash' , 'bulk-delete' ) , 'bd_render_delete_posts_from_trash' , $bd->posts_page , 'advanced' ); |
|
25
|
|
|
} |
|
26
|
|
|
add_action( 'bd_add_meta_box_for_posts', 'bd_register_post_addons' ); |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Render delete posts by custom field box |
|
30
|
|
|
* |
|
31
|
|
|
* @since 5.5 |
|
32
|
|
|
*/ |
|
33
|
|
|
function bd_render_delete_posts_by_custom_field_box() { |
|
34
|
|
|
|
|
35
|
|
|
if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_CUSTOM_FIELD ) ) { |
|
36
|
|
|
printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
|
37
|
|
|
return; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
if ( ! class_exists( 'Bulk_Delete_Posts_By_Custom_Field' ) ) { |
|
41
|
|
|
?> |
|
42
|
|
|
<!-- Custom Field box start--> |
|
43
|
|
|
<p> |
|
44
|
|
|
<span class = "bd-post-custom-field-pro" style = "color:red"> |
|
45
|
|
|
<?php _e( 'You need "Bulk Delete Posts by Custom Field" Addon, to delete post by custom field.', 'bulk-delete' ); ?> |
|
46
|
|
|
<a href = "http://bulkwp.com/addons/bulk-delete-posts-by-custom-field/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-cf">Buy now</a> |
|
47
|
|
|
</span> |
|
48
|
|
|
</p> |
|
49
|
|
|
<!-- Custom Field box end--> |
|
50
|
|
|
<?php |
|
51
|
|
|
} else { |
|
52
|
|
|
Bulk_Delete_Posts_By_Custom_Field::render_delete_posts_by_custom_field_box(); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Render posts by title box |
|
58
|
|
|
* |
|
59
|
|
|
* @since 5.5 |
|
60
|
|
|
*/ |
|
61
|
|
|
function bd_render_delete_posts_by_title_box() { |
|
62
|
|
|
|
|
63
|
|
|
if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_TITLE ) ) { |
|
64
|
|
|
printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
|
65
|
|
|
return; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
if ( ! class_exists( 'Bulk_Delete_Posts_By_Title' ) ) { |
|
69
|
|
|
?> |
|
70
|
|
|
<!-- Title box start--> |
|
71
|
|
|
<p> |
|
72
|
|
|
<span class = "bd-post-title-pro" style = "color:red"> |
|
73
|
|
|
<?php _e( 'You need "Bulk Delete Posts by Title" Addon, to delete post by title.', 'bulk-delete' ); ?> |
|
74
|
|
|
<a href = "http://bulkwp.com/addons/bulk-delete-posts-by-title/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-ti">Buy now</a> |
|
75
|
|
|
</span> |
|
76
|
|
|
</p> |
|
77
|
|
|
<!-- Title box end--> |
|
78
|
|
|
<?php |
|
79
|
|
|
} else { |
|
80
|
|
|
Bulk_Delete_Posts_By_Title::render_delete_posts_by_title_box(); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Render delete posts by duplicate title box |
|
86
|
|
|
* |
|
87
|
|
|
* @since 5.5 |
|
88
|
|
|
*/ |
|
89
|
|
|
function bd_render_delete_posts_by_duplicate_title_box() { |
|
90
|
|
|
|
|
91
|
|
|
if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_DUPLICATE_TITLE ) ) { |
|
92
|
|
|
printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
|
93
|
|
|
return; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
if ( ! class_exists( 'Bulk_Delete_Posts_By_Duplicate_Title' ) ) { |
|
97
|
|
|
?> |
|
98
|
|
|
<!-- Duplicate Title box start--> |
|
99
|
|
|
<p> |
|
100
|
|
|
<span class = "bd-post-title-pro" style = "color:red"> |
|
101
|
|
|
<?php _e( 'You need "Bulk Delete Posts by Duplicate Title" Addon, to delete post by duplicate title.', 'bulk-delete' ); ?> |
|
102
|
|
|
<a href = "http://bulkwp.com/addons/bulk-delete-posts-by-duplicate-title/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-dti">Buy now</a> |
|
103
|
|
|
</span> |
|
104
|
|
|
</p> |
|
105
|
|
|
<!-- Duplicate Title box end--> |
|
106
|
|
|
<?php |
|
107
|
|
|
} else { |
|
108
|
|
|
Bulk_Delete_Posts_By_Duplicate_Title::render_delete_posts_by_duplicate_title_box(); |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Delete posts by user role |
|
114
|
|
|
* |
|
115
|
|
|
* @since 5.5 |
|
116
|
|
|
*/ |
|
117
|
|
|
function bd_render_delete_posts_by_user_role_box() { |
|
118
|
|
|
|
|
119
|
|
|
if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_POST_BY_ROLE ) ) { |
|
120
|
|
|
printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
|
121
|
|
|
return; |
|
122
|
|
|
} |
|
123
|
|
|
if ( ! class_exists( 'Bulk_Delete_Posts_By_User_Role' ) ) { |
|
124
|
|
|
?> |
|
125
|
|
|
<!-- Posts by user role start--> |
|
126
|
|
|
<p> |
|
127
|
|
|
<span class = "bd-post-by-role-pro" style = "color:red"> |
|
128
|
|
|
<?php _e( 'You need "Bulk Delete Posts by User Role" Addon, to delete post based on User Role', 'bulk-delete' ); ?> |
|
129
|
|
|
<a href = "http://bulkwp.com/addons/bulk-delete-posts-by-user-role/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-ur">Buy now</a> |
|
130
|
|
|
</span> |
|
131
|
|
|
</p> |
|
132
|
|
|
<!-- Posts by user role end--> |
|
133
|
|
|
<?php |
|
134
|
|
|
} else { |
|
135
|
|
|
Bulk_Delete_Posts_By_User_Role::render_delete_posts_by_user_role_box(); |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Render delete posts from trash box |
|
141
|
|
|
* |
|
142
|
|
|
* @since 5.5 |
|
143
|
|
|
*/ |
|
144
|
|
|
function bd_render_delete_posts_from_trash() { |
|
145
|
|
|
if ( BD_Util::is_posts_box_hidden( Bulk_Delete::BOX_POST_FROM_TRASH ) ) { |
|
146
|
|
|
printf( __( 'This section just got enabled. Kindly <a href = "%1$s">refresh</a> the page to fully enable it.', 'bulk-delete' ), 'admin.php?page=' . Bulk_Delete::POSTS_PAGE_SLUG ); |
|
147
|
|
|
return; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
if ( ! class_exists( 'Bulk_Delete_From_Trash' ) ) { |
|
151
|
|
|
?> |
|
152
|
|
|
<!-- Posts In Trash box start--> |
|
153
|
|
|
<p> |
|
154
|
|
|
<span class = "bd-post-trash-pro" style = "color:red"> |
|
155
|
|
|
<?php _e( 'You need "Bulk Delete From Trash" Addon, to delete post in Trash.', 'bulk-delete' ); ?> |
|
156
|
|
|
<a href = "http://bulkwp.com/addons/bulk-delete-from-trash/?utm_source=wpadmin&utm_campaign=BulkDelete&utm_medium=buynow&utm_content=bd-th">Buy now</a> |
|
157
|
|
|
</span> |
|
158
|
|
|
</p> |
|
159
|
|
|
<!-- Posts In Trash box end--> |
|
160
|
|
|
<?php |
|
161
|
|
|
} else { |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* Render delete posts from trash box |
|
165
|
|
|
* |
|
166
|
|
|
* @since 5.4 |
|
167
|
|
|
*/ |
|
168
|
|
|
do_action( 'bd_render_delete_posts_from_trash' ); |
|
169
|
|
|
} |
|
170
|
|
|
} |
|
171
|
|
|
?> |
|
172
|
|
|
|