Strong Testimonials - Version 3.0.0

Version Description

Download this release

Release Info

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

Code changes from version 2.51.9 to 3.0.0

Files changed (51) hide show
  1. admin/about/class-strong-testimonials-welcome.php +137 -137
  2. admin/admin-notices.php +181 -181
  3. admin/admin.php +311 -311
  4. admin/challenge/modal.php +115 -0
  5. admin/class-strong-testimonials-addons.php +141 -141
  6. admin/class-strong-testimonials-admin-category-list.php +69 -69
  7. admin/class-strong-testimonials-admin-list.php +347 -347
  8. admin/class-strong-testimonials-admin-scripts.php +420 -420
  9. admin/class-strong-testimonials-defaults.php +874 -874
  10. admin/class-strong-testimonials-exporter.php +80 -80
  11. admin/class-strong-testimonials-help.php +226 -226
  12. admin/class-strong-testimonials-helper.php +2559 -2559
  13. admin/class-strong-testimonials-list-table.php +1212 -1212
  14. admin/class-strong-testimonials-lite-vs-pro-page.php +137 -138
  15. admin/class-strong-testimonials-page-shortcodes.php +417 -415
  16. admin/class-strong-testimonials-post-editor.php +401 -401
  17. admin/class-strong-testimonials-review.php +169 -169
  18. admin/class-strong-testimonials-updater.php +1387 -1387
  19. admin/class-strong-testimonials-upsell.php +892 -831
  20. admin/class-strong-testimonials-wpchill-upsells.php +499 -0
  21. admin/class-strong-views-list-table.php +276 -276
  22. admin/class-walker-strong-category-checklist.php +127 -127
  23. admin/class-walker-strong-form-category-checklist.php +127 -127
  24. admin/compat.php +116 -116
  25. admin/css/about.css +53 -53
  26. admin/css/admin-compat.css +178 -178
  27. admin/css/admin-form.css +138 -138
  28. admin/css/fields.css +317 -317
  29. admin/css/form-preview.css +135 -135
  30. admin/css/lite-vs-pro.css +174 -174
  31. admin/css/number-spinner.css +98 -98
  32. admin/css/order.css +129 -129
  33. admin/css/polylang.css +7 -7
  34. admin/css/post-editor.css +114 -114
  35. admin/css/selectize.default.css +408 -408
  36. admin/css/uninstall.css +113 -113
  37. admin/css/views.css +1031 -1031
  38. admin/css/wpml.css +31 -31
  39. admin/custom-fields-ajax.php +123 -123
  40. admin/custom-fields.php +529 -529
  41. admin/form-preview.php +51 -51
  42. admin/img/features/email.svg +21 -21
  43. admin/img/features/filter.svg +21 -21
  44. admin/img/features/infinitescroll.svg +15 -15
  45. admin/img/features/mailchimp.svg +34 -34
  46. admin/img/features/rolemanagement.svg +17 -17
  47. admin/img/logo-long.svg +91 -91
  48. admin/img/star.svg +12 -12
  49. admin/js/addon-licenses.js +163 -163
  50. admin/js/admin-compat.js +117 -117
  51. admin/js/admin-fields.js +379 -603
