PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Admin / Options / Module_Disable_Comments.php

Module_Disable_Comments.php in Adminify – White Label, Admin Menu Editor, Login Customizer 1.0.7, at Inc/Admin/Options/Module_Disable_Comments.php

265 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Admin\Options;
4
5 use WPAdminify\Inc\Utils;
6 use WPAdminify\Inc\Admin\AdminSettingsModel;
7
8 if (!defined('ABSPATH')) {
9 die;
10 } // Cannot access directly.
11
12 class Module_Disable_Comments extends AdminSettingsModel
13 {
14 public function __construct()
15 {
16 $this->disable_comments_settings();
17 }
18
19 public function get_defaults()
20 {
21 return [
22 'disable_comments_post_types' => ['page'],
23 'disable_comments_menu_redirect' => false,
24 'disable_comments_media' => false,
25 'disable_comments_dashboard_widget' => false,
26 'disable_comments_admin_menu' => false,
27 'disable_comments_discussion_menu' => false,
28 'disable_comments_close_front' => false,
29 'disable_comments_hide_existing' => false,
30 'disable_comments_admin_bar' => false,
31 'disable_comments_url_field' => false,
32 'disable_comments_replace_comment_link' => false,
33 'disable_comments_replace_author_link' => false,
34 ];
35 }
36
37
38 /**
39 * Option Settings
40 */
41 public function disable_comments_default_settings(&$fields)
42 {
43 $fields[] = array(
44 'type' => 'subheading',
45 'content' => Utils::adminfiy_help_urls(
46 __('Disable Comments Settings', WP_ADMINIFY_TD),
47 'https://wpadminify.com/kb/disable-comments-in-wordpress/',
48 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
49 'https://www.facebook.com/groups/jeweltheme',
50 'https://wpadminify.com/support/disable-comments/'
51 )
52 );
53
54 $fields[] = array(
55 'id' => 'disable_comments_post_types',
56 'type' => 'checkbox',
57 'title' => __('Disable Comments for', WP_ADMINIFY_TD),
58 'label' => __('Select Post Types where you want to Disable Comments', WP_ADMINIFY_TD),
59 'options' => 'post_types',
60 'default' => $this->get_default_field('disable_comments_post_types'),
61 );
62
63 if (!jltwp_adminify()->can_use_premium_code__premium_only()) {
64 $fields[] = array(
65 'type' => 'notice',
66 'style' => 'warning',
67 'content' => Utils::adminify_upgrade_pro(),
68 'dependency' => array(
69 array('disable_comments_post_types', 'not-any', 'post,page'),
70 array('disable_comments_post_types', '!=', ''),
71 ),
72 );
73 }
74
75 $fields[] = array(
76 'id' => 'disable_comments_menu_redirect',
77 'type' => 'switcher',
78 'title' => __('"Comments" Menu Redirect to Admin?', WP_ADMINIFY_TD),
79 'subtitle' => __('Admin Menu "Comments" redirect to Admin', WP_ADMINIFY_TD),
80 'text_on' => 'Yes',
81 'text_off' => 'No',
82 'text_width' => 70,
83 'default' => $this->get_default_field('disable_comments_menu_redirect'),
84
85 );
86
87 if (jltwp_adminify()->can_use_premium_code__premium_only()) {
88 $fields[] = array(
89 'id' => 'disable_comments_media',
90 'type' => 'switcher',
91 'title' => __('Remove Comments for Attachments?', WP_ADMINIFY_TD),
92 'subtitle' => __('Remove Comments for Attachments File', WP_ADMINIFY_TD),
93 'text_on' => 'Yes',
94 'text_off' => 'No',
95 'text_width' => 70,
96 'default' => $this->get_default_field('disable_comments_media'),
97 );
98 } else {
99 $fields[] = array(
100 'type' => 'notice',
101 'title' => __('Remove Comments for Attachments?', WP_ADMINIFY_TD),
102 'subtitle' => __('Remove Comments for Attachments File', WP_ADMINIFY_TD),
103 'style' => 'warning',
104 'content' => Utils::adminify_upgrade_pro()
105 );
106 }
107
108 $fields[] = array(
109 'id' => 'disable_comments_dashboard_widget',
110 'type' => 'switcher',
111 'title' => __('Remove Dashboard Comments Widget?', WP_ADMINIFY_TD),
112 'subtitle' => __('Do you want to Remove Dashboard <a href="https://wpadminify.com/kb/disable-comments-in-wordpress/" target="_blank">Comments Widget </a>', WP_ADMINIFY_TD),
113 'text_on' => 'Yes',
114 'text_off' => 'No',
115 'text_width' => 70,
116 'default' => $this->get_default_field('disable_comments_dashboard_widget'),
117 );
118
119 $fields[] = array(
120 'id' => 'disable_comments_admin_menu',
121 'type' => 'switcher',
122 'title' => __('Remove Admin Menu "Comments"', WP_ADMINIFY_TD),
123 'subtitle' => __('Remove Comments Menu from Admin Menu', WP_ADMINIFY_TD),
124 'text_on' => 'Yes',
125 'text_off' => 'No',
126 'text_width' => 70,
127 'default' => $this->get_default_field('disable_comments_admin_menu'),
128 );
129
130 $fields[] = array(
131 'id' => 'disable_comments_discussion_menu',
132 'type' => 'switcher',
133 'title' => __('Remove Submenu "Discussion"', WP_ADMINIFY_TD),
134 'subtitle' => __('Remove Discussion Menu from "Settings>Discussion" Sub Menu', WP_ADMINIFY_TD),
135 'text_on' => 'Yes',
136 'text_off' => 'No',
137 'text_width' => 70,
138 'default' => $this->get_default_field('disable_comments_discussion_menu'),
139 );
140
141 $fields[] = array(
142 'id' => 'disable_comments_close_front',
143 'type' => 'switcher',
144 'title' => __('Close Comments Front-end', WP_ADMINIFY_TD),
145 'subtitle' => __('Close Comments from front-end', WP_ADMINIFY_TD),
146 'text_on' => 'Yes',
147 'text_off' => 'No',
148 'text_width' => 70,
149 'default' => $this->get_default_field('disable_comments_close_front'),
150 );
151
152
153 if (jltwp_adminify()->can_use_premium_code__premium_only()) {
154 $fields[] = array(
155 'id' => 'disable_comments_hide_existing',
156 'type' => 'switcher',
157 'title' => __('Hide Existing Comments', WP_ADMINIFY_TD),
158 'subtitle' => __('Hide Existing Comments from front-end', WP_ADMINIFY_TD),
159 'text_on' => 'Yes',
160 'text_off' => 'No',
161 'text_width' => 70,
162 'default' => $this->get_default_field('disable_comments_hide_existing'),
163 );
164 } else {
165 $fields[] = array(
166 'type' => 'notice',
167 'title' => __('Hide Existing Comments', WP_ADMINIFY_TD),
168 'subtitle' => __('Hide Existing Comments from front-end', WP_ADMINIFY_TD),
169 'style' => 'warning',
170 'content' => Utils::adminify_upgrade_pro()
171 );
172 }
173
174
175
176 $fields[] = array(
177 'id' => 'disable_comments_admin_bar',
178 'type' => 'switcher',
179 'title' => __('Remove Comments Admin Bar', WP_ADMINIFY_TD),
180 'subtitle' => __('Remove Comments from Admin Bar', WP_ADMINIFY_TD),
181 'text_on' => 'Yes',
182 'text_off' => 'No',
183 'text_width' => 70,
184 'default' => $this->get_default_field('disable_comments_admin_bar'),
185 );
186
187 $fields[] = array(
188 'id' => 'disable_comments_url_field',
189 'type' => 'switcher',
190 'title' => __('Remove Comment Form URL Field?', WP_ADMINIFY_TD),
191 'subtitle' => __('Remove URL Field from Comment Form', WP_ADMINIFY_TD),
192 'text_on' => 'Yes',
193 'text_off' => 'No',
194 'text_width' => 70,
195 'default' => $this->get_default_field('disable_comments_url_field'),
196 );
197
198
199 if (jltwp_adminify()->can_use_premium_code__premium_only()) {
200 $fields[] = array(
201 'id' => 'disable_comments_replace_comment_link',
202 'type' => 'switcher',
203 'title' => __('Replace Comment Links to JavaScript?', WP_ADMINIFY_TD),
204 'subtitle' => 'Replace external links in comments to JavaScript form to avoid',
205 'help' => __('Superfluous external links from comments, which can be typed from a dozen and more for one article, do not bring anything good for promotion.', WP_ADMINIFY_TD) . '<br><br><b>Clearfy: </b>' . sprintf(__('Replaces the links of this kind of %s, on links of this kind %s', WP_ADMINIFY_TD), '<code>a href="http://yourdomain.com" rel="nofollow"</code>', '<code>span data-uri="http://yourdomain.com"</code>'),
206 'text_on' => 'Yes',
207 'text_off' => 'No',
208 'text_width' => 70,
209 'default' => $this->get_default_field('disable_comments_replace_comment_link'),
210 );
211 } else {
212 $fields[] = array(
213 'type' => 'notice',
214 'title' => __('Replace Comment Links to JavaScript?', WP_ADMINIFY_TD),
215 'subtitle' => 'Replace external links in comments to JavaScript form to avoid',
216 'help' => __('Superfluous external links from comments, which can be typed from a dozen and more for one article, do not bring anything good for promotion.', WP_ADMINIFY_TD) . '<br><br><b>Clearfy: </b>' . sprintf(__('Replaces the links of this kind of %s, on links of this kind %s', WP_ADMINIFY_TD), '<code>a href="http://yourdomain.com" rel="nofollow"</code>', '<code>span data-uri="http://yourdomain.com"</code>'),
217 'style' => 'warning',
218 'content' => Utils::adminify_upgrade_pro()
219 );
220 }
221
222 if (jltwp_adminify()->can_use_premium_code__premium_only()) {
223 $fields[] = array(
224 'id' => 'disable_comments_replace_author_link',
225 'type' => 'switcher',
226 'title' => __('Replace Author Links to JavaScript?', WP_ADMINIFY_TD),
227 'subtitle' => __('Replace external links in comments to JavaScript form to avoid', WP_ADMINIFY_TD),
228 'help' => __('Up to 90 percent of comments in the blog can be left for the sake of an external link. Even nofollow from page weight loss here does not help.', WP_ADMINIFY_TD) . '<br><br><b>Clearfy: </b>' . __('Replaces the links of the authors of comments on the JavaScript code, it is impossible to distinguish it from usual links.', WP_ADMINIFY_TD) . '<br>--<br><i>' . __('In some Wordpress topics this may not work.', WP_ADMINIFY_TD) . '</i>',
229 'text_on' => 'Yes',
230 'text_off' => 'No',
231 'text_width' => 70,
232 'default' => $this->get_default_field('disable_comments_replace_author_link'),
233 );
234 } else {
235 $fields[] = array(
236 'type' => 'notice',
237 'title' => __('Replace Author Links to JavaScript?', WP_ADMINIFY_TD),
238 'subtitle' => __('Replace external links in comments to JavaScript form to avoid', WP_ADMINIFY_TD),
239 'help' => __('Up to 90 percent of comments in the blog can be left for the sake of an external link. Even nofollow from page weight loss here does not help.', WP_ADMINIFY_TD) . '<br><br><b>Clearfy: </b>' . __('Replaces the links of the authors of comments on the JavaScript code, it is impossible to distinguish it from usual links.', WP_ADMINIFY_TD) . '<br>--<br><i>' . __('In some Wordpress topics this may not work.', WP_ADMINIFY_TD) . '</i>',
240 'style' => 'warning',
241 'content' => Utils::adminify_upgrade_pro()
242 );
243 }
244 }
245
246 public function disable_comments_settings()
247 {
248 if (!class_exists('ADMINIFY')) {
249 return;
250 }
251
252 $fields = [];
253 $this->disable_comments_default_settings($fields);
254
255 \ADMINIFY::createSection($this->prefix, array(
256 'title' => __('Disable Comments', WP_ADMINIFY_TD),
257 'parent' => 'module_settings',
258 'id' => 'disable_comments',
259 'icon' => 'fas fa-comment-slash',
260 'class' => 'wp-adminify-two-columns aminify-title-width-65',
261 'fields' => $fields
262 ));
263 }
264 }
265