PluginProbe
Bulk Delete / trunk
Bulk Delete vtrunk
6.12 trunk 0.2 0.3 0.4 0.6 0.7 0.8 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.2.1 2.2.2 3.0 3.1 All 64 releases
bulk-delete / include / addons / posts.php

posts.php in Bulk Delete trunk, at include/addons/posts.php

139 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Post Addons related functions.
5 *
6 * @since 5.5
7 *
8 * @author Sudar
9 *
10 * @package BulkDelete\Addon
11 */
12 defined('ABSPATH') || exit; // Exit if accessed directly
13
14 /**
15 * Register post related addons.
16 *
17 * @since 5.5
18 */
19 function bd_register_post_features(){ //phpcs:ignore
20 $bd = BULK_DELETE();
21
22 add_meta_box(Bulk_Delete::BOX_CUSTOM_FIELD, esc_html__('By Custom Field', 'bulk-delete'), 'bd_render_delete_posts_by_custom_field_box', $bd->posts_page, 'advanced');
23 add_meta_box(Bulk_Delete::BOX_TITLE, esc_html__('By Title', 'bulk-delete'), 'bd_render_delete_posts_by_title_box', $bd->posts_page, 'advanced');
24 add_meta_box(Bulk_Delete::BOX_DUPLICATE_TITLE, esc_html__('By Duplicate Title', 'bulk-delete'), 'bd_render_delete_posts_by_duplicate_title_box', $bd->posts_page, 'advanced');
25 add_meta_box(Bulk_Delete::BOX_POST_BY_ROLE, esc_html__('By User Role', 'bulk-delete'), 'bd_render_delete_posts_by_user_role_box', $bd->posts_page, 'advanced');
26 }
27 add_action('bd_add_meta_box_for_posts', 'bd_register_post_features');
28
29 /**
30 * Render delete posts by custom field box.
31 *
32 * @since 5.5
33 */
34 function bd_render_delete_posts_by_custom_field_box(){ //phpcs:ignore
35 if (BD_Util::is_posts_box_hidden(Bulk_Delete::BOX_CUSTOM_FIELD)) {
36 /* translators: %1$s is the URL to refresh the page */
37 bd_wp_kses_wf(sprintf(__('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));
38
39 return;
40 }
41
42 if (! class_exists('Bulk_Delete_Posts_By_Custom_Field')) {
43 ?>
44 <!-- Custom Field box start-->
45 <p>
46 <span class="bd-post-custom-field-pro" style="color:red">
47 <?php esc_html_e('Deleting posts by custom field is ', 'bulk-delete') . '<span class="open-upsell pro-feature-inline">Available in PRO</span>'; ?>
48 </span>
49 </p>
50 <!-- Custom Field box end-->
51 <?php
52 } else {
53 Bulk_Delete_Posts_By_Custom_Field::render_delete_posts_by_custom_field_box();
54 }
55 }
56
57 /**
58 * Render posts by title box.
59 *
60 * @since 5.5
61 */
62 function bd_render_delete_posts_by_title_box(){ //phpcs:ignore
63 if (BD_Util::is_posts_box_hidden(Bulk_Delete::BOX_TITLE)) {
64 /* translators: %1$s is the URL to refresh the page */
65 bd_wp_kses_wf(sprintf(__('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));
66
67 return;
68 }
69
70 if (! class_exists('Bulk_Delete_Posts_By_Title')) {
71 ?>
72 <!-- Title box start-->
73 <p>
74 <span class="bd-post-title-pro" style="color:red">
75 <?php esc_html_e('Bulk Delete Posts by Title is ', 'bulk-delete') . '<span class="open-upsell pro-feature-inline">Available in PRO</span>'; ?>
76 </span>
77 </p>
78 <!-- Title box end-->
79 <?php
80 } else {
81 Bulk_Delete_Posts_By_Title::render_delete_posts_by_title_box();
82 }
83 }
84
85 /**
86 * Render delete posts by duplicate title box.
87 *
88 * @since 5.5
89 */
90 function bd_render_delete_posts_by_duplicate_title_box(){ //phpcs:ignore
91 if (BD_Util::is_posts_box_hidden(Bulk_Delete::BOX_DUPLICATE_TITLE)) {
92 /* translators: %1$s is the URL to refresh the page */
93 bd_wp_kses_wf(sprintf(__('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));
94
95 return;
96 }
97
98 if (! class_exists('Bulk_Delete_Posts_By_Duplicate_Title')) {
99 ?>
100 <!-- Duplicate Title box start-->
101 <p>
102 <span class="bd-post-title-pro" style="color:red">
103 <?php esc_html_e('Bulk Delete Posts by Duplicate Title is ', 'bulk-delete') . '<span class="open-upsell pro-feature-inline">Available in PRO</span>'; ?>
104 </span>
105 </p>
106 <!-- Duplicate Title box end-->
107 <?php
108 } else {
109 Bulk_Delete_Posts_By_Duplicate_Title::render_delete_posts_by_duplicate_title_box();
110 }
111 }
112
113 /**
114 * Delete posts by user role.
115 *
116 * @since 5.5
117 */
118 function bd_render_delete_posts_by_user_role_box(){ //phpcs:ignore
119 if (BD_Util::is_posts_box_hidden(Bulk_Delete::BOX_POST_BY_ROLE)) {
120 /* translators: %1$s is the URL to refresh the page */
121 bd_wp_kses_wf(sprintf(__('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));
122
123 return;
124 }
125 if (! class_exists('Bulk_Delete_Posts_By_User_Role')) {
126 ?>
127 <!-- Posts by user role start-->
128 <p>
129 <span class="bd-post-by-role-pro" style="color:red">
130 <?php esc_html_e('Bulk Delete Posts by User Role is ', 'bulk-delete') . '<span class="open-upsell pro-feature-inline">Available in PRO</span>'; ?>
131 </span>
132 </p>
133 <!-- Posts by user role end-->
134 <?php
135 } else {
136 Bulk_Delete_Posts_By_User_Role::render_delete_posts_by_user_role_box();
137 }
138 }
139 ?>