admin/about/class-strong-testimonials-welcome.php CHANGED
@@ -1,137 +1,137 @@
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
- add_action( 'wpmtst_after_update_setup', array( $this, 'wpmtst_on_activation' ), 15 );
9
- }
10
-
11
- public function hide_menu() {
12
- remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
13
- }
14
-
15
- /**
16
- * Add activation hook. Need to be this way so that the About page can be created and accessed
17
- *
18
- * @param $first_install
19
- * @since 2.51.9
20
- */
21
- public function wpmtst_on_activation( $first_install ) {
22
-
23
- if ( $first_install ) {
24
- add_action( 'activated_plugin', array( $this, 'redirect_on_activation' ) );
25
- }
26
- }
27
-
28
- /**
29
- * Redirect to About page when activated
30
- *
31
- * @param $plugin
32
- * @since 2.51.9
33
- */
34
- public function redirect_on_activation( $plugin ) {
35
-
36
- if ( WPMTST_PLUGIN === $plugin ) {
37
- wp_safe_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
38
- exit;
39
- }
40
- }
41
- public function register() {
42
-
43
- add_dashboard_page(
44
- esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
45
- esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
46
- 'manage_options',
47
- 'wpmtst-getting-started',
48
- array( $this, 'about_page' )
49
- );
50
- }
51
-
52
- /**
53
- * @since 2.51.9
54
- * Display About page
55
- */
56
- public function about_page() {
57
-
58
- // WPChill Welcome Class
59
- require_once WPMTST_DIR . 'includes/submodules/banner/class-wpchill-welcome.php';
60
- $welcome = WPChill_Welcome::get_instance();
61
- ?>
62
- <div id="wpchill-welcome">
63
-
64
- <div class="container">
65
-
66
- <div class="hero features">
67
-
68
- <div class="mascot">
69
- <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
70
- </div>
71
-
72
- <div class="block">
73
- <?php $welcome->display_heading( esc_html__( 'Thank you for installing Strong Testimonials', 'strong-testimonials' ) ); ?>
74
- <?php $welcome->display_subheading( esc_html__( 'You\'re just a few steps away from adding and displaying your first testimonial on your website with the easiest to use WordPress review and testimonial plugin on the market.', 'strong-testimonials' ) ); ?>
75
- </div>
76
-
77
- <div class="button-wrap-single">
78
- <?php $welcome->display_button( esc_html__( 'Read our step-by-step guide to get started', 'strong-testimonials' ), 'https://strongtestimonials.com/docs/add-testimonials-to-your-website/', true ); ?>
79
- </div>
80
-
81
- <?php $welcome->display_empty_space(); ?>
82
-
83
- <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
84
-
85
- <?php $welcome->horizontal_delimiter(); ?>
86
-
87
- <div class="block">
88
- <?php $welcome->display_heading( esc_html__( 'Features&Add-ons', 'strong-testimonials' ) ); ?>
89
- <?php $welcome->layout_start( 2, 'feature-list clear' ); ?>
90
- <?php $welcome->display_extension( esc_html__( 'Multiple views', 'strong-testimonials' ), esc_html__( 'Take advantage of our three testimonial views - display, slider, and form, and use them to apply custom settings to multiple testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/multiple-views.png', true ); ?>
91
- <?php $welcome->display_extension( esc_html__( 'Predesigned templates', 'strong-testimonials' ), esc_html__( 'Choose a built-in template, layout, background, and font color to showcase your testimonials in a visually-appealing way.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/predesigned-templates.png', true ); ?>
92
- <?php $welcome->display_extension( esc_html__( 'Testimonial Importer', 'strong-testimonials' ), esc_html__( 'Keep all your testimonials in one single place by importing reviews from third-party websites/plugins, such as: Google, Facebook, Yelp, Zomato, Woocommerce.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-importer.png', true ); ?>
93
- <?php $welcome->display_extension( esc_html__( 'Testimonial forms', 'strong-testimonials' ), esc_html__( 'Collect testimonials from customers via different types of forms along with their data - name, email, company name, company website, featured image, star rating.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-forms.png', true ); ?>
94
- <?php $welcome->display_extension( esc_html__( 'User role management', 'strong-testimonials' ), esc_html__( 'As, an admin, easily decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/user-role-management.png', true ); ?>
95
- <?php $welcome->display_extension( esc_html__( 'Spam protection', 'strong-testimonials' ), esc_html__( 'Add spam control to your forms with our Captcha extension.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/spam-protection.png', true ); ?>
96
- <?php $welcome->display_extension( esc_html__( 'Email integration', 'strong-testimonials' ), esc_html__( 'Unlock more marketing and automation potential by sending users a targeted message or a coupon to thank them for leaving a good review and subscribing to a MailChimp email list', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/email-integration.png', true ); ?>
97
- <?php $welcome->display_extension( esc_html__( 'SEO-friendly markup', 'strong-testimonials' ), esc_html__( 'Include rating markup to encourage search engines to display rich snippets - whether or not you use a star rating field on your testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/seo-friendly-markup.png', true ); ?>
98
- <?php $welcome->display_extension( esc_html__( 'Pending testimonials', 'strong-testimonials' ), esc_html__( 'Manually verify and approve your incoming testimonials, or make use of the auto-approve feature to save time.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/pending-testimonials.png', true ); ?>
99
- <?php $welcome->display_extension( esc_html__( 'Testimonial assignment', 'strong-testimonials' ), esc_html__( 'Assign testimonials to certain custom post types.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-assignment.png', true ); ?>
100
- <?php $welcome->display_extension( esc_html__( 'Testimonial category filters', 'strong-testimonials' ), esc_html__( 'Increase workflow and user experience by filtering testimonials by category, product/service, or star rating.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-category-filters.png', true ); ?>
101
- <?php $welcome->display_extension( esc_html__( 'Properties ', 'strong-testimonials' ), esc_html__( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/properties.png', true ); ?>
102
- <?php $welcome->layout_end(); ?>
103
- <div class="button-wrap-single clear">
104
- <div class="right">
105
- <?php $welcome->display_button( esc_html__( 'Upgrade Now', 'strong-testimonials' ), 'https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner&utm_content=first_button', true, '#E76F51' ); ?>
106
- </div>
107
- </div>
108
- </div>
109
-
110
- <?php $welcome->horizontal_delimiter(); ?>
111
-
112
- <div class="block">
113
- <div class="testimonials">
114
- <div class="clear">
115
- <?php $welcome->display_heading( esc_html__( 'Happy users of Strong Testimonials', 'strong-testimonials' ) ); ?>
116
-
117
- <?php $welcome->display_testimonial( esc_html__( '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' ), esc_url( WPMTST_ADMIN_URL ) . '/img/testimonial-image-1.jpg', 'Ryan Haught', 'Digital Marketer at Heaven\'s Family' ); ?>
118
- <?php $welcome->display_testimonial( esc_html__( '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' ), esc_url( WPMTST_ADMIN_URL ) . '/img/testimonial-image-2.jpeg', 'Johan Horak', 'Marketing at CapeHolidays' ); ?>
119
- </div>
120
- </div><!-- testimonials -->
121
- <div class="button-wrap clear">
122
- <div class="left">
123
- <?php $welcome->display_button( esc_html__( 'Start Adding Testimonials', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ), true ); ?>
124
- </div>
125
- <div class="right">
126
- <?php $welcome->display_button( esc_html__( 'Upgrade Now', 'strong-testimonials' ), 'https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner&utm_content=second_button', true, '#E76F51' ); ?>
127
- </div>
128
- </div>
129
- </div>
130
- </div><!-- hero -->
131
- </div><!-- container -->
132
- </div><!-- wpchill welcome -->
133
- <?php
134
- }
135
- }
136
-
137
- 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
+ add_action( 'wpmtst_after_update_setup', array( $this, 'wpmtst_on_activation' ), 15 );
9
+ }
10
+
11
+ public function hide_menu() {
12
+ remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
13
+ }
14
+
15
+ /**
16
+ * Add activation hook. Need to be this way so that the About page can be created and accessed
17
+ *
18
+ * @param $first_install
19
+ * @since 2.51.9
20
+ */
21
+ public function wpmtst_on_activation( $first_install ) {
22
+
23
+ if ( $first_install ) {
24
+ add_action( 'activated_plugin', array( $this, 'redirect_on_activation' ) );
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Redirect to About page when activated
30
+ *
31
+ * @param $plugin
32
+ * @since 2.51.9
33
+ */
34
+ public function redirect_on_activation( $plugin ) {
35
+
36
+ if ( WPMTST_PLUGIN === $plugin ) {
37
+ wp_safe_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
38
+ exit;
39
+ }
40
+ }
41
+ public function register() {
42
+
43
+ add_dashboard_page(
44
+ esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
45
+ esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
46
+ 'manage_options',
47
+ 'wpmtst-getting-started',
48
+ array( $this, 'about_page' )
49
+ );
50
+ }
51
+
52
+ /**
53
+ * @since 2.51.9
54
+ * Display About page
55
+ */
56
+ public function about_page() {
57
+
58
+ // WPChill Welcome Class
59
+ require_once WPMTST_DIR . 'includes/submodules/banner/class-wpchill-welcome.php';
60
+ $welcome = WPChill_Welcome::get_instance();
61
+ ?>
62
+ <div id="wpchill-welcome">
63
+
64
+ <div class="container">
65
+
66
+ <div class="hero features">
67
+
68
+ <div class="mascot">
69
+ <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
70
+ </div>
71
+
72
+ <div class="block">
73
+ <?php $welcome->display_heading( esc_html__( 'Thank you for installing Strong Testimonials', 'strong-testimonials' ) ); ?>
74
+ <?php $welcome->display_subheading( esc_html__( 'You\'re just a few steps away from adding and displaying your first testimonial on your website with the easiest to use WordPress review and testimonial plugin on the market.', 'strong-testimonials' ) ); ?>
75
+ </div>
76
+
77
+ <div class="button-wrap-single">
78
+ <?php $welcome->display_button( esc_html__( 'Read our step-by-step guide to get started', 'strong-testimonials' ), 'https://strongtestimonials.com/docs/add-testimonials-to-your-website/', true ); ?>
79
+ </div>
80
+
81
+ <?php $welcome->display_empty_space(); ?>
82
+
83
+ <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
84
+
85
+ <?php $welcome->horizontal_delimiter(); ?>
86
+
87
+ <div class="block">
88
+ <?php $welcome->display_heading( esc_html__( 'Features&Add-ons', 'strong-testimonials' ) ); ?>
89
+ <?php $welcome->layout_start( 2, 'feature-list clear' ); ?>
90
+ <?php $welcome->display_extension( esc_html__( 'Multiple views', 'strong-testimonials' ), esc_html__( 'Take advantage of our three testimonial views - display, slider, and form, and use them to apply custom settings to multiple testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/multiple-views.png', true ); ?>
91
+ <?php $welcome->display_extension( esc_html__( 'Predesigned templates', 'strong-testimonials' ), esc_html__( 'Choose a built-in template, layout, background, and font color to showcase your testimonials in a visually-appealing way.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/predesigned-templates.png', true ); ?>
92
+ <?php $welcome->display_extension( esc_html__( 'Testimonial Importer', 'strong-testimonials' ), esc_html__( 'Keep all your testimonials in one single place by importing reviews from third-party websites/plugins, such as: Google, Facebook, Yelp, Zomato, Woocommerce.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-importer.png', true ); ?>
93
+ <?php $welcome->display_extension( esc_html__( 'Testimonial forms', 'strong-testimonials' ), esc_html__( 'Collect testimonials from customers via different types of forms along with their data - name, email, company name, company website, featured image, star rating.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-forms.png', true ); ?>
94
+ <?php $welcome->display_extension( esc_html__( 'User role management', 'strong-testimonials' ), esc_html__( 'As, an admin, easily decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/user-role-management.png', true ); ?>
95
+ <?php $welcome->display_extension( esc_html__( 'Spam protection', 'strong-testimonials' ), esc_html__( 'Add spam control to your forms with our Captcha extension.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/spam-protection.png', true ); ?>
96
+ <?php $welcome->display_extension( esc_html__( 'Email integration', 'strong-testimonials' ), esc_html__( 'Unlock more marketing and automation potential by sending users a targeted message or a coupon to thank them for leaving a good review and subscribing to a MailChimp email list', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/email-integration.png', true ); ?>
97
+ <?php $welcome->display_extension( esc_html__( 'SEO-friendly markup', 'strong-testimonials' ), esc_html__( 'Include rating markup to encourage search engines to display rich snippets - whether or not you use a star rating field on your testimonials.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/seo-friendly-markup.png', true ); ?>
98
+ <?php $welcome->display_extension( esc_html__( 'Pending testimonials', 'strong-testimonials' ), esc_html__( 'Manually verify and approve your incoming testimonials, or make use of the auto-approve feature to save time.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/pending-testimonials.png', true ); ?>
99
+ <?php $welcome->display_extension( esc_html__( 'Testimonial assignment', 'strong-testimonials' ), esc_html__( 'Assign testimonials to certain custom post types.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-assignment.png', true ); ?>
100
+ <?php $welcome->display_extension( esc_html__( 'Testimonial category filters', 'strong-testimonials' ), esc_html__( 'Increase workflow and user experience by filtering testimonials by category, product/service, or star rating.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/testimonial-category-filters.png', true ); ?>
101
+ <?php $welcome->display_extension( esc_html__( 'Properties ', 'strong-testimonials' ), esc_html__( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ), esc_url( WPMTST_ADMIN_URL ) . '/img/features/properties.png', true ); ?>
102
+ <?php $welcome->layout_end(); ?>
103
+ <div class="button-wrap-single clear">
104
+ <div class="right">
105
+ <?php $welcome->display_button( esc_html__( 'Upgrade Now', 'strong-testimonials' ), 'https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner&utm_content=first_button', true, '#E76F51' ); ?>
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <?php $welcome->horizontal_delimiter(); ?>
111
+
112
+ <div class="block">
113
+ <div class="testimonials">
114
+ <div class="clear">
115
+ <?php $welcome->display_heading( esc_html__( 'Happy users of Strong Testimonials', 'strong-testimonials' ) ); ?>
116
+
117
+ <?php $welcome->display_testimonial( esc_html__( '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' ), esc_url( WPMTST_ADMIN_URL ) . '/img/testimonial-image-1.jpg', 'Ryan Haught', 'Digital Marketer at Heaven\'s Family' ); ?>
118
+ <?php $welcome->display_testimonial( esc_html__( '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' ), esc_url( WPMTST_ADMIN_URL ) . '/img/testimonial-image-2.jpeg', 'Johan Horak', 'Marketing at CapeHolidays' ); ?>
119
+ </div>
120
+ </div><!-- testimonials -->
121
+ <div class="button-wrap clear">
122
+ <div class="left">
123
+ <?php $welcome->display_button( esc_html__( 'Start Adding Testimonials', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ), true ); ?>
124
+ </div>
125
+ <div class="right">
126
+ <?php $welcome->display_button( esc_html__( 'Upgrade Now', 'strong-testimonials' ), 'https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner&utm_content=second_button', true, '#E76F51' ); ?>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div><!-- hero -->
131
+ </div><!-- container -->
132
+ </div><!-- wpchill welcome -->
133
+ <?php
134
+ }
135
+ }
136
+
137
+ new Strong_Testimonials_Welcome();
admin/admin-notices.php CHANGED
@@ -1,181 +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
- $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
-
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,312 +1,312 @@
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
-
42
- Strong_Testimonials_Updater::update();
43
- }
44
-
45
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
46
-
47
- /**
48
- * Initialize.
49
- */
50
- function wpmtst_admin_init() {
51
-
52
- /**
53
- * Custom action hooks
54
- *
55
- * @since 1.18.4
56
- */
57
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
58
- $action = sanitize_text_field( $_REQUEST['action'] );
59
- do_action( 'wpmtst_' . $action );
60
- }
61
- }
62
-
63
- add_action( 'admin_init', 'wpmtst_admin_init' );
64
-
65
- /**
66
- * Custom action link in admin notice.
67
- *
68
- * @since 2.29.0
69
- */
70
- function wpmtst_action_captcha_options_changed() {
71
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
72
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
73
- exit;
74
- }
75
-
76
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
77
-
78
- /**
79
- * Are we on a testimonial admin screen?
80
- *
81
- * Used by add-ons too!
82
- *
83
- * @return bool
84
- */
85
- function wpmtst_is_testimonial_screen() {
86
- $screen = get_current_screen();
87
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
88
- }
89
-
90
- /**
91
- * Add pending numbers to post types on admin menu.
92
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
93
- *
94
- * @param $menu
95
- *
96
- * @return mixed
97
- */
98
- function wpmtst_pending_indicator( $menu ) {
99
- if ( ! current_user_can( 'edit_posts' ) )
100
- return $menu;
101
-
102
- $options = get_option( 'wpmtst_options' );
103
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
104
- return $menu;
105
-
106
- $types = array( 'wpm-testimonial' );
107
- $status = 'pending';
108
- foreach ( $types as $type ) {
109
- $num_posts = wp_count_posts( $type, 'readable' );
110
- $pending_count = 0;
111
- if ( ! empty( $num_posts->$status ) )
112
- $pending_count = $num_posts->$status;
113
-
114
- if ( $type == 'post' )
115
- $menu_str = 'edit.php';
116
- else
117
- $menu_str = 'edit.php?post_type=' . $type;
118
-
119
- foreach ( $menu as $menu_key => $menu_data ) {
120
- if ( $menu_str != $menu_data[2] )
121
- continue;
122
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
123
- }
124
- }
125
-
126
- return $menu;
127
- }
128
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
129
-
130
- /**
131
- * The [restore default] icon.
132
- *
133
- * @param $for
134
- *
135
- * @since 2.18.0
136
- */
137
- function wpmtst_restore_default_icon( $for ) {
138
- if ( !$for ) return;
139
- ?>
140
- <input type="button" class="button secondary restore-default"
141
- title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
142
- value="&#xf171"
143
- data-for="<?php echo esc_attr( $for ); ?>"/>
144
- <?php
145
- }
146
-
147
-
148
-
149
- /**
150
- * Check for configuration issues when options are updated.
151
- *
152
- * @since 2.24.0
153
- * @param $option
154
- * @param $old_value
155
- * @param $value
156
- */
157
- function wpmtst_updated_option( $option, $old_value, $value ) {
158
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
159
- do_action( 'wpmtst_check_config' );
160
- }
161
- }
162
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
163
-
164
-
165
- /**
166
- * Store configuration error.
167
- *
168
- * @since 2.24.0
169
- * @param $key
170
- */
171
- function wpmtst_add_config_error( $key ) {
172
- $errors = get_option( 'wpmtst_config_errors', array() );
173
- $errors[] = $key;
174
- update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
175
-
176
- wpmtst_add_admin_notice( $key, true );
177
- }
178
-
179
-
180
- /**
181
- * Delete configuration error.
182
- *
183
- * @since 2.24.0
184
- * @param $key
185
- */
186
- function wpmtst_delete_config_error( $key ) {
187
- $errors = get_option( 'wpmtst_config_errors', array() );
188
- $errors = array_diff( $errors, array ( $key ) );
189
- update_option( 'wpmtst_config_errors', $errors, 'no' );
190
-
191
- wpmtst_delete_admin_notice( $key );
192
- }
193
-
194
-
195
- /**
196
- * Save a View.
197
- *
198
- * @param $view
199
- * @param string $action
200
- * @usedby Strong_Testimonials_Update:update_views
201
- *
202
- * @return bool|false|int
203
- */
204
- function wpmtst_save_view( $view, $action = 'edit' ) {
205
- global $wpdb;
206
-
207
- if ( ! $view ) return false;
208
-
209
- $table_name = $wpdb->prefix . 'strong_views';
210
- $serialized = serialize( $view['data'] );
211
-
212
- if ( 'add' == $action || 'duplicate' == $action ) {
213
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
214
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
215
- $wpdb->query( $sql );
216
- $view['id'] = $wpdb->insert_id;
217
- $return = $view['id'];
218
- }
219
- else {
220
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
221
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
222
- $wpdb->query( $sql );
223
- $return = $wpdb->last_error ? 0 : 1;
224
- }
225
-
226
- do_action( 'wpmtst_view_saved', $view );
227
-
228
- return $return;
229
- }
230
-
231
-
232
- /**
233
- * @param $field
234
- *
235
- * @return mixed
236
- */
237
- function wpmtst_get_field_label( $field ) {
238
- if ( isset( $field['field'] ) ) {
239
- $custom_fields = wpmtst_get_custom_fields();
240
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
241
- return $custom_fields[ $field['field'] ]['label'];
242
- }
243
- $builtin_fields = wpmtst_get_builtin_fields();
244
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
245
- return $builtin_fields[ $field['field'] ]['label'];
246
- }
247
- }
248
-
249
- return '';
250
- }
251
-
252
- function wpmtst_get_field_text( $field ) {
253
- if ( isset( $field['field'] ) ) {
254
- $custom_fields = wpmtst_get_custom_fields();
255
- if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
256
- return $custom_fields[ $field['field'] ]['text'];
257
- }
258
- $builtin_fields = wpmtst_get_builtin_fields();
259
- if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
260
- return $builtin_fields[ $field['field'] ]['text'];
261
- }
262
- }
263
-
264
- return '';
265
- }
266
-
267
-
268
- /**
269
- * @param string $field_name
270
- *
271
- * @return mixed
272
- */
273
- function wpmtst_get_field_by_name( $field_name = '' ) {
274
- if ( $field_name ) {
275
- $custom_fields = wpmtst_get_custom_fields();
276
- if ( isset( $custom_fields[ $field_name ] ) ) {
277
- return $custom_fields[ $field_name ];
278
- }
279
- }
280
-
281
- return '';
282
- }
283
-
284
- /**
285
- * Returns true if at least one extension is installed
286
- */
287
- function wpmtst_extensions_installed() {
288
-
289
- if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
290
- return true;
291
- }
292
- if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
293
- return true;
294
- }
295
- if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
296
- return true;
297
- }
298
- if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
299
- return true;
300
- }
301
- if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
302
- return true;
303
- }
304
- if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
305
- return true;
306
- }
307
- if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
308
- return true;
309
- }
310
-
311
- return false;
312
  }
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
+
42
+ Strong_Testimonials_Updater::update();
43
+ }
44
+
45
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
46
+
47
+ /**
48
+ * Initialize.
49
+ */
50
+ function wpmtst_admin_init() {
51
+
52
+ /**
53
+ * Custom action hooks
54
+ *
55
+ * @since 1.18.4
56
+ */
57
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
58
+ $action = sanitize_text_field( $_REQUEST['action'] );
59
+ do_action( 'wpmtst_' . $action );
60
+ }
61
+ }
62
+
63
+ add_action( 'admin_init', 'wpmtst_admin_init' );
64
+
65
+ /**
66
+ * Custom action link in admin notice.
67
+ *
68
+ * @since 2.29.0
69
+ */
70
+ function wpmtst_action_captcha_options_changed() {
71
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
72
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
73
+ exit;
74
+ }
75
+
76
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
77
+
78
+ /**
79
+ * Are we on a testimonial admin screen?
80
+ *
81
+ * Used by add-ons too!
82
+ *
83
+ * @return bool
84
+ */
85
+ function wpmtst_is_testimonial_screen() {
86
+ $screen = get_current_screen();
87
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
88
+ }
89
+
90
+ /**
91
+ * Add pending numbers to post types on admin menu.
92
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
93
+ *
94
+ * @param $menu
95
+ *
96
+ * @return mixed
97
+ */
98
+ function wpmtst_pending_indicator( $menu ) {
99
+ if ( ! current_user_can( 'edit_posts' ) )
100
+ return $menu;
101
+
102
+ $options = get_option( 'wpmtst_options' );
103
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
104
+ return $menu;
105
+
106
+ $types = array( 'wpm-testimonial' );
107
+ $status = 'pending';
108
+ foreach ( $types as $type ) {
109
+ $num_posts = wp_count_posts( $type, 'readable' );
110
+ $pending_count = 0;
111
+ if ( ! empty( $num_posts->$status ) )
112
+ $pending_count = $num_posts->$status;
113
+
114
+ if ( $type == 'post' )
115
+ $menu_str = 'edit.php';
116
+ else
117
+ $menu_str = 'edit.php?post_type=' . $type;
118
+
119
+ foreach ( $menu as $menu_key => $menu_data ) {
120
+ if ( $menu_str != $menu_data[2] )
121
+ continue;
122
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
123
+ }
124
+ }
125
+
126
+ return $menu;
127
+ }
128
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
129
+
130
+ /**
131
+ * The [restore default] icon.
132
+ *
133
+ * @param $for
134
+ *
135
+ * @since 2.18.0
136
+ */
137
+ function wpmtst_restore_default_icon( $for ) {
138
+ if ( !$for ) return;
139
+ ?>
140
+ <input type="button" class="button secondary restore-default"
141
+ title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
142
+ value="&#xf171"
143
+ data-for="<?php echo esc_attr( $for ); ?>"/>
144
+ <?php
145
+ }
146
+
147
+
148
+
149
+ /**
150
+ * Check for configuration issues when options are updated.
151
+ *
152
+ * @since 2.24.0
153
+ * @param $option
154
+ * @param $old_value
155
+ * @param $value
156
+ */
157
+ function wpmtst_updated_option( $option, $old_value, $value ) {
158
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
159
+ do_action( 'wpmtst_check_config' );
160
+ }
161
+ }
162
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
163
+
164
+
165
+ /**
166
+ * Store configuration error.
167
+ *
168
+ * @since 2.24.0
169
+ * @param $key
170
+ */
171
+ function wpmtst_add_config_error( $key ) {
172
+ $errors = get_option( 'wpmtst_config_errors', array() );
173
+ $errors[] = $key;
174
+ update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
175
+
176
+ wpmtst_add_admin_notice( $key, true );
177
+ }
178
+
179
+
180
+ /**
181
+ * Delete configuration error.
182
+ *
183
+ * @since 2.24.0
184
+ * @param $key
185
+ */
186
+ function wpmtst_delete_config_error( $key ) {
187
+ $errors = get_option( 'wpmtst_config_errors', array() );
188
+ $errors = array_diff( $errors, array ( $key ) );
189
+ update_option( 'wpmtst_config_errors', $errors, 'no' );
190
+
191
+ wpmtst_delete_admin_notice( $key );
192
+ }
193
+
194
+
195
+ /**
196
+ * Save a View.
197
+ *
198
+ * @param $view
199
+ * @param string $action
200
+ * @usedby Strong_Testimonials_Update:update_views
201
+ *
202
+ * @return bool|false|int
203
+ */
204
+ function wpmtst_save_view( $view, $action = 'edit' ) {
205
+ global $wpdb;
206
+
207
+ if ( ! $view ) return false;
208
+
209
+ $table_name = $wpdb->prefix . 'strong_views';
210
+ $serialized = serialize( $view['data'] );
211
+
212
+ if ( 'add' == $action || 'duplicate' == $action ) {
213
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
214
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
215
+ $wpdb->query( $sql );
216
+ $view['id'] = $wpdb->insert_id;
217
+ $return = $view['id'];
218
+ }
219
+ else {
220
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
221
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
222
+ $wpdb->query( $sql );
223
+ $return = $wpdb->last_error ? 0 : 1;
224
+ }
225
+
226
+ do_action( 'wpmtst_view_saved', $view );
227
+
228
+ return $return;
229
+ }
230
+
231
+
232
+ /**
233
+ * @param $field
234
+ *
235
+ * @return mixed
236
+ */
237
+ function wpmtst_get_field_label( $field ) {
238
+ if ( isset( $field['field'] ) ) {
239
+ $custom_fields = wpmtst_get_custom_fields();
240
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
241
+ return $custom_fields[ $field['field'] ]['label'];
242
+ }
243
+ $builtin_fields = wpmtst_get_builtin_fields();
244
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
245
+ return $builtin_fields[ $field['field'] ]['label'];
246
+ }
247
+ }
248
+
249
+ return '';
250
+ }
251
+
252
+ function wpmtst_get_field_text( $field ) {
253
+ if ( isset( $field['field'] ) ) {
254
+ $custom_fields = wpmtst_get_custom_fields();
255
+ if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
256
+ return $custom_fields[ $field['field'] ]['text'];
257
+ }
258
+ $builtin_fields = wpmtst_get_builtin_fields();
259
+ if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
260
+ return $builtin_fields[ $field['field'] ]['text'];
261
+ }
262
+ }
263
+
264
+ return '';
265
+ }
266
+
267
+
268
+ /**
269
+ * @param string $field_name
270
+ *
271
+ * @return mixed
272
+ */
273
+ function wpmtst_get_field_by_name( $field_name = '' ) {
274
+ if ( $field_name ) {
275
+ $custom_fields = wpmtst_get_custom_fields();
276
+ if ( isset( $custom_fields[ $field_name ] ) ) {
277
+ return $custom_fields[ $field_name ];
278
+ }
279
+ }
280
+
281
+ return '';
282
+ }
283
+
284
+ /**
285
+ * Returns true if at least one extension is installed
286
+ */
287
+ function wpmtst_extensions_installed() {
288
+
289
+ if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
290
+ return true;
291
+ }
292
+ if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
293
+ return true;
294
+ }
295
+ if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
296
+ return true;
297
+ }
298
+ if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
299
+ return true;
300
+ }
301
+ if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
302
+ return true;
303
+ }
304
+ if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
305
+ return true;
306
+ }
307
+ if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
308
+ return true;
309
+ }
310
+
311
+ return false;
312
  }
admin/challenge/modal.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Challenge main class
4
+ *
5
+ * @since 2.6.8
6
+ *
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+
14
+ class ST_Challenge_Modal{
15
+
16
+
17
+ public function __construct(){
18
+
19
+ if( is_admin() && $this->show_challenge() && 1 == get_option( 'wpmtst-challenge', 1 ) ){
20
+ add_action( 'admin_footer', array( $this, 'challenge_render' ), 99 );
21
+ add_action( 'admin_enqueue_scripts', array( $this, 'challenge_scripts' ) );
22
+ add_action( 'wp_ajax_wpmtst_challenge_hide', array( $this, 'wpmtst_challenge_hide' ) );
23
+ }
24
+
25
+ }
26
+
27
+ public function challenge_render(){
28
+
29
+ $new_gallery_url = add_query_arg(
30
+ array(
31
+ 'post_type' => 'wpm-testimonial',
32
+ ),
33
+ admin_url( 'post-new.php' )
34
+ );
35
+
36
+ ?>
37
+ <div class="wpmtst-challenge-wrap">
38
+ <div class="wpmtst-challenge-header">
39
+ <span id="wpmtst-challenge-close" class="dashicons dashicons-no-alt"></span>
40
+ <p><?php echo wp_kses_post( __( 'Start enjoying <strong>Strong Testimonials</strong> by adding your first testimonial.', 'strong-testimonials' ) ); ?></p>
41
+ </div>
42
+ <div class="wpmtst-challenge-list">
43
+ <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Primul lucru din lista', 'strong-testimonials' ); ?></p>
44
+ <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 2-lea lucru din lista', 'strong-testimonials' ); ?></p>
45
+ <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 3-lea lucru din lista', 'strong-testimonials' ); ?></p>
46
+ <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 4-lea lucru din lista', 'strong-testimonials' ); ?></p>
47
+ <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 5-lea lucru din lista', 'strong-testimonials' ); ?></p>
48
+ </div>
49
+ <div class="wpmtst-challenge-footer">
50
+ <img src="<?php echo esc_url( WPMTST_URL . 'admin/img/mascot.png' ); ?>" class="wpmtst-challenge-logo"/>
51
+ <div>
52
+ <h3>Strong Testimonials</h3>
53
+ <p><span class="wpmtst-challenge-time">5:00</span> remaining.</p>
54
+ </div>
55
+ </div>
56
+ <div class="wpmtst-challenge-footer-button">
57
+ <a id="wpmtst-challenge-button" href="<?php echo esc_url( $new_gallery_url ); ?>" class="wpmtst-btn wpmtst-challenge-btn"><?php esc_html_e( 'Create First Gallery', 'strong-testimonials' ); ?></a>
58
+ </div>
59
+
60
+ </div>
61
+ <?php
62
+ }
63
+
64
+ public function challenge_scripts( $hook ) {
65
+
66
+ wp_enqueue_style( 'wpmtst-challenge-style', WPMTST_URL . 'assets/css/challenge.css', array(), true );
67
+ wp_enqueue_script( 'wpmtst-challenge-script', WPMTST_URL . 'assets/js/challenge.js', array( 'jquery' ), '1.0.0', true );
68
+ $args = array(
69
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
70
+ 'nonce' => wp_create_nonce( 'wpmtst-challenge' ),
71
+ );
72
+ wp_localize_script( 'wpmtst-challenge-script', 'wpmtstChallenge', $args );
73
+
74
+ }
75
+
76
+ public function show_challenge(){
77
+ $args = array(
78
+ 'numberposts' => 1,
79
+ 'post_status' => 'any, trash',
80
+ 'post_type' => 'wpm-testimonial'
81
+ );
82
+
83
+ if( !isset( $_GET['post_type'] ) || 'wpm-testimonial' !== $_GET['post_type'] ){
84
+ return false;
85
+ }
86
+
87
+ if( empty( get_posts( $args ) ) ){
88
+ return true;
89
+ }
90
+
91
+ return false;
92
+
93
+ }
94
+ public function wpmtst_challenge_hide(){
95
+
96
+ $nonce = '';
97
+
98
+ if( isset( $_POST['nonce'] ) ){
99
+
100
+ $nonce = $_POST['nonce'];
101
+ }
102
+
103
+ if ( ! wp_verify_nonce( $nonce, 'wpmtst-challenge' ) ) {
104
+ wp_send_json_error();
105
+ die();
106
+ }
107
+
108
+ update_option( 'wpmtst-challenge', 0 );
109
+ wp_send_json_success();
110
+ wp_die();
111
+ }
112
+
113
+ }
114
+ new ST_Challenge_Modal();
115
+ ?>
admin/class-strong-testimonials-addons.php CHANGED
@@ -1,141 +1,141 @@
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
- * Retrieves ST addons
130
- *
131
- * @return Array
132
- *
133
- * @since 2.51.7
134
- */
135
- public function get_addons() {
136
- return $this->check_for_addons();
137
- }
138
-
139
- }
140
-
141
- 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
+ * Retrieves ST addons
130
+ *
131
+ * @return Array
132
+ *
133
+ * @since 2.51.7
134
+ */
135
+ public function get_addons() {
136
+ return $this->check_for_addons();
137
+ }
138
+
139
+ }
140
+
141
+ 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 ( isset( $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,420 +1,420 @@
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-style',
70
- WPMTST_ASSETS_CSS . 'admin.css',
71
- array( ),
72
- $plugin_version );
73
-
74
- wp_register_style( 'wpmtst-post-editor',
75
- WPMTST_ADMIN_URL . 'css/post-editor.css',
76
- array( ),
77
- $plugin_version );
78
-
79
- wp_register_style( 'wpmtst-lite-vs-pro',
80
- WPMTST_ADMIN_URL . 'css/lite-vs-pro.css',
81
- array( ),
82
- $plugin_version );
83
-
84
- wp_register_script( 'wpmtst-custom-spinner',
85
- WPMTST_ADMIN_URL . 'js/custom-spinner.js',
86
- array( 'jquery' ),
87
- $plugin_version,
88
- true );
89
-
90
- wp_register_script( 'autosize',
91
- WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
92
- array(),
93
- '4.0.1',
94
- true );
95
-
96
- /**
97
- * Form tab
98
- */
99
- wp_register_style( 'wpmtst-admin-form-style',
100
- WPMTST_ADMIN_URL . 'css/admin-form.css',
101
- array( 'wpmtst-admin-style' ),
102
- $plugin_version );
103
-
104
- wp_register_script( 'wpmtst-admin-form-script',
105
- WPMTST_ADMIN_URL . 'js/admin-form.js',
106
- array( 'wpmtst-admin-script', 'autosize' ),
107
- $plugin_version,
108
- true );
109
-
110
- /**
111
- * Compatibility tab
112
- */
113
- wp_register_style( 'wpmtst-admin-compat-style',
114
- WPMTST_ADMIN_URL . 'css/admin-compat.css',
115
- array(),
116
- $plugin_version );
117
-
118
- wp_register_script( 'wpmtst-admin-compat-script',
119
- WPMTST_ADMIN_URL . 'js/admin-compat.js',
120
- array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
121
- $plugin_version,
122
- true );
123
-
124
- /**
125
- * Fields
126
- */
127
- wp_register_style( 'wpmtst-admin-fields-style',
128
- WPMTST_ADMIN_URL . 'css/fields.css',
129
- array(),
130
- $plugin_version );
131
-
132
- wp_register_style( 'wpmtst-admin-form-preview',
133
- WPMTST_ADMIN_URL . 'css/form-preview.css',
134
- array(),
135
- $plugin_version );
136
-
137
- wp_register_script( 'wpmtst-admin-fields-script',
138
- WPMTST_ADMIN_URL . 'js/admin-fields.js',
139
- array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
140
- $plugin_version,
141
- true );
142
-
143
- $params = array(
144
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
145
- 'newField' => esc_html_x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
146
- 'inUse' => esc_html_x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
147
- 'noneFound' => esc_html_x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
148
- );
149
- wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
150
-
151
- /**
152
- * Ratings
153
- */
154
- wp_register_style( 'wpmtst-rating-display',
155
- WPMTST_PUBLIC_URL . 'css/rating-display.css',
156
- array( ),
157
- $plugin_version );
158
-
159
- wp_register_style( 'wpmtst-rating-form',
160
- WPMTST_PUBLIC_URL . 'css/rating-form.css',
161
- array( ),
162
- $plugin_version );
163
-
164
- wp_register_script( 'wpmtst-rating-script',
165
- WPMTST_ADMIN_URL . 'js/rating-edit.js',
166
- array( 'jquery' ),
167
- $plugin_version,
168
- true );
169
-
170
- /**
171
- * Views
172
- */
173
- wp_register_style( 'wpmtst-admin-views-style',
174
- WPMTST_ADMIN_URL . 'css/views.css',
175
- array(),
176
- $plugin_version );
177
-
178
- wp_register_script( 'wpmtst-admin-views-script',
179
- WPMTST_ADMIN_URL . 'js/views.js',
180
- array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
181
- $plugin_version,
182
- true );
183
-
184
- /**
185
- * Category filter in View editor.
186
- *
187
- * JavaScript adapted under GPL-2.0+ license
188
- * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
189
- *
190
- * @since 2.2.0
191
- */
192
- wp_register_script( 'wpmtst-view-category-filter-script',
193
- WPMTST_ADMIN_URL . 'js/view-category-filter.js',
194
- array( 'jquery' ),
195
- $plugin_version,
196
- true );
197
-
198
- wp_register_style( 'wpmtst-about-style',
199
- WPMTST_ADMIN_URL . 'css/about.css',
200
- array(),
201
- $plugin_version );
202
-
203
- /**
204
- * Add-on licenses
205
- *
206
- * @since 2.18
207
- */
208
- wp_register_script( 'wpmtst-addons-script',
209
- WPMTST_ADMIN_URL . 'js/addon-licenses.js',
210
- array( 'jquery' ),
211
- $plugin_version,
212
- true );
213
-
214
- $params = array(
215
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
216
- 'requiredField' => esc_html( 'This field is required.', 'strong-testimonials' ),
217
- 'errorMessage' => esc_html__( 'An error occurred, please try again.', 'strong-testimonials' ),
218
- 'restoreDefault' => esc_html__( 'Restore the default settings?', 'strong-testimonials' ),
219
- );
220
- wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
221
-
222
- /**
223
- * Are You Sure? for dirty forms
224
- *
225
- * @since 2.18
226
- */
227
- wp_register_script( 'wpmtst-ays-script',
228
- WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
229
- array( 'jquery' ),
230
- $plugin_version,
231
- true );
232
- }
233
-
234
- /**
235
- * Enqueue global admin scripts.
236
- */
237
- public static function admin_enqueue_scripts() {
238
- $screen = get_current_screen();
239
- $plugin_version = get_option( 'wpmtst_plugin_version' );
240
-
241
- wp_enqueue_style( 'wpmtst-admin-global-style' );
242
-
243
- wp_enqueue_script( 'wpmtst-admin-global',
244
- WPMTST_ADMIN_URL . 'js/admin-global.js',
245
- array( 'jquery' ),
246
- $plugin_version,
247
- true );
248
-
249
- wp_localize_script(
250
- 'wpmtst-admin-global',
251
- 'wpmtst_admin',
252
- array(
253
- 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
254
- 'templateTagTitle' => esc_html__( 'click to insert into message at caret', 'strong-testimonials' ),
255
- )
256
- );
257
-
258
- }
259
-
260
- /**
261
- * Enqueue specific styles and scripts.
262
- *
263
- * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
264
- *
265
- * @since 2.12.0
266
- */
267
-
268
- /**
269
- * Views
270
- */
271
- public static function admin_views() {
272
- wp_enqueue_style( 'wpmtst-admin-style' );
273
- wp_enqueue_script( 'wpmtst-admin-script' );
274
-
275
- wp_enqueue_style( 'wpmtst-admin-views-style' );
276
- wp_enqueue_script( 'wpmtst-admin-views-script' );
277
- wp_enqueue_script( 'wpmtst-view-category-filter-script' );
278
-
279
- wp_enqueue_style( 'wp-color-picker' );
280
- }
281
-
282
- /**
283
- * Fields
284
- */
285
- public static function admin_fields() {
286
- $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
287
- wp_enqueue_style( 'wpmtst-admin-style' );
288
- wp_enqueue_script( 'wpmtst-admin-script' );
289
-
290
- switch ( $tab ) {
291
- case 'form':
292
- wp_enqueue_style( 'wpmtst-admin-form-style' );
293
- wp_enqueue_script( 'wpmtst-admin-form-script' );
294
- break;
295
- case 'fields':
296
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
297
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
298
-
299
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
300
- wp_enqueue_style( 'wpmtst-rating-form' );
301
- break;
302
- default:
303
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
304
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
305
-
306
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
307
- wp_enqueue_style( 'wpmtst-rating-form' );
308
- }
309
- }
310
-
311
- /**
312
- * Settings
313
- */
314
- public static function admin_settings() {
315
- $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
316
-
317
- switch ( $tab ) {
318
- case 'compat':
319
- wp_enqueue_style( 'wpmtst-admin-compat-style' );
320
- wp_enqueue_script( 'wpmtst-admin-compat-script' );
321
- break;
322
- case 'licenses':
323
- wp_enqueue_style( 'wpmtst-admin-style' );
324
- wp_enqueue_script( 'wpmtst-addons-script' );
325
- break;
326
- default:
327
- wp_enqueue_style( 'wpmtst-admin-style' );
328
- wp_enqueue_script( 'wpmtst-admin-script' );
329
- }
330
- }
331
-
332
- /**
333
- * About
334
- */
335
- public static function admin_about() {
336
- wp_enqueue_style( 'wpmtst-admin-style' );
337
- wp_enqueue_script( 'wpmtst-admin-script' );
338
- wp_enqueue_style( 'wpmtst-about-style' );
339
- }
340
-
341
- /**
342
- * Shortcodes
343
- *
344
- * @since 2.31.0
345
- */
346
- public static function admin_shortcodes() {
347
- wp_enqueue_style( 'wpmtst-admin-style' );
348
- wp_enqueue_style( 'wpmtst-rating-display' );
349
- }
350
-
351
- /**
352
- * List table
353
- */
354
- public static function admin_load_edit() {
355
- if ( wpmtst_is_testimonial_screen() ) {
356
- wp_enqueue_style( 'wpmtst-admin-style' );
357
- wp_enqueue_script( 'wpmtst-admin-script' );
358
- wp_enqueue_style( 'wpmtst-rating-display' );
359
- }
360
- }
361
-
362
- /**
363
- * Categories
364
- */
365
- public static function admin_load_edit_tags() {
366
- if ( wpmtst_is_testimonial_screen() ) {
367
- wp_enqueue_style( 'wpmtst-admin-style' );
368
- }
369
- }
370
-
371
- /**
372
- * Edit post
373
- */
374
- public static function admin_load_post() {
375
- if ( wpmtst_is_testimonial_screen() ) {
376
- wp_enqueue_style( 'wpmtst-admin-style' );
377
- wp_enqueue_style( 'wpmtst-post-editor' );
378
- wp_enqueue_script( 'wpmtst-admin-script' );
379
-
380
- wp_enqueue_style( 'wpmtst-rating-display' );
381
- wp_enqueue_style( 'wpmtst-rating-form' );
382
- wp_enqueue_script( 'wpmtst-rating-script' );
383
- }
384
- }
385
-
386
- /**
387
- * Known theme and plugin conflicts.
388
- *
389
- * @param $hook
390
- */
391
- public static function admin_dequeue_scripts( $hook ) {
392
- if ( wp_style_is( 'CPTStyleSheets' ) ) {
393
- wp_dequeue_style( 'CPTStyleSheets' );
394
- }
395
-
396
- $hooks_to_script = array(
397
- 'wpm-testimonial_page_testimonial-views',
398
- 'wpm-testimonial_page_testimonial-fields',
399
- 'wpm-testimonial_page_testimonial-settings',
400
- 'wpm-testimonial_page_about-strong-testimonials',
401
- );
402
-
403
- if ( wpmtst_is_testimonial_screen() ) {
404
- $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
405
- }
406
-
407
- /**
408
- * Block RT Themes and their overzealous JavaScript on our admin pages.
409
- * @since 2.2.12.1
410
- */
411
- if ( in_array( $hook, $hooks_to_script ) ) {
412
- if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
413
- wp_dequeue_script( 'admin-scripts' );
414
- }
415
- }
416
- }
417
-
418
- }
419
-
420
- 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-style',
70
+ WPMTST_ASSETS_CSS . 'admin.css',
71
+ array( ),
72
+ $plugin_version );
73
+
74
+ wp_register_style( 'wpmtst-post-editor',
75
+ WPMTST_ADMIN_URL . 'css/post-editor.css',
76
+ array( ),
77
+ $plugin_version );
78
+
79
+ wp_register_style( 'wpmtst-lite-vs-pro',
80
+ WPMTST_ADMIN_URL . 'css/lite-vs-pro.css',
81
+ array( ),
82
+ $plugin_version );
83
+
84
+ wp_register_script( 'wpmtst-custom-spinner',
85
+ WPMTST_ADMIN_URL . 'js/custom-spinner.js',
86
+ array( 'jquery' ),
87
+ $plugin_version,
88
+ true );
89
+
90
+ wp_register_script( 'autosize',
91
+ WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
92
+ array(),
93
+ '4.0.1',
94
+ true );
95
+
96
+ /**
97
+ * Form tab
98
+ */
99
+ wp_register_style( 'wpmtst-admin-form-style',
100
+ WPMTST_ADMIN_URL . 'css/admin-form.css',
101
+ array( 'wpmtst-admin-style' ),
102
+ $plugin_version );
103
+
104
+ wp_register_script( 'wpmtst-admin-form-script',
105
+ WPMTST_ADMIN_URL . 'js/admin-form.js',
106
+ array( 'wpmtst-admin-script', 'autosize' ),
107
+ $plugin_version,
108
+ true );
109
+
110
+ /**
111
+ * Compatibility tab
112
+ */
113
+ wp_register_style( 'wpmtst-admin-compat-style',
114
+ WPMTST_ADMIN_URL . 'css/admin-compat.css',
115
+ array(),
116
+ $plugin_version );
117
+
118
+ wp_register_script( 'wpmtst-admin-compat-script',
119
+ WPMTST_ADMIN_URL . 'js/admin-compat.js',
120
+ array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
121
+ $plugin_version,
122
+ true );
123
+
124
+ /**
125
+ * Fields
126
+ */
127
+ wp_register_style( 'wpmtst-admin-fields-style',
128
+ WPMTST_ADMIN_URL . 'css/fields.css',
129
+ array(),
130
+ $plugin_version );
131
+
132
+ wp_register_style( 'wpmtst-admin-form-preview',
133
+ WPMTST_ADMIN_URL . 'css/form-preview.css',
134
+ array(),
135
+ $plugin_version );
136
+
137
+ wp_register_script( 'wpmtst-admin-fields-script',
138
+ WPMTST_ADMIN_URL . 'js/admin-fields.js',
139
+ array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
140
+ $plugin_version,
141
+ true );
142
+
143
+ $params = array(
144
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
145
+ 'newField' => esc_html_x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
146
+ 'inUse' => esc_html_x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
147
+ 'noneFound' => esc_html_x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
148
+ );
149
+ wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
150
+
151
+ /**
152
+ * Ratings
153
+ */
154
+ wp_register_style( 'wpmtst-rating-display',
155
+ WPMTST_PUBLIC_URL . 'css/rating-display.css',
156
+ array( ),
157
+ $plugin_version );
158
+
159
+ wp_register_style( 'wpmtst-rating-form',
160
+ WPMTST_PUBLIC_URL . 'css/rating-form.css',
161
+ array( ),
162
+ $plugin_version );
163
+
164
+ wp_register_script( 'wpmtst-rating-script',
165
+ WPMTST_ADMIN_URL . 'js/rating-edit.js',
166
+ array( 'jquery' ),
167
+ $plugin_version,
168
+ true );
169
+
170
+ /**
171
+ * Views
172
+ */
173
+ wp_register_style( 'wpmtst-admin-views-style',
174
+ WPMTST_ADMIN_URL . 'css/views.css',
175
+ array(),
176
+ $plugin_version );
177
+
178
+ wp_register_script( 'wpmtst-admin-views-script',
179
+ WPMTST_ADMIN_URL . 'js/views.js',
180
+ array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
181
+ $plugin_version,
182
+ true );
183
+
184
+ /**
185
+ * Category filter in View editor.
186
+ *
187
+ * JavaScript adapted under GPL-2.0+ license
188
+ * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
189
+ *
190
+ * @since 2.2.0
191
+ */
192
+ wp_register_script( 'wpmtst-view-category-filter-script',
193
+ WPMTST_ADMIN_URL . 'js/view-category-filter.js',
194
+ array( 'jquery' ),
195
+ $plugin_version,
196
+ true );
197
+
198
+ wp_register_style( 'wpmtst-about-style',
199
+ WPMTST_ADMIN_URL . 'css/about.css',
200
+ array(),
201
+ $plugin_version );
202
+
203
+ /**
204
+ * Add-on licenses
205
+ *
206
+ * @since 2.18
207
+ */
208
+ wp_register_script( 'wpmtst-addons-script',
209
+ WPMTST_ADMIN_URL . 'js/addon-licenses.js',
210
+ array( 'jquery' ),
211
+ $plugin_version,
212
+ true );
213
+
214
+ $params = array(
215
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
216
+ 'requiredField' => esc_html( 'This field is required.', 'strong-testimonials' ),
217
+ 'errorMessage' => esc_html__( 'An error occurred, please try again.', 'strong-testimonials' ),
218
+ 'restoreDefault' => esc_html__( 'Restore the default settings?', 'strong-testimonials' ),
219
+ );
220
+ wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
221
+
222
+ /**
223
+ * Are You Sure? for dirty forms
224
+ *
225
+ * @since 2.18
226
+ */
227
+ wp_register_script( 'wpmtst-ays-script',
228
+ WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
229
+ array( 'jquery' ),
230
+ $plugin_version,
231
+ true );
232
+ }
233
+
234
+ /**
235
+ * Enqueue global admin scripts.
236
+ */
237
+ public static function admin_enqueue_scripts() {
238
+ $screen = get_current_screen();
239
+ $plugin_version = get_option( 'wpmtst_plugin_version' );
240
+
241
+ wp_enqueue_style( 'wpmtst-admin-global-style' );
242
+
243
+ wp_enqueue_script( 'wpmtst-admin-global',
244
+ WPMTST_ADMIN_URL . 'js/admin-global.js',
245
+ array( 'jquery' ),
246
+ $plugin_version,
247
+ true );
248
+
249
+ wp_localize_script(
250
+ 'wpmtst-admin-global',
251
+ 'wpmtst_admin',
252
+ array(
253
+ 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
254
+ 'templateTagTitle' => esc_html__( 'click to insert into message at caret', 'strong-testimonials' ),
255
+ )
256
+ );
257
+
258
+ }
259
+
260
+ /**
261
+ * Enqueue specific styles and scripts.
262
+ *
263
+ * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
264
+ *
265
+ * @since 2.12.0
266
+ */
267
+
268
+ /**
269
+ * Views
270
+ */
271
+ public static function admin_views() {
272
+ wp_enqueue_style( 'wpmtst-admin-style' );
273
+ wp_enqueue_script( 'wpmtst-admin-script' );
274
+
275
+ wp_enqueue_style( 'wpmtst-admin-views-style' );
276
+ wp_enqueue_script( 'wpmtst-admin-views-script' );
277
+ wp_enqueue_script( 'wpmtst-view-category-filter-script' );
278
+
279
+ wp_enqueue_style( 'wp-color-picker' );
280
+ }
281
+
282
+ /**
283
+ * Fields
284
+ */
285
+ public static function admin_fields() {
286
+ $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
287
+ wp_enqueue_style( 'wpmtst-admin-style' );
288
+ wp_enqueue_script( 'wpmtst-admin-script' );
289
+
290
+ switch ( $tab ) {
291
+ case 'form':
292
+ wp_enqueue_style( 'wpmtst-admin-form-style' );
293
+ wp_enqueue_script( 'wpmtst-admin-form-script' );
294
+ break;
295
+ case 'fields':
296
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
297
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
298
+
299
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
300
+ wp_enqueue_style( 'wpmtst-rating-form' );
301
+ break;
302
+ default:
303
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
304
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
305
+
306
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
307
+ wp_enqueue_style( 'wpmtst-rating-form' );
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Settings
313
+ */
314
+ public static function admin_settings() {
315
+ $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : '';
316
+
317
+ switch ( $tab ) {
318
+ case 'compat':
319
+ wp_enqueue_style( 'wpmtst-admin-compat-style' );
320
+ wp_enqueue_script( 'wpmtst-admin-compat-script' );
321
+ break;
322
+ case 'licenses':
323
+ wp_enqueue_style( 'wpmtst-admin-style' );
324
+ wp_enqueue_script( 'wpmtst-addons-script' );
325
+ break;
326
+ default:
327
+ wp_enqueue_style( 'wpmtst-admin-style' );
328
+ wp_enqueue_script( 'wpmtst-admin-script' );
329
+ }
330
+ }
331
+
332
+ /**
333
+ * About
334
+ */
335
+ public static function admin_about() {
336
+ wp_enqueue_style( 'wpmtst-admin-style' );
337
+ wp_enqueue_script( 'wpmtst-admin-script' );
338
+ wp_enqueue_style( 'wpmtst-about-style' );
339
+ }
340
+
341
+ /**
342
+ * Shortcodes
343
+ *
344
+ * @since 2.31.0
345
+ */
346
+ public static function admin_shortcodes() {
347
+ wp_enqueue_style( 'wpmtst-admin-style' );
348
+ wp_enqueue_style( 'wpmtst-rating-display' );
349
+ }
350
+
351
+ /**
352
+ * List table
353
+ */
354
+ public static function admin_load_edit() {
355
+ if ( wpmtst_is_testimonial_screen() ) {
356
+ wp_enqueue_style( 'wpmtst-admin-style' );
357
+ wp_enqueue_script( 'wpmtst-admin-script' );
358
+ wp_enqueue_style( 'wpmtst-rating-display' );
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Categories
364
+ */
365
+ public static function admin_load_edit_tags() {
366
+ if ( wpmtst_is_testimonial_screen() ) {
367
+ wp_enqueue_style( 'wpmtst-admin-style' );
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Edit post
373
+ */
374
+ public static function admin_load_post() {
375
+ if ( wpmtst_is_testimonial_screen() ) {
376
+ wp_enqueue_style( 'wpmtst-admin-style' );
377
+ wp_enqueue_style( 'wpmtst-post-editor' );
378
+ wp_enqueue_script( 'wpmtst-admin-script' );
379
+
380
+ wp_enqueue_style( 'wpmtst-rating-display' );
381
+ wp_enqueue_style( 'wpmtst-rating-form' );
382
+ wp_enqueue_script( 'wpmtst-rating-script' );
383
+ }
384
+ }
385
+
386
+ /**
387
+ * Known theme and plugin conflicts.
388
+ *
389
+ * @param $hook
390
+ */
391
+ public static function admin_dequeue_scripts( $hook ) {
392
+ if ( wp_style_is( 'CPTStyleSheets' ) ) {
393
+ wp_dequeue_style( 'CPTStyleSheets' );
394
+ }
395
+
396
+ $hooks_to_script = array(
397
+ 'wpm-testimonial_page_testimonial-views',
398
+ 'wpm-testimonial_page_testimonial-fields',
399
+ 'wpm-testimonial_page_testimonial-settings',
400
+ 'wpm-testimonial_page_about-strong-testimonials',
401
+ );
402
+
403
+ if ( wpmtst_is_testimonial_screen() ) {
404
+ $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
405
+ }
406
+
407
+ /**
408
+ * Block RT Themes and their overzealous JavaScript on our admin pages.
409
+ * @since 2.2.12.1
410
+ */
411
+ if ( in_array( $hook, $hooks_to_script ) ) {
412
+ if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
413
+ wp_dequeue_script( 'admin-scripts' );
414
+ }
415
+ }
416
+ }
417
+
418
+ }
419
+
420
+ Strong_Testimonials_Admin_Scripts::init();
admin/class-strong-testimonials-defaults.php CHANGED
@@ -1,874 +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
- '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
- }
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-lite-vs-pro-page.php CHANGED
@@ -1,139 +1,138 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Addons
4
- *
5
- */
6
- class Strong_Testimonials_Lite_vs_PRO_page {
7
-
8
- public function __construct() {
9
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
10
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
11
-
12
- // Upgrade to PRO plugin action link
13
- add_filter( 'plugin_action_links_' . WPMTST_PLUGIN, array( $this, 'filter_action_links' ), 60 );
14
- }
15
-
16
- /**
17
- * Add the Upgrade to PRO plugin action link
18
- *
19
- * @param $links
20
- *
21
- * @return array
22
- *
23
- * @since 2.51.7
24
- */
25
- public function filter_action_links( $links ) {
26
-
27
- if ( apply_filters( 'st_plugins_upgrade_pro', true ) ) {
28
-
29
- $links = array_merge( array ( '<a target="_blank" class="wpmtst-lite-vs-pro" href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials-lite&utm_medium=plugin_settings&utm_campaign=upsell">' . esc_html__( 'Upgrade to PRO!', 'strong-testimonials' ) . '</a>' ), $links );
30
- }
31
-
32
- return $links;
33
- }
34
- /**
35
- * Add submenu page.
36
- *
37
- * @param $pages
38
- *
39
- * @return mixed
40
- */
41
- public function add_submenu( $pages ) {
42
- $pages[99] = $this->get_submenu();
43
- return $pages;
44
- }
45
-
46
- public function admin_enqueue_scripts(){
47
- wp_enqueue_style( 'wpmtst-lite-vs-pro' );
48
- }
49
-
50
- /**
51
- * Return submenu page parameters.
52
- *
53
- * @return array
54
- */
55
- public function get_submenu() {
56
- return array(
57
- 'page_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
58
- 'menu_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
59
- 'capability' => 'strong_testimonials_options',
60
- 'menu_slug' => 'strong-testimonials-lite-vs-pro',
61
- 'function' => array( $this, 'render_page' ),
62
- );
63
- }
64
-
65
- public function render_page(){
66
-
67
- $addons = new Strong_Testimonials_Addons();
68
- ?>
69
- <div class="wrap wpmtst-lite-vs-premium">
70
- <hr class="wp-header-end" />
71
- <h1><?php echo esc_html__( 'LITE vs PRO', 'strong-testimonials' ); ?> </h1>
72
- <div class="free-vs-premium">
73
- <!-- Table header -->
74
- <div class="wpchill-plans-table table-header">
75
- <div class="wpchill-pricing-package wpchill-empty">
76
- <!--This is an empty div so that we can have an empty corner-->
77
- </div>
78
- <div class="wpchill-pricing-package wpchill-title">
79
- <p class="wpchill-name"><strong>PRO</strong></p>
80
- </div>
81
- <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">
82
- <p class="wpchill-name"><strong>LITE</strong></p>
83
- </div>
84
- </div>
85
- <!-- Table content -->
86
-
87
- <?php
88
- foreach ( $addons->get_addons() as $pro ) {
89
- ?>
90
- <div class="wpchill-plans-table">
91
- <div class="wpchill-pricing-package feature-name">
92
- <h3><?php echo esc_html( $pro['name']); ?></h3>
93
- <p class="tab-header-description wpmtst-tooltip-content">
94
- <?php echo esc_html( $pro['description'] ); ?>
95
- </p>
96
- </div>
97
- <div class="wpchill-pricing-package">
98
- <span class="dashicons dashicons-saved"></span>
99
- </div>
100
- <div class="wpchill-pricing-package">
101
- <span class="dashicons dashicons-no-alt"></span>
102
- </div>
103
- </div>
104
- <?php
105
- }
106
- ?>
107
- <!-- Support -->
108
- <div class="wpchill-plans-table">
109
- <div class="wpchill-pricing-package feature-name">
110
- <h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
111
- </div>
112
- <div class="wpchill-pricing-package">Priority</div>
113
- <div class="wpchill-pricing-package"><a href="https://wordpress.org/support/plugin/strong-testimonials/"
114
- target="_blank">wp.org</a>
115
- </div>
116
- </div>
117
- <!-- Table footer -->
118
- <div class="wpchill-plans-table tabled-footer">
119
- <div class="wpchill-pricing-package wpchill-empty">
120
- <!--This is an empty div so that we can have an empty corner-->
121
- </div>
122
- <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-grid-gallery-business">
123
-
124
- <a href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials&utm_medium=lite-vs-pro&utm_campaign=upsell" target="_blank"
125
- class="button button-primary button-hero "><span class="dashicons dashicons-cart"></span>
126
- <?php esc_html_e( 'Upgrade now!', 'strong-testimonials' ); ?> </a>
127
-
128
- </div>
129
- <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">
130
-
131
-
132
- </div>
133
- </div>
134
- </div>
135
- </div>
136
- <?php
137
- }
138
- }
139
  new Strong_Testimonials_Lite_vs_PRO_page();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Addons
4
+ *
5
+ */
6
+ class Strong_Testimonials_Lite_vs_PRO_page {
7
+
8
+ public function __construct() {
9
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
10
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
11
+
12
+ // Upgrade to PRO plugin action link
13
+ add_filter( 'plugin_action_links_' . WPMTST_PLUGIN, array( $this, 'filter_action_links' ), 60 );
14
+ }
15
+
16
+ /**
17
+ * Add the Upgrade to PRO plugin action link
18
+ *
19
+ * @param $links
20
+ *
21
+ * @return array
22
+ *
23
+ * @since 2.51.7
24
+ */
25
+ public function filter_action_links( $links ) {
26
+
27
+ if ( apply_filters( 'st_plugins_upgrade_pro', true ) ) {
28
+
29
+ $links = array_merge( array ( '<a target="_blank" class="wpmtst-lite-vs-pro" href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials-lite&utm_medium=plugin_settings&utm_campaign=upsell">' . esc_html__( 'Upgrade to PRO!', 'strong-testimonials' ) . '</a>' ), $links );
30
+ }
31
+ return $links;
32
+ }
33
+ /**
34
+ * Add submenu page.
35
+ *
36
+ * @param $pages
37
+ *
38
+ * @return mixed
39
+ */
40
+ public function add_submenu( $pages ) {
41
+ $pages[99] = $this->get_submenu();
42
+ return $pages;
43
+ }
44
+
45
+ public function admin_enqueue_scripts(){
46
+ wp_enqueue_style( 'wpmtst-lite-vs-pro' );
47
+ }
48
+
49
+ /**
50
+ * Return submenu page parameters.
51
+ *
52
+ * @return array
53
+ */
54
+ public function get_submenu() {
55
+ return array(
56
+ 'page_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
57
+ 'menu_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
58
+ 'capability' => 'strong_testimonials_options',
59
+ 'menu_slug' => 'strong-testimonials-lite-vs-pro',
60
+ 'function' => array( $this, 'render_page' ),
61
+ );
62
+ }
63
+
64
+ public function render_page(){
65
+
66
+ $addons = new Strong_Testimonials_Addons();
67
+ ?>
68
+ <div class="wrap wpmtst-lite-vs-premium">
69
+ <hr class="wp-header-end" />
70
+ <h1><?php echo esc_html__( 'LITE vs PRO', 'strong-testimonials' ); ?> </h1>
71
+ <div class="free-vs-premium">
72
+ <!-- Table header -->
73
+ <div class="wpchill-plans-table table-header">
74
+ <div class="wpchill-pricing-package wpchill-empty">
75
+ <!--This is an empty div so that we can have an empty corner-->
76
+ </div>
77
+ <div class="wpchill-pricing-package wpchill-title">
78
+ <p class="wpchill-name"><strong>PRO</strong></p>
79
+ </div>
80
+ <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">
81
+ <p class="wpchill-name"><strong>LITE</strong></p>
82
+ </div>
83
+ </div>
84
+ <!-- Table content -->
85
+
86
+ <?php
87
+ foreach ( $addons->get_addons() as $pro ) {
88
+ ?>
89
+ <div class="wpchill-plans-table">
90
+ <div class="wpchill-pricing-package feature-name">
91
+ <h3><?php echo esc_html( $pro['name']); ?></h3>
92
+ <p class="tab-header-description wpmtst-tooltip-content">
93
+ <?php echo esc_html( $pro['description'] ); ?>
94
+ </p>
95
+ </div>
96
+ <div class="wpchill-pricing-package">
97
+ <span class="dashicons dashicons-saved"></span>
98
+ </div>
99
+ <div class="wpchill-pricing-package">
100
+ <span class="dashicons dashicons-no-alt"></span>
101
+ </div>
102
+ </div>
103
+ <?php
104
+ }
105
+ ?>
106
+ <!-- Support -->
107
+ <div class="wpchill-plans-table">
108
+ <div class="wpchill-pricing-package feature-name">
109
+ <h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
110
+ </div>
111
+ <div class="wpchill-pricing-package">Priority</div>
112
+ <div class="wpchill-pricing-package"><a href="https://wordpress.org/support/plugin/strong-testimonials/"
113
+ target="_blank">wp.org</a>
114
+ </div>
115
+ </div>
116
+ <!-- Table footer -->
117
+ <div class="wpchill-plans-table tabled-footer">
118
+ <div class="wpchill-pricing-package wpchill-empty">
119
+ <!--This is an empty div so that we can have an empty corner-->
120
+ </div>
121
+ <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-grid-gallery-business">
122
+
123
+ <a href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials&utm_medium=lite-vs-pro&utm_campaign=upsell" target="_blank"
124
+ class="button button-primary button-hero "><span class="dashicons dashicons-cart"></span>
125
+ <?php esc_html_e( 'Upgrade now!', 'strong-testimonials' ); ?> </a>
126
+
127
+ </div>
128
+ <div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">
129
+
130
+
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ <?php
136
+ }
137
+ }
 
138
  new Strong_Testimonials_Lite_vs_PRO_page();
admin/class-strong-testimonials-page-shortcodes.php CHANGED
@@ -1,415 +1,417 @@
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
+ $star_solid = '<svg class="star_solid" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="-8 -8 584 520"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg>';
21
+ $star_regular = '<svg class="star_regular" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="-8 -8 584 520"><path d="M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM388.6 312.3l23.7 138.4L288 385.4l-124.3 65.3 23.7-138.4-100.6-98 139-20.2 62.2-126 62.2 126 139 20.2-100.6 98z"></path></svg>';
22
+ $star_half = '<svg class="star_half" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="-8 -8 584 520"><path d="M508.55 171.51L362.18 150.2 296.77 17.81C290.89 5.98 279.42 0 267.95 0c-11.4 0-22.79 5.9-28.69 17.81l-65.43 132.38-146.38 21.29c-26.25 3.8-36.77 36.09-17.74 54.59l105.89 103-25.06 145.48C86.98 495.33 103.57 512 122.15 512c4.93 0 10-1.17 14.87-3.75l130.95-68.68 130.94 68.7c4.86 2.55 9.92 3.71 14.83 3.71 18.6 0 35.22-16.61 31.66-37.4l-25.03-145.49 105.91-102.98c19.04-18.5 8.52-50.8-17.73-54.6zm-121.74 123.2l-18.12 17.62 4.28 24.88 19.52 113.45-102.13-53.59-22.38-11.74.03-317.19 51.03 103.29 11.18 22.63 25.01 3.64 114.23 16.63-82.65 80.38z"></path></svg>';
23
+
24
+ $stars = '<span class="strong-rating"><span class="star0 star"></span><span class="star">'.$star_solid.'</span><span class="star">'.$star_solid.'</span><span class="star">'.$star_solid.'</span><span class="star">'.$star_solid.'</span><span class="star current half">'.$star_half.'</span></span>';
25
+ $stars_rounded = '<span class="strong-rating"><span class="star0 star"></span><span class="star">'.$star_solid.'</span><span class="star">'.$star_solid.'</span><span class="star">'.$star_solid.'</span><span class="star current">'.$star_solid.'</span><span class="star">'.$star_regular.'</span></span>';
26
+
27
+ $tags = array(
28
+ 'a' => array(
29
+ 'href' => array(),
30
+ 'target' => array(),
31
+ ),
32
+ );
33
+ ?>
34
+ <div class="wrap wpmtst shortcodes has-stars">
35
+
36
+ <h1><?php esc_html_e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
37
+
38
+ <h2><?php esc_html_e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
39
+
40
+ <p>
41
+ <?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>.
42
+ <?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' ) ); ?>
43
+ </p>
44
+
45
+ <h2><?php esc_html_e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
46
+
47
+ <p><?php printf( esc_html__( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
48
+
49
+ <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
50
+ <tr>
51
+ <td>
52
+ <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
53
+ </td>
54
+ <td class="shortcode">
55
+ <?php /* translators: %s is a shortcode */ ?>
56
+ <p>
57
+ <?php printf( esc_html__( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
58
+ </p>
59
+ </td>
60
+ </tr>
61
+ <tr>
62
+ <td>
63
+ <?php /* translators: %s is a shortcode attribute */ ?>
64
+ <p><?php printf( esc_html__( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
65
+ </td>
66
+ <td class="shortcode">
67
+ <?php /* translators: %s is a shortcode */ ?>
68
+ <p>
69
+ <?php printf( esc_html__( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
70
+ </p>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+
75
+ <h2><?php esc_html_e( 'Average Rating', 'strong-testimonials' ); ?></h2>
76
+
77
+ <p>
78
+ <?php /* translators: %s is a shortcode */ ?>
79
+ <?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>' ); ?>
80
+ </p>
81
+
82
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
83
+ <tr>
84
+ <td>
85
+ <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
86
+ <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>
87
+ </td>
88
+ <td class="has-inner">
89
+ <table class="inner" cellpadding="0" cellspacing="0">
90
+ <tr>
91
+ <td class="shortcode">&#91;testimonial_average_rating /&#93;</td>
92
+ </tr>
93
+ <tr>
94
+ <td>
95
+ <div class="strong-rating-wrapper average">
96
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
97
+ <?php echo $stars; ?>
98
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
99
+ </div>
100
+ </td>
101
+ </tr>
102
+ </table>
103
+ </td>
104
+ </tr>
105
+ </table>
106
+
107
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
108
+ <tr>
109
+ <td>
110
+ <p><?php esc_html_e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
111
+ <p><?php esc_html_e( 'Default:', 'strong-testimonials' ); ?></p>
112
+ <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
113
+ </td>
114
+ <td class="has-inner">
115
+ <table class="inner" cellpadding="0" cellspacing="0">
116
+ <tr>
117
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title} {stars} {summary}&#91;/testimonial_average_rating&#93;</td>
118
+ </tr>
119
+ <tr>
120
+ <td>
121
+ <div class="strong-rating-wrapper average">
122
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
123
+ <?php echo $stars; ?>
124
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)','strong-testimonials'); ?></span>
125
+ </div>
126
+ </td>
127
+ </tr>
128
+ </table>
129
+ </td>
130
+ </tr>
131
+ </table>
132
+
133
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
134
+ <tr>
135
+ <td>
136
+ <p><?php esc_html_e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
137
+ <p><code>{title2}</code><br><code>{summary2}</code></p>
138
+ </td>
139
+ <td class="has-inner">
140
+ <table class="inner" cellpadding="0" cellspacing="0">
141
+ <tr>
142
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title2} {stars} {summary2}&#91;/testimonial_average_rating&#93;</td>
143
+ </tr>
144
+ <tr>
145
+ <td>
146
+ <div class="strong-rating-wrapper average">
147
+ <span class="strong-rating-title"><?php esc_html_e( 'Average of 9 Ratings:', 'strong-testimonials' ); ?></span>
148
+ <?php echo $stars; ?>
149
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars', 'strong-testimonials' ); ?></span>
150
+ </div>
151
+ </td>
152
+ <tr>
153
+ </tr>
154
+ </table>
155
+ </tr>
156
+ </table>
157
+
158
+ <table class="form-table shortcodes average">
159
+ <tr>
160
+ <td>
161
+ <p><?php esc_html_e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
162
+ </td>
163
+ <td class="has-inner">
164
+ <table class="inner" cellpadding="0" cellspacing="0">
165
+ <tr>
166
+ <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>
167
+ </tr>
168
+ <tr>
169
+ <td>
170
+ <div class="strong-rating-wrapper average">
171
+ <?php echo $stars; ?>
172
+ <?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>
173
+ </div>
174
+ </td>
175
+ </tr>
176
+ </table>
177
+ </td>
178
+ </tr>
179
+ </table>
180
+
181
+ <table class="form-table shortcodes average">
182
+ <tr>
183
+ <td>
184
+ <p><code>{stars}</code></p>
185
+ </td>
186
+ <td class="has-inner">
187
+ <table class="inner" cellpadding="0" cellspacing="0">
188
+ <tr>
189
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}&#91;/testimonial_average_rating&#93;</td>
190
+ </tr>
191
+ <tr>
192
+ <td>
193
+ <div class="strong-rating-wrapper average">
194
+ <?php echo $stars; ?>
195
+ </div>
196
+ </td>
197
+ </tr>
198
+ </table>
199
+ </td>
200
+ </tr>
201
+ </table>
202
+
203
+ <table class="form-table shortcodes average">
204
+ <tr>
205
+ <td>
206
+ <p><code>{average}</code></p>
207
+ </td>
208
+ <td class="has-inner">
209
+ <table class="inner" cellpadding="0" cellspacing="0">
210
+ <tr>
211
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{average}&#91;/testimonial_average_rating&#93;</td>
212
+ </tr>
213
+ <tr>
214
+ <td>
215
+ <div class="strong-rating-wrapper average"><span class="strong-rating-average"><?php esc_html_e( '4.3', 'strong-testimonials' ); ?></span></div>
216
+ </td>
217
+ </tr>
218
+ </table>
219
+ </td>
220
+ </tr>
221
+ </table>
222
+
223
+ <table class="form-table shortcodes average">
224
+ <tr>
225
+ <td>
226
+ <p><code>decimals</code></p>
227
+ <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>
228
+
229
+ </td>
230
+ <td class="has-inner">
231
+ <table class="inner" cellpadding="0" cellspacing="0">
232
+ <tr>
233
+ <td class="shortcode">&#91;testimonial_average_rating decimals="number" /&#93;</td>
234
+ </tr>
235
+ <tr>
236
+ <td>
237
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
238
+ <?php echo $stars; ?>
239
+ <span class="strong-rating-summary"><?php esc_html_e( '4.333 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
240
+ </div>
241
+ </td>
242
+ </tr>
243
+ </table>
244
+ </td>
245
+ </tr>
246
+ </table>
247
+
248
+ <table class="form-table shortcodes average">
249
+ <tr>
250
+ <td>
251
+ <p><code>{count}</code></p>
252
+ </td>
253
+ <td class="has-inner">
254
+ <table class="inner" cellpadding="0" cellspacing="0">
255
+ <tr>
256
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{count}&#91;/testimonial_average_rating&#93;</td>
257
+ </tr>
258
+ <tr>
259
+ <td>
260
+ <div class="strong-rating-wrapper average"><span class="strong-rating-count"><?php esc_html_e( '9', 'strong-testimonials' ); ?></span></div>
261
+ </td>
262
+ </tr>
263
+ </table>
264
+ </td>
265
+ </tr>
266
+ </table>
267
+
268
+ <table class="form-table shortcodes average">
269
+ <tr>
270
+ <td>
271
+ <p><code>field</code></p>
272
+ <p class="description"><?php esc_html_e( 'If using multiple rating fields, you can specify the specific field you need.', 'strong-testimonials' ); ?></p>
273
+ <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>
274
+ </td>
275
+ <td class="has-inner">
276
+ <table class="inner" cellpadding="0" cellspacing="0">
277
+ <tr>
278
+ <td class="shortcode">&#91;testimonial_average_rating field="rating" /&#93;</td>
279
+ </tr>
280
+ <tr>
281
+ <td class="shortcode">&#91;testimonial_average_rating field="all" /&#93;</td>
282
+ </tr>
283
+ <tr>
284
+ <td>
285
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
286
+ <?php echo $stars; ?>
287
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
288
+ </div>
289
+ </td>
290
+ </tr>
291
+ </table>
292
+ </td>
293
+ </tr>
294
+ </table>
295
+
296
+ <table class="form-table shortcodes average">
297
+ <tr>
298
+ <td>
299
+ <p><code>block</code></p>
300
+ </td>
301
+ <td class="has-inner">
302
+ <table class="inner" cellpadding="0" cellspacing="0">
303
+ <tr>
304
+ <td class="shortcode">&#91;testimonial_average_rating block /&#93;</td>
305
+ </tr>
306
+ <tr>
307
+ <td>
308
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
309
+ <?php echo $stars; ?>
310
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
311
+ </div>
312
+ </td>
313
+ </tr>
314
+ </table>
315
+ </td>
316
+ </tr>
317
+ </table>
318
+
319
+ <table class="form-table shortcodes average">
320
+ <tr>
321
+ <td>
322
+ <p><code>centered</code></p>
323
+ </td>
324
+ <td class="has-inner">
325
+ <table class="inner" cellpadding="0" cellspacing="0">
326
+ <tr>
327
+ <td class="shortcode">&#91;testimonial_average_rating centered /&#93;</td>
328
+ </tr>
329
+ <tr>
330
+ <td>
331
+ <div class="strong-rating-wrapper average centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
332
+ <?php echo $stars; ?>
333
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
334
+ </div>
335
+ </td>
336
+ </tr>
337
+ </table>
338
+ </td>
339
+ </tr>
340
+ </table>
341
+
342
+ <table class="form-table shortcodes average">
343
+ <tr>
344
+ <td>
345
+ <p><code>rounded</code></p>
346
+ <p class="description"><?php esc_html_e( 'Round the rating(ex.: from 4.3 -> 4 or 4.7->5)', 'strong-testimonials' ); ?></p>
347
+ </td>
348
+ <td class="has-inner">
349
+ <table class="inner" cellpadding="0" cellspacing="0">
350
+ <tr>
351
+ <td class="shortcode">&#91;testimonial_average_rating rounded &#93;</td>
352
+ </tr>
353
+ <tr>
354
+ <td>
355
+ <div class="strong-rating-wrapper average"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
356
+ <?php echo $stars_rounded; ?>
357
+ <span class="strong-rating-summary"><?php esc_html_e( '4 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
358
+ </div>
359
+ </td>
360
+ </tr>
361
+ </table>
362
+ </td>
363
+ </tr>
364
+ </table>
365
+
366
+ <table class="form-table shortcodes average">
367
+ <tr>
368
+ <td>
369
+ <p><code>block</code> and <code>centered</code></p>
370
+ </td>
371
+ <td class="has-inner">
372
+ <table class="inner" cellpadding="0" cellspacing="0">
373
+ <tr>
374
+ <td class="shortcode">&#91;testimonial_average_rating block centered /&#93;</td>
375
+ </tr>
376
+ <tr>
377
+ <td>
378
+ <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
379
+ <?php echo $stars; ?>
380
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
381
+ </div>
382
+ </td>
383
+ </tr>
384
+ </table>
385
+ </td>
386
+ </tr>
387
+ </table>
388
+
389
+ <table class="form-table shortcodes average">
390
+ <tr>
391
+ <td>
392
+ <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
393
+ </td>
394
+ <td class="has-inner">
395
+ <table class="inner" cellpadding="0" cellspacing="0">
396
+ <tr>
397
+ <td class="shortcode">&#91;testimonial_average_rating element="span" /&#93;</td>
398
+ </tr>
399
+ <tr>
400
+ <td>
401
+ <span class="strong-rating-wrapper average">
402
+ <span class="strong-rating-title"><?php esc_html_e( 'Average Rating:', 'strong-testimonials' ); ?></span>
403
+ <?php echo $stars; ?>
404
+ <span class="strong-rating-summary"><?php esc_html_e( '4.3 stars (based on 9 ratings)', 'strong-testimonials' ); ?></span>
405
+ </span>
406
+ </td>
407
+ </tr>
408
+ </table>
409
+ </td>
410
+ </tr>
411
+ </table>
412
+
413
+ </div>
414
+ <?php
415
+ }
416
+
417
+ }
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">