Strong Testimonials - Version 2.51.6

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon 128x128 Strong Testimonials
Version 2.51.6
Comparing to
See all releases

Code changes from version 2.51.5 to 2.51.6

Files changed (50) hide show
  1. admin/about/class-strong-testimonials-welcome.php +256 -256
  2. admin/admin-notices.php +181 -180
  3. admin/admin.php +334 -334
  4. admin/class-strong-testimonials-addons.php +132 -132
  5. admin/class-strong-testimonials-admin-category-list.php +69 -69
  6. admin/class-strong-testimonials-admin-list.php +347 -347
  7. admin/class-strong-testimonials-admin-scripts.php +424 -424
  8. admin/class-strong-testimonials-defaults.php +874 -873
  9. admin/class-strong-testimonials-exporter.php +80 -80
  10. admin/class-strong-testimonials-help.php +226 -226
  11. admin/class-strong-testimonials-helper.php +2559 -2559
  12. admin/class-strong-testimonials-list-table.php +1212 -1212
  13. admin/class-strong-testimonials-page-shortcodes.php +415 -415
  14. admin/class-strong-testimonials-post-editor.php +401 -401
  15. admin/class-strong-testimonials-review.php +169 -169
  16. admin/class-strong-testimonials-updater.php +1387 -1387
  17. admin/class-strong-testimonials-upsell.php +831 -831
  18. admin/class-strong-views-list-table.php +276 -276
  19. admin/class-walker-strong-category-checklist.php +127 -127
  20. admin/class-walker-strong-form-category-checklist.php +127 -127
  21. admin/compat.php +116 -116
  22. admin/css/about.css +53 -53
  23. admin/css/admin-compat.css +178 -178
  24. admin/css/admin-form.css +138 -138
  25. admin/css/fields.css +317 -317
  26. admin/css/form-preview.css +135 -135
  27. admin/css/number-spinner.css +98 -98
  28. admin/css/order.css +129 -129
  29. admin/css/polylang.css +7 -7
  30. admin/css/post-editor.css +114 -114
  31. admin/css/selectize.default.css +408 -408
  32. admin/css/uninstall.css +113 -113
  33. admin/css/views.css +1031 -1031
  34. admin/css/wpml.css +31 -31
  35. admin/custom-fields-ajax.php +123 -123
  36. admin/custom-fields.php +529 -529
  37. admin/form-preview.php +51 -51
  38. admin/img/features/email.svg +21 -21
  39. admin/img/features/filter.svg +21 -21
  40. admin/img/features/infinitescroll.svg +15 -15
  41. admin/img/features/mailchimp.svg +34 -34
  42. admin/img/features/rolemanagement.svg +17 -17
  43. admin/img/logo-long.svg +91 -91
  44. admin/js/addon-licenses.js +163 -163
  45. admin/js/admin-compat.js +117 -117
  46. admin/js/admin-fields.js +603 -603
  47. admin/js/admin-form.js +163 -163
  48. admin/js/admin-global.js +35 -35
  49. admin/js/admin-order.js +129 -129
  50. admin/js/custom-spinner.js +0 -70
admin/about/class-strong-testimonials-welcome.php CHANGED
@@ -1,256 +1,256 @@
1
- <?php
2
-
3
- class Strong_Testimonials_Welcome {
4
-
5
- public function __construct() {
6
- add_action( 'admin_menu', array( $this, 'register' ) );
7
- add_action( 'admin_head', array( $this, 'hide_menu' ) );
8
- }
9
-
10
- public function hide_menu() {
11
- remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
12
- }
13
-
14
- public function register() {
15
-
16
- add_dashboard_page(
17
- esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
18
- esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
19
- 'manage_options',
20
- 'wpmtst-getting-started',
21
- array( $this, 'output' )
22
- );
23
- }
24
-
25
- public function output() {
26
- ?>
27
- <div id="wpmtst-welcome">
28
-
29
- <div class="container">
30
-
31
- <div class="hero features">
32
-
33
- <div class="mascot">
34
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
35
- </div>
36
-
37
- <div class="block">
38
- <h1><?php esc_html_e( 'Welcome to Strong Testimonials', 'strong-testimonials' ); ?></h1>
39
- <h6><?php esc_html_e( 'Thank you for choosing Strong Testimonials - Build trust and credibility with your products.', 'strong-testimonials' ); ?></h6>
40
- </div>
41
-
42
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
43
-
44
- <div class="block">
45
-
46
- <div class="feature-list clear">
47
-
48
- <div class="feature-block first">
49
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/7.svg">
50
- <h5><?php esc_html_e( 'Increase Conversions', 'strong-testimonials' ); ?></h5>
51
- <p><?php esc_html_e( 'Make customers 63% more likely to purchase with testimonials that drive sales.', 'strong-testimonials' ); ?></p>
52
- </div>
53
-
54
- <div class="feature-block last">
55
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/8.svg">
56
- <h5><?php esc_html_e( 'Collect Testimonials', 'strong-testimonials' ); ?></h5>
57
- <p><?php esc_html_e( 'Easily collect testimonials from customers by creating forms.', 'strong-testimonials' ); ?></p>
58
- </div>
59
-
60
- <div class="feature-block first">
61
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/5.svg">
62
- <h5><?php esc_html_e( 'Multiple Layouts', 'strong-testimonials' ); ?></h5>
63
- <p><?php esc_html_e( 'Choose from four unique layouts for your testimonials.', 'strong-testimonials' ); ?></p>
64
- </div>
65
-
66
- <div class="feature-block last">
67
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
68
- <h5><?php esc_html_e( 'SEO-friendly', 'strong-testimonials' ); ?></h5>
69
- <p><?php esc_html_e( 'SEO-friendly testimonials that your customers and Search Engines can understand.', 'strong-testimonials' ); ?></p>
70
- </div>
71
-
72
- </div>
73
-
74
- <div class="button-wrap clear">
75
- <div class="left">
76
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>" class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
77
- <?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
78
- </a>
79
- </div>
80
- <div class="right">
81
- <a href="https://strongtestimonials.com/docs?utm_source=welcome_banner&utm_medium=readdocs&utm_campaign=welcome_banner"
82
- class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg" target="_blank">
83
- <?php esc_html_e( 'Read the Docs', 'strong-testimonials' ); ?>
84
- </a>
85
- </div>
86
- </div>
87
-
88
- </div>
89
-
90
- </div><!-- hero -->
91
-
92
- <div class="features">
93
-
94
- <div class="block">
95
-
96
- <h1><?php esc_html_e( 'Strong Testimonials Extensions', 'strong-testimonials' ); ?></h1>
97
- <h6><?php esc_html_e( 'Sales copy grabs attention - testimonials drive sales.', 'strong-testimonials' ); ?></h6>
98
-
99
- <div class="feature-list clear">
100
-
101
- <div class="feature-block first">
102
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/1.svg">
103
- <h5><?php esc_html_e( 'Pro Templates', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
104
- <p><?php esc_html_e( 'Create beautiful testimonial designs with a number of predesigned and easy-to-use premium templates.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/pro-templates?utm_source=welcome_banner&utm_medium=pro-templates&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
105
- </div>
106
-
107
- <div class="feature-block last">
108
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/infinitescroll.svg">
109
- <h5><?php esc_html_e( 'Infinite Scroll', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
110
- <p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/infinite-scroll/?utm_source=welcome_banner&utm_medium=infinite-scroll&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
111
- </div>
112
-
113
- <div class="feature-block first">
114
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/12.svg">
115
- <h5><?php esc_html_e( 'Testimonial Assignment', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
116
- <p><?php esc_html_e( 'Assign testimonials to custom post types for easy management and filtering.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/assignment?utm_source=welcome_banner&utm_medium=assignment&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
117
- </div>
118
-
119
- <div class="feature-block last">
120
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/11.svg">
121
- <h5><?php esc_html_e( 'Custom Properties', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
122
- <p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/properties?utm_source=welcome_banner&utm_medium=properties&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
123
- </div>
124
-
125
- <div class="feature-block first">
126
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/6.svg">
127
- <h5><?php esc_html_e( 'Advanced View Settings', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
128
- <p><?php esc_html_e( 'Customize your testimonials beyond star ratings, reorder fields and more.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/advanced-views?utm_source=welcome_banner&utm_medium=advanced-views&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
129
- </div>
130
-
131
- <div class="feature-block last">
132
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/9.svg">
133
- <h5><?php esc_html_e( 'Multiple Submission Forms', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
134
- <p><?php esc_html_e( 'Easily collect testimonials from customers by creating and customizing multiple forms at once.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/multiple-forms?utm_source=welcome_banner&utm_medium=multiple-forms&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
135
- </div>
136
-
137
- <div class="feature-block first">
138
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/10.svg">
139
- <h5><?php esc_html_e( 'Custom Form Fields', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
140
- <p><?php esc_html_e( 'Enhance your submission forms to both collect and display additional information.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/custom-fields?utm_source=welcome_banner&utm_medium=custom-fields&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
141
- </div>
142
-
143
- <div class="feature-block last">
144
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
145
- <h5><?php esc_html_e( 'SEO-friendly Testimonials', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
146
- <p><?php esc_html_e( 'Take full advantage of your testimonials with our Schema.org Markup extension.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/review-markup?utm_source=welcome_banner&utm_medium=review-markup&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
147
- </div>
148
-
149
- <div class="feature-block first">
150
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/13.svg">
151
- <h5><?php esc_html_e( 'Spam Control', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
152
- <p><?php esc_html_e( 'Protect your testimonial submission forms from spam and other types of automated abuse.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/captcha?utm_source=welcome_banner&utm_medium=captcha&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
153
- </div>
154
-
155
- <div class="feature-block last">
156
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/15.svg">
157
- <h5><?php esc_html_e( 'Testimonial Importer', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
158
- <p><?php esc_html_e( 'Import reviews from 3rd party sites like: Facebook, Google, Yelp, Zomato & WooCommerce', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/importer?utm_source=welcome_banner&utm_medium=importer&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
159
- </div>
160
-
161
- <div class="feature-block first">
162
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/email.svg">
163
- <h5><?php esc_html_e( 'Enhanced Emails', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
164
- <p><?php esc_html_e( 'We added the option to send an email to the customer upon new testimonial submission. Also, to send an email to the customer when the testimonial is approved.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/enhanced-emails/?utm_source=welcome_banner&utm_medium=enhanced-emails&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
165
- </div>
166
-
167
- <div class="feature-block last">
168
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/filter.svg">
169
- <h5><?php esc_html_e( 'Filters', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
170
- <p><?php esc_html_e( 'Now you can use categories to group your testimonials and have your clients read reviews grouped by service/product type.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/filters/?utm_source=welcome_banner&utm_medium=filters&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
171
- </div>
172
-
173
- <div class="feature-block first">
174
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/rolemanagement.svg">
175
- <h5><?php esc_html_e( 'Role Management', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
176
- <p><?php esc_html_e( 'We’re giving power back to the users and admins can decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/role-management/?utm_source=welcome_banner&utm_medium=role-management&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
177
- </div>
178
-
179
- <div class="feature-block last">
180
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/mailchimp.svg">
181
- <h5><?php esc_html_e( 'Mailchimp integration', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
182
- <p><?php esc_html_e( 'Now you can subscribe your customers to a Mailchimp list.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
183
- </div>
184
-
185
- </div><!-- feature-list -->
186
-
187
- </div>
188
-
189
- </div><!-- features -->
190
-
191
- <div class="upgrade">
192
- <div class="block">
193
- <a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
194
- class="wpmtst-btn wpmtst-btn-lg wpmtst-btn-orange">
195
- <?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?>
196
- </a>
197
-
198
- </div>
199
- </div><!--/.upgrade-->
200
-
201
-
202
- <div class="testimonials">
203
-
204
- <div class="block clear">
205
- <h1>Happy users of the Strong Testimonials - premium version</h1>
206
- <div class="testimonial-block left">
207
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-1.jpg">
208
- <p><?php esc_html_e( 'Strong Testimonials is my new, go-to resource for creating pages with multiple staff bios or testimonials. It’s extremely easy to use, update, and customize, and that makes it an invaluable asset. Highly recommend!', 'strong-testimonials' ); ?>
209
- <div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
210
- <p><strong><?php esc_html_e( 'Ryan Haught' ); ?></strong><br/><?php esc_html_e( 'Digital Marketer at Heaven’s Family' ); ?></p>
211
- </div>
212
-
213
- <div class="testimonial-block right">
214
- <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-2.jpeg">
215
- <p><?php esc_html_e( 'I have used various testimonials plugins. What I get here for free is just amazing. The support is great. And updates fresh. Looking at the ability to get reviews indexed by Google is more than enough reason to get an upgrade.', 'strong-testimonials' ); ?>
216
- <div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
217
- <p><strong><?php esc_html_e( 'Johan Horak' ); ?></strong><br/><?php esc_html_e( 'Marketing at CapeHolidays' ); ?></p>
218
- </div>
219
-
220
- </div>
221
-
222
- </div><!-- testimonials -->
223
-
224
- <div class="footer">
225
-
226
- <div class="block clear">
227
-
228
- <div class="button-wrap clear">
229
- <div class="left">
230
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>"
231
- class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
232
- <?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
233
- </a>
234
- </div>
235
- <div class="right">
236
- <a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
237
- class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
238
- <?php esc_html_e( 'Upgrade now', 'strong-testimonials' ); ?>
239
- </a>
240
- </div>
241
- </div>
242
-
243
- </div>
244
-
245
- </div><!-- footer -->
246
-
247
- </div><!-- container -->
248
-
249
- </div><!-- wpmtst welcome -->
250
- <?php
251
- }
252
-
253
-
254
- }
255
-
256
- new Strong_Testimonials_Welcome();
1
+ <?php
2
+
3
+ class Strong_Testimonials_Welcome {
4
+
5
+ public function __construct() {
6
+ add_action( 'admin_menu', array( $this, 'register' ) );
7
+ add_action( 'admin_head', array( $this, 'hide_menu' ) );
8
+ }
9
+
10
+ public function hide_menu() {
11
+ remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
12
+ }
13
+
14
+ public function register() {
15
+
16
+ add_dashboard_page(
17
+ esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
18
+ esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
19
+ 'manage_options',
20
+ 'wpmtst-getting-started',
21
+ array( $this, 'output' )
22
+ );
23
+ }
24
+
25
+ public function output() {
26
+ ?>
27
+ <div id="wpmtst-welcome">
28
+
29
+ <div class="container">
30
+
31
+ <div class="hero features">
32
+
33
+ <div class="mascot">
34
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
35
+ </div>
36
+
37
+ <div class="block">
38
+ <h1><?php esc_html_e( 'Welcome to Strong Testimonials', 'strong-testimonials' ); ?></h1>
39
+ <h6><?php esc_html_e( 'Thank you for choosing Strong Testimonials - Build trust and credibility with your products.', 'strong-testimonials' ); ?></h6>
40
+ </div>
41
+
42
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
43
+
44
+ <div class="block">
45
+
46
+ <div class="feature-list clear">
47
+
48
+ <div class="feature-block first">
49
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/7.svg">
50
+ <h5><?php esc_html_e( 'Increase Conversions', 'strong-testimonials' ); ?></h5>
51
+ <p><?php esc_html_e( 'Make customers 63% more likely to purchase with testimonials that drive sales.', 'strong-testimonials' ); ?></p>
52
+ </div>
53
+
54
+ <div class="feature-block last">
55
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/8.svg">
56
+ <h5><?php esc_html_e( 'Collect Testimonials', 'strong-testimonials' ); ?></h5>
57
+ <p><?php esc_html_e( 'Easily collect testimonials from customers by creating forms.', 'strong-testimonials' ); ?></p>
58
+ </div>
59
+
60
+ <div class="feature-block first">
61
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/5.svg">
62
+ <h5><?php esc_html_e( 'Multiple Layouts', 'strong-testimonials' ); ?></h5>
63
+ <p><?php esc_html_e( 'Choose from four unique layouts for your testimonials.', 'strong-testimonials' ); ?></p>
64
+ </div>
65
+
66
+ <div class="feature-block last">
67
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
68
+ <h5><?php esc_html_e( 'SEO-friendly', 'strong-testimonials' ); ?></h5>
69
+ <p><?php esc_html_e( 'SEO-friendly testimonials that your customers and Search Engines can understand.', 'strong-testimonials' ); ?></p>
70
+ </div>
71
+
72
+ </div>
73
+
74
+ <div class="button-wrap clear">
75
+ <div class="left">
76
+ <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>" class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
77
+ <?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
78
+ </a>
79
+ </div>
80
+ <div class="right">
81
+ <a href="https://strongtestimonials.com/docs?utm_source=welcome_banner&utm_medium=readdocs&utm_campaign=welcome_banner"
82
+ class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg" target="_blank">
83
+ <?php esc_html_e( 'Read the Docs', 'strong-testimonials' ); ?>
84
+ </a>
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+ </div><!-- hero -->
91
+
92
+ <div class="features">
93
+
94
+ <div class="block">
95
+
96
+ <h1><?php esc_html_e( 'Strong Testimonials Extensions', 'strong-testimonials' ); ?></h1>
97
+ <h6><?php esc_html_e( 'Sales copy grabs attention - testimonials drive sales.', 'strong-testimonials' ); ?></h6>
98
+
99
+ <div class="feature-list clear">
100
+
101
+ <div class="feature-block first">
102
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/1.svg">
103
+ <h5><?php esc_html_e( 'Pro Templates', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
104
+ <p><?php esc_html_e( 'Create beautiful testimonial designs with a number of predesigned and easy-to-use premium templates.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/pro-templates?utm_source=welcome_banner&utm_medium=pro-templates&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
105
+ </div>
106
+
107
+ <div class="feature-block last">
108
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/infinitescroll.svg">
109
+ <h5><?php esc_html_e( 'Infinite Scroll', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
110
+ <p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/infinite-scroll/?utm_source=welcome_banner&utm_medium=infinite-scroll&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
111
+ </div>
112
+
113
+ <div class="feature-block first">
114
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/12.svg">
115
+ <h5><?php esc_html_e( 'Testimonial Assignment', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
116
+ <p><?php esc_html_e( 'Assign testimonials to custom post types for easy management and filtering.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/assignment?utm_source=welcome_banner&utm_medium=assignment&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
117
+ </div>
118
+
119
+ <div class="feature-block last">
120
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/11.svg">
121
+ <h5><?php esc_html_e( 'Custom Properties', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
122
+ <p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/properties?utm_source=welcome_banner&utm_medium=properties&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
123
+ </div>
124
+
125
+ <div class="feature-block first">
126
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/6.svg">
127
+ <h5><?php esc_html_e( 'Advanced View Settings', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
128
+ <p><?php esc_html_e( 'Customize your testimonials beyond star ratings, reorder fields and more.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/advanced-views?utm_source=welcome_banner&utm_medium=advanced-views&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
129
+ </div>
130
+
131
+ <div class="feature-block last">
132
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/9.svg">
133
+ <h5><?php esc_html_e( 'Multiple Submission Forms', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
134
+ <p><?php esc_html_e( 'Easily collect testimonials from customers by creating and customizing multiple forms at once.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/multiple-forms?utm_source=welcome_banner&utm_medium=multiple-forms&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
135
+ </div>
136
+
137
+ <div class="feature-block first">
138
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/10.svg">
139
+ <h5><?php esc_html_e( 'Custom Form Fields', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
140
+ <p><?php esc_html_e( 'Enhance your submission forms to both collect and display additional information.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/custom-fields?utm_source=welcome_banner&utm_medium=custom-fields&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
141
+ </div>
142
+
143
+ <div class="feature-block last">
144
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
145
+ <h5><?php esc_html_e( 'SEO-friendly Testimonials', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
146
+ <p><?php esc_html_e( 'Take full advantage of your testimonials with our Schema.org Markup extension.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/review-markup?utm_source=welcome_banner&utm_medium=review-markup&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
147
+ </div>
148
+
149
+ <div class="feature-block first">
150
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/13.svg">
151
+ <h5><?php esc_html_e( 'Spam Control', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
152
+ <p><?php esc_html_e( 'Protect your testimonial submission forms from spam and other types of automated abuse.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/captcha?utm_source=welcome_banner&utm_medium=captcha&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
153
+ </div>
154
+
155
+ <div class="feature-block last">
156
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/15.svg">
157
+ <h5><?php esc_html_e( 'Testimonial Importer', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
158
+ <p><?php esc_html_e( 'Import reviews from 3rd party sites like: Facebook, Google, Yelp, Zomato & WooCommerce', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/importer?utm_source=welcome_banner&utm_medium=importer&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
159
+ </div>
160
+
161
+ <div class="feature-block first">
162
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/email.svg">
163
+ <h5><?php esc_html_e( 'Enhanced Emails', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
164
+ <p><?php esc_html_e( 'We added the option to send an email to the customer upon new testimonial submission. Also, to send an email to the customer when the testimonial is approved.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/enhanced-emails/?utm_source=welcome_banner&utm_medium=enhanced-emails&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
165
+ </div>
166
+
167
+ <div class="feature-block last">
168
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/filter.svg">
169
+ <h5><?php esc_html_e( 'Filters', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
170
+ <p><?php esc_html_e( 'Now you can use categories to group your testimonials and have your clients read reviews grouped by service/product type.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/filters/?utm_source=welcome_banner&utm_medium=filters&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
171
+ </div>
172
+
173
+ <div class="feature-block first">
174
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/rolemanagement.svg">
175
+ <h5><?php esc_html_e( 'Role Management', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
176
+ <p><?php esc_html_e( 'We’re giving power back to the users and admins can decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/role-management/?utm_source=welcome_banner&utm_medium=role-management&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
177
+ </div>
178
+
179
+ <div class="feature-block last">
180
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/mailchimp.svg">
181
+ <h5><?php esc_html_e( 'Mailchimp integration', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
182
+ <p><?php esc_html_e( 'Now you can subscribe your customers to a Mailchimp list.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
183
+ </div>
184
+
185
+ </div><!-- feature-list -->
186
+
187
+ </div>
188
+
189
+ </div><!-- features -->
190
+
191
+ <div class="upgrade">
192
+ <div class="block">
193
+ <a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
194
+ class="wpmtst-btn wpmtst-btn-lg wpmtst-btn-orange">
195
+ <?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?>
196
+ </a>
197
+
198
+ </div>
199
+ </div><!--/.upgrade-->
200
+
201
+
202
+ <div class="testimonials">
203
+
204
+ <div class="block clear">
205
+ <h1>Happy users of the Strong Testimonials - premium version</h1>
206
+ <div class="testimonial-block left">
207
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-1.jpg">
208
+ <p><?php esc_html_e( 'Strong Testimonials is my new, go-to resource for creating pages with multiple staff bios or testimonials. It’s extremely easy to use, update, and customize, and that makes it an invaluable asset. Highly recommend!', 'strong-testimonials' ); ?>
209
+ <div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
210
+ <p><strong><?php esc_html_e( 'Ryan Haught' ); ?></strong><br/><?php esc_html_e( 'Digital Marketer at Heaven’s Family' ); ?></p>
211
+ </div>
212
+
213
+ <div class="testimonial-block right">
214
+ <img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-2.jpeg">
215
+ <p><?php esc_html_e( 'I have used various testimonials plugins. What I get here for free is just amazing. The support is great. And updates fresh. Looking at the ability to get reviews indexed by Google is more than enough reason to get an upgrade.', 'strong-testimonials' ); ?>
216
+ <div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
217
+ <p><strong><?php esc_html_e( 'Johan Horak' ); ?></strong><br/><?php esc_html_e( 'Marketing at CapeHolidays' ); ?></p>
218
+ </div>
219
+
220
+ </div>
221
+
222
+ </div><!-- testimonials -->
223
+
224
+ <div class="footer">
225
+
226
+ <div class="block clear">
227
+
228
+ <div class="button-wrap clear">
229
+ <div class="left">
230
+ <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>"
231
+ class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
232
+ <?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
233
+ </a>
234
+ </div>
235
+ <div class="right">
236
+ <a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
237
+ class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
238
+ <?php esc_html_e( 'Upgrade now', 'strong-testimonials' ); ?>
239
+ </a>
240
+ </div>
241
+ </div>
242
+
243
+ </div>
244
+
245
+ </div><!-- footer -->
246
+
247
+ </div><!-- container -->
248
+
249
+ </div><!-- wpmtst welcome -->
250
+ <?php
251
+ }
252
+
253
+
254
+ }
255
+
256
+ new Strong_Testimonials_Welcome();
admin/admin-notices.php CHANGED
@@ -1,180 +1,181 @@
1
- <?php
2
- /**
3
- * Admin notices
4
- */
5
-
6
-
7
- /**
8
- * Dismiss persistent notices.
9
- *
10
- * @since 2.29.0
11
- */
12
- function wpmtst_dismiss_notice_ajax() {
13
- if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
- echo 0;
15
- wp_die();
16
- }
17
-
18
- check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
- wpmtst_delete_admin_notice( $_POST['key'] );
20
- wp_die();
21
- }
22
-
23
- add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
-
25
- /**
26
- * Print admin notices.
27
- *
28
- * @since 2.24.0
29
- */
30
- function wpmtst_admin_notices() {
31
- $notices = get_option( 'wpmtst_admin_notices' );
32
- if ( ! $notices ) {
33
- return;
34
- }
35
-
36
- foreach ( $notices as $key => $notice ) {
37
- $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
- if ( $message ) {
39
- echo $message;
40
- }
41
- if ( ! $notice['persist'] ) {
42
- wpmtst_delete_admin_notice( $key );
43
- }
44
- }
45
- }
46
- add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
-
48
-
49
- /**
50
- * Return specific admin notice text.
51
- *
52
- * @since 2.28.5
53
- * @param string $html
54
- * @param $key
55
- *
56
- * @return string
57
- */
58
- function wpmtst_admin_notice_text( $html, $key, $persist = false ) {
59
-
60
- switch ( $key ) {
61
- case 'defaults-restored' :
62
- ob_start();
63
- ?>
64
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
- <p>
66
- <?php esc_html_e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
- </p>
68
- </div>
69
- <?php
70
- $html = ob_get_clean();
71
- break;
72
-
73
- case 'fields-saved' :
74
- ob_start();
75
- ?>
76
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
- <p>
78
- <?php esc_html_e( 'Fields saved.', 'strong-testimonials' ); ?>
79
- </p>
80
- </div>
81
- <?php
82
- $html = ob_get_clean();
83
- break;
84
-
85
- case 'changes-cancelled' :
86
- ob_start();
87
- ?>
88
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
- <p>
90
- <?php esc_html_e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
- </p>
92
- </div>
93
- <?php
94
- $html = ob_get_clean();
95
- break;
96
-
97
- case 'captcha-options-changed' :
98
- $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
- //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
- $settings_url = admin_url( '?action=captcha-options-changed' );
101
- $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), esc_html__( 'settings', 'strong-testimonials' ) );
102
-
103
- ob_start();
104
- ?>
105
- <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
106
- <p>
107
- <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
- <?php echo esc_url( $settings_link ); ?>
109
- </p>
110
- </div>
111
- <?php
112
- $html = ob_get_clean();
113
- break;
114
-
115
- default :
116
- // nothing
117
- }
118
-
119
- return $html;
120
- }
121
- add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
-
123
-
124
- /**
125
- * Add admin notice to queue.
126
- *
127
- * @since 2.24.0
128
- *
129
- * @param $key
130
- * @param $persist
131
- */
132
- function wpmtst_add_admin_notice( $key, $persist = false ) {
133
- $notices = get_option( 'wpmtst_admin_notices', array() );
134
- $notices[ $key ] = array( 'persist' => $persist );
135
- update_option( 'wpmtst_admin_notices', $notices, 'no' );
136
- }
137
-
138
-
139
- /**
140
- * Delete admin notice from queue.
141
- *
142
- * @since 2.24.0
143
- *
144
- * @param $key
145
- */
146
- function wpmtst_delete_admin_notice( $key ) {
147
- $notices = get_option( 'wpmtst_admin_notices', array() );
148
- if ( isset( $notices[ $key ] ) ) {
149
- unset( $notices[ $key ] );
150
- update_option( 'wpmtst_admin_notices', $notices, 'no' );
151
- }
152
- }
153
-
154
-
155
- /**
156
- * Automatically dismiss specific notices when settings are saved.
157
- *
158
- * @since 2.29.0
159
- * @param $option
160
- * @param $old_value
161
- * @param $value
162
- */
163
- function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
164
- if ( ! function_exists( 'get_current_screen' ) ) {
165
- return;
166
- }
167
-
168
- $screen = get_current_screen();
169
- if ( $screen && 'options' == $screen->base ) {
170
- if ( 'wpmtst_form_options' == $option ) {
171
- $notices = get_option( 'wpmtst_admin_notices', array() );
172
- if ( isset( $notices['captcha-options-changed'] ) ) {
173
- unset( $notices['captcha-options-changed'] );
174
- update_option( 'wpmtst_admin_notices', $notices, 'no' );
175
- }
176
- }
177
- }
178
- }
179
- add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
180
-
 
1
+ <?php
2
+ /**
3
+ * Admin notices
4
+ */
5
+
6
+
7
+ /**
8
+ * Dismiss persistent notices.
9
+ *
10
+ * @since 2.29.0
11
+ */
12
+ function wpmtst_dismiss_notice_ajax() {
13
+ if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
+ echo 0;
15
+ wp_die();
16
+ }
17
+
18
+ check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
+ wpmtst_delete_admin_notice( $_POST['key'] );
20
+ wp_die();
21
+ }
22
+
23
+ add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
+
25
+ /**
26
+ * Print admin notices.
27
+ *
28
+ * @since 2.24.0
29
+ */
30
+ function wpmtst_admin_notices() {
31
+ $notices = get_option( 'wpmtst_admin_notices' );
32
+ if ( ! $notices ) {
33
+ return;
34
+ }
35
+
36
+ foreach ( $notices as $key => $notice ) {
37
+ $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
+ if ( $message ) {
39
+ echo $message;
40
+ }
41
+ if ( ! $notice['persist'] ) {
42
+ wpmtst_delete_admin_notice( $key );
43
+ }
44
+ }
45
+ }
46
+ add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
+
48
+
49
+ /**
50
+ * Return specific admin notice text.
51
+ *
52
+ * @since 2.28.5
53
+ * @param string $html
54
+ * @param $key
55
+ *
56
+ * @return string
57
+ */
58
+ function wpmtst_admin_notice_text( $html, $key, $persist = false ) {
59
+
60
+ switch ( $key ) {
61
+ case 'defaults-restored' :
62
+ ob_start();
63
+ ?>
64
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
+ <p>
66
+ <?php esc_html_e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
+ </p>
68
+ </div>
69
+ <?php
70
+ $html = ob_get_clean();
71
+ break;
72
+
73
+ case 'fields-saved' :
74
+ ob_start();
75
+ ?>
76
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
+ <p>
78
+ <?php esc_html_e( 'Fields saved.', 'strong-testimonials' ); ?>
79
+ </p>
80
+ </div>
81
+ <?php
82
+ $html = ob_get_clean();
83
+ break;
84
+
85
+ case 'changes-cancelled' :
86
+ ob_start();
87
+ ?>
88
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
+ <p>
90
+ <?php esc_html_e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
+ </p>
92
+ </div>
93
+ <?php
94
+ $html = ob_get_clean();
95
+ break;
96
+
97
+ case 'captcha-options-changed' :
98
+ $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
+ //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
+ $settings_url = admin_url( '?action=captcha-options-changed' );
101
+ $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), esc_html__( 'settings', 'strong-testimonials' ) );
102
+
103
+ ob_start();
104
+ ?>
105
+ <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
106
+ <p>
107
+ <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
+ <?php echo esc_url( $settings_link ); ?>
109
+ </p>
110
+ </div>
111
+ <?php
112
+ $html = ob_get_clean();
113
+ break;
114
+
115
+ default :
116
+ $html = apply_filters( 'wpmtst_' . $key . '_notice', '' );
117
+ // nothing
118
+ }
119
+
120
+ return $html;
121
+ }
122
+ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
123
+
124
+
125
+ /**
126
+ * Add admin notice to queue.
127
+ *
128
+ * @since 2.24.0
129
+ *
130
+ * @param $key
131
+ * @param $persist
132
+ */
133
+ function wpmtst_add_admin_notice( $key, $persist = false ) {
134
+ $notices = get_option( 'wpmtst_admin_notices', array() );
135
+ $notices[ $key ] = array( 'persist' => $persist );
136
+ update_option( 'wpmtst_admin_notices', $notices, 'no' );
137
+ }
138
+
139
+
140
+ /**
141
+ * Delete admin notice from queue.
142
+ *
143
+ * @since 2.24.0
144
+ *
145
+ * @param $key
146
+ */
147
+ function wpmtst_delete_admin_notice( $key ) {
148
+ $notices = get_option( 'wpmtst_admin_notices', array() );
149
+ if ( isset( $notices[ $key ] ) ) {
150
+ unset( $notices[ $key ] );
151
+ update_option( 'wpmtst_admin_notices', $notices, 'no' );
152
+ }
153
+ }
154
+
155
+
156
+ /**
157
+ * Automatically dismiss specific notices when settings are saved.
158
+ *
159
+ * @since 2.29.0
160
+ * @param $option
161
+ * @param $old_value
162
+ * @param $value
163
+ */
164
+ function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
165
+ if ( ! function_exists( 'get_current_screen' ) ) {
166
+ return;
167
+ }
168
+
169
+ $screen = get_current_screen();
170
+ if ( $screen && 'options' == $screen->base ) {
171
+ if ( 'wpmtst_form_options' == $option ) {
172
+ $notices = get_option( 'wpmtst_admin_notices', array() );
173
+ if ( isset( $notices['captcha-options-changed'] ) ) {
174
+ unset( $notices['captcha-options-changed'] );
175
+ update_option( 'wpmtst_admin_notices', $notices, 'no' );
176
+ }
177
+ }
178
+ }
179
+ }
180
+ add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
181
+
admin/admin.php CHANGED
@@ -1,335 +1,335 @@
1
- <?php
2
- /**
3
- * Strong Testimonials admin functions.
4
- *
5
- * 1. Check for required WordPress version.
6
- * 2. Check for plugin update.
7
- * 3. Initialize.
8
- */
9
-
10
- /**
11
- * Check for required WordPress version.
12
- */
13
- function wpmtst_version_check() {
14
- global $wp_version;
15
- $require_wp_version = "3.7";
16
-
17
- if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
- deactivate_plugins( WPMTST_PLUGIN );
19
- /* translators: %s is the name of the plugin. */
20
- $message = '<h2>' . sprintf( esc_html_x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
- /* translators: %s is a WordPress version number. */
22
- $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
- $message .= '<p>' . esc_html_x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
- $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
- wp_die( $message );
26
- }
27
- }
28
-
29
- add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
-
31
- /**
32
- * Check for plugin update.
33
- *
34
- * @since 2.28.4 Before other admin_init actions.
35
- */
36
- function wpmtst_update_check() {
37
- $version = get_option( 'wpmtst_plugin_version', false );
38
- if ( $version == WPMTST_VERSION ) {
39
- return;
40
- }
41
- // Redirect to About page afterwards. On new install or (de)activation only.
42
- if ( false === $version ) {
43
- add_option( 'wpmtst_do_activation_redirect', true );
44
- }
45
-
46
- Strong_Testimonials_Updater::update();
47
- }
48
-
49
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
-
51
- /**
52
- * Initialize.
53
- */
54
- function wpmtst_admin_init() {
55
- /**
56
- * Redirect to About page for new installs only
57
- *
58
- * @since 2.28.4
59
- */
60
- wpmtst_activation_redirect();
61
-
62
- /**
63
- * Custom action hooks
64
- *
65
- * @since 1.18.4
66
- */
67
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
- $action = sanitize_text_field( $_REQUEST['action'] );
69
- do_action( 'wpmtst_' . $action );
70
- }
71
- }
72
-
73
- add_action( 'admin_init', 'wpmtst_admin_init' );
74
-
75
- /**
76
- * Custom action link in admin notice.
77
- *
78
- * @since 2.29.0
79
- */
80
- function wpmtst_action_captcha_options_changed() {
81
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
82
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
83
- exit;
84
- }
85
-
86
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
87
-
88
- /**
89
- * Redirect to About page.
90
- *
91
- * @since 2.28.4
92
- */
93
- function wpmtst_activation_redirect() {
94
- if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
95
- delete_option( 'wpmtst_do_activation_redirect' );
96
- wp_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
97
- exit;
98
- }
99
- }
100
-
101
- /**
102
- * Are we on a testimonial admin screen?
103
- *
104
- * Used by add-ons too!
105
- *
106
- * @return bool
107
- */
108
- function wpmtst_is_testimonial_screen() {
109
- $screen = get_current_screen();
110
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
111
- }
112
-
113
- /**
114
- * Add pending numbers to post types on admin menu.
115
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
116
- *
117
- * @param $menu
118
- *
119
- * @return mixed
120
- */
121
- function wpmtst_pending_indicator( $menu ) {
122
- if ( ! current_user_can( 'edit_posts' ) )
123
- return $menu;
124
-
125
- $options = get_option( 'wpmtst_options' );
126
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
127
- return $menu;
128
-
129
- $types = array( 'wpm-testimonial' );
130
- $status = 'pending';
131
- foreach ( $types as $type ) {
132
- $num_posts = wp_count_posts( $type, 'readable' );
133
- $pending_count = 0;
134
- if ( ! empty( $num_posts->$status ) )
135
- $pending_count = $num_posts->$status;
136
-
137
- if ( $type == 'post' )
138
- $menu_str = 'edit.php';
139
- else
140
- $menu_str = 'edit.php?post_type=' . $type;
141
-
142
- foreach ( $menu as $menu_key => $menu_data ) {
143
- if ( $menu_str != $menu_data[2] )
144
- continue;
145
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
146
- }
147
- }
148
-
149
- return $menu;
150
- }
151
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
152
-
153
- /**
154
- * The [restore default] icon.
155
- *
156
- * @param $for
157
- *
158
- * @since 2.18.0
159
- */
160
- function wpmtst_restore_default_icon( $for ) {
161
- if ( !$for ) return;
162
- ?>
163
- <input type="button" class="button secondary restore-default"
164
- title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
165
- value="&#xf171"
166
- data-for="<?php echo esc_attr( $for ); ?>"/>
167
- <?php
168
- }
169
-
170
-
171
-
172
- /**
173
- * Check for configuration issues when options are updated.
174
- *
175
- * @since 2.24.0
176
- * @param $option
177
- * @param $old_value
178
- * @param $value
179
- */
180
- function wpmtst_updated_option( $option, $old_value, $value ) {
181
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
182
- do_action( 'wpmtst_check_config' );
183
- }
184
- }
185
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
186
-
187
-
188
- /**
189
- * Store configuration error.
190
- *
191
- * @since 2.24.0
192
- * @param $key
193
- */
194
- function wpmtst_add_config_error( $key ) {
195
- $errors = get_option( 'wpmtst_config_errors', array() );
196
- $errors[] = $key;
197
- update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
198
-
199
- wpmtst_add_admin_notice( $key, true );
200
- }
201
-
202
-
203
- /**
204
- * Delete configuration error.
205
- *
206
- * @since 2.24.0
207
- * @param $key
208
- */
209
- function wpmtst_delete_config_error( $key ) {
210
- $errors = get_option( 'wpmtst_config_errors', array() );
211
- $errors = array_diff( $errors, array ( $key ) );
212
- update_option( 'wpmtst_config_errors', $errors, 'no' );
213
-
214
- wpmtst_delete_admin_notice( $key );
215
- }
216
-
217
-
218
- /**
219
- * Save a View.
220
- *
221
- * @param $view
222
- * @param string $action
223
- * @usedby Strong_Testimonials_Update:update_views
224
- *
225
- * @return bool|false|int
226
- */
227
- function wpmtst_save_view( $view, $action = 'edit' ) {
228
- global $wpdb;
229
-
230
- if ( ! $view ) return false;
231
-
232
- $table_name = $wpdb->prefix . 'strong_views';
233
- $serialized = serialize( $view['data'] );
234
-
235
- if ( 'add' == $action || 'duplicate' == $action ) {
236
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
237
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
238
- $wpdb->query( $sql );
239
- $view['id'] = $wpdb->insert_id;
240
- $return = $view['id'];
241
- }
242
- else {
243
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
244
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
245
- $wpdb->query( $sql );
246
- $return = $wpdb->last_error ? 0 : 1;
247
- }
248
-
249
- do_action( 'wpmtst_view_saved', $view );
250
-
251
- return $return;
252
- }
253
-
254
-
255
- /**
256
- * @param $field
257
- *
258
- * @return mixed
259
- */
260
- function wpmtst_get_field_label( $field ) {
261
- if ( isset( $field['field'] ) ) {
262
- $custom_fields = wpmtst_get_custom_fields();
263
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
264
- return $custom_fields[ $field['field'] ]['label'];
265
- }
266
- $builtin_fields = wpmtst_get_builtin_fields();
267
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
268
- return $builtin_fields[ $field['field'] ]['label'];
269
- }
270
- }
271
-
272
- return '';
273
- }
274
-
275
- function wpmtst_get_field_text( $field ) {
276
- if ( isset( $field['field'] ) ) {
277
- $custom_fields = wpmtst_get_custom_fields();
278
- if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
279
- return $custom_fields[ $field['field'] ]['text'];
280
- }
281
- $builtin_fields = wpmtst_get_builtin_fields();
282
- if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
283
- return $builtin_fields[ $field['field'] ]['text'];
284
- }
285
- }
286
-
287
- return '';
288
- }
289
-
290
-
291
- /**
292
- * @param string $field_name
293
- *
294
- * @return mixed
295
- */
296
- function wpmtst_get_field_by_name( $field_name = '' ) {
297
- if ( $field_name ) {
298
- $custom_fields = wpmtst_get_custom_fields();
299
- if ( isset( $custom_fields[ $field_name ] ) ) {
300
- return $custom_fields[ $field_name ];
301
- }
302
- }
303
-
304
- return '';
305
- }
306
-
307
- /**
308
- * Returns true if at least one extension is installed
309
- */
310
- function wpmtst_extensions_installed() {
311
-
312
- if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
313
- return true;
314
- }
315
- if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
316
- return true;
317
- }
318
- if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
319
- return true;
320
- }
321
- if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
322
- return true;
323
- }
324
- if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
325
- return true;
326
- }
327
- if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
328
- return true;
329
- }
330
- if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
331
- return true;
332
- }
333
-
334
- return false;
335
  }
1
+ <?php
2
+ /**
3
+ * Strong Testimonials admin functions.
4
+ *
5
+ * 1. Check for required WordPress version.
6
+ * 2. Check for plugin update.
7
+ * 3. Initialize.
8
+ */
9
+
10
+ /**
11
+ * Check for required WordPress version.
12
+ */
13
+ function wpmtst_version_check() {
14
+ global $wp_version;
15
+ $require_wp_version = "3.7";
16
+
17
+ if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
+ deactivate_plugins( WPMTST_PLUGIN );
19
+ /* translators: %s is the name of the plugin. */
20
+ $message = '<h2>' . sprintf( esc_html_x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
+ /* translators: %s is a WordPress version number. */
22
+ $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
+ $message .= '<p>' . esc_html_x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
+ $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
+ wp_die( $message );
26
+ }
27
+ }
28
+
29
+ add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
+
31
+ /**
32
+ * Check for plugin update.
33
+ *
34
+ * @since 2.28.4 Before other admin_init actions.
35
+ */
36
+ function wpmtst_update_check() {
37
+ $version = get_option( 'wpmtst_plugin_version', false );
38
+ if ( $version == WPMTST_VERSION ) {
39
+ return;
40
+ }
41
+ // Redirect to About page afterwards. On new install or (de)activation only.
42
+ if ( false === $version ) {
43
+ add_option( 'wpmtst_do_activation_redirect', true );
44
+ }
45
+
46
+ Strong_Testimonials_Updater::update();
47
+ }
48
+
49
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
+
51
+ /**
52
+ * Initialize.
53
+ */
54
+ function wpmtst_admin_init() {
55
+ /**
56
+ * Redirect to About page for new installs only
57
+ *
58
+ * @since 2.28.4
59
+ */
60
+ wpmtst_activation_redirect();
61
+
62
+ /**
63
+ * Custom action hooks
64
+ *
65
+ * @since 1.18.4
66
+ */
67
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
+ $action = sanitize_text_field( $_REQUEST['action'] );
69
+ do_action( 'wpmtst_' . $action );
70
+ }
71
+ }
72
+
73
+ add_action( 'admin_init', 'wpmtst_admin_init' );
74
+
75
+ /**
76
+ * Custom action link in admin notice.
77
+ *
78
+ * @since 2.29.0
79
+ */
80
+ function wpmtst_action_captcha_options_changed() {
81
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
82
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
83
+ exit;
84
+ }
85
+
86
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
87
+
88
+ /**
89
+ * Redirect to About page.
90
+ *
91
+ * @since 2.28.4
92
+ */
93
+ function wpmtst_activation_redirect() {
94
+ if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
95
+ delete_option( 'wpmtst_do_activation_redirect' );
96
+ wp_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
97
+ exit;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Are we on a testimonial admin screen?
103
+ *
104
+ * Used by add-ons too!
105
+ *
106
+ * @return bool
107
+ */
108
+ function wpmtst_is_testimonial_screen() {
109
+ $screen = get_current_screen();
110
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
111
+ }
112
+
113
+ /**
114
+ * Add pending numbers to post types on admin menu.
115
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
116
+ *
117
+ * @param $menu
118
+ *
119
+ * @return mixed
120
+ */
121
+ function wpmtst_pending_indicator( $menu ) {
122
+ if ( ! current_user_can( 'edit_posts' ) )
123
+ return $menu;
124
+
125
+ $options = get_option( 'wpmtst_options' );
126
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
127
+ return $menu;
128
+
129
+ $types = array( 'wpm-testimonial' );
130
+ $status = 'pending';
131
+ foreach ( $types as $type ) {
132
+ $num_posts = wp_count_posts( $type, 'readable' );
133
+ $pending_count = 0;
134
+ if ( ! empty( $num_posts->$status ) )
135
+ $pending_count = $num_posts->$status;
136
+
137
+ if ( $type == 'post' )
138
+ $menu_str = 'edit.php';
139
+ else
140
+ $menu_str = 'edit.php?post_type=' . $type;
141
+
142
+ foreach ( $menu as $menu_key => $menu_data ) {
143
+ if ( $menu_str != $menu_data[2] )
144
+ continue;
145
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
146
+ }
147
+ }
148
+
149
+ return $menu;
150
+ }
151
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
152
+
153
+ /**
154
+ * The [restore default] icon.
155
+ *
156
+ * @param $for
157
+ *
158
+ * @since 2.18.0
159
+ */
160
+ function wpmtst_restore_default_icon( $for ) {
161
+ if ( !$for ) return;
162
+ ?>
163
+ <input type="button" class="button secondary restore-default"
164
+ title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
165
+ value="&#xf171"
166
+ data-for="<?php echo esc_attr( $for ); ?>"/>
167
+ <?php
168
+ }
169
+
170
+
171
+
172
+ /**
173
+ * Check for configuration issues when options are updated.
174
+ *
175
+ * @since 2.24.0
176
+ * @param $option
177
+ * @param $old_value
178
+ * @param $value
179
+ */
180
+ function wpmtst_updated_option( $option, $old_value, $value ) {
181
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
182
+ do_action( 'wpmtst_check_config' );
183
+ }
184
+ }
185
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
186
+
187
+
188
+ /**
189
+ * Store configuration error.
190
+ *
191
+ * @since 2.24.0
192
+ * @param $key
193
+ */
194
+ function wpmtst_add_config_error( $key ) {
195
+ $errors = get_option( 'wpmtst_config_errors', array() );
196
+ $errors[] = $key;
197
+ update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
198
+
199
+ wpmtst_add_admin_notice( $key, true );
200
+ }
201
+
202
+
203
+ /**
204
+ * Delete configuration error.
205
+ *
206
+ * @since 2.24.0
207
+ * @param $key
208
+ */
209
+ function wpmtst_delete_config_error( $key ) {
210
+ $errors = get_option( 'wpmtst_config_errors', array() );
211
+ $errors = array_diff( $errors, array ( $key ) );
212
+ update_option( 'wpmtst_config_errors', $errors, 'no' );
213
+
214
+ wpmtst_delete_admin_notice( $key );
215
+ }
216
+
217
+
218
+ /**
219
+ * Save a View.
220
+ *
221
+ * @param $view
222
+ * @param string $action
223
+ * @usedby Strong_Testimonials_Update:update_views
224
+ *
225
+ * @return bool|false|int
226
+ */
227
+ function wpmtst_save_view( $view, $action = 'edit' ) {
228
+ global $wpdb;
229
+
230
+ if ( ! $view ) return false;
231
+
232
+ $table_name = $wpdb->prefix . 'strong_views';
233
+ $serialized = serialize( $view['data'] );
234
+
235
+ if ( 'add' == $action || 'duplicate' == $action ) {
236
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
237
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
238
+ $wpdb->query( $sql );
239
+ $view['id'] = $wpdb->insert_id;
240
+ $return = $view['id'];
241
+ }
242
+ else {
243
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
244
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
245
+ $wpdb->query( $sql );
246
+ $return = $wpdb->last_error ? 0 : 1;
247
+ }
248
+
249
+ do_action( 'wpmtst_view_saved', $view );
250
+
251
+ return $return;
252
+ }
253
+
254
+
255
+ /**
256
+ * @param $field
257
+ *
258
+ * @return mixed
259
+ */
260
+ function wpmtst_get_field_label( $field ) {
261
+ if ( isset( $field['field'] ) ) {
262
+ $custom_fields = wpmtst_get_custom_fields();
263
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
264
+ return $custom_fields[ $field['field'] ]['label'];
265
+ }
266
+ $builtin_fields = wpmtst_get_builtin_fields();
267
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
268
+ return $builtin_fields[ $field['field'] ]['label'];
269
+ }
270
+ }
271
+
272
+ return '';
273
+ }
274
+
275
+ function wpmtst_get_field_text( $field ) {
276
+ if ( isset( $field['field'] ) ) {
277
+ $custom_fields = wpmtst_get_custom_fields();
278
+ if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
279
+ return $custom_fields[ $field['field'] ]['text'];
280
+ }
281
+ $builtin_fields = wpmtst_get_builtin_fields();
282
+ if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
283
+ return $builtin_fields[ $field['field'] ]['text'];
284
+ }
285
+ }
286
+
287
+ return '';
288
+ }
289
+
290
+
291
+ /**
292
+ * @param string $field_name
293
+ *
294
+ * @return mixed
295
+ */
296
+ function wpmtst_get_field_by_name( $field_name = '' ) {
297
+ if ( $field_name ) {
298
+ $custom_fields = wpmtst_get_custom_fields();
299
+ if ( isset( $custom_fields[ $field_name ] ) ) {
300
+ return $custom_fields[ $field_name ];
301
+ }
302
+ }
303
+
304
+ return '';
305
+ }
306
+
307
+ /**
308
+ * Returns true if at least one extension is installed
309
+ */
310
+ function wpmtst_extensions_installed() {
311
+
312
+ if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
313
+ return true;
314
+ }
315
+ if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
316
+ return true;
317
+ }
318
+ if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
319
+ return true;
320
+ }
321
+ if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
322
+ return true;
323
+ }
324
+ if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
325
+ return true;
326
+ }
327
+ if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
328
+ return true;
329
+ }
330
+ if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
331
+ return true;
332
+ }
333
+
334
+ return false;
335
  }
admin/class-strong-testimonials-addons.php CHANGED
@@ -1,132 +1,132 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Addons
4
- *
5
- * @since 2.38
6
- */
7
- class Strong_Testimonials_Addons {
8
-
9
- private $addons = array();
10
-
11
- public function __construct() {
12
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
-
14
- // Add ajax action to reload extensions
15
- add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
- }
17
-
18
- private function check_for_addons() {
19
-
20
- if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
- return $data;
22
- }
23
-
24
- $addons = array();
25
-
26
- $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
-
28
- // Get data from the remote URL.
29
- $response = wp_remote_get( $url );
30
-
31
- if ( ! is_wp_error( $response ) ) {
32
-
33
- // Decode the data that we got.
34
- $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
-
36
- if ( ! empty( $data ) && is_array( $data ) ) {
37
- $addons = $data;
38
- // Store the data for a week.
39
- set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
- }
41
- }
42
-
43
- return apply_filters( 'wpmtst_addons', $addons );
44
- }
45
-
46
- public function render_addons() {
47
-
48
- wp_enqueue_style( 'wpmtst-admin-style' );
49
- wp_enqueue_script( 'wpmtst-admin-script' );
50
-
51
- if ( ! empty( $this->addons ) ) {
52
- foreach ( $this->addons as $addon ) {
53
- $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
- echo '<div class="wpmtst-addon">';
55
- echo '<div class="wpmtst-addon-box">';
56
- echo '<img src="' . esc_attr( $image ) . '">';
57
- echo '<div class="wpmtst-addon-content">';
58
- echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
- echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
- echo '</div>';
61
- echo '</div>';
62
- echo '<div class="wpmtst-addon-actions">';
63
- echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade now', 'strong-testimonials' ) . '</a>', $addon );
64
- echo '</div>';
65
- echo '</div>';
66
- }
67
- }
68
-
69
- }
70
-
71
- /**
72
- * Add submenu page.
73
- *
74
- * @param $pages
75
- *
76
- * @return mixed
77
- */
78
- public function add_submenu( $pages ) {
79
- $pages[91] = $this->get_submenu();
80
- return $pages;
81
- }
82
-
83
- /**
84
- * Return submenu page parameters.
85
- *
86
- * @return array
87
- */
88
- public function get_submenu() {
89
- return array(
90
- 'page_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
91
- 'menu_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
92
- 'capability' => 'strong_testimonials_options',
93
- 'menu_slug' => 'strong-testimonials-addons',
94
- 'function' => array( $this, 'addons_page' ),
95
- );
96
- }
97
-
98
-
99
- /**
100
- * Print the Addons page.
101
- */
102
- public function addons_page() {
103
-
104
- $this->addons = $this->check_for_addons();
105
- ?>
106
-
107
- <div class="wrap">
108
- <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
-
110
- <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
-
112
- <div class="wpmtst-addons-container">
113
- <?php $this->render_addons(); ?>
114
- </div>
115
- </div>
116
- <?php
117
- }
118
-
119
- public function reload_extensions() {
120
- // Run a security check first.
121
- check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
-
123
- delete_transient( 'strong_testimonials_all_extensions' );
124
-
125
- die;
126
- }
127
-
128
-
129
-
130
- }
131
-
132
- new Strong_Testimonials_Addons();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Addons
4
+ *
5
+ * @since 2.38
6
+ */
7
+ class Strong_Testimonials_Addons {
8
+
9
+ private $addons = array();
10
+
11
+ public function __construct() {
12
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
+
14
+ // Add ajax action to reload extensions
15
+ add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
+ }
17
+
18
+ private function check_for_addons() {
19
+
20
+ if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
+ return $data;
22
+ }
23
+
24
+ $addons = array();
25
+
26
+ $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
+
28
+ // Get data from the remote URL.
29
+ $response = wp_remote_get( $url );
30
+
31
+ if ( ! is_wp_error( $response ) ) {
32
+
33
+ // Decode the data that we got.
34
+ $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
+
36
+ if ( ! empty( $data ) && is_array( $data ) ) {
37
+ $addons = $data;
38
+ // Store the data for a week.
39
+ set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
+ }
41
+ }
42
+
43
+ return apply_filters( 'wpmtst_addons', $addons );
44
+ }
45
+
46
+ public function render_addons() {
47
+
48
+ wp_enqueue_style( 'wpmtst-admin-style' );
49
+ wp_enqueue_script( 'wpmtst-admin-script' );
50
+
51
+ if ( ! empty( $this->addons ) ) {
52
+ foreach ( $this->addons as $addon ) {
53
+ $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
+ echo '<div class="wpmtst-addon">';
55
+ echo '<div class="wpmtst-addon-box">';
56
+ echo '<img src="' . esc_attr( $image ) . '">';
57
+ echo '<div class="wpmtst-addon-content">';
58
+ echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
+ echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
+ echo '</div>';
61
+ echo '</div>';
62
+ echo '<div class="wpmtst-addon-actions">';
63
+ echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade now', 'strong-testimonials' ) . '</a>', $addon );
64
+ echo '</div>';
65
+ echo '</div>';
66
+ }
67
+ }
68
+
69
+ }
70
+
71
+ /**
72
+ * Add submenu page.
73
+ *
74
+ * @param $pages
75
+ *
76
+ * @return mixed
77
+ */
78
+ public function add_submenu( $pages ) {
79
+ $pages[91] = $this->get_submenu();
80
+ return $pages;
81
+ }
82
+
83
+ /**
84
+ * Return submenu page parameters.
85
+ *
86
+ * @return array
87
+ */
88
+ public function get_submenu() {
89
+ return array(
90
+ 'page_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
91
+ 'menu_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
92
+ 'capability' => 'strong_testimonials_options',
93
+ 'menu_slug' => 'strong-testimonials-addons',
94
+ 'function' => array( $this, 'addons_page' ),
95
+ );
96
+ }
97
+
98
+
99
+ /**
100
+ * Print the Addons page.
101
+ */
102
+ public function addons_page() {
103
+
104
+ $this->addons = $this->check_for_addons();
105
+ ?>
106
+
107
+ <div class="wrap">
108
+ <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
+
110
+ <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
+
112
+ <div class="wpmtst-addons-container">
113
+ <?php $this->render_addons(); ?>
114
+ </div>
115
+ </div>
116
+ <?php
117
+ }
118
+
119
+ public function reload_extensions() {
120
+ // Run a security check first.
121
+ check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
+
123
+ delete_transient( 'strong_testimonials_all_extensions' );
124
+
125
+ die;
126
+ }
127
+
128
+
129
+
130
+ }
131
+
132
+ new Strong_Testimonials_Addons();
admin/class-strong-testimonials-admin-category-list.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_Category_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_Category_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_list constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
- add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
- }
28
-
29
- /**
30
- * Add columns to the testimonials categories screen
31
- *
32
- * @param $columns
33
- *
34
- * @return array
35
- */
36
- public static function manage_categories( $columns ) {
37
- $new_columns = array(
38
- 'cb' => '<input type="checkbox">',
39
- 'ID' => esc_html__( 'ID', 'strong-testimonials' ),
40
- 'name' => esc_html__( 'Name', 'strong-testimonials' ),
41
- 'slug' => esc_html__( 'Slug', 'strong-testimonials' ),
42
- 'posts' => esc_html__( 'Posts', 'strong-testimonials' ),
43
- );
44
-
45
- return $new_columns;
46
- }
47
-
48
- /**
49
- * Show custom column
50
- *
51
- * @param $out
52
- * @param $column_name
53
- * @param $id
54
- *
55
- * @return string
56
- */
57
- public static function manage_columns( $out, $column_name, $id ) {
58
- if ( 'ID' == $column_name ) {
59
- $output = $id;
60
- } else {
61
- $output = '';
62
- }
63
-
64
- return $output;
65
- }
66
-
67
- }
68
-
69
- Strong_Testimonials_Admin_Category_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_Category_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_Category_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_list constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
+ add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
+ }
28
+
29
+ /**
30
+ * Add columns to the testimonials categories screen
31
+ *
32
+ * @param $columns
33
+ *
34
+ * @return array
35
+ */
36
+ public static function manage_categories( $columns ) {
37
+ $new_columns = array(
38
+ 'cb' => '<input type="checkbox">',
39
+ 'ID' => esc_html__( 'ID', 'strong-testimonials' ),
40
+ 'name' => esc_html__( 'Name', 'strong-testimonials' ),
41
+ 'slug' => esc_html__( 'Slug', 'strong-testimonials' ),
42
+ 'posts' => esc_html__( 'Posts', 'strong-testimonials' ),
43
+ );
44
+
45
+ return $new_columns;
46
+ }
47
+
48
+ /**
49
+ * Show custom column
50
+ *
51
+ * @param $out
52
+ * @param $column_name
53
+ * @param $id
54
+ *
55
+ * @return string
56
+ */
57
+ public static function manage_columns( $out, $column_name, $id ) {
58
+ if ( 'ID' == $column_name ) {
59
+ $output = $id;
60
+ } else {
61
+ $output = '';
62
+ }
63
+
64
+ return $output;
65
+ }
66
+
67
+ }
68
+
69
+ Strong_Testimonials_Admin_Category_List::init();
admin/class-strong-testimonials-admin-list.php CHANGED
@@ -1,347 +1,347 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_List constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
- add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
- add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
- add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
- add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
- add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
- add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
- }
33
-
34
- /**
35
- * Add post ID to post row actions.
36
- *
37
- * @param $actions
38
- * @param $post
39
- * @since 2.32.2
40
- *
41
- * @return array
42
- */
43
- public static function post_row_actions( $actions, $post ) {
44
- if ( 'wpm-testimonial' == $post->post_type ) {
45
- $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
- }
47
-
48
- return $actions;
49
- }
50
-
51
- /**
52
- * Add custom columns to the admin list.
53
- *
54
- * @param $columns
55
- *
56
- * @since 1.4.0
57
- * @since 2.5.1 Added comments column.
58
- *
59
- * @return array
60
- */
61
- public static function edit_columns( $columns ) {
62
- $fields = wpmtst_get_all_fields();
63
-
64
- $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
-
66
- /*
67
- INCOMING COLUMNS = Array (
68
- [cb] => <input type="checkbox" />
69
- [title] => Title
70
- [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
- [date] => Date
72
- [search_exclude] => Search Exclude // other plugin
73
- [strong_thumbnail] => Thumbnail
74
- )
75
- */
76
-
77
- // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
- unset( $columns['strong_thumbnail'], $columns['date'] );
79
-
80
- if ( $comments ) {
81
- unset( $columns['comments'] );
82
- }
83
-
84
- // 2. insert [order] after [cb]
85
- if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
- $columns = array_merge(
87
- array_slice( $columns, 0, 1 ),
88
- array( 'handle' => 'Order' ),
89
- array_slice( $columns, 1, null )
90
- );
91
- }
92
-
93
- // 3. insert [excerpt] after [title]
94
- $key = 'title';
95
- $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
- $fields_to_add = array( 'post_excerpt' => esc_html__( 'Excerpt', 'strong-testimonials' ) );
97
-
98
- // 4. add custom fields
99
- foreach ( $fields as $key => $field ) {
100
-
101
- if ( $field['admin_table'] ) {
102
-
103
- if ( 'post_title' == $field['name'] ) {
104
- continue;
105
- } elseif ( 'featured_image' == $field['name'] ) {
106
- $fields_to_add['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
107
- } elseif ( 'rating' == $field['input_type'] ) {
108
- $fields_to_add[ $field['name'] ] = esc_html__( 'Rating', 'strong-testimonials' );
109
- } else {
110
- $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
- }
112
-
113
- }
114
-
115
- }
116
-
117
- // 5. add [category], [comments] and [date]
118
- // The slug "categories" slug is reserved by WordPress.
119
- if ( wpmtst_get_cat_count() ) {
120
- $fields_to_add['category'] = esc_html__( 'Categories', 'strong-testimonials' );
121
- }
122
-
123
- if ( $comments ) {
124
- $fields_to_add['comments'] = $comments;
125
- }
126
-
127
- $fields_to_add['date'] = esc_html__( 'Date', 'strong-testimonials' );
128
-
129
- $options = get_option( 'wpmtst_options' );
130
- if ( isset( $options['include_platform'] ) && $options['include_platform'] === true ) {
131
- $fields_to_add['platform'] = esc_html__( 'Platform', 'strong-testimonials' );
132
- }
133
-
134
- // Push other added columns like [search_exclude] to the end.
135
- $columns = array_merge(
136
- array_slice( $columns, 0, $offset ),
137
- $fields_to_add,
138
- array_slice( $columns, $offset, null )
139
- );
140
-
141
- return $columns;
142
- }
143
-
144
- /**
145
- * Show custom values
146
- *
147
- * @param $column
148
- */
149
- public static function custom_columns( $column ) {
150
- global $post;
151
-
152
- switch ( $column ) {
153
-
154
- case 'post_id' :
155
- echo absint( $post->ID );
156
- break;
157
-
158
- case 'post_content' :
159
- echo substr( $post->post_content, 0, 100 ) . '&hellip;';
160
- break;
161
-
162
- case 'post_excerpt' :
163
- echo $post->post_excerpt;
164
- break;
165
-
166
- case 'strong_thumbnail' :
167
- echo wpmtst_get_thumbnail( array( 60, 60 ) );
168
- break;
169
-
170
- case 'category' :
171
- $categories = get_the_terms( 0, 'wpm-testimonial-category' );
172
- if ( $categories && ! is_wp_error( $categories ) ) {
173
- $list = array();
174
- foreach ( $categories as $cat ) {
175
- $list[] = $cat->name;
176
- }
177
- echo implode( ", ", $list );
178
- }
179
- break;
180
-
181
- case 'handle' :
182
- if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
183
- echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
184
- }
185
- break;
186
-
187
- case 'platform':
188
- $platform = get_post_meta( $post->ID, 'platform', true );
189
-
190
- if ( $platform ) {
191
- ?>
192
- <img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="26" height="26" src="<?php esc_attr_e( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php esc_attr_e( $platform ); ?>.svg"/>
193
- <?php
194
- }
195
-
196
- break;
197
-
198
- default :
199
- // custom field?
200
- $custom = get_post_custom();
201
- $fields = wpmtst_get_custom_fields();
202
-
203
- if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
204
-
205
- if ( isset( $fields[ $column ] ) ) {
206
-
207
- switch ( $fields[ $column ]['input_type'] ) {
208
- case 'rating' :
209
- wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
210
- break;
211
- case 'checkbox' :
212
- echo $custom[ $column ][0] ? 'yes' : 'no';
213
- break;
214
- default :
215
- echo $custom[ $column ][0];
216
- }
217
-
218
- }
219
-
220
- } else {
221
-
222
- if ( isset( $fields[ $column ] ) ) {
223
-
224
- if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
225
- echo 'no';
226
- } else {
227
- // display nothing
228
- }
229
-
230
- }
231
- }
232
-
233
- }
234
- }
235
-
236
- /**
237
- * Add thumbnail column to admin list
238
- *
239
- * @param $columns
240
- *
241
- * @return array
242
- */
243
- public static function add_thumbnail_column( $columns ) {
244
- $columns['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
245
-
246
- return $columns;
247
- }
248
-
249
- /**
250
- * Make columns sortable.
251
- *
252
- * @param $columns
253
- *
254
- * @since 1.12.0
255
- * @since 2.2.0 category
256
- *
257
- * @return mixed
258
- */
259
- public static function manage_sortable_columns( $columns ) {
260
- $columns['client_name'] = 'client_name';
261
- $columns['category'] = 'categories';
262
- $columns['date'] = 'date';
263
-
264
- return $columns;
265
- }
266
-
267
- /**
268
- * Add category filter to testimonial list table.
269
- *
270
- * @since 2.2.0
271
- */
272
- public static function add_taxonomy_filters() {
273
- global $typenow;
274
-
275
- if ( $typenow != 'wpm-testimonial' ) {
276
- return;
277
- }
278
-
279
- $taxonomies = array( 'wpm-testimonial-category' );
280
-
281
- foreach ( $taxonomies as $tax ) {
282
- $tax_obj = get_taxonomy( $tax );
283
- $args = array(
284
- 'show_option_all' => $tax_obj->labels->all_items,
285
- 'show_option_none' => '',
286
- 'option_none_value' => '-1',
287
- 'orderby' => 'NAME',
288
- 'order' => 'ASC',
289
- 'show_count' => 1,
290
- 'hide_empty' => 1,
291
- 'child_of' => 0,
292
- 'exclude' => '',
293
- 'echo' => 1,
294
- 'selected' => isset( $_GET[ $tax ] ) ? sanitize_text_field( $_GET[ $tax ] ) : '',
295
- 'hierarchical' => 1,
296
- 'name' => $tax,
297
- 'id' => $tax,
298
- 'class' => 'postform',
299
- 'depth' => 0,
300
- 'tab_index' => 0,
301
- 'taxonomy' => $tax,
302
- 'hide_if_empty' => true,
303
- 'value_field' => 'slug',
304
- );
305
-
306
- wp_dropdown_categories( $args );
307
- }
308
- }
309
-
310
- /**
311
- * Sort columns.
312
- *
313
- * @since 1.12.0
314
- *
315
- * @param $query
316
- */
317
- public static function pre_get_posts( $query ) {
318
- // Only in main WP query AND if an orderby query variable is designated.
319
- if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
320
- if ( 'client_name' == $query->get( 'orderby' ) ) {
321
- $query->set( 'meta_key', 'client_name' );
322
- $query->set( 'orderby', 'meta_value' );
323
- }
324
- }
325
- }
326
-
327
- /**
328
- * Check if we are viewing the Trash.
329
- *
330
- * @since 1.16.0
331
- */
332
- public static function is_viewing_trash() {
333
- return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
334
- }
335
-
336
- /**
337
- * Check if a column in admin list table is sorted.
338
- *
339
- * @since 1.16.0
340
- */
341
- public static function is_column_sorted() {
342
- return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
343
- }
344
-
345
- }
346
-
347
- Strong_Testimonials_Admin_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_List constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
+ add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
+ add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
+ add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
+ add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
+ add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
+ add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
+ }
33
+
34
+ /**
35
+ * Add post ID to post row actions.
36
+ *
37
+ * @param $actions
38
+ * @param $post
39
+ * @since 2.32.2
40
+ *
41
+ * @return array
42
+ */
43
+ public static function post_row_actions( $actions, $post ) {
44
+ if ( 'wpm-testimonial' == $post->post_type ) {
45
+ $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
+ }
47
+
48
+ return $actions;
49
+ }
50
+
51
+ /**
52
+ * Add custom columns to the admin list.
53
+ *
54
+ * @param $columns
55
+ *
56
+ * @since 1.4.0
57
+ * @since 2.5.1 Added comments column.
58
+ *
59
+ * @return array
60
+ */
61
+ public static function edit_columns( $columns ) {
62
+ $fields = wpmtst_get_all_fields();
63
+
64
+ $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
+
66
+ /*
67
+ INCOMING COLUMNS = Array (
68
+ [cb] => <input type="checkbox" />
69
+ [title] => Title
70
+ [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
+ [date] => Date
72
+ [search_exclude] => Search Exclude // other plugin
73
+ [strong_thumbnail] => Thumbnail
74
+ )
75
+ */
76
+
77
+ // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
+ unset( $columns['strong_thumbnail'], $columns['date'] );
79
+
80
+ if ( $comments ) {
81
+ unset( $columns['comments'] );
82
+ }
83
+
84
+ // 2. insert [order] after [cb]
85
+ if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
+ $columns = array_merge(
87
+ array_slice( $columns, 0, 1 ),
88
+ array( 'handle' => 'Order' ),
89
+ array_slice( $columns, 1, null )
90
+ );
91
+ }
92
+
93
+ // 3. insert [excerpt] after [title]
94
+ $key = 'title';
95
+ $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
+ $fields_to_add = array( 'post_excerpt' => esc_html__( 'Excerpt', 'strong-testimonials' ) );
97
+
98
+ // 4. add custom fields
99
+ foreach ( $fields as $key => $field ) {
100
+
101
+ if ( $field['admin_table'] ) {
102
+
103
+ if ( 'post_title' == $field['name'] ) {
104
+ continue;
105
+ } elseif ( 'featured_image' == $field['name'] ) {
106
+ $fields_to_add['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
107
+ } elseif ( 'rating' == $field['input_type'] ) {
108
+ $fields_to_add[ $field['name'] ] = esc_html__( 'Rating', 'strong-testimonials' );
109
+ } else {
110
+ $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
+ }
112
+
113
+ }
114
+
115
+ }
116
+
117
+ // 5. add [category], [comments] and [date]
118
+ // The slug "categories" slug is reserved by WordPress.
119
+ if ( wpmtst_get_cat_count() ) {
120
+ $fields_to_add['category'] = esc_html__( 'Categories', 'strong-testimonials' );
121
+ }
122
+
123
+ if ( $comments ) {
124
+ $fields_to_add['comments'] = $comments;
125
+ }
126
+
127
+ $fields_to_add['date'] = esc_html__( 'Date', 'strong-testimonials' );
128
+
129
+ $options = get_option( 'wpmtst_options' );
130
+ if ( isset( $options['include_platform'] ) && $options['include_platform'] === true ) {
131
+ $fields_to_add['platform'] = esc_html__( 'Platform', 'strong-testimonials' );
132
+ }
133
+
134
+ // Push other added columns like [search_exclude] to the end.
135
+ $columns = array_merge(
136
+ array_slice( $columns, 0, $offset ),
137
+ $fields_to_add,
138
+ array_slice( $columns, $offset, null )
139
+ );
140
+
141
+ return $columns;
142
+ }
143
+
144
+ /**
145
+ * Show custom values
146
+ *
147
+ * @param $column
148
+ */
149
+ public static function custom_columns( $column ) {
150
+ global $post;
151
+
152
+ switch ( $column ) {
153
+
154
+ case 'post_id' :
155
+ echo absint( $post->ID );
156
+ break;
157
+
158
+ case 'post_content' :
159
+ echo substr( $post->post_content, 0, 100 ) . '&hellip;';
160
+ break;
161
+
162
+ case 'post_excerpt' :
163
+ echo $post->post_excerpt;
164
+ break;
165
+
166
+ case 'strong_thumbnail' :
167
+ echo wpmtst_get_thumbnail( array( 60, 60 ) );
168
+ break;
169
+
170
+ case 'category' :
171
+ $categories = get_the_terms( 0, 'wpm-testimonial-category' );
172
+ if ( $categories && ! is_wp_error( $categories ) ) {
173
+ $list = array();
174
+ foreach ( $categories as $cat ) {
175
+ $list[] = $cat->name;
176
+ }
177
+ echo implode( ", ", $list );
178
+ }
179
+ break;
180
+
181
+ case 'handle' :
182
+ if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
183
+ echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
184
+ }
185
+ break;
186
+
187
+ case 'platform':
188
+ $platform = get_post_meta( $post->ID, 'platform', true );
189
+
190
+ if ( $platform ) {
191
+ ?>
192
+ <img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="26" height="26" src="<?php esc_attr_e( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php esc_attr_e( $platform ); ?>.svg"/>
193
+ <?php
194
+ }
195
+
196
+ break;
197
+
198
+ default :
199
+ // custom field?
200
+ $custom = get_post_custom();
201
+ $fields = wpmtst_get_custom_fields();
202
+
203
+ if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
204
+
205
+ if ( isset( $fields[ $column ] ) ) {
206
+
207
+ switch ( $fields[ $column ]['input_type'] ) {
208
+ case 'rating' :
209
+ wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
210
+ break;
211
+ case 'checkbox' :
212
+ echo $custom[ $column ][0] ? 'yes' : 'no';
213
+ break;
214
+ default :
215
+ echo $custom[ $column ][0];
216
+ }
217
+
218
+ }
219
+
220
+ } else {
221
+
222
+ if ( isset( $fields[ $column ] ) ) {
223
+
224
+ if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
225
+ echo 'no';
226
+ } else {
227
+ // display nothing
228
+ }
229
+
230
+ }
231
+ }
232
+
233
+ }
234
+ }
235
+
236
+ /**
237
+ * Add thumbnail column to admin list
238
+ *
239
+ * @param $columns
240
+ *
241
+ * @return array
242
+ */
243
+ public static function add_thumbnail_column( $columns ) {
244
+ $columns['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
245
+
246
+ return $columns;
247
+ }
248
+
249
+ /**
250
+ * Make columns sortable.
251
+ *
252
+ * @param $columns
253
+ *
254
+ * @since 1.12.0
255
+ * @since 2.2.0 category
256
+ *
257
+ * @return mixed
258
+ */
259
+ public static function manage_sortable_columns( $columns ) {
260
+ $columns['client_name'] = 'client_name';
261
+ $columns['category'] = 'categories';
262
+ $columns['date'] = 'date';
263
+
264
+ return $columns;
265
+ }
266
+
267
+ /**
268
+ * Add category filter to testimonial list table.
269
+ *
270
+ * @since 2.2.0
271
+ */
272
+ public static function add_taxonomy_filters() {
273
+ global $typenow;
274
+
275
+ if ( $typenow != 'wpm-testimonial' ) {
276
+ return;
277
+ }
278
+
279
+ $taxonomies = array( 'wpm-testimonial-category' );
280
+
281
+ foreach ( $taxonomies as $tax ) {
282
+ $tax_obj = get_taxonomy( $tax );
283
+ $args = array(
284
+ 'show_option_all' => $tax_obj->labels->all_items,
285
+ 'show_option_none' => '',
286
+ 'option_none_value' => '-1',
287
+ 'orderby' => 'NAME',
288
+ 'order' => 'ASC',
289
+ 'show_count' => 1,
290
+ 'hide_empty' => 1,
291
+ 'child_of' => 0,
292
+ 'exclude' => '',
293
+ 'echo' => 1,
294
+ 'selected' => isset( $_GET[ $tax ] ) ? sanitize_text_field( $_GET[ $tax ] ) : '',
295
+ 'hierarchical' => 1,
296
+ 'name' => $tax,
297
+ 'id' => $tax,
298
+ 'class' => 'postform',
299
+ 'depth' => 0,
300
+ 'tab_index' => 0,
301
+ 'taxonomy' => $tax,
302
+ 'hide_if_empty' => true,
303
+ 'value_field' => 'slug',
304
+ );
305
+
306
+ wp_dropdown_categories( $args );
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Sort columns.
312
+ *
313
+ * @since 1.12.0
314
+ *
315
+ * @param $query
316
+ */
317
+ public static function pre_get_posts( $query ) {
318
+ // Only in main WP query AND if an orderby query variable is designated.
319
+ if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
320
+ if ( 'client_name' == $query->get( 'orderby' ) ) {
321
+ $query->set( 'meta_key', 'client_name' );
322
+ $query->set( 'orderby', 'meta_value' );
323
+ }
324
+ }
325
+ }
326
+
327
+ /**
328
+ * Check if we are viewing the Trash.
329
+ *
330
+ * @since 1.16.0
331
+ */
332
+ public static function is_viewing_trash() {
333
+ return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
334
+ }
335
+
336
+ /**
337
+ * Check if a column in admin list table is sorted.
338
+ *
339
+ * @since 1.16.0
340
+ */
341
+ public static function is_column_sorted() {
342
+ return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
343
+ }
344
+
345
+ }
346
+
347
+ Strong_Testimonials_Admin_List::init();
admin/class-strong-testimonials-admin-scripts.php CHANGED
@@ -1,424 +1,424 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_Scripts
4
- */
5
- class Strong_Testimonials_Admin_Scripts {
6
-
7
- /**
8
- * Strong_Testimonials_Admin_Scripts constructor.
9
- */
10
- public function __construct() {}
11
-
12
- /**
13
- * Initialize.
14
- */
15
- public static function init() {
16
- self::add_actions();
17
- }
18
-
19
- /**
20
- * Add actions and filters.
21
- */
22
- public static function add_actions() {
23
- add_action( 'admin_init', array( __CLASS__, 'admin_register' ) );
24
- add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_dequeue_scripts' ), 500 );
25
- add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
26
-
27
- add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'admin_views' ) );
28
- add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'admin_fields' ) );
29
- add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'admin_settings' ) );
30
- add_action( 'admin_print_styles-wpm-testimonial_page_about-strong-testimonials', array( __CLASS__, 'admin_about' ) );
31
- add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-shortcodes', array( __CLASS__, 'admin_shortcodes' ) );
32
-
33
- add_action( 'load-edit.php', array( __CLASS__, 'admin_load_edit' ) );
34
- add_action( 'load-post.php', array( __CLASS__, 'admin_load_post' ) );
35
- add_action( 'load-post-new.php', array( __CLASS__, 'admin_load_post' ) );
36
- add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_load_edit_tags' ) );
37
- }
38
-
39
- /**
40
- * Register admin scripts.
41
- */
42
- public static function admin_register() {
43
-
44
- $plugin_version = get_option( 'wpmtst_plugin_version' );
45
-
46
- $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
47
-
48
- wp_register_script( 'wpmtst-help',
49
- WPMTST_ADMIN_URL . 'js/help.js',
50
- array( 'jquery' ),
51
- $plugin_version,
52
- true );
53
-
54
-
55
- wp_register_script(
56
- 'wpmtst-admin-script',
57
- WPMTST_ASSETS_JS . 'admin-js.js',
58
- array( 'jquery', 'underscore' ),
59
- $plugin_version,
60
- true );
61
-
62
- wp_register_style(
63
- 'wpmtst-admin-global-style',
64
- WPMTST_ASSETS_CSS . 'admin-global.css',
65
- array(),
66
- $plugin_version );
67
-
68
- wp_register_style(
69
- 'wpmtst-admin-welcome-style',
70
- WPMTST_ASSETS_CSS . 'admin-welcome.css',
71
- array(),
72
- $plugin_version );
73
-
74
- wp_register_style(
75
- 'wpmtst-admin-style',
76
- WPMTST_ASSETS_CSS . 'admin.css',
77
- array( ),
78
- $plugin_version );
79
-
80
- wp_register_style( 'wpmtst-post-editor',
81
- WPMTST_ADMIN_URL . 'css/post-editor.css',
82
- array( ),
83
- $plugin_version );
84
-
85
- wp_register_script( 'wpmtst-custom-spinner',
86
- WPMTST_ADMIN_URL . 'js/custom-spinner.js',
87
- array( 'jquery' ),
88
- $plugin_version,
89
- true );
90
-
91
- wp_register_script( 'autosize',
92
- WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
93
- array(),
94
- '4.0.1',
95
- true );
96
-
97
- /**
98
- * Form tab
99
- */
100
- wp_register_style( 'wpmtst-admin-form-style',
101
- WPMTST_ADMIN_URL . 'css/admin-form.css',
102
- array( 'wpmtst-admin-style' ),
103
- $plugin_version );
104
-
105
- wp_register_script( 'wpmtst-admin-form-script',
106
- WPMTST_ADMIN_URL . 'js/admin-form.js',
107
- array( 'wpmtst-admin-script', 'autosize' ),
108
- $plugin_version,
109
- true );
110
-
111
- /**
112
- * Compatibility tab
113
- */
114
- wp_register_style( 'wpmtst-admin-compat-style',
115
- WPMTST_ADMIN_URL . 'css/admin-compat.css',
116
- array(),
117
- $plugin_version );
118
-
119
- wp_register_script( 'wpmtst-admin-compat-script',
120
- WPMTST_ADMIN_URL . 'js/admin-compat.js',
121
- array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
122
- $plugin_version,
123
- true );
124
-
125
- /**
126
- * Fields
127
- */
128
- wp_register_style( 'wpmtst-admin-fields-style',
129
- WPMTST_ADMIN_URL . 'css/fields.css',
130
- array(),
131
- $plugin_version );
132
-
133
- wp_register_style( 'wpmtst-admin-form-preview',
134
- WPMTST_ADMIN_URL . 'css/form-preview.css',
135
- array(),
136
- $plugin_version );
137
-
138
- wp_register_script( 'wpmtst-admin-fields-script',
139
- WPMTST_ADMIN_URL . 'js/admin-fields.js',
140
- array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
141
- $plugin_version,
142
- true );
143
-
144
- $params = array(
145
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
146
- 'newField' => esc_html_x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
147
- 'inUse' => esc_html_x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
148
- 'noneFound' => esc_html_x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
149
- );
150
- wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
151
-
152
- /**
153
- * Ratings
154
- */
155
- wp_register_style( 'wpmtst-rating-display',
156
- WPMTST_PUBLIC_URL . 'css/rating-display.css',
157
- array( ),
158
- $plugin_version );
159
-
160
- wp_register_style( 'wpmtst-rating-form',
161
- WPMTST_PUBLIC_URL . 'css/rating-form.css',
162
- array( ),
163
- $plugin_version );
164
-
165
- wp_register_script( 'wpmtst-rating-script',
166
- WPMTST_ADMIN_URL . 'js/rating-edit.js',
167
- array( 'jquery' ),
168
- $plugin_version,
169
- true );
170
-
171
- /**
172
- * Views
173
- */
174
- wp_register_style( 'wpmtst-admin-views-style',
175
- WPMTST_ADMIN_URL . 'css/views.css',
176
- array(),
177
- $plugin_version );
178
-
179
- wp_register_script( 'wpmtst-admin-views-script',
180
- WPMTST_ADMIN_URL . 'js/views.js',
181
- array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
182
- $plugin_version,
183
- true );
184
-
185
- /**
186
- * Category filter in View editor.
187
- *
188
- * JavaScript adapted under GPL-2.0+ license
189
- * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
190
- *
191
- * @since 2.2.0
192
- */
193
- wp_register_script( 'wpmtst-view-category-filter-script',
194
- WPMTST_ADMIN_URL . 'js/view-category-filter.js',
195
- array( 'jquery' ),
196
- $plugin_version,
197
- true );
198
-
199
- wp_register_style( 'wpmtst-about-style',
200
- WPMTST_ADMIN_URL . 'css/about.css',
201
- array(),
202
- $plugin_version );
203
-
204
- /**
205
- * Add-on licenses
206
- *
207
- * @since 2.18
208
- */
209
- wp_register_script( 'wpmtst-addons-script',
210
- WPMTST_ADMIN_URL . 'js/addon-licenses.js',
211
- array( 'jquery' ),
212
- $plugin_version,
213
- true );
214
-
215
- $params = array(
216
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
217
- 'requiredField' => esc_html( 'This field is required.', 'strong-testimonials' ),
218
- 'errorMessage' => esc_html__( 'An error occurred, please try again.', 'strong-testimonials' ),
219
- 'restoreDefault' => esc_html__( 'Restore the default settings?', 'strong-testimonials' ),
220
- );
221
- wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
222
-
223
- /**
224
- * Are You Sure? for dirty forms
225
- *
226
- * @since 2.18
227
- */
228
- wp_register_script( 'wpmtst-ays-script',
229
- WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
230
- array( 'jquery' ),
231
- $plugin_version,
232
- true );
233
- }
234
-
235
- /**
236
- * Enqueue global admin scripts.
237
- */
238
- public static function admin_enqueue_scripts() {
239
- $screen = get_current_screen();
240
- $plugin_version = get_option( 'wpmtst_plugin_version' );
241
-
242
- wp_enqueue_style( 'wpmtst-admin-global-style' );
243
-
244
- wp_enqueue_script( 'wpmtst-admin-global',
245
- WPMTST_ADMIN_URL . 'js/admin-global.js',
246
- array( 'jquery' ),
247
- $plugin_version,
248
- true );
249
-
250
- wp_localize_script(
251
- 'wpmtst-admin-global',
252
- 'wpmtst_admin',
253
- array(
254
- 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
255
- 'templateTagTitle' => esc_html__( 'click to insert into message at caret', 'strong-testimonials' ),
256
- )
257
- );
258
-
259
- if ( $screen->id === 'dashboard_page_wpmtst-getting-started' ) {
260
- wp_enqueue_style( 'wpmtst-admin-welcome-style' );
261
- }
262
- }
263
-
264
- /**
265
- * Enqueue specific styles and scripts.
266
- *
267
- * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
268
- *
269
- * @since 2.12.0
270
- */
271
-
272
- /**
273
- * Views
274
- */
275
- public static function admin_views() {
276
- wp_enqueue_style( 'wpmtst-admin-style' );
277
- wp_enqueue_script( 'wpmtst-admin-script' );
278
-
279
- wp_enqueue_style( 'wpmtst-admin-views-style' );
280
- wp_enqueue_script( 'wpmtst-admin-views-script' );
281
- wp_enqueue_script( 'wpmtst-view-category-filter-script' );
282
-
283
- wp_enqueue_style( 'wp-color-picker' );
284
- }
285
-
286
- /**
287
- * Fields
288
- */
289
- public static function admin_fields() {
290
- $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
291
- wp_enqueue_style( 'wpmtst-admin-style' );
292
- wp_enqueue_script( 'wpmtst-admin-script' );
293
-
294
- switch ( $tab ) {
295
- case 'form':
296
- wp_enqueue_style( 'wpmtst-admin-form-style' );
297
- wp_enqueue_script( 'wpmtst-admin-form-script' );
298
- break;
299
- case 'fields':
300
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
301
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
302
-
303
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
304
- wp_enqueue_style( 'wpmtst-rating-form' );
305
- break;
306
- default:
307
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
308
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
309
-
310
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
311
- wp_enqueue_style( 'wpmtst-rating-form' );
312
- }
313
- }
314
-
315
- /**
316
- * Settings
317
- */
318
- public static function admin_settings() {
319
- $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
320
-
321
- switch ( $tab ) {
322
- case 'compat':
323
- wp_enqueue_style( 'wpmtst-admin-compat-style' );
324
- wp_enqueue_script( 'wpmtst-admin-compat-script' );
325
- break;
326
- case 'licenses':
327
- wp_enqueue_style( 'wpmtst-admin-style' );
328
- wp_enqueue_script( 'wpmtst-addons-script' );
329
- break;
330
- default:
331
- wp_enqueue_style( 'wpmtst-admin-style' );
332
- wp_enqueue_script( 'wpmtst-admin-script' );
333
- }
334
- }
335
-
336
- /**
337
- * About
338
- */
339
- public static function admin_about() {
340
- wp_enqueue_style( 'wpmtst-admin-style' );
341
- wp_enqueue_script( 'wpmtst-admin-script' );
342
- wp_enqueue_style( 'wpmtst-about-style' );
343
- }
344
-
345
- /**
346
- * Shortcodes
347
- *
348
- * @since 2.31.0
349
- */
350
- public static function admin_shortcodes() {
351
- wp_enqueue_style( 'wpmtst-admin-style' );
352
- wp_enqueue_style( 'wpmtst-rating-display' );
353
- }
354
-
355
- /**
356
- * List table
357
- */
358
- public static function admin_load_edit() {
359
- if ( wpmtst_is_testimonial_screen() ) {
360
- wp_enqueue_style( 'wpmtst-admin-style' );
361
- wp_enqueue_script( 'wpmtst-admin-script' );
362
- wp_enqueue_style( 'wpmtst-rating-display' );
363
- }
364
- }
365
-
366
- /**
367
- * Categories
368
- */
369
- public static function admin_load_edit_tags() {
370
- if ( wpmtst_is_testimonial_screen() ) {
371
- wp_enqueue_style( 'wpmtst-admin-style' );
372
- }
373
- }
374
-
375
- /**
376
- * Edit post
377
- */
378
- public static function admin_load_post() {
379
- if ( wpmtst_is_testimonial_screen() ) {
380
- wp_enqueue_style( 'wpmtst-admin-style' );
381
- wp_enqueue_style( 'wpmtst-post-editor' );
382
- wp_enqueue_script( 'wpmtst-admin-script' );
383
-
384
- wp_enqueue_style( 'wpmtst-rating-display' );
385
- wp_enqueue_style( 'wpmtst-rating-form' );
386
- wp_enqueue_script( 'wpmtst-rating-script' );
387
- }
388
- }
389
-
390
- /**
391
- * Known theme and plugin conflicts.
392
- *
393
- * @param $hook
394
- */
395
- public static function admin_dequeue_scripts( $hook ) {
396
- if ( wp_style_is( 'CPTStyleSheets' ) ) {
397
- wp_dequeue_style( 'CPTStyleSheets' );
398
- }
399
-
400
- $hooks_to_script = array(
401
- 'wpm-testimonial_page_testimonial-views',
402
- 'wpm-testimonial_page_testimonial-fields',
403
- 'wpm-testimonial_page_testimonial-settings',
404
- 'wpm-testimonial_page_about-strong-testimonials',
405
- );
406
-
407
- if ( wpmtst_is_testimonial_screen() ) {
408
- $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
409
- }
410
-
411
- /**
412
- * Block RT Themes and their overzealous JavaScript on our admin pages.
413
- * @since 2.2.12.1
414
- */
415
- if ( in_array( $hook, $hooks_to_script ) ) {
416
- if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
417
- wp_dequeue_script( 'admin-scripts' );
418
- }
419
- }
420
- }
421
-
422
- }
423
-
424
- Strong_Testimonials_Admin_Scripts::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_Scripts
4
+ */
5
+ class Strong_Testimonials_Admin_Scripts {
6
+
7
+ /**
8
+ * Strong_Testimonials_Admin_Scripts constructor.
9
+ */
10
+ public function __construct() {}
11
+
12
+ /**
13
+ * Initialize.
14
+ */
15
+ public static function init() {
16
+ self::add_actions();
17
+ }
18
+
19
+ /**
20
+ * Add actions and filters.
21
+ */
22
+ public static function add_actions() {
23
+ add_action( 'admin_init', array( __CLASS__, 'admin_register' ) );
24
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_dequeue_scripts' ), 500 );
25
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
26
+
27
+ add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'admin_views' ) );
28
+ add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'admin_fields' ) );
29
+ add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'admin_settings' ) );
30
+ add_action( 'admin_print_styles-wpm-testimonial_page_about-strong-testimonials', array( __CLASS__, 'admin_about' ) );
31
+ add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-shortcodes', array( __CLASS__, 'admin_shortcodes' ) );
32
+
33
+ add_action( 'load-edit.php', array( __CLASS__, 'admin_load_edit' ) );
34
+ add_action( 'load-post.php', array( __CLASS__, 'admin_load_post' ) );
35
+ add_action( 'load-post-new.php', array( __CLASS__, 'admin_load_post' ) );
36
+ add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_load_edit_tags' ) );
37
+ }
38
+
39
+ /**
40
+ * Register admin scripts.
41
+ */
42
+ public static function admin_register() {
43
+
44
+ $plugin_version = get_option( 'wpmtst_plugin_version' );
45
+
46
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
47
+
48
+ wp_register_script( 'wpmtst-help',
49
+ WPMTST_ADMIN_URL . 'js/help.js',
50
+ array( 'jquery' ),
51
+ $plugin_version,
52
+ true );
53
+
54
+
55
+ wp_register_script(
56
+ 'wpmtst-admin-script',
57
+ WPMTST_ASSETS_JS . 'admin-js.js',
58
+ array( 'jquery', 'underscore' ),
59
+ $plugin_version,
60
+ true );
61
+
62
+ wp_register_style(
63
+ 'wpmtst-admin-global-style',
64
+ WPMTST_ASSETS_CSS . 'admin-global.css',
65
+ array(),
66
+ $plugin_version );
67
+
68
+ wp_register_style(
69
+ 'wpmtst-admin-welcome-style',
70
+ WPMTST_ASSETS_CSS . 'admin-welcome.css',
71
+ array(),
72
+ $plugin_version );
73
+
74
+ wp_register_style(
75
+ 'wpmtst-admin-style',
76
+ WPMTST_ASSETS_CSS . 'admin.css',
77
+ array( ),
78
+ $plugin_version );
79
+
80
+ wp_register_style( 'wpmtst-post-editor',
81
+ WPMTST_ADMIN_URL . 'css/post-editor.css',
82
+ array( ),
83
+ $plugin_version );
84
+
85
+ wp_register_script( 'wpmtst-custom-spinner',
86
+ WPMTST_ADMIN_URL . 'js/custom-spinner.js',
87
+ array( 'jquery' ),
88
+ $plugin_version,
89
+ true );
90
+
91
+ wp_register_script( 'autosize',
92
+ WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
93
+ array(),
94
+ '4.0.1',
95
+ true );
96
+
97
+ /**
98
+ * Form tab
99
+ */
100
+ wp_register_style( 'wpmtst-admin-form-style',
101
+ WPMTST_ADMIN_URL . 'css/admin-form.css',
102
+ array( 'wpmtst-admin-style' ),
103
+ $plugin_version );
104
+
105
+ wp_register_script( 'wpmtst-admin-form-script',
106
+ WPMTST_ADMIN_URL . 'js/admin-form.js',
107
+ array( 'wpmtst-admin-script', 'autosize' ),
108
+ $plugin_version,
109
+ true );
110
+
111
+ /**
112
+ * Compatibility tab
113
+ */
114
+ wp_register_style( 'wpmtst-admin-compat-style',
115
+ WPMTST_ADMIN_URL . 'css/admin-compat.css',
116
+ array(),
117
+ $plugin_version );
118
+
119
+ wp_register_script( 'wpmtst-admin-compat-script',
120
+ WPMTST_ADMIN_URL . 'js/admin-compat.js',
121
+ array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
122
+ $plugin_version,
123
+ true );
124
+
125
+ /**
126
+ * Fields
127
+ */
128
+ wp_register_style( 'wpmtst-admin-fields-style',
129
+ WPMTST_ADMIN_URL . 'css/fields.css',
130
+ array(),
131
+ $plugin_version );
132
+
133
+ wp_register_style( 'wpmtst-admin-form-preview',
134
+ WPMTST_ADMIN_URL . 'css/form-preview.css',
135
+ array(),
136
+ $plugin_version );
137
+
138
+ wp_register_script( 'wpmtst-admin-fields-script',
139
+ WPMTST_ADMIN_URL . 'js/admin-fields.js',
140
+ array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
141
+ $plugin_version,
142
+ true );
143
+
144
+ $params = array(
145
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
146
+ 'newField' => esc_html_x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
147
+ 'inUse' => esc_html_x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
148
+ 'noneFound' => esc_html_x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
149
+ );
150
+ wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
151
+
152
+ /**
153
+ * Ratings
154
+ */
155
+ wp_register_style( 'wpmtst-rating-display',
156
+ WPMTST_PUBLIC_URL . 'css/rating-display.css',
157
+ array( ),
158
+ $plugin_version );
159
+
160
+ wp_register_style( 'wpmtst-rating-form',
161
+ WPMTST_PUBLIC_URL . 'css/rating-form.css',
162
+ array( ),
163
+ $plugin_version );
164
+
165
+ wp_register_script( 'wpmtst-rating-script',
166
+ WPMTST_ADMIN_URL . 'js/rating-edit.js',
167
+ array( 'jquery' ),
168
+ $plugin_version,
169
+ true );
170
+
171
+ /**
172
+ * Views
173
+ */
174
+ wp_register_style( 'wpmtst-admin-views-style',
175
+ WPMTST_ADMIN_URL . 'css/views.css',
176
+ array(),
177
+ $plugin_version );
178
+
179
+ wp_register_script( 'wpmtst-admin-views-script',
180
+ WPMTST_ADMIN_URL . 'js/views.js',
181
+ array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
182
+ $plugin_version,
183
+ true );
184
+
185
+ /**
186
+ * Category filter in View editor.
187
+ *
188
+ * JavaScript adapted under GPL-2.0+ license
189
+ * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
190
+ *
191
+ * @since 2.2.0
192
+ */
193
+ wp_register_script( 'wpmtst-view-category-filter-script',
194
+ WPMTST_ADMIN_URL . 'js/view-category-filter.js',
195
+ array( 'jquery' ),
196
+ $plugin_version,
197
+ true );
198
+
199
+ wp_register_style( 'wpmtst-about-style',
200
+ WPMTST_ADMIN_URL . 'css/about.css',
201
+ array(),
202
+ $plugin_version );
203
+
204
+ /**
205
+ * Add-on licenses
206
+ *
207
+ * @since 2.18
208
+ */
209
+ wp_register_script( 'wpmtst-addons-script',
210
+ WPMTST_ADMIN_URL . 'js/addon-licenses.js',
211
+ array( 'jquery' ),
212
+ $plugin_version,
213
+ true );
214
+
215
+ $params = array(
216
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
217
+ 'requiredField' => esc_html( 'This field is required.', 'strong-testimonials' ),
218
+ 'errorMessage' => esc_html__( 'An error occurred, please try again.', 'strong-testimonials' ),
219
+ 'restoreDefault' => esc_html__( 'Restore the default settings?', 'strong-testimonials' ),
220
+ );
221
+ wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
222
+
223
+ /**
224
+ * Are You Sure? for dirty forms
225
+ *
226
+ * @since 2.18
227
+ */
228
+ wp_register_script( 'wpmtst-ays-script',
229
+ WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
230
+ array( 'jquery' ),
231
+ $plugin_version,
232
+ true );
233
+ }
234
+
235
+ /**
236
+ * Enqueue global admin scripts.
237
+ */
238
+ public static function admin_enqueue_scripts() {
239
+ $screen = get_current_screen();
240
+ $plugin_version = get_option( 'wpmtst_plugin_version' );
241
+
242
+ wp_enqueue_style( 'wpmtst-admin-global-style' );
243
+
244
+ wp_enqueue_script( 'wpmtst-admin-global',
245
+ WPMTST_ADMIN_URL . 'js/admin-global.js',
246
+ array( 'jquery' ),
247
+ $plugin_version,
248
+ true );
249
+
250
+ wp_localize_script(
251
+ 'wpmtst-admin-global',
252
+ 'wpmtst_admin',
253
+ array(
254
+ 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
255
+ 'templateTagTitle' => esc_html__( 'click to insert into message at caret', 'strong-testimonials' ),
256
+ )
257
+ );
258
+
259
+ if ( $screen->id === 'dashboard_page_wpmtst-getting-started' ) {
260
+ wp_enqueue_style( 'wpmtst-admin-welcome-style' );
261
+ }
262
+ }
263
+
264
+ /**
265
+ * Enqueue specific styles and scripts.
266
+ *
267
+ * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
268
+ *
269
+ * @since 2.12.0
270
+ */
271
+
272
+ /**
273
+ * Views
274
+ */
275
+ public static function admin_views() {
276
+ wp_enqueue_style( 'wpmtst-admin-style' );
277
+ wp_enqueue_script( 'wpmtst-admin-script' );
278
+
279
+ wp_enqueue_style( 'wpmtst-admin-views-style' );
280
+ wp_enqueue_script( 'wpmtst-admin-views-script' );
281
+ wp_enqueue_script( 'wpmtst-view-category-filter-script' );
282
+
283
+ wp_enqueue_style( 'wp-color-picker' );
284
+ }
285
+
286
+ /**
287
+ * Fields
288
+ */
289
+ public static function admin_fields() {
290
+ $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
291
+ wp_enqueue_style( 'wpmtst-admin-style' );
292
+ wp_enqueue_script( 'wpmtst-admin-script' );
293
+
294
+ switch ( $tab ) {
295
+ case 'form':
296
+ wp_enqueue_style( 'wpmtst-admin-form-style' );
297
+ wp_enqueue_script( 'wpmtst-admin-form-script' );
298
+ break;
299
+ case 'fields':
300
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
301
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
302
+
303
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
304
+ wp_enqueue_style( 'wpmtst-rating-form' );
305
+ break;
306
+ default:
307
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
308
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
309
+
310
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
311
+ wp_enqueue_style( 'wpmtst-rating-form' );
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Settings
317
+ */
318
+ public static function admin_settings() {
319
+ $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
320
+
321
+ switch ( $tab ) {
322
+ case 'compat':
323
+ wp_enqueue_style( 'wpmtst-admin-compat-style' );
324
+ wp_enqueue_script( 'wpmtst-admin-compat-script' );
325
+ break;
326
+ case 'licenses':
327
+ wp_enqueue_style( 'wpmtst-admin-style' );
328
+ wp_enqueue_script( 'wpmtst-addons-script' );
329
+ break;
330
+ default:
331
+ wp_enqueue_style( 'wpmtst-admin-style' );
332
+ wp_enqueue_script( 'wpmtst-admin-script' );
333
+ }
334
+ }
335
+
336
+ /**
337
+ * About
338
+ */
339
+ public static function admin_about() {
340
+ wp_enqueue_style( 'wpmtst-admin-style' );
341
+ wp_enqueue_script( 'wpmtst-admin-script' );
342
+ wp_enqueue_style( 'wpmtst-about-style' );
343
+ }
344
+
345
+ /**
346
+ * Shortcodes
347
+ *
348
+ * @since 2.31.0
349
+ */
350
+ public static function admin_shortcodes() {
351
+ wp_enqueue_style( 'wpmtst-admin-style' );
352
+ wp_enqueue_style( 'wpmtst-rating-display' );
353
+ }
354
+
355
+ /**
356
+ * List table
357
+ */
358
+ public static function admin_load_edit() {
359
+ if ( wpmtst_is_testimonial_screen() ) {
360
+ wp_enqueue_style( 'wpmtst-admin-style' );
361
+ wp_enqueue_script( 'wpmtst-admin-script' );
362
+ wp_enqueue_style( 'wpmtst-rating-display' );
363
+ }
364
+ }
365
+
366
+ /**
367
+ * Categories
368
+ */
369
+ public static function admin_load_edit_tags() {
370
+ if ( wpmtst_is_testimonial_screen() ) {
371
+ wp_enqueue_style( 'wpmtst-admin-style' );
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Edit post
377
+ */
378
+ public static function admin_load_post() {
379
+ if ( wpmtst_is_testimonial_screen() ) {
380
+ wp_enqueue_style( 'wpmtst-admin-style' );
381
+ wp_enqueue_style( 'wpmtst-post-editor' );
382
+ wp_enqueue_script( 'wpmtst-admin-script' );
383
+
384
+ wp_enqueue_style( 'wpmtst-rating-display' );
385
+ wp_enqueue_style( 'wpmtst-rating-form' );
386
+ wp_enqueue_script( 'wpmtst-rating-script' );
387
+ }
388
+ }
389
+
390
+ /**
391
+ * Known theme and plugin conflicts.
392
+ *
393
+ * @param $hook
394
+ */
395
+ public static function admin_dequeue_scripts( $hook ) {
396
+ if ( wp_style_is( 'CPTStyleSheets' ) ) {
397
+ wp_dequeue_style( 'CPTStyleSheets' );
398
+ }
399
+
400
+ $hooks_to_script = array(
401
+ 'wpm-testimonial_page_testimonial-views',
402
+ 'wpm-testimonial_page_testimonial-fields',
403
+ 'wpm-testimonial_page_testimonial-settings',
404
+ 'wpm-testimonial_page_about-strong-testimonials',
405
+ );
406
+
407
+ if ( wpmtst_is_testimonial_screen() ) {
408
+ $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
409
+ }
410
+
411
+ /**
412
+ * Block RT Themes and their overzealous JavaScript on our admin pages.
413
+ * @since 2.2.12.1
414
+ */
415
+ if ( in_array( $hook, $hooks_to_script ) ) {
416
+ if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
417
+ wp_dequeue_script( 'admin-scripts' );
418
+ }
419
+ }
420
+ }
421
+
422
+ }
423
+
424
+ Strong_Testimonials_Admin_Scripts::init();
admin/class-strong-testimonials-defaults.php CHANGED
@@ -1,873 +1,874 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Defaults
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Defaults {
9
-
10
- /**
11
- * Strong_Testimonials_Defaults constructor.
12
- */
13
- public function __construct() { }
14
-
15
- /**
16
- * Settings
17
- *
18
- * @since 1.13.0 reorder
19
- * @since 2.2.11 scrolltop
20
- * @since 2.3.0 remove whitespace
21
- * @since 2.6.0 embed width
22
- * @since 2.6.2 slideshow z-index
23
- * @since 2.10.0 pending indicator
24
- * @since 2.21.0 load Font Awesome
25
- * @since 2.22.5 nofollow
26
- * @since 2.27.0 no_lazyload
27
- *
28
- * @return array
29
- */
30
- public static function get_options() {
31
- $default_options = array(
32
- 'embed_width' => '',
33
- 'nofollow' => true,
34
- 'noopener' => true,
35
- 'noreferrer' => true,
36
- 'disable_rewrite' => false,
37
- 'pending_indicator' => true,
38
- 'remove_whitespace' => true,
39
- //@todo : delete commented line. For the moment let it be
40
- //'reorder' => false,
41
- 'support_comments' => false,
42
- 'support_custom_fields' => false,
43
- 'single_testimonial_slug' => 'testimonial',
44
- 'scrolltop' => true,
45
- 'scrolltop_offset' => 80,
46
- 'lazyload' => false,
47
- 'no_lazyload_plugin' => true,
48
- 'touch_enabled' => true,
49
- 'disable_upsells' => false
50
- );
51
-
52
- return $default_options;
53
- }
54
-
55
- /**
56
- * Custom field base.
57
- *
58
- * @since 2.28.0 Use 'action' to register a callback.
59
- *
60
- * @return array
61
- */
62
- public static function get_field_base() {
63
- return apply_filters( 'wpmtst_field_base', array(
64
- 'name' => '',
65
- 'name_mutable' => 1,
66
- 'label' => '',
67
- 'show_label' => 1,
68
- 'input_type' => '',
69
- 'action_input' => '',
70
- 'action_output' => '',
71
- 'text' => '',
72
- 'show_text_option' => 0,
73
- 'required' => 0,
74
- 'show_required_option' => 1,
75
- 'default_form_value' => '',
76
- 'default_display_value' => '',
77
- 'show_default_options' => 1,
78
- 'error' => esc_html__( 'This field is required.', 'strong-testimonials' ),
79
- 'placeholder' => '',
80
- 'show_placeholder_option' => 1,
81
- 'before' => '',
82
- 'after' => '',
83
- 'admin_table' => 0,
84
- 'admin_table_option' => 1,
85
- 'show_admin_table_option' => 1,
86
- 'shortcode_on_form' => '',
87
- 'shortcode_on_display' => '',
88
- 'show_shortcode_options' => 0,
89
- 'show_length_option' => 0,
90
- 'max_length' => ''
91
- ) );
92
- }
93
-
94
- /**
95
- * Custom fields.
96
- *
97
- * @return array
98
- */
99
- public static function get_fields() {
100
- $field_base = self::get_field_base();
101
- $field_types = array();
102
-
103
- /*
104
- * Assemble post field types
105
- */
106
- $field_types['post'] = array(
107
- 'post_title' => array(
108
- 'input_type' => 'text',
109
- 'option_label' => esc_html__( 'Testimonial Title', 'strong-testimonials' ),
110
- 'map' => 'post_title',
111
- 'show_default_options' => 0,
112
- 'admin_table' => 1,
113
- 'admin_table_option' => 0,
114
- 'show_admin_table_option' => 0,
115
- 'name_mutable' => 0,
116
- 'show_length_option' => 1
117
- ),
118
- 'post_content' => array(
119
- 'input_type' => 'textarea',
120
- 'option_label' => esc_html__( 'Testimonial Content', 'strong-testimonials' ),
121
- 'map' => 'post_content',
122
- 'required' => 1,
123
- 'show_default_options' => 0,
124
- 'core' => 0,
125
- 'admin_table' => 0,
126
- 'show_admin_table_option' => 0,
127
- 'name_mutable' => 0,
128
- 'show_length_option' => 1
129
- ),
130
- 'featured_image' => array(
131
- 'input_type' => 'file',
132
- 'option_label' => esc_html__( 'Featured Image', 'strong-testimonials' ),
133
- 'map' => 'featured_image',
134
- 'show_default_options' => 0,
135
- 'show_placeholder_option' => 0,
136
- 'admin_table' => 0,
137
- 'name_mutable' => 0,
138
- )
139
- );
140
- foreach ( $field_types['post'] as $key => $array ) {
141
- $field_types['post'][ $key ] = array_merge( $field_base, $array );
142
- }
143
-
144
- /*
145
- * Assemble custom field types
146
- */
147
- $field_types['custom'] = array(
148
- 'text' => array(
149
- 'input_type' => 'text',
150
- 'option_label' => esc_html__( 'text', 'strong-testimonials' ),
151
- ),
152
- 'email' => array(
153
- 'input_type' => 'email',
154
- 'option_label' => esc_html__( 'email', 'strong-testimonials' ),
155
- 'show_default_options' => 0,
156
- ),
157
- 'url' => array(
158
- 'input_type' => 'url',
159
- 'option_label' => esc_html__( 'URL', 'strong-testimonials' ),
160
- 'show_default_options' => 0,
161
- ),
162
- 'checkbox' => array(
163
- 'input_type' => 'checkbox',
164
- 'option_label' => esc_html__( 'checkbox', 'strong-testimonials' ),
165
- 'show_text_option' => 1,
166
- 'show_placeholder_option' => 0,
167
- ),
168
- );
169
- foreach ( $field_types['custom'] as $key => $array ) {
170
- $field_types['custom'][ $key ] = array_merge( $field_base, $array );
171
- }
172
-
173
- /*
174
- * Assemble special field types (FKA Optional)
175
- *
176
- * @since 1.18
177
- * @since 2.2.2 Fix bug caused by localizing 'categories'
178
- */
179
- $field_types['optional'] = array(
180
- 'category-selector' => array(
181
- 'input_type' => 'category-selector',
182
- 'option_label' => esc_html__( 'category selector', 'strong-testimonials' ),
183
- 'show_default_options' => 0,
184
- 'show_placeholder_option' => 0,
185
- 'show_admin_table_option' => 0,
186
- 'name_mutable' => 0,
187
- ),
188
- 'category-checklist' => array(
189
- 'input_type' => 'category-checklist',
190
- 'option_label' => esc_html__( 'category checklist', 'strong-testimonials' ),
191
- 'show_default_options' => 0,
192
- 'show_placeholder_option' => 0,
193
- 'show_admin_table_option' => 0,
194
- 'name_mutable' => 0,
195
- ),
196
- 'shortcode' => array(
197
- 'input_type' => 'shortcode',
198
- 'option_label' => esc_html__( 'shortcode', 'strong-testimonials' ),
199
- 'show_label' => 0,
200
- 'required' => 0,
201
- 'show_required_option' => 0,
202
- 'show_default_options' => 0,
203
- 'show_placeholder_option' => 0,
204
- 'show_admin_table_option' => 0,
205
- 'show_shortcode_options' => 1,
206
- ),
207
- 'rating' => array(
208
- 'input_type' => 'rating',
209
- 'option_label' => esc_html__( 'star rating', 'strong-testimonials' ),
210
- 'show_placeholder_option' => 0,
211
- 'admin_table' => 1,
212
- 'admin_table_option' => 1,
213
- 'show_admin_table_option' => 1,
214
- ),
215
- );
216
-
217
- /*
218
- * Merge each one onto base field
219
- */
220
- foreach ( $field_types['optional'] as $key => $array ) {
221
- $field_types['optional'][ $key ] = array_merge( $field_base, $array );
222
- }
223
-
224
- /*
225
- * Assemble all fields
226
- */
227
- $default_fields = array(
228
- 'field_base' => $field_base,
229
- 'field_types' => $field_types,
230
- );
231
-
232
- return apply_filters( 'wpmtst_default_fields', $default_fields );
233
- }
234
-
235
- /**
236
- * Default forms.
237
- *
238
- * @return array
239
- */
240
- public static function get_base_forms() {
241
- $default_fields = self::get_fields();
242
-
243
- // Assemble field groups.
244
- $forms = array(
245
- 'default' => array(
246
- 'name' => 'default',
247
- 'label' => esc_html__( 'Default Form', 'strong-testimonials' ),
248
- 'readonly' => 1,
249
- 'fields' => array(
250
- // ------
251
- // CUSTOM
252
- // ------
253
- 0 => array(
254
- 'record_type' => 'custom',
255
- 'name' => 'client_name',
256
- 'label' => esc_html__( 'Full Name', 'strong-testimonials' ),
257
- 'input_type' => 'text',
258
- 'required' => 1,
259
- 'after' => esc_html__( 'What is your full name?', 'strong-testimonials' ),
260
- 'admin_table' => 1,
261
- ),
262
- 1 => array(
263
- 'record_type' => 'custom',
264
- 'name' => 'email',
265
- 'label' => esc_html__( 'Email', 'strong-testimonials' ),
266
- 'input_type' => 'email',
267
- 'required' => 1,
268
- 'after' => esc_html__( 'What is your email address?', 'strong-testimonials' ),
269
- ),
270
- 3 => array(
271
- 'record_type' => 'custom',
272
- 'name' => 'company_name',
273
- 'label' => esc_html__( 'Company Name', 'strong-testimonials' ),
274
- 'input_type' => 'text',
275
- 'after' => esc_html__( 'What is your company name?', 'strong-testimonials' ),
276
- ),
277
- 4 => array(
278
- 'record_type' => 'custom',
279
- 'name' => 'company_website',
280
- 'label' => esc_html__( 'Company Website', 'strong-testimonials' ),
281
- 'input_type' => 'url',
282
- 'after' => esc_html__( 'Does your company have a website?', 'strong-testimonials' ),
283
- ),
284
- // ----
285
- // POST
286
- // ----
287
- 5 => array(
288
- 'record_type' => 'post',
289
- 'name' => 'post_title',
290
- 'label' => esc_html__( 'Heading', 'strong-testimonials' ),
291
- 'input_type' => 'text',
292
- 'required' => 0,
293
- 'after' => esc_html__( 'A headline for your testimonial.', 'strong-testimonials' ),
294
- 'max_length' => ''
295
- ),
296
- 6 => array(
297
- 'record_type' => 'post',
298
- 'name' => 'post_content',
299
- 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ),
300
- 'input_type' => 'textarea',
301
- 'required' => 1,
302
- 'after' => esc_html__( 'What do you think about us?', 'strong-testimonials' ),
303
- 'max_length' => ''
304
- ),
305
- 7 => array(
306
- 'record_type' => 'post',
307
- 'name' => 'featured_image',
308
- 'label' => esc_html__( 'Photo', 'strong-testimonials' ),
309
- 'input_type' => 'file',
310
- 'after' => esc_html__( 'Would you like to include a photo?', 'strong-testimonials' ),
311
- 'admin_table' => 1,
312
- ),
313
- 8 => array(
314
- 'record_type' => 'optional',
315
- 'name' => 'star_rating',
316
- 'label' => esc_html__( 'Star rating', 'strong-testimonials' ),
317
- 'input_type' => 'rating',
318
- 'required' => 0,
319
- 'after' => esc_html__( 'Would you like to include star rating?', 'strong-testimonials' )
320
- ),
321
- ),
322
- ),
323
- );
324
-
325
- $forms['minimal'] = array(
326
- 'name' => 'minimal',
327
- 'label' => esc_html__( 'Minimal Form', 'strong-testimonials' ),
328
- 'readonly' => 1,
329
- 'fields' => array(
330
- // ------
331
- // CUSTOM
332
- // ------
333
- 0 => array(
334
- 'record_type' => 'custom',
335
- 'name' => 'client_name',
336
- 'label' => esc_html__( 'Name', 'strong-testimonials' ),
337
- 'input_type' => 'text',
338
- 'required' => 1,
339
- 'after' => '',
340
- 'admin_table' => 1,
341
- ),
342
- 1 => array(
343
- 'record_type' => 'custom',
344
- 'name' => 'email',
345
- 'label' => esc_html__( 'Email', 'strong-testimonials' ),
346
- 'input_type' => 'email',
347
- 'required' => 1,
348
- 'after' => '',
349
- ),
350
- // ----
351
- // POST
352
- // ----
353
- 2 => array(
354
- 'record_type' => 'post',
355
- 'name' => 'post_content',
356
- 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ),
357
- 'input_type' => 'textarea',
358
- 'required' => 1,
359
- 'after' => '',
360
- ),
361
- ),
362
- );
363
-
364
- foreach ( $forms as $form_name => $form ) {
365
- foreach ( $form['fields'] as $key => $array ) {
366
- if ( 'post' == $array['record_type'] ) {
367
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
368
- } elseif ( 'custom' == $array['record_type']) {
369
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
370
- } else {
371
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['optional'][ $array['input_type'] ], $array );
372
- }
373
- }
374
- }
375
-
376
- return $forms;
377
- }
378
-
379
- /**
380
- * Custom forms.
381
- *
382
- * @return array
383
- */
384
- public static function get_custom_forms() {
385
-
386
- $base_forms = self::get_base_forms();
387
-
388
- // Copy default fields to custom fields.
389
- $forms[1] = array(
390
- 'name' => 'custom',
391
- 'label' => esc_html__( 'Custom Form', 'strong-testimonials' ),
392
- 'readonly' => 0,
393
- 'fields' => $base_forms['default']['fields'],
394
- );
395
-
396
- return apply_filters( 'wpmtst_update_custom_form', $forms );
397
- }
398
-
399
- /**
400
- * Form options.
401
- *
402
- * @return array
403
- */
404
- public static function get_form_options() {
405
- /**
406
- * Messages
407
- *
408
- * @since 1.13
409
- */
410
- $default_messages = array(
411
- 'required-field' => array(
412
- 'order' => 1,
413
- /* translators: Settings > Form > Messages tab */
414
- 'description' => esc_html_x( 'Required', 'setting description', 'strong-testimonials' ),
415
- 'text' => esc_html_x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
416
- 'enabled' => 1,
417
- ),
418
- 'form-submit-button' => array(
419
- 'order' => 2,
420
- /* translators: Settings > Form > Messages tab */
421
- 'description' => esc_html_x( 'Submit Button', 'description', 'strong-testimonials' ),
422
- /* translators: Default label for the Submit button on testimonial form. */
423
- 'text' => esc_html_x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
424
- ),
425
- 'submission-error' => array(
426
- 'order' => 3,
427
- /* translators: Settings > Form > Messages tab */
428
- 'description' => esc_html_x( 'Submission Error', 'description', 'strong-testimonials' ),
429
- /* translators: Default message for submission form error. */
430
- 'text' => esc_html_x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
431
- ),
432
- 'submission-success' => array(
433
- 'order' => 4,
434
- /* translators: Settings > Form > Messages tab */
435
- 'description' => esc_html_x( 'Submission Success', 'description', 'strong-testimonials' ),
436
- /* translators: Default message for submission form success message. */
437
- 'text' => esc_html_x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
438
- ),
439
- );
440
-
441
- uasort( $default_messages, 'wpmtst_uasort' );
442
-
443
- $default_form_options = array(
444
- 'post_status' => 'pending',
445
- 'admin_notify' => false,
446
- 'customer-notify' => false,
447
- 'approved-notify' => false,
448
- 'sender_name_for_customer' => false,
449
- 'sender_customer_email' => false,
450
- 'sender_site_customer_email' => true,
451
- 'sender_name_for_customer_approval' => false,
452
- 'sender_site_customer_approval_email' => true,
453
- 'sender_approval_email' => false,
454
- 'mail_queue' => false,
455
- 'sender_name' => get_bloginfo( 'name' ),
456
- 'sender_site_email' => true,
457
- 'sender_email' => '',
458
- 'recipients' => array(
459
- array(
460
- 'admin_name' => '',
461
- 'admin_email' => '',
462
- 'admin_site_email' => true,
463
- 'primary' => true, // cannot be deleted
464
- ),
465
- ),
466
- 'default_recipient' => array(
467
- 'admin_name' => '',
468
- 'admin_email' => '',
469
- ),
470
- /* translators: Default subject line for new testimonial notification email. */
471
- 'email_subject' => esc_html__( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
472
- 'customer_approval_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ),
473
- 'customer_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ),
474
- /* translators: Default message for new testimonial notification email. */
475
- 'email_message' => esc_html__( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
476
- 'customer_approval_email_message' => esc_html__( 'Your testimonial was published for %BLOGNAME%. Thank you!', 'strong-testimonials' ),
477
- 'customer_email_message' => esc_html__( 'Your testimonial was received for %BLOGNAME% and awaiting approval from the website administrator. Thank you!', 'strong-testimonials' ),
478
- 'messages' => $default_messages,
479
- 'scrolltop_success' => true,
480
- 'scrolltop_success_offset' => 80,
481
- 'scrolltop_error' => true,
482
- 'scrolltop_error_offset' => 80,
483
- 'success_action' => 'message', // message | id | url
484
- 'success_redirect_id' => '',
485
- 'success_redirect_url' => '',
486
- 'members_only' => false,
487
- 'members_only_message' => esc_html__( 'You need to be logged in to access this form.', 'strong-testimonials' ),
488
- 'mailchimp' => false,
489
- 'mailchimp_message' => esc_html__( 'Subscribe to our newsletter.', 'strong-testimonials' ),
490
- 'mailchimp_list' => ''
491
- );
492
-
493
- return apply_filters( 'wpmtst_default_form_options', $default_form_options );
494
- }
495
-
496
- /**
497
- * Default view options.
498
- *
499
- * @since 1.21.0
500
- *
501
- * @return array
502
- */
503
- public static function get_view_options() {
504
- $default_view_options = array(
505
-
506
- 'mode' => array(
507
- 'display' => array(
508
- 'name' => 'display',
509
- 'label' => esc_html__( 'Display', 'strong-testimonials' ),
510
- 'description' => esc_html__( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
511
- ),
512
- 'slideshow' => array(
513
- 'name' => 'slideshow',
514
- 'label' => esc_html__( 'Slideshow', 'strong-testimonials' ),
515
- 'description' => esc_html__( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
516
- ),
517
- 'form' => array(
518
- 'name' => 'form',
519
- 'label' => esc_html__( 'Form', 'strong-testimonials' ),
520
- 'description' => esc_html__( 'Display a testimonial submission form.', 'strong-testimonials' ),
521
- ),
522
- 'single_template' => array(
523
- 'name' => 'single_template',
524
- 'label' => esc_html__( 'Single Template', 'strong-testimonials' ),
525
- 'description' => esc_html__( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
526
- ),
527
- ),
528
-
529
- 'order' => array(
530
- 'random' => esc_html_x( 'random', 'display order', 'strong-testimonials' ),
531
- 'menu_order' => esc_html_x( 'menu order', 'display order', 'strong-testimonials' ),
532
- 'newest' => esc_html_x( 'newest first', 'display order', 'strong-testimonials' ),
533
- 'oldest' => esc_html_x( 'oldest first', 'display order', 'strong-testimonials' ),
534
- ),
535
-
536
- 'slideshow_effect' => array(
537
- 'none' => esc_html_x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
538
- 'fade' => esc_html_x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
539
- 'horizontal' => esc_html_x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
540
- 'vertical' => esc_html_x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
541
- ),
542
-
543
- 'slideshow_height' => array(
544
- 'dynamic' => esc_html_x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
545
- 'static' => esc_html_x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
546
- ),
547
-
548
- 'slideshow_nav_method' => array(
549
- 'controls' => array(
550
- 'none' => array(
551
- 'label' => esc_html_x( 'none', 'slideshow controls option', 'strong-testimonials' ),
552
- 'args' => array( // base args; style will add more args
553
- 'controls' => 0,
554
- 'pager' => 0,
555
- 'autoControls' => 0,
556
- ),
557
- ),
558
- 'full' => array(
559
- 'label' => esc_html_x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
560
- 'class' => 'controls-type-full',
561
- 'add_position_class' => 1,
562
- 'args' => array(
563
- 'pager' => 0,
564
- 'autoControls' => 1,
565
- 'autoControlsCombine' => 1,
566
- 'fullSetButtons' => 1,
567
- 'fullSetText' => 1,
568
- ),
569
- ),
570
- 'simple' => array(
571
- 'label' => esc_html_x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
572
- 'class' => 'controls-type-simple',
573
- 'add_position_class' => 1,
574
- 'args' => array(
575
- 'controls' => 1,
576
- 'autoControls' => 0,
577
- ),
578
- ),
579
- 'sides' => array(
580
- 'label' => esc_html_x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
581
- 'class' => 'controls-type-sides',
582
- 'add_position_class' => 0,
583
- 'args' => array(
584
- 'controls' => 1,
585
- 'autoControls' => 0,
586
- 'prevText' => '',
587
- 'nextText' => '',
588
- ),
589
- ),
590
- ),
591
- 'pager' => array(
592
- 'none' => array(
593
- 'label' => esc_html_x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
594
- 'args' => array(),
595
- ),
596
- 'full' => array(
597
- 'label' => esc_html_x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
598
- //'class' => 'controls-pager-full',
599
- 'class' => 'pager-type-full',
600
- 'args' => array(
601
- 'pager' => 1,
602
- ),
603
- ),
604
- ),
605
- ),
606
-
607
- 'slideshow_nav_style' => array(
608
- 'controls' => array(
609
- 'buttons' => array(
610
- 'label' => esc_html_x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
611
- 'class' => 'controls-style-buttons',
612
- 'args' => array(
613
- 'startText' => '',
614
- 'stopText' => '',
615
- 'prevText' => '',
616
- 'nextText' => '',
617
- ),
618
- ),
619
- 'buttons2' => array(
620
- 'label' => esc_html_x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
621
- 'class' => 'controls-style-buttons2',
622
- 'args' => array(
623
- 'startText' => '',
624
- 'stopText' => '',
625
- 'prevText' => '',
626
- 'nextText' => '',
627
- ),
628
- ),
629
- 'buttons3' => array(
630
- 'label' => esc_html_x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
631
- 'class' => 'controls-style-buttons3',
632
- 'args' => array(
633
- 'startText' => '',
634
- 'stopText' => '',
635
- 'prevText' => '',
636
- 'nextText' => '',
637
- ),
638
- ),
639
- 'text' => array(
640
- 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
641
- 'class' => 'controls-style-text',
642
- 'args' => array(
643
- 'startText' => esc_html_x( 'Play', 'slideshow control', 'strong-testimonials' ),
644
- 'stopText' => esc_html_x( 'Pause', 'slideshow control', 'strong-testimonials' ),
645
- 'prevText' => esc_html_x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
646
- 'nextText' => esc_html_x( 'Next', 'slideshow_control', 'strong-testimonials' ),
647
- ),
648
- ),
649
- ),
650
- 'pager' => array(
651
- 'buttons' => array(
652
- 'label' => esc_html_x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
653
- 'class' => 'pager-style-buttons',
654
- 'args' => array(
655
- 'buildPager' => 'icons',
656
- 'simpleSetPager' => 1,
657
- ),
658
- ),
659
- 'text' => array(
660
- 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
661
- 'class' => 'pager-style-text',
662
- 'args' => array(
663
- 'buildPager' => null,
664
- 'simpleSetText' => 1,
665
- ),
666
- ),
667
- ),
668
- ),
669
-
670
- // Position is shared by Controls and Pagination.
671
- 'slideshow_nav_position' => array(
672
- 'inside' => esc_html_x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
673
- 'outside' => esc_html_x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
674
- ),
675
- );
676
-
677
- return $default_view_options;
678
- }
679
-
680
- /**
681
- * Default view configuration.
682
- *
683
- * @since 1.21.0
684
- *
685
- * @return array
686
- */
687
- public static function get_default_view() {
688
- $default_view = array(
689
- 'background' => array(
690
- 'color' => '',
691
- 'type' => '',
692
- 'preset' => '',
693
- 'gradient1' => '',
694
- 'gradient2' => '',
695
- ),
696
- 'category' => 'all',
697
- 'class' => '',
698
- 'client_section' => array(
699
- 0 => array(
700
- 'field' => 'client_name',
701
- 'type' => 'text',
702
- 'before' => '',
703
- 'class' => 'testimonial-name',
704
- ),
705
- 1 => array(
706
- 'field' => 'company_name',
707
- 'type' => 'link',
708
- 'before' => '',
709
- 'url' => 'company_website',
710
- 'class' => 'testimonial-company',
711
- 'new_tab' => true,
712
- ),
713
- ),
714
- 'column_count' => 2,
715
- 'container_class' => '',
716
- 'container_data' => '',
717
- 'content' => 'entire',
718
- 'count' => -1,
719
- 'divi_builder' => 0,
720
- 'excerpt_length' => 55,
721
- 'font-color' => array(
722
- 'color' => '',
723
- 'type' => '',
724
- ),
725
- 'form_ajax' => 0,
726
- 'form_id' => 1,
727
- 'gravatar' => 'no',
728
- 'initials_font_size' => '42',
729
- 'initials_font_color' => '#000000',
730
- 'initials_bg_color' => '#ffffff',
731
- 'id' => '',
732
- 'layout' => '',
733
- 'lightbox' => '',
734
- 'lightbox_class' => '',
735
- 'mode' => 'display',
736
- 'more_full_post' => false,
737
- 'more_post' => true,
738
- 'more_post_ellipsis' => true,
739
- 'more_post_text' => esc_html_x( 'Read more', 'link', 'strong-testimonials' ),
740
- 'more_post_in_place' => false,
741
- 'less_post' => false,
742
- 'less_post_text' => esc_html__( 'Show less', 'strong-testimonials' ),
743
- 'more_page' => false,
744
- 'more_page_hook' => 'wpmtst_view_footer',
745
- 'more_page_id' => 0,
746
- 'more_page_text' => esc_html_x( 'Read more testimonials', 'link', 'strong-testimonials' ),
747
- 'note' => '',
748
- 'order' => 'oldest',
749
- 'page' => '',
750
- 'pagination' => false,
751
- 'pagination_settings' => array(
752
- 'type' => 'simple',
753
- 'nav' => 'after',
754
- 'per_page' => 5,
755
- 'show_all' => 0,
756
- 'end_size' => 1,
757
- 'mid_size' => 2,
758
- 'prev_next' => 1,
759
- 'prev_text' => esc_html__( '&laquo; Previous', 'strong-testimonials' ),
760
- 'next_text' => esc_html__( 'Next &raquo;', 'strong-testimonials' ),
761
- 'before_page_number' => '',
762
- 'after_page_number' => '',
763
- ),
764
- 'slideshow_settings' => array(
765
- 'type' => 'show_single', // or show_multiple
766
- 'show_single' => array(
767
- 'max_slides' => 1,
768
- 'move_slides' => 1,
769
- 'margin' => 1,
770
- ),
771
- 'breakpoints' => array(
772
- 'desktop' => array(
773
- 'description' => 'Desktop',
774
- 'width' => 1200,
775
- 'max_slides' => 2,
776
- 'move_slides' => 1,
777
- 'margin' => 20,
778
- ),
779
- 'large' => array(
780
- 'description' => 'Large',
781
- 'width' => 1024,
782
- 'max_slides' => 2,
783
- 'move_slides' => 1,
784
- 'margin' => 20,
785
- ),
786
- 'medium' => array(
787
- 'description' => 'Medium',
788
- 'width' => 640,
789
- 'max_slides' => 1,
790
- 'move_slides' => 1,
791
- 'margin' => 10,
792
- ),
793
- 'small' => array(
794
- 'description' => 'Small',
795
- 'width' => 480,
796
- 'max_slides' => 1,
797
- 'move_slides' => 1,
798
- 'margin' => 1,
799
- ),
800
- ),
801
- 'effect' => 'fade',
802
- 'speed' => 1,
803
- 'pause' => 8,
804
- 'auto_start' => true,
805
- 'continuous_sliding' => false,
806
- 'auto_hover' => true,
807
- 'adapt_height' => true,
808
- 'adapt_height_speed' => .5,
809
- 'stretch' => 0,
810
- 'stop_auto_on_click' => true,
811
- 'controls_type' => 'none',
812
- 'controls_style' => 'buttons',
813
- 'pager_type' => 'none',
814
- 'pager_style' => 'buttons',
815
- 'nav_position' => 'inside',
816
- ),
817
- 'template' => 'default',
818
- 'template_settings' => array(),
819
- 'thumbnail' => true,
820
- 'thumbnail_size' => 'thumbnail',
821
- 'thumbnail_height' => null,
822
- 'thumbnail_width' => null,
823
- 'title' => true,
824
- 'title_link' => 'none',
825
- 'use_default_length' => true,
826
- 'use_default_more' => false,
827
- 'view' => '',
828
- );
829
- ksort( $default_view );
830
-
831
- return $default_view;
832
- }
833
-
834
- /**
835
- * Compatibility options.
836
- *
837
- * @since 2.28.0
838
- * @since 2.31.0 controller
839
- * @since 2.31.0 lazyload
840
- * @return array
841
- */
842
- public static function get_compat_options() {
843
- $options = array(
844
- 'page_loading' => '', // (blank) | general | advanced
845
- 'prerender' => 'current', // current | all | none
846
- 'ajax' => array(
847
- 'method' => '', // (blank) | universal | observer | event | script
848
- 'universal_timer' => 0.5,
849
- 'observer_timer' => 0.5,
850
- 'container_id' => 'page', // = what we listen to (try page > content > primary)
851
- 'addednode_id' => 'content', // = what we listen for
852
- 'event' => '',
853
- 'script' => '',
854
- ),
855
- 'controller' => array(
856
- 'initialize_on' => 'documentReady', // or windowLoad
857
- ),
858
- 'lazyload' => array(
859
- 'enabled' => '',
860
- 'classes' => array( // may be multiple pairs
861
- array(
862
- 'start' => '',
863
- 'finish' => '',
864
- )
865
- ),
866
- ),
867
- 'random_js' => false
868
- );
869
-
870
- return $options;
871
- }
872
-
873
- }
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Defaults
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Defaults {
9
+
10
+ /**
11
+ * Strong_Testimonials_Defaults constructor.
12
+ */
13
+ public function __construct() { }
14
+
15
+ /**
16
+ * Settings
17
+ *
18
+ * @since 1.13.0 reorder
19
+ * @since 2.2.11 scrolltop
20
+ * @since 2.3.0 remove whitespace
21
+ * @since 2.6.0 embed width
22
+ * @since 2.6.2 slideshow z-index
23
+ * @since 2.10.0 pending indicator
24
+ * @since 2.21.0 load Font Awesome
25
+ * @since 2.22.5 nofollow
26
+ * @since 2.27.0 no_lazyload
27
+ *
28
+ * @return array
29
+ */
30
+ public static function get_options() {
31
+ $default_options = array(
32
+ 'embed_width' => '',
33
+ 'nofollow' => true,
34
+ 'noopener' => true,
35
+ 'noreferrer' => true,
36
+ 'disable_rewrite' => false,
37
+ 'pending_indicator' => true,
38
+ 'remove_whitespace' => true,
39
+ //@todo : delete commented line. For the moment let it be
40
+ //'reorder' => false,
41
+ 'support_comments' => false,
42
+ 'support_custom_fields' => false,
43
+ 'single_testimonial_slug' => 'testimonial',
44
+ 'scrolltop' => true,
45
+ 'scrolltop_offset' => 80,
46
+ 'lazyload' => false,
47
+ 'no_lazyload_plugin' => true,
48
+ 'touch_enabled' => true,
49
+ 'disable_upsells' => false,
50
+ 'track_data' => false,
51
+ );
52
+
53
+ return $default_options;
54
+ }
55
+
56
+ /**
57
+ * Custom field base.
58
+ *
59
+ * @since 2.28.0 Use 'action' to register a callback.
60
+ *
61
+ * @return array
62
+ */
63
+ public static function get_field_base() {
64
+ return apply_filters( 'wpmtst_field_base', array(
65
+ 'name' => '',
66
+ 'name_mutable' => 1,
67
+ 'label' => '',
68
+ 'show_label' => 1,
69
+ 'input_type' => '',
70
+ 'action_input' => '',
71
+ 'action_output' => '',
72
+ 'text' => '',
73
+ 'show_text_option' => 0,
74
+ 'required' => 0,
75
+ 'show_required_option' => 1,
76
+ 'default_form_value' => '',
77
+ 'default_display_value' => '',
78
+ 'show_default_options' => 1,
79
+ 'error' => esc_html__( 'This field is required.', 'strong-testimonials' ),
80
+ 'placeholder' => '',
81
+ 'show_placeholder_option' => 1,
82
+ 'before' => '',
83
+ 'after' => '',
84
+ 'admin_table' => 0,
85
+ 'admin_table_option' => 1,
86
+ 'show_admin_table_option' => 1,
87
+ 'shortcode_on_form' => '',
88
+ 'shortcode_on_display' => '',
89
+ 'show_shortcode_options' => 0,
90
+ 'show_length_option' => 0,
91
+ 'max_length' => ''
92
+ ) );
93
+ }
94
+
95
+ /**
96
+ * Custom fields.
97
+ *
98
+ * @return array
99
+ */
100
+ public static function get_fields() {
101
+ $field_base = self::get_field_base();
102
+ $field_types = array();
103
+
104
+ /*
105
+ * Assemble post field types
106
+ */
107
+ $field_types['post'] = array(
108
+ 'post_title' => array(
109
+ 'input_type' => 'text',
110
+ 'option_label' => esc_html__( 'Testimonial Title', 'strong-testimonials' ),
111
+ 'map' => 'post_title',
112
+ 'show_default_options' => 0,
113
+ 'admin_table' => 1,
114
+ 'admin_table_option' => 0,
115
+ 'show_admin_table_option' => 0,
116
+ 'name_mutable' => 0,
117
+ 'show_length_option' => 1
118
+ ),
119
+ 'post_content' => array(
120
+ 'input_type' => 'textarea',
121
+ 'option_label' => esc_html__( 'Testimonial Content', 'strong-testimonials' ),
122
+ 'map' => 'post_content',
123
+ 'required' => 1,
124
+ 'show_default_options' => 0,
125
+ 'core' => 0,
126
+ 'admin_table' => 0,
127
+ 'show_admin_table_option' => 0,
128
+ 'name_mutable' => 0,
129
+ 'show_length_option' => 1
130
+ ),
131
+ 'featured_image' => array(
132
+ 'input_type' => 'file',
133
+ 'option_label' => esc_html__( 'Featured Image', 'strong-testimonials' ),
134
+ 'map' => 'featured_image',
135
+ 'show_default_options' => 0,
136
+ 'show_placeholder_option' => 0,
137
+ 'admin_table' => 0,
138
+ 'name_mutable' => 0,
139
+ )
140
+ );
141
+ foreach ( $field_types['post'] as $key => $array ) {
142
+ $field_types['post'][ $key ] = array_merge( $field_base, $array );
143
+ }
144
+
145
+ /*
146
+ * Assemble custom field types
147
+ */
148
+ $field_types['custom'] = array(
149
+ 'text' => array(
150
+ 'input_type' => 'text',
151
+ 'option_label' => esc_html__( 'text', 'strong-testimonials' ),
152
+ ),
153
+ 'email' => array(
154
+ 'input_type' => 'email',
155
+ 'option_label' => esc_html__( 'email', 'strong-testimonials' ),
156
+ 'show_default_options' => 0,
157
+ ),
158
+ 'url' => array(
159
+ 'input_type' => 'url',
160
+ 'option_label' => esc_html__( 'URL', 'strong-testimonials' ),
161
+ 'show_default_options' => 0,
162
+ ),
163
+ 'checkbox' => array(
164
+ 'input_type' => 'checkbox',
165
+ 'option_label' => esc_html__( 'checkbox', 'strong-testimonials' ),
166
+ 'show_text_option' => 1,
167
+ 'show_placeholder_option' => 0,
168
+ ),
169
+ );
170
+ foreach ( $field_types['custom'] as $key => $array ) {
171
+ $field_types['custom'][ $key ] = array_merge( $field_base, $array );
172
+ }
173
+
174
+ /*
175
+ * Assemble special field types (FKA Optional)
176
+ *
177
+ * @since 1.18
178
+ * @since 2.2.2 Fix bug caused by localizing 'categories'
179
+ */
180
+ $field_types['optional'] = array(
181
+ 'category-selector' => array(
182
+ 'input_type' => 'category-selector',
183
+ 'option_label' => esc_html__( 'category selector', 'strong-testimonials' ),
184
+ 'show_default_options' => 0,
185
+ 'show_placeholder_option' => 0,
186
+ 'show_admin_table_option' => 0,
187
+ 'name_mutable' => 0,
188
+ ),
189
+ 'category-checklist' => array(
190
+ 'input_type' => 'category-checklist',
191
+ 'option_label' => esc_html__( 'category checklist', 'strong-testimonials' ),
192
+ 'show_default_options' => 0,
193
+ 'show_placeholder_option' => 0,
194
+ 'show_admin_table_option' => 0,
195
+ 'name_mutable' => 0,
196
+ ),
197
+ 'shortcode' => array(
198
+ 'input_type' => 'shortcode',
199
+ 'option_label' => esc_html__( 'shortcode', 'strong-testimonials' ),
200
+ 'show_label' => 0,
201
+ 'required' => 0,
202
+ 'show_required_option' => 0,
203
+ 'show_default_options' => 0,
204
+ 'show_placeholder_option' => 0,
205
+ 'show_admin_table_option' => 0,
206
+ 'show_shortcode_options' => 1,
207
+ ),
208
+ 'rating' => array(
209
+ 'input_type' => 'rating',
210
+ 'option_label' => esc_html__( 'star rating', 'strong-testimonials' ),
211
+ 'show_placeholder_option' => 0,
212
+ 'admin_table' => 1,
213
+ 'admin_table_option' => 1,
214
+ 'show_admin_table_option' => 1,
215
+ ),
216
+ );
217
+
218
+ /*
219
+ * Merge each one onto base field
220
+ */
221
+ foreach ( $field_types['optional'] as $key => $array ) {
222
+ $field_types['optional'][ $key ] = array_merge( $field_base, $array );
223
+ }
224
+
225
+ /*
226
+ * Assemble all fields
227
+ */
228
+ $default_fields = array(
229
+ 'field_base' => $field_base,
230
+ 'field_types' => $field_types,
231
+ );
232
+
233
+ return apply_filters( 'wpmtst_default_fields', $default_fields );
234
+ }
235
+
236
+ /**
237
+ * Default forms.
238
+ *
239
+ * @return array
240
+ */
241
+ public static function get_base_forms() {
242
+ $default_fields = self::get_fields();
243
+
244
+ // Assemble field groups.
245
+ $forms = array(
246
+ 'default' => array(
247
+ 'name' => 'default',
248
+ 'label' => esc_html__( 'Default Form', 'strong-testimonials' ),
249
+ 'readonly' => 1,
250
+ 'fields' => array(
251
+ // ------
252
+ // CUSTOM
253
+ // ------
254
+ 0 => array(
255
+ 'record_type' => 'custom',
256
+ 'name' => 'client_name',
257
+ 'label' => esc_html__( 'Full Name', 'strong-testimonials' ),
258
+ 'input_type' => 'text',
259
+ 'required' => 1,
260
+ 'after' => esc_html__( 'What is your full name?', 'strong-testimonials' ),
261
+ 'admin_table' => 1,
262
+ ),
263
+ 1 => array(
264
+ 'record_type' => 'custom',
265
+ 'name' => 'email',
266
+ 'label' => esc_html__( 'Email', 'strong-testimonials' ),
267
+ 'input_type' => 'email',
268
+ 'required' => 1,
269
+ 'after' => esc_html__( 'What is your email address?', 'strong-testimonials' ),
270
+ ),
271
+ 3 => array(
272
+ 'record_type' => 'custom',
273
+ 'name' => 'company_name',
274
+ 'label' => esc_html__( 'Company Name', 'strong-testimonials' ),
275
+ 'input_type' => 'text',
276
+ 'after' => esc_html__( 'What is your company name?', 'strong-testimonials' ),
277
+ ),
278
+ 4 => array(
279
+ 'record_type' => 'custom',
280
+ 'name' => 'company_website',
281
+ 'label' => esc_html__( 'Company Website', 'strong-testimonials' ),
282
+ 'input_type' => 'url',
283
+ 'after' => esc_html__( 'Does your company have a website?', 'strong-testimonials' ),
284
+ ),
285
+ // ----
286
+ // POST
287
+ // ----
288
+ 5 => array(
289
+ 'record_type' => 'post',
290
+ 'name' => 'post_title',
291
+ 'label' => esc_html__( 'Heading', 'strong-testimonials' ),
292
+ 'input_type' => 'text',
293
+ 'required' => 0,
294
+ 'after' => esc_html__( 'A headline for your testimonial.', 'strong-testimonials' ),
295
+ 'max_length' => ''
296
+ ),
297
+ 6 => array(
298
+ 'record_type' => 'post',
299
+ 'name' => 'post_content',
300
+ 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ),
301
+ 'input_type' => 'textarea',
302
+ 'required' => 1,
303
+ 'after' => esc_html__( 'What do you think about us?', 'strong-testimonials' ),
304
+ 'max_length' => ''
305
+ ),
306
+ 7 => array(
307
+ 'record_type' => 'post',
308
+ 'name' => 'featured_image',
309
+ 'label' => esc_html__( 'Photo', 'strong-testimonials' ),
310
+ 'input_type' => 'file',
311
+ 'after' => esc_html__( 'Would you like to include a photo?', 'strong-testimonials' ),
312
+ 'admin_table' => 1,
313
+ ),
314
+ 8 => array(
315
+ 'record_type' => 'optional',
316
+ 'name' => 'star_rating',
317
+ 'label' => esc_html__( 'Star rating', 'strong-testimonials' ),
318
+ 'input_type' => 'rating',
319
+ 'required' => 0,
320
+ 'after' => esc_html__( 'Would you like to include star rating?', 'strong-testimonials' )
321
+ ),
322
+ ),
323
+ ),
324
+ );
325
+
326
+ $forms['minimal'] = array(
327
+ 'name' => 'minimal',
328
+ 'label' => esc_html__( 'Minimal Form', 'strong-testimonials' ),
329
+ 'readonly' => 1,
330
+ 'fields' => array(
331
+ // ------
332
+ // CUSTOM
333
+ // ------
334
+ 0 => array(
335
+ 'record_type' => 'custom',
336
+ 'name' => 'client_name',
337
+ 'label' => esc_html__( 'Name', 'strong-testimonials' ),
338
+ 'input_type' => 'text',
339
+ 'required' => 1,
340
+ 'after' => '',
341
+ 'admin_table' => 1,
342
+ ),
343
+ 1 => array(
344
+ 'record_type' => 'custom',
345
+ 'name' => 'email',
346
+ 'label' => esc_html__( 'Email', 'strong-testimonials' ),
347
+ 'input_type' => 'email',
348
+ 'required' => 1,
349
+ 'after' => '',
350
+ ),
351
+ // ----
352
+ // POST
353
+ // ----
354
+ 2 => array(
355
+ 'record_type' => 'post',
356
+ 'name' => 'post_content',
357
+ 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ),
358
+ 'input_type' => 'textarea',
359
+ 'required' => 1,
360
+ 'after' => '',
361
+ ),
362
+ ),
363
+ );
364
+
365
+ foreach ( $forms as $form_name => $form ) {
366
+ foreach ( $form['fields'] as $key => $array ) {
367
+ if ( 'post' == $array['record_type'] ) {
368
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
369
+ } elseif ( 'custom' == $array['record_type']) {
370
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
371
+ } else {
372
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['optional'][ $array['input_type'] ], $array );
373
+ }
374
+ }
375
+ }
376
+
377
+ return $forms;
378
+ }
379
+
380
+ /**
381
+ * Custom forms.
382
+ *
383
+ * @return array
384
+ */
385
+ public static function get_custom_forms() {
386
+
387
+ $base_forms = self::get_base_forms();
388
+
389
+ // Copy default fields to custom fields.
390
+ $forms[1] = array(
391
+ 'name' => 'custom',
392
+ 'label' => esc_html__( 'Custom Form', 'strong-testimonials' ),
393
+ 'readonly' => 0,
394
+ 'fields' => $base_forms['default']['fields'],
395
+ );
396
+
397
+ return apply_filters( 'wpmtst_update_custom_form', $forms );
398
+ }
399
+
400
+ /**
401
+ * Form options.
402
+ *
403
+ * @return array
404
+ */
405
+ public static function get_form_options() {
406
+ /**
407
+ * Messages
408
+ *
409
+ * @since 1.13
410
+ */
411
+ $default_messages = array(
412
+ 'required-field' => array(
413
+ 'order' => 1,
414
+ /* translators: Settings > Form > Messages tab */
415
+ 'description' => esc_html_x( 'Required', 'setting description', 'strong-testimonials' ),
416
+ 'text' => esc_html_x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
417
+ 'enabled' => 1,
418
+ ),
419
+ 'form-submit-button' => array(
420
+ 'order' => 2,
421
+ /* translators: Settings > Form > Messages tab */
422
+ 'description' => esc_html_x( 'Submit Button', 'description', 'strong-testimonials' ),
423
+ /* translators: Default label for the Submit button on testimonial form. */
424
+ 'text' => esc_html_x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
425
+ ),
426
+ 'submission-error' => array(
427
+ 'order' => 3,
428
+ /* translators: Settings > Form > Messages tab */
429
+ 'description' => esc_html_x( 'Submission Error', 'description', 'strong-testimonials' ),
430
+ /* translators: Default message for submission form error. */
431
+ 'text' => esc_html_x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
432
+ ),
433
+ 'submission-success' => array(
434
+ 'order' => 4,
435
+ /* translators: Settings > Form > Messages tab */
436
+ 'description' => esc_html_x( 'Submission Success', 'description', 'strong-testimonials' ),
437
+ /* translators: Default message for submission form success message. */
438
+ 'text' => esc_html_x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
439
+ ),
440
+ );
441
+
442
+ uasort( $default_messages, 'wpmtst_uasort' );
443
+
444
+ $default_form_options = array(
445
+ 'post_status' => 'pending',
446
+ 'admin_notify' => false,
447
+ 'customer-notify' => false,
448
+ 'approved-notify' => false,
449
+ 'sender_name_for_customer' => false,
450
+ 'sender_customer_email' => false,
451
+ 'sender_site_customer_email' => true,
452
+ 'sender_name_for_customer_approval' => false,
453
+ 'sender_site_customer_approval_email' => true,
454
+ 'sender_approval_email' => false,
455
+ 'mail_queue' => false,
456
+ 'sender_name' => get_bloginfo( 'name' ),
457
+ 'sender_site_email' => true,
458
+ 'sender_email' => '',
459
+ 'recipients' => array(
460
+ array(
461
+ 'admin_name' => '',
462
+ 'admin_email' => '',
463
+ 'admin_site_email' => true,
464
+ 'primary' => true, // cannot be deleted
465
+ ),
466
+ ),
467
+ 'default_recipient' => array(
468
+ 'admin_name' => '',
469
+ 'admin_email' => '',
470
+ ),
471
+ /* translators: Default subject line for new testimonial notification email. */
472
+ 'email_subject' => esc_html__( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
473
+ 'customer_approval_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ),
474
+ 'customer_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ),
475
+ /* translators: Default message for new testimonial notification email. */
476
+ 'email_message' => esc_html__( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
477
+ 'customer_approval_email_message' => esc_html__( 'Your testimonial was published for %BLOGNAME%. Thank you!', 'strong-testimonials' ),
478
+ 'customer_email_message' => esc_html__( 'Your testimonial was received for %BLOGNAME% and awaiting approval from the website administrator. Thank you!', 'strong-testimonials' ),
479
+ 'messages' => $default_messages,
480
+ 'scrolltop_success' => true,
481
+ 'scrolltop_success_offset' => 80,
482
+ 'scrolltop_error' => true,
483
+ 'scrolltop_error_offset' => 80,
484
+ 'success_action' => 'message', // message | id | url
485
+ 'success_redirect_id' => '',
486
+ 'success_redirect_url' => '',
487
+ 'members_only' => false,
488
+ 'members_only_message' => esc_html__( 'You need to be logged in to access this form.', 'strong-testimonials' ),
489
+ 'mailchimp' => false,
490
+ 'mailchimp_message' => esc_html__( 'Subscribe to our newsletter.', 'strong-testimonials' ),
491
+ 'mailchimp_list' => ''
492
+ );
493
+
494
+ return apply_filters( 'wpmtst_default_form_options', $default_form_options );
495
+ }
496
+
497
+ /**
498
+ * Default view options.
499
+ *
500
+ * @since 1.21.0
501
+ *
502
+ * @return array
503
+ */
504
+ public static function get_view_options() {
505
+ $default_view_options = array(
506
+
507
+ 'mode' => array(
508
+ 'display' => array(
509
+ 'name' => 'display',
510
+ 'label' => esc_html__( 'Display', 'strong-testimonials' ),
511
+ 'description' => esc_html__( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
512
+ ),
513
+ 'slideshow' => array(
514
+ 'name' => 'slideshow',
515
+ 'label' => esc_html__( 'Slideshow', 'strong-testimonials' ),
516
+ 'description' => esc_html__( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
517
+ ),
518
+ 'form' => array(
519
+ 'name' => 'form',
520
+ 'label' => esc_html__( 'Form', 'strong-testimonials' ),
521
+ 'description' => esc_html__( 'Display a testimonial submission form.', 'strong-testimonials' ),
522
+ ),
523
+ 'single_template' => array(
524
+ 'name' => 'single_template',
525
+ 'label' => esc_html__( 'Single Template', 'strong-testimonials' ),
526
+ 'description' => esc_html__( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
527
+ ),
528
+ ),
529
+
530
+ 'order' => array(
531
+ 'random' => esc_html_x( 'random', 'display order', 'strong-testimonials' ),
532
+ 'menu_order' => esc_html_x( 'menu order', 'display order', 'strong-testimonials' ),
533
+ 'newest' => esc_html_x( 'newest first', 'display order', 'strong-testimonials' ),
534
+ 'oldest' => esc_html_x( 'oldest first', 'display order', 'strong-testimonials' ),
535
+ ),
536
+
537
+ 'slideshow_effect' => array(
538
+ 'none' => esc_html_x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
539
+ 'fade' => esc_html_x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
540
+ 'horizontal' => esc_html_x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
541
+ 'vertical' => esc_html_x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
542
+ ),
543
+
544
+ 'slideshow_height' => array(
545
+ 'dynamic' => esc_html_x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
546
+ 'static' => esc_html_x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
547
+ ),
548
+
549
+ 'slideshow_nav_method' => array(
550
+ 'controls' => array(
551
+ 'none' => array(
552
+ 'label' => esc_html_x( 'none', 'slideshow controls option', 'strong-testimonials' ),
553
+ 'args' => array( // base args; style will add more args
554
+ 'controls' => 0,
555
+ 'pager' => 0,
556
+ 'autoControls' => 0,
557
+ ),
558
+ ),
559
+ 'full' => array(
560
+ 'label' => esc_html_x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
561
+ 'class' => 'controls-type-full',
562
+ 'add_position_class' => 1,
563
+ 'args' => array(
564
+ 'pager' => 0,
565
+ 'autoControls' => 1,
566
+ 'autoControlsCombine' => 1,
567
+ 'fullSetButtons' => 1,
568
+ 'fullSetText' => 1,
569
+ ),
570
+ ),
571
+ 'simple' => array(
572
+ 'label' => esc_html_x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
573
+ 'class' => 'controls-type-simple',
574
+ 'add_position_class' => 1,
575
+ 'args' => array(
576
+ 'controls' => 1,
577
+ 'autoControls' => 0,
578
+ ),
579
+ ),
580
+ 'sides' => array(
581
+ 'label' => esc_html_x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
582
+ 'class' => 'controls-type-sides',
583
+ 'add_position_class' => 0,
584
+ 'args' => array(
585
+ 'controls' => 1,
586
+ 'autoControls' => 0,
587
+ 'prevText' => '',
588
+ 'nextText' => '',
589
+ ),
590
+ ),
591
+ ),
592
+ 'pager' => array(
593
+ 'none' => array(
594
+ 'label' => esc_html_x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
595
+ 'args' => array(),
596
+ ),
597
+ 'full' => array(
598
+ 'label' => esc_html_x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
599
+ //'class' => 'controls-pager-full',
600
+ 'class' => 'pager-type-full',
601
+ 'args' => array(
602
+ 'pager' => 1,
603
+ ),
604
+ ),
605
+ ),
606
+ ),
607
+
608
+ 'slideshow_nav_style' => array(
609
+ 'controls' => array(
610
+ 'buttons' => array(
611
+ 'label' => esc_html_x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
612
+ 'class' => 'controls-style-buttons',
613
+ 'args' => array(
614
+ 'startText' => '',
615
+ 'stopText' => '',
616
+ 'prevText' => '',
617
+ 'nextText' => '',
618
+ ),
619
+ ),
620
+ 'buttons2' => array(
621
+ 'label' => esc_html_x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
622
+ 'class' => 'controls-style-buttons2',
623
+ 'args' => array(
624
+ 'startText' => '',
625
+ 'stopText' => '',
626
+ 'prevText' => '',
627
+ 'nextText' => '',
628
+ ),
629
+ ),
630
+ 'buttons3' => array(
631
+ 'label' => esc_html_x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
632
+ 'class' => 'controls-style-buttons3',
633
+ 'args' => array(
634
+ 'startText' => '',
635
+ 'stopText' => '',
636
+ 'prevText' => '',
637
+ 'nextText' => '',
638
+ ),
639
+ ),
640
+ 'text' => array(
641
+ 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
642
+ 'class' => 'controls-style-text',
643
+ 'args' => array(
644
+ 'startText' => esc_html_x( 'Play', 'slideshow control', 'strong-testimonials' ),
645
+ 'stopText' => esc_html_x( 'Pause', 'slideshow control', 'strong-testimonials' ),
646
+ 'prevText' => esc_html_x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
647
+ 'nextText' => esc_html_x( 'Next', 'slideshow_control', 'strong-testimonials' ),
648
+ ),
649
+ ),
650
+ ),
651
+ 'pager' => array(
652
+ 'buttons' => array(
653
+ 'label' => esc_html_x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
654
+ 'class' => 'pager-style-buttons',
655
+ 'args' => array(
656
+ 'buildPager' => 'icons',
657
+ 'simpleSetPager' => 1,
658
+ ),
659
+ ),
660
+ 'text' => array(
661
+ 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
662
+ 'class' => 'pager-style-text',
663
+ 'args' => array(
664
+ 'buildPager' => null,
665
+ 'simpleSetText' => 1,
666
+ ),
667
+ ),
668
+ ),
669
+ ),
670
+
671
+ // Position is shared by Controls and Pagination.
672
+ 'slideshow_nav_position' => array(
673
+ 'inside' => esc_html_x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
674
+ 'outside' => esc_html_x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
675
+ ),
676
+ );
677
+
678
+ return $default_view_options;
679
+ }
680
+
681
+ /**
682
+ * Default view configuration.
683
+ *
684
+ * @since 1.21.0
685
+ *
686
+ * @return array
687
+ */
688
+ public static function get_default_view() {
689
+ $default_view = array(
690
+ 'background' => array(
691
+ 'color' => '',
692
+ 'type' => '',
693
+ 'preset' => '',
694
+ 'gradient1' => '',
695
+ 'gradient2' => '',
696
+ ),
697
+ 'category' => 'all',
698
+ 'class' => '',
699
+ 'client_section' => array(
700
+ 0 => array(
701
+ 'field' => 'client_name',
702
+ 'type' => 'text',
703
+ 'before' => '',
704
+ 'class' => 'testimonial-name',
705
+ ),
706
+ 1 => array(
707
+ 'field' => 'company_name',
708
+ 'type' => 'link',
709
+ 'before' => '',
710
+ 'url' => 'company_website',
711
+ 'class' => 'testimonial-company',
712
+ 'new_tab' => true,
713
+ ),
714
+ ),
715
+ 'column_count' => 2,
716
+ 'container_class' => '',
717
+ 'container_data' => '',
718
+ 'content' => 'entire',
719
+ 'count' => -1,
720
+ 'divi_builder' => 0,
721
+ 'excerpt_length' => 55,
722
+ 'font-color' => array(
723
+ 'color' => '',
724
+ 'type' => '',
725
+ ),
726
+ 'form_ajax' => 0,
727
+ 'form_id' => 1,
728
+ 'gravatar' => 'no',
729
+ 'initials_font_size' => '42',
730
+ 'initials_font_color' => '#000000',
731
+ 'initials_bg_color' => '#ffffff',
732
+ 'id' => '',
733
+ 'layout' => '',
734
+ 'lightbox' => '',
735
+ 'lightbox_class' => '',
736
+ 'mode' => 'display',
737
+ 'more_full_post' => false,
738
+ 'more_post' => true,
739
+ 'more_post_ellipsis' => true,
740
+ 'more_post_text' => esc_html_x( 'Read more', 'link', 'strong-testimonials' ),
741
+ 'more_post_in_place' => false,
742
+ 'less_post' => false,
743
+ 'less_post_text' => esc_html__( 'Show less', 'strong-testimonials' ),
744
+ 'more_page' => false,
745
+ 'more_page_hook' => 'wpmtst_view_footer',
746
+ 'more_page_id' => 0,
747
+ 'more_page_text' => esc_html_x( 'Read more testimonials', 'link', 'strong-testimonials' ),
748
+ 'note' => '',
749
+ 'order' => 'oldest',
750
+ 'page' => '',
751
+ 'pagination' => false,
752
+ 'pagination_settings' => array(
753
+ 'type' => 'simple',
754
+ 'nav' => 'after',
755
+ 'per_page' => 5,
756
+ 'show_all' => 0,
757
+ 'end_size' => 1,
758
+ 'mid_size' => 2,
759
+ 'prev_next' => 1,
760
+ 'prev_text' => esc_html__( '&laquo; Previous', 'strong-testimonials' ),
761
+ 'next_text' => esc_html__( 'Next &raquo;', 'strong-testimonials' ),
762
+ 'before_page_number' => '',
763
+ 'after_page_number' => '',
764
+ ),
765
+ 'slideshow_settings' => array(
766
+ 'type' => 'show_single', // or show_multiple
767
+ 'show_single' => array(
768
+ 'max_slides' => 1,
769
+ 'move_slides' => 1,
770
+ 'margin' => 1,
771
+ ),
772
+ 'breakpoints' => array(
773
+ 'desktop' => array(
774
+ 'description' => 'Desktop',
775
+ 'width' => 1200,
776
+ 'max_slides' => 2,
777
+ 'move_slides' => 1,
778
+ 'margin' => 20,
779
+ ),
780
+ 'large' => array(
781
+ 'description' => 'Large',
782
+ 'width' => 1024,
783
+ 'max_slides' => 2,
784
+ 'move_slides' => 1,
785
+ 'margin' => 20,
786
+ ),
787
+ 'medium' => array(
788
+ 'description' => 'Medium',
789
+ 'width' => 640,
790
+ 'max_slides' => 1,
791
+ 'move_slides' => 1,
792
+ 'margin' => 10,
793
+ ),
794
+ 'small' => array(
795
+ 'description' => 'Small',
796
+ 'width' => 480,
797
+ 'max_slides' => 1,
798
+ 'move_slides' => 1,
799
+ 'margin' => 1,
800
+ ),
801
+ ),
802
+ 'effect' => 'fade',
803
+ 'speed' => 1,
804
+ 'pause' => 8,
805
+ 'auto_start' => true,
806
+ 'continuous_sliding' => false,
807
+ 'auto_hover' => true,
808
+ 'adapt_height' => true,
809
+ 'adapt_height_speed' => .5,
810
+ 'stretch' => 0,
811
+ 'stop_auto_on_click' => true,
812
+ 'controls_type' => 'none',
813
+ 'controls_style' => 'buttons',
814
+ 'pager_type' => 'none',
815
+ 'pager_style' => 'buttons',
816
+ 'nav_position' => 'inside',
817
+ ),
818
+ 'template' => 'default',
819
+ 'template_settings' => array(),
820
+ 'thumbnail' => true,
821
+ 'thumbnail_size' => 'thumbnail',
822
+ 'thumbnail_height' => null,
823
+ 'thumbnail_width' => null,
824
+ 'title' => true,
825
+ 'title_link' => 'none',
826
+ 'use_default_length' => true,
827
+ 'use_default_more' => false,
828
+ 'view' => '',
829
+ );
830
+ ksort( $default_view );
831
+
832
+ return $default_view;
833
+ }
834
+
835
+ /**
836
+ * Compatibility options.
837
+ *
838
+ * @since 2.28.0
839
+ * @since 2.31.0 controller
840
+ * @since 2.31.0 lazyload
841
+ * @return array
842
+ */
843
+ public static function get_compat_options() {
844
+ $options = array(
845
+ 'page_loading' => '', // (blank) | general | advanced
846
+ 'prerender' => 'current', // current | all | none
847
+ 'ajax' => array(
848
+ 'method' => '', // (blank) | universal | observer | event | script
849
+ 'universal_timer' => 0.5,
850
+ 'observer_timer' => 0.5,
851
+ 'container_id' => 'page', // = what we listen to (try page > content > primary)
852
+ 'addednode_id' => 'content', // = what we listen for
853
+ 'event' => '',
854
+ 'script' => '',
855
+ ),
856
+ 'controller' => array(
857
+ 'initialize_on' => 'documentReady', // or windowLoad
858
+ ),
859
+ 'lazyload' => array(
860
+ 'enabled' => '',
861
+ 'classes' => array( // may be multiple pairs
862
+ array(
863
+ 'start' => '',
864
+ 'finish' => '',
865
+ )
866
+ ),
867
+ ),
868
+ 'random_js' => false
869
+ );
870
+
871
+ return $options;
872
+ }
873
+
874
+ }
admin/class-strong-testimonials-exporter.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Exporter
5
- *
6
- * exports testimonials along with their featured media
7
- *
8
- * @since 2.36
9
- */
10
- class Strong_Testimonials_Exporter {
11
-
12
- public $args = array();
13
- public $query_done = false;
14
-
15
- public function __construct() {
16
- add_action( 'export_wp', array( $this, 'export_wp' ), 10, 1 );
17
- add_filter( 'export_query', array( $this, 'export_query' ), 10, 1 );
18
- }
19
-
20
- public function export_wp( $args ) {
21
- $this->args = $args;
22
- add_filter( 'query', array( $this, 'export_query_filter' ), 10, 1 );
23
- }
24
-
25
- public function export_query_filter( $query ) {
26
-
27
- global $wpdb;
28
- if ( false === $this->query_done && 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} " ) ) {
29
- $this->query_done = true;
30
- remove_filter( 'query', array( $this, 'export_query_filter' ), 10 );
31
- $query = apply_filters( 'export_query', $query );
32
- }
33
- return $query;
34
- }
35
-
36
- public function export_query( $query ) {
37
- global $wpdb;
38
-
39
- if ( isset( $this->args['content'] ) && 'wpm-testimonial' === $this->args['content'] ) {
40
-
41
- $attachments = $wpdb->get_results( "SELECT ID, guid, post_parent FROM {$wpdb->posts} WHERE post_type = 'attachment'", OBJECT_K );
42
- if ( empty( $attachments ) ) {
43
- return $query;
44
- }
45
-
46
- $ids = array();
47
-
48
- // get attachments who are post thumbnails
49
- $posts = $wpdb->get_col( $query );
50
- if ( $posts ) {
51
- $ids = $wpdb->get_col( sprintf( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_thumbnail_id' AND post_id IN(%s)", implode( ',', $posts ) ) );
52
- }
53
-
54
- // get atachments who have a post parent.
55
- foreach ( $attachments as $id => $att ) {
56
- if ( in_array( $att->post_parent, $posts ) ) {
57
- $ids[] = $id;
58
- }
59
- }
60
-
61
- $ids = array_unique( $ids );
62
- if ( count( $ids ) === 0 ) {
63
- return $query;
64
- }
65
-
66
- if ( 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} " ) ) {
67
- // replace INNER JOIN with LEFT JOIN.
68
- $query = str_replace( "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} ", "SELECT ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ", $query );
69
- }
70
- $query .= sprintf( " OR {$wpdb->posts}.ID IN (%s) ", implode( ',', $ids ) );
71
-
72
- }
73
- return $query;
74
- }
75
-
76
-
77
- }
78
-
79
- new Strong_Testimonials_Exporter();
80
-
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Exporter
5
+ *
6
+ * exports testimonials along with their featured media
7
+ *
8
+ * @since 2.36
9
+ */
10
+ class Strong_Testimonials_Exporter {
11
+
12
+ public $args = array();
13
+ public $query_done = false;
14
+
15
+ public function __construct() {
16
+ add_action( 'export_wp', array( $this, 'export_wp' ), 10, 1 );
17
+ add_filter( 'export_query', array( $this, 'export_query' ), 10, 1 );
18
+ }
19
+
20
+ public function export_wp( $args ) {
21
+ $this->args = $args;
22
+ add_filter( 'query', array( $this, 'export_query_filter' ), 10, 1 );
23
+ }
24
+
25
+ public function export_query_filter( $query ) {
26
+
27
+ global $wpdb;
28
+ if ( false === $this->query_done && 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} " ) ) {
29
+ $this->query_done = true;
30
+ remove_filter( 'query', array( $this, 'export_query_filter' ), 10 );
31
+ $query = apply_filters( 'export_query', $query );
32
+ }
33
+ return $query;
34
+ }
35
+
36
+ public function export_query( $query ) {
37
+ global $wpdb;
38
+
39
+ if ( isset( $this->args['content'] ) && 'wpm-testimonial' === $this->args['content'] ) {
40
+
41
+ $attachments = $wpdb->get_results( "SELECT ID, guid, post_parent FROM {$wpdb->posts} WHERE post_type = 'attachment'", OBJECT_K );
42
+ if ( empty( $attachments ) ) {
43
+ return $query;
44
+ }
45
+
46
+ $ids = array();
47
+
48
+ // get attachments who are post thumbnails
49
+ $posts = $wpdb->get_col( $query );
50
+ if ( $posts ) {
51
+ $ids = $wpdb->get_col( sprintf( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_thumbnail_id' AND post_id IN(%s)", implode( ',', $posts ) ) );
52
+ }
53
+
54
+ // get atachments who have a post parent.
55
+ foreach ( $attachments as $id => $att ) {
56
+ if ( in_array( $att->post_parent, $posts ) ) {
57
+ $ids[] = $id;
58
+ }
59
+ }
60
+
61
+ $ids = array_unique( $ids );
62
+ if ( count( $ids ) === 0 ) {
63
+ return $query;
64
+ }
65
+
66
+ if ( 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} " ) ) {
67
+ // replace INNER JOIN with LEFT JOIN.
68
+ $query = str_replace( "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} ", "SELECT ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ", $query );
69
+ }
70
+ $query .= sprintf( " OR {$wpdb->posts}.ID IN (%s) ", implode( ',', $ids ) );
71
+
72
+ }
73
+ return $query;
74
+ }
75
+
76
+
77
+ }
78
+
79
+ new Strong_Testimonials_Exporter();
80
+
admin/class-strong-testimonials-help.php CHANGED
@@ -1,226 +1,226 @@
1
- <?php
2
- /**
3
- * Contextual help.
4
- */
5
-
6
- class Strong_Testimonials_Help {
7
-
8
- public function __construct() {}
9
-
10
- public static function init() {
11
- add_action( 'load-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'fields_editor' ) );
12
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'views_list' ) );
13
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'shortcode_attributes' ) );
14
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_pagination' ) );
15
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_stretch' ) );
16
-
17
- add_action( 'load-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'settings_compat' ) );
18
- }
19
-
20
- /**
21
- * Compatibility settings.
22
- */
23
- public static function settings_compat() {
24
- if ( ! isset( $_GET['tab'] ) || 'compat' != sanitize_key( $_GET['tab'] ) ) {
25
- return;
26
- }
27
-
28
- ob_start();
29
- ?>
30
- <p><?php esc_html_e( 'Normally, a web page will load its stylesheets (font, color, size, etc.) before the content. When the content is displayed, the style is ready and the page appears as it was designed.', 'strong-testimonials' ); ?></p>
31
- <p><?php esc_html_e( 'When a browser displays the content before all the stylesheets have been loaded, a flash of unstyled content can occur.', 'strong-testimonials' ); ?></p>
32
- <p>
33
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' ) ); ?>
34
- |
35
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://codepen.io/micikato/full/JroPNm/' ) ); ?>
36
- |
37
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://css-tricks.com/fout-foit-foft/' ) ); ?>
38
- </p>
39
- <p><?php esc_html_e( 'When this occurs with plugins that use shortcodes, it means the plugin\'s stylesheet was enqueued when the shortcode was rendered so it gets loaded after the content instead of in the normal sequence.', 'strong-testimonials' ); ?></p>
40
- <p><?php esc_html_e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
41
- <?php
42
- $content = ob_get_clean();
43
-
44
- get_current_screen()->add_help_tab( array(
45
- 'id' => 'wpmtst-help-prerender',
46
- 'title' => esc_html__( 'Prerender', 'strong-testimonials' ),
47
- 'content' => $content,
48
- ) );
49
- }
50
-
51
- /**
52
- * Custom fields editor.
53
- */
54
- public static function fields_editor() {
55
- ob_start();
56
- ?>
57
- <p><?php esc_html_e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
58
- <p><?php esc_html_e( 'This editor serves two purposes: (1) to modify the form as it appears on your site, and (2) to modify the custom fields added to each testimonial.', 'strong-testimonials' ); ?></p>
59
- <p><?php esc_html_e( 'The default fields are designed to fit most situations. You can quickly add or remove fields and change several display properties.', 'strong-testimonials' ); ?></p>
60
- <p><?php esc_html_e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( esc_html__( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
61
- <p><?php esc_html_e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
62
- <?php
63
- $content = ob_get_clean();
64
-
65
- // Links
66
-
67
- $links = array(
68
- '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
69
- );
70
-
71
- $content .= '<p>' . implode( ' | ', $links ) . '</p>';
72
-
73
- get_current_screen()->add_help_tab( array(
74
- 'id' => 'wpmtst-help',
75
- 'title' => esc_html__( 'Form Fields', 'strong-testimonials' ),
76
- 'content' => $content,
77
- ) );
78
- }
79
-
80
- /**
81
- * About views.
82
- */
83
- public static function views_list() {
84
- ob_start();
85
- ?>
86
- <div>
87
- <p><?php esc_html_e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
88
- <p><?php _e( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ); ?></p>
89
- <p><?php esc_html_e( 'For example:', 'strong-testimonials' ); ?></p>
90
- <ul class="standard">
91
- <li><?php esc_html_e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
92
- <li><?php esc_html_e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
93
- <li><?php esc_html_e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
94
- <?php do_action( 'wpmtst_views_intro_list' ); ?>
95
- </ul>
96
- <p><?php esc_html_e( 'Add a view to a page with its unique shortcode or add it to a sidebar with the Strong Testimonials widget.', 'strong-testimonials' ); ?></p>
97
- </div>
98
- <?php
99
- $content = ob_get_clean();
100
-
101
- get_current_screen()->add_help_tab( array(
102
- 'id' => 'wpmtst-help-views',
103
- 'title' => esc_html__( 'About Views', 'strong-testimonials' ),
104
- 'content' => $content,
105
- ) );
106
- }
107
-
108
- /**
109
- * Shortcode attributes.
110
- */
111
- public static function shortcode_attributes() {
112
- if ( ! isset( $_GET['action'] ) ) {
113
- return;
114
- }
115
-
116
- ob_start();
117
- ?>
118
- <div>
119
- <p><?php echo wp_kses_post( _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ) ); ?>
120
- <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
121
- <p><?php echo wp_kses_post( esc_html_e( 'For example, imagine you have five services, a sales page for each service, and a testimonial category for each service. To display the testimonials on each service page, you can create five duplicate views, one for each category.', 'strong-testimonials' ) ); ?>
122
- <p><?php echo wp_kses_post( _e( 'Or you can configure one view as a pattern and add it to each service page with the <code>category</code> attribute.', 'strong-testimonials' ) ); ?>
123
- <p>
124
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-1"]</code>' ); ?>,
125
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-2"]</code>' ); ?>, etc.
126
- </p>
127
- <p>
128
- <?php echo wp_kses_post( esc_html_e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
129
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>' ); ?>
130
- </p>
131
- <p><?php echo wp_kses_post( _e( 'Using <code>post_ids</code> is the most specific method and it will override category and count (whether settings or attributes).', 'strong-testimonials' ) ); ?></p>
132
- </div>
133
- <?php
134
- $content = ob_get_clean();
135
-
136
- get_current_screen()->add_help_tab( array(
137
- 'id' => 'wpmtst-help-shortcode',
138
- 'title' => esc_html__( 'Shortcode Attributes', 'strong-testimonials' ),
139
- 'content' => $content,
140
- ) );
141
- }
142
-
143
- /**
144
- * Pagination comparison.
145
- */
146
- public static function view_editor_pagination() {
147
- if ( ! isset( $_GET['action'] ) ) {
148
- return;
149
- }
150
-
151
- ob_start();
152
- ?>
153
- <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
154
-
155
- <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
156
- <thead>
157
- <tr>
158
- <th></th>
159
- <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
160
- <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
161
- </tr>
162
- </thead>
163
- <tbody>
164
- <tr>
165
- <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
166
- <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
167
- <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
168
- </tr>
169
- <tr>
170
- <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
171
- <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
172
- <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
173
- </tr>
174
- <tr>
175
- <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
176
- <td><?php esc_html_e( 'It does not remember which page of testimonials you are on. If you click away &ndash; for example, on a "Read more" link &ndash; then click back, you will return to page one.', 'strong-testimonials' ); ?></td>
177
- <td><?php esc_html_e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td>
178
- </tr>
179
- <tr>
180
- <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
181
- <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
182
- <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
183
- </tr>
184
- <tr>
185
- <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
186
- <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
187
- <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
188
- </tr>
189
- </tbody>
190
- </table>
191
- <?php
192
- $content = ob_get_clean();
193
-
194
- get_current_screen()->add_help_tab( array(
195
- 'id' => 'wpmtst-help-pagination',
196
- 'title' => esc_html__( 'Pagination', 'strong-testimonials' ),
197
- 'content' => $content,
198
- ) );
199
- }
200
-
201
- /**
202
- * Slideshow stretch explanation.
203
- */
204
- public static function view_editor_stretch() {
205
- if ( ! isset( $_GET['action'] ) ) {
206
- return;
207
- }
208
-
209
- ob_start();
210
- ?>
211
- <p><?php _e( 'This will set the height of the <b>slideshow container</b> to match the tallest slide in order to keep elements below it from bouncing up and down during slide transitions. With testimonials of uneven length, the result is whitespace underneath the shorter testimonials.', 'strong-testimonials' ); ?></p>
212
- <p><?php _e( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
213
- <p><?php esc_html_e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
214
- <?php
215
- $content = ob_get_clean();
216
-
217
- get_current_screen()->add_help_tab( array(
218
- 'id' => 'wpmtst-help-stretch',
219
- 'title' => esc_html__( 'Stretch', 'strong-testimonials' ),
220
- 'content' => $content,
221
- ) );
222
- }
223
-
224
- }
225
-
226
- Strong_Testimonials_Help::init();
1
+ <?php
2
+ /**
3
+ * Contextual help.
4
+ */
5
+
6
+ class Strong_Testimonials_Help {
7
+
8
+ public function __construct() {}
9
+
10
+ public static function init() {
11
+ add_action( 'load-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'fields_editor' ) );
12
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'views_list' ) );
13
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'shortcode_attributes' ) );
14
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_pagination' ) );
15
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_stretch' ) );
16
+
17
+ add_action( 'load-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'settings_compat' ) );
18
+ }
19
+
20
+ /**
21
+ * Compatibility settings.
22
+ */
23
+ public static function settings_compat() {
24
+ if ( ! isset( $_GET['tab'] ) || 'compat' != sanitize_key( $_GET['tab'] ) ) {
25
+ return;
26
+ }
27
+
28
+ ob_start();
29
+ ?>
30
+ <p><?php esc_html_e( 'Normally, a web page will load its stylesheets (font, color, size, etc.) before the content. When the content is displayed, the style is ready and the page appears as it was designed.', 'strong-testimonials' ); ?></p>
31
+ <p><?php esc_html_e( 'When a browser displays the content before all the stylesheets have been loaded, a flash of unstyled content can occur.', 'strong-testimonials' ); ?></p>
32
+ <p>
33
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' ) ); ?>
34
+ |
35
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://codepen.io/micikato/full/JroPNm/' ) ); ?>
36
+ |
37
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://css-tricks.com/fout-foit-foft/' ) ); ?>
38
+ </p>
39
+ <p><?php esc_html_e( 'When this occurs with plugins that use shortcodes, it means the plugin\'s stylesheet was enqueued when the shortcode was rendered so it gets loaded after the content instead of in the normal sequence.', 'strong-testimonials' ); ?></p>
40
+ <p><?php esc_html_e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
41
+ <?php
42
+ $content = ob_get_clean();
43
+
44
+ get_current_screen()->add_help_tab( array(
45
+ 'id' => 'wpmtst-help-prerender',
46
+ 'title' => esc_html__( 'Prerender', 'strong-testimonials' ),
47
+ 'content' => $content,
48
+ ) );
49
+ }
50
+
51
+ /**
52
+ * Custom fields editor.
53
+ */
54
+ public static function fields_editor() {
55
+ ob_start();
56
+ ?>
57
+ <p><?php esc_html_e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
58
+ <p><?php esc_html_e( 'This editor serves two purposes: (1) to modify the form as it appears on your site, and (2) to modify the custom fields added to each testimonial.', 'strong-testimonials' ); ?></p>
59
+ <p><?php esc_html_e( 'The default fields are designed to fit most situations. You can quickly add or remove fields and change several display properties.', 'strong-testimonials' ); ?></p>
60
+ <p><?php esc_html_e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( esc_html__( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
61
+ <p><?php esc_html_e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
62
+ <?php
63
+ $content = ob_get_clean();
64
+
65
+ // Links
66
+
67
+ $links = array(
68
+ '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
69
+ );
70
+
71
+ $content .= '<p>' . implode( ' | ', $links ) . '</p>';
72
+
73
+ get_current_screen()->add_help_tab( array(
74
+ 'id' => 'wpmtst-help',
75
+ 'title' => esc_html__( 'Form Fields', 'strong-testimonials' ),
76
+ 'content' => $content,
77
+ ) );
78
+ }
79
+
80
+ /**
81
+ * About views.
82
+ */
83
+ public static function views_list() {
84
+ ob_start();
85
+ ?>
86
+ <div>
87
+ <p><?php esc_html_e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
88
+ <p><?php _e( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ); ?></p>
89
+ <p><?php esc_html_e( 'For example:', 'strong-testimonials' ); ?></p>
90
+ <ul class="standard">
91
+ <li><?php esc_html_e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
92
+ <li><?php esc_html_e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
93
+ <li><?php esc_html_e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
94
+ <?php do_action( 'wpmtst_views_intro_list' ); ?>
95
+ </ul>
96
+ <p><?php esc_html_e( 'Add a view to a page with its unique shortcode or add it to a sidebar with the Strong Testimonials widget.', 'strong-testimonials' ); ?></p>
97
+ </div>
98
+ <?php
99
+ $content = ob_get_clean();
100
+
101
+ get_current_screen()->add_help_tab( array(
102
+ 'id' => 'wpmtst-help-views',
103
+ 'title' => esc_html__( 'About Views', 'strong-testimonials' ),
104
+ 'content' => $content,
105
+ ) );
106
+ }
107
+
108
+ /**
109
+ * Shortcode attributes.
110
+ */
111
+ public static function shortcode_attributes() {
112
+ if ( ! isset( $_GET['action'] ) ) {
113
+ return;
114
+ }
115
+
116
+ ob_start();
117
+ ?>
118
+ <div>
119
+ <p><?php echo wp_kses_post( _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ) ); ?>
120
+ <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
121
+ <p><?php echo wp_kses_post( esc_html_e( 'For example, imagine you have five services, a sales page for each service, and a testimonial category for each service. To display the testimonials on each service page, you can create five duplicate views, one for each category.', 'strong-testimonials' ) ); ?>
122
+ <p><?php echo wp_kses_post( _e( 'Or you can configure one view as a pattern and add it to each service page with the <code>category</code> attribute.', 'strong-testimonials' ) ); ?>
123
+ <p>
124
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-1"]</code>' ); ?>,
125
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-2"]</code>' ); ?>, etc.
126
+ </p>
127
+ <p>
128
+ <?php echo wp_kses_post( esc_html_e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
129
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>' ); ?>
130
+ </p>
131
+ <p><?php echo wp_kses_post( _e( 'Using <code>post_ids</code> is the most specific method and it will override category and count (whether settings or attributes).', 'strong-testimonials' ) ); ?></p>
132
+ </div>
133
+ <?php
134
+ $content = ob_get_clean();
135
+
136
+ get_current_screen()->add_help_tab( array(
137
+ 'id' => 'wpmtst-help-shortcode',
138
+ 'title' => esc_html__( 'Shortcode Attributes', 'strong-testimonials' ),
139
+ 'content' => $content,
140
+ ) );
141
+ }
142
+
143
+ /**
144
+ * Pagination comparison.
145
+ */
146
+ public static function view_editor_pagination() {
147
+ if ( ! isset( $_GET['action'] ) ) {
148
+ return;
149
+ }
150
+
151
+ ob_start();
152
+ ?>
153
+ <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
154
+
155
+ <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
156
+ <thead>
157
+ <tr>
158
+ <th></th>
159
+ <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
160
+ <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
161
+ </tr>
162
+ </thead>
163
+ <tbody>
164
+ <tr>
165
+ <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
166
+ <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
167
+ <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
168
+ </tr>
169
+ <tr>
170
+ <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
171
+ <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
172
+ <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
173
+ </tr>
174
+ <tr>
175
+ <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
176
+ <td><?php esc_html_e( 'It does not remember which page of testimonials you are on. If you click away &ndash; for example, on a "Read more" link &ndash; then click back, you will return to page one.', 'strong-testimonials' ); ?></td>
177
+ <td><?php esc_html_e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td>
178
+ </tr>
179
+ <tr>
180
+ <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
181
+ <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
182
+ <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
183
+ </tr>
184
+ <tr>
185
+ <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
186
+ <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
187
+ <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
188
+ </tr>
189
+ </tbody>
190
+ </table>
191
+ <?php
192
+ $content = ob_get_clean();
193
+
194
+ get_current_screen()->add_help_tab( array(
195
+ 'id' => 'wpmtst-help-pagination',
196
+ 'title' => esc_html__( 'Pagination', 'strong-testimonials' ),
197
+ 'content' => $content,
198
+ ) );
199
+ }
200
+
201
+ /**
202
+ * Slideshow stretch explanation.
203
+ */
204
+ public static function view_editor_stretch() {
205
+ if ( ! isset( $_GET['action'] ) ) {
206
+ return;
207
+ }
208
+
209
+ ob_start();
210
+ ?>
211
+ <p><?php _e( 'This will set the height of the <b>slideshow container</b> to match the tallest slide in order to keep elements below it from bouncing up and down during slide transitions. With testimonials of uneven length, the result is whitespace underneath the shorter testimonials.', 'strong-testimonials' ); ?></p>
212
+ <p><?php _e( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
213
+ <p><?php esc_html_e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
214
+ <?php
215
+ $content = ob_get_clean();
216
+
217
+ get_current_screen()->add_help_tab( array(
218
+ 'id' => 'wpmtst-help-stretch',
219
+ 'title' => esc_html__( 'Stretch', 'strong-testimonials' ),
220
+ 'content' => $content,
221
+ ) );
222
+ }
223
+
224
+ }
225
+
226
+ Strong_Testimonials_Help::init();
admin/class-strong-testimonials-helper.php CHANGED
@@ -1,2560 +1,2560 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Helper
5
- *
6
- * @since 2.5
7
- */
8
- class Strong_Testimonials_Helper {
9
-
10
- /**
11
- * Our Class variables
12
- *
13
- * @since 2.51.5
14
- */
15
- public $field;
16
- public $action;
17
- public $view_id;
18
- public $view_options;
19
- public $cat_count = false;
20
- public $show_section;
21
- public $view;
22
- public $view_name;
23
- public $view_cats_array;
24
- public $sections;
25
- public $current_mode;
26
- public $current_type;
27
- public $isSetting;
28
-
29
- /**
30
- * Strong_Testimonials_Helper constructor.
31
- *
32
- * @since 2.51.5
33
- */
34
- public function __construct() {
35
-
36
- $this->action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
37
- $this->view_id = abs( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
38
- $this->view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
39
- $this->cat_count = wpmtst_get_cat_count();
40
- }
41
-
42
- /**
43
- * Set Strong Testimonial view
44
- *
45
- * @since 2.51.5
46
- */
47
- public function set_view() {
48
-
49
- $this->view = $this->get_view();
50
- $this->show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
51
- if ( 'edit' == $this->action ) {
52
- $view_array = wpmtst_get_view( $this->view_id );
53
- $this->view = unserialize( $view_array['value'] );
54
- $this->view_name = $view_array['name'];
55
- } elseif ( 'duplicate' == $this->action ) {
56
- $view_array = wpmtst_get_view( $this->view_id );
57
- $this->view = unserialize( $view_array['value'] );
58
- $this->view_id = 0;
59
- $this->view_name = $view_array['name'] . ' - COPY';
60
- } else {
61
- $this->view_id = 1;
62
- $this->view = wpmtst_get_view_default();
63
- $this->view_name = 'new';
64
- }
65
- $this->view_cats_array = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->view['category'] ) );
66
- $this->sections = $this->get_sections();
67
- }
68
-
69
- /**
70
- * Get Strong Testimonial view
71
- *
72
- * @return array|mixed
73
- *
74
- * @since 2.51.5
75
- */
76
- public static function get_view() {
77
-
78
- $view = wpmtst_get_view_default();
79
- if ( isset( $_REQUEST['action'] ) ) {
80
- $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
81
- $id = abs( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
82
- if ( 'edit' == $action || 'duplicate' == $action ) {
83
- $view_array = wpmtst_get_view( $id );
84
- if ( isset( $view_array['value'] ) ) {
85
- $view = unserialize( $view_array['value'] );
86
- }
87
- }
88
- }
89
-
90
- return $view;
91
- }
92
-
93
- /**
94
- * Get Strong Testimonials sections
95
- *
96
- * @return mixed|void
97
- *
98
- * @since 2.51.5
99
- */
100
- public function get_sections() {
101
- return apply_filters( 'wpmtst_view_sections', array(
102
- 'query' => array(
103
- 'section_action_before' => 'wpmtst_view_editor_before_group_select',
104
- 'section_action_after' => 'wpmtst_view_editor_after_group_select',
105
- 'fields_action_before' => '',
106
- 'fields_action_after' => array(
107
- 'action' => 'wpmtst_views_group_query',
108
- 'param' => $this->view
109
- ),
110
- 'classes' => array(
111
- 'then',
112
- 'then_display',
113
- 'then_not_form',
114
- 'then_slideshow',
115
- 'then_not_single_template'
116
- ),
117
- 'title' => esc_html__( 'Query', 'strong-testimonials' ),
118
- 'table_classes' => 'form-table multiple group-select',
119
- 'subheading' => array(
120
- array(
121
- 'title' => esc_html__( 'Option', 'strong-testimonials' ),
122
- 'classes' => '',
123
- 'colspan' => 1,
124
- 'after' => ''
125
- ),
126
- array(
127
- 'title' => esc_html__( 'Settings', 'strong-testimonials' ),
128
- 'classes' => '',
129
- 'colspan' => 1,
130
- 'after' => ''
131
- ),
132
- array(
133
- 'title' => esc_html__( 'or Shortcode Attribute', 'strong-testimonials' ),
134
- 'classes' => 'divider',
135
- 'colspan' => 2,
136
- 'after' => '<span class="help-links"><span class="description"><a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a></span></span>'
137
- ),
138
- array(
139
- 'title' => esc_html__( 'Example', 'strong-testimonials' ),
140
- 'classes' => '',
141
- 'colspan' => 1,
142
- 'after' => ''
143
- )
144
- ),
145
- 'fields' => array(
146
- 'field_select' => array(
147
- 'label' => esc_html_x( 'Select', 'verb', 'strong-testimonials' ),
148
- 'type' => 'select',
149
- 'before' => '',
150
- 'after' => '',
151
- 'class' => 'view-single_or_multiple',
152
- 'container_classes' => 'then then_display then_slideshow then_not_form',
153
- 'id' => '',
154
- 'field_action_before' => '',
155
- 'field_action_after' => ''
156
- ),
157
- 'field_category' => array(
158
- 'label' => esc_html__( 'Categories', 'strong-testimonials' ),
159
- 'type' => 'category',
160
- 'before' => '',
161
- 'after' => '',
162
- 'class' => 'view-category-select',
163
- 'container_classes' => 'then then_display then_slideshow then_not_form',
164
- 'id' => '',
165
- 'field_action_before' => '',
166
- 'field_action_after' => ''
167
- ),
168
- 'field_order' => array(
169
- 'label' => esc_html_x( 'Order', 'noun', 'strong-testimonials' ),
170
- 'type' => 'order',
171
- 'before' => '',
172
- 'after' => '',
173
- 'class' => 'view-order',
174
- 'container_classes' => 'then then_display then_slideshow then_not_form',
175
- 'id' => '',
176
- 'field_action_before' => '',
177
- 'field_action_after' => ''
178
- ),
179
- 'field_limit' => array(
180
- 'label' => esc_html__( 'Quantity', 'strong-testimonials' ),
181
- 'type' => 'limit',
182
- 'before' => '',
183
- 'after' => '',
184
- 'class' => 'view-all',
185
- 'container_classes' => 'then then_display then_slideshow then_not_form',
186
- 'id' => '',
187
- 'field_action_before' => '',
188
- 'field_action_after' => ''
189
- )
190
- )
191
- ),
192
- 'fields' => array(
193
- 'section_action_before' => 'wpmtst_view_editor_before_group_fields',
194
- 'section_action_after' => '',
195
- 'fields_action_before' => '',
196
- 'fields_action_after' => '',
197
- 'classes' => array(
198
- 'then',
199
- 'then_display',
200
- 'then_not_form',
201
- 'then_slideshow',
202
- 'then_single_template'
203
- ),
204
- 'title' => esc_html__( 'Fields', 'strong-testimonials' ),
205
- 'table_classes' => 'form-table multiple group-show',
206
- 'fields' => array(
207
- 'field_title' => array(
208
- 'label' => esc_html__( ' Title', 'strong-testimonials' ),
209
- 'type' => 'title',
210
- 'before' => '<input type="checkbox" id="view-title" name="view[data][title]" value="1"' . checked( $this->view['title'], true, false ) . ' class="checkbox if toggle">',
211
- 'after' => '',
212
- 'class' => 'view-title',
213
- 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
214
- 'id' => '',
215
- 'field_action_before' => '',
216
- 'field_action_after' => ''
217
- ),
218
- 'field_thumbnail' => array(
219
- 'label' => esc_html__( ' Featured Image', 'strong-testimonials' ),
220
- 'type' => 'thumbnail',
221
- 'before' => '<input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1"' . checked( $this->view['thumbnail'], true, false ) . '>',
222
- 'after' => '',
223
- 'class' => 'view-images',
224
- 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
225
- 'id' => '',
226
- 'field_action_before' => '',
227
- 'field_action_after' => ''
228
- ),
229
- 'field_content' => array(
230
- 'label' => esc_html__( ' Content', 'strong-testimonials' ),
231
- 'type' => 'content',
232
- 'before' => '',
233
- 'after' => '',
234
- 'class' => 'view-content',
235
- 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
236
- 'id' => '',
237
- 'field_action_before' => '',
238
- 'field_action_after' => ''
239
- ),
240
- 'field_client_section' => array(
241
- 'include' => 'option-client-section.php',
242
- 'label' => esc_html__( ' Custom Fields', 'strong-testimonials' ),
243
- 'type' => 'client-section',
244
- 'before' => '',
245
- 'after' => '',
246
- 'class' => '',
247
- 'container_classes' => 'then then_display then_not_form then_slideshow then_single_template',
248
- 'id' => '',
249
- 'field_action_before' => '',
250
- 'field_action_after' => ''
251
- )
252
- )
253
- ),
254
-
255
- 'extra' => array(
256
- 'section_action_before' => 'wpmtst_view_editor_before_group_extra',
257
- 'section_action_after' => '',
258
- 'fields_action_before' => '',
259
- 'fields_action_after' => '',
260
- 'classes' => array(
261
- 'then',
262
- 'then_display',
263
- 'then_not_form',
264
- 'then_slideshow',
265
- 'then_not_single_template'
266
- ),
267
- 'title' => esc_html__( 'Extra', 'strong-testimonials' ),
268
- 'table_classes' => 'form-table multiple group-layout',
269
- 'fields' => array(
270
- 'field_pagination' => array(
271
- 'label' => esc_html__( ' Pagination', 'strong-testimonials' ),
272
- 'type' => 'pagination',
273
- 'before' => '<input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]" type="checkbox" value="1"' . checked( $this->view['pagination'], true, false ) . '/>',
274
- 'after' => '',
275
- 'class' => 'view-pagination',
276
- 'container_classes' => 'then then_display then_not_form then_not_slideshow then_not_single then_multiple',
277
- 'id' => '',
278
- 'field_action_before' => '',
279
- 'field_action_after' => ''
280
- ),
281
- 'field_read_more' => array(
282
- 'include' => 'option-read-more-page.php',
283
- 'label' => esc_html__( ' "Read more" link to a page or post', 'strong-testimonials' ),
284
- 'type' => 'read-more-page',
285
- 'before' => '<div class="checkbox"><input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"' . checked( isset( $this->view['more_page'] ) && $this->view['more_page'], true, false ) . ' class="checkbox">',
286
- 'after' => '</div>',
287
- 'class' => 'view-more_page',
288
- 'container_classes' => 'then then_display then_not_form then_slideshow read-more',
289
- 'id' => '',
290
- 'field_action_before' => '',
291
- 'field_action_after' => ''
292
- ),
293
- )
294
- ),
295
- 'slideshow' => array(
296
- 'section_action_before' => 'wpmtst_view_editor_before_group_slideshow',
297
- 'section_action_after' => '',
298
- 'fields_action_before' => '',
299
- 'fields_action_after' => '',
300
- 'classes' => array(
301
- 'then',
302
- 'then_not_display',
303
- 'then_not_form',
304
- 'then_slideshow',
305
- 'then_not_single_template'
306
- ),
307
- 'title' => esc_html__( 'Slideshow', 'strong-testimonials' ),
308
- 'table_classes' => 'form-table multiple group-select',
309
- 'fields' => array(
310
- 'field_slideshow_num' => array(
311
- 'label' => esc_html__( 'Show', 'strong-testimonials' ),
312
- 'type' => 'slideshow-num',
313
- 'before' => '',
314
- 'after' => '',
315
- 'class' => '',
316
- 'container_classes' => 'then then_slideshow',
317
- 'id' => '',
318
- 'field_action_before' => '',
319
- 'field_action_after' => ''
320
- ),
321
- 'field_slideshow_transition' => array(
322
- 'include' => 'option-slideshow-transition.php',
323
- 'label' => esc_html__( 'Transition', 'strong-testimonials' ),
324
- 'type' => 'slideshow-transition',
325
- 'before' => '',
326
- 'after' => '',
327
- 'class' => '',
328
- 'container_classes' => 'then then_slideshow',
329
- 'id' => '',
330
- 'field_action_before' => '',
331
- 'field_action_after' => ''
332
- ),
333
- 'field_slideshow_behavior' => array(
334
- 'label' => esc_html__( 'Behavior', 'strong-testimonials' ),
335
- 'type' => 'slideshow-behavior',
336
- 'before' => '',
337
- 'after' => '',
338
- 'class' => '',
339
- 'container_classes' => 'then then_slideshow',
340
- 'id' => '',
341
- 'field_action_before' => '',
342
- 'field_action_after' => ''
343
- ),
344
- 'field_slideshow_navigation' => array(
345
- 'label' => esc_html__( 'Navigation', 'strong-testimonials' ),
346
- 'type' => 'slideshow-navigation',
347
- 'before' => '',
348
- 'after' => '',
349
- 'class' => 'view-slideshow_nav',
350
- 'container_classes' => 'then then_slideshow',
351
- 'id' => '',
352
- 'field_action_before' => '',
353
- 'field_action_after' => ''
354
- )
355
- )
356
- ),
357
-
358
- 'form' => array(
359
- 'section_action_before' => 'wpmtst_view_editor_before_group_form',
360
- 'section_action_after' => '',
361
- 'fields_action_before' => '',
362
- 'fields_action_after' => '',
363
- 'classes' => array(
364
- 'then',
365
- 'then_not_display',
366
- 'then_not_slideshow',
367
- 'then_form',
368
- 'then_not_single_template'
369
- ),
370
- 'title' => esc_html__( 'Actions', 'strong-testimonials' ),
371
- 'table_classes' => 'form-table multiple group-select',
372
- 'fields' => array(
373
- 'field_form_category' => array(
374
- 'label' => esc_html__( 'Assign to a category', 'strong-testimonials' ),
375
- 'type' => 'form-category',
376
- 'before' => '',
377
- 'after' => '',
378
- 'class' => '',
379
- 'container_classes' => 'then then_form',
380
- 'id' => '',
381
- 'field_action_before' => '',
382
- 'field_action_after' => ''
383
- ),
384
- 'field_form_ajax' => array(
385
- 'label' => esc_html__( ' Submit form without reloading the page (Ajax)', 'strong-testimonials' ),
386
- 'type' => 'form-ajax',
387
- 'before' => '<input type="checkbox" id="view-form_ajax" class="checkbox if toggle" name="view[data][form_ajax]" value="1"' . checked( $this->view['form_ajax'], true, false ) . '>',
388
- 'after' => '',
389
- 'class' => 'view-form_ajax',
390
- 'container_classes' => 'then then_form',
391
- 'id' => '',
392
- 'field_action_before' => '',
393
- 'field_action_after' => ''
394
- ),
395
- )
396
- ),
397
-
398
- 'style' => array(
399
- 'section_action_before' => 'wpmtst_view_editor_before_group_style',
400
- 'section_action_after' => 'wpmtst_after_style_view_section',
401
- 'fields_action_before' => '',
402
- 'fields_action_after' => array(
403
- 'action' => 'wpmtst_view_editor_after_style_section',
404
- 'param' => ''
405
- ),
406
- 'classes' => array(
407
- 'then',
408
- 'then_display',
409
- 'then_form',
410
- 'then_slideshow',
411
- 'then_not_single_template'
412
- ),
413
- 'title' => esc_html__( 'Style', 'strong-testimonials' ),
414
- 'table_classes' => 'form-table multiple group-style',
415
- 'fields' => array(
416
- 'field_template_list_display' => array(
417
- 'label' => esc_html__( 'Template', 'strong-testimonials' ),
418
- 'type' => 'template-list-display',
419
- 'before' => '',
420
- 'after' => '',
421
- 'class' => '',
422
- 'container_classes' => 'then then_display then_not_form then_slideshow',
423
- 'id' => '',
424
- 'field_action_before' => 'wpmtst_view_editor_before_template_list',
425
- 'field_action_after' => ''
426
- ),
427
- 'field_template_list_form' => array(
428
- 'label' => esc_html__( 'Template', 'strong-testimonials' ),
429
- 'type' => 'template-list-form',
430
- 'before' => '',
431
- 'after' => '',
432
- 'class' => '',
433
- 'container_classes' => 'then then_not_display then_form then_not_slideshow',
434
- 'id' => '',
435
- 'field_action_before' => '',
436
- 'field_action_after' => ''
437
- ),
438
- 'field_option_layout' => array(
439
- 'include' => 'option-layout.php',
440
- 'label' => esc_html__( 'Layout', 'strong-testimonials' ),
441
- 'type' => 'layout',
442
- 'before' => '',
443
- 'after' => '',
444
- 'class' => '',
445
- 'container_classes' => 'then then_display then_not_form then_not_slideshow',
446
- 'id' => '',
447
- 'field_action_before' => 'wpmtst_view_editor_before_layout',
448
- 'field_action_after' => ''
449
- ),
450
- 'field_background' => array(
451
- 'label' => esc_html__( 'Background', 'strong-testimonials' ),
452
- 'type' => 'background',
453
- 'before' => '',
454
- 'after' => '',
455
- 'class' => '',
456
- 'id' => 'group-style-option-background',
457
- 'container_classes' => 'then then_display then_form then_slideshow',
458
- 'field_action_before' => 'wpmtst_view_editor_before_background',
459
- 'field_action_after' => ''
460
- ),
461
- 'field_color' => array(
462
- 'label' => esc_html__( 'Font Color', 'strong-testimonials' ),
463
- 'type' => 'color',
464
- 'before' => '',
465
- 'after' => '',
466
- 'class' => '',
467
- 'id' => 'group-style-option-color',
468
- 'container_classes' => 'then then_display then_form then_slideshow',
469
- 'field_action_before' => '',
470
- 'field_action_after' => ''
471
- ),
472
- 'field_classes' => array(
473
- 'label' => esc_html__( 'CSS Classes', 'strong-testimonials' ),
474
- 'type' => 'classes',
475
- 'before' => '',
476
- 'after' => '',
477
- 'class' => 'view-class',
478
- 'id' => '',
479
- 'container_classes' => 'then then_display then_form then_slideshow',
480
- 'field_action_before' => 'wpmtst_view_editor_before_classes',
481
- 'field_action_after' => ''
482
- ),
483
- )
484
- ),
485
-
486
- 'compat' => array(
487
- 'section_action_before' => 'wpmtst_view_editor_before_group_compat',
488
- 'section_action_after' => '',
489
- 'fields_action_before' => '',
490
- 'fields_action_after' => '',
491
- 'classes' => array( 'then' ),
492
- 'title' => esc_html__( 'Compatibility', 'strong-testimonials' ),
493
- 'table_classes' => 'form-table multiple group-general',
494
- 'fields' => array(
495
- 'field_divi_builder' => array(
496
- 'label' => esc_html__( 'Divi Builder', 'strong-testimonials' ),
497
- 'type' => 'divi',
498
- 'before' => '',
499
- 'after' => '',
500
- 'class' => 'view-divi_builder',
501
- 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
502
- 'id' => '',
503
- 'field_action_before' => '',
504
- 'field_action_after' => ''
505
- ),
506
- )
507
- ),
508
- ) );
509
- }
510
-
511
- /**
512
- * Render Strong Testimonials form
513
- *
514
- * @since 2.51.5
515
- */
516
- public function render_form() {
517
-
518
- $actions = array( 'edit', 'duplicate', 'add' );
519
-
520
- if ( ! in_array( $this->action, $actions ) ) {
521
- wp_die( esc_html__( 'Invalid request. Please try again.', 'strong-testimonials' ) );
522
- }
523
-
524
- if ( ( 'edit' == $this->action || 'duplicate' == $this->action ) && ! $this->view_id ) {
525
- return;
526
- }
527
-
528
- $this->set_view();
529
- add_thickbox();
530
-
531
- // @todo: these don't seem to be used anywhere
532
- $fields = wpmtst_get_custom_fields();
533
- $all_fields = wpmtst_get_all_fields();
534
-
535
- /**
536
- * Show category filter if necessary.
537
- *
538
- * @since 2.2.0
539
- */
540
- if ( $this->cat_count > 5 ) {
541
- wp_enqueue_script( 'wpmtst-view-category-filter-script' );
542
- }
543
-
544
- // Select default template if necessary
545
- if ( ! $this->view['template'] ) {
546
- if ( 'form' == $this->view['mode'] ) {
547
- $this->view['template'] = 'default-form';
548
- } else {
549
- $this->view['template'] = 'default';
550
- }
551
- }
552
-
553
- // Get urls
554
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' );
555
- $url1 = $url . '&action=add';
556
- $url2 = $url . '&action=duplicate&id=' . $this->view_id;
557
-
558
- ?>
559
- <h1>
560
- <?php 'edit' == $this->action ? esc_html_e( 'Edit View', 'strong-testimonials' ) : esc_html_e( 'Add View', 'strong-testimonials' ); ?>
561
- <a href="<?php echo esc_url( $url1 ); ?>"
562
- class="add-new-h2"><?php esc_html_e( 'Add New', 'strong-testimonials' ); ?></a>
563
- <a href="<?php echo esc_url( $url ); ?>"
564
- class="add-new-h2"><?php esc_html_e( 'Return To List', 'strong-testimonials' ); ?></a>
565
- <?php if ( 'edit' == $this->action ) : ?>
566
- <a href="<?php echo esc_url( $url2 ); ?>"
567
- class="add-new-h2"><?php esc_html_e( 'Duplicate This View', 'strong-testimonials' ); ?></a>
568
- <?php endif; ?>
569
- </h1>
570
-
571
- <form id="wpmtst-views-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"
572
- autocomplete="off" enctype="multipart/form-data">
573
- <?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
574
-
575
- <input type="hidden" name="action" value="view_<?php echo esc_attr( $this->action ); ?>_form">
576
- <input type="hidden" name="view[id]" value="<?php echo esc_attr( $this->view_id ); ?>">
577
- <input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $this->view['mode'] ); ?>">
578
- <input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $this->view['form_id'] ); ?>">
579
-
580
- <div class="table view-info">
581
- <?php $this->render_info(); ?>
582
- </div>
583
-
584
- <?php $this->render_sections(); ?>
585
-
586
- <p class="wpmtst-submit">
587
- <?php submit_button( '', 'primary', 'submit-form', false ); ?>
588
- <?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?>
589
- <?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?>
590
- </p>
591
- </form>
592
- <?php
593
- }
594
-
595
- /**
596
- * Render Strong Testimonials view info
597
- *
598
- * @since 2.51.5
599
- */
600
- private function render_info() {
601
-
602
- if ( 'edit' == $this->action ) {
603
- $shortcode = '<div class="saved">';
604
- $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $this->view_id ) . '&quot;]" readonly />';
605
- $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
606
- $shortcode .= '<span id="copy-message">' . esc_html__( 'copied', 'strong-testimonials' ) . '</span>';
607
- $shortcode .= '</div>';
608
- } else {
609
- $shortcode = '<div class="unsaved">' . esc_html_x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
610
- }
611
-
612
- $classes = array(
613
- 'then',
614
- 'then_display',
615
- 'then_form',
616
- 'then_slideshow',
617
- 'then_not_single_template',
618
- apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
619
- ); ?>
620
-
621
- <div class="table-row form-view-name">
622
- <div class="table-cell">
623
- <label for="view-name">
624
- <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
625
- </label>
626
- </div>
627
- <div class="table-cell">
628
- <input type="text" id="view-name" class="view-name" name="view[name]"
629
- value="<?php echo esc_attr( htmlspecialchars( stripslashes( $this->view_name ) ) ); ?>"
630
- tabindex="1">
631
- </div>
632
- </div>
633
-
634
- <div class="table-row form-view-shortcode <?php echo esc_attr( implode( ' ', array_filter( $classes ) ) ); ?>">
635
- <div class="table-cell">
636
- <label for="view-shortcode"><?php esc_html_e( 'Shortcode', 'strong-testimonials' ); ?></label>
637
- </div>
638
- <div class="table-cell">
639
- <?php echo $shortcode; ?>
640
- </div>
641
- </div>
642
-
643
- <div id="view-mode" class="table-row mode-select">
644
- <div class="table-cell">
645
- <?php esc_html_e( 'Mode', 'strong-testimonials' ); ?>
646
- </div>
647
- <div class="table-cell">
648
- <div class="mode-list">
649
- <?php foreach ( $this->view_options['mode'] as $mode ) : ?>
650
- <label>
651
- <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
652
- value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $this->view['mode'], $mode['name'] ); ?>>
653
- <?php echo esc_html( $mode['label'] ); ?>
654
- <div class="mode-line"></div>
655
- </label>
656
- <?php endforeach; ?>
657
- </div>
658
- <div class="mode-description"></div>
659
- </div>
660
- </div><?php
661
- }
662
-
663
- /**
664
- * Render Strong Testimonials view sections
665
- *
666
- * @since 2.51.5
667
- */
668
- private function render_sections() {
669
-
670
- // @todo: check what `$show_section = apply_filters('wpmtst_show_section', $this->view['mode']);` does
671
- // @todo: seems like the same filter is used above for $this->show_sections
672
- $show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
673
- foreach ( $this->sections as $name => $section ) {
674
- if ( ! empty( $section['section_action_before'] ) ) {
675
- do_action( $section['section_action_before'] );
676
- }
677
-
678
- $this->render_section( $name, $section );
679
-
680
- if ( ! empty( $section['section_action_after'] ) ) {
681
- do_action( $section['section_action_after'] );
682
- }
683
- }
684
-
685
- do_action( 'wpmtst_view_editor_before_group_general' );
686
- do_action( 'wpmtst_view_editor_after_groups' );
687
- }
688
-
689
- /**
690
- * Render Strong Testimonial section
691
- *
692
- * @param $name
693
- * @param $section
694
- *
695
- * @since 2.51.5
696
- */
697
- public function render_section( $name, $section ) {
698
-
699
- $section['classes'][] = apply_filters( 'wpmtst_view_section', '', $name ); ?>
700
- <div class="<?php echo esc_attr( implode( ' ', array_filter( $section['classes'] ) ) ); ?>"
701
- style="display:none">
702
- <h3><?php echo esc_html( $section['title'] ) ?></h3>
703
- <table class="<?php echo esc_attr( $section['table_classes'] ) ?>">
704
-
705
- <?php if ( ! empty( $section['subheading'] ) ): ?>
706
- <tr class="subheading">
707
- <?php foreach ( $section['subheading'] as $subheading ): ?>
708
- <td class="<?php echo esc_attr( $subheading['classes'] ) ?>"
709
- colspan="<?php echo esc_attr( $subheading['colspan'] ) ?>">
710
- <?php echo esc_html( $subheading['title'] ) ?>
711
- <?php echo wp_kses_post( $subheading['after'] ) ?>
712
- </td>
713
- <?php endforeach; ?>
714
- </tr>
715
- <?php endif;
716
-
717
- if ( ! empty( $section['fields'] ) ) {
718
- if ( ! empty( $section['fields_action_before'] ) ) {
719
- do_action( $section['fields_action_before']['action'], $section['fields_action_before']['param'] );
720
- }
721
- foreach ( $section['fields'] as $key => $field ) {
722
- $this->set_field( $field );
723
- if ( ! empty( $this->field['field_action_before'] ) ) {
724
- do_action( $field['field_action_before'] );
725
- } ?>
726
- <tr id="<?php echo esc_attr( $this->field['id'] ) ?>"
727
- class="<?php echo esc_attr( $this->field['container_classes'] ) ?>" style="display:none">
728
- <?php $this->render_field() ?>
729
- </tr>
730
- <?php
731
- if ( ! empty( $this->field['field_action_after'] ) ) {
732
- do_action( $field['field_action_after'] );
733
- }
734
- }
735
- if ( ! empty( $section['fields_action_after'] ) ) {
736
- do_action( $section['fields_action_after']['action'], $section['fields_action_after']['param'] );
737
- }
738
- }
739
- ?>
740
- </table>
741
- </div>
742
- <?php
743
- }
744
-
745
- /**
746
- * Set Strong Testimonial field
747
- *
748
- * @param $field
749
- *
750
- * @since 2.51.5
751
- */
752
- public function set_field( $field ) {
753
-
754
- $this->field = $field;
755
- }
756
-
757
- /**
758
- * Set Strong Testimonial settings field
759
- *
760
- * @param $field
761
- *
762
- * @since 2.51.5
763
- */
764
- public function set_settings_field( $field ) {
765
-
766
- $this->field = $field;
767
- $this->isSetting = true;
768
- }
769
-
770
- /**
771
- * Render Strong Testimonial field
772
- *
773
- * @since 2.51.5
774
- */
775
- public function render_field() { ?>
776
-
777
- <th>
778
- <?php echo wp_kses_post( $this->field['before'] ); ?>
779
- <label for="<?php echo esc_attr( $this->field['class'] ) ?>"><?php echo wp_kses_post( $this->field['label'] ); ?></label>
780
- <?php echo wp_kses_post( $this->field['after'] ); ?>
781
- </th> <?php
782
- switch ( $this->field['type'] ) {
783
- case 'select':
784
- $this->render_field_select();
785
- break;
786
- case 'category':
787
- $this->render_field_category();
788
- break;
789
- case 'order':
790
- $this->render_field_order();
791
- break;
792
- case 'limit':
793
- $this->render_field_limit();
794
- break;
795
- case 'title':
796
- $this->render_field_title();
797
- break;
798
- case 'thumbnail':
799
- $this->render_field_thumbnail();
800
- break;
801
- case 'content':
802
- $this->render_field_content();
803
- break;
804
- case 'client-section':
805
- $this->render_field_client_section();
806
- break;
807
- case 'pagination':
808
- $this->render_field_pagination();
809
- break;
810
- case 'read-more-page':
811
- $this->render_field_read_more_page();
812
- break;
813
- case 'slideshow-num':
814
- $this->render_field_slideshow_num();
815
- break;
816
- case 'slideshow-transition':
817
- $this->render_field_slideshow_transition();
818
- break;
819
- case 'slideshow-behavior':
820
- $this->render_field_slideshow_behavior();
821
- break;
822
- case 'slideshow-navigation':
823
- $this->render_field_slideshow_navigation();
824
- break;
825
- case 'form-category':
826
- $this->render_field_form_category();
827
- break;
828
- case 'form-ajax':
829
- $this->render_field_form_ajax();
830
- break;
831
- case 'template-list-display':
832
- $this->current_mode = 'template';
833
- $this->current_type = 'display';
834
- $this->render_field_template_list();
835
- break;
836
- case 'template-list-form':
837
- $this->current_mode = 'form-template';
838
- $this->current_type = 'form';
839
- $this->render_field_template_list();
840
- break;
841
- case 'layout':
842
- $this->render_field_layout();
843
- break;
844
- case 'background':
845
- $this->render_field_background();
846
- break;
847
- case 'color':
848
- $this->render_field_color();
849
- break;
850
- case 'classes':
851
- $this->render_field_classes();
852
- break;
853
- case 'divi':
854
- $this->render_field_divi();
855
- break;
856
- default:
857
- do_action( 'wpmtst_render_field', $this->field );
858
- }
859
- }
860
-
861
- /**
862
- * Render ST select
863
- *
864
- * @param $input_name
865
- * @param false $recommended
866
- * @param string $title
867
- *
868
- * @since 2.51.5
869
- */
870
- public function render_option_select( $input_name, $recommended = false, $title = '' ) {
871
-
872
- $selected = $this->field['selected'];
873
-
874
- if ( $this->isSetting ) {
875
- $selected = $this->field['selected_settings'];
876
- }
877
-
878
- if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ): ?>
879
- <td>
880
-
881
- <?php if ( ! empty( $title ) ): ?>
882
- <h4 class="title"><?php esc_html_e( $title ); ?>
883
- <h4>
884
- <?php endif; ?>
885
- <select id="<?php echo esc_attr( $this->field['class'] ) ?>"
886
- name="<?php echo esc_attr( $input_name ); ?>">
887
- <?php foreach ( $this->field['options'] as $option ): ?>
888
- <option value="<?php echo esc_attr( $option ); ?>" <?php selected( $option, $selected ); ?>><?php esc_html_e( $option, 'strong-testimonials-review-markup' ); ?></option>
889
- <?php endforeach; ?>
890
- </select>
891
- <?php if ( $recommended ): ?>
892
- <p class="description"><strong
893
- style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials-review-markup' ) ?></strong>
894
- <?php if ( is_string( $recommended ) ) {
895
- echo esc_html( $recommended );
896
- } ?>
897
- </p>
898
- <?php endif; ?>
899
-
900
- </td>
901
- <?php endif;
902
- }
903
-
904
- /**
905
- * Render ST textfield
906
- *
907
- * @param $input_name
908
- * @param false $recommended
909
- * @param string $description
910
- * @param string $title
911
- * @param string $placeholder
912
- *
913
- * @SINCE 2.51.5
914
- */
915
- public function render_option_textfield( $input_name, $recommended = false, $description = '', $title = '', $placeholder = '' ) {
916
-
917
- $value = $this->field['value'];
918
-
919
- if ( $this->isSetting ) {
920
- $value = $this->field['value_settings'];
921
- } ?>
922
-
923
- <td>
924
- <?php if ( ! empty( $title ) ): ?>
925
- <h4 class="title"><?php esc_html_e( $title ); ?>
926
- <h4>
927
- <?php endif; ?>
928
-
929
- <div>
930
- <div class="has-input">
931
- <input class="regular-text" type="text" id="<?php echo esc_attr( $this->field['class'] ) ?>"
932
- name="<?php echo esc_attr( $input_name ) ?>" value="<?php echo esc_attr( $value ) ?>"
933
- data-default="<?php echo esc_attr( $this->field['default'] ) ?>"
934
- placeholder="<?php echo esc_attr( $placeholder, 'strong-testimonials-review-markup' ) ?>">
935
- </div>
936
- <div class="error-message"></div>
937
- </div>
938
- <p class="description">
939
-
940
- <?php if ( $recommended ): ?>
941
- <strong style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials-review-markup' ) ?></strong>
942
- <?php endif; ?>
943
-
944
- <?php if ( ! empty( $description ) ): ?>
945
- <?php esc_html_e( $description, 'strong-testimonials-review-markup' ); ?>
946
- <?php endif; ?>
947
-
948
- </p>
949
- </td>
950
- <?php
951
- }
952
-
953
- /**
954
- * Render ST select
955
- *
956
- * @since 2.51.5
957
- */
958
- private function render_field_select() {
959
-
960
- $testimonials_list = get_posts( array(
961
- 'orderby' => 'post_date',
962
- 'order' => 'ASC',
963
- 'post_type' => 'wpm-testimonial',
964
- 'post_status' => 'publish',
965
- 'posts_per_page' => - 1,
966
- 'suppress_filters' => true,
967
- ) ); ?>
968
- <td>
969
- <div class="row">
970
- <div class="row-inner">
971
- <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
972
- <option value="multiple" <?php echo (int) $this->view['id'] == 0 ? 'selected' : ''; ?>><?php esc_html_e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
973
- <option value="single" <?php echo (int) $this->view['id'] >= 1 ? 'selected' : ''; ?>><?php esc_html_e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
974
- </select>
975
- </div>
976
- </div>
977
-
978
- <div class="row">
979
- <div class="then then_not_slideshow then_single then_not_multiple" style="display: none;">
980
- <div class="row-inner">
981
- <label>
982
- <select id="view-id" name="view[data][id]">
983
- <option value="0"><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
984
- <?php foreach ( $testimonials_list as $post ) : ?>
985
- <option value="<?php echo esc_attr( $post->ID ); ?>" <?php selected( $this->view['id'], $post->ID ); ?>>
986
- <?php echo $post->post_title ? esc_html( $post->post_title ) : __( '(untitled)', 'strong-testimonials' ); ?>
987
- </option>
988
- <?php endforeach; ?>
989
- </select>
990
- </label>
991
- </div>
992
- <div class="row-inner">
993
- <label for="view-post_id">
994
- <?php _ex( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
995
- </label>
996
- <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
997
- </div>
998
- </div>
999
- </div>
1000
- </td>
1001
-
1002
- <td class="divider">
1003
- <p><?php echo wp_kses_post( '<code>post_ids</code>' ); ?></p>
1004
- </td>
1005
-
1006
- <td>
1007
- <p><?php esc_html_e( 'a comma-separated list of post ID\'s', 'strong-testimonials' ); ?></p>
1008
- </td>
1009
-
1010
- <td>
1011
- <p><?php echo wp_kses_post( '<code>post_ids="123,456"</code>' ); ?></p>
1012
- </td>
1013
- <?php
1014
- }
1015
-
1016
- /**
1017
- * Render ST category field
1018
- *
1019
- * @since 2.51.5
1020
- */
1021
- private function render_field_category() {
1022
-
1023
- if ( $this->cat_count ) : ?>
1024
- <td>
1025
- <div id="view-category" class="row">
1026
- <div class="table inline">
1027
- <div class="table-row">
1028
- <div class="table-cell select-cell then_display then_slideshow then_not_form">
1029
- <select id="view-category-select" class="if selectper" name="view[data][category_all]">
1030
- <option value="allcats" <?php selected( $this->view['category'], 'all' ); ?>><?php esc_html_e( 'all', 'strong-testimonials' ); ?></option>
1031
- <option value="somecats" <?php echo( 'all' != $this->view['category'] ? 'selected' : '' ); ?>><?php _ex( 'select', 'verb', 'strong-testimonials' ); ?></option>
1032
- </select>
1033
- </div>
1034
- <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
1035
- <div class="table">
1036
- <?php if ( $this->cat_count > 5 ) : ?>
1037
- <div class="table-row">
1038
- <div class="table-cell">
1039
- <div class="row" style="text-align: right; padding-bottom: 5px;">
1040
- <input type="button" class="expand-cats button"
1041
- value="expand list"/>
1042
- </div>
1043
- </div>
1044
- </div>
1045
- <?php endif; ?>
1046
- <div class="table-row">
1047
- <div class="table-cell"><?php wpmtst_category_checklist( $this->view_cats_array ); ?></div>
1048
- </div>
1049
- </div>
1050
- </div>
1051
- </div>
1052
- </div>
1053
- </div>
1054
- </td>
1055
- <?php else : ?>
1056
- <td>
1057
- <div id="view-category" class="row">
1058
- <input type="hidden" name="view[data][category_all]" value="all">
1059
- <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
1060
- </div>
1061
- </td>
1062
- <?php endif; ?>
1063
-
1064
- <td class="divider">
1065
- <p><?php echo wp_kses_post( '<code>category</code>' ); ?></p>
1066
- </td>
1067
- <td>
1068
- <p><?php esc_html_e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
1069
- </td>
1070
- <td>
1071
- <p><?php echo wp_kses_post( '<code>category="accounting"</code>' ); ?></p>
1072
- </td><?php
1073
- }
1074
-
1075
- /**
1076
- * Render ST order field
1077
- *
1078
- * @since 2.51.5
1079
- */
1080
- private function render_field_order() {
1081
-
1082
- ?>
1083
- <td>
1084
- <div class="row">
1085
- <div class="inline">
1086
- <select id="view-order" name="view[data][order]">
1087
- <?php foreach ( $this->view_options['order'] as $order => $order_label ) : ?>
1088
- <option value="<?php echo esc_attr( $order ); ?>" <?php selected( $order, $this->view['order'] ); ?>><?php echo esc_html( $order_label ); ?></option>
1089
- <?php endforeach; ?>
1090
- </select>
1091
- </div>
1092
- </div>
1093
- </td>
1094
- <td class="divider">
1095
- <p><?php echo wp_kses_post( '<code>order</code>' ); ?></p>
1096
- </td>
1097
- <td>
1098
- <p><?php echo wp_kses_post( 'oldest | newest | random | menu_order' ); ?></p>
1099
- </td>
1100
- <td>
1101
- <p><?php echo wp_kses_post( '<code>order="random"</code>' ); ?></p>
1102
- </td> <?php
1103
- }
1104
-
1105
- /**
1106
- * Render ST limit fied
1107
- *
1108
- * @since 2.51.5
1109
- */
1110
- private function render_field_limit() {
1111
-
1112
- ?>
1113
- <td>
1114
- <div class="row">
1115
- <div class="inline">
1116
- <select class="if select" id="view-all" name="view[data][all]">
1117
- <option value="1" <?php selected( - 1, $this->view['count'] ); ?>>
1118
- <?php esc_html_e( 'all', 'strong-testimonials' ); ?>
1119
- </option>
1120
- <option class="trip" value="0" <?php selected( $this->view['count'] > 0 ); ?>>
1121
- <?php _ex( 'count', 'noun', 'strong-testimonials' ); ?>
1122
- </option>
1123
- </select>
1124
- &nbsp;
1125
- <label><input class="input-incremental then_all" type="number" id="view-count"
1126
- name="view[data][count]"
1127
- value="<?php echo ( - 1 == $this->view['count'] ) ? 1 : esc_attr( $this->view['count'] ); ?>"
1128
- min="1" size="5" style="display: none;"></label>
1129
- </div>
1130
- </div>
1131
- </td>
1132
- <td class="divider">
1133
- <p><?php echo wp_kses_post( '<code>count</code>' ); ?></p>
1134
- </td>
1135
- <td></td>
1136
- <td>
1137
- <p><?php echo wp_kses_post( '<code>count=5</code>' ); ?></p>
1138
- </td>
1139
- <?php
1140
- }
1141
-
1142
- /**
1143
- * Render ST title field
1144
- *
1145
- * @since 2.51.5
1146
- */
1147
- private function render_field_title() {
1148
-
1149
- $custom_fields = wpmtst_get_custom_fields();
1150
- $options = get_option( 'wpmtst_options' );
1151
- $url_fields = array();
1152
-
1153
- foreach ( $custom_fields as $field ) {
1154
- if ( 'url' == $field['input_type'] ) {
1155
- $url_fields[] = $field;
1156
- }
1157
- }
1158
-
1159
- // For older versions where title_link was checkbox
1160
- if ( '1' == $this->view['title_link'] ) {
1161
- $this->view['title_link'] = 'wpmtst_testimonial';
1162
- }
1163
-
1164
- if ( '0' == $this->view['title_link'] ) {
1165
- $this->view['title_link'] = 'none';
1166
- } ?>
1167
-
1168
- <td colspan="2">
1169
- <div class="row">
1170
- <div class="row-inner">
1171
- <div class="then then_title" style="display: none;">
1172
- <label for="view-title_link">
1173
- <?php printf( esc_html_x( 'Link to %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
1174
- </label>
1175
- <div class="wpmtst-tooltip"><span>[?]</span>
1176
- <div class="wpmtst-tooltip-content"><?php echo esc_html__( '"Full testimonial" option doesn\'s work if "Disable permalinks for testimonials" from "Settings" page is enabled.', 'strong-testimonials' ); ?></div>
1177
- </div>
1178
-
1179
- <select name="view[data][title_link]">
1180
- <option value="none" <?php selected( 'none', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'None', 'strong-testimonials' ); ?></option>
1181
- <?php if ( ! isset( $options['disable_rewrite'] ) || '1' != $options['disable_rewrite'] ) { ?>
1182
- <option value="wpmtst_testimonial" <?php selected( 'wpmtst_testimonial', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'Full testimonial', 'strong-testimonials' ); ?></option>
1183
- <?php } ?>
1184
-
1185
- <?php foreach ( $url_fields as $url ) { ?>
1186
- <option value="<?php echo esc_attr( $url['name'] ); ?>" <?php selected( $url['name'], $this->view['title_link'] ); ?>><?php echo esc_html( $url['label'] ); ?></option>
1187
- <?php } ?>
1188
-
1189
- </select>
1190
- <?php do_action( 'wpmtst_view_editor_after_group_fields_title' ) ?>
1191
- </div>
1192
- </div>
1193
- </div>
1194
- </td>
1195
- <?php
1196
- }
1197
-
1198
- /**
1199
- * Render ST thumbnail field
1200
- *
1201
- * @since 2.51.5
1202
- */
1203
- private function render_field_thumbnail() {
1204
-
1205
- $image_sizes = wpmtst_get_image_sizes();
1206
- ?>
1207
- <td colspan="2">
1208
- <div class="then then_images" style="display: none;">
1209
- <div class="row">
1210
- <div class="row-inner">
1211
- <div class="inline">
1212
- <label for="view-thumbnail_size">Size</label>
1213
- <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
1214
- <?php foreach ( $image_sizes as $key => $size ) : ?>
1215
- <option class="<?php echo( 'custom' == $key ? 'trip' : '' ) ?>"
1216
- value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $this->view['thumbnail_size'] ); ?>><?php echo esc_html( $size['label'] ); ?></option>
1217
- <?php endforeach; ?>
1218
- </select>
1219
- </div>
1220
- <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
1221
- <label for="thumbnail_width"><?php esc_html_e( 'width', 'strong-testimonials' ); ?></label>
1222
- <input id="thumbnail_width" class="input-number-px" type="text"
1223
- name="view[data][thumbnail_width]"
1224
- value="<?php echo esc_attr( $this->view['thumbnail_width'] ); ?>"> px
1225
- <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
1226
- <label for="thumbnail_height"><?php esc_html_e( 'height', 'strong-testimonials' ); ?></label>
1227
- <input id="thumbnail_height" class="input-number-px" type="text"
1228
- name="view[data][thumbnail_height]"
1229
- value="<?php echo esc_attr( $this->view['thumbnail_height'] ); ?>"> px
1230
- </div>
1231
- </div>
1232
- </div>
1233
- <div class="row">
1234
- <div class="row-inner">
1235
- <div class="inline">
1236
- <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
1237
- value="1" <?php checked( $this->view['lightbox'] ); ?> class="checkbox">
1238
- <label for="view-lightbox"><?php esc_html_e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?></label>
1239
- </div>
1240
- <div class="inline then then_lightbox">
1241
- <p class="description"><?php esc_html_e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
1242
- </div>
1243
- </div>
1244
- </div>
1245
-
1246
- <div class="row">
1247
- <div class="row-inner">
1248
- <div class="inline then then_lightbox input" style="display: none;">
1249
- <label for="view-lightbox_class"><?php esc_html_e( 'CSS class', 'strong-testimonials' ); ?></label>
1250
- <input type="text" id="view-lightbox_class" class="medium inline"
1251
- name="view[data][lightbox_class]"
1252
- value="<?php echo esc_attr( $this->view['lightbox_class'] ); ?>">
1253
- <p class="inline description tall"><?php esc_html_e( 'To add a class to the image link.', 'strong-testimonials' ); ?></p>
1254
- </div>
1255
- </div>
1256
- </div>
1257
- <div class="row">
1258
- <div class="row-inner">
1259
- <div class="inline">
1260
- <label for="view-gravatar"><?php esc_html_e( 'If no Featured Image', 'strong-testimonials' ); ?></label>
1261
- <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
1262
- <option value="no" <?php selected( $this->view['gravatar'], 'no' ); ?>><?php esc_html_e( 'show nothing', 'strong-testimonials' ); ?></option>
1263
- <option value="yes" <?php selected( $this->view['gravatar'], 'yes' ); ?>><?php esc_html_e( 'show Gravatar', 'strong-testimonials' ); ?></option>
1264
- <option value="if" <?php selected( $this->view['gravatar'], 'if' ); ?>><?php esc_html_e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
1265
- <?php do_action( 'wpmtst_avatar_options', $this->view ) ?>
1266
- </select>
1267
- </div>
1268
- <div class="inline">
1269
- <div class="then fast then_not_no then_not_default then_not_initials then_not_wp_avatars then_yes then_if"
1270
- style="display: none;">
1271
- <p class="description tall"><a
1272
- href="<?php echo esc_url( admin_url( 'options-discussion.php' ) ); ?>"><?php esc_html_e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
1273
- </p>
1274
- </div>
1275
- </div>
1276
- <?php do_action( 'after_no_featured_image', $this->view ) ?>
1277
- </div>
1278
- </div>
1279
- </div><!-- .then_images -->
1280
- </td>
1281
- <?php
1282
- }
1283
-
1284
- /**
1285
- * Render ST content field
1286
- *
1287
- * @since 2.51.5
1288
- */
1289
- private function render_field_content() {
1290
-
1291
- ?>
1292
- <td colspan="2">
1293
- <!-- Content type -->
1294
- <div id="option-content" class="row">
1295
- <div class="row-inner">
1296
- <!-- select -->
1297
- <div class="inline">
1298
- <select id="view-content" class="if selectper min-width-1 label-not-adjacent"
1299
- name="view[data][content]">
1300
- <option value="entire" <?php selected( 'entire', $this->view['content'] ); ?>><?php _ex( 'entire content', 'display setting', 'strong-testimonials' ); ?></option>
1301
- <option value="truncated" <?php selected( 'truncated', $this->view['content'] ); ?>><?php _ex( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?></option>
1302
- <option value="excerpt" <?php selected( 'excerpt', $this->view['content'] ); ?>><?php _ex( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?></option>
1303
- </select>
1304
- </div>
1305
- <!-- info & screenshot -->
1306
- <div class="inline then fast then_truncated then_not_entire then_not_excerpt"
1307
- style="display: none;">
1308
- <p class="description"><?php esc_html_e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?></p>
1309
- </div>
1310
- <div class="inline then fast then_not_truncated then_not_entire then_excerpt"
1311
- style="display: none;">
1312
- <p class="description">
1313
- <?php printf( __( 'To create manual excerpts, you may need to enable them in the post editor like in this <a href="%s" class="thickbox">screenshot</a>.', 'strong-testimonials' ), esc_url( '#TB_inline?width=&height=210&inlineId=screenshot-screen-options' ) ); ?>
1314
- <span class="screenshot" id="screenshot-screen-options" style="display: none;"><img
1315
- src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>img/screen-options.png"
1316
- width="600"></span>
1317
- </p>
1318
- </div>
1319
- </div>
1320
- </div>
1321
- <!-- Excerpt length -->
1322
- <div id="option-content-length" class="row then then_not_entire then_excerpt then_truncated"
1323
- style="display: none;">
1324
- <div class="row-inner">
1325
- <!-- info -->
1326
- <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
1327
- <span><?php esc_html_e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?></span>
1328
- </div>
1329
- <!-- default or custom? -->
1330
- <div class="inline">
1331
- <label>
1332
- <select id="view-use_default_length" class="if selectgroup min-width-1"
1333
- name="view[data][use_default_length]">
1334
- <option value="1" <?php selected( $this->view['use_default_length'] ); ?>><?php _ex( 'default length', 'display setting', 'strong-testimonials' ); ?></option>
1335
- <option value="0" <?php selected( ! $this->view['use_default_length'] ); ?>><?php _ex( 'custom length', 'display setting', 'strong-testimonials' ); ?></option>
1336
- </select>
1337
- </label>
1338
- </div>
1339
- <!-- 1st option: default -->
1340
- <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
1341
- <label for="view-use_default_length" class="inline-middle"><p
1342
- class="description tall"><?php esc_html_e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
1343
- </label>
1344
- </div>
1345
- <!-- 2nd option: length -->
1346
- <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
1347
- <label class="inline-middle"><?php printf( esc_html_x( 'the first %s words', 'the excerpt length', 'strong-testimonials' ), '<input id="view-excerpt_length" class="input-incremental" type="number" min="1" max="999" name="view[data][excerpt_length]" value="' . esc_attr( $this->view['excerpt_length'] ) . '">' ); ?></label>
1348
- </div>
1349
- </div>
1350
- </div><!-- #option-content-length -->
1351
-
1352
- <!-- Read-more link -->
1353
- <div id="option-content-read-more" class="row then then_not_entire then_excerpt then_truncated"
1354
- style="display: none;">
1355
- <div class="row-inner subgroup">
1356
- <!-- action: full post or in place -->
1357
- <div class="row-inner">
1358
- <div class="inline"><?php _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ); ?></div>
1359
- <div class="inline tight">
1360
- <label>
1361
- <select id="view-more_post_in_place" class="if selectgroup"
1362
- name="view[data][more_post_in_place]">
1363
- <option value="0" <?php selected( ! $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'the full testimonial', 'strong-testimonials' ); ?></option>
1364
- <option value="1" <?php selected( $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'expand content in place', 'strong-testimonials' ); ?></option>
1365
- </select>
1366
- </label>
1367
- </div>
1368
- </div>
1369
- <!-- ellipsis -->
1370
- <div class="row-inner">
1371
- <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
1372
- <div class="inline">
1373
- <label>
1374
- <select id="view-more_post_ellipsis" class="if selectgroup"
1375
- name="view[data][more_post_ellipsis]">
1376
- <option value="1" <?php selected( $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'with an ellipsis', 'strong-testimonials' ); ?></option>
1377
- <option value="0" <?php selected( ! $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'without an ellipsis', 'strong-testimonials' ); ?></option>
1378
- </select>
1379
- </label>
1380
- </div>
1381
- <div class="inline then then_excerpt then_not_truncated" style="display: none;">
1382
- <p class="description"><?php esc_html_e( 'Automatic excerpt only.', 'strong-testimonials' ); ?></p>
1383
- </div>
1384
- </div>
1385
- </div>
1386
- <!-- default or custom -->
1387
- <div class="row-inner">
1388
- <div class="inline tight then fast then_more_post_in_place then_1 then_not_0"
1389
- style="display: none;">
1390
- <?php esc_html_e( 'with link text to read more', 'strong-testimonials' ); ?>
1391
- </div>
1392
- <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
1393
- <label>
1394
- <select id="view-use_default_more" class="if selectgroup min-width-1"
1395
- name="view[data][use_default_more]">
1396
- <option value="1" <?php selected( $this->view['use_default_more'] ); ?>><?php _ex( 'with default link text', 'display setting', 'strong-testimonials' ); ?></option>
1397
- <option value="0" <?php selected( ! $this->view['use_default_more'] ); ?>><?php _ex( 'with custom link text', 'display setting', 'strong-testimonials' ); ?></option>
1398
- </select>
1399
- </label>
1400
- </div>
1401
- <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
1402
- <p class="description"><?php esc_html_e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
1403
- </div>
1404
- <!-- read more -->
1405
- <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
1406
- <span id="option-link-text" class="inline-span">
1407
- <label for="view-more_post_text">
1408
- <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
1409
- value="<?php echo esc_attr( $this->view['more_post_text'] ); ?>" size="22"
1410
- placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1411
- </label>
1412
- </span>
1413
- </div>
1414
- </div>
1415
- <!-- read less -->
1416
- <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
1417
- <div class="inline tight">
1418
- <?php esc_html_e( 'and link text to read less', 'strong-testimonials' ); ?>
1419
- </div>
1420
- <div class="inline tight">
1421
- <span id="option-link-text-less" class="inline-span">
1422
- <label for="view-less_post_text">
1423
- <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
1424
- value="<?php echo esc_attr( $this->view['less_post_text'] ); ?>" size="22"
1425
- placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1426
- </label>
1427
- </span>
1428
- <p class="inline description"><?php esc_html_e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
1429
- </div>
1430
- <div class="html-content-checkbox">
1431
- <input class="checkbox" id="view-html-content" name="view[data][html_content]" value="1"
1432
- type="checkbox" <?php checked( $this->view['html_content'] ); ?>/>
1433
- <label for="view-html-content"><?php _e( 'Show <strong>html content</strong>.', 'strong-testimonials' ); ?></label>
1434
- </div>
1435
- </div>
1436
- <!-- automatic or both -->
1437
- <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
1438
- <div class="inline">
1439
- <label>
1440
- <select id="view-more_full_post" class="if selectgroup"
1441
- name="view[data][more_full_post]">
1442
- <option value="0" <?php selected( $this->view['more_full_post'], 0 ); ?>><?php _ex( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?></option>
1443
- <option value="1" <?php selected( $this->view['more_full_post'], 1 ); ?>><?php _ex( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?></option>
1444
- </select>
1445
- </label>
1446
- </div>
1447
- </div>
1448
- </div>
1449
- </div>
1450
- <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
1451
- <p class="description tall solo"><?php printf( esc_html__( '%s about WordPress excerpts', 'strong-testimonials' ), sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ), esc_html__( 'Learn more', 'strong-testimonials' ) ) ); ?></p>
1452
- </div>
1453
- </td>
1454
- <?php
1455
- }
1456
-
1457
- /**
1458
- * Render ST client field
1459
- *
1460
- * @since 2.51.5
1461
- */
1462
- private function render_field_client_section() {
1463
-
1464
- ?>
1465
- <td colspan="2">
1466
- <div id="client-section-table">
1467
- <div id="custom-field-list2" class="fields">
1468
- <?php
1469
- if ( isset( $this->view['client_section'] ) ) {
1470
- foreach ( $this->view['client_section'] as $key => $field ) {
1471
- wpmtst_view_field_inputs( $key, $field );
1472
- }
1473
- }
1474
- ?>
1475
- </div>
1476
- </div>
1477
- <div id="add-field-bar" class="is-below">
1478
- <input id="add-field" type="button" name="add-field" source="view[data]"
1479
- value="<?php esc_html_e( 'Add Field', 'strong-testimonials' ); ?>" class="button-secondary"/>
1480
- </div>
1481
- </td>
1482
- <?php
1483
- }
1484
-
1485
- /**
1486
- * Render ST pagination
1487
- *
1488
- * @since 2.51.5
1489
- */
1490
- private function render_field_pagination() {
1491
- /**
1492
- * Attempt to repair bug from 2.28.2
1493
- */
1494
- if ( ! isset( $this->view['pagination_settings']['end_size'] ) || ! $this->view['pagination_settings']['end_size'] ) {
1495
- $this->view['pagination_settings']['end_size'] = 1;
1496
- }
1497
- if ( ! isset( $this->view['pagination_settings']['mid_size'] ) || ! $this->view['pagination_settings']['mid_size'] ) {
1498
- $this->view['pagination_settings']['mid_size'] = 2;
1499
- }
1500
- if ( ! isset( $this->view['pagination_settings']['per_page'] ) || ! $this->view['pagination_settings']['per_page'] ) {
1501
- $this->view['pagination_settings']['per_page'] = 5;
1502
- }
1503
- $links = '<span class="help-links">';
1504
- $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a>';
1505
- $links .= '</span>';
1506
- ?>
1507
- <td>
1508
- <div class="row then then_pagination" style="display: none;">
1509
- <div class="row-inner">
1510
- <div class="inline">
1511
- <label for="view-pagination_type">
1512
- <select class="if selectper" id="view-pagination_type"
1513
- name="view[data][pagination_settings][type]">
1514
- <option value="simple" <?php selected( 'simple', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'simple', 'strong-testimonials' ); ?></option>
1515
- <option value="standard" <?php selected( 'standard', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'WordPress standard', 'strong-testimonials' ); ?></option>
1516
- <?php do_action( 'wpmtst_form_pagination_options_after', $this->view ) ?>
1517
- </select>
1518
- </label>
1519
- </div>
1520
- <div class="inline then fast then_simple then_not_standard then_not_infinitescroll then_not_loadmore"
1521
- style="display: none;">
1522
- <p class="description">
1523
- <?php esc_html_e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
1524
- <?php echo wp_kses_post( $links ); ?>
1525
- </p>
1526
- </div>
1527
- <div class="inline then fast then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1528
- style="display: none;">
1529
- <p class="description">
1530
- <?php esc_html_e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
1531
- <?php echo wp_kses_post( $links ); ?>
1532
- </p>
1533
- </div>
1534
- </div>
1535
- </div>
1536
- <div class="row then then_pagination" style="display: none;">
1537
- <div class="row-inner">
1538
- <div class="inline">
1539
- <label for="view-per_page"><?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?></label>
1540
- <input class="input-incremental" id="view-per_page"
1541
- name="view[data][pagination_settings][per_page]" type="number" min="1" step="1"
1542
- value="<?php echo esc_attr( $this->view['pagination_settings']['per_page'] ); ?>"/>
1543
- </div>
1544
- <div class="inline then then_simple then_standard then_not_infinitescroll then_not_loadmore">
1545
- <label for="view-nav"><?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?></label>
1546
- <select id="view-nav" name="view[data][pagination_settings][nav]">
1547
- <option value="before" <?php selected( $this->view['pagination_settings']['nav'], 'before' ); ?>><?php esc_html_e( 'before', 'strong-testimonials' ); ?></option>
1548
- <option value="after" <?php selected( $this->view['pagination_settings']['nav'], 'after' ); ?>><?php esc_html_e( 'after', 'strong-testimonials' ); ?></option>
1549
- <option value="before,after" <?php selected( $this->view['pagination_settings']['nav'], 'before,after' ); ?>><?php esc_html_e( 'before & after', 'strong-testimonials' ); ?></option>
1550
- </select>
1551
- </div>
1552
- </div>
1553
- <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1554
- style="display: none;">
1555
- <div class="row-inner">
1556
- <div class="inline">
1557
- <label for="view-pagination-show_all">
1558
- <select class="if select" id="view-pagination-show_all"
1559
- name="view[data][pagination_settings][show_all]">
1560
- <option value="on" <?php selected( $this->view['pagination_settings']['show_all'] ); ?>><?php esc_html_e( 'Show all page numbers', 'strong-testimonials' ); ?></option>
1561
- <option value="off"
1562
- <?php selected( ! $this->view['pagination_settings']['show_all'] ); ?>class="trip"><?php esc_html_e( 'Show condensed page numbers', 'strong-testimonials' ); ?></option>
1563
- </select>
1564
- </label>
1565
- </div>
1566
- <div class="inline then then_show_all" style="display: none;">
1567
- <div class="inline">
1568
- <label for="view-pagination-end_size"><?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?></label>
1569
- <input class="input-incremental" id="view-pagination-end_size"
1570
- name="view[data][pagination_settings][end_size]" type="number" min="1" step="1"
1571
- value="<?php echo esc_attr( $this->view['pagination_settings']['end_size'] ); ?>"/>
1572
- </div>
1573
- <div class="inline">
1574
- <label for="view-pagination-mid_size"><?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?></label>
1575
- <input class="input-incremental" id="view-pagination-mid_size"
1576
- name="view[data][pagination_settings][mid_size]" type="number" min="1" step="1"
1577
- value="<?php echo esc_attr( $this->view['pagination_settings']['mid_size'] ); ?>"/>
1578
- </div>
1579
- </div>
1580
- </div>
1581
- </div>
1582
- <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1583
- style="display: none;">
1584
- <div class="row-inner">
1585
- <div class="inline inline-middle">
1586
- <input class="if toggle checkbox" id="view-pagination-prev_next"
1587
- name="view[data][pagination_settings][prev_next]" type="checkbox"
1588
- value="1" <?php checked( $this->view['pagination_settings']['prev_next'] ); ?>>
1589
- <label for="view-pagination-prev_next"><?php esc_html_e( 'Show previous/next links', 'strong-testimonials' ); ?></label>
1590
- </div>
1591
- <div class="then then_prev_next inline inline-middle">
1592
- <label for="view-pagination-prev_text"><?php esc_html_e( 'Previous text', 'strong-testimonials' ); ?></label>
1593
- <input class="code" id="view-pagination-prev_text"
1594
- name="view[data][pagination_settings][prev_text]" type="text"
1595
- value="<?php echo htmlentities( $this->view['pagination_settings']['prev_text'] ); ?>">
1596
- </div>
1597
- <div class="then then_prev_next inline inline-middle">
1598
- <label for="view-pagination-next_text"><?php esc_html_e( 'Next text', 'strong-testimonials' ); ?></label>
1599
- <input class="code" id="view-pagination-next_text"
1600
- name="view[data][pagination_settings][next_text]" type="text"
1601
- value="<?php echo htmlentities( $this->view['pagination_settings']['next_text'] ); ?>">
1602
- </div>
1603
- </div>
1604
- </div>
1605
- <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1606
- style="display: none;">
1607
- <div class="row-inner">
1608
- <div class="inline">
1609
- <label for="view-pagination-before_page_number"><?php esc_html_e( 'Before page number', 'strong-testimonials' ); ?></label>
1610
- <input class="small-text" id="view-pagination-before_page_number"
1611
- name="view[data][pagination_settings][before_page_number]" type="text"
1612
- value="<?php echo esc_attr( $this->view['pagination_settings']['before_page_number'] ); ?>">
1613
- </div>
1614
- <div class="inline">
1615
- <label for="view-pagination-after_page_number"><?php esc_html_e( 'After page number', 'strong-testimonials' ); ?></label>
1616
- <input class="small-text" id="view-pagination-after_page_number"
1617
- name="view[data][pagination_settings][after_page_number]" type="text"
1618
- value="<?php echo esc_attr( $this->view['pagination_settings']['after_page_number'] ); ?>">
1619
- </div>
1620
- </div>
1621
- </div>
1622
- </div>
1623
- <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
1624
- </td>
1625
- <?php
1626
- }
1627
-
1628
- /**
1629
- * Render ST read more
1630
- *
1631
- * @since 2.51.5
1632
- */
1633
- private function render_field_read_more_page() {
1634
-
1635
- $custom_list = apply_filters( 'wpmtst_custom_pages_list', array(), $this->view );
1636
- $pages_list = apply_filters( 'wpmtst_pages_list', wpmtst_get_pages() );
1637
- $posts_list = apply_filters( 'wpmtst_posts_list', wpmtst_get_posts() );
1638
-
1639
- ?>
1640
- <td>
1641
- <div class="row then then_more_page" style="display: none;">
1642
- <!-- Select page -->
1643
- <div class="row then then_more_page" style="display: none;">
1644
- <div class="row-inner">
1645
- <label>
1646
- <select id="view-page" name="view[data][more_page_id]">
1647
- <option value=""><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
1648
- <?php
1649
- do_action( 'wpmtst_readmore_page_list', $this->view );
1650
-
1651
- if ( $custom_list ) {
1652
- ?>
1653
- <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
1654
- <?php
1655
- foreach ( $custom_list as $page ) {
1656
- echo wp_kses_post( $page );
1657
- }
1658
- ?>
1659
- </optgroup>
1660
- <?php } ?>
1661
-
1662
- <optgroup label="<?php esc_attr_e( 'Pages', 'strong-testimonials' ); ?>">
1663
-
1664
- <?php foreach ( $pages_list as $pages ) : ?>
1665
- <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $pages->ID ); ?>><?php echo esc_html( $pages->post_title ); ?></option>
1666
- <?php endforeach; ?>
1667
-
1668
- </optgroup>
1669
-
1670
- <optgroup label="<?php esc_attr_e( 'Posts', 'strong-testimonials' ); ?>">
1671
-
1672
- <?php foreach ( $posts_list as $posts ) : ?>
1673
- <option value="<?php echo esc_attr( $posts->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $posts->ID ); ?>><?php echo esc_html( $posts->post_title ); ?></option>
1674
- <?php endforeach; ?>
1675
-
1676
- </optgroup>
1677
- </select>
1678
- </label>
1679
- <label for="view-page_id2"><?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?></label>
1680
- <input type="text" id="view-page_id2"
1681
- name="view[data][more_page_id2]" <?php echo( isset( $this->view['more_page_id'] ) ? 'value="' . esc_attr( $this->view['more_page_id'] ) . '"' : '' ); ?>
1682
- size="30">
1683
- </div>
1684
- </div>
1685
- <!-- Link text -->
1686
- <div class="row">
1687
- <div class="row-inner">
1688
- <div class="inline">
1689
- <label for="view-more_page_text"><?php esc_html_e( 'with link text', 'strong-testimonials' ); ?></label>
1690
- <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
1691
- value="<?php echo esc_attr( $this->view['more_page_text'] ); ?>" size="50">
1692
- </div>
1693
- </div>
1694
- </div>
1695
- <!-- location -->
1696
- <div class="row">
1697
- <div class="row-inner">
1698
- <label>
1699
- <select id="view-more_page_hook" name="view[data][more_page_hook]">
1700
- <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $this->view['more_page_hook'] ); ?>><?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?></option>
1701
- <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $this->view['more_page_hook'] ); ?>><?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?></option>
1702
- </select>
1703
- </label>
1704
- </div>
1705
- </div>
1706
- </div>
1707
- </td>
1708
- <?php
1709
- }
1710
-
1711
- /**
1712
- * Render ST slideshow number
1713
- *
1714
- * @since 2.51.5
1715
- */
1716
- private function render_field_slideshow_num() {
1717
-
1718
- ?>
1719
- <td>
1720
- <div class="row">
1721
- <div class="inline inline-middle">
1722
- <label>
1723
- <select id="view-slider_type" name="view[data][slideshow_settings][type]"
1724
- class="if selectgroup">
1725
- <option value="show_single" <?php selected( $this->view['slideshow_settings']['type'], 'show_single' ); ?>><?php esc_html_e( 'single', 'strong-testimonials' ); ?></option>
1726
- <option value="show_multiple" <?php selected( $this->view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php esc_html_e( 'multiple', 'strong-testimonials' ); ?></option>
1727
- </select>
1728
- </label>
1729
- <div class="option-desc singular" style="display: none;">
1730
- <?php esc_html_e( 'slide at a time', 'strong-testimonials' ); ?>
1731
- </div>
1732
- <div class="option-desc plural" style="display: none;">
1733
- <?php esc_html_e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
1734
- </div>
1735
- </div>
1736
- </div>
1737
- </td>
1738
- <td>
1739
- <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
1740
- <div class="row">
1741
- <div class="inner-table is-below">
1742
- <div class="inner-table-row bordered header">
1743
- <div class="inner-table-cell"><?php esc_html_e( 'minimum screen width', 'strong-testimonials' ); ?></div>
1744
- <div class="inner-table-cell"><?php esc_html_e( 'show', 'strong-testimonials' ); ?></div>
1745
- <div class="inner-table-cell"><?php esc_html_e( 'margin', 'strong-testimonials' ); ?></div>
1746
- <div class="inner-table-cell"><?php esc_html_e( 'move', 'strong-testimonials' ); ?></div>
1747
- </div>
1748
- <?php foreach ( $this->view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
1749
- <div class="inner-table-row bordered">
1750
- <div class="inner-table-cell">
1751
- <label>
1752
- <input id="view-breakpoint_<?php echo esc_attr( $key ); ?>"
1753
- name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][width]"
1754
- value="<?php echo esc_attr( $breakpoint['width'] ); ?>" type="number"
1755
- class="input-incremental"> px
1756
- </label>
1757
- </div>
1758
- <div class="inner-table-cell">
1759
- <label>
1760
- <select id="view-max_slides_<?php echo $key; ?>"
1761
- name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][max_slides]"
1762
- class="if selectgroup">
1763
- <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1
1764
- </option>
1765
- <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2
1766
- </option>
1767
- <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3
1768
- </option>
1769
- <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4
1770
- </option>
1771
- </select>
1772
- </label>
1773
- <div class="option-desc singular"
1774
- style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1775
- <div class="option-desc plural"
1776
- style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1777
- </div>
1778
- <div class="inner-table-cell">
1779
- <input id="view-margin_<?php echo esc_attr( $key ); ?>"
1780
- name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][margin]"
1781
- value="<?php echo esc_attr( $breakpoint['margin'] ); ?>" type="number"
1782
- min="1" step="1" size="3" class="input-incremental"/> px
1783
- </div>
1784
- <div class="inner-table-cell">
1785
- <label>
1786
- <select id="view-move_slides_<?php echo esc_attr( $key ); ?>"
1787
- name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][move_slides]"
1788
- class="if selectgroup">
1789
- <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1
1790
- </option>
1791
- <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2
1792
- </option>
1793
- <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3
1794
- </option>
1795
- <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4
1796
- </option>
1797
- </select>
1798
- </label>
1799
- <div class="option-desc singular"
1800
- style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1801
- <div class="option-desc plural"
1802
- style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1803
- </div>
1804
- </div>
1805
- <?php endforeach; ?>
1806
- </div>
1807
- </div>
1808
- <div class="is-below">
1809
- <input id="restore-default-breakpoints" type="button" name="restore-default-breakpoints"
1810
- value="<?php esc_html_e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
1811
- class="button-secondary"/>
1812
- <span id="restored-message"><?php esc_html_e( 'defaults restored', 'strong-testimonials' ); ?></span>
1813
- </div>
1814
- </div>
1815
- </td>
1816
- <?php
1817
- }
1818
-
1819
- /**
1820
- * Render ST Slideshow transition
1821
- *
1822
- * @since 2.51.5
1823
- */
1824
- private function render_field_slideshow_transition() {
1825
-
1826
- ?>
1827
- <td>
1828
- <div class="row">
1829
- <div class="inline inline-middle">
1830
- <label for="view-pause"><?php _ex( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?></label>
1831
- <input type="number" id="view-pause" class="input-incremental"
1832
- name="view[data][slideshow_settings][pause]" min=".1" step=".1"
1833
- value="<?php echo esc_attr( $this->view['slideshow_settings']['pause'] ); ?>" size="3"/>
1834
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1835
- </div>
1836
- <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast"
1837
- style="display: none;">
1838
- <label for="view-effect"><?php esc_html_e( 'then', 'strong-testimonials' ); ?></label>
1839
- <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
1840
- <?php foreach ( $this->view_options['slideshow_effect'] as $key => $label ) : ?>
1841
- <option value="<?php echo esc_attr( $key ); ?>"
1842
- <?php selected( $this->view['slideshow_settings']['effect'], $key ); ?>
1843
- <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo esc_html( $label ); ?></option>
1844
- <?php endforeach; ?>
1845
- </select>
1846
- </div>
1847
- <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast"
1848
- style="display: none;">
1849
- <?php esc_html_e( 'then', 'strong-testimonials' ); ?><?php _ex( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
1850
- </div>
1851
- <div class="inline inline-middle then then_effect then_none">
1852
- <label for="view-speed"><?php esc_html_e( 'for', 'strong-testimonials' ); ?></label>
1853
- <input type="number" id="view-speed" class="input-incremental"
1854
- name="view[data][slideshow_settings][speed]" min=".1" step=".1"
1855
- value="<?php echo esc_attr( $this->view['slideshow_settings']['speed'] ); ?>" size="3"/>
1856
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1857
- </div>
1858
- </div>
1859
- </td>
1860
- <?php
1861
- }
1862
-
1863
- /**
1864
- * Render ST Slideshow behavior
1865
- *
1866
- * @since 2.51.5
1867
- */
1868
- private function render_field_slideshow_behavior() {
1869
-
1870
- ?>
1871
- <td>
1872
- <div class="row">
1873
- <div class="inline inline-middle">
1874
- <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]"
1875
- value="0" <?php checked( $this->view['slideshow_settings']['auto_start'] ); ?>
1876
- class="checkbox">
1877
- <label for="view-auto_start"><?php _ex( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?></label>
1878
- </div>
1879
- </div>
1880
- <div class="row">
1881
- <div class="inline inline-middle">
1882
- <input type="checkbox" id="view-continuous_sliding"
1883
- name="view[data][slideshow_settings][continuous_sliding]"
1884
- value="0" <?php checked( $this->view['slideshow_settings']['continuous_sliding'] ); ?>
1885
- class="checkbox">
1886
- <label for="view-continuous_sliding"><?php _ex( 'Continuous Sliding', 'slideshow setting', 'strong-testimonials' ); ?></label>
1887
- </div>
1888
- </div>
1889
- <div class="row">
1890
- <div class="inline inline-middle">
1891
- <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]"
1892
- value="0" <?php checked( $this->view['slideshow_settings']['auto_hover'] ); ?>
1893
- class="checkbox">
1894
- <label for="view-auto_hover"><?php _ex( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?></label>
1895
- </div>
1896
- </div>
1897
- <div class="row">
1898
- <div class="inline inline-middle">
1899
- <input type="checkbox" id="view-stop_auto_on_click"
1900
- name="view[data][slideshow_settings][stop_auto_on_click]"
1901
- value="0" <?php checked( $this->view['slideshow_settings']['stop_auto_on_click'] ); ?>
1902
- class="checkbox">
1903
- <label for="view-stop_auto_on_click"><?php _ex( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?></label>
1904
- </div>
1905
- <div class="inline inline-middle">
1906
- <p class="description"><?php esc_html_e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
1907
- </div>
1908
- </div>
1909
- <?php
1910
- if ( $this->view['slideshow_settings']['adapt_height'] ) {
1911
- $height = 'dynamic';
1912
- } else {
1913
- $height = 'static';
1914
- }
1915
- ?>
1916
- <div class="row">
1917
- <div class="row-inner">
1918
- <div class="inline">
1919
- <label for="view-slideshow_height">
1920
- <select id="view-slideshow_height" name="view[data][slideshow_settings][height]"
1921
- class="if selectgroup">
1922
- <?php foreach ( $this->view_options['slideshow_height'] as $key => $type ) : ?>
1923
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
1924
- <?php selected( $height, $key ); ?>>
1925
- <?php echo esc_html( $type ); ?>
1926
- </option>
1927
- <?php endforeach; ?>
1928
- </select>
1929
- </label>
1930
- </div>
1931
- <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
1932
- <label for="view-adapt_height_speed"><?php esc_html_e( 'Duration', 'strong-testimonials' ); ?></label>
1933
- <input type="number" id="view-adapt_height_speed" class="input-incremental"
1934
- name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
1935
- value="<?php echo esc_attr( $this->view['slideshow_settings']['adapt_height_speed'] ); ?>"
1936
- size="3"/>
1937
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1938
- </div>
1939
- <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
1940
- <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]"
1941
- value="1" <?php checked( $this->view['slideshow_settings']['stretch'] ); ?>
1942
- class="checkbox">
1943
- <label for="view-stretch"><?php esc_html_e( 'Stretch slides vertically', 'strong-testimonials' ); ?></label>
1944
- <div class="inline description">
1945
- <a href="#tab-panel-wpmtst-help-stretch"
1946
- class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
1947
- </div>
1948
- </div>
1949
- </div>
1950
- </div>
1951
- <div class="row tall">
1952
- <p class="description"><?php esc_html_e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
1953
- </div>
1954
- </td>
1955
- <?php
1956
- }
1957
-
1958
- /**
1959
- * Render ST Slideshow navigation
1960
- *
1961
- * @since 2.51.5
1962
- */
1963
- private function render_field_slideshow_navigation() {
1964
-
1965
- ?>
1966
- <td>
1967
- <div class="row">
1968
- <div class="row-inner">
1969
- <div class="inline">
1970
- <label for="view-slideshow_controls_type"><?php esc_html_e( 'Controls', 'strong-testimonials' ); ?></label>
1971
- <select id="view-slideshow_controls_type" name="view[data][slideshow_settings][controls_type]"
1972
- class="if selectnot">
1973
-
1974
- <?php foreach ( $this->view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
1975
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
1976
- <?php selected( $this->view['slideshow_settings']['controls_type'], $key ); ?>
1977
- <?php if ( 'none' == $key ) {
1978
- echo ' class="trip"';
1979
- } ?>>
1980
- <?php echo esc_html( $type['label'] ); ?>
1981
- </option>
1982
- <?php endforeach; ?>
1983
-
1984
- </select>
1985
- </div>
1986
- <div class="inline then then_slideshow_controls_type" style="display: none;">
1987
- <label for="view-slideshow_controls_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
1988
- <select id="view-slideshow_controls_style"
1989
- name="view[data][slideshow_settings][controls_style]">
1990
- <?php foreach ( $this->view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
1991
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['controls_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
1992
- <?php endforeach; ?>
1993
- </select>
1994
- </div>
1995
- </div>
1996
- </div>
1997
- <div class="row">
1998
- <div class="row-inner then then_has-pager">
1999
- <div class="inline">
2000
- <label for="view-slideshow_pager_type"><?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?></label>
2001
- <select id="view-slideshow_pager_type" name="view[data][slideshow_settings][pager_type]"
2002
- class="if selectnot">
2003
-
2004
- <?php foreach ( $this->view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
2005
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
2006
- <?php selected( $this->view['slideshow_settings']['pager_type'], $key ); ?>
2007
- <?php if ( 'none' == $key ) {
2008
- echo ' class="trip"';
2009
- } ?>>
2010
- <?php echo esc_html( $type['label'] ); ?>
2011
- </option>
2012
- <?php endforeach; ?>
2013
-
2014
- </select>
2015
- </div>
2016
- <div class="inline then then_slideshow_pager_type" style="display: none;">
2017
- <label for="view-slideshow_pager_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
2018
- <select id="view-slideshow_pager_style" name="view[data][slideshow_settings][pager_style]"
2019
- class="if selectnot">
2020
- <?php foreach ( $this->view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
2021
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['pager_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
2022
- <?php endforeach; ?>
2023
- </select>
2024
- </div>
2025
- </div>
2026
- </div>
2027
- <div class="row">
2028
- <div class="row-inner">
2029
- <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
2030
- <div class="inline then then_has-position" style="display: none;">
2031
- <label for="view-slideshow_nav_position"><?php esc_html_e( 'Position', 'strong-testimonials' ); ?></label>
2032
- <select id="view-slideshow_nav_position"
2033
- name="view[data][slideshow_settings][nav_position]">
2034
- <?php foreach ( $this->view_options['slideshow_nav_position'] as $key => $label ) : ?>
2035
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['nav_position'], $key ); ?>><?php echo esc_html( $label ); ?></option>
2036
- <?php endforeach; ?>
2037
- </select>
2038
- <?php //esc_html_e( 'outside', 'strong-testimonials' ); ?>
2039
- <?php esc_html_e( 'the testimonial frame', 'strong-testimonials' ); ?>
2040
- </div>
2041
- </div>
2042
- </div>
2043
- </div>
2044
- </td>
2045
- <?php
2046
- }
2047
-
2048
- /**
2049
- * Render ST form category field
2050
- *
2051
- * @since 2.51.5
2052
- */
2053
- private function render_field_form_category() {
2054
-
2055
- if ( $this->cat_count ) : ?>
2056
- <td>
2057
- <div class="table">
2058
-
2059
- <?php if ( $this->cat_count > 5 ) : ?>
2060
- <div class="table-row">
2061
- <div class="table-cell">
2062
- <div class="row" style="text-align: right; padding-bottom: 5px;">
2063
- <input type="button" class="expand-cats button" value="expand list"/>
2064
- </div>
2065
- </div>
2066
- </div>
2067
- <?php endif; ?>
2068
-
2069
- <div class="table-row">
2070
- <div class="table-cell">
2071
- <?php wpmtst_form_category_checklist( $this->view_cats_array ); ?>
2072
- </div>
2073
- </div>
2074
- </div>
2075
- </td>
2076
- <?php else : ?>
2077
- <td>
2078
- <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
2079
- </td>
2080
- <?php endif;
2081
- }
2082
-
2083
- /**
2084
- * Render ST form AJAX field
2085
- *
2086
- * @since 2.51.5
2087
- */
2088
- private function render_field_form_ajax() {
2089
-
2090
- ?>
2091
- <td>
2092
- <p class="description tall"><?php _e( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ); ?></p>
2093
- </td>
2094
- <?php
2095
- }
2096
-
2097
- /**
2098
- * Render ST template list field
2099
- *
2100
- * @since 2.51.5
2101
- */
2102
- private function render_field_template_list() {
2103
-
2104
- // Assemble list of templates
2105
- $templates = array(
2106
- 'display' => WPMST()->templates->get_templates( 'display' ),
2107
- 'form' => WPMST()->templates->get_templates( 'form' ),
2108
- );
2109
- $template_found = in_array( $this->view['template'], WPMST()->templates->get_template_keys() );
2110
-
2111
- ?>
2112
- <td colspan="2">
2113
- <div id="view-template-list">
2114
- <div class="radio-buttons">
2115
-
2116
- <?php if ( ! $template_found ) : ?>
2117
- <ul class="radio-list template-list">
2118
- <li>
2119
- <div>
2120
- <input class="error" type="radio"
2121
- id="<?php echo esc_attr( $this->view['template'] ); ?>"
2122
- name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2123
- value="<?php echo esc_attr( $this->view['template'] ); ?>" checked>
2124
- <label for="<?php echo esc_attr( $this->view['template'] ); ?>"><?php echo esc_html( $this->view['template'] ); ?></label>
2125
- </div>
2126
- <div class="template-description">
2127
- <p>
2128
- <span class="dashicons dashicons-warning error"></span>&nbsp;
2129
- <span class="error"><?php esc_html_e( 'not found', 'strong-testimonials' ); ?></span>
2130
- </p>
2131
- </div>
2132
- </li>
2133
- </ul>
2134
- <?php endif; ?>
2135
-
2136
- <ul class="radio-list template-list">
2137
-
2138
- <?php foreach ( $templates[ $this->current_type ] as $key => $template ) : ?>
2139
- <li>
2140
- <div>
2141
- <input type="radio" id="template-<?php echo esc_attr( $key ); ?>"
2142
- name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2143
- value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $this->view['template'] ); ?>>
2144
- <label for="template-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $template['config']['name'] ); ?></label>
2145
- </div>
2146
- <div class="template-description">
2147
- <p><?php echo( isset( $template['config']['description'] ) && $template['config']['description'] ? esc_html( $template['config']['description'] ) : __( 'no description', 'strong-testimonials' ) ) ?></p>
2148
- <div class="options">
2149
- <div>
2150
- <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
2151
- <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
2152
- <?php else : ?>
2153
- <?php foreach ( $template['config']['options'] as $option ) : ?>
2154
- <div style="margin-bottom: 10px;">
2155
- <?php
2156
- $name = sprintf( 'view[data][template_settings][%s][%s]', esc_attr( $key ), esc_attr( $option->name ) );
2157
- $id = $key . '-' . $option->name;
2158
-
2159
- switch ( $option->type ) {
2160
- case 'select':
2161
-
2162
- // Get default if not set
2163
- if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2164
- $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2165
- }
2166
-
2167
- if ( $option->label ) {
2168
- printf( '<label for="%s">%s</label>', esc_attr( $id ), wp_kses_post( $option->label ) );
2169
- }
2170
-
2171
- printf( '<select id="%s" name="%s">', esc_attr( $id ), $name );
2172
-
2173
- foreach ( $option->values as $value ) {
2174
- $selected = selected( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2175
- printf( '<option value="%s" %s>%s</option>', esc_attr( $value->value ), $selected, esc_html( $value->description ) );
2176
- }
2177
-
2178
- echo '</select>';
2179
- break;
2180
- case 'radio':
2181
-
2182
- if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2183
- $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2184
- }
2185
-
2186
- foreach ( $option->values as $value ) {
2187
- $checked = checked( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2188
- printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', esc_attr( $id ), $name, esc_attr( $value->value ), $checked );
2189
- printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $value->description ) );
2190
- }
2191
-
2192
- break;
2193
- case 'colorpicker':
2194
-
2195
- if ( $option->label ) {
2196
- printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
2197
- }
2198
-
2199
- $value = isset( $this->view['template_settings'][ $key ][ $option->name ] ) ? $this->view['template_settings'][ $key ][ $option->name ] : $option->default;
2200
- printf( '<input type="text" class="wp-color-picker-field" data-alpha="true" id="%s" name="%s" value="%s">', esc_attr( $id ), $name, esc_attr( $value ) );
2201
- break;
2202
- default:
2203
- do_action( 'wpmtst_views_render_template_option_' . $option->type, $this->view, $key, $option );
2204
- break;
2205
- }
2206
- ?>
2207
- </div>
2208
- <?php endforeach; ?>
2209
-
2210
- <?php endif; ?>
2211
- </div>
2212
- </div>
2213
- <?php do_action( 'wpmtst_views_after_template_options', $this->view, $template, $key ); ?>
2214
- </div>
2215
- </li>
2216
- <?php endforeach; ?>
2217
-
2218
- </ul>
2219
- </div>
2220
- </div>
2221
- <?php do_action( 'wpmtst_views_after_template_list' ); ?>
2222
- </td>
2223
- <?php
2224
- }
2225
-
2226
- /**
2227
- * Render ST layout field
2228
- *
2229
- * @since 2.51.5
2230
- */
2231
- private function render_field_layout() { ?>
2232
- <td colspan="2">
2233
- <div class="section-radios layout-section">
2234
- <div class="radio-buttons">
2235
- <ul class="radio-list layout-list">
2236
- <li>
2237
- <input type="radio" id="view-layout-normal" name="view[data][layout]"
2238
- value="" <?php checked( false, $this->view['layout'] ); ?>>
2239
- <label for="view-layout-normal"><?php esc_html_e( 'normal', 'strong-testimonials' ); ?></label>
2240
- </li>
2241
- <li>
2242
- <input type="radio" id="view-layout-masonry" name="view[data][layout]"
2243
- value="masonry" <?php checked( 'masonry', $this->view['layout'] ); ?>>
2244
- <label for="view-layout-masonry"><?php esc_html_e( 'Masonry', 'strong-testimonials' ); ?> </label>
2245
- </li>
2246
- <li>
2247
- <input type="radio"
2248
- id="view-layout-columns"
2249
- name="view[data][layout]"
2250
- value="columns" <?php checked( 'columns', $this->view['layout'] ); ?>>
2251
- <label for="view-layout-columns">
2252
- <?php esc_html_e( 'columns', 'strong-testimonials' ); ?>
2253
- </label>
2254
- </li>
2255
- <li>
2256
- <input type="radio" id="view-layout-grid" name="view[data][layout]"
2257
- value="grid" <?php checked( 'grid', $this->view['layout'] ); ?>>
2258
- <label for="view-layout-grid"><?php esc_html_e( 'grid', 'strong-testimonials' ); ?></label>
2259
- </li>
2260
- </ul>
2261
- </div>
2262
- <div>
2263
- <div class="radio-description" id="view-layout-info">
2264
- <div class="layout-description view-layout-normal">
2265
- <p><?php esc_html_e( 'A single column.', 'strong-testimonials' ); ?></p>
2266
- </div>
2267
- <div class="layout-description view-layout-masonry">
2268
- <p><?php printf( __( 'A cascading, responsive grid using the jQuery plugin <a href="%s" target="_blank">Masonry</a>.', 'strong-testimonials' ), esc_url( 'http://masonry.desandro.com/' ) ); ?></p>
2269
- <p><?php esc_html_e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
2270
- <p><?php esc_html_e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
2271
- </div>
2272
- <div class="layout-description view-layout-columns">
2273
- <p><?php printf( __( 'Using <a href="%s" target="_blank">CSS multi-column</a>. Fill from top to bottom, then over to next column.', 'strong-testimonials' ), esc_url( 'https://css-tricks.com/guide-responsive-friendly-css-columns/' ) ); ?></p>
2274
- <p><?php esc_html_e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
2275
- <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2276
- </div>
2277
- <div class="layout-description view-layout-grid">
2278
- <p><?php
2279
- $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
2280
- printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) ); ?>
2281
- </p>
2282
- <p><?php esc_html_e( 'Testimonials will be equal height so this works best when they are about the same length either naturally or using excerpts.', 'strong-testimonials' ); ?></p>
2283
- <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2284
- </div>
2285
- </div>
2286
- <div class="radio-description options" id="column-count-wrapper">
2287
- <div>
2288
- <label for="view-column-count"><?php esc_html_e( 'Number of columns', 'strong-testimonials' ); ?></label>
2289
- <select id="view-column-count" name="view[data][column_count]">
2290
- <option value="2" <?php selected( $this->view['column_count'], 2 ); ?>>2</option>
2291
- <option value="3" <?php selected( $this->view['column_count'], 3 ); ?>>3</option>
2292
- <option value="4" <?php selected( $this->view['column_count'], 4 ); ?>>4</option>
2293
- </select>
2294
- </div>
2295
- </div>
2296
- </div>
2297
- <div>
2298
- <div class="layout-example view-layout-normal">
2299
- <div class="example-container">
2300
- <div class="box"><span>1</span></div>
2301
- <div class="box size2"><span>2</span></div>
2302
- <div class="box"><span>3</span></div>
2303
- <div class="box size2"><span>4</span></div>
2304
- <div class="box"><span>5</span></div>
2305
- </div>
2306
- </div>
2307
- <div class="layout-example view-layout-masonry">
2308
- <div class="example-container col-2">
2309
- <div class="grid-sizer"></div>
2310
- <div class="box"><span>1</span></div>
2311
- <div class="box size2"><span>2</span></div>
2312
- <div class="box"><span>3</span></div>
2313
- <div class="box size3"><span>4</span></div>
2314
- <div class="box"><span>5</span></div>
2315
- <div class="box size2"><span>6</span></div>
2316
- <div class="box"><span>7</span></div>
2317
- <div class="box size3"><span>8</span></div>
2318
- <div class="box"><span>9</span></div>
2319
- </div>
2320
- </div>
2321
- <div class="layout-example view-layout-columns">
2322
- <div class="example-container col-2">
2323
- <div class="box"><span>1</span></div>
2324
- <div class="box size2"><span>2</span></div>
2325
- <div class="box"><span>3</span></div>
2326
- <div class="box size3"><span>4</span></div>
2327
- <div class="box"><span>5</span></div>
2328
- <div class="box size2"><span>6</span></div>
2329
- <div class="box"><span>7</span></div>
2330
- <div class="box size3"><span>8</span></div>
2331
- <div class="box"><span>9</span></div>
2332
- </div>
2333
- </div>
2334
- <div class="layout-example view-layout-grid">
2335
- <div class="example-container col-2">
2336
- <div class="box"><span>1</span></div>
2337
- <div class="box"><span>2</span></div>
2338
- <div class="box"><span>3</span></div>
2339
- <div class="box"><span>4</span></div>
2340
- <div class="box"><span>5</span></div>
2341
- <div class="box"><span>6</span></div>
2342
- <div class="box"><span>7</span></div>
2343
- <div class="box"><span>8</span></div>
2344
- <div class="box"><span>9</span></div>
2345
- </div>
2346
- </div>
2347
- </div>
2348
- </div>
2349
- </td>
2350
- <?php
2351
- }
2352
-
2353
- /**
2354
- * Render ST background field
2355
- *
2356
- * @since 2.51.5
2357
- */
2358
- private function render_field_background() {
2359
-
2360
- ?>
2361
- <td>
2362
- <div class="section-radios background-section">
2363
- <div class="radio-buttons">
2364
- <ul class="radio-list background-list">
2365
- <li>
2366
- <input type="radio" id="bg-none" name="view[data][background][type]"
2367
- value="" <?php checked( $this->view['background']['type'], '' ); ?>>
2368
- <label for="bg-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2369
- </li>
2370
- <li>
2371
- <input type="radio" id="bg-single" name="view[data][background][type]"
2372
- value="single" <?php checked( $this->view['background']['type'], 'single' ); ?>>
2373
- <label for="bg-single"><?php esc_html_e( 'single color', 'strong-testimonials' ); ?></label>
2374
- </li>
2375
- <li>
2376
- <input type="radio" id="bg-gradient" name="view[data][background][type]"
2377
- value="gradient" <?php checked( $this->view['background']['type'], 'gradient' ); ?>>
2378
- <label for="bg-gradient"><?php esc_html_e( 'gradient', 'strong-testimonials' ); ?></label>
2379
- </li>
2380
- <li>
2381
- <input type="radio" id="bg-preset" name="view[data][background][type]"
2382
- value="preset" <?php checked( $this->view['background']['type'], 'preset' ); ?>>
2383
- <label for="bg-preset"><?php esc_html_e( 'preset', 'strong-testimonials' ); ?></label>
2384
- </li>
2385
- </ul>
2386
- </div>
2387
- <div class="radio-description" id="view-background-info">
2388
- <div class="background-description bg-none">
2389
- <div class="description-inner options">
2390
- <div>
2391
- <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
2392
- </div>
2393
- </div>
2394
- </div>
2395
- <div class="background-description bg-single">
2396
- <div class="description-inner options">
2397
- <div>
2398
- <label>
2399
- <input type="text" id="bg-color" name="view[data][background][color]"
2400
- value="<?php echo esc_attr( $this->view['background']['color'] ); ?>"
2401
- class="wp-color-picker-field">
2402
- </label>
2403
- </div>
2404
- </div>
2405
- </div>
2406
- <div class="background-description bg-gradient">
2407
- <div class="description-inner options">
2408
- <div>
2409
- <div class="color-picker-wrap">
2410
- <div>
2411
- <label for="bg-gradient1"><?php esc_html_e( 'From top', 'strong-testimonials' ); ?></label>
2412
- </div>
2413
- <div><input type="text" id="bg-gradient1" name="view[data][background][gradient1]"
2414
- value="<?php echo esc_attr( $this->view['background']['gradient1'] ); ?>"
2415
- class="wp-color-picker-field gradient"></div>
2416
- </div>
2417
- </div>
2418
- </div>
2419
- <div class="description-inner options">
2420
- <div>
2421
- <div class="color-picker-wrap">
2422
- <div>
2423
- <label for="bg-gradient2"><?php esc_html_e( 'To bottom', 'strong-testimonials' ); ?></label>
2424
- </div>
2425
- <div><input type="text" id="bg-gradient2" name="view[data][background][gradient2]"
2426
- value="<?php echo esc_attr( $this->view['background']['gradient2'] ); ?>"
2427
- class="wp-color-picker-field gradient"></div>
2428
- </div>
2429
- </div>
2430
- </div>
2431
- </div>
2432
-
2433
- <div class="background-description bg-preset">
2434
- <div class="description-inner options">
2435
- <div>
2436
- <label for="view-background-preset">
2437
- <select id="view-background-preset" name="view[data][background][preset]">
2438
- <?php
2439
- $presets = wpmtst_get_background_presets();
2440
- $current_preset = ( isset( $this->view['background']['preset'] ) && $this->view['background']['preset'] ) ? $this->view['background']['preset'] : '';
2441
- echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
2442
- foreach ( $presets as $key => $preset ) {
2443
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $current_preset, $key, false ) . '>' . esc_html( $preset['label'] ) . '</option>';
2444
- }
2445
- ?>
2446
- </select>
2447
- </label>
2448
- </div>
2449
- </div>
2450
- </div>
2451
- </div>
2452
- </div>
2453
- </td>
2454
-
2455
- <td rowspan="2" class="rowspan">
2456
- <div id="view-color-preview" class="table-cell">
2457
- <div class="background-preview-wrap">
2458
- <div id="background-preview">
2459
- Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse
2460
- maiorum
2461
- in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad
2462
- vidisse
2463
- expetendis.
2464
- </div>
2465
- </div>
2466
- </div>
2467
- </td>
2468
- <?php
2469
- }
2470
-
2471
- /**
2472
- * Render ST color field
2473
- *
2474
- * @since 2.51.5
2475
- */
2476
- private function render_field_color() {
2477
-
2478
- ?>
2479
- <td>
2480
- <div class="section-radios font-color-section">
2481
- <div class="radio-buttons">
2482
- <ul class="radio-list font-folor-list">
2483
- <li>
2484
- <input type="radio" id="fc-none" name="view[data][font-color][type]"
2485
- value="" <?php checked( $this->view['font-color']['type'], '' ); ?>>
2486
- <label for="fc-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2487
- </li>
2488
- <li>
2489
- <input type="radio" id="fc-custom" name="view[data][font-color][type]"
2490
- value="custom" <?php checked( $this->view['font-color']['type'], 'custom' ); ?>>
2491
- <label for="fc-custom"><?php esc_html_e( 'custom', 'strong-testimonials' ); ?></label>
2492
- </li>
2493
- </ul>
2494
- </div>
2495
- <div class="radio-description" id="view-font-color-info">
2496
- <div class="font-color-description fc-none">
2497
- <div class="description-inner options">
2498
- <div><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></div>
2499
- </div>
2500
- </div>
2501
- <div class="font-color-description fc-custom">
2502
- <div class="description-inner options">
2503
- <div>
2504
- <label>
2505
- <input type="text" id="fc-color" name="view[data][font-color][color]"
2506
- value="<?php echo esc_attr( $this->view['font-color']['color'] ); ?>"
2507
- class="wp-color-picker-field">
2508
- </label>
2509
- </div>
2510
- </div>
2511
- </div>
2512
- </div>
2513
- </div>
2514
- </td>
2515
- <?php
2516
- }
2517
-
2518
- /**
2519
- * Render ST class field
2520
- *
2521
- * @since 2.51.5
2522
- */
2523
- private function render_field_classes() {
2524
-
2525
- ?>
2526
- <td colspan="2">
2527
- <div class="then then_display then_form then_slideshow input" style="display: none;">
2528
- <input type="text" id="view-class" class="long inline" name="view[data][class]"
2529
- value="<?php echo esc_attr( $this->view['class'] ); ?>">
2530
- <p class="inline description tall">
2531
- <?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?>
2532
- <?php esc_html_e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
2533
- </p>
2534
- </div>
2535
- </td>
2536
- <?php
2537
- }
2538
-
2539
- /**
2540
- * Render divi field
2541
- *
2542
- * @since 2.51.5
2543
- */
2544
- private function render_field_divi() {
2545
-
2546
- ?>
2547
- <td>
2548
- <div class="row">
2549
- <div class="row-inner">
2550
- <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
2551
- name="view[data][divi_builder]" value="1" <?php checked( $this->view['divi_builder'] ); ?>/>
2552
- <label for="view-divi_builder"><?php esc_html_e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?></label>
2553
- <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?></p>
2554
- <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?></p>
2555
- </div>
2556
- </div>
2557
- </td>
2558
- <?php
2559
- }
2560
  }
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Helper
5
+ *
6
+ * @since 2.5
7
+ */
8
+ class Strong_Testimonials_Helper {
9
+
10
+ /**
11
+ * Our Class variables
12
+ *
13
+ * @since 2.51.5
14
+ */
15
+ public $field;
16
+ public $action;
17
+ public $view_id;
18
+ public $view_options;
19
+ public $cat_count = false;
20
+ public $show_section;
21
+ public $view;
22
+ public $view_name;
23
+ public $view_cats_array;
24
+ public $sections;
25
+ public $current_mode;
26
+ public $current_type;
27
+ public $isSetting;
28
+
29
+ /**
30
+ * Strong_Testimonials_Helper constructor.
31
+ *
32
+ * @since 2.51.5
33
+ */
34
+ public function __construct() {
35
+
36
+ $this->action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
37
+ $this->view_id = abs( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
38
+ $this->view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
39
+ $this->cat_count = wpmtst_get_cat_count();
40
+ }
41
+
42
+ /**
43
+ * Set Strong Testimonial view
44
+ *
45
+ * @since 2.51.5
46
+ */
47
+ public function set_view() {
48
+
49
+ $this->view = $this->get_view();
50
+ $this->show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
51
+ if ( 'edit' == $this->action ) {
52
+ $view_array = wpmtst_get_view( $this->view_id );
53
+ $this->view = unserialize( $view_array['value'] );
54
+ $this->view_name = $view_array['name'];
55
+ } elseif ( 'duplicate' == $this->action ) {
56
+ $view_array = wpmtst_get_view( $this->view_id );
57
+ $this->view = unserialize( $view_array['value'] );
58
+ $this->view_id = 0;
59
+ $this->view_name = $view_array['name'] . ' - COPY';
60
+ } else {
61
+ $this->view_id = 1;
62
+ $this->view = wpmtst_get_view_default();
63
+ $this->view_name = 'new';
64
+ }
65
+ $this->view_cats_array = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->view['category'] ) );
66
+ $this->sections = $this->get_sections();
67
+ }
68
+
69
+ /**
70
+ * Get Strong Testimonial view
71
+ *
72
+ * @return array|mixed
73
+ *
74
+ * @since 2.51.5
75
+ */
76
+ public static function get_view() {
77
+
78
+ $view = wpmtst_get_view_default();
79
+ if ( isset( $_REQUEST['action'] ) ) {
80
+ $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
81
+ $id = abs( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
82
+ if ( 'edit' == $action || 'duplicate' == $action ) {
83
+ $view_array = wpmtst_get_view( $id );
84
+ if ( isset( $view_array['value'] ) ) {
85
+ $view = unserialize( $view_array['value'] );
86
+ }
87
+ }
88
+ }
89
+
90
+ return $view;
91
+ }
92
+
93
+ /**
94
+ * Get Strong Testimonials sections
95
+ *
96
+ * @return mixed|void
97
+ *
98
+ * @since 2.51.5
99
+ */
100
+ public function get_sections() {
101
+ return apply_filters( 'wpmtst_view_sections', array(
102
+ 'query' => array(
103
+ 'section_action_before' => 'wpmtst_view_editor_before_group_select',
104
+ 'section_action_after' => 'wpmtst_view_editor_after_group_select',
105
+ 'fields_action_before' => '',
106
+ 'fields_action_after' => array(
107
+ 'action' => 'wpmtst_views_group_query',
108
+ 'param' => $this->view
109
+ ),
110
+ 'classes' => array(
111
+ 'then',
112
+ 'then_display',
113
+ 'then_not_form',
114
+ 'then_slideshow',
115
+ 'then_not_single_template'
116
+ ),
117
+ 'title' => esc_html__( 'Query', 'strong-testimonials' ),
118
+ 'table_classes' => 'form-table multiple group-select',
119
+ 'subheading' => array(
120
+ array(
121
+ 'title' => esc_html__( 'Option', 'strong-testimonials' ),
122
+ 'classes' => '',
123
+ 'colspan' => 1,
124
+ 'after' => ''
125
+ ),
126
+ array(
127
+ 'title' => esc_html__( 'Settings', 'strong-testimonials' ),
128
+ 'classes' => '',
129
+ 'colspan' => 1,
130
+ 'after' => ''
131
+ ),
132
+ array(
133
+ 'title' => esc_html__( 'or Shortcode Attribute', 'strong-testimonials' ),
134
+ 'classes' => 'divider',
135
+ 'colspan' => 2,
136
+ 'after' => '<span class="help-links"><span class="description"><a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a></span></span>'
137
+ ),
138
+ array(
139
+ 'title' => esc_html__( 'Example', 'strong-testimonials' ),
140
+ 'classes' => '',
141
+ 'colspan' => 1,
142
+ 'after' => ''
143
+ )
144
+ ),
145
+ 'fields' => array(
146
+ 'field_select' => array(
147
+ 'label' => esc_html_x( 'Select', 'verb', 'strong-testimonials' ),
148
+ 'type' => 'select',
149
+ 'before' => '',
150
+ 'after' => '',
151
+ 'class' => 'view-single_or_multiple',
152
+ 'container_classes' => 'then then_display then_slideshow then_not_form',
153
+ 'id' => '',
154
+ 'field_action_before' => '',
155
+ 'field_action_after' => ''
156
+ ),
157
+ 'field_category' => array(
158
+ 'label' => esc_html__( 'Categories', 'strong-testimonials' ),
159
+ 'type' => 'category',
160
+ 'before' => '',
161
+ 'after' => '',
162
+ 'class' => 'view-category-select',
163
+ 'container_classes' => 'then then_display then_slideshow then_not_form',
164
+ 'id' => '',
165
+ 'field_action_before' => '',
166
+ 'field_action_after' => ''
167
+ ),
168
+ 'field_order' => array(
169
+ 'label' => esc_html_x( 'Order', 'noun', 'strong-testimonials' ),
170
+ 'type' => 'order',
171
+ 'before' => '',
172
+ 'after' => '',
173
+ 'class' => 'view-order',
174
+ 'container_classes' => 'then then_display then_slideshow then_not_form',
175
+ 'id' => '',
176
+ 'field_action_before' => '',
177
+ 'field_action_after' => ''
178
+ ),
179
+ 'field_limit' => array(
180
+ 'label' => esc_html__( 'Quantity', 'strong-testimonials' ),
181
+ 'type' => 'limit',
182
+ 'before' => '',
183
+ 'after' => '',
184
+ 'class' => 'view-all',
185
+ 'container_classes' => 'then then_display then_slideshow then_not_form',
186
+ 'id' => '',
187
+ 'field_action_before' => '',
188
+ 'field_action_after' => ''
189
+ )
190
+ )
191
+ ),
192
+ 'fields' => array(
193
+ 'section_action_before' => 'wpmtst_view_editor_before_group_fields',
194
+ 'section_action_after' => '',
195
+ 'fields_action_before' => '',
196
+ 'fields_action_after' => '',
197
+ 'classes' => array(
198
+ 'then',
199
+ 'then_display',
200
+ 'then_not_form',
201
+ 'then_slideshow',
202
+ 'then_single_template'
203
+ ),
204
+ 'title' => esc_html__( 'Fields', 'strong-testimonials' ),
205
+ 'table_classes' => 'form-table multiple group-show',
206
+ 'fields' => array(
207
+ 'field_title' => array(
208
+ 'label' => esc_html__( ' Title', 'strong-testimonials' ),
209
+ 'type' => 'title',
210
+ 'before' => '<input type="checkbox" id="view-title" name="view[data][title]" value="1"' . checked( $this->view['title'], true, false ) . ' class="checkbox if toggle">',
211
+ 'after' => '',
212
+ 'class' => 'view-title',
213
+ 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
214
+ 'id' => '',
215
+ 'field_action_before' => '',
216
+ 'field_action_after' => ''
217
+ ),
218
+ 'field_thumbnail' => array(
219
+ 'label' => esc_html__( ' Featured Image', 'strong-testimonials' ),
220
+ 'type' => 'thumbnail',
221
+ 'before' => '<input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1"' . checked( $this->view['thumbnail'], true, false ) . '>',
222
+ 'after' => '',
223
+ 'class' => 'view-images',
224
+ 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
225
+ 'id' => '',
226
+ 'field_action_before' => '',
227
+ 'field_action_after' => ''
228
+ ),
229
+ 'field_content' => array(
230
+ 'label' => esc_html__( ' Content', 'strong-testimonials' ),
231
+ 'type' => 'content',
232
+ 'before' => '',
233
+ 'after' => '',
234
+ 'class' => 'view-content',
235
+ 'container_classes' => 'then then_display then_not_form then_slideshow then_not_single_template',
236
+ 'id' => '',
237
+ 'field_action_before' => '',
238
+ 'field_action_after' => ''
239
+ ),
240
+ 'field_client_section' => array(
241
+ 'include' => 'option-client-section.php',
242
+ 'label' => esc_html__( ' Custom Fields', 'strong-testimonials' ),
243
+ 'type' => 'client-section',
244
+ 'before' => '',
245
+ 'after' => '',
246
+ 'class' => '',
247
+ 'container_classes' => 'then then_display then_not_form then_slideshow then_single_template',
248
+ 'id' => '',
249
+ 'field_action_before' => '',
250
+ 'field_action_after' => ''
251
+ )
252
+ )
253
+ ),
254
+
255
+ 'extra' => array(
256
+ 'section_action_before' => 'wpmtst_view_editor_before_group_extra',
257
+ 'section_action_after' => '',
258
+ 'fields_action_before' => '',
259
+ 'fields_action_after' => '',
260
+ 'classes' => array(
261
+ 'then',
262
+ 'then_display',
263
+ 'then_not_form',
264
+ 'then_slideshow',
265
+ 'then_not_single_template'
266
+ ),
267
+ 'title' => esc_html__( 'Extra', 'strong-testimonials' ),
268
+ 'table_classes' => 'form-table multiple group-layout',
269
+ 'fields' => array(
270
+ 'field_pagination' => array(
271
+ 'label' => esc_html__( ' Pagination', 'strong-testimonials' ),
272
+ 'type' => 'pagination',
273
+ 'before' => '<input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]" type="checkbox" value="1"' . checked( $this->view['pagination'], true, false ) . '/>',
274
+ 'after' => '',
275
+ 'class' => 'view-pagination',
276
+ 'container_classes' => 'then then_display then_not_form then_not_slideshow then_not_single then_multiple',
277
+ 'id' => '',
278
+ 'field_action_before' => '',
279
+ 'field_action_after' => ''
280
+ ),
281
+ 'field_read_more' => array(
282
+ 'include' => 'option-read-more-page.php',
283
+ 'label' => esc_html__( ' "Read more" link to a page or post', 'strong-testimonials' ),
284
+ 'type' => 'read-more-page',
285
+ 'before' => '<div class="checkbox"><input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"' . checked( isset( $this->view['more_page'] ) && $this->view['more_page'], true, false ) . ' class="checkbox">',
286
+ 'after' => '</div>',
287
+ 'class' => 'view-more_page',
288
+ 'container_classes' => 'then then_display then_not_form then_slideshow read-more',
289
+ 'id' => '',
290
+ 'field_action_before' => '',
291
+ 'field_action_after' => ''
292
+ ),
293
+ )
294
+ ),
295
+ 'slideshow' => array(
296
+ 'section_action_before' => 'wpmtst_view_editor_before_group_slideshow',
297
+ 'section_action_after' => '',
298
+ 'fields_action_before' => '',
299
+ 'fields_action_after' => '',
300
+ 'classes' => array(
301
+ 'then',
302
+ 'then_not_display',
303
+ 'then_not_form',
304
+ 'then_slideshow',
305
+ 'then_not_single_template'
306
+ ),
307
+ 'title' => esc_html__( 'Slideshow', 'strong-testimonials' ),
308
+ 'table_classes' => 'form-table multiple group-select',
309
+ 'fields' => array(
310
+ 'field_slideshow_num' => array(
311
+ 'label' => esc_html__( 'Show', 'strong-testimonials' ),
312
+ 'type' => 'slideshow-num',
313
+ 'before' => '',
314
+ 'after' => '',
315
+ 'class' => '',
316
+ 'container_classes' => 'then then_slideshow',
317
+ 'id' => '',
318
+ 'field_action_before' => '',
319
+ 'field_action_after' => ''
320
+ ),
321
+ 'field_slideshow_transition' => array(
322
+ 'include' => 'option-slideshow-transition.php',
323
+ 'label' => esc_html__( 'Transition', 'strong-testimonials' ),
324
+ 'type' => 'slideshow-transition',
325
+ 'before' => '',
326
+ 'after' => '',
327
+ 'class' => '',
328
+ 'container_classes' => 'then then_slideshow',
329
+ 'id' => '',
330
+ 'field_action_before' => '',
331
+ 'field_action_after' => ''
332
+ ),
333
+ 'field_slideshow_behavior' => array(
334
+ 'label' => esc_html__( 'Behavior', 'strong-testimonials' ),
335
+ 'type' => 'slideshow-behavior',
336
+ 'before' => '',
337
+ 'after' => '',
338
+ 'class' => '',
339
+ 'container_classes' => 'then then_slideshow',
340
+ 'id' => '',
341
+ 'field_action_before' => '',
342
+ 'field_action_after' => ''
343
+ ),
344
+ 'field_slideshow_navigation' => array(
345
+ 'label' => esc_html__( 'Navigation', 'strong-testimonials' ),
346
+ 'type' => 'slideshow-navigation',
347
+ 'before' => '',
348
+ 'after' => '',
349
+ 'class' => 'view-slideshow_nav',
350
+ 'container_classes' => 'then then_slideshow',
351
+ 'id' => '',
352
+ 'field_action_before' => '',
353
+ 'field_action_after' => ''
354
+ )
355
+ )
356
+ ),
357
+
358
+ 'form' => array(
359
+ 'section_action_before' => 'wpmtst_view_editor_before_group_form',
360
+ 'section_action_after' => '',
361
+ 'fields_action_before' => '',
362
+ 'fields_action_after' => '',
363
+ 'classes' => array(
364
+ 'then',
365
+ 'then_not_display',
366
+ 'then_not_slideshow',
367
+ 'then_form',
368
+ 'then_not_single_template'
369
+ ),
370
+ 'title' => esc_html__( 'Actions', 'strong-testimonials' ),
371
+ 'table_classes' => 'form-table multiple group-select',
372
+ 'fields' => array(
373
+ 'field_form_category' => array(
374
+ 'label' => esc_html__( 'Assign to a category', 'strong-testimonials' ),
375
+ 'type' => 'form-category',
376
+ 'before' => '',
377
+ 'after' => '',
378
+ 'class' => '',
379
+ 'container_classes' => 'then then_form',
380
+ 'id' => '',
381
+ 'field_action_before' => '',
382
+ 'field_action_after' => ''
383
+ ),
384
+ 'field_form_ajax' => array(
385
+ 'label' => esc_html__( ' Submit form without reloading the page (Ajax)', 'strong-testimonials' ),
386
+ 'type' => 'form-ajax',
387
+ 'before' => '<input type="checkbox" id="view-form_ajax" class="checkbox if toggle" name="view[data][form_ajax]" value="1"' . checked( $this->view['form_ajax'], true, false ) . '>',
388
+ 'after' => '',
389
+ 'class' => 'view-form_ajax',
390
+ 'container_classes' => 'then then_form',
391
+ 'id' => '',
392
+ 'field_action_before' => '',
393
+ 'field_action_after' => ''
394
+ ),
395
+ )
396
+ ),
397
+
398
+ 'style' => array(
399
+ 'section_action_before' => 'wpmtst_view_editor_before_group_style',
400
+ 'section_action_after' => 'wpmtst_after_style_view_section',
401
+ 'fields_action_before' => '',
402
+ 'fields_action_after' => array(
403
+ 'action' => 'wpmtst_view_editor_after_style_section',
404
+ 'param' => ''
405
+ ),
406
+ 'classes' => array(
407
+ 'then',
408
+ 'then_display',
409
+ 'then_form',
410
+ 'then_slideshow',
411
+ 'then_not_single_template'
412
+ ),
413
+ 'title' => esc_html__( 'Style', 'strong-testimonials' ),
414
+ 'table_classes' => 'form-table multiple group-style',
415
+ 'fields' => array(
416
+ 'field_template_list_display' => array(
417
+ 'label' => esc_html__( 'Template', 'strong-testimonials' ),
418
+ 'type' => 'template-list-display',
419
+ 'before' => '',
420
+ 'after' => '',
421
+ 'class' => '',
422
+ 'container_classes' => 'then then_display then_not_form then_slideshow',
423
+ 'id' => '',
424
+ 'field_action_before' => 'wpmtst_view_editor_before_template_list',
425
+ 'field_action_after' => ''
426
+ ),
427
+ 'field_template_list_form' => array(
428
+ 'label' => esc_html__( 'Template', 'strong-testimonials' ),
429
+ 'type' => 'template-list-form',
430
+ 'before' => '',
431
+ 'after' => '',
432
+ 'class' => '',
433
+ 'container_classes' => 'then then_not_display then_form then_not_slideshow',
434
+ 'id' => '',
435
+ 'field_action_before' => '',
436
+ 'field_action_after' => ''
437
+ ),
438
+ 'field_option_layout' => array(
439
+ 'include' => 'option-layout.php',
440
+ 'label' => esc_html__( 'Layout', 'strong-testimonials' ),
441
+ 'type' => 'layout',
442
+ 'before' => '',
443
+ 'after' => '',
444
+ 'class' => '',
445
+ 'container_classes' => 'then then_display then_not_form then_not_slideshow',
446
+ 'id' => '',
447
+ 'field_action_before' => 'wpmtst_view_editor_before_layout',
448
+ 'field_action_after' => ''
449
+ ),
450
+ 'field_background' => array(
451
+ 'label' => esc_html__( 'Background', 'strong-testimonials' ),
452
+ 'type' => 'background',
453
+ 'before' => '',
454
+ 'after' => '',
455
+ 'class' => '',
456
+ 'id' => 'group-style-option-background',
457
+ 'container_classes' => 'then then_display then_form then_slideshow',
458
+ 'field_action_before' => 'wpmtst_view_editor_before_background',
459
+ 'field_action_after' => ''
460
+ ),
461
+ 'field_color' => array(
462
+ 'label' => esc_html__( 'Font Color', 'strong-testimonials' ),
463
+ 'type' => 'color',
464
+ 'before' => '',
465
+ 'after' => '',
466
+ 'class' => '',
467
+ 'id' => 'group-style-option-color',
468
+ 'container_classes' => 'then then_display then_form then_slideshow',
469
+ 'field_action_before' => '',
470
+ 'field_action_after' => ''
471
+ ),
472
+ 'field_classes' => array(
473
+ 'label' => esc_html__( 'CSS Classes', 'strong-testimonials' ),
474
+ 'type' => 'classes',
475
+ 'before' => '',
476
+ 'after' => '',
477
+ 'class' => 'view-class',
478
+ 'id' => '',
479
+ 'container_classes' => 'then then_display then_form then_slideshow',
480
+ 'field_action_before' => 'wpmtst_view_editor_before_classes',
481
+ 'field_action_after' => ''
482
+ ),
483
+ )
484
+ ),
485
+
486
+ 'compat' => array(
487
+ 'section_action_before' => 'wpmtst_view_editor_before_group_compat',
488
+ 'section_action_after' => '',
489
+ 'fields_action_before' => '',
490
+ 'fields_action_after' => '',
491
+ 'classes' => array( 'then' ),
492
+ 'title' => esc_html__( 'Compatibility', 'strong-testimonials' ),
493
+ 'table_classes' => 'form-table multiple group-general',
494
+ 'fields' => array(
495
+ 'field_divi_builder' => array(
496
+ 'label' => esc_html__( 'Divi Builder', 'strong-testimonials' ),
497
+ 'type' => 'divi',
498
+ 'before' => '',
499
+ 'after' => '',
500
+ 'class' => 'view-divi_builder',
501
+ 'container_classes' => 'then then_display then_form then_slideshow then_not_single_template',
502
+ 'id' => '',
503
+ 'field_action_before' => '',
504
+ 'field_action_after' => ''
505
+ ),
506
+ )
507
+ ),
508
+ ) );
509
+ }
510
+
511
+ /**
512
+ * Render Strong Testimonials form
513
+ *
514
+ * @since 2.51.5
515
+ */
516
+ public function render_form() {
517
+
518
+ $actions = array( 'edit', 'duplicate', 'add' );
519
+
520
+ if ( ! in_array( $this->action, $actions ) ) {
521
+ wp_die( esc_html__( 'Invalid request. Please try again.', 'strong-testimonials' ) );
522
+ }
523
+
524
+ if ( ( 'edit' == $this->action || 'duplicate' == $this->action ) && ! $this->view_id ) {
525
+ return;
526
+ }
527
+
528
+ $this->set_view();
529
+ add_thickbox();
530
+
531
+ // @todo: these don't seem to be used anywhere
532
+ $fields = wpmtst_get_custom_fields();
533
+ $all_fields = wpmtst_get_all_fields();
534
+
535
+ /**
536
+ * Show category filter if necessary.
537
+ *
538
+ * @since 2.2.0
539
+ */
540
+ if ( $this->cat_count > 5 ) {
541
+ wp_enqueue_script( 'wpmtst-view-category-filter-script' );
542
+ }
543
+
544
+ // Select default template if necessary
545
+ if ( ! $this->view['template'] ) {
546
+ if ( 'form' == $this->view['mode'] ) {
547
+ $this->view['template'] = 'default-form';
548
+ } else {
549
+ $this->view['template'] = 'default';
550
+ }
551
+ }
552
+
553
+ // Get urls
554
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' );
555
+ $url1 = $url . '&action=add';
556
+ $url2 = $url . '&action=duplicate&id=' . $this->view_id;
557
+
558
+ ?>
559
+ <h1>
560
+ <?php 'edit' == $this->action ? esc_html_e( 'Edit View', 'strong-testimonials' ) : esc_html_e( 'Add View', 'strong-testimonials' ); ?>
561
+ <a href="<?php echo esc_url( $url1 ); ?>"
562
+ class="add-new-h2"><?php esc_html_e( 'Add New', 'strong-testimonials' ); ?></a>
563
+ <a href="<?php echo esc_url( $url ); ?>"
564
+ class="add-new-h2"><?php esc_html_e( 'Return To List', 'strong-testimonials' ); ?></a>
565
+ <?php if ( 'edit' == $this->action ) : ?>
566
+ <a href="<?php echo esc_url( $url2 ); ?>"
567
+ class="add-new-h2"><?php esc_html_e( 'Duplicate This View', 'strong-testimonials' ); ?></a>
568
+ <?php endif; ?>
569
+ </h1>
570
+
571
+ <form id="wpmtst-views-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"
572
+ autocomplete="off" enctype="multipart/form-data">
573
+ <?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
574
+
575
+ <input type="hidden" name="action" value="view_<?php echo esc_attr( $this->action ); ?>_form">
576
+ <input type="hidden" name="view[id]" value="<?php echo esc_attr( $this->view_id ); ?>">
577
+ <input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $this->view['mode'] ); ?>">
578
+ <input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $this->view['form_id'] ); ?>">
579
+
580
+ <div class="table view-info">
581
+ <?php $this->render_info(); ?>
582
+ </div>
583
+
584
+ <?php $this->render_sections(); ?>
585
+
586
+ <p class="wpmtst-submit">
587
+ <?php submit_button( '', 'primary', 'submit-form', false ); ?>
588
+ <?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?>
589
+ <?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?>
590
+ </p>
591
+ </form>
592
+ <?php
593
+ }
594
+
595
+ /**
596
+ * Render Strong Testimonials view info
597
+ *
598
+ * @since 2.51.5
599
+ */
600
+ private function render_info() {
601
+
602
+ if ( 'edit' == $this->action ) {
603
+ $shortcode = '<div class="saved">';
604
+ $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $this->view_id ) . '&quot;]" readonly />';
605
+ $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
606
+ $shortcode .= '<span id="copy-message">' . esc_html__( 'copied', 'strong-testimonials' ) . '</span>';
607
+ $shortcode .= '</div>';
608
+ } else {
609
+ $shortcode = '<div class="unsaved">' . esc_html_x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
610
+ }
611
+
612
+ $classes = array(
613
+ 'then',
614
+ 'then_display',
615
+ 'then_form',
616
+ 'then_slideshow',
617
+ 'then_not_single_template',
618
+ apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
619
+ ); ?>
620
+
621
+ <div class="table-row form-view-name">
622
+ <div class="table-cell">
623
+ <label for="view-name">
624
+ <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
625
+ </label>
626
+ </div>
627
+ <div class="table-cell">
628
+ <input type="text" id="view-name" class="view-name" name="view[name]"
629
+ value="<?php echo esc_attr( htmlspecialchars( stripslashes( $this->view_name ) ) ); ?>"
630
+ tabindex="1">
631
+ </div>
632
+ </div>
633
+
634
+ <div class="table-row form-view-shortcode <?php echo esc_attr( implode( ' ', array_filter( $classes ) ) ); ?>">
635
+ <div class="table-cell">
636
+ <label for="view-shortcode"><?php esc_html_e( 'Shortcode', 'strong-testimonials' ); ?></label>
637
+ </div>
638
+ <div class="table-cell">
639
+ <?php echo $shortcode; ?>
640
+ </div>
641
+ </div>
642
+
643
+ <div id="view-mode" class="table-row mode-select">
644
+ <div class="table-cell">
645
+ <?php esc_html_e( 'Mode', 'strong-testimonials' ); ?>
646
+ </div>
647
+ <div class="table-cell">
648
+ <div class="mode-list">
649
+ <?php foreach ( $this->view_options['mode'] as $mode ) : ?>
650
+ <label>
651
+ <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
652
+ value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $this->view['mode'], $mode['name'] ); ?>>
653
+ <?php echo esc_html( $mode['label'] ); ?>
654
+ <div class="mode-line"></div>
655
+ </label>
656
+ <?php endforeach; ?>
657
+ </div>
658
+ <div class="mode-description"></div>
659
+ </div>
660
+ </div><?php
661
+ }
662
+
663
+ /**
664
+ * Render Strong Testimonials view sections
665
+ *
666
+ * @since 2.51.5
667
+ */
668
+ private function render_sections() {
669
+
670
+ // @todo: check what `$show_section = apply_filters('wpmtst_show_section', $this->view['mode']);` does
671
+ // @todo: seems like the same filter is used above for $this->show_sections
672
+ $show_section = apply_filters( 'wpmtst_show_section', $this->view['mode'] );
673
+ foreach ( $this->sections as $name => $section ) {
674
+ if ( ! empty( $section['section_action_before'] ) ) {
675
+ do_action( $section['section_action_before'] );
676
+ }
677
+
678
+ $this->render_section( $name, $section );
679
+
680
+ if ( ! empty( $section['section_action_after'] ) ) {
681
+ do_action( $section['section_action_after'] );
682
+ }
683
+ }
684
+
685
+ do_action( 'wpmtst_view_editor_before_group_general' );
686
+ do_action( 'wpmtst_view_editor_after_groups' );
687
+ }
688
+
689
+ /**
690
+ * Render Strong Testimonial section
691
+ *
692
+ * @param $name
693
+ * @param $section
694
+ *
695
+ * @since 2.51.5
696
+ */
697
+ public function render_section( $name, $section ) {
698
+
699
+ $section['classes'][] = apply_filters( 'wpmtst_view_section', '', $name ); ?>
700
+ <div class="<?php echo esc_attr( implode( ' ', array_filter( $section['classes'] ) ) ); ?>"
701
+ style="display:none">
702
+ <h3><?php echo esc_html( $section['title'] ) ?></h3>
703
+ <table class="<?php echo esc_attr( $section['table_classes'] ) ?>">
704
+
705
+ <?php if ( ! empty( $section['subheading'] ) ): ?>
706
+ <tr class="subheading">
707
+ <?php foreach ( $section['subheading'] as $subheading ): ?>
708
+ <td class="<?php echo esc_attr( $subheading['classes'] ) ?>"
709
+ colspan="<?php echo esc_attr( $subheading['colspan'] ) ?>">
710
+ <?php echo esc_html( $subheading['title'] ) ?>
711
+ <?php echo wp_kses_post( $subheading['after'] ) ?>
712
+ </td>
713
+ <?php endforeach; ?>
714
+ </tr>
715
+ <?php endif;
716
+
717
+ if ( ! empty( $section['fields'] ) ) {
718
+ if ( ! empty( $section['fields_action_before'] ) ) {
719
+ do_action( $section['fields_action_before']['action'], $section['fields_action_before']['param'] );
720
+ }
721
+ foreach ( $section['fields'] as $key => $field ) {
722
+ $this->set_field( $field );
723
+ if ( ! empty( $this->field['field_action_before'] ) ) {
724
+ do_action( $field['field_action_before'] );
725
+ } ?>
726
+ <tr id="<?php echo esc_attr( $this->field['id'] ) ?>"
727
+ class="<?php echo esc_attr( $this->field['container_classes'] ) ?>" style="display:none">
728
+ <?php $this->render_field() ?>
729
+ </tr>
730
+ <?php
731
+ if ( ! empty( $this->field['field_action_after'] ) ) {
732
+ do_action( $field['field_action_after'] );
733
+ }
734
+ }
735
+ if ( ! empty( $section['fields_action_after'] ) ) {
736
+ do_action( $section['fields_action_after']['action'], $section['fields_action_after']['param'] );
737
+ }
738
+ }
739
+ ?>
740
+ </table>
741
+ </div>
742
+ <?php
743
+ }
744
+
745
+ /**
746
+ * Set Strong Testimonial field
747
+ *
748
+ * @param $field
749
+ *
750
+ * @since 2.51.5
751
+ */
752
+ public function set_field( $field ) {
753
+
754
+ $this->field = $field;
755
+ }
756
+
757
+ /**
758
+ * Set Strong Testimonial settings field
759
+ *
760
+ * @param $field
761
+ *
762
+ * @since 2.51.5
763
+ */
764
+ public function set_settings_field( $field ) {
765
+
766
+ $this->field = $field;
767
+ $this->isSetting = true;
768
+ }
769
+
770
+ /**
771
+ * Render Strong Testimonial field
772
+ *
773
+ * @since 2.51.5
774
+ */
775
+ public function render_field() { ?>
776
+
777
+ <th>
778
+ <?php echo wp_kses_post( $this->field['before'] ); ?>
779
+ <label for="<?php echo esc_attr( $this->field['class'] ) ?>"><?php echo wp_kses_post( $this->field['label'] ); ?></label>
780
+ <?php echo wp_kses_post( $this->field['after'] ); ?>
781
+ </th> <?php
782
+ switch ( $this->field['type'] ) {
783
+ case 'select':
784
+ $this->render_field_select();
785
+ break;
786
+ case 'category':
787
+ $this->render_field_category();
788
+ break;
789
+ case 'order':
790
+ $this->render_field_order();
791
+ break;
792
+ case 'limit':
793
+ $this->render_field_limit();
794
+ break;
795
+ case 'title':
796
+ $this->render_field_title();
797
+ break;
798
+ case 'thumbnail':
799
+ $this->render_field_thumbnail();
800
+ break;
801
+ case 'content':
802
+ $this->render_field_content();
803
+ break;
804
+ case 'client-section':
805
+ $this->render_field_client_section();
806
+ break;
807
+ case 'pagination':
808
+ $this->render_field_pagination();
809
+ break;
810
+ case 'read-more-page':
811
+ $this->render_field_read_more_page();
812
+ break;
813
+ case 'slideshow-num':
814
+ $this->render_field_slideshow_num();
815
+ break;
816
+ case 'slideshow-transition':
817
+ $this->render_field_slideshow_transition();
818
+ break;
819
+ case 'slideshow-behavior':
820
+ $this->render_field_slideshow_behavior();
821
+ break;
822
+ case 'slideshow-navigation':
823
+ $this->render_field_slideshow_navigation();
824
+ break;
825
+ case 'form-category':
826
+ $this->render_field_form_category();
827
+ break;
828
+ case 'form-ajax':
829
+ $this->render_field_form_ajax();
830
+ break;
831
+ case 'template-list-display':
832
+ $this->current_mode = 'template';
833
+ $this->current_type = 'display';
834
+ $this->render_field_template_list();
835
+ break;
836
+ case 'template-list-form':
837
+ $this->current_mode = 'form-template';
838
+ $this->current_type = 'form';
839
+ $this->render_field_template_list();
840
+ break;
841
+ case 'layout':
842
+ $this->render_field_layout();
843
+ break;
844
+ case 'background':
845
+ $this->render_field_background();
846
+ break;
847
+ case 'color':
848
+ $this->render_field_color();
849
+ break;
850
+ case 'classes':
851
+ $this->render_field_classes();
852
+ break;
853
+ case 'divi':
854
+ $this->render_field_divi();
855
+ break;
856
+ default:
857
+ do_action( 'wpmtst_render_field', $this->field );
858
+ }
859
+ }
860
+
861
+ /**
862
+ * Render ST select
863
+ *
864
+ * @param $input_name
865
+ * @param false $recommended
866
+ * @param string $title
867
+ *
868
+ * @since 2.51.5
869
+ */
870
+ public function render_option_select( $input_name, $recommended = false, $title = '' ) {
871
+
872
+ $selected = $this->field['selected'];
873
+
874
+ if ( $this->isSetting ) {
875
+ $selected = $this->field['selected_settings'];
876
+ }
877
+
878
+ if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ): ?>
879
+ <td>
880
+
881
+ <?php if ( ! empty( $title ) ): ?>
882
+ <h4 class="title"><?php esc_html_e( $title ); ?>
883
+ <h4>
884
+ <?php endif; ?>
885
+ <select id="<?php echo esc_attr( $this->field['class'] ) ?>"
886
+ name="<?php echo esc_attr( $input_name ); ?>">
887
+ <?php foreach ( $this->field['options'] as $option ): ?>
888
+ <option value="<?php echo esc_attr( $option ); ?>" <?php selected( $option, $selected ); ?>><?php esc_html_e( $option, 'strong-testimonials-review-markup' ); ?></option>
889
+ <?php endforeach; ?>
890
+ </select>
891
+ <?php if ( $recommended ): ?>
892
+ <p class="description"><strong
893
+ style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials-review-markup' ) ?></strong>
894
+ <?php if ( is_string( $recommended ) ) {
895
+ echo esc_html( $recommended );
896
+ } ?>
897
+ </p>
898
+ <?php endif; ?>
899
+
900
+ </td>
901
+ <?php endif;
902
+ }
903
+
904
+ /**
905
+ * Render ST textfield
906
+ *
907
+ * @param $input_name
908
+ * @param false $recommended
909
+ * @param string $description
910
+ * @param string $title
911
+ * @param string $placeholder
912
+ *
913
+ * @SINCE 2.51.5
914
+ */
915
+ public function render_option_textfield( $input_name, $recommended = false, $description = '', $title = '', $placeholder = '' ) {
916
+
917
+ $value = $this->field['value'];
918
+
919
+ if ( $this->isSetting ) {
920
+ $value = $this->field['value_settings'];
921
+ } ?>
922
+
923
+ <td>
924
+ <?php if ( ! empty( $title ) ): ?>
925
+ <h4 class="title"><?php esc_html_e( $title ); ?>
926
+ <h4>
927
+ <?php endif; ?>
928
+
929
+ <div>
930
+ <div class="has-input">
931
+ <input class="regular-text" type="text" id="<?php echo esc_attr( $this->field['class'] ) ?>"
932
+ name="<?php echo esc_attr( $input_name ) ?>" value="<?php echo esc_attr( $value ) ?>"
933
+ data-default="<?php echo esc_attr( $this->field['default'] ) ?>"
934
+ placeholder="<?php echo esc_attr( $placeholder, 'strong-testimonials-review-markup' ) ?>">
935
+ </div>
936
+ <div class="error-message"></div>
937
+ </div>
938
+ <p class="description">
939
+
940
+ <?php if ( $recommended ): ?>
941
+ <strong style="color: #00805e; font-style: normal;"><?php esc_html_e( 'Recommended.', 'strong-testimonials-review-markup' ) ?></strong>
942
+ <?php endif; ?>
943
+
944
+ <?php if ( ! empty( $description ) ): ?>
945
+ <?php esc_html_e( $description, 'strong-testimonials-review-markup' ); ?>
946
+ <?php endif; ?>
947
+
948
+ </p>
949
+ </td>
950
+ <?php
951
+ }
952
+
953
+ /**
954
+ * Render ST select
955
+ *
956
+ * @since 2.51.5
957
+ */
958
+ private function render_field_select() {
959
+
960
+ $testimonials_list = get_posts( array(
961
+ 'orderby' => 'post_date',
962
+ 'order' => 'ASC',
963
+ 'post_type' => 'wpm-testimonial',
964
+ 'post_status' => 'publish',
965
+ 'posts_per_page' => - 1,
966
+ 'suppress_filters' => true,
967
+ ) ); ?>
968
+ <td>
969
+ <div class="row">
970
+ <div class="row-inner">
971
+ <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
972
+ <option value="multiple" <?php echo (int) $this->view['id'] == 0 ? 'selected' : ''; ?>><?php esc_html_e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
973
+ <option value="single" <?php echo (int) $this->view['id'] >= 1 ? 'selected' : ''; ?>><?php esc_html_e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
974
+ </select>
975
+ </div>
976
+ </div>
977
+
978
+ <div class="row">
979
+ <div class="then then_not_slideshow then_single then_not_multiple" style="display: none;">
980
+ <div class="row-inner">
981
+ <label>
982
+ <select id="view-id" name="view[data][id]">
983
+ <option value="0"><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
984
+ <?php foreach ( $testimonials_list as $post ) : ?>
985
+ <option value="<?php echo esc_attr( $post->ID ); ?>" <?php selected( $this->view['id'], $post->ID ); ?>>
986
+ <?php echo $post->post_title ? esc_html( $post->post_title ) : __( '(untitled)', 'strong-testimonials' ); ?>
987
+ </option>
988
+ <?php endforeach; ?>
989
+ </select>
990
+ </label>
991
+ </div>
992
+ <div class="row-inner">
993
+ <label for="view-post_id">
994
+ <?php _ex( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
995
+ </label>
996
+ <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
997
+ </div>
998
+ </div>
999
+ </div>
1000
+ </td>
1001
+
1002
+ <td class="divider">
1003
+ <p><?php echo wp_kses_post( '<code>post_ids</code>' ); ?></p>
1004
+ </td>
1005
+
1006
+ <td>
1007
+ <p><?php esc_html_e( 'a comma-separated list of post ID\'s', 'strong-testimonials' ); ?></p>
1008
+ </td>
1009
+
1010
+ <td>
1011
+ <p><?php echo wp_kses_post( '<code>post_ids="123,456"</code>' ); ?></p>
1012
+ </td>
1013
+ <?php
1014
+ }
1015
+
1016
+ /**
1017
+ * Render ST category field
1018
+ *
1019
+ * @since 2.51.5
1020
+ */
1021
+ private function render_field_category() {
1022
+
1023
+ if ( $this->cat_count ) : ?>
1024
+ <td>
1025
+ <div id="view-category" class="row">
1026
+ <div class="table inline">
1027
+ <div class="table-row">
1028
+ <div class="table-cell select-cell then_display then_slideshow then_not_form">
1029
+ <select id="view-category-select" class="if selectper" name="view[data][category_all]">
1030
+ <option value="allcats" <?php selected( $this->view['category'], 'all' ); ?>><?php esc_html_e( 'all', 'strong-testimonials' ); ?></option>
1031
+ <option value="somecats" <?php echo( 'all' != $this->view['category'] ? 'selected' : '' ); ?>><?php _ex( 'select', 'verb', 'strong-testimonials' ); ?></option>
1032
+ </select>
1033
+ </div>
1034
+ <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
1035
+ <div class="table">
1036
+ <?php if ( $this->cat_count > 5 ) : ?>
1037
+ <div class="table-row">
1038
+ <div class="table-cell">
1039
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
1040
+ <input type="button" class="expand-cats button"
1041
+ value="expand list"/>
1042
+ </div>
1043
+ </div>
1044
+ </div>
1045
+ <?php endif; ?>
1046
+ <div class="table-row">
1047
+ <div class="table-cell"><?php wpmtst_category_checklist( $this->view_cats_array ); ?></div>
1048
+ </div>
1049
+ </div>
1050
+ </div>
1051
+ </div>
1052
+ </div>
1053
+ </div>
1054
+ </td>
1055
+ <?php else : ?>
1056
+ <td>
1057
+ <div id="view-category" class="row">
1058
+ <input type="hidden" name="view[data][category_all]" value="all">
1059
+ <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
1060
+ </div>
1061
+ </td>
1062
+ <?php endif; ?>
1063
+
1064
+ <td class="divider">
1065
+ <p><?php echo wp_kses_post( '<code>category</code>' ); ?></p>
1066
+ </td>
1067
+ <td>
1068
+ <p><?php esc_html_e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
1069
+ </td>
1070
+ <td>
1071
+ <p><?php echo wp_kses_post( '<code>category="accounting"</code>' ); ?></p>
1072
+ </td><?php
1073
+ }
1074
+
1075
+ /**
1076
+ * Render ST order field
1077
+ *
1078
+ * @since 2.51.5
1079
+ */
1080
+ private function render_field_order() {
1081
+
1082
+ ?>
1083
+ <td>
1084
+ <div class="row">
1085
+ <div class="inline">
1086
+ <select id="view-order" name="view[data][order]">
1087
+ <?php foreach ( $this->view_options['order'] as $order => $order_label ) : ?>
1088
+ <option value="<?php echo esc_attr( $order ); ?>" <?php selected( $order, $this->view['order'] ); ?>><?php echo esc_html( $order_label ); ?></option>
1089
+ <?php endforeach; ?>
1090
+ </select>
1091
+ </div>
1092
+ </div>
1093
+ </td>
1094
+ <td class="divider">
1095
+ <p><?php echo wp_kses_post( '<code>order</code>' ); ?></p>
1096
+ </td>
1097
+ <td>
1098
+ <p><?php echo wp_kses_post( 'oldest | newest | random | menu_order' ); ?></p>
1099
+ </td>
1100
+ <td>
1101
+ <p><?php echo wp_kses_post( '<code>order="random"</code>' ); ?></p>
1102
+ </td> <?php
1103
+ }
1104
+
1105
+ /**
1106
+ * Render ST limit fied
1107
+ *
1108
+ * @since 2.51.5
1109
+ */
1110
+ private function render_field_limit() {
1111
+
1112
+ ?>
1113
+ <td>
1114
+ <div class="row">
1115
+ <div class="inline">
1116
+ <select class="if select" id="view-all" name="view[data][all]">
1117
+ <option value="1" <?php selected( - 1, $this->view['count'] ); ?>>
1118
+ <?php esc_html_e( 'all', 'strong-testimonials' ); ?>
1119
+ </option>
1120
+ <option class="trip" value="0" <?php selected( $this->view['count'] > 0 ); ?>>
1121
+ <?php _ex( 'count', 'noun', 'strong-testimonials' ); ?>
1122
+ </option>
1123
+ </select>
1124
+ &nbsp;
1125
+ <label><input class="input-incremental then_all" type="number" id="view-count"
1126
+ name="view[data][count]"
1127
+ value="<?php echo ( - 1 == $this->view['count'] ) ? 1 : esc_attr( $this->view['count'] ); ?>"
1128
+ min="1" size="5" style="display: none;"></label>
1129
+ </div>
1130
+ </div>
1131
+ </td>
1132
+ <td class="divider">
1133
+ <p><?php echo wp_kses_post( '<code>count</code>' ); ?></p>
1134
+ </td>
1135
+ <td></td>
1136
+ <td>
1137
+ <p><?php echo wp_kses_post( '<code>count=5</code>' ); ?></p>
1138
+ </td>
1139
+ <?php
1140
+ }
1141
+
1142
+ /**
1143
+ * Render ST title field
1144
+ *
1145
+ * @since 2.51.5
1146
+ */
1147
+ private function render_field_title() {
1148
+
1149
+ $custom_fields = wpmtst_get_custom_fields();
1150
+ $options = get_option( 'wpmtst_options' );
1151
+ $url_fields = array();
1152
+
1153
+ foreach ( $custom_fields as $field ) {
1154
+ if ( 'url' == $field['input_type'] ) {
1155
+ $url_fields[] = $field;
1156
+ }
1157
+ }
1158
+
1159
+ // For older versions where title_link was checkbox
1160
+ if ( '1' == $this->view['title_link'] ) {
1161
+ $this->view['title_link'] = 'wpmtst_testimonial';
1162
+ }
1163
+
1164
+ if ( '0' == $this->view['title_link'] ) {
1165
+ $this->view['title_link'] = 'none';
1166
+ } ?>
1167
+
1168
+ <td colspan="2">
1169
+ <div class="row">
1170
+ <div class="row-inner">
1171
+ <div class="then then_title" style="display: none;">
1172
+ <label for="view-title_link">
1173
+ <?php printf( esc_html_x( 'Link to %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
1174
+ </label>
1175
+ <div class="wpmtst-tooltip"><span>[?]</span>
1176
+ <div class="wpmtst-tooltip-content"><?php echo esc_html__( '"Full testimonial" option doesn\'s work if "Disable permalinks for testimonials" from "Settings" page is enabled.', 'strong-testimonials' ); ?></div>
1177
+ </div>
1178
+
1179
+ <select name="view[data][title_link]">
1180
+ <option value="none" <?php selected( 'none', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'None', 'strong-testimonials' ); ?></option>
1181
+ <?php if ( ! isset( $options['disable_rewrite'] ) || '1' != $options['disable_rewrite'] ) { ?>
1182
+ <option value="wpmtst_testimonial" <?php selected( 'wpmtst_testimonial', $this->view['title_link'], true ); ?>><?php echo esc_html__( 'Full testimonial', 'strong-testimonials' ); ?></option>
1183
+ <?php } ?>
1184
+
1185
+ <?php foreach ( $url_fields as $url ) { ?>
1186
+ <option value="<?php echo esc_attr( $url['name'] ); ?>" <?php selected( $url['name'], $this->view['title_link'] ); ?>><?php echo esc_html( $url['label'] ); ?></option>
1187
+ <?php } ?>
1188
+
1189
+ </select>
1190
+ <?php do_action( 'wpmtst_view_editor_after_group_fields_title' ) ?>
1191
+ </div>
1192
+ </div>
1193
+ </div>
1194
+ </td>
1195
+ <?php
1196
+ }
1197
+
1198
+ /**
1199
+ * Render ST thumbnail field
1200
+ *
1201
+ * @since 2.51.5
1202
+ */
1203
+ private function render_field_thumbnail() {
1204
+
1205
+ $image_sizes = wpmtst_get_image_sizes();
1206
+ ?>
1207
+ <td colspan="2">
1208
+ <div class="then then_images" style="display: none;">
1209
+ <div class="row">
1210
+ <div class="row-inner">
1211
+ <div class="inline">
1212
+ <label for="view-thumbnail_size">Size</label>
1213
+ <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
1214
+ <?php foreach ( $image_sizes as $key => $size ) : ?>
1215
+ <option class="<?php echo( 'custom' == $key ? 'trip' : '' ) ?>"
1216
+ value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $this->view['thumbnail_size'] ); ?>><?php echo esc_html( $size['label'] ); ?></option>
1217
+ <?php endforeach; ?>
1218
+ </select>
1219
+ </div>
1220
+ <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
1221
+ <label for="thumbnail_width"><?php esc_html_e( 'width', 'strong-testimonials' ); ?></label>
1222
+ <input id="thumbnail_width" class="input-number-px" type="text"
1223
+ name="view[data][thumbnail_width]"
1224
+ value="<?php echo esc_attr( $this->view['thumbnail_width'] ); ?>"> px
1225
+ <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
1226
+ <label for="thumbnail_height"><?php esc_html_e( 'height', 'strong-testimonials' ); ?></label>
1227
+ <input id="thumbnail_height" class="input-number-px" type="text"
1228
+ name="view[data][thumbnail_height]"
1229
+ value="<?php echo esc_attr( $this->view['thumbnail_height'] ); ?>"> px
1230
+ </div>
1231
+ </div>
1232
+ </div>
1233
+ <div class="row">
1234
+ <div class="row-inner">
1235
+ <div class="inline">
1236
+ <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
1237
+ value="1" <?php checked( $this->view['lightbox'] ); ?> class="checkbox">
1238
+ <label for="view-lightbox"><?php esc_html_e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?></label>
1239
+ </div>
1240
+ <div class="inline then then_lightbox">
1241
+ <p class="description"><?php esc_html_e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
1242
+ </div>
1243
+ </div>
1244
+ </div>
1245
+
1246
+ <div class="row">
1247
+ <div class="row-inner">
1248
+ <div class="inline then then_lightbox input" style="display: none;">
1249
+ <label for="view-lightbox_class"><?php esc_html_e( 'CSS class', 'strong-testimonials' ); ?></label>
1250
+ <input type="text" id="view-lightbox_class" class="medium inline"
1251
+ name="view[data][lightbox_class]"
1252
+ value="<?php echo esc_attr( $this->view['lightbox_class'] ); ?>">
1253
+ <p class="inline description tall"><?php esc_html_e( 'To add a class to the image link.', 'strong-testimonials' ); ?></p>
1254
+ </div>
1255
+ </div>
1256
+ </div>
1257
+ <div class="row">
1258
+ <div class="row-inner">
1259
+ <div class="inline">
1260
+ <label for="view-gravatar"><?php esc_html_e( 'If no Featured Image', 'strong-testimonials' ); ?></label>
1261
+ <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
1262
+ <option value="no" <?php selected( $this->view['gravatar'], 'no' ); ?>><?php esc_html_e( 'show nothing', 'strong-testimonials' ); ?></option>
1263
+ <option value="yes" <?php selected( $this->view['gravatar'], 'yes' ); ?>><?php esc_html_e( 'show Gravatar', 'strong-testimonials' ); ?></option>
1264
+ <option value="if" <?php selected( $this->view['gravatar'], 'if' ); ?>><?php esc_html_e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
1265
+ <?php do_action( 'wpmtst_avatar_options', $this->view ) ?>
1266
+ </select>
1267
+ </div>
1268
+ <div class="inline">
1269
+ <div class="then fast then_not_no then_not_default then_not_initials then_not_wp_avatars then_yes then_if"
1270
+ style="display: none;">
1271
+ <p class="description tall"><a
1272
+ href="<?php echo esc_url( admin_url( 'options-discussion.php' ) ); ?>"><?php esc_html_e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
1273
+ </p>
1274
+ </div>
1275
+ </div>
1276
+ <?php do_action( 'after_no_featured_image', $this->view ) ?>
1277
+ </div>
1278
+ </div>
1279
+ </div><!-- .then_images -->
1280
+ </td>
1281
+ <?php
1282
+ }
1283
+
1284
+ /**
1285
+ * Render ST content field
1286
+ *
1287
+ * @since 2.51.5
1288
+ */
1289
+ private function render_field_content() {
1290
+
1291
+ ?>
1292
+ <td colspan="2">
1293
+ <!-- Content type -->
1294
+ <div id="option-content" class="row">
1295
+ <div class="row-inner">
1296
+ <!-- select -->
1297
+ <div class="inline">
1298
+ <select id="view-content" class="if selectper min-width-1 label-not-adjacent"
1299
+ name="view[data][content]">
1300
+ <option value="entire" <?php selected( 'entire', $this->view['content'] ); ?>><?php _ex( 'entire content', 'display setting', 'strong-testimonials' ); ?></option>
1301
+ <option value="truncated" <?php selected( 'truncated', $this->view['content'] ); ?>><?php _ex( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?></option>
1302
+ <option value="excerpt" <?php selected( 'excerpt', $this->view['content'] ); ?>><?php _ex( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?></option>
1303
+ </select>
1304
+ </div>
1305
+ <!-- info & screenshot -->
1306
+ <div class="inline then fast then_truncated then_not_entire then_not_excerpt"
1307
+ style="display: none;">
1308
+ <p class="description"><?php esc_html_e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?></p>
1309
+ </div>
1310
+ <div class="inline then fast then_not_truncated then_not_entire then_excerpt"
1311
+ style="display: none;">
1312
+ <p class="description">
1313
+ <?php printf( __( 'To create manual excerpts, you may need to enable them in the post editor like in this <a href="%s" class="thickbox">screenshot</a>.', 'strong-testimonials' ), esc_url( '#TB_inline?width=&height=210&inlineId=screenshot-screen-options' ) ); ?>
1314
+ <span class="screenshot" id="screenshot-screen-options" style="display: none;"><img
1315
+ src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>img/screen-options.png"
1316
+ width="600"></span>
1317
+ </p>
1318
+ </div>
1319
+ </div>
1320
+ </div>
1321
+ <!-- Excerpt length -->
1322
+ <div id="option-content-length" class="row then then_not_entire then_excerpt then_truncated"
1323
+ style="display: none;">
1324
+ <div class="row-inner">
1325
+ <!-- info -->
1326
+ <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
1327
+ <span><?php esc_html_e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?></span>
1328
+ </div>
1329
+ <!-- default or custom? -->
1330
+ <div class="inline">
1331
+ <label>
1332
+ <select id="view-use_default_length" class="if selectgroup min-width-1"
1333
+ name="view[data][use_default_length]">
1334
+ <option value="1" <?php selected( $this->view['use_default_length'] ); ?>><?php _ex( 'default length', 'display setting', 'strong-testimonials' ); ?></option>
1335
+ <option value="0" <?php selected( ! $this->view['use_default_length'] ); ?>><?php _ex( 'custom length', 'display setting', 'strong-testimonials' ); ?></option>
1336
+ </select>
1337
+ </label>
1338
+ </div>
1339
+ <!-- 1st option: default -->
1340
+ <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
1341
+ <label for="view-use_default_length" class="inline-middle"><p
1342
+ class="description tall"><?php esc_html_e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
1343
+ </label>
1344
+ </div>
1345
+ <!-- 2nd option: length -->
1346
+ <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
1347
+ <label class="inline-middle"><?php printf( esc_html_x( 'the first %s words', 'the excerpt length', 'strong-testimonials' ), '<input id="view-excerpt_length" class="input-incremental" type="number" min="1" max="999" name="view[data][excerpt_length]" value="' . esc_attr( $this->view['excerpt_length'] ) . '">' ); ?></label>
1348
+ </div>
1349
+ </div>
1350
+ </div><!-- #option-content-length -->
1351
+
1352
+ <!-- Read-more link -->
1353
+ <div id="option-content-read-more" class="row then then_not_entire then_excerpt then_truncated"
1354
+ style="display: none;">
1355
+ <div class="row-inner subgroup">
1356
+ <!-- action: full post or in place -->
1357
+ <div class="row-inner">
1358
+ <div class="inline"><?php _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ); ?></div>
1359
+ <div class="inline tight">
1360
+ <label>
1361
+ <select id="view-more_post_in_place" class="if selectgroup"
1362
+ name="view[data][more_post_in_place]">
1363
+ <option value="0" <?php selected( ! $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'the full testimonial', 'strong-testimonials' ); ?></option>
1364
+ <option value="1" <?php selected( $this->view['more_post_in_place'] ); ?>><?php esc_html_e( 'expand content in place', 'strong-testimonials' ); ?></option>
1365
+ </select>
1366
+ </label>
1367
+ </div>
1368
+ </div>
1369
+ <!-- ellipsis -->
1370
+ <div class="row-inner">
1371
+ <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
1372
+ <div class="inline">
1373
+ <label>
1374
+ <select id="view-more_post_ellipsis" class="if selectgroup"
1375
+ name="view[data][more_post_ellipsis]">
1376
+ <option value="1" <?php selected( $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'with an ellipsis', 'strong-testimonials' ); ?></option>
1377
+ <option value="0" <?php selected( ! $this->view['more_post_ellipsis'] ); ?>><?php esc_html_e( 'without an ellipsis', 'strong-testimonials' ); ?></option>
1378
+ </select>
1379
+ </label>
1380
+ </div>
1381
+ <div class="inline then then_excerpt then_not_truncated" style="display: none;">
1382
+ <p class="description"><?php esc_html_e( 'Automatic excerpt only.', 'strong-testimonials' ); ?></p>
1383
+ </div>
1384
+ </div>
1385
+ </div>
1386
+ <!-- default or custom -->
1387
+ <div class="row-inner">
1388
+ <div class="inline tight then fast then_more_post_in_place then_1 then_not_0"
1389
+ style="display: none;">
1390
+ <?php esc_html_e( 'with link text to read more', 'strong-testimonials' ); ?>
1391
+ </div>
1392
+ <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
1393
+ <label>
1394
+ <select id="view-use_default_more" class="if selectgroup min-width-1"
1395
+ name="view[data][use_default_more]">
1396
+ <option value="1" <?php selected( $this->view['use_default_more'] ); ?>><?php _ex( 'with default link text', 'display setting', 'strong-testimonials' ); ?></option>
1397
+ <option value="0" <?php selected( ! $this->view['use_default_more'] ); ?>><?php _ex( 'with custom link text', 'display setting', 'strong-testimonials' ); ?></option>
1398
+ </select>
1399
+ </label>
1400
+ </div>
1401
+ <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
1402
+ <p class="description"><?php esc_html_e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
1403
+ </div>
1404
+ <!-- read more -->
1405
+ <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
1406
+ <span id="option-link-text" class="inline-span">
1407
+ <label for="view-more_post_text">
1408
+ <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
1409
+ value="<?php echo esc_attr( $this->view['more_post_text'] ); ?>" size="22"
1410
+ placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1411
+ </label>
1412
+ </span>
1413
+ </div>
1414
+ </div>
1415
+ <!-- read less -->
1416
+ <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
1417
+ <div class="inline tight">
1418
+ <?php esc_html_e( 'and link text to read less', 'strong-testimonials' ); ?>
1419
+ </div>
1420
+ <div class="inline tight">
1421
+ <span id="option-link-text-less" class="inline-span">
1422
+ <label for="view-less_post_text">
1423
+ <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
1424
+ value="<?php echo esc_attr( $this->view['less_post_text'] ); ?>" size="22"
1425
+ placeholder="<?php esc_html_e( 'enter a phrase', 'strong-testimonials' ); ?>">
1426
+ </label>
1427
+ </span>
1428
+ <p class="inline description"><?php esc_html_e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
1429
+ </div>
1430
+ <div class="html-content-checkbox">
1431
+ <input class="checkbox" id="view-html-content" name="view[data][html_content]" value="1"
1432
+ type="checkbox" <?php checked( $this->view['html_content'] ); ?>/>
1433
+ <label for="view-html-content"><?php _e( 'Show <strong>html content</strong>.', 'strong-testimonials' ); ?></label>
1434
+ </div>
1435
+ </div>
1436
+ <!-- automatic or both -->
1437
+ <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
1438
+ <div class="inline">
1439
+ <label>
1440
+ <select id="view-more_full_post" class="if selectgroup"
1441
+ name="view[data][more_full_post]">
1442
+ <option value="0" <?php selected( $this->view['more_full_post'], 0 ); ?>><?php _ex( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?></option>
1443
+ <option value="1" <?php selected( $this->view['more_full_post'], 1 ); ?>><?php _ex( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?></option>
1444
+ </select>
1445
+ </label>
1446
+ </div>
1447
+ </div>
1448
+ </div>
1449
+ </div>
1450
+ <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
1451
+ <p class="description tall solo"><?php printf( esc_html__( '%s about WordPress excerpts', 'strong-testimonials' ), sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ), esc_html__( 'Learn more', 'strong-testimonials' ) ) ); ?></p>
1452
+ </div>
1453
+ </td>
1454
+ <?php
1455
+ }
1456
+
1457
+ /**
1458
+ * Render ST client field
1459
+ *
1460
+ * @since 2.51.5
1461
+ */
1462
+ private function render_field_client_section() {
1463
+
1464
+ ?>
1465
+ <td colspan="2">
1466
+ <div id="client-section-table">
1467
+ <div id="custom-field-list2" class="fields">
1468
+ <?php
1469
+ if ( isset( $this->view['client_section'] ) ) {
1470
+ foreach ( $this->view['client_section'] as $key => $field ) {
1471
+ wpmtst_view_field_inputs( $key, $field );
1472
+ }
1473
+ }
1474
+ ?>
1475
+ </div>
1476
+ </div>
1477
+ <div id="add-field-bar" class="is-below">
1478
+ <input id="add-field" type="button" name="add-field" source="view[data]"
1479
+ value="<?php esc_html_e( 'Add Field', 'strong-testimonials' ); ?>" class="button-secondary"/>
1480
+ </div>
1481
+ </td>
1482
+ <?php
1483
+ }
1484
+
1485
+ /**
1486
+ * Render ST pagination
1487
+ *
1488
+ * @since 2.51.5
1489
+ */
1490
+ private function render_field_pagination() {
1491
+ /**
1492
+ * Attempt to repair bug from 2.28.2
1493
+ */
1494
+ if ( ! isset( $this->view['pagination_settings']['end_size'] ) || ! $this->view['pagination_settings']['end_size'] ) {
1495
+ $this->view['pagination_settings']['end_size'] = 1;
1496
+ }
1497
+ if ( ! isset( $this->view['pagination_settings']['mid_size'] ) || ! $this->view['pagination_settings']['mid_size'] ) {
1498
+ $this->view['pagination_settings']['mid_size'] = 2;
1499
+ }
1500
+ if ( ! isset( $this->view['pagination_settings']['per_page'] ) || ! $this->view['pagination_settings']['per_page'] ) {
1501
+ $this->view['pagination_settings']['per_page'] = 5;
1502
+ }
1503
+ $links = '<span class="help-links">';
1504
+ $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a>';
1505
+ $links .= '</span>';
1506
+ ?>
1507
+ <td>
1508
+ <div class="row then then_pagination" style="display: none;">
1509
+ <div class="row-inner">
1510
+ <div class="inline">
1511
+ <label for="view-pagination_type">
1512
+ <select class="if selectper" id="view-pagination_type"
1513
+ name="view[data][pagination_settings][type]">
1514
+ <option value="simple" <?php selected( 'simple', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'simple', 'strong-testimonials' ); ?></option>
1515
+ <option value="standard" <?php selected( 'standard', $this->view['pagination_settings']['type'] ); ?>><?php esc_html_e( 'WordPress standard', 'strong-testimonials' ); ?></option>
1516
+ <?php do_action( 'wpmtst_form_pagination_options_after', $this->view ) ?>
1517
+ </select>
1518
+ </label>
1519
+ </div>
1520
+ <div class="inline then fast then_simple then_not_standard then_not_infinitescroll then_not_loadmore"
1521
+ style="display: none;">
1522
+ <p class="description">
1523
+ <?php esc_html_e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
1524
+ <?php echo wp_kses_post( $links ); ?>
1525
+ </p>
1526
+ </div>
1527
+ <div class="inline then fast then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1528
+ style="display: none;">
1529
+ <p class="description">
1530
+ <?php esc_html_e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
1531
+ <?php echo wp_kses_post( $links ); ?>
1532
+ </p>
1533
+ </div>
1534
+ </div>
1535
+ </div>
1536
+ <div class="row then then_pagination" style="display: none;">
1537
+ <div class="row-inner">
1538
+ <div class="inline">
1539
+ <label for="view-per_page"><?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?></label>
1540
+ <input class="input-incremental" id="view-per_page"
1541
+ name="view[data][pagination_settings][per_page]" type="number" min="1" step="1"
1542
+ value="<?php echo esc_attr( $this->view['pagination_settings']['per_page'] ); ?>"/>
1543
+ </div>
1544
+ <div class="inline then then_simple then_standard then_not_infinitescroll then_not_loadmore">
1545
+ <label for="view-nav"><?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?></label>
1546
+ <select id="view-nav" name="view[data][pagination_settings][nav]">
1547
+ <option value="before" <?php selected( $this->view['pagination_settings']['nav'], 'before' ); ?>><?php esc_html_e( 'before', 'strong-testimonials' ); ?></option>
1548
+ <option value="after" <?php selected( $this->view['pagination_settings']['nav'], 'after' ); ?>><?php esc_html_e( 'after', 'strong-testimonials' ); ?></option>
1549
+ <option value="before,after" <?php selected( $this->view['pagination_settings']['nav'], 'before,after' ); ?>><?php esc_html_e( 'before & after', 'strong-testimonials' ); ?></option>
1550
+ </select>
1551
+ </div>
1552
+ </div>
1553
+ <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1554
+ style="display: none;">
1555
+ <div class="row-inner">
1556
+ <div class="inline">
1557
+ <label for="view-pagination-show_all">
1558
+ <select class="if select" id="view-pagination-show_all"
1559
+ name="view[data][pagination_settings][show_all]">
1560
+ <option value="on" <?php selected( $this->view['pagination_settings']['show_all'] ); ?>><?php esc_html_e( 'Show all page numbers', 'strong-testimonials' ); ?></option>
1561
+ <option value="off"
1562
+ <?php selected( ! $this->view['pagination_settings']['show_all'] ); ?>class="trip"><?php esc_html_e( 'Show condensed page numbers', 'strong-testimonials' ); ?></option>
1563
+ </select>
1564
+ </label>
1565
+ </div>
1566
+ <div class="inline then then_show_all" style="display: none;">
1567
+ <div class="inline">
1568
+ <label for="view-pagination-end_size"><?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?></label>
1569
+ <input class="input-incremental" id="view-pagination-end_size"
1570
+ name="view[data][pagination_settings][end_size]" type="number" min="1" step="1"
1571
+ value="<?php echo esc_attr( $this->view['pagination_settings']['end_size'] ); ?>"/>
1572
+ </div>
1573
+ <div class="inline">
1574
+ <label for="view-pagination-mid_size"><?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?></label>
1575
+ <input class="input-incremental" id="view-pagination-mid_size"
1576
+ name="view[data][pagination_settings][mid_size]" type="number" min="1" step="1"
1577
+ value="<?php echo esc_attr( $this->view['pagination_settings']['mid_size'] ); ?>"/>
1578
+ </div>
1579
+ </div>
1580
+ </div>
1581
+ </div>
1582
+ <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1583
+ style="display: none;">
1584
+ <div class="row-inner">
1585
+ <div class="inline inline-middle">
1586
+ <input class="if toggle checkbox" id="view-pagination-prev_next"
1587
+ name="view[data][pagination_settings][prev_next]" type="checkbox"
1588
+ value="1" <?php checked( $this->view['pagination_settings']['prev_next'] ); ?>>
1589
+ <label for="view-pagination-prev_next"><?php esc_html_e( 'Show previous/next links', 'strong-testimonials' ); ?></label>
1590
+ </div>
1591
+ <div class="then then_prev_next inline inline-middle">
1592
+ <label for="view-pagination-prev_text"><?php esc_html_e( 'Previous text', 'strong-testimonials' ); ?></label>
1593
+ <input class="code" id="view-pagination-prev_text"
1594
+ name="view[data][pagination_settings][prev_text]" type="text"
1595
+ value="<?php echo htmlentities( $this->view['pagination_settings']['prev_text'] ); ?>">
1596
+ </div>
1597
+ <div class="then then_prev_next inline inline-middle">
1598
+ <label for="view-pagination-next_text"><?php esc_html_e( 'Next text', 'strong-testimonials' ); ?></label>
1599
+ <input class="code" id="view-pagination-next_text"
1600
+ name="view[data][pagination_settings][next_text]" type="text"
1601
+ value="<?php echo htmlentities( $this->view['pagination_settings']['next_text'] ); ?>">
1602
+ </div>
1603
+ </div>
1604
+ </div>
1605
+ <div class="row then then_not_simple then_standard then_not_infinitescroll then_not_loadmore"
1606
+ style="display: none;">
1607
+ <div class="row-inner">
1608
+ <div class="inline">
1609
+ <label for="view-pagination-before_page_number"><?php esc_html_e( 'Before page number', 'strong-testimonials' ); ?></label>
1610
+ <input class="small-text" id="view-pagination-before_page_number"
1611
+ name="view[data][pagination_settings][before_page_number]" type="text"
1612
+ value="<?php echo esc_attr( $this->view['pagination_settings']['before_page_number'] ); ?>">
1613
+ </div>
1614
+ <div class="inline">
1615
+ <label for="view-pagination-after_page_number"><?php esc_html_e( 'After page number', 'strong-testimonials' ); ?></label>
1616
+ <input class="small-text" id="view-pagination-after_page_number"
1617
+ name="view[data][pagination_settings][after_page_number]" type="text"
1618
+ value="<?php echo esc_attr( $this->view['pagination_settings']['after_page_number'] ); ?>">
1619
+ </div>
1620
+ </div>
1621
+ </div>
1622
+ </div>
1623
+ <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
1624
+ </td>
1625
+ <?php
1626
+ }
1627
+
1628
+ /**
1629
+ * Render ST read more
1630
+ *
1631
+ * @since 2.51.5
1632
+ */
1633
+ private function render_field_read_more_page() {
1634
+
1635
+ $custom_list = apply_filters( 'wpmtst_custom_pages_list', array(), $this->view );
1636
+ $pages_list = apply_filters( 'wpmtst_pages_list', wpmtst_get_pages() );
1637
+ $posts_list = apply_filters( 'wpmtst_posts_list', wpmtst_get_posts() );
1638
+
1639
+ ?>
1640
+ <td>
1641
+ <div class="row then then_more_page" style="display: none;">
1642
+ <!-- Select page -->
1643
+ <div class="row then then_more_page" style="display: none;">
1644
+ <div class="row-inner">
1645
+ <label>
1646
+ <select id="view-page" name="view[data][more_page_id]">
1647
+ <option value=""><?php esc_html_e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
1648
+ <?php
1649
+ do_action( 'wpmtst_readmore_page_list', $this->view );
1650
+
1651
+ if ( $custom_list ) {
1652
+ ?>
1653
+ <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
1654
+ <?php
1655
+ foreach ( $custom_list as $page ) {
1656
+ echo wp_kses_post( $page );
1657
+ }
1658
+ ?>
1659
+ </optgroup>
1660
+ <?php } ?>
1661
+
1662
+ <optgroup label="<?php esc_attr_e( 'Pages', 'strong-testimonials' ); ?>">
1663
+
1664
+ <?php foreach ( $pages_list as $pages ) : ?>
1665
+ <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $pages->ID ); ?>><?php echo esc_html( $pages->post_title ); ?></option>
1666
+ <?php endforeach; ?>
1667
+
1668
+ </optgroup>
1669
+
1670
+ <optgroup label="<?php esc_attr_e( 'Posts', 'strong-testimonials' ); ?>">
1671
+
1672
+ <?php foreach ( $posts_list as $posts ) : ?>
1673
+ <option value="<?php echo esc_attr( $posts->ID ); ?>" <?php selected( isset( $this->view['more_page_id'] ) ? $this->view['more_page_id'] : 0, $posts->ID ); ?>><?php echo esc_html( $posts->post_title ); ?></option>
1674
+ <?php endforeach; ?>
1675
+
1676
+ </optgroup>
1677
+ </select>
1678
+ </label>
1679
+ <label for="view-page_id2"><?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?></label>
1680
+ <input type="text" id="view-page_id2"
1681
+ name="view[data][more_page_id2]" <?php echo( isset( $this->view['more_page_id'] ) ? 'value="' . esc_attr( $this->view['more_page_id'] ) . '"' : '' ); ?>
1682
+ size="30">
1683
+ </div>
1684
+ </div>
1685
+ <!-- Link text -->
1686
+ <div class="row">
1687
+ <div class="row-inner">
1688
+ <div class="inline">
1689
+ <label for="view-more_page_text"><?php esc_html_e( 'with link text', 'strong-testimonials' ); ?></label>
1690
+ <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
1691
+ value="<?php echo esc_attr( $this->view['more_page_text'] ); ?>" size="50">
1692
+ </div>
1693
+ </div>
1694
+ </div>
1695
+ <!-- location -->
1696
+ <div class="row">
1697
+ <div class="row-inner">
1698
+ <label>
1699
+ <select id="view-more_page_hook" name="view[data][more_page_hook]">
1700
+ <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $this->view['more_page_hook'] ); ?>><?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?></option>
1701
+ <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $this->view['more_page_hook'] ); ?>><?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?></option>
1702
+ </select>
1703
+ </label>
1704
+ </div>
1705
+ </div>
1706
+ </div>
1707
+ </td>
1708
+ <?php
1709
+ }
1710
+
1711
+ /**
1712
+ * Render ST slideshow number
1713
+ *
1714
+ * @since 2.51.5
1715
+ */
1716
+ private function render_field_slideshow_num() {
1717
+
1718
+ ?>
1719
+ <td>
1720
+ <div class="row">
1721
+ <div class="inline inline-middle">
1722
+ <label>
1723
+ <select id="view-slider_type" name="view[data][slideshow_settings][type]"
1724
+ class="if selectgroup">
1725
+ <option value="show_single" <?php selected( $this->view['slideshow_settings']['type'], 'show_single' ); ?>><?php esc_html_e( 'single', 'strong-testimonials' ); ?></option>
1726
+ <option value="show_multiple" <?php selected( $this->view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php esc_html_e( 'multiple', 'strong-testimonials' ); ?></option>
1727
+ </select>
1728
+ </label>
1729
+ <div class="option-desc singular" style="display: none;">
1730
+ <?php esc_html_e( 'slide at a time', 'strong-testimonials' ); ?>
1731
+ </div>
1732
+ <div class="option-desc plural" style="display: none;">
1733
+ <?php esc_html_e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
1734
+ </div>
1735
+ </div>
1736
+ </div>
1737
+ </td>
1738
+ <td>
1739
+ <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
1740
+ <div class="row">
1741
+ <div class="inner-table is-below">
1742
+ <div class="inner-table-row bordered header">
1743
+ <div class="inner-table-cell"><?php esc_html_e( 'minimum screen width', 'strong-testimonials' ); ?></div>
1744
+ <div class="inner-table-cell"><?php esc_html_e( 'show', 'strong-testimonials' ); ?></div>
1745
+ <div class="inner-table-cell"><?php esc_html_e( 'margin', 'strong-testimonials' ); ?></div>
1746
+ <div class="inner-table-cell"><?php esc_html_e( 'move', 'strong-testimonials' ); ?></div>
1747
+ </div>
1748
+ <?php foreach ( $this->view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
1749
+ <div class="inner-table-row bordered">
1750
+ <div class="inner-table-cell">
1751
+ <label>
1752
+ <input id="view-breakpoint_<?php echo esc_attr( $key ); ?>"
1753
+ name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][width]"
1754
+ value="<?php echo esc_attr( $breakpoint['width'] ); ?>" type="number"
1755
+ class="input-incremental"> px
1756
+ </label>
1757
+ </div>
1758
+ <div class="inner-table-cell">
1759
+ <label>
1760
+ <select id="view-max_slides_<?php echo $key; ?>"
1761
+ name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][max_slides]"
1762
+ class="if selectgroup">
1763
+ <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1
1764
+ </option>
1765
+ <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2
1766
+ </option>
1767
+ <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3
1768
+ </option>
1769
+ <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4
1770
+ </option>
1771
+ </select>
1772
+ </label>
1773
+ <div class="option-desc singular"
1774
+ style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1775
+ <div class="option-desc plural"
1776
+ style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1777
+ </div>
1778
+ <div class="inner-table-cell">
1779
+ <input id="view-margin_<?php echo esc_attr( $key ); ?>"
1780
+ name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][margin]"
1781
+ value="<?php echo esc_attr( $breakpoint['margin'] ); ?>" type="number"
1782
+ min="1" step="1" size="3" class="input-incremental"/> px
1783
+ </div>
1784
+ <div class="inner-table-cell">
1785
+ <label>
1786
+ <select id="view-move_slides_<?php echo esc_attr( $key ); ?>"
1787
+ name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][move_slides]"
1788
+ class="if selectgroup">
1789
+ <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1
1790
+ </option>
1791
+ <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2
1792
+ </option>
1793
+ <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3
1794
+ </option>
1795
+ <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4
1796
+ </option>
1797
+ </select>
1798
+ </label>
1799
+ <div class="option-desc singular"
1800
+ style="display: none;"><?php esc_html_e( 'slide', 'strong-testimonials' ); ?></div>
1801
+ <div class="option-desc plural"
1802
+ style="display: none;"><?php esc_html_e( 'slides', 'strong-testimonials' ); ?></div>
1803
+ </div>
1804
+ </div>
1805
+ <?php endforeach; ?>
1806
+ </div>
1807
+ </div>
1808
+ <div class="is-below">
1809
+ <input id="restore-default-breakpoints" type="button" name="restore-default-breakpoints"
1810
+ value="<?php esc_html_e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
1811
+ class="button-secondary"/>
1812
+ <span id="restored-message"><?php esc_html_e( 'defaults restored', 'strong-testimonials' ); ?></span>
1813
+ </div>
1814
+ </div>
1815
+ </td>
1816
+ <?php
1817
+ }
1818
+
1819
+ /**
1820
+ * Render ST Slideshow transition
1821
+ *
1822
+ * @since 2.51.5
1823
+ */
1824
+ private function render_field_slideshow_transition() {
1825
+
1826
+ ?>
1827
+ <td>
1828
+ <div class="row">
1829
+ <div class="inline inline-middle">
1830
+ <label for="view-pause"><?php _ex( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?></label>
1831
+ <input type="number" id="view-pause" class="input-incremental"
1832
+ name="view[data][slideshow_settings][pause]" min=".1" step=".1"
1833
+ value="<?php echo esc_attr( $this->view['slideshow_settings']['pause'] ); ?>" size="3"/>
1834
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1835
+ </div>
1836
+ <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast"
1837
+ style="display: none;">
1838
+ <label for="view-effect"><?php esc_html_e( 'then', 'strong-testimonials' ); ?></label>
1839
+ <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
1840
+ <?php foreach ( $this->view_options['slideshow_effect'] as $key => $label ) : ?>
1841
+ <option value="<?php echo esc_attr( $key ); ?>"
1842
+ <?php selected( $this->view['slideshow_settings']['effect'], $key ); ?>
1843
+ <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo esc_html( $label ); ?></option>
1844
+ <?php endforeach; ?>
1845
+ </select>
1846
+ </div>
1847
+ <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast"
1848
+ style="display: none;">
1849
+ <?php esc_html_e( 'then', 'strong-testimonials' ); ?><?php _ex( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
1850
+ </div>
1851
+ <div class="inline inline-middle then then_effect then_none">
1852
+ <label for="view-speed"><?php esc_html_e( 'for', 'strong-testimonials' ); ?></label>
1853
+ <input type="number" id="view-speed" class="input-incremental"
1854
+ name="view[data][slideshow_settings][speed]" min=".1" step=".1"
1855
+ value="<?php echo esc_attr( $this->view['slideshow_settings']['speed'] ); ?>" size="3"/>
1856
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1857
+ </div>
1858
+ </div>
1859
+ </td>
1860
+ <?php
1861
+ }
1862
+
1863
+ /**
1864
+ * Render ST Slideshow behavior
1865
+ *
1866
+ * @since 2.51.5
1867
+ */
1868
+ private function render_field_slideshow_behavior() {
1869
+
1870
+ ?>
1871
+ <td>
1872
+ <div class="row">
1873
+ <div class="inline inline-middle">
1874
+ <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]"
1875
+ value="0" <?php checked( $this->view['slideshow_settings']['auto_start'] ); ?>
1876
+ class="checkbox">
1877
+ <label for="view-auto_start"><?php _ex( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?></label>
1878
+ </div>
1879
+ </div>
1880
+ <div class="row">
1881
+ <div class="inline inline-middle">
1882
+ <input type="checkbox" id="view-continuous_sliding"
1883
+ name="view[data][slideshow_settings][continuous_sliding]"
1884
+ value="0" <?php checked( $this->view['slideshow_settings']['continuous_sliding'] ); ?>
1885
+ class="checkbox">
1886
+ <label for="view-continuous_sliding"><?php _ex( 'Continuous Sliding', 'slideshow setting', 'strong-testimonials' ); ?></label>
1887
+ </div>
1888
+ </div>
1889
+ <div class="row">
1890
+ <div class="inline inline-middle">
1891
+ <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]"
1892
+ value="0" <?php checked( $this->view['slideshow_settings']['auto_hover'] ); ?>
1893
+ class="checkbox">
1894
+ <label for="view-auto_hover"><?php _ex( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?></label>
1895
+ </div>
1896
+ </div>
1897
+ <div class="row">
1898
+ <div class="inline inline-middle">
1899
+ <input type="checkbox" id="view-stop_auto_on_click"
1900
+ name="view[data][slideshow_settings][stop_auto_on_click]"
1901
+ value="0" <?php checked( $this->view['slideshow_settings']['stop_auto_on_click'] ); ?>
1902
+ class="checkbox">
1903
+ <label for="view-stop_auto_on_click"><?php _ex( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?></label>
1904
+ </div>
1905
+ <div class="inline inline-middle">
1906
+ <p class="description"><?php esc_html_e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
1907
+ </div>
1908
+ </div>
1909
+ <?php
1910
+ if ( $this->view['slideshow_settings']['adapt_height'] ) {
1911
+ $height = 'dynamic';
1912
+ } else {
1913
+ $height = 'static';
1914
+ }
1915
+ ?>
1916
+ <div class="row">
1917
+ <div class="row-inner">
1918
+ <div class="inline">
1919
+ <label for="view-slideshow_height">
1920
+ <select id="view-slideshow_height" name="view[data][slideshow_settings][height]"
1921
+ class="if selectgroup">
1922
+ <?php foreach ( $this->view_options['slideshow_height'] as $key => $type ) : ?>
1923
+ <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
1924
+ <?php selected( $height, $key ); ?>>
1925
+ <?php echo esc_html( $type ); ?>
1926
+ </option>
1927
+ <?php endforeach; ?>
1928
+ </select>
1929
+ </label>
1930
+ </div>
1931
+ <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
1932
+ <label for="view-adapt_height_speed"><?php esc_html_e( 'Duration', 'strong-testimonials' ); ?></label>
1933
+ <input type="number" id="view-adapt_height_speed" class="input-incremental"
1934
+ name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
1935
+ value="<?php echo esc_attr( $this->view['slideshow_settings']['adapt_height_speed'] ); ?>"
1936
+ size="3"/>
1937
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
1938
+ </div>
1939
+ <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
1940
+ <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]"
1941
+ value="1" <?php checked( $this->view['slideshow_settings']['stretch'] ); ?>
1942
+ class="checkbox">
1943
+ <label for="view-stretch"><?php esc_html_e( 'Stretch slides vertically', 'strong-testimonials' ); ?></label>
1944
+ <div class="inline description">
1945
+ <a href="#tab-panel-wpmtst-help-stretch"
1946
+ class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
1947
+ </div>
1948
+ </div>
1949
+ </div>
1950
+ </div>
1951
+ <div class="row tall">
1952
+ <p class="description"><?php esc_html_e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
1953
+ </div>
1954
+ </td>
1955
+ <?php
1956
+ }
1957
+
1958
+ /**
1959
+ * Render ST Slideshow navigation
1960
+ *
1961
+ * @since 2.51.5
1962
+ */
1963
+ private function render_field_slideshow_navigation() {
1964
+
1965
+ ?>
1966
+ <td>
1967
+ <div class="row">
1968
+ <div class="row-inner">
1969
+ <div class="inline">
1970
+ <label for="view-slideshow_controls_type"><?php esc_html_e( 'Controls', 'strong-testimonials' ); ?></label>
1971
+ <select id="view-slideshow_controls_type" name="view[data][slideshow_settings][controls_type]"
1972
+ class="if selectnot">
1973
+
1974
+ <?php foreach ( $this->view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
1975
+ <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
1976
+ <?php selected( $this->view['slideshow_settings']['controls_type'], $key ); ?>
1977
+ <?php if ( 'none' == $key ) {
1978
+ echo ' class="trip"';
1979
+ } ?>>
1980
+ <?php echo esc_html( $type['label'] ); ?>
1981
+ </option>
1982
+ <?php endforeach; ?>
1983
+
1984
+ </select>
1985
+ </div>
1986
+ <div class="inline then then_slideshow_controls_type" style="display: none;">
1987
+ <label for="view-slideshow_controls_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
1988
+ <select id="view-slideshow_controls_style"
1989
+ name="view[data][slideshow_settings][controls_style]">
1990
+ <?php foreach ( $this->view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
1991
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['controls_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
1992
+ <?php endforeach; ?>
1993
+ </select>
1994
+ </div>
1995
+ </div>
1996
+ </div>
1997
+ <div class="row">
1998
+ <div class="row-inner then then_has-pager">
1999
+ <div class="inline">
2000
+ <label for="view-slideshow_pager_type"><?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?></label>
2001
+ <select id="view-slideshow_pager_type" name="view[data][slideshow_settings][pager_type]"
2002
+ class="if selectnot">
2003
+
2004
+ <?php foreach ( $this->view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
2005
+ <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
2006
+ <?php selected( $this->view['slideshow_settings']['pager_type'], $key ); ?>
2007
+ <?php if ( 'none' == $key ) {
2008
+ echo ' class="trip"';
2009
+ } ?>>
2010
+ <?php echo esc_html( $type['label'] ); ?>
2011
+ </option>
2012
+ <?php endforeach; ?>
2013
+
2014
+ </select>
2015
+ </div>
2016
+ <div class="inline then then_slideshow_pager_type" style="display: none;">
2017
+ <label for="view-slideshow_pager_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
2018
+ <select id="view-slideshow_pager_style" name="view[data][slideshow_settings][pager_style]"
2019
+ class="if selectnot">
2020
+ <?php foreach ( $this->view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
2021
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['pager_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
2022
+ <?php endforeach; ?>
2023
+ </select>
2024
+ </div>
2025
+ </div>
2026
+ </div>
2027
+ <div class="row">
2028
+ <div class="row-inner">
2029
+ <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
2030
+ <div class="inline then then_has-position" style="display: none;">
2031
+ <label for="view-slideshow_nav_position"><?php esc_html_e( 'Position', 'strong-testimonials' ); ?></label>
2032
+ <select id="view-slideshow_nav_position"
2033
+ name="view[data][slideshow_settings][nav_position]">
2034
+ <?php foreach ( $this->view_options['slideshow_nav_position'] as $key => $label ) : ?>
2035
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $this->view['slideshow_settings']['nav_position'], $key ); ?>><?php echo esc_html( $label ); ?></option>
2036
+ <?php endforeach; ?>
2037
+ </select>
2038
+ <?php //esc_html_e( 'outside', 'strong-testimonials' ); ?>
2039
+ <?php esc_html_e( 'the testimonial frame', 'strong-testimonials' ); ?>
2040
+ </div>
2041
+ </div>
2042
+ </div>
2043
+ </div>
2044
+ </td>
2045
+ <?php
2046
+ }
2047
+
2048
+ /**
2049
+ * Render ST form category field
2050
+ *
2051
+ * @since 2.51.5
2052
+ */
2053
+ private function render_field_form_category() {
2054
+
2055
+ if ( $this->cat_count ) : ?>
2056
+ <td>
2057
+ <div class="table">
2058
+
2059
+ <?php if ( $this->cat_count > 5 ) : ?>
2060
+ <div class="table-row">
2061
+ <div class="table-cell">
2062
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
2063
+ <input type="button" class="expand-cats button" value="expand list"/>
2064
+ </div>
2065
+ </div>
2066
+ </div>
2067
+ <?php endif; ?>
2068
+
2069
+ <div class="table-row">
2070
+ <div class="table-cell">
2071
+ <?php wpmtst_form_category_checklist( $this->view_cats_array ); ?>
2072
+ </div>
2073
+ </div>
2074
+ </div>
2075
+ </td>
2076
+ <?php else : ?>
2077
+ <td>
2078
+ <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
2079
+ </td>
2080
+ <?php endif;
2081
+ }
2082
+
2083
+ /**
2084
+ * Render ST form AJAX field
2085
+ *
2086
+ * @since 2.51.5
2087
+ */
2088
+ private function render_field_form_ajax() {
2089
+
2090
+ ?>
2091
+ <td>
2092
+ <p class="description tall"><?php _e( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ); ?></p>
2093
+ </td>
2094
+ <?php
2095
+ }
2096
+
2097
+ /**
2098
+ * Render ST template list field
2099
+ *
2100
+ * @since 2.51.5
2101
+ */
2102
+ private function render_field_template_list() {
2103
+
2104
+ // Assemble list of templates
2105
+ $templates = array(
2106
+ 'display' => WPMST()->templates->get_templates( 'display' ),
2107
+ 'form' => WPMST()->templates->get_templates( 'form' ),
2108
+ );
2109
+ $template_found = in_array( $this->view['template'], WPMST()->templates->get_template_keys() );
2110
+
2111
+ ?>
2112
+ <td colspan="2">
2113
+ <div id="view-template-list">
2114
+ <div class="radio-buttons">
2115
+
2116
+ <?php if ( ! $template_found ) : ?>
2117
+ <ul class="radio-list template-list">
2118
+ <li>
2119
+ <div>
2120
+ <input class="error" type="radio"
2121
+ id="<?php echo esc_attr( $this->view['template'] ); ?>"
2122
+ name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2123
+ value="<?php echo esc_attr( $this->view['template'] ); ?>" checked>
2124
+ <label for="<?php echo esc_attr( $this->view['template'] ); ?>"><?php echo esc_html( $this->view['template'] ); ?></label>
2125
+ </div>
2126
+ <div class="template-description">
2127
+ <p>
2128
+ <span class="dashicons dashicons-warning error"></span>&nbsp;
2129
+ <span class="error"><?php esc_html_e( 'not found', 'strong-testimonials' ); ?></span>
2130
+ </p>
2131
+ </div>
2132
+ </li>
2133
+ </ul>
2134
+ <?php endif; ?>
2135
+
2136
+ <ul class="radio-list template-list">
2137
+
2138
+ <?php foreach ( $templates[ $this->current_type ] as $key => $template ) : ?>
2139
+ <li>
2140
+ <div>
2141
+ <input type="radio" id="template-<?php echo esc_attr( $key ); ?>"
2142
+ name="view[data][<?php echo esc_attr( $this->current_mode ); ?>]"
2143
+ value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $this->view['template'] ); ?>>
2144
+ <label for="template-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $template['config']['name'] ); ?></label>
2145
+ </div>
2146
+ <div class="template-description">
2147
+ <p><?php echo( isset( $template['config']['description'] ) && $template['config']['description'] ? esc_html( $template['config']['description'] ) : __( 'no description', 'strong-testimonials' ) ) ?></p>
2148
+ <div class="options">
2149
+ <div>
2150
+ <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
2151
+ <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
2152
+ <?php else : ?>
2153
+ <?php foreach ( $template['config']['options'] as $option ) : ?>
2154
+ <div style="margin-bottom: 10px;">
2155
+ <?php
2156
+ $name = sprintf( 'view[data][template_settings][%s][%s]', esc_attr( $key ), esc_attr( $option->name ) );
2157
+ $id = $key . '-' . $option->name;
2158
+
2159
+ switch ( $option->type ) {
2160
+ case 'select':
2161
+
2162
+ // Get default if not set
2163
+ if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2164
+ $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2165
+ }
2166
+
2167
+ if ( $option->label ) {
2168
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), wp_kses_post( $option->label ) );
2169
+ }
2170
+
2171
+ printf( '<select id="%s" name="%s">', esc_attr( $id ), $name );
2172
+
2173
+ foreach ( $option->values as $value ) {
2174
+ $selected = selected( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2175
+ printf( '<option value="%s" %s>%s</option>', esc_attr( $value->value ), $selected, esc_html( $value->description ) );
2176
+ }
2177
+
2178
+ echo '</select>';
2179
+ break;
2180
+ case 'radio':
2181
+
2182
+ if ( ! isset( $this->view['template_settings'][ $key ][ $option->name ] ) ) {
2183
+ $this->view['template_settings'][ $key ][ $option->name ] = $option->default;
2184
+ }
2185
+
2186
+ foreach ( $option->values as $value ) {
2187
+ $checked = checked( $value->value, $this->view['template_settings'][ $key ][ $option->name ], false );
2188
+ printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', esc_attr( $id ), $name, esc_attr( $value->value ), $checked );
2189
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $value->description ) );
2190
+ }
2191
+
2192
+ break;
2193
+ case 'colorpicker':
2194
+
2195
+ if ( $option->label ) {
2196
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
2197
+ }
2198
+
2199
+ $value = isset( $this->view['template_settings'][ $key ][ $option->name ] ) ? $this->view['template_settings'][ $key ][ $option->name ] : $option->default;
2200
+ printf( '<input type="text" class="wp-color-picker-field" data-alpha="true" id="%s" name="%s" value="%s">', esc_attr( $id ), $name, esc_attr( $value ) );
2201
+ break;
2202
+ default:
2203
+ do_action( 'wpmtst_views_render_template_option_' . $option->type, $this->view, $key, $option );
2204
+ break;
2205
+ }
2206
+ ?>
2207
+ </div>
2208
+ <?php endforeach; ?>
2209
+
2210
+ <?php endif; ?>
2211
+ </div>
2212
+ </div>
2213
+ <?php do_action( 'wpmtst_views_after_template_options', $this->view, $template, $key ); ?>
2214
+ </div>
2215
+ </li>
2216
+ <?php endforeach; ?>
2217
+
2218
+ </ul>
2219
+ </div>
2220
+ </div>
2221
+ <?php do_action( 'wpmtst_views_after_template_list' ); ?>
2222
+ </td>
2223
+ <?php
2224
+ }
2225
+
2226
+ /**
2227
+ * Render ST layout field
2228
+ *
2229
+ * @since 2.51.5
2230
+ */
2231
+ private function render_field_layout() { ?>
2232
+ <td colspan="2">
2233
+ <div class="section-radios layout-section">
2234
+ <div class="radio-buttons">
2235
+ <ul class="radio-list layout-list">
2236
+ <li>
2237
+ <input type="radio" id="view-layout-normal" name="view[data][layout]"
2238
+ value="" <?php checked( false, $this->view['layout'] ); ?>>
2239
+ <label for="view-layout-normal"><?php esc_html_e( 'normal', 'strong-testimonials' ); ?></label>
2240
+ </li>
2241
+ <li>
2242
+ <input type="radio" id="view-layout-masonry" name="view[data][layout]"
2243
+ value="masonry" <?php checked( 'masonry', $this->view['layout'] ); ?>>
2244
+ <label for="view-layout-masonry"><?php esc_html_e( 'Masonry', 'strong-testimonials' ); ?> </label>
2245
+ </li>
2246
+ <li>
2247
+ <input type="radio"
2248
+ id="view-layout-columns"
2249
+ name="view[data][layout]"
2250
+ value="columns" <?php checked( 'columns', $this->view['layout'] ); ?>>
2251
+ <label for="view-layout-columns">
2252
+ <?php esc_html_e( 'columns', 'strong-testimonials' ); ?>
2253
+ </label>
2254
+ </li>
2255
+ <li>
2256
+ <input type="radio" id="view-layout-grid" name="view[data][layout]"
2257
+ value="grid" <?php checked( 'grid', $this->view['layout'] ); ?>>
2258
+ <label for="view-layout-grid"><?php esc_html_e( 'grid', 'strong-testimonials' ); ?></label>
2259
+ </li>
2260
+ </ul>
2261
+ </div>
2262
+ <div>
2263
+ <div class="radio-description" id="view-layout-info">
2264
+ <div class="layout-description view-layout-normal">
2265
+ <p><?php esc_html_e( 'A single column.', 'strong-testimonials' ); ?></p>
2266
+ </div>
2267
+ <div class="layout-description view-layout-masonry">
2268
+ <p><?php printf( __( 'A cascading, responsive grid using the jQuery plugin <a href="%s" target="_blank">Masonry</a>.', 'strong-testimonials' ), esc_url( 'http://masonry.desandro.com/' ) ); ?></p>
2269
+ <p><?php esc_html_e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
2270
+ <p><?php esc_html_e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
2271
+ </div>
2272
+ <div class="layout-description view-layout-columns">
2273
+ <p><?php printf( __( 'Using <a href="%s" target="_blank">CSS multi-column</a>. Fill from top to bottom, then over to next column.', 'strong-testimonials' ), esc_url( 'https://css-tricks.com/guide-responsive-friendly-css-columns/' ) ); ?></p>
2274
+ <p><?php esc_html_e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
2275
+ <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2276
+ </div>
2277
+ <div class="layout-description view-layout-grid">
2278
+ <p><?php
2279
+ $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
2280
+ printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) ); ?>
2281
+ </p>
2282
+ <p><?php esc_html_e( 'Testimonials will be equal height so this works best when they are about the same length either naturally or using excerpts.', 'strong-testimonials' ); ?></p>
2283
+ <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
2284
+ </div>
2285
+ </div>
2286
+ <div class="radio-description options" id="column-count-wrapper">
2287
+ <div>
2288
+ <label for="view-column-count"><?php esc_html_e( 'Number of columns', 'strong-testimonials' ); ?></label>
2289
+ <select id="view-column-count" name="view[data][column_count]">
2290
+ <option value="2" <?php selected( $this->view['column_count'], 2 ); ?>>2</option>
2291
+ <option value="3" <?php selected( $this->view['column_count'], 3 ); ?>>3</option>
2292
+ <option value="4" <?php selected( $this->view['column_count'], 4 ); ?>>4</option>
2293
+ </select>
2294
+ </div>
2295
+ </div>
2296
+ </div>
2297
+ <div>
2298
+ <div class="layout-example view-layout-normal">
2299
+ <div class="example-container">
2300
+ <div class="box"><span>1</span></div>
2301
+ <div class="box size2"><span>2</span></div>
2302
+ <div class="box"><span>3</span></div>
2303
+ <div class="box size2"><span>4</span></div>
2304
+ <div class="box"><span>5</span></div>
2305
+ </div>
2306
+ </div>
2307
+ <div class="layout-example view-layout-masonry">
2308
+ <div class="example-container col-2">
2309
+ <div class="grid-sizer"></div>
2310
+ <div class="box"><span>1</span></div>
2311
+ <div class="box size2"><span>2</span></div>
2312
+ <div class="box"><span>3</span></div>
2313
+ <div class="box size3"><span>4</span></div>
2314
+ <div class="box"><span>5</span></div>
2315
+ <div class="box size2"><span>6</span></div>
2316
+ <div class="box"><span>7</span></div>
2317
+ <div class="box size3"><span>8</span></div>
2318
+ <div class="box"><span>9</span></div>
2319
+ </div>
2320
+ </div>
2321
+ <div class="layout-example view-layout-columns">
2322
+ <div class="example-container col-2">
2323
+ <div class="box"><span>1</span></div>
2324
+ <div class="box size2"><span>2</span></div>
2325
+ <div class="box"><span>3</span></div>
2326
+ <div class="box size3"><span>4</span></div>
2327
+ <div class="box"><span>5</span></div>
2328
+ <div class="box size2"><span>6</span></div>
2329
+ <div class="box"><span>7</span></div>
2330
+ <div class="box size3"><span>8</span></div>
2331
+ <div class="box"><span>9</span></div>
2332
+ </div>
2333
+ </div>
2334
+ <div class="layout-example view-layout-grid">
2335
+ <div class="example-container col-2">
2336
+ <div class="box"><span>1</span></div>
2337
+ <div class="box"><span>2</span></div>
2338
+ <div class="box"><span>3</span></div>
2339
+ <div class="box"><span>4</span></div>
2340
+ <div class="box"><span>5</span></div>
2341
+ <div class="box"><span>6</span></div>
2342
+ <div class="box"><span>7</span></div>
2343
+ <div class="box"><span>8</span></div>
2344
+ <div class="box"><span>9</span></div>
2345
+ </div>
2346
+ </div>
2347
+ </div>
2348
+ </div>
2349
+ </td>
2350
+ <?php
2351
+ }
2352
+
2353
+ /**
2354
+ * Render ST background field
2355
+ *
2356
+ * @since 2.51.5
2357
+ */
2358
+ private function render_field_background() {
2359
+
2360
+ ?>
2361
+ <td>
2362
+ <div class="section-radios background-section">
2363
+ <div class="radio-buttons">
2364
+ <ul class="radio-list background-list">
2365
+ <li>
2366
+ <input type="radio" id="bg-none" name="view[data][background][type]"
2367
+ value="" <?php checked( $this->view['background']['type'], '' ); ?>>
2368
+ <label for="bg-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2369
+ </li>
2370
+ <li>
2371
+ <input type="radio" id="bg-single" name="view[data][background][type]"
2372
+ value="single" <?php checked( $this->view['background']['type'], 'single' ); ?>>
2373
+ <label for="bg-single"><?php esc_html_e( 'single color', 'strong-testimonials' ); ?></label>
2374
+ </li>
2375
+ <li>
2376
+ <input type="radio" id="bg-gradient" name="view[data][background][type]"
2377
+ value="gradient" <?php checked( $this->view['background']['type'], 'gradient' ); ?>>
2378
+ <label for="bg-gradient"><?php esc_html_e( 'gradient', 'strong-testimonials' ); ?></label>
2379
+ </li>
2380
+ <li>
2381
+ <input type="radio" id="bg-preset" name="view[data][background][type]"
2382
+ value="preset" <?php checked( $this->view['background']['type'], 'preset' ); ?>>
2383
+ <label for="bg-preset"><?php esc_html_e( 'preset', 'strong-testimonials' ); ?></label>
2384
+ </li>
2385
+ </ul>
2386
+ </div>
2387
+ <div class="radio-description" id="view-background-info">
2388
+ <div class="background-description bg-none">
2389
+ <div class="description-inner options">
2390
+ <div>
2391
+ <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
2392
+ </div>
2393
+ </div>
2394
+ </div>
2395
+ <div class="background-description bg-single">
2396
+ <div class="description-inner options">
2397
+ <div>
2398
+ <label>
2399
+ <input type="text" id="bg-color" name="view[data][background][color]"
2400
+ value="<?php echo esc_attr( $this->view['background']['color'] ); ?>"
2401
+ class="wp-color-picker-field">
2402
+ </label>
2403
+ </div>
2404
+ </div>
2405
+ </div>
2406
+ <div class="background-description bg-gradient">
2407
+ <div class="description-inner options">
2408
+ <div>
2409
+ <div class="color-picker-wrap">
2410
+ <div>
2411
+ <label for="bg-gradient1"><?php esc_html_e( 'From top', 'strong-testimonials' ); ?></label>
2412
+ </div>
2413
+ <div><input type="text" id="bg-gradient1" name="view[data][background][gradient1]"
2414
+ value="<?php echo esc_attr( $this->view['background']['gradient1'] ); ?>"
2415
+ class="wp-color-picker-field gradient"></div>
2416
+ </div>
2417
+ </div>
2418
+ </div>
2419
+ <div class="description-inner options">
2420
+ <div>
2421
+ <div class="color-picker-wrap">
2422
+ <div>
2423
+ <label for="bg-gradient2"><?php esc_html_e( 'To bottom', 'strong-testimonials' ); ?></label>
2424
+ </div>
2425
+ <div><input type="text" id="bg-gradient2" name="view[data][background][gradient2]"
2426
+ value="<?php echo esc_attr( $this->view['background']['gradient2'] ); ?>"
2427
+ class="wp-color-picker-field gradient"></div>
2428
+ </div>
2429
+ </div>
2430
+ </div>
2431
+ </div>
2432
+
2433
+ <div class="background-description bg-preset">
2434
+ <div class="description-inner options">
2435
+ <div>
2436
+ <label for="view-background-preset">
2437
+ <select id="view-background-preset" name="view[data][background][preset]">
2438
+ <?php
2439
+ $presets = wpmtst_get_background_presets();
2440
+ $current_preset = ( isset( $this->view['background']['preset'] ) && $this->view['background']['preset'] ) ? $this->view['background']['preset'] : '';
2441
+ echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
2442
+ foreach ( $presets as $key => $preset ) {
2443
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $current_preset, $key, false ) . '>' . esc_html( $preset['label'] ) . '</option>';
2444
+ }
2445
+ ?>
2446
+ </select>
2447
+ </label>
2448
+ </div>
2449
+ </div>
2450
+ </div>
2451
+ </div>
2452
+ </div>
2453
+ </td>
2454
+
2455
+ <td rowspan="2" class="rowspan">
2456
+ <div id="view-color-preview" class="table-cell">
2457
+ <div class="background-preview-wrap">
2458
+ <div id="background-preview">
2459
+ Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse
2460
+ maiorum
2461
+ in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad
2462
+ vidisse
2463
+ expetendis.
2464
+ </div>
2465
+ </div>
2466
+ </div>
2467
+ </td>
2468
+ <?php
2469
+ }
2470
+
2471
+ /**
2472
+ * Render ST color field
2473
+ *
2474
+ * @since 2.51.5
2475
+ */
2476
+ private function render_field_color() {
2477
+
2478
+ ?>
2479
+ <td>
2480
+ <div class="section-radios font-color-section">
2481
+ <div class="radio-buttons">
2482
+ <ul class="radio-list font-folor-list">
2483
+ <li>
2484
+ <input type="radio" id="fc-none" name="view[data][font-color][type]"
2485
+ value="" <?php checked( $this->view['font-color']['type'], '' ); ?>>
2486
+ <label for="fc-none"><?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?></label>
2487
+ </li>
2488
+ <li>
2489
+ <input type="radio" id="fc-custom" name="view[data][font-color][type]"
2490
+ value="custom" <?php checked( $this->view['font-color']['type'], 'custom' ); ?>>
2491
+ <label for="fc-custom"><?php esc_html_e( 'custom', 'strong-testimonials' ); ?></label>
2492
+ </li>
2493
+ </ul>
2494
+ </div>
2495
+ <div class="radio-description" id="view-font-color-info">
2496
+ <div class="font-color-description fc-none">
2497
+ <div class="description-inner options">
2498
+ <div><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></div>
2499
+ </div>
2500
+ </div>
2501
+ <div class="font-color-description fc-custom">
2502
+ <div class="description-inner options">
2503
+ <div>
2504
+ <label>
2505
+ <input type="text" id="fc-color" name="view[data][font-color][color]"
2506
+ value="<?php echo esc_attr( $this->view['font-color']['color'] ); ?>"
2507
+ class="wp-color-picker-field">
2508
+ </label>
2509
+ </div>
2510
+ </div>
2511
+ </div>
2512
+ </div>
2513
+ </div>
2514
+ </td>
2515
+ <?php
2516
+ }
2517
+
2518
+ /**
2519
+ * Render ST class field
2520
+ *
2521
+ * @since 2.51.5
2522
+ */
2523
+ private function render_field_classes() {
2524
+
2525
+ ?>
2526
+ <td colspan="2">
2527
+ <div class="then then_display then_form then_slideshow input" style="display: none;">
2528
+ <input type="text" id="view-class" class="long inline" name="view[data][class]"
2529
+ value="<?php echo esc_attr( $this->view['class'] ); ?>">
2530
+ <p class="inline description tall">
2531
+ <?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?>
2532
+ <?php esc_html_e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
2533
+ </p>
2534
+ </div>
2535
+ </td>
2536
+ <?php
2537
+ }
2538
+
2539
+ /**
2540
+ * Render divi field
2541
+ *
2542
+ * @since 2.51.5
2543
+ */
2544
+ private function render_field_divi() {
2545
+
2546
+ ?>
2547
+ <td>
2548
+ <div class="row">
2549
+ <div class="row-inner">
2550
+ <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
2551
+ name="view[data][divi_builder]" value="1" <?php checked( $this->view['divi_builder'] ); ?>/>
2552
+ <label for="view-divi_builder"><?php esc_html_e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?></label>
2553
+ <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?></p>
2554
+ <p class="description short"><?php esc_html_e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?></p>
2555
+ </div>
2556
+ </div>
2557
+ </td>
2558
+ <?php
2559
+ }
2560
  }
admin/class-strong-testimonials-list-table.php CHANGED
@@ -1,1213 +1,1213 @@
1
- <?php
2
- /**
3
- * Base class for displaying a list of items in an ajaxified HTML table.
4
- *
5
- * -!- This is a copy of /wp-admin/includes/class-wp-list-table.php. -!-
6
- * See Codex for reasoning.
7
- * @link http://codex.wordpress.org/Class_Reference/WP_List_Table
8
- *
9
- * @since 3.1.0
10
- * @access private
11
- */
12
-
13
- if ( ! class_exists( 'Strong_Testimonials_List_Table' ) ) :
14
-
15
- class Strong_Testimonials_List_Table {
16
-
17
- /**
18
- * The current list of items
19
- *
20
- * @since 3.1.0
21
- * @var array
22
- * @access public
23
- */
24
- public $items;
25
-
26
- /**
27
- * Various information about the current table
28
- *
29
- * @since 3.1.0
30
- * @var array
31
- * @access protected
32
- */
33
- protected $_args;
34
-
35
- /**
36
- * Various information needed for displaying the pagination
37
- *
38
- * @since 3.1.0
39
- * @var array
40
- */
41
- protected $_pagination_args = array();
42
-
43
- /**
44
- * The current screen
45
- *
46
- * @since 3.1.0
47
- * @var object
48
- * @access protected
49
- */
50
- protected $screen;
51
-
52
- /**
53
- * Cached bulk actions
54
- *
55
- * @since 3.1.0
56
- * @var array
57
- * @access private
58
- */
59
- private $_actions;
60
-
61
- /**
62
- * Cached pagination output
63
- *
64
- * @since 3.1.0
65
- * @var string
66
- * @access private
67
- */
68
- private $_pagination;
69
-
70
- /**
71
- * The view switcher modes.
72
- *
73
- * @since 4.1.0
74
- * @var array
75
- * @access protected
76
- */
77
- protected $modes = array();
78
-
79
- /**
80
- * Stores the value returned by ->get_column_info()
81
- *
82
- * @var array
83
- */
84
- protected $_column_headers;
85
-
86
- protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
87
-
88
- protected $compat_methods = array(
89
- 'set_pagination_args',
90
- 'get_views',
91
- 'get_bulk_actions',
92
- 'bulk_actions',
93
- 'row_actions',
94
- 'months_dropdown',
95
- 'view_switcher',
96
- 'comments_bubble',
97
- 'get_items_per_page',
98
- 'pagination',
99
- 'get_sortable_columns',
100
- 'get_column_info',
101
- 'get_table_classes',
102
- 'display_tablenav',
103
- 'extra_tablenav',
104
- 'single_row_columns',
105
- );
106
-
107
- /**
108
- * Constructor.
109
- *
110
- * The child class should call this constructor from its own constructor to override
111
- * the default $args.
112
- *
113
- * @since 3.1.0
114
- * @access public
115
- *
116
- * @param array|string $args {
117
- * Array or string of arguments.
118
- *
119
- * @type string $plural Plural value used for labels and the objects being listed.
120
- * This affects things such as CSS class-names and nonces used
121
- * in the list table, e.g. 'posts'. Default empty.
122
- * @type string $singular Singular label for an object being listed, e.g. 'post'.
123
- * Default empty
124
- * @type bool $ajax Whether the list table supports AJAX. This includes loading
125
- * and sorting data, for example. If true, the class will call
126
- * the {@see _js_vars()} method in the footer to provide variables
127
- * to any scripts handling AJAX events. Default false.
128
- * @type string $screen String containing the hook name used to determine the current
129
- * screen. If left null, the current screen will be automatically set.
130
- * Default null.
131
- * }
132
- */
133
- public function __construct( $args = array() ) {
134
- $args = wp_parse_args(
135
- $args,
136
- array(
137
- 'plural' => '',
138
- 'singular' => '',
139
- 'ajax' => false,
140
- 'screen' => null,
141
- )
142
- );
143
-
144
- $this->screen = convert_to_screen( $args['screen'] );
145
-
146
- add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
147
-
148
- if ( ! $args['plural'] ) {
149
- $args['plural'] = $this->screen->base;
150
- }
151
-
152
- $args['plural'] = sanitize_key( $args['plural'] );
153
- $args['singular'] = sanitize_key( $args['singular'] );
154
-
155
- $this->_args = $args;
156
-
157
- if ( $args['ajax'] ) {
158
- // wp_enqueue_script( 'list-table' );
159
- add_action( 'admin_footer', array( $this, '_js_vars' ) );
160
- }
161
-
162
- if ( empty( $this->modes ) ) {
163
- $this->modes = array(
164
- 'list' => esc_html__( 'List View', 'strong-testimonials' ),
165
- 'excerpt' => esc_html__( 'Excerpt View', 'strong-testimonials' ),
166
- );
167
- }
168
- }
169
-
170
- /**
171
- * Make private properties readable for backwards compatibility.
172
- *
173
- * @since 4.0.0
174
- * @access public
175
- *
176
- * @param string $name Property to get.
177
- * @return mixed Property.
178
- */
179
- public function __get( $name ) {
180
- if ( in_array( $name, $this->compat_fields ) ) {
181
- return $this->$name;
182
- }
183
- }
184
-
185
- /**
186
- * Make private properties settable for backwards compatibility.
187
- *
188
- * @since 4.0.0
189
- * @access public
190
- *
191
- * @param string $name Property to check if set.
192
- * @param mixed $value Property value.
193
- * @return mixed Newly-set property.
194
- */
195
- public function __set( $name, $value ) {
196
- if ( in_array( $name, $this->compat_fields ) ) {
197
- return $this->$name = $value;
198
- }
199
- }
200
-
201
- /**
202
- * Make private properties checkable for backwards compatibility.
203
- *
204
- * @since 4.0.0
205
- * @access public
206
- *
207
- * @param string $name Property to check if set.
208
- * @return bool Whether the property is set.
209
- */
210
- public function __isset( $name ) {
211
- if ( in_array( $name, $this->compat_fields ) ) {
212
- return isset( $this->$name );
213
- }
214
- }
215
-
216
- /**
217
- * Make private properties un-settable for backwards compatibility.
218
- *
219
- * @since 4.0.0
220
- * @access public
221
- *
222
- * @param string $name Property to unset.
223
- */
224
- public function __unset( $name ) {
225
- if ( in_array( $name, $this->compat_fields ) ) {
226
- unset( $this->$name );
227
- }
228
- }
229
-
230
- /**
231
- * Make private/protected methods readable for backwards compatibility.
232
- *
233
- * @since 4.0.0
234
- * @access public
235
- *
236
- * @param callable $name Method to call.
237
- * @param array $arguments Arguments to pass when calling.
238
- * @return mixed|bool Return value of the callback, false otherwise.
239
- */
240
- public function __call( $name, $arguments ) {
241
- if ( in_array( $name, $this->compat_methods ) ) {
242
- return call_user_func_array( array( $this, $name ), $arguments );
243
- }
244
- return false;
245
- }
246
-
247
- /**
248
- * Checks the current user's permissions
249
- *
250
- * @since 3.1.0
251
- * @access public
252
- * @abstract
253
- */
254
- public function ajax_user_can() {
255
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
256
- }
257
-
258
- /**
259
- * Prepares the list of items for displaying.
260
- * @uses WP_List_Table::set_pagination_args()
261
- *
262
- * @since 3.1.0
263
- * @access public
264
- * @abstract
265
- */
266
- public function prepare_items() {
267
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
268
- }
269
-
270
- /**
271
- * An internal method that sets all the necessary pagination arguments
272
- *
273
- * @param array $args An associative array with information about the pagination
274
- * @access protected
275
- */
276
- protected function set_pagination_args( $args ) {
277
- $args = wp_parse_args(
278
- $args,
279
- array(
280
- 'total_items' => 0,
281
- 'total_pages' => 0,
282
- 'per_page' => 0,
283
- )
284
- );
285
-
286
- if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
287
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
288
- }
289
-
290
- // Redirect if page number is invalid and headers are not already sent.
291
- if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
292
- wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
293
- exit;
294
- }
295
-
296
- $this->_pagination_args = $args;
297
- }
298
-
299
- /**
300
- * Access the pagination args.
301
- *
302
- * @since 3.1.0
303
- * @access public
304
- *
305
- * @param string $key Pagination argument to retrieve. Common values include 'total_items',
306
- * 'total_pages', 'per_page', or 'infinite_scroll'.
307
- * @return int Number of items that correspond to the given pagination argument.
308
- */
309
- public function get_pagination_arg( $key ) {
310
- if ( 'page' == $key ) {
311
- return $this->get_pagenum();
312
- }
313
-
314
- if ( isset( $this->_pagination_args[ $key ] ) ) {
315
- return $this->_pagination_args[ $key ];
316
- }
317
- }
318
-
319
- /**
320
- * Whether the table has items to display or not
321
- *
322
- * @since 3.1.0
323
- * @access public
324
- *
325
- * @return bool
326
- */
327
- public function has_items() {
328
- return ! empty( $this->items );
329
- }
330
-
331
- /**
332
- * Message to be displayed when there are no items
333
- *
334
- * @since 3.1.0
335
- * @access public
336
- */
337
- public function no_items() {
338
- esc_html_e( 'No items found.', 'strong-testimonials' );
339
- }
340
-
341
- /**
342
- * Display the search box.
343
- *
344
- * @since 3.1.0
345
- * @access public
346
- *
347
- * @param string $text The search button text
348
- * @param string $input_id The search input id
349
- */
350
- public function search_box( $text, $input_id ) {
351
- if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
- return;
353
- }
354
-
355
- $input_id = $input_id . '-search-input';
356
-
357
- if ( ! empty( $_REQUEST['orderby'] ) ) {
358
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
359
- }
360
- if ( ! empty( $_REQUEST['order'] ) ) {
361
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
362
- }
363
- if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
- echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
365
- }
366
- if ( ! empty( $_REQUEST['detached'] ) ) {
367
- echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
368
- }
369
- ?>
370
- <p class="search-box">
371
- <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
372
- <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>">
373
- <?php submit_button( esc_html( $text ), 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
374
- </p>
375
- <?php
376
- }
377
-
378
- /**
379
- * Get an associative array ( id => link ) with the list
380
- * of views available on this table.
381
- *
382
- * @since 3.1.0
383
- * @access protected
384
- *
385
- * @return array
386
- */
387
- protected function get_views() {
388
- return array();
389
- }
390
-
391
- /**
392
- * Display the list of views available on this table.
393
- *
394
- * @since 3.1.0
395
- * @access public
396
- */
397
- public function views() {
398
- $views = $this->get_views();
399
- /**
400
- * Filter the list of available list table views.
401
- *
402
- * The dynamic portion of the hook name, `$this->screen->id`, refers
403
- * to the ID of the current screen, usually a string.
404
- *
405
- * @since 3.5.0
406
- *
407
- * @param array $views An array of available list table views.
408
- */
409
- $views = apply_filters( "views_{$this->screen->id}", $views );
410
-
411
- if ( empty( $views ) ) {
412
- return;
413
- }
414
-
415
- echo "<ul class='subsubsub'>\n";
416
- foreach ( $views as $class => $view ) {
417
- $views[ $class ] = "\t<li class='$class'>$view";
418
- }
419
- echo implode( " |</li>\n", wp_kses_post( $views ) ) . "</li>\n";
420
- echo '</ul>';
421
- }
422
-
423
- /**
424
- * Get an associative array ( option_name => option_title ) with the list
425
- * of bulk actions available on this table.
426
- *
427
- * @since 3.1.0
428
- * @access protected
429
- *
430
- * @return array
431
- */
432
- protected function get_bulk_actions() {
433
- return array();
434
- }
435
-
436
- /**
437
- * Display the bulk actions dropdown.
438
- *
439
- * @since 3.1.0
440
- * @access protected
441
- *
442
- * @param string $which The location of the bulk actions: 'top' or 'bottom'.
443
- * This is designated as optional for backwards-compatibility.
444
- */
445
- protected function bulk_actions( $which = '' ) {
446
- if ( is_null( $this->_actions ) ) {
447
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
448
- /**
449
- * Filter the list table Bulk Actions drop-down.
450
- *
451
- * The dynamic portion of the hook name, `$this->screen->id`, refers
452
- * to the ID of the current screen, usually a string.
453
- *
454
- * This filter can currently only be used to remove bulk actions.
455
- *
456
- * @since 3.5.0
457
- *
458
- * @param array $actions An array of the available bulk actions.
459
- */
460
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
461
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
462
- $two = '';
463
- } else {
464
- $two = '2';
465
- }
466
-
467
- if ( empty( $this->_actions ) ) {
468
- return;
469
- }
470
-
471
- echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_html__( 'Select bulk action', 'strong-testimonials' ) . '</label>';
472
- echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
473
- echo "<option value='-1' selected='selected'>" . esc_html__( 'Bulk Actions', 'strong-testimonials' ) . "</option>\n";
474
-
475
- foreach ( $this->_actions as $name => $title ) {
476
- $class = 'edit' == $name ? 'hide-if-no-js' : '';
477
-
478
- echo "\t<option value='" . esc_attr( $name ) . "' class='" . esc_attr($class) . "'>" . esc_html( $title ) . "</option>\n";
479
- }
480
-
481
- echo "</select>\n";
482
-
483
- submit_button( esc_html__( 'Apply', 'strong-testimonials' ), 'action', '', false, array( 'id' => "doaction$two" ) );
484
- echo "\n";
485
- }
486
-
487
- /**
488
- * Get the current action selected from the bulk actions dropdown.
489
- *
490
- * @since 3.1.0
491
- * @access public
492
- *
493
- * @return string|bool The action name or False if no action was selected
494
- */
495
- public function current_action() {
496
- if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
497
- return false;
498
- }
499
-
500
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
501
- return $_REQUEST['action'];
502
- }
503
-
504
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
505
- return $_REQUEST['action2'];
506
- }
507
-
508
- return false;
509
- }
510
-
511
- /**
512
- * Generate row actions div
513
- *
514
- * @since 3.1.0
515
- * @access protected
516
- *
517
- * @param array $actions The list of actions
518
- * @param bool $always_visible Whether the actions should be always visible
519
- * @return string
520
- */
521
- protected function row_actions( $actions, $always_visible = false ) {
522
- $action_count = count( $actions );
523
- $i = 0;
524
-
525
- if ( ! $action_count ) {
526
- return '';
527
- }
528
-
529
- $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
530
- foreach ( $actions as $action => $link ) {
531
- ++$i;
532
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
533
- $out .= "<span class='$action'>$link$sep</span>";
534
- }
535
- $out .= '</div>';
536
-
537
- return $out;
538
- }
539
-
540
- /**
541
- * Display a monthly dropdown for filtering items
542
- *
543
- * @since 3.1.0
544
- * @access protected
545
- *
546
- * @param string $post_type
547
- */
548
- protected function months_dropdown( $post_type ) {
549
- global $wpdb, $wp_locale;
550
-
551
- /**
552
- * Filter whether to remove the 'Months' drop-down from the post list table.
553
- *
554
- * @since 4.2.0
555
- *
556
- * @param bool $disable Whether to disable the drop-down. Default false.
557
- * @param string $post_type The post type.
558
- */
559
- if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
560
- return;
561
- }
562
-
563
- $months = $wpdb->get_results(
564
- $wpdb->prepare(
565
- "
566
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
567
- FROM $wpdb->posts
568
- WHERE post_type = %s
569
- ORDER BY post_date DESC
570
- ",
571
- $post_type
572
- )
573
- );
574
-
575
- /**
576
- * Filter the 'Months' drop-down results.
577
- *
578
- * @since 3.7.0
579
- *
580
- * @param object $months The months drop-down query results.
581
- * @param string $post_type The post type.
582
- */
583
- $months = apply_filters( 'months_dropdown_results', $months, $post_type );
584
-
585
- $month_count = count( $months );
586
-
587
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
588
- return;
589
- }
590
-
591
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
592
- ?>
593
- <label for="filter-by-date" class="screen-reader-text"><?php esc_html_e( 'Filter by date', 'strong-testimonials' ); ?></label>
594
- <select name="m" id="filter-by-date">
595
- <option<?php selected( $m, 0 ); ?> value="0"><?php esc_html_e( 'All dates', 'strong-testimonials' ); ?></option>
596
- <?php
597
- foreach ( $months as $arc_row ) {
598
- if ( 0 == $arc_row->year ) {
599
- continue;
600
- }
601
-
602
- $month = zeroise( $arc_row->month, 2 );
603
- $year = $arc_row->year;
604
-
605
- printf(
606
- "<option %s value='%s'>%s</option>\n",
607
- selected( $m, $year . $month, false ),
608
- esc_attr( $arc_row->year . $month ),
609
- /* translators: 1: month name, 2: 4-digit year */
610
- sprintf( '%1$s %2$d', esc_html( $wp_locale->get_month( $month ) ), esc_html( $year) )
611
- );
612
- }
613
- ?>
614
- </select>
615
- <?php
616
- }
617
-
618
- /**
619
- * Display a view switcher
620
- *
621
- * @since 3.1.0
622
- * @access protected
623
- *
624
- * @param string $current_mode
625
- */
626
- protected function view_switcher( $current_mode ) {
627
- ?>
628
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
629
- <div class="view-switch">
630
- <?php
631
- foreach ( $this->modes as $mode => $title ) {
632
- $classes = array( 'view-' . $mode );
633
- if ( $current_mode == $mode ) {
634
- $classes[] = 'current';
635
- }
636
- printf(
637
- "<a href='%s' class='%s' id='view-switch-%s'><span class='screen-reader-text'>%s</span></a>\n",
638
- esc_url(add_query_arg('mode', $mode)),
639
- esc_attr(implode(' ', $classes)),
640
- esc_attr($mode),
641
- esc_html($title)
642
- );
643
- }
644
- ?>
645
- </div>
646
- <?php
647
- }
648
-
649
- /**
650
- * Display a comment count bubble
651
- *
652
- * @since 3.1.0
653
- * @access protected
654
- *
655
- * @param int $post_id The post ID.
656
- * @param int $pending_comments Number of pending comments.
657
- */
658
- protected function comments_bubble( $post_id, $pending_comments ) {
659
- $pending_phrase = sprintf( __( '%s pending', 'strong-testimonials' ), number_format( $pending_comments ) );
660
-
661
- if ( $pending_comments ) {
662
- echo '<strong>';
663
- }
664
-
665
- echo "<a href='" . esc_url( add_query_arg( 'p', absint( $post_id ), admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . absint( number_format_i18n( get_comments_number() ) ) . '</span></a>';
666
-
667
- if ( $pending_comments ) {
668
- echo '</strong>';
669
- }
670
- }
671
-
672
- /**
673
- * Get the current page number
674
- *
675
- * @since 3.1.0
676
- * @access public
677
- *
678
- * @return int
679
- */
680
- public function get_pagenum() {
681
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
682
-
683
- if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
684
- $pagenum = $this->_pagination_args['total_pages'];
685
- }
686
-
687
- return max( 1, $pagenum );
688
- }
689
-
690
- /**
691
- * Get number of items to display on a single page
692
- *
693
- * @since 3.1.0
694
- * @access protected
695
- *
696
- * @param string $option
697
- * @param int $default
698
- * @return int
699
- */
700
- protected function get_items_per_page( $option, $default = 20 ) {
701
- $per_page = (int) get_user_option( $option );
702
- if ( empty( $per_page ) || $per_page < 1 ) {
703
- $per_page = $default;
704
- }
705
-
706
- /**
707
- * Filter the number of items to be displayed on each page of the list table.
708
- *
709
- * The dynamic hook name, $option, refers to the `per_page` option depending
710
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
711
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
712
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
713
- * 'edit_{$post_type}_per_page', etc.
714
- *
715
- * @since 2.9.0
716
- *
717
- * @param int $per_page Number of items to be displayed. Default 20.
718
- */
719
- return (int) apply_filters( $option, $per_page );
720
- }
721
-
722
- /**
723
- * Display the pagination.
724
- *
725
- * @since 3.1.0
726
- * @access protected
727
- *
728
- * @param string $which
729
- */
730
- protected function pagination( $which ) {
731
- if ( empty( $this->_pagination_args ) ) {
732
- return;
733
- }
734
-
735
- $total_items = $this->_pagination_args['total_items'];
736
- $total_pages = $this->_pagination_args['total_pages'];
737
- $infinite_scroll = false;
738
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
739
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
740
- }
741
-
742
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items, 'strong-testimonials' ), number_format_i18n( $total_items ) ) . '</span>';
743
-
744
- $current = $this->get_pagenum();
745
-
746
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
747
-
748
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
749
-
750
- $page_links = array();
751
-
752
- $disable_first = $disable_last = '';
753
- if ( $current == 1 ) {
754
- $disable_first = ' disabled';
755
- }
756
- if ( $current == $total_pages ) {
757
- $disable_last = ' disabled';
758
- }
759
- $page_links[] = sprintf(
760
- "<a class='%s' title='%s' href='%s'>%s</a>",
761
- 'first-page' . $disable_first,
762
- esc_attr__( 'Go to the first page', 'strong-testimonials' ),
763
- esc_url( remove_query_arg( 'paged', $current_url ) ),
764
- '&laquo;'
765
- );
766
-
767
- $page_links[] = sprintf(
768
- "<a class='%s' title='%s' href='%s'>%s</a>",
769
- 'prev-page' . $disable_first,
770
- esc_attr__( 'Go to the previous page', 'strong-testimonials' ),
771
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
772
- '&lsaquo;'
773
- );
774
-
775
- if ( 'bottom' == $which ) {
776
- $html_current_page = $current;
777
- } else {
778
- $html_current_page = sprintf(
779
- "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
780
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page', 'strong-testimonials' ) . '</label>',
781
- esc_attr__( 'Current page', 'strong-testimonials' ),
782
- $current,
783
- strlen( $total_pages )
784
- );
785
- }
786
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
787
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging', 'strong-testimonials' ), $html_current_page, $html_total_pages ) . '</span>';
788
-
789
- $page_links[] = sprintf(
790
- "<a class='%s' title='%s' href='%s'>%s</a>",
791
- 'next-page' . $disable_last,
792
- esc_attr__( 'Go to the next page', 'strong-testimonials' ),
793
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
794
- '&rsaquo;'
795
- );
796
-
797
- $page_links[] = sprintf(
798
- "<a class='%s' title='%s' href='%s'>%s</a>",
799
- 'last-page' . $disable_last,
800
- esc_attr__( 'Go to the last page', 'strong-testimonials' ),
801
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
802
- '&raquo;'
803
- );
804
-
805
- $pagination_links_class = 'pagination-links';
806
- if ( ! empty( $infinite_scroll ) ) {
807
- $pagination_links_class = ' hide-if-js';
808
- }
809
- $output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
810
-
811
- if ( $total_pages ) {
812
- $page_class = $total_pages < 2 ? ' one-page' : '';
813
- } else {
814
- $page_class = ' no-pages';
815
- }
816
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
817
-
818
- echo $this->_pagination;
819
- }
820
-
821
- /**
822
- * Get a list of columns. The format is:
823
- * 'internal-name' => 'Title'
824
- *
825
- * @since 3.1.0
826
- * @access public
827
- * @abstract
828
- *
829
- * @return array
830
- */
831
- public function get_columns() {
832
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
833
- }
834
-
835
- /**
836
- * Get a list of sortable columns. The format is:
837
- * 'internal-name' => 'orderby'
838
- * or
839
- * 'internal-name' => array( 'orderby', true )
840
- *
841
- * The second format will make the initial sorting order be descending
842
- *
843
- * @since 3.1.0
844
- * @access protected
845
- *
846
- * @return array
847
- */
848
- protected function get_sortable_columns() {
849
- return array();
850
- }
851
-
852
- /**
853
- * Get a list of all, hidden and sortable columns, with filter applied
854
- *
855
- * @since 3.1.0
856
- * @access protected
857
- *
858
- * @return array
859
- */
860
- protected function get_column_info() {
861
- if ( isset( $this->_column_headers ) ) {
862
- return $this->_column_headers;
863
- }
864
-
865
- $columns = get_column_headers( $this->screen );
866
- $hidden = get_hidden_columns( $this->screen );
867
-
868
- $sortable_columns = $this->get_sortable_columns();
869
- /**
870
- * Filter the list table sortable columns for a specific screen.
871
- *
872
- * The dynamic portion of the hook name, `$this->screen->id`, refers
873
- * to the ID of the current screen, usually a string.
874
- *
875
- * @since 3.5.0
876
- *
877
- * @param array $sortable_columns An array of sortable columns.
878
- */
879
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
880
-
881
- $sortable = array();
882
- foreach ( $_sortable as $id => $data ) {
883
- if ( empty( $data ) ) {
884
- continue;
885
- }
886
-
887
- $data = (array) $data;
888
- if ( ! isset( $data[1] ) ) {
889
- $data[1] = false;
890
- }
891
-
892
- $sortable[ $id ] = $data;
893
- }
894
-
895
- $this->_column_headers = array( $columns, $hidden, $sortable );
896
-
897
- return $this->_column_headers;
898
- }
899
-
900
- /**
901
- * Return number of visible columns
902
- *
903
- * @since 3.1.0
904
- * @access public
905
- *
906
- * @return int
907
- */
908
- public function get_column_count() {
909
- list ( $columns, $hidden ) = $this->get_column_info();
910
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
911
- return count( $columns ) - count( $hidden );
912
- }
913
-
914
- /**
915
- * Print column headers, accounting for hidden and sortable columns.
916
- *
917
- * @since 3.1.0
918
- * @access public
919
- *
920
- * @param bool $with_id Whether to set the id attribute or not
921
- */
922
- public function print_column_headers( $with_id = true ) {
923
- list( $columns, $hidden, $sortable ) = $this->get_column_info();
924
-
925
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
926
- $current_url = remove_query_arg( 'paged', $current_url );
927
-
928
- if ( isset( $_GET['orderby'] ) ) {
929
- $current_orderby = sanitize_text_field( $_GET['orderby'] );
930
- } else {
931
- $current_orderby = '';
932
- }
933
-
934
- if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) {
935
- $current_order = 'desc';
936
- } else {
937
- $current_order = 'asc';
938
- }
939
-
940
- if ( ! empty( $columns['cb'] ) ) {
941
- static $cb_counter = 1;
942
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . esc_html__( 'Select All', 'strong-testimonials' ) . '</label>'
943
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
944
- $cb_counter++;
945
- }
946
-
947
- foreach ( $columns as $column_key => $column_display_name ) {
948
- $class = array( 'manage-column', "column-$column_key" );
949
-
950
- $style = '';
951
- if ( in_array( $column_key, $hidden ) ) {
952
- $style = 'display:none;';
953
- }
954
-
955
- $style = ' style="' . $style . '"';
956
-
957
- if ( 'cb' == $column_key ) {
958
- $class[] = 'check-column';
959
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
960
- $class[] = 'num';
961
- }
962
-
963
- if ( isset( $sortable[ $column_key ] ) ) {
964
- list( $orderby, $desc_first ) = $sortable[ $column_key ];
965
-
966
- if ( $current_orderby == $orderby ) {
967
- $order = 'asc' == $current_order ? 'desc' : 'asc';
968
- $class[] = 'sorted';
969
- $class[] = $current_order;
970
- } else {
971
- $order = $desc_first ? 'desc' : 'asc';
972
- $class[] = 'sortable';
973
- $class[] = $desc_first ? 'asc' : 'desc';
974
- }
975
-
976
- $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
977
- }
978
-
979
- $id = $with_id ? "id='$column_key'" : '';
980
-
981
- if ( ! empty( $class ) ) {
982
- $class = "class='" . implode( ' ', $class ) . "'";
983
- }
984
-
985
- echo "<th scope='col' $id $class $style>$column_display_name</th>";
986
- }
987
- }
988
-
989
- /**
990
- * Display the table
991
- *
992
- * @since 3.1.0
993
- * @access public
994
- */
995
- public function display() {
996
- $singular = $this->_args['singular'];
997
-
998
- $this->display_tablenav( 'top' );
999
-
1000
- ?>
1001
- <table class="wp-list-table <?php echo esc_attr(implode(' ', $this->get_table_classes())); ?>">
1002
- <thead>
1003
- <tr>
1004
- <?php $this->print_column_headers(); ?>
1005
- </tr>
1006
- </thead>
1007
-
1008
- <tbody id="the-list"
1009
- <?php
1010
- if ( $singular ) {
1011
- echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
1012
- }
1013
- ?>
1014
- >
1015
- <?php $this->display_rows_or_placeholder(); ?>
1016
- </tbody>
1017
-
1018
- <tfoot>
1019
- <tr>
1020
- <?php $this->print_column_headers( false ); ?>
1021
- </tr>
1022
- </tfoot>
1023
-
1024
- </table>
1025
- <?php
1026
- $this->display_tablenav( 'bottom' );
1027
- }
1028
-
1029
- /**
1030
- * Get a list of CSS classes for the list table table tag.
1031
- *
1032
- * @since 3.1.0
1033
- * @access protected
1034
- *
1035
- * @return array List of CSS classes for the table tag.
1036
- */
1037
- protected function get_table_classes() {
1038
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1039
- }
1040
-
1041
- /**
1042
- * Generate the table navigation above or below the table
1043
- *
1044
- * @since 3.1.0
1045
- * @access protected
1046
- * @param string $which
1047
- */
1048
- protected function display_tablenav( $which ) {
1049
- if ( 'top' == $which ) {
1050
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1051
- }
1052
- ?>
1053
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
1054
-
1055
- <div class="alignleft actions bulkactions">
1056
- <?php $this->bulk_actions( $which ); ?>
1057
- </div>
1058
- <?php
1059
- $this->extra_tablenav( $which );
1060
- $this->pagination( $which );
1061
- ?>
1062
-
1063
- <br class="clear">
1064
- </div>
1065
- <?php
1066
- }
1067
-
1068
- /**
1069
- * Extra controls to be displayed between bulk actions and pagination
1070
- *
1071
- * @since 3.1.0
1072
- * @access protected
1073
- *
1074
- * @param string $which
1075
- */
1076
- protected function extra_tablenav( $which ) {}
1077
-
1078
- /**
1079
- * Generate the tbody element for the list table.
1080
- *
1081
- * @since 3.1.0
1082
- * @access public
1083
- */
1084
- public function display_rows_or_placeholder() {
1085
- if ( $this->has_items() ) {
1086
- $this->display_rows();
1087
- } else {
1088
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . absint( $this->get_column_count() ) . '">';
1089
- $this->no_items();
1090
- echo '</td></tr>';
1091
- }
1092
- }
1093
-
1094
- /**
1095
- * Generate the table rows
1096
- *
1097
- * @since 3.1.0
1098
- * @access public
1099
- */
1100
- public function display_rows() {
1101
- foreach ( $this->items as $item ) {
1102
- $this->single_row( $item );
1103
- }
1104
- }
1105
-
1106
- /**
1107
- * Generates content for a single row of the table
1108
- *
1109
- * @since 3.1.0
1110
- * @access public
1111
- *
1112
- * @param object $item The current item
1113
- */
1114
- public function single_row( $item ) {
1115
- echo '<tr>';
1116
- $this->single_row_columns( $item );
1117
- echo '</tr>';
1118
- }
1119
-
1120
- protected function column_default( $item, $column_name ) {}
1121
-
1122
- protected function column_cb( $item ) {}
1123
-
1124
- /**
1125
- * Generates the columns for a single row of the table
1126
- *
1127
- * @since 3.1.0
1128
- * @access protected
1129
- *
1130
- * @param object $item The current item
1131
- */
1132
- protected function single_row_columns( $item ) {
1133
- list( $columns, $hidden ) = $this->get_column_info();
1134
-
1135
- foreach ( $columns as $column_name => $column_display_name ) {
1136
- $class = "class='$column_name column-$column_name'";
1137
-
1138
- $style = '';
1139
- if ( in_array( $column_name, $hidden ) ) {
1140
- $style = ' style="display:none;"';
1141
- }
1142
-
1143
- $attributes = "$class$style";
1144
-
1145
- if ( 'cb' == $column_name ) {
1146
- echo '<th scope="row" class="check-column">';
1147
- echo $this->column_cb( $item );
1148
- echo '</th>';
1149
- } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1150
- echo "<td $attributes>";
1151
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1152
- echo '</td>';
1153
- } else {
1154
- echo "<td $attributes>";
1155
- echo $this->column_default( $item, $column_name );
1156
- echo '</td>';
1157
- }
1158
- }
1159
- }
1160
-
1161
- /**
1162
- * Handle an incoming ajax request (called from admin-ajax.php)
1163
- *
1164
- * @since 3.1.0
1165
- * @access public
1166
- */
1167
- public function ajax_response() {
1168
- $this->prepare_items();
1169
-
1170
- ob_start();
1171
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1172
- $this->display_rows();
1173
- } else {
1174
- $this->display_rows_or_placeholder();
1175
- }
1176
-
1177
- $rows = ob_get_clean();
1178
-
1179
- $response = array( 'rows' => $rows );
1180
-
1181
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1182
- $response['total_items_i18n'] = sprintf(
1183
- _n( '1 item', '%s items', $this->_pagination_args['total_items'], 'strong-testimonials' ),
1184
- number_format_i18n( $this->_pagination_args['total_items'] )
1185
- );
1186
- }
1187
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1188
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1189
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1190
- }
1191
-
1192
- die( wp_json_encode( $response ) );
1193
- }
1194
-
1195
- /**
1196
- * Send required variables to JavaScript land
1197
- *
1198
- * @access public
1199
- */
1200
- public function _js_vars() {
1201
- $args = array(
1202
- 'class' => get_class( $this ),
1203
- 'screen' => array(
1204
- 'id' => $this->screen->id,
1205
- 'base' => $this->screen->base,
1206
- ),
1207
- );
1208
-
1209
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1210
- }
1211
- }
1212
-
1213
  endif;
1
+ <?php
2
+ /**
3
+ * Base class for displaying a list of items in an ajaxified HTML table.
4
+ *
5
+ * -!- This is a copy of /wp-admin/includes/class-wp-list-table.php. -!-
6
+ * See Codex for reasoning.
7
+ * @link http://codex.wordpress.org/Class_Reference/WP_List_Table
8
+ *
9
+ * @since 3.1.0
10
+ * @access private
11
+ */
12
+
13
+ if ( ! class_exists( 'Strong_Testimonials_List_Table' ) ) :
14
+
15
+ class Strong_Testimonials_List_Table {
16
+
17
+ /**
18
+ * The current list of items
19
+ *
20
+ * @since 3.1.0
21
+ * @var array
22
+ * @access public
23
+ */
24
+ public $items;
25
+
26
+ /**
27
+ * Various information about the current table
28
+ *
29
+ * @since 3.1.0
30
+ * @var array
31
+ * @access protected
32
+ */
33
+ protected $_args;
34
+
35
+ /**
36
+ * Various information needed for displaying the pagination
37
+ *
38
+ * @since 3.1.0
39
+ * @var array
40
+ */
41
+ protected $_pagination_args = array();
42
+
43
+ /**
44
+ * The current screen
45
+ *
46
+ * @since 3.1.0
47
+ * @var object
48
+ * @access protected
49
+ */
50
+ protected $screen;
51
+
52
+ /**
53
+ * Cached bulk actions
54
+ *
55
+ * @since 3.1.0
56
+ * @var array
57
+ * @access private
58
+ */
59
+ private $_actions;
60
+
61
+ /**
62
+ * Cached pagination output
63
+ *
64
+ * @since 3.1.0
65
+ * @var string
66
+ * @access private
67
+ */
68
+ private $_pagination;
69
+
70
+ /**
71
+ * The view switcher modes.
72
+ *
73
+ * @since 4.1.0
74
+ * @var array
75
+ * @access protected
76
+ */
77
+ protected $modes = array();
78
+
79
+ /**
80
+ * Stores the value returned by ->get_column_info()
81
+ *
82
+ * @var array
83
+ */
84
+ protected $_column_headers;
85
+
86
+ protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
87
+
88
+ protected $compat_methods = array(
89
+ 'set_pagination_args',
90
+ 'get_views',
91
+ 'get_bulk_actions',
92
+ 'bulk_actions',
93
+ 'row_actions',
94
+ 'months_dropdown',
95
+ 'view_switcher',
96
+ 'comments_bubble',
97
+ 'get_items_per_page',
98
+ 'pagination',
99
+ 'get_sortable_columns',
100
+ 'get_column_info',
101
+ 'get_table_classes',
102
+ 'display_tablenav',
103
+ 'extra_tablenav',
104
+ 'single_row_columns',
105
+ );
106
+
107
+ /**
108
+ * Constructor.
109
+ *
110
+ * The child class should call this constructor from its own constructor to override
111
+ * the default $args.
112
+ *
113
+ * @since 3.1.0
114
+ * @access public
115
+ *
116
+ * @param array|string $args {
117
+ * Array or string of arguments.
118
+ *
119
+ * @type string $plural Plural value used for labels and the objects being listed.
120
+ * This affects things such as CSS class-names and nonces used
121
+ * in the list table, e.g. 'posts'. Default empty.
122
+ * @type string $singular Singular label for an object being listed, e.g. 'post'.
123
+ * Default empty
124
+ * @type bool $ajax Whether the list table supports AJAX. This includes loading
125
+ * and sorting data, for example. If true, the class will call
126
+ * the {@see _js_vars()} method in the footer to provide variables
127
+ * to any scripts handling AJAX events. Default false.
128
+ * @type string $screen String containing the hook name used to determine the current
129
+ * screen. If left null, the current screen will be automatically set.
130
+ * Default null.
131
+ * }
132
+ */
133
+ public function __construct( $args = array() ) {
134
+ $args = wp_parse_args(
135
+ $args,
136
+ array(
137
+ 'plural' => '',
138
+ 'singular' => '',
139
+ 'ajax' => false,
140
+ 'screen' => null,
141
+ )
142
+ );
143
+
144
+ $this->screen = convert_to_screen( $args['screen'] );
145
+
146
+ add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
147
+
148
+ if ( ! $args['plural'] ) {
149
+ $args['plural'] = $this->screen->base;
150
+ }
151
+
152
+ $args['plural'] = sanitize_key( $args['plural'] );
153
+ $args['singular'] = sanitize_key( $args['singular'] );
154
+
155
+ $this->_args = $args;
156
+
157
+ if ( $args['ajax'] ) {
158
+ // wp_enqueue_script( 'list-table' );
159
+ add_action( 'admin_footer', array( $this, '_js_vars' ) );
160
+ }
161
+
162
+ if ( empty( $this->modes ) ) {
163
+ $this->modes = array(
164
+ 'list' => esc_html__( 'List View', 'strong-testimonials' ),
165
+ 'excerpt' => esc_html__( 'Excerpt View', 'strong-testimonials' ),
166
+ );
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Make private properties readable for backwards compatibility.
172
+ *
173
+ * @since 4.0.0
174
+ * @access public
175
+ *
176
+ * @param string $name Property to get.
177
+ * @return mixed Property.
178
+ */
179
+ public function __get( $name ) {
180
+ if ( in_array( $name, $this->compat_fields ) ) {
181
+ return $this->$name;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Make private properties settable for backwards compatibility.
187
+ *
188
+ * @since 4.0.0
189
+ * @access public
190
+ *
191
+ * @param string $name Property to check if set.
192
+ * @param mixed $value Property value.
193
+ * @return mixed Newly-set property.
194
+ */
195
+ public function __set( $name, $value ) {
196
+ if ( in_array( $name, $this->compat_fields ) ) {
197
+ return $this->$name = $value;
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Make private properties checkable for backwards compatibility.
203
+ *
204
+ * @since 4.0.0
205
+ * @access public
206
+ *
207
+ * @param string $name Property to check if set.
208
+ * @return bool Whether the property is set.
209
+ */
210
+ public function __isset( $name ) {
211
+ if ( in_array( $name, $this->compat_fields ) ) {
212
+ return isset( $this->$name );
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Make private properties un-settable for backwards compatibility.
218
+ *
219
+ * @since 4.0.0
220
+ * @access public
221
+ *
222
+ * @param string $name Property to unset.
223
+ */
224
+ public function __unset( $name ) {
225
+ if ( in_array( $name, $this->compat_fields ) ) {
226
+ unset( $this->$name );
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Make private/protected methods readable for backwards compatibility.
232
+ *
233
+ * @since 4.0.0
234
+ * @access public
235
+ *
236
+ * @param callable $name Method to call.
237
+ * @param array $arguments Arguments to pass when calling.
238
+ * @return mixed|bool Return value of the callback, false otherwise.
239
+ */
240
+ public function __call( $name, $arguments ) {
241
+ if ( in_array( $name, $this->compat_methods ) ) {
242
+ return call_user_func_array( array( $this, $name ), $arguments );
243
+ }
244
+ return false;
245
+ }
246
+
247
+ /**
248
+ * Checks the current user's permissions
249
+ *
250
+ * @since 3.1.0
251
+ * @access public
252
+ * @abstract
253
+ */
254
+ public function ajax_user_can() {
255
+ die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
256
+ }
257
+
258
+ /**
259
+ * Prepares the list of items for displaying.
260
+ * @uses WP_List_Table::set_pagination_args()
261
+ *
262
+ * @since 3.1.0
263
+ * @access public
264
+ * @abstract
265
+ */
266
+ public function prepare_items() {
267
+ die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
268
+ }
269
+
270
+ /**
271
+ * An internal method that sets all the necessary pagination arguments
272
+ *
273
+ * @param array $args An associative array with information about the pagination
274
+ * @access protected
275
+ */
276
+ protected function set_pagination_args( $args ) {
277
+ $args = wp_parse_args(
278
+ $args,
279
+ array(
280
+ 'total_items' => 0,
281
+ 'total_pages' => 0,
282
+ 'per_page' => 0,
283
+ )
284
+ );
285
+
286
+ if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
287
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
288
+ }
289
+
290
+ // Redirect if page number is invalid and headers are not already sent.
291
+ if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
292
+ wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
293
+ exit;
294
+ }
295
+
296
+ $this->_pagination_args = $args;
297
+ }
298
+
299
+ /**
300
+ * Access the pagination args.
301
+ *
302
+ * @since 3.1.0
303
+ * @access public
304
+ *
305
+ * @param string $key Pagination argument to retrieve. Common values include 'total_items',
306
+ * 'total_pages', 'per_page', or 'infinite_scroll'.
307
+ * @return int Number of items that correspond to the given pagination argument.
308
+ */
309
+ public function get_pagination_arg( $key ) {
310
+ if ( 'page' == $key ) {
311
+ return $this->get_pagenum();
312
+ }
313
+
314
+ if ( isset( $this->_pagination_args[ $key ] ) ) {
315
+ return $this->_pagination_args[ $key ];
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Whether the table has items to display or not
321
+ *
322
+ * @since 3.1.0
323
+ * @access public
324
+ *
325
+ * @return bool
326
+ */
327
+ public function has_items() {
328
+ return ! empty( $this->items );
329
+ }
330
+
331
+ /**
332
+ * Message to be displayed when there are no items
333
+ *
334
+ * @since 3.1.0
335
+ * @access public
336
+ */
337
+ public function no_items() {
338
+ esc_html_e( 'No items found.', 'strong-testimonials' );
339
+ }
340
+
341
+ /**
342
+ * Display the search box.
343
+ *
344
+ * @since 3.1.0
345
+ * @access public
346
+ *
347
+ * @param string $text The search button text
348
+ * @param string $input_id The search input id
349
+ */
350
+ public function search_box( $text, $input_id ) {
351
+ if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
+ return;
353
+ }
354
+
355
+ $input_id = $input_id . '-search-input';
356
+
357
+ if ( ! empty( $_REQUEST['orderby'] ) ) {
358
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
359
+ }
360
+ if ( ! empty( $_REQUEST['order'] ) ) {
361
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
362
+ }
363
+ if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
365
+ }
366
+ if ( ! empty( $_REQUEST['detached'] ) ) {
367
+ echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
368
+ }
369
+ ?>
370
+ <p class="search-box">
371
+ <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
372
+ <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>">
373
+ <?php submit_button( esc_html( $text ), 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
374
+ </p>
375
+ <?php
376
+ }
377
+
378
+ /**
379
+ * Get an associative array ( id => link ) with the list
380
+ * of views available on this table.
381
+ *
382
+ * @since 3.1.0
383
+ * @access protected
384
+ *
385
+ * @return array
386
+ */
387
+ protected function get_views() {
388
+ return array();
389
+ }
390
+
391
+ /**
392
+ * Display the list of views available on this table.
393
+ *
394
+ * @since 3.1.0
395
+ * @access public
396
+ */
397
+ public function views() {
398
+ $views = $this->get_views();
399
+ /**
400
+ * Filter the list of available list table views.
401
+ *
402
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
403
+ * to the ID of the current screen, usually a string.
404
+ *
405
+ * @since 3.5.0
406
+ *
407
+ * @param array $views An array of available list table views.
408
+ */
409
+ $views = apply_filters( "views_{$this->screen->id}", $views );
410
+
411
+ if ( empty( $views ) ) {
412
+ return;
413
+ }
414
+
415
+ echo "<ul class='subsubsub'>\n";
416
+ foreach ( $views as $class => $view ) {
417
+ $views[ $class ] = "\t<li class='$class'>$view";
418
+ }
419
+ echo implode( " |</li>\n", wp_kses_post( $views ) ) . "</li>\n";
420
+ echo '</ul>';
421
+ }
422
+
423
+ /**
424
+ * Get an associative array ( option_name => option_title ) with the list
425
+ * of bulk actions available on this table.
426
+ *
427
+ * @since 3.1.0
428
+ * @access protected
429
+ *
430
+ * @return array
431
+ */
432
+ protected function get_bulk_actions() {
433
+ return array();
434
+ }
435
+
436
+ /**
437
+ * Display the bulk actions dropdown.
438
+ *
439
+ * @since 3.1.0
440
+ * @access protected
441
+ *
442
+ * @param string $which The location of the bulk actions: 'top' or 'bottom'.
443
+ * This is designated as optional for backwards-compatibility.
444
+ */
445
+ protected function bulk_actions( $which = '' ) {
446
+ if ( is_null( $this->_actions ) ) {
447
+ $no_new_actions = $this->_actions = $this->get_bulk_actions();
448
+ /**
449
+ * Filter the list table Bulk Actions drop-down.
450
+ *
451
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
452
+ * to the ID of the current screen, usually a string.
453
+ *
454
+ * This filter can currently only be used to remove bulk actions.
455
+ *
456
+ * @since 3.5.0
457
+ *
458
+ * @param array $actions An array of the available bulk actions.
459
+ */
460
+ $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
461
+ $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
462
+ $two = '';
463
+ } else {
464
+ $two = '2';
465
+ }
466
+
467
+ if ( empty( $this->_actions ) ) {
468
+ return;
469
+ }
470
+
471
+ echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_html__( 'Select bulk action', 'strong-testimonials' ) . '</label>';
472
+ echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
473
+ echo "<option value='-1' selected='selected'>" . esc_html__( 'Bulk Actions', 'strong-testimonials' ) . "</option>\n";
474
+
475
+ foreach ( $this->_actions as $name => $title ) {
476
+ $class = 'edit' == $name ? 'hide-if-no-js' : '';
477
+
478
+ echo "\t<option value='" . esc_attr( $name ) . "' class='" . esc_attr($class) . "'>" . esc_html( $title ) . "</option>\n";
479
+ }
480
+
481
+ echo "</select>\n";
482
+
483
+ submit_button( esc_html__( 'Apply', 'strong-testimonials' ), 'action', '', false, array( 'id' => "doaction$two" ) );
484
+ echo "\n";
485
+ }
486
+
487
+ /**
488
+ * Get the current action selected from the bulk actions dropdown.
489
+ *
490
+ * @since 3.1.0
491
+ * @access public
492
+ *
493
+ * @return string|bool The action name or False if no action was selected
494
+ */
495
+ public function current_action() {
496
+ if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
497
+ return false;
498
+ }
499
+
500
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
501
+ return $_REQUEST['action'];
502
+ }
503
+
504
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
505
+ return $_REQUEST['action2'];
506
+ }
507
+
508
+ return false;
509
+ }
510
+
511
+ /**
512
+ * Generate row actions div
513
+ *
514
+ * @since 3.1.0
515
+ * @access protected
516
+ *
517
+ * @param array $actions The list of actions
518
+ * @param bool $always_visible Whether the actions should be always visible
519
+ * @return string
520
+ */
521
+ protected function row_actions( $actions, $always_visible = false ) {
522
+ $action_count = count( $actions );
523
+ $i = 0;
524
+
525
+ if ( ! $action_count ) {
526
+ return '';
527
+ }
528
+
529
+ $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
530
+ foreach ( $actions as $action => $link ) {
531
+ ++$i;
532
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
533
+ $out .= "<span class='$action'>$link$sep</span>";
534
+ }
535
+ $out .= '</div>';
536
+
537
+ return $out;
538
+ }
539
+
540
+ /**
541
+ * Display a monthly dropdown for filtering items
542
+ *
543
+ * @since 3.1.0
544
+ * @access protected
545
+ *
546
+ * @param string $post_type
547
+ */
548
+ protected function months_dropdown( $post_type ) {
549
+ global $wpdb, $wp_locale;
550
+
551
+ /**
552
+ * Filter whether to remove the 'Months' drop-down from the post list table.
553
+ *
554
+ * @since 4.2.0
555
+ *
556
+ * @param bool $disable Whether to disable the drop-down. Default false.
557
+ * @param string $post_type The post type.
558
+ */
559
+ if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
560
+ return;
561
+ }
562
+
563
+ $months = $wpdb->get_results(
564
+ $wpdb->prepare(
565
+ "
566
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
567
+ FROM $wpdb->posts
568
+ WHERE post_type = %s
569
+ ORDER BY post_date DESC
570
+ ",
571
+ $post_type
572
+ )
573
+ );
574
+
575
+ /**
576
+ * Filter the 'Months' drop-down results.
577
+ *
578
+ * @since 3.7.0
579
+ *
580
+ * @param object $months The months drop-down query results.
581
+ * @param string $post_type The post type.
582
+ */
583
+ $months = apply_filters( 'months_dropdown_results', $months, $post_type );
584
+
585
+ $month_count = count( $months );
586
+
587
+ if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
588
+ return;
589
+ }
590
+
591
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
592
+ ?>
593
+ <label for="filter-by-date" class="screen-reader-text"><?php esc_html_e( 'Filter by date', 'strong-testimonials' ); ?></label>
594
+ <select name="m" id="filter-by-date">
595
+ <option<?php selected( $m, 0 ); ?> value="0"><?php esc_html_e( 'All dates', 'strong-testimonials' ); ?></option>
596
+ <?php
597
+ foreach ( $months as $arc_row ) {
598
+ if ( 0 == $arc_row->year ) {
599
+ continue;
600
+ }
601
+
602
+ $month = zeroise( $arc_row->month, 2 );
603
+ $year = $arc_row->year;
604
+
605
+ printf(
606
+ "<option %s value='%s'>%s</option>\n",
607
+ selected( $m, $year . $month, false ),
608
+ esc_attr( $arc_row->year . $month ),
609
+ /* translators: 1: month name, 2: 4-digit year */
610
+ sprintf( '%1$s %2$d', esc_html( $wp_locale->get_month( $month ) ), esc_html( $year) )
611
+ );
612
+ }
613
+ ?>
614
+ </select>
615
+ <?php
616
+ }
617
+
618
+ /**
619
+ * Display a view switcher
620
+ *
621
+ * @since 3.1.0
622
+ * @access protected
623
+ *
624
+ * @param string $current_mode
625
+ */
626
+ protected function view_switcher( $current_mode ) {
627
+ ?>
628
+ <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
629
+ <div class="view-switch">
630
+ <?php
631
+ foreach ( $this->modes as $mode => $title ) {
632
+ $classes = array( 'view-' . $mode );
633
+ if ( $current_mode == $mode ) {
634
+ $classes[] = 'current';
635
+ }
636
+ printf(
637
+ "<a href='%s' class='%s' id='view-switch-%s'><span class='screen-reader-text'>%s</span></a>\n",
638
+ esc_url(add_query_arg('mode', $mode)),
639
+ esc_attr(implode(' ', $classes)),
640
+ esc_attr($mode),
641
+ esc_html($title)
642
+ );
643
+ }
644
+ ?>
645
+ </div>
646
+ <?php
647
+ }
648
+
649
+ /**
650
+ * Display a comment count bubble
651
+ *
652
+ * @since 3.1.0
653
+ * @access protected
654
+ *
655
+ * @param int $post_id The post ID.
656
+ * @param int $pending_comments Number of pending comments.
657
+ */
658
+ protected function comments_bubble( $post_id, $pending_comments ) {
659
+ $pending_phrase = sprintf( __( '%s pending', 'strong-testimonials' ), number_format( $pending_comments ) );
660
+
661
+ if ( $pending_comments ) {
662
+ echo '<strong>';
663
+ }
664
+
665
+ echo "<a href='" . esc_url( add_query_arg( 'p', absint( $post_id ), admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . absint( number_format_i18n( get_comments_number() ) ) . '</span></a>';
666
+
667
+ if ( $pending_comments ) {
668
+ echo '</strong>';
669
+ }
670
+ }
671
+
672
+ /**
673
+ * Get the current page number
674
+ *
675
+ * @since 3.1.0
676
+ * @access public
677
+ *
678
+ * @return int
679
+ */
680
+ public function get_pagenum() {
681
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
682
+
683
+ if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
684
+ $pagenum = $this->_pagination_args['total_pages'];
685
+ }
686
+
687
+ return max( 1, $pagenum );
688
+ }
689
+
690
+ /**
691
+ * Get number of items to display on a single page
692
+ *
693
+ * @since 3.1.0
694
+ * @access protected
695
+ *
696
+ * @param string $option
697
+ * @param int $default
698
+ * @return int
699
+ */
700
+ protected function get_items_per_page( $option, $default = 20 ) {
701
+ $per_page = (int) get_user_option( $option );
702
+ if ( empty( $per_page ) || $per_page < 1 ) {
703
+ $per_page = $default;
704
+ }
705
+
706
+ /**
707
+ * Filter the number of items to be displayed on each page of the list table.
708
+ *
709
+ * The dynamic hook name, $option, refers to the `per_page` option depending
710
+ * on the type of list table in use. Possible values include: 'edit_comments_per_page',
711
+ * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
712
+ * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
713
+ * 'edit_{$post_type}_per_page', etc.
714
+ *
715
+ * @since 2.9.0
716
+ *
717
+ * @param int $per_page Number of items to be displayed. Default 20.
718
+ */
719
+ return (int) apply_filters( $option, $per_page );
720
+ }
721
+
722
+ /**
723
+ * Display the pagination.
724
+ *
725
+ * @since 3.1.0
726
+ * @access protected
727
+ *
728
+ * @param string $which
729
+ */
730
+ protected function pagination( $which ) {
731
+ if ( empty( $this->_pagination_args ) ) {
732
+ return;
733
+ }
734
+
735
+ $total_items = $this->_pagination_args['total_items'];
736
+ $total_pages = $this->_pagination_args['total_pages'];
737
+ $infinite_scroll = false;
738
+ if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
739
+ $infinite_scroll = $this->_pagination_args['infinite_scroll'];
740
+ }
741
+
742
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items, 'strong-testimonials' ), number_format_i18n( $total_items ) ) . '</span>';
743
+
744
+ $current = $this->get_pagenum();
745
+
746
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
747
+
748
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
749
+
750
+ $page_links = array();
751
+
752
+ $disable_first = $disable_last = '';
753
+ if ( $current == 1 ) {
754
+ $disable_first = ' disabled';
755
+ }
756
+ if ( $current == $total_pages ) {
757
+ $disable_last = ' disabled';
758
+ }
759
+ $page_links[] = sprintf(
760
+ "<a class='%s' title='%s' href='%s'>%s</a>",
761
+ 'first-page' . $disable_first,
762
+ esc_attr__( 'Go to the first page', 'strong-testimonials' ),
763
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
764
+ '&laquo;'
765
+ );
766
+
767
+ $page_links[] = sprintf(
768
+ "<a class='%s' title='%s' href='%s'>%s</a>",
769
+ 'prev-page' . $disable_first,
770
+ esc_attr__( 'Go to the previous page', 'strong-testimonials' ),
771
+ esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
772
+ '&lsaquo;'
773
+ );
774
+
775
+ if ( 'bottom' == $which ) {
776
+ $html_current_page = $current;
777
+ } else {
778
+ $html_current_page = sprintf(
779
+ "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
780
+ '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page', 'strong-testimonials' ) . '</label>',
781
+ esc_attr__( 'Current page', 'strong-testimonials' ),
782
+ $current,
783
+ strlen( $total_pages )
784
+ );
785
+ }
786
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
787
+ $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging', 'strong-testimonials' ), $html_current_page, $html_total_pages ) . '</span>';
788
+
789
+ $page_links[] = sprintf(
790
+ "<a class='%s' title='%s' href='%s'>%s</a>",
791
+ 'next-page' . $disable_last,
792
+ esc_attr__( 'Go to the next page', 'strong-testimonials' ),
793
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
794
+ '&rsaquo;'
795
+ );
796
+
797
+ $page_links[] = sprintf(
798
+ "<a class='%s' title='%s' href='%s'>%s</a>",
799
+ 'last-page' . $disable_last,
800
+ esc_attr__( 'Go to the last page', 'strong-testimonials' ),
801
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
802
+ '&raquo;'
803
+ );
804
+
805
+ $pagination_links_class = 'pagination-links';
806
+ if ( ! empty( $infinite_scroll ) ) {
807
+ $pagination_links_class = ' hide-if-js';
808
+ }
809
+ $output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
810
+
811
+ if ( $total_pages ) {
812
+ $page_class = $total_pages < 2 ? ' one-page' : '';
813
+ } else {
814
+ $page_class = ' no-pages';
815
+ }
816
+ $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
817
+
818
+ echo $this->_pagination;
819
+ }
820
+
821
+ /**
822
+ * Get a list of columns. The format is:
823
+ * 'internal-name' => 'Title'
824
+ *
825
+ * @since 3.1.0
826
+ * @access public
827
+ * @abstract
828
+ *
829
+ * @return array
830
+ */
831
+ public function get_columns() {
832
+ die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
833
+ }
834
+
835
+ /**
836
+ * Get a list of sortable columns. The format is:
837
+ * 'internal-name' => 'orderby'
838
+ * or
839
+ * 'internal-name' => array( 'orderby', true )
840
+ *
841
+ * The second format will make the initial sorting order be descending
842
+ *
843
+ * @since 3.1.0
844
+ * @access protected
845
+ *
846
+ * @return array
847
+ */
848
+ protected function get_sortable_columns() {
849
+ return array();
850
+ }
851
+
852
+ /**
853
+ * Get a list of all, hidden and sortable columns, with filter applied
854
+ *
855
+ * @since 3.1.0
856
+ * @access protected
857
+ *
858
+ * @return array
859
+ */
860
+ protected function get_column_info() {
861
+ if ( isset( $this->_column_headers ) ) {
862
+ return $this->_column_headers;
863
+ }
864
+
865
+ $columns = get_column_headers( $this->screen );
866
+ $hidden = get_hidden_columns( $this->screen );
867
+
868
+ $sortable_columns = $this->get_sortable_columns();
869
+ /**
870
+ * Filter the list table sortable columns for a specific screen.
871
+ *
872
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
873
+ * to the ID of the current screen, usually a string.
874
+ *
875
+ * @since 3.5.0
876
+ *
877
+ * @param array $sortable_columns An array of sortable columns.
878
+ */
879
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
880
+
881
+ $sortable = array();
882
+ foreach ( $_sortable as $id => $data ) {
883
+ if ( empty( $data ) ) {
884
+ continue;
885
+ }
886
+
887
+ $data = (array) $data;
888
+ if ( ! isset( $data[1] ) ) {
889
+ $data[1] = false;
890
+ }
891
+
892
+ $sortable[ $id ] = $data;
893
+ }
894
+
895
+ $this->_column_headers = array( $columns, $hidden, $sortable );
896
+
897
+ return $this->_column_headers;
898
+ }
899
+
900
+ /**
901
+ * Return number of visible columns
902
+ *
903
+ * @since 3.1.0
904
+ * @access public
905
+ *
906
+ * @return int
907
+ */
908
+ public function get_column_count() {
909
+ list ( $columns, $hidden ) = $this->get_column_info();
910
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
911
+ return count( $columns ) - count( $hidden );
912
+ }
913
+
914
+ /**
915
+ * Print column headers, accounting for hidden and sortable columns.
916
+ *
917
+ * @since 3.1.0
918
+ * @access public
919
+ *
920
+ * @param bool $with_id Whether to set the id attribute or not
921
+ */
922
+ public function print_column_headers( $with_id = true ) {
923
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
924
+
925
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
926
+ $current_url = remove_query_arg( 'paged', $current_url );
927
+
928
+ if ( isset( $_GET['orderby'] ) ) {
929
+ $current_orderby = sanitize_text_field( $_GET['orderby'] );
930
+ } else {
931
+ $current_orderby = '';
932
+ }
933
+
934
+ if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) {
935
+ $current_order = 'desc';
936
+ } else {
937
+ $current_order = 'asc';
938
+ }
939
+
940
+ if ( ! empty( $columns['cb'] ) ) {
941
+ static $cb_counter = 1;
942
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . esc_html__( 'Select All', 'strong-testimonials' ) . '</label>'
943
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
944
+ $cb_counter++;
945
+ }
946
+
947
+ foreach ( $columns as $column_key => $column_display_name ) {
948
+ $class = array( 'manage-column', "column-$column_key" );
949
+
950
+ $style = '';
951
+ if ( in_array( $column_key, $hidden ) ) {
952
+ $style = 'display:none;';
953
+ }
954
+
955
+ $style = ' style="' . $style . '"';
956
+
957
+ if ( 'cb' == $column_key ) {
958
+ $class[] = 'check-column';
959
+ } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
960
+ $class[] = 'num';
961
+ }
962
+
963
+ if ( isset( $sortable[ $column_key ] ) ) {
964
+ list( $orderby, $desc_first ) = $sortable[ $column_key ];
965
+
966
+ if ( $current_orderby == $orderby ) {
967
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
968
+ $class[] = 'sorted';
969
+ $class[] = $current_order;
970
+ } else {
971
+ $order = $desc_first ? 'desc' : 'asc';
972
+ $class[] = 'sortable';
973
+ $class[] = $desc_first ? 'asc' : 'desc';
974
+ }
975
+
976
+ $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
977
+ }
978
+
979
+ $id = $with_id ? "id='$column_key'" : '';
980
+
981
+ if ( ! empty( $class ) ) {
982
+ $class = "class='" . implode( ' ', $class ) . "'";
983
+ }
984
+
985
+ echo "<th scope='col' $id $class $style>$column_display_name</th>";
986
+ }
987
+ }
988
+
989
+ /**
990
+ * Display the table
991
+ *
992
+ * @since 3.1.0
993
+ * @access public
994
+ */
995
+ public function display() {
996
+ $singular = $this->_args['singular'];
997
+
998
+ $this->display_tablenav( 'top' );
999
+
1000
+ ?>
1001
+ <table class="wp-list-table <?php echo esc_attr(implode(' ', $this->get_table_classes())); ?>">
1002
+ <thead>
1003
+ <tr>
1004
+ <?php $this->print_column_headers(); ?>
1005
+ </tr>
1006
+ </thead>
1007
+
1008
+ <tbody id="the-list"
1009
+ <?php
1010
+ if ( $singular ) {
1011
+ echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
1012
+ }
1013
+ ?>
1014
+ >
1015
+ <?php $this->display_rows_or_placeholder(); ?>
1016
+ </tbody>
1017
+
1018
+ <tfoot>
1019
+ <tr>
1020
+ <?php $this->print_column_headers( false ); ?>
1021
+ </tr>
1022
+ </tfoot>
1023
+
1024
+ </table>
1025
+ <?php
1026
+ $this->display_tablenav( 'bottom' );
1027
+ }
1028
+
1029
+ /**
1030
+ * Get a list of CSS classes for the list table table tag.
1031
+ *
1032
+ * @since 3.1.0
1033
+ * @access protected
1034
+ *
1035
+ * @return array List of CSS classes for the table tag.
1036
+ */
1037
+ protected function get_table_classes() {
1038
+ return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1039
+ }
1040
+
1041
+ /**
1042
+ * Generate the table navigation above or below the table
1043
+ *
1044
+ * @since 3.1.0
1045
+ * @access protected
1046
+ * @param string $which
1047
+ */
1048
+ protected function display_tablenav( $which ) {
1049
+ if ( 'top' == $which ) {
1050
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1051
+ }
1052
+ ?>
1053
+ <div class="tablenav <?php echo esc_attr( $which ); ?>">
1054
+
1055
+ <div class="alignleft actions bulkactions">
1056
+ <?php $this->bulk_actions( $which ); ?>
1057
+ </div>
1058
+ <?php
1059
+ $this->extra_tablenav( $which );
1060
+ $this->pagination( $which );
1061
+ ?>
1062
+
1063
+ <br class="clear">
1064
+ </div>
1065
+ <?php
1066
+ }
1067
+
1068
+ /**
1069
+ * Extra controls to be displayed between bulk actions and pagination
1070
+ *
1071
+ * @since 3.1.0
1072
+ * @access protected
1073
+ *
1074
+ * @param string $which
1075
+ */
1076
+ protected function extra_tablenav( $which ) {}
1077
+
1078
+ /**
1079
+ * Generate the tbody element for the list table.
1080
+ *
1081
+ * @since 3.1.0
1082
+ * @access public
1083
+ */
1084
+ public function display_rows_or_placeholder() {
1085
+ if ( $this->has_items() ) {
1086
+ $this->display_rows();
1087
+ } else {
1088
+ echo '<tr class="no-items"><td class="colspanchange" colspan="' . absint( $this->get_column_count() ) . '">';
1089
+ $this->no_items();
1090
+ echo '</td></tr>';
1091
+ }
1092
+ }
1093
+
1094
+ /**
1095
+ * Generate the table rows
1096
+ *
1097
+ * @since 3.1.0
1098
+ * @access public
1099
+ */
1100
+ public function display_rows() {
1101
+ foreach ( $this->items as $item ) {
1102
+ $this->single_row( $item );
1103
+ }
1104
+ }
1105
+
1106
+ /**
1107
+ * Generates content for a single row of the table
1108
+ *
1109
+ * @since 3.1.0
1110
+ * @access public
1111
+ *
1112
+ * @param object $item The current item
1113
+ */
1114
+ public function single_row( $item ) {
1115
+ echo '<tr>';
1116
+ $this->single_row_columns( $item );
1117
+ echo '</tr>';
1118
+ }
1119
+
1120
+ protected function column_default( $item, $column_name ) {}
1121
+
1122
+ protected function column_cb( $item ) {}
1123
+
1124
+ /**
1125
+ * Generates the columns for a single row of the table
1126
+ *
1127
+ * @since 3.1.0
1128
+ * @access protected
1129
+ *
1130
+ * @param object $item The current item
1131
+ */
1132
+ protected function single_row_columns( $item ) {
1133
+ list( $columns, $hidden ) = $this->get_column_info();
1134
+
1135
+ foreach ( $columns as $column_name => $column_display_name ) {
1136
+ $class = "class='$column_name column-$column_name'";
1137
+
1138
+ $style = '';
1139
+ if ( in_array( $column_name, $hidden ) ) {
1140
+ $style = ' style="display:none;"';
1141
+ }
1142
+
1143
+ $attributes = "$class$style";
1144
+
1145
+ if ( 'cb' == $column_name ) {
1146
+ echo '<th scope="row" class="check-column">';
1147
+ echo $this->column_cb( $item );
1148
+ echo '</th>';
1149
+ } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1150
+ echo "<td $attributes>";
1151
+ echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1152
+ echo '</td>';
1153
+ } else {
1154
+ echo "<td $attributes>";
1155
+ echo $this->column_default( $item, $column_name );
1156
+ echo '</td>';
1157
+ }
1158
+ }
1159
+ }
1160
+
1161
+ /**
1162
+ * Handle an incoming ajax request (called from admin-ajax.php)
1163
+ *
1164
+ * @since 3.1.0
1165
+ * @access public
1166
+ */
1167
+ public function ajax_response() {
1168
+ $this->prepare_items();
1169
+
1170
+ ob_start();
1171
+ if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1172
+ $this->display_rows();
1173
+ } else {
1174
+ $this->display_rows_or_placeholder();
1175
+ }
1176
+
1177
+ $rows = ob_get_clean();
1178
+
1179
+ $response = array( 'rows' => $rows );
1180
+
1181
+ if ( isset( $this->_pagination_args['total_items'] ) ) {
1182
+ $response['total_items_i18n'] = sprintf(
1183
+ _n( '1 item', '%s items', $this->_pagination_args['total_items'], 'strong-testimonials' ),
1184
+ number_format_i18n( $this->_pagination_args['total_items'] )
1185
+ );
1186
+ }
1187
+ if ( isset( $this->_pagination_args['total_pages'] ) ) {
1188
+ $response['total_pages'] = $this->_pagination_args['total_pages'];
1189
+ $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1190
+ }
1191
+
1192
+ die( wp_json_encode( $response ) );
1193
+ }
1194
+
1195
+ /**
1196
+ * Send required variables to JavaScript land
1197
+ *
1198
+ * @access public
1199
+ */
1200
+ public function _js_vars() {
1201
+ $args = array(
1202
+ 'class' => get_class( $this ),
1203
+ 'screen' => array(
1204
+ 'id' => $this->screen->id,
1205
+ 'base' => $this->screen->base,
1206
+ ),
1207
+ );
1208
+
1209
+ printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1210
+ }
1211
+ }
1212
+
1213
  endif;
admin/class-strong-testimonials-page-shortcodes.php CHANGED
@@ -1,415 +1,415 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Page_Shortcodes
5
- *
6
- * @since 2.31.0
7
- */
8
- class Strong_Testimonials_Page_Shortcodes {
9
-
10
- /**
11
- * Strong_Testimonials_Page_Shortcodes constructor.
12
- */
13
- private function __construct() {
14
- }
15
-
16
- /**
17
- * Render the shortcode instructions page.
18
- */
19
- public static function render_page() {
20
-
21
- $stars = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current half"></span></span>';
22
-
23
- $stars_rounded = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current"></span><span class="star"></span></span>';
24
-
25
- $tags = array(
26
- 'a' => array(
27
- 'href' => array(),
28
- 'target' => array(),
29
- ),
30
- );
31
- ?>
32
- <div class="wrap wpmtst shortcodes has-stars">
33
-
34
- <h1><?php esc_html_e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
35
-
36
- <h2><?php esc_html_e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
37
-
38
- <p>
39
- <?php echo wp_kses_post( esc_html_e( 'Each view has a unique shortcode like ', 'strong-testimonials' ) ); ?><code>&#91;testimonial_view id="1"&#93;</code>.
40
- <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), esc_html__( 'Go to views', 'strong-testimonials' ) ); ?>
41
- </p>
42
-
43
- <h2><?php esc_html_e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
44
-
45
- <p><?php printf( esc_html__( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
46
-
47
- <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
48
- <tr>
49
- <td>
50
- <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
51
- </td>
52
- <td class="shortcode">
53
- <?php /* translators: %s is a shortcode */ ?>
54
- <p>
55
- <?php printf( esc_html__( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
56
- </p>
57
- </td>
58
- </tr>
59
- <tr>
60
- <td>
61
- <?php /* translators: %s is a shortcode attribute */ ?>
62
- <p><?php printf( esc_html__( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
63
- </td>
64
- <td class="shortcode">
65
- <?php /* translators: %s is a shortcode */ ?>
66
- <p>
67
- <?php printf( esc_html__( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
68
- </p>
69
- </td>
70
- </tr>
71
- </table>
72
-
73
- <h2><?php esc_html_e( 'Average Rating', 'strong-testimonials' ); ?></h2>
74
-
75
- <p>
76
- <?php /* translators: %s is a shortcode */ ?>
77
- <?php printf( __( 'If using a <strong>single</strong> rating field, use %s to display the average rating.', 'strong-testimonials' ), '<code>&#91;testimonial_average_rating&#93;</code>' ); ?>
78
- </p>
79
-
80
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
81
- <tr>
82
- <td>
83
- <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
84
- <p class="description"><?php _e( 'You must use the closing slash <code>/</code> if using the shortcode with content elsewhere on your page.', 'strong-testimonials' ); ?></p>
85
- </td>
86
- <td class="has-inner">
87
- <table class="inner" cellpadding="0" cellspacing="0">
88
- <tr>
89
- <td class="shortcode">&#91;testimonial_average_rating /&#93;</td>
90
- </tr>
91
- <tr>
92
- <td>
93
- <div class="strong-rating-wrapper average">
94
- <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
95
- <?php echo $stars; ?>
96
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
97
- </div>
98
- </td>
99
- </tr>
100
- </table>
101
- </td>
102
- </tr>
103
- </table>
104
-
105
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
106
- <tr>
107
- <td>
108
- <p><?php esc_html_e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
109
- <p><?php esc_html_e( 'Default:', 'strong-testimonials' ); ?></p>
110
- <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
111
- </td>
112
- <td class="has-inner">
113
- <table class="inner" cellpadding="0" cellspacing="0">
114
- <tr>
115
- <td class="shortcode">&#91;testimonial_average_rating&#93;{title} {stars} {summary}&#91;/testimonial_average_rating&#93;</td>
116
- </tr>
117
- <tr>
118
- <td>
119
- <div class="strong-rating-wrapper average">
120
- <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
121
- <?php echo $stars; ?>
122
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
123
- </div>
124
- </td>
125
- </tr>
126
- </table>
127
- </td>
128
- </tr>
129
- </table>
130
-
131
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
132
- <tr>
133
- <td>
134
- <p><?php esc_html_e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
135
- <p><code>{title2}</code><br><code>{summary2}</code></p>
136
- </td>
137
- <td class="has-inner">
138
- <table class="inner" cellpadding="0" cellspacing="0">
139
- <tr>
140
- <td class="shortcode">&#91;testimonial_average_rating&#93;{title2} {stars} {summary2}&#91;/testimonial_average_rating&#93;</td>
141
- </tr>
142
- <tr>
143
- <td>
144
- <div class="strong-rating-wrapper average">
145
- <span class="strong-rating-title"><?php esc_html_e( 'Average of 9 Ratings:', 'strong-testimonials' ); ?></span>
146
- <?php echo $stars; ?>
147
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars', 'strong-testimonials' ); ?></span>
148
- </div>
149
- </td>
150
- <tr>
151
- </tr>
152
- </table>
153
- </tr>
154
- </table>
155
-
156
- <table class="form-table shortcodes average">
157
- <tr>
158
- <td>
159
- <p><?php esc_html_e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
160
- </td>
161
- <td class="has-inner">
162
- <table class="inner" cellpadding="0" cellspacing="0">
163
- <tr>
164
- <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}<?php esc_html( 'Our average rating is ', 'strong-testimonials' ); ?> &lt;b&gt;{summary2}&lt;/b&gt;&#91;/testimonial_average_rating&#93;</td>
165
- </tr>
166
- <tr>
167
- <td>
168
- <div class="strong-rating-wrapper average">
169
- <?php echo $stars; ?>
170
- <?php esc_html_e( 'Our average rating is ', 'strong-testimonials' ); ?><b><span class="strong-rating-summary"><?php esc_html_e( '4.3 stars', 'strong-testimonials' ); ?></span></b>
171
- </div>
172
- </td>
173
- </tr>
174
- </table>
175
- </td>
176
- </tr>
177
- </table>
178
-
179
- <table class="form-table shortcodes average">
180
- <tr>
181
- <td>
182
- <p><code>{stars}</code></p>
183
- </td>
184
- <td class="has-inner">
185
- <table class="inner" cellpadding="0" cellspacing="0">
186
- <tr>
187
- <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}&#91;/testimonial_average_rating&#93;</td>
188
- </tr>
189
- <tr>
190
- <td>
191
- <div class="strong-rating-wrapper average">
192
- <?php echo $stars; ?>
193
- </div>
194
- </td>
195
- </tr>
196
- </table>
197
- </td>
198
- </tr>
199
- </table>
200
-
201
- <table class="form-table shortcodes average">
202
- <tr>
203
- <td>
204
- <p><code>{average}</code></p>
205
- </td>
206
- <td class="has-inner">
207
- <table class="inner" cellpadding="0" cellspacing="0">
208
- <tr>
209
- <td class="shortcode">&#91;testimonial_average_rating&#93;{average}&#91;/testimonial_average_rating&#93;</td>
210
- </tr>
211
- <tr>
212
- <td>
213
- <div class="strong-rating-wrapper average"><span class="strong-rating-average"><?php esc_html_e( '4.3', 'strong-testimonials' ); ?></span></div>
214
- </td>
215
- </tr>
216
- </table>
217
- </td>
218
- </tr>
219
- </table>
220
-
221
- <table class="form-table shortcodes average">
222
- <tr>
223
- <td>
224
- <p><code>decimals</code></p>
225
- <p class="description"><?php esc_html_e( 'If you need to display multiple decimals for average rating you have to set a number to decimal.', 'strong-testimonials' ); ?></p>
226
-
227
- </td>
228
- <td class="has-inner">
229
- <table class="inner" cellpadding="0" cellspacing="0">
230
- <tr>
231
- <td class="shortcode">&#91;testimonial_average_rating decimals="number" /&#93;</td>
232
- </tr>
233
- <tr>
234
- <td>
235
- <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
236
- <?php echo $stars; ?>
237
- <span class="strong-rating-summary"><?php esc_html_e( '4.333 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
238
- </div>
239
- </td>
240
- </tr>
241
- </table>
242
- </td>
243
- </tr>
244
- </table>
245
-
246
- <table class="form-table shortcodes average">
247
- <tr>
248
- <td>
249
- <p><code>{count}</code></p>
250
- </td>
251
- <td class="has-inner">
252
- <table class="inner" cellpadding="0" cellspacing="0">
253
- <tr>
254
- <td class="shortcode">&#91;testimonial_average_rating&#93;{count}&#91;/testimonial_average_rating&#93;</td>
255
- </tr>
256
- <tr>
257
- <td>
258
- <div class="strong-rating-wrapper average"><span class="strong-rating-count"><?php esc_html_e( '9', 'strong-testimonials' ); ?></span></div>
259
- </td>
260
- </tr>
261
- </table>
262
- </td>
263
- </tr>
264
- </table>
265
-
266
- <table class="form-table shortcodes average">
267
- <tr>
268
- <td>
269
- <p><code>field</code></p>
270
- <p class="description"><?php esc_html_e( 'If using multiple rating fields, you can specify the specific field you need.', 'strong-testimonials' ); ?></p>
271
- <p class="description"><?php esc_html_e( 'If using multiple rating fields, you can use "all" to use all the rating fields.', 'strong-testimonials' ); ?></p>
272
- </td>
273
- <td class="has-inner">
274
- <table class="inner" cellpadding="0" cellspacing="0">
275
- <tr>
276
- <td class="shortcode">&#91;testimonial_average_rating field="rating" /&#93;</td>
277
- </tr>
278
- <tr>
279
- <td class="shortcode">&#91;testimonial_average_rating field="all" /&#93;</td>
280
- </tr>
281
- <tr>
282
- <td>
283
- <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
284
- <?php echo $stars; ?>
285
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
286
- </div>
287
- </td>
288
- </tr>
289
- </table>
290
- </td>
291
- </tr>
292
- </table>
293
-
294
- <table class="form-table shortcodes average">
295
- <tr>
296
- <td>
297
- <p><code>block</code></p>
298
- </td>
299
- <td class="has-inner">
300
- <table class="inner" cellpadding="0" cellspacing="0">
301
- <tr>
302
- <td class="shortcode">&#91;testimonial_average_rating block /&#93;</td>
303
- </tr>
304
- <tr>
305
- <td>
306
- <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
307
- <?php echo $stars; ?>
308
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
309
- </div>
310
- </td>
311
- </tr>
312
- </table>
313
- </td>
314
- </tr>
315
- </table>
316
-
317
- <table class="form-table shortcodes average">
318
- <tr>
319
- <td>
320
- <p><code>centered</code></p>
321
- </td>
322
- <td class="has-inner">
323
- <table class="inner" cellpadding="0" cellspacing="0">
324
- <tr>
325
- <td class="shortcode">&#91;testimonial_average_rating centered /&#93;</td>
326
- </tr>
327
- <tr>
328
- <td>
329
- <div class="strong-rating-wrapper average centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
330
- <?php echo $stars; ?>
331
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
332
- </div>
333
- </td>
334
- </tr>
335
- </table>
336
- </td>
337
- </tr>
338
- </table>
339
-
340
- <table class="form-table shortcodes average">
341
- <tr>
342
- <td>
343
- <p><code>rounded</code></p>
344
- <p class="description"><?php esc_html_e( 'Round the rating(ex.: from 4.3 -> 4 or 4.7->5)', 'strong-testimonials' ); ?></p>
345
- </td>
346
- <td class="has-inner">
347
- <table class="inner" cellpadding="0" cellspacing="0">
348
- <tr>
349
- <td class="shortcode">&#91;testimonial_average_rating rounded &#93;</td>
350
- </tr>
351
- <tr>
352
- <td>
353
- <div class="strong-rating-wrapper average"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
354
- <?php echo $stars_rounded; ?>
355
- <span class="strong-rating-summary"><?php esc_html_e( '4 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
356
- </div>
357
- </td>
358
- </tr>
359
- </table>
360
- </td>
361
- </tr>
362
- </table>
363
-
364
- <table class="form-table shortcodes average">
365
- <tr>
366
- <td>
367
- <p><code>block</code> and <code>centered</code></p>
368
- </td>
369
- <td class="has-inner">
370
- <table class="inner" cellpadding="0" cellspacing="0">
371
- <tr>
372
- <td class="shortcode">&#91;testimonial_average_rating block centered /&#93;</td>
373
- </tr>
374
- <tr>
375
- <td>
376
- <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
377
- <?php echo $stars; ?>
378
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
379
- </div>
380
- </td>
381
- </tr>
382
- </table>
383
- </td>
384
- </tr>
385
- </table>
386
-
387
- <table class="form-table shortcodes average">
388
- <tr>
389
- <td>
390
- <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
391
- </td>
392
- <td class="has-inner">
393
- <table class="inner" cellpadding="0" cellspacing="0">
394
- <tr>
395
- <td class="shortcode">&#91;testimonial_average_rating element="span" /&#93;</td>
396
- </tr>
397
- <tr>
398
- <td>
399
- <span class="strong-rating-wrapper average">
400
- <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
401
- <?php echo $stars; ?>
402
- <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
403
- </span>
404
- </td>
405
- </tr>
406
- </table>
407
- </td>
408
- </tr>
409
- </table>
410
-
411
- </div>
412
- <?php
413
- }
414
-
415
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Page_Shortcodes
5
+ *
6
+ * @since 2.31.0
7
+ */
8
+ class Strong_Testimonials_Page_Shortcodes {
9
+
10
+ /**
11
+ * Strong_Testimonials_Page_Shortcodes constructor.
12
+ */
13
+ private function __construct() {
14
+ }
15
+
16
+ /**
17
+ * Render the shortcode instructions page.
18
+ */
19
+ public static function render_page() {
20
+
21
+ $stars = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current half"></span></span>';
22
+
23
+ $stars_rounded = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current"></span><span class="star"></span></span>';
24
+
25
+ $tags = array(
26
+ 'a' => array(
27
+ 'href' => array(),
28
+ 'target' => array(),
29
+ ),
30
+ );
31
+ ?>
32
+ <div class="wrap wpmtst shortcodes has-stars">
33
+
34
+ <h1><?php esc_html_e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
35
+
36
+ <h2><?php esc_html_e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
37
+
38
+ <p>
39
+ <?php echo wp_kses_post( esc_html_e( 'Each view has a unique shortcode like ', 'strong-testimonials' ) ); ?><code>&#91;testimonial_view id="1"&#93;</code>.
40
+ <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), esc_html__( 'Go to views', 'strong-testimonials' ) ); ?>
41
+ </p>
42
+
43
+ <h2><?php esc_html_e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
44
+
45
+ <p><?php printf( esc_html__( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
46
+
47
+ <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
48
+ <tr>
49
+ <td>
50
+ <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
51
+ </td>
52
+ <td class="shortcode">
53
+ <?php /* translators: %s is a shortcode */ ?>
54
+ <p>
55
+ <?php printf( esc_html__( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
56
+ </p>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <td>
61
+ <?php /* translators: %s is a shortcode attribute */ ?>
62
+ <p><?php printf( esc_html__( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
63
+ </td>
64
+ <td class="shortcode">
65
+ <?php /* translators: %s is a shortcode */ ?>
66
+ <p>
67
+ <?php printf( esc_html__( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
68
+ </p>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+
73
+ <h2><?php esc_html_e( 'Average Rating', 'strong-testimonials' ); ?></h2>
74
+
75
+ <p>
76
+ <?php /* translators: %s is a shortcode */ ?>
77
+ <?php printf( __( 'If using a <strong>single</strong> rating field, use %s to display the average rating.', 'strong-testimonials' ), '<code>&#91;testimonial_average_rating&#93;</code>' ); ?>
78
+ </p>
79
+
80
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
81
+ <tr>
82
+ <td>
83
+ <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
84
+ <p class="description"><?php _e( 'You must use the closing slash <code>/</code> if using the shortcode with content elsewhere on your page.', 'strong-testimonials' ); ?></p>
85
+ </td>
86
+ <td class="has-inner">
87
+ <table class="inner" cellpadding="0" cellspacing="0">
88
+ <tr>
89
+ <td class="shortcode">&#91;testimonial_average_rating /&#93;</td>
90
+ </tr>
91
+ <tr>
92
+ <td>
93
+ <div class="strong-rating-wrapper average">
94
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
95
+ <?php echo $stars; ?>
96
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
97
+ </div>
98
+ </td>
99
+ </tr>
100
+ </table>
101
+ </td>
102
+ </tr>
103
+ </table>
104
+
105
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
106
+ <tr>
107
+ <td>
108
+ <p><?php esc_html_e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
109
+ <p><?php esc_html_e( 'Default:', 'strong-testimonials' ); ?></p>
110
+ <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
111
+ </td>
112
+ <td class="has-inner">
113
+ <table class="inner" cellpadding="0" cellspacing="0">
114
+ <tr>
115
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title} {stars} {summary}&#91;/testimonial_average_rating&#93;</td>
116
+ </tr>
117
+ <tr>
118
+ <td>
119
+ <div class="strong-rating-wrapper average">
120
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
121
+ <?php echo $stars; ?>
122
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
123
+ </div>
124
+ </td>
125
+ </tr>
126
+ </table>
127
+ </td>
128
+ </tr>
129
+ </table>
130
+
131
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
132
+ <tr>
133
+ <td>
134
+ <p><?php esc_html_e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
135
+ <p><code>{title2}</code><br><code>{summary2}</code></p>
136
+ </td>
137
+ <td class="has-inner">
138
+ <table class="inner" cellpadding="0" cellspacing="0">
139
+ <tr>
140
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title2} {stars} {summary2}&#91;/testimonial_average_rating&#93;</td>
141
+ </tr>
142
+ <tr>
143
+ <td>
144
+ <div class="strong-rating-wrapper average">
145
+ <span class="strong-rating-title"><?php esc_html_e( 'Average of 9 Ratings:', 'strong-testimonials' ); ?></span>
146
+ <?php echo $stars; ?>
147
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars', 'strong-testimonials' ); ?></span>
148
+ </div>
149
+ </td>
150
+ <tr>
151
+ </tr>
152
+ </table>
153
+ </tr>
154
+ </table>
155
+
156
+ <table class="form-table shortcodes average">
157
+ <tr>
158
+ <td>
159
+ <p><?php esc_html_e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
160
+ </td>
161
+ <td class="has-inner">
162
+ <table class="inner" cellpadding="0" cellspacing="0">
163
+ <tr>
164
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}<?php esc_html( 'Our average rating is ', 'strong-testimonials' ); ?> &lt;b&gt;{summary2}&lt;/b&gt;&#91;/testimonial_average_rating&#93;</td>
165
+ </tr>
166
+ <tr>
167
+ <td>
168
+ <div class="strong-rating-wrapper average">
169
+ <?php echo $stars; ?>
170
+ <?php esc_html_e( 'Our average rating is ', 'strong-testimonials' ); ?><b><span class="strong-rating-summary"><?php esc_html_e( '4.3 stars', 'strong-testimonials' ); ?></span></b>
171
+ </div>
172
+ </td>
173
+ </tr>
174
+ </table>
175
+ </td>
176
+ </tr>
177
+ </table>
178
+
179
+ <table class="form-table shortcodes average">
180
+ <tr>
181
+ <td>
182
+ <p><code>{stars}</code></p>
183
+ </td>
184
+ <td class="has-inner">
185
+ <table class="inner" cellpadding="0" cellspacing="0">
186
+ <tr>
187
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}&#91;/testimonial_average_rating&#93;</td>
188
+ </tr>
189
+ <tr>
190
+ <td>
191
+ <div class="strong-rating-wrapper average">
192
+ <?php echo $stars; ?>
193
+ </div>
194
+ </td>
195
+ </tr>
196
+ </table>
197
+ </td>
198
+ </tr>
199
+ </table>
200
+
201
+ <table class="form-table shortcodes average">
202
+ <tr>
203
+ <td>
204
+ <p><code>{average}</code></p>
205
+ </td>
206
+ <td class="has-inner">
207
+ <table class="inner" cellpadding="0" cellspacing="0">
208
+ <tr>
209
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{average}&#91;/testimonial_average_rating&#93;</td>
210
+ </tr>
211
+ <tr>
212
+ <td>
213
+ <div class="strong-rating-wrapper average"><span class="strong-rating-average"><?php esc_html_e( '4.3', 'strong-testimonials' ); ?></span></div>
214
+ </td>
215
+ </tr>
216
+ </table>
217
+ </td>
218
+ </tr>
219
+ </table>
220
+
221
+ <table class="form-table shortcodes average">
222
+ <tr>
223
+ <td>
224
+ <p><code>decimals</code></p>
225
+ <p class="description"><?php esc_html_e( 'If you need to display multiple decimals for average rating you have to set a number to decimal.', 'strong-testimonials' ); ?></p>
226
+
227
+ </td>
228
+ <td class="has-inner">
229
+ <table class="inner" cellpadding="0" cellspacing="0">
230
+ <tr>
231
+ <td class="shortcode">&#91;testimonial_average_rating decimals="number" /&#93;</td>
232
+ </tr>
233
+ <tr>
234
+ <td>
235
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
236
+ <?php echo $stars; ?>
237
+ <span class="strong-rating-summary"><?php esc_html_e( '4.333 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
238
+ </div>
239
+ </td>
240
+ </tr>
241
+ </table>
242
+ </td>
243
+ </tr>
244
+ </table>
245
+
246
+ <table class="form-table shortcodes average">
247
+ <tr>
248
+ <td>
249
+ <p><code>{count}</code></p>
250
+ </td>
251
+ <td class="has-inner">
252
+ <table class="inner" cellpadding="0" cellspacing="0">
253
+ <tr>
254
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{count}&#91;/testimonial_average_rating&#93;</td>
255
+ </tr>
256
+ <tr>
257
+ <td>
258
+ <div class="strong-rating-wrapper average"><span class="strong-rating-count"><?php esc_html_e( '9', 'strong-testimonials' ); ?></span></div>
259
+ </td>
260
+ </tr>
261
+ </table>
262
+ </td>
263
+ </tr>
264
+ </table>
265
+
266
+ <table class="form-table shortcodes average">
267
+ <tr>
268
+ <td>
269
+ <p><code>field</code></p>
270
+ <p class="description"><?php esc_html_e( 'If using multiple rating fields, you can specify the specific field you need.', 'strong-testimonials' ); ?></p>
271
+ <p class="description"><?php esc_html_e( 'If using multiple rating fields, you can use "all" to use all the rating fields.', 'strong-testimonials' ); ?></p>
272
+ </td>
273
+ <td class="has-inner">
274
+ <table class="inner" cellpadding="0" cellspacing="0">
275
+ <tr>
276
+ <td class="shortcode">&#91;testimonial_average_rating field="rating" /&#93;</td>
277
+ </tr>
278
+ <tr>
279
+ <td class="shortcode">&#91;testimonial_average_rating field="all" /&#93;</td>
280
+ </tr>
281
+ <tr>
282
+ <td>
283
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
284
+ <?php echo $stars; ?>
285
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
286
+ </div>
287
+ </td>
288
+ </tr>
289
+ </table>
290
+ </td>
291
+ </tr>
292
+ </table>
293
+
294
+ <table class="form-table shortcodes average">
295
+ <tr>
296
+ <td>
297
+ <p><code>block</code></p>
298
+ </td>
299
+ <td class="has-inner">
300
+ <table class="inner" cellpadding="0" cellspacing="0">
301
+ <tr>
302
+ <td class="shortcode">&#91;testimonial_average_rating block /&#93;</td>
303
+ </tr>
304
+ <tr>
305
+ <td>
306
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
307
+ <?php echo $stars; ?>
308
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
309
+ </div>
310
+ </td>
311
+ </tr>
312
+ </table>
313
+ </td>
314
+ </tr>
315
+ </table>
316
+
317
+ <table class="form-table shortcodes average">
318
+ <tr>
319
+ <td>
320
+ <p><code>centered</code></p>
321
+ </td>
322
+ <td class="has-inner">
323
+ <table class="inner" cellpadding="0" cellspacing="0">
324
+ <tr>
325
+ <td class="shortcode">&#91;testimonial_average_rating centered /&#93;</td>
326
+ </tr>
327
+ <tr>
328
+ <td>
329
+ <div class="strong-rating-wrapper average centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
330
+ <?php echo $stars; ?>
331
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
332
+ </div>
333
+ </td>
334
+ </tr>
335
+ </table>
336
+ </td>
337
+ </tr>
338
+ </table>
339
+
340
+ <table class="form-table shortcodes average">
341
+ <tr>
342
+ <td>
343
+ <p><code>rounded</code></p>
344
+ <p class="description"><?php esc_html_e( 'Round the rating(ex.: from 4.3 -> 4 or 4.7->5)', 'strong-testimonials' ); ?></p>
345
+ </td>
346
+ <td class="has-inner">
347
+ <table class="inner" cellpadding="0" cellspacing="0">
348
+ <tr>
349
+ <td class="shortcode">&#91;testimonial_average_rating rounded &#93;</td>
350
+ </tr>
351
+ <tr>
352
+ <td>
353
+ <div class="strong-rating-wrapper average"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
354
+ <?php echo $stars_rounded; ?>
355
+ <span class="strong-rating-summary"><?php esc_html_e( '4 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
356
+ </div>
357
+ </td>
358
+ </tr>
359
+ </table>
360
+ </td>
361
+ </tr>
362
+ </table>
363
+
364
+ <table class="form-table shortcodes average">
365
+ <tr>
366
+ <td>
367
+ <p><code>block</code> and <code>centered</code></p>
368
+ </td>
369
+ <td class="has-inner">
370
+ <table class="inner" cellpadding="0" cellspacing="0">
371
+ <tr>
372
+ <td class="shortcode">&#91;testimonial_average_rating block centered /&#93;</td>
373
+ </tr>
374
+ <tr>
375
+ <td>
376
+ <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
377
+ <?php echo $stars; ?>
378
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
379
+ </div>
380
+ </td>
381
+ </tr>
382
+ </table>
383
+ </td>
384
+ </tr>
385
+ </table>
386
+
387
+ <table class="form-table shortcodes average">
388
+ <tr>
389
+ <td>
390
+ <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
391
+ </td>
392
+ <td class="has-inner">
393
+ <table class="inner" cellpadding="0" cellspacing="0">
394
+ <tr>
395
+ <td class="shortcode">&#91;testimonial_average_rating element="span" /&#93;</td>
396
+ </tr>
397
+ <tr>
398
+ <td>
399
+ <span class="strong-rating-wrapper average">
400
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
401
+ <?php echo $stars; ?>
402
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
403
+ </span>
404
+ </td>
405
+ </tr>
406
+ </table>
407
+ </td>
408
+ </tr>
409
+ </table>
410
+
411
+ </div>
412
+ <?php
413
+ }
414
+
415
+ }
admin/class-strong-testimonials-post-editor.php CHANGED
@@ -1,401 +1,401 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Post_Editor
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Post_Editor {
9
-
10
- /**
11
- * Strong_Testimonials_Post_Editor constructor.
12
- */
13
- public function __construct() {
14
- }
15
-
16
- /**
17
- * Initialize.
18
- */
19
- public static function init() {
20
- self::add_actions();
21
- }
22
-
23
- /**
24
- * Add actions and filters.
25
- */
26
- public static function add_actions() {
27
- add_action( 'add_meta_boxes_wpm-testimonial', array( __CLASS__, 'add_meta_boxes' ) );
28
- add_action( 'save_post_wpm-testimonial', array( __CLASS__, 'save_details' ) );
29
- add_action( 'wp_ajax_wpmtst_edit_rating', array( __CLASS__, 'edit_rating' ) );
30
- add_filter( 'wp_insert_post_data', array( __CLASS__, 'prevent_shortcode' ), 10, 2 );
31
- }
32
-
33
- /**
34
- * Add meta box to the post editor screen.
35
- */
36
- public static function add_meta_boxes() {
37
- add_meta_box(
38
- 'details',
39
- esc_html_x( 'Client Details', 'post editor', 'strong-testimonials' ),
40
- array( __CLASS__, 'meta_options' ),
41
- 'wpm-testimonial',
42
- 'normal',
43
- 'high'
44
- );
45
- }
46
-
47
- /**
48
- * Add custom fields to the testimonial editor.
49
- */
50
- public static function meta_options() {
51
- global $post, $pagenow;
52
- $post = wpmtst_get_post( $post );
53
- $fields = wpmtst_get_custom_fields();
54
- $is_new = ( 'post-new.php' == $pagenow );
55
- wp_nonce_field ( plugin_basename(__FILE__), 'wpmtst_metabox_nonce');
56
- ?>
57
- <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
58
- <table class="options">
59
- <tr>
60
- <td colspan="2">
61
- <p><?php esc_html_x( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
62
- </td>
63
- </tr>
64
- <?php
65
- do_action( 'wpmtst_before_client_fields' );
66
- foreach ( $fields as $key => $field ) {
67
- // TODO Use field property to bypass instead
68
- // short-circuit
69
- if ( 'category' == strtok( $field['input_type'], '-' ) ) {
70
- continue;
71
- }
72
- ?>
73
- <tr>
74
- <th>
75
- <label for="<?php echo esc_attr( $field['name'] ); ?>">
76
- <?php echo apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ); ?>
77
- </label>
78
- </th>
79
- <td>
80
- <div class="<?php echo esc_attr( $field['input_type'] ); ?>">
81
- <?php self::meta_option( $field, $post, $is_new ); ?>
82
- </div>
83
- </td>
84
- </tr>
85
- <?php
86
- }
87
- do_action( 'wpmtst_after_client_fields' );
88
- ?>
89
- </table>
90
- <?php
91
- do_action( 'wpmtst_after_client_fields_table' );
92
- }
93
-
94
- /**
95
- * Input type for a single custom field.
96
- *
97
- * @since 2.23.0
98
- *
99
- * @param $field
100
- * @param $post
101
- * @param $is_new
102
- */
103
- public static function meta_option( $field, $post, $is_new ) {
104
- // Check for callback first.
105
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
106
- self::meta_option__action( $field, $post, $is_new );
107
- }
108
- // Check field type.
109
- else {
110
- switch ( $field['input_type'] ) {
111
- case 'rating' :
112
- self::meta_option__rating( $field, $post, $is_new );
113
- break;
114
- case 'url' :
115
- self::meta_option__url( $field, $post, $is_new );
116
- break;
117
- case 'checkbox' :
118
- self::meta_option__checkbox( $field, $post, $is_new );
119
- break;
120
- case 'shortcode' :
121
- self::meta_option__shortcode( $field, $post, $is_new );
122
- break;
123
- case 'textarea' :
124
- self::meta_option__textarea( $field, $post, $is_new );
125
- break;
126
- default :
127
- self::meta_option__text( $field, $post, $is_new );
128
- }
129
- }
130
- }
131
-
132
- /**
133
- * Custom action callback.
134
- *
135
- * @param $field
136
- * @param $post
137
- * @param $is_new
138
- */
139
- private static function meta_option__action( $field, $post, $is_new ) {
140
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
141
- do_action( $field['action_input'], $field, $post->{$field['name']} );
142
- }
143
- }
144
-
145
- /**
146
- * Text input.
147
- *
148
- * @param $field
149
- * @param $post
150
- * @param $is_new
151
- */
152
- private static function meta_option__text( $field, $post, $is_new ) {
153
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">', esc_attr( $field['input_type'] ), esc_attr( $field['name'] ), esc_attr( $post->{$field['name']} ) );
154
- }
155
-
156
- /**
157
- * Textarea.
158
- *
159
- * @param $field
160
- * @param $post
161
- * @param $is_new
162
- */
163
- private static function meta_option__textarea( $field, $post, $is_new ) {
164
- printf(
165
- '<textarea id="%1$s" name="custom[%1$s]" class="custom-input">%2$s</textarea>',
166
- esc_attr( $field['name'] ),
167
- wp_kses_post( $post->{$field['name']} )
168
- );
169
- }
170
-
171
- /**
172
- * URL input.
173
- *
174
- * @param $field
175
- * @param $post
176
- * @param $is_new
177
- */
178
- private static function meta_option__url( $field, $post, $is_new ) {
179
- ?>
180
- <div class="input-url">
181
- <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">', esc_attr( $field['input_type'] ), esc_html( $field['name'] ), esc_attr( $post->{$field['name']} ) ); ?>
182
- </div>
183
- <div class="input-links">
184
- <div class="input-nofollow">
185
- <label for="custom_nofollow"><code>rel="nofollow"</code></label>
186
- <select id="custom_nofollow" name="custom[nofollow]">
187
- <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
188
- <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
189
- <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
190
- </select>
191
- </div>
192
- <div class="input-noopener">
193
- <label for="custom_noopener"><code>rel="noopener"</code></label>
194
- <select id="custom_noopener" name="custom[noopener]">
195
- <option value="default" <?php selected( $post->noopener, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
196
- <option value="yes" <?php selected( $post->noopener, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
197
- <option value="no" <?php selected( $post->noopener, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
198
- </select>
199
- </div>
200
- <div class="input-noreferrer">
201
- <label for="custom_noreferrer"><code>rel="noreferrer"</code></label>
202
- <select id="custom_noopener" name="custom[noreferrer]">
203
- <option value="default" <?php selected( $post->noreferrer, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
204
- <option value="yes" <?php selected( $post->noreferrer, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
205
- <option value="no" <?php selected( $post->noreferrer, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
206
- </select>
207
- </div>
208
- <?php
209
- }
210
-
211
- /**
212
- * Checkbox input.
213
- *
214
- * @param $field
215
- * @param $post
216
- * @param $is_new
217
- */
218
- private static function meta_option__checkbox( $field, $post, $is_new ) {
219
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>', esc_attr( $field['input_type'] ), esc_attr( $field['name'] ), 1, checked( $post->{$field['name']}, 1, false ) );
220
- }
221
-
222
- /**
223
- * Rating input.
224
- *
225
- * @param $field
226
- * @param $post
227
- * @param $is_new
228
- */
229
- private static function meta_option__rating( $field, $post, $is_new ) {
230
- $rating = get_post_meta( $post->ID, $field['name'], true );
231
- if ( ! $rating || $is_new ) {
232
- $rating = 0;
233
- }
234
- ?>
235
- <div class="edit-rating-box hide-if-no-js" data-field="<?php echo esc_attr( $field['name'] ); ?>">
236
-
237
- <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
238
- <input type="hidden" class="current-rating" value="<?php echo esc_attr( $rating ); ?>">
239
-
240
- <!-- form -->
241
- <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
242
- <span class="inner">
243
- <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
244
- </span>
245
- <?php if ( ! $is_new ) : ?>
246
- <span class="edit-rating-buttons-2">
247
- <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
248
- <button type="button" class="save button button-small"><?php esc_html_e( 'OK', 'strong-testimonials' ); ?></button>&nbsp;
249
- <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel', 'strong-testimonials' ); ?></button>
250
- </span>
251
- <?php endif; ?>
252
- </div>
253
-
254
- <!-- display -->
255
- <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
256
- <span class="inner">
257
- <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
258
- </span>
259
-
260
- <?php if ( ! $is_new ) : ?>
261
- <span class="edit-rating-buttons-1">
262
- <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit', 'strong-testimonials' ); ?></button>
263
- </span>
264
- <?php endif; ?>
265
- </div>
266
-
267
- <span class="edit-rating-success"></span>
268
-
269
- </div>
270
- <?php
271
- }
272
-
273
- /**
274
- * Shortcode for custom input.
275
- *
276
- * @param $field
277
- * @param $post
278
- * @param $is_new
279
- */
280
- public static function meta_option__shortcode( $field, $post, $is_new ) {
281
- $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
282
- if ( shortcode_exists( $shortcode ) ) {
283
- echo do_shortcode( $field['shortcode_on_display'] );
284
- } else {
285
- echo '<div class="custom-input not-found">' . sprintf( esc_html__( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . esc_html($field['shortcode_on_display']) . '</code>' ) . '</div>';
286
- }
287
- }
288
-
289
- /**
290
- * Save custom fields.
291
- *
292
- * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
293
- */
294
- public static function save_details() {
295
- if ( ! isset( $_POST['custom'] ) || !wp_verify_nonce( $_POST['wpmtst_metabox_nonce'], plugin_basename(__FILE__))) {
296
- return;
297
- }
298
-
299
- $post_id = absint( $_POST['post_ID'] );
300
- $custom = $_POST['custom'] ;
301
-
302
- $custom_fields = wpmtst_get_custom_fields();
303
-
304
- // Construct array of checkbox empty values because blank checkboxes are not POSTed.
305
- $checkboxes = array();
306
- foreach ( $custom_fields as $key => $field ) {
307
- if ( 'checkbox' == $field['input_type'] ) {
308
- $checkboxes[ $key ] = 0;
309
- }
310
- }
311
- if ( $checkboxes ) {
312
- $custom = array_merge( $checkboxes, $custom );
313
- }
314
-
315
-
316
- // Determine whether to update or delete.
317
- // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
318
- $custom_fields['nofollow']['input_type'] = '';
319
- $custom_fields['noopener']['input_type'] = '';
320
- $custom_fields['noreferrer']['input_type'] = '';
321
-
322
- foreach ( $custom as $key => $value ) {
323
- $action = 'update';
324
- $sanitized_value = '';
325
-
326
- if ( isset( $custom_fields[ $key ] ) ) {
327
- if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
328
- $action = 'delete';
329
- }
330
- }
331
-
332
- // Data Sanitizationva
333
- if ( isset($custom_fields[ $key ]['input_type']) && 'text' == $custom_fields[ $key ]['input_type'] ) {
334
- $sanitized_value = wp_filter_post_kses( $value );
335
- }elseif ( isset($custom_fields[ $key ]['input_type']) && 'email' == $custom_fields[ $key ]['input_type'] ) {
336
- $sanitized_value = sanitize_email( $value );
337
- }elseif ( isset($custom_fields[ $key ]['input_type']) && 'url' == $custom_fields[ $key ]['input_type'] ) {
338
- $sanitized_value = esc_url_raw( $value );
339
- }else{
340
- $sanitized_value = sanitize_text_field( $value );
341
- }
342
-
343
- if ( 'update' == $action ) {
344
- // empty values replace existing values
345
- update_post_meta( $post_id, $key, $sanitized_value );
346
- }
347
- else {
348
- // delete value; e.g. zero rating
349
- delete_post_meta( $post_id, $key );
350
- }
351
- }
352
- }
353
-
354
- /**
355
- * Prevent use of this plugin's shortcode in a testimonial.
356
- *
357
- * @since 2.32.2
358
- * @param $data
359
- * @param $postarr
360
- *
361
- * @return mixed
362
- */
363
- public static function prevent_shortcode( $data, $postarr ) {
364
- if ( 'wpm-testimonial' == $data['post_type'] ) {
365
- $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
366
- }
367
-
368
- return $data;
369
- }
370
-
371
- /**
372
- * Ajax handler to edit a rating.
373
- *
374
- * @since 2.12.0
375
- */
376
- public static function edit_rating() {
377
- $message = '';
378
- $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
379
- $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
380
- $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
381
-
382
- check_ajax_referer( 'editrating', 'editratingnonce' );
383
-
384
- if ( $post_id ) {
385
- if ( $rating ) {
386
- update_post_meta( $post_id, $name, $rating );
387
- } else {
388
- delete_post_meta( $post_id, $name );
389
- }
390
- $message = 'New rating saved';
391
- }
392
-
393
- $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
394
- $response = array( 'display' => $display, 'message' => $message );
395
- echo json_encode( $response );
396
- wp_die();
397
- }
398
-
399
- }
400
-
401
- Strong_Testimonials_Post_Editor::init();
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Post_Editor
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Post_Editor {
9
+
10
+ /**
11
+ * Strong_Testimonials_Post_Editor constructor.
12
+ */
13
+ public function __construct() {
14
+ }
15
+
16
+ /**
17
+ * Initialize.
18
+ */
19
+ public static function init() {
20
+ self::add_actions();
21
+ }
22
+
23
+ /**
24
+ * Add actions and filters.
25
+ */
26
+ public static function add_actions() {
27
+ add_action( 'add_meta_boxes_wpm-testimonial', array( __CLASS__, 'add_meta_boxes' ) );
28
+ add_action( 'save_post_wpm-testimonial', array( __CLASS__, 'save_details' ) );
29
+ add_action( 'wp_ajax_wpmtst_edit_rating', array( __CLASS__, 'edit_rating' ) );
30
+ add_filter( 'wp_insert_post_data', array( __CLASS__, 'prevent_shortcode' ), 10, 2 );
31
+ }
32
+
33
+ /**
34
+ * Add meta box to the post editor screen.
35
+ */
36
+ public static function add_meta_boxes() {
37
+ add_meta_box(
38
+ 'details',
39
+ esc_html_x( 'Client Details', 'post editor', 'strong-testimonials' ),
40
+ array( __CLASS__, 'meta_options' ),
41
+ 'wpm-testimonial',
42
+ 'normal',
43
+ 'high'
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Add custom fields to the testimonial editor.
49
+ */
50
+ public static function meta_options() {
51
+ global $post, $pagenow;
52
+ $post = wpmtst_get_post( $post );
53
+ $fields = wpmtst_get_custom_fields();
54
+ $is_new = ( 'post-new.php' == $pagenow );
55
+ wp_nonce_field ( plugin_basename(__FILE__), 'wpmtst_metabox_nonce');
56
+ ?>
57
+ <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
58
+ <table class="options">
59
+ <tr>
60
+ <td colspan="2">
61
+ <p><?php esc_html_x( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
62
+ </td>
63
+ </tr>
64
+ <?php
65
+ do_action( 'wpmtst_before_client_fields' );
66
+ foreach ( $fields as $key => $field ) {
67
+ // TODO Use field property to bypass instead
68
+ // short-circuit
69
+ if ( 'category' == strtok( $field['input_type'], '-' ) ) {
70
+ continue;
71
+ }
72
+ ?>
73
+ <tr>
74
+ <th>
75
+ <label for="<?php echo esc_attr( $field['name'] ); ?>">
76
+ <?php echo apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ); ?>
77
+ </label>
78
+ </th>
79
+ <td>
80
+ <div class="<?php echo esc_attr( $field['input_type'] ); ?>">
81
+ <?php self::meta_option( $field, $post, $is_new ); ?>
82
+ </div>
83
+ </td>
84
+ </tr>
85
+ <?php
86
+ }
87
+ do_action( 'wpmtst_after_client_fields' );
88
+ ?>
89
+ </table>
90
+ <?php
91
+ do_action( 'wpmtst_after_client_fields_table' );
92
+ }
93
+
94
+ /**
95
+ * Input type for a single custom field.
96
+ *
97
+ * @since 2.23.0
98
+ *
99
+ * @param $field
100
+ * @param $post
101
+ * @param $is_new
102
+ */
103
+ public static function meta_option( $field, $post, $is_new ) {
104
+ // Check for callback first.
105
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
106
+ self::meta_option__action( $field, $post, $is_new );
107
+ }
108
+ // Check field type.
109
+ else {
110
+ switch ( $field['input_type'] ) {
111
+ case 'rating' :
112
+ self::meta_option__rating( $field, $post, $is_new );
113
+ break;
114
+ case 'url' :
115
+ self::meta_option__url( $field, $post, $is_new );
116
+ break;
117
+ case 'checkbox' :
118
+ self::meta_option__checkbox( $field, $post, $is_new );
119
+ break;
120
+ case 'shortcode' :
121
+ self::meta_option__shortcode( $field, $post, $is_new );
122
+ break;
123
+ case 'textarea' :
124
+ self::meta_option__textarea( $field, $post, $is_new );
125
+ break;
126
+ default :
127
+ self::meta_option__text( $field, $post, $is_new );
128
+ }
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Custom action callback.
134
+ *
135
+ * @param $field
136
+ * @param $post
137
+ * @param $is_new
138
+ */
139
+ private static function meta_option__action( $field, $post, $is_new ) {
140
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
141
+ do_action( $field['action_input'], $field, $post->{$field['name']} );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Text input.
147
+ *
148
+ * @param $field
149
+ * @param $post
150
+ * @param $is_new
151
+ */
152
+ private static function meta_option__text( $field, $post, $is_new ) {
153
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">', esc_attr( $field['input_type'] ), esc_attr( $field['name'] ), esc_attr( $post->{$field['name']} ) );
154
+ }
155
+
156
+ /**
157
+ * Textarea.
158
+ *
159
+ * @param $field
160
+ * @param $post
161
+ * @param $is_new
162
+ */
163
+ private static function meta_option__textarea( $field, $post, $is_new ) {
164
+ printf(
165
+ '<textarea id="%1$s" name="custom[%1$s]" class="custom-input">%2$s</textarea>',
166
+ esc_attr( $field['name'] ),
167
+ wp_kses_post( $post->{$field['name']} )
168
+ );
169
+ }
170
+
171
+ /**
172
+ * URL input.
173
+ *
174
+ * @param $field
175
+ * @param $post
176
+ * @param $is_new
177
+ */
178
+ private static function meta_option__url( $field, $post, $is_new ) {
179
+ ?>
180
+ <div class="input-url">
181
+ <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">', esc_attr( $field['input_type'] ), esc_html( $field['name'] ), esc_attr( $post->{$field['name']} ) ); ?>
182
+ </div>
183
+ <div class="input-links">
184
+ <div class="input-nofollow">
185
+ <label for="custom_nofollow"><code>rel="nofollow"</code></label>
186
+ <select id="custom_nofollow" name="custom[nofollow]">
187
+ <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
188
+ <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
189
+ <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
190
+ </select>
191
+ </div>
192
+ <div class="input-noopener">
193
+ <label for="custom_noopener"><code>rel="noopener"</code></label>
194
+ <select id="custom_noopener" name="custom[noopener]">
195
+ <option value="default" <?php selected( $post->noopener, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
196
+ <option value="yes" <?php selected( $post->noopener, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
197
+ <option value="no" <?php selected( $post->noopener, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
198
+ </select>
199
+ </div>
200
+ <div class="input-noreferrer">
201
+ <label for="custom_noreferrer"><code>rel="noreferrer"</code></label>
202
+ <select id="custom_noopener" name="custom[noreferrer]">
203
+ <option value="default" <?php selected( $post->noreferrer, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
204
+ <option value="yes" <?php selected( $post->noreferrer, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
205
+ <option value="no" <?php selected( $post->noreferrer, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
206
+ </select>
207
+ </div>
208
+ <?php
209
+ }
210
+
211
+ /**
212
+ * Checkbox input.
213
+ *
214
+ * @param $field
215
+ * @param $post
216
+ * @param $is_new
217
+ */
218
+ private static function meta_option__checkbox( $field, $post, $is_new ) {
219
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>', esc_attr( $field['input_type'] ), esc_attr( $field['name'] ), 1, checked( $post->{$field['name']}, 1, false ) );
220
+ }
221
+
222
+ /**
223
+ * Rating input.
224
+ *
225
+ * @param $field
226
+ * @param $post
227
+ * @param $is_new
228
+ */
229
+ private static function meta_option__rating( $field, $post, $is_new ) {
230
+ $rating = get_post_meta( $post->ID, $field['name'], true );
231
+ if ( ! $rating || $is_new ) {
232
+ $rating = 0;
233
+ }
234
+ ?>
235
+ <div class="edit-rating-box hide-if-no-js" data-field="<?php echo esc_attr( $field['name'] ); ?>">
236
+
237
+ <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
238
+ <input type="hidden" class="current-rating" value="<?php echo esc_attr( $rating ); ?>">
239
+
240
+ <!-- form -->
241
+ <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
242
+ <span class="inner">
243
+ <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
244
+ </span>
245
+ <?php if ( ! $is_new ) : ?>
246
+ <span class="edit-rating-buttons-2">
247
+ <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
248
+ <button type="button" class="save button button-small"><?php esc_html_e( 'OK', 'strong-testimonials' ); ?></button>&nbsp;
249
+ <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel', 'strong-testimonials' ); ?></button>
250
+ </span>
251
+ <?php endif; ?>
252
+ </div>
253
+
254
+ <!-- display -->
255
+ <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
256
+ <span class="inner">
257
+ <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
258
+ </span>
259
+
260
+ <?php if ( ! $is_new ) : ?>
261
+ <span class="edit-rating-buttons-1">
262
+ <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit', 'strong-testimonials' ); ?></button>
263
+ </span>
264
+ <?php endif; ?>
265
+ </div>
266
+
267
+ <span class="edit-rating-success"></span>
268
+
269
+ </div>
270
+ <?php
271
+ }
272
+
273
+ /**
274
+ * Shortcode for custom input.
275
+ *
276
+ * @param $field
277
+ * @param $post
278
+ * @param $is_new
279
+ */
280
+ public static function meta_option__shortcode( $field, $post, $is_new ) {
281
+ $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
282
+ if ( shortcode_exists( $shortcode ) ) {
283
+ echo do_shortcode( $field['shortcode_on_display'] );
284
+ } else {
285
+ echo '<div class="custom-input not-found">' . sprintf( esc_html__( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . esc_html($field['shortcode_on_display']) . '</code>' ) . '</div>';
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Save custom fields.
291
+ *
292
+ * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
293
+ */
294
+ public static function save_details() {
295
+ if ( ! isset( $_POST['custom'] ) || !wp_verify_nonce( $_POST['wpmtst_metabox_nonce'], plugin_basename(__FILE__))) {
296
+ return;
297
+ }
298
+
299
+ $post_id = absint( $_POST['post_ID'] );
300
+ $custom = $_POST['custom'] ;
301
+
302
+ $custom_fields = wpmtst_get_custom_fields();
303
+
304
+ // Construct array of checkbox empty values because blank checkboxes are not POSTed.
305
+ $checkboxes = array();
306
+ foreach ( $custom_fields as $key => $field ) {
307
+ if ( 'checkbox' == $field['input_type'] ) {
308
+ $checkboxes[ $key ] = 0;
309
+ }
310
+ }
311
+ if ( $checkboxes ) {
312
+ $custom = array_merge( $checkboxes, $custom );
313
+ }
314
+
315
+
316
+ // Determine whether to update or delete.
317
+ // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
318
+ $custom_fields['nofollow']['input_type'] = '';
319
+ $custom_fields['noopener']['input_type'] = '';
320
+ $custom_fields['noreferrer']['input_type'] = '';
321
+
322
+ foreach ( $custom as $key => $value ) {
323
+ $action = 'update';
324
+ $sanitized_value = '';
325
+
326
+ if ( isset( $custom_fields[ $key ] ) ) {
327
+ if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
328
+ $action = 'delete';
329
+ }
330
+ }
331
+
332
+ // Data Sanitizationva
333
+ if ( isset($custom_fields[ $key ]['input_type']) && 'text' == $custom_fields[ $key ]['input_type'] ) {
334
+ $sanitized_value = wp_filter_post_kses( $value );
335
+ }elseif ( isset($custom_fields[ $key ]['input_type']) && 'email' == $custom_fields[ $key ]['input_type'] ) {
336
+ $sanitized_value = sanitize_email( $value );
337
+ }elseif ( isset($custom_fields[ $key ]['input_type']) && 'url' == $custom_fields[ $key ]['input_type'] ) {
338
+ $sanitized_value = esc_url_raw( $value );
339
+ }else{
340
+ $sanitized_value = sanitize_text_field( $value );
341
+ }
342
+
343
+ if ( 'update' == $action ) {
344
+ // empty values replace existing values
345
+ update_post_meta( $post_id, $key, $sanitized_value );
346
+ }
347
+ else {
348
+ // delete value; e.g. zero rating
349
+ delete_post_meta( $post_id, $key );
350
+ }
351
+ }
352
+ }
353
+
354
+ /**
355
+ * Prevent use of this plugin's shortcode in a testimonial.
356
+ *
357
+ * @since 2.32.2
358
+ * @param $data
359
+ * @param $postarr
360
+ *
361
+ * @return mixed
362
+ */
363
+ public static function prevent_shortcode( $data, $postarr ) {
364
+ if ( 'wpm-testimonial' == $data['post_type'] ) {
365
+ $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
366
+ }
367
+
368
+ return $data;
369
+ }
370
+
371
+ /**
372
+ * Ajax handler to edit a rating.
373
+ *
374
+ * @since 2.12.0
375
+ */
376
+ public static function edit_rating() {
377
+ $message = '';
378
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
379
+ $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
380
+ $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
381
+
382
+ check_ajax_referer( 'editrating', 'editratingnonce' );
383
+
384
+ if ( $post_id ) {
385
+ if ( $rating ) {
386
+ update_post_meta( $post_id, $name, $rating );
387
+ } else {
388
+ delete_post_meta( $post_id, $name );
389
+ }
390
+ $message = 'New rating saved';
391
+ }
392
+
393
+ $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
394
+ $response = array( 'display' => $display, 'message' => $message );
395
+ echo json_encode( $response );
396
+ wp_die();
397
+ }
398
+
399
+ }
400
+
401
+ Strong_Testimonials_Post_Editor::init();
admin/class-strong-testimonials-review.php CHANGED
@@ -1,170 +1,170 @@
1
- <?php
2
-
3
- class Strong_Review {
4
-
5
- private $value;
6
- private $messages;
7
- private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
8
- private $slug = 'strong-testimonials';
9
-
10
- function __construct() {
11
-
12
- $this->messages = array(
13
- 'notice' => esc_html__( "Hi there! Stoked to see you're using Strong Testimonials for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'strong-testimonials' ),
14
- 'rate' => esc_html__( 'Rate the plugin', 'strong-testimonials' ),
15
- 'rated' => esc_html__( 'Remind me later', 'strong-testimonials' ),
16
- 'no_rate' => __( 'Don\'t show again', 'strong-testimonials' ),
17
- );
18
-
19
- if ( isset( $args['messages'] ) ) {
20
- $this->messages = wp_parse_args( $args['messages'], $this->messages );
21
- }
22
-
23
- add_action( 'init', array( $this, 'init' ) );
24
-
25
- }
26
-
27
- public function init() {
28
- if ( ! is_admin() ) {
29
- return;
30
- }
31
-
32
- $this->value = $this->value();
33
-
34
- if ( $this->check() ) {
35
- add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) );
36
- add_action( 'wp_ajax_strong-testimonials_review', array( $this, 'ajax' ) );
37
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
38
- add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) );
39
- }
40
-
41
- add_filter('st_uninstall_db_options',array($this,'uninstall_options'));
42
-
43
- }
44
-
45
- private function check() {
46
-
47
- if ( ! current_user_can('manage_options') ) {
48
- return false;
49
- }
50
-
51
- return( time() > $this->value );
52
-
53
- }
54
-
55
- private function value() {
56
-
57
- $value = get_option( 'strong-testimonials-rate-time', false );
58
- if ( $value ) {
59
- return $value;
60
- }
61
-
62
- $value = time() + DAY_IN_SECONDS;
63
- update_option( 'strong-testimonials-rate-time', $value );
64
-
65
- return $value;
66
-
67
- }
68
-
69
- public function five_star_wp_rate_notice() {
70
-
71
- $url = sprintf( $this->link, $this->slug );
72
-
73
- ?>
74
- <div id="<?php echo esc_attr( $this->slug ) ?>-strong-testimonials-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
75
- <p><?php echo sprintf( esc_html( $this->messages['notice'] ), esc_attr( $this->value ) ) ; ?></p>
76
- <p class="actions">
77
- <a id="strong-testimonials-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary strong-testimonials-review-button">
78
- <?php echo esc_html( $this->messages['rate'] ); ?>
79
- </a>
80
- <a id="strong-testimonials-later" href="#" style="margin-left:10px" class="strong-testimonials-review-button"><?php echo esc_html( $this->messages['rated'] ); ?></a>
81
- <a id="strong-testimonials-no-rate" href="#" style="margin-left:10px" class="strong-testimonials-review-button"><?php echo esc_html( $this->messages['no_rate'] ); ?></a>
82
- </p>
83
- </div>
84
- <?php
85
- }
86
-
87
- public function ajax() {
88
-
89
- check_ajax_referer( 'strong-testimonials-review', 'security' );
90
-
91
- if ( ! isset( $_POST['check'] ) ) {
92
- wp_die( 'ok' );
93
- }
94
-
95
- $time = get_option( 'strong-testimonials-rate-time' );
96
-
97
- if ( 'strong-testimonials-rate' == $_POST['check'] ) {
98
- $time = time() + YEAR_IN_SECONDS * 1;
99
- }elseif ( 'strong-testimonials-later' == ['check'] ) {
100
- $time = time() + WEEK_IN_SECONDS;
101
- }elseif ( 'strong-testimonials-no-rate' == $_POST['check'] ) {
102
- $time = time() + YEAR_IN_SECONDS * 1;
103
- }
104
-
105
- update_option( 'strong-testimonials-rate-time', $time );
106
- wp_die( 'ok' );
107
-
108
- }
109
-
110
- public function enqueue() {
111
- wp_enqueue_script( 'jquery' );
112
- }
113
-
114
- public function ajax_script() {
115
-
116
- $ajax_nonce = wp_create_nonce( "strong-testimonials-review" );
117
-
118
- ?>
119
-
120
- <script type="text/javascript">
121
- jQuery( document ).ready( function( $ ){
122
-
123
- $( '.strong-testimonials-review-button' ).on('click', function( evt ){
124
- var href = $(this).attr('href'),
125
- id = $(this).attr('id');
126
-
127
- if ( 'strong-testimonials-rate' != id ) {
128
- evt.preventDefault();
129
- }
130
-
131
- var data = {
132
- action: 'strong-testimonials_review',
133
- security: '<?php echo $ajax_nonce; ?>',
134
- check: id
135
- };
136
-
137
- if ( 'strong-testimonials-rated' === id ) {
138
- data['strong-testimonials-review'] = 1;
139
- }
140
-
141
- $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
142
- $( '#<?php echo $this->slug ?>-strong-testimonials-review-notice' ).slideUp( 'fast', function() {
143
- $( this ).remove();
144
- } );
145
- });
146
-
147
- } );
148
-
149
- });
150
- </script>
151
-
152
- <?php
153
- }
154
-
155
- /**
156
- * @param $options
157
- *
158
- * @return mixed
159
- *
160
- * @since 2.51.6
161
- */
162
- public function uninstall_options( $options ) {
163
-
164
- $options[] = 'strong-testimonials-rate-time';
165
-
166
- return $options;
167
- }
168
- }
169
-
170
  new Strong_Review();
1
+ <?php
2
+
3
+ class Strong_Review {
4
+
5
+ private $value;
6
+ private $messages;
7
+ private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
8
+ private $slug = 'strong-testimonials';
9
+
10
+ function __construct() {
11
+
12
+ $this->messages = array(
13
+ 'notice' => esc_html__( "Hi there! Stoked to see you're using Strong Testimonials for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'strong-testimonials' ),
14
+ 'rate' => esc_html__( 'Rate the plugin', 'strong-testimonials' ),
15
+ 'rated' => esc_html__( 'Remind me later', 'strong-testimonials' ),
16
+ 'no_rate' => __( 'Don\'t show again', 'strong-testimonials' ),
17
+ );
18
+
19
+ if ( isset( $args['messages'] ) ) {
20
+ $this->messages = wp_parse_args( $args['messages'], $this->messages );
21
+ }
22
+
23
+ add_action( 'init', array( $this, 'init' ) );
24
+
25
+ }
26
+
27
+ public function init() {
28
+ if ( ! is_admin() ) {
29
+ return;
30
+ }
31
+
32
+ $this->value = $this->value();
33
+
34
+ if ( $this->check() ) {
35
+ add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) );
36
+ add_action( 'wp_ajax_strong-testimonials_review', array( $this, 'ajax' ) );
37
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
38
+ add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) );
39
+ }
40
+
41
+ add_filter('st_uninstall_db_options',array($this,'uninstall_options'));
42
+
43
+ }
44
+
45
+ private function check() {
46
+
47
+ if ( ! current_user_can('manage_options') ) {
48
+ return false;
49
+ }
50
+
51
+ return( time() > $this->value );
52
+
53
+ }
54
+
55
+ private function value() {
56
+
57
+ $value = get_option( 'strong-testimonials-rate-time', false );
58
+ if ( $value ) {
59
+ return $value;
60
+ }
61
+
62
+ $value = time() + DAY_IN_SECONDS;
63
+ update_option( 'strong-testimonials-rate-time', $value );
64
+
65
+ return $value;
66
+
67
+ }
68
+
69
+ public function five_star_wp_rate_notice() {
70
+
71
+ $url = sprintf( $this->link, $this->slug );
72
+
73
+ ?>
74
+ <div id="<?php echo esc_attr( $this->slug ) ?>-strong-testimonials-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
75
+ <p><?php echo sprintf( esc_html( $this->messages['notice'] ), esc_attr( $this->value ) ) ; ?></p>
76
+ <p class="actions">
77
+ <a id="strong-testimonials-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary strong-testimonials-review-button">
78
+ <?php echo esc_html( $this->messages['rate'] ); ?>
79
+ </a>
80
+ <a id="strong-testimonials-later" href="#" style="margin-left:10px" class="strong-testimonials-review-button"><?php echo esc_html( $this->messages['rated'] ); ?></a>
81
+ <a id="strong-testimonials-no-rate" href="#" style="margin-left:10px" class="strong-testimonials-review-button"><?php echo esc_html( $this->messages['no_rate'] ); ?></a>
82
+ </p>
83
+ </div>
84
+ <?php
85
+ }
86
+
87
+ public function ajax() {
88
+
89
+ check_ajax_referer( 'strong-testimonials-review', 'security' );
90
+
91
+ if ( ! isset( $_POST['check'] ) ) {
92
+ wp_die( 'ok' );
93
+ }
94
+
95
+ $time = get_option( 'strong-testimonials-rate-time' );
96
+
97
+ if ( 'strong-testimonials-rate' == $_POST['check'] ) {
98
+ $time = time() + YEAR_IN_SECONDS * 1;
99
+ }elseif ( 'strong-testimonials-later' == ['check'] ) {
100
+ $time = time() + WEEK_IN_SECONDS;
101
+ }elseif ( 'strong-testimonials-no-rate' == $_POST['check'] ) {
102
+ $time = time() + YEAR_IN_SECONDS * 1;
103
+ }
104
+
105
+ update_option( 'strong-testimonials-rate-time', $time );
106
+ wp_die( 'ok' );
107
+
108
+ }
109
+
110
+ public function enqueue() {
111
+ wp_enqueue_script( 'jquery' );
112
+ }
113
+
114
+ public function ajax_script() {
115
+
116
+ $ajax_nonce = wp_create_nonce( "strong-testimonials-review" );
117
+
118
+ ?>
119
+
120
+ <script type="text/javascript">
121
+ jQuery( document ).ready( function( $ ){
122
+
123
+ $( '.strong-testimonials-review-button' ).on('click', function( evt ){
124
+ var href = $(this).attr('href'),
125
+ id = $(this).attr('id');
126
+
127
+ if ( 'strong-testimonials-rate' != id ) {
128
+ evt.preventDefault();
129
+ }
130
+
131
+ var data = {
132
+ action: 'strong-testimonials_review',
133
+ security: '<?php echo $ajax_nonce; ?>',
134
+ check: id
135
+ };
136
+
137
+ if ( 'strong-testimonials-rated' === id ) {
138
+ data['strong-testimonials-review'] = 1;
139
+ }
140
+
141
+ $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
142
+ $( '#<?php echo $this->slug ?>-strong-testimonials-review-notice' ).slideUp( 'fast', function() {
143
+ $( this ).remove();
144
+ } );
145
+ });
146
+
147
+ } );
148
+
149
+ });
150
+ </script>
151
+
152
+ <?php
153
+ }
154
+
155
+ /**
156
+ * @param $options
157
+ *
158
+ * @return mixed
159
+ *
160
+ * @since 2.51.6
161
+ */
162
+ public function uninstall_options( $options ) {
163
+
164
+ $options[] = 'strong-testimonials-rate-time';
165
+
166
+ return $options;
167
+ }
168
+ }
169
+
170
  new Strong_Review();
admin/class-strong-testimonials-updater.php CHANGED
@@ -1,1387 +1,1387 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Updater
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Updater {
9
-
10
- /**
11
- * The version before updating.
12
- *
13
- * @var string
14
- */
15
- private static $old_version;
16
-
17
- /**
18
- * Log steps during update process.
19
- *
20
- * @var array
21
- */
22
- private static $new_log;
23
-
24
- /**
25
- * Strong_Testimonials_Updater constructor.
26
- */
27
- public function __construct() {
28
-
29
- }
30
-
31
- /**
32
- * Add a log entry.
33
- *
34
- * @param $name
35
- * @param string $entry
36
- * @param string $var
37
- */
38
- private static function log( $name, $entry = '', $var = '' ) {
39
- if ( $name ) {
40
- $x = $name;
41
- if ( $entry ) {
42
- $x .= ' : ' . $entry;
43
- if ( $var ) {
44
- $x .= ' = ';
45
- if ( is_array( $var ) || is_object( $var ) ) {
46
- // log the text
47
- self::$new_log[] = $x;
48
- // then log the variable
49
- self::$new_log[] = $var;
50
- }
51
- else {
52
- self::$new_log[] = $x . $var;
53
- }
54
- }
55
- else {
56
- self::$new_log[] = $x;
57
- }
58
- }
59
- else {
60
- self::$new_log[] = $x;
61
- }
62
- }
63
- }
64
-
65
- /**
66
- * Plugin activation and update.
67
- *
68
- * ---------
69
- * REMEMBER!
70
- * ---------
71
- * If you are changing the value of a default field property,
72
- * then you need to unset that value in the current field
73
- * before merging in the new default values.
74
- *
75
- * For example, when changing a rating field property from
76
- * disabled (0) to enabled (1) in order for the property to
77
- * be displayed in the form editor.
78
- */
79
- public static function update() {
80
- if ( get_transient( 'wpmtst_update_in_progress' ) ) {
81
- return;
82
- }
83
-
84
- set_transient( 'wpmtst_update_in_progress', 1, 10 );
85
-
86
- /**
87
- * Add custom capablities.
88
- *
89
- * @since 2.27.1
90
- */
91
- self::add_caps();
92
-
93
- /**
94
- * Check DB version.
95
- */
96
- self::update_db_check();
97
-
98
- /**
99
- * Let's start updating.
100
- */
101
- $history = get_option( 'wpmtst_history', array() );
102
-
103
- /**
104
- * Options.
105
- */
106
- update_option( 'wpmtst_options', self::update_options() );
107
-
108
- /**
109
- * Custom fields.
110
- */
111
- update_option( 'wpmtst_fields', self::update_fields(), 'no' );
112
-
113
- /**
114
- * Forms.
115
- */
116
- update_option( 'wpmtst_base_forms', self::update_base_forms(), 'no' );
117
- update_option( 'wpmtst_custom_forms', self::update_custom_forms() );
118
- update_option( 'wpmtst_form_options', self::update_form_options() );
119
-
120
- /**
121
- * Compatibility options.
122
- *
123
- * @since 2.28.0
124
- */
125
- update_option( 'wpmtst_compat_options', self::update_compat_options() );
126
-
127
- /**
128
- * Overwrite default view options.
129
- *
130
- * @since 2.15.0
131
- */
132
- update_option( 'wpmtst_view_options', self::update_view_options() );
133
-
134
- /**
135
- * Overwrite default view settings.
136
- *
137
- * @since 2.15.0
138
- */
139
- update_option( 'wpmtst_view_default', self::update_default_view(), 'no' );
140
-
141
- /**
142
- * Update views.
143
- */
144
- self::update_views();
145
-
146
- /**
147
- * Convert nofollow
148
- */
149
- if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
150
- self::convert_nofollow();
151
- self::update_history_log( '2.23.0_convert_nofollow' );
152
- self::convert_noopener();
153
- self::convert_noreferrer();
154
- }
155
-
156
-
157
- /**
158
- * Legacy stuff.
159
- */
160
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
161
- // Upgrade from version 1.x
162
- delete_option( 'wpmtst_cycle' );
163
-
164
- // L10n context no longer used.
165
- delete_option( 'wpmtst_l10n_contexts' );
166
-
167
- // Remove older attempts at admin notices.
168
- delete_option( 'wpmtst_news_flag' );
169
-
170
- self::update_history_log( '2.28_new_update_process' );
171
- }
172
-
173
- /**
174
- * Fix add-ons.
175
- */
176
- self::update_addons();
177
-
178
- /**
179
- * Update the plugin version.
180
- */
181
- update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
182
-
183
- /**
184
- * Update log.
185
- */
186
- self::update_log();
187
-
188
- /**
189
- * Update admin notices.
190
- */
191
- self::update_admin_notices();
192
-
193
- delete_transient( 'wpmtst_update_in_progress' );
194
- }
195
-
196
- /**
197
- * Fix add-on file names.
198
- *
199
- * @since 2.30.9
200
- */
201
- public static function update_addons() {
202
- $addons = get_option( 'wpmtst_addons' );
203
- if ( $addons ) {
204
- foreach ( $addons as $addon => $data ) {
205
- if ( isset( $addons[ $addon ]['file'] ) ) {
206
- $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
207
- }
208
- }
209
- update_option( 'wpmtst_addons', $addons );
210
- }
211
- }
212
-
213
- /**
214
- * Update the log in options table.
215
- */
216
- public static function update_log() {
217
- $log = get_option( 'wpmtst_update_log', array() );
218
- $log[ current_time( 'mysql' ) ] = self::$new_log;
219
- update_option( 'wpmtst_update_log', $log );
220
- }
221
-
222
- public static function update_admin_notices() {
223
- wpmtst_add_admin_notice( 'feedback-notice', true );
224
- wpmtst_add_admin_notice( 'upsell-notice', true );
225
- }
226
-
227
- /**
228
- * Return admin role.
229
- *
230
- * @since 2.27.0
231
- *
232
- * @return bool|null|WP_Role
233
- */
234
- public static function get_admins() {
235
- return get_role( 'administrator' );
236
- }
237
-
238
- /**
239
- * Add custom capabilities.
240
- *
241
- * @since 2.27.1
242
- */
243
- public static function add_caps() {
244
- $admins = self::get_admins();
245
- if ( $admins ) {
246
- $admins->add_cap( 'strong_testimonials_views' );
247
- $admins->add_cap( 'strong_testimonials_fields' );
248
- $admins->add_cap( 'strong_testimonials_options' );
249
- $admins->add_cap( 'strong_testimonials_about' );
250
- }
251
- else {
252
- self::log( __FUNCTION__, 'failed' );
253
- }
254
- }
255
-
256
- /**
257
- * Remove custom capabilities.
258
- *
259
- * Was part of uninstall process but cannot be run from static class.
260
- *
261
- * @todo Move to Leave No Trace.
262
- *
263
- * @since 2.27.1
264
- */
265
- public static function remove_caps() {
266
- if ( $admins = self::get_admins() ) {
267
- $admins->remove_cap( 'strong_testimonials_views' );
268
- $admins->remove_cap( 'strong_testimonials_fields' );
269
- $admins->remove_cap( 'strong_testimonials_options' );
270
- $admins->remove_cap( 'strong_testimonials_about' );
271
- }
272
- }
273
-
274
- /**
275
- * Update tables.
276
- *
277
- * @since 1.21.0 Checking for new table version.
278
- */
279
- public static function update_db_check() {
280
- if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
281
- wpmtst_update_tables();
282
- self::log( __FUNCTION__, 'tables updated' );
283
- }
284
- }
285
-
286
- /**
287
- * Update history log.
288
- *
289
- * @param $event
290
- */
291
- public static function update_history_log( $event ) {
292
- $history = get_option( 'wpmtst_history', array() );
293
- $history[ $event ] = current_time( 'mysql' );
294
- update_option( 'wpmtst_history', $history );
295
- }
296
-
297
- /**
298
- * Update options.
299
- *
300
- * @return array
301
- */
302
- public static function update_options() {
303
- $options = get_option( 'wpmtst_options' );
304
- if ( ! $options ) {
305
- return Strong_Testimonials_Defaults::get_options();
306
- }
307
-
308
- /**
309
- * Remove version 1 options
310
- */
311
- if ( version_compare( '2.0', self::$old_version ) ) {
312
-
313
- if ( isset( $options['captcha'] ) ) {
314
- unset( $options['captcha'] );
315
- }
316
-
317
- if ( isset( $options['plugin_version'] ) ) {
318
- unset( $options['plugin_version'] );
319
- }
320
-
321
- if ( isset( $options['per_page'] ) ) {
322
- unset( $options['per_page'] );
323
- }
324
-
325
- if ( isset( $options['load_page_style'] ) ) {
326
- unset( $options['load_page_style'] );
327
- }
328
-
329
- if ( isset( $options['load_widget_style'] ) ) {
330
- unset( $options['load_widget_style'] );
331
- }
332
-
333
- if ( isset( $options['load_form_style'] ) ) {
334
- unset( $options['load_form_style'] );
335
- }
336
-
337
- if ( isset( $options['load_rtl_style'] ) ) {
338
- unset( $options['load_rtl_style'] );
339
- }
340
-
341
- if ( isset( $options['shortcode'] ) ) {
342
- unset( $options['shortcode'] );
343
- }
344
-
345
- if ( isset( $options['default_template'] ) ) {
346
- unset( $options['default_template'] );
347
- }
348
-
349
- if ( isset( $options['client_section'] ) ) {
350
- unset( $options['client_section'] );
351
- }
352
-
353
- }
354
-
355
- /**
356
- * Remove slideshow z-index (Cycle)
357
- *
358
- * @since 2.15.0
359
- */
360
- if ( isset( $options['slideshow_zindex'] ) ) {
361
- unset( $options['slideshow_zindex'] );
362
- }
363
-
364
- /**
365
- * Replace zero embed_width with empty value.
366
- *
367
- * @since 2.27.0
368
- */
369
- if ( 0 === $options['embed_width'] ) {
370
- $options['embed_width'] = '';
371
- }
372
-
373
- /**
374
- * Remove email logging.
375
- *
376
- * @since 2.28.4
377
- */
378
- if ( isset( $options['email_log_level'] ) ) {
379
- unset( $options['email_log_level'] );
380
- }
381
-
382
- // Merge in new options
383
- $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
384
-
385
- return $options;
386
- }
387
-
388
- /**
389
- * Default custom fields.
390
- *
391
- * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
392
- * Overwrite existing fields on every update to auto-repair.
393
- *
394
- * @return array
395
- */
396
- public static function update_fields() {
397
- return Strong_Testimonials_Defaults::get_fields();
398
- }
399
-
400
- /**
401
- * Base forms.
402
- *
403
- * @return array
404
- */
405
- public static function update_base_forms() {
406
- return Strong_Testimonials_Defaults::get_base_forms();
407
- }
408
-
409
- /**
410
- * Custom forms.
411
- *
412
- * @return array
413
- */
414
- public static function update_custom_forms() {
415
- $custom_forms = get_option( 'wpmtst_custom_forms' );
416
- if ( ! $custom_forms ) {
417
- return Strong_Testimonials_Defaults::get_custom_forms();
418
- }
419
-
420
- foreach ( $custom_forms as $form_id => $form_properties ) {
421
- foreach ( $form_properties['fields'] as $key => $form_field ) {
422
-
423
- /*
424
- * Convert categories to category-selector.
425
- * @since 2.17.0
426
- */
427
- if ( 'categories' == $form_field['input_type'] ) {
428
- $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
429
- }
430
-
431
- /*
432
- * Unset `show_default_options` for rating field. Going from 0 to 1.
433
- * @since 2.21.0
434
- */
435
- if ( 'rating' == $form_field['input_type'] ) {
436
- unset( $form_field['show_default_options'] );
437
- }
438
-
439
- /*
440
- * Add `show_required_option` to shortcode field. Initial value is false.
441
- * @since 2.22.0
442
- */
443
- if ( 'shortcode' == $form_field['input_type'] ) {
444
- $form_field['show_required_option'] = false;
445
- }
446
-
447
- /*
448
- * Add `show_default_options` to checkbox field.
449
- *
450
- * @since 2.27.0
451
- */
452
- if ( 'checkbox' == $form_field['input_type'] ) {
453
- $form_field['show_default_options'] = 1;
454
- }
455
-
456
- /*
457
- * Merge in new default.
458
- * Custom fields are in display order (not associative) so we must find them by `input_type`.
459
- * @since 2.21.0 Using default fields instead of default form as source
460
- */
461
- $new_default = array();
462
- $fields = get_option( 'wpmtst_fields', array() );
463
-
464
- foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
465
- foreach ( $field_type_group as $field_type_key => $field_type_field ) {
466
- if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
467
- $new_default = $field_type_field;
468
- break;
469
- }
470
- }
471
- }
472
-
473
- if ( $new_default ) {
474
- $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
475
- }
476
-
477
- }
478
- }
479
-
480
- return $custom_forms;
481
- }
482
-
483
- /**
484
- * Form options.
485
- *
486
- * @return array
487
- */
488
- public static function update_form_options() {
489
- $form_options = get_option( 'wpmtst_form_options' );
490
- if ( ! $form_options ) {
491
- return Strong_Testimonials_Defaults::get_form_options();
492
- }
493
-
494
- $options = get_option( 'wpmtst_options', array() );
495
- $history = get_option( 'wpmtst_history', array() );
496
-
497
- /**
498
- * Move existing options.
499
- */
500
- if ( isset( $options['admin_notify'] ) ) {
501
- $form_options['admin_notify'] = $options['admin_notify'];
502
- unset( $options['admin_notify'] );
503
-
504
- $form_options['admin_email'] = $options['admin_email'];
505
- unset( $options['admin_email'] );
506
-
507
- update_option( 'wpmtst_options', $options );
508
- }
509
-
510
- /**
511
- * Update single email recipient to multiple.
512
- *
513
- * @since 1.18
514
- */
515
- if ( ! isset( $form_options['recipients'] ) ) {
516
- $form_options['recipients'] = array(
517
- array(
518
- 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
519
- 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
520
- 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
521
- 'primary' => 1, // cannot be deleted
522
- ),
523
- );
524
-
525
- unset( $form_options['admin_name'] );
526
- unset( $form_options['admin_site_email'] );
527
- unset( $form_options['admin_email'] );
528
- }
529
-
530
- /**
531
- * Add default required-notice setting
532
- *
533
- * @since 2.24.1
534
- */
535
- if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
536
- $form_options['messages']['required-field']['enabled'] = 1;
537
- }
538
-
539
- /**
540
- * Delete form options
541
- *
542
- * @since 2.38
543
- */
544
- unset( $form_options['captcha'] );
545
- unset( $form_options['messages']['captcha'] );
546
-
547
-
548
- /**
549
- * Merge in new options.
550
- */
551
- $defaults = Strong_Testimonials_Defaults::get_form_options();
552
-
553
- $form_options = array_merge( $defaults, $form_options );
554
-
555
- // Merge nested arrays individually. Don't use array_merge_recursive.
556
-
557
- $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
558
- foreach ( $defaults['messages'] as $key => $message ) {
559
- if( isset( $form_options['messages'][ $key ] ) ) {
560
- $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
561
- }
562
- }
563
-
564
- return $form_options;
565
- }
566
-
567
- /**
568
- * Compatibility options.
569
- *
570
- * @since 2.28.0
571
- *
572
- * @return array
573
- */
574
- public static function update_compat_options() {
575
- $options = get_option( 'wpmtst_compat_options' );
576
- if ( ! $options ) {
577
- return Strong_Testimonials_Defaults::get_compat_options();
578
- }
579
-
580
- // Merge in new options.
581
- $defaults = Strong_Testimonials_Defaults::get_compat_options();
582
-
583
- // Merge nested arrays individually. Don't use array_merge_recursive.
584
-
585
- if ( isset( $options['controller'] ) ) {
586
- $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
587
- } else {
588
- $options['ajax'] = $defaults['ajax'];
589
- }
590
-
591
- /**
592
- * Controller
593
- *
594
- * @since 2.31.0
595
- */
596
- if ( isset( $options['controller'] ) ) {
597
- $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
598
- } else {
599
- $options['controller'] = $defaults['controller'];
600
- }
601
-
602
- /**
603
- * Lazy load
604
- *
605
- * @since 2.31.0
606
- */
607
- if ( isset( $options['lazyload'] ) ) {
608
- // first level only: enabled, classes (array)
609
- $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
610
- } else {
611
- $options['lazyload'] = $defaults['lazyload'];
612
- }
613
-
614
- $options = array_merge( $defaults, $options );
615
-
616
- return $options;
617
- }
618
-
619
- /**
620
- * View options.
621
- *
622
- * @return array
623
- */
624
- public static function update_view_options() {
625
- return Strong_Testimonials_Defaults::get_view_options();
626
- }
627
-
628
- /**
629
- * Default view.
630
- *
631
- * @return array
632
- */
633
- public static function update_default_view() {
634
- return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
635
- }
636
-
637
- /**
638
- * Update views.
639
- *
640
- * @uses wpmtst_save_view
641
- */
642
- public static function update_views() {
643
- $views = wpmtst_get_views();
644
-
645
- if ( ! $views ) {
646
- return;
647
- }
648
-
649
- $default_view = wpmtst_get_view_default();
650
- $history = get_option( 'wpmtst_history', array() );
651
-
652
- foreach ( $views as $key => $view ) {
653
-
654
- $view_data = unserialize( $view['value'] );
655
- if ( ! is_array( $view_data ) ) {
656
- self::log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
657
- continue;
658
- }
659
-
660
- /**
661
- * For version 2.28.
662
- */
663
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
664
- /**
665
- * Compat mode no longer needed.
666
- *
667
- * @since 2.22.0
668
- */
669
- unset( $view_data['compat'] );
670
-
671
- $view_data = self::convert_template_name( $view_data );
672
- $view_data = self::convert_background_color( $view_data );
673
- $view_data = self::convert_form_ajax( $view_data );
674
- $view_data = self::convert_layout( $view_data );
675
- $view_data = self::convert_word_count( $view_data );
676
- $view_data = self::convert_excerpt_length( $view_data );
677
- $view_data = self::convert_more_text( $view_data );
678
- $view_data = self::convert_modern_title( $view_data );
679
- $view_data = self::convert_slideshow( $view_data );
680
- $view_data = self::convert_title_link( $view_data );
681
- $view_data = self::convert_pagination_type( $view_data );
682
- }
683
-
684
- /**
685
- * For version 2.30.
686
- */
687
- if ( ! isset( $history['2.30_new_template_structure'] ) ) {
688
- $view_data = self::convert_template_structure( $view_data );
689
- $view_data = self::convert_count( $view_data );
690
- if ( isset( $view_data['background']['example-font-color'] ) ) {
691
- unset( $view_data['background']['example-font-color'] );
692
- }
693
-
694
- self::update_history_log( '2.30_new_template_structure' );
695
- }
696
-
697
- /**
698
- * Add carousel breakpoints.
699
- *
700
- * @since 2.32.2
701
- */
702
- if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
703
- $view['data'] = self::add_carousel_breakpoints( $view_data );
704
- self::update_history_log( '2.32.2_carousel_breakpoints' );
705
- }
706
-
707
- /**
708
- * Merge in new default values.
709
- * Merge nested arrays individually. Don't use array_merge_recursive.
710
- */
711
- $view['data'] = array_merge( $default_view, $view_data );
712
-
713
- /**
714
- * Background defaults.
715
- */
716
- $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
717
-
718
- /**
719
- * Pagination defaults.
720
- * Attempt to repair bug from 2.28.2
721
- *
722
- * @since 2.28.3
723
- */
724
- if ( isset( $view_data['pagination_settings'] ) ) {
725
- $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
726
-
727
- if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
728
- $view['data']['pagination_settings']['end_size'] = 1;
729
- }
730
- if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
731
- $view['data']['pagination_settings']['mid_size'] = 2;
732
- }
733
- if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
734
- $view['data']['pagination_settings']['per_page'] = 5;
735
- }
736
- } else {
737
- $view['data']['pagination_settings'] = $default_view['pagination_settings'];
738
- }
739
-
740
- /**
741
- * Slideshow defaults.
742
- */
743
- if ( isset( $view_data['slideshow_settings'] ) ) {
744
- $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
745
- } else {
746
- $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
747
- }
748
- ksort( $view['data']['slideshow_settings'] );
749
-
750
- /**
751
- * Save it.
752
- */
753
- wpmtst_save_view( $view );
754
-
755
- } // foreach $view
756
- }
757
-
758
- /**
759
- * Add carousel breakpoints.
760
- *
761
- * @param array $view_data
762
- * @since 2.32.2
763
- *
764
- * @return array
765
- */
766
- public static function add_carousel_breakpoints( $view_data ) {
767
- if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
768
- return $view_data;
769
- }
770
-
771
- if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
772
-
773
- // Convert to single
774
- $view_data['slideshow_settings']['type'] = 'show_single';
775
-
776
- $view_data['slideshow_settings']['show_single'] = array(
777
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
778
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
779
- 'margin' => 1,
780
- );
781
-
782
- } else {
783
-
784
- // Convert to multiple
785
- $view_data['slideshow_settings']['type'] = 'show_multiple';
786
-
787
- $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
788
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
789
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
790
- 'margin' => 1,
791
- );
792
-
793
- }
794
-
795
- // Remove old values
796
- unset(
797
- $view_data['slideshow_settings']['max_slides'],
798
- $view_data['slideshow_settings']['move_slides'],
799
- $view_data['slideshow_settings']['margin']
800
- );
801
-
802
- return $view_data;
803
- }
804
-
805
- /**
806
- * Convert template naming structure.
807
- *
808
- * @since 2.30.0
809
- *
810
- * @param $view_data
811
- *
812
- * @return array
813
- */
814
- public static function convert_template_structure( $view_data ) {
815
- /*
816
- Array
817
- (
818
- [0] => default:content
819
- [1] => default-dark:form
820
- [2] => default-dark:content
821
- [3] => default:form
822
- [4] => image-right:content
823
- [5] => no-quotes:content
824
- [6] => large:widget
825
- [7] => modern:content
826
- [8] => simple:content
827
- [9] => simple:form
828
- [10] => unstyled:content
829
- [11] => unstyled:form
830
- [12] => default:widget
831
- [13] => image-right:widget
832
- )
833
- */
834
- switch ( $view_data['template'] ) {
835
- case 'default:content' :
836
- $view_data['template'] = 'default';
837
- break;
838
- case 'default-dark:form' :
839
- $view_data['template'] = 'default-form';
840
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
841
- break;
842
- case 'default-dark:content' :
843
- $view_data['template'] = 'default';
844
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
845
- break;
846
- case 'default:form' :
847
- $view_data['template'] = 'default-form';
848
- break;
849
- case 'image-right:content' :
850
- $view_data['template'] = 'default';
851
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
852
- break;
853
- case 'no-quotes:content' :
854
- $view_data['template'] = 'default';
855
- $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
856
- break;
857
- case 'large:widget' :
858
- $view_data['template'] = 'bold';
859
- break;
860
- case 'modern:content' :
861
- $view_data['template'] = 'modern';
862
- break;
863
- case 'simple:content' :
864
- $view_data['template'] = 'simple';
865
- break;
866
- case 'simple:form' :
867
- $view_data['template'] = 'simple-form';
868
- break;
869
- case 'unstyled:content' :
870
- $view_data['template'] = 'unstyled';
871
- break;
872
- case 'unstyled:form' :
873
- $view_data['template'] = 'unstyled-form';
874
- break;
875
- case 'default:widget' :
876
- $view_data['template'] = 'small-widget';
877
- break;
878
- case 'image-right:widget' :
879
- $view_data['template'] = 'small-widget';
880
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
881
- break;
882
- default:
883
- // Keep existing value; it's probably a custom template.
884
- }
885
-
886
- return $view_data;
887
- }
888
-
889
- /**
890
- * Update template naming structure.
891
- *
892
- * @param $view_data
893
- *
894
- * @return array
895
- */
896
- public static function convert_template_name( $view_data ) {
897
- // Change default template from empty to 'default:{type}'
898
- if ( ! $view_data['template'] ) {
899
- if ( 'form' == $view_data['mode'] ) {
900
- $type = 'form';
901
- }
902
- else {
903
- $type = 'content';
904
- }
905
-
906
- $view_data['template'] = "default:$type";
907
- }
908
- else {
909
- // Convert name; e.g. 'simple/testimonials.php'
910
- if ( 'widget/testimonials.php' == $view_data['template'] ) {
911
- $view_data['template'] = 'default:widget';
912
- }
913
- else {
914
- $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
915
- $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
916
- $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
917
- }
918
- }
919
-
920
- return $view_data;
921
- }
922
-
923
- /**
924
- * Convert length (characters).
925
- *
926
- * @since 2.10.0 word_count (deprecated)
927
- * @since 2.11.4 excerpt_length
928
- *
929
- * @param $view_data
930
- *
931
- * @return array
932
- */
933
- public static function convert_excerpt_length( $view_data ) {
934
- if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
935
- $default_view = Strong_Testimonials_Defaults::get_default_view();
936
- $average_word_length = self::get_average_word_length();
937
-
938
- if ( isset( $view_data['length'] ) && $view_data['length'] ) {
939
- $word_count = round( $view_data['length'] / $average_word_length );
940
- $word_count = $word_count < 5 ? 5 : $word_count;
941
- $word_count = $word_count > 300 ? 300 : $word_count;
942
- $view_data['excerpt_length'] = $word_count;
943
- }
944
- else {
945
- $view_data['excerpt_length'] = $default_view['excerpt_length'];
946
- }
947
-
948
- unset( $view_data['length'] );
949
- }
950
-
951
- return $view_data;
952
- }
953
-
954
- /**
955
- * Convert more_text to post or page.
956
- *
957
- * @since 2.10.0
958
- *
959
- * @param $view_data
960
- *
961
- * @return array
962
- */
963
- public static function convert_more_text( $view_data ) {
964
- if ( isset( $view_data['more_text'] ) ) {
965
- if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
966
- // convert more_page to toggle and move page id to more_page_id
967
- $view_data['more_page_id'] = $view_data['more_page'];
968
- $view_data['more_page'] = 1;
969
- $view_data['more_page_text'] = $view_data['more_text'];
970
- }
971
- elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
972
- $view_data['more_post_text'] = $view_data['more_text'];
973
- }
974
- unset( $view_data['more_text'] );
975
- }
976
-
977
- return $view_data;
978
- }
979
-
980
- /**
981
- * Convert slideshow settings.
982
- *
983
- * @since 2.15.0
984
- *
985
- * @param $view_data
986
- *
987
- * @return array
988
- */
989
- public static function convert_slideshow( $view_data ) {
990
- if ( isset( $view_data['slideshow_settings'] ) ) {
991
- return $view_data;
992
- }
993
-
994
- if ( 'scrollHorz' == $view_data['effect'] ) {
995
- $view_data['effect'] = 'horizontal';
996
- }
997
-
998
- $view_data['slideshow_settings'] = array(
999
- 'effect' => $view_data['effect'],
1000
- 'speed' => $view_data['effect_for'],
1001
- 'pause' => $view_data['show_for'],
1002
- 'auto_hover' => ! $view_data['no_pause'],
1003
- 'adapt_height' => false,
1004
- 'adapt_height_speed' => .5,
1005
- 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1006
- );
1007
-
1008
- unset(
1009
- $view_data['effect'],
1010
- $view_data['effect_for'],
1011
- $view_data['no_pause'],
1012
- $view_data['show_for'],
1013
- $view_data['stretch']
1014
- );
1015
-
1016
- if ( isset( $view_data['slideshow_nav'] ) ) {
1017
- switch ( $view_data['slideshow_nav'] ) {
1018
- case 'simple':
1019
- $view_data['slideshow_settings']['controls_type'] = 'none';
1020
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1021
- $view_data['slideshow_settings']['pager_type'] = 'full';
1022
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1023
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1024
- break;
1025
- case 'buttons1':
1026
- $view_data['slideshow_settings']['controls_type'] = 'sides';
1027
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1028
- $view_data['slideshow_settings']['pager_type'] = 'none';
1029
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1030
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1031
- break;
1032
- case 'buttons2':
1033
- $view_data['slideshow_settings']['controls_type'] = 'simple';
1034
- $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1035
- $view_data['slideshow_settings']['pager_type'] = 'none';
1036
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1037
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1038
- break;
1039
- case 'indexed':
1040
- $view_data['slideshow_settings']['controls_type'] = 'none';
1041
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1042
- $view_data['slideshow_settings']['pager_type'] = 'full';
1043
- $view_data['slideshow_settings']['pager_style'] = 'text';
1044
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1045
- break;
1046
- default:
1047
- // none
1048
- }
1049
- unset( $view_data['slideshow_nav'] );
1050
- }
1051
-
1052
- return $view_data;
1053
- }
1054
-
1055
- /**
1056
- * Convert 'all' to 'count'.
1057
- *
1058
- * @param $view_data
1059
- *
1060
- * @return array
1061
- */
1062
- public static function convert_count( $view_data ) {
1063
- if ( isset( $view_data['all'] ) ) {
1064
- if ( $view_data['all'] ) {
1065
- $view_data['count'] = -1;
1066
- }
1067
- unset( $view_data['all'] );
1068
- }
1069
-
1070
- return $view_data;
1071
- }
1072
-
1073
- /**
1074
- * Convert background color.
1075
- *
1076
- * @param $view_data
1077
- *
1078
- * @return array
1079
- */
1080
- public static function convert_background_color( $view_data ) {
1081
- if ( ! is_array( $view_data['background'] ) ) {
1082
- $view_data['background'] = array(
1083
- 'color' => $view_data['background'],
1084
- 'type' => 'single',
1085
- );
1086
- }
1087
-
1088
- return $view_data;
1089
- }
1090
-
1091
- /**
1092
- * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1093
- *
1094
- * @param $view_data
1095
- *
1096
- * @return array
1097
- */
1098
- public static function convert_form_ajax( $view_data ) {
1099
- if ( isset( $view_data['form-ajax'] ) ) {
1100
- $view_data['form_ajax'] = $view_data['form-ajax'];
1101
- unset( $view_data['form-ajax'] );
1102
- }
1103
-
1104
- return $view_data;
1105
- }
1106
-
1107
- /**
1108
- * Prevent incompatible layouts.
1109
- *
1110
- * @param $view_data
1111
- *
1112
- * @return array
1113
- */
1114
- public static function convert_layout( $view_data ) {
1115
- if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1116
- if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1117
- $view_data['layout'] = '';
1118
- }
1119
- }
1120
-
1121
- return $view_data;
1122
- }
1123
-
1124
- /**
1125
- * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1126
- *
1127
- * @since 2.11.4
1128
- *
1129
- * @param $view_data
1130
- *
1131
- * @return array
1132
- */
1133
- public static function convert_word_count( $view_data ) {
1134
- if ( isset( $view_data['word_count'] ) ) {
1135
- $view_data['excerpt_length'] = $view_data['word_count'];
1136
- unset( $view_data['word_count'] );
1137
- }
1138
-
1139
- return $view_data;
1140
- }
1141
-
1142
- /**
1143
- * Disable title on Modern template because new version of template has the title.
1144
- * Only if updating from version earlier than 2.12.4.
1145
- *
1146
- * @param $view_data
1147
- *
1148
- * @return array
1149
- */
1150
- public static function convert_modern_title( $view_data ) {
1151
- if ( 'modern:content' == $view_data['template'] ) {
1152
- if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1153
- $view_data['title'] = 0;
1154
- self::update_history_log( '2.12.4_convert_modern_template' );
1155
- }
1156
- }
1157
-
1158
- return $view_data;
1159
- }
1160
-
1161
- /**
1162
- * Title link
1163
- *
1164
- * @since 2.26.0
1165
- *
1166
- * @param $view_data
1167
- *
1168
- * @return array
1169
- */
1170
- public static function convert_title_link( $view_data ) {
1171
- if ( ! isset( $view_data['title_link'] ) ) {
1172
- $view_data['title_link'] = 'none';
1173
- }
1174
-
1175
- return $view_data;
1176
- }
1177
-
1178
-
1179
- /**
1180
- * Convert nofollow from (on|off) to (1|0).
1181
- *
1182
- * @since 2.23.0
1183
- */
1184
- public static function convert_nofollow() {
1185
- $args = array(
1186
- 'posts_per_page' => - 1,
1187
- 'post_type' => 'wpm-testimonial',
1188
- 'post_status' => 'publish',
1189
- 'suppress_filters' => true,
1190
- );
1191
- $posts = get_posts( $args );
1192
- if ( ! $posts ) {
1193
- return;
1194
- }
1195
-
1196
- /**
1197
- * Remove the equivocation. There is no false.
1198
- */
1199
- foreach ( $posts as $post ) {
1200
- $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1201
- $new_value = 'default';
1202
-
1203
- if ( 'on' == $nofollow ) {
1204
- $new_value = 'yes';
1205
- }
1206
- elseif ( 1 === $nofollow ) {
1207
- $new_value = 'yes';
1208
- }
1209
- elseif ( 'off' == $nofollow ) {
1210
- $new_value = 'no';
1211
- }
1212
- elseif ( 0 === $nofollow ) {
1213
- $new_value = 'no';
1214
- }
1215
- elseif ( is_bool( $nofollow ) ) {
1216
- if ( $nofollow ) {
1217
- $new_value = 'yes';
1218
- }
1219
- else {
1220
- $new_value = 'default';
1221
- }
1222
- }
1223
-
1224
- update_post_meta( $post->ID, 'nofollow', $new_value );
1225
- }
1226
- }
1227
-
1228
- /**
1229
- * Convert noopener from (on|off) to (1|0).
1230
- *
1231
- * @since 2.41.0
1232
- */
1233
- public static function convert_noopener() {
1234
- $args = array(
1235
- 'posts_per_page' => - 1,
1236
- 'post_type' => 'wpm-testimonial',
1237
- 'post_status' => 'publish',
1238
- 'suppress_filters' => true,
1239
- );
1240
- $posts = get_posts( $args );
1241
- if ( ! $posts ) {
1242
- return;
1243
- }
1244
-
1245
- /**
1246
- * Remove the equivocation. There is no false.
1247
- */
1248
- foreach ( $posts as $post ) {
1249
- $noopener = get_post_meta( $post->ID, 'noopener', true );
1250
- $new_value = 'default';
1251
-
1252
- if ( 'on' == $noopener ) {
1253
- $new_value = 'yes';
1254
- }
1255
- elseif ( 1 === $noopener ) {
1256
- $new_value = 'yes';
1257
- }
1258
- elseif ( 'off' == $noopener ) {
1259
- $new_value = 'no';
1260
- }
1261
- elseif ( 0 === $noopener ) {
1262
- $new_value = 'no';
1263
- }
1264
- elseif ( is_bool( $noopener ) ) {
1265
- if ( $noopener ) {
1266
- $new_value = 'yes';
1267
- }
1268
- else {
1269
- $new_value = 'default';
1270
- }
1271
- }
1272
-
1273
- update_post_meta( $post->ID, 'noopener', $new_value );
1274
- }
1275
- }
1276
-
1277
- /**
1278
- * Convert noreferrer from (on|off) to (1|0).
1279
- *
1280
- * @since 2.41.0
1281
- */
1282
- public static function convert_noreferrer() {
1283
- $args = array(
1284
- 'posts_per_page' => - 1,
1285
- 'post_type' => 'wpm-testimonial',
1286
- 'post_status' => 'publish',
1287
- 'suppress_filters' => true,
1288
- );
1289
- $posts = get_posts( $args );
1290
- if ( ! $posts ) {
1291
- return;
1292
- }
1293
-
1294
- /**
1295
- * Remove the equivocation. There is no false.
1296
- */
1297
- foreach ( $posts as $post ) {
1298
- $noreferrer = get_post_meta( $post->ID, 'noreferrer', true );
1299
- $new_value = 'default';
1300
-
1301
- if ( 'on' == $noreferrer ) {
1302
- $new_value = 'yes';
1303
- }
1304
- elseif ( 1 === $noreferrer ) {
1305
- $new_value = 'yes';
1306
- }
1307
- elseif ( 'off' == $noreferrer ) {
1308
- $new_value = 'no';
1309
- }
1310
- elseif ( 0 === $noreferrer ) {
1311
- $new_value = 'no';
1312
- }
1313
- elseif ( is_bool( $noreferrer ) ) {
1314
- if ( $noreferrer ) {
1315
- $new_value = 'yes';
1316
- }
1317
- else {
1318
- $new_value = 'default';
1319
- }
1320
- }
1321
-
1322
- update_post_meta( $post->ID, 'noreferrer', $new_value );
1323
- }
1324
- }
1325
-
1326
- /**
1327
- * Convert pagination settings.
1328
- *
1329
- * @since 2.28.0
1330
- *
1331
- * @param $view_data
1332
- *
1333
- * @return mixed
1334
- */
1335
- public static function convert_pagination_type( $view_data ) {
1336
- if ( isset( $view_data['pagination_type'] ) ) {
1337
- $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1338
- unset( $view_data['pagination_type'] );
1339
- }
1340
-
1341
- if ( isset( $view_data['nav'] ) ) {
1342
- $view_data['pagination_settings']['nav'] = $view_data['nav'];
1343
- unset( $view_data['nav'] );
1344
- }
1345
-
1346
- if ( isset( $view_data['per_page'] ) ) {
1347
- $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1348
- unset( $view_data['per_page'] );
1349
- }
1350
-
1351
- return $view_data;
1352
- }
1353
-
1354
- /**
1355
- * Convert length to excerpt_length.
1356
- *
1357
- * @since 2.10.0
1358
- */
1359
- public static function get_average_word_length() {
1360
- $args = array(
1361
- 'posts_per_page' => - 1,
1362
- 'post_type' => 'wpm-testimonial',
1363
- 'post_status' => 'publish',
1364
- 'suppress_filters' => true,
1365
- );
1366
- $posts = get_posts( $args );
1367
- if ( ! $posts ) {
1368
- return 5;
1369
- }
1370
-
1371
- $allwords = array();
1372
-
1373
- foreach ( $posts as $post ) {
1374
- $words = explode( ' ', $post->post_content );
1375
- if ( count( $words ) > 5 ) {
1376
- $allwords = $allwords + $words;
1377
- }
1378
- }
1379
-
1380
- $wordstring = implode( '', $allwords );
1381
-
1382
- return round( strlen( $wordstring ) / count( $allwords ) );
1383
- }
1384
-
1385
- }
1386
-
1387
- new Strong_Testimonials_Updater();
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Updater
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Updater {
9
+
10
+ /**
11
+ * The version before updating.
12
+ *
13
+ * @var string
14
+ */
15
+ private static $old_version;
16
+
17
+ /**
18
+ * Log steps during update process.
19
+ *
20
+ * @var array
21
+ */
22
+ private static $new_log;
23
+
24
+ /**
25
+ * Strong_Testimonials_Updater constructor.
26
+ */
27
+ public function __construct() {
28
+
29
+ }
30
+
31
+ /**
32
+ * Add a log entry.
33
+ *
34
+ * @param $name
35
+ * @param string $entry
36
+ * @param string $var
37
+ */
38
+ private static function log( $name, $entry = '', $var = '' ) {
39
+ if ( $name ) {
40
+ $x = $name;
41
+ if ( $entry ) {
42
+ $x .= ' : ' . $entry;
43
+ if ( $var ) {
44
+ $x .= ' = ';
45
+ if ( is_array( $var ) || is_object( $var ) ) {
46
+ // log the text
47
+ self::$new_log[] = $x;
48
+ // then log the variable
49
+ self::$new_log[] = $var;
50
+ }
51
+ else {
52
+ self::$new_log[] = $x . $var;
53
+ }
54
+ }
55
+ else {
56
+ self::$new_log[] = $x;
57
+ }
58
+ }
59
+ else {
60
+ self::$new_log[] = $x;
61
+ }
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Plugin activation and update.
67
+ *
68
+ * ---------
69
+ * REMEMBER!
70
+ * ---------
71
+ * If you are changing the value of a default field property,
72
+ * then you need to unset that value in the current field
73
+ * before merging in the new default values.
74
+ *
75
+ * For example, when changing a rating field property from
76
+ * disabled (0) to enabled (1) in order for the property to
77
+ * be displayed in the form editor.
78
+ */
79
+ public static function update() {
80
+ if ( get_transient( 'wpmtst_update_in_progress' ) ) {
81
+ return;
82
+ }
83
+
84
+ set_transient( 'wpmtst_update_in_progress', 1, 10 );
85
+
86
+ /**
87
+ * Add custom capablities.
88
+ *
89
+ * @since 2.27.1
90
+ */
91
+ self::add_caps();
92
+
93
+ /**
94
+ * Check DB version.
95
+ */
96
+ self::update_db_check();
97
+
98
+ /**
99
+ * Let's start updating.
100
+ */
101
+ $history = get_option( 'wpmtst_history', array() );
102
+
103
+ /**
104
+ * Options.
105
+ */
106
+ update_option( 'wpmtst_options', self::update_options() );
107
+
108
+ /**
109
+ * Custom fields.
110
+ */
111
+ update_option( 'wpmtst_fields', self::update_fields(), 'no' );
112
+
113
+ /**
114
+ * Forms.
115
+ */
116
+ update_option( 'wpmtst_base_forms', self::update_base_forms(), 'no' );
117
+ update_option( 'wpmtst_custom_forms', self::update_custom_forms() );
118
+ update_option( 'wpmtst_form_options', self::update_form_options() );
119
+
120
+ /**
121
+ * Compatibility options.
122
+ *
123
+ * @since 2.28.0
124
+ */
125
+ update_option( 'wpmtst_compat_options', self::update_compat_options() );
126
+
127
+ /**
128
+ * Overwrite default view options.
129
+ *
130
+ * @since 2.15.0
131
+ */
132
+ update_option( 'wpmtst_view_options', self::update_view_options() );
133
+
134
+ /**
135
+ * Overwrite default view settings.
136
+ *
137
+ * @since 2.15.0
138
+ */
139
+ update_option( 'wpmtst_view_default', self::update_default_view(), 'no' );
140
+
141
+ /**
142
+ * Update views.
143
+ */
144
+ self::update_views();
145
+
146
+ /**
147
+ * Convert nofollow
148
+ */
149
+ if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
150
+ self::convert_nofollow();
151
+ self::update_history_log( '2.23.0_convert_nofollow' );
152
+ self::convert_noopener();
153
+ self::convert_noreferrer();
154
+ }
155
+
156
+
157
+ /**
158
+ * Legacy stuff.
159
+ */
160
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
161
+ // Upgrade from version 1.x
162
+ delete_option( 'wpmtst_cycle' );
163
+
164
+ // L10n context no longer used.
165
+ delete_option( 'wpmtst_l10n_contexts' );
166
+
167
+ // Remove older attempts at admin notices.
168
+ delete_option( 'wpmtst_news_flag' );
169
+
170
+ self::update_history_log( '2.28_new_update_process' );
171
+ }
172
+
173
+ /**
174
+ * Fix add-ons.
175
+ */
176
+ self::update_addons();
177
+
178
+ /**
179
+ * Update the plugin version.
180
+ */
181
+ update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
182
+
183
+ /**
184
+ * Update log.
185
+ */
186
+ self::update_log();
187
+
188
+ /**
189
+ * Update admin notices.
190
+ */
191
+ self::update_admin_notices();
192
+
193
+ delete_transient( 'wpmtst_update_in_progress' );
194
+ }
195
+
196
+ /**
197
+ * Fix add-on file names.
198
+ *
199
+ * @since 2.30.9
200
+ */
201
+ public static function update_addons() {
202
+ $addons = get_option( 'wpmtst_addons' );
203
+ if ( $addons ) {
204
+ foreach ( $addons as $addon => $data ) {
205
+ if ( isset( $addons[ $addon ]['file'] ) ) {
206
+ $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
207
+ }
208
+ }
209
+ update_option( 'wpmtst_addons', $addons );
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Update the log in options table.
215
+ */
216
+ public static function update_log() {
217
+ $log = get_option( 'wpmtst_update_log', array() );
218
+ $log[ current_time( 'mysql' ) ] = self::$new_log;
219
+ update_option( 'wpmtst_update_log', $log );
220
+ }
221
+
222
+ public static function update_admin_notices() {
223
+ wpmtst_add_admin_notice( 'feedback-notice', true );
224
+ wpmtst_add_admin_notice( 'upsell-notice', true );
225
+ }
226
+
227
+ /**
228
+ * Return admin role.
229
+ *
230
+ * @since 2.27.0
231
+ *
232
+ * @return bool|null|WP_Role
233
+ */
234
+ public static function get_admins() {
235
+ return get_role( 'administrator' );
236
+ }
237
+
238
+ /**
239
+ * Add custom capabilities.
240
+ *
241
+ * @since 2.27.1
242
+ */
243
+ public static function add_caps() {
244
+ $admins = self::get_admins();
245
+ if ( $admins ) {
246
+ $admins->add_cap( 'strong_testimonials_views' );
247
+ $admins->add_cap( 'strong_testimonials_fields' );
248
+ $admins->add_cap( 'strong_testimonials_options' );
249
+ $admins->add_cap( 'strong_testimonials_about' );
250
+ }
251
+ else {
252
+ self::log( __FUNCTION__, 'failed' );
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Remove custom capabilities.
258
+ *
259
+ * Was part of uninstall process but cannot be run from static class.
260
+ *
261
+ * @todo Move to Leave No Trace.
262
+ *
263
+ * @since 2.27.1
264
+ */
265
+ public static function remove_caps() {
266
+ if ( $admins = self::get_admins() ) {
267
+ $admins->remove_cap( 'strong_testimonials_views' );
268
+ $admins->remove_cap( 'strong_testimonials_fields' );
269
+ $admins->remove_cap( 'strong_testimonials_options' );
270
+ $admins->remove_cap( 'strong_testimonials_about' );
271
+ }
272
+ }
273
+
274
+ /**
275
+ * Update tables.
276
+ *
277
+ * @since 1.21.0 Checking for new table version.
278
+ */
279
+ public static function update_db_check() {
280
+ if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
281
+ wpmtst_update_tables();
282
+ self::log( __FUNCTION__, 'tables updated' );
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Update history log.
288
+ *
289
+ * @param $event
290
+ */
291
+ public static function update_history_log( $event ) {
292
+ $history = get_option( 'wpmtst_history', array() );
293
+ $history[ $event ] = current_time( 'mysql' );
294
+ update_option( 'wpmtst_history', $history );
295
+ }
296
+
297
+ /**
298
+ * Update options.
299
+ *
300
+ * @return array
301
+ */
302
+ public static function update_options() {
303
+ $options = get_option( 'wpmtst_options' );
304
+ if ( ! $options ) {
305
+ return Strong_Testimonials_Defaults::get_options();
306
+ }
307
+
308
+ /**
309
+ * Remove version 1 options
310
+ */
311
+ if ( version_compare( '2.0', self::$old_version ) ) {
312
+
313
+ if ( isset( $options['captcha'] ) ) {
314
+ unset( $options['captcha'] );
315
+ }
316
+
317
+ if ( isset( $options['plugin_version'] ) ) {
318
+ unset( $options['plugin_version'] );
319
+ }
320
+
321
+ if ( isset( $options['per_page'] ) ) {
322
+ unset( $options['per_page'] );
323
+ }
324
+
325
+ if ( isset( $options['load_page_style'] ) ) {
326
+ unset( $options['load_page_style'] );
327
+ }
328
+
329
+ if ( isset( $options['load_widget_style'] ) ) {
330
+ unset( $options['load_widget_style'] );
331
+ }
332
+
333
+ if ( isset( $options['load_form_style'] ) ) {
334
+ unset( $options['load_form_style'] );
335
+ }
336
+
337
+ if ( isset( $options['load_rtl_style'] ) ) {
338
+ unset( $options['load_rtl_style'] );
339
+ }
340
+
341
+ if ( isset( $options['shortcode'] ) ) {
342
+ unset( $options['shortcode'] );
343
+ }
344
+
345
+ if ( isset( $options['default_template'] ) ) {
346
+ unset( $options['default_template'] );
347
+ }
348
+
349
+ if ( isset( $options['client_section'] ) ) {
350
+ unset( $options['client_section'] );
351
+ }
352
+
353
+ }
354
+
355
+ /**
356
+ * Remove slideshow z-index (Cycle)
357
+ *
358
+ * @since 2.15.0
359
+ */
360
+ if ( isset( $options['slideshow_zindex'] ) ) {
361
+ unset( $options['slideshow_zindex'] );
362
+ }
363
+
364
+ /**
365
+ * Replace zero embed_width with empty value.
366
+ *
367
+ * @since 2.27.0
368
+ */
369
+ if ( 0 === $options['embed_width'] ) {
370
+ $options['embed_width'] = '';
371
+ }
372
+
373
+ /**
374
+ * Remove email logging.
375
+ *
376
+ * @since 2.28.4
377
+ */
378
+ if ( isset( $options['email_log_level'] ) ) {
379
+ unset( $options['email_log_level'] );
380
+ }
381
+
382
+ // Merge in new options
383
+ $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
384
+
385
+ return $options;
386
+ }
387
+
388
+ /**
389
+ * Default custom fields.
390
+ *
391
+ * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
392
+ * Overwrite existing fields on every update to auto-repair.
393
+ *
394
+ * @return array
395
+ */
396
+ public static function update_fields() {
397
+ return Strong_Testimonials_Defaults::get_fields();
398
+ }
399
+
400
+ /**
401
+ * Base forms.
402
+ *
403
+ * @return array
404
+ */
405
+ public static function update_base_forms() {
406
+ return Strong_Testimonials_Defaults::get_base_forms();
407
+ }
408
+
409
+ /**
410
+ * Custom forms.
411
+ *
412
+ * @return array
413
+ */
414
+ public static function update_custom_forms() {
415
+ $custom_forms = get_option( 'wpmtst_custom_forms' );
416
+ if ( ! $custom_forms ) {
417
+ return Strong_Testimonials_Defaults::get_custom_forms();
418
+ }
419
+
420
+ foreach ( $custom_forms as $form_id => $form_properties ) {
421
+ foreach ( $form_properties['fields'] as $key => $form_field ) {
422
+
423
+ /*
424
+ * Convert categories to category-selector.
425
+ * @since 2.17.0
426
+ */
427
+ if ( 'categories' == $form_field['input_type'] ) {
428
+ $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
429
+ }
430
+
431
+ /*
432
+ * Unset `show_default_options` for rating field. Going from 0 to 1.
433
+ * @since 2.21.0
434
+ */
435
+ if ( 'rating' == $form_field['input_type'] ) {
436
+ unset( $form_field['show_default_options'] );
437
+ }
438
+
439
+ /*
440
+ * Add `show_required_option` to shortcode field. Initial value is false.
441
+ * @since 2.22.0
442
+ */
443
+ if ( 'shortcode' == $form_field['input_type'] ) {
444
+ $form_field['show_required_option'] = false;
445
+ }
446
+
447
+ /*
448
+ * Add `show_default_options` to checkbox field.
449
+ *
450
+ * @since 2.27.0
451
+ */
452
+ if ( 'checkbox' == $form_field['input_type'] ) {
453
+ $form_field['show_default_options'] = 1;
454
+ }
455
+
456
+ /*
457
+ * Merge in new default.
458
+ * Custom fields are in display order (not associative) so we must find them by `input_type`.
459
+ * @since 2.21.0 Using default fields instead of default form as source
460
+ */
461
+ $new_default = array();
462
+ $fields = get_option( 'wpmtst_fields', array() );
463
+
464
+ foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
465
+ foreach ( $field_type_group as $field_type_key => $field_type_field ) {
466
+ if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
467
+ $new_default = $field_type_field;
468
+ break;
469
+ }
470
+ }
471
+ }
472
+
473
+ if ( $new_default ) {
474
+ $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
475
+ }
476
+
477
+ }
478
+ }
479
+
480
+ return $custom_forms;
481
+ }
482
+
483
+ /**
484
+ * Form options.
485
+ *
486
+ * @return array
487
+ */
488
+ public static function update_form_options() {
489
+ $form_options = get_option( 'wpmtst_form_options' );
490
+ if ( ! $form_options ) {
491
+ return Strong_Testimonials_Defaults::get_form_options();
492
+ }
493
+
494
+ $options = get_option( 'wpmtst_options', array() );
495
+ $history = get_option( 'wpmtst_history', array() );
496
+
497
+ /**
498
+ * Move existing options.
499
+ */
500
+ if ( isset( $options['admin_notify'] ) ) {
501
+ $form_options['admin_notify'] = $options['admin_notify'];
502
+ unset( $options['admin_notify'] );
503
+
504
+ $form_options['admin_email'] = $options['admin_email'];
505
+ unset( $options['admin_email'] );
506
+
507
+ update_option( 'wpmtst_options', $options );
508
+ }
509
+
510
+ /**
511
+ * Update single email recipient to multiple.
512
+ *
513
+ * @since 1.18
514
+ */
515
+ if ( ! isset( $form_options['recipients'] ) ) {
516
+ $form_options['recipients'] = array(
517
+ array(
518
+ 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
519
+ 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
520
+ 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
521
+ 'primary' => 1, // cannot be deleted
522
+ ),
523
+ );
524
+
525
+ unset( $form_options['admin_name'] );
526
+ unset( $form_options['admin_site_email'] );
527
+ unset( $form_options['admin_email'] );
528
+ }
529
+
530
+ /**
531
+ * Add default required-notice setting
532
+ *
533
+ * @since 2.24.1
534
+ */
535
+ if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
536
+ $form_options['messages']['required-field']['enabled'] = 1;
537
+ }
538
+
539
+ /**
540
+ * Delete form options
541
+ *
542
+ * @since 2.38
543
+ */
544
+ unset( $form_options['captcha'] );
545
+ unset( $form_options['messages']['captcha'] );
546
+
547
+
548
+ /**
549
+ * Merge in new options.
550
+ */
551
+ $defaults = Strong_Testimonials_Defaults::get_form_options();
552
+
553
+ $form_options = array_merge( $defaults, $form_options );
554
+
555
+ // Merge nested arrays individually. Don't use array_merge_recursive.
556
+
557
+ $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
558
+ foreach ( $defaults['messages'] as $key => $message ) {
559
+ if( isset( $form_options['messages'][ $key ] ) ) {
560
+ $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
561
+ }
562
+ }
563
+
564
+ return $form_options;
565
+ }
566
+
567
+ /**
568
+ * Compatibility options.
569
+ *
570
+ * @since 2.28.0
571
+ *
572
+ * @return array
573
+ */
574
+ public static function update_compat_options() {
575
+ $options = get_option( 'wpmtst_compat_options' );
576
+ if ( ! $options ) {
577
+ return Strong_Testimonials_Defaults::get_compat_options();
578
+ }
579
+
580
+ // Merge in new options.
581
+ $defaults = Strong_Testimonials_Defaults::get_compat_options();
582
+
583
+ // Merge nested arrays individually. Don't use array_merge_recursive.
584
+
585
+ if ( isset( $options['controller'] ) ) {
586
+ $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
587
+ } else {
588
+ $options['ajax'] = $defaults['ajax'];
589
+ }
590
+
591
+ /**
592
+ * Controller
593
+ *
594
+ * @since 2.31.0
595
+ */
596
+ if ( isset( $options['controller'] ) ) {
597
+ $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
598
+ } else {
599
+ $options['controller'] = $defaults['controller'];
600
+ }
601
+
602
+ /**
603
+ * Lazy load
604
+ *
605
+ * @since 2.31.0
606
+ */
607
+ if ( isset( $options['lazyload'] ) ) {
608
+ // first level only: enabled, classes (array)
609
+ $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
610
+ } else {
611
+ $options['lazyload'] = $defaults['lazyload'];
612
+ }
613
+
614
+ $options = array_merge( $defaults, $options );
615
+
616
+ return $options;
617
+ }
618
+
619
+ /**
620
+ * View options.
621
+ *
622
+ * @return array
623
+ */
624
+ public static function update_view_options() {
625
+ return Strong_Testimonials_Defaults::get_view_options();
626
+ }
627
+
628
+ /**
629
+ * Default view.
630
+ *
631
+ * @return array
632
+ */
633
+ public static function update_default_view() {
634
+ return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
635
+ }
636
+
637
+ /**
638
+ * Update views.
639
+ *
640
+ * @uses wpmtst_save_view
641
+ */
642
+ public static function update_views() {
643
+ $views = wpmtst_get_views();
644
+
645
+ if ( ! $views ) {
646
+ return;
647
+ }
648
+
649
+ $default_view = wpmtst_get_view_default();
650
+ $history = get_option( 'wpmtst_history', array() );
651
+
652
+ foreach ( $views as $key => $view ) {
653
+
654
+ $view_data = unserialize( $view['value'] );
655
+ if ( ! is_array( $view_data ) ) {
656
+ self::log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
657
+ continue;
658
+ }
659
+
660
+ /**
661
+ * For version 2.28.
662
+ */
663
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
664
+ /**
665
+ * Compat mode no longer needed.
666
+ *
667
+ * @since 2.22.0
668
+ */
669
+ unset( $view_data['compat'] );
670
+
671
+ $view_data = self::convert_template_name( $view_data );
672
+ $view_data = self::convert_background_color( $view_data );
673
+ $view_data = self::convert_form_ajax( $view_data );
674
+ $view_data = self::convert_layout( $view_data );
675
+ $view_data = self::convert_word_count( $view_data );
676
+ $view_data = self::convert_excerpt_length( $view_data );
677
+ $view_data = self::convert_more_text( $view_data );
678
+ $view_data = self::convert_modern_title( $view_data );
679
+ $view_data = self::convert_slideshow( $view_data );
680
+ $view_data = self::convert_title_link( $view_data );
681
+ $view_data = self::convert_pagination_type( $view_data );
682
+ }
683
+
684
+ /**
685
+ * For version 2.30.
686
+ */
687
+ if ( ! isset( $history['2.30_new_template_structure'] ) ) {
688
+ $view_data = self::convert_template_structure( $view_data );
689
+ $view_data = self::convert_count( $view_data );
690
+ if ( isset( $view_data['background']['example-font-color'] ) ) {
691
+ unset( $view_data['background']['example-font-color'] );
692
+ }
693
+
694
+ self::update_history_log( '2.30_new_template_structure' );
695
+ }
696
+
697
+ /**
698
+ * Add carousel breakpoints.
699
+ *
700
+ * @since 2.32.2
701
+ */
702
+ if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
703
+ $view['data'] = self::add_carousel_breakpoints( $view_data );
704
+ self::update_history_log( '2.32.2_carousel_breakpoints' );
705
+ }
706
+
707
+ /**
708
+ * Merge in new default values.
709
+ * Merge nested arrays individually. Don't use array_merge_recursive.
710
+ */
711
+ $view['data'] = array_merge( $default_view, $view_data );
712
+
713
+ /**
714
+ * Background defaults.
715
+ */
716
+ $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
717
+
718
+ /**
719
+ * Pagination defaults.
720
+ * Attempt to repair bug from 2.28.2
721
+ *
722
+ * @since 2.28.3
723
+ */
724
+ if ( isset( $view_data['pagination_settings'] ) ) {
725
+ $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
726
+
727
+ if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
728
+ $view['data']['pagination_settings']['end_size'] = 1;
729
+ }
730
+ if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
731
+ $view['data']['pagination_settings']['mid_size'] = 2;
732
+ }
733
+ if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
734
+ $view['data']['pagination_settings']['per_page'] = 5;
735
+ }
736
+ } else {
737
+ $view['data']['pagination_settings'] = $default_view['pagination_settings'];
738
+ }
739
+
740
+ /**
741
+ * Slideshow defaults.
742
+ */
743
+ if ( isset( $view_data['slideshow_settings'] ) ) {
744
+ $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
745
+ } else {
746
+ $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
747
+ }
748
+ ksort( $view['data']['slideshow_settings'] );
749
+
750
+ /**
751
+ * Save it.
752
+ */
753
+ wpmtst_save_view( $view );
754
+
755
+ } // foreach $view
756
+ }
757
+
758
+ /**
759
+ * Add carousel breakpoints.
760
+ *
761
+ * @param array $view_data
762
+ * @since 2.32.2
763
+ *
764
+ * @return array
765
+ */
766
+ public static function add_carousel_breakpoints( $view_data ) {
767
+ if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
768
+ return $view_data;
769
+ }
770
+
771
+ if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
772
+
773
+ // Convert to single
774
+ $view_data['slideshow_settings']['type'] = 'show_single';
775
+
776
+ $view_data['slideshow_settings']['show_single'] = array(
777
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
778
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
779
+ 'margin' => 1,
780
+ );
781
+
782
+ } else {
783
+
784
+ // Convert to multiple
785
+ $view_data['slideshow_settings']['type'] = 'show_multiple';
786
+
787
+ $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
788
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
789
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
790
+ 'margin' => 1,
791
+ );
792
+
793
+ }
794
+
795
+ // Remove old values
796
+ unset(
797
+ $view_data['slideshow_settings']['max_slides'],
798
+ $view_data['slideshow_settings']['move_slides'],
799
+ $view_data['slideshow_settings']['margin']
800
+ );
801
+
802
+ return $view_data;
803
+ }
804
+
805
+ /**
806
+ * Convert template naming structure.
807
+ *
808
+ * @since 2.30.0
809
+ *
810
+ * @param $view_data
811
+ *
812
+ * @return array
813
+ */
814
+ public static function convert_template_structure( $view_data ) {
815
+ /*
816
+ Array
817
+ (
818
+ [0] => default:content
819
+ [1] => default-dark:form
820
+ [2] => default-dark:content
821
+ [3] => default:form
822
+ [4] => image-right:content
823
+ [5] => no-quotes:content
824
+ [6] => large:widget
825
+ [7] => modern:content
826
+ [8] => simple:content
827
+ [9] => simple:form
828
+ [10] => unstyled:content
829
+ [11] => unstyled:form
830
+ [12] => default:widget
831
+ [13] => image-right:widget
832
+ )
833
+ */
834
+ switch ( $view_data['template'] ) {
835
+ case 'default:content' :
836
+ $view_data['template'] = 'default';
837
+ break;
838
+ case 'default-dark:form' :
839
+ $view_data['template'] = 'default-form';
840
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
841
+ break;
842
+ case 'default-dark:content' :
843
+ $view_data['template'] = 'default';
844
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
845
+ break;
846
+ case 'default:form' :
847
+ $view_data['template'] = 'default-form';
848
+ break;
849
+ case 'image-right:content' :
850
+ $view_data['template'] = 'default';
851
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
852
+ break;
853
+ case 'no-quotes:content' :
854
+ $view_data['template'] = 'default';
855
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
856
+ break;
857
+ case 'large:widget' :
858
+ $view_data['template'] = 'bold';
859
+ break;
860
+ case 'modern:content' :
861
+ $view_data['template'] = 'modern';
862
+ break;
863
+ case 'simple:content' :
864
+ $view_data['template'] = 'simple';
865
+ break;
866
+ case 'simple:form' :
867
+ $view_data['template'] = 'simple-form';
868
+ break;
869
+ case 'unstyled:content' :
870
+ $view_data['template'] = 'unstyled';
871
+ break;
872
+ case 'unstyled:form' :
873
+ $view_data['template'] = 'unstyled-form';
874
+ break;
875
+ case 'default:widget' :
876
+ $view_data['template'] = 'small-widget';
877
+ break;
878
+ case 'image-right:widget' :
879
+ $view_data['template'] = 'small-widget';
880
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
881
+ break;
882
+ default:
883
+ // Keep existing value; it's probably a custom template.
884
+ }
885
+
886
+ return $view_data;
887
+ }
888
+
889
+ /**
890
+ * Update template naming structure.
891
+ *
892
+ * @param $view_data
893
+ *
894
+ * @return array
895
+ */
896
+ public static function convert_template_name( $view_data ) {
897
+ // Change default template from empty to 'default:{type}'
898
+ if ( ! $view_data['template'] ) {
899
+ if ( 'form' == $view_data['mode'] ) {
900
+ $type = 'form';
901
+ }
902
+ else {
903
+ $type = 'content';
904
+ }
905
+
906
+ $view_data['template'] = "default:$type";
907
+ }
908
+ else {
909
+ // Convert name; e.g. 'simple/testimonials.php'
910
+ if ( 'widget/testimonials.php' == $view_data['template'] ) {
911
+ $view_data['template'] = 'default:widget';
912
+ }
913
+ else {
914
+ $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
915
+ $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
916
+ $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
917
+ }
918
+ }
919
+
920
+ return $view_data;
921
+ }
922
+
923
+ /**
924
+ * Convert length (characters).
925
+ *
926
+ * @since 2.10.0 word_count (deprecated)
927
+ * @since 2.11.4 excerpt_length
928
+ *
929
+ * @param $view_data
930
+ *
931
+ * @return array
932
+ */
933
+ public static function convert_excerpt_length( $view_data ) {
934
+ if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
935
+ $default_view = Strong_Testimonials_Defaults::get_default_view();
936
+ $average_word_length = self::get_average_word_length();
937
+
938
+ if ( isset( $view_data['length'] ) && $view_data['length'] ) {
939
+ $word_count = round( $view_data['length'] / $average_word_length );
940
+ $word_count = $word_count < 5 ? 5 : $word_count;
941
+ $word_count = $word_count > 300 ? 300 : $word_count;
942
+ $view_data['excerpt_length'] = $word_count;
943
+ }
944
+ else {
945
+ $view_data['excerpt_length'] = $default_view['excerpt_length'];
946
+ }
947
+
948
+ unset( $view_data['length'] );
949
+ }
950
+
951
+ return $view_data;
952
+ }
953
+
954
+ /**
955
+ * Convert more_text to post or page.
956
+ *
957
+ * @since 2.10.0
958
+ *
959
+ * @param $view_data
960
+ *
961
+ * @return array
962
+ */
963
+ public static function convert_more_text( $view_data ) {
964
+ if ( isset( $view_data['more_text'] ) ) {
965
+ if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
966
+ // convert more_page to toggle and move page id to more_page_id
967
+ $view_data['more_page_id'] = $view_data['more_page'];
968
+ $view_data['more_page'] = 1;
969
+ $view_data['more_page_text'] = $view_data['more_text'];
970
+ }
971
+ elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
972
+ $view_data['more_post_text'] = $view_data['more_text'];
973
+ }
974
+ unset( $view_data['more_text'] );
975
+ }
976
+
977
+ return $view_data;
978
+ }
979
+
980
+ /**
981
+ * Convert slideshow settings.
982
+ *
983
+ * @since 2.15.0
984
+ *
985
+ * @param $view_data
986
+ *
987
+ * @return array
988
+ */
989
+ public static function convert_slideshow( $view_data ) {
990
+ if ( isset( $view_data['slideshow_settings'] ) ) {
991
+ return $view_data;
992
+ }
993
+
994
+ if ( 'scrollHorz' == $view_data['effect'] ) {
995
+ $view_data['effect'] = 'horizontal';
996
+ }
997
+
998
+ $view_data['slideshow_settings'] = array(
999
+ 'effect' => $view_data['effect'],
1000
+ 'speed' => $view_data['effect_for'],
1001
+ 'pause' => $view_data['show_for'],
1002
+ 'auto_hover' => ! $view_data['no_pause'],
1003
+ 'adapt_height' => false,
1004
+ 'adapt_height_speed' => .5,
1005
+ 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1006
+ );
1007
+
1008
+ unset(
1009
+ $view_data['effect'],
1010
+ $view_data['effect_for'],
1011
+ $view_data['no_pause'],
1012
+ $view_data['show_for'],
1013
+ $view_data['stretch']
1014
+ );
1015
+
1016
+ if ( isset( $view_data['slideshow_nav'] ) ) {
1017
+ switch ( $view_data['slideshow_nav'] ) {
1018
+ case 'simple':
1019
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1020
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1021
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1022
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1023
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1024
+ break;
1025
+ case 'buttons1':
1026
+ $view_data['slideshow_settings']['controls_type'] = 'sides';
1027
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1028
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1029
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1030
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1031
+ break;
1032
+ case 'buttons2':
1033
+ $view_data['slideshow_settings']['controls_type'] = 'simple';
1034
+ $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1035
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1036
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1037
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1038
+ break;
1039
+ case 'indexed':
1040
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1041
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1042
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1043
+ $view_data['slideshow_settings']['pager_style'] = 'text';
1044
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1045
+ break;
1046
+ default:
1047
+ // none
1048
+ }
1049
+ unset( $view_data['slideshow_nav'] );
1050
+ }
1051
+
1052
+ return $view_data;
1053
+ }
1054
+
1055
+ /**
1056
+ * Convert 'all' to 'count'.
1057
+ *
1058
+ * @param $view_data
1059
+ *
1060
+ * @return array
1061
+ */
1062
+ public static function convert_count( $view_data ) {
1063
+ if ( isset( $view_data['all'] ) ) {
1064
+ if ( $view_data['all'] ) {
1065
+ $view_data['count'] = -1;
1066
+ }
1067
+ unset( $view_data['all'] );
1068
+ }
1069
+
1070
+ return $view_data;
1071
+ }
1072
+
1073
+ /**
1074
+ * Convert background color.
1075
+ *
1076
+ * @param $view_data
1077
+ *
1078
+ * @return array
1079
+ */
1080
+ public static function convert_background_color( $view_data ) {
1081
+ if ( ! is_array( $view_data['background'] ) ) {
1082
+ $view_data['background'] = array(
1083
+ 'color' => $view_data['background'],
1084
+ 'type' => 'single',
1085
+ );
1086
+ }
1087
+
1088
+ return $view_data;
1089
+ }
1090
+
1091
+ /**
1092
+ * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1093
+ *
1094
+ * @param $view_data
1095
+ *
1096
+ * @return array
1097
+ */
1098
+ public static function convert_form_ajax( $view_data ) {
1099
+ if ( isset( $view_data['form-ajax'] ) ) {
1100
+ $view_data['form_ajax'] = $view_data['form-ajax'];
1101
+ unset( $view_data['form-ajax'] );
1102
+ }
1103
+
1104
+ return $view_data;
1105
+ }
1106
+
1107
+ /**
1108
+ * Prevent incompatible layouts.
1109
+ *
1110
+ * @param $view_data
1111
+ *
1112
+ * @return array
1113
+ */
1114
+ public static function convert_layout( $view_data ) {
1115
+ if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1116
+ if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1117
+ $view_data['layout'] = '';
1118
+ }
1119
+ }
1120
+
1121
+ return $view_data;
1122
+ }
1123
+
1124
+ /**
1125
+ * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1126
+ *
1127
+ * @since 2.11.4
1128
+ *
1129
+ * @param $view_data
1130
+ *
1131
+ * @return array
1132
+ */
1133
+ public static function convert_word_count( $view_data ) {
1134
+ if ( isset( $view_data['word_count'] ) ) {
1135
+ $view_data['excerpt_length'] = $view_data['word_count'];
1136
+ unset( $view_data['word_count'] );
1137
+ }
1138
+
1139
+ return $view_data;
1140
+ }
1141
+
1142
+ /**
1143
+ * Disable title on Modern template because new version of template has the title.
1144
+ * Only if updating from version earlier than 2.12.4.
1145
+ *
1146
+ * @param $view_data
1147
+ *
1148
+ * @return array
1149
+ */
1150
+ public static function convert_modern_title( $view_data ) {
1151
+ if ( 'modern:content' == $view_data['template'] ) {
1152
+ if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1153
+ $view_data['title'] = 0;
1154
+ self::update_history_log( '2.12.4_convert_modern_template' );
1155
+ }
1156
+ }
1157
+
1158
+ return $view_data;
1159
+ }
1160
+
1161
+ /**
1162
+ * Title link
1163
+ *
1164
+ * @since 2.26.0
1165
+ *
1166
+ * @param $view_data
1167
+ *
1168
+ * @return array
1169
+ */
1170
+ public static function convert_title_link( $view_data ) {
1171
+ if ( ! isset( $view_data['title_link'] ) ) {
1172
+ $view_data['title_link'] = 'none';
1173
+ }
1174
+
1175
+ return $view_data;
1176
+ }
1177
+
1178
+
1179
+ /**
1180
+ * Convert nofollow from (on|off) to (1|0).
1181
+ *
1182
+ * @since 2.23.0
1183
+ */
1184
+ public static function convert_nofollow() {
1185
+ $args = array(
1186
+ 'posts_per_page' => - 1,
1187
+ 'post_type' => 'wpm-testimonial',
1188
+ 'post_status' => 'publish',
1189
+ 'suppress_filters' => true,
1190
+ );
1191
+ $posts = get_posts( $args );
1192
+ if ( ! $posts ) {
1193
+ return;
1194
+ }
1195
+
1196
+ /**
1197
+ * Remove the equivocation. There is no false.
1198
+ */
1199
+ foreach ( $posts as $post ) {
1200
+ $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1201
+ $new_value = 'default';
1202
+
1203
+ if ( 'on' == $nofollow ) {
1204
+ $new_value = 'yes';
1205
+ }
1206
+ elseif ( 1 === $nofollow ) {
1207
+ $new_value = 'yes';
1208
+ }
1209
+ elseif ( 'off' == $nofollow ) {
1210
+ $new_value = 'no';
1211
+ }
1212
+ elseif ( 0 === $nofollow ) {
1213
+ $new_value = 'no';
1214
+ }
1215
+ elseif ( is_bool( $nofollow ) ) {
1216
+ if ( $nofollow ) {
1217
+ $new_value = 'yes';
1218
+ }
1219
+ else {
1220
+ $new_value = 'default';
1221
+ }
1222
+ }
1223
+
1224
+ update_post_meta( $post->ID, 'nofollow', $new_value );
1225
+ }
1226
+ }
1227
+
1228
+ /**
1229
+ * Convert noopener from (on|off) to (1|0).
1230
+ *
1231
+ * @since 2.41.0
1232
+ */
1233
+ public static function convert_noopener() {
1234
+ $args = array(
1235
+ 'posts_per_page' => - 1,
1236
+ 'post_type' => 'wpm-testimonial',
1237
+ 'post_status' => 'publish',
1238
+ 'suppress_filters' => true,
1239
+ );
1240
+ $posts = get_posts( $args );
1241
+ if ( ! $posts ) {
1242
+ return;
1243
+ }
1244
+
1245
+ /**
1246
+ * Remove the equivocation. There is no false.
1247
+ */
1248
+ foreach ( $posts as $post ) {
1249
+ $noopener = get_post_meta( $post->ID, 'noopener', true );
1250
+ $new_value = 'default';
1251
+
1252
+ if ( 'on' == $noopener ) {
1253
+ $new_value = 'yes';
1254
+ }
1255
+ elseif ( 1 === $noopener ) {
1256
+ $new_value = 'yes';
1257
+ }
1258
+ elseif ( 'off' == $noopener ) {
1259
+ $new_value = 'no';
1260
+ }
1261
+ elseif ( 0 === $noopener ) {
1262
+ $new_value = 'no';
1263
+ }
1264
+ elseif ( is_bool( $noopener ) ) {
1265
+ if ( $noopener ) {
1266
+ $new_value = 'yes';
1267
+ }
1268
+ else {
1269
+ $new_value = 'default';
1270
+ }
1271
+ }
1272
+
1273
+ update_post_meta( $post->ID, 'noopener', $new_value );
1274
+ }
1275
+ }
1276
+
1277
+ /**
1278
+ * Convert noreferrer from (on|off) to (1|0).
1279
+ *
1280
+ * @since 2.41.0
1281
+ */
1282
+ public static function convert_noreferrer() {
1283
+ $args = array(
1284
+ 'posts_per_page' => - 1,
1285
+ 'post_type' => 'wpm-testimonial',
1286
+ 'post_status' => 'publish',
1287
+ 'suppress_filters' => true,
1288
+ );
1289
+ $posts = get_posts( $args );
1290
+ if ( ! $posts ) {
1291
+ return;
1292
+ }
1293
+
1294
+ /**
1295
+ * Remove the equivocation. There is no false.
1296
+ */
1297
+ foreach ( $posts as $post ) {
1298
+ $noreferrer = get_post_meta( $post->ID, 'noreferrer', true );
1299
+ $new_value = 'default';
1300
+
1301
+ if ( 'on' == $noreferrer ) {
1302
+ $new_value = 'yes';
1303
+ }
1304
+ elseif ( 1 === $noreferrer ) {
1305
+ $new_value = 'yes';
1306
+ }
1307
+ elseif ( 'off' == $noreferrer ) {
1308
+ $new_value = 'no';
1309
+ }
1310
+ elseif ( 0 === $noreferrer ) {
1311
+ $new_value = 'no';
1312
+ }
1313
+ elseif ( is_bool( $noreferrer ) ) {
1314
+ if ( $noreferrer ) {
1315
+ $new_value = 'yes';
1316
+ }
1317
+ else {
1318
+ $new_value = 'default';
1319
+ }
1320
+ }
1321
+
1322
+ update_post_meta( $post->ID, 'noreferrer', $new_value );
1323
+ }
1324
+ }
1325
+
1326
+ /**
1327
+ * Convert pagination settings.
1328
+ *
1329
+ * @since 2.28.0
1330
+ *
1331
+ * @param $view_data
1332
+ *
1333
+ * @return mixed
1334
+ */
1335
+ public static function convert_pagination_type( $view_data ) {
1336
+ if ( isset( $view_data['pagination_type'] ) ) {
1337
+ $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1338
+ unset( $view_data['pagination_type'] );
1339
+ }
1340
+
1341
+ if ( isset( $view_data['nav'] ) ) {
1342
+ $view_data['pagination_settings']['nav'] = $view_data['nav'];
1343
+ unset( $view_data['nav'] );
1344
+ }
1345
+
1346
+ if ( isset( $view_data['per_page'] ) ) {
1347
+ $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1348
+ unset( $view_data['per_page'] );
1349
+ }
1350
+
1351
+ return $view_data;
1352
+ }
1353
+
1354
+ /**
1355
+ * Convert length to excerpt_length.
1356
+ *
1357
+ * @since 2.10.0
1358
+ */
1359
+ public static function get_average_word_length() {
1360
+ $args = array(
1361
+ 'posts_per_page' => - 1,
1362
+ 'post_type' => 'wpm-testimonial',
1363
+ 'post_status' => 'publish',
1364
+ 'suppress_filters' => true,
1365
+ );
1366
+ $posts = get_posts( $args );
1367
+ if ( ! $posts ) {
1368
+ return 5;
1369
+ }
1370
+
1371
+ $allwords = array();
1372
+
1373
+ foreach ( $posts as $post ) {
1374
+ $words = explode( ' ', $post->post_content );
1375
+ if ( count( $words ) > 5 ) {
1376
+ $allwords = $allwords + $words;
1377
+ }
1378
+ }
1379
+
1380
+ $wordstring = implode( '', $allwords );
1381
+
1382
+ return round( strlen( $wordstring ) / count( $allwords ) );
1383
+ }
1384
+
1385
+ }
1386
+
1387
+ new Strong_Testimonials_Updater();
admin/class-strong-testimonials-upsell.php CHANGED
@@ -1,831 +1,831 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Upsell
4
- *
5
- * @since 2.38
6
- */
7
- class Strong_Testimonials_Upsell {
8
-
9
- public $store_upgrade_url;
10
-
11
- public function __construct() {
12
- $this->set_store_upgrade_url();
13
- $options = get_option( 'wpmtst_options' );
14
-
15
- if ( isset( $options['disable_upsells'] ) && $options['disable_upsells'] ) {
16
- return;
17
- }
18
-
19
- add_action( 'wpmtst_admin_after_settings_form', array( $this, 'general_upsell' ) );
20
-
21
- if ( ! defined( 'WPMTST_ROLE_MANAGEMENT_VERSION' ) ) {
22
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_role_manager' ), 4, 2 );
23
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_rm_settings_page' ) );
24
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_role_upsell' ), 20 );
25
- }
26
-
27
- if ( ! defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
28
- add_action( 'wpmtst_after_form_type_selection', array( $this, 'output_country_selector_upsell' ) );
29
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_country_selector_upsell' ), 95 );
30
- }
31
-
32
- if ( ! defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
33
- add_action( 'wpmtst_after_form_type_selection', array( $this, 'output_custom_fields_upsell' ) );
34
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_custom_fields_upsell' ), 90 );
35
- }
36
-
37
- if ( ! defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
38
- add_action( 'wpmtst_before_fields_settings', array( $this, 'output_multiple_form_upsell' ) );
39
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_multiple_form_upsell' ), 30 );
40
- }
41
-
42
- if ( ! defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
43
- add_action( 'wpmtst_view_editor_after_groups', array( $this, 'output_review_markup_upsell' ) );
44
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_review_markup_upsell' ), 15 );
45
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_review_markup' ), 4, 2 );
46
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_review_markup_settings_page' ) );
47
- }
48
-
49
- if ( ! defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
50
- add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'output_advanced_views_upsell' ) );
51
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_advanced_views_upsell' ), 35 );
52
- }
53
-
54
- if ( ! defined( 'WPMTST_CAPTCHA_VERSION' ) ) {
55
- add_action( 'wpmtst_fields_before_fields_editor_preview', array( $this, 'output_captcha_editor_upsell' ) );
56
- add_action( 'wpmtst_after_form_settings', array( $this, 'output_captcha_form_settings_upsell' ) );
57
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_captcha_upsell' ), 40 );
58
- }
59
-
60
- if ( ! defined( 'WPMTST_PRO_TEMPLATES_VERSION' ) ) {
61
- add_action( 'wpmtst_views_after_template_list', array( $this, 'output_pro_templates_upsell' ) );
62
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_pro_templates_upsell' ), 20 );
63
- }
64
-
65
- if ( ! defined( 'WPMTST_EMAILS_VERSION' ) ) {
66
- add_action( 'wpmtst_after_mail_notification_settings', array( $this, 'output_enhanced_emails_upsell' ) );
67
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_enhanced_emails_upsell' ), 45 );
68
- }
69
-
70
- if ( ! defined( 'WPMTST_INFINITE_SCROLL_VERSION' ) ) {
71
- add_action( 'wpmtst_view_editor_pagination_row_end', array( $this, 'output_infinite_scroll_upsell' ) );
72
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_infinite_scroll_upsell' ), 50 );
73
- }
74
-
75
- if ( ! defined( 'WPMTST_FILTERS_VERSION' ) ) {
76
- add_action( 'wpmtst_after_style_view_section', array( $this, 'output_filters_upsell' ) );
77
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_filters_upsell' ), 15 );
78
- }
79
-
80
- if ( ! defined( 'WPMTST_PRO_VERSION' ) ) {
81
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_st_pro_tab' ), 4, 2 );
82
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_st_pro_page' ) );
83
- add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_pro_upsell' ), 10 );
84
- }
85
-
86
- if ( ! defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
87
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_assigment_tab' ), 4, 2 );
88
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_assigment_settings_page' ) );
89
- }
90
-
91
- if ( ! defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
92
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_properties_tab' ), 4, 2 );
93
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_properties_page' ) );
94
- }
95
-
96
-
97
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
98
- }
99
-
100
- public function add_meta_boxes() {
101
-
102
-
103
- if ( ! defined( 'WPMTST_IMPORTER_VERSION' ) ) {
104
- add_meta_box(
105
- 'wpmtst-importer-upsell', // Unique ID
106
- esc_html__( 'Import', 'strong-testimonials' ), // Title
107
- array( $this, 'output_importer_upsell' ), // Callback function
108
- 'wpm-testimonial', // Admin page (or post type)
109
- 'side', // Context
110
- 'high' // Priority
111
- );
112
- }
113
-
114
- }
115
-
116
- public function set_store_upgrade_url() {
117
-
118
- $this->store_upgrade_url = WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell';
119
-
120
- //append license key
121
- $license = trim( get_option( 'strong_testimonials_license_key' ) );
122
- if ( $license ) {
123
- $this->store_upgrade_url .= '&license=' . $license;
124
- }
125
-
126
- }
127
-
128
- public function output_importer_upsell() {
129
- ?>
130
- <div class="wpmtst-alert">
131
- <h2><?php esc_html_e( 'Automatically pull in & display new reviews as your customers leave their feedback on external platforms', 'strong-testimonials' ) ?></h2>
132
- <p><?php esc_html_e( 'Upgrade today and get the ability to import testimonials from:', 'strong-testimonials' ) ?></p>
133
- <ul>
134
- <li><?php esc_html_e( 'Facebook', 'strong-testimonials' ) ?></li>
135
- <li><?php esc_html_e( 'Google', 'strong-testimonials' ) ?></li>
136
- <li><?php esc_html_e( 'Yelp', 'strong-testimonials' ) ?></li>
137
- <li><?php esc_html_e( 'Zomato', 'strong-testimonials' ) ?></li>
138
- <li><?php esc_html_e( 'WooCommerce', 'strong-testimonials' ) ?></li>
139
- <li><?php esc_html_e( 'and more...', 'strong-testimonials' ) ?></li>
140
- </ul>
141
- <p>
142
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=importer-metabox' ); ?>"><?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?></a>
143
- </p>
144
- </div>
145
- <?php
146
- }
147
-
148
- public function general_upsell(){
149
-
150
- $general_upsells = apply_filters( 'wpmtst_general_upsell_items', array() );
151
-
152
- if ( ! empty( $general_upsells ) ) {
153
-
154
- ?>
155
-
156
- <div class="wpmtst-settings-upsell">
157
- <div class="wpmtst-alert">
158
- <h3><?php esc_html_e( 'Upgrade now', 'strong-testimonials' ) ?></h3>
159
- <ul>
160
- <?php foreach ( $general_upsells as $general_upsell ) { ?>
161
- <li>
162
- <span>
163
- <?php echo wp_kses_post($general_upsell); ?>
164
- </span>
165
- </li>
166
- <?php } ?>
167
- </ul>
168
-
169
- <a href="<?php echo esc_url(WPMTST_STORE_URL . '/pricing?utm_source=st-lite&utm_campaign=upsell&utm_medium=general-settings-upsell'); ?>"
170
- target="_blank" class="button button-primary button-hero"
171
- style="width:100%;display:block;margin-top:20px;text-align:center;"><?php echo esc_html__('Upgrade now', 'strong-testimonials'); ?></a>
172
-
173
- </div>
174
- </div>
175
-
176
- <?php
177
- }
178
- }
179
-
180
- // Role Manager upsell
181
- public function register_role_manager( $active_tab, $url ) {
182
- $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
183
- printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
184
- esc_url( add_query_arg( 'tab', 'access', $url ) ),
185
- esc_attr( $tab == 'access' ? 'nav-tab-active' : '' ),
186
- esc_html_x( 'Role Management', 'adjective', 'strong-testimonials' ),
187
- '<span class="wpmtst-upsell-badge">PRO</span>'
188
- );
189
- }
190
-
191
- public function register_rm_settings_page( $pages ) {
192
- $pages[ 'access' ] = array( $this, 'output_role_manager_page' );
193
- return $pages;
194
- }
195
-
196
- public function output_role_manager_page(){
197
- ?>
198
- <div class="wpmtst-alert">
199
- <?php
200
- printf(
201
- esc_html__( 'Control who approves testimonials or who has access to the plugins’ settings panel with %s extension. Get total granular control over who has access to your testimonials.', 'strong-testimonials' ),
202
- sprintf(
203
- '<a href="%s" target="_blank">%s</a>',
204
- esc_url( WPMTST_STORE_URL . '/extensions/role-management?utm_source=st-lite&utm_campaign=upsell&utm_medium=role-management-tab-upsell' ),
205
- esc_html__( 'Role Management', 'strong-testimonials' )
206
- )
207
- );
208
- ?>
209
- <p>
210
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=role-management-tab-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
211
- </p>
212
- </div>
213
- <?php
214
- }
215
-
216
- public function add_role_upsell( $upsells ) {
217
- $upsell = sprintf(
218
- esc_html__( 'Control who approves testimonials or who has access to the plugins’ settings panel with %s extension. Get total granular control over who has access to your testimonials.', 'strong-testimonials' ),
219
- sprintf(
220
- '<a href="%s" target="_blank">%s</a>',
221
- esc_url( WPMTST_STORE_URL . '/extensions/role-management?utm_source=st-lite&utm_campaign=upsell&utm_medium=role-management-general-upsell' ),
222
- esc_html__( 'Role Management', 'strong-testimonials' )
223
- )
224
- );
225
-
226
- $upsells[] = $upsell;
227
- return $upsells;
228
- }
229
-
230
- /*
231
- Country Selector
232
- */
233
- public function output_country_selector_upsell() {
234
- ?>
235
- <div class="wpmtst-alert" style="margin-top: 10px">
236
- <?php esc_html_e( 'Want to know where are your customers located?', 'strong-testimonials' ); ?>
237
- <br/>
238
- <?php
239
- printf(
240
- esc_html__( 'Install the %s extension', 'strong-testimonials' ),
241
- sprintf(
242
- '<a href="%s" target="_blank">%s</a>',
243
- esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ),
244
- esc_html__( 'Strong Testimonials: Country Selector', 'strong-testimonials' )
245
- )
246
- );
247
- ?>
248
- <p>
249
-
250
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
251
- </p>
252
- </div>
253
- <?php
254
- }
255
-
256
- public function add_country_selector_upsell( $upsells ) {
257
- $upsell = sprintf(
258
- esc_html__( 'Show where your customers are located with the %s extension. ', 'strong-testimonials' ),
259
- sprintf(
260
- '<a href="%s" target="_blank">%s</a>',
261
- esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=country-selector-general-upsell' ),
262
- esc_html__( 'Country Selector', 'strong-testimonials' )
263
- )
264
- );
265
-
266
- $upsells[] = $upsell;
267
- return $upsells;
268
- }
269
-
270
- /*
271
- Custom fields
272
- */
273
- public function output_custom_fields_upsell() {
274
- ?>
275
- <div class="wpmtst-alert" style="margin-top: 10px">
276
- <?php esc_html_e( 'Know your customers by having access to more advanced custom fields.', 'strong-testimonials' ); ?>
277
- <br/>
278
- <?php
279
- printf(
280
- esc_html__( 'Install the %s extension', 'strong-testimonials' ),
281
- sprintf(
282
- '<a href="%s" target="_blank">%s</a>',
283
- esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ),
284
- esc_html__( 'Strong Testimonials: Custom Fields', 'strong-testimonials' )
285
- )
286
- );
287
- ?>
288
- <p>
289
-
290
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
291
- </p>
292
- </div>
293
- <?php
294
- }
295
-
296
- public function add_custom_fields_upsell( $upsells ) {
297
- $upsell = sprintf(
298
- esc_html__( 'Get to know your customers by installing our %s extension.', 'strong-testimonials' ),
299
- sprintf(
300
- '<a href="%s" target="_blank">%s</a>',
301
- esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=custom-fields-general-upsell' ),
302
- esc_html__( 'Custom Fields', 'strong-testimonials' )
303
- )
304
- );
305
-
306
- $upsells[] = $upsell;
307
- return $upsells;
308
- }
309
-
310
- /*
311
- * Multiple forms
312
- */
313
- public function output_multiple_form_upsell() {
314
- ?>
315
- <div class="wpmtst-alert" style="margin-top: 10px">
316
- <?php
317
- printf(
318
- esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
319
- sprintf(
320
- '<a href="%s" target="_blank">%s</a>',
321
- esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ),
322
- esc_html__( 'Strong Testimonials: Multiple Forms', 'strong-testimonials' )
323
- )
324
- );
325
- ?>
326
- <p>
327
-
328
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
329
- </p>
330
- </div>
331
- <?php
332
- }
333
-
334
- public function add_multiple_form_upsell( $upsells ) {
335
- $upsell = sprintf(
336
- esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
337
- sprintf(
338
- '<a href="%s" target="_blank">%s</a>',
339
- esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=multiple-forms-general-upsell' ),
340
- esc_html__( 'Multiple Forms', 'strong-testimonials' )
341
- )
342
- );
343
-
344
- $upsells[] = $upsell;
345
- return $upsells;
346
- }
347
-
348
- /*
349
- * Review Markup
350
- */
351
- public function register_review_markup( $active_tab, $url ) {
352
- $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
353
- printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
354
- esc_url( add_query_arg( 'tab', 'review-markup', $url ) ),
355
- esc_attr( $tab == 'review-markup' ? 'nav-tab-active' : '' ),
356
- esc_html_x( 'Review Markup', 'adjective', 'strong-testimonials' ),
357
- '<span class="wpmtst-upsell-badge">PRO</span>'
358
- );
359
- }
360
- public function register_review_markup_settings_page( $pages ) {
361
- $pages[ 'review-markup' ] = array( $this, 'output_review_markup_upsell' );
362
- return $pages;
363
- }
364
- public function output_review_markup_upsell() {
365
- ?>
366
- <div class="wpmtst-alert" style="margin-top: 10px">
367
- <?php
368
- printf(
369
- esc_html__( 'Add SEO-friendly & Schema.org compliant Testimonials with our %s extension.', 'strong-testimonials' ),
370
- sprintf(
371
- '<a href="%s" target="_blank">%s</a>',
372
- esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ),
373
- esc_html__( 'Strong Testimonials: Review Markup', 'strong-testimonials' )
374
- )
375
- );
376
- ?>
377
- <ul>
378
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'With this extensions, search engines will display star ratings in search results for your site.', 'strong-testimonials' ); ?></li>
379
- </ul>
380
- <p>
381
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
382
- </p>
383
- </div>
384
- <?php
385
- }
386
-
387
- public function add_review_markup_upsell( $upsells ) {
388
- $upsell = sprintf(
389
- esc_html__( 'Add SEO-friendly & Schema.org compliant Testimonials with our %s extension.', 'strong-testimonials' ),
390
- sprintf(
391
- '<a href="%s" target="_blank">%s</a>',
392
- esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=review-markup-general-upsell' ),
393
- esc_html__( 'Review Markup', 'strong-testimonials' )
394
- )
395
- );
396
-
397
- $upsells[] = $upsell;
398
- return $upsells;
399
- }
400
-
401
- /*
402
- Advanced Views
403
- */
404
- public function output_advanced_views_upsell() {
405
- ?>
406
- <div class="wpmtst-alert" style="margin-top: 1.5rem">
407
- <?php
408
- printf(
409
- esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
410
- sprintf(
411
- '<a href="%s" target="_blank">%s</a>',
412
- esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ),
413
- esc_html__( 'Strong Testimonials: Advanced Views', 'strong-testimonials' )
414
- )
415
- );
416
-
417
- ?>
418
- <ul>
419
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'filter & display testimonials based on their rating or on a pre-defined condition.', 'strong-testimonials' ); ?></li>
420
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'easily define the display order of your testimonial fields. Re-order the name, image, url and testimonial content fields through drag & drop.', 'strong-testimonials' ); ?></li>
421
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'edit, in real time, the way your testimonials will look on your site. Stop loosing clients because of poor design.', 'strong-testimonials' ); ?></li>
422
-
423
- </ul>
424
- <p>
425
-
426
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
427
- </p>
428
- </div>
429
- <?php
430
- }
431
-
432
- public function add_advanced_views_upsell( $upsells ) {
433
- $upsell = sprintf(
434
- esc_html__( 'Start filtering, changing the order, or even editing your testimonials in real-time with the %s extension.', 'strong-testimonials' ),
435
- sprintf(
436
- '<a href="%s" target="_blank">%s</a>',
437
- esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=advanced-views-general-upsell' ),
438
- esc_html__( 'Advanced Views', 'strong-testimonials' )
439
- )
440
- );
441
-
442
- $upsells[] = $upsell;
443
- return $upsells;
444
-
445
- }
446
-
447
- /*
448
- Captcha extensio
449
- */
450
- public function output_captcha_editor_upsell() {
451
- ?>
452
- <div class="wpmtst-alert">
453
- <?php
454
- printf(
455
- esc_html__( 'Protect your form against spam with the %s extension.', 'strong-testimonials' ),
456
- sprintf(
457
- '<a href="%s" target="_blank">%s</a>',
458
- esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
459
- esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
460
- )
461
- );
462
- ?>
463
- <p>
464
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
465
- </p>
466
- </div>
467
- <?php
468
- }
469
-
470
- public function output_captcha_form_settings_upsell() {
471
- ?>
472
- <hr>
473
-
474
- <h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
475
-
476
- <div class="wpmtst-alert">
477
- <?php
478
- printf(
479
- esc_html__( 'Protect your form against spam. Add Google reCAPTCHA or honeypot anti-spam with the %s extension.', 'strong-testimonials' ),
480
- sprintf(
481
- '<a href="%s" target="_blank">%s</a>',
482
- esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
483
- esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
484
- )
485
- );
486
- ?>
487
-
488
- <table class="form-table" cellpadding="0" cellspacing="0">
489
- <tr>
490
- <th scope="row">
491
- <label>
492
- <?php esc_html_e( 'Honeypot', 'strong-testimonials' ); ?>
493
- </label>
494
- </th>
495
- <td>
496
- <p>
497
- <?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
498
- </p>
499
- </td>
500
- </tr>
501
- <tr valign="top">
502
- <th scope="row">
503
- <label>
504
- <a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
505
- </label>
506
- </th>
507
- <td>
508
- <?php esc_html_e( 'Google reCAPTCHA prompts visitors to check a box to prove that they’re not a robot before they submit the form.', 'strong-testimonials' ); ?>
509
- <br/>
510
- <?php esc_html_e( 'In some cases, they’re prompted to complete another task, like identify a string of letters.', 'strong-testimonials' ); ?>
511
- <br/>
512
- <?php esc_html_e( 'This method makes it difficult for spambots to complete form submissions.', 'strong-testimonials' ); ?>
513
- </td>
514
- </tr>
515
- </table>
516
- <p>
517
- <a class="button button-primary" target="_blank"
518
- href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
519
- </p>
520
- </div>
521
- <?php
522
- }
523
-
524
- public function add_captcha_upsell( $upsells ) {
525
- $upsell = sprintf(
526
- esc_html__( 'Protect your form against spam. Add Google ReCaptcha or honeypot anti-spam with the %s extension.', 'strong-testimonials' ),
527
- sprintf(
528
- '<a href="%s" target="_blank">%s</a>',
529
- esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-captcha-general-upsell' ),
530
- esc_html__( 'Captcha', 'strong-testimonials' )
531
- )
532
- );
533
-
534
- $upsells[] = $upsell;
535
- return $upsells;
536
-
537
- }
538
-
539
- /*
540
- PRO Templates
541
- */
542
- public function output_pro_templates_upsell() {
543
- ?>
544
- <div class="wpmtst-alert">
545
- <?php
546
- echo esc_html__( 'Impress your potential clients with profesionally designed, pixel-perfect templates that increase your chances of standing out and landing more clients.', 'strong-testimonials' )
547
- ?>
548
- <p>
549
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-pro-templates-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
550
- </p>
551
- </div>
552
- <?php
553
- }
554
-
555
- public function add_pro_templates_upsell( $upsells ) {
556
- $upsell = sprintf(
557
- esc_html__( 'Get access to professionally designed testimonial templates with the %s extension.', 'strong-testimonials' ),
558
- sprintf(
559
- '<a href="%s" target="_blank">%s</a>',
560
- esc_url( WPMTST_STORE_URL . '/extensions/pro-templates?utm_source=st-lite&utm_campaign=upsell&utm_medium=pro-templates-general-upsell' ),
561
- esc_html__( 'Pro Templates', 'strong-testimonials' )
562
- )
563
- );
564
-
565
- $upsells[] = $upsell;
566
- return $upsells;
567
-
568
- }
569
-
570
- /*
571
- Enhanced Emails
572
- */
573
- public function output_enhanced_emails_upsell() {
574
- ?>
575
- <div class="wpmtst-alert" style="margin-top: 10px">
576
- <?php
577
- printf(
578
- esc_html__( 'Use the %s extension to:', 'strong-testimonials' ),
579
- sprintf(
580
- '<a href="%s" target="_blank">%s</a>',
581
- esc_url( WPMTST_STORE_URL . '/extensions/enhanced-emails?utm_source=st-lite&utm_campaign=upsell&utm_medium=enhanced-emails-upsell' ),
582
- esc_html__( 'Strong Testimonials: Enhanced Emails', 'strong-testimonials' )
583
- )
584
- );
585
- ?>
586
- <ul>
587
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'send a thank you email to your client once his testimonial\'s approved', 'strong-testimonials' ); ?></li>
588
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'increase brand loyalty by showing you really care about your clients', 'strong-testimonials' ); ?></li>
589
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'keep your clients engaged and increase your chances of selling more', 'strong-testimonials' ); ?></li>
590
- </ul>
591
- <p>
592
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=enhanced-emails-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
593
- </p>
594
- </div>
595
- <?php
596
- }
597
-
598
- public function add_enhanced_emails_upsell( $upsells ) {
599
- $upsell = sprintf(
600
- esc_html__( 'Send a thank-you email to your clients once their testimonial is approved using %s extension. This way, you increase brand loyalty and grow your chances of seeling more. ', 'strong-testimonials' ),
601
- sprintf(
602
- '<a href="%s" target="_blank">%s</a>',
603
- esc_url( WPMTST_STORE_URL . '/extensions/enhanced-emails?utm_source=st-lite&utm_campaign=upsell&utm_medium=enhanced-emails-general-upsell' ),
604
- esc_html__( 'Enhanced Emails', 'strong-testimonials' )
605
- )
606
- );
607
-
608
- $upsells[] = $upsell;
609
- return $upsells;
610
-
611
- }
612
-
613
- /*
614
- Inifinite Scroll
615
- */
616
- public function output_infinite_scroll_upsell() {
617
- ?>
618
- <div class="wpmtst-alert" style="margin-top: 10px">
619
- <?php
620
- printf(
621
- esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
622
- sprintf(
623
- '<a href="%s" target="_blank">%s</a>',
624
- esc_url( WPMTST_STORE_URL . '/extensions/infinite-scroll?utm_source=st-lite&utm_campaign=upsell&utm_medium=infinite-scroll-upsell' ),
625
- esc_html__( 'Strong Testimonials: Infinite Scroll', 'strong-testimonials' )
626
- )
627
- );
628
- ?>
629
- <ul>
630
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'display a fixed number of testimonials on first view and have more of them load when the user starts scrolling', 'strong-testimonials' ); ?></li>
631
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'reduce your page\'s initial load time, making your site faster in the process and not driving clients away because of a slow loading website', 'strong-testimonials' ); ?></li>
632
- </ul>
633
- <p>
634
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=infinite-scroll-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
635
- </p>
636
- </div>
637
- <?php
638
- }
639
-
640
- public function add_infinite_scroll_upsell( $upsells ) {
641
- $upsell = sprintf(
642
- esc_html__( 'Reduce your page’s initial load time - display a fixed number of testimonials on the first view and have more loading when you scroll down with %s extension.', 'strong-testimonials' ),
643
- sprintf(
644
- '<a href="%s" target="_blank">%s</a>',
645
- esc_url( WPMTST_STORE_URL . '/extensions/infinite-scroll?utm_source=st-lite&utm_campaign=upsell&utm_medium=infinite-scroll-general-upsell' ),
646
- esc_html__( 'Infinite Scroll', 'strong-testimonials' )
647
- )
648
- );
649
-
650
- $upsells[] = $upsell;
651
- return $upsells;
652
-
653
- }
654
-
655
- /*
656
- Filters
657
- */
658
- public function output_filters_upsell() {
659
- ?>
660
- <div class="wpmtst-alert" style="margin-top:1.5rem;">
661
- <?php
662
- printf(
663
- esc_html__( 'Use the %s extensions to:', 'strong-testimonials' ),
664
- sprintf(
665
- '<a href="%s" target="_blank">%s</a>',
666
- esc_url( WPMTST_STORE_URL . '/extensions/filters?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-filters-upsell' ),
667
- esc_html__( 'Strong Testimonials: Filters', 'strong-testimonials' )
668
- )
669
- );
670
- ?>
671
- <ul>
672
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'create category-like filters for your testimonials', 'strong-testimonials' ); ?></li>
673
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'group testimonials by associated product or service', 'strong-testimonials' ); ?></li>
674
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'help potential clients appreciate the great work you do by showcasing reviews from other clients', 'strong-testimonials' ); ?></li>
675
- </ul>
676
- <p>
677
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=filters-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
678
- </p>
679
- </div>
680
- <?php
681
- }
682
- public function add_filters_upsell( $upsells ) {
683
- $upsell = sprintf(
684
- esc_html__( 'Add category-like filters for testimonials, group testimonials by associated product/service, and help potential clients appreciate the great work you do by showcasing reviews from other clients with %s extension.', 'strong-testimonials' ),
685
- sprintf(
686
- '<a href="%s" target="_blank">%s</a>',
687
- esc_url( WPMTST_STORE_URL . '/extensions/filters?utm_source=st-lite&utm_campaign=upsell&utm_medium=filters-general-upsell' ),
688
- esc_html__( 'Filters', 'strong-testimonials' )
689
- )
690
- );
691
-
692
- $upsells[] = $upsell;
693
- return $upsells;
694
-
695
- }
696
-
697
- /*
698
- Assigments
699
- */
700
- public function register_assigment_tab( $active_tab, $url ) {
701
- $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
702
- printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
703
- esc_url( add_query_arg( 'tab', 'assignment', $url ) ),
704
- esc_attr( $tab == 'assignment' ? 'nav-tab-active' : '' ),
705
- esc_html_x( 'Assignment', 'adjective', 'strong-testimonials' ),
706
- '<span class="wpmtst-upsell-badge">PRO</span>'
707
- );
708
- }
709
- public function register_assigment_settings_page( $pages ) {
710
- $pages[ 'assignment' ] = array( $this, 'output_assigment_upsell' );
711
- return $pages;
712
- }
713
- public function output_assigment_upsell() {
714
- ?>
715
-
716
- <div class="wpmtst-alert" style="margin-top:1.5rem;">
717
- <?php
718
- printf(
719
- esc_html__( 'The %s extension is perfect if you want to easily assign testimonials to certain custom post types.', 'strong-testimonials' ),
720
- sprintf(
721
- '<a href="%s" target="_blank">%s</a>',
722
- esc_url( WPMTST_STORE_URL . '/extensions/assignment?utm_source=st-lite&utm_campaign=upsell&utm_medium=settings-tab-assigment-upsell' ),
723
- esc_html__( 'Strong Testimonials: Assignment', 'strong-testimonials' )
724
- )
725
- );
726
- ?>
727
- <p>
728
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=assigment-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
729
- </p>
730
- </div>
731
-
732
- <?php
733
- }
734
-
735
- /*
736
- Strong Testimonials PRO
737
- */
738
- public function register_st_pro_tab( $active_tab, $url ) {
739
- $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
740
- printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
741
- esc_url( add_query_arg( 'tab', 'single_testiomonial_template', $url ) ),
742
- esc_attr( $tab == 'single_testiomonial_template' ? 'nav-tab-active' : '' ),
743
- esc_html_x( 'Single Testimonial Template', 'adjective', 'strong-testimonials' ),
744
- '<span class="wpmtst-upsell-badge">PRO</span>'
745
- );
746
- }
747
- public function register_st_pro_page( $pages ) {
748
- $pages[ 'single_testiomonial_template' ] = array( $this, 'output_st_pro_upsell' );
749
- return $pages;
750
- }
751
- public function output_st_pro_upsell() {
752
- ?>
753
- <div class="wpmtst-alert" style="margin-top:1.5rem;">
754
- <?php
755
- printf(
756
- esc_html__( 'With %s you can:', 'strong-testimonials' ),
757
- sprintf(
758
- '<a href="%s" target="_blank">%s</a>',
759
- esc_url( WPMTST_STORE_URL . '/extensions/strong-testimonials-pro?utm_source=st-lite&utm_campaign=upsell&utm_medium=setting-tab-st-pro-upsell' ),
760
- esc_html__( 'Strong Testimonials PRO', 'strong-testimonials' )
761
- )
762
- );
763
- ?>
764
- <ul>
765
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Display a default image when no image has been provided for the testimonial;', 'strong-testimonials' ); ?></li>
766
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Use author initials as the testimonial image;', 'strong-testimonials' ); ?></li>
767
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Choose the HTML tag you’d like to use for your testimonial titles;', 'strong-testimonials' ); ?></li>
768
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Choose the Single Testimonial Template settings;', 'strong-testimonials' ); ?></li>
769
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Prefill testimonial forms from $_GET parameters;', 'strong-testimonials' ); ?></li>
770
- <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Show testimonial form only for logged-in users.', 'strong-testimonials' ); ?></li>
771
- </ul>
772
- <p>
773
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=setting-tab-st-pro-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
774
- </p>
775
- </div>
776
- <?php
777
- }
778
- public function add_pro_upsell( $upsells ) {
779
- $upsell = sprintf(
780
- esc_html__( '%s provides you with a lot of new functionalities in one plugin, such as choosing the HTML tag you’d like to display for your testimonial titles or prefilling the forms from $_GET parameters. Moreover, if no image is provided for your testimonial, you can display the author’s initials or a default picture. Get started with Strong Testimonials Pro today!', 'strong-testimonials' ),
781
- sprintf(
782
- '<a href="%s" target="_blank">%s</a>',
783
- esc_url( WPMTST_STORE_URL . '/extensions/strong-testimonials-pro?utm_source=st-lite&utm_campaign=upsell&utm_medium=st-pro-general-upsell' ),
784
- esc_html__( 'Strong Testimonials PRO', 'strong-testimonials' )
785
- )
786
- );
787
-
788
- $upsells[] = $upsell;
789
- return $upsells;
790
-
791
- }
792
-
793
- /*
794
- Properties
795
- */
796
- public function register_properties_tab( $active_tab, $url ) {
797
- $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
798
- printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
799
- esc_url( add_query_arg( 'tab', 'properties', $url ) ),
800
- esc_attr( $tab == 'properties' ? 'nav-tab-active' : '' ),
801
- esc_html_x( 'Properties', 'adjective', 'strong-testimonials' ),
802
- '<span class="wpmtst-upsell-badge">PRO</span>'
803
- );
804
- }
805
- public function register_properties_page( $pages ) {
806
- $pages[ 'properties' ] = array( $this, 'output_properties_upsell' );
807
- return $pages;
808
- }
809
- public function output_properties_upsell() {
810
- ?>
811
- <div class="wpmtst-alert" style="margin-top:1.5rem;">
812
- <?php
813
- printf(
814
- esc_html__( 'Easily customize default testimonial attributes such as labels, permalink structure, icons and more with the %s extension.', 'strong-testimonials' ),
815
- sprintf(
816
- '<a href="%s" target="_blank">%s</a>',
817
- esc_url( WPMTST_STORE_URL . '/extensions/properties?utm_source=st-lite&utm_campaign=upsell&utm_medium=settings-tab-properties-upsell' ),
818
- esc_html__( 'Strong Testimonials: Properties', 'strong-testimonials' )
819
- )
820
- );
821
- ?>
822
- <p>
823
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=properties-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
824
- </p>
825
- </div>
826
- <?php
827
- }
828
-
829
- }
830
-
831
- new Strong_Testimonials_Upsell();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Upsell
4
+ *
5
+ * @since 2.38
6
+ */
7
+ class Strong_Testimonials_Upsell {
8
+
9
+ public $store_upgrade_url;
10
+
11
+ public function __construct() {
12
+ $this->set_store_upgrade_url();
13
+ $options = get_option( 'wpmtst_options' );
14
+
15
+ if ( isset( $options['disable_upsells'] ) && $options['disable_upsells'] ) {
16
+ return;
17
+ }
18
+
19
+ add_action( 'wpmtst_admin_after_settings_form', array( $this, 'general_upsell' ) );
20
+
21
+ if ( ! defined( 'WPMTST_ROLE_MANAGEMENT_VERSION' ) ) {
22
+ add_action( 'wpmtst_settings_tabs', array( $this, 'register_role_manager' ), 4, 2 );
23
+ add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_rm_settings_page' ) );
24
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_role_upsell' ), 20 );
25
+ }
26
+
27
+ if ( ! defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
28
+ add_action( 'wpmtst_after_form_type_selection', array( $this, 'output_country_selector_upsell' ) );
29
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_country_selector_upsell' ), 95 );
30
+ }
31
+
32
+ if ( ! defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
33
+ add_action( 'wpmtst_after_form_type_selection', array( $this, 'output_custom_fields_upsell' ) );
34
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_custom_fields_upsell' ), 90 );
35
+ }
36
+
37
+ if ( ! defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
38
+ add_action( 'wpmtst_before_fields_settings', array( $this, 'output_multiple_form_upsell' ) );
39
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_multiple_form_upsell' ), 30 );
40
+ }
41
+
42
+ if ( ! defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
43
+ add_action( 'wpmtst_view_editor_after_groups', array( $this, 'output_review_markup_upsell' ) );
44
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_review_markup_upsell' ), 15 );
45
+ add_action( 'wpmtst_settings_tabs', array( $this, 'register_review_markup' ), 4, 2 );
46
+ add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_review_markup_settings_page' ) );
47
+ }
48
+
49
+ if ( ! defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
50
+ add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'output_advanced_views_upsell' ) );
51
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_advanced_views_upsell' ), 35 );
52
+ }
53
+
54
+ if ( ! defined( 'WPMTST_CAPTCHA_VERSION' ) ) {
55
+ add_action( 'wpmtst_fields_before_fields_editor_preview', array( $this, 'output_captcha_editor_upsell' ) );
56
+ add_action( 'wpmtst_after_form_settings', array( $this, 'output_captcha_form_settings_upsell' ) );
57
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_captcha_upsell' ), 40 );
58
+ }
59
+
60
+ if ( ! defined( 'WPMTST_PRO_TEMPLATES_VERSION' ) ) {
61
+ add_action( 'wpmtst_views_after_template_list', array( $this, 'output_pro_templates_upsell' ) );
62
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_pro_templates_upsell' ), 20 );
63
+ }
64
+
65
+ if ( ! defined( 'WPMTST_EMAILS_VERSION' ) ) {
66
+ add_action( 'wpmtst_after_mail_notification_settings', array( $this, 'output_enhanced_emails_upsell' ) );
67
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_enhanced_emails_upsell' ), 45 );
68
+ }
69
+
70
+ if ( ! defined( 'WPMTST_INFINITE_SCROLL_VERSION' ) ) {
71
+ add_action( 'wpmtst_view_editor_pagination_row_end', array( $this, 'output_infinite_scroll_upsell' ) );
72
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_infinite_scroll_upsell' ), 50 );
73
+ }
74
+
75
+ if ( ! defined( 'WPMTST_FILTERS_VERSION' ) ) {
76
+ add_action( 'wpmtst_after_style_view_section', array( $this, 'output_filters_upsell' ) );
77
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_filters_upsell' ), 15 );
78
+ }
79
+
80
+ if ( ! defined( 'WPMTST_PRO_VERSION' ) ) {
81
+ add_action( 'wpmtst_settings_tabs', array( $this, 'register_st_pro_tab' ), 4, 2 );
82
+ add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_st_pro_page' ) );
83
+ add_filter( 'wpmtst_general_upsell_items', array( $this, 'add_pro_upsell' ), 10 );
84
+ }
85
+
86
+ if ( ! defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
87
+ add_action( 'wpmtst_settings_tabs', array( $this, 'register_assigment_tab' ), 4, 2 );
88
+ add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_assigment_settings_page' ) );
89
+ }
90
+
91
+ if ( ! defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
92
+ add_action( 'wpmtst_settings_tabs', array( $this, 'register_properties_tab' ), 4, 2 );
93
+ add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_properties_page' ) );
94
+ }
95
+
96
+
97
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
98
+ }
99
+
100
+ public function add_meta_boxes() {
101
+
102
+
103
+ if ( ! defined( 'WPMTST_IMPORTER_VERSION' ) ) {
104
+ add_meta_box(
105
+ 'wpmtst-importer-upsell', // Unique ID
106
+ esc_html__( 'Import', 'strong-testimonials' ), // Title
107
+ array( $this, 'output_importer_upsell' ), // Callback function
108
+ 'wpm-testimonial', // Admin page (or post type)
109
+ 'side', // Context
110
+ 'high' // Priority
111
+ );
112
+ }
113
+
114
+ }
115
+
116
+ public function set_store_upgrade_url() {
117
+
118
+ $this->store_upgrade_url = WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell';
119
+
120
+ //append license key
121
+ $license = trim( get_option( 'strong_testimonials_license_key' ) );
122
+ if ( $license ) {
123
+ $this->store_upgrade_url .= '&license=' . $license;
124
+ }
125
+
126
+ }
127
+
128
+ public function output_importer_upsell() {
129
+ ?>
130
+ <div class="wpmtst-alert">
131
+ <h2><?php esc_html_e( 'Automatically pull in & display new reviews as your customers leave their feedback on external platforms', 'strong-testimonials' ) ?></h2>
132
+ <p><?php esc_html_e( 'Upgrade today and get the ability to import testimonials from:', 'strong-testimonials' ) ?></p>
133
+ <ul>
134
+ <li><?php esc_html_e( 'Facebook', 'strong-testimonials' ) ?></li>
135
+ <li><?php esc_html_e( 'Google', 'strong-testimonials' ) ?></li>
136
+ <li><?php esc_html_e( 'Yelp', 'strong-testimonials' ) ?></li>
137
+ <li><?php esc_html_e( 'Zomato', 'strong-testimonials' ) ?></li>
138
+ <li><?php esc_html_e( 'WooCommerce', 'strong-testimonials' ) ?></li>
139
+ <li><?php esc_html_e( 'and more...', 'strong-testimonials' ) ?></li>
140
+ </ul>
141
+ <p>
142
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=importer-metabox' ); ?>"><?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?></a>
143
+ </p>
144
+ </div>
145
+ <?php
146
+ }
147
+
148
+ public function general_upsell(){
149
+
150
+ $general_upsells = apply_filters( 'wpmtst_general_upsell_items', array() );
151
+
152
+ if ( ! empty( $general_upsells ) ) {
153
+
154
+ ?>
155
+
156
+ <div class="wpmtst-settings-upsell">
157
+ <div class="wpmtst-alert">
158
+ <h3><?php esc_html_e( 'Upgrade now', 'strong-testimonials' ) ?></h3>
159
+ <ul>
160
+ <?php foreach ( $general_upsells as $general_upsell ) { ?>
161
+ <li>
162
+ <span>
163
+ <?php echo wp_kses_post($general_upsell); ?>
164
+ </span>
165
+ </li>
166
+ <?php } ?>
167
+ </ul>
168
+
169
+ <a href="<?php echo esc_url(WPMTST_STORE_URL . '/pricing?utm_source=st-lite&utm_campaign=upsell&utm_medium=general-settings-upsell'); ?>"
170
+ target="_blank" class="button button-primary button-hero"
171
+ style="width:100%;display:block;margin-top:20px;text-align:center;"><?php echo esc_html__('Upgrade now', 'strong-testimonials'); ?></a>
172
+
173
+ </div>
174
+ </div>
175
+
176
+ <?php
177
+ }
178
+ }
179
+
180
+ // Role Manager upsell
181
+ public function register_role_manager( $active_tab, $url ) {
182
+ $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
183
+ printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
184
+ esc_url( add_query_arg( 'tab', 'access', $url ) ),
185
+ esc_attr( $tab == 'access' ? 'nav-tab-active' : '' ),
186
+ esc_html_x( 'Role Management', 'adjective', 'strong-testimonials' ),
187
+ '<span class="wpmtst-upsell-badge">PRO</span>'
188
+ );
189
+ }
190
+
191
+ public function register_rm_settings_page( $pages ) {
192
+ $pages[ 'access' ] = array( $this, 'output_role_manager_page' );
193
+ return $pages;
194
+ }
195
+
196
+ public function output_role_manager_page(){
197
+ ?>
198
+ <div class="wpmtst-alert">
199
+ <?php
200
+ printf(
201
+ esc_html__( 'Control who approves testimonials or who has access to the plugins’ settings panel with %s extension. Get total granular control over who has access to your testimonials.', 'strong-testimonials' ),
202
+ sprintf(
203
+ '<a href="%s" target="_blank">%s</a>',
204
+ esc_url( WPMTST_STORE_URL . '/extensions/role-management?utm_source=st-lite&utm_campaign=upsell&utm_medium=role-management-tab-upsell' ),
205
+ esc_html__( 'Role Management', 'strong-testimonials' )
206
+ )
207
+ );
208
+ ?>
209
+ <p>
210
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=role-management-tab-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
211
+ </p>
212
+ </div>
213
+ <?php
214
+ }
215
+
216
+ public function add_role_upsell( $upsells ) {
217
+ $upsell = sprintf(
218
+ esc_html__( 'Control who approves testimonials or who has access to the plugins’ settings panel with %s extension. Get total granular control over who has access to your testimonials.', 'strong-testimonials' ),
219
+ sprintf(
220
+ '<a href="%s" target="_blank">%s</a>',
221
+ esc_url( WPMTST_STORE_URL . '/extensions/role-management?utm_source=st-lite&utm_campaign=upsell&utm_medium=role-management-general-upsell' ),
222
+ esc_html__( 'Role Management', 'strong-testimonials' )
223
+ )
224
+ );
225
+
226
+ $upsells[] = $upsell;
227
+ return $upsells;
228
+ }
229
+
230
+ /*
231
+ Country Selector
232
+ */
233
+ public function output_country_selector_upsell() {
234
+ ?>
235
+ <div class="wpmtst-alert" style="margin-top: 10px">
236
+ <?php esc_html_e( 'Want to know where are your customers located?', 'strong-testimonials' ); ?>
237
+ <br/>
238
+ <?php
239
+ printf(
240
+ esc_html__( 'Install the %s extension', 'strong-testimonials' ),
241
+ sprintf(
242
+ '<a href="%s" target="_blank">%s</a>',
243
+ esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ),
244
+ esc_html__( 'Strong Testimonials: Country Selector', 'strong-testimonials' )
245
+ )
246
+ );
247
+ ?>
248
+ <p>
249
+
250
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
251
+ </p>
252
+ </div>
253
+ <?php
254
+ }
255
+
256
+ public function add_country_selector_upsell( $upsells ) {
257
+ $upsell = sprintf(
258
+ esc_html__( 'Show where your customers are located with the %s extension. ', 'strong-testimonials' ),
259
+ sprintf(
260
+ '<a href="%s" target="_blank">%s</a>',
261
+ esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=country-selector-general-upsell' ),
262
+ esc_html__( 'Country Selector', 'strong-testimonials' )
263
+ )
264
+ );
265
+
266
+ $upsells[] = $upsell;
267
+ return $upsells;
268
+ }
269
+
270
+ /*
271
+ Custom fields
272
+ */
273
+ public function output_custom_fields_upsell() {
274
+ ?>
275
+ <div class="wpmtst-alert" style="margin-top: 10px">
276
+ <?php esc_html_e( 'Know your customers by having access to more advanced custom fields.', 'strong-testimonials' ); ?>
277
+ <br/>
278
+ <?php
279
+ printf(
280
+ esc_html__( 'Install the %s extension', 'strong-testimonials' ),
281
+ sprintf(
282
+ '<a href="%s" target="_blank">%s</a>',
283
+ esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ),
284
+ esc_html__( 'Strong Testimonials: Custom Fields', 'strong-testimonials' )
285
+ )
286
+ );
287
+ ?>
288
+ <p>
289
+
290
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
291
+ </p>
292
+ </div>
293
+ <?php
294
+ }
295
+
296
+ public function add_custom_fields_upsell( $upsells ) {
297
+ $upsell = sprintf(
298
+ esc_html__( 'Get to know your customers by installing our %s extension.', 'strong-testimonials' ),
299
+ sprintf(
300
+ '<a href="%s" target="_blank">%s</a>',
301
+ esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=custom-fields-general-upsell' ),
302
+ esc_html__( 'Custom Fields', 'strong-testimonials' )
303
+ )
304
+ );
305
+
306
+ $upsells[] = $upsell;
307
+ return $upsells;
308
+ }
309
+
310
+ /*
311
+ * Multiple forms
312
+ */
313
+ public function output_multiple_form_upsell() {
314
+ ?>
315
+ <div class="wpmtst-alert" style="margin-top: 10px">
316
+ <?php
317
+ printf(
318
+ esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
319
+ sprintf(
320
+ '<a href="%s" target="_blank">%s</a>',
321
+ esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ),
322
+ esc_html__( 'Strong Testimonials: Multiple Forms', 'strong-testimonials' )
323
+ )
324
+ );
325
+ ?>
326
+ <p>
327
+
328
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
329
+ </p>
330
+ </div>
331
+ <?php
332
+ }
333
+
334
+ public function add_multiple_form_upsell( $upsells ) {
335
+ $upsell = sprintf(
336
+ esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
337
+ sprintf(
338
+ '<a href="%s" target="_blank">%s</a>',
339
+ esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=multiple-forms-general-upsell' ),
340
+ esc_html__( 'Multiple Forms', 'strong-testimonials' )
341
+ )
342
+ );
343
+
344
+ $upsells[] = $upsell;
345
+ return $upsells;
346
+ }
347
+
348
+ /*
349
+ * Review Markup
350
+ */
351
+ public function register_review_markup( $active_tab, $url ) {
352
+ $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
353
+ printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
354
+ esc_url( add_query_arg( 'tab', 'review-markup', $url ) ),
355
+ esc_attr( $tab == 'review-markup' ? 'nav-tab-active' : '' ),
356
+ esc_html_x( 'Review Markup', 'adjective', 'strong-testimonials' ),
357
+ '<span class="wpmtst-upsell-badge">PRO</span>'
358
+ );
359
+ }
360
+ public function register_review_markup_settings_page( $pages ) {
361
+ $pages[ 'review-markup' ] = array( $this, 'output_review_markup_upsell' );
362
+ return $pages;
363
+ }
364
+ public function output_review_markup_upsell() {
365
+ ?>
366
+ <div class="wpmtst-alert" style="margin-top: 10px">
367
+ <?php
368
+ printf(
369
+ esc_html__( 'Add SEO-friendly & Schema.org compliant Testimonials with our %s extension.', 'strong-testimonials' ),
370
+ sprintf(
371
+ '<a href="%s" target="_blank">%s</a>',
372
+ esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ),
373
+ esc_html__( 'Strong Testimonials: Review Markup', 'strong-testimonials' )
374
+ )
375
+ );
376
+ ?>
377
+ <ul>
378
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'With this extensions, search engines will display star ratings in search results for your site.', 'strong-testimonials' ); ?></li>
379
+ </ul>
380
+ <p>
381
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
382
+ </p>
383
+ </div>
384
+ <?php
385
+ }
386
+
387
+ public function add_review_markup_upsell( $upsells ) {
388
+ $upsell = sprintf(
389
+ esc_html__( 'Add SEO-friendly & Schema.org compliant Testimonials with our %s extension.', 'strong-testimonials' ),
390
+ sprintf(
391
+ '<a href="%s" target="_blank">%s</a>',
392
+ esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=review-markup-general-upsell' ),
393
+ esc_html__( 'Review Markup', 'strong-testimonials' )
394
+ )
395
+ );
396
+
397
+ $upsells[] = $upsell;
398
+ return $upsells;
399
+ }
400
+
401
+ /*
402
+ Advanced Views
403
+ */
404
+ public function output_advanced_views_upsell() {
405
+ ?>
406
+ <div class="wpmtst-alert" style="margin-top: 1.5rem">
407
+ <?php
408
+ printf(
409
+ esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
410
+ sprintf(
411
+ '<a href="%s" target="_blank">%s</a>',
412
+ esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ),
413
+ esc_html__( 'Strong Testimonials: Advanced Views', 'strong-testimonials' )
414
+ )
415
+ );
416
+
417
+ ?>
418
+ <ul>
419
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'filter & display testimonials based on their rating or on a pre-defined condition.', 'strong-testimonials' ); ?></li>
420
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'easily define the display order of your testimonial fields. Re-order the name, image, url and testimonial content fields through drag & drop.', 'strong-testimonials' ); ?></li>
421
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'edit, in real time, the way your testimonials will look on your site. Stop loosing clients because of poor design.', 'strong-testimonials' ); ?></li>
422
+
423
+ </ul>
424
+ <p>
425
+
426
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
427
+ </p>
428
+ </div>
429
+ <?php
430
+ }
431
+
432
+ public function add_advanced_views_upsell( $upsells ) {
433
+ $upsell = sprintf(
434
+ esc_html__( 'Start filtering, changing the order, or even editing your testimonials in real-time with the %s extension.', 'strong-testimonials' ),
435
+ sprintf(
436
+ '<a href="%s" target="_blank">%s</a>',
437
+ esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=advanced-views-general-upsell' ),
438
+ esc_html__( 'Advanced Views', 'strong-testimonials' )
439
+ )
440
+ );
441
+
442
+ $upsells[] = $upsell;
443
+ return $upsells;
444
+
445
+ }
446
+
447
+ /*
448
+ Captcha extensio
449
+ */
450
+ public function output_captcha_editor_upsell() {
451
+ ?>
452
+ <div class="wpmtst-alert">
453
+ <?php
454
+ printf(
455
+ esc_html__( 'Protect your form against spam with the %s extension.', 'strong-testimonials' ),
456
+ sprintf(
457
+ '<a href="%s" target="_blank">%s</a>',
458
+ esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
459
+ esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
460
+ )
461
+ );
462
+ ?>
463
+ <p>
464
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
465
+ </p>
466
+ </div>
467
+ <?php
468
+ }
469
+
470
+ public function output_captcha_form_settings_upsell() {
471
+ ?>
472
+ <hr>
473
+
474
+ <h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
475
+
476
+ <div class="wpmtst-alert">
477
+ <?php
478
+ printf(
479
+ esc_html__( 'Protect your form against spam. Add Google reCAPTCHA or honeypot anti-spam with the %s extension.', 'strong-testimonials' ),
480
+ sprintf(
481
+ '<a href="%s" target="_blank">%s</a>',
482
+ esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
483
+ esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
484
+ )
485
+ );
486
+ ?>
487
+
488
+ <table class="form-table" cellpadding="0" cellspacing="0">
489
+ <tr>
490
+ <th scope="row">
491
+ <label>
492
+ <?php esc_html_e( 'Honeypot', 'strong-testimonials' ); ?>
493
+ </label>
494
+ </th>
495
+ <td>
496
+ <p>
497
+ <?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
498
+ </p>
499
+ </td>
500
+ </tr>
501
+ <tr valign="top">
502
+ <th scope="row">
503
+ <label>
504
+ <a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
505
+ </label>
506
+ </th>
507
+ <td>
508
+ <?php esc_html_e( 'Google reCAPTCHA prompts visitors to check a box to prove that they’re not a robot before they submit the form.', 'strong-testimonials' ); ?>
509
+ <br/>
510
+ <?php esc_html_e( 'In some cases, they’re prompted to complete another task, like identify a string of letters.', 'strong-testimonials' ); ?>
511
+ <br/>
512
+ <?php esc_html_e( 'This method makes it difficult for spambots to complete form submissions.', 'strong-testimonials' ); ?>
513
+ </td>
514
+ </tr>
515
+ </table>
516
+ <p>
517
+ <a class="button button-primary" target="_blank"
518
+ href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
519
+ </p>
520
+ </div>
521
+ <?php
522
+ }
523
+
524
+ public function add_captcha_upsell( $upsells ) {
525
+ $upsell = sprintf(
526
+ esc_html__( 'Protect your form against spam. Add Google ReCaptcha or honeypot anti-spam with the %s extension.', 'strong-testimonials' ),
527
+ sprintf(
528
+ '<a href="%s" target="_blank">%s</a>',
529
+ esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-captcha-general-upsell' ),
530
+ esc_html__( 'Captcha', 'strong-testimonials' )
531
+ )
532
+ );
533
+
534
+ $upsells[] = $upsell;
535
+ return $upsells;
536
+
537
+ }
538
+
539
+ /*
540
+ PRO Templates
541
+ */
542
+ public function output_pro_templates_upsell() {
543
+ ?>
544
+ <div class="wpmtst-alert">
545
+ <?php
546
+ echo esc_html__( 'Impress your potential clients with profesionally designed, pixel-perfect templates that increase your chances of standing out and landing more clients.', 'strong-testimonials' )
547
+ ?>
548
+ <p>
549
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-pro-templates-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
550
+ </p>
551
+ </div>
552
+ <?php
553
+ }
554
+
555
+ public function add_pro_templates_upsell( $upsells ) {
556
+ $upsell = sprintf(
557
+ esc_html__( 'Get access to professionally designed testimonial templates with the %s extension.', 'strong-testimonials' ),
558
+ sprintf(
559
+ '<a href="%s" target="_blank">%s</a>',
560
+ esc_url( WPMTST_STORE_URL . '/extensions/pro-templates?utm_source=st-lite&utm_campaign=upsell&utm_medium=pro-templates-general-upsell' ),
561
+ esc_html__( 'Pro Templates', 'strong-testimonials' )
562
+ )
563
+ );
564
+
565
+ $upsells[] = $upsell;
566
+ return $upsells;
567
+
568
+ }
569
+
570
+ /*
571
+ Enhanced Emails
572
+ */
573
+ public function output_enhanced_emails_upsell() {
574
+ ?>
575
+ <div class="wpmtst-alert" style="margin-top: 10px">
576
+ <?php
577
+ printf(
578
+ esc_html__( 'Use the %s extension to:', 'strong-testimonials' ),
579
+ sprintf(
580
+ '<a href="%s" target="_blank">%s</a>',
581
+ esc_url( WPMTST_STORE_URL . '/extensions/enhanced-emails?utm_source=st-lite&utm_campaign=upsell&utm_medium=enhanced-emails-upsell' ),
582
+ esc_html__( 'Strong Testimonials: Enhanced Emails', 'strong-testimonials' )
583
+ )
584
+ );
585
+ ?>
586
+ <ul>
587
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'send a thank you email to your client once his testimonial\'s approved', 'strong-testimonials' ); ?></li>
588
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'increase brand loyalty by showing you really care about your clients', 'strong-testimonials' ); ?></li>
589
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'keep your clients engaged and increase your chances of selling more', 'strong-testimonials' ); ?></li>
590
+ </ul>
591
+ <p>
592
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=enhanced-emails-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
593
+ </p>
594
+ </div>
595
+ <?php
596
+ }
597
+
598
+ public function add_enhanced_emails_upsell( $upsells ) {
599
+ $upsell = sprintf(
600
+ esc_html__( 'Send a thank-you email to your clients once their testimonial is approved using %s extension. This way, you increase brand loyalty and grow your chances of seeling more. ', 'strong-testimonials' ),
601
+ sprintf(
602
+ '<a href="%s" target="_blank">%s</a>',
603
+ esc_url( WPMTST_STORE_URL . '/extensions/enhanced-emails?utm_source=st-lite&utm_campaign=upsell&utm_medium=enhanced-emails-general-upsell' ),
604
+ esc_html__( 'Enhanced Emails', 'strong-testimonials' )
605
+ )
606
+ );
607
+
608
+ $upsells[] = $upsell;
609
+ return $upsells;
610
+
611
+ }
612
+
613
+ /*
614
+ Inifinite Scroll
615
+ */
616
+ public function output_infinite_scroll_upsell() {
617
+ ?>
618
+ <div class="wpmtst-alert" style="margin-top: 10px">
619
+ <?php
620
+ printf(
621
+ esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
622
+ sprintf(
623
+ '<a href="%s" target="_blank">%s</a>',
624
+ esc_url( WPMTST_STORE_URL . '/extensions/infinite-scroll?utm_source=st-lite&utm_campaign=upsell&utm_medium=infinite-scroll-upsell' ),
625
+ esc_html__( 'Strong Testimonials: Infinite Scroll', 'strong-testimonials' )
626
+ )
627
+ );
628
+ ?>
629
+ <ul>
630
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'display a fixed number of testimonials on first view and have more of them load when the user starts scrolling', 'strong-testimonials' ); ?></li>
631
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'reduce your page\'s initial load time, making your site faster in the process and not driving clients away because of a slow loading website', 'strong-testimonials' ); ?></li>
632
+ </ul>
633
+ <p>
634
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=infinite-scroll-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
635
+ </p>
636
+ </div>
637
+ <?php
638
+ }
639
+
640
+ public function add_infinite_scroll_upsell( $upsells ) {
641
+ $upsell = sprintf(
642
+ esc_html__( 'Reduce your page’s initial load time - display a fixed number of testimonials on the first view and have more loading when you scroll down with %s extension.', 'strong-testimonials' ),
643
+ sprintf(
644
+ '<a href="%s" target="_blank">%s</a>',
645
+ esc_url( WPMTST_STORE_URL . '/extensions/infinite-scroll?utm_source=st-lite&utm_campaign=upsell&utm_medium=infinite-scroll-general-upsell' ),
646
+ esc_html__( 'Infinite Scroll', 'strong-testimonials' )
647
+ )
648
+ );
649
+
650
+ $upsells[] = $upsell;
651
+ return $upsells;
652
+
653
+ }
654
+
655
+ /*
656
+ Filters
657
+ */
658
+ public function output_filters_upsell() {
659
+ ?>
660
+ <div class="wpmtst-alert" style="margin-top:1.5rem;">
661
+ <?php
662
+ printf(
663
+ esc_html__( 'Use the %s extensions to:', 'strong-testimonials' ),
664
+ sprintf(
665
+ '<a href="%s" target="_blank">%s</a>',
666
+ esc_url( WPMTST_STORE_URL . '/extensions/filters?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-filters-upsell' ),
667
+ esc_html__( 'Strong Testimonials: Filters', 'strong-testimonials' )
668
+ )
669
+ );
670
+ ?>
671
+ <ul>
672
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'create category-like filters for your testimonials', 'strong-testimonials' ); ?></li>
673
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'group testimonials by associated product or service', 'strong-testimonials' ); ?></li>
674
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'help potential clients appreciate the great work you do by showcasing reviews from other clients', 'strong-testimonials' ); ?></li>
675
+ </ul>
676
+ <p>
677
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=filters-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
678
+ </p>
679
+ </div>
680
+ <?php
681
+ }
682
+ public function add_filters_upsell( $upsells ) {
683
+ $upsell = sprintf(
684
+ esc_html__( 'Add category-like filters for testimonials, group testimonials by associated product/service, and help potential clients appreciate the great work you do by showcasing reviews from other clients with %s extension.', 'strong-testimonials' ),
685
+ sprintf(
686
+ '<a href="%s" target="_blank">%s</a>',
687
+ esc_url( WPMTST_STORE_URL . '/extensions/filters?utm_source=st-lite&utm_campaign=upsell&utm_medium=filters-general-upsell' ),
688
+ esc_html__( 'Filters', 'strong-testimonials' )
689
+ )
690
+ );
691
+
692
+ $upsells[] = $upsell;
693
+ return $upsells;
694
+
695
+ }
696
+
697
+ /*
698
+ Assigments
699
+ */
700
+ public function register_assigment_tab( $active_tab, $url ) {
701
+ $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
702
+ printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
703
+ esc_url( add_query_arg( 'tab', 'assignment', $url ) ),
704
+ esc_attr( $tab == 'assignment' ? 'nav-tab-active' : '' ),
705
+ esc_html_x( 'Assignment', 'adjective', 'strong-testimonials' ),
706
+ '<span class="wpmtst-upsell-badge">PRO</span>'
707
+ );
708
+ }
709
+ public function register_assigment_settings_page( $pages ) {
710
+ $pages[ 'assignment' ] = array( $this, 'output_assigment_upsell' );
711
+ return $pages;
712
+ }
713
+ public function output_assigment_upsell() {
714
+ ?>
715
+
716
+ <div class="wpmtst-alert" style="margin-top:1.5rem;">
717
+ <?php
718
+ printf(
719
+ esc_html__( 'The %s extension is perfect if you want to easily assign testimonials to certain custom post types.', 'strong-testimonials' ),
720
+ sprintf(
721
+ '<a href="%s" target="_blank">%s</a>',
722
+ esc_url( WPMTST_STORE_URL . '/extensions/assignment?utm_source=st-lite&utm_campaign=upsell&utm_medium=settings-tab-assigment-upsell' ),
723
+ esc_html__( 'Strong Testimonials: Assignment', 'strong-testimonials' )
724
+ )
725
+ );
726
+ ?>
727
+ <p>
728
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=assigment-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
729
+ </p>
730
+ </div>
731
+
732
+ <?php
733
+ }
734
+
735
+ /*
736
+ Strong Testimonials PRO
737
+ */
738
+ public function register_st_pro_tab( $active_tab, $url ) {
739
+ $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
740
+ printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
741
+ esc_url( add_query_arg( 'tab', 'single_testiomonial_template', $url ) ),
742
+ esc_attr( $tab == 'single_testiomonial_template' ? 'nav-tab-active' : '' ),
743
+ esc_html_x( 'Single Testimonial Template', 'adjective', 'strong-testimonials' ),
744
+ '<span class="wpmtst-upsell-badge">PRO</span>'
745
+ );
746
+ }
747
+ public function register_st_pro_page( $pages ) {
748
+ $pages[ 'single_testiomonial_template' ] = array( $this, 'output_st_pro_upsell' );
749
+ return $pages;
750
+ }
751
+ public function output_st_pro_upsell() {
752
+ ?>
753
+ <div class="wpmtst-alert" style="margin-top:1.5rem;">
754
+ <?php
755
+ printf(
756
+ esc_html__( 'With %s you can:', 'strong-testimonials' ),
757
+ sprintf(
758
+ '<a href="%s" target="_blank">%s</a>',
759
+ esc_url( WPMTST_STORE_URL . '/extensions/strong-testimonials-pro?utm_source=st-lite&utm_campaign=upsell&utm_medium=setting-tab-st-pro-upsell' ),
760
+ esc_html__( 'Strong Testimonials PRO', 'strong-testimonials' )
761
+ )
762
+ );
763
+ ?>
764
+ <ul>
765
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Display a default image when no image has been provided for the testimonial;', 'strong-testimonials' ); ?></li>
766
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Use author initials as the testimonial image;', 'strong-testimonials' ); ?></li>
767
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Choose the HTML tag you’d like to use for your testimonial titles;', 'strong-testimonials' ); ?></li>
768
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Choose the Single Testimonial Template settings;', 'strong-testimonials' ); ?></li>
769
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Prefill testimonial forms from $_GET parameters;', 'strong-testimonials' ); ?></li>
770
+ <li class="wpmtst-upsell-checkmark"><?php esc_html_e( 'Show testimonial form only for logged-in users.', 'strong-testimonials' ); ?></li>
771
+ </ul>
772
+ <p>
773
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=setting-tab-st-pro-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
774
+ </p>
775
+ </div>
776
+ <?php
777
+ }
778
+ public function add_pro_upsell( $upsells ) {
779
+ $upsell = sprintf(
780
+ esc_html__( '%s provides you with a lot of new functionalities in one plugin, such as choosing the HTML tag you’d like to display for your testimonial titles or prefilling the forms from $_GET parameters. Moreover, if no image is provided for your testimonial, you can display the author’s initials or a default picture. Get started with Strong Testimonials Pro today!', 'strong-testimonials' ),
781
+ sprintf(
782
+ '<a href="%s" target="_blank">%s</a>',
783
+ esc_url( WPMTST_STORE_URL . '/extensions/strong-testimonials-pro?utm_source=st-lite&utm_campaign=upsell&utm_medium=st-pro-general-upsell' ),
784
+ esc_html__( 'Strong Testimonials PRO', 'strong-testimonials' )
785
+ )
786
+ );
787
+
788
+ $upsells[] = $upsell;
789
+ return $upsells;
790
+
791
+ }
792
+
793
+ /*
794
+ Properties
795
+ */
796
+ public function register_properties_tab( $active_tab, $url ) {
797
+ $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
798
+ printf( '<a href="%s" class="nav-tab %s">%s%s</a>',
799
+ esc_url( add_query_arg( 'tab', 'properties', $url ) ),
800
+ esc_attr( $tab == 'properties' ? 'nav-tab-active' : '' ),
801
+ esc_html_x( 'Properties', 'adjective', 'strong-testimonials' ),
802
+ '<span class="wpmtst-upsell-badge">PRO</span>'
803
+ );
804
+ }
805
+ public function register_properties_page( $pages ) {
806
+ $pages[ 'properties' ] = array( $this, 'output_properties_upsell' );
807
+ return $pages;
808
+ }
809
+ public function output_properties_upsell() {
810
+ ?>
811
+ <div class="wpmtst-alert" style="margin-top:1.5rem;">
812
+ <?php
813
+ printf(
814
+ esc_html__( 'Easily customize default testimonial attributes such as labels, permalink structure, icons and more with the %s extension.', 'strong-testimonials' ),
815
+ sprintf(
816
+ '<a href="%s" target="_blank">%s</a>',
817
+ esc_url( WPMTST_STORE_URL . '/extensions/properties?utm_source=st-lite&utm_campaign=upsell&utm_medium=settings-tab-properties-upsell' ),
818
+ esc_html__( 'Strong Testimonials: Properties', 'strong-testimonials' )
819
+ )
820
+ );
821
+ ?>
822
+ <p>
823
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=properties-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
824
+ </p>
825
+ </div>
826
+ <?php
827
+ }
828
+
829
+ }
830
+
831
+ new Strong_Testimonials_Upsell();
admin/class-strong-views-list-table.php CHANGED
@@ -1,276 +1,276 @@
1
- <?php
2
- /**
3
- * Admin List Table
4
- *
5
- * @version 0.2.1
6
- */
7
-
8
- class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
-
10
- public $stickies;
11
-
12
- /**
13
- * Message to be displayed when there are no items
14
- *
15
- * @since 0.2.1
16
- * @access public
17
- */
18
- public function no_items() {
19
- esc_html_e( 'No views found.', 'strong-testimonials' );
20
- }
21
-
22
- public function prepare_list( $data = array() ) {
23
- $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
-
25
- $columns = $this->get_columns();
26
- $hidden = $this->get_hidden_columns();
27
- $sortable = $this->get_sortable_columns();
28
-
29
- $this->_column_headers = array( $columns, $hidden, $sortable );
30
-
31
- // Sort the list
32
- if ( isset( $_GET['orderby'] ) ) {
33
- usort( $data, array( &$this, 'usort_reorder' ) );
34
- }
35
- $data = $this->move_sticky( $data );
36
- $data = apply_filters('wpmtst_list_views', $data);
37
- if ( isset( $_GET['mode'] ) && ! empty( $_GET['mode'] ) && $_GET['mode'] !== 'all' ) {
38
- $data = $this->filter_data( sanitize_text_field( $_GET['mode'] ), $data );
39
- }
40
- if ( isset( $_GET['s'] ) && ! empty( $_GET['s'] ) ) {
41
- $data = $this->search_data( sanitize_text_field( $_GET['s'] ), $data );
42
- }
43
- $this->items = $data;
44
- }
45
-
46
- public function prepare_filters( $data = array() ) {
47
- $links = array();
48
- foreach ($data as $item) {
49
- $value = unserialize($item['value']);
50
- $links[$value['mode']][] = $item;
51
- }
52
- return $links;
53
- }
54
-
55
- public function filter_data( $mode, $data = array() ) {
56
- $items = array();
57
- foreach ($data as $item) {
58
- if ( $mode == $item['data']['mode'] ) {
59
- $items[] = $item;
60
- }
61
- }
62
- return $items;
63
- }
64
-
65
- public function search_data( $search, $data = array() ) {
66
- $items = array();
67
- foreach ($data as $item) {
68
- if ( strtolower($search) == strtolower($item['name']) ) {
69
- $items[] = $item;
70
- }
71
- }
72
- return $items;
73
- }
74
-
75
- /**
76
- * Move sticky views to the top
77
- *
78
- * @param $data
79
- * @since 0.2.0
80
- * @return array
81
- */
82
- public function move_sticky( $data ) {
83
- $sticky_views = $views = array();
84
- foreach ( $data as $view ) {
85
- if ( in_array( $view['id'], $this->stickies ) ) {
86
- $sticky_views[] = $view;
87
- } else {
88
- $views[] = $view;
89
- }
90
- }
91
-
92
- return array_merge( $sticky_views, $views );
93
- }
94
-
95
- public function get_columns() {
96
- $columns = array(
97
- 'id' => esc_html__( 'ID', 'strong-testimonials' ),
98
- //'sticky' => __( 'Sticky', 'strong-testimonials' ),
99
- 'sticky' => '',
100
- 'name' => esc_html__( 'Name', 'strong-testimonials' ),
101
- 'mode' => esc_html__( 'Mode', 'strong-testimonials' ),
102
- 'template' => esc_html__( 'Template', 'strong-testimonials' ),
103
- 'shortcode' => esc_html__( 'Shortcode', 'strong-testimonials' ),
104
- );
105
-
106
- return $columns;
107
- }
108
-
109
- public function get_hidden_columns() {
110
- return array();
111
- }
112
-
113
- public function get_sortable_columns() {
114
- return array(
115
- 'id' => array( 'id', false ),
116
- 'name' => array( 'name', false ),
117
- );
118
- }
119
-
120
- public function usort_reorder( $a, $b ) {
121
- // If no sort, default to name
122
- $orderby = ( ! empty( $_GET['orderby'] ) ) ? sanitize_text_field( $_GET['orderby'] ) : 'name';
123
-
124
- // If no order, default to asc
125
- $order = ( ! empty($_GET['order'] ) ) ? sanitize_text_field( $_GET['order'] ) : 'asc';
126
-
127
- // Determine sort order
128
- if ( 'id' == $orderby ) {
129
- $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
130
- } else {
131
- $result = strcasecmp( $a[$orderby], $b[$orderby] );
132
- }
133
-
134
- // Send final sort direction to usort
135
- return ( $order === 'asc' ) ? $result : -$result;
136
- }
137
-
138
- public function cmp( $a, $b ) {
139
- if ( $a == $b ) {
140
- return 0;
141
- }
142
-
143
- return ( $a < $b ) ? -1 : 1;
144
- }
145
-
146
- public function column_name( $item ) {
147
- $screen = get_current_screen();
148
- $url = $screen->parent_file;
149
-
150
- // Edit link
151
- $edit_link = esc_url( $url . '&page=testimonial-views&action=edit&id=' . $item['id'] );
152
- echo '<a class="row-title" href="' . $edit_link . '">' . esc_html( $item['name'] ) . '</a>';
153
-
154
- // Duplicate link
155
- // @since 2.1.0
156
- $duplicate_link = esc_url( $url . '&page=testimonial-views&action=duplicate&id=' . $item['id'] );
157
-
158
- // Delete link
159
- $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
160
-
161
- // Assemble links
162
-
163
- $actions = array();
164
- $actions['edit'] = '<a href="' . $edit_link . '">' . esc_html__( 'Edit', 'strong-testimonials' ) . '</a>';
165
- $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . esc_html__( 'Duplicate', 'strong-testimonials' ) . '</a>';
166
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?', 'strong-testimonials' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . esc_html__( 'Delete', 'strong-testimonials' ) . '</a>';
167
-
168
- $actions = apply_filters('wpmtst_views_actions',$actions,$item);
169
-
170
- echo $this->row_actions( $actions );
171
- }
172
-
173
- public function column_default( $item, $column_name ) {
174
- switch ( $column_name ) {
175
- case 'id':
176
- $text = $item['id'];
177
- break;
178
- case 'sticky':
179
- $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
180
- $text = '<a href="#" class="stickit ' . $stuck . '" title="' . esc_html__( 'stick to top of list', 'strong-testimonials' ) . '"></>';
181
- break;
182
- case 'name':
183
- $text = $item['name'];
184
- break;
185
- case 'mode':
186
- $mode = $item['data']['mode'];
187
- $text = $mode;
188
- $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
189
- if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
190
- $text = $view_options['mode'][ $mode ]['label'];
191
- }
192
- break;
193
- case 'template':
194
- if ( 'single_template' == $item['data']['mode'] ) {
195
- $text = esc_html__( 'theme single post template', 'strong-testimonials' );
196
- } else {
197
- $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
198
- }
199
- break;
200
- case 'shortcode':
201
- if ( 'single_template' == $item['data']['mode'] ) {
202
- $text = '';
203
- } else {
204
- $text = '[testimonial_view id="' . $item['id'] . '"]';
205
- }
206
- break;
207
- default:
208
- $text = print_r( $item, true );
209
- }
210
-
211
- return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
212
- }
213
-
214
- public function is_stuck( $id ) {
215
- $stickies = get_option( 'wpmtst_sticky_views', array() );
216
- return ( $stickies && in_array( $id, $stickies ) );
217
- }
218
-
219
- public function find_template( $atts = '' ) {
220
- $name = WPMST()->templates->get_template_config( $atts, 'name', false );
221
- return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'not found', 'strong-testimonials' ) . '</span>';
222
- }
223
-
224
- /**
225
- * Display the table
226
- *
227
- * @since 3.1.0
228
- * @access public
229
- */
230
- public function display() {
231
- $singular = $this->_args['singular'];
232
- // Disabling the table nav options to regain some real estate.
233
- //$this->display_tablenav( 'top' );
234
- $s = '';
235
- if ( isset( $_GET['s'] ) ) {
236
- $s = sanitize_text_field( $_GET['s'] );
237
- }
238
- ?>
239
- <form id="posts-filter" method="get">
240
- <p class="search-box">
241
- <label class="screen-reader-text" for="post-search-input"><?php esc_html_e( 'Search', 'strong-testimonials' ); ?></label>
242
- <input type="search" id="post-search-input" name="s" value="<?php echo esc_attr( $s ) ?>">
243
- <input type="submit" id="search-submit" class="button" value="<?php esc_html_e( 'Search', 'strong-testimonials' ); ?>">
244
- <input type="hidden" name="post_type" class="post_type_page" value="wpm-testimonial">
245
- <input type="hidden" name="page" value="testimonial-views">
246
- </p>
247
- <table class="wp-list-table <?php echo esc_attr(implode( ' ', $this->get_table_classes())); ?>">
248
- <thead>
249
- <tr>
250
- <?php $this->print_column_headers(); ?>
251
- </tr>
252
- </thead>
253
-
254
- <tbody id="the-list"
255
- <?php
256
- if ( $singular ) {
257
- echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
258
- } ?>>
259
- <?php $this->display_rows_or_placeholder(); ?>
260
- </tbody>
261
-
262
- <tfoot>
263
- <tr>
264
- <?php $this->print_column_headers( false ); ?>
265
- </tr>
266
- </tfoot>
267
-
268
- </table>
269
- <?php
270
- //$this->display_tablenav( 'bottom' );
271
- ?>
272
- </form>
273
- <?php
274
- }
275
-
276
- }
1
+ <?php
2
+ /**
3
+ * Admin List Table
4
+ *
5
+ * @version 0.2.1
6
+ */
7
+
8
+ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
+
10
+ public $stickies;
11
+
12
+ /**
13
+ * Message to be displayed when there are no items
14
+ *
15
+ * @since 0.2.1
16
+ * @access public
17
+ */
18
+ public function no_items() {
19
+ esc_html_e( 'No views found.', 'strong-testimonials' );
20
+ }
21
+
22
+ public function prepare_list( $data = array() ) {
23
+ $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
+
25
+ $columns = $this->get_columns();
26
+ $hidden = $this->get_hidden_columns();
27
+ $sortable = $this->get_sortable_columns();
28
+
29
+ $this->_column_headers = array( $columns, $hidden, $sortable );
30
+
31
+ // Sort the list
32
+ if ( isset( $_GET['orderby'] ) ) {
33
+ usort( $data, array( &$this, 'usort_reorder' ) );
34
+ }
35
+ $data = $this->move_sticky( $data );
36
+ $data = apply_filters('wpmtst_list_views', $data);
37
+ if ( isset( $_GET['mode'] ) && ! empty( $_GET['mode'] ) && $_GET['mode'] !== 'all' ) {
38
+ $data = $this->filter_data( sanitize_text_field( $_GET['mode'] ), $data );
39
+ }
40
+ if ( isset( $_GET['s'] ) && ! empty( $_GET['s'] ) ) {
41
+ $data = $this->search_data( sanitize_text_field( $_GET['s'] ), $data );
42
+ }
43
+ $this->items = $data;
44
+ }
45
+
46
+ public function prepare_filters( $data = array() ) {
47
+ $links = array();
48
+ foreach ($data as $item) {
49
+ $value = unserialize($item['value']);
50
+ $links[$value['mode']][] = $item;
51
+ }
52
+ return $links;
53
+ }
54
+
55
+ public function filter_data( $mode, $data = array() ) {
56
+ $items = array();
57
+ foreach ($data as $item) {
58
+ if ( $mode == $item['data']['mode'] ) {
59
+ $items[] = $item;
60
+ }
61
+ }
62
+ return $items;
63
+ }
64
+
65
+ public function search_data( $search, $data = array() ) {
66
+ $items = array();
67
+ foreach ($data as $item) {
68
+ if ( strtolower($search) == strtolower($item['name']) ) {
69
+ $items[] = $item;
70
+ }
71
+ }
72
+ return $items;
73
+ }
74
+
75
+ /**
76
+ * Move sticky views to the top
77
+ *
78
+ * @param $data
79
+ * @since 0.2.0
80
+ * @return array
81
+ */
82
+ public function move_sticky( $data ) {
83
+ $sticky_views = $views = array();
84
+ foreach ( $data as $view ) {
85
+ if ( in_array( $view['id'], $this->stickies ) ) {
86
+ $sticky_views[] = $view;
87
+ } else {
88
+ $views[] = $view;
89
+ }
90
+ }
91
+
92
+ return array_merge( $sticky_views, $views );
93
+ }
94
+
95
+ public function get_columns() {
96
+ $columns = array(
97
+ 'id' => esc_html__( 'ID', 'strong-testimonials' ),
98
+ //'sticky' => __( 'Sticky', 'strong-testimonials' ),
99
+ 'sticky' => '',
100
+ 'name' => esc_html__( 'Name', 'strong-testimonials' ),
101
+ 'mode' => esc_html__( 'Mode', 'strong-testimonials' ),
102
+ 'template' => esc_html__( 'Template', 'strong-testimonials' ),
103
+ 'shortcode' => esc_html__( 'Shortcode', 'strong-testimonials' ),
104
+ );
105
+
106
+ return $columns;
107
+ }
108
+
109
+ public function get_hidden_columns() {
110
+ return array();
111
+ }
112
+
113
+ public function get_sortable_columns() {
114
+ return array(
115
+ 'id' => array( 'id', false ),
116
+ 'name' => array( 'name', false ),
117
+ );
118
+ }
119
+
120
+ public function usort_reorder( $a, $b ) {
121
+ // If no sort, default to name
122
+ $orderby = ( ! empty( $_GET['orderby'] ) ) ? sanitize_text_field( $_GET['orderby'] ) : 'name';
123
+
124
+ // If no order, default to asc
125
+ $order = ( ! empty($_GET['order'] ) ) ? sanitize_text_field( $_GET['order'] ) : 'asc';
126
+
127
+ // Determine sort order
128
+ if ( 'id' == $orderby ) {
129
+ $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
130
+ } else {
131
+ $result = strcasecmp( $a[$orderby], $b[$orderby] );
132
+ }
133
+
134
+ // Send final sort direction to usort
135
+ return ( $order === 'asc' ) ? $result : -$result;
136
+ }
137
+
138
+ public function cmp( $a, $b ) {
139
+ if ( $a == $b ) {
140
+ return 0;
141
+ }
142
+
143
+ return ( $a < $b ) ? -1 : 1;
144
+ }
145
+
146
+ public function column_name( $item ) {
147
+ $screen = get_current_screen();
148
+ $url = $screen->parent_file;
149
+
150
+ // Edit link
151
+ $edit_link = esc_url( $url . '&page=testimonial-views&action=edit&id=' . $item['id'] );
152
+ echo '<a class="row-title" href="' . $edit_link . '">' . esc_html( $item['name'] ) . '</a>';
153
+
154
+ // Duplicate link
155
+ // @since 2.1.0
156
+ $duplicate_link = esc_url( $url . '&page=testimonial-views&action=duplicate&id=' . $item['id'] );
157
+
158
+ // Delete link
159
+ $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
160
+
161
+ // Assemble links
162
+
163
+ $actions = array();
164
+ $actions['edit'] = '<a href="' . $edit_link . '">' . esc_html__( 'Edit', 'strong-testimonials' ) . '</a>';
165
+ $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . esc_html__( 'Duplicate', 'strong-testimonials' ) . '</a>';
166
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?', 'strong-testimonials' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . esc_html__( 'Delete', 'strong-testimonials' ) . '</a>';
167
+
168
+ $actions = apply_filters('wpmtst_views_actions',$actions,$item);
169
+
170
+ echo $this->row_actions( $actions );
171
+ }
172
+
173
+ public function column_default( $item, $column_name ) {
174
+ switch ( $column_name ) {
175
+ case 'id':
176
+ $text = $item['id'];
177
+ break;
178
+ case 'sticky':
179
+ $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
180
+ $text = '<a href="#" class="stickit ' . $stuck . '" title="' . esc_html__( 'stick to top of list', 'strong-testimonials' ) . '"></>';
181
+ break;
182
+ case 'name':
183
+ $text = $item['name'];
184
+ break;
185
+ case 'mode':
186
+ $mode = $item['data']['mode'];
187
+ $text = $mode;
188
+ $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
189
+ if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
190
+ $text = $view_options['mode'][ $mode ]['label'];
191
+ }
192
+ break;
193
+ case 'template':
194
+ if ( 'single_template' == $item['data']['mode'] ) {
195
+ $text = esc_html__( 'theme single post template', 'strong-testimonials' );
196
+ } else {
197
+ $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
198
+ }
199
+ break;
200
+ case 'shortcode':
201
+ if ( 'single_template' == $item['data']['mode'] ) {
202
+ $text = '';
203
+ } else {
204
+ $text = '[testimonial_view id="' . $item['id'] . '"]';
205
+ }
206
+ break;
207
+ default:
208
+ $text = print_r( $item, true );
209
+ }
210
+
211
+ return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
212
+ }
213
+
214
+ public function is_stuck( $id ) {
215
+ $stickies = get_option( 'wpmtst_sticky_views', array() );
216
+ return ( $stickies && in_array( $id, $stickies ) );
217
+ }
218
+
219
+ public function find_template( $atts = '' ) {
220
+ $name = WPMST()->templates->get_template_config( $atts, 'name', false );
221
+ return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'not found', 'strong-testimonials' ) . '</span>';
222
+ }
223
+
224
+ /**
225
+ * Display the table
226
+ *
227
+ * @since 3.1.0
228
+ * @access public
229
+ */
230
+ public function display() {
231
+ $singular = $this->_args['singular'];
232
+ // Disabling the table nav options to regain some real estate.
233
+ //$this->display_tablenav( 'top' );
234
+ $s = '';
235
+ if ( isset( $_GET['s'] ) ) {
236
+ $s = sanitize_text_field( $_GET['s'] );
237
+ }
238
+ ?>
239
+ <form id="posts-filter" method="get">
240
+ <p class="search-box">
241
+ <label class="screen-reader-text" for="post-search-input"><?php esc_html_e( 'Search', 'strong-testimonials' ); ?></label>
242
+ <input type="search" id="post-search-input" name="s" value="<?php echo esc_attr( $s ) ?>">
243
+ <input type="submit" id="search-submit" class="button" value="<?php esc_html_e( 'Search', 'strong-testimonials' ); ?>">
244
+ <input type="hidden" name="post_type" class="post_type_page" value="wpm-testimonial">
245
+ <input type="hidden" name="page" value="testimonial-views">
246
+ </p>
247
+ <table class="wp-list-table <?php echo esc_attr(implode( ' ', $this->get_table_classes())); ?>">
248
+ <thead>
249
+ <tr>
250
+ <?php $this->print_column_headers(); ?>
251
+ </tr>
252
+ </thead>
253
+
254
+ <tbody id="the-list"
255
+ <?php
256
+ if ( $singular ) {
257
+ echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
258
+ } ?>>
259
+ <?php $this->display_rows_or_placeholder(); ?>
260
+ </tbody>
261
+
262
+ <tfoot>
263
+ <tr>
264
+ <?php $this->print_column_headers( false ); ?>
265
+ </tr>
266
+ </tfoot>
267
+
268
+ </table>
269
+ <?php
270
+ //$this->display_tablenav( 'bottom' );
271
+ ?>
272
+ </form>
273
+ <?php
274
+ }
275
+
276
+ }
admin/class-walker-strong-category-checklist.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
- /**
3
- * Taxonomy API: Walker_Strong_Category_Checklist class
4
- *
5
- * @since 2.2.0
6
- */
7
-
8
- /**
9
- * Custom walker class to output an unordered list of category checkbox input elements.
10
- *
11
- * @since 2.5.1
12
- *
13
- * @see Walker
14
- * @see wp_category_checklist()
15
- * @see wp_terms_checklist()
16
- */
17
- class Walker_Strong_Category_Checklist extends Walker {
18
- public $tree_type = 'category';
19
- public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
-
21
- /**
22
- * Starts the list before the elements are added.
23
- *
24
- * @see Walker:start_lvl()
25
- *
26
- * @since 2.5.1
27
- *
28
- * @param string $output Passed by reference. Used to append additional content.
29
- * @param int $depth Depth of category. Used for tab indentation.
30
- * @param array $args An array of arguments. @see wp_terms_checklist()
31
- */
32
- public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
- $indent = str_repeat("\t", $depth);
34
- $output .= "$indent<ul class='children'>\n";
35
- }
36
-
37
- /**
38
- * Ends the list of after the elements are added.
39
- *
40
- * @see Walker::end_lvl()
41
- *
42
- * @since 2.5.1
43
- *
44
- * @param string $output Passed by reference. Used to append additional content.
45
- * @param int $depth Depth of category. Used for tab indentation.
46
- * @param array $args An array of arguments. @see wp_terms_checklist()
47
- */
48
- public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
- $indent = str_repeat("\t", $depth);
50
- $output .= "$indent</ul>\n";
51
- }
52
-
53
- /**
54
- * Start the element output.
55
- *
56
- * @see Walker::start_el()
57
- *
58
- * @since 2.5.1
59
- *
60
- * @param string $output Passed by reference. Used to append additional content.
61
- * @param object $category The current term object.
62
- * @param int $depth Depth of the term in reference to parents. Default 0.
63
- * @param array $args An array of arguments. @see wp_terms_checklist()
64
- * @param int $id ID of the current term.
65
- */
66
- public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
- if ( empty( $args['taxonomy'] ) ) {
68
- $taxonomy = 'wpm-testimonial-category';
69
- } else {
70
- $taxonomy = $args['taxonomy'];
71
- }
72
-
73
- $name = "view[data][category]";
74
-
75
- $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
-
78
- $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
-
80
- $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
-
82
- if ( ! empty( $args['list_only'] ) ) {
83
- $aria_cheched = 'false';
84
- $inner_class = 'category';
85
-
86
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
- $inner_class .= ' selected';
88
- $aria_cheched = 'true';
89
- }
90
-
91
- /** This filter is documented in wp-includes/category-template.php */
92
- $output .= "\n" . '<li' . $class . '>' .
93
- '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
- ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
- esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
- }
97
- else {
98
- /** This filter is documented in wp-includes/category-template.php */
99
- // newlines make for consistent spacing without extra CSS
100
- $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
101
- $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
- . ' id="category-' . $category->term_id . '"'
103
- . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
- . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
- $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
106
- $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
- . ' <span class="cat-count">(' . $category->count . ')</span>';
108
- $output .= '</label>';
109
- }
110
- }
111
-
112
- /**
113
- * Ends the element output, if needed.
114
- *
115
- * @see Walker::end_el()
116
- *
117
- * @since 2.5.1
118
- *
119
- * @param string $output Passed by reference. Used to append additional content.
120
- * @param object $category The current term object.
121
- * @param int $depth Depth of the term in reference to parents. Default 0.
122
- * @param array $args An array of arguments. @see wp_terms_checklist()
123
- */
124
- public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
- $output .= "</li>\n";
126
- }
127
- }
1
+ <?php
2
+ /**
3
+ * Taxonomy API: Walker_Strong_Category_Checklist class
4
+ *
5
+ * @since 2.2.0
6
+ */
7
+
8
+ /**
9
+ * Custom walker class to output an unordered list of category checkbox input elements.
10
+ *
11
+ * @since 2.5.1
12
+ *
13
+ * @see Walker
14
+ * @see wp_category_checklist()
15
+ * @see wp_terms_checklist()
16
+ */
17
+ class Walker_Strong_Category_Checklist extends Walker {
18
+ public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
+
21
+ /**
22
+ * Starts the list before the elements are added.
23
+ *
24
+ * @see Walker:start_lvl()
25
+ *
26
+ * @since 2.5.1
27
+ *
28
+ * @param string $output Passed by reference. Used to append additional content.
29
+ * @param int $depth Depth of category. Used for tab indentation.
30
+ * @param array $args An array of arguments. @see wp_terms_checklist()
31
+ */
32
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
+ $output .= "$indent<ul class='children'>\n";
35
+ }
36
+
37
+ /**
38
+ * Ends the list of after the elements are added.
39
+ *
40
+ * @see Walker::end_lvl()
41
+ *
42
+ * @since 2.5.1
43
+ *
44
+ * @param string $output Passed by reference. Used to append additional content.
45
+ * @param int $depth Depth of category. Used for tab indentation.
46
+ * @param array $args An array of arguments. @see wp_terms_checklist()
47
+ */
48
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
+ $output .= "$indent</ul>\n";
51
+ }
52
+
53
+ /**
54
+ * Start the element output.
55
+ *
56
+ * @see Walker::start_el()
57
+ *
58
+ * @since 2.5.1
59
+ *
60
+ * @param string $output Passed by reference. Used to append additional content.
61
+ * @param object $category The current term object.
62
+ * @param int $depth Depth of the term in reference to parents. Default 0.
63
+ * @param array $args An array of arguments. @see wp_terms_checklist()
64
+ * @param int $id ID of the current term.
65
+ */
66
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
+ if ( empty( $args['taxonomy'] ) ) {
68
+ $taxonomy = 'wpm-testimonial-category';
69
+ } else {
70
+ $taxonomy = $args['taxonomy'];
71
+ }
72
+
73
+ $name = "view[data][category]";
74
+
75
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
+
78
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
+
80
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
+
82
+ if ( ! empty( $args['list_only'] ) ) {
83
+ $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
+
86
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
+ $inner_class .= ' selected';
88
+ $aria_cheched = 'true';
89
+ }
90
+
91
+ /** This filter is documented in wp-includes/category-template.php */
92
+ $output .= "\n" . '<li' . $class . '>' .
93
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
+ /** This filter is documented in wp-includes/category-template.php */
99
+ // newlines make for consistent spacing without extra CSS
100
+ $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
101
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
+ . ' id="category-' . $category->term_id . '"'
103
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
+ $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
106
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
108
+ $output .= '</label>';
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Ends the element output, if needed.
114
+ *
115
+ * @see Walker::end_el()
116
+ *
117
+ * @since 2.5.1
118
+ *
119
+ * @param string $output Passed by reference. Used to append additional content.
120
+ * @param object $category The current term object.
121
+ * @param int $depth Depth of the term in reference to parents. Default 0.
122
+ * @param array $args An array of arguments. @see wp_terms_checklist()
123
+ */
124
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
+ $output .= "</li>\n";
126
+ }
127
+ }
admin/class-walker-strong-form-category-checklist.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
- /**
3
- * Taxonomy API: Walker_Strong_Form_Category_Checklist class
4
- *
5
- * @since 2.2.0
6
- */
7
-
8
- /**
9
- * Custom walker class to output an unordered list of category checkbox input elements.
10
- *
11
- * @since 2.5.1
12
- *
13
- * @see Walker
14
- * @see wp_category_checklist()
15
- * @see wp_terms_checklist()
16
- */
17
- class Walker_Strong_Form_Category_Checklist extends Walker {
18
- public $tree_type = 'category';
19
- public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
-
21
- /**
22
- * Starts the list before the elements are added.
23
- *
24
- * @see Walker:start_lvl()
25
- *
26
- * @since 2.5.1
27
- *
28
- * @param string $output Passed by reference. Used to append additional content.
29
- * @param int $depth Depth of category. Used for tab indentation.
30
- * @param array $args An array of arguments. @see wp_terms_checklist()
31
- */
32
- public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
- $indent = str_repeat("\t", $depth);
34
- $output .= "$indent<ul class='children'>\n";
35
- }
36
-
37
- /**
38
- * Ends the list of after the elements are added.
39
- *
40
- * @see Walker::end_lvl()
41
- *
42
- * @since 2.5.1
43
- *
44
- * @param string $output Passed by reference. Used to append additional content.
45
- * @param int $depth Depth of category. Used for tab indentation.
46
- * @param array $args An array of arguments. @see wp_terms_checklist()
47
- */
48
- public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
- $indent = str_repeat("\t", $depth);
50
- $output .= "$indent</ul>\n";
51
- }
52
-
53
- /**
54
- * Start the element output.
55
- *
56
- * @see Walker::start_el()
57
- *
58
- * @since 2.5.1
59
- *
60
- * @param string $output Passed by reference. Used to append additional content.
61
- * @param object $category The current term object.
62
- * @param int $depth Depth of the term in reference to parents. Default 0.
63
- * @param array $args An array of arguments. @see wp_terms_checklist()
64
- * @param int $id ID of the current term.
65
- */
66
- public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
- if ( empty( $args['taxonomy'] ) ) {
68
- $taxonomy = 'wpm-testimonial-category';
69
- } else {
70
- $taxonomy = $args['taxonomy'];
71
- }
72
-
73
- $name = "view[data][category-form]";
74
-
75
- $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
-
78
- $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
-
80
- $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
-
82
- if ( ! empty( $args['list_only'] ) ) {
83
- $aria_cheched = 'false';
84
- $inner_class = 'category';
85
-
86
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
- $inner_class .= ' selected';
88
- $aria_cheched = 'true';
89
- }
90
-
91
- /** This filter is documented in wp-includes/category-template.php */
92
- $output .= "\n" . '<li' . $class . '>' .
93
- '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
- ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
- esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
- }
97
- else {
98
- /** This filter is documented in wp-includes/category-template.php */
99
- // newlines make for consistent spacing without extra CSS
100
- $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
101
- $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
- . ' id="category-form-' . $category->term_id . '"'
103
- . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
- . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
- $output .= '<label class="selectit" for="category-form-' . $category->term_id . '">' . "\n";
106
- $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
- . ' <span class="cat-count">(' . $category->count . ')</span>';
108
- $output .= '</label>';
109
- }
110
- }
111
-
112
- /**
113
- * Ends the element output, if needed.
114
- *
115
- * @see Walker::end_el()
116
- *
117
- * @since 2.5.1
118
- *
119
- * @param string $output Passed by reference. Used to append additional content.
120
- * @param object $category The current term object.
121
- * @param int $depth Depth of the term in reference to parents. Default 0.
122
- * @param array $args An array of arguments. @see wp_terms_checklist()
123
- */
124
- public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
- $output .= "</li>\n";
126
- }
127
- }
1
+ <?php
2
+ /**
3
+ * Taxonomy API: Walker_Strong_Form_Category_Checklist class
4
+ *
5
+ * @since 2.2.0
6
+ */
7
+
8
+ /**
9
+ * Custom walker class to output an unordered list of category checkbox input elements.
10
+ *
11
+ * @since 2.5.1
12
+ *
13
+ * @see Walker
14
+ * @see wp_category_checklist()
15
+ * @see wp_terms_checklist()
16
+ */
17
+ class Walker_Strong_Form_Category_Checklist extends Walker {
18
+ public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
+
21
+ /**
22
+ * Starts the list before the elements are added.
23
+ *
24
+ * @see Walker:start_lvl()
25
+ *
26
+ * @since 2.5.1
27
+ *
28
+ * @param string $output Passed by reference. Used to append additional content.
29
+ * @param int $depth Depth of category. Used for tab indentation.
30
+ * @param array $args An array of arguments. @see wp_terms_checklist()
31
+ */
32
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
+ $output .= "$indent<ul class='children'>\n";
35
+ }
36
+
37
+ /**
38
+ * Ends the list of after the elements are added.
39
+ *
40
+ * @see Walker::end_lvl()
41
+ *
42
+ * @since 2.5.1
43
+ *
44
+ * @param string $output Passed by reference. Used to append additional content.
45
+ * @param int $depth Depth of category. Used for tab indentation.
46
+ * @param array $args An array of arguments. @see wp_terms_checklist()
47
+ */
48
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
+ $output .= "$indent</ul>\n";
51
+ }
52
+
53
+ /**
54
+ * Start the element output.
55
+ *
56
+ * @see Walker::start_el()
57
+ *
58
+ * @since 2.5.1
59
+ *
60
+ * @param string $output Passed by reference. Used to append additional content.
61
+ * @param object $category The current term object.
62
+ * @param int $depth Depth of the term in reference to parents. Default 0.
63
+ * @param array $args An array of arguments. @see wp_terms_checklist()
64
+ * @param int $id ID of the current term.
65
+ */
66
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
+ if ( empty( $args['taxonomy'] ) ) {
68
+ $taxonomy = 'wpm-testimonial-category';
69
+ } else {
70
+ $taxonomy = $args['taxonomy'];
71
+ }
72
+
73
+ $name = "view[data][category-form]";
74
+
75
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
+
78
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
+
80
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
+
82
+ if ( ! empty( $args['list_only'] ) ) {
83
+ $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
+
86
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
+ $inner_class .= ' selected';
88
+ $aria_cheched = 'true';
89
+ }
90
+
91
+ /** This filter is documented in wp-includes/category-template.php */
92
+ $output .= "\n" . '<li' . $class . '>' .
93
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
+ /** This filter is documented in wp-includes/category-template.php */
99
+ // newlines make for consistent spacing without extra CSS
100
+ $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
101
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
+ . ' id="category-form-' . $category->term_id . '"'
103
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
+ $output .= '<label class="selectit" for="category-form-' . $category->term_id . '">' . "\n";
106
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
108
+ $output .= '</label>';
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Ends the element output, if needed.
114
+ *
115
+ * @see Walker::end_el()
116
+ *
117
+ * @since 2.5.1
118
+ *
119
+ * @param string $output Passed by reference. Used to append additional content.
120
+ * @param object $category The current term object.
121
+ * @param int $depth Depth of the term in reference to parents. Default 0.
122
+ * @param array $args An array of arguments. @see wp_terms_checklist()
123
+ */
124
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
+ $output .= "</li>\n";
126
+ }
127
+ }
admin/compat.php CHANGED
@@ -1,116 +1,116 @@
1
- <?php
2
-
3
- /**
4
- * Prevent other post ordering plugins, in admin_menu hook.
5
- *
6
- * @since 1.16.0
7
- */
8
- function wpmtst_deny_plugins_menu() {
9
-
10
- /**
11
- * Post Types Order
12
- */
13
- if ( is_plugin_active( 'post-types-order/post-types-order.php' ) ) {
14
- remove_submenu_page( 'edit.php?post_type=wpm-testimonial', 'order-post-types-wpm-testimonial' );
15
- }
16
-
17
- }
18
- add_action( 'admin_menu', 'wpmtst_deny_plugins_menu', 200 );
19
-
20
-
21
- /**
22
- * Plugin and theme compatibility in admin.
23
- *
24
- * @since 2.4.0
25
- */
26
- function wpmtst_compat_admin_init() {
27
- $theme = wp_get_theme();
28
-
29
- /* ------------------------------------------------------------
30
- * Theme Name: Mercury
31
- * Theme URI: http://themes.themegoods2.com/mercury
32
- * Description: Premium Template for Photography Portfolio
33
- * Version: 1.7.5
34
- * Author: Peerapong Pulpipatnan
35
- * Author URI: http://themeforest.net/user/peerapong
36
- * ------------------------------------------------------------
37
- * Mercury enqueues its scripts and styles poorly.
38
- * 1. on the `admin_init` hook
39
- * 2. UNconditionally
40
- */
41
- if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
-
43
- /** Screen information is not available yet. */
44
- //$screen = get_current_screen();
45
- //if ( $screen && 'wpm-testimonial' == $screen->post_type ) {
46
-
47
- if ( false !== strpos( $_SERVER['QUERY_STRING'], 'post_type=wpm-testimonial' ) ) {
48
- if ( function_exists( 'pp_add_init' ) ) {
49
- remove_action( 'admin_init', 'pp_add_init' );
50
- }
51
- }
52
-
53
- }
54
- }
55
- add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
56
-
57
-
58
- /**
59
- * Prevent other post ordering plugins, in admin_init hook.
60
- *
61
- * @since 1.16.0
62
- */
63
- function wpmtst_deny_plugins_init() {
64
-
65
- /**
66
- * Intuitive Custom Post Order
67
- */
68
- if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
69
- $options = get_option( 'hicpo_options' );
70
- $update = false;
71
-
72
- if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
73
- if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
74
- $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
75
- $update = true;
76
- }
77
- }
78
-
79
- if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
80
- if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
81
- $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
82
- $update = true;
83
- }
84
- }
85
-
86
- if ( $update )
87
- update_option( 'hicpo_options', $options, 'no' );
88
- }
89
-
90
- /**
91
- * Simple Custom Post Order
92
- */
93
- if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
- $options = get_option( 'scporder_options' );
95
- $update = false;
96
-
97
- if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
- if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
- $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
- $update = true;
101
- }
102
- }
103
-
104
- if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
- if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
- $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
- $update = true;
108
- }
109
- }
110
-
111
- if ( $update )
112
- update_option( 'scporder_options', $options, 'no' );
113
- }
114
-
115
- }
116
- add_action( 'admin_init', 'wpmtst_deny_plugins_init', 200 );
1
+ <?php
2
+
3
+ /**
4
+ * Prevent other post ordering plugins, in admin_menu hook.
5
+ *
6
+ * @since 1.16.0
7
+ */
8
+ function wpmtst_deny_plugins_menu() {
9
+
10
+ /**
11
+ * Post Types Order
12
+ */
13
+ if ( is_plugin_active( 'post-types-order/post-types-order.php' ) ) {
14
+ remove_submenu_page( 'edit.php?post_type=wpm-testimonial', 'order-post-types-wpm-testimonial' );
15
+ }
16
+
17
+ }
18
+ add_action( 'admin_menu', 'wpmtst_deny_plugins_menu', 200 );
19
+
20
+
21
+ /**
22
+ * Plugin and theme compatibility in admin.
23
+ *
24
+ * @since 2.4.0
25
+ */
26
+ function wpmtst_compat_admin_init() {
27
+ $theme = wp_get_theme();
28
+
29
+ /* ------------------------------------------------------------
30
+ * Theme Name: Mercury
31
+ * Theme URI: http://themes.themegoods2.com/mercury
32
+ * Description: Premium Template for Photography Portfolio
33
+ * Version: 1.7.5
34
+ * Author: Peerapong Pulpipatnan
35
+ * Author URI: http://themeforest.net/user/peerapong
36
+ * ------------------------------------------------------------
37
+ * Mercury enqueues its scripts and styles poorly.
38
+ * 1. on the `admin_init` hook
39
+ * 2. UNconditionally
40
+ */
41
+ if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
+
43
+ /** Screen information is not available yet. */
44
+ //$screen = get_current_screen();
45
+ //if ( $screen && 'wpm-testimonial' == $screen->post_type ) {
46
+
47
+ if ( false !== strpos( $_SERVER['QUERY_STRING'], 'post_type=wpm-testimonial' ) ) {
48
+ if ( function_exists( 'pp_add_init' ) ) {
49
+ remove_action( 'admin_init', 'pp_add_init' );
50
+ }
51
+ }
52
+
53
+ }
54
+ }
55
+ add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
56
+
57
+
58
+ /**
59
+ * Prevent other post ordering plugins, in admin_init hook.
60
+ *
61
+ * @since 1.16.0
62
+ */
63
+ function wpmtst_deny_plugins_init() {
64
+
65
+ /**
66
+ * Intuitive Custom Post Order
67
+ */
68
+ if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
69
+ $options = get_option( 'hicpo_options' );
70
+ $update = false;
71
+
72
+ if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
73
+ if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
74
+ $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
75
+ $update = true;
76
+ }
77
+ }
78
+
79
+ if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
80
+ if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
81
+ $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
82
+ $update = true;
83
+ }
84
+ }
85
+
86
+ if ( $update )
87
+ update_option( 'hicpo_options', $options, 'no' );
88
+ }
89
+
90
+ /**
91
+ * Simple Custom Post Order
92
+ */
93
+ if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
+ $options = get_option( 'scporder_options' );
95
+ $update = false;
96
+
97
+ if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
+ if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
+ $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
+ $update = true;
101
+ }
102
+ }
103
+
104
+ if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
+ if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
+ $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
+ $update = true;
108
+ }
109
+ }
110
+
111
+ if ( $update )
112
+ update_option( 'scporder_options', $options, 'no' );
113
+ }
114
+
115
+ }
116
+ add_action( 'admin_init', 'wpmtst_deny_plugins_init', 200 );
admin/css/about.css CHANGED
@@ -1,53 +1,53 @@
1
- /**
2
- * About Strong Testimonials page
3
- */
4
- /* == Elements
5
- --------------------------------------------------*/
6
- .highlight {
7
- background: #FFFF99;
8
- border: 1px solid #EEEE00;
9
- display: inline-block;
10
- padding: 3px 6px 2px; }
11
-
12
- .code {
13
- display: inline-block;
14
- font-family: Consolas, Monaco, monospace;
15
- font-size: 13px;
16
- background: white;
17
- padding: 4px 8px;
18
- box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
19
- max-width: 90%; }
20
-
21
- .highlight {
22
- background: rgba(255, 229, 135, 0.5);
23
- border: 1px solid #FFDC5D;
24
- border-radius: 3px;
25
- color: #1E1800;
26
- padding: 5px 15px; }
27
-
28
- .feature-section-sub {
29
- margin-top: 2em; }
30
- .feature-section-sub h3.heading {
31
- font-size: 1.2em; }
32
- .feature-section-sub ul {
33
- font-size: 14px;
34
- list-style: square;
35
- margin-left: 1em; }
36
- .feature-section-sub ul li {
37
- margin-left: 1em;
38
- text-indent: 4px; }
39
-
40
- /* == Extending WordPress about.css
41
- --------------------------------------------------*/
42
- .about-wrap [class$="-col"] .col {
43
- align-self: flex-start; }
44
-
45
- .wp-badge {
46
- color: #FFF; }
47
-
48
- .wp-badge.strong-testimonials {
49
- background-image: url(../img/strong-testimonials-badge.png);
50
- background-color: #8224E3; }
51
-
52
- .feature-section code {
53
- font-size: 13px; }
1
+ /**
2
+ * About Strong Testimonials page
3
+ */
4
+ /* == Elements
5
+ --------------------------------------------------*/
6
+ .highlight {
7
+ background: #FFFF99;
8
+ border: 1px solid #EEEE00;
9
+ display: inline-block;
10
+ padding: 3px 6px 2px; }
11
+
12
+ .code {
13
+ display: inline-block;
14
+ font-family: Consolas, Monaco, monospace;
15
+ font-size: 13px;
16
+ background: white;
17
+ padding: 4px 8px;
18
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
19
+ max-width: 90%; }
20
+
21
+ .highlight {
22
+ background: rgba(255, 229, 135, 0.5);
23
+ border: 1px solid #FFDC5D;
24
+ border-radius: 3px;
25
+ color: #1E1800;
26
+ padding: 5px 15px; }
27
+
28
+ .feature-section-sub {
29
+ margin-top: 2em; }
30
+ .feature-section-sub h3.heading {
31
+ font-size: 1.2em; }
32
+ .feature-section-sub ul {
33
+ font-size: 14px;
34
+ list-style: square;
35
+ margin-left: 1em; }
36
+ .feature-section-sub ul li {
37
+ margin-left: 1em;
38
+ text-indent: 4px; }
39
+
40
+ /* == Extending WordPress about.css
41
+ --------------------------------------------------*/
42
+ .about-wrap [class$="-col"] .col {
43
+ align-self: flex-start; }
44
+
45
+ .wp-badge {
46
+ color: #FFF; }
47
+
48
+ .wp-badge.strong-testimonials {
49
+ background-image: url(../img/strong-testimonials-badge.png);
50
+ background-color: #8224E3; }
51
+
52
+ .feature-section code {
53
+ font-size: 13px; }
admin/css/admin-compat.css CHANGED
@@ -1,178 +1,178 @@
1
- /**
2
- * Compatibility settings tab
3
- */
4
- /**
5
- * Basic structure
6
- */
7
- div.row {
8
- display: table-row; }
9
- div.row > div {
10
- display: table-cell; }
11
- div.row > div:first-child {
12
- width: 200px; }
13
- div.row:not(:last-child) > div {
14
- padding-bottom: 0.5em; }
15
- div.row p {
16
- margin-bottom: 0.5em; }
17
- div.row.header p {
18
- margin-bottom: 1em; }
19
-
20
- /**
21
- * Elements
22
- */
23
- .wrap.wpmtst h2 {
24
- margin: 2em 0 1em; }
25
- .wrap.wpmtst h2.nav-tab-wrapper {
26
- margin-top: 6px; }
27
-
28
- input.element {
29
- width: 15em; }
30
-
31
- /**
32
- * Behavior
33
- */
34
- .hidden {
35
- display: none; }
36
-
37
- [data-sub] {
38
- display: none; }
39
-
40
- /**
41
- * Common scenarios table
42
- */
43
- div.scenarios div.row {
44
- border: 1px solid #DDD; }
45
- div.scenarios div.row > div {
46
- padding: 1em; }
47
- div.scenarios div.row > div:first-child {
48
- width: 35%;
49
- border-right: 1px dotted #DDD; }
50
- div.scenarios div.row > div:last-child {
51
- width: 30%;
52
- border-left: 1px dotted #DDD; }
53
- div.scenarios div.row p {
54
- font-size: 14px;
55
- margin: 0; }
56
- div.scenarios div.row p:not(:last-child) {
57
- margin-bottom: 1em; }
58
- div.scenarios div.row.header > div {
59
- font-weight: 600;
60
- padding: 0.5em 1em; }
61
-
62
- /**
63
- * Settings table
64
- */
65
- div.row:not(:last-child) > div:nth-child(2) {
66
- padding-bottom: 0.5em; }
67
- div.row > div.radio-sub label {
68
- text-indent: 24px;
69
- width: 200px; }
70
- div.row p.about {
71
- display: inline-block;
72
- vertical-align: middle; }
73
- div.row p.about.adjacent {
74
- margin-left: 0.5em; }
75
- div.row p.description {
76
- display: inline-block;
77
- font-size: 14px; }
78
- div.row label.current {
79
- font-weight: 600; }
80
-
81
- /**
82
- * Lazy load class name pairs
83
- */
84
- .pair-actions {
85
- margin-top: 10px; }
86
-
87
- .pair-sep {
88
- margin-right: 1em; }
89
-
90
- @media only screen and (max-width: 1024px) {
91
- .lazyload-pairs .pair {
92
- border: 1px solid #DDD;
93
- padding: 5px 10px; } }
94
- /**
95
- * Number spinner
96
- */
97
- .number-style {
98
- display: inline-block;
99
- margin-right: 10px;
100
- /**
101
- * Disable text selection on buttons. Seems to help jittery pointers.
102
- */ }
103
- .number-style input {
104
- margin: 0 5px;
105
- font-family: Consolas, Monaco, monospace;
106
- text-align: center;
107
- width: 4em; }
108
- .number-style > span {
109
- cursor: pointer; }
110
- .number-style > span.number-minus, .number-style > span.number-plus {
111
- height: 24px;
112
- width: 24px;
113
- display: inline-block;
114
- text-align: center;
115
- vertical-align: top;
116
- border-radius: 3px;
117
- background: #0085ba;
118
- border-width: 1px;
119
- border-style: solid;
120
- border-color: #0073aa #006799 #006799;
121
- -webkit-box-shadow: 0 1px 0 #006799;
122
- box-shadow: 0 1px 0 #006799;
123
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
124
- color: #FFF; }
125
- .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
126
- background: #008ec2; }
127
- .number-style > span.number-minus:active, .number-style > span.number-plus:active {
128
- background: #0073aa;
129
- border-color: #006799;
130
- -webkit-box-shadow: inset 0 2px 0 #006799;
131
- box-shadow: inset 0 2px 0 #006799;
132
- -webkit-transform: translateY(1px);
133
- -ms-transform: translateY(1px);
134
- transform: translateY(1px);
135
- outline: none; }
136
- .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
137
- background: #AAA;
138
- border-color: #999 #777 #777;
139
- -webkit-box-shadow: 0 1px 0 #777;
140
- box-shadow: 0 1px 0 #777;
141
- text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777; }
142
- .number-style > span.number-minus::after, .number-style > span.number-plus::after {
143
- font-family: dashicons;
144
- font-size: 24px;
145
- line-height: 24px;
146
- height: 24px;
147
- width: 24px;
148
- display: inline-block;
149
- color: #FFF;
150
- text-align: center;
151
- position: relative;
152
- left: -1px; }
153
- .number-style > span.number-minus::after {
154
- content: "\f140"; }
155
- .number-style > span.number-plus::after {
156
- content: "\f142"; }
157
- .number-style input[type='number'] {
158
- -moz-appearance: textfield; }
159
- .number-style input::-webkit-outer-spin-button,
160
- .number-style input::-webkit-inner-spin-button {
161
- -webkit-appearance: none; }
162
- .number-style .number-minus,
163
- .number-style .number-plus,
164
- .number-style .number-minus::after,
165
- .number-style .number-plus::after {
166
- -webkit-touch-callout: none;
167
- /* iOS Safari */
168
- -webkit-user-select: none;
169
- /* Safari */
170
- -khtml-user-select: none;
171
- /* Konqueror HTML */
172
- -moz-user-select: none;
173
- /* Firefox */
174
- -ms-user-select: none;
175
- /* Internet Explorer/Edge */
176
- user-select: none;
177
- /* Non-prefixed version, currently
178
- supported by Chrome and Opera */ }
1
+ /**
2
+ * Compatibility settings tab
3
+ */
4
+ /**
5
+ * Basic structure
6
+ */
7
+ div.row {
8
+ display: table-row; }
9
+ div.row > div {
10
+ display: table-cell; }
11
+ div.row > div:first-child {
12
+ width: 200px; }
13
+ div.row:not(:last-child) > div {
14
+ padding-bottom: 0.5em; }
15
+ div.row p {
16
+ margin-bottom: 0.5em; }
17
+ div.row.header p {
18
+ margin-bottom: 1em; }
19
+
20
+ /**
21
+ * Elements
22
+ */
23
+ .wrap.wpmtst h2 {
24
+ margin: 2em 0 1em; }
25
+ .wrap.wpmtst h2.nav-tab-wrapper {
26
+ margin-top: 6px; }
27
+
28
+ input.element {
29
+ width: 15em; }
30
+
31
+ /**
32
+ * Behavior
33
+ */
34
+ .hidden {
35
+ display: none; }
36
+
37
+ [data-sub] {
38
+ display: none; }
39
+
40
+ /**
41
+ * Common scenarios table
42
+ */
43
+ div.scenarios div.row {
44
+ border: 1px solid #DDD; }
45
+ div.scenarios div.row > div {
46
+ padding: 1em; }
47
+ div.scenarios div.row > div:first-child {
48
+ width: 35%;
49
+ border-right: 1px dotted #DDD; }
50
+ div.scenarios div.row > div:last-child {
51
+ width: 30%;
52
+ border-left: 1px dotted #DDD; }
53
+ div.scenarios div.row p {
54
+ font-size: 14px;
55
+ margin: 0; }
56
+ div.scenarios div.row p:not(:last-child) {
57
+ margin-bottom: 1em; }
58
+ div.scenarios div.row.header > div {
59
+ font-weight: 600;
60
+ padding: 0.5em 1em; }
61
+
62
+ /**
63
+ * Settings table
64
+ */
65
+ div.row:not(:last-child) > div:nth-child(2) {
66
+ padding-bottom: 0.5em; }
67
+ div.row > div.radio-sub label {
68
+ text-indent: 24px;
69
+ width: 200px; }
70
+ div.row p.about {
71
+ display: inline-block;
72
+ vertical-align: middle; }
73
+ div.row p.about.adjacent {
74
+ margin-left: 0.5em; }
75
+ div.row p.description {
76
+ display: inline-block;
77
+ font-size: 14px; }
78
+ div.row label.current {
79
+ font-weight: 600; }
80
+
81
+ /**
82
+ * Lazy load class name pairs
83
+ */
84
+ .pair-actions {
85
+ margin-top: 10px; }
86
+
87
+ .pair-sep {
88
+ margin-right: 1em; }
89
+
90
+ @media only screen and (max-width: 1024px) {
91
+ .lazyload-pairs .pair {
92
+ border: 1px solid #DDD;
93
+ padding: 5px 10px; } }
94
+ /**
95
+ * Number spinner
96
+ */
97
+ .number-style {
98
+ display: inline-block;
99
+ margin-right: 10px;
100
+ /**
101
+ * Disable text selection on buttons. Seems to help jittery pointers.
102
+ */ }
103
+ .number-style input {
104
+ margin: 0 5px;
105
+ font-family: Consolas, Monaco, monospace;
106
+ text-align: center;
107
+ width: 4em; }
108
+ .number-style > span {
109
+ cursor: pointer; }
110
+ .number-style > span.number-minus, .number-style > span.number-plus {
111
+ height: 24px;
112
+ width: 24px;
113
+ display: inline-block;
114
+ text-align: center;
115
+ vertical-align: top;
116
+ border-radius: 3px;
117
+ background: #0085ba;
118
+ border-width: 1px;
119
+ border-style: solid;
120
+ border-color: #0073aa #006799 #006799;
121
+ -webkit-box-shadow: 0 1px 0 #006799;
122
+ box-shadow: 0 1px 0 #006799;
123
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
124
+ color: #FFF; }
125
+ .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
126
+ background: #008ec2; }
127
+ .number-style > span.number-minus:active, .number-style > span.number-plus:active {
128
+ background: #0073aa;
129
+ border-color: #006799;
130
+ -webkit-box-shadow: inset 0 2px 0 #006799;
131
+ box-shadow: inset 0 2px 0 #006799;
132
+ -webkit-transform: translateY(1px);
133
+ -ms-transform: translateY(1px);
134
+ transform: translateY(1px);
135
+ outline: none; }
136
+ .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
137
+ background: #AAA;
138
+ border-color: #999 #777 #777;
139
+ -webkit-box-shadow: 0 1px 0 #777;
140
+ box-shadow: 0 1px 0 #777;
141
+ text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777; }
142
+ .number-style > span.number-minus::after, .number-style > span.number-plus::after {
143
+ font-family: dashicons;
144
+ font-size: 24px;
145
+ line-height: 24px;
146
+ height: 24px;
147
+ width: 24px;
148
+ display: inline-block;
149
+ color: #FFF;
150
+ text-align: center;
151
+ position: relative;
152
+ left: -1px; }
153
+ .number-style > span.number-minus::after {
154
+ content: "\f140"; }
155
+ .number-style > span.number-plus::after {
156
+ content: "\f142"; }
157
+ .number-style input[type='number'] {
158
+ -moz-appearance: textfield; }
159
+ .number-style input::-webkit-outer-spin-button,
160
+ .number-style input::-webkit-inner-spin-button {
161
+ -webkit-appearance: none; }
162
+ .number-style .number-minus,
163
+ .number-style .number-plus,
164
+ .number-style .number-minus::after,
165
+ .number-style .number-plus::after {
166
+ -webkit-touch-callout: none;
167
+ /* iOS Safari */
168
+ -webkit-user-select: none;
169
+ /* Safari */
170
+ -khtml-user-select: none;
171
+ /* Konqueror HTML */
172
+ -moz-user-select: none;
173
+ /* Firefox */
174
+ -ms-user-select: none;
175
+ /* Internet Explorer/Edge */
176
+ user-select: none;
177
+ /* Non-prefixed version, currently
178
+ supported by Chrome and Opera */ }
admin/css/admin-form.css CHANGED
@@ -1,138 +1,138 @@
1
-
2
- /* Settings tab for Form Notification Email
3
- ------------------------------------------------*/
4
- .match-height {
5
- /* match WordPress - divs with text inputs are taller than ones with radio buttons */
6
- margin: 0.25em 0 0.5em !important;
7
- }
8
- .email-container {
9
- display: flex;
10
- flex-direction: column;
11
- max-width: 900px;
12
- }
13
- .email-container > div {
14
- margin-bottom: 2px;
15
- }
16
- .email-option-row {
17
- display: flex;
18
- flex-direction: row;
19
- background: #FFF;
20
- padding: 0 10px;
21
- }
22
- .no-padding {
23
- padding: 0;
24
- }
25
- .email-option-row.column {
26
- flex-direction: column;
27
- }
28
- /* row > column 1 */
29
- .email-option-desc {
30
- flex: 0 0 8%;
31
- min-width: 80px;
32
- padding: 10px 0;
33
- font-weight: 600;
34
- }
35
- /* row > column 2 */
36
- .email-option-inputs {
37
- flex: 1 0 auto;
38
- flex-direction: column;
39
- }
40
- .email-option {
41
- flex: 0 0 100%;
42
- display: flex;
43
- flex-direction: row;
44
- }
45
- .email-option.header {
46
- padding: 10px 0;
47
- }
48
- .email-option.body {
49
- padding: 10px 0;
50
- }
51
- .email-option.footer {
52
- padding: 10px 0;
53
- }
54
- .email-option-first {
55
- margin-top: 10px ;
56
- }
57
- .email-option.single {
58
- }
59
- .email-option:not(:last-child) {
60
- border-bottom: 1px solid #F2F2F2;
61
- }
62
- .email-option-part { /* 2 columns */
63
- flex: 1 0 auto;
64
- display: flex;
65
- flex-direction: column;
66
- }
67
- .email-option-part:first-child {
68
- flex: 0 1 40%;
69
- padding-right: 20px;
70
- }
71
- .email-option-part input[type="text"],
72
- .email-option-part input[type="email"],
73
- input.wide {
74
- width: 100%;
75
- }
76
- .email-option-label {
77
- padding-left: 3px;
78
- }
79
- .email-option-fieldset {
80
- display: flex;
81
- flex-direction: row;
82
- }
83
- .email-option-fieldset .controls {
84
- flex: 0 0 30px;
85
- justify-content: center;
86
- }
87
- .email-option-fieldset .controls input[type="radio"] {
88
- margin-top: 2px;
89
- }
90
- .email-option-fieldset .fields {
91
- flex: 1 0 auto;
92
- }
93
- .email-option-fieldset .controls,
94
- .email-option-fieldset .fields {
95
- display: flex;
96
- height: 30px;
97
- align-items: center;
98
- }
99
-
100
- /* delete email recipient */
101
- .delete-recipient {
102
- color: #999;
103
- display: inline-block;
104
- transition: all 0.2s ease;
105
- }
106
- .delete-recipient:hover {
107
- cursor: pointer;
108
- color: #FFF;
109
- background: #FF0000;
110
- border-radius: 1px;
111
- }
112
-
113
- /* message */
114
- .email-container textarea {
115
- white-space: pre-wrap;
116
- width: 100%;
117
- }
118
-
119
- /* template tags */
120
- .template-tags-help {
121
- flex: 2 0 auto;
122
- background: #FFFFE0;
123
- }
124
- .template-tags-help ul {
125
- margin: 0;
126
- }
127
- .template-tags-help .title {
128
- background: rgba(0, 0, 0, 0.1);
129
- padding: 10px;
130
- }
131
- .template-tags-help .content {
132
- padding: 10px;
133
- }
134
- .template-tags-help ul li {
135
- display: inline-block;
136
- cursor: pointer;
137
- margin-right: 1em;
138
- }
1
+
2
+ /* Settings tab for Form Notification Email
3
+ ------------------------------------------------*/
4
+ .match-height {
5
+ /* match WordPress - divs with text inputs are taller than ones with radio buttons */
6
+ margin: 0.25em 0 0.5em !important;
7
+ }
8
+ .email-container {
9
+ display: flex;
10
+ flex-direction: column;
11
+ max-width: 900px;
12
+ }
13
+ .email-container > div {
14
+ margin-bottom: 2px;
15
+ }
16
+ .email-option-row {
17
+ display: flex;
18
+ flex-direction: row;
19
+ background: #FFF;
20
+ padding: 0 10px;
21
+ }
22
+ .no-padding {
23
+ padding: 0;
24
+ }
25
+ .email-option-row.column {
26
+ flex-direction: column;
27
+ }
28
+ /* row > column 1 */
29
+ .email-option-desc {
30
+ flex: 0 0 8%;
31
+ min-width: 80px;
32
+ padding: 10px 0;
33
+ font-weight: 600;
34
+ }
35
+ /* row > column 2 */
36
+ .email-option-inputs {
37
+ flex: 1 0 auto;
38
+ flex-direction: column;
39
+ }
40
+ .email-option {
41
+ flex: 0 0 100%;
42
+ display: flex;
43
+ flex-direction: row;
44
+ }
45
+ .email-option.header {
46
+ padding: 10px 0;
47
+ }
48
+ .email-option.body {
49
+ padding: 10px 0;
50
+ }
51
+ .email-option.footer {
52
+ padding: 10px 0;
53
+ }
54
+ .email-option-first {
55
+ margin-top: 10px ;
56
+ }
57
+ .email-option.single {
58
+ }
59
+ .email-option:not(:last-child) {
60
+ border-bottom: 1px solid #F2F2F2;
61
+ }
62
+ .email-option-part { /* 2 columns */
63
+ flex: 1 0 auto;
64
+ display: flex;
65
+ flex-direction: column;
66
+ }
67
+ .email-option-part:first-child {
68
+ flex: 0 1 40%;
69
+ padding-right: 20px;
70
+ }
71
+ .email-option-part input[type="text"],
72
+ .email-option-part input[type="email"],
73
+ input.wide {
74
+ width: 100%;
75
+ }
76
+ .email-option-label {
77
+ padding-left: 3px;
78
+ }
79
+ .email-option-fieldset {
80
+ display: flex;
81
+ flex-direction: row;
82
+ }
83
+ .email-option-fieldset .controls {
84
+ flex: 0 0 30px;
85
+ justify-content: center;
86
+ }
87
+ .email-option-fieldset .controls input[type="radio"] {
88
+ margin-top: 2px;
89
+ }
90
+ .email-option-fieldset .fields {
91
+ flex: 1 0 auto;
92
+ }
93
+ .email-option-fieldset .controls,
94
+ .email-option-fieldset .fields {
95
+ display: flex;
96
+ height: 30px;
97
+ align-items: center;
98
+ }
99
+
100
+ /* delete email recipient */
101
+ .delete-recipient {
102
+ color: #999;
103
+ display: inline-block;
104
+ transition: all 0.2s ease;
105
+ }
106
+ .delete-recipient:hover {
107
+ cursor: pointer;
108
+ color: #FFF;
109
+ background: #FF0000;
110
+ border-radius: 1px;
111
+ }
112
+
113
+ /* message */
114
+ .email-container textarea {
115
+ white-space: pre-wrap;
116
+ width: 100%;
117
+ }
118
+
119
+ /* template tags */
120
+ .template-tags-help {
121
+ flex: 2 0 auto;
122
+ background: #FFFFE0;
123
+ }
124
+ .template-tags-help ul {
125
+ margin: 0;
126
+ }
127
+ .template-tags-help .title {
128
+ background: rgba(0, 0, 0, 0.1);
129
+ padding: 10px;
130
+ }
131
+ .template-tags-help .content {
132
+ padding: 10px;
133
+ }
134
+ .template-tags-help ul li {
135
+ display: inline-block;
136
+ cursor: pointer;
137
+ margin-right: 1em;
138
+ }
admin/css/fields.css CHANGED
@@ -1,317 +1,317 @@
1
- /**
2
- * Strong Testimonials admin stylesheet
3
- */
4
-
5
- optgroup,
6
- optgroup option {
7
- /* Firefox */
8
- font-family: inherit;
9
- }
10
-
11
- /* structure */
12
-
13
- #left-col,
14
- #right-col {
15
- box-sizing: border-box;
16
- }
17
-
18
- #left-col {
19
- width: 55%;
20
- float: left;
21
- padding: 20px 0;
22
- }
23
-
24
- #right-col {
25
- width: calc(45% - 30px);
26
- float: right;
27
- padding: 20px 0 20px 0;
28
- }
29
-
30
- #wpmtst-custom-fields-form {
31
- width: 100%;
32
- }
33
-
34
- #fields-editor-preview {
35
- background: #fdfdfd;
36
- border: 1px solid #bbb;
37
- box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
38
- min-height: 300px;
39
- }
40
-
41
- .wrap.wpmtst {
42
- /*max-width: 1024px;*/
43
- max-width: 1366px;
44
- }
45
-
46
- .wrap.wpmtst h3 {
47
- margin-top: 0;
48
- }
49
-
50
- /* Custom fields
51
- ---------------------------------------------------------*/
52
-
53
- #custom-field-list {
54
- margin-bottom: 0;
55
- }
56
-
57
- #custom-field-list li {
58
- background: #fff;
59
- margin: 0;
60
- border: 1px solid #DDD;
61
- border-top-width: 0;
62
- }
63
-
64
- #custom-field-list li:first-child {
65
- border-top-width: 1px;
66
- }
67
-
68
- #custom-field-list li.ui-sortable-helper {
69
- border-bottom-width: 1px;
70
- box-shadow: 0 0 10px rgba(0,0,0,0.3);
71
- }
72
-
73
- #custom-field-list .custom-field-header {
74
- /*padding: 10px;*/
75
- font-size: 1.1em;
76
- height: 40px;
77
- }
78
-
79
- #custom-field-list span.link {
80
- display: inline-block;
81
- cursor: pointer;
82
- padding: 10px;
83
- width: calc(100% - 20px);
84
- }
85
-
86
- /* toggle */
87
-
88
- #custom-field-list span.link span.toggle:before {
89
- content: "\f140";
90
- display: inline-block;
91
- font: normal 20px/1 dashicons;
92
- float: right;
93
- color: #999;
94
- width: 20px;
95
- height: 20px;
96
- }
97
-
98
- /* handle */
99
-
100
- #custom-field-list .handle:before {
101
- content: "\f333";
102
- display: inline-block;
103
- font: normal 20px/1 dashicons;
104
- float: left;
105
- color: #999;
106
- width: 20px;
107
- height: 20px;
108
- margin-right: 10px;
109
- }
110
-
111
- #custom-field-list .handle:hover {
112
- color: #111;
113
- cursor: move;
114
- }
115
-
116
- #custom-field-list a.field {
117
- text-decoration: none;
118
- }
119
-
120
- /* open */
121
-
122
- #custom-field-list li.open {
123
- border-color: #2ea2cc;
124
- }
125
-
126
- #custom-field-list li .custom-field-header {
127
- transition: background 0.2s ease;
128
- }
129
-
130
- #custom-field-list li.open .custom-field-header {
131
- background: #2ea2cc;
132
- }
133
-
134
- #custom-field-list li.open span.toggle:before {
135
- content: "\f142";
136
- }
137
-
138
- #custom-field-list li.open span.handle:before,
139
- #custom-field-list li.open span.link a,
140
- #custom-field-list li.open span.toggle:before {
141
- color: #fff;
142
- }
143
-
144
- /* field inputs */
145
-
146
- #custom-field-list .custom-field {
147
- display: none;
148
- }
149
-
150
- #custom-field-list select.field-type {
151
- min-width: 120px;
152
- }
153
-
154
- #custom-field-list option[disabled] {
155
- color: #999;
156
- }
157
-
158
- #custom-field-list optgroup {
159
- font-weight: 600;
160
- }
161
-
162
- #custom-field-list optgroup:before {
163
- color: #333;
164
- content: attr(label);
165
- display: block;
166
- font-style: normal;
167
- padding-left: 4px;
168
- }
169
-
170
- #wpmtst-custom-fields-form .controls {
171
- padding: 10px 15px;
172
- background: #e7f5fa;
173
- border-top: 1px solid #A9D9EB;
174
- }
175
-
176
- #wpmtst-custom-fields-form .controls > span:nth-child(n+2):before {
177
- content: " | ";
178
- }
179
-
180
- #wpmtst-custom-fields-form .controls a.delete-field {
181
- color: #F00;
182
- }
183
-
184
- #custom-field-list .sortable-placeholder {
185
- border: 1px dashed #ccc !important;
186
- background: lightyellow !important;
187
- height: 40px;
188
- }
189
-
190
- #custom-field-list .field-table {
191
- border-collapse: collapse;
192
- width: 100%;
193
- }
194
-
195
- #custom-field-list .field-table th,
196
- #custom-field-list .field-table td {
197
- border-bottom: 1px solid #E8E8E8;
198
- padding: 10px;
199
- }
200
-
201
- #custom-field-list .field-table th {
202
- font-weight: 600;
203
- width: 160px;
204
- padding-top: 14px;
205
- text-align: left;
206
- vertical-align: top;
207
- white-space: nowrap;
208
- }
209
-
210
- #custom-field-list .field-table td input[type="text"] {
211
- width: 100%;
212
- }
213
-
214
- #custom-field-list .field-table td input[type="text"].as-number {
215
- width: 4em;
216
- }
217
-
218
- #custom-field-list .field-table td span.help {
219
- display: block;
220
- padding: 3px;
221
- }
222
-
223
- #custom-field-list .field-table td span.help.inline {
224
- display: inline-block;
225
- }
226
-
227
- #custom-field-list .field-table td span.help:first-of-type {
228
- margin-top: 5px;
229
- }
230
-
231
- #custom-field-list .form-error {
232
- background: rgba(242, 0, 0, 0.05);
233
- }
234
- #custom-field-list .form-error-text {
235
- color: #EE0000;
236
- }
237
-
238
- #custom-field-list .field-table tr:last-of-type th,
239
- #custom-field-list .field-table tr:last-of-type td {
240
- border-bottom: 0;
241
- }
242
-
243
- #add-field-bar {
244
- padding-top: 10px;
245
- text-align: right;
246
- }
247
-
248
- #add-field-bar input {
249
- margin-right: 0;
250
- margin-left: 10px;
251
- }
252
-
253
- /* field group actions */
254
-
255
- #field-group-actions {
256
- margin-top: 2em;
257
- }
258
-
259
- #field-group-actions > div {
260
- display: inline-block;
261
- float: left;
262
- margin-bottom: 1em;
263
- }
264
-
265
- #field-group-actions > div:not(:last-child) {
266
- margin-right: 1em;
267
- }
268
-
269
- /* field group label */
270
-
271
- p.field-group-label-wrap {
272
- display: table;
273
- width: 100%;
274
- }
275
-
276
- p.field-group-label-wrap > label,
277
- p.field-group-label-wrap > input {
278
- display: table-cell;
279
- font-size: 20px;
280
- line-height: 1.4em;
281
- }
282
-
283
- .field-group-label-wrap label {
284
- width: 6.5em;
285
- }
286
-
287
- p.field-group-label-wrap input {
288
- width: 100%;
289
- margin: 0;
290
- padding: 4px 8px;
291
- }
292
-
293
- /* fields editor */
294
-
295
- #fields-editor-wrap {
296
- display: inline-block;
297
- float: left;
298
- width: 540px;
299
- }
300
-
301
- /*--------------------------------------------------*
302
- Responsive
303
- *--------------------------------------------------*/
304
- @media only screen and (max-width: 1024px) {
305
-
306
- #left-col {
307
- width: 100%;
308
- padding: 20px 0;
309
- }
310
-
311
- #right-col {
312
- width: 100%;
313
- border-left: 0;
314
- padding: 20px;
315
- }
316
-
317
- }
1
+ /**
2
+ * Strong Testimonials admin stylesheet
3
+ */
4
+
5
+ optgroup,
6
+ optgroup option {
7
+ /* Firefox */
8
+ font-family: inherit;
9
+ }
10
+
11
+ /* structure */
12
+
13
+ #left-col,
14
+ #right-col {
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ #left-col {
19
+ width: 55%;
20
+ float: left;
21
+ padding: 20px 0;
22
+ }
23
+
24
+ #right-col {
25
+ width: calc(45% - 30px);
26
+ float: right;
27
+ padding: 20px 0 20px 0;
28
+ }
29
+
30
+ #wpmtst-custom-fields-form {
31
+ width: 100%;
32
+ }
33
+
34
+ #fields-editor-preview {
35
+ background: #fdfdfd;
36
+ border: 1px solid #bbb;
37
+ box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
38
+ min-height: 300px;
39
+ }
40
+
41
+ .wrap.wpmtst {
42
+ /*max-width: 1024px;*/
43
+ max-width: 1366px;
44
+ }
45
+
46
+ .wrap.wpmtst h3 {
47
+ margin-top: 0;
48
+ }
49
+
50
+ /* Custom fields
51
+ ---------------------------------------------------------*/
52
+
53
+ #custom-field-list {
54
+ margin-bottom: 0;
55
+ }
56
+
57
+ #custom-field-list li {
58
+ background: #fff;
59
+ margin: 0;
60
+ border: 1px solid #DDD;
61
+ border-top-width: 0;
62
+ }
63
+
64
+ #custom-field-list li:first-child {
65
+ border-top-width: 1px;
66
+ }
67
+
68
+ #custom-field-list li.ui-sortable-helper {
69
+ border-bottom-width: 1px;
70
+ box-shadow: 0 0 10px rgba(0,0,0,0.3);
71
+ }
72
+
73
+ #custom-field-list .custom-field-header {
74
+ /*padding: 10px;*/
75
+ font-size: 1.1em;
76
+ height: 40px;
77
+ }
78
+
79
+ #custom-field-list span.link {
80
+ display: inline-block;
81
+ cursor: pointer;
82
+ padding: 10px;
83
+ width: calc(100% - 20px);
84
+ }
85
+
86
+ /* toggle */
87
+
88
+ #custom-field-list span.link span.toggle:before {
89
+ content: "\f140";
90
+ display: inline-block;
91
+ font: normal 20px/1 dashicons;
92
+ float: right;
93
+ color: #999;
94
+ width: 20px;
95
+ height: 20px;
96
+ }
97
+
98
+ /* handle */
99
+
100
+ #custom-field-list .handle:before {
101
+ content: "\f333";
102
+ display: inline-block;
103
+ font: normal 20px/1 dashicons;
104
+ float: left;
105
+ color: #999;
106
+ width: 20px;
107
+ height: 20px;
108
+ margin-right: 10px;
109
+ }
110
+
111
+ #custom-field-list .handle:hover {
112
+ color: #111;
113
+ cursor: move;
114
+ }
115
+
116
+ #custom-field-list a.field {
117
+ text-decoration: none;
118
+ }
119
+
120
+ /* open */
121
+
122
+ #custom-field-list li.open {
123
+ border-color: #2ea2cc;
124
+ }
125
+
126
+ #custom-field-list li .custom-field-header {
127
+ transition: background 0.2s ease;
128
+ }
129
+
130
+ #custom-field-list li.open .custom-field-header {
131
+ background: #2ea2cc;
132
+ }
133
+
134
+ #custom-field-list li.open span.toggle:before {
135
+ content: "\f142";
136
+ }
137
+
138
+ #custom-field-list li.open span.handle:before,
139
+ #custom-field-list li.open span.link a,
140
+ #custom-field-list li.open span.toggle:before {
141
+ color: #fff;
142
+ }
143
+
144
+ /* field inputs */
145
+
146
+ #custom-field-list .custom-field {
147
+ display: none;
148
+ }
149
+
150
+ #custom-field-list select.field-type {
151
+ min-width: 120px;
152
+ }
153
+
154
+ #custom-field-list option[disabled] {
155
+ color: #999;
156
+ }
157
+
158
+ #custom-field-list optgroup {
159
+ font-weight: 600;
160
+ }
161
+
162
+ #custom-field-list optgroup:before {
163
+ color: #333;
164
+ content: attr(label);
165
+ display: block;
166
+ font-style: normal;
167
+ padding-left: 4px;
168
+ }
169
+
170
+ #wpmtst-custom-fields-form .controls {
171
+ padding: 10px 15px;
172
+ background: #e7f5fa;
173
+ border-top: 1px solid #A9D9EB;
174
+ }
175
+
176
+ #wpmtst-custom-fields-form .controls > span:nth-child(n+2):before {
177
+ content: " | ";
178
+ }
179
+
180
+ #wpmtst-custom-fields-form .controls a.delete-field {
181
+ color: #F00;
182
+ }
183
+
184
+ #custom-field-list .sortable-placeholder {
185
+ border: 1px dashed #ccc !important;
186
+ background: lightyellow !important;
187
+ height: 40px;
188
+ }
189
+
190
+ #custom-field-list .field-table {
191
+ border-collapse: collapse;
192
+ width: 100%;
193
+ }
194
+
195
+ #custom-field-list .field-table th,
196
+ #custom-field-list .field-table td {
197
+ border-bottom: 1px solid #E8E8E8;
198
+ padding: 10px;
199
+ }
200
+
201
+ #custom-field-list .field-table th {
202
+ font-weight: 600;
203
+ width: 160px;
204
+ padding-top: 14px;
205
+ text-align: left;
206
+ vertical-align: top;
207
+ white-space: nowrap;
208
+ }
209
+
210
+ #custom-field-list .field-table td input[type="text"] {
211
+ width: 100%;
212
+ }
213
+
214
+ #custom-field-list .field-table td input[type="text"].as-number {
215
+ width: 4em;
216
+ }
217
+
218
+ #custom-field-list .field-table td span.help {
219
+ display: block;
220
+ padding: 3px;
221
+ }
222
+
223
+ #custom-field-list .field-table td span.help.inline {
224
+ display: inline-block;
225
+ }
226
+
227
+ #custom-field-list .field-table td span.help:first-of-type {
228
+ margin-top: 5px;
229
+ }
230
+
231
+ #custom-field-list .form-error {
232
+ background: rgba(242, 0, 0, 0.05);
233
+ }
234
+ #custom-field-list .form-error-text {
235
+ color: #EE0000;
236
+ }
237
+
238
+ #custom-field-list .field-table tr:last-of-type th,
239
+ #custom-field-list .field-table tr:last-of-type td {
240
+ border-bottom: 0;
241
+ }
242
+
243
+ #add-field-bar {
244
+ padding-top: 10px;
245
+ text-align: right;
246
+ }
247
+
248
+ #add-field-bar input {
249
+ margin-right: 0;
250
+ margin-left: 10px;
251
+ }
252
+
253
+ /* field group actions */
254
+
255
+ #field-group-actions {
256
+ margin-top: 2em;
257
+ }
258
+
259
+ #field-group-actions > div {
260
+ display: inline-block;
261
+ float: left;
262
+ margin-bottom: 1em;
263
+ }
264
+
265
+ #field-group-actions > div:not(:last-child) {
266
+ margin-right: 1em;
267
+ }
268
+
269
+ /* field group label */
270
+
271
+ p.field-group-label-wrap {
272
+ display: table;
273
+ width: 100%;
274
+ }
275
+
276
+ p.field-group-label-wrap > label,
277
+ p.field-group-label-wrap > input {
278
+ display: table-cell;
279
+ font-size: 20px;
280
+ line-height: 1.4em;
281
+ }
282
+
283
+ .field-group-label-wrap label {
284
+ width: 6.5em;
285
+ }
286
+
287
+ p.field-group-label-wrap input {
288
+ width: 100%;
289
+ margin: 0;
290
+ padding: 4px 8px;
291
+ }
292
+
293
+ /* fields editor */
294
+
295
+ #fields-editor-wrap {
296
+ display: inline-block;
297
+ float: left;
298
+ width: 540px;
299
+ }
300
+
301
+ /*--------------------------------------------------*
302
+ Responsive
303
+ *--------------------------------------------------*/
304
+ @media only screen and (max-width: 1024px) {
305
+
306
+ #left-col {
307
+ width: 100%;
308
+ padding: 20px 0;
309
+ }
310
+
311
+ #right-col {
312
+ width: 100%;
313
+ border-left: 0;
314
+ padding: 20px;
315
+ }
316
+
317
+ }
admin/css/form-preview.css CHANGED
@@ -1,135 +1,135 @@
1
- /**
2
- * Strong Testimonials Default Form template
3
- */
4
- .strong-form {
5
- margin: 0 auto;
6
- padding: 20px;
7
- }
8
-
9
- .strong-form .form-field {
10
- margin-bottom: 1.5em;
11
- }
12
-
13
- .strong-form .form-field.submit {
14
- margin-bottom: 1em;
15
- padding: 0;
16
- }
17
-
18
- .strong-form .required.symbol:after {
19
- content: '*';
20
- color: #FF0000;
21
- margin: 0 4px;
22
- }
23
-
24
- .strong-form label {
25
- display: inline-block;
26
- float: none;
27
- }
28
-
29
- .strong-form input[type="text"],
30
- .strong-form input[type="email"],
31
- .strong-form input[type="url"],
32
- .strong-form input[type="file"],
33
- .strong-form select,
34
- .strong-form textarea {
35
- box-sizing: border-box;
36
- display: block;
37
- float: none;
38
- width: 100%;
39
- margin: 3px 0;
40
- padding: 1px 5px;
41
- }
42
-
43
- .strong-form input[type="checkbox"] {
44
- margin-right: 0.5em;
45
- }
46
-
47
- .strong-form input[type="checkbox"] + label {
48
- font-weight: 400;
49
- }
50
-
51
- .strong-form textarea {
52
- height: 12em;
53
- }
54
-
55
- .strong-form span.error,
56
- .strong-form label.error {
57
- display: block;
58
- }
59
-
60
- .strong-form .before {
61
- display: block;
62
- }
63
-
64
- .strong-form .after {
65
- display: block;
66
- }
67
-
68
- input.captcha {
69
- display: block;
70
- width: auto;
71
- }
72
-
73
- img.captcha {
74
- border: 0;
75
- }
76
-
77
- .wpmtst-captcha {
78
- margin-bottom: 1em;
79
- }
80
-
81
- .strong-form label {
82
- font-weight: 700;
83
- }
84
-
85
- .strong-form .form-field .after {
86
- font-style: italic;
87
- }
88
-
89
- .strong-form input.error,
90
- .strong-form textarea.error,
91
- .strong-form select.error {
92
- background: #F9E5E6;
93
- border: 1px solid #E8AAAD;
94
- color: #B50007;
95
- }
96
-
97
- .strong-form span.error,
98
- .strong-form label.error {
99
- color: #B50007;
100
- }
101
-
102
- /* category checklist */
103
-
104
- .strong-category-list-panel {
105
- margin: 3px 0;
106
- }
107
-
108
- .strong-category-list,
109
- .strong-category-list ul {
110
- list-style-type: none;
111
- }
112
-
113
- .strong-category-list {
114
- margin: 0;
115
- }
116
-
117
- .strong-category-list ul {
118
- margin-left: 20px;
119
- }
120
-
121
- .strong-category-list li {
122
- line-height: normal;
123
- margin-bottom: 0;
124
- }
125
-
126
- .strong-category-list input[type="checkbox"] {
127
- margin: 0;
128
- }
129
-
130
- .strong-category-list label {
131
- font-weight: 400;
132
- white-space: nowrap;
133
- word-wrap: break-word;
134
- }
135
-
1
+ /**
2
+ * Strong Testimonials Default Form template
3
+ */
4
+ .strong-form {
5
+ margin: 0 auto;
6
+ padding: 20px;
7
+ }
8
+
9
+ .strong-form .form-field {
10
+ margin-bottom: 1.5em;
11
+ }
12
+
13
+ .strong-form .form-field.submit {
14
+ margin-bottom: 1em;
15
+ padding: 0;
16
+ }
17
+
18
+ .strong-form .required.symbol:after {
19
+ content: '*';
20
+ color: #FF0000;
21
+ margin: 0 4px;
22
+ }
23
+
24
+ .strong-form label {
25
+ display: inline-block;
26
+ float: none;
27
+ }
28
+
29
+ .strong-form input[type="text"],
30
+ .strong-form input[type="email"],
31
+ .strong-form input[type="url"],
32
+ .strong-form input[type="file"],
33
+ .strong-form select,
34
+ .strong-form textarea {
35
+ box-sizing: border-box;
36
+ display: block;
37
+ float: none;
38
+ width: 100%;
39
+ margin: 3px 0;
40
+ padding: 1px 5px;
41
+ }
42
+
43
+ .strong-form input[type="checkbox"] {
44
+ margin-right: 0.5em;
45
+ }
46
+
47
+ .strong-form input[type="checkbox"] + label {
48
+ font-weight: 400;
49
+ }
50
+
51
+ .strong-form textarea {
52
+ height: 12em;
53
+ }
54
+
55
+ .strong-form span.error,
56
+ .strong-form label.error {
57
+ display: block;
58
+ }
59
+
60
+ .strong-form .before {
61
+ display: block;
62
+ }
63
+
64
+ .strong-form .after {
65
+ display: block;
66
+ }
67
+
68
+ input.captcha {
69
+ display: block;
70
+ width: auto;
71
+ }
72
+
73
+ img.captcha {
74
+ border: 0;
75
+ }
76
+
77
+ .wpmtst-captcha {
78
+ margin-bottom: 1em;
79
+ }
80
+
81
+ .strong-form label {
82
+ font-weight: 700;
83
+ }
84
+
85
+ .strong-form .form-field .after {
86
+ font-style: italic;
87
+ }
88
+
89
+ .strong-form input.error,
90
+ .strong-form textarea.error,
91
+ .strong-form select.error {
92
+ background: #F9E5E6;
93
+ border: 1px solid #E8AAAD;
94
+ color: #B50007;
95
+ }
96
+
97
+ .strong-form span.error,
98
+ .strong-form label.error {
99
+ color: #B50007;
100
+ }
101
+
102
+ /* category checklist */
103
+
104
+ .strong-category-list-panel {
105
+ margin: 3px 0;
106
+ }
107
+
108
+ .strong-category-list,
109
+ .strong-category-list ul {
110
+ list-style-type: none;
111
+ }
112
+
113
+ .strong-category-list {
114
+ margin: 0;
115
+ }
116
+
117
+ .strong-category-list ul {
118
+ margin-left: 20px;
119
+ }
120
+
121
+ .strong-category-list li {
122
+ line-height: normal;
123
+ margin-bottom: 0;
124
+ }
125
+
126
+ .strong-category-list input[type="checkbox"] {
127
+ margin: 0;
128
+ }
129
+
130
+ .strong-category-list label {
131
+ font-weight: 400;
132
+ white-space: nowrap;
133
+ word-wrap: break-word;
134
+ }
135
+
admin/css/number-spinner.css CHANGED
@@ -1,98 +1,98 @@
1
- /**
2
- * Number spinner
3
- */
4
- .number-style {
5
- display: inline-block;
6
- margin-right: 10px;
7
- /**
8
- * Disable text selection on buttons. Seems to help jittery pointers.
9
- */
10
- }
11
- .number-style input {
12
- margin: 0 5px;
13
- font-family: Consolas, Monaco, monospace;
14
- text-align: center;
15
- width: 4em;
16
- }
17
- .number-style > span {
18
- cursor: pointer;
19
- }
20
- .number-style > span.number-minus, .number-style > span.number-plus {
21
- height: 24px;
22
- width: 24px;
23
- display: inline-block;
24
- text-align: center;
25
- vertical-align: top;
26
- border-radius: 3px;
27
- background: #0085ba;
28
- border-width: 1px;
29
- border-style: solid;
30
- border-color: #0073aa #006799 #006799;
31
- -webkit-box-shadow: 0 1px 0 #006799;
32
- box-shadow: 0 1px 0 #006799;
33
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
34
- color: #FFF;
35
- }
36
- .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
37
- background: #008ec2;
38
- }
39
- .number-style > span.number-minus:active, .number-style > span.number-plus:active {
40
- background: #0073aa;
41
- border-color: #006799;
42
- -webkit-box-shadow: inset 0 2px 0 #006799;
43
- box-shadow: inset 0 2px 0 #006799;
44
- -webkit-transform: translateY(1px);
45
- -ms-transform: translateY(1px);
46
- transform: translateY(1px);
47
- outline: none;
48
- }
49
- .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
50
- background: #AAA;
51
- border-color: #999 #777 #777;
52
- -webkit-box-shadow: 0 1px 0 #777;
53
- box-shadow: 0 1px 0 #777;
54
- text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
55
- }
56
- .number-style > span.number-minus::after, .number-style > span.number-plus::after {
57
- font-family: dashicons;
58
- font-size: 24px;
59
- line-height: 24px;
60
- height: 24px;
61
- width: 24px;
62
- display: inline-block;
63
- color: #FFF;
64
- text-align: center;
65
- position: relative;
66
- left: -1px;
67
- }
68
- .number-style > span.number-minus::after {
69
- content: "\f140";
70
- }
71
- .number-style > span.number-plus::after {
72
- content: "\f142";
73
- }
74
- .number-style input[type='number'] {
75
- -moz-appearance: textfield;
76
- }
77
- .number-style input::-webkit-outer-spin-button,
78
- .number-style input::-webkit-inner-spin-button {
79
- -webkit-appearance: none;
80
- }
81
- .number-style .number-minus,
82
- .number-style .number-plus,
83
- .number-style .number-minus::after,
84
- .number-style .number-plus::after {
85
- -webkit-touch-callout: none;
86
- /* iOS Safari */
87
- -webkit-user-select: none;
88
- /* Safari */
89
- -khtml-user-select: none;
90
- /* Konqueror HTML */
91
- -moz-user-select: none;
92
- /* Firefox */
93
- -ms-user-select: none;
94
- /* Internet Explorer/Edge */
95
- user-select: none;
96
- /* Non-prefixed version, currently
97
- supported by Chrome and Opera */
98
- }
1
+ /**
2
+ * Number spinner
3
+ */
4
+ .number-style {
5
+ display: inline-block;
6
+ margin-right: 10px;
7
+ /**
8
+ * Disable text selection on buttons. Seems to help jittery pointers.
9
+ */
10
+ }
11
+ .number-style input {
12
+ margin: 0 5px;
13
+ font-family: Consolas, Monaco, monospace;
14
+ text-align: center;
15
+ width: 4em;
16
+ }
17
+ .number-style > span {
18
+ cursor: pointer;
19
+ }
20
+ .number-style > span.number-minus, .number-style > span.number-plus {
21
+ height: 24px;
22
+ width: 24px;
23
+ display: inline-block;
24
+ text-align: center;
25
+ vertical-align: top;
26
+ border-radius: 3px;
27
+ background: #0085ba;
28
+ border-width: 1px;
29
+ border-style: solid;
30
+ border-color: #0073aa #006799 #006799;
31
+ -webkit-box-shadow: 0 1px 0 #006799;
32
+ box-shadow: 0 1px 0 #006799;
33
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
34
+ color: #FFF;
35
+ }
36
+ .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
37
+ background: #008ec2;
38
+ }
39
+ .number-style > span.number-minus:active, .number-style > span.number-plus:active {
40
+ background: #0073aa;
41
+ border-color: #006799;
42
+ -webkit-box-shadow: inset 0 2px 0 #006799;
43
+ box-shadow: inset 0 2px 0 #006799;
44
+ -webkit-transform: translateY(1px);
45
+ -ms-transform: translateY(1px);
46
+ transform: translateY(1px);
47
+ outline: none;
48
+ }
49
+ .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
50
+ background: #AAA;
51
+ border-color: #999 #777 #777;
52
+ -webkit-box-shadow: 0 1px 0 #777;
53
+ box-shadow: 0 1px 0 #777;
54
+ text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
55
+ }
56
+ .number-style > span.number-minus::after, .number-style > span.number-plus::after {
57
+ font-family: dashicons;
58
+ font-size: 24px;
59
+ line-height: 24px;
60
+ height: 24px;
61
+ width: 24px;
62
+ display: inline-block;
63
+ color: #FFF;
64
+ text-align: center;
65
+ position: relative;
66
+ left: -1px;
67
+ }
68
+ .number-style > span.number-minus::after {
69
+ content: "\f140";
70
+ }
71
+ .number-style > span.number-plus::after {
72
+ content: "\f142";
73
+ }
74
+ .number-style input[type='number'] {
75
+ -moz-appearance: textfield;
76
+ }
77
+ .number-style input::-webkit-outer-spin-button,
78
+ .number-style input::-webkit-inner-spin-button {
79
+ -webkit-appearance: none;
80
+ }
81
+ .number-style .number-minus,
82
+ .number-style .number-plus,
83
+ .number-style .number-minus::after,
84
+ .number-style .number-plus::after {
85
+ -webkit-touch-callout: none;
86
+ /* iOS Safari */
87
+ -webkit-user-select: none;
88
+ /* Safari */
89
+ -khtml-user-select: none;
90
+ /* Konqueror HTML */
91
+ -moz-user-select: none;
92
+ /* Firefox */
93
+ -ms-user-select: none;
94
+ /* Internet Explorer/Edge */
95
+ user-select: none;
96
+ /* Non-prefixed version, currently
97
+ supported by Chrome and Opera */
98
+ }
admin/css/order.css CHANGED
@@ -1,129 +1,129 @@
1
- /**
2
- * Admin list order
3
- * Strong Testimonials
4
- */
5
-
6
- th.manage-column.column-handle {
7
- width: 3em;
8
- text-align: center;
9
- }
10
-
11
- td.column-handle {
12
- text-align: center;
13
- padding-top: 10px;
14
- }
15
-
16
- #the-list:not(.ui-sortable-disabled) td.column-handle {
17
- cursor: move;
18
- }
19
-
20
- #the-list:not(.ui-sortable-disabled) tr.reorder-hover {
21
- background: #E7F8FD;
22
- }
23
-
24
- td.column-handle .help:before,
25
- td.column-handle .help-in-motion:before {
26
- font-size: 20px;
27
- width: 1em;
28
- margin: 0 auto;
29
- color: #aaa;
30
- }
31
-
32
- td.column-handle .help:before {
33
- content: "";
34
- background: #aaa;
35
- background-size: contain;
36
- width: 20px;
37
- height: 20px;
38
- display: inline-block;
39
- -webkit-mask: url('../img/bars-solid.svg') center center no-repeat;
40
- mask: url('../img/bars-solid.svg') center center no-repeat;
41
- }
42
-
43
- td.column-handle .help-in-motion:before {
44
- content: "";
45
- background: #111;
46
- background-size: contain;
47
- width: 20px;
48
- height: 20px;
49
- color: #111;
50
- font-size: 20px;
51
- display: none;
52
- -webkit-mask: url('../img/hand-rock-regular.svg') center center no-repeat;
53
- mask: url('../img/hand-rock-regular.svg') center center no-repeat;
54
- }
55
-
56
- #the-list:not(.ui-sortable-disabled) td.column-handle:not(.refresh):hover .help:before {
57
- content: "";
58
- background: #111;
59
- background-size: contain;
60
- width: 20px;
61
- height: 20px;
62
- color: #111;
63
- font-size: 20px;
64
- display: inline-block;
65
- -webkit-mask: url('../img/hand-paper-regular.svg') center center no-repeat;
66
- mask: url('../img/hand-paper-regular.svg') center center no-repeat;
67
-
68
- }
69
-
70
- .ui-sortable tr.ui-sortable-helper {
71
- background: rgba(187,235,250,0.6) !important;
72
- border: 1px solid #DFDFDF;
73
- }
74
-
75
- .ui-sortable tr.ui-sortable-helper .help:before {
76
- display: none !important;
77
- }
78
-
79
- .ui-sortable tr.ui-sortable-helper .help-in-motion:before {
80
- display: block;
81
- }
82
-
83
- .sortable-placeholder {
84
- background: #E7F8FD;
85
- }
86
-
87
- @-webkit-keyframes spin {
88
- 0% {
89
- -webkit-transform: rotate(0deg);
90
- transform: rotate(0deg);
91
- }
92
-
93
- 100% {
94
- -webkit-transform: rotate(359deg);
95
- transform: rotate(359deg);
96
- }
97
- }
98
-
99
- @keyframes spin {
100
- 0% {
101
- -webkit-transform: rotate(0deg);
102
- -ms-transform: rotate(0deg);
103
- transform: rotate(0deg);
104
- }
105
-
106
- 100% {
107
- -webkit-transform: rotate(359deg);
108
- -ms-transform: rotate(359deg);
109
- transform: rotate(359deg);
110
- }
111
- }
112
-
113
- td.column-handle.refresh .help:before {
114
- content: "";
115
- background: #0073AA;
116
- background-size: contain;
117
- width: 20px;
118
- height: 20px;
119
- font-size: 20px;
120
- display: inline-block;
121
- color: #0073AA;
122
- mask: url('../img/spinner-solid.svg') center center no-repeat;
123
- -webkit-mask: url('../img/spinner-solid.svg') center center no-repeat;
124
- }
125
-
126
- td.column-handle.refresh .help {
127
- -webkit-animation: spin 1.5s linear infinite;
128
- animation: spin 1.5s linear infinite;
129
- }
1
+ /**
2
+ * Admin list order
3
+ * Strong Testimonials
4
+ */
5
+
6
+ th.manage-column.column-handle {
7
+ width: 3em;
8
+ text-align: center;
9
+ }
10
+
11
+ td.column-handle {
12
+ text-align: center;
13
+ padding-top: 10px;
14
+ }
15
+
16
+ #the-list:not(.ui-sortable-disabled) td.column-handle {
17
+ cursor: move;
18
+ }
19
+
20
+ #the-list:not(.ui-sortable-disabled) tr.reorder-hover {
21
+ background: #E7F8FD;
22
+ }
23
+
24
+ td.column-handle .help:before,
25
+ td.column-handle .help-in-motion:before {
26
+ font-size: 20px;
27
+ width: 1em;
28
+ margin: 0 auto;
29
+ color: #aaa;
30
+ }
31
+
32
+ td.column-handle .help:before {
33
+ content: "";
34
+ background: #aaa;
35
+ background-size: contain;
36
+ width: 20px;
37
+ height: 20px;
38
+ display: inline-block;
39
+ -webkit-mask: url('../img/bars-solid.svg') center center no-repeat;
40
+ mask: url('../img/bars-solid.svg') center center no-repeat;
41
+ }
42
+
43
+ td.column-handle .help-in-motion:before {
44
+ content: "";
45
+ background: #111;
46
+ background-size: contain;
47
+ width: 20px;
48
+ height: 20px;
49
+ color: #111;
50
+ font-size: 20px;
51
+ display: none;
52
+ -webkit-mask: url('../img/hand-rock-regular.svg') center center no-repeat;
53
+ mask: url('../img/hand-rock-regular.svg') center center no-repeat;
54
+ }
55
+
56
+ #the-list:not(.ui-sortable-disabled) td.column-handle:not(.refresh):hover .help:before {
57
+ content: "";
58
+ background: #111;
59
+ background-size: contain;
60
+ width: 20px;
61
+ height: 20px;
62
+ color: #111;
63
+ font-size: 20px;
64
+ display: inline-block;
65
+ -webkit-mask: url('../img/hand-paper-regular.svg') center center no-repeat;
66
+ mask: url('../img/hand-paper-regular.svg') center center no-repeat;
67
+
68
+ }
69
+
70
+ .ui-sortable tr.ui-sortable-helper {
71
+ background: rgba(187,235,250,0.6) !important;
72
+ border: 1px solid #DFDFDF;
73
+ }
74
+
75
+ .ui-sortable tr.ui-sortable-helper .help:before {
76
+ display: none !important;
77
+ }
78
+
79
+ .ui-sortable tr.ui-sortable-helper .help-in-motion:before {
80
+ display: block;
81
+ }
82
+
83
+ .sortable-placeholder {
84
+ background: #E7F8FD;
85
+ }
86
+
87
+ @-webkit-keyframes spin {
88
+ 0% {
89
+ -webkit-transform: rotate(0deg);
90
+ transform: rotate(0deg);
91
+ }
92
+
93
+ 100% {
94
+ -webkit-transform: rotate(359deg);
95
+ transform: rotate(359deg);
96
+ }
97
+ }
98
+
99
+ @keyframes spin {
100
+ 0% {
101
+ -webkit-transform: rotate(0deg);
102
+ -ms-transform: rotate(0deg);
103
+ transform: rotate(0deg);
104
+ }
105
+
106
+ 100% {
107
+ -webkit-transform: rotate(359deg);
108
+ -ms-transform: rotate(359deg);
109
+ transform: rotate(359deg);
110
+ }
111
+ }
112
+
113
+ td.column-handle.refresh .help:before {
114
+ content: "";
115
+ background: #0073AA;
116
+ background-size: contain;
117
+ width: 20px;
118
+ height: 20px;
119
+ font-size: 20px;
120
+ display: inline-block;
121
+ color: #0073AA;
122
+ mask: url('../img/spinner-solid.svg') center center no-repeat;
123
+ -webkit-mask: url('../img/spinner-solid.svg') center center no-repeat;
124
+ }
125
+
126
+ td.column-handle.refresh .help {
127
+ -webkit-animation: spin 1.5s linear infinite;
128
+ animation: spin 1.5s linear infinite;
129
+ }
admin/css/polylang.css CHANGED
@@ -1,8 +1,8 @@
1
- .wp-list-table.stringstranslations .column-name {
2
- width: 15%;
3
- word-break: normal;
4
- }
5
-
6
- form#string-translation .tablenav .actions select {
7
- max-width: 300px;
8
  }
1
+ .wp-list-table.stringstranslations .column-name {
2
+ width: 15%;
3
+ word-break: normal;
4
+ }
5
+
6
+ form#string-translation .tablenav .actions select {
7
+ max-width: 300px;
8
  }
admin/css/post-editor.css CHANGED
@@ -1,114 +1,114 @@
1
- /* Client details meta box
2
- ------------------------------------------------*/
3
- #details table {
4
- border: none;
5
- width: 100%;
6
- }
7
-
8
- #details th {
9
- font-weight: 400;
10
- text-align: right;
11
- vertical-align: top;
12
- padding-top: 8px;
13
- }
14
-
15
- #details td {
16
- margin: 5px;
17
- padding: 5px;
18
- }
19
-
20
- #details tr:first-child td > p:first-child {
21
- margin-top: 0;
22
- }
23
-
24
- input[type="text"].custom-input,
25
- input[type="email"].custom-input,
26
- input[type="url"].custom-input,
27
- textarea.custom-input {
28
- width: 100%;
29
- }
30
-
31
- div.checkbox {
32
- height: 28px;
33
- padding: 3px 0 5px;
34
- }
35
-
36
- div.checkbox input[type="checkbox"] {
37
- margin: 1px;
38
- padding: 3px 5px;
39
- }
40
-
41
- .input-url {
42
- display: inline-block;
43
- }
44
-
45
- .input-url {
46
- width: calc(100% - 210px);
47
- }
48
-
49
- .input-links {
50
- display: flex;
51
- }
52
-
53
- /*.input-nofollow {
54
- float: right;
55
- }*/
56
-
57
- label.nowrap {
58
- word-break: keep-all;
59
- white-space: nowrap;
60
- }
61
-
62
- label.nowrap code {
63
- position: relative;
64
- top: -2px;
65
- }
66
-
67
- /* Post Publish Meta Box
68
- --------------------------------------*/
69
- .wpmtst-pub-section {
70
- padding: 6px 10px 8px;
71
- }
72
-
73
- #submit-timestamp {
74
- padding: 2px 0 1px 0;
75
- }
76
-
77
- #submit-timestamp:before {
78
- content: "\f175";
79
- top: -1px;
80
- color: #82878c;
81
- font: normal 20px/1 dashicons;
82
- display: inline-block;
83
- padding: 0 2px 0 0;
84
- left: -1px;
85
- position: relative;
86
- vertical-align: top;
87
- }
88
-
89
- /* Star rating in post editor
90
- --------------------------------------------------*/
91
- .edit-rating-box {
92
- height: 27px;
93
- line-height: 27px;
94
- }
95
-
96
- .wp-core-ui .edit-rating-box button {
97
- margin-left: 0;
98
- }
99
-
100
- .edit-rating-box .cancel,
101
- .edit-rating-box .zero {
102
- padding: 0;
103
- text-decoration: underline;
104
- color: #0073aa;
105
- }
106
-
107
- .rating .inner,
108
- .edit-rating-buttons-1,
109
- .edit-rating-buttons-2,
110
- .edit-rating-success {
111
- display: inline-block;
112
- margin-left: 5px;
113
- vertical-align: middle;
114
- }
1
+ /* Client details meta box
2
+ ------------------------------------------------*/
3
+ #details table {
4
+ border: none;
5
+ width: 100%;
6
+ }
7
+
8
+ #details th {
9
+ font-weight: 400;
10
+ text-align: right;
11
+ vertical-align: top;
12
+ padding-top: 8px;
13
+ }
14
+
15
+ #details td {
16
+ margin: 5px;
17
+ padding: 5px;
18
+ }
19
+
20
+ #details tr:first-child td > p:first-child {
21
+ margin-top: 0;
22
+ }
23
+
24
+ input[type="text"].custom-input,
25
+ input[type="email"].custom-input,
26
+ input[type="url"].custom-input,
27
+ textarea.custom-input {
28
+ width: 100%;
29
+ }
30
+
31
+ div.checkbox {
32
+ height: 28px;
33
+ padding: 3px 0 5px;
34
+ }
35
+
36
+ div.checkbox input[type="checkbox"] {
37
+ margin: 1px;
38
+ padding: 3px 5px;
39
+ }
40
+
41
+ .input-url {
42
+ display: inline-block;
43
+ }
44
+
45
+ .input-url {
46
+ width: calc(100% - 210px);
47
+ }
48
+
49
+ .input-links {
50
+ display: flex;
51
+ }
52
+
53
+ /*.input-nofollow {
54
+ float: right;
55
+ }*/
56
+
57
+ label.nowrap {
58
+ word-break: keep-all;
59
+ white-space: nowrap;
60
+ }
61
+
62
+ label.nowrap code {
63
+ position: relative;
64
+ top: -2px;
65
+ }
66
+
67
+ /* Post Publish Meta Box
68
+ --------------------------------------*/
69
+ .wpmtst-pub-section {
70
+ padding: 6px 10px 8px;
71
+ }
72
+
73
+ #submit-timestamp {
74
+ padding: 2px 0 1px 0;
75
+ }
76
+
77
+ #submit-timestamp:before {
78
+ content: "\f175";
79
+ top: -1px;
80
+ color: #82878c;
81
+ font: normal 20px/1 dashicons;
82
+ display: inline-block;
83
+ padding: 0 2px 0 0;
84
+ left: -1px;
85
+ position: relative;
86
+ vertical-align: top;
87
+ }
88
+
89
+ /* Star rating in post editor
90
+ --------------------------------------------------*/
91
+ .edit-rating-box {
92
+ height: 27px;
93
+ line-height: 27px;
94
+ }
95
+
96
+ .wp-core-ui .edit-rating-box button {
97
+ margin-left: 0;
98
+ }
99
+
100
+ .edit-rating-box .cancel,
101
+ .edit-rating-box .zero {
102
+ padding: 0;
103
+ text-decoration: underline;
104
+ color: #0073aa;
105
+ }
106
+
107
+ .rating .inner,
108
+ .edit-rating-buttons-1,
109
+ .edit-rating-buttons-2,
110
+ .edit-rating-success {
111
+ display: inline-block;
112
+ margin-left: 5px;
113
+ vertical-align: middle;
114
+ }
admin/css/selectize.default.css CHANGED
@@ -1,408 +1,408 @@
1
- /**
2
- * selectize.default.css (v0.12.6) - Default Theme
3
- * Copyright (c) 2013–2015 Brian Reavis & contributors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
- * file except in compliance with the License. You may obtain a copy of the License at:
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- * ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- *
14
- * @author Brian Reavis <brian@thirdroute.com>
15
- */
16
- .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
17
- visibility: visible !important;
18
- background: #f2f2f2 !important;
19
- background: rgba(0, 0, 0, 0.06) !important;
20
- border: 0 none !important;
21
- -webkit-box-shadow: inset 0 0 12px 4px #fff;
22
- box-shadow: inset 0 0 12px 4px #fff;
23
- }
24
- .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
25
- content: '!';
26
- visibility: hidden;
27
- }
28
- .selectize-control.plugin-drag_drop .ui-sortable-helper {
29
- -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
30
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
31
- }
32
- .selectize-dropdown-header {
33
- position: relative;
34
- padding: 5px 8px;
35
- border-bottom: 1px solid #d0d0d0;
36
- background: #f8f8f8;
37
- -webkit-border-radius: 3px 3px 0 0;
38
- -moz-border-radius: 3px 3px 0 0;
39
- border-radius: 3px 3px 0 0;
40
- }
41
- .selectize-dropdown-header-close {
42
- position: absolute;
43
- right: 8px;
44
- top: 50%;
45
- color: #303030;
46
- opacity: 0.4;
47
- margin-top: -12px;
48
- line-height: 20px;
49
- font-size: 20px !important;
50
- }
51
- .selectize-dropdown-header-close:hover {
52
- color: #000000;
53
- }
54
- .selectize-dropdown.plugin-optgroup_columns .optgroup {
55
- border-right: 1px solid #f2f2f2;
56
- border-top: 0 none;
57
- float: left;
58
- -webkit-box-sizing: border-box;
59
- -moz-box-sizing: border-box;
60
- box-sizing: border-box;
61
- }
62
- .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
63
- border-right: 0 none;
64
- }
65
- .selectize-dropdown.plugin-optgroup_columns .optgroup:before {
66
- display: none;
67
- }
68
- .selectize-dropdown.plugin-optgroup_columns .optgroup-header {
69
- border-top: 0 none;
70
- }
71
- .selectize-control.plugin-remove_button [data-value] {
72
- position: relative;
73
- padding-right: 24px !important;
74
- }
75
- .selectize-control.plugin-remove_button [data-value] .remove {
76
- z-index: 1;
77
- /* fixes ie bug (see #392) */
78
- position: absolute;
79
- top: 0;
80
- right: 0;
81
- bottom: 0;
82
- width: 17px;
83
- text-align: center;
84
- font-weight: bold;
85
- font-size: 12px;
86
- color: inherit;
87
- text-decoration: none;
88
- vertical-align: middle;
89
- display: inline-block;
90
- padding: 2px 0 0 0;
91
- border-left: 1px solid #0073bb;
92
- -webkit-border-radius: 0 2px 2px 0;
93
- -moz-border-radius: 0 2px 2px 0;
94
- border-radius: 0 2px 2px 0;
95
- -webkit-box-sizing: border-box;
96
- -moz-box-sizing: border-box;
97
- box-sizing: border-box;
98
- }
99
- .selectize-control.plugin-remove_button [data-value] .remove:hover {
100
- background: rgba(0, 0, 0, 0.05);
101
- }
102
- .selectize-control.plugin-remove_button [data-value].active .remove {
103
- border-left-color: #00578d;
104
- }
105
- .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
106
- background: none;
107
- }
108
- .selectize-control.plugin-remove_button .disabled [data-value] .remove {
109
- border-left-color: #aaaaaa;
110
- }
111
- .selectize-control.plugin-remove_button .remove-single {
112
- position: absolute;
113
- right: 0;
114
- top: 0;
115
- font-size: 23px;
116
- }
117
- .selectize-control {
118
- position: relative;
119
- }
120
- .selectize-dropdown,
121
- .selectize-input,
122
- .selectize-input input {
123
- color: #303030;
124
- font-family: inherit;
125
- font-size: 13px;
126
- line-height: 18px;
127
- -webkit-font-smoothing: inherit;
128
- }
129
- .selectize-input,
130
- .selectize-control.single .selectize-input.input-active {
131
- background: #fff;
132
- cursor: text;
133
- display: inline-block;
134
- }
135
- .selectize-input {
136
- border: 1px solid #d0d0d0;
137
- padding: 8px 8px;
138
- display: inline-block;
139
- width: 100%;
140
- overflow: hidden;
141
- position: relative;
142
- z-index: 1;
143
- -webkit-box-sizing: border-box;
144
- -moz-box-sizing: border-box;
145
- box-sizing: border-box;
146
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
147
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
148
- -webkit-border-radius: 3px;
149
- -moz-border-radius: 3px;
150
- border-radius: 3px;
151
- }
152
- .selectize-control.multi .selectize-input.has-items {
153
- padding: 5px 8px 2px;
154
- }
155
- .selectize-input.full {
156
- background-color: #fff;
157
- }
158
- .selectize-input.disabled,
159
- .selectize-input.disabled * {
160
- cursor: default !important;
161
- }
162
- .selectize-input.focus {
163
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
164
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
165
- }
166
- .selectize-input.dropdown-active {
167
- -webkit-border-radius: 3px 3px 0 0;
168
- -moz-border-radius: 3px 3px 0 0;
169
- border-radius: 3px 3px 0 0;
170
- }
171
- .selectize-input > * {
172
- vertical-align: baseline;
173
- display: -moz-inline-stack;
174
- display: inline-block;
175
- zoom: 1;
176
- *display: inline;
177
- }
178
- .selectize-control.multi .selectize-input > div {
179
- cursor: pointer;
180
- margin: 0 3px 3px 0;
181
- padding: 2px 6px;
182
- background: #1da7ee;
183
- color: #fff;
184
- border: 1px solid #0073bb;
185
- }
186
- .selectize-control.multi .selectize-input > div.active {
187
- background: #92c836;
188
- color: #fff;
189
- border: 1px solid #00578d;
190
- }
191
- .selectize-control.multi .selectize-input.disabled > div,
192
- .selectize-control.multi .selectize-input.disabled > div.active {
193
- color: #ffffff;
194
- background: #d2d2d2;
195
- border: 1px solid #aaaaaa;
196
- }
197
- .selectize-input > input {
198
- display: inline-block !important;
199
- padding: 0 !important;
200
- min-height: 0 !important;
201
- max-height: none !important;
202
- max-width: 100% !important;
203
- margin: 0 1px !important;
204
- text-indent: 0 !important;
205
- border: 0 none !important;
206
- background: none !important;
207
- line-height: inherit !important;
208
- -webkit-user-select: auto !important;
209
- -webkit-box-shadow: none !important;
210
- box-shadow: none !important;
211
- }
212
- .selectize-input > input::-ms-clear {
213
- display: none;
214
- }
215
- .selectize-input > input:focus {
216
- outline: none !important;
217
- }
218
- .selectize-input::after {
219
- content: ' ';
220
- display: block;
221
- clear: left;
222
- }
223
- .selectize-input.dropdown-active::before {
224
- content: ' ';
225
- display: block;
226
- position: absolute;
227
- background: #f0f0f0;
228
- height: 1px;
229
- bottom: 0;
230
- left: 0;
231
- right: 0;
232
- }
233
- .selectize-dropdown {
234
- position: absolute;
235
- z-index: 10;
236
- border: 1px solid #d0d0d0;
237
- background: #fff;
238
- margin: -1px 0 0 0;
239
- border-top: 0 none;
240
- -webkit-box-sizing: border-box;
241
- -moz-box-sizing: border-box;
242
- box-sizing: border-box;
243
- -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
244
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
245
- -webkit-border-radius: 0 0 3px 3px;
246
- -moz-border-radius: 0 0 3px 3px;
247
- border-radius: 0 0 3px 3px;
248
- }
249
- .selectize-dropdown [data-selectable] {
250
- cursor: pointer;
251
- overflow: hidden;
252
- }
253
- .selectize-dropdown [data-selectable] .highlight {
254
- background: rgba(125, 168, 208, 0.2);
255
- -webkit-border-radius: 1px;
256
- -moz-border-radius: 1px;
257
- border-radius: 1px;
258
- }
259
- .selectize-dropdown .option,
260
- .selectize-dropdown .optgroup-header {
261
- padding: 5px 8px;
262
- }
263
- .selectize-dropdown .option,
264
- .selectize-dropdown [data-disabled],
265
- .selectize-dropdown [data-disabled] [data-selectable].option {
266
- cursor: inherit;
267
- opacity: 0.5;
268
- }
269
- .selectize-dropdown [data-selectable].option {
270
- opacity: 1;
271
- }
272
- .selectize-dropdown .optgroup:first-child .optgroup-header {
273
- border-top: 0 none;
274
- }
275
- .selectize-dropdown .optgroup-header {
276
- color: #303030;
277
- background: #fff;
278
- cursor: default;
279
- }
280
- .selectize-dropdown .active {
281
- background-color: #f5fafd;
282
- color: #495c68;
283
- }
284
- .selectize-dropdown .active.create {
285
- color: #495c68;
286
- }
287
- .selectize-dropdown .create {
288
- color: rgba(48, 48, 48, 0.5);
289
- }
290
- .selectize-dropdown-content {
291
- overflow-y: auto;
292
- overflow-x: hidden;
293
- max-height: 200px;
294
- -webkit-overflow-scrolling: touch;
295
- }
296
- .selectize-control.single .selectize-input,
297
- .selectize-control.single .selectize-input input {
298
- cursor: pointer;
299
- }
300
- .selectize-control.single .selectize-input.input-active,
301
- .selectize-control.single .selectize-input.input-active input {
302
- cursor: text;
303
- }
304
- .selectize-control.single .selectize-input:after {
305
- content: ' ';
306
- display: block;
307
- position: absolute;
308
- top: 50%;
309
- right: 15px;
310
- margin-top: -3px;
311
- width: 0;
312
- height: 0;
313
- border-style: solid;
314
- border-width: 5px 5px 0 5px;
315
- border-color: #808080 transparent transparent transparent;
316
- }
317
- /* Cutomization for select */
318
- .elementor-control-modula_gallery_select .selectize-control.single .selectize-input:after {
319
- display:none;
320
- }
321
-
322
- .selectize-control.single .selectize-input.dropdown-active:after {
323
- margin-top: -4px;
324
- border-width: 0 5px 5px 5px;
325
- border-color: transparent transparent #808080 transparent;
326
- }
327
- .selectize-control.rtl.single .selectize-input:after {
328
- left: 15px;
329
- right: auto;
330
- }
331
- .selectize-control.rtl .selectize-input > input {
332
- margin: 0 4px 0 -2px !important;
333
- }
334
- .selectize-control .selectize-input.disabled {
335
- opacity: 0.5;
336
- background-color: #fafafa;
337
- }
338
- .selectize-control.multi .selectize-input.has-items {
339
- padding-left: 5px;
340
- padding-right: 5px;
341
- }
342
- .selectize-control.multi .selectize-input.disabled [data-value] {
343
- color: #999;
344
- text-shadow: none;
345
- background: none;
346
- -webkit-box-shadow: none;
347
- box-shadow: none;
348
- }
349
- .selectize-control.multi .selectize-input.disabled [data-value],
350
- .selectize-control.multi .selectize-input.disabled [data-value] .remove {
351
- border-color: #e6e6e6;
352
- }
353
- .selectize-control.multi .selectize-input.disabled [data-value] .remove {
354
- background: none;
355
- }
356
- .selectize-control.multi .selectize-input [data-value] {
357
- text-shadow: 0 1px 0 rgba(0, 51, 83, 0.3);
358
- -webkit-border-radius: 3px;
359
- -moz-border-radius: 3px;
360
- border-radius: 3px;
361
- background-color: #1b9dec;
362
- background-image: -moz-linear-gradient(top, #1da7ee, #178ee9);
363
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#1da7ee), to(#178ee9));
364
- background-image: -webkit-linear-gradient(top, #1da7ee, #178ee9);
365
- background-image: -o-linear-gradient(top, #1da7ee, #178ee9);
366
- background-image: linear-gradient(to bottom, #1da7ee, #178ee9);
367
- background-repeat: repeat-x;
368
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1da7ee', endColorstr='#ff178ee9', GradientType=0);
369
- -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
370
- box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
371
- }
372
- .selectize-control.multi .selectize-input [data-value].active {
373
- background-color: #0085d4;
374
- background-image: -moz-linear-gradient(top, #008fd8, #0075cf);
375
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#008fd8), to(#0075cf));
376
- background-image: -webkit-linear-gradient(top, #008fd8, #0075cf);
377
- background-image: -o-linear-gradient(top, #008fd8, #0075cf);
378
- background-image: linear-gradient(to bottom, #008fd8, #0075cf);
379
- background-repeat: repeat-x;
380
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff008fd8', endColorstr='#ff0075cf', GradientType=0);
381
- }
382
- .selectize-control.single .selectize-input {
383
- -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
384
- box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
385
- background-color: #f9f9f9;
386
- background-image: -moz-linear-gradient(top, #fefefe, #f2f2f2);
387
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fefefe), to(#f2f2f2));
388
- background-image: -webkit-linear-gradient(top, #fefefe, #f2f2f2);
389
- background-image: -o-linear-gradient(top, #fefefe, #f2f2f2);
390
- background-image: linear-gradient(to bottom, #fefefe, #f2f2f2);
391
- background-repeat: repeat-x;
392
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffefefe', endColorstr='#fff2f2f2', GradientType=0);
393
- }
394
- .selectize-control.single .selectize-input,
395
- .selectize-dropdown.single {
396
- border-color: #b8b8b8;
397
- }
398
- .selectize-dropdown .optgroup-header {
399
- padding-top: 7px;
400
- font-weight: bold;
401
- font-size: 0.85em;
402
- }
403
- .selectize-dropdown .optgroup {
404
- border-top: 1px solid #f0f0f0;
405
- }
406
- .selectize-dropdown .optgroup:first-child {
407
- border-top: 0 none;
408
- }
1
+ /**
2
+ * selectize.default.css (v0.12.6) - Default Theme
3
+ * Copyright (c) 2013–2015 Brian Reavis & contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ * @author Brian Reavis <brian@thirdroute.com>
15
+ */
16
+ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
17
+ visibility: visible !important;
18
+ background: #f2f2f2 !important;
19
+ background: rgba(0, 0, 0, 0.06) !important;
20
+ border: 0 none !important;
21
+ -webkit-box-shadow: inset 0 0 12px 4px #fff;
22
+ box-shadow: inset 0 0 12px 4px #fff;
23
+ }
24
+ .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
25
+ content: '!';
26
+ visibility: hidden;
27
+ }
28
+ .selectize-control.plugin-drag_drop .ui-sortable-helper {
29
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
30
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
31
+ }
32
+ .selectize-dropdown-header {
33
+ position: relative;
34
+ padding: 5px 8px;
35
+ border-bottom: 1px solid #d0d0d0;
36
+ background: #f8f8f8;
37
+ -webkit-border-radius: 3px 3px 0 0;
38
+ -moz-border-radius: 3px 3px 0 0;
39
+ border-radius: 3px 3px 0 0;
40
+ }
41
+ .selectize-dropdown-header-close {
42
+ position: absolute;
43
+ right: 8px;
44
+ top: 50%;
45
+ color: #303030;
46
+ opacity: 0.4;
47
+ margin-top: -12px;
48
+ line-height: 20px;
49
+ font-size: 20px !important;
50
+ }
51
+ .selectize-dropdown-header-close:hover {
52
+ color: #000000;
53
+ }
54
+ .selectize-dropdown.plugin-optgroup_columns .optgroup {
55
+ border-right: 1px solid #f2f2f2;
56
+ border-top: 0 none;
57
+ float: left;
58
+ -webkit-box-sizing: border-box;
59
+ -moz-box-sizing: border-box;
60
+ box-sizing: border-box;
61
+ }
62
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
63
+ border-right: 0 none;
64
+ }
65
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:before {
66
+ display: none;
67
+ }
68
+ .selectize-dropdown.plugin-optgroup_columns .optgroup-header {
69
+ border-top: 0 none;
70
+ }
71
+ .selectize-control.plugin-remove_button [data-value] {
72
+ position: relative;
73
+ padding-right: 24px !important;
74
+ }
75
+ .selectize-control.plugin-remove_button [data-value] .remove {
76
+ z-index: 1;
77
+ /* fixes ie bug (see #392) */
78
+ position: absolute;
79
+ top: 0;
80
+ right: 0;
81
+ bottom: 0;
82
+ width: 17px;
83
+ text-align: center;
84
+ font-weight: bold;
85
+ font-size: 12px;
86
+ color: inherit;
87
+ text-decoration: none;
88
+ vertical-align: middle;
89
+ display: inline-block;
90
+ padding: 2px 0 0 0;
91
+ border-left: 1px solid #0073bb;
92
+ -webkit-border-radius: 0 2px 2px 0;
93
+ -moz-border-radius: 0 2px 2px 0;
94
+ border-radius: 0 2px 2px 0;
95
+ -webkit-box-sizing: border-box;
96
+ -moz-box-sizing: border-box;
97
+ box-sizing: border-box;
98
+ }
99
+ .selectize-control.plugin-remove_button [data-value] .remove:hover {
100
+ background: rgba(0, 0, 0, 0.05);
101
+ }
102
+ .selectize-control.plugin-remove_button [data-value].active .remove {
103
+ border-left-color: #00578d;
104
+ }
105
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
106
+ background: none;
107
+ }
108
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove {
109
+ border-left-color: #aaaaaa;
110
+ }
111
+ .selectize-control.plugin-remove_button .remove-single {
112
+ position: absolute;
113
+ right: 0;
114
+ top: 0;
115
+ font-size: 23px;
116
+ }
117
+ .selectize-control {
118
+ position: relative;
119
+ }
120
+ .selectize-dropdown,
121
+ .selectize-input,
122
+ .selectize-input input {
123
+ color: #303030;
124
+ font-family: inherit;
125
+ font-size: 13px;
126
+ line-height: 18px;
127
+ -webkit-font-smoothing: inherit;
128
+ }
129
+ .selectize-input,
130
+ .selectize-control.single .selectize-input.input-active {
131
+ background: #fff;
132
+ cursor: text;
133
+ display: inline-block;
134
+ }
135
+ .selectize-input {
136
+ border: 1px solid #d0d0d0;
137
+ padding: 8px 8px;
138
+ display: inline-block;
139
+ width: 100%;
140
+ overflow: hidden;
141
+ position: relative;
142
+ z-index: 1;
143
+ -webkit-box-sizing: border-box;
144
+ -moz-box-sizing: border-box;
145
+ box-sizing: border-box;
146
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
147
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
148
+ -webkit-border-radius: 3px;
149
+ -moz-border-radius: 3px;
150
+ border-radius: 3px;
151
+ }
152
+ .selectize-control.multi .selectize-input.has-items {
153
+ padding: 5px 8px 2px;
154
+ }
155
+ .selectize-input.full {
156
+ background-color: #fff;
157
+ }
158
+ .selectize-input.disabled,
159
+ .selectize-input.disabled * {
160
+ cursor: default !important;
161
+ }
162
+ .selectize-input.focus {
163
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
164
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
165
+ }
166
+ .selectize-input.dropdown-active {
167
+ -webkit-border-radius: 3px 3px 0 0;
168
+ -moz-border-radius: 3px 3px 0 0;
169
+ border-radius: 3px 3px 0 0;
170
+ }
171
+ .selectize-input > * {
172
+ vertical-align: baseline;
173
+ display: -moz-inline-stack;
174
+ display: inline-block;
175
+ zoom: 1;
176
+ *display: inline;
177
+ }
178
+ .selectize-control.multi .selectize-input > div {
179
+ cursor: pointer;
180
+ margin: 0 3px 3px 0;
181
+ padding: 2px 6px;
182
+ background: #1da7ee;
183
+ color: #fff;
184
+ border: 1px solid #0073bb;
185
+ }
186
+ .selectize-control.multi .selectize-input > div.active {
187
+ background: #92c836;
188
+ color: #fff;
189
+ border: 1px solid #00578d;
190
+ }
191
+ .selectize-control.multi .selectize-input.disabled > div,
192
+ .selectize-control.multi .selectize-input.disabled > div.active {
193
+ color: #ffffff;
194
+ background: #d2d2d2;
195
+ border: 1px solid #aaaaaa;
196
+ }
197
+ .selectize-input > input {
198
+ display: inline-block !important;
199
+ padding: 0 !important;
200
+ min-height: 0 !important;
201
+ max-height: none !important;
202
+ max-width: 100% !important;
203
+ margin: 0 1px !important;
204
+ text-indent: 0 !important;
205
+ border: 0 none !important;
206
+ background: none !important;
207
+ line-height: inherit !important;
208
+ -webkit-user-select: auto !important;
209
+ -webkit-box-shadow: none !important;
210
+ box-shadow: none !important;
211
+ }
212
+ .selectize-input > input::-ms-clear {
213
+ display: none;
214
+ }
215
+ .selectize-input > input:focus {
216
+ outline: none !important;
217
+ }
218
+ .selectize-input::after {
219
+ content: ' ';
220
+ display: block;
221
+ clear: left;
222
+ }
223
+ .selectize-input.dropdown-active::before {
224
+ content: ' ';
225
+ display: block;
226
+ position: absolute;
227
+ background: #f0f0f0;
228
+ height: 1px;
229
+ bottom: 0;
230
+ left: 0;
231
+ right: 0;
232
+ }
233
+ .selectize-dropdown {
234
+ position: absolute;
235
+ z-index: 10;
236
+ border: 1px solid #d0d0d0;
237
+ background: #fff;
238
+ margin: -1px 0 0 0;
239
+ border-top: 0 none;
240
+ -webkit-box-sizing: border-box;
241
+ -moz-box-sizing: border-box;
242
+ box-sizing: border-box;
243
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
244
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
245
+ -webkit-border-radius: 0 0 3px 3px;
246
+ -moz-border-radius: 0 0 3px 3px;
247
+ border-radius: 0 0 3px 3px;
248
+ }
249
+ .selectize-dropdown [data-selectable] {
250
+ cursor: pointer;
251
+ overflow: hidden;
252
+ }
253
+ .selectize-dropdown [data-selectable] .highlight {
254
+ background: rgba(125, 168, 208, 0.2);
255
+ -webkit-border-radius: 1px;
256
+ -moz-border-radius: 1px;
257
+ border-radius: 1px;
258
+ }
259
+ .selectize-dropdown .option,
260
+ .selectize-dropdown .optgroup-header {
261
+ padding: 5px 8px;
262
+ }
263
+ .selectize-dropdown .option,
264
+ .selectize-dropdown [data-disabled],
265
+ .selectize-dropdown [data-disabled] [data-selectable].option {
266
+ cursor: inherit;
267
+ opacity: 0.5;
268
+ }
269
+ .selectize-dropdown [data-selectable].option {
270
+ opacity: 1;
271
+ }
272
+ .selectize-dropdown .optgroup:first-child .optgroup-header {
273
+ border-top: 0 none;
274
+ }
275
+ .selectize-dropdown .optgroup-header {
276
+ color: #303030;
277
+ background: #fff;
278
+ cursor: default;
279
+ }
280
+ .selectize-dropdown .active {
281
+ background-color: #f5fafd;
282
+ color: #495c68;
283
+ }
284
+ .selectize-dropdown .active.create {
285
+ color: #495c68;
286
+ }
287
+ .selectize-dropdown .create {
288
+ color: rgba(48, 48, 48, 0.5);
289
+ }
290
+ .selectize-dropdown-content {
291
+ overflow-y: auto;
292
+ overflow-x: hidden;
293
+ max-height: 200px;
294
+ -webkit-overflow-scrolling: touch;
295
+ }
296
+ .selectize-control.single .selectize-input,
297
+ .selectize-control.single .selectize-input input {
298
+ cursor: pointer;
299
+ }
300
+ .selectize-control.single .selectize-input.input-active,
301
+ .selectize-control.single .selectize-input.input-active input {
302
+ cursor: text;
303
+ }
304
+ .selectize-control.single .selectize-input:after {
305
+ content: ' ';
306
+ display: block;
307
+ position: absolute;
308
+ top: 50%;
309
+ right: 15px;
310
+ margin-top: -3px;
311
+ width: 0;
312
+ height: 0;
313
+ border-style: solid;
314
+ border-width: 5px 5px 0 5px;
315
+ border-color: #808080 transparent transparent transparent;
316
+ }
317
+ /* Cutomization for select */
318
+ .elementor-control-modula_gallery_select .selectize-control.single .selectize-input:after {
319
+ display:none;
320
+ }
321
+
322
+ .selectize-control.single .selectize-input.dropdown-active:after {
323
+ margin-top: -4px;
324
+ border-width: 0 5px 5px 5px;
325
+ border-color: transparent transparent #808080 transparent;
326
+ }
327
+ .selectize-control.rtl.single .selectize-input:after {
328
+ left: 15px;
329
+ right: auto;
330
+ }
331
+ .selectize-control.rtl .selectize-input > input {
332
+ margin: 0 4px 0 -2px !important;
333
+ }
334
+ .selectize-control .selectize-input.disabled {
335
+ opacity: 0.5;
336
+ background-color: #fafafa;
337
+ }
338
+ .selectize-control.multi .selectize-input.has-items {
339
+ padding-left: 5px;
340
+ padding-right: 5px;
341
+ }
342
+ .selectize-control.multi .selectize-input.disabled [data-value] {
343
+ color: #999;
344
+ text-shadow: none;
345
+ background: none;
346
+ -webkit-box-shadow: none;
347
+ box-shadow: none;
348
+ }
349
+ .selectize-control.multi .selectize-input.disabled [data-value],
350
+ .selectize-control.multi .selectize-input.disabled [data-value] .remove {
351
+ border-color: #e6e6e6;
352
+ }
353
+ .selectize-control.multi .selectize-input.disabled [data-value] .remove {
354
+ background: none;
355
+ }
356
+ .selectize-control.multi .selectize-input [data-value] {
357
+ text-shadow: 0 1px 0 rgba(0, 51, 83, 0.3);
358
+ -webkit-border-radius: 3px;
359
+ -moz-border-radius: 3px;
360
+ border-radius: 3px;
361
+ background-color: #1b9dec;
362
+ background-image: -moz-linear-gradient(top, #1da7ee, #178ee9);
363
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#1da7ee), to(#178ee9));
364
+ background-image: -webkit-linear-gradient(top, #1da7ee, #178ee9);
365
+ background-image: -o-linear-gradient(top, #1da7ee, #178ee9);
366
+ background-image: linear-gradient(to bottom, #1da7ee, #178ee9);
367
+ background-repeat: repeat-x;
368
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1da7ee', endColorstr='#ff178ee9', GradientType=0);
369
+ -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
370
+ box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03);
371
+ }
372
+ .selectize-control.multi .selectize-input [data-value].active {
373
+ background-color: #0085d4;
374
+ background-image: -moz-linear-gradient(top, #008fd8, #0075cf);
375
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#008fd8), to(#0075cf));
376
+ background-image: -webkit-linear-gradient(top, #008fd8, #0075cf);
377
+ background-image: -o-linear-gradient(top, #008fd8, #0075cf);
378
+ background-image: linear-gradient(to bottom, #008fd8, #0075cf);
379
+ background-repeat: repeat-x;
380
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff008fd8', endColorstr='#ff0075cf', GradientType=0);
381
+ }
382
+ .selectize-control.single .selectize-input {
383
+ -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
384
+ box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
385
+ background-color: #f9f9f9;
386
+ background-image: -moz-linear-gradient(top, #fefefe, #f2f2f2);
387
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fefefe), to(#f2f2f2));
388
+ background-image: -webkit-linear-gradient(top, #fefefe, #f2f2f2);
389
+ background-image: -o-linear-gradient(top, #fefefe, #f2f2f2);
390
+ background-image: linear-gradient(to bottom, #fefefe, #f2f2f2);
391
+ background-repeat: repeat-x;
392
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffefefe', endColorstr='#fff2f2f2', GradientType=0);
393
+ }
394
+ .selectize-control.single .selectize-input,
395
+ .selectize-dropdown.single {
396
+ border-color: #b8b8b8;
397
+ }
398
+ .selectize-dropdown .optgroup-header {
399
+ padding-top: 7px;
400
+ font-weight: bold;
401
+ font-size: 0.85em;
402
+ }
403
+ .selectize-dropdown .optgroup {
404
+ border-top: 1px solid #f0f0f0;
405
+ }
406
+ .selectize-dropdown .optgroup:first-child {
407
+ border-top: 0 none;
408
+ }
admin/css/uninstall.css CHANGED
@@ -1,114 +1,114 @@
1
- .st-uninstall-form-active .st-uninstall-form-bg {
2
- background: rgba(0, 0, 0, .5);
3
- position: fixed;
4
- top: 0;
5
- left: 0;
6
- width: 100%;
7
- height: 100%;
8
- }
9
-
10
- .st-uninstall-form-wrapper {
11
- position: fixed;
12
- z-index: 999;
13
- display: none;
14
- width: 100%;
15
- height: 100%;
16
- top: 0;
17
- left: 0;
18
- right: 0;
19
- bottom: 0;
20
- margin: 0 auto;
21
- }
22
-
23
- .st-uninstall-form-wrapper .uninstall {
24
- text-align: center;
25
- }
26
-
27
- .st-uninstall-form-active .st-uninstall-form-wrapper {
28
- display: block;
29
- z-index: 999;
30
- }
31
-
32
- .st-uninstall-form {
33
- display: none;
34
- }
35
-
36
- .st-uninstall-form-active .st-uninstall-form {
37
- position: absolute;
38
- left: 0;
39
- right: 0;
40
- margin: 0 auto;
41
- top: 50%;
42
- transform: translateY(-50%);
43
- max-width: 600px;
44
- background: #fff;
45
- white-space: normal;
46
- }
47
-
48
- .st-uninstall-form-head {
49
- background: #774cce;
50
- padding: 8px 18px;
51
- position: relative;
52
- }
53
-
54
- .st-uninstall-form-head h3 {
55
- color: #fff;
56
- }
57
-
58
- .st-uninstall-form-body {
59
- padding: 8px 18px;
60
- color: #444;
61
- }
62
-
63
- .deactivating-spinner {
64
- display: none;
65
- }
66
-
67
- .deactivating-spinner .spinner {
68
- float: none;
69
- margin: 4px 4px 0 18px;
70
- vertical-align: bottom;
71
- visibility: visible;
72
- }
73
-
74
- .toggle-spinner .deactivating-spinner {
75
- display: block !important;
76
- }
77
-
78
- .st-uninstall-form-footer p {
79
- display: flex;
80
- align-items: center;
81
- justify-content: space-between;
82
- }
83
-
84
- .st-uninstall-form.process-response .st-uninstall-form-body {
85
- position: relative;
86
- }
87
-
88
- .st-uninstall-form.process-response .st-uninstall-form-body:after {
89
- content: "";
90
- display: block;
91
- position: absolute;
92
- top: 0;
93
- left: 0;
94
- width: 100%;
95
- height: 100%;
96
- background-color: rgba(255, 255, 255, .5);
97
- }
98
-
99
- .st-uninstall-form-head .close-uninstall-form {
100
- position: absolute;
101
- right: 15px;
102
- color: #fff;
103
- font-family: Arial;
104
- font-size: 14px;
105
- display: inline-block;
106
- top: 50%;
107
- transform: translateY(-50%);
108
- cursor: pointer;
109
- }
110
-
111
- .st-red-text {
112
- color:red !important;
113
- font-weight:bold;
114
  }
1
+ .st-uninstall-form-active .st-uninstall-form-bg {
2
+ background: rgba(0, 0, 0, .5);
3
+ position: fixed;
4
+ top: 0;
5
+ left: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ }
9
+
10
+ .st-uninstall-form-wrapper {
11
+ position: fixed;
12
+ z-index: 999;
13
+ display: none;
14
+ width: 100%;
15
+ height: 100%;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ bottom: 0;
20
+ margin: 0 auto;
21
+ }
22
+
23
+ .st-uninstall-form-wrapper .uninstall {
24
+ text-align: center;
25
+ }
26
+
27
+ .st-uninstall-form-active .st-uninstall-form-wrapper {
28
+ display: block;
29
+ z-index: 999;
30
+ }
31
+
32
+ .st-uninstall-form {
33
+ display: none;
34
+ }
35
+
36
+ .st-uninstall-form-active .st-uninstall-form {
37
+ position: absolute;
38
+ left: 0;
39
+ right: 0;
40
+ margin: 0 auto;
41
+ top: 50%;
42
+ transform: translateY(-50%);
43
+ max-width: 600px;
44
+ background: #fff;
45
+ white-space: normal;
46
+ }
47
+
48
+ .st-uninstall-form-head {
49
+ background: #774cce;
50
+ padding: 8px 18px;
51
+ position: relative;
52
+ }
53
+
54
+ .st-uninstall-form-head h3 {
55
+ color: #fff;
56
+ }
57
+
58
+ .st-uninstall-form-body {
59
+ padding: 8px 18px;
60
+ color: #444;
61
+ }
62
+
63
+ .deactivating-spinner {
64
+ display: none;
65
+ }
66
+
67
+ .deactivating-spinner .spinner {
68
+ float: none;
69
+ margin: 4px 4px 0 18px;
70
+ vertical-align: bottom;
71
+ visibility: visible;
72
+ }
73
+
74
+ .toggle-spinner .deactivating-spinner {
75
+ display: block !important;
76
+ }
77
+
78
+ .st-uninstall-form-footer p {
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: space-between;
82
+ }
83
+
84
+ .st-uninstall-form.process-response .st-uninstall-form-body {
85
+ position: relative;
86
+ }
87
+
88
+ .st-uninstall-form.process-response .st-uninstall-form-body:after {
89
+ content: "";
90
+ display: block;
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ width: 100%;
95
+ height: 100%;
96
+ background-color: rgba(255, 255, 255, .5);
97
+ }
98
+
99
+ .st-uninstall-form-head .close-uninstall-form {
100
+ position: absolute;
101
+ right: 15px;
102
+ color: #fff;
103
+ font-family: Arial;
104
+ font-size: 14px;
105
+ display: inline-block;
106
+ top: 50%;
107
+ transform: translateY(-50%);
108
+ cursor: pointer;
109
+ }
110
+
111
+ .st-red-text {
112
+ color:red !important;
113
+ font-weight:bold;
114
  }
admin/css/views.css CHANGED
@@ -1,1031 +1,1031 @@
1
- /* ==================================================
2
- Strong Testimonials View Editor
3
- ================================================== */
4
- /* TODO Consolidate with admin.css */
5
- /*-----------------------------------------------
6
- Structure
7
- -----------------------------------------------*/
8
- .clear {
9
- clear: both; }
10
-
11
- .table {
12
- display: table; }
13
-
14
- .table-row {
15
- display: table-row; }
16
-
17
- .table-cell {
18
- display: table-cell;
19
- vertical-align: top; }
20
-
21
- .option-wrap {
22
- margin-right: 2em; }
23
-
24
- .half-width {
25
- display: inline-block;
26
- box-sizing: border-box;
27
- width: 50%;
28
- float: left; }
29
-
30
- optgroup,
31
- optgroup option {
32
- font-family: inherit; }
33
-
34
- .intro {
35
- margin-bottom: 2em; }
36
-
37
- /* --------------------------------------------------
38
- The view info section at the top
39
- -------------------------------------------------- */
40
- .view-info {
41
- width: 100%;
42
- font-size: 20px;
43
- margin-top: 1em; }
44
- .view-info .table-cell {
45
- padding-bottom: 15px; }
46
- .view-info .table-cell:first-child {
47
- padding-top: 9px;
48
- min-width: 130px; }
49
- .view-info .table-row:last-child .table-cell {
50
- padding-bottom: 0; }
51
- .view-info label {
52
- vertical-align: top;
53
- margin: 0;
54
- display: block; }
55
- .view-info input {
56
- font-size: 20px; }
57
- .view-info input.view-name {
58
- width: 100%;
59
- margin: 0;
60
- padding: 4px 8px; }
61
-
62
- /* -------------------------------------------------
63
- Shortcode read-only input
64
- ------------------------------------------------- */
65
- #view-shortcode {
66
- direction: ltr;
67
- font-family: Consolas, Monaco, monospace;
68
- unicode-bidi: embed;
69
- display: inline-block;
70
- font-size: 18px;
71
- padding: 0 8px;
72
- line-height: 35px;
73
- width: 300px;
74
- color: #777;
75
- background: #FFF; }
76
-
77
- .form-view-shortcode .unsaved {
78
- color: #888;
79
- font-style: italic;
80
- line-height: 37px; }
81
-
82
- /* -------------------------------------------------
83
- Copy shortcode button
84
- ------------------------------------------------- */
85
- #copy-shortcode {
86
- margin: 5px 1em;
87
- line-height: 26px; }
88
-
89
- #copy-message {
90
- opacity: 0;
91
- font-size: 14px;
92
- line-height: 26px;
93
- height: 26px;
94
- padding: 0 10px;
95
- margin: 0;
96
- display: inline-block;
97
- background: #00A4F3;
98
- color: #FFF;
99
- border-radius: 3px;
100
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
101
- position: relative;
102
- top: -1px; }
103
-
104
- #copy-message.copied {
105
- opacity: 0;
106
- will-change: opacity;
107
- animation: showcopied 2s ease; }
108
-
109
- @keyframes showcopied {
110
- 0% {
111
- opacity: 0; }
112
- 70% {
113
- opacity: 1; }
114
- 100% {
115
- opacity: 0; } }
116
- /* -------------------------------------------------
117
- Mode selector
118
- ------------------------------------------------- */
119
- #view-mode {
120
- margin-top: 1em; }
121
- #view-mode label {
122
- display: inline-block;
123
- margin: 0 5px 0 0;
124
- padding: 0.5em 18px 0.5em 12px;
125
- border: 2px solid #ccc;
126
- border-radius: 20px;
127
- color: #888;
128
- position: relative;
129
- background: #fff; }
130
- #view-mode label.checked {
131
- position: relative;
132
- background: #00A4F3;
133
- color: #FFF;
134
- border-color: transparent;
135
- transition: all 0.1s ease; }
136
- #view-mode label:hover {
137
- background: #FFF;
138
- color: #444;
139
- border-color: #00A4F3; }
140
- #view-mode input[type="radio"] {
141
- margin-right: 7px; }
142
-
143
- .mode-list {
144
- display: inline-block; }
145
-
146
- .mode-line {
147
- display: none;
148
- position: absolute;
149
- border-left: 2px solid #00A4F3;
150
- height: 18px;
151
- top: 100%;
152
- left: calc( 50% - 1px );
153
- z-index: -1; }
154
- label.checked .mode-line {
155
- display: block; }
156
-
157
- .mode-description {
158
- box-sizing: border-box;
159
- background: #FFF;
160
- margin: 15px 5px 0 0;
161
- padding: 8px 20px;
162
- border: 2px solid #00A4F3;
163
- color: #00A4F3;
164
- text-align: center;
165
- border-radius: 20px;
166
- font-size: 16px;
167
- line-height: 1.3;
168
- min-height: 40px;
169
- transition: all 0.2s ease; }
170
-
171
- /* --------------------------------------------------
172
- Category filter
173
- -------------------------------------------------- */
174
- .fc-search-wrap {
175
- display: none;
176
- position: relative; }
177
-
178
- .fc-search-field {
179
- margin: 12px 0 4px 0;
180
- width: 100%; }
181
-
182
- .cat-count {
183
- color: #888; }
184
-
185
- .view-category-list-panel {
186
- box-sizing: border-box;
187
- min-height: 42px;
188
- min-width: 220px;
189
- overflow: auto;
190
- padding: 0 10px;
191
- border: 1px solid #DFDFDF;
192
- background-color: #FDFDFD;
193
- transition: all 0.2s ease; }
194
- .view-category-list-panel.short-panel {
195
- max-height: 205px; }
196
- .view-category-list-panel.tall-panel {
197
- max-height: none; }
198
-
199
- .view-category-list {
200
- margin: 7px 0; }
201
- .view-category-list li {
202
- margin-bottom: 0;
203
- line-height: 24px; }
204
- .view-category-list li label {
205
- margin-bottom: 6px;
206
- word-wrap: break-word;
207
- white-space: nowrap; }
208
- .view-category-list ul.children {
209
- margin-left: 21px; }
210
-
211
- /* -------------------------------------------------
212
- Replace checkboxes with icons
213
- ------------------------------------------------- */
214
- input[type=checkbox] {
215
- display: none; }
216
- input[type=checkbox] + label:before {
217
- display: inline-block;
218
- font-size: 18px;
219
- width: 20px;
220
- height: 20px;
221
- position: relative;
222
- top: 5px;
223
- /* unchecked icon */
224
- content: "";
225
- color: #00A4F3;
226
- background: #00A4F3;
227
- -webkit-mask: url('../img/square-regular.svg') center center no-repeat;
228
- mask: url('../img/square-regular.svg') center center no-repeat;
229
- }
230
- input[type=checkbox] + label:hover:before {
231
- color: #FF8900; }
232
- input[type=checkbox]:checked + label:before {
233
- /* checked icon */
234
- content: "";
235
- -webkit-mask: url('../img/check-square-regular.svg') center center no-repeat;
236
- mask: url('../img/check-square-regular.svg') center center no-repeat;
237
- }
238
- input[type=checkbox]:checked + label:hover:before {
239
- color: #FF8900; }
240
- input[type=checkbox]:disabled + label:before {
241
- /* disabled icon */
242
- content: "";
243
- -webkit-mask: url('../img/minus-square-regular.svg') center center no-repeat;
244
- mask: url('../img/minus-square-regular.svg') center center no-repeat;
245
- color: #888;
246
- background: #888;
247
- }
248
- input[type=checkbox]:disabled + label:hover:before {
249
- color: #888;
250
- background: #888;}
251
-
252
- /* -------------------------------------------------
253
- Misc.
254
- ------------------------------------------------- */
255
- #wpmtst-views-form input[type="submit"] {
256
- margin-right: 10px; }
257
-
258
- td.column-name strong {
259
- display: block;
260
- margin-bottom: .2em;
261
- font-size: 14px; }
262
-
263
- td.rowspan {
264
- border-left: 1px solid #DDD; }
265
-
266
- .subgroup {
267
- background: #f8f8f8;
268
- border: 1px solid #f1f1f1;
269
- padding: 0.25em 1em;
270
- margin-right: 1em; }
271
-
272
- .subgroup-heading {
273
- font-weight: 600; }
274
-
275
- .subgroup .subgroup-heading + .row-inner {
276
- margin-top: 5px; }
277
-
278
- .subgroup .row-inner {
279
- margin-bottom: 10px; }
280
-
281
- .min-width-1 {
282
- min-width: 152px; }
283
-
284
- .label-not-adjacent {
285
- margin-right: 0.3em; }
286
-
287
- .is-below {
288
- margin-top: 10px; }
289
-
290
- /* -------------------------------------------------
291
- Restore Default Breakpoints button
292
- ------------------------------------------------- */
293
- #restored-message {
294
- opacity: 0;
295
- line-height: 26px;
296
- height: 26px;
297
- padding: 0 10px;
298
- margin: 1px 1em;
299
- display: inline-block;
300
- background: #00A4F3;
301
- color: #FFF;
302
- border-radius: 3px;
303
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
304
- position: relative;
305
- top: -1px; }
306
-
307
- #restored-message.copied {
308
- opacity: 0;
309
- will-change: opacity;
310
- animation: showcopied 2s ease; }
311
-
312
- @keyframes showcopied {
313
- 0% {
314
- opacity: 0; }
315
- 70% {
316
- opacity: 1; }
317
- 100% {
318
- opacity: 0; } }
319
- .screenshot {
320
- margin: 10px; }
321
- .screenshot > div {
322
- display: inline-block;
323
- -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
324
- -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
325
- box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8); }
326
-
327
- /* --------------------------------------------------
328
- Inputs
329
- -------------------------------------------------- */
330
- input[type="text"].long {
331
- width: 25em; }
332
-
333
- input[type="text"].medium {
334
- width: 18em; }
335
-
336
- .input-number {
337
- width: 5em;
338
- text-align: right; }
339
-
340
- .input-incremental {
341
- width: 5em; }
342
-
343
- .input-number-px {
344
- width: 4em;
345
- text-align: right; }
346
-
347
- .form-table select {
348
- vertical-align: baseline; }
349
-
350
- div.radio {
351
- line-height: 1.5em;
352
- padding: 0 5px; }
353
-
354
- label,
355
- .nolabel {
356
- vertical-align: baseline;
357
- display: inline-block; }
358
-
359
- label:hover {
360
- color: #000; }
361
-
362
- option:disabled {
363
- font-style: italic !important; }
364
-
365
- /* -------------------------------------------------
366
- Elements
367
- ------------------------------------------------- */
368
- .wpmtst2 {
369
- max-width: 1200px;
370
- /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
371
- /* views section heading */ }
372
- .wpmtst2 p.wpmtst-submit {
373
- margin-top: 2em; }
374
- .wpmtst2 h3 {
375
- background: #FFF;
376
- color: #00A4F3;
377
- font-weight: 400;
378
- border: 1px solid #DDD;
379
- border-bottom: 0;
380
- padding: 10px 15px;
381
- margin-bottom: 0;
382
- margin-top: 1.5rem; }
383
-
384
- .form-table td p.description {
385
- margin-top: 0;
386
- font-style: italic; }
387
- .form-table td p.description.tall {
388
- line-height: 32px;
389
- margin-top: 0; }
390
- .form-table td p.description.short {
391
- line-height: 22px;
392
- padding: 5px 0; }
393
- .form-table td p.description.solo {
394
- margin-left: 0.3em; }
395
- .form-table td p.description.under-checkbox {
396
- margin-left: 22px; }
397
-
398
- /* Misc positioning */
399
- .inline {
400
- display: inline-block;
401
- margin-right: 1em;
402
- vertical-align: top; }
403
- .inline:last-child {
404
- margin-right: 0; }
405
-
406
- .inline span,
407
- .row span {
408
- display: inline-block;
409
- margin-right: 3px; }
410
-
411
- .inline-middle {
412
- vertical-align: middle; }
413
-
414
- .tight {
415
- margin-right: 0.2em; }
416
-
417
- .tight:last-child,
418
- .last {
419
- margin-right: 0; }
420
-
421
- .checkbox,
422
- .form-table th.checkbox {
423
- line-height: 32px; }
424
-
425
- .field {
426
- position: relative; }
427
- .field div {
428
- display: inline-block;
429
- padding: 0.2em 0.3em; }
430
-
431
- /* -------------------------------------------------
432
- Form table
433
- ------------------------------------------------- */
434
- .form-table {
435
- margin-top: 0;
436
- background: #FEFEFE;
437
- width: 100% !important;
438
- border: 1px solid #DDD; }
439
- .form-table.multiple {
440
- width: auto; }
441
- .form-table tr {
442
- border: 1px solid #DDD; }
443
- .form-table th,
444
- .form-table td {
445
- vertical-align: top; }
446
- .form-table th {
447
- font-weight: 400;
448
- white-space: nowrap;
449
- vertical-align: top;
450
- width: 150px;
451
- padding: 10px 15px; }
452
- .form-table td {
453
- padding: 10px; }
454
- .form-table td.valign-middle {
455
- vertical-align: middle; }
456
- .form-table td.w1 {
457
- width: 185px; }
458
- .form-table td.w2 {
459
- width: 300px; }
460
-
461
- tr.subheading {
462
- font-weight: 600; }
463
- tr.subheading td {
464
- padding: 5px 10px; }
465
- tr.subheading td:first-child {
466
- padding-left: 15px; }
467
- tr.subheading td:last-child {
468
- width: 190px; }
469
-
470
- td.divider {
471
- border-left: 1px dashed #DDD; }
472
-
473
- .wpmtst2 .form-table th,
474
- .wpmtst2 .form-table th label {
475
- line-height: 30px;
476
- margin-top: 0;
477
- margin-bottom: 0; }
478
-
479
- span.title {
480
- display: inline-block;
481
- margin-right: 1em; }
482
-
483
- .row,
484
- .row p {
485
- vertical-align: middle;
486
- line-height: 32px; }
487
-
488
- .row.tall,
489
- .row.tall p {
490
- line-height: 40px; }
491
-
492
- .row.links {
493
- margin-top: 10px; }
494
-
495
- .row:not(:first-child) .row-inner {
496
- margin-top: 10px; }
497
-
498
- /* --------------------------------------------------
499
- Category checkboxes
500
- -------------------------------------------------- */
501
- ul.checkbox-horizontal {
502
- display: inline-block;
503
- list-style: none;
504
- margin: 0; }
505
- ul.checkbox-horizontal li {
506
- display: inline-block;
507
- float: left;
508
- margin: 6px 2em 0 0; }
509
-
510
- .select-cell {
511
- padding-right: 2em; }
512
-
513
- /* -------------------------------------------------
514
- Form table
515
- ------------------------------------------------- */
516
- .form-table {
517
- margin-top: 0;
518
- background: #FEFEFE;
519
- width: 100% !important;
520
- border: 1px solid #DDD; }
521
- .form-table.multiple {
522
- width: auto; }
523
- .form-table tr {
524
- border: 1px solid #DDD; }
525
- .form-table th,
526
- .form-table td {
527
- vertical-align: top; }
528
- .form-table th {
529
- font-weight: 400;
530
- white-space: nowrap;
531
- vertical-align: top;
532
- width: 150px;
533
- padding: 10px 15px; }
534
- .form-table td {
535
- padding: 10px; }
536
- .form-table td.valign-middle {
537
- vertical-align: middle; }
538
- .form-table td.w1 {
539
- width: 185px; }
540
- .form-table td.w2 {
541
- width: 300px; }
542
-
543
- tr.subheading {
544
- font-weight: 600; }
545
- tr.subheading td {
546
- padding: 5px 10px; }
547
- tr.subheading td:first-child {
548
- padding-left: 15px; }
549
- tr.subheading td:last-child {
550
- width: 190px; }
551
-
552
- td.divider {
553
- border-left: 1px dashed #DDD; }
554
-
555
- .wpmtst2 .form-table th,
556
- .wpmtst2 .form-table th label {
557
- line-height: 30px;
558
- margin-top: 0;
559
- margin-bottom: 0; }
560
-
561
- span.title {
562
- display: inline-block;
563
- margin-right: 1em; }
564
-
565
- .row,
566
- .row p {
567
- vertical-align: middle;
568
- line-height: 32px; }
569
-
570
- .row.tall,
571
- .row.tall p {
572
- line-height: 40px; }
573
-
574
- .row.links {
575
- margin-top: 10px; }
576
-
577
- .row:not(:first-child) .row-inner {
578
- margin-top: 10px; }
579
-
580
- /* -------------------------------------------------
581
- List radio buttons
582
- ------------------------------------------------- */
583
- .section-radios {
584
- display: flex;
585
- justify-content: space-between; }
586
- .section-radios > div:first-child {
587
- flex: 0 0 15%; }
588
- .section-radios > div:nth-child(2) {
589
- flex: 1 1 auto;
590
- background: rgba(0, 164, 243, 0.085);
591
- border-radius: 15px; }
592
-
593
- .radio-buttons input[type=radio] {
594
- display: none; }
595
- .radio-buttons input[type=radio] + label {
596
- border-radius: 15px 0 0 15px;
597
- line-height: 30px;
598
- margin-right: 15px; }
599
- .radio-buttons input[type=radio] + label:before {
600
- display: inline-block;
601
- color: #999;
602
- background:#999;
603
- text-align: center;
604
- font-size: 17px;
605
- margin-left: 5px;
606
- margin-right: 1px;
607
- position: relative;
608
- top:5px;
609
- width: 20px;
610
- height:20px;
611
- /* unchecked icon */
612
- content: "";
613
- -webkit-mask: url('../img/circle-regular.svg') center center no-repeat;
614
- mask: url('../img/circle-regular.svg') center center no-repeat;
615
- }
616
- .radio-buttons input[type=radio] + label:hover:before {
617
- color: #FF8900; }
618
- .radio-buttons input[type=radio]:checked + label:before {
619
- /* checked icon */
620
- content: "";
621
- -webkit-mask: url('../img/dot-circle-regular.svg') center center no-repeat;
622
- mask: url('../img/dot-circle-regular.svg') center center no-repeat;
623
- color: #00A4F3;
624
- background: #00A4F3;}
625
- .radio-buttons input[type=radio]:checked + label:hover:before {
626
- color: #FF8900;
627
- background: #FF8900;}
628
- .radio-buttons input[type=radio].error + label, .radio-buttons input[type=radio].error + label:before {
629
- color: red; }
630
- .radio-buttons input[type=radio]:disabled + label {
631
- color: #AAA; }
632
- .radio-buttons input[type=radio]:disabled + label:before {
633
- color: #CCC; }
634
- .radio-buttons input[type=radio]:disabled + label:hover {
635
- background: transparent; }
636
- .radio-buttons input[type=radio]:checked:disabled + label:hover {
637
- background: #EAF7FB; }
638
-
639
- ul.radio-list {
640
- margin: 15px 0; }
641
- ul.radio-list li {
642
- margin: 0; }
643
- ul.radio-list li.current-selection label {
644
- background: rgba(0, 164, 243, 0.085); }
645
- ul.radio-list li label {
646
- width: 100%;
647
- white-space: nowrap; }
648
-
649
- .radio-description {
650
- padding: 0 15px; }
651
- .radio-description p {
652
- margin: 15px 0 15px !important; }
653
-
654
- .options {
655
- margin: 0 10px 15px 0; }
656
- .options > div {
657
- display: inline-block;
658
- display: flex; }
659
- .options > div > div {
660
- display: inline-block;
661
- width: 25%; }
662
-
663
- .description-inner {
664
- margin: 15px 0; }
665
-
666
- /* -------------------------------------------------
667
- Template options
668
- ------------------------------------------------- */
669
- ul.radio-list.template-list li {
670
- display: flex; }
671
- ul.radio-list.template-list li.current-selection .template-description {
672
- background: rgba(0, 164, 243, 0.085); }
673
- ul.radio-list.template-list li > div:first-child {
674
- flex: 0 0 15%;
675
- white-space: nowrap;
676
- align-self: center; }
677
- ul.radio-list.template-list li > div:nth-child(2) {
678
- flex: 1 1 auto; }
679
-
680
- .template-optgroup {
681
- font-weight: 600;
682
- margin: 15px 10px 10px 0; }
683
-
684
- .template-description {
685
- border-radius: 15px;
686
- padding: 15px; }
687
- .template-description p {
688
- margin: 0px 0 15px !important; }
689
- .template-description label {
690
- background: transparent !important; }
691
-
692
- /* -------------------------------------------------
693
- Layout options
694
- ------------------------------------------------- */
695
- .layout-section > div:last-child {
696
- flex: 0 0 auto;
697
- align-self: flex-start;
698
- margin-left: 10px;
699
- padding: 10px; }
700
-
701
- /* --------------------------------------------------
702
- Examples
703
- -------------------------------------------------- */
704
- .example-container {
705
- background: white;
706
- border: 1px solid #ccc;
707
- box-sizing: border-box;
708
- padding: 15px 10px 5px;
709
- width: 170px; }
710
- .example-container .box {
711
- background: #DDD;
712
- width: 100%;
713
- line-height: 30px;
714
- height: 30px;
715
- margin-bottom: 10px;
716
- text-align: center;
717
- /* to prevent overflowing margins */
718
- display: inline-block;
719
- position: relative;
720
- /* multi-column properties */
721
- -webkit-column-break-inside: avoid;
722
- page-break-inside: avoid;
723
- break-inside: avoid; }
724
- .example-container .box span {
725
- display: block;
726
- margin: 0 auto; }
727
- .example-container .box.size2 {
728
- height: 45px; }
729
- .example-container .box.size3 {
730
- height: 60px; }
731
-
732
- /* --------------------------------------------------
733
- Columns
734
- -------------------------------------------------- */
735
- .view-layout-columns .example-container {
736
- padding-bottom: 15px;
737
- text-align: center;
738
- /* a minimum width fallback */
739
- -webkit-column-width: 25px;
740
- -moz-column-width: 25px;
741
- column-width: 25px;
742
- -webkit-column-gap: 10px;
743
- -moz-column-gap: 10px;
744
- column-gap: 10px;
745
- /* chrome does not repaint column-rule when switching classes in js :( */
746
- /*-webkit-column-rule: 1px dashed #999;*/
747
- /*-moz-column-rule: 1px dashed #999;*/
748
- /*column-rule: 1px dashed #999;*/
749
- -webkit-margin-bottom-collapse: separate; }
750
- .view-layout-columns .example-container.col-2 {
751
- -webkit-column-count: 2;
752
- -moz-column-count: 2;
753
- column-count: 2; }
754
- .view-layout-columns .example-container.col-3 {
755
- -webkit-column-count: 3;
756
- -moz-column-count: 3;
757
- column-count: 3; }
758
- .view-layout-columns .example-container.col-4 {
759
- -webkit-column-count: 4;
760
- -moz-column-count: 4;
761
- column-count: 4; }
762
-
763
- /* --------------------------------------------------
764
- Grid
765
- -------------------------------------------------- */
766
- .view-layout-grid .example-container {
767
- display: -webkit-flex;
768
- display: -ms-flexbox;
769
- display: flex;
770
- -webkit-flex-wrap: wrap;
771
- -ms-flex-wrap: wrap;
772
- flex-wrap: wrap;
773
- justify-content: space-between; }
774
- .view-layout-grid .example-container .box {
775
- display: -webkit-flex;
776
- display: -ms-flexbox;
777
- display: flex; }
778
- .view-layout-grid .example-container.col-2 .box {
779
- width: 47%; }
780
- .view-layout-grid .example-container.col-3 .box {
781
- width: 29%; }
782
- .view-layout-grid .example-container.col-4 .box {
783
- width: 21%; }
784
-
785
- /* --------------------------------------------------
786
- Masonry
787
- -------------------------------------------------- */
788
- .view-layout-masonry .example-container .box {
789
- width: 46%; }
790
- .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
791
- width: 46%; }
792
- .view-layout-masonry .example-container.col-3 .grid-sizer {
793
- width: 27.5%; }
794
- .view-layout-masonry .example-container.col-4 .grid-sizer {
795
- width: 19.5%; }
796
-
797
- /* -------------------------------------------------
798
- Background options
799
- ------------------------------------------------- */
800
- .color-picker-wrap {
801
- display: flex; }
802
- .color-picker-wrap > div:first-child {
803
- min-width: 80px; }
804
-
805
- .background-preview-wrap {
806
- background: #FFF;
807
- padding: 2em;
808
- max-width: 300px; }
809
-
810
- #background-preview {
811
- padding: 1em;
812
- text-align: center; }
813
- #background-preview.dark {
814
- color: #333; }
815
- #background-preview.light {
816
- color: #EEE; }
817
-
818
- /* --------------------------------------------------
819
- Custom fields
820
- -------------------------------------------------- */
821
- .fields {
822
- display: inline-block;
823
- min-width: 350px; }
824
- .fields .field2 {
825
- border: 1px solid #DDD;
826
- background: #FFF;
827
- /* for better dragging */
828
- transition: background 0.3s ease, border 0.3s ease; }
829
- .fields .field2.open {
830
- background: #FFF;
831
- border-color: #444; }
832
- .fields .field3 {
833
- flex: 20; }
834
- .fields div.link {
835
- display: inline-block;
836
- cursor: pointer;
837
- padding: 10px 10px 8px;
838
- width: calc(100% - 20px); }
839
-
840
- .controls2 {
841
- /* icons */ }
842
- .controls2 > div {
843
- display: flex; }
844
- .controls2 .icon-wrap {
845
- position: relative;
846
- top: 1px;
847
- color: #999; }
848
- .controls2 .icon-wrap:hover {
849
- cursor: pointer; }
850
- .controls2.left {
851
- float: left; }
852
- .controls2.left .icon-wrap {
853
- margin-right: 5px; }
854
- .controls2.right {
855
- float: right; }
856
- .controls2.right .icon-wrap {
857
- margin-left: 5px; }
858
- .controls2 .handle:before,
859
- .controls2 .delete:before,
860
- .controls2 .toggle:before {
861
- font: normal 20px/1 dashicons;
862
- width: 20px;
863
- height: 20px; }
864
- .controls2 .handle:hover,
865
- .controls2 .delete:hover,
866
- .controls2 .toggle:hover {
867
- cursor: pointer; }
868
- .controls2 .delete:before {
869
- content: "\f335"; }
870
- .controls2 .delete:hover:before {
871
- background: #FF0000;
872
- color: #FFF;
873
- border-radius: 1px; }
874
- .controls2 .handle:before {
875
- content: "\f333"; }
876
- .controls2 .handle:hover {
877
- color: #2ea2cc;
878
- cursor: move; }
879
- .controls2 .toggle:before {
880
- content: "\f140"; }
881
- .controls2 .toggle:hover:before {
882
- color: #2EA2CC; }
883
-
884
- .field-description {
885
- padding: 0 5px;
886
- font-weight: 600;
887
- text-decoration: none;
888
- color: #444; }
889
- .field-description:hover {
890
- color: #444; }
891
-
892
- .field-properties {
893
- padding: 5px 10px;
894
- border-top: 1px dotted #DDD; }
895
-
896
- .field-property,
897
- .field-property-box .flex {
898
- display: flex;
899
- margin: 5px 0; }
900
- .field-property label,
901
- .field-property .nolabel,
902
- .field-property-box .flex label,
903
- .field-property-box .flex .nolabel {
904
- flex: 0 1 80px;
905
- line-height: 28px; }
906
- .field-property select, .field-property input,
907
- .field-property-box .flex select,
908
- .field-property-box .flex input {
909
- flex: 3; }
910
-
911
- .field2.open .toggle:before {
912
- content: "\f142"; }
913
-
914
- .sortable-placeholder {
915
- background: lightyellow !important;
916
- margin: 0; }
917
-
918
- .ui-sortable-helper {
919
- border: 1px solid #444 !important; }
920
-
921
- div.help {
922
- font-style: italic;
923
- padding-bottom: 5px; }
924
-
925
- @-moz-document url-prefix() {
926
- select optgroup {
927
- font-style: normal;
928
- margin-left: 3px; } }
929
- /* --------------------------------------------------
930
- help tab
931
- -------------------------------------------------- */
932
- span.help-links {
933
- display: inline-block;
934
- margin-left: 0.4em; }
935
-
936
- a.open-help-tab {
937
- font-weight: 400; }
938
-
939
- table.wpmtst-help-tab {
940
- border-collapse: collapse;
941
- margin: 20px 0;
942
- width: 100%; }
943
- table.wpmtst-help-tab tr:hover td {
944
- background: #FFFFAA; }
945
- table.wpmtst-help-tab th,
946
- table.wpmtst-help-tab td {
947
- padding: 5px 10px;
948
- text-align: center; }
949
- table.wpmtst-help-tab th {
950
- border-bottom: 1px solid #AAA; }
951
- table.wpmtst-help-tab td {
952
- border-bottom: 1px solid #E1E1E1; }
953
- table.wpmtst-help-tab td:first-child {
954
- text-align: right;
955
- font-weight: 600;
956
- white-space: nowrap; }
957
- table.wpmtst-help-tab td:not(:last-child) {
958
- border-right: 1px dotted #E1E1E1; }
959
-
960
- /* --------------------------------------------------
961
- Views list table sticky
962
- -------------------------------------------------- */
963
- .wp-list-table-wrap {
964
- position: relative; }
965
-
966
- .stickit, .stickit:before {
967
- cursor: pointer;
968
- content: "\f154";
969
- display: inline-block;
970
- width: 20px;
971
- height: 20px;
972
- color: #aaa;
973
- font-size: 20px;
974
- line-height: 1;
975
- font-family: dashicons;
976
- text-decoration: inherit;
977
- font-weight: normal;
978
- font-style: normal;
979
- vertical-align: top;
980
- text-align: center;
981
- -webkit-transition: color .1s ease-in;
982
- transition: color .1s ease-in;
983
- -webkit-font-smoothing: antialiased;
984
- -moz-osx-font-smoothing: grayscale; }
985
-
986
- .stickit.stuck:before {
987
- content: "\f155";
988
- color: #0073aa; }
989
- .stickit:hover:before {
990
- content: "\f155";
991
- color: #0096dd; }
992
-
993
- .overlay {
994
- position: absolute;
995
- top: 0;
996
- left: 0;
997
- bottom: 0;
998
- right: 0;
999
- background: rgba(255, 255, 255, 0.7); }
1000
-
1001
- /* -------------------------------------------------
1002
- Inner table
1003
- ------------------------------------------------- */
1004
- .inner-table {
1005
- display: table; }
1006
-
1007
- .inner-table-row {
1008
- display: table-row; }
1009
- .inner-table-row.bordered {
1010
- border: 1px solid #DDD; }
1011
- .inner-table-row.header .inner-table-cell {
1012
- text-align: center;
1013
- padding: 0 10px;
1014
- background: #f6f6f6; }
1015
-
1016
- .inner-table-cell {
1017
- display: table-cell;
1018
- padding: 5px 10px; }
1019
- .inner-table-cell:not(:last-child) {
1020
- border-right: 1px dashed #e2e2e2; }
1021
-
1022
- .form-table td p.description.normal {
1023
- font-style: normal; }
1024
-
1025
- ul.description.normal {
1026
- margin-top: 0;
1027
- font-style: normal; }
1028
-
1029
- ul.description li {
1030
- margin-bottom: 0;
1031
- line-height: 1.5; }
1
+ /* ==================================================
2
+ Strong Testimonials View Editor
3
+ ================================================== */
4
+ /* TODO Consolidate with admin.css */
5
+ /*-----------------------------------------------
6
+ Structure
7
+ -----------------------------------------------*/
8
+ .clear {
9
+ clear: both; }
10
+
11
+ .table {
12
+ display: table; }
13
+
14
+ .table-row {
15
+ display: table-row; }
16
+
17
+ .table-cell {
18
+ display: table-cell;
19
+ vertical-align: top; }
20
+
21
+ .option-wrap {
22
+ margin-right: 2em; }
23
+
24
+ .half-width {
25
+ display: inline-block;
26
+ box-sizing: border-box;
27
+ width: 50%;
28
+ float: left; }
29
+
30
+ optgroup,
31
+ optgroup option {
32
+ font-family: inherit; }
33
+
34
+ .intro {
35
+ margin-bottom: 2em; }
36
+
37
+ /* --------------------------------------------------
38
+ The view info section at the top
39
+ -------------------------------------------------- */
40
+ .view-info {
41
+ width: 100%;
42
+ font-size: 20px;
43
+ margin-top: 1em; }
44
+ .view-info .table-cell {
45
+ padding-bottom: 15px; }
46
+ .view-info .table-cell:first-child {
47
+ padding-top: 9px;
48
+ min-width: 130px; }
49
+ .view-info .table-row:last-child .table-cell {
50
+ padding-bottom: 0; }
51
+ .view-info label {
52
+ vertical-align: top;
53
+ margin: 0;
54
+ display: block; }
55
+ .view-info input {
56
+ font-size: 20px; }
57
+ .view-info input.view-name {
58
+ width: 100%;
59
+ margin: 0;
60
+ padding: 4px 8px; }
61
+
62
+ /* -------------------------------------------------
63
+ Shortcode read-only input
64
+ ------------------------------------------------- */
65
+ #view-shortcode {
66
+ direction: ltr;
67
+ font-family: Consolas, Monaco, monospace;
68
+ unicode-bidi: embed;
69
+ display: inline-block;
70
+ font-size: 18px;
71
+ padding: 0 8px;
72
+ line-height: 35px;
73
+ width: 300px;
74
+ color: #777;
75
+ background: #FFF; }
76
+
77
+ .form-view-shortcode .unsaved {
78
+ color: #888;
79
+ font-style: italic;
80
+ line-height: 37px; }
81
+
82
+ /* -------------------------------------------------
83
+ Copy shortcode button
84
+ ------------------------------------------------- */
85
+ #copy-shortcode {
86
+ margin: 5px 1em;
87
+ line-height: 26px; }
88
+
89
+ #copy-message {
90
+ opacity: 0;
91
+ font-size: 14px;
92
+ line-height: 26px;
93
+ height: 26px;
94
+ padding: 0 10px;
95
+ margin: 0;
96
+ display: inline-block;
97
+ background: #00A4F3;
98
+ color: #FFF;
99
+ border-radius: 3px;
100
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
101
+ position: relative;
102
+ top: -1px; }
103
+
104
+ #copy-message.copied {
105
+ opacity: 0;
106
+ will-change: opacity;
107
+ animation: showcopied 2s ease; }
108
+
109
+ @keyframes showcopied {
110
+ 0% {
111
+ opacity: 0; }
112
+ 70% {
113
+ opacity: 1; }
114
+ 100% {
115
+ opacity: 0; } }
116
+ /* -------------------------------------------------
117
+ Mode selector
118
+ ------------------------------------------------- */
119
+ #view-mode {
120
+ margin-top: 1em; }
121
+ #view-mode label {
122
+ display: inline-block;
123
+ margin: 0 5px 0 0;
124
+ padding: 0.5em 18px 0.5em 12px;
125
+ border: 2px solid #ccc;
126
+ border-radius: 20px;
127
+ color: #888;
128
+ position: relative;
129
+ background: #fff; }
130
+ #view-mode label.checked {
131
+ position: relative;
132
+ background: #00A4F3;
133
+ color: #FFF;
134
+ border-color: transparent;
135
+ transition: all 0.1s ease; }
136
+ #view-mode label:hover {
137
+ background: #FFF;
138
+ color: #444;
139
+ border-color: #00A4F3; }
140
+ #view-mode input[type="radio"] {
141
+ margin-right: 7px; }
142
+
143
+ .mode-list {
144
+ display: inline-block; }
145
+
146
+ .mode-line {
147
+ display: none;
148
+ position: absolute;
149
+ border-left: 2px solid #00A4F3;
150
+ height: 18px;
151
+ top: 100%;
152
+ left: calc( 50% - 1px );
153
+ z-index: -1; }
154
+ label.checked .mode-line {
155
+ display: block; }
156
+
157
+ .mode-description {
158
+ box-sizing: border-box;
159
+ background: #FFF;
160
+ margin: 15px 5px 0 0;
161
+ padding: 8px 20px;
162
+ border: 2px solid #00A4F3;
163
+ color: #00A4F3;
164
+ text-align: center;
165
+ border-radius: 20px;
166
+ font-size: 16px;
167
+ line-height: 1.3;
168
+ min-height: 40px;
169
+ transition: all 0.2s ease; }
170
+
171
+ /* --------------------------------------------------
172
+ Category filter
173
+ -------------------------------------------------- */
174
+ .fc-search-wrap {
175
+ display: none;
176
+ position: relative; }
177
+
178
+ .fc-search-field {
179
+ margin: 12px 0 4px 0;
180
+ width: 100%; }
181
+
182
+ .cat-count {
183
+ color: #888; }
184
+
185
+ .view-category-list-panel {
186
+ box-sizing: border-box;
187
+ min-height: 42px;
188
+ min-width: 220px;
189
+ overflow: auto;
190
+ padding: 0 10px;
191
+ border: 1px solid #DFDFDF;
192
+ background-color: #FDFDFD;
193
+ transition: all 0.2s ease; }
194
+ .view-category-list-panel.short-panel {
195
+ max-height: 205px; }
196
+ .view-category-list-panel.tall-panel {
197
+ max-height: none; }
198
+
199
+ .view-category-list {
200
+ margin: 7px 0; }
201
+ .view-category-list li {
202
+ margin-bottom: 0;
203
+ line-height: 24px; }
204
+ .view-category-list li label {
205
+ margin-bottom: 6px;
206
+ word-wrap: break-word;
207
+ white-space: nowrap; }
208
+ .view-category-list ul.children {
209
+ margin-left: 21px; }
210
+
211
+ /* -------------------------------------------------
212
+ Replace checkboxes with icons
213
+ ------------------------------------------------- */
214
+ input[type=checkbox] {
215
+ display: none; }
216
+ input[type=checkbox] + label:before {
217
+ display: inline-block;
218
+ font-size: 18px;
219
+ width: 20px;
220
+ height: 20px;
221
+ position: relative;
222
+ top: 5px;
223
+ /* unchecked icon */
224
+ content: "";
225
+ color: #00A4F3;
226
+ background: #00A4F3;
227
+ -webkit-mask: url('../img/square-regular.svg') center center no-repeat;
228
+ mask: url('../img/square-regular.svg') center center no-repeat;
229
+ }
230
+ input[type=checkbox] + label:hover:before {
231
+ color: #FF8900; }
232
+ input[type=checkbox]:checked + label:before {
233
+ /* checked icon */
234
+ content: "";
235
+ -webkit-mask: url('../img/check-square-regular.svg') center center no-repeat;
236
+ mask: url('../img/check-square-regular.svg') center center no-repeat;
237
+ }
238
+ input[type=checkbox]:checked + label:hover:before {
239
+ color: #FF8900; }
240
+ input[type=checkbox]:disabled + label:before {
241
+ /* disabled icon */
242
+ content: "";
243
+ -webkit-mask: url('../img/minus-square-regular.svg') center center no-repeat;
244
+ mask: url('../img/minus-square-regular.svg') center center no-repeat;
245
+ color: #888;
246
+ background: #888;
247
+ }
248
+ input[type=checkbox]:disabled + label:hover:before {
249
+ color: #888;
250
+ background: #888;}
251
+
252
+ /* -------------------------------------------------
253
+ Misc.
254
+ ------------------------------------------------- */
255
+ #wpmtst-views-form input[type="submit"] {
256
+ margin-right: 10px; }
257
+
258
+ td.column-name strong {
259
+ display: block;
260
+ margin-bottom: .2em;
261
+ font-size: 14px; }
262
+
263
+ td.rowspan {
264
+ border-left: 1px solid #DDD; }
265
+
266
+ .subgroup {
267
+ background: #f8f8f8;
268
+ border: 1px solid #f1f1f1;
269
+ padding: 0.25em 1em;
270
+ margin-right: 1em; }
271
+
272
+ .subgroup-heading {
273
+ font-weight: 600; }
274
+
275
+ .subgroup .subgroup-heading + .row-inner {
276
+ margin-top: 5px; }
277
+
278
+ .subgroup .row-inner {
279
+ margin-bottom: 10px; }
280
+
281
+ .min-width-1 {
282
+ min-width: 152px; }
283
+
284
+ .label-not-adjacent {
285
+ margin-right: 0.3em; }
286
+
287
+ .is-below {
288
+ margin-top: 10px; }
289
+
290
+ /* -------------------------------------------------
291
+ Restore Default Breakpoints button
292
+ ------------------------------------------------- */
293
+ #restored-message {
294
+ opacity: 0;
295
+ line-height: 26px;
296
+ height: 26px;
297
+ padding: 0 10px;
298
+ margin: 1px 1em;
299
+ display: inline-block;
300
+ background: #00A4F3;
301
+ color: #FFF;
302
+ border-radius: 3px;
303
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
304
+ position: relative;
305
+ top: -1px; }
306
+
307
+ #restored-message.copied {
308
+ opacity: 0;
309
+ will-change: opacity;
310
+ animation: showcopied 2s ease; }
311
+
312
+ @keyframes showcopied {
313
+ 0% {
314
+ opacity: 0; }
315
+ 70% {
316
+ opacity: 1; }
317
+ 100% {
318
+ opacity: 0; } }
319
+ .screenshot {
320
+ margin: 10px; }
321
+ .screenshot > div {
322
+ display: inline-block;
323
+ -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
324
+ -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
325
+ box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8); }
326
+
327
+ /* --------------------------------------------------
328
+ Inputs
329
+ -------------------------------------------------- */
330
+ input[type="text"].long {
331
+ width: 25em; }
332
+
333
+ input[type="text"].medium {
334
+ width: 18em; }
335
+
336
+ .input-number {
337
+ width: 5em;
338
+ text-align: right; }
339
+
340
+ .input-incremental {
341
+ width: 5em; }
342
+
343
+ .input-number-px {
344
+ width: 4em;
345
+ text-align: right; }
346
+
347
+ .form-table select {
348
+ vertical-align: baseline; }
349
+
350
+ div.radio {
351
+ line-height: 1.5em;
352
+ padding: 0 5px; }
353
+
354
+ label,
355
+ .nolabel {
356
+ vertical-align: baseline;
357
+ display: inline-block; }
358
+
359
+ label:hover {
360
+ color: #000; }
361
+
362
+ option:disabled {
363
+ font-style: italic !important; }
364
+
365
+ /* -------------------------------------------------
366
+ Elements
367
+ ------------------------------------------------- */
368
+ .wpmtst2 {
369
+ max-width: 1200px;
370
+ /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
371
+ /* views section heading */ }
372
+ .wpmtst2 p.wpmtst-submit {
373
+ margin-top: 2em; }
374
+ .wpmtst2 h3 {
375
+ background: #FFF;
376
+ color: #00A4F3;
377
+ font-weight: 400;
378
+ border: 1px solid #DDD;
379
+ border-bottom: 0;
380
+ padding: 10px 15px;
381
+ margin-bottom: 0;
382
+ margin-top: 1.5rem; }
383
+
384
+ .form-table td p.description {
385
+ margin-top: 0;
386
+ font-style: italic; }
387
+ .form-table td p.description.tall {
388
+ line-height: 32px;
389
+ margin-top: 0; }
390
+ .form-table td p.description.short {
391
+ line-height: 22px;
392
+ padding: 5px 0; }
393
+ .form-table td p.description.solo {
394
+ margin-left: 0.3em; }
395
+ .form-table td p.description.under-checkbox {
396
+ margin-left: 22px; }
397
+
398
+ /* Misc positioning */
399
+ .inline {
400
+ display: inline-block;
401
+ margin-right: 1em;
402
+ vertical-align: top; }
403
+ .inline:last-child {
404
+ margin-right: 0; }
405
+
406
+ .inline span,
407
+ .row span {
408
+ display: inline-block;
409
+ margin-right: 3px; }
410
+
411
+ .inline-middle {
412
+ vertical-align: middle; }
413
+
414
+ .tight {
415
+ margin-right: 0.2em; }
416
+
417
+ .tight:last-child,
418
+ .last {
419
+ margin-right: 0; }
420
+
421
+ .checkbox,
422
+ .form-table th.checkbox {
423
+ line-height: 32px; }
424
+
425
+ .field {
426
+ position: relative; }
427
+ .field div {
428
+ display: inline-block;
429
+ padding: 0.2em 0.3em; }
430
+
431
+ /* -------------------------------------------------
432
+ Form table
433
+ ------------------------------------------------- */
434
+ .form-table {
435
+ margin-top: 0;
436
+ background: #FEFEFE;
437
+ width: 100% !important;
438
+ border: 1px solid #DDD; }
439
+ .form-table.multiple {
440
+ width: auto; }
441
+ .form-table tr {
442
+ border: 1px solid #DDD; }
443
+ .form-table th,
444
+ .form-table td {
445
+ vertical-align: top; }
446
+ .form-table th {
447
+ font-weight: 400;
448
+ white-space: nowrap;
449
+ vertical-align: top;
450
+ width: 150px;
451
+ padding: 10px 15px; }
452
+ .form-table td {
453
+ padding: 10px; }
454
+ .form-table td.valign-middle {
455
+ vertical-align: middle; }
456
+ .form-table td.w1 {
457
+ width: 185px; }
458
+ .form-table td.w2 {
459
+ width: 300px; }
460
+
461
+ tr.subheading {
462
+ font-weight: 600; }
463
+ tr.subheading td {
464
+ padding: 5px 10px; }
465
+ tr.subheading td:first-child {
466
+ padding-left: 15px; }
467
+ tr.subheading td:last-child {
468
+ width: 190px; }
469
+
470
+ td.divider {
471
+ border-left: 1px dashed #DDD; }
472
+
473
+ .wpmtst2 .form-table th,
474
+ .wpmtst2 .form-table th label {
475
+ line-height: 30px;
476
+ margin-top: 0;
477
+ margin-bottom: 0; }
478
+
479
+ span.title {
480
+ display: inline-block;
481
+ margin-right: 1em; }
482
+
483
+ .row,
484
+ .row p {
485
+ vertical-align: middle;
486
+ line-height: 32px; }
487
+
488
+ .row.tall,
489
+ .row.tall p {
490
+ line-height: 40px; }
491
+
492
+ .row.links {
493
+ margin-top: 10px; }
494
+
495
+ .row:not(:first-child) .row-inner {
496
+ margin-top: 10px; }
497
+
498
+ /* --------------------------------------------------
499
+ Category checkboxes
500
+ -------------------------------------------------- */
501
+ ul.checkbox-horizontal {
502
+ display: inline-block;
503
+ list-style: none;
504
+ margin: 0; }
505
+ ul.checkbox-horizontal li {
506
+ display: inline-block;
507
+ float: left;
508
+ margin: 6px 2em 0 0; }
509
+
510
+ .select-cell {
511
+ padding-right: 2em; }
512
+
513
+ /* -------------------------------------------------
514
+ Form table
515
+ ------------------------------------------------- */
516
+ .form-table {
517
+ margin-top: 0;
518
+ background: #FEFEFE;
519
+ width: 100% !important;
520
+ border: 1px solid #DDD; }
521
+ .form-table.multiple {
522
+ width: auto; }
523
+ .form-table tr {
524
+ border: 1px solid #DDD; }
525
+ .form-table th,
526
+ .form-table td {
527
+ vertical-align: top; }
528
+ .form-table th {
529
+ font-weight: 400;
530
+ white-space: nowrap;
531
+ vertical-align: top;
532
+ width: 150px;
533
+ padding: 10px 15px; }
534
+ .form-table td {
535
+ padding: 10px; }
536
+ .form-table td.valign-middle {
537
+ vertical-align: middle; }
538
+ .form-table td.w1 {
539
+ width: 185px; }
540
+ .form-table td.w2 {
541
+ width: 300px; }
542
+
543
+ tr.subheading {
544
+ font-weight: 600; }
545
+ tr.subheading td {
546
+ padding: 5px 10px; }
547
+ tr.subheading td:first-child {
548
+ padding-left: 15px; }
549
+ tr.subheading td:last-child {
550
+ width: 190px; }
551
+
552
+ td.divider {
553
+ border-left: 1px dashed #DDD; }
554
+
555
+ .wpmtst2 .form-table th,
556
+ .wpmtst2 .form-table th label {
557
+ line-height: 30px;
558
+ margin-top: 0;
559
+ margin-bottom: 0; }
560
+
561
+ span.title {
562
+ display: inline-block;
563
+ margin-right: 1em; }
564
+
565
+ .row,
566
+ .row p {
567
+ vertical-align: middle;
568
+ line-height: 32px; }
569
+
570
+ .row.tall,
571
+ .row.tall p {
572
+ line-height: 40px; }
573
+
574
+ .row.links {
575
+ margin-top: 10px; }
576
+
577
+ .row:not(:first-child) .row-inner {
578
+ margin-top: 10px; }
579
+
580
+ /* -------------------------------------------------
581
+ List radio buttons
582
+ ------------------------------------------------- */
583
+ .section-radios {
584
+ display: flex;
585
+ justify-content: space-between; }
586
+ .section-radios > div:first-child {
587
+ flex: 0 0 15%; }
588
+ .section-radios > div:nth-child(2) {
589
+ flex: 1 1 auto;
590
+ background: rgba(0, 164, 243, 0.085);
591
+ border-radius: 15px; }
592
+
593
+ .radio-buttons input[type=radio] {
594
+ display: none; }
595
+ .radio-buttons input[type=radio] + label {
596
+ border-radius: 15px 0 0 15px;
597
+ line-height: 30px;
598
+ margin-right: 15px; }
599
+ .radio-buttons input[type=radio] + label:before {
600
+ display: inline-block;
601
+ color: #999;
602
+ background:#999;
603
+ text-align: center;
604
+ font-size: 17px;
605
+ margin-left: 5px;
606
+ margin-right: 1px;
607
+ position: relative;
608
+ top:5px;
609
+ width: 20px;
610
+ height:20px;
611
+ /* unchecked icon */
612
+ content: "";
613
+ -webkit-mask: url('../img/circle-regular.svg') center center no-repeat;
614
+ mask: url('../img/circle-regular.svg') center center no-repeat;
615
+ }
616
+ .radio-buttons input[type=radio] + label:hover:before {
617
+ color: #FF8900; }
618
+ .radio-buttons input[type=radio]:checked + label:before {
619
+ /* checked icon */
620
+ content: "";
621
+ -webkit-mask: url('../img/dot-circle-regular.svg') center center no-repeat;
622
+ mask: url('../img/dot-circle-regular.svg') center center no-repeat;
623
+ color: #00A4F3;
624
+ background: #00A4F3;}
625
+ .radio-buttons input[type=radio]:checked + label:hover:before {
626
+ color: #FF8900;
627
+ background: #FF8900;}
628
+ .radio-buttons input[type=radio].error + label, .radio-buttons input[type=radio].error + label:before {
629
+ color: red; }
630
+ .radio-buttons input[type=radio]:disabled + label {
631
+ color: #AAA; }
632
+ .radio-buttons input[type=radio]:disabled + label:before {
633
+ color: #CCC; }
634
+ .radio-buttons input[type=radio]:disabled + label:hover {
635
+ background: transparent; }
636
+ .radio-buttons input[type=radio]:checked:disabled + label:hover {
637
+ background: #EAF7FB; }
638
+
639
+ ul.radio-list {
640
+ margin: 15px 0; }
641
+ ul.radio-list li {
642
+ margin: 0; }
643
+ ul.radio-list li.current-selection label {
644
+ background: rgba(0, 164, 243, 0.085); }
645
+ ul.radio-list li label {
646
+ width: 100%;
647
+ white-space: nowrap; }
648
+
649
+ .radio-description {
650
+ padding: 0 15px; }
651
+ .radio-description p {
652
+ margin: 15px 0 15px !important; }
653
+
654
+ .options {
655
+ margin: 0 10px 15px 0; }
656
+ .options > div {
657
+ display: inline-block;
658
+ display: flex; }
659
+ .options > div > div {
660
+ display: inline-block;
661
+ width: 25%; }
662
+
663
+ .description-inner {
664
+ margin: 15px 0; }
665
+
666
+ /* -------------------------------------------------
667
+ Template options
668
+ ------------------------------------------------- */
669
+ ul.radio-list.template-list li {
670
+ display: flex; }
671
+ ul.radio-list.template-list li.current-selection .template-description {
672
+ background: rgba(0, 164, 243, 0.085); }
673
+ ul.radio-list.template-list li > div:first-child {
674
+ flex: 0 0 15%;
675
+ white-space: nowrap;
676
+ align-self: center; }
677
+ ul.radio-list.template-list li > div:nth-child(2) {
678
+ flex: 1 1 auto; }
679
+
680
+ .template-optgroup {
681
+ font-weight: 600;
682
+ margin: 15px 10px 10px 0; }
683
+
684
+ .template-description {
685
+ border-radius: 15px;
686
+ padding: 15px; }
687
+ .template-description p {
688
+ margin: 0px 0 15px !important; }
689
+ .template-description label {
690
+ background: transparent !important; }
691
+
692
+ /* -------------------------------------------------
693
+ Layout options
694
+ ------------------------------------------------- */
695
+ .layout-section > div:last-child {
696
+ flex: 0 0 auto;
697
+ align-self: flex-start;
698
+ margin-left: 10px;
699
+ padding: 10px; }
700
+
701
+ /* --------------------------------------------------
702
+ Examples
703
+ -------------------------------------------------- */
704
+ .example-container {
705
+ background: white;
706
+ border: 1px solid #ccc;
707
+ box-sizing: border-box;
708
+ padding: 15px 10px 5px;
709
+ width: 170px; }
710
+ .example-container .box {
711
+ background: #DDD;
712
+ width: 100%;
713
+ line-height: 30px;
714
+ height: 30px;
715
+ margin-bottom: 10px;
716
+ text-align: center;
717
+ /* to prevent overflowing margins */
718
+ display: inline-block;
719
+ position: relative;
720
+ /* multi-column properties */
721
+ -webkit-column-break-inside: avoid;
722
+ page-break-inside: avoid;
723
+ break-inside: avoid; }
724
+ .example-container .box span {
725
+ display: block;
726
+ margin: 0 auto; }
727
+ .example-container .box.size2 {
728
+ height: 45px; }
729
+ .example-container .box.size3 {
730
+ height: 60px; }
731
+
732
+ /* --------------------------------------------------
733
+ Columns
734
+ -------------------------------------------------- */
735
+ .view-layout-columns .example-container {
736
+ padding-bottom: 15px;
737
+ text-align: center;
738
+ /* a minimum width fallback */
739
+ -webkit-column-width: 25px;
740
+ -moz-column-width: 25px;
741
+ column-width: 25px;
742
+ -webkit-column-gap: 10px;
743
+ -moz-column-gap: 10px;
744
+ column-gap: 10px;
745
+ /* chrome does not repaint column-rule when switching classes in js :( */
746
+ /*-webkit-column-rule: 1px dashed #999;*/
747
+ /*-moz-column-rule: 1px dashed #999;*/
748
+ /*column-rule: 1px dashed #999;*/
749
+ -webkit-margin-bottom-collapse: separate; }
750
+ .view-layout-columns .example-container.col-2 {
751
+ -webkit-column-count: 2;
752
+ -moz-column-count: 2;
753
+ column-count: 2; }
754
+ .view-layout-columns .example-container.col-3 {
755
+ -webkit-column-count: 3;
756
+ -moz-column-count: 3;
757
+ column-count: 3; }
758
+ .view-layout-columns .example-container.col-4 {
759
+ -webkit-column-count: 4;
760
+ -moz-column-count: 4;
761
+ column-count: 4; }
762
+
763
+ /* --------------------------------------------------
764
+ Grid
765
+ -------------------------------------------------- */
766
+ .view-layout-grid .example-container {
767
+ display: -webkit-flex;
768
+ display: -ms-flexbox;
769
+ display: flex;
770
+ -webkit-flex-wrap: wrap;
771
+ -ms-flex-wrap: wrap;
772
+ flex-wrap: wrap;
773
+ justify-content: space-between; }
774
+ .view-layout-grid .example-container .box {
775
+ display: -webkit-flex;
776
+ display: -ms-flexbox;
777
+ display: flex; }
778
+ .view-layout-grid .example-container.col-2 .box {
779
+ width: 47%; }
780
+ .view-layout-grid .example-container.col-3 .box {
781
+ width: 29%; }
782
+ .view-layout-grid .example-container.col-4 .box {
783
+ width: 21%; }
784
+
785
+ /* --------------------------------------------------
786
+ Masonry
787
+ -------------------------------------------------- */
788
+ .view-layout-masonry .example-container .box {
789
+ width: 46%; }
790
+ .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
791
+ width: 46%; }
792
+ .view-layout-masonry .example-container.col-3 .grid-sizer {
793
+ width: 27.5%; }
794
+ .view-layout-masonry .example-container.col-4 .grid-sizer {
795
+ width: 19.5%; }
796
+
797
+ /* -------------------------------------------------
798
+ Background options
799
+ ------------------------------------------------- */
800
+ .color-picker-wrap {
801
+ display: flex; }
802
+ .color-picker-wrap > div:first-child {
803
+ min-width: 80px; }
804
+
805
+ .background-preview-wrap {
806
+ background: #FFF;
807
+ padding: 2em;
808
+ max-width: 300px; }
809
+
810
+ #background-preview {
811
+ padding: 1em;
812
+ text-align: center; }
813
+ #background-preview.dark {
814
+ color: #333; }
815
+ #background-preview.light {
816
+ color: #EEE; }
817
+
818
+ /* --------------------------------------------------
819
+ Custom fields
820
+ -------------------------------------------------- */
821
+ .fields {
822
+ display: inline-block;
823
+ min-width: 350px; }
824
+ .fields .field2 {
825
+ border: 1px solid #DDD;
826
+ background: #FFF;
827
+ /* for better dragging */
828
+ transition: background 0.3s ease, border 0.3s ease; }
829
+ .fields .field2.open {
830
+ background: #FFF;
831
+ border-color: #444; }
832
+ .fields .field3 {
833
+ flex: 20; }
834
+ .fields div.link {
835
+ display: inline-block;
836
+ cursor: pointer;
837
+ padding: 10px 10px 8px;
838
+ width: calc(100% - 20px); }
839
+
840
+ .controls2 {
841
+ /* icons */ }
842
+ .controls2 > div {
843
+ display: flex; }
844
+ .controls2 .icon-wrap {
845
+ position: relative;
846
+ top: 1px;
847
+ color: #999; }
848
+ .controls2 .icon-wrap:hover {
849
+ cursor: pointer; }
850
+ .controls2.left {
851
+ float: left; }
852
+ .controls2.left .icon-wrap {
853
+ margin-right: 5px; }
854
+ .controls2.right {
855
+ float: right; }
856
+ .controls2.right .icon-wrap {
857
+ margin-left: 5px; }
858
+ .controls2 .handle:before,
859
+ .controls2 .delete:before,
860
+ .controls2 .toggle:before {
861
+ font: normal 20px/1 dashicons;
862
+ width: 20px;
863
+ height: 20px; }
864
+ .controls2 .handle:hover,
865
+ .controls2 .delete:hover,
866
+ .controls2 .toggle:hover {
867
+ cursor: pointer; }
868
+ .controls2 .delete:before {
869
+ content: "\f335"; }
870
+ .controls2 .delete:hover:before {
871
+ background: #FF0000;
872
+ color: #FFF;
873
+ border-radius: 1px; }
874
+ .controls2 .handle:before {
875
+ content: "\f333"; }
876
+ .controls2 .handle:hover {
877
+ color: #2ea2cc;
878
+ cursor: move; }
879
+ .controls2 .toggle:before {
880
+ content: "\f140"; }
881
+ .controls2 .toggle:hover:before {
882
+ color: #2EA2CC; }
883
+
884
+ .field-description {
885
+ padding: 0 5px;
886
+ font-weight: 600;
887
+ text-decoration: none;
888
+ color: #444; }
889
+ .field-description:hover {
890
+ color: #444; }
891
+
892
+ .field-properties {
893
+ padding: 5px 10px;
894
+ border-top: 1px dotted #DDD; }
895
+
896
+ .field-property,
897
+ .field-property-box .flex {
898
+ display: flex;
899
+ margin: 5px 0; }
900
+ .field-property label,
901
+ .field-property .nolabel,
902
+ .field-property-box .flex label,
903
+ .field-property-box .flex .nolabel {
904
+ flex: 0 1 80px;
905
+ line-height: 28px; }
906
+ .field-property select, .field-property input,
907
+ .field-property-box .flex select,
908
+ .field-property-box .flex input {
909
+ flex: 3; }
910
+
911
+ .field2.open .toggle:before {
912
+ content: "\f142"; }
913
+
914
+ .sortable-placeholder {
915
+ background: lightyellow !important;
916
+ margin: 0; }
917
+
918
+ .ui-sortable-helper {
919
+ border: 1px solid #444 !important; }
920
+
921
+ div.help {
922
+ font-style: italic;
923
+ padding-bottom: 5px; }
924
+
925
+ @-moz-document url-prefix() {
926
+ select optgroup {
927
+ font-style: normal;
928
+ margin-left: 3px; } }
929
+ /* --------------------------------------------------
930
+ help tab
931
+ -------------------------------------------------- */
932
+ span.help-links {
933
+ display: inline-block;
934
+ margin-left: 0.4em; }
935
+
936
+ a.open-help-tab {
937
+ font-weight: 400; }
938
+
939
+ table.wpmtst-help-tab {
940
+ border-collapse: collapse;
941
+ margin: 20px 0;
942
+ width: 100%; }
943
+ table.wpmtst-help-tab tr:hover td {
944
+ background: #FFFFAA; }
945
+ table.wpmtst-help-tab th,
946
+ table.wpmtst-help-tab td {
947
+ padding: 5px 10px;
948
+ text-align: center; }
949
+ table.wpmtst-help-tab th {
950
+ border-bottom: 1px solid #AAA; }
951
+ table.wpmtst-help-tab td {
952
+ border-bottom: 1px solid #E1E1E1; }
953
+ table.wpmtst-help-tab td:first-child {
954
+ text-align: right;
955
+ font-weight: 600;
956
+ white-space: nowrap; }
957
+ table.wpmtst-help-tab td:not(:last-child) {
958
+ border-right: 1px dotted #E1E1E1; }
959
+
960
+ /* --------------------------------------------------
961
+ Views list table sticky
962
+ -------------------------------------------------- */
963
+ .wp-list-table-wrap {
964
+ position: relative; }
965
+
966
+ .stickit, .stickit:before {
967
+ cursor: pointer;
968
+ content: "\f154";
969
+ display: inline-block;
970
+ width: 20px;
971
+ height: 20px;
972
+ color: #aaa;
973
+ font-size: 20px;
974
+ line-height: 1;
975
+ font-family: dashicons;
976
+ text-decoration: inherit;
977
+ font-weight: normal;
978
+ font-style: normal;
979
+ vertical-align: top;
980
+ text-align: center;
981
+ -webkit-transition: color .1s ease-in;
982
+ transition: color .1s ease-in;
983
+ -webkit-font-smoothing: antialiased;
984
+ -moz-osx-font-smoothing: grayscale; }
985
+
986
+ .stickit.stuck:before {
987
+ content: "\f155";
988
+ color: #0073aa; }
989
+ .stickit:hover:before {
990
+ content: "\f155";
991
+ color: #0096dd; }
992
+
993
+ .overlay {
994
+ position: absolute;
995
+ top: 0;
996
+ left: 0;
997
+ bottom: 0;
998
+ right: 0;
999
+ background: rgba(255, 255, 255, 0.7); }
1000
+
1001
+ /* -------------------------------------------------
1002
+ Inner table
1003
+ ------------------------------------------------- */
1004
+ .inner-table {
1005
+ display: table; }
1006
+
1007
+ .inner-table-row {
1008
+ display: table-row; }
1009
+ .inner-table-row.bordered {
1010
+ border: 1px solid #DDD; }
1011
+ .inner-table-row.header .inner-table-cell {
1012
+ text-align: center;
1013
+ padding: 0 10px;
1014
+ background: #f6f6f6; }
1015
+
1016
+ .inner-table-cell {
1017
+ display: table-cell;
1018
+ padding: 5px 10px; }
1019
+ .inner-table-cell:not(:last-child) {
1020
+ border-right: 1px dashed #e2e2e2; }
1021
+
1022
+ .form-table td p.description.normal {
1023
+ font-style: normal; }
1024
+
1025
+ ul.description.normal {
1026
+ margin-top: 0;
1027
+ font-style: normal; }
1028
+
1029
+ ul.description li {
1030
+ margin-bottom: 0;
1031
+ line-height: 1.5; }
admin/css/wpml.css CHANGED
@@ -1,31 +1,31 @@
1
- /* The String Translation screen
2
- -----------------------------------------------*/
3
-
4
- /* word break */
5
- .wrap .wpml-st-col-domain, .wpml-st-col-name {
6
- word-break: normal;
7
- }
8
-
9
- /* striping */
10
- #icl_string_translations > tbody > *:nth-child(2n+1) {
11
- background-color: #f9f9f9;
12
- }
13
-
14
- /* the languages links under Bulk Actions on the Categories screen */
15
- #icl_subsubsub {
16
- display: block;
17
- padding: 5px 8px 8px;
18
- }
19
-
20
- /* the textareas */
21
- .icl-st-table textarea {
22
- font-size: 13px;
23
- }
24
-
25
- /* match the header/footer checkbox to standard post list table */
26
- .widefat thead td.check-column,
27
- .widefat thead th.check-column,
28
- .widefat tfoot td.check-column,
29
- .widefat tfoot th.check-column {
30
- padding: 10px 0 0 2px;
31
- }
1
+ /* The String Translation screen
2
+ -----------------------------------------------*/
3
+
4
+ /* word break */
5
+ .wrap .wpml-st-col-domain, .wpml-st-col-name {
6
+ word-break: normal;
7
+ }
8
+
9
+ /* striping */
10
+ #icl_string_translations > tbody > *:nth-child(2n+1) {
11
+ background-color: #f9f9f9;
12
+ }
13
+
14
+ /* the languages links under Bulk Actions on the Categories screen */
15
+ #icl_subsubsub {
16
+ display: block;
17
+ padding: 5px 8px 8px;
18
+ }
19
+
20
+ /* the textareas */
21
+ .icl-st-table textarea {
22
+ font-size: 13px;
23
+ }
24
+
25
+ /* match the header/footer checkbox to standard post list table */
26
+ .widefat thead td.check-column,
27
+ .widefat thead th.check-column,
28
+ .widefat tfoot td.check-column,
29
+ .widefat tfoot th.check-column {
30
+ padding: 10px 0 0 2px;
31
+ }
admin/custom-fields-ajax.php CHANGED
@@ -1,124 +1,124 @@
1
- <?php
2
- /**
3
- * Ajax Functions
4
- */
5
-
6
-
7
- /**
8
- * [Add New Field] Ajax receiver
9
- */
10
- function wpmtst_add_field_function() {
11
-
12
- if ( ! current_user_can( 'manage_options' ) ) {
13
- wp_die();
14
- }
15
-
16
- check_ajax_referer( 'wpmtst-admin', 'security' );
17
-
18
- // when adding, leave Name empty so it will be populated from Label
19
- $empty_field = array(
20
- 'name' => 'new_field',
21
- 'name_mutable' => 1,
22
- 'record_type' => 'custom',
23
- 'input_type' => 'text',
24
- 'label' => esc_html__( 'New Field', 'strong-testimonials' ),
25
- 'show_label' => 1,
26
- );
27
- echo wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true );
28
- wp_die();
29
- }
30
- add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
31
-
32
-
33
- /**
34
- * [Add New Field 2] Ajax receiver
35
- */
36
- function wpmtst_add_field_2_function() {
37
-
38
- if ( ! current_user_can( 'manage_options' ) ) {
39
- wp_die();
40
- }
41
-
42
- check_ajax_referer( 'wpmtst-admin', 'security' );
43
-
44
- $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
45
- $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
46
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
47
-
48
- $empty_field = array_merge(
49
- $fields['field_types'][$new_field_class][$new_field_type],
50
- array( 'record_type' => $new_field_class )
51
- );
52
- echo wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field );
53
- wp_die();
54
- }
55
- add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
56
-
57
-
58
- /**
59
- * [Add New Field 3] Ajax receiver
60
- */
61
- function wpmtst_add_field_3_function() {
62
-
63
- if ( ! current_user_can( 'manage_options' ) ) {
64
- wp_die();
65
- }
66
-
67
- check_ajax_referer( 'wpmtst-admin', 'security' );
68
-
69
- $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
70
- $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
71
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
72
-
73
- $empty_field = array_merge(
74
- $fields['field_types'][$new_field_class][$new_field_type],
75
- array( 'record_type' => $new_field_class )
76
- );
77
- echo wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field );
78
- wp_die();
79
- }
80
- add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
81
-
82
-
83
- /**
84
- * [Add New Field 4] Ajax receiver
85
- */
86
- function wpmtst_add_field_4_function() {
87
-
88
- if ( ! current_user_can( 'manage_options' ) ) {
89
- add_filter( 'show_admin_bar', '__return_false' );
90
- }
91
-
92
- check_ajax_referer( 'wpmtst-admin', 'security' );
93
-
94
- $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
95
- $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
96
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
97
- $empty_field = array();
98
- if ( isset( $fields['field_types'][$new_field_class][$new_field_type] ) ) {
99
- $empty_field = array_merge(
100
- $fields['field_types'][ $new_field_class ][ $new_field_type ],
101
- array( 'record_type' => $new_field_class )
102
- );
103
- }
104
- echo wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field );
105
- wp_die();
106
- }
107
- add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
108
-
109
-
110
- /**
111
- * Return the category count.
112
- */
113
- function wpmtst_ajax_cat_count() {
114
-
115
- if ( ! current_user_can( 'manage_options' ) ) {
116
- wp_die();
117
- }
118
-
119
- check_ajax_referer( 'wpmtst-admin', 'security' );
120
-
121
- echo wpmtst_get_cat_count();
122
- wp_die();
123
- }
124
  add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
1
+ <?php
2
+ /**
3
+ * Ajax Functions
4
+ */
5
+
6
+
7
+ /**
8
+ * [Add New Field] Ajax receiver
9
+ */
10
+ function wpmtst_add_field_function() {
11
+
12
+ if ( ! current_user_can( 'manage_options' ) ) {
13
+ wp_die();
14
+ }
15
+
16
+ check_ajax_referer( 'wpmtst-admin', 'security' );
17
+
18
+ // when adding, leave Name empty so it will be populated from Label
19
+ $empty_field = array(
20
+ 'name' => 'new_field',
21
+ 'name_mutable' => 1,
22
+ 'record_type' => 'custom',
23
+ 'input_type' => 'text',
24
+ 'label' => esc_html__( 'New Field', 'strong-testimonials' ),
25
+ 'show_label' => 1,
26
+ );
27
+ echo wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true );
28
+ wp_die();
29
+ }
30
+ add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
31
+
32
+
33
+ /**
34
+ * [Add New Field 2] Ajax receiver
35
+ */
36
+ function wpmtst_add_field_2_function() {
37
+
38
+ if ( ! current_user_can( 'manage_options' ) ) {
39
+ wp_die();
40
+ }
41
+
42
+ check_ajax_referer( 'wpmtst-admin', 'security' );
43
+
44
+ $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
45
+ $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
46
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
47
+
48
+ $empty_field = array_merge(
49
+ $fields['field_types'][$new_field_class][$new_field_type],
50
+ array( 'record_type' => $new_field_class )
51
+ );
52
+ echo wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field );
53
+ wp_die();
54
+ }
55
+ add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
56
+
57
+
58
+ /**
59
+ * [Add New Field 3] Ajax receiver
60
+ */
61
+ function wpmtst_add_field_3_function() {
62
+
63
+ if ( ! current_user_can( 'manage_options' ) ) {
64
+ wp_die();
65
+ }
66
+
67
+ check_ajax_referer( 'wpmtst-admin', 'security' );
68
+
69
+ $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
70
+ $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
71
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
72
+
73
+ $empty_field = array_merge(
74
+ $fields['field_types'][$new_field_class][$new_field_type],
75
+ array( 'record_type' => $new_field_class )
76
+ );
77
+ echo wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field );
78
+ wp_die();
79
+ }
80
+ add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
81
+
82
+
83
+ /**
84
+ * [Add New Field 4] Ajax receiver
85
+ */
86
+ function wpmtst_add_field_4_function() {
87
+
88
+ if ( ! current_user_can( 'manage_options' ) ) {
89
+ add_filter( 'show_admin_bar', '__return_false' );
90
+ }
91
+
92
+ check_ajax_referer( 'wpmtst-admin', 'security' );
93
+
94
+ $new_field_type = sanitize_text_field( $_REQUEST['fieldType'] );
95
+ $new_field_class = sanitize_text_field( $_REQUEST['fieldClass'] );
96
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
97
+ $empty_field = array();
98
+ if ( isset( $fields['field_types'][$new_field_class][$new_field_type] ) ) {
99
+ $empty_field = array_merge(
100
+ $fields['field_types'][ $new_field_class ][ $new_field_type ],
101
+ array( 'record_type' => $new_field_class )
102
+ );
103
+ }
104
+ echo wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field );
105
+ wp_die();
106
+ }
107
+ add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
108
+
109
+
110
+ /**
111
+ * Return the category count.
112
+ */
113
+ function wpmtst_ajax_cat_count() {
114
+
115
+ if ( ! current_user_can( 'manage_options' ) ) {
116
+ wp_die();
117
+ }
118
+
119
+ check_ajax_referer( 'wpmtst-admin', 'security' );
120
+
121
+ echo wpmtst_get_cat_count();
122
+ wp_die();
123
+ }
124
  add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
admin/custom-fields.php CHANGED
@@ -1,529 +1,529 @@
1
- <?php
2
- /**
3
- * Strong Testimonials - Custom fields admin functions
4
- */
5
-
6
- function wpmtst_form_admin() {
7
- do_action( 'wpmtst_form_admin' );
8
- }
9
-
10
- function wpmtst_form_admin2() {
11
- wpmtst_settings_custom_fields( 1 );
12
- }
13
-
14
- add_action( 'wpmtst_form_admin', 'wpmtst_form_admin2' );
15
-
16
- /**
17
- * Save changes to custom fields.
18
- *
19
- * @since 2.28.5 As separate function on custom action.
20
- */
21
- function wpmtst_update_custom_fields() {
22
- $goback = wp_get_referer();
23
- $goback = apply_filters( 'wpmtst_form_goback', $goback );
24
-
25
- if ( ! isset( $_POST['wpmtst_form_submitted'] ) ) {
26
- wp_redirect( $goback );
27
- exit;
28
- }
29
-
30
- if ( ! wp_verify_nonce( $_POST['wpmtst_form_submitted'], 'wpmtst_custom_fields_form' ) ) {
31
- wp_redirect( $goback );
32
- exit;
33
- }
34
-
35
- $form_id = absint ( $_POST['form_id'] );
36
- $forms = get_option( 'wpmtst_custom_forms' );
37
- $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
38
-
39
- if ( isset( $_POST['reset'] ) ) {
40
-
41
- // Undo changes
42
- wpmtst_add_admin_notice( 'changes-cancelled' );
43
-
44
- }
45
- elseif ( isset( $_POST['restore-defaults'] ) ) {
46
-
47
- // Restore defaults
48
- $default_forms = Strong_Testimonials_Defaults::get_base_forms();
49
- $fields = $default_forms['default']['fields'];
50
- $forms[ $form_id ]['fields'] = $fields;
51
- update_option( 'wpmtst_custom_forms', $forms );
52
- do_action( 'wpmtst_fields_updated', $fields );
53
-
54
- wpmtst_add_admin_notice( 'defaults-restored' );
55
-
56
- }
57
- else {
58
-
59
- // Save changes
60
- $fields = array();
61
- $new_key = 0;
62
-
63
- /**
64
- * Strip the dang slashes from the dang magic quotes.
65
- *
66
- * @since 2.0.0
67
- */
68
- $post_fields = stripslashes_deep( $_POST['fields'] );
69
-
70
- foreach ( $post_fields as $key => $field ) {
71
-
72
-
73
- /*
74
- * Before merging onto base field, catch fields that are "off"
75
- * which the form does not submit. Otherwise, the default "on"
76
- * would override the requested (but not submitted) "off".
77
- */
78
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
79
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
80
-
81
- $field = array_merge( $field_options['field_base'], $field );
82
-
83
- $field['name'] = sanitize_text_field( $field['name'] );
84
- $field['label'] = sanitize_text_field( $field['label'] );
85
- $field['text'] = sanitize_text_field( $field['text'] );
86
-
87
- // TODO Replace this special handling
88
- if ( 'checkbox' == $field['input_type'] ) {
89
- $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
90
- } else {
91
- $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
92
- }
93
- $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
94
- $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
95
-
96
- $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
97
-
98
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
99
-
100
- $field['before'] = sanitize_text_field( $field['before'] );
101
- $field['after'] = sanitize_text_field( $field['after'] );
102
-
103
- $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
104
- $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
105
- $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
106
-
107
- // Hidden options (no need to check if isset)
108
- $field['admin_table'] = $field['admin_table'] ? 1 : 0;
109
- $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
- $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
- $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
- $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
- $field['show_length_option'] = $field['show_length_option'] ? 1 : 0;
114
-
115
- $field = apply_filters( 'wpmtst_sanitize_form_field_options', $field );
116
-
117
- // add to fields array in display order
118
- $fields[ $new_key++ ] = $field;
119
-
120
- }
121
-
122
- $forms[ $form_id ]['fields'] = $fields;
123
-
124
- if ( isset( $_POST['field_group_label'] ) ) {
125
- // TODO Catch if empty.
126
- $new_label = sanitize_text_field( $_POST['field_group_label'] );
127
- $forms[ $form_id ]['label'] = $new_label;
128
- }
129
-
130
- update_option( 'wpmtst_custom_forms', $forms );
131
- do_action( 'wpmtst_fields_updated', $fields );
132
-
133
- wpmtst_add_admin_notice( 'fields-saved' );
134
-
135
- }
136
-
137
- wp_redirect( $goback );
138
- exit;
139
- }
140
-
141
- add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
142
-
143
- /**
144
- * Custom Fields form
145
- *
146
- * @param int $form_id
147
- */
148
- function wpmtst_settings_custom_fields( $form_id = 1 ) {
149
- if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
150
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'strong-testimonials' ) );
151
- }
152
-
153
- if ( ! $form_id ) {
154
- echo '<div class="wrap wpmtst"><p>' . esc_html__( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
155
- return;
156
- }
157
-
158
- $forms = get_option( 'wpmtst_custom_forms' );
159
- $fields = apply_filters( 'wpmtst_form_fields', $forms[$form_id]['fields'] );
160
- ?>
161
-
162
- <div class="wrap wpmtst">
163
- <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
164
-
165
- <div id="left-col">
166
- <div>
167
- <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
168
- <p>
169
- <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
170
- <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
171
- </p>
172
- <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
173
- </div>
174
-
175
- <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
176
- <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
177
- <input type="hidden" name="action" value="wpmtst_update_custom_fields">
178
- <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
179
-
180
- <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
181
-
182
- <ul id="custom-field-list">
183
- <?php
184
- foreach ( $fields as $key => $field ) {
185
- echo '<li id="field-' . esc_attr( $key ) . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
186
- }
187
- ?>
188
- </ul>
189
-
190
- <div id="add-field-bar">
191
- <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
192
- </div>
193
-
194
- <?php do_action( 'wpmtst_admin_after_form_fields' ); ?>
195
-
196
- <div id="field-group-actions">
197
- <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
198
- <div><?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
199
- <div><?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
200
- </div>
201
- </form>
202
- </div><!-- #left-col -->
203
-
204
- <div id="right-col">
205
- <div class="intro">
206
- <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
207
- <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
208
- </div>
209
- <?php do_action( 'wpmtst_fields_before_fields_editor_preview' ); ?>
210
- <div id="fields-editor-preview">
211
- <div><!-- placeholder --></div>
212
- </div>
213
- </div><!-- #right-col -->
214
-
215
- </div><!-- .wrap -->
216
- <?php
217
- }
218
-
219
- /**
220
- * Add a field to the form
221
- *
222
- * @param $key
223
- * @param $field
224
- * @param $adding
225
- *
226
- * @return string
227
- */
228
- function wpmtst_show_field( $key, $field, $adding ) {
229
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
230
- $field_types = $fields['field_types'];
231
-
232
- ob_start();
233
-
234
- include 'partials/fields/field-header.php';
235
- ?>
236
- <div class="custom-field" style="display: none;">
237
-
238
- <table class="field-table">
239
- <?php
240
- include 'partials/fields/field-type.php';
241
- include 'partials/fields/field-label.php';
242
- include 'partials/fields/field-name.php';
243
-
244
- if ( ! $adding ) {
245
- echo wpmtst_show_field_secondary( $key, $field );
246
- echo wpmtst_show_field_admin_table( $key, $field );
247
- }
248
-
249
- ?>
250
- </table>
251
-
252
- <?php
253
- if ( ! $adding ) {
254
- echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
255
- }
256
- include 'partials/fields/field-controls.php';
257
- ?>
258
- </div><!-- .custom-field -->
259
-
260
- <?php
261
- $html = ob_get_contents();
262
- ob_end_clean();
263
-
264
- return $html;
265
- }
266
-
267
-
268
- /**
269
- * Create the secondary inputs for a new custom field.
270
- * Called after field type is chosen (Post or Custom).
271
- *
272
- * @param $key
273
- * @param $field
274
- *
275
- * @return string
276
- */
277
- function wpmtst_show_field_secondary( $key, $field ) {
278
- $html = '';
279
-
280
- /*
281
- * Required
282
- */
283
- if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
284
- // Disable option if this is a core field like post_content.
285
- if ( isset( $field['core'] ) && $field['core'] ) {
286
- $disabled = ' disabled="disabled"';
287
- } else {
288
- $disabled = '';
289
- }
290
-
291
- $html .= '<tr class="field-secondary">' . "\n";
292
- $html .= '<th>' . esc_html__( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
293
- $html .= '<td>' . "\n";
294
- if ( $disabled ) {
295
- $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][required]" value="' . esc_attr( $field['required'] ) . '">';
296
- $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
297
- } else {
298
- $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][required]" ' . checked( $field['required'], true, false ) . '>';
299
- }
300
- $html .= '</td>' . "\n";
301
- $html .= '</tr>' . "\n";
302
- }
303
-
304
- /*
305
- * Placeholder
306
- */
307
- if ( $field['show_placeholder_option'] ) {
308
- if ( isset( $field['placeholder'] ) ) {
309
- $html .= '<tr class="field-secondary">' . "\n";
310
- $html .= '<th>' . esc_html__( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
311
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
312
- $html .= '</tr>' . "\n";
313
- }
314
- }
315
-
316
- /*
317
- * Length
318
- */
319
- if ( $field['show_length_option'] ) {
320
- if ( isset( $field['max_length'] ) ) {
321
- $html .= '<tr class="field-secondary">' . "\n";
322
- $html .= '<th>' . esc_html__( 'Maximum Length', 'strong-testimonials' ) . '</th>' . "\n";
323
- $html .= '<td><input type="number" name="fields[' . esc_attr( $key ) . '][max_length]" value="' . esc_attr($field['max_length']) . '"><span> ' . esc_html__( 'Limit the user imput to a certain number of characters', 'strong-testimonials' ) . '</span></td>' . "\n";
324
- $html .= '</tr>' . "\n";
325
- }
326
- }
327
-
328
- /**
329
- * Text (checkbox, radio)
330
- *
331
- * @since 2.23.0
332
- */
333
- if ( $field['show_text_option'] ) {
334
- if ( isset( $field['text'] ) ) {
335
- $html .= '<tr class="field-secondary">' . "\n";
336
- $html .= '<th>' . esc_html__( 'Checked value', 'strong-testimonials' ) . '</th>' . "\n";
337
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . esc_html__( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
338
- $html .= '</tr>' . "\n";
339
- }
340
- }
341
-
342
- /*
343
- * Before
344
- */
345
- $html .= '<tr class="field-secondary">' . "\n";
346
- $html .= '<th>' . esc_html__( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
347
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
348
- $html .= '</tr>' . "\n";
349
-
350
- /*
351
- * After
352
- */
353
- $html .= '<tr class="field-secondary">' . "\n";
354
- $html .= '<th>' . esc_html__( 'After', 'strong-testimonials' ) . '</th>' . "\n";
355
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
356
- $html .= '</tr>' . "\n";
357
-
358
- /*
359
- * Default Form Value
360
- */
361
- if ( $field['show_default_options'] ) {
362
- if ( isset( $field['default_form_value'] ) ) {
363
- $html .= '<tr class="field-secondary">' . "\n";
364
- $html .= '<th>' . esc_html__( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
365
- $html .= '<td>' . "\n";
366
-
367
- // TODO Replace this special handling
368
- if ( 'rating' == $field['input_type'] ) {
369
-
370
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
371
- $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
372
- $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
373
-
374
- } elseif ( 'checkbox' == $field['input_type'] ) {
375
-
376
- $html .= '<label>';
377
- $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
378
- $html .= '<span class="help inline">' . esc_html__( 'Checked by default.', 'strong-testimonials' ) . '</span>';
379
- $html .= '</label>';
380
-
381
- } else {
382
-
383
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
384
- $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
385
-
386
- }
387
-
388
- $html .= '</td>' . "\n";
389
- $html .= '</tr>' . "\n";
390
- }
391
- }
392
-
393
- /*
394
- * Default Display Value
395
- */
396
- if ( $field['show_default_options'] ) {
397
- // TODO Replace this special handling for checkbox type
398
- if ( 'checkbox' != $field['input_type'] ) {
399
- if ( isset( $field['default_display_value'] ) ) {
400
- $html .= '<tr class="field-secondary">' . "\n";
401
- $html .= '<th>' . esc_html__( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
402
- $html .= '<td>' . "\n";
403
-
404
- // TODO Replace this special handling
405
- if ( 'rating' == $field['input_type'] ) {
406
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
407
- $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
408
- } else {
409
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
410
- }
411
-
412
- $html .= '<span class="help">' . esc_html__( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
413
- $html .= '</td>' . "\n";
414
- $html .= '</tr>' . "\n";
415
- }
416
- }
417
- }
418
-
419
- /*
420
- * Shortcode Options
421
- */
422
- if ( $field['show_shortcode_options'] ) {
423
- if ( isset( $field['shortcode_on_form'] ) ) {
424
- $html .= '<tr class="field-secondary">' . "\n";
425
- $html .= '<th>' . esc_html__( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
426
- $html .= '<td>' . "\n";
427
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
428
- $html .= '</td>' . "\n";
429
- $html .= '</tr>' . "\n";
430
- }
431
- if ( isset( $field['shortcode_on_display'] ) ) {
432
- $html .= '<tr class="field-secondary">' . "\n";
433
- $html .= '<th>' . esc_html__( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
434
- $html .= '<td>' . "\n";
435
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
436
- $html .= '</td>' . "\n";
437
- $html .= '</tr>' . "\n";
438
- }
439
- }
440
-
441
- $html = apply_filters( 'wpmtst_fields_secondary', $html, $key, $field );
442
-
443
- return $html;
444
- }
445
-
446
-
447
- /**
448
- * Add type-specific [Admin Table] setting to form.
449
- */
450
- function wpmtst_show_field_admin_table( $key, $field ) {
451
- // -------------------
452
- // Show in Admin Table
453
- // -------------------
454
- if ( ! $field['show_admin_table_option'] ) {
455
- $html = '<input type="hidden" name="fields[' . esc_attr( $key ) . '][show_admin_table_option]" value="' . esc_attr( $field['show_admin_table_option'] ) . '">';
456
- return $html;
457
- }
458
-
459
- $html = '<tr class="field-admin-table">' . "\n";
460
- $html .= '<th>' . esc_html__( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
461
- $html .= '<td>' . "\n";
462
- if ( $field['admin_table_option'] ) {
463
- $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . esc_attr( $key ) . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
464
- } else {
465
- $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . esc_html__( 'required', 'strong-testimonials' ) . '</em>';
466
- $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][admin_table]" value="' . esc_attr( $field['admin_table'] ) . '">';
467
- }
468
- $html .= '<span class="help inline">' . esc_html__( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
469
- $html .= '</label>';
470
- $html .= '</td>' . "\n";
471
- $html .= '</tr>' . "\n";
472
-
473
- return $html;
474
- }
475
-
476
-
477
- /**
478
- * Add type-specific select options field
479
- */
480
- function wpmtst_show_field_select_options( $key, $field ) {
481
-
482
- if( $field['input_type'] !== 'select' ) {
483
- return;
484
- }
485
-
486
- ob_start();
487
- include 'partials/fields/field-select-options.php';
488
- return ob_get_clean();
489
- }
490
-
491
-
492
- /**
493
- * Add hidden fields to form.
494
- *
495
- * @param $key
496
- * @param $field
497
- *
498
- * @return string
499
- */
500
- function wpmtst_show_field_hidden( $key, $field ) {
501
- $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
502
-
503
- $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
504
- $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
505
- if ( isset( $field['action_input'] ) ) {
506
- $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
507
- }
508
- if ( isset( $field['action_output'] ) ) {
509
- $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
510
- }
511
- $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
512
- $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
513
- $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
514
- $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
515
- $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
516
- $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
517
- $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
518
- $html .= sprintf( $pattern, $key, 'show_length_option', $field['show_length_option'] ) . "\n";
519
-
520
- if ( isset( $field['map'] ) ) {
521
- $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
522
- }
523
-
524
- if ( isset( $field['core'] ) ) {
525
- $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
526
- }
527
-
528
- return $html;
529
- }
1
+ <?php
2
+ /**
3
+ * Strong Testimonials - Custom fields admin functions
4
+ */
5
+
6
+ function wpmtst_form_admin() {
7
+ do_action( 'wpmtst_form_admin' );
8
+ }
9
+
10
+ function wpmtst_form_admin2() {
11
+ wpmtst_settings_custom_fields( 1 );
12
+ }
13
+
14
+ add_action( 'wpmtst_form_admin', 'wpmtst_form_admin2' );
15
+
16
+ /**
17
+ * Save changes to custom fields.
18
+ *
19
+ * @since 2.28.5 As separate function on custom action.
20
+ */
21
+ function wpmtst_update_custom_fields() {
22
+ $goback = wp_get_referer();
23
+ $goback = apply_filters( 'wpmtst_form_goback', $goback );
24
+
25
+ if ( ! isset( $_POST['wpmtst_form_submitted'] ) ) {
26
+ wp_redirect( $goback );
27
+ exit;
28
+ }
29
+
30
+ if ( ! wp_verify_nonce( $_POST['wpmtst_form_submitted'], 'wpmtst_custom_fields_form' ) ) {
31
+ wp_redirect( $goback );
32
+ exit;
33
+ }
34
+
35
+ $form_id = absint ( $_POST['form_id'] );
36
+ $forms = get_option( 'wpmtst_custom_forms' );
37
+ $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
38
+
39
+ if ( isset( $_POST['reset'] ) ) {
40
+
41
+ // Undo changes
42
+ wpmtst_add_admin_notice( 'changes-cancelled' );
43
+
44
+ }
45
+ elseif ( isset( $_POST['restore-defaults'] ) ) {
46
+
47
+ // Restore defaults
48
+ $default_forms = Strong_Testimonials_Defaults::get_base_forms();
49
+ $fields = $default_forms['default']['fields'];
50
+ $forms[ $form_id ]['fields'] = $fields;
51
+ update_option( 'wpmtst_custom_forms', $forms );
52
+ do_action( 'wpmtst_fields_updated', $fields );
53
+
54
+ wpmtst_add_admin_notice( 'defaults-restored' );
55
+
56
+ }
57
+ else {
58
+
59
+ // Save changes
60
+ $fields = array();
61
+ $new_key = 0;
62
+
63
+ /**
64
+ * Strip the dang slashes from the dang magic quotes.
65
+ *
66
+ * @since 2.0.0
67
+ */
68
+ $post_fields = stripslashes_deep( $_POST['fields'] );
69
+
70
+ foreach ( $post_fields as $key => $field ) {
71
+
72
+
73
+ /*
74
+ * Before merging onto base field, catch fields that are "off"
75
+ * which the form does not submit. Otherwise, the default "on"
76
+ * would override the requested (but not submitted) "off".
77
+ */
78
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
79
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
80
+
81
+ $field = array_merge( $field_options['field_base'], $field );
82
+
83
+ $field['name'] = sanitize_text_field( $field['name'] );
84
+ $field['label'] = sanitize_text_field( $field['label'] );
85
+ $field['text'] = sanitize_text_field( $field['text'] );
86
+
87
+ // TODO Replace this special handling
88
+ if ( 'checkbox' == $field['input_type'] ) {
89
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
90
+ } else {
91
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
92
+ }
93
+ $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
94
+ $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
95
+
96
+ $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
97
+
98
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
99
+
100
+ $field['before'] = sanitize_text_field( $field['before'] );
101
+ $field['after'] = sanitize_text_field( $field['after'] );
102
+
103
+ $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
104
+ $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
105
+ $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
106
+
107
+ // Hidden options (no need to check if isset)
108
+ $field['admin_table'] = $field['admin_table'] ? 1 : 0;
109
+ $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
+ $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
+ $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
+ $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
+ $field['show_length_option'] = $field['show_length_option'] ? 1 : 0;
114
+
115
+ $field = apply_filters( 'wpmtst_sanitize_form_field_options', $field );
116
+
117
+ // add to fields array in display order
118
+ $fields[ $new_key++ ] = $field;
119
+
120
+ }
121
+
122
+ $forms[ $form_id ]['fields'] = $fields;
123
+
124
+ if ( isset( $_POST['field_group_label'] ) ) {
125
+ // TODO Catch if empty.
126
+ $new_label = sanitize_text_field( $_POST['field_group_label'] );
127
+ $forms[ $form_id ]['label'] = $new_label;
128
+ }
129
+
130
+ update_option( 'wpmtst_custom_forms', $forms );
131
+ do_action( 'wpmtst_fields_updated', $fields );
132
+
133
+ wpmtst_add_admin_notice( 'fields-saved' );
134
+
135
+ }
136
+
137
+ wp_redirect( $goback );
138
+ exit;
139
+ }
140
+
141
+ add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
142
+
143
+ /**
144
+ * Custom Fields form
145
+ *
146
+ * @param int $form_id
147
+ */
148
+ function wpmtst_settings_custom_fields( $form_id = 1 ) {
149
+ if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
150
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'strong-testimonials' ) );
151
+ }
152
+
153
+ if ( ! $form_id ) {
154
+ echo '<div class="wrap wpmtst"><p>' . esc_html__( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
155
+ return;
156
+ }
157
+
158
+ $forms = get_option( 'wpmtst_custom_forms' );
159
+ $fields = apply_filters( 'wpmtst_form_fields', $forms[$form_id]['fields'] );
160
+ ?>
161
+
162
+ <div class="wrap wpmtst">
163
+ <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
164
+
165
+ <div id="left-col">
166
+ <div>
167
+ <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
168
+ <p>
169
+ <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
170
+ <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
171
+ </p>
172
+ <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
173
+ </div>
174
+
175
+ <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
176
+ <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
177
+ <input type="hidden" name="action" value="wpmtst_update_custom_fields">
178
+ <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
179
+
180
+ <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
181
+
182
+ <ul id="custom-field-list">
183
+ <?php
184
+ foreach ( $fields as $key => $field ) {
185
+ echo '<li id="field-' . esc_attr( $key ) . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
186
+ }
187
+ ?>
188
+ </ul>
189
+
190
+ <div id="add-field-bar">
191
+ <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
192
+ </div>
193
+
194
+ <?php do_action( 'wpmtst_admin_after_form_fields' ); ?>
195
+
196
+ <div id="field-group-actions">
197
+ <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
198
+ <div><?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
199
+ <div><?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
200
+ </div>
201
+ </form>
202
+ </div><!-- #left-col -->
203
+
204
+ <div id="right-col">
205
+ <div class="intro">
206
+ <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
207
+ <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
208
+ </div>
209
+ <?php do_action( 'wpmtst_fields_before_fields_editor_preview' ); ?>
210
+ <div id="fields-editor-preview">
211
+ <div><!-- placeholder --></div>
212
+ </div>
213
+ </div><!-- #right-col -->
214
+
215
+ </div><!-- .wrap -->
216
+ <?php
217
+ }
218
+
219
+ /**
220
+ * Add a field to the form
221
+ *
222
+ * @param $key
223
+ * @param $field
224
+ * @param $adding
225
+ *
226
+ * @return string
227
+ */
228
+ function wpmtst_show_field( $key, $field, $adding ) {
229
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
230
+ $field_types = $fields['field_types'];
231
+
232
+ ob_start();
233
+
234
+ include 'partials/fields/field-header.php';
235
+ ?>
236
+ <div class="custom-field" style="display: none;">
237
+
238
+ <table class="field-table">
239
+ <?php
240
+ include 'partials/fields/field-type.php';
241
+ include 'partials/fields/field-label.php';
242
+ include 'partials/fields/field-name.php';
243
+
244
+ if ( ! $adding ) {
245
+ echo wpmtst_show_field_secondary( $key, $field );
246
+ echo wpmtst_show_field_admin_table( $key, $field );
247
+ }
248
+
249
+ ?>
250
+ </table>
251
+
252
+ <?php
253
+ if ( ! $adding ) {
254
+ echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
255
+ }
256
+ include 'partials/fields/field-controls.php';
257
+ ?>
258
+ </div><!-- .custom-field -->
259
+
260
+ <?php
261
+ $html = ob_get_contents();
262
+ ob_end_clean();
263
+
264
+ return $html;
265
+ }
266
+
267
+
268
+ /**
269
+ * Create the secondary inputs for a new custom field.
270
+ * Called after field type is chosen (Post or Custom).
271
+ *
272
+ * @param $key
273
+ * @param $field
274
+ *
275
+ * @return string
276
+ */
277
+ function wpmtst_show_field_secondary( $key, $field ) {
278
+ $html = '';
279
+
280
+ /*
281
+ * Required
282
+ */
283
+ if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
284
+ // Disable option if this is a core field like post_content.
285
+ if ( isset( $field['core'] ) && $field['core'] ) {
286
+ $disabled = ' disabled="disabled"';
287
+ } else {
288
+ $disabled = '';
289
+ }
290
+
291
+ $html .= '<tr class="field-secondary">' . "\n";
292
+ $html .= '<th>' . esc_html__( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
293
+ $html .= '<td>' . "\n";
294
+ if ( $disabled ) {
295
+ $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][required]" value="' . esc_attr( $field['required'] ) . '">';
296
+ $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
297
+ } else {
298
+ $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][required]" ' . checked( $field['required'], true, false ) . '>';
299
+ }
300
+ $html .= '</td>' . "\n";
301
+ $html .= '</tr>' . "\n";
302
+ }
303
+
304
+ /*
305
+ * Placeholder
306
+ */
307
+ if ( $field['show_placeholder_option'] ) {
308
+ if ( isset( $field['placeholder'] ) ) {
309
+ $html .= '<tr class="field-secondary">' . "\n";
310
+ $html .= '<th>' . esc_html__( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
311
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
312
+ $html .= '</tr>' . "\n";
313
+ }
314
+ }
315
+
316
+ /*
317
+ * Length
318
+ */
319
+ if ( $field['show_length_option'] ) {
320
+ if ( isset( $field['max_length'] ) ) {
321
+ $html .= '<tr class="field-secondary">' . "\n";
322
+ $html .= '<th>' . esc_html__( 'Maximum Length', 'strong-testimonials' ) . '</th>' . "\n";
323
+ $html .= '<td><input type="number" name="fields[' . esc_attr( $key ) . '][max_length]" value="' . esc_attr($field['max_length']) . '"><span> ' . esc_html__( 'Limit the user imput to a certain number of characters', 'strong-testimonials' ) . '</span></td>' . "\n";
324
+ $html .= '</tr>' . "\n";
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Text (checkbox, radio)
330
+ *
331
+ * @since 2.23.0
332
+ */
333
+ if ( $field['show_text_option'] ) {
334
+ if ( isset( $field['text'] ) ) {
335
+ $html .= '<tr class="field-secondary">' . "\n";
336
+ $html .= '<th>' . esc_html__( 'Checked value', 'strong-testimonials' ) . '</th>' . "\n";
337
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . esc_html__( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
338
+ $html .= '</tr>' . "\n";
339
+ }
340
+ }
341
+
342
+ /*
343
+ * Before
344
+ */
345
+ $html .= '<tr class="field-secondary">' . "\n";
346
+ $html .= '<th>' . esc_html__( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
347
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
348
+ $html .= '</tr>' . "\n";
349
+
350
+ /*
351
+ * After
352
+ */
353
+ $html .= '<tr class="field-secondary">' . "\n";
354
+ $html .= '<th>' . esc_html__( 'After', 'strong-testimonials' ) . '</th>' . "\n";
355
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
356
+ $html .= '</tr>' . "\n";
357
+
358
+ /*
359
+ * Default Form Value
360
+ */
361
+ if ( $field['show_default_options'] ) {
362
+ if ( isset( $field['default_form_value'] ) ) {
363
+ $html .= '<tr class="field-secondary">' . "\n";
364
+ $html .= '<th>' . esc_html__( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
365
+ $html .= '<td>' . "\n";
366
+
367
+ // TODO Replace this special handling
368
+ if ( 'rating' == $field['input_type'] ) {
369
+
370
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
371
+ $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
372
+ $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
373
+
374
+ } elseif ( 'checkbox' == $field['input_type'] ) {
375
+
376
+ $html .= '<label>';
377
+ $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
378
+ $html .= '<span class="help inline">' . esc_html__( 'Checked by default.', 'strong-testimonials' ) . '</span>';
379
+ $html .= '</label>';
380
+
381
+ } else {
382
+
383
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
384
+ $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
385
+
386
+ }
387
+
388
+ $html .= '</td>' . "\n";
389
+ $html .= '</tr>' . "\n";
390
+ }
391
+ }
392
+
393
+ /*
394
+ * Default Display Value
395
+ */
396
+ if ( $field['show_default_options'] ) {
397
+ // TODO Replace this special handling for checkbox type
398
+ if ( 'checkbox' != $field['input_type'] ) {
399
+ if ( isset( $field['default_display_value'] ) ) {
400
+ $html .= '<tr class="field-secondary">' . "\n";
401
+ $html .= '<th>' . esc_html__( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
402
+ $html .= '<td>' . "\n";
403
+
404
+ // TODO Replace this special handling
405
+ if ( 'rating' == $field['input_type'] ) {
406
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
407
+ $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
408
+ } else {
409
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
410
+ }
411
+
412
+ $html .= '<span class="help">' . esc_html__( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
413
+ $html .= '</td>' . "\n";
414
+ $html .= '</tr>' . "\n";
415
+ }
416
+ }
417
+ }
418
+
419
+ /*
420
+ * Shortcode Options
421
+ */
422
+ if ( $field['show_shortcode_options'] ) {
423
+ if ( isset( $field['shortcode_on_form'] ) ) {
424
+ $html .= '<tr class="field-secondary">' . "\n";
425
+ $html .= '<th>' . esc_html__( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
426
+ $html .= '<td>' . "\n";
427
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
428
+ $html .= '</td>' . "\n";
429
+ $html .= '</tr>' . "\n";
430
+ }
431
+ if ( isset( $field['shortcode_on_display'] ) ) {
432
+ $html .= '<tr class="field-secondary">' . "\n";
433
+ $html .= '<th>' . esc_html__( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
434
+ $html .= '<td>' . "\n";
435
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
436
+ $html .= '</td>' . "\n";
437
+ $html .= '</tr>' . "\n";
438
+ }
439
+ }
440
+
441
+ $html = apply_filters( 'wpmtst_fields_secondary', $html, $key, $field );
442
+
443
+ return $html;
444
+ }
445
+
446
+
447
+ /**
448
+ * Add type-specific [Admin Table] setting to form.
449
+ */
450
+ function wpmtst_show_field_admin_table( $key, $field ) {
451
+ // -------------------
452
+ // Show in Admin Table
453
+ // -------------------
454
+ if ( ! $field['show_admin_table_option'] ) {
455
+ $html = '<input type="hidden" name="fields[' . esc_attr( $key ) . '][show_admin_table_option]" value="' . esc_attr( $field['show_admin_table_option'] ) . '">';
456
+ return $html;
457
+ }
458
+
459
+ $html = '<tr class="field-admin-table">' . "\n";
460
+ $html .= '<th>' . esc_html__( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
461
+ $html .= '<td>' . "\n";
462
+ if ( $field['admin_table_option'] ) {
463
+ $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . esc_attr( $key ) . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
464
+ } else {
465
+ $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . esc_html__( 'required', 'strong-testimonials' ) . '</em>';
466
+ $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][admin_table]" value="' . esc_attr( $field['admin_table'] ) . '">';
467
+ }
468
+ $html .= '<span class="help inline">' . esc_html__( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
469
+ $html .= '</label>';
470
+ $html .= '</td>' . "\n";
471
+ $html .= '</tr>' . "\n";
472
+
473
+ return $html;
474
+ }
475
+
476
+
477
+ /**
478
+ * Add type-specific select options field
479
+ */
480
+ function wpmtst_show_field_select_options( $key, $field ) {
481
+
482
+ if( $field['input_type'] !== 'select' ) {
483
+ return;
484
+ }
485
+
486
+ ob_start();
487
+ include 'partials/fields/field-select-options.php';
488
+ return ob_get_clean();
489
+ }
490
+
491
+
492
+ /**
493
+ * Add hidden fields to form.
494
+ *
495
+ * @param $key
496
+ * @param $field
497
+ *
498
+ * @return string
499
+ */
500
+ function wpmtst_show_field_hidden( $key, $field ) {
501
+ $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
502
+
503
+ $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
504
+ $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
505
+ if ( isset( $field['action_input'] ) ) {
506
+ $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
507
+ }
508
+ if ( isset( $field['action_output'] ) ) {
509
+ $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
510
+ }
511
+ $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
512
+ $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
513
+ $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
514
+ $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
515
+ $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
516
+ $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
517
+ $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
518
+ $html .= sprintf( $pattern, $key, 'show_length_option', $field['show_length_option'] ) . "\n";
519
+
520
+ if ( isset( $field['map'] ) ) {
521
+ $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
522
+ }
523
+
524
+ if ( isset( $field['core'] ) ) {
525
+ $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
526
+ }
527
+
528
+ return $html;
529
+ }
admin/form-preview.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
-
3
- function wpmtst_get_form_preview() {
4
- if ( ! isset( $_POST['fields'] ) ) exit;
5
-
6
- // parse_str decodes too; no need to use urldecode
7
- parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
-
9
- $new_fields = array();
10
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
-
12
- foreach ( $preview['fields'] as $key => $field ) {
13
- /*
14
- * Before merging onto base field, catch fields that are "off"
15
- * which the form does not submit. Otherwise, the default "on"
16
- * would override the requested (but not submitted) "off".
17
- */
18
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
-
21
- $field = array_merge( $fields['field_base'], $field );
22
-
23
- if ( 'none' == $field['input_type'] ) {
24
- $field['input_type'] = 'text';
25
- }
26
-
27
- $field['name'] = sanitize_text_field( $field['name'] );
28
- $field['label'] = sanitize_text_field( $field['label'] );
29
- // TODO Replace this special handling
30
- if ( 'checkbox' == $field['input_type'] ) {
31
- $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32
- } else {
33
- $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34
- }
35
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36
- $field['before'] = sanitize_text_field( $field['before'] );
37
- $field['after'] = sanitize_text_field( $field['after'] );
38
-
39
- // add to fields array in display order
40
- $new_fields[] = $field;
41
- }
42
-
43
- ob_start();
44
- include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45
- $html = ob_get_contents();
46
- ob_end_clean();
47
- echo $html;
48
-
49
- exit;
50
- }
51
- add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
1
+ <?php
2
+
3
+ function wpmtst_get_form_preview() {
4
+ if ( ! isset( $_POST['fields'] ) ) exit;
5
+
6
+ // parse_str decodes too; no need to use urldecode
7
+ parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
+
9
+ $new_fields = array();
10
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
+
12
+ foreach ( $preview['fields'] as $key => $field ) {
13
+ /*
14
+ * Before merging onto base field, catch fields that are "off"
15
+ * which the form does not submit. Otherwise, the default "on"
16
+ * would override the requested (but not submitted) "off".
17
+ */
18
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
+
21
+ $field = array_merge( $fields['field_base'], $field );
22
+
23
+ if ( 'none' == $field['input_type'] ) {
24
+ $field['input_type'] = 'text';
25
+ }
26
+
27
+ $field['name'] = sanitize_text_field( $field['name'] );
28
+ $field['label'] = sanitize_text_field( $field['label'] );
29
+ // TODO Replace this special handling
30
+ if ( 'checkbox' == $field['input_type'] ) {
31
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32
+ } else {
33
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34
+ }
35
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36
+ $field['before'] = sanitize_text_field( $field['before'] );
37
+ $field['after'] = sanitize_text_field( $field['after'] );
38
+
39
+ // add to fields array in display order
40
+ $new_fields[] = $field;
41
+ }
42
+
43
+ ob_start();
44
+ include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45
+ $html = ob_get_contents();
46
+ ob_end_clean();
47
+ echo $html;
48
+
49
+ exit;
50
+ }
51
+ add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
admin/img/features/email.svg CHANGED
@@ -1,21 +1,21 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#A999F6;}
7
- </style>
8
- <g>
9
- <g>
10
- <path class="st0" d="M64.5,13.1v34.1c0,2.8-2.3,5.1-5.1,5.1h-48c-2.8,0-5.1-2.3-5.1-5.1V13.1c0-2.8,2.3-5.1,5.1-5.1h48
11
- C62.2,8,64.5,10.3,64.5,13.1z"/>
12
- </g>
13
- </g>
14
- <g>
15
- <g>
16
- <path d="M56.6,2.6H5.5C2.4,2.6,0,5,0,8v36.4c0,3,2.4,5.5,5.5,5.5h51.1c3,0,5.5-2.4,5.5-5.5V8C62,5,59.6,2.6,56.6,2.6z M55.8,6.2
17
- L31.1,30.9L6.2,6.2H55.8z M3.6,43.6V8.8l17.5,17.4L3.6,43.6z M6.2,46.2l17.5-17.5l6.1,6.1c0.7,0.7,1.9,0.7,2.6,0l6-6l17.4,17.4
18
- H6.2z M58.4,43.6L41,26.2L58.4,8.8V43.6z"/>
19
- </g>
20
- </g>
21
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#A999F6;}
7
+ </style>
8
+ <g>
9
+ <g>
10
+ <path class="st0" d="M64.5,13.1v34.1c0,2.8-2.3,5.1-5.1,5.1h-48c-2.8,0-5.1-2.3-5.1-5.1V13.1c0-2.8,2.3-5.1,5.1-5.1h48
11
+ C62.2,8,64.5,10.3,64.5,13.1z"/>
12
+ </g>
13
+ </g>
14
+ <g>
15
+ <g>
16
+ <path d="M56.6,2.6H5.5C2.4,2.6,0,5,0,8v36.4c0,3,2.4,5.5,5.5,5.5h51.1c3,0,5.5-2.4,5.5-5.5V8C62,5,59.6,2.6,56.6,2.6z M55.8,6.2
17
+ L31.1,30.9L6.2,6.2H55.8z M3.6,43.6V8.8l17.5,17.4L3.6,43.6z M6.2,46.2l17.5-17.5l6.1,6.1c0.7,0.7,1.9,0.7,2.6,0l6-6l17.4,17.4
18
+ H6.2z M58.4,43.6L41,26.2L58.4,8.8V43.6z"/>
19
+ </g>
20
+ </g>
21
+ </svg>
admin/img/features/filter.svg CHANGED
@@ -1,21 +1,21 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#A999F6;}
7
- </style>
8
- <g>
9
- <g>
10
- <path class="st0" d="M61.2,7.2v9.2c0,0.5-0.2,1-0.6,1.4L42.7,33.9v15.8c0,0.7-0.4,1.3-1,1.6l-11.1,5.5C30.4,57,30.1,57,29.8,57
11
- c-1,0-1.8-0.8-1.8-1.8V33.9L10.1,17.8c-0.4-0.3-0.6-0.9-0.6-1.4V7.2c0-1,0.8-1.8,1.8-1.8h48C60.4,5.3,61.2,6.1,61.2,7.2z"/>
12
- </g>
13
- </g>
14
- <g>
15
- <g>
16
- <path d="M58.1,0H5.8c-1.1,0-2,0.9-2,2v10.1c0,0.6,0.2,1.1,0.7,1.5l19.4,17.5v23.2c0,1.1,0.9,2,2,2c0.3,0,0.6-0.1,0.9-0.2l12.1-6
17
- c0.7-0.3,1.1-1,1.1-1.8V31.1l19.4-17.5c0.4-0.4,0.7-0.9,0.7-1.5V2C60.1,0.9,59.2,0,58.1,0z M56.1,11.2L36.6,28.7
18
- c-0.4,0.4-0.7,0.9-0.7,1.5V47l-8,4V30.2c0-0.6-0.2-1.1-0.7-1.5L7.8,11.2V4h48.3V11.2z"/>
19
- </g>
20
- </g>
21
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#A999F6;}
7
+ </style>
8
+ <g>
9
+ <g>
10
+ <path class="st0" d="M61.2,7.2v9.2c0,0.5-0.2,1-0.6,1.4L42.7,33.9v15.8c0,0.7-0.4,1.3-1,1.6l-11.1,5.5C30.4,57,30.1,57,29.8,57
11
+ c-1,0-1.8-0.8-1.8-1.8V33.9L10.1,17.8c-0.4-0.3-0.6-0.9-0.6-1.4V7.2c0-1,0.8-1.8,1.8-1.8h48C60.4,5.3,61.2,6.1,61.2,7.2z"/>
12
+ </g>
13
+ </g>
14
+ <g>
15
+ <g>
16
+ <path d="M58.1,0H5.8c-1.1,0-2,0.9-2,2v10.1c0,0.6,0.2,1.1,0.7,1.5l19.4,17.5v23.2c0,1.1,0.9,2,2,2c0.3,0,0.6-0.1,0.9-0.2l12.1-6
17
+ c0.7-0.3,1.1-1,1.1-1.8V31.1l19.4-17.5c0.4-0.4,0.7-0.9,0.7-1.5V2C60.1,0.9,59.2,0,58.1,0z M56.1,11.2L36.6,28.7
18
+ c-0.4,0.4-0.7,0.9-0.7,1.5V47l-8,4V30.2c0-0.6-0.2-1.1-0.7-1.5L7.8,11.2V4h48.3V11.2z"/>
19
+ </g>
20
+ </g>
21
+ </svg>
admin/img/features/infinitescroll.svg CHANGED
@@ -1,15 +1,15 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#A999F6;}
7
- </style>
8
- <path class="st0" d="M50.9,18v26.7c0,6.5-5,11.8-11.1,11.8h-8.5c-6.1,0-11.1-5.3-11.1-11.8V18c0-6.5,5-11.8,11.1-11.8h8.5
9
- C45.9,6.2,50.9,11.5,50.9,18z"/>
10
- <path d="M31.2,45.9L21.8,36l3-2.9l6.3,6.7l6.3-6.7l3.1,2.9L31.2,45.9z M48.6,41.9V13.5C48.6,6.5,43,0.9,36,0.9h-9.6
11
- c-6.9,0-12.6,5.6-12.6,12.6v28.5c0,6.9,5.6,12.6,12.6,12.6H36C43,54.5,48.6,48.9,48.6,41.9z M36,5.1c4.6,0,8.4,3.8,8.4,8.4v28.5
12
- c0,4.6-3.8,8.4-8.4,8.4h-9.6c-4.6,0-8.4-3.8-8.4-8.4V13.5c0-4.6,3.8-8.4,8.4-8.4H36z M31.2,9.4c-1.2,0-2.1,0.9-2.1,2.1
13
- s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1S32.4,9.4,31.2,9.4z M31.2,17.8c-1.2,0-2.1,0.9-2.1,2.1s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1
14
- S32.4,17.8,31.2,17.8z M31.2,26.1c-1.2,0-2.1,0.9-2.1,2.1s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1S32.4,26.1,31.2,26.1z"/>
15
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#A999F6;}
7
+ </style>
8
+ <path class="st0" d="M50.9,18v26.7c0,6.5-5,11.8-11.1,11.8h-8.5c-6.1,0-11.1-5.3-11.1-11.8V18c0-6.5,5-11.8,11.1-11.8h8.5
9
+ C45.9,6.2,50.9,11.5,50.9,18z"/>
10
+ <path d="M31.2,45.9L21.8,36l3-2.9l6.3,6.7l6.3-6.7l3.1,2.9L31.2,45.9z M48.6,41.9V13.5C48.6,6.5,43,0.9,36,0.9h-9.6
11
+ c-6.9,0-12.6,5.6-12.6,12.6v28.5c0,6.9,5.6,12.6,12.6,12.6H36C43,54.5,48.6,48.9,48.6,41.9z M36,5.1c4.6,0,8.4,3.8,8.4,8.4v28.5
12
+ c0,4.6-3.8,8.4-8.4,8.4h-9.6c-4.6,0-8.4-3.8-8.4-8.4V13.5c0-4.6,3.8-8.4,8.4-8.4H36z M31.2,9.4c-1.2,0-2.1,0.9-2.1,2.1
13
+ s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1S32.4,9.4,31.2,9.4z M31.2,17.8c-1.2,0-2.1,0.9-2.1,2.1s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1
14
+ S32.4,17.8,31.2,17.8z M31.2,26.1c-1.2,0-2.1,0.9-2.1,2.1s0.9,2.1,2.1,2.1s2.1-0.9,2.1-2.1S32.4,26.1,31.2,26.1z"/>
15
+ </svg>
admin/img/features/mailchimp.svg CHANGED
@@ -1,34 +1,34 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#A999F6;}
7
- </style>
8
- <path class="st0" d="M59.6,40.1c0,2.2-0.9,4.6-1.1,5.2C51.9,61.1,26.3,61,19.3,44.8c-3.8,0-7.8-3.3-8.2-7.4c-0.2-1.4,0-2.8,0.5-4.1
9
- l-1.8-1.5C1.6,25,27.3-3.6,35.5,3.5c0.1,0,2.8,2.7,2.8,2.7l1.5-0.6c7.2-3,13.1-1.5,13.1,3.2c0,2.5-1.6,5.4-4.1,8
10
- c3.2,3,2.4,8.7,2.6,10.1c0.9,0.2,3.7,0.9,5,2.3c2.2,2.3,0.7,4.8,0.4,5.3c0.5,1.4,0.4,1.1,0.8,2.5C58.4,37,59.6,37.9,59.6,40.1z"/>
11
- <path d="M44.1,25.8c0.4,0,0.8,0,1.1,0c0.2-0.5,0.2-1.3,0.1-2.1c-0.3-1.3-0.6-2.1-1.4-2c-0.8,0.1-0.8,1.1-0.5,2.4
12
- C43.5,24.8,43.8,25.4,44.1,25.8L44.1,25.8z M37.6,26.8c0.5,0.2,0.9,0.4,1,0.3c0.2-0.2-0.4-1.1-1.5-1.6c-1.2-0.5-2.6-0.3-3.7,0.4
13
- c-0.4,0.3-0.7,0.6-0.7,0.9c0.1,0.5,1.2-0.3,2.8-0.4C36.3,26.3,37,26.6,37.6,26.8L37.6,26.8z M36.5,27.5c-1.1,0.2-1.8,0.8-1.6,1.2
14
- c0.1,0,0.1,0.1,0.6-0.1c0.7-0.3,1.5-0.4,2.3-0.2c0.4,0,0.5,0.1,0.6-0.1C38.5,28,37.6,27.3,36.5,27.5L36.5,27.5z M43.1,29.5
15
- c0.4-0.8-1.3-1.7-1.7-0.9C40.9,29.5,42.6,30.4,43.1,29.5L43.1,29.5z M45,27c-0.9,0-1,1.9,0,1.9C45.9,29,45.9,27.1,45,27L45,27z
16
- M18.3,36.7c-0.2,0-0.7,0.2-1-0.3c-0.6-1,1.4-2.5,0.4-4.4c-1.1-2.1-3.4-1.6-4.3-0.7c-1.1,1.2-1.1,2.9-0.6,2.9
17
- c0.5,0.1,0.5-0.8,0.9-1.4c0.5-0.7,1.4-0.9,2.2-0.5c0,0,0,0,0,0c1.4,0.9,0.2,2.2,0.3,3.5c0.2,2,2.2,2,2.6,1.1c0.1-0.1,0-0.2,0-0.3
18
- C18.7,36.8,18.8,36.5,18.3,36.7L18.3,36.7z M54.8,34.6c-0.4-1.4-0.3-1.1-0.8-2.5c0.3-0.4,1.9-2.9-0.4-5.3c-1.3-1.3-4.1-2-5-2.3
19
- c-0.2-1.4,0.6-7.1-2.6-10.1c2.5-2.6,4.1-5.5,4.1-8c0-4.8-5.9-6.2-13.1-3.2l-1.5,0.6c0,0-2.8-2.7-2.8-2.7C24.5-6-1.2,22.6,7,29.5
20
- L8.8,31c-0.5,1.3-0.7,2.7-0.5,4.1c0.4,4.1,4.4,7.4,8.2,7.3c7,16.2,32.6,16.2,39.2,0.4c0.2-0.5,1.1-3,1.1-5.2
21
- C56.8,35.5,55.6,34.6,54.8,34.6L54.8,34.6z M16.3,40.4c-2.8-0.1-5.8-2.6-6.1-5.5c-0.8-7.5,9-9.2,10.2-1.5C21,37,19.9,40.5,16.3,40.4
22
- L16.3,40.4z M14.1,26.5c-1.8,0.4-3.5,1.4-4.5,2.9c-0.6-0.5-1.7-1.5-1.9-1.8c-1.6-3,1.7-8.9,4.1-12.2C17.5,7.2,26.5,1,30.7,2.1
23
- c0.7,0.2,2.9,2.8,2.9,2.8s-4.2,2.3-8,5.5C20.4,14.4,16.4,20.2,14.1,26.5L14.1,26.5z M43.2,38.8c0,0-4.3,0.6-8.5-0.9
24
- c0.8-2.5,3.3,0.7,11.7-1.7c1.9-0.5,4.3-1.6,6.2-3.1c0.4,0.9,0.7,1.9,0.9,3c0.4-0.1,1.7-0.1,1.4,2.2c-0.4,2.4-1.4,4.4-3.2,6.2
25
- c-1.1,1.2-2.4,2.1-3.8,2.8c-0.8,0.4-1.6,0.8-2.5,1c-6.5,2.1-13.2-0.2-15.3-5.2c-0.2-0.4-0.3-0.8-0.4-1.2c-0.9-3.3-0.1-7.3,2.3-9.8
26
- c0.1-0.2,0.3-0.3,0.3-0.6c0-0.2-0.1-0.4-0.2-0.6c-0.9-1.2-3.8-3.3-3.2-7.4c0.4-2.9,3-5,5.4-4.9l0.6,0c1,0.1,1.9,0.2,2.8,0.2
27
- c1.4,0.1,2.7-0.1,4.2-1.4c0.5-0.4,0.9-0.8,1.6-0.9c0.6-0.1,1.2,0,1.7,0.3c1.2,0.8,1.4,2.8,1.5,4.2c0,0.8,0.1,2.8,0.2,3.4
28
- c0.1,1.3,0.4,1.5,1.1,1.7c0.4,0.1,0.7,0.2,1.3,0.4c1.6,0.5,2.6,0.9,3.2,1.5c0.3,0.3,0.5,0.7,0.6,1.1c0.2,1.4-1.1,3.1-4.4,4.6
29
- c-5.7,2.6-11.4,1.8-12.2,1.7c-2.5-0.3-3.8,2.8-2.4,5c2.8,4.1,14.9,2.4,18.4-2.6c0.1-0.1,0-0.2-0.1-0.1c-5.1,3.5-11.8,4.7-15.6,3.2
30
- c-0.6-0.2-1.8-0.8-1.9-2c5.3,1.6,8.6,0.1,8.6,0.1S43.5,38.8,43.2,38.8L43.2,38.8z M24.7,15.3c2-2.4,4.5-4.4,6.8-5.6c0,0,0.1,0,0.1,0
31
- c0,0,0,0.1,0,0.1c-0.2,0.3-0.5,1-0.6,1.5c0,0,0,0.1,0.1,0.1c0,0,0.1,0,0.1,0c1.4-1,3.8-2,6-2.1c0.1,0,0.1,0,0.1,0.1c0,0,0,0.1,0,0.1
32
- c-0.4,0.3-0.7,0.6-0.9,0.9c0,0,0,0.1,0,0.1c0,0,0,0,0.1,0c1.5,0,3.6,0.5,5,1.3c0.1,0.1,0,0.2-0.1,0.2c-8.5-1.9-15,2.3-16.4,3.3
33
- c0,0-0.1,0-0.1,0C24.7,15.4,24.7,15.4,24.7,15.3L24.7,15.3z"/>
34
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#A999F6;}
7
+ </style>
8
+ <path class="st0" d="M59.6,40.1c0,2.2-0.9,4.6-1.1,5.2C51.9,61.1,26.3,61,19.3,44.8c-3.8,0-7.8-3.3-8.2-7.4c-0.2-1.4,0-2.8,0.5-4.1
9
+ l-1.8-1.5C1.6,25,27.3-3.6,35.5,3.5c0.1,0,2.8,2.7,2.8,2.7l1.5-0.6c7.2-3,13.1-1.5,13.1,3.2c0,2.5-1.6,5.4-4.1,8
10
+ c3.2,3,2.4,8.7,2.6,10.1c0.9,0.2,3.7,0.9,5,2.3c2.2,2.3,0.7,4.8,0.4,5.3c0.5,1.4,0.4,1.1,0.8,2.5C58.4,37,59.6,37.9,59.6,40.1z"/>
11
+ <path d="M44.1,25.8c0.4,0,0.8,0,1.1,0c0.2-0.5,0.2-1.3,0.1-2.1c-0.3-1.3-0.6-2.1-1.4-2c-0.8,0.1-0.8,1.1-0.5,2.4
12
+ C43.5,24.8,43.8,25.4,44.1,25.8L44.1,25.8z M37.6,26.8c0.5,0.2,0.9,0.4,1,0.3c0.2-0.2-0.4-1.1-1.5-1.6c-1.2-0.5-2.6-0.3-3.7,0.4
13
+ c-0.4,0.3-0.7,0.6-0.7,0.9c0.1,0.5,1.2-0.3,2.8-0.4C36.3,26.3,37,26.6,37.6,26.8L37.6,26.8z M36.5,27.5c-1.1,0.2-1.8,0.8-1.6,1.2
14
+ c0.1,0,0.1,0.1,0.6-0.1c0.7-0.3,1.5-0.4,2.3-0.2c0.4,0,0.5,0.1,0.6-0.1C38.5,28,37.6,27.3,36.5,27.5L36.5,27.5z M43.1,29.5
15
+ c0.4-0.8-1.3-1.7-1.7-0.9C40.9,29.5,42.6,30.4,43.1,29.5L43.1,29.5z M45,27c-0.9,0-1,1.9,0,1.9C45.9,29,45.9,27.1,45,27L45,27z
16
+ M18.3,36.7c-0.2,0-0.7,0.2-1-0.3c-0.6-1,1.4-2.5,0.4-4.4c-1.1-2.1-3.4-1.6-4.3-0.7c-1.1,1.2-1.1,2.9-0.6,2.9
17
+ c0.5,0.1,0.5-0.8,0.9-1.4c0.5-0.7,1.4-0.9,2.2-0.5c0,0,0,0,0,0c1.4,0.9,0.2,2.2,0.3,3.5c0.2,2,2.2,2,2.6,1.1c0.1-0.1,0-0.2,0-0.3
18
+ C18.7,36.8,18.8,36.5,18.3,36.7L18.3,36.7z M54.8,34.6c-0.4-1.4-0.3-1.1-0.8-2.5c0.3-0.4,1.9-2.9-0.4-5.3c-1.3-1.3-4.1-2-5-2.3
19
+ c-0.2-1.4,0.6-7.1-2.6-10.1c2.5-2.6,4.1-5.5,4.1-8c0-4.8-5.9-6.2-13.1-3.2l-1.5,0.6c0,0-2.8-2.7-2.8-2.7C24.5-6-1.2,22.6,7,29.5
20
+ L8.8,31c-0.5,1.3-0.7,2.7-0.5,4.1c0.4,4.1,4.4,7.4,8.2,7.3c7,16.2,32.6,16.2,39.2,0.4c0.2-0.5,1.1-3,1.1-5.2
21
+ C56.8,35.5,55.6,34.6,54.8,34.6L54.8,34.6z M16.3,40.4c-2.8-0.1-5.8-2.6-6.1-5.5c-0.8-7.5,9-9.2,10.2-1.5C21,37,19.9,40.5,16.3,40.4
22
+ L16.3,40.4z M14.1,26.5c-1.8,0.4-3.5,1.4-4.5,2.9c-0.6-0.5-1.7-1.5-1.9-1.8c-1.6-3,1.7-8.9,4.1-12.2C17.5,7.2,26.5,1,30.7,2.1
23
+ c0.7,0.2,2.9,2.8,2.9,2.8s-4.2,2.3-8,5.5C20.4,14.4,16.4,20.2,14.1,26.5L14.1,26.5z M43.2,38.8c0,0-4.3,0.6-8.5-0.9
24
+ c0.8-2.5,3.3,0.7,11.7-1.7c1.9-0.5,4.3-1.6,6.2-3.1c0.4,0.9,0.7,1.9,0.9,3c0.4-0.1,1.7-0.1,1.4,2.2c-0.4,2.4-1.4,4.4-3.2,6.2
25
+ c-1.1,1.2-2.4,2.1-3.8,2.8c-0.8,0.4-1.6,0.8-2.5,1c-6.5,2.1-13.2-0.2-15.3-5.2c-0.2-0.4-0.3-0.8-0.4-1.2c-0.9-3.3-0.1-7.3,2.3-9.8
26
+ c0.1-0.2,0.3-0.3,0.3-0.6c0-0.2-0.1-0.4-0.2-0.6c-0.9-1.2-3.8-3.3-3.2-7.4c0.4-2.9,3-5,5.4-4.9l0.6,0c1,0.1,1.9,0.2,2.8,0.2
27
+ c1.4,0.1,2.7-0.1,4.2-1.4c0.5-0.4,0.9-0.8,1.6-0.9c0.6-0.1,1.2,0,1.7,0.3c1.2,0.8,1.4,2.8,1.5,4.2c0,0.8,0.1,2.8,0.2,3.4
28
+ c0.1,1.3,0.4,1.5,1.1,1.7c0.4,0.1,0.7,0.2,1.3,0.4c1.6,0.5,2.6,0.9,3.2,1.5c0.3,0.3,0.5,0.7,0.6,1.1c0.2,1.4-1.1,3.1-4.4,4.6
29
+ c-5.7,2.6-11.4,1.8-12.2,1.7c-2.5-0.3-3.8,2.8-2.4,5c2.8,4.1,14.9,2.4,18.4-2.6c0.1-0.1,0-0.2-0.1-0.1c-5.1,3.5-11.8,4.7-15.6,3.2
30
+ c-0.6-0.2-1.8-0.8-1.9-2c5.3,1.6,8.6,0.1,8.6,0.1S43.5,38.8,43.2,38.8L43.2,38.8z M24.7,15.3c2-2.4,4.5-4.4,6.8-5.6c0,0,0.1,0,0.1,0
31
+ c0,0,0,0.1,0,0.1c-0.2,0.3-0.5,1-0.6,1.5c0,0,0,0.1,0.1,0.1c0,0,0.1,0,0.1,0c1.4-1,3.8-2,6-2.1c0.1,0,0.1,0,0.1,0.1c0,0,0,0.1,0,0.1
32
+ c-0.4,0.3-0.7,0.6-0.9,0.9c0,0,0,0.1,0,0.1c0,0,0,0,0.1,0c1.5,0,3.6,0.5,5,1.3c0.1,0.1,0,0.2-0.1,0.2c-8.5-1.9-15,2.3-16.4,3.3
33
+ c0,0-0.1,0-0.1,0C24.7,15.4,24.7,15.4,24.7,15.3L24.7,15.3z"/>
34
+ </svg>
admin/img/features/rolemanagement.svg CHANGED
@@ -1,17 +1,17 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#A999F6;}
7
- </style>
8
- <path class="st0" d="M59.2,30.4c0,6.7-2.6,13.1-7.4,17.9c-4.8,4.8-11.1,7.4-17.9,7.4c-6.7,0-13.1-2.6-17.9-7.4
9
- c-4.8-4.8-7.4-11.1-7.4-17.9c0-6.7,2.6-13.1,7.4-17.9C20.9,7.8,27.2,5.2,34,5.2c6.7,0,13.1,2.6,17.9,7.4
10
- C56.6,17.4,59.2,23.7,59.2,30.4z"/>
11
- <path d="M49.7,8.7c-5-5-11.7-7.8-18.8-7.8c-7.1,0-13.8,2.8-18.8,7.8S4.2,20.4,4.2,27.5c0,7.1,2.8,13.8,7.8,18.8s11.7,7.8,18.8,7.8
12
- c7.1,0,13.8-2.8,18.8-7.8s7.8-11.7,7.8-18.8C57.5,20.4,54.7,13.7,49.7,8.7z M17.6,46.9c1.1-6.4,6.7-11.1,13.3-11.1
13
- c6.6,0,12.2,4.7,13.3,11.1c-3.8,2.6-8.4,4.1-13.3,4.1S21.4,49.5,17.6,46.9z M22.4,24.1c0-4.7,3.8-8.5,8.5-8.5s8.5,3.8,8.5,8.5
14
- s-3.8,8.5-8.5,8.5S22.4,28.8,22.4,24.1z M46.8,44.7c-0.8-3-2.5-5.7-4.8-7.8c-1.4-1.3-3.1-2.3-4.8-3c3.2-2.1,5.3-5.6,5.3-9.7
15
- c0-6.4-5.2-11.6-11.6-11.6s-11.6,5.2-11.6,11.6c0,4.1,2.1,7.6,5.3,9.7c-1.8,0.7-3.4,1.7-4.8,3c-2.3,2.1-4,4.8-4.8,7.8
16
- c-4.6-4.3-7.5-10.4-7.5-17.2C7.4,14.5,17.9,4,30.9,4s23.5,10.5,23.5,23.5C54.4,34.3,51.5,40.4,46.8,44.7z"/>
17
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 65 57" style="enable-background:new 0 0 65 57;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#A999F6;}
7
+ </style>
8
+ <path class="st0" d="M59.2,30.4c0,6.7-2.6,13.1-7.4,17.9c-4.8,4.8-11.1,7.4-17.9,7.4c-6.7,0-13.1-2.6-17.9-7.4
9
+ c-4.8-4.8-7.4-11.1-7.4-17.9c0-6.7,2.6-13.1,7.4-17.9C20.9,7.8,27.2,5.2,34,5.2c6.7,0,13.1,2.6,17.9,7.4
10
+ C56.6,17.4,59.2,23.7,59.2,30.4z"/>
11
+ <path d="M49.7,8.7c-5-5-11.7-7.8-18.8-7.8c-7.1,0-13.8,2.8-18.8,7.8S4.2,20.4,4.2,27.5c0,7.1,2.8,13.8,7.8,18.8s11.7,7.8,18.8,7.8
12
+ c7.1,0,13.8-2.8,18.8-7.8s7.8-11.7,7.8-18.8C57.5,20.4,54.7,13.7,49.7,8.7z M17.6,46.9c1.1-6.4,6.7-11.1,13.3-11.1
13
+ c6.6,0,12.2,4.7,13.3,11.1c-3.8,2.6-8.4,4.1-13.3,4.1S21.4,49.5,17.6,46.9z M22.4,24.1c0-4.7,3.8-8.5,8.5-8.5s8.5,3.8,8.5,8.5
14
+ s-3.8,8.5-8.5,8.5S22.4,28.8,22.4,24.1z M46.8,44.7c-0.8-3-2.5-5.7-4.8-7.8c-1.4-1.3-3.1-2.3-4.8-3c3.2-2.1,5.3-5.6,5.3-9.7
15
+ c0-6.4-5.2-11.6-11.6-11.6s-11.6,5.2-11.6,11.6c0,4.1,2.1,7.6,5.3,9.7c-1.8,0.7-3.4,1.7-4.8,3c-2.3,2.1-4,4.8-4.8,7.8
16
+ c-4.6-4.3-7.5-10.4-7.5-17.2C7.4,14.5,17.9,4,30.9,4s23.5,10.5,23.5,23.5C54.4,34.3,51.5,40.4,46.8,44.7z"/>
17
+ </svg>
admin/img/logo-long.svg CHANGED
@@ -1,91 +1,91 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="-59 183.8 7819.5 475.1" style="enable-background:new -59 183.8 7819.5 475.1;" xml:space="preserve">
5
- <g>
6
- <g>
7
- <path d="M105.4,403.1h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1c0-20.2,7.1-37.4,21.4-51.7
8
- c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5c0-4.9-1.8-9.2-5.4-12.8
9
- c-3.6-3.6-7.9-5.4-12.8-5.4H87.2c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3c-13.1,13.1-23.6,28.7-31.3,46.7
10
- c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6c15.2,0,28.2-5.3,38.8-16
11
- c10.7-10.7,16-23.6,16-38.8V457.9c0-15.2-5.3-28.2-16-38.8C133.6,408.4,120.7,403.1,105.4,403.1z"/>
12
- <path d="M400.1,419.1c-10.7-10.7-23.6-16-38.8-16h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1
13
- c0-20.2,7.1-37.4,21.4-51.7c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5
14
- c0-4.9-1.8-9.2-5.4-12.8c-3.6-3.6-7.9-5.4-12.8-5.4H343c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3
15
- c-13.1,13.1-23.6,28.7-31.3,46.7c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6
16
- c15.2,0,28.2-5.3,38.8-16c10.7-10.7,16-23.6,16-38.8V457.9C416.1,442.7,410.8,429.7,400.1,419.1z"/>
17
- </g>
18
- </g>
19
- <g>
20
- <path d="M852.4,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
21
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
22
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
23
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
24
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
25
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
26
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
27
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
28
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
29
- C891.6,617.3,872.9,620,852.4,620z"/>
30
- <path d="M1151,313.2h-115v-76.7h313.2v76.7h-115v301.3H1151V313.2z"/>
31
- <path d="M1412.9,236.6h172.8c47.9,0,84.6,12.8,110.2,38.3c21.6,21.6,32.4,50.4,32.4,86.4v1.1c0,30.6-7.5,55.5-22.4,74.8
32
- c-14.9,19.3-34.5,33.4-58.6,42.4l92.3,135h-97.2l-81-121h-1.1H1496v121h-83.2V236.6z M1580.3,420.2c20.5,0,36.3-4.9,47.3-14.6
33
- c11-9.7,16.5-22.7,16.5-38.9v-1.1c0-18-5.8-31.5-17.3-40.5c-11.5-9-27.5-13.5-48.1-13.5H1496v108.5H1580.3z"/>
34
- <path d="M1986.9,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
35
- c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
36
- c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
37
- c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
38
- C2043,615.9,2016.1,621,1986.9,621z M1988,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4c9.9-10.8,17.6-23.3,23.2-37.5
39
- c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8c-10.3-10.8-22.4-19.3-36.4-25.6
40
- c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4c-9.9,10.8-17.6,23.3-23.2,37.5
41
- c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8c10.3,10.8,22.3,19.4,36.2,25.6
42
- C1955.7,541.2,1971.1,544.4,1988,544.4z"/>
43
- <path d="M2262.3,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
44
- <path d="M2870.9,621c-29.5,0-56.4-4.9-80.7-14.6c-24.3-9.7-45.2-23.2-62.6-40.5c-17.5-17.3-31-37.8-40.8-61.6s-14.6-49.7-14.6-77.8
45
- v-1.1c0-27,4.9-52.3,14.8-75.9c9.9-23.6,23.7-44.3,41.3-62.1c17.6-17.8,38.5-31.9,62.6-42.1c24.1-10.3,50.6-15.4,79.4-15.4
46
- c16.9,0,32.3,1.2,46.2,3.5c13.9,2.3,26.7,5.7,38.6,10s23,9.7,33.5,16.2c10.4,6.5,20.5,13.9,30.2,22.1l-52.4,63.2
47
- c-7.2-6.1-14.4-11.5-21.6-16.2c-7.2-4.7-14.7-8.6-22.4-11.9c-7.7-3.2-16.1-5.8-25.1-7.6c-9-1.8-18.9-2.7-29.7-2.7
48
- c-15.1,0-29.3,3.2-42.4,9.5c-13.1,6.3-24.7,14.8-34.6,25.4c-9.9,10.6-17.6,23.1-23.2,37.3c-5.6,14.3-8.4,29.5-8.4,45.7v1.1
49
- c0,17.3,2.8,33.3,8.4,47.9c5.6,14.6,13.5,27.3,23.8,38.2c10.3,10.8,22.3,19.2,36.2,25.2c13.9,6,29.2,8.9,46.2,8.9
50
- c31,0,57.1-7.6,78.3-22.8v-54.4h-83.7v-71.8h164.2v164.2c-19.4,16.6-42.6,30.7-69.4,42.4C2936.1,615.2,2905.4,621,2870.9,621z"/>
51
- <path d="M3524.3,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
52
- <path d="M3786.2,236.6h284.6v74h-202.5v76.7h178.2v74h-178.2v79.4h205.2v74h-287.3V236.6z"/>
53
- <path d="M4283,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
54
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
55
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
56
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
57
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
58
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
59
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
60
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
61
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
62
- C4322.2,617.3,4303.5,620,4283,620z"/>
63
- <path d="M4581.6,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
64
- <path d="M4847.3,236.6h83.2v378h-83.2V236.6z"/>
65
- <path d="M5024.9,236.6h89.6l99.4,159.8l99.4-159.8h89.6v378h-82.1V367.8l-106.4,161.5h-2.2L5107,369.4v245.2h-82.1V236.6z"/>
66
- <path d="M5677.2,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
67
- c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
68
- c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
69
- c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
70
- C5733.3,615.9,5706.4,621,5677.2,621z M5678.3,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4
71
- c9.9-10.8,17.6-23.3,23.2-37.5c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8
72
- c-10.3-10.8-22.4-19.3-36.4-25.6c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4
73
- c-9.9,10.8-17.6,23.3-23.2,37.5c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8
74
- c10.3,10.8,22.3,19.4,36.2,25.6C5646,541.2,5661.4,544.4,5678.3,544.4z"/>
75
- <path d="M5952.6,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
76
- <path d="M6383,236.6h83.2v378H6383V236.6z"/>
77
- <path d="M6690.3,233.9h76.7l162,380.7H6842l-34.6-84.8h-159.8l-34.6,84.8h-84.8L6690.3,233.9z M6777.7,456.3l-50.2-122.6
78
- l-50.2,122.6H6777.7z"/>
79
- <path d="M6987.3,236.6h83.2v302.9h188.5v75.1h-271.6V236.6z"/>
80
- <path d="M7456.5,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
81
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
82
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
83
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
84
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
85
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
86
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
87
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
88
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
89
- C7495.7,617.3,7477,620,7456.5,620z"/>
90
- </g>
91
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="-59 183.8 7819.5 475.1" style="enable-background:new -59 183.8 7819.5 475.1;" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <path d="M105.4,403.1h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1c0-20.2,7.1-37.4,21.4-51.7
8
+ c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5c0-4.9-1.8-9.2-5.4-12.8
9
+ c-3.6-3.6-7.9-5.4-12.8-5.4H87.2c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3c-13.1,13.1-23.6,28.7-31.3,46.7
10
+ c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6c15.2,0,28.2-5.3,38.8-16
11
+ c10.7-10.7,16-23.6,16-38.8V457.9c0-15.2-5.3-28.2-16-38.8C133.6,408.4,120.7,403.1,105.4,403.1z"/>
12
+ <path d="M400.1,419.1c-10.7-10.7-23.6-16-38.8-16h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1
13
+ c0-20.2,7.1-37.4,21.4-51.7c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5
14
+ c0-4.9-1.8-9.2-5.4-12.8c-3.6-3.6-7.9-5.4-12.8-5.4H343c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3
15
+ c-13.1,13.1-23.6,28.7-31.3,46.7c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6
16
+ c15.2,0,28.2-5.3,38.8-16c10.7-10.7,16-23.6,16-38.8V457.9C416.1,442.7,410.8,429.7,400.1,419.1z"/>
17
+ </g>
18
+ </g>
19
+ <g>
20
+ <path d="M852.4,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
21
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
22
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
23
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
24
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
25
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
26
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
27
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
28
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
29
+ C891.6,617.3,872.9,620,852.4,620z"/>
30
+ <path d="M1151,313.2h-115v-76.7h313.2v76.7h-115v301.3H1151V313.2z"/>
31
+ <path d="M1412.9,236.6h172.8c47.9,0,84.6,12.8,110.2,38.3c21.6,21.6,32.4,50.4,32.4,86.4v1.1c0,30.6-7.5,55.5-22.4,74.8
32
+ c-14.9,19.3-34.5,33.4-58.6,42.4l92.3,135h-97.2l-81-121h-1.1H1496v121h-83.2V236.6z M1580.3,420.2c20.5,0,36.3-4.9,47.3-14.6
33
+ c11-9.7,16.5-22.7,16.5-38.9v-1.1c0-18-5.8-31.5-17.3-40.5c-11.5-9-27.5-13.5-48.1-13.5H1496v108.5H1580.3z"/>
34
+ <path d="M1986.9,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
35
+ c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
36
+ c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
37
+ c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
38
+ C2043,615.9,2016.1,621,1986.9,621z M1988,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4c9.9-10.8,17.6-23.3,23.2-37.5
39
+ c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8c-10.3-10.8-22.4-19.3-36.4-25.6
40
+ c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4c-9.9,10.8-17.6,23.3-23.2,37.5
41
+ c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8c10.3,10.8,22.3,19.4,36.2,25.6
42
+ C1955.7,541.2,1971.1,544.4,1988,544.4z"/>
43
+ <path d="M2262.3,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
44
+ <path d="M2870.9,621c-29.5,0-56.4-4.9-80.7-14.6c-24.3-9.7-45.2-23.2-62.6-40.5c-17.5-17.3-31-37.8-40.8-61.6s-14.6-49.7-14.6-77.8
45
+ v-1.1c0-27,4.9-52.3,14.8-75.9c9.9-23.6,23.7-44.3,41.3-62.1c17.6-17.8,38.5-31.9,62.6-42.1c24.1-10.3,50.6-15.4,79.4-15.4
46
+ c16.9,0,32.3,1.2,46.2,3.5c13.9,2.3,26.7,5.7,38.6,10s23,9.7,33.5,16.2c10.4,6.5,20.5,13.9,30.2,22.1l-52.4,63.2
47
+ c-7.2-6.1-14.4-11.5-21.6-16.2c-7.2-4.7-14.7-8.6-22.4-11.9c-7.7-3.2-16.1-5.8-25.1-7.6c-9-1.8-18.9-2.7-29.7-2.7
48
+ c-15.1,0-29.3,3.2-42.4,9.5c-13.1,6.3-24.7,14.8-34.6,25.4c-9.9,10.6-17.6,23.1-23.2,37.3c-5.6,14.3-8.4,29.5-8.4,45.7v1.1
49
+ c0,17.3,2.8,33.3,8.4,47.9c5.6,14.6,13.5,27.3,23.8,38.2c10.3,10.8,22.3,19.2,36.2,25.2c13.9,6,29.2,8.9,46.2,8.9
50
+ c31,0,57.1-7.6,78.3-22.8v-54.4h-83.7v-71.8h164.2v164.2c-19.4,16.6-42.6,30.7-69.4,42.4C2936.1,615.2,2905.4,621,2870.9,621z"/>
51
+ <path d="M3524.3,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
52
+ <path d="M3786.2,236.6h284.6v74h-202.5v76.7h178.2v74h-178.2v79.4h205.2v74h-287.3V236.6z"/>
53
+ <path d="M4283,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
54
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
55
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
56
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
57
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
58
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
59
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
60
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
61
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
62
+ C4322.2,617.3,4303.5,620,4283,620z"/>
63
+ <path d="M4581.6,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
64
+ <path d="M4847.3,236.6h83.2v378h-83.2V236.6z"/>
65
+ <path d="M5024.9,236.6h89.6l99.4,159.8l99.4-159.8h89.6v378h-82.1V367.8l-106.4,161.5h-2.2L5107,369.4v245.2h-82.1V236.6z"/>
66
+ <path d="M5677.2,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
67
+ c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
68
+ c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
69
+ c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
70
+ C5733.3,615.9,5706.4,621,5677.2,621z M5678.3,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4
71
+ c9.9-10.8,17.6-23.3,23.2-37.5c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8
72
+ c-10.3-10.8-22.4-19.3-36.4-25.6c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4
73
+ c-9.9,10.8-17.6,23.3-23.2,37.5c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8
74
+ c10.3,10.8,22.3,19.4,36.2,25.6C5646,541.2,5661.4,544.4,5678.3,544.4z"/>
75
+ <path d="M5952.6,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
76
+ <path d="M6383,236.6h83.2v378H6383V236.6z"/>
77
+ <path d="M6690.3,233.9h76.7l162,380.7H6842l-34.6-84.8h-159.8l-34.6,84.8h-84.8L6690.3,233.9z M6777.7,456.3l-50.2-122.6
78
+ l-50.2,122.6H6777.7z"/>
79
+ <path d="M6987.3,236.6h83.2v302.9h188.5v75.1h-271.6V236.6z"/>
80
+ <path d="M7456.5,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
81
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
82
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
83
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
84
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
85
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
86
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
87
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
88
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
89
+ C7495.7,617.3,7477,620,7456.5,620z"/>
90
+ </g>
91
+ </svg>
admin/js/addon-licenses.js CHANGED
@@ -1,163 +1,163 @@
1
- /**
2
- * Add-on License Activation
3
- */
4
- (function ($) {
5
-
6
- $.fn.showInlineBlock = function () {
7
- return this.css('display', 'inline-block');
8
- };
9
-
10
- $("td.status").on("click", function () {
11
- $(this).children(".ajax-done").hide();
12
- $(this).children(".indicator").addClass("doing-ajax");
13
- });
14
-
15
- /**
16
- * Activate license
17
- */
18
- $(".activator").on("click", function () {
19
-
20
- var parent = $(this).closest("td");
21
- var status = parent.parent().find("input[name$='[license][status]']");
22
- parent.find(".response").html("").removeClass("activation-error");
23
-
24
- $.get(ajaxurl, {
25
- 'action': 'wpmtst_activate_license',
26
- 'plugin': parent.data("addon"),
27
- 'security': strongAddonAdmin.ajax_nonce
28
- },
29
- function (response) {
30
- parent.find(".indicator").removeClass("doing-ajax");
31
- if (0 == response) {
32
- response = {failure: true, data: strongAddonAdmin.errorMessage};
33
- }
34
- if (response.success) {
35
- parent.find(".addon-inactive").hide();
36
- parent.find(".addon-active").showInlineBlock();
37
- status.val(response.data);
38
- } else {
39
- parent.find(".addon-active").hide();
40
- parent.find(".addon-inactive").showInlineBlock();
41
- parent.find(".response").html(response.data).addClass("activation-error");
42
- status.val('');
43
- }
44
- });
45
-
46
- });
47
-
48
-
49
- /**
50
- * Deactivate license
51
- */
52
- $(".deactivator").on("click", function () {
53
-
54
- var parent = $(this).closest("td");
55
- parent.find(".response").html("").removeClass("activation-error");
56
-
57
- $.get(ajaxurl, {
58
- 'action': 'wpmtst_deactivate_license',
59
- 'plugin': parent.data("addon"),
60
- 'security': strongAddonAdmin.ajax_nonce
61
- },
62
- function (response) {
63
- parent.find(".indicator").removeClass("doing-ajax");
64
- if (0 == response) {
65
- response = {failure: true, data: strongAddonAdmin.errorMessage};
66
- }
67
- if (response.success) {
68
- parent.find(".addon-active").hide();
69
- parent.find(".addon-inactive").showInlineBlock();
70
- } else {
71
- parent.find(".addon-inactive").hide();
72
- parent.find(".addon-active").showInlineBlock();
73
- parent.find(".response").html(response.data).addClass("activation-error");
74
- }
75
- });
76
-
77
- });
78
-
79
- /**
80
- * Prevent copy/inspect license key
81
- */
82
-
83
- $(document).on('contextmenu dragstart', function () {
84
- return false;
85
- });
86
-
87
- /**
88
- * Monitor which keys are being pressed
89
- */
90
- var st_protection_keys = {
91
- 'alt': false,
92
- 'shift': false,
93
- 'meta': false,
94
- };
95
-
96
- $(document).on('keydown', function (e) {
97
-
98
- // Alt Key Pressed
99
- if (e.altKey) {
100
- st_protection_keys.alt = true;
101
- }
102
-
103
- // Shift Key Pressed
104
- if (e.shiftKey) {
105
- st_protection_keys.shift = true;
106
- }
107
-
108
- // Meta Key Pressed (e.g. Mac Cmd)
109
- if (e.metaKey) {
110
- st_protection_keys.meta = true;
111
- }
112
-
113
- if (e.ctrlKey && '85' == e.keyCode) {
114
- st_protection_keys.ctrl = true;
115
- }
116
-
117
-
118
- });
119
- $(document).on('keyup', function (e) {
120
-
121
- // Alt Key Released
122
- if (!e.altKey) {
123
- st_protection_keys.alt = false;
124
- }
125
-
126
- // Shift Key Released
127
- if (e.shiftKey) {
128
- st_protection_keys.shift = false;
129
- }
130
-
131
- // Meta Key Released (e.g. Mac Cmd)
132
- if (!e.metaKey) {
133
- st_protection_keys.meta = false;
134
- }
135
-
136
- if (!e.ctrlKey) {
137
- st_protection_keys.ctrl = false;
138
- }
139
-
140
- });
141
-
142
- /**
143
- * Prevent automatic download when Alt + left click
144
- */
145
- jQuery(document).on('click', '#strong_testimonials_license_key', function (e) {
146
- if (st_protection_keys.alt || st_protection_keys.shift || st_protection_keys.meta || st_protection_keys.ctrl) {
147
- // User is trying to download - stop!
148
- e.preventDefault();
149
- return false;
150
- }
151
- });
152
-
153
- jQuery(document).on('keydown click',function(e){
154
- if (st_protection_keys.ctrl) {
155
- // User is trying to view source
156
- e.preventDefault();
157
- return false;
158
- }
159
- });
160
-
161
- })(jQuery);
162
-
163
-
1
+ /**
2
+ * Add-on License Activation
3
+ */
4
+ (function ($) {
5
+
6
+ $.fn.showInlineBlock = function () {
7
+ return this.css('display', 'inline-block');
8
+ };
9
+
10
+ $("td.status").on("click", function () {
11
+ $(this).children(".ajax-done").hide();
12
+ $(this).children(".indicator").addClass("doing-ajax");
13
+ });
14
+
15
+ /**
16
+ * Activate license
17
+ */
18
+ $(".activator").on("click", function () {
19
+
20
+ var parent = $(this).closest("td");
21
+ var status = parent.parent().find("input[name$='[license][status]']");
22
+ parent.find(".response").html("").removeClass("activation-error");
23
+
24
+ $.get(ajaxurl, {
25
+ 'action': 'wpmtst_activate_license',
26
+ 'plugin': parent.data("addon"),
27
+ 'security': strongAddonAdmin.ajax_nonce
28
+ },
29
+ function (response) {
30
+ parent.find(".indicator").removeClass("doing-ajax");
31
+ if (0 == response) {
32
+ response = {failure: true, data: strongAddonAdmin.errorMessage};
33
+ }
34
+ if (response.success) {
35
+ parent.find(".addon-inactive").hide();
36
+ parent.find(".addon-active").showInlineBlock();
37
+ status.val(response.data);
38
+ } else {
39
+ parent.find(".addon-active").hide();
40
+ parent.find(".addon-inactive").showInlineBlock();
41
+ parent.find(".response").html(response.data).addClass("activation-error");
42
+ status.val('');
43
+ }
44
+ });
45
+
46
+ });
47
+
48
+
49
+ /**
50
+ * Deactivate license
51
+ */
52
+ $(".deactivator").on("click", function () {
53
+
54
+ var parent = $(this).closest("td");
55
+ parent.find(".response").html("").removeClass("activation-error");
56
+
57
+ $.get(ajaxurl, {
58
+ 'action': 'wpmtst_deactivate_license',
59
+ 'plugin': parent.data("addon"),
60
+ 'security': strongAddonAdmin.ajax_nonce
61
+ },
62
+ function (response) {
63
+ parent.find(".indicator").removeClass("doing-ajax");
64
+ if (0 == response) {
65
+ response = {failure: true, data: strongAddonAdmin.errorMessage};
66
+ }
67
+ if (response.success) {
68
+ parent.find(".addon-active").hide();
69
+ parent.find(".addon-inactive").showInlineBlock();
70
+ } else {
71
+ parent.find(".addon-inactive").hide();
72
+ parent.find(".addon-active").showInlineBlock();
73
+ parent.find(".response").html(response.data).addClass("activation-error");
74
+ }
75
+ });
76
+
77
+ });
78
+
79
+ /**
80
+ * Prevent copy/inspect license key
81
+ */
82
+
83
+ $(document).on('contextmenu dragstart', function () {
84
+ return false;
85
+ });
86
+
87
+ /**
88
+ * Monitor which keys are being pressed
89
+ */
90
+ var st_protection_keys = {
91
+ 'alt': false,
92
+ 'shift': false,
93
+ 'meta': false,
94
+ };
95
+
96
+ $(document).on('keydown', function (e) {
97
+
98
+ // Alt Key Pressed
99
+ if (e.altKey) {
100
+ st_protection_keys.alt = true;
101
+ }
102
+
103
+ // Shift Key Pressed
104
+ if (e.shiftKey) {
105
+ st_protection_keys.shift = true;
106
+ }
107
+
108
+ // Meta Key Pressed (e.g. Mac Cmd)
109
+ if (e.metaKey) {
110
+ st_protection_keys.meta = true;
111
+ }
112
+
113
+ if (e.ctrlKey && '85' == e.keyCode) {
114
+ st_protection_keys.ctrl = true;
115
+ }
116
+
117
+
118
+ });
119
+ $(document).on('keyup', function (e) {
120
+
121
+ // Alt Key Released
122
+ if (!e.altKey) {
123
+ st_protection_keys.alt = false;
124
+ }
125
+
126
+ // Shift Key Released
127
+ if (e.shiftKey) {
128
+ st_protection_keys.shift = false;
129
+ }
130
+
131
+ // Meta Key Released (e.g. Mac Cmd)
132
+ if (!e.metaKey) {
133
+ st_protection_keys.meta = false;
134
+ }
135
+
136
+ if (!e.ctrlKey) {
137
+ st_protection_keys.ctrl = false;
138
+ }
139
+
140
+ });
141
+
142
+ /**
143
+ * Prevent automatic download when Alt + left click
144
+ */
145
+ jQuery(document).on('click', '#strong_testimonials_license_key', function (e) {
146
+ if (st_protection_keys.alt || st_protection_keys.shift || st_protection_keys.meta || st_protection_keys.ctrl) {
147
+ // User is trying to download - stop!
148
+ e.preventDefault();
149
+ return false;
150
+ }
151
+ });
152
+
153
+ jQuery(document).on('keydown click',function(e){
154
+ if (st_protection_keys.ctrl) {
155
+ // User is trying to view source
156
+ e.preventDefault();
157
+ return false;
158
+ }
159
+ });
160
+
161
+ })(jQuery);
162
+
163
+
admin/js/admin-compat.js CHANGED
@@ -1,117 +1,117 @@
1
- /**
2
- * Compatibility settings tab
3
- */
4
-
5
- ;(function ($) {
6
-
7
- var currentSettings = {}
8
- var quick = 200
9
-
10
- // Store current setting(s)
11
- function saveCurrentSettings () {
12
- $('[data-radio-group]').each(function (index, el) {
13
- var radioGroup = $(this).data('radioGroup')
14
- currentSettings[radioGroup] = {
15
- value: $(this).find(':checked').val(),
16
- forced: false
17
- }
18
- })
19
- }
20
-
21
- // Update display based on current selections
22
- function updateDisplay () {
23
- // matchMethodSetting()
24
- highlightRadioLabel()
25
- toggle()
26
- }
27
-
28
- // Toggle dependent inputs
29
- function toggle () {
30
- $('[data-group]').each(function (index, el) {
31
- var group = $(this).data('group')
32
- var $sub = $("[data-sub='" + group + "']")
33
- if ($(this).is(':checked')) {
34
- $sub.fadeIn()
35
- } else {
36
- $sub.fadeOut(quick)
37
- }
38
- })
39
- }
40
-
41
- // Update available options --- not currently used
42
- /*
43
- function matchMethodSetting () {
44
- if ($('#prerender-current').is(':checked')) {
45
- saveCurrentSettings()
46
- $('#method-none').prop('checked', true)
47
- $('#method-universal').prop('disabled', true)
48
- $('#method-observer').prop('disabled', true)
49
- $('#method-event').prop('disabled', true)
50
- $('#method-script').prop('disabled', true)
51
- currentSettings['method'].forced = true
52
- } else {
53
- if (currentSettings['method'].forced) {
54
- $('#method-' + currentSettings['method'].value).prop('checked', true)
55
- $('#method-universal').prop('disabled', false)
56
- $('#method-observer').prop('disabled', false)
57
- $('#method-event').prop('disabled', false)
58
- $('#method-script').prop('disabled', false)
59
- currentSettings['method'].forced = false
60
- }
61
- }
62
- }
63
- */
64
-
65
- // UI
66
- function highlightRadioLabel () {
67
- $('input:radio:checked').closest('label').addClass('current')
68
- $('input:radio:not(:checked)').closest('label').removeClass('current')
69
- }
70
-
71
- // Number spinner
72
- function initSpinner () {
73
- $("input[type='number']").each(function () {
74
- $(this).number();
75
- });
76
- }
77
-
78
- // Presets
79
- function setScenario1() {
80
- $('#page-loading-general').trigger('click')
81
- $('#prerender-all').trigger('click').prop('checked', true)
82
- $('#method-universal').trigger('click').prop('checked', true)
83
- }
84
-
85
- function setScenarioDefault() {
86
- $('#prerender-current').trigger('click')
87
- $('#method-none').trigger('click')
88
- }
89
-
90
- // Listen for change
91
- $('.form-table').on('change', function (e) {
92
- updateDisplay()
93
- var currentType = $("input[name='wpmtst_compat_options[page_loading]']:checked").val()
94
- switch (currentType) {
95
- case 'general':
96
- setScenario1()
97
- break;
98
- case 'advanced':
99
- break;
100
- default:
101
- setScenarioDefault()
102
- }
103
- })
104
-
105
- // Listen for presets
106
- $('#set-scenario-1').on('click', function(e) {
107
- $(this).trigger('blur')
108
- setScenario1()
109
- e.preventDefault()
110
- })
111
-
112
- // Start
113
- saveCurrentSettings()
114
- updateDisplay()
115
- initSpinner()
116
-
117
- })(jQuery)
1
+ /**
2
+ * Compatibility settings tab
3
+ */
4
+
5
+ ;(function ($) {
6
+
7
+ var currentSettings = {}
8
+ var quick = 200
9
+
10
+ // Store current setting(s)
11
+ function saveCurrentSettings () {
12
+ $('[data-radio-group]').each(function (index, el) {
13
+ var radioGroup = $(this).data('radioGroup')
14
+ currentSettings[radioGroup] = {
15
+ value: $(this).find(':checked').val(),
16
+ forced: false
17
+ }
18
+ })
19
+ }
20
+
21
+ // Update display based on current selections
22
+ function updateDisplay () {
23
+ // matchMethodSetting()
24
+ highlightRadioLabel()
25
+ toggle()
26
+ }
27
+
28
+ // Toggle dependent inputs
29
+ function toggle () {
30
+ $('[data-group]').each(function (index, el) {
31
+ var group = $(this).data('group')
32
+ var $sub = $("[data-sub='" + group + "']")
33
+ if ($(this).is(':checked')) {
34
+ $sub.fadeIn()
35
+ } else {
36
+ $sub.fadeOut(quick)
37
+ }
38
+ })
39
+ }
40
+
41
+ // Update available options --- not currently used
42
+ /*
43
+ function matchMethodSetting () {
44
+ if ($('#prerender-current').is(':checked')) {
45
+ saveCurrentSettings()
46
+ $('#method-none').prop('checked', true)
47
+ $('#method-universal').prop('disabled', true)
48
+ $('#method-observer').prop('disabled', true)
49
+ $('#method-event').prop('disabled', true)
50
+ $('#method-script').prop('disabled', true)
51
+ currentSettings['method'].forced = true
52
+ } else {
53
+ if (currentSettings['method'].forced) {
54
+ $('#method-' + currentSettings['method'].value).prop('checked', true)
55
+ $('#method-universal').prop('disabled', false)
56
+ $('#method-observer').prop('disabled', false)
57
+ $('#method-event').prop('disabled', false)
58
+ $('#method-script').prop('disabled', false)
59
+ currentSettings['method'].forced = false
60
+ }
61
+ }
62
+ }
63
+ */
64
+
65
+ // UI
66
+ function highlightRadioLabel () {
67
+ $('input:radio:checked').closest('label').addClass('current')
68
+ $('input:radio:not(:checked)').closest('label').removeClass('current')
69
+ }
70
+
71
+ // Number spinner
72
+ function initSpinner () {
73
+ $("input[type='number']").each(function () {
74
+ $(this).number();
75
+ });
76
+ }
77
+
78
+ // Presets
79
+ function setScenario1() {
80
+ $('#page-loading-general').trigger('click')
81
+ $('#prerender-all').trigger('click').prop('checked', true)
82
+ $('#method-universal').trigger('click').prop('checked', true)
83
+ }
84
+
85
+ function setScenarioDefault() {
86
+ $('#prerender-current').trigger('click')
87
+ $('#method-none').trigger('click')
88
+ }
89
+
90
+ // Listen for change
91
+ $('.form-table').on('change', function (e) {
92
+ updateDisplay()
93
+ var currentType = $("input[name='wpmtst_compat_options[page_loading]']:checked").val()
94
+ switch (currentType) {
95
+ case 'general':
96
+ setScenario1()
97
+ break;
98
+ case 'advanced':
99
+ break;
100
+ default:
101
+ setScenarioDefault()
102
+ }
103
+ })
104
+
105
+ // Listen for presets
106
+ $('#set-scenario-1').on('click', function(e) {
107
+ $(this).trigger('blur')
108
+ setScenario1()
109
+ e.preventDefault()
110
+ })
111
+
112
+ // Start
113
+ saveCurrentSettings()
114
+ updateDisplay()
115
+ initSpinner()
116
+
117
+ })(jQuery)
admin/js/admin-fields.js CHANGED
@@ -1,603 +1,603 @@
1
- /**
2
- * Strong Testimonials Custom Fields Editor
3
- *
4
- * @namespace wpmtstAdmin
5
- * @namespace wpmtstAdmin.newField
6
- */
7
-
8
- // Function to get the Max value in Array
9
- Array.max = function (array) {
10
- return Math.max.apply(Math, array);
11
- };
12
-
13
- // Convert "A String" to "a_string"
14
- function sanitizeName(label) {
15
- return label.trim().replace(/\W/g, " ").replace(/\s+/g, "_").toLowerCase();
16
- }
17
-
18
- (function ($) {
19
-
20
- /**
21
- * If open, scroll field into view.
22
- * If closed, scroll all the way up.
23
- *
24
- * @returns {jQuery}
25
- */
26
- $.fn.scrollUp = function () {
27
- var containerOffset;
28
- this.each(function () {
29
- containerOffset = 0;
30
- if ($(this).hasClass("open")) {
31
- containerOffset = parseInt($(this).offset().top) - 72;
32
- }
33
- $("html, body").animate({scrollTop: containerOffset}, 800);
34
- });
35
-
36
- return this;
37
- };
38
-
39
- /**
40
- * Replace the field type selector with its value. Better than readonly.
41
- *
42
- * @returns {jQuery}
43
- */
44
- $.fn.replaceSelect = function () {
45
- this.each(function () {
46
- if ($(this).hasClass("open")) {
47
- $(this).find("select.field-type").each(function (index, el) {
48
- $(el).replaceWith(el.value);
49
- });
50
- }
51
- });
52
-
53
- return this;
54
- }
55
-
56
- /**
57
- * Initialize
58
- */
59
- var catCount = 0;
60
- getCatCount();
61
-
62
- var $theForm = $("#wpmtst-custom-fields-form");
63
- var $fieldList = $("#custom-field-list");
64
-
65
- formPreview();
66
- toggleCategoryFields();
67
-
68
- /**
69
- * Sortable
70
- */
71
- $fieldList.sortable({
72
- placeholder: "sortable-placeholder",
73
- forcePlaceholderSize: true,
74
- handle: ".handle",
75
- cursor: "move",
76
- update: function (event, ui) {
77
- dismissNotice();
78
- formPreview();
79
- }
80
- });
81
-
82
- /**
83
- * ------------------------------------------------------------
84
- * Events
85
- * ------------------------------------------------------------
86
- */
87
-
88
- /**
89
- * Any changes.
90
- */
91
- $theForm.on("change", "input", function () {
92
- dismissNotice();
93
- formPreview();
94
- });
95
-
96
- /**
97
- * Disable buttons on submit.
98
- * Thanks https://stackoverflow.com/a/25651260/51600
99
- */
100
- $theForm.on('submit', function(){
101
- $('#field-group-actions').find('.button').each(function (index) {
102
- // Create a disabled clone of the submit button
103
- $(this).clone(false).removeAttr('id').prop('disabled', true).insertBefore($(this));
104
- // Hide the actual submit button and move it to the beginning of the form
105
- $(this).hide();
106
- });
107
- });
108
-
109
- /**
110
- * Save Changes
111
- */
112
- $('#submit-form').on('click',function(e){
113
-
114
- // Validate field type
115
- $("select.field-type").each(function (index) {
116
- if ('none' === this.value) {
117
- $(this).closest('tr').addClass('form-error');
118
- $(this).parent().find('.form-error-text').show();
119
- var $parent = $(this).closest("li");
120
- if (!$parent.hasClass("open")) {
121
- $parent.find("a.field").trigger('click');
122
- }
123
- $(this).trigger('focus');
124
- e.preventDefault();
125
- } else {
126
- $(this).closest('tr').removeClass('form-error');
127
- $(this).parent().find('.form-error-text').hide();
128
- }
129
- });
130
-
131
- // Validate field name
132
- $("input.field-name").each(function (index) {
133
- if ('name' === $(this).val() || 'date' === $(this).val()) {
134
- $(this).closest('tr').addClass('form-error');
135
- $(this).parent().find('.field-name-help.important').addClass('form-error-text');
136
- var $parent = $(this).closest("li");
137
- if (!$parent.hasClass("open")) {
138
- $parent.find("a.field").trigger('click');
139
- }
140
- $(this).trigger('focus');
141
- e.preventDefault();
142
- } else {
143
- $(this).closest('tr').removeClass('form-error');
144
- $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
145
- }
146
- });
147
-
148
- });
149
-
150
- /**
151
- * Cancel Changes
152
- */
153
- $('#reset').on('click',function(e){
154
- $theForm.trigger('submit');
155
- });
156
-
157
- /**
158
- * Restore Defaults
159
- */
160
- $('#restore-defaults').on('click',function(e){
161
- if (confirm("Restore the default fields?")) {
162
- $theForm.trigger('submit');
163
- } else {
164
- $(this).trigger("blur");
165
- return false;
166
- }
167
- });
168
-
169
- /**
170
- * Prevent single click on handle from opening accordion
171
- */
172
- $fieldList.on("click", "span.handle", function (e) {
173
- e.stopImmediatePropagation();
174
- e.preventDefault();
175
- });
176
-
177
- /**
178
- * Open/close
179
- */
180
- $fieldList.on("click", "span.link", function () {
181
- toggleField($(this).closest("li"));
182
- return false;
183
- });
184
-
185
- /**
186
- * Validate field label
187
- */
188
- $fieldList.on("change blur", "input.field-label", function () {
189
- var newLabel = $(this).val().trim();
190
- // fill in blank label
191
- if ('' === newLabel) {
192
- newLabel = wpmtstAdmin.newField;
193
- }
194
- $(this).val(newLabel);
195
-
196
- var $parent = $(this).closest("li");
197
- var fieldIndex = $parent.index();
198
-
199
- // update parent list item
200
- $parent.find("a.field").html(newLabel);
201
-
202
- // fill in blank field name
203
- var $fieldName = $parent.find("input.field-name");
204
- if ('new_field' === $fieldName.val()) {
205
- $fieldName.val(getUniqueName(newLabel, fieldIndex)).trigger( 'change' );
206
- }
207
- });
208
-
209
- /**
210
- * Validate field name
211
- */
212
- $fieldList.on("change", "input.field-name", function () {
213
- var fieldName = $(this).val();
214
- var $parent = $(this).closest("li");
215
- var fieldIndex = $parent.index();
216
-
217
- if (fieldName) {
218
- $(this).val(getUniqueName(fieldName, fieldIndex));
219
- } else {
220
- var fieldLabel = $(this).closest(".field-table").find(".field-label").val();
221
- $(this).val(getUniqueName(fieldLabel, fieldIndex));
222
- }
223
-
224
- // Check new name, not initial value
225
- if ('name' === $(this).val() || 'date' === $(this).val()) {
226
- $(this).closest('tr').addClass('form-error');
227
- $(this).parent().find('.field-name-help.important').addClass('form-error-text');
228
- $(this).trigger('focus')
229
- return false;
230
- } else {
231
- $(this).closest('tr').removeClass('form-error');
232
- $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
233
- }
234
- });
235
-
236
- /**
237
- * Delete field
238
- */
239
- $fieldList.on("click", ".delete-field", function () {
240
- $(this).trigger("blur");
241
- dismissNotice();
242
- var thisField = $(this).closest("li");
243
- var thisLabel = thisField.find(".field").text();
244
- if (confirm('Delete "' + thisLabel + '"?')) {
245
- thisField.fadeOut(function () {
246
- $.when(thisField.remove()).then(function () {
247
- formPreview();
248
- toggleCategoryFields();
249
- $("#add-field, #submit").prop("disabled", false);
250
- })
251
- });
252
- }
253
- });
254
-
255
- /**
256
- * Close field
257
- */
258
- $fieldList.on("click", "span.close-field a", function () {
259
- toggleField($(this).closest("li"));
260
- return false;
261
- });
262
-
263
- /**
264
- * Add new field
265
- */
266
- $("#add-field").on('click', function () {
267
- dismissNotice();
268
- var keys = $fieldList.find("li").map(function () {
269
- var key_id = $(this).attr("id");
270
- return key_id.substr(key_id.lastIndexOf("-") + 1);
271
- }).get();
272
- var nextKey = Array.max(keys) + 1;
273
-
274
- var data = {
275
- 'action': 'wpmtst_add_field',
276
- 'nextKey': nextKey,
277
- 'fieldClass': null,
278
- 'fieldType': null,
279
- 'security': wpmtstAdmin.ajax_nonce
280
- };
281
- $.get(ajaxurl, data, function (response) {
282
- $("#add-field, #submit").attr("disabled", "disabled");
283
-
284
- // create list item
285
- var $li = $('<li id="field-' + nextKey + '" data-status="new">').append(response);
286
-
287
- // hide elements until Type is selected
288
- $li.find('.field-label-row').hide();
289
- $li.find('.field-name-row').hide();
290
- $li.find("span.close-field").hide();
291
-
292
- // append to list
293
- $.when($fieldList.append($li)).then(function () {
294
- formPreview();
295
- togglePostFields();
296
- toggleCategoryFields();
297
-
298
- // click it to open
299
- $li.find("span.link").trigger('click');
300
- });
301
- });
302
- });
303
-
304
- /**
305
- * Field type change
306
- */
307
- $fieldList.on("change", ".field-type", function (e) {
308
- var fieldType = $(this).val();
309
- var $table = $(this).closest("table");
310
- var $parent = $(this).closest('li');
311
-
312
- if ($parent.data('status') !== 'new') {
313
- $table.find(".field-secondary, .field-admin-table").remove();
314
- }
315
-
316
- if ('none' === fieldType) {
317
- $parent.find('.field-label-row').hide();
318
- $parent.find('.field-name-row').hide();
319
-
320
- // Hide "Close" link
321
- $parent.find("span.close-field").hide();
322
- $("#add-field, #submit").attr("disabled", "disabled");
323
- return;
324
- }
325
- $parent.find('tr').removeClass('form-error');
326
- $parent.find('.form-error-text').hide();
327
-
328
- var key_id = $parent.attr("id");
329
- var key = key_id.substr(key_id.lastIndexOf("-") + 1);
330
-
331
- var $fieldLabel = $parent.find('input.field-label');
332
- var $fieldName = $parent.find('input.field-name');
333
- var fieldIndex = $parent.index();
334
-
335
- // get type of field from its optgroup
336
- var fieldOption = $(this).find("option[value='" + fieldType + "']");
337
- var fieldClass = fieldOption.closest("optgroup").attr("class");
338
-
339
- switch (fieldClass) {
340
-
341
- case 'post':
342
- $parent.find('.field-label-row').show();
343
- $parent.find('.field-name-row').show();
344
-
345
- // Force values if selecting a Post field.
346
- if (fieldType === 'post_title') {
347
- $fieldLabel.val('Testimonial Title');
348
- $fieldName.val('post_title').attr('disabled', 'disabled');
349
- }
350
- else if (fieldType === 'featured_image') {
351
- $fieldLabel.val('Photo');
352
- $fieldName.val('featured_image').attr('disabled', 'disabled');
353
- }
354
- else if (fieldType === 'post_content') {
355
- $fieldLabel.val('Testimonial');
356
- $fieldName.val('post_content').attr('disabled', 'disabled');
357
- }
358
- // move value to hidden input
359
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
360
- // hide help message
361
- $parent.find(".field-name-help").hide();
362
- break;
363
-
364
- case 'optional':
365
- $parent.find('.field-label-row').show();
366
- $parent.find('.field-name-row').show();
367
-
368
- if ('category' === fieldType.split('-')[0]) {
369
- $fieldName.val('category').attr('disabled', 'disabled');
370
- // move value to hidden input
371
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
372
- // hide help message
373
- $parent.find(".field-name-help").hide();
374
- }
375
- var forceName = fieldOption.data('force-name');
376
- if (forceName) {
377
- $fieldName.val(forceName).attr('disabled', 'disabled');
378
- // move value to hidden input
379
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
380
- // hide help message
381
- $parent.find(".field-name-help").hide();
382
- }
383
- $fieldLabel.val(wpmtstAdmin.newField).trigger('focus').trigger('select');
384
- break;
385
-
386
- default:
387
- $parent.find('.field-label-row').show();
388
- $parent.find('.field-name-row').show();
389
-
390
- // TODO DRY
391
- $fieldLabel.val(wpmtstAdmin.newField).trigger('focus').trigger('select');
392
- $fieldName.val(getUniqueName($fieldLabel.val(), fieldIndex));
393
- $fieldName.prop('disabled', false);
394
- $parent.find(".field-name-help").show();
395
- }
396
-
397
- // secondary form fields
398
- var data1 = {
399
- 'action': 'wpmtst_add_field_2',
400
- 'nextKey': key,
401
- 'fieldClass': fieldClass,
402
- 'fieldType': fieldType,
403
- 'security': wpmtstAdmin.ajax_nonce
404
- };
405
-
406
- var ajax1 = $.get(ajaxurl, data1, function (response) {
407
- $table.append(response);
408
- $( document ).trigger( "st-done-loading-secondary-fields", [ $table ] );
409
- });
410
-
411
-
412
- // admin-table field
413
- var data2 = {
414
- 'action': 'wpmtst_add_field_4',
415
- 'nextKey': key,
416
- 'fieldClass': fieldClass,
417
- 'fieldType': fieldType,
418
- 'security': wpmtstAdmin.ajax_nonce
419
- };
420
-
421
- var ajax2 = ajax1.then(function () {
422
- return $.get(ajaxurl, data2, function (response) {
423
- $table.append(response);
424
- });
425
- });
426
-
427
-
428
- // hidden inputs
429
- var data3 = {
430
- 'action': 'wpmtst_add_field_3',
431
- 'nextKey': key,
432
- 'fieldClass': fieldClass,
433
- 'fieldType': fieldType,
434
- 'security': wpmtstAdmin.ajax_nonce
435
- };
436
-
437
- var ajax3 = ajax2.then(function () {
438
- return $.get(ajaxurl, data3, function (response) {
439
- $table.parent().append(response);
440
- });
441
- });
442
-
443
- ajax3.done(function () {
444
-
445
- formPreview();
446
- $("#add-field, #submit").prop("disabled", false);
447
-
448
- // Successfully added so show "Close" link
449
- $("span.close-field").show();
450
-
451
- $parent
452
- // Reset temporary status
453
- .removeData("status").removeAttr("data-status")
454
- // update parent list item
455
- .find(".custom-field-header a.field").html($fieldLabel.val()).end()
456
- // update hidden [record_type] input
457
- .find('input[name$="[record_type]"]').val(fieldClass);
458
-
459
- });
460
-
461
- });
462
-
463
- /**
464
- * ------------------------------------------------------------
465
- * Functions
466
- * ------------------------------------------------------------
467
- */
468
-
469
- function getCatCount() {
470
- $.get(ajaxurl, {
471
- 'action': 'wpmtst_get_cat_count',
472
- 'security': wpmtstAdmin.ajax_nonce
473
- },
474
- function (response) {
475
- catCount = parseInt(response);
476
- });
477
- }
478
-
479
- // Preview
480
- function formPreview() {
481
- var formFields = $theForm.find("[name^='fields']");
482
- if (!formFields.length) return;
483
-
484
- var data = {
485
- 'action': 'wpmtst_get_form_preview',
486
- 'fields': formFields.serialize()
487
- };
488
- $.post(ajaxurl, data, function (response) {
489
- var newDiv = $("<div></div>").hide().html(response)
490
- $("#fields-editor-preview")
491
- .children().first()
492
- .after(newDiv)
493
- .fadeOut(0, function () {
494
- newDiv.show();
495
- $(this).remove();
496
- });
497
- });
498
- }
499
-
500
- /*
501
- * Disable any Post fields already in use.
502
- *
503
- * Doing this client-side so a Post field can be added
504
- * but not saved before adding more fields;
505
- * i.e. add multiple fields of either type without risk
506
- * of duplicating single Post fields before clicking "Save".
507
- */
508
- function togglePostFields() {
509
- $fieldList.find('input[name$="[record_type]"]').each(function () {
510
- var $parent = $(this).closest("li");
511
- var value = $(this).val();
512
- if ("post" === value) {
513
- var name = $parent.find(".field-name").val();
514
- $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
515
- }
516
- });
517
- }
518
-
519
- // Only allow one category field
520
- function toggleCategoryFields() {
521
- var categoryInUse = false;
522
-
523
- $fieldList.find('input[name$="[record_type]"]').each(function () {
524
- var $parent = $(this).closest("li");
525
- var value = $(this).val();
526
- if ('optional' === value) {
527
- var fieldType = $parent.find('input[name$="[input_type]"]').val();
528
- if (!categoryInUse) {
529
- categoryInUse = ( 'category' === fieldType.split('-')[0] );
530
- }
531
- }
532
- });
533
-
534
- var $options = $fieldList.find('option[value^="category"]');
535
- if (categoryInUse) {
536
- $options.each(function () {
537
- var text = $(this).text();
538
- $(this)
539
- .attr("disabled", "disabled")
540
- .text(text + ' ' + wpmtstAdmin.inUse)
541
- .data('origText', text);
542
- });
543
- }
544
- else if (0 === catCount) {
545
- $options.each(function () {
546
- var text = $(this).text();
547
- $(this)
548
- .attr("disabled", "disabled")
549
- .text(text + ' ' + wpmtstAdmin.noneFound)
550
- .data('origText', text);
551
- });
552
- } else {
553
- $options.each(function () {
554
- $(this)
555
- .prop("disabled", false)
556
- .text($(this).data('origText'));
557
- });
558
- }
559
- }
560
-
561
- // Actions on opening/closing the field
562
- function toggleField($field) {
563
- $field.replaceSelect()
564
- .toggleClass("open")
565
- .scrollUp()
566
- .find("span.link")
567
- .toggleClass("open")
568
- .end()
569
- .find(".custom-field")
570
- .toggleClass("open")
571
- .slideToggle()
572
- .find(".first-field")
573
- .trigger('focus');
574
- }
575
-
576
- // Build a unique name
577
- function getUniqueName(fieldName, fieldIndex) {
578
- fieldName = sanitizeName(fieldName);
579
-
580
- // Get names of *other* fields
581
- var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
582
- return this.value;
583
- }).get();
584
-
585
- names = names.filter(function (x) {
586
- return (x !== (undefined || ''));
587
- });
588
-
589
- var uniqueName = fieldName;
590
- var i = 2;
591
-
592
- while ($.inArray(uniqueName, names) >= 1) {
593
- uniqueName = fieldName + '_' + i++;
594
- }
595
- return uniqueName;
596
- }
597
-
598
- // Dismiss the "Fields saved" notice.
599
- function dismissNotice() {
600
- $('.wpmtst.notice').find(".notice-dismiss").trigger('click');
601
- }
602
-
603
- })(jQuery);
1
+ /**
2
+ * Strong Testimonials Custom Fields Editor
3
+ *
4
+ * @namespace wpmtstAdmin
5
+ * @namespace wpmtstAdmin.newField
6
+ */
7
+
8
+ // Function to get the Max value in Array
9
+ Array.max = function (array) {
10
+ return Math.max.apply(Math, array);
11
+ };
12
+
13
+ // Convert "A String" to "a_string"
14
+ function sanitizeName(label) {
15
+ return label.trim().replace(/\W/g, " ").replace(/\s+/g, "_").toLowerCase();
16
+ }
17
+
18
+ (function ($) {
19
+
20
+ /**
21
+ * If open, scroll field into view.
22
+ * If closed, scroll all the way up.
23
+ *
24
+ * @returns {jQuery}
25
+ */
26
+ $.fn.scrollUp = function () {
27
+ var containerOffset;
28
+ this.each(function () {
29
+ containerOffset = 0;
30
+ if ($(this).hasClass("open")) {
31
+ containerOffset = parseInt($(this).offset().top) - 72;
32
+ }
33
+ $("html, body").animate({scrollTop: containerOffset}, 800);
34
+ });
35
+
36
+ return this;
37
+ };
38
+
39
+ /**
40
+ * Replace the field type selector with its value. Better than readonly.
41
+ *
42
+ * @returns {jQuery}
43
+ */
44
+ $.fn.replaceSelect = function () {
45
+ this.each(function () {
46
+ if ($(this).hasClass("open")) {
47
+ $(this).find("select.field-type").each(function (index, el) {
48
+ $(el).replaceWith(el.value);
49
+ });
50
+ }
51
+ });
52
+
53
+ return this;
54
+ }
55
+
56
+ /**
57
+ * Initialize
58
+ */
59
+ var catCount = 0;
60
+ getCatCount();
61
+
62
+ var $theForm = $("#wpmtst-custom-fields-form");
63
+ var $fieldList = $("#custom-field-list");
64
+
65
+ formPreview();
66
+ toggleCategoryFields();
67
+
68
+ /**
69
+ * Sortable
70
+ */
71
+ $fieldList.sortable({
72
+ placeholder: "sortable-placeholder",
73
+ forcePlaceholderSize: true,
74
+ handle: ".handle",
75
+ cursor: "move",
76
+ update: function (event, ui) {
77
+ dismissNotice();
78
+ formPreview();
79
+ }
80
+ });
81
+
82
+ /**
83
+ * ------------------------------------------------------------
84
+ * Events
85
+ * ------------------------------------------------------------
86
+ */
87
+
88
+ /**
89
+ * Any changes.
90
+ */
91
+ $theForm.on("change", "input", function () {
92
+ dismissNotice();
93
+ formPreview();
94
+ });
95
+
96
+ /**
97
+ * Disable buttons on submit.
98
+ * Thanks https://stackoverflow.com/a/25651260/51600
99
+ */
100
+ $theForm.on('submit', function(){
101
+ $('#field-group-actions').find('.button').each(function (index) {
102
+ // Create a disabled clone of the submit button
103
+ $(this).clone(false).removeAttr('id').prop('disabled', true).insertBefore($(this));
104
+ // Hide the actual submit button and move it to the beginning of the form
105
+ $(this).hide();
106
+ });
107
+ });
108
+
109
+ /**
110
+ * Save Changes
111
+ */
112
+ $('#submit-form').on('click',function(e){
113
+
114
+ // Validate field type
115
+ $("select.field-type").each(function (index) {
116
+ if ('none' === this.value) {
117
+ $(this).closest('tr').addClass('form-error');
118
+ $(this).parent().find('.form-error-text').show();
119
+ var $parent = $(this).closest("li");
120
+ if (!$parent.hasClass("open")) {
121
+ $parent.find("a.field").trigger('click');
122
+ }
123
+ $(this).trigger('focus');
124
+ e.preventDefault();
125
+ } else {
126
+ $(this).closest('tr').removeClass('form-error');
127
+ $(this).parent().find('.form-error-text').hide();
128
+ }
129
+ });
130
+
131
+ // Validate field name
132
+ $("input.field-name").each(function (index) {
133
+ if ('name' === $(this).val() || 'date' === $(this).val()) {
134
+ $(this).closest('tr').addClass('form-error');
135
+ $(this).parent().find('.field-name-help.important').addClass('form-error-text');
136
+ var $parent = $(this).closest("li");
137
+ if (!$parent.hasClass("open")) {
138
+ $parent.find("a.field").trigger('click');
139
+ }
140
+ $(this).trigger('focus');
141
+ e.preventDefault();
142
+ } else {
143
+ $(this).closest('tr').removeClass('form-error');
144
+ $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
145
+ }
146
+ });
147
+
148
+ });
149
+
150
+ /**
151
+ * Cancel Changes
152
+ */
153
+ $('#reset').on('click',function(e){
154
+ $theForm.trigger('submit');
155
+ });
156
+
157
+ /**
158
+ * Restore Defaults
159
+ */
160
+ $('#restore-defaults').on('click',function(e){
161
+ if (confirm("Restore the default fields?")) {
162
+ $theForm.trigger('submit');
163
+ } else {
164
+ $(this).trigger("blur");
165
+ return false;
166
+ }
167
+ });
168
+
169
+ /**
170
+ * Prevent single click on handle from opening accordion
171
+ */
172
+ $fieldList.on("click", "span.handle", function (e) {
173
+ e.stopImmediatePropagation();
174
+ e.preventDefault();
175
+ });
176
+
177
+ /**
178
+ * Open/close
179
+ */
180
+ $fieldList.on("click", "span.link", function () {
181
+ toggleField($(this).closest("li"));
182
+ return false;
183
+ });
184
+
185
+ /**
186
+ * Validate field label
187
+ */
188
+ $fieldList.on("change blur", "input.field-label", function () {
189
+ var newLabel = $(this).val().trim();
190
+ // fill in blank label
191
+ if ('' === newLabel) {
192
+ newLabel = wpmtstAdmin.newField;
193
+ }
194
+ $(this).val(newLabel);
195
+
196
+ var $parent = $(this).closest("li");
197
+ var fieldIndex = $parent.index();
198
+
199
+ // update parent list item
200
+ $parent.find("a.field").html(newLabel);
201
+
202
+ // fill in blank field name
203
+ var $fieldName = $parent.find("input.field-name");
204
+ if ('new_field' === $fieldName.val()) {
205
+ $fieldName.val(getUniqueName(newLabel, fieldIndex)).trigger( 'change' );
206
+ }
207
+ });
208
+
209
+ /**
210
+ * Validate field name
211
+ */
212
+ $fieldList.on("change", "input.field-name", function () {
213
+ var fieldName = $(this).val();
214
+ var $parent = $(this).closest("li");
215
+ var fieldIndex = $parent.index();
216
+
217
+ if (fieldName) {
218
+ $(this).val(getUniqueName(fieldName, fieldIndex));
219
+ } else {
220
+ var fieldLabel = $(this).closest(".field-table").find(".field-label").val();
221
+ $(this).val(getUniqueName(fieldLabel, fieldIndex));
222
+ }
223
+
224
+ // Check new name, not initial value
225
+ if ('name' === $(this).val() || 'date' === $(this).val()) {
226
+ $(this).closest('tr').addClass('form-error');
227
+ $(this).parent().find('.field-name-help.important').addClass('form-error-text');
228
+ $(this).trigger('focus')
229
+ return false;
230
+ } else {
231
+ $(this).closest('tr').removeClass('form-error');
232
+ $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
233
+ }
234
+ });
235
+
236
+ /**
237
+ * Delete field
238
+ */
239
+ $fieldList.on("click", ".delete-field", function () {
240
+ $(this).trigger("blur");
241
+ dismissNotice();
242
+ var thisField = $(this).closest("li");
243
+ var thisLabel = thisField.find(".field").text();
244
+ if (confirm('Delete "' + thisLabel + '"?')) {
245
+ thisField.fadeOut(function () {
246
+ $.when(thisField.remove()).then(function () {
247
+ formPreview();
248
+ toggleCategoryFields();
249
+ $("#add-field, #submit").prop("disabled", false);
250
+ })
251
+ });
252
+ }
253
+ });
254
+
255
+ /**
256
+ * Close field
257
+ */
258
+ $fieldList.on("click", "span.close-field a", function () {
259
+ toggleField($(this).closest("li"));
260
+ return false;
261
+ });
262
+
263
+ /**
264
+ * Add new field
265
+ */
266
+ $("#add-field").on('click', function () {
267
+ dismissNotice();
268
+ var keys = $fieldList.find("li").map(function () {
269
+ var key_id = $(this).attr("id");
270
+ return key_id.substr(key_id.lastIndexOf("-") + 1);
271
+ }).get();
272
+ var nextKey = Array.max(keys) + 1;
273
+
274
+ var data = {
275
+ 'action': 'wpmtst_add_field',
276
+ 'nextKey': nextKey,
277
+ 'fieldClass': null,
278
+ 'fieldType': null,
279
+ 'security': wpmtstAdmin.ajax_nonce
280
+ };
281
+ $.get(ajaxurl, data, function (response) {
282
+ $("#add-field, #submit").attr("disabled", "disabled");
283
+
284
+ // create list item
285
+ var $li = $('<li id="field-' + nextKey + '" data-status="new">').append(response);
286
+
287
+ // hide elements until Type is selected
288
+ $li.find('.field-label-row').hide();
289
+ $li.find('.field-name-row').hide();
290
+ $li.find("span.close-field").hide();
291
+
292
+ // append to list
293
+ $.when($fieldList.append($li)).then(function () {
294
+ formPreview();
295
+ togglePostFields();
296
+ toggleCategoryFields();
297
+
298
+ // click it to open
299
+ $li.find("span.link").trigger('click');
300
+ });
301
+ });
302
+ });
303
+
304
+ /**
305
+ * Field type change
306
+ */
307
+ $fieldList.on("change", ".field-type", function (e) {
308
+ var fieldType = $(this).val();
309
+ var $table = $(this).closest("table");
310
+ var $parent = $(this).closest('li');
311
+
312
+ if ($parent.data('status') !== 'new') {
313
+ $table.find(".field-secondary, .field-admin-table").remove();
314
+ }
315
+
316
+ if ('none' === fieldType) {
317
+ $parent.find('.field-label-row').hide();
318
+ $parent.find('.field-name-row').hide();
319
+
320
+ // Hide "Close" link
321
+ $parent.find("span.close-field").hide();
322
+ $("#add-field, #submit").attr("disabled", "disabled");
323
+ return;
324
+ }
325
+ $parent.find('tr').removeClass('form-error');
326
+ $parent.find('.form-error-text').hide();
327
+
328
+ var key_id = $parent.attr("id");
329
+ var key = key_id.substr(key_id.lastIndexOf("-") + 1);
330
+
331
+ var $fieldLabel = $parent.find('input.field-label');
332
+ var $fieldName = $parent.find('input.field-name');
333
+ var fieldIndex = $parent.index();
334
+
335
+ // get type of field from its optgroup
336
+ var fieldOption = $(this).find("option[value='" + fieldType + "']");
337
+ var fieldClass = fieldOption.closest("optgroup").attr("class");
338
+
339
+ switch (fieldClass) {
340
+
341
+ case 'post':
342
+ $parent.find('.field-label-row').show();
343
+ $parent.find('.field-name-row').show();
344
+
345
+ // Force values if selecting a Post field.
346
+ if (fieldType === 'post_title') {
347
+ $fieldLabel.val('Testimonial Title');
348
+ $fieldName.val('post_title').attr('disabled', 'disabled');
349
+ }
350
+ else if (fieldType === 'featured_image') {
351
+ $fieldLabel.val('Photo');
352
+ $fieldName.val('featured_image').attr('disabled', 'disabled');
353
+ }
354
+ else if (fieldType === 'post_content') {
355
+ $fieldLabel.val('Testimonial');
356
+ $fieldName.val('post_content').attr('disabled', 'disabled');
357
+ }
358
+ // move value to hidden input
359
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
360
+ // hide help message
361
+ $parent.find(".field-name-help").hide();
362
+ break;
363
+
364
+ case 'optional':
365
+ $parent.find('.field-label-row').show();
366
+ $parent.find('.field-name-row').show();
367
+
368
+ if ('category' === fieldType.split('-')[0]) {
369
+ $fieldName.val('category').attr('disabled', 'disabled');
370
+ // move value to hidden input
371
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
372
+ // hide help message
373
+ $parent.find(".field-name-help").hide();
374
+ }
375
+ var forceName = fieldOption.data('force-name');
376
+ if (forceName) {
377
+ $fieldName.val(forceName).attr('disabled', 'disabled');
378
+ // move value to hidden input
379
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
380
+ // hide help message
381
+ $parent.find(".field-name-help").hide();
382
+ }
383
+ $fieldLabel.val(wpmtstAdmin.newField).trigger('focus').trigger('select');
384
+ break;
385
+
386
+ default:
387
+ $parent.find('.field-label-row').show();
388
+ $parent.find('.field-name-row').show();
389
+
390
+ // TODO DRY
391
+ $fieldLabel.val(wpmtstAdmin.newField).trigger('focus').trigger('select');
392
+ $fieldName.val(getUniqueName($fieldLabel.val(), fieldIndex));
393
+ $fieldName.prop('disabled', false);
394
+ $parent.find(".field-name-help").show();
395
+ }
396
+
397
+ // secondary form fields
398
+ var data1 = {
399
+ 'action': 'wpmtst_add_field_2',
400
+ 'nextKey': key,
401
+ 'fieldClass': fieldClass,
402
+ 'fieldType': fieldType,
403
+ 'security': wpmtstAdmin.ajax_nonce
404
+ };
405
+
406
+ var ajax1 = $.get(ajaxurl, data1, function (response) {
407
+ $table.append(response);
408
+ $( document ).trigger( "st-done-loading-secondary-fields", [ $table ] );
409
+ });
410
+
411
+
412
+ // admin-table field
413
+ var data2 = {
414
+ 'action': 'wpmtst_add_field_4',
415
+ 'nextKey': key,
416
+ 'fieldClass': fieldClass,
417
+ 'fieldType': fieldType,
418
+ 'security': wpmtstAdmin.ajax_nonce
419
+ };
420
+
421
+ var ajax2 = ajax1.then(function () {
422
+ return $.get(ajaxurl, data2, function (response) {
423
+ $table.append(response);
424
+ });
425
+ });
426
+
427
+
428
+ // hidden inputs
429
+ var data3 = {
430
+ 'action': 'wpmtst_add_field_3',
431
+ 'nextKey': key,
432
+ 'fieldClass': fieldClass,
433
+ 'fieldType': fieldType,
434
+ 'security': wpmtstAdmin.ajax_nonce
435
+ };
436
+
437
+ var ajax3 = ajax2.then(function () {
438
+ return $.get(ajaxurl, data3, function (response) {
439
+ $table.parent().append(response);
440
+ });
441
+ });
442
+
443
+ ajax3.done(function () {
444
+
445
+ formPreview();
446
+ $("#add-field, #submit").prop("disabled", false);
447
+
448
+ // Successfully added so show "Close" link
449
+ $("span.close-field").show();
450
+
451
+ $parent
452
+ // Reset temporary status
453
+ .removeData("status").removeAttr("data-status")
454
+ // update parent list item
455
+ .find(".custom-field-header a.field").html($fieldLabel.val()).end()
456
+ // update hidden [record_type] input
457
+ .find('input[name$="[record_type]"]').val(fieldClass);
458
+
459
+ });
460
+
461
+ });
462
+
463
+ /**
464
+ * ------------------------------------------------------------
465
+ * Functions
466
+ * ------------------------------------------------------------
467
+ */
468
+
469
+ function getCatCount() {
470
+ $.get(ajaxurl, {
471
+ 'action': 'wpmtst_get_cat_count',
472
+ 'security': wpmtstAdmin.ajax_nonce
473
+ },
474
+ function (response) {
475
+ catCount = parseInt(response);
476
+ });
477
+ }
478
+
479
+ // Preview
480
+ function formPreview() {
481
+ var formFields = $theForm.find("[name^='fields']");
482
+ if (!formFields.length) return;
483
+
484
+ var data = {
485
+ 'action': 'wpmtst_get_form_preview',
486
+ 'fields': formFields.serialize()
487
+ };
488
+ $.post(ajaxurl, data, function (response) {
489
+ var newDiv = $("<div></div>").hide().html(response)
490
+ $("#fields-editor-preview")
491
+ .children().first()
492
+ .after(newDiv)
493
+ .fadeOut(0, function () {
494
+ newDiv.show();
495
+ $(this).remove();
496
+ });
497
+ });
498
+ }
499
+
500
+ /*
501
+ * Disable any Post fields already in use.
502
+ *
503
+ * Doing this client-side so a Post field can be added
504
+ * but not saved before adding more fields;
505
+ * i.e. add multiple fields of either type without risk
506
+ * of duplicating single Post fields before clicking "Save".
507
+ */
508
+ function togglePostFields() {
509
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
510
+ var $parent = $(this).closest("li");
511
+ var value = $(this).val();
512
+ if ("post" === value) {
513
+ var name = $parent.find(".field-name").val();
514
+ $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
515
+ }
516
+ });
517
+ }
518
+
519
+ // Only allow one category field
520
+ function toggleCategoryFields() {
521
+ var categoryInUse = false;
522
+
523
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
524
+ var $parent = $(this).closest("li");
525
+ var value = $(this).val();
526
+ if ('optional' === value) {
527
+ var fieldType = $parent.find('input[name$="[input_type]"]').val();
528
+ if (!categoryInUse) {
529
+ categoryInUse = ( 'category' === fieldType.split('-')[0] );
530
+ }
531
+ }
532
+ });
533
+
534
+ var $options = $fieldList.find('option[value^="category"]');
535
+ if (categoryInUse) {
536
+ $options.each(function () {
537
+ var text = $(this).text();
538
+ $(this)
539
+ .attr("disabled", "disabled")
540
+ .text(text + ' ' + wpmtstAdmin.inUse)
541
+ .data('origText', text);
542
+ });
543
+ }
544
+ else if (0 === catCount) {
545
+ $options.each(function () {
546
+ var text = $(this).text();
547
+ $(this)
548
+ .attr("disabled", "disabled")
549
+ .text(text + ' ' + wpmtstAdmin.noneFound)
550
+ .data('origText', text);
551
+ });
552
+ } else {
553
+ $options.each(function () {
554
+ $(this)
555
+ .prop("disabled", false)
556
+ .text($(this).data('origText'));
557
+ });
558
+ }
559
+ }
560
+
561
+ // Actions on opening/closing the field
562
+ function toggleField($field) {
563
+ $field.replaceSelect()
564
+ .toggleClass("open")
565
+ .scrollUp()
566
+ .find("span.link")
567
+ .toggleClass("open")
568
+ .end()
569
+ .find(".custom-field")
570
+ .toggleClass("open")
571
+ .slideToggle()
572
+ .find(".first-field")
573
+ .trigger('focus');
574
+ }
575
+
576
+ // Build a unique name
577
+ function getUniqueName(fieldName, fieldIndex) {
578
+ fieldName = sanitizeName(fieldName);
579
+
580
+ // Get names of *other* fields
581
+ var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
582
+ return this.value;
583
+ }).get();
584
+
585
+ names = names.filter(function (x) {
586
+ return (x !== (undefined || ''));
587
+ });
588
+
589
+ var uniqueName = fieldName;
590
+ var i = 2;
591
+
592
+ while ($.inArray(uniqueName, names) >= 1) {
593
+ uniqueName = fieldName + '_' + i++;
594
+ }
595
+ return uniqueName;
596
+ }
597
+
598
+ // Dismiss the "Fields saved" notice.
599
+ function dismissNotice() {
600
+ $('.wpmtst.notice').find(".notice-dismiss").trigger('click');
601
+ }
602
+
603
+ })(jQuery);
admin/js/admin-form.js CHANGED
@@ -1,163 +1,163 @@
1
- /**
2
- * Strong Testimonials admin
3
- *
4
- * @namespace jQuery
5
- */
6
-
7
- jQuery(document).ready(function ($) {
8
-
9
- /**
10
- * ----------------------------------------
11
- * Admin notification email events
12
- * ----------------------------------------
13
- */
14
-
15
- var $notifyAdmin = $('#wpmtst-options-admin-notify');
16
- var $notifyFields = $('#admin-notify-fields');
17
-
18
- if ($notifyAdmin.is(':checked')) {
19
- $notifyFields.slideDown();
20
- }
21
-
22
- $notifyAdmin.on( 'change', function (e) {
23
- if ($(this).is(':checked')) {
24
- $notifyFields.slideDown();
25
- $(this).trigger('blur');
26
- }
27
- else {
28
- $notifyFields.slideUp();
29
- }
30
- });
31
-
32
- $('#add-recipient').on('click', function (e) {
33
- var $this = $(this);
34
- var key = $this.parent().siblings('.recipient').length;
35
- var data = {
36
- 'action': 'wpmtst_add_recipient',
37
- 'key': key,
38
- };
39
- $.get(ajaxurl, data, function (response) {
40
- $this.parent().before(response).prev().find('.admin_name').first().trigger('focus');
41
- });
42
- });
43
-
44
- $notifyFields.on('click', '.delete-recipient', function (e) {
45
- $(this).closest('.email-option.recipient').remove();
46
- });
47
-
48
- /**
49
- * ----------------------------------------
50
- * Admin notification email tags
51
- *
52
- * Thanks http://skfox.com/2008/11/26/jquery-example-inserting-text-with-drag-n-drop/
53
- * ----------------------------------------
54
- */
55
-
56
- var $tagListItems = $('#wpmtst-tags-list li');
57
- $tagListItems.attr('title', wpmtst_admin.templateTagTitle);
58
-
59
- $tagListItems.on('click', function () {
60
- $(this).closest('.email-container').find('#wpmtst-option-email-message').insertAtCaret($(this).text());
61
- return false;
62
- });
63
-
64
- $.fn.insertAtCaret = function (myValue) {
65
- return this.each(function () {
66
- var sel;
67
- //IE support
68
- if (document.selection) {
69
- this.trigger('focus');
70
- sel = document.selection.createRange();
71
- sel.text = myValue;
72
- this.trigger('focus');
73
- }
74
- //MOZILLA / NETSCAPE support
75
- else if (this.selectionStart || this.selectionStart === '0') {
76
- var startPos = this.selectionStart;
77
- var endPos = this.selectionEnd;
78
- var scrollTop = this.scrollTop;
79
- this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
80
- this.trigger('focus');
81
- this.selectionStart = startPos + myValue.length;
82
- this.selectionEnd = startPos + myValue.length;
83
- this.scrollTop = scrollTop;
84
- } else {
85
- this.value += myValue;
86
- this.trigger('focus');
87
- }
88
- });
89
- };
90
-
91
- /**
92
- * Autosize textarea
93
- */
94
- var ta = document.getElementsByClassName('autosize');
95
- autosize(ta);
96
-
97
- /**
98
- * ----------------------------------------
99
- * Form Settings
100
- * ----------------------------------------
101
- */
102
-
103
- /**
104
- * Restore all default messages
105
- */
106
- $('#restore-default-messages').on('click', function (e) {
107
- var data = {
108
- 'action': 'wpmtst_restore_default_messages'
109
- };
110
-
111
- $.get(ajaxurl, data, function (response) {
112
-
113
- var object = JSON.parse(response);
114
-
115
- for (var key in object) {
116
-
117
- if (object.hasOwnProperty(key)) {
118
-
119
- var targetId = key.replace(/-/g, '_');
120
- var el = $('[id=\'' + targetId + '\']');
121
- el.val(object[key]['text']);
122
-
123
- if ('submission_success' === targetId) {
124
- var editor = tinyMCE.activeEditor;
125
- if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
126
- tinyMCE.activeEditor.setContent(object[key]['text']);
127
- }
128
- }
129
-
130
- }
131
-
132
- }
133
-
134
- });
135
- });
136
-
137
- /**
138
- * Restore a single default message
139
- */
140
- $('.restore-default-message').on('click', function (e) {
141
- var targetId = $(e.target).data('targetId');
142
- var data = {
143
- 'action': 'wpmtst_restore_default_message',
144
- 'field': targetId
145
- };
146
-
147
- $.get(ajaxurl, data, function (response) {
148
-
149
- var object = JSON.parse(response);
150
-
151
- $('[id=\'' + targetId + '\']').val(object['text']);
152
-
153
- if ('submission_success' === targetId) {
154
- var editor = tinyMCE.activeEditor;
155
- if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
156
- tinyMCE.activeEditor.setContent(object['text']);
157
- }
158
- }
159
- });
160
-
161
- });
162
-
163
- });
1
+ /**
2
+ * Strong Testimonials admin
3
+ *
4
+ * @namespace jQuery
5
+ */
6
+
7
+ jQuery(document).ready(function ($) {
8
+
9
+ /**
10
+ * ----------------------------------------
11
+ * Admin notification email events
12
+ * ----------------------------------------
13
+ */
14
+
15
+ var $notifyAdmin = $('#wpmtst-options-admin-notify');
16
+ var $notifyFields = $('#admin-notify-fields');
17
+
18
+ if ($notifyAdmin.is(':checked')) {
19
+ $notifyFields.slideDown();
20
+ }
21
+
22
+ $notifyAdmin.on( 'change', function (e) {
23
+ if ($(this).is(':checked')) {
24
+ $notifyFields.slideDown();
25
+ $(this).trigger('blur');
26
+ }
27
+ else {
28
+ $notifyFields.slideUp();
29
+ }
30
+ });
31
+
32
+ $('#add-recipient').on('click', function (e) {
33
+ var $this = $(this);
34
+ var key = $this.parent().siblings('.recipient').length;
35
+ var data = {
36
+ 'action': 'wpmtst_add_recipient',
37
+ 'key': key,
38
+ };
39
+ $.get(ajaxurl, data, function (response) {
40
+ $this.parent().before(response).prev().find('.admin_name').first().trigger('focus');
41
+ });
42
+ });
43
+
44
+ $notifyFields.on('click', '.delete-recipient', function (e) {
45
+ $(this).closest('.email-option.recipient').remove();
46
+ });
47
+
48
+ /**
49
+ * ----------------------------------------
50
+ * Admin notification email tags
51
+ *
52
+ * Thanks http://skfox.com/2008/11/26/jquery-example-inserting-text-with-drag-n-drop/
53
+ * ----------------------------------------
54
+ */
55
+
56
+ var $tagListItems = $('#wpmtst-tags-list li');
57
+ $tagListItems.attr('title', wpmtst_admin.templateTagTitle);
58
+
59
+ $tagListItems.on('click', function () {
60
+ $(this).closest('.email-container').find('#wpmtst-option-email-message').insertAtCaret($(this).text());
61
+ return false;
62
+ });
63
+
64
+ $.fn.insertAtCaret = function (myValue) {
65
+ return this.each(function () {
66
+ var sel;
67
+ //IE support
68
+ if (document.selection) {
69
+ this.trigger('focus');
70
+ sel = document.selection.createRange();
71
+ sel.text = myValue;
72
+ this.trigger('focus');
73
+ }
74
+ //MOZILLA / NETSCAPE support
75
+ else if (this.selectionStart || this.selectionStart === '0') {
76
+ var startPos = this.selectionStart;
77
+ var endPos = this.selectionEnd;
78
+ var scrollTop = this.scrollTop;
79
+ this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
80
+ this.trigger('focus');
81
+ this.selectionStart = startPos + myValue.length;
82
+ this.selectionEnd = startPos + myValue.length;
83
+ this.scrollTop = scrollTop;
84
+ } else {
85
+ this.value += myValue;
86
+ this.trigger('focus');
87
+ }
88
+ });
89
+ };
90
+
91
+ /**
92
+ * Autosize textarea
93
+ */
94
+ var ta = document.getElementsByClassName('autosize');
95
+ autosize(ta);
96
+
97
+ /**
98
+ * ----------------------------------------
99
+ * Form Settings
100
+ * ----------------------------------------
101
+ */
102
+
103
+ /**
104
+ * Restore all default messages
105
+ */
106
+ $('#restore-default-messages').on('click', function (e) {
107
+ var data = {
108
+ 'action': 'wpmtst_restore_default_messages'
109
+ };
110
+
111
+ $.get(ajaxurl, data, function (response) {
112
+
113
+ var object = JSON.parse(response);
114
+
115
+ for (var key in object) {
116
+
117
+ if (object.hasOwnProperty(key)) {
118
+
119
+ var targetId = key.replace(/-/g, '_');
120
+ var el = $('[id=\'' + targetId + '\']');
121
+ el.val(object[key]['text']);
122
+
123
+ if ('submission_success' === targetId) {
124
+ var editor = tinyMCE.activeEditor;
125
+ if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
126
+ tinyMCE.activeEditor.setContent(object[key]['text']);
127
+ }
128
+ }
129
+
130
+ }
131
+
132
+ }
133
+
134
+ });
135
+ });
136
+
137
+ /**
138
+ * Restore a single default message
139
+ */
140
+ $('.restore-default-message').on('click', function (e) {
141
+ var targetId = $(e.target).data('targetId');
142
+ var data = {
143
+ 'action': 'wpmtst_restore_default_message',
144
+ 'field': targetId
145
+ };
146
+
147
+ $.get(ajaxurl, data, function (response) {
148
+
149
+ var object = JSON.parse(response);
150
+
151
+ $('[id=\'' + targetId + '\']').val(object['text']);
152
+
153
+ if ('submission_success' === targetId) {
154
+ var editor = tinyMCE.activeEditor;
155
+ if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
156
+ tinyMCE.activeEditor.setContent(object['text']);
157
+ }
158
+ }
159
+ });
160
+
161
+ });
162
+
163
+ });
admin/js/admin-global.js CHANGED
@@ -1,35 +1,35 @@
1
- /**
2
- * Strong Testimonials admin
3
- *
4
- * @namespace wpmtst_admin
5
- */
6
-
7
- jQuery(document).ready(function ($) {
8
- /**
9
- * ----------------------------------------
10
- * Persistent admin notices.
11
- * Dismissible from any page.
12
- * ----------------------------------------
13
- */
14
- $('.wpmtst.notice.is-dismissible').on('click', '.notice-dismiss', function (event) {
15
- event.preventDefault()
16
- var $this = $(this)
17
- if ('undefined' === $this.parent().attr('data-key')) {
18
- return
19
- }
20
- $.post(ajaxurl, {
21
- action: 'wpmtst_dismiss_notice',
22
- key: $this.parent().attr('data-key'),
23
- nonce: wpmtst_admin.nonce
24
- })
25
- });
26
-
27
- $('input[name="wpmtst_options[disable_rewrite]"]').on('click',function(){
28
-
29
- if($(this).is(':checked')){
30
- $('tr[data-setting="single_testimonial_slug"]').hide();
31
- } else {
32
- $('tr[data-setting="single_testimonial_slug"]').show();
33
- }
34
- });
35
- });
1
+ /**
2
+ * Strong Testimonials admin
3
+ *
4
+ * @namespace wpmtst_admin
5
+ */
6
+
7
+ jQuery(document).ready(function ($) {
8
+ /**
9
+ * ----------------------------------------
10
+ * Persistent admin notices.
11
+ * Dismissible from any page.
12
+ * ----------------------------------------
13
+ */
14
+ $('.wpmtst.notice.is-dismissible').on('click', '.notice-dismiss', function (event) {
15
+ event.preventDefault()
16
+ var $this = $(this)
17
+ if ('undefined' === $this.parent().attr('data-key')) {
18
+ return
19
+ }
20
+ $.post(ajaxurl, {
21
+ action: 'wpmtst_dismiss_notice',
22
+ key: $this.parent().attr('data-key'),
23
+ nonce: wpmtst_admin.nonce
24
+ })
25
+ });
26
+
27
+ $('input[name="wpmtst_options[disable_rewrite]"]').on('click',function(){
28
+
29
+ if($(this).is(':checked')){
30
+ $('tr[data-setting="single_testimonial_slug"]').hide();
31
+ } else {
32
+ $('tr[data-setting="single_testimonial_slug"]').show();
33
+ }
34
+ });
35
+ });
admin/js/admin-order.js CHANGED
@@ -1,129 +1,129 @@
1
- /**
2
- * Admin list order
3
- * Strong Testimonials
4
- */
5
-
6
- // set cell widths to prevent shrinkage
7
- function setCellWidths() {
8
- jQuery('td, th', 'table.posts').each(function () {
9
- var cell = jQuery(this);
10
- cell.width(cell.width());
11
- });
12
- };
13
-
14
- // reset cell widths
15
- function resetCellWidths(reset) {
16
- jQuery('td, th', 'table.posts').each(function () {
17
- var cell = jQuery(this);
18
- cell.width('');
19
- }).promise().done(setCellWidths);
20
- };
21
-
22
- // Returns a function, that, as long as it continues to be invoked, will not
23
- // be triggered. The function will be called after it stops being called for
24
- // N milliseconds. If `immediate` is passed, trigger the function on the
25
- // leading edge, instead of the trailing.
26
- // Thanks http://davidwalsh.name/javascript-debounce-function
27
- function debounce(func, wait, immediate) {
28
- var timeout;
29
- return function () {
30
- var context = this, args = arguments;
31
- var later = function () {
32
- timeout = null;
33
- if (!immediate) func.apply(context, args);
34
- };
35
- var callNow = immediate && !timeout;
36
- clearTimeout(timeout);
37
- timeout = setTimeout(later, wait);
38
- if (callNow) func.apply(context, args);
39
- };
40
- };
41
-
42
- // window resize listener
43
- var myEfficientFn = debounce(resetCellWidths, 100);
44
- window.addEventListener('resize', myEfficientFn);
45
-
46
-
47
- jQuery(document).ready(function ($) {
48
-
49
- $.fn.strongSort = function (options) {
50
-
51
- var $this = this;
52
- var $handles = $(options.handles);
53
-
54
- var toggleReorder = function () {
55
- $this.sortable("enable");
56
- $handles.show();
57
- }
58
-
59
- this.sortable({
60
- disabled: true, // initially disabled
61
- items: 'tr',
62
- axis: 'y',
63
- handle: options.handles,
64
- forcePlaceholderSize: true,
65
- placeholder: "sortable-placeholder",
66
- start: function (e, ui) {
67
- // set height of placeholder to match current dragged element
68
- ui.placeholder.height(ui.helper.height());
69
- ui.helper.css("cursor", "move");
70
- },
71
- helper: function (e, ui) {
72
- var $originals = ui.children();
73
- var $helper = ui.clone();
74
- $helper.children().each(function (index) {
75
- // set helper cell sizes to match the original sizes
76
- $(this).width($originals.eq(index).width());
77
- });
78
- return $helper;
79
- },
80
- update: function (e, ui) {
81
- ui.item.find(".column-handle").addClass("refresh");
82
- $.post(ajaxurl, {
83
- action: 'st-update-menu-order',
84
- posts: $('#the-list').sortable('serialize'),
85
- order: wpmtstOrderHelper
86
- },
87
- function (data) {
88
- // update menu order shown
89
- var $orders = $(".menu-order");
90
- var obj = JSON.parse(data);
91
- var orderArray = $.map(obj, function (val, i) {
92
- $orders.eq(i).html(val);
93
- });
94
- })
95
- .done(function () {
96
- // update zebra striping
97
- $("#the-list").find("tr:even").removeClass("alternate");
98
- ui.item.effect('highlight', {}, 2000);
99
- ui.item.find(".column-handle").removeClass("refresh");
100
- })
101
-
102
- }
103
- });
104
-
105
- toggleReorder();
106
-
107
- return this;
108
- }
109
-
110
- // Init
111
-
112
- setCellWidths();
113
-
114
- $("#screen-meta").on("change", ".metabox-prefs", resetCellWidths);
115
-
116
- $("#the-list").strongSort({
117
- handles: 'td.column-handle'
118
- });
119
-
120
- $("td.column-handle").on( 'mouseenter mouseleave',
121
- function () {
122
- $(this).closest("tr").addClass("reorder-hover");
123
- },
124
- function () {
125
- $(this).closest("tr").removeClass("reorder-hover");
126
- }
127
- );
128
-
129
- });
1
+ /**
2
+ * Admin list order
3
+ * Strong Testimonials
4
+ */
5
+
6
+ // set cell widths to prevent shrinkage
7
+ function setCellWidths() {
8
+ jQuery('td, th', 'table.posts').each(function () {
9
+ var cell = jQuery(this);
10
+ cell.width(cell.width());
11
+ });
12
+ };
13
+
14
+ // reset cell widths
15
+ function resetCellWidths(reset) {
16
+ jQuery('td, th', 'table.posts').each(function () {
17
+ var cell = jQuery(this);
18
+ cell.width('');
19
+ }).promise().done(setCellWidths);
20
+ };
21
+
22
+ // Returns a function, that, as long as it continues to be invoked, will not
23
+ // be triggered. The function will be called after it stops being called for
24
+ // N milliseconds. If `immediate` is passed, trigger the function on the
25
+ // leading edge, instead of the trailing.
26
+ // Thanks http://davidwalsh.name/javascript-debounce-function
27
+ function debounce(func, wait, immediate) {
28
+ var timeout;
29
+ return function () {
30
+ var context = this, args = arguments;
31
+ var later = function () {
32
+ timeout = null;
33
+ if (!immediate) func.apply(context, args);
34
+ };
35
+ var callNow = immediate && !timeout;
36
+ clearTimeout(timeout);
37
+ timeout = setTimeout(later, wait);
38
+ if (callNow) func.apply(context, args);
39
+ };
40
+ };
41
+
42
+ // window resize listener
43
+ var myEfficientFn = debounce(resetCellWidths, 100);
44
+ window.addEventListener('resize', myEfficientFn);
45
+
46
+
47
+ jQuery(document).ready(function ($) {
48
+
49
+ $.fn.strongSort = function (options) {
50
+
51
+ var $this = this;
52
+ var $handles = $(options.handles);
53
+
54
+ var toggleReorder = function () {
55
+ $this.sortable("enable");
56
+ $handles.show();
57
+ }
58
+
59
+ this.sortable({
60
+ disabled: true, // initially disabled
61
+ items: 'tr',
62
+ axis: 'y',
63
+ handle: options.handles,
64
+ forcePlaceholderSize: true,
65
+ placeholder: "sortable-placeholder",
66
+ start: function (e, ui) {
67
+ // set height of placeholder to match current dragged element
68
+ ui.placeholder.height(ui.helper.height());
69
+ ui.helper.css("cursor", "move");
70
+ },
71
+ helper: function (e, ui) {
72
+ var $originals = ui.children();
73
+ var $helper = ui.clone();
74
+ $helper.children().each(function (index) {
75
+ // set helper cell sizes to match the original sizes
76
+ $(this).width($originals.eq(index).width());
77
+ });
78
+ return $helper;
79
+ },
80
+ update: function (e, ui) {
81
+ ui.item.find(".column-handle").addClass("refresh");
82
+ $.post(ajaxurl, {
83
+ action: 'st-update-menu-order',
84
+ posts: $('#the-list').sortable('serialize'),
85
+ order: wpmtstOrderHelper
86
+ },
87
+ function (data) {
88
+ // update menu order shown
89
+ var $orders = $(".menu-order");
90
+ var obj = JSON.parse(data);
91
+ var orderArray = $.map(obj, function (val, i) {
92
+ $orders.eq(i).html(val);
93
+ });
94
+ })
95
+ .done(function () {
96
+ // update zebra striping
97
+ $("#the-list").find("tr:even").removeClass("alternate");
98
+ ui.item.effect('highlight', {}, 2000);
99
+ ui.item.find(".column-handle").removeClass("refresh");
100
+ })
101
+
102
+ }
103
+ });
104
+
105
+ toggleReorder();
106
+
107
+ return this;
108
+ }
109
+
110
+ // Init
111
+
112
+ setCellWidths();
113
+
114
+ $("#screen-meta").on("change", ".metabox-prefs", resetCellWidths);
115
+
116
+ $("#the-list").strongSort({
117
+ handles: 'td.column-handle'
118
+ });
119
+
120
+ $("td.column-handle").on( 'mouseenter mouseleave',
121
+ function () {
122
+ $(this).closest("tr").addClass("reorder-hover");
123
+ },
124
+ function () {
125
+ $(this).closest("tr").removeClass("reorder-hover");
126
+ }
127
+ );
128
+
129
+ });
admin/js/custom-spinner.js CHANGED
@@ -1,81 +1,81 @@
1
- /**
2
- * Custom Number Spinner
3
- *
4
- * Courtesy of
5
- * http://www.jqueryscript.net/form/Custom-Number-InputSpinner-Plugin-jQuery-number.html
6
- * with help from
7
- * https://stackoverflow.com/a/7343013/51600
8
- */
9
- ;(function ($) {
10
- $.fn.number = function (customOptions) {
11
- function round(value, precision) {
12
- var multiplier = Math.pow(10, precision || 0);
13
- return Math.round(value * multiplier) / multiplier;
14
- }
15
-
16
- var options = {
17
- 'containerClass': 'number-style noselect',
18
- 'minus': 'number-minus',
19
- 'plus': 'number-plus',
20
- 'containerTag': 'div',
21
- 'btnTag': 'span'
22
- }
23
- options = $.extend(true, options, customOptions)
24
-
25
- var input = this
26
- input.wrap('<' + options.containerTag + ' class="' + options.containerClass + '">')
27
-
28
- var wrapper = input.parent()
29
- wrapper.prepend('<' + options.btnTag + ' class="' + options.minus + '"></' + options.btnTag + '>')
30
- wrapper.append('<' + options.btnTag + ' class="' + options.plus + '"></' + options.btnTag + '>')
31
-
32
- var minus = wrapper.find('.' + options.minus)
33
- var plus = wrapper.find('.' + options.plus)
34
-
35
- var min = round(input.attr('min'),1)
36
- var max = round(input.attr('max'),1)
37
- var step = 1
38
- if(input.attr('step')){
39
- step = +round(input.attr('step'),1)
40
- }
41
-
42
- if (+input.val() <= +min) {
43
- minus.addClass('disabled')
44
- }
45
- if (+input.val() >= +max) {
46
- plus.addClass('disabled')
47
- }
48
-
49
- minus.on('click', function () {
50
- var input = $(this).parent().find('input')
51
- var value = +round(input.val(),1)
52
- if (+value > +min) {
53
- input.val(round(+value - step,1))
54
- if (+input.val() === +min) {
55
- input.prev('.' + options.minus).addClass('disabled')
56
- }
57
- if (input.next('.' + options.plus).hasClass('disabled')) {
58
- input.next('.' + options.plus).removeClass('disabled')
59
- }
60
- } else if (!min) {
61
- input.val(round(+value - step,1))
62
- }
63
- })
64
-
65
- plus.on('click', function () {
66
- var input = $(this).parent().find('input')
67
- var value = +round(input.val(),2)
68
- if (+value < +max) {
69
- input.val(round(+value + step,1))
70
- if (+input.val