PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.6
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.6
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 / Tweaks_Comments.php

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

164 lines 6.6 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 Tweaks_Comments extends AdminSettingsModel
13 {
14 public function __construct()
15 {
16 $this->tweaks_comments_settings();
17 }
18
19 public function get_defaults()
20 {
21 return [
22 'remove_comments_url' => false,
23 'remove_comments_notes' => false,
24 'remove_comments_author_link' => false,
25 'remove_comments_autolinking' => false,
26 'gravatar_query_strings' => false,
27 'enable_custom_gravatar' => false,
28 'custom_gravatar_image' => [
29 [
30 'avatar_image' => '',
31 'avatar_name' => 'Avatar Name',
32 ]
33 ]
34 ];
35 }
36
37
38 public function tweaks_comments_fields(&$comments_fields)
39 {
40 $comments_fields[] = array(
41 'type' => 'subheading',
42 'content' => Utils::adminfiy_help_urls(
43 __('Cleanup your comment form and comments template.', 'adminify'),
44 'https://wpadminify.com/kb/wp-adminify-tweaks/',
45 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
46 'https://www.facebook.com/groups/jeweltheme',
47 'https://wpadminify.com/support/'
48 )
49 );
50
51 $comments_fields[] = array(
52 'id' => 'remove_comments_url',
53 'type' => 'switcher',
54 'title' => esc_html__('Remove Website Field', 'adminify'),
55 'subtitle' => esc_html__('Remove website (URL) field from comment form template', 'adminify'),
56 'label' => esc_html__('Website field in comments is a popular way to leave spam link. You can avoid such kind of spam.', 'adminify'),
57 'text_on' => __('Yes', 'adminify'),
58 'text_off' => __('No', 'adminify'),
59 'text_width' => 80,
60 'default' => $this->get_default_field('remove_comments_url'),
61 );
62
63 $comments_fields[] = array(
64 'id' => 'remove_comments_notes',
65 'type' => 'switcher',
66 'title' => esc_html__('Remove Notes Before Comment Form', 'adminify'),
67 'subtitle' => esc_html__('Remove "Your email address will not be published..." from comment form template', 'adminify'),
68 'label' => esc_html__('This note is used on many websites. You can remove it as not unique content.', 'adminify'),
69 'text_on' => __('Yes', 'adminify'),
70 'text_off' => __('No', 'adminify'),
71 'text_width' => 80,
72 'default' => $this->get_default_field('remove_comments_notes'),
73 );
74
75 $comments_fields[] = array(
76 'id' => 'remove_comments_author_link',
77 'type' => 'switcher',
78 'title' => esc_html__('Remove Comment Author Link', 'adminify'),
79 'subtitle' => esc_html__('Remove website link from comment author name', 'adminify'),
80 'label' => esc_html__('By default comment author name is linked to its website. You can avoid this.', 'adminify'),
81 'text_on' => __('Yes', 'adminify'),
82 'text_off' => __('No', 'adminify'),
83 'text_width' => 80,
84 'default' => $this->get_default_field('remove_comments_author_link'),
85 );
86
87 $comments_fields[] = array(
88 'id' => 'remove_comments_autolinking',
89 'type' => 'switcher',
90 'title' => esc_html__('Disable Auto Linking', 'adminify'),
91 'subtitle' => esc_html__('Disable auto linking in comment content (URLs will stay as plain text as were posted)', 'adminify'),
92 'label' => esc_html__('When user adds URL as plain text to the comment WordPress automatically converts it to the link tag. You can disable this feature.', 'adminify'),
93 'text_on' => __('Yes', 'adminify'),
94 'text_off' => __('No', 'adminify'),
95 'text_width' => 80,
96 'default' => $this->get_default_field('remove_comments_autolinking'),
97 );
98
99 $comments_fields[] = array(
100 'id' => 'gravatar_query_strings',
101 'type' => 'switcher',
102 'title' => esc_html__('Remove Gravatar Query Strings', 'adminify'),
103 'text_on' => __('Yes', 'adminify'),
104 'text_off' => __('No', 'adminify'),
105 'text_width' => 80,
106 'default' => $this->get_default_field('gravatar_query_strings'),
107 );
108
109 $comments_fields[] = array(
110 'id' => 'enable_custom_gravatar',
111 'type' => 'switcher',
112 'title' => esc_html__('Custom Gravatar', 'adminify'),
113 'subtitle' => esc_html__('Add Custom Gravatar Images', 'adminify'),
114 'label' => esc_html__('If you want to Add your own Avatar Images for your users', 'adminify'),
115 'text_on' => __('Yes', 'adminify'),
116 'text_off' => __('No', 'adminify'),
117 'text_width' => 80,
118 'default' => $this->get_default_field('enable_custom_gravatar'),
119 );
120
121 $comments_fields[] = array(
122 'id' => 'custom_gravatar_image',
123 'type' => 'repeater',
124 'title' => __('Custom Avatar', 'adminify'),
125 'fields' => array(
126 array(
127 'id' => 'avatar_image',
128 'type' => 'media',
129 'title' => __('Image', 'adminify'),
130 'library' => 'image',
131 ),
132 array(
133 'id' => 'avatar_name',
134 'type' => 'text',
135 'title' => __('Name', 'adminify'),
136 ),
137 ),
138 'default' => $this->get_default_field('custom_gravatar_image'),
139 'dependency' => array('enable_custom_gravatar', '==', 'true'),
140 );
141 }
142
143 public function tweaks_comments_settings()
144 {
145
146 if (!class_exists('ADMINIFY')) {
147 return;
148 }
149
150 $comments_fields = [];
151 $this->tweaks_comments_fields($comments_fields);
152
153 \ADMINIFY::createSection(
154 $this->prefix,
155 array(
156 'title' => __('Comments', 'adminify'),
157 'parent' => 'tweaks_performance',
158 'icon' => 'fas fa-comments',
159 'fields' => $comments_fields
160 )
161 );
162 }
163 }
164