Strong Testimonials - Version 2.36

Version Description

Download this release

Release Info

Developer machothemes
Plugin Icon 128x128 Strong Testimonials
Version 2.36
Comparing to
See all releases

Code changes from version 2.35 to 2.36

Files changed (127) hide show
  1. admin/about/class-strong-testimonials-about.php +15 -15
  2. admin/about/how-to.php +32 -32
  3. admin/about/links.php +9 -5
  4. admin/about/privacy.php +11 -11
  5. admin/admin-notices.php +44 -51
  6. admin/admin.php +21 -26
  7. admin/class-strong-testimonials-admin-list.php +23 -15
  8. admin/class-strong-testimonials-admin-scripts.php +65 -113
  9. admin/class-strong-testimonials-defaults.php +51 -54
  10. admin/class-strong-testimonials-help.php +118 -169
  11. admin/class-strong-testimonials-list-table.php +943 -1008
  12. admin/class-strong-testimonials-page-shortcodes.php +28 -28
  13. admin/class-strong-testimonials-post-editor.php +87 -100
  14. admin/class-strong-testimonials-updater.php +73 -56
  15. admin/class-strong-views-list-table.php +50 -53
  16. admin/class-walker-strong-category-checklist.php +8 -10
  17. admin/class-walker-strong-form-category-checklist.php +8 -10
  18. admin/compat.php +10 -11
  19. admin/custom-fields-ajax.php +8 -8
  20. admin/custom-fields.php +179 -177
  21. admin/form-preview.php +10 -12
  22. admin/menu/class-strong-testimonials-menu-fields.php +2 -2
  23. admin/menu/class-strong-testimonials-menu-settings.php +7 -7
  24. admin/menu/class-strong-testimonials-menu-shortcodes.php +2 -2
  25. admin/menu/class-strong-testimonials-menu-views.php +2 -2
  26. admin/menu/class-strong-testimonials-menu.php +22 -22
  27. admin/partials/fields/field-controls.php +2 -2
  28. admin/partials/fields/field-header.php +3 -3
  29. admin/partials/fields/field-label.php +8 -8
  30. admin/partials/fields/field-name.php +7 -8
  31. admin/partials/fields/field-text.php +5 -2
  32. admin/partials/fields/field-type.php +20 -19
  33. admin/partials/templates/form-preview-template.php +8 -8
  34. admin/partials/views/group-compat.php +2 -2
  35. admin/partials/views/group-extra.php +3 -3
  36. admin/partials/views/group-fields.php +5 -5
  37. admin/partials/views/group-form.php +3 -3
  38. admin/partials/views/group-query.php +14 -14
  39. admin/partials/views/group-slideshow.php +5 -5
  40. admin/partials/views/group-style.php +14 -14
  41. admin/partials/views/option-background.php +88 -88
  42. admin/partials/views/option-boilerplate.php +11 -11
  43. admin/partials/views/option-category.php +39 -39
  44. admin/partials/views/option-classes.php +4 -4
  45. admin/partials/views/option-client-section.php +6 -2
  46. admin/partials/views/option-color.php +33 -23
  47. admin/partials/views/option-content.php +90 -90
  48. admin/partials/views/option-divi.php +16 -15
  49. admin/partials/views/option-form-ajax.php +4 -3
  50. admin/partials/views/option-form-category.php +21 -21
  51. admin/partials/views/option-id.php +5 -5
  52. admin/partials/views/option-layout.php +65 -64
  53. admin/partials/views/option-limit.php +20 -18
  54. admin/partials/views/option-order.php +7 -7
  55. admin/partials/views/option-pagination.php +149 -129
  56. admin/partials/views/option-read-more-page.php +24 -23
  57. admin/partials/views/option-select.php +8 -8
  58. admin/partials/views/option-slideshow-behavior.php +27 -21
  59. admin/partials/views/option-slideshow-breakpoints.php +80 -66
  60. admin/partials/views/option-slideshow-navigation.php +62 -66
  61. admin/partials/views/option-slideshow-num.php +3 -3
  62. admin/partials/views/option-slideshow-transition.php +17 -13
  63. admin/partials/views/option-slideshow-type.php +14 -14
  64. admin/partials/views/option-template-list.php +14 -14
  65. admin/partials/views/option-thumbnail.php +23 -28
  66. admin/partials/views/option-title.php +16 -14
  67. admin/partials/views/template-input.php +6 -4
  68. admin/partials/views/template-not-found.php +19 -18
  69. admin/partials/views/template-options.php +64 -63
  70. admin/partials/views/view-mode.php +16 -15
  71. admin/partials/views/view-name.php +8 -7
  72. admin/partials/views/view-shortcode.php +14 -14
  73. admin/settings/class-strong-testimonials-settings-compat.php +230 -146
  74. admin/settings/class-strong-testimonials-settings-form.php +15 -26
  75. admin/settings/class-strong-testimonials-settings-general.php +10 -11
  76. admin/settings/class-strong-testimonials-settings-licenses.php +4 -5
  77. admin/settings/class-strong-testimonials-settings.php +12 -13
  78. admin/settings/partials/email-from.php +88 -72
  79. admin/settings/partials/email-to.php +24 -23
  80. admin/settings/partials/email.php +44 -35
  81. admin/settings/partials/form.php +258 -235
  82. admin/settings/partials/general.php +112 -137
  83. admin/settings/partials/licenses.php +6 -6
  84. admin/settings/partials/recipient.php +55 -40
  85. admin/view-list-order.php +5 -4
  86. admin/views-ajax.php +9 -17
  87. admin/views-validate.php +35 -34
  88. admin/views.php +183 -213
  89. changelog.txt +4 -1
  90. includes/class-strong-form.php +44 -32
  91. includes/class-strong-log.php +99 -103
  92. includes/class-strong-mail.php +42 -45
  93. includes/class-strong-templates.php +430 -427
  94. includes/class-strong-testimonials-order.php +10 -14
  95. includes/class-strong-testimonials-privacy.php +3 -1
  96. includes/class-strong-testimonials-render.php +9 -4
  97. includes/class-strong-testimonials-shortcode-average.php +32 -31
  98. includes/class-strong-testimonials-shortcode-count.php +1 -1
  99. includes/class-strong-testimonials-shortcode.php +8 -8
  100. includes/class-strong-view-display.php +382 -378
  101. includes/class-strong-view-form.php +215 -216
  102. includes/class-strong-view-slideshow.php +371 -369
  103. includes/class-strong-view.php +454 -450
  104. includes/class-walker-strong-category-checklist-front.php +8 -10
  105. includes/filters.php +0 -98
  106. includes/functions-activation.php +3 -3
  107. includes/functions-content.php +14 -17
  108. includes/functions-image.php +8 -9
  109. includes/functions-rating.php +36 -32
  110. includes/functions-template-form.php +182 -199
  111. includes/functions-template.php +45 -46
  112. includes/functions-views.php +8 -8
  113. includes/functions.php +102 -122
  114. includes/integrations/class-integration-captcha-pro.php +1 -1
  115. includes/integrations/class-integration-captcha.php +1 -1
  116. includes/integrations/class-integration-really-simple-captcha.php +9 -9
  117. includes/l10n-polylang.php +11 -31
  118. includes/l10n-wpml.php +8 -10
  119. includes/post-types.php +15 -20
  120. includes/retro.php +92 -92
  121. includes/scripts.php +80 -111
  122. includes/widget2.php +33 -31
  123. readme.txt +2 -2
  124. strong-testimonials.php +2 -2
  125. templates/default-form/form.php +10 -10
  126. templates/simple-form/form.php +10 -10
  127. templates/unstyled-form/form.php +10 -10
admin/about/class-strong-testimonials-about.php CHANGED
@@ -10,8 +10,8 @@ class Strong_Testimonials_About {
10
  * Strong_Testimonials_About constructor.
11
  */
12
  public function __construct() {
13
- $this->add_actions();
14
- }
15
 
16
  /**
17
  * Add actions and filters.
@@ -21,8 +21,8 @@ class Strong_Testimonials_About {
21
  }
22
 
23
  /**
24
- * Add submenu page.
25
- *
26
  * @param $pages
27
  *
28
  * @return mixed
@@ -40,8 +40,8 @@ class Strong_Testimonials_About {
40
  public function get_submenu() {
41
  return array(
42
  'page_title' => __( 'About' ),
43
- 'menu_title' => __( 'About' ),
44
- 'capability' => 'strong_testimonials_about',
45
  'menu_slug' => 'about-strong-testimonials',
46
  'function' => array( $this, 'about_page' ),
47
  );
@@ -58,26 +58,26 @@ class Strong_Testimonials_About {
58
  <div class="wrap about-wrap">
59
 
60
  <?php /* translators: %s is the plugin version number */ ?>
61
- <h1><?php printf( esc_html__( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), esc_html( $major_minor ) ); ?></h1>
62
 
63
  <p class="about-text">
64
- <?php esc_html_e( 'Thank you for updating to the latest version!' ); ?>
65
  <?php /* translators: %s is the plugin version number */ ?>
66
- </p>
67
 
68
- <div class="wp-badge strong-testimonials"><?php printf( esc_html__( 'Version %s' ), esc_html( $major_minor ) ); ?></div>
69
 
70
  <h2 class="nav-tab-wrapper wp-clearfix">
71
 
72
- <a href="<?php echo esc_url( add_query_arg( 'tab', 'how-to', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'How To', 'strong-testimonials' ); ?></a>
73
 
74
- <a href="<?php echo esc_url( add_query_arg( 'tab', 'privacy', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Privacy' ); ?></a>
75
 
76
  </h2>
77
 
78
 
79
  <?php
80
- switch ( $active_tab ) {
81
  case 'privacy':
82
  include WPMTST_ADMIN . 'about/privacy.php';
83
  break;
@@ -86,8 +86,8 @@ class Strong_Testimonials_About {
86
  break;
87
  }
88
 
89
- include WPMTST_ADMIN . 'about/links.php';
90
- include WPMTST_ADMIN . 'about/addons.php';
91
  ?>
92
 
93
  </div>
10
  * Strong_Testimonials_About constructor.
11
  */
12
  public function __construct() {
13
+ $this->add_actions();
14
+ }
15
 
16
  /**
17
  * Add actions and filters.
21
  }
22
 
23
  /**
24
+ * Add submenu page.
25
+ *
26
  * @param $pages
27
  *
28
  * @return mixed
40
  public function get_submenu() {
41
  return array(
42
  'page_title' => __( 'About' ),
43
+ 'menu_title' => __( 'About' ),
44
+ 'capability' => 'strong_testimonials_about',
45
  'menu_slug' => 'about-strong-testimonials',
46
  'function' => array( $this, 'about_page' ),
47
  );
58
  <div class="wrap about-wrap">
59
 
60
  <?php /* translators: %s is the plugin version number */ ?>
61
+ <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), $major_minor ); ?></h1>
62
 
63
  <p class="about-text">
64
+ <?php _e( 'Thank you for updating to the latest version!' ); ?>
65
  <?php /* translators: %s is the plugin version number */ ?>
66
+ </p>
67
 
68
+ <div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
69
 
70
  <h2 class="nav-tab-wrapper wp-clearfix">
71
 
72
+ <a href="<?php echo add_query_arg( 'tab', 'how-to', $url ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php _e( 'How To', 'strong-testimonials' ); ?></a>
73
 
74
+ <a href="<?php echo add_query_arg( 'tab', 'privacy', $url ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Privacy' ); ?></a>
75
 
76
  </h2>
77
 
78
 
79
  <?php
80
+ switch( $active_tab ) {
81
  case 'privacy':
82
  include WPMTST_ADMIN . 'about/privacy.php';
83
  break;
86
  break;
87
  }
88
 
89
+ include WPMTST_ADMIN. 'about/links.php';
90
+ include WPMTST_ADMIN. 'about/addons.php';
91
  ?>
92
 
93
  </div>
admin/about/how-to.php CHANGED
@@ -1,41 +1,41 @@
1
  <?php
2
  $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
  ?>
4
- <h2><?php esc_html_e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
- <p class="lead-description"><?php esc_html_e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
 
7
  <div class="feature-section two-col">
8
- <div class="col">
9
- <h3><?php esc_html_e( 'How to Add the Form', 'strong-testimonials' ); ?></h3>
10
- <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ) ) ); ?>
11
- </p>
12
- <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
13
- <?php wp_kses_post( _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ) ); ?>
14
- </p>
15
- <p>3. <?php echo esc_html( $add_the_view ); ?></p>
16
- </div>
17
 
18
- <div class="col">
19
- <h3><?php esc_html_e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
- <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
21
- <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
22
- <?php wp_kses_post( _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ) ); ?>
23
- </p>
24
- <p>3. <?php echo esc_html( $add_the_view ); ?></p>
25
- </div>
26
 
27
- <div class="col">
28
- <h3><?php esc_html_e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
- <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
30
- <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
31
- <?php wp_kses_post( _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ) ); ?>
32
- </p>
33
- <p>3. <?php echo esc_html( $add_the_view ); ?></p>
34
- </div>
35
 
36
- <div class="col">
37
- <h3><?php esc_html_e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
- <p><?php esc_html_e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
- <p><?php wp_kses_post( _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ) ); ?></p>
40
- </div>
41
  </div>
1
  <?php
2
  $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
  ?>
4
+ <h2><?php _e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
+ <p class="lead-description"><?php _e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
 
7
  <div class="feature-section two-col">
8
+ <div class="col">
9
+ <h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
10
+ <p>1. <?php printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ); ?>
11
+ </p>
12
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
13
+ <?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
14
+ </p>
15
+ <p>3. <?php echo $add_the_view; ?></p>
16
+ </div>
17
 
18
+ <div class="col">
19
+ <h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
+ <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
21
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
22
+ <?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
23
+ </p>
24
+ <p>3. <?php echo $add_the_view; ?></p>
25
+ </div>
26
 
27
+ <div class="col">
28
+ <h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
+ <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
30
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
31
+ <?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
32
+ </p>
33
+ <p>3. <?php echo $add_the_view; ?></p>
34
+ </div>
35
 
36
+ <div class="col">
37
+ <h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
+ <p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
+ <p><?php _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ); ?></p>
40
+ </div>
41
  </div>
admin/about/links.php CHANGED
@@ -1,15 +1,19 @@
1
  <hr />
2
 
3
  <div class="feature-section three-col">
4
- <div class="col">
5
- <h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
6
  <?php
7
- $links = array();
8
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ), __( 'Use the community support forum', 'strong-testimonials' ) );
 
 
 
 
9
  ?>
10
  <ul>
11
  <?php foreach ( $links as $link ) : ?>
12
- <li><?php echo wp_kses_post( $link ); ?></li>
13
  <?php endforeach; ?>
14
  </ul>
15
  </div>
1
  <hr />
2
 
3
  <div class="feature-section three-col">
4
+ <div class="col">
5
+ <h3><?php _e( 'Support', 'strong-testimonials' ); ?></h3>
6
  <?php
7
+ $links = array();
8
+
9
+ $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
10
+ esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ),
11
+ __( 'Use the community support forum', 'strong-testimonials' ) );
12
+
13
  ?>
14
  <ul>
15
  <?php foreach ( $links as $link ) : ?>
16
+ <li><?php echo $link; ?></li>
17
  <?php endforeach; ?>
18
  </ul>
19
  </div>
admin/about/privacy.php CHANGED
@@ -1,13 +1,13 @@
1
- <h2><?php esc_html_e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
- <p class="lead-description"><?php esc_html_e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
  <div class="feature-section one-col">
4
- <div class="col">
5
- <p><?php esc_html_e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
- <p><?php esc_html_e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
- <p><strong><?php esc_html_e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
- <p><?php esc_html_e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
- <p><?php esc_html_e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
- <p><?php esc_html_e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
- <p><?php esc_html_e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
- </div>
13
  </div>
1
+ <h2><?php _e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
+ <p class="lead-description"><?php _e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
  <div class="feature-section one-col">
4
+ <div class="col">
5
+ <p><?php _e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
+ <p><?php _e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
+ <p><strong><?php _e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
+ <p><?php _e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
+ <p><?php _e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
+ <p><?php _e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
+ <p><?php _e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
+ </div>
13
  </div>
admin/admin-notices.php CHANGED
@@ -33,15 +33,15 @@ function wpmtst_admin_notices() {
33
  return;
34
  }
35
 
36
- foreach ( $notices as $key => $notice ) {
37
- $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
- if ( $message ) {
39
- echo wp_kses_post( $message );
40
- }
41
- if ( ! $notice['persist'] ) {
42
- wpmtst_delete_admin_notice( $key );
43
- }
44
- }
45
  }
46
  add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
 
@@ -58,66 +58,61 @@ add_action( 'admin_notices', 'wpmtst_admin_notices' );
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(
99
- 'a' => array(
100
- 'class' => array(),
101
- 'href' => array(),
102
- ),
103
- );
104
  //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
105
  $settings_url = admin_url( '?action=captcha-options-changed' );
106
- $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%1$s">%2$s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
107
 
108
  ob_start();
109
  ?>
110
- <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
111
- <p>
112
- <?php echo wp_kses_post( _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ) ); ?>
113
- <?php echo wp_kses_post( $settings_link ); ?>
114
- </p>
115
- </div>
116
  <?php
117
  $html = ob_get_clean();
118
  break;
119
 
120
- default:
121
  // nothing
122
  }
123
 
@@ -135,7 +130,7 @@ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
135
  * @param $persist
136
  */
137
  function wpmtst_add_admin_notice( $key, $persist = false ) {
138
- $notices = get_option( 'wpmtst_admin_notices', array() );
139
  $notices[ $key ] = array( 'persist' => $persist );
140
  update_option( 'wpmtst_admin_notices', $notices );
141
  }
@@ -164,31 +159,29 @@ function wpmtst_delete_admin_notice( $key ) {
164
  * @param $value
165
  */
166
  function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
167
- if ( ! function_exists( 'get_current_screen' ) ) {
168
- return;
169
- }
170
-
171
- $screen = get_current_screen();
172
- if ( $screen && 'options' == $screen->base ) {
173
- if ( 'wpmtst_form_options' == $option ) {
174
- $notices = get_option( 'wpmtst_admin_notices', array() );
175
- if ( isset( $notices['captcha-options-changed'] ) ) {
176
- unset( $notices['captcha-options-changed'] );
177
- update_option( 'wpmtst_admin_notices', $notices );
178
- }
179
- }
180
- }
181
  }
182
  add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
183
 
184
 
185
  function wpmtst_admin_feedback_notice() {
186
-
187
  $screen = get_current_screen();
188
  if ( $screen->id !== 'edit-wpm-testimonial' ) {
189
  return;
190
  }
191
-
192
  ?>
193
  <div class="notice wpmtst-notice">
194
  <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/logo-long.svg" width="400"/>
@@ -197,4 +190,4 @@ function wpmtst_admin_feedback_notice() {
197
  </div>
198
  <?php
199
  }
200
- add_action( 'admin_notices', 'wpmtst_admin_feedback_notice' );
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
 
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 esc_attr_e( $key ); ?>">
65
  <p>
66
+ <?php _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 esc_attr_e( $key ); ?>">
77
  <p>
78
+ <?php _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 esc_attr_e( $key ); ?>">
89
  <p>
90
+ <?php _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 ), __( 'settings', 'strong-testimonials' ) );
102
 
103
  ob_start();
104
  ?>
105
+ <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
106
+ <p>
107
+ <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
+ <?php echo $settings_link; ?>
109
+ </p>
110
+ </div>
111
  <?php
112
  $html = ob_get_clean();
113
  break;
114
 
115
+ default :
116
  // nothing
117
  }
118
 
130
  * @param $persist
131
  */
132
  function wpmtst_add_admin_notice( $key, $persist = false ) {
133
+ $notices = get_option( 'wpmtst_admin_notices', array() );
134
  $notices[ $key ] = array( 'persist' => $persist );
135
  update_option( 'wpmtst_admin_notices', $notices );
136
  }
159
  * @param $value
160
  */
161
  function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
162
+ if ( ! function_exists( 'get_current_screen' ) ) {
163
+ return;
164
+ }
165
+
166
+ $screen = get_current_screen();
167
+ if ( $screen && 'options' == $screen->base ) {
168
+ if ( 'wpmtst_form_options' == $option ) {
169
+ $notices = get_option( 'wpmtst_admin_notices', array() );
170
+ if ( isset( $notices['captcha-options-changed'] ) ) {
171
+ unset( $notices['captcha-options-changed'] );
172
+ update_option( 'wpmtst_admin_notices', $notices );
173
+ }
174
+ }
175
+ }
176
  }
177
  add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
178
 
179
 
180
  function wpmtst_admin_feedback_notice() {
 
181
  $screen = get_current_screen();
182
  if ( $screen->id !== 'edit-wpm-testimonial' ) {
183
  return;
184
  }
 
185
  ?>
186
  <div class="notice wpmtst-notice">
187
  <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/logo-long.svg" width="400"/>
190
  </div>
191
  <?php
192
  }
193
+ add_action( 'admin_notices', 'wpmtst_admin_feedback_notice' );
admin/admin.php CHANGED
@@ -12,7 +12,7 @@
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 );
@@ -22,7 +22,7 @@ function wpmtst_version_check() {
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>' . _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( wp_kses_post( $message ) );
26
  }
27
  }
28
 
@@ -80,8 +80,8 @@ add_action( 'admin_init', 'wpmtst_admin_init' );
80
  */
81
  function wpmtst_action_captcha_options_changed() {
82
  wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
- exit;
85
  }
86
 
87
  add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
@@ -120,34 +120,29 @@ function wpmtst_is_testimonial_screen() {
120
  * @return mixed
121
  */
122
  function wpmtst_pending_indicator( $menu ) {
123
- if ( ! current_user_can( 'edit_posts' ) ) {
124
  return $menu;
125
- }
126
 
127
  $options = get_option( 'wpmtst_options' );
128
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] ) {
129
  return $menu;
130
- }
131
 
132
  $types = array( 'wpm-testimonial' );
133
  $status = 'pending';
134
  foreach ( $types as $type ) {
135
  $num_posts = wp_count_posts( $type, 'readable' );
136
  $pending_count = 0;
137
- if ( ! empty( $num_posts->$status ) ) {
138
  $pending_count = $num_posts->$status;
139
- }
140
 
141
- if ( $type == 'post' ) {
142
  $menu_str = 'edit.php';
143
- } else {
144
  $menu_str = 'edit.php?post_type=' . $type;
145
- }
146
 
147
  foreach ( $menu as $menu_key => $menu_data ) {
148
- if ( $menu_str != $menu_data[2] ) {
149
  continue;
150
- }
151
  $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
152
  }
153
  }
@@ -164,11 +159,12 @@ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
164
  * @since 2.18.0
165
  */
166
  function wpmtst_restore_default_icon( $for ) {
167
- if ( ! $for ) {
168
- return;
169
- }
170
  ?>
171
- <input type="button" class="button secondary restore-default" title="<?php esc_attr_e( 'restore default', 'strong-testimonials' ); ?>" value="&#xf171" data-for="<?php echo esc_attr( $for ); ?>"/>
 
 
 
172
  <?php
173
  }
174
 
@@ -197,7 +193,7 @@ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
197
  * @param $key
198
  */
199
  function wpmtst_add_config_error( $key ) {
200
- $errors = get_option( 'wpmtst_config_errors', array() );
201
  $errors[] = $key;
202
  update_option( 'wpmtst_config_errors', array_unique( $errors ) );
203
 
@@ -213,7 +209,7 @@ function wpmtst_add_config_error( $key ) {
213
  */
214
  function wpmtst_delete_config_error( $key ) {
215
  $errors = get_option( 'wpmtst_config_errors', array() );
216
- $errors = array_diff( $errors, array( $key ) );
217
  update_option( 'wpmtst_config_errors', $errors );
218
 
219
  wpmtst_delete_admin_notice( $key );
@@ -232,9 +228,7 @@ function wpmtst_delete_config_error( $key ) {
232
  function wpmtst_save_view( $view, $action = 'edit' ) {
233
  global $wpdb;
234
 
235
- if ( ! $view ) {
236
- return false;
237
- }
238
 
239
  $table_name = $wpdb->prefix . 'strong_views';
240
  $serialized = serialize( $view['data'] );
@@ -244,8 +238,9 @@ function wpmtst_save_view( $view, $action = 'edit' ) {
244
  $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
245
  $wpdb->query( $sql );
246
  $view['id'] = $wpdb->insert_id;
247
- $return = $view['id'];
248
- } else {
 
249
  $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
250
  $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
251
  $wpdb->query( $sql );
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 );
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>' . _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
 
80
  */
81
  function wpmtst_action_captcha_options_changed() {
82
  wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
+ exit;
85
  }
86
 
87
  add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
120
  * @return mixed
121
  */
122
  function wpmtst_pending_indicator( $menu ) {
123
+ if ( ! current_user_can( 'edit_posts' ) )
124
  return $menu;
 
125
 
126
  $options = get_option( 'wpmtst_options' );
127
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
128
  return $menu;
 
129
 
130
  $types = array( 'wpm-testimonial' );
131
  $status = 'pending';
132
  foreach ( $types as $type ) {
133
  $num_posts = wp_count_posts( $type, 'readable' );
134
  $pending_count = 0;
135
+ if ( ! empty( $num_posts->$status ) )
136
  $pending_count = $num_posts->$status;
 
137
 
138
+ if ( $type == 'post' )
139
  $menu_str = 'edit.php';
140
+ else
141
  $menu_str = 'edit.php?post_type=' . $type;
 
142
 
143
  foreach ( $menu as $menu_key => $menu_data ) {
144
+ if ( $menu_str != $menu_data[2] )
145
  continue;
 
146
  $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
147
  }
148
  }
159
  * @since 2.18.0
160
  */
161
  function wpmtst_restore_default_icon( $for ) {
162
+ if ( !$for ) return;
 
 
163
  ?>
164
+ <input type="button" class="button secondary restore-default"
165
+ title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
166
+ value="&#xf171"
167
+ data-for="<?php echo $for; ?>"/>
168
  <?php
169
  }
170
 
193
  * @param $key
194
  */
195
  function wpmtst_add_config_error( $key ) {
196
+ $errors = get_option( 'wpmtst_config_errors', array() );
197
  $errors[] = $key;
198
  update_option( 'wpmtst_config_errors', array_unique( $errors ) );
199
 
209
  */
210
  function wpmtst_delete_config_error( $key ) {
211
  $errors = get_option( 'wpmtst_config_errors', array() );
212
+ $errors = array_diff( $errors, array ( $key ) );
213
  update_option( 'wpmtst_config_errors', $errors );
214
 
215
  wpmtst_delete_admin_notice( $key );
228
  function wpmtst_save_view( $view, $action = 'edit' ) {
229
  global $wpdb;
230
 
231
+ if ( ! $view ) return false;
 
 
232
 
233
  $table_name = $wpdb->prefix . 'strong_views';
234
  $serialized = serialize( $view['data'] );
238
  $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
239
  $wpdb->query( $sql );
240
  $view['id'] = $wpdb->insert_id;
241
+ $return = $view['id'];
242
+ }
243
+ else {
244
  $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
245
  $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
246
  $wpdb->query( $sql );
admin/class-strong-testimonials-admin-list.php CHANGED
@@ -109,7 +109,9 @@ class Strong_Testimonials_Admin_List {
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
  // 5. add [category], [comments] and [date]
@@ -144,40 +146,40 @@ class Strong_Testimonials_Admin_List {
144
 
145
  switch ( $column ) {
146
 
147
- case 'post_id':
148
- echo wp_kses_post( $post->ID );
149
  break;
150
 
151
- case 'post_content':
152
- echo wp_kses_post( substr( $post->post_content, 0, 100 ) ) . '&hellip;';
153
  break;
154
 
155
- case 'post_excerpt':
156
- echo wp_kses_post( $post->post_excerpt );
157
  break;
158
 
159
- case 'strong_thumbnail':
160
  echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
161
  break;
162
 
163
- case 'category':
164
  $categories = get_the_terms( 0, 'wpm-testimonial-category' );
165
  if ( $categories && ! is_wp_error( $categories ) ) {
166
  $list = array();
167
  foreach ( $categories as $cat ) {
168
  $list[] = $cat->name;
169
  }
170
- echo wp_kses_post( join( ', ', $list ) );
171
  }
172
  break;
173
 
174
- case 'handle':
175
  if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
176
  echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
177
  }
178
  break;
179
 
180
- default:
181
  // custom field?
182
  $custom = get_post_custom();
183
  $fields = wpmtst_get_custom_fields();
@@ -187,25 +189,31 @@ class Strong_Testimonials_Admin_List {
187
  if ( isset( $fields[ $column ] ) ) {
188
 
189
  switch ( $fields[ $column ]['input_type'] ) {
190
- case 'rating':
191
  wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
192
  break;
193
- case 'checkbox':
194
  echo $custom[ $column ][0] ? 'yes' : 'no';
195
  break;
196
- default:
197
- echo wp_kses_post( $custom[ $column ][0] );
198
  }
 
199
  }
 
200
  } else {
201
 
202
  if ( isset( $fields[ $column ] ) ) {
203
 
204
  if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
205
  echo 'no';
 
 
206
  }
 
207
  }
208
  }
 
209
  }
210
  }
211
 
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]
146
 
147
  switch ( $column ) {
148
 
149
+ case 'post_id' :
150
+ echo $post->ID;
151
  break;
152
 
153
+ case 'post_content' :
154
+ echo substr( $post->post_content, 0, 100 ) . '&hellip;';
155
  break;
156
 
157
+ case 'post_excerpt' :
158
+ echo $post->post_excerpt;
159
  break;
160
 
161
+ case 'strong_thumbnail' :
162
  echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
163
  break;
164
 
165
+ case 'category' :
166
  $categories = get_the_terms( 0, 'wpm-testimonial-category' );
167
  if ( $categories && ! is_wp_error( $categories ) ) {
168
  $list = array();
169
  foreach ( $categories as $cat ) {
170
  $list[] = $cat->name;
171
  }
172
+ echo join( ", ", $list );
173
  }
174
  break;
175
 
176
+ case 'handle' :
177
  if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
178
  echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
179
  }
180
  break;
181
 
182
+ default :
183
  // custom field?
184
  $custom = get_post_custom();
185
  $fields = wpmtst_get_custom_fields();
189
  if ( isset( $fields[ $column ] ) ) {
190
 
191
  switch ( $fields[ $column ]['input_type'] ) {
192
+ case 'rating' :
193
  wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
194
  break;
195
+ case 'checkbox' :
196
  echo $custom[ $column ][0] ? 'yes' : 'no';
197
  break;
198
+ default :
199
+ echo $custom[ $column ][0];
200
  }
201
+
202
  }
203
+
204
  } else {
205
 
206
  if ( isset( $fields[ $column ] ) ) {
207
 
208
  if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
209
  echo 'no';
210
+ } else {
211
+ // display nothing
212
  }
213
+
214
  }
215
  }
216
+
217
  }
218
  }
219
 
admin/class-strong-testimonials-admin-scripts.php CHANGED
@@ -45,119 +45,91 @@ class Strong_Testimonials_Admin_Scripts {
45
 
46
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
47
 
48
- wp_register_style(
49
- 'wpmtst-font-awesome',
50
  WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
51
  array(),
52
- '4.6.3'
53
- );
54
 
55
- wp_register_script(
56
- 'wpmtst-help',
57
  WPMTST_ADMIN_URL . 'js/help.js',
58
  array( 'jquery' ),
59
  $plugin_version,
60
- true
61
- );
62
 
63
- wp_register_script(
64
- 'wpmtst-admin-script',
65
  WPMTST_ADMIN_URL . 'js/admin.js',
66
  array( 'jquery', 'underscore' ),
67
  $plugin_version,
68
- true
69
- );
70
 
71
- wp_register_style(
72
- 'wpmtst-admin-style',
73
  WPMTST_ADMIN_URL . 'css/admin.css',
74
  array( 'wpmtst-font-awesome' ),
75
- $plugin_version
76
- );
77
 
78
- wp_register_style(
79
- 'wpmtst-post-editor',
80
  WPMTST_ADMIN_URL . 'css/post-editor.css',
81
  array( 'wpmtst-font-awesome' ),
82
- $plugin_version
83
- );
84
 
85
- wp_register_script(
86
- 'wpmtst-custom-spinner',
87
- WPMTST_ADMIN_URL . 'js/custom-spinner.js',
88
- array( 'jquery' ),
89
- $plugin_version,
90
- true
91
- );
92
 
93
- wp_register_script(
94
- 'autosize',
95
  WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
96
  array(),
97
  '4.0.1',
98
- true
99
- );
100
 
101
  /**
102
  * Form tab
103
  */
104
- wp_register_style(
105
- 'wpmtst-admin-form-style',
106
- WPMTST_ADMIN_URL . 'css/admin-form.css',
107
- array( 'wpmtst-admin-style' ),
108
- $plugin_version
109
- );
110
 
111
- wp_register_script(
112
- 'wpmtst-admin-form-script',
113
- WPMTST_ADMIN_URL . 'js/admin-form.js',
114
- array( 'wpmtst-admin-script', 'autosize' ),
115
- $plugin_version,
116
- true
117
- );
118
 
119
  /**
120
  * Compatibility tab
121
  */
122
- wp_register_style(
123
- 'wpmtst-admin-compat-style',
124
- WPMTST_ADMIN_URL . 'css/admin-compat.css',
125
- array(),
126
- $plugin_version
127
- );
128
 
129
- wp_register_script(
130
- 'wpmtst-admin-compat-script',
131
- WPMTST_ADMIN_URL . 'js/admin-compat.js',
132
- array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
133
- $plugin_version,
134
- true
135
- );
136
 
137
  /**
138
  * Fields
139
  */
140
- wp_register_style(
141
- 'wpmtst-admin-fields-style',
142
  WPMTST_ADMIN_URL . 'css/fields.css',
143
  array(),
144
- $plugin_version
145
- );
146
 
147
- wp_register_style(
148
- 'wpmtst-admin-form-preview',
149
  WPMTST_ADMIN_URL . 'css/form-preview.css',
150
  array(),
151
- $plugin_version
152
- );
153
 
154
- wp_register_script(
155
- 'wpmtst-admin-fields-script',
156
  WPMTST_ADMIN_URL . 'js/admin-fields.js',
157
  array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
158
  $plugin_version,
159
- true
160
- );
161
 
162
  $params = array(
163
  'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
@@ -170,45 +142,35 @@ class Strong_Testimonials_Admin_Scripts {
170
  /**
171
  * Ratings
172
  */
173
- wp_register_style(
174
- 'wpmtst-rating-display',
175
  WPMTST_PUBLIC_URL . 'css/rating-display.css',
176
  array( 'wpmtst-font-awesome' ),
177
- $plugin_version
178
- );
179
 
180
- wp_register_style(
181
- 'wpmtst-rating-form',
182
  WPMTST_PUBLIC_URL . 'css/rating-form.css',
183
  array( 'wpmtst-font-awesome' ),
184
- $plugin_version
185
- );
186
 
187
- wp_register_script(
188
- 'wpmtst-rating-script',
189
  WPMTST_ADMIN_URL . 'js/rating-edit.js',
190
  array( 'jquery' ),
191
  $plugin_version,
192
- true
193
- );
194
 
195
  /**
196
  * Views
197
  */
198
- wp_register_style(
199
- 'wpmtst-admin-views-style',
200
  WPMTST_ADMIN_URL . 'css/views.css',
201
  array(),
202
- $plugin_version
203
- );
204
 
205
- wp_register_script(
206
- 'wpmtst-admin-views-script',
207
  WPMTST_ADMIN_URL . 'js/views.js',
208
  array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
209
  $plugin_version,
210
- true
211
- );
212
 
213
  /**
214
  * Category filter in View editor.
@@ -218,33 +180,27 @@ class Strong_Testimonials_Admin_Scripts {
218
  *
219
  * @since 2.2.0
220
  */
221
- wp_register_script(
222
- 'wpmtst-view-category-filter-script',
223
  WPMTST_ADMIN_URL . 'js/view-category-filter.js',
224
  array( 'jquery' ),
225
  $plugin_version,
226
- true
227
- );
228
 
229
- wp_register_style(
230
- 'wpmtst-about-style',
231
  WPMTST_ADMIN_URL . 'css/about.css',
232
  array(),
233
- $plugin_version
234
- );
235
 
236
  /**
237
  * Add-on licenses
238
  *
239
  * @since 2.18
240
  */
241
- wp_register_script(
242
- 'wpmtst-addons-script',
243
  WPMTST_ADMIN_URL . 'js/addon-licenses.js',
244
  array( 'jquery' ),
245
  $plugin_version,
246
- true
247
- );
248
 
249
  $params = array(
250
  'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
@@ -259,13 +215,11 @@ class Strong_Testimonials_Admin_Scripts {
259
  *
260
  * @since 2.18
261
  */
262
- wp_register_script(
263
- 'wpmtst-ays-script',
264
  WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
265
  array( 'jquery' ),
266
  $plugin_version,
267
- true
268
- );
269
  }
270
 
271
  /**
@@ -274,19 +228,17 @@ class Strong_Testimonials_Admin_Scripts {
274
  public static function admin_enqueue_scripts() {
275
  $plugin_version = get_option( 'wpmtst_plugin_version' );
276
 
277
- wp_enqueue_script(
278
- 'wpmtst-admin-global',
279
- WPMTST_ADMIN_URL . 'js/admin-global.js',
280
- array( 'jquery' ),
281
- $plugin_version,
282
- true
283
- );
284
 
285
  wp_localize_script(
286
  'wpmtst-admin-global',
287
  'wpmtst_admin',
288
  array(
289
- 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
290
  'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
291
  )
292
  );
45
 
46
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
47
 
48
+ wp_register_style( 'wpmtst-font-awesome',
 
49
  WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
50
  array(),
51
+ '4.6.3' );
 
52
 
53
+ wp_register_script( 'wpmtst-help',
 
54
  WPMTST_ADMIN_URL . 'js/help.js',
55
  array( 'jquery' ),
56
  $plugin_version,
57
+ true );
 
58
 
59
+ wp_register_script( 'wpmtst-admin-script',
 
60
  WPMTST_ADMIN_URL . 'js/admin.js',
61
  array( 'jquery', 'underscore' ),
62
  $plugin_version,
63
+ true );
 
64
 
65
+ wp_register_style( 'wpmtst-admin-style',
 
66
  WPMTST_ADMIN_URL . 'css/admin.css',
67
  array( 'wpmtst-font-awesome' ),
68
+ $plugin_version );
 
69
 
70
+ wp_register_style( 'wpmtst-post-editor',
 
71
  WPMTST_ADMIN_URL . 'css/post-editor.css',
72
  array( 'wpmtst-font-awesome' ),
73
+ $plugin_version );
 
74
 
75
+ wp_register_script( 'wpmtst-custom-spinner',
76
+ WPMTST_ADMIN_URL . 'js/custom-spinner.js',
77
+ array( 'jquery' ),
78
+ $plugin_version,
79
+ true );
 
 
80
 
81
+ wp_register_script( 'autosize',
 
82
  WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
83
  array(),
84
  '4.0.1',
85
+ true );
 
86
 
87
  /**
88
  * Form tab
89
  */
90
+ wp_register_style( 'wpmtst-admin-form-style',
91
+ WPMTST_ADMIN_URL . 'css/admin-form.css',
92
+ array( 'wpmtst-admin-style' ),
93
+ $plugin_version );
 
 
94
 
95
+ wp_register_script( 'wpmtst-admin-form-script',
96
+ WPMTST_ADMIN_URL . 'js/admin-form.js',
97
+ array( 'wpmtst-admin-script', 'autosize' ),
98
+ $plugin_version,
99
+ true );
 
 
100
 
101
  /**
102
  * Compatibility tab
103
  */
104
+ wp_register_style( 'wpmtst-admin-compat-style',
105
+ WPMTST_ADMIN_URL . 'css/admin-compat.css',
106
+ array(),
107
+ $plugin_version );
 
 
108
 
109
+ wp_register_script( 'wpmtst-admin-compat-script',
110
+ WPMTST_ADMIN_URL . 'js/admin-compat.js',
111
+ array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
112
+ $plugin_version,
113
+ true );
 
 
114
 
115
  /**
116
  * Fields
117
  */
118
+ wp_register_style( 'wpmtst-admin-fields-style',
 
119
  WPMTST_ADMIN_URL . 'css/fields.css',
120
  array(),
121
+ $plugin_version );
 
122
 
123
+ wp_register_style( 'wpmtst-admin-form-preview',
 
124
  WPMTST_ADMIN_URL . 'css/form-preview.css',
125
  array(),
126
+ $plugin_version );
 
127
 
128
+ wp_register_script( 'wpmtst-admin-fields-script',
 
129
  WPMTST_ADMIN_URL . 'js/admin-fields.js',
130
  array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
131
  $plugin_version,
132
+ true );
 
133
 
134
  $params = array(
135
  'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
142
  /**
143
  * Ratings
144
  */
145
+ wp_register_style( 'wpmtst-rating-display',
 
146
  WPMTST_PUBLIC_URL . 'css/rating-display.css',
147
  array( 'wpmtst-font-awesome' ),
148
+ $plugin_version );
 
149
 
150
+ wp_register_style( 'wpmtst-rating-form',
 
151
  WPMTST_PUBLIC_URL . 'css/rating-form.css',
152
  array( 'wpmtst-font-awesome' ),
153
+ $plugin_version );
 
154
 
155
+ wp_register_script( 'wpmtst-rating-script',
 
156
  WPMTST_ADMIN_URL . 'js/rating-edit.js',
157
  array( 'jquery' ),
158
  $plugin_version,
159
+ true );
 
160
 
161
  /**
162
  * Views
163
  */
164
+ wp_register_style( 'wpmtst-admin-views-style',
 
165
  WPMTST_ADMIN_URL . 'css/views.css',
166
  array(),
167
+ $plugin_version );
 
168
 
169
+ wp_register_script( 'wpmtst-admin-views-script',
 
170
  WPMTST_ADMIN_URL . 'js/views.js',
171
  array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
172
  $plugin_version,
173
+ true );
 
174
 
175
  /**
176
  * Category filter in View editor.
180
  *
181
  * @since 2.2.0
182
  */
183
+ wp_register_script( 'wpmtst-view-category-filter-script',
 
184
  WPMTST_ADMIN_URL . 'js/view-category-filter.js',
185
  array( 'jquery' ),
186
  $plugin_version,
187
+ true );
 
188
 
189
+ wp_register_style( 'wpmtst-about-style',
 
190
  WPMTST_ADMIN_URL . 'css/about.css',
191
  array(),
192
+ $plugin_version );
 
193
 
194
  /**
195
  * Add-on licenses
196
  *
197
  * @since 2.18
198
  */
199
+ wp_register_script( 'wpmtst-addons-script',
 
200
  WPMTST_ADMIN_URL . 'js/addon-licenses.js',
201
  array( 'jquery' ),
202
  $plugin_version,
203
+ true );
 
204
 
205
  $params = array(
206
  'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
215
  *
216
  * @since 2.18
217
  */
218
+ wp_register_script( 'wpmtst-ays-script',
 
219
  WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
220
  array( 'jquery' ),
221
  $plugin_version,
222
+ true );
 
223
  }
224
 
225
  /**
228
  public static function admin_enqueue_scripts() {
229
  $plugin_version = get_option( 'wpmtst_plugin_version' );
230
 
231
+ wp_enqueue_script( 'wpmtst-admin-global',
232
+ WPMTST_ADMIN_URL . 'js/admin-global.js',
233
+ array( 'jquery' ),
234
+ $plugin_version,
235
+ true );
 
 
236
 
237
  wp_localize_script(
238
  'wpmtst-admin-global',
239
  'wpmtst_admin',
240
  array(
241
+ 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
242
  'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
243
  )
244
  );
admin/class-strong-testimonials-defaults.php CHANGED
@@ -54,36 +54,33 @@ class Strong_Testimonials_Defaults {
54
  * @return array
55
  */
56
  public static function get_field_base() {
57
- return apply_filters(
58
- 'wpmtst_field_base',
59
- array(
60
- 'name' => '',
61
- 'name_mutable' => 1,
62
- 'label' => '',
63
- 'show_label' => 1,
64
- 'input_type' => '',
65
- 'action_input' => '',
66
- 'action_output' => '',
67
- 'text' => '',
68
- 'show_text_option' => 0,
69
- 'required' => 0,
70
- 'show_required_option' => 1,
71
- 'default_form_value' => '',
72
- 'default_display_value' => '',
73
- 'show_default_options' => 1,
74
- 'error' => __( 'This field is required.', 'strong-testimonials' ),
75
- 'placeholder' => '',
76
- 'show_placeholder_option' => 1,
77
- 'before' => '',
78
- 'after' => '',
79
- 'admin_table' => 0,
80
- 'admin_table_option' => 1,
81
- 'show_admin_table_option' => 1,
82
- 'shortcode_on_form' => '',
83
- 'shortcode_on_display' => '',
84
- 'show_shortcode_options' => 0,
85
- )
86
- );
87
  }
88
 
89
  /**
@@ -477,7 +474,7 @@ class Strong_Testimonials_Defaults {
477
  public static function get_view_options() {
478
  $default_view_options = array(
479
 
480
- 'mode' => array(
481
  'display' => array(
482
  'name' => 'display',
483
  'label' => __( 'Display', 'strong-testimonials' ),
@@ -500,33 +497,33 @@ class Strong_Testimonials_Defaults {
500
  ),
501
  ),
502
 
503
- 'order' => array(
504
  'random' => _x( 'random', 'display order', 'strong-testimonials' ),
505
  'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
506
  'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
507
  'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
508
  ),
509
 
510
- 'slideshow_effect' => array(
511
  'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
512
  'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
513
  'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
514
  'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
515
  ),
516
 
517
- 'slideshow_height' => array(
518
  'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
519
  'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
520
  ),
521
 
522
- 'slideshow_nav_method' => array(
523
  'controls' => array(
524
  'none' => array(
525
  'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
526
  'args' => array( // base args; style will add more args
527
- 'controls' => 0,
528
- 'pager' => 0,
529
- 'autoControls' => 0,
530
  ),
531
  ),
532
  'full' => array(
@@ -661,11 +658,11 @@ class Strong_Testimonials_Defaults {
661
  public static function get_default_view() {
662
  $default_view = array(
663
  'background' => array(
664
- 'color' => '',
665
- 'type' => '',
666
- 'preset' => '',
667
- 'gradient1' => '',
668
- 'gradient2' => '',
669
  ),
670
  'category' => 'all',
671
  'class' => '',
@@ -692,7 +689,7 @@ class Strong_Testimonials_Defaults {
692
  'count' => -1,
693
  'divi_builder' => 0,
694
  'excerpt_length' => 55,
695
- 'font-color' => array(
696
  'color' => '',
697
  'type' => '',
698
  ),
@@ -733,13 +730,13 @@ class Strong_Testimonials_Defaults {
733
  'after_page_number' => '',
734
  ),
735
  'slideshow_settings' => array(
736
- 'type' => 'show_single', // or show_multiple
737
- 'show_single' => array(
738
  'max_slides' => 1,
739
  'move_slides' => 1,
740
  'margin' => 1,
741
  ),
742
- 'breakpoints' => array(
743
  'desktop' => array(
744
  'description' => 'Desktop',
745
  'width' => 1200,
@@ -822,16 +819,16 @@ class Strong_Testimonials_Defaults {
822
  'event' => '',
823
  'script' => '',
824
  ),
825
- 'controller' => array(
826
  'initialize_on' => 'documentReady', // or windowLoad
827
  ),
828
- 'lazyload' => array(
829
  'enabled' => '',
830
  'classes' => array( // may be multiple pairs
831
  array(
832
  'start' => '',
833
  'finish' => '',
834
- ),
835
  ),
836
  ),
837
  );
@@ -846,7 +843,7 @@ class Strong_Testimonials_Defaults {
846
  */
847
  public static function get_captcha_plugins() {
848
  $plugins = array(
849
- 'google-captcha' => array(
850
  'name' => 'Google Captcha by BestWebSoft (free)',
851
  'desc' => __( '<strong>Recommended.</strong> The best choice for both Invisible reCAPTCHA and reCAPTCHA V2 ("I\'m not a robot" checkbox).', 'strong-testimonials' ),
852
  'class' => 'Google_Captcha',
@@ -857,18 +854,18 @@ class Strong_Testimonials_Defaults {
857
  'installed' => false,
858
  'active' => false,
859
  ),
860
- 'captcha-pro' => array(
861
  'name' => 'Captcha Pro by BestWebSoft (premium)',
862
  'desc' => __( 'An excellent plugin for math- and image-based captchas.', 'strong-testimonials' ),
863
  'class' => 'Captcha_Pro',
864
  'file' => 'captcha-pro/captcha_pro.php',
865
  'settings' => 'admin.php?page=captcha_pro.php',
866
- 'search' => '',
867
  'url' => 'https://bestwebsoft.com/products/wordpress/plugins/captcha/',
868
  'installed' => false,
869
  'active' => false,
870
  ),
871
- 'really-simple-captcha' => array(
872
  'name' => 'Really Simple Captcha by Takayuki Miyoshi (free)',
873
  'class' => 'Really_Simple_Captcha',
874
  'file' => 'really-simple-captcha/really-simple-captcha.php',
54
  * @return array
55
  */
56
  public static function get_field_base() {
57
+ return apply_filters( 'wpmtst_field_base', array(
58
+ 'name' => '',
59
+ 'name_mutable' => 1,
60
+ 'label' => '',
61
+ 'show_label' => 1,
62
+ 'input_type' => '',
63
+ 'action_input' => '',
64
+ 'action_output' => '',
65
+ 'text' => '',
66
+ 'show_text_option' => 0,
67
+ 'required' => 0,
68
+ 'show_required_option' => 1,
69
+ 'default_form_value' => '',
70
+ 'default_display_value' => '',
71
+ 'show_default_options' => 1,
72
+ 'error' => __( 'This field is required.', 'strong-testimonials' ),
73
+ 'placeholder' => '',
74
+ 'show_placeholder_option' => 1,
75
+ 'before' => '',
76
+ 'after' => '',
77
+ 'admin_table' => 0,
78
+ 'admin_table_option' => 1,
79
+ 'show_admin_table_option' => 1,
80
+ 'shortcode_on_form' => '',
81
+ 'shortcode_on_display' => '',
82
+ 'show_shortcode_options' => 0,
83
+ ) );
 
 
 
84
  }
85
 
86
  /**
474
  public static function get_view_options() {
475
  $default_view_options = array(
476
 
477
+ 'mode' => array(
478
  'display' => array(
479
  'name' => 'display',
480
  'label' => __( 'Display', 'strong-testimonials' ),
497
  ),
498
  ),
499
 
500
+ 'order' => array(
501
  'random' => _x( 'random', 'display order', 'strong-testimonials' ),
502
  'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
503
  'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
504
  'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
505
  ),
506
 
507
+ 'slideshow_effect' => array(
508
  'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
509
  'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
510
  'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
511
  'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
512
  ),
513
 
514
+ 'slideshow_height' => array(
515
  'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
516
  'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
517
  ),
518
 
519
+ 'slideshow_nav_method' => array(
520
  'controls' => array(
521
  'none' => array(
522
  'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
523
  'args' => array( // base args; style will add more args
524
+ 'controls' => 0,
525
+ 'pager' => 0,
526
+ 'autoControls' => 0,
527
  ),
528
  ),
529
  'full' => array(
658
  public static function get_default_view() {
659
  $default_view = array(
660
  'background' => array(
661
+ 'color' => '',
662
+ 'type' => '',
663
+ 'preset' => '',
664
+ 'gradient1' => '',
665
+ 'gradient2' => '',
666
  ),
667
  'category' => 'all',
668
  'class' => '',
689
  'count' => -1,
690
  'divi_builder' => 0,
691
  'excerpt_length' => 55,
692
+ 'font-color' => array(
693
  'color' => '',
694
  'type' => '',
695
  ),
730
  'after_page_number' => '',
731
  ),
732
  'slideshow_settings' => array(
733
+ 'type' => 'show_single', // or show_multiple
734
+ 'show_single' => array(
735
  'max_slides' => 1,
736
  'move_slides' => 1,
737
  'margin' => 1,
738
  ),
739
+ 'breakpoints' => array(
740
  'desktop' => array(
741
  'description' => 'Desktop',
742
  'width' => 1200,
819
  'event' => '',
820
  'script' => '',
821
  ),
822
+ 'controller' => array(
823
  'initialize_on' => 'documentReady', // or windowLoad
824
  ),
825
+ 'lazyload' => array(
826
  'enabled' => '',
827
  'classes' => array( // may be multiple pairs
828
  array(
829
  'start' => '',
830
  'finish' => '',
831
+ )
832
  ),
833
  ),
834
  );
843
  */
844
  public static function get_captcha_plugins() {
845
  $plugins = array(
846
+ 'google-captcha' => array(
847
  'name' => 'Google Captcha by BestWebSoft (free)',
848
  'desc' => __( '<strong>Recommended.</strong> The best choice for both Invisible reCAPTCHA and reCAPTCHA V2 ("I\'m not a robot" checkbox).', 'strong-testimonials' ),
849
  'class' => 'Google_Captcha',
854
  'installed' => false,
855
  'active' => false,
856
  ),
857
+ 'captcha-pro' => array(
858
  'name' => 'Captcha Pro by BestWebSoft (premium)',
859
  'desc' => __( 'An excellent plugin for math- and image-based captchas.', 'strong-testimonials' ),
860
  'class' => 'Captcha_Pro',
861
  'file' => 'captcha-pro/captcha_pro.php',
862
  'settings' => 'admin.php?page=captcha_pro.php',
863
+ 'search' => '',
864
  'url' => 'https://bestwebsoft.com/products/wordpress/plugins/captcha/',
865
  'installed' => false,
866
  'active' => false,
867
  ),
868
+ 'really-simple-captcha' => array(
869
  'name' => 'Really Simple Captcha by Takayuki Miyoshi (free)',
870
  'class' => 'Really_Simple_Captcha',
871
  'file' => 'really-simple-captcha/really-simple-captcha.php',
admin/class-strong-testimonials-help.php CHANGED
@@ -9,10 +9,10 @@ class Strong_Testimonials_Help {
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
  }
@@ -27,81 +27,40 @@ class Strong_Testimonials_Help {
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
34
- printf(
35
- wp_kses(
36
- __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ),
37
- array(
38
- 'a' => array(
39
- 'href' => array(),
40
- 'target' => array(),
41
- ),
42
- )
43
- ),
44
- esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' )
45
- );
46
- ?>
47
- |
48
- <?php
49
- printf(
50
- wp_kses(
51
- __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ),
52
- array(
53
- 'a' => array(
54
- 'href' => array(),
55
- 'target' => array(),
56
- ),
57
- )
58
- ),
59
- esc_url( 'https://codepen.io/micikato/full/JroPNm/' )
60
- );
61
- ?>
62
- |
63
- <?php
64
- printf(
65
- wp_kses(
66
- __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ),
67
- array(
68
- 'a' => array(
69
- 'href' => array(),
70
- 'target' => array(),
71
- ),
72
- )
73
- ),
74
- esc_url( 'https://css-tricks.com/fout-foit-foft/' )
75
- );
76
- ?>
77
- </p>
78
- <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>
79
- <p><?php esc_html_e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
80
- <?php
81
  $content = ob_get_clean();
82
 
83
- get_current_screen()->add_help_tab(
84
- array(
85
  'id' => 'wpmtst-help-prerender',
86
  'title' => __( 'Prerender', 'strong-testimonials' ),
87
  'content' => $content,
88
- )
89
- );
90
  }
91
 
92
  /**
93
  * Custom fields editor.
94
  */
95
  public static function fields_editor() {
96
- ob_start();
97
- ?>
98
- <p><?php esc_html_e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
99
- <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>
100
- <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>
101
- <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>
102
- <p><?php esc_html_e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
103
- <?php
104
- $content = ob_get_clean();
105
 
106
  // Links
107
 
@@ -111,13 +70,11 @@ class Strong_Testimonials_Help {
111
 
112
  $content .= '<p>' . implode( ' | ', $links ) . '</p>';
113
 
114
- get_current_screen()->add_help_tab(
115
- array(
116
- 'id' => 'wpmtst-help',
117
- 'title' => __( 'Form Fields', 'strong-testimonials' ),
118
- 'content' => $content,
119
- )
120
- );
121
  }
122
 
123
  /**
@@ -126,28 +83,26 @@ class Strong_Testimonials_Help {
126
  public static function views_list() {
127
  ob_start();
128
  ?>
129
- <div>
130
- <p><?php esc_html_e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
131
- <p><?php esc_html_e( 'You can create an unlimited number of views.', 'strong-testimonials' ); ?></p>
132
- <p><?php esc_html_e( 'For example:', 'strong-testimonials' ); ?></p>
133
- <ul class="standard">
134
- <li><?php esc_html_e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
135
- <li><?php esc_html_e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
136
- <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>
137
  <?php do_action( 'wpmtst_views_intro_list' ); ?>
138
- </ul>
139
- <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>
140
- </div>
141
  <?php
142
  $content = ob_get_clean();
143
 
144
- get_current_screen()->add_help_tab(
145
- array(
146
- 'id' => 'wpmtst-help-views',
147
- 'title' => __( 'About Views', 'strong-testimonials' ),
148
- 'content' => $content,
149
- )
150
- );
151
  }
152
 
153
  /**
@@ -160,31 +115,29 @@ class Strong_Testimonials_Help {
160
 
161
  ob_start();
162
  ?>
163
- <div>
164
- <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' ) ); ?>
165
- <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
166
- <p><?php echo wp_kses_post( _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' ) ); ?>
167
- <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' ) ); ?>
168
- <p>
169
- <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-1"]</code>', 'strong-testimonials' ) ); ?>,
170
- <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-2"]</code>', 'strong-testimonials' ) ); ?>, etc.
171
- </p>
172
- <p>
173
- <?php echo wp_kses_post( _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
174
- <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>', 'strong-testimonials' ) ); ?>
175
- </p>
176
- <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>
177
- </div>
178
  <?php
179
  $content = ob_get_clean();
180
 
181
- get_current_screen()->add_help_tab(
182
- array(
183
- 'id' => 'wpmtst-help-shortcode',
184
- 'title' => __( 'Shortcode Attributes', 'strong-testimonials' ),
185
- 'content' => $content,
186
- )
187
- );
188
  }
189
 
190
  /**
@@ -197,54 +150,52 @@ class Strong_Testimonials_Help {
197
 
198
  ob_start();
199
  ?>
200
- <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
201
-
202
- <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
203
- <thead>
204
- <tr>
205
- <th></th>
206
- <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
207
- <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
208
- </tr>
209
- </thead>
210
- <tbody>
211
- <tr>
212
- <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
213
- <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
214
- <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
215
- </tr>
216
- <tr>
217
- <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
218
- <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
219
- <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
220
- </tr>
221
- <tr>
222
- <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
223
- <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>
224
- <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>
225
- </tr>
226
- <tr>
227
- <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
228
- <td><?php esc_html_e( 'yes' ); ?></td>
229
- <td><?php esc_html_e( 'no' ); ?></td>
230
- </tr>
231
- <tr>
232
- <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
233
- <td><?php esc_html_e( 'yes' ); ?></td>
234
- <td><?php esc_html_e( 'no' ); ?></td>
235
- </tr>
236
- </tbody>
237
- </table>
238
  <?php
239
  $content = ob_get_clean();
240
 
241
- get_current_screen()->add_help_tab(
242
- array(
243
- 'id' => 'wpmtst-help-pagination',
244
- 'title' => __( 'Pagination', 'strong-testimonials' ),
245
- 'content' => $content,
246
- )
247
- );
248
  }
249
 
250
  /**
@@ -257,19 +208,17 @@ class Strong_Testimonials_Help {
257
 
258
  ob_start();
259
  ?>
260
- <p><?php esc_html_e( 'This will set the height of the slideshow container 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>
261
- <p><?php esc_html_e( 'Select the Stretch option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
262
- <p><?php esc_html_e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
263
  <?php
264
  $content = ob_get_clean();
265
 
266
- get_current_screen()->add_help_tab(
267
- array(
268
- 'id' => 'wpmtst-help-stretch',
269
- 'title' => __( 'Stretch', 'strong-testimonials' ),
270
- 'content' => $content,
271
- )
272
- );
273
  }
274
 
275
  }
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
  }
27
 
28
  ob_start();
29
  ?>
30
+ <p><?php _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 _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 _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 _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' => __( '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 _e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
58
+ <p><?php _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 _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 _e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( __( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
61
+ <p><?php _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
 
70
 
71
  $content .= '<p>' . implode( ' | ', $links ) . '</p>';
72
 
73
+ get_current_screen()->add_help_tab( array(
74
+ 'id' => 'wpmtst-help',
75
+ 'title' => __( 'Form Fields', 'strong-testimonials' ),
76
+ 'content' => $content,
77
+ ) );
 
 
78
  }
79
 
80
  /**
83
  public static function views_list() {
84
  ob_start();
85
  ?>
86
+ <div>
87
+ <p><?php _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 _e( 'For example:', 'strong-testimonials' ); ?></p>
90
+ <ul class="standard">
91
+ <li><?php _e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
92
+ <li><?php _e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
93
+ <li><?php _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 _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' => __( 'About Views', 'strong-testimonials' ),
104
+ 'content' => $content,
105
+ ) );
 
 
106
  }
107
 
108
  /**
115
 
116
  ob_start();
117
  ?>
118
+ <div>
119
+ <p><?php _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ); ?>
120
+ <p><?php _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ); ?>
121
+ <p><?php _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 _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 _e( '<code>[testimonial_view id="1" category="service-1"]</code>', 'strong-testimonials' ); ?>,
125
+ <?php _e( '<code>[testimonial_view id="1" category="service-2"]</code>', 'strong-testimonials' ); ?>, etc.
126
+ </p>
127
+ <p>
128
+ <?php _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ); ?>
129
+ <?php _e( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>', 'strong-testimonials' ); ?>
130
+ </p>
131
+ <p><?php _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' => __( 'Shortcode Attributes', 'strong-testimonials' ),
139
+ 'content' => $content,
140
+ ) );
 
 
141
  }
142
 
143
  /**
150
 
151
  ob_start();
152
  ?>
153
+ <p><?php _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 _e( 'Simple', 'strong-testimonials' ); ?></th>
160
+ <th><?php _e( 'Standard', 'strong-testimonials' ); ?></th>
161
+ </tr>
162
+ </thead>
163
+ <tbody>
164
+ <tr>
165
+ <td><?php _e( 'best use', 'strong-testimonials' ); ?></td>
166
+ <td><?php _e( 'ten pages or less', 'strong-testimonials' ); ?></td>
167
+ <td><?php _e( 'more than ten pages', 'strong-testimonials' ); ?></td>
168
+ </tr>
169
+ <tr>
170
+ <td><?php _e( 'URLs', 'strong-testimonials' ); ?></td>
171
+ <td><?php _e( 'does not change the URL', 'strong-testimonials' ); ?></td>
172
+ <td><?php _e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
173
+ </tr>
174
+ <tr>
175
+ <td><?php _e( 'the Back button', 'strong-testimonials' ); ?></td>
176
+ <td><?php _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 _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 _e( 'works with random order option', 'strong-testimonials' ); ?></td>
181
+ <td><?php _e( 'yes' ); ?></td>
182
+ <td><?php _e( 'no' ); ?></td>
183
+ </tr>
184
+ <tr>
185
+ <td><?php _e( 'works in a widget', 'strong-testimonials' ); ?></td>
186
+ <td><?php _e( 'yes' ); ?></td>
187
+ <td><?php _e( 'no' ); ?></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' => __( 'Pagination', 'strong-testimonials' ),
197
+ 'content' => $content,
198
+ ) );
 
 
199
  }
200
 
201
  /**
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 _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' => __( 'Stretch', 'strong-testimonials' ),
220
+ 'content' => $content,
221
+ ) );
 
 
222
  }
223
 
224
  }
admin/class-strong-testimonials-list-table.php CHANGED
@@ -10,629 +10,585 @@
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' => __( 'List View' ),
165
- 'excerpt' => __( 'Excerpt View' ),
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.' );
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( $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' ) . '</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' ) . "</option>\n";
474
-
475
- foreach ( $this->_actions as $name => $title ) {
476
- $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
477
-
478
- echo "\t<option value='$name'$class>$title</option>\n";
479
- }
480
 
481
- echo "</select>\n";
 
482
 
483
- submit_button( __( 'Apply' ), '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 _e( 'Filter by date' ); ?></label>
594
  <select name="m" id="filter-by-date">
595
  <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></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' ), $wp_locale->get_month( $month ), $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-$mode'><span class='screen-reader-text'>%s</span></a>\n",
638
  esc_url( add_query_arg( 'mode', $mode ) ),
@@ -640,573 +596,552 @@ if ( ! class_exists( 'Strong_Testimonials_List_Table' ) ) :
640
  $title
641
  );
642
  }
643
- ?>
644
  </div>
645
- <?php
646
- }
647
-
648
- /**
649
- * Display a comment count bubble
650
- *
651
- * @since 3.1.0
652
- * @access protected
653
- *
654
- * @param int $post_id The post ID.
655
- * @param int $pending_comments Number of pending comments.
656
- */
657
- protected function comments_bubble( $post_id, $pending_comments ) {
658
- $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
659
 
660
- if ( $pending_comments ) {
661
- echo '<strong>';
662
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
 
664
- echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . '</span></a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
 
666
- if ( $pending_comments ) {
667
- echo '</strong>';
668
- }
669
- }
 
 
 
 
 
 
 
 
 
 
670
 
671
  /**
672
- * Get the current page number
673
- *
674
- * @since 3.1.0
675
- * @access public
676
  *
677
- * @return int
678
- */
679
- public function get_pagenum() {
680
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
681
-
682
- if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
683
- $pagenum = $this->_pagination_args['total_pages'];
684
- }
685
-
686
- return max( 1, $pagenum );
687
- }
688
-
689
- /**
690
- * Get number of items to display on a single page
691
  *
692
- * @since 3.1.0
693
- * @access protected
694
  *
695
- * @param string $option
696
- * @param int $default
697
- * @return int
698
  */
699
- protected function get_items_per_page( $option, $default = 20 ) {
700
- $per_page = (int) get_user_option( $option );
701
- if ( empty( $per_page ) || $per_page < 1 ) {
702
- $per_page = $default;
703
- }
704
 
705
- /**
706
- * Filter the number of items to be displayed on each page of the list table.
707
- *
708
- * The dynamic hook name, $option, refers to the `per_page` option depending
709
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
710
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
711
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
712
- * 'edit_{$post_type}_per_page', etc.
713
- *
714
- * @since 2.9.0
715
- *
716
- * @param int $per_page Number of items to be displayed. Default 20.
717
- */
718
- return (int) apply_filters( $option, $per_page );
719
  }
720
 
721
- /**
722
- * Display the pagination.
723
- *
724
- * @since 3.1.0
725
- * @access protected
726
- *
727
- * @param string $which
728
- */
729
- protected function pagination( $which ) {
730
- if ( empty( $this->_pagination_args ) ) {
731
- return;
732
- }
733
-
734
- $total_items = $this->_pagination_args['total_items'];
735
- $total_pages = $this->_pagination_args['total_pages'];
736
- $infinite_scroll = false;
737
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
738
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
739
- }
740
-
741
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
742
 
743
- $current = $this->get_pagenum();
744
 
745
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
746
 
747
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
748
 
749
- $page_links = array();
750
 
751
- $disable_first = $disable_last = '';
752
- if ( $current == 1 ) {
753
- $disable_first = ' disabled';
754
- }
755
- if ( $current == $total_pages ) {
756
- $disable_last = ' disabled';
757
- }
758
- $page_links[] = sprintf(
759
- "<a class='%s' title='%s' href='%s'>%s</a>",
760
- 'first-page' . $disable_first,
761
- esc_attr__( 'Go to the first page' ),
762
- esc_url( remove_query_arg( 'paged', $current_url ) ),
763
- '&laquo;'
764
- );
765
 
766
- $page_links[] = sprintf(
767
- "<a class='%s' title='%s' href='%s'>%s</a>",
768
- 'prev-page' . $disable_first,
769
- esc_attr__( 'Go to the previous page' ),
770
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
771
- '&lsaquo;'
772
- );
 
 
 
 
 
 
773
 
774
- if ( 'bottom' == $which ) {
775
- $html_current_page = $current;
776
- } else {
777
- $html_current_page = sprintf(
778
- "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
779
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page' ) . '</label>',
780
- esc_attr__( 'Current page' ),
781
- $current,
782
- strlen( $total_pages )
783
- );
784
- }
785
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
786
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
787
-
788
- $page_links[] = sprintf(
789
- "<a class='%s' title='%s' href='%s'>%s</a>",
790
- 'next-page' . $disable_last,
791
- esc_attr__( 'Go to the next page' ),
792
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
793
- '&rsaquo;'
794
- );
795
 
796
- $page_links[] = sprintf(
797
- "<a class='%s' title='%s' href='%s'>%s</a>",
798
- 'last-page' . $disable_last,
799
- esc_attr__( 'Go to the last page' ),
800
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
801
- '&raquo;'
 
 
802
  );
803
-
804
- $pagination_links_class = 'pagination-links';
805
- if ( ! empty( $infinite_scroll ) ) {
806
- $pagination_links_class = ' hide-if-js';
807
- }
808
- $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
809
-
810
- if ( $total_pages ) {
811
- $page_class = $total_pages < 2 ? ' one-page' : '';
812
- } else {
813
- $page_class = ' no-pages';
814
- }
815
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
816
-
817
- echo $this->_pagination;
818
  }
 
 
 
 
 
 
 
 
 
819
 
820
- /**
821
- * Get a list of columns. The format is:
822
- * 'internal-name' => 'Title'
823
- *
824
- * @since 3.1.0
825
- * @access public
826
- * @abstract
827
- *
828
- * @return array
829
- */
830
- public function get_columns() {
831
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
832
- }
833
 
834
- /**
835
- * Get a list of sortable columns. The format is:
836
- * 'internal-name' => 'orderby'
837
- * or
838
- * 'internal-name' => array( 'orderby', true )
839
- *
840
- * The second format will make the initial sorting order be descending
841
- *
842
- * @since 3.1.0
843
- * @access protected
844
- *
845
- * @return array
846
- */
847
- protected function get_sortable_columns() {
848
- return array();
849
  }
 
850
 
851
- /**
852
- * Get a list of all, hidden and sortable columns, with filter applied
853
- *
854
- * @since 3.1.0
855
- * @access protected
856
- *
857
- * @return array
858
- */
859
- protected function get_column_info() {
860
- if ( isset( $this->_column_headers ) ) {
861
- return $this->_column_headers;
862
- }
863
-
864
- $columns = get_column_headers( $this->screen );
865
- $hidden = get_hidden_columns( $this->screen );
866
-
867
- $sortable_columns = $this->get_sortable_columns();
868
- /**
869
- * Filter the list table sortable columns for a specific screen.
870
- *
871
- * The dynamic portion of the hook name, `$this->screen->id`, refers
872
- * to the ID of the current screen, usually a string.
873
- *
874
- * @since 3.5.0
875
- *
876
- * @param array $sortable_columns An array of sortable columns.
877
- */
878
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
879
-
880
- $sortable = array();
881
- foreach ( $_sortable as $id => $data ) {
882
- if ( empty( $data ) ) {
883
- continue;
884
- }
885
 
886
- $data = (array) $data;
887
- if ( ! isset( $data[1] ) ) {
888
- $data[1] = false;
889
- }
890
 
891
- $sortable[ $id ] = $data;
892
- }
 
 
 
 
 
 
 
 
 
 
 
893
 
894
- $this->_column_headers = array( $columns, $hidden, $sortable );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
895
 
 
 
 
 
 
 
 
 
 
 
896
  return $this->_column_headers;
897
- }
898
 
899
- /**
900
- * Return number of visible columns
901
- *
902
- * @since 3.1.0
903
- * @access public
904
- *
905
- * @return int
906
- */
907
- public function get_column_count() {
908
- list ( $columns, $hidden ) = $this->get_column_info();
909
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
910
- return count( $columns ) - count( $hidden );
911
- }
912
 
 
913
  /**
914
- * Print column headers, accounting for hidden and sortable columns.
 
 
 
915
  *
916
- * @since 3.1.0
917
- * @access public
918
  *
919
- * @param bool $with_id Whether to set the id attribute or not
920
  */
921
- public function print_column_headers( $with_id = true ) {
922
- list( $columns, $hidden, $sortable ) = $this->get_column_info();
923
 
924
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
925
- $current_url = remove_query_arg( 'paged', $current_url );
 
 
926
 
927
- if ( isset( $_GET['orderby'] ) ) {
928
- $current_orderby = $_GET['orderby'];
929
- } else {
930
- $current_orderby = '';
931
- }
932
 
933
- if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) {
934
- $current_order = 'desc';
935
- } else {
936
- $current_order = 'asc';
937
- }
938
 
939
- if ( ! empty( $columns['cb'] ) ) {
940
- static $cb_counter = 1;
941
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
942
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
943
- $cb_counter++;
944
- }
945
 
946
- foreach ( $columns as $column_key => $column_display_name ) {
947
- $class = array( 'manage-column', "column-$column_key" );
948
 
949
- $style = '';
950
- if ( in_array( $column_key, $hidden ) ) {
951
- $style = 'display:none;';
952
- }
 
 
 
 
 
 
 
 
 
953
 
954
- $style = ' style="' . $style . '"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
955
 
956
- if ( 'cb' == $column_key ) {
957
- $class[] = 'check-column';
958
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
959
- $class[] = 'num';
960
- }
961
 
962
- if ( isset( $sortable[ $column_key ] ) ) {
963
- list( $orderby, $desc_first ) = $sortable[ $column_key ];
 
964
 
965
- if ( $current_orderby == $orderby ) {
966
- $order = 'asc' == $current_order ? 'desc' : 'asc';
967
- $class[] = 'sorted';
968
- $class[] = $current_order;
969
- } else {
970
- $order = $desc_first ? 'desc' : 'asc';
971
- $class[] = 'sortable';
972
- $class[] = $desc_first ? 'asc' : 'desc';
973
- }
974
 
975
- $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>';
976
- }
 
 
977
 
978
- $id = $with_id ? "id='$column_key'" : '';
 
979
 
980
- if ( ! empty( $class ) ) {
981
- $class = "class='" . join( ' ', $class ) . "'";
 
 
 
 
 
 
982
  }
983
 
984
- echo "<th scope='col' $id $class $style>$column_display_name</th>";
985
  }
 
 
 
 
 
 
 
986
  }
 
987
 
988
- /**
989
- * Display the table
990
- *
991
- * @since 3.1.0
992
- * @access public
993
- */
994
- public function display() {
995
- $singular = $this->_args['singular'];
996
 
997
- $this->display_tablenav( 'top' );
998
 
999
- ?>
1000
  <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1001
  <thead>
1002
  <tr>
1003
- <?php $this->print_column_headers(); ?>
1004
  </tr>
1005
  </thead>
1006
 
1007
- <tbody id="the-list"
1008
- <?php
1009
- if ( $singular ) {
1010
- echo " data-wp-lists='list:$singular'";
1011
- }
1012
- ?>
1013
- >
1014
- <?php $this->display_rows_or_placeholder(); ?>
1015
  </tbody>
1016
 
1017
  <tfoot>
1018
  <tr>
1019
- <?php $this->print_column_headers( false ); ?>
1020
  </tr>
1021
  </tfoot>
1022
 
1023
  </table>
1024
- <?php
1025
- $this->display_tablenav( 'bottom' );
1026
- }
1027
 
1028
- /**
1029
- * Get a list of CSS classes for the list table table tag.
1030
- *
1031
- * @since 3.1.0
1032
- * @access protected
1033
- *
1034
- * @return array List of CSS classes for the table tag.
1035
- */
1036
- protected function get_table_classes() {
1037
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1038
- }
1039
 
1040
- /**
1041
- * Generate the table navigation above or below the table
1042
- *
1043
- * @since 3.1.0
1044
- * @access protected
1045
- * @param string $which
1046
- */
1047
- protected function display_tablenav( $which ) {
1048
- if ( 'top' == $which ) {
1049
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1050
- }
1051
- ?>
1052
  <div class="tablenav <?php echo esc_attr( $which ); ?>">
1053
 
1054
  <div class="alignleft actions bulkactions">
1055
  <?php $this->bulk_actions( $which ); ?>
1056
  </div>
1057
- <?php
1058
- $this->extra_tablenav( $which );
1059
- $this->pagination( $which );
1060
- ?>
1061
 
1062
  <br class="clear">
1063
  </div>
1064
- <?php
1065
- }
1066
-
1067
- /**
1068
- * Extra controls to be displayed between bulk actions and pagination
1069
- *
1070
- * @since 3.1.0
1071
- * @access protected
1072
- *
1073
- * @param string $which
1074
- */
1075
- protected function extra_tablenav( $which ) {}
1076
 
1077
- /**
1078
- * Generate the tbody element for the list table.
1079
- *
1080
- * @since 3.1.0
1081
- * @access public
1082
- */
1083
- public function display_rows_or_placeholder() {
1084
- if ( $this->has_items() ) {
1085
- $this->display_rows();
1086
- } else {
1087
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1088
- $this->no_items();
1089
- echo '</td></tr>';
1090
- }
 
 
 
 
 
 
 
 
 
1091
  }
 
1092
 
1093
- /**
1094
- * Generate the table rows
1095
- *
1096
- * @since 3.1.0
1097
- * @access public
1098
- */
1099
- public function display_rows() {
1100
- foreach ( $this->items as $item ) {
1101
- $this->single_row( $item );
1102
- }
1103
- }
1104
 
1105
- /**
1106
- * Generates content for a single row of the table
1107
- *
1108
- * @since 3.1.0
1109
- * @access public
1110
- *
1111
- * @param object $item The current item
1112
- */
1113
- public function single_row( $item ) {
1114
- echo '<tr>';
1115
- $this->single_row_columns( $item );
1116
- echo '</tr>';
1117
- }
1118
 
1119
- protected function column_default( $item, $column_name ) {}
1120
 
1121
- protected function column_cb( $item ) {}
1122
 
1123
- /**
1124
- * Generates the columns for a single row of the table
1125
- *
1126
- * @since 3.1.0
1127
- * @access protected
1128
- *
1129
- * @param object $item The current item
1130
- */
1131
- protected function single_row_columns( $item ) {
1132
- list( $columns, $hidden ) = $this->get_column_info();
1133
 
1134
- foreach ( $columns as $column_name => $column_display_name ) {
1135
- $class = "class='$column_name column-$column_name'";
1136
 
1137
- $style = '';
1138
- if ( in_array( $column_name, $hidden ) ) {
1139
- $style = ' style="display:none;"';
1140
- }
1141
 
1142
- $attributes = "$class$style";
1143
 
1144
- if ( 'cb' == $column_name ) {
1145
- echo '<th scope="row" class="check-column">';
1146
- echo $this->column_cb( $item );
1147
- echo '</th>';
1148
- } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1149
- echo "<td $attributes>";
1150
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1151
- echo '</td>';
1152
- } else {
1153
- echo "<td $attributes>";
1154
- echo $this->column_default( $item, $column_name );
1155
- echo '</td>';
1156
- }
 
1157
  }
1158
  }
 
1159
 
1160
- /**
1161
- * Handle an incoming ajax request (called from admin-ajax.php)
1162
- *
1163
- * @since 3.1.0
1164
- * @access public
1165
- */
1166
- public function ajax_response() {
1167
- $this->prepare_items();
1168
-
1169
- ob_start();
1170
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1171
- $this->display_rows();
1172
- } else {
1173
- $this->display_rows_or_placeholder();
1174
- }
1175
 
1176
- $rows = ob_get_clean();
1177
 
1178
- $response = array( 'rows' => $rows );
1179
 
1180
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1181
- $response['total_items_i18n'] = sprintf(
1182
- _n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
1183
- number_format_i18n( $this->_pagination_args['total_items'] )
1184
- );
1185
- }
1186
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1187
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1188
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1189
- }
1190
-
1191
- die( wp_json_encode( $response ) );
1192
  }
1193
 
1194
- /**
1195
- * Send required variables to JavaScript land
1196
- *
1197
- * @access public
1198
- */
1199
- public function _js_vars() {
1200
- $args = array(
1201
- 'class' => get_class( $this ),
1202
- 'screen' => array(
1203
- 'id' => $this->screen->id,
1204
- 'base' => $this->screen->base,
1205
- ),
1206
- );
1207
 
1208
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1209
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
  }
 
1211
 
1212
  endif;
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( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
89
+ 'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
90
+ 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
91
+ 'single_row_columns' );
92
+
93
+ /**
94
+ * Constructor.
95
+ *
96
+ * The child class should call this constructor from its own constructor to override
97
+ * the default $args.
98
+ *
99
+ * @since 3.1.0
100
+ * @access public
101
+ *
102
+ * @param array|string $args {
103
+ * Array or string of arguments.
104
+ *
105
+ * @type string $plural Plural value used for labels and the objects being listed.
106
+ * This affects things such as CSS class-names and nonces used
107
+ * in the list table, e.g. 'posts'. Default empty.
108
+ * @type string $singular Singular label for an object being listed, e.g. 'post'.
109
+ * Default empty
110
+ * @type bool $ajax Whether the list table supports AJAX. This includes loading
111
+ * and sorting data, for example. If true, the class will call
112
+ * the {@see _js_vars()} method in the footer to provide variables
113
+ * to any scripts handling AJAX events. Default false.
114
+ * @type string $screen String containing the hook name used to determine the current
115
+ * screen. If left null, the current screen will be automatically set.
116
+ * Default null.
117
+ * }
118
+ */
119
+ public function __construct( $args = array() ) {
120
+ $args = wp_parse_args( $args, array(
121
+ 'plural' => '',
122
+ 'singular' => '',
123
+ 'ajax' => false,
124
+ 'screen' => null,
125
+ ) );
126
+
127
+ $this->screen = convert_to_screen( $args['screen'] );
128
+
129
+ add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
130
+
131
+ if ( !$args['plural'] )
132
+ $args['plural'] = $this->screen->base;
133
+
134
+ $args['plural'] = sanitize_key( $args['plural'] );
135
+ $args['singular'] = sanitize_key( $args['singular'] );
136
+
137
+ $this->_args = $args;
138
+
139
+ if ( $args['ajax'] ) {
140
+ // wp_enqueue_script( 'list-table' );
141
+ add_action( 'admin_footer', array( $this, '_js_vars' ) );
142
+ }
143
 
144
+ if ( empty( $this->modes ) ) {
145
+ $this->modes = array(
146
+ 'list' => __( 'List View' ),
147
+ 'excerpt' => __( 'Excerpt View' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
+ }
151
 
152
+ /**
153
+ * Make private properties readable for backwards compatibility.
154
+ *
155
+ * @since 4.0.0
156
+ * @access public
157
+ *
158
+ * @param string $name Property to get.
159
+ * @return mixed Property.
160
+ */
161
+ public function __get( $name ) {
162
+ if ( in_array( $name, $this->compat_fields ) ) {
163
+ return $this->$name;
 
164
  }
165
+ }
166
 
167
+ /**
168
+ * Make private properties settable for backwards compatibility.
169
+ *
170
+ * @since 4.0.0
171
+ * @access public
172
+ *
173
+ * @param string $name Property to check if set.
174
+ * @param mixed $value Property value.
175
+ * @return mixed Newly-set property.
176
+ */
177
+ public function __set( $name, $value ) {
178
+ if ( in_array( $name, $this->compat_fields ) ) {
179
+ return $this->$name = $value;
 
180
  }
181
+ }
182
 
183
+ /**
184
+ * Make private properties checkable for backwards compatibility.
185
+ *
186
+ * @since 4.0.0
187
+ * @access public
188
+ *
189
+ * @param string $name Property to check if set.
190
+ * @return bool Whether the property is set.
191
+ */
192
+ public function __isset( $name ) {
193
+ if ( in_array( $name, $this->compat_fields ) ) {
194
+ return isset( $this->$name );
 
195
  }
196
+ }
197
 
198
+ /**
199
+ * Make private properties un-settable for backwards compatibility.
200
+ *
201
+ * @since 4.0.0
202
+ * @access public
203
+ *
204
+ * @param string $name Property to unset.
205
+ */
206
+ public function __unset( $name ) {
207
+ if ( in_array( $name, $this->compat_fields ) ) {
208
+ unset( $this->$name );
 
209
  }
210
+ }
211
 
212
+ /**
213
+ * Make private/protected methods readable for backwards compatibility.
214
+ *
215
+ * @since 4.0.0
216
+ * @access public
217
+ *
218
+ * @param callable $name Method to call.
219
+ * @param array $arguments Arguments to pass when calling.
220
+ * @return mixed|bool Return value of the callback, false otherwise.
221
+ */
222
+ public function __call( $name, $arguments ) {
223
+ if ( in_array( $name, $this->compat_methods ) ) {
224
+ return call_user_func_array( array( $this, $name ), $arguments );
 
 
225
  }
226
+ return false;
227
+ }
228
 
229
+ /**
230
+ * Checks the current user's permissions
231
+ *
232
+ * @since 3.1.0
233
+ * @access public
234
+ * @abstract
235
+ */
236
+ public function ajax_user_can() {
237
+ die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
238
+ }
239
 
240
+ /**
241
+ * Prepares the list of items for displaying.
242
+ * @uses WP_List_Table::set_pagination_args()
243
+ *
244
+ * @since 3.1.0
245
+ * @access public
246
+ * @abstract
247
+ */
248
+ public function prepare_items() {
249
+ die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
250
+ }
251
 
252
+ /**
253
+ * An internal method that sets all the necessary pagination arguments
254
+ *
255
+ * @param array $args An associative array with information about the pagination
256
+ * @access protected
257
+ */
258
+ protected function set_pagination_args( $args ) {
259
+ $args = wp_parse_args( $args, array(
260
+ 'total_items' => 0,
261
+ 'total_pages' => 0,
262
+ 'per_page' => 0,
263
+ ) );
264
+
265
+ if ( !$args['total_pages'] && $args['per_page'] > 0 )
266
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
267
+
268
+ // Redirect if page number is invalid and headers are not already sent.
269
+ if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
270
+ wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
271
+ exit;
272
+ }
273
 
274
+ $this->_pagination_args = $args;
275
+ }
 
276
 
277
+ /**
278
+ * Access the pagination args.
279
+ *
280
+ * @since 3.1.0
281
+ * @access public
282
+ *
283
+ * @param string $key Pagination argument to retrieve. Common values include 'total_items',
284
+ * 'total_pages', 'per_page', or 'infinite_scroll'.
285
+ * @return int Number of items that correspond to the given pagination argument.
286
+ */
287
+ public function get_pagination_arg( $key ) {
288
+ if ( 'page' == $key )
289
+ return $this->get_pagenum();
290
+
291
+ if ( isset( $this->_pagination_args[$key] ) )
292
+ return $this->_pagination_args[$key];
293
+ }
294
 
295
+ /**
296
+ * Whether the table has items to display or not
297
+ *
298
+ * @since 3.1.0
299
+ * @access public
300
+ *
301
+ * @return bool
302
+ */
303
+ public function has_items() {
304
+ return !empty( $this->items );
305
+ }
306
 
307
+ /**
308
+ * Message to be displayed when there are no items
309
+ *
310
+ * @since 3.1.0
311
+ * @access public
312
+ */
313
+ public function no_items() {
314
+ _e( 'No items found.' );
315
+ }
 
 
 
 
 
316
 
317
+ /**
318
+ * Display the search box.
319
+ *
320
+ * @since 3.1.0
321
+ * @access public
322
+ *
323
+ * @param string $text The search button text
324
+ * @param string $input_id The search input id
325
+ */
326
+ public function search_box( $text, $input_id ) {
327
+ if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
328
+ return;
329
+
330
+ $input_id = $input_id . '-search-input';
331
+
332
+ if ( ! empty( $_REQUEST['orderby'] ) )
333
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
334
+ if ( ! empty( $_REQUEST['order'] ) )
335
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
336
+ if ( ! empty( $_REQUEST['post_mime_type'] ) )
337
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
338
+ if ( ! empty( $_REQUEST['detached'] ) )
339
+ echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
340
+ ?>
341
+ <p class="search-box">
342
+ <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
343
+ <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>">
344
+ <?php submit_button( $text, 'button', '', false, array('id' => 'search-submit') ); ?>
345
+ </p>
346
+ <?php
347
+ }
348
 
349
+ /**
350
+ * Get an associative array ( id => link ) with the list
351
+ * of views available on this table.
352
+ *
353
+ * @since 3.1.0
354
+ * @access protected
355
+ *
356
+ * @return array
357
+ */
358
+ protected function get_views() {
359
+ return array();
360
+ }
361
 
362
+ /**
363
+ * Display the list of views available on this table.
364
+ *
365
+ * @since 3.1.0
366
+ * @access public
367
+ */
368
+ public function views() {
369
+ $views = $this->get_views();
370
  /**
371
+ * Filter the list of available list table views.
372
  *
373
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
374
+ * to the ID of the current screen, usually a string.
 
 
 
 
 
 
 
375
  *
376
+ * @since 3.5.0
 
377
  *
378
+ * @param array $views An array of available list table views.
 
379
  */
380
+ $views = apply_filters( "views_{$this->screen->id}", $views );
 
 
 
381
 
382
+ if ( empty( $views ) )
383
+ return;
384
 
385
+ echo "<ul class='subsubsub'>\n";
386
+ foreach ( $views as $class => $view ) {
387
+ $views[ $class ] = "\t<li class='$class'>$view";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  }
389
+ echo implode( " |</li>\n", $views ) . "</li>\n";
390
+ echo "</ul>";
391
+ }
392
 
393
+ /**
394
+ * Get an associative array ( option_name => option_title ) with the list
395
+ * of bulk actions available on this table.
396
+ *
397
+ * @since 3.1.0
398
+ * @access protected
399
+ *
400
+ * @return array
401
+ */
402
+ protected function get_bulk_actions() {
403
+ return array();
404
+ }
405
 
406
+ /**
407
+ * Display the bulk actions dropdown.
408
+ *
409
+ * @since 3.1.0
410
+ * @access protected
411
+ *
412
+ * @param string $which The location of the bulk actions: 'top' or 'bottom'.
413
+ * This is designated as optional for backwards-compatibility.
414
+ */
415
+ protected function bulk_actions( $which = '' ) {
416
+ if ( is_null( $this->_actions ) ) {
417
+ $no_new_actions = $this->_actions = $this->get_bulk_actions();
418
  /**
419
+ * Filter the list table Bulk Actions drop-down.
420
  *
421
  * The dynamic portion of the hook name, `$this->screen->id`, refers
422
  * to the ID of the current screen, usually a string.
423
  *
424
+ * This filter can currently only be used to remove bulk actions.
425
+ *
426
  * @since 3.5.0
427
  *
428
+ * @param array $actions An array of the available bulk actions.
429
  */
430
+ $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
431
+ $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
432
+ $two = '';
433
+ } else {
434
+ $two = '2';
 
 
 
 
 
 
 
435
  }
436
 
437
+ if ( empty( $this->_actions ) )
438
+ return;
 
 
 
 
 
 
 
 
 
 
439
 
440
+ echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
441
+ echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
442
+ echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
+ foreach ( $this->_actions as $name => $title ) {
445
+ $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
446
 
447
+ echo "\t<option value='$name'$class>$title</option>\n";
 
448
  }
449
 
450
+ echo "</select>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
 
452
+ submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
453
+ echo "\n";
454
+ }
455
 
456
+ /**
457
+ * Get the current action selected from the bulk actions dropdown.
458
+ *
459
+ * @since 3.1.0
460
+ * @access public
461
+ *
462
+ * @return string|bool The action name or False if no action was selected
463
+ */
464
+ public function current_action() {
465
+ if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) )
466
  return false;
 
467
 
468
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
469
+ return $_REQUEST['action'];
 
 
 
 
 
 
 
 
 
 
 
470
 
471
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
472
+ return $_REQUEST['action2'];
 
473
 
474
+ return false;
475
+ }
 
 
 
 
 
476
 
477
+ /**
478
+ * Generate row actions div
479
+ *
480
+ * @since 3.1.0
481
+ * @access protected
482
+ *
483
+ * @param array $actions The list of actions
484
+ * @param bool $always_visible Whether the actions should be always visible
485
+ * @return string
486
+ */
487
+ protected function row_actions( $actions, $always_visible = false ) {
488
+ $action_count = count( $actions );
489
+ $i = 0;
490
+
491
+ if ( !$action_count )
492
+ return '';
493
+
494
+ $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
495
+ foreach ( $actions as $action => $link ) {
496
+ ++$i;
497
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
498
+ $out .= "<span class='$action'>$link$sep</span>";
499
  }
500
+ $out .= '</div>';
501
+
502
+ return $out;
503
+ }
504
+
505
+ /**
506
+ * Display a monthly dropdown for filtering items
507
+ *
508
+ * @since 3.1.0
509
+ * @access protected
510
+ *
511
+ * @param string $post_type
512
+ */
513
+ protected function months_dropdown( $post_type ) {
514
+ global $wpdb, $wp_locale;
515
 
516
  /**
517
+ * Filter whether to remove the 'Months' drop-down from the post list table.
518
  *
519
+ * @since 4.2.0
 
520
  *
521
+ * @param bool $disable Whether to disable the drop-down. Default false.
522
+ * @param string $post_type The post type.
523
  */
524
+ if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
525
+ return;
526
+ }
 
 
 
 
 
 
 
 
 
 
 
527
 
528
+ $months = $wpdb->get_results( $wpdb->prepare( "
 
 
529
  SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
530
  FROM $wpdb->posts
531
  WHERE post_type = %s
532
  ORDER BY post_date DESC
533
+ ", $post_type ) );
 
 
 
534
 
535
+ /**
536
+ * Filter the 'Months' drop-down results.
537
+ *
538
+ * @since 3.7.0
539
+ *
540
+ * @param object $months The months drop-down query results.
541
+ * @param string $post_type The post type.
542
+ */
543
+ $months = apply_filters( 'months_dropdown_results', $months, $post_type );
544
 
545
+ $month_count = count( $months );
546
 
547
+ if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
548
+ return;
 
549
 
550
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
551
+ ?>
552
  <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
553
  <select name="m" id="filter-by-date">
554
  <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
555
+ <?php
556
+ foreach ( $months as $arc_row ) {
557
+ if ( 0 == $arc_row->year )
558
+ continue;
559
+
560
+ $month = zeroise( $arc_row->month, 2 );
561
+ $year = $arc_row->year;
562
+
563
+ printf( "<option %s value='%s'>%s</option>\n",
564
+ selected( $m, $year . $month, false ),
565
+ esc_attr( $arc_row->year . $month ),
566
+ /* translators: 1: month name, 2: 4-digit year */
567
+ sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
568
+ );
 
 
 
 
 
 
569
  }
570
+ ?>
571
+ </select>
572
+ <?php
573
+ }
574
 
575
+ /**
576
+ * Display a view switcher
577
+ *
578
+ * @since 3.1.0
579
+ * @access protected
580
+ *
581
+ * @param string $current_mode
582
+ */
583
+ protected function view_switcher( $current_mode ) {
584
+ ?>
585
  <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
586
  <div class="view-switch">
587
+ <?php
588
  foreach ( $this->modes as $mode => $title ) {
589
  $classes = array( 'view-' . $mode );
590
+ if ( $current_mode == $mode )
591
  $classes[] = 'current';
 
592
  printf(
593
  "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
594
  esc_url( add_query_arg( 'mode', $mode ) ),
596
  $title
597
  );
598
  }
599
+ ?>
600
  </div>
601
+ <?php
602
+ }
 
 
 
 
 
 
 
 
 
 
 
 
603
 
604
+ /**
605
+ * Display a comment count bubble
606
+ *
607
+ * @since 3.1.0
608
+ * @access protected
609
+ *
610
+ * @param int $post_id The post ID.
611
+ * @param int $pending_comments Number of pending comments.
612
+ */
613
+ protected function comments_bubble( $post_id, $pending_comments ) {
614
+ $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
615
+
616
+ if ( $pending_comments )
617
+ echo '<strong>';
618
+
619
+ echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . "</span></a>";
620
+
621
+ if ( $pending_comments )
622
+ echo '</strong>';
623
+ }
624
 
625
+ /**
626
+ * Get the current page number
627
+ *
628
+ * @since 3.1.0
629
+ * @access public
630
+ *
631
+ * @return int
632
+ */
633
+ public function get_pagenum() {
634
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
635
+
636
+ if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
637
+ $pagenum = $this->_pagination_args['total_pages'];
638
+
639
+ return max( 1, $pagenum );
640
+ }
641
 
642
+ /**
643
+ * Get number of items to display on a single page
644
+ *
645
+ * @since 3.1.0
646
+ * @access protected
647
+ *
648
+ * @param string $option
649
+ * @param int $default
650
+ * @return int
651
+ */
652
+ protected function get_items_per_page( $option, $default = 20 ) {
653
+ $per_page = (int) get_user_option( $option );
654
+ if ( empty( $per_page ) || $per_page < 1 )
655
+ $per_page = $default;
656
 
657
  /**
658
+ * Filter the number of items to be displayed on each page of the list table.
 
 
 
659
  *
660
+ * The dynamic hook name, $option, refers to the `per_page` option depending
661
+ * on the type of list table in use. Possible values include: 'edit_comments_per_page',
662
+ * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
663
+ * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
664
+ * 'edit_{$post_type}_per_page', etc.
 
 
 
 
 
 
 
 
 
665
  *
666
+ * @since 2.9.0
 
667
  *
668
+ * @param int $per_page Number of items to be displayed. Default 20.
 
 
669
  */
670
+ return (int) apply_filters( $option, $per_page );
671
+ }
 
 
 
672
 
673
+ /**
674
+ * Display the pagination.
675
+ *
676
+ * @since 3.1.0
677
+ * @access protected
678
+ *
679
+ * @param string $which
680
+ */
681
+ protected function pagination( $which ) {
682
+ if ( empty( $this->_pagination_args ) ) {
683
+ return;
 
 
 
684
  }
685
 
686
+ $total_items = $this->_pagination_args['total_items'];
687
+ $total_pages = $this->_pagination_args['total_pages'];
688
+ $infinite_scroll = false;
689
+ if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
690
+ $infinite_scroll = $this->_pagination_args['infinite_scroll'];
691
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
 
693
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
694
 
695
+ $current = $this->get_pagenum();
696
 
697
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
698
 
699
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
700
 
701
+ $page_links = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
702
 
703
+ $disable_first = $disable_last = '';
704
+ if ( $current == 1 ) {
705
+ $disable_first = ' disabled';
706
+ }
707
+ if ( $current == $total_pages ) {
708
+ $disable_last = ' disabled';
709
+ }
710
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
711
+ 'first-page' . $disable_first,
712
+ esc_attr__( 'Go to the first page' ),
713
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
714
+ '&laquo;'
715
+ );
716
 
717
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
718
+ 'prev-page' . $disable_first,
719
+ esc_attr__( 'Go to the previous page' ),
720
+ esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
721
+ '&lsaquo;'
722
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
 
724
+ if ( 'bottom' == $which ) {
725
+ $html_current_page = $current;
726
+ } else {
727
+ $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
728
+ '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page' ) . '</label>',
729
+ esc_attr__( 'Current page' ),
730
+ $current,
731
+ strlen( $total_pages )
732
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  }
734
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
735
+ $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
736
+
737
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
738
+ 'next-page' . $disable_last,
739
+ esc_attr__( 'Go to the next page' ),
740
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
741
+ '&rsaquo;'
742
+ );
743
 
744
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
745
+ 'last-page' . $disable_last,
746
+ esc_attr__( 'Go to the last page' ),
747
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
748
+ '&raquo;'
749
+ );
 
 
 
 
 
 
 
750
 
751
+ $pagination_links_class = 'pagination-links';
752
+ if ( ! empty( $infinite_scroll ) ) {
753
+ $pagination_links_class = ' hide-if-js';
 
 
 
 
 
 
 
 
 
 
 
 
754
  }
755
+ $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
756
 
757
+ if ( $total_pages ) {
758
+ $page_class = $total_pages < 2 ? ' one-page' : '';
759
+ } else {
760
+ $page_class = ' no-pages';
761
+ }
762
+ $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
 
764
+ echo $this->_pagination;
765
+ }
 
 
766
 
767
+ /**
768
+ * Get a list of columns. The format is:
769
+ * 'internal-name' => 'Title'
770
+ *
771
+ * @since 3.1.0
772
+ * @access public
773
+ * @abstract
774
+ *
775
+ * @return array
776
+ */
777
+ public function get_columns() {
778
+ die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
779
+ }
780
 
781
+ /**
782
+ * Get a list of sortable columns. The format is:
783
+ * 'internal-name' => 'orderby'
784
+ * or
785
+ * 'internal-name' => array( 'orderby', true )
786
+ *
787
+ * The second format will make the initial sorting order be descending
788
+ *
789
+ * @since 3.1.0
790
+ * @access protected
791
+ *
792
+ * @return array
793
+ */
794
+ protected function get_sortable_columns() {
795
+ return array();
796
+ }
797
 
798
+ /**
799
+ * Get a list of all, hidden and sortable columns, with filter applied
800
+ *
801
+ * @since 3.1.0
802
+ * @access protected
803
+ *
804
+ * @return array
805
+ */
806
+ protected function get_column_info() {
807
+ if ( isset( $this->_column_headers ) )
808
  return $this->_column_headers;
 
809
 
810
+ $columns = get_column_headers( $this->screen );
811
+ $hidden = get_hidden_columns( $this->screen );
 
 
 
 
 
 
 
 
 
 
 
812
 
813
+ $sortable_columns = $this->get_sortable_columns();
814
  /**
815
+ * Filter the list table sortable columns for a specific screen.
816
+ *
817
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
818
+ * to the ID of the current screen, usually a string.
819
  *
820
+ * @since 3.5.0
 
821
  *
822
+ * @param array $sortable_columns An array of sortable columns.
823
  */
824
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
 
825
 
826
+ $sortable = array();
827
+ foreach ( $_sortable as $id => $data ) {
828
+ if ( empty( $data ) )
829
+ continue;
830
 
831
+ $data = (array) $data;
832
+ if ( !isset( $data[1] ) )
833
+ $data[1] = false;
 
 
834
 
835
+ $sortable[$id] = $data;
836
+ }
 
 
 
837
 
838
+ $this->_column_headers = array( $columns, $hidden, $sortable );
 
 
 
 
 
839
 
840
+ return $this->_column_headers;
841
+ }
842
 
843
+ /**
844
+ * Return number of visible columns
845
+ *
846
+ * @since 3.1.0
847
+ * @access public
848
+ *
849
+ * @return int
850
+ */
851
+ public function get_column_count() {
852
+ list ( $columns, $hidden ) = $this->get_column_info();
853
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
854
+ return count( $columns ) - count( $hidden );
855
+ }
856
 
857
+ /**
858
+ * Print column headers, accounting for hidden and sortable columns.
859
+ *
860
+ * @since 3.1.0
861
+ * @access public
862
+ *
863
+ * @param bool $with_id Whether to set the id attribute or not
864
+ */
865
+ public function print_column_headers( $with_id = true ) {
866
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
867
+
868
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
869
+ $current_url = remove_query_arg( 'paged', $current_url );
870
+
871
+ if ( isset( $_GET['orderby'] ) )
872
+ $current_orderby = $_GET['orderby'];
873
+ else
874
+ $current_orderby = '';
875
+
876
+ if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
877
+ $current_order = 'desc';
878
+ else
879
+ $current_order = 'asc';
880
+
881
+ if ( ! empty( $columns['cb'] ) ) {
882
+ static $cb_counter = 1;
883
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
884
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
885
+ $cb_counter++;
886
+ }
887
 
888
+ foreach ( $columns as $column_key => $column_display_name ) {
889
+ $class = array( 'manage-column', "column-$column_key" );
 
 
 
890
 
891
+ $style = '';
892
+ if ( in_array( $column_key, $hidden ) )
893
+ $style = 'display:none;';
894
 
895
+ $style = ' style="' . $style . '"';
 
 
 
 
 
 
 
 
896
 
897
+ if ( 'cb' == $column_key )
898
+ $class[] = 'check-column';
899
+ elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
900
+ $class[] = 'num';
901
 
902
+ if ( isset( $sortable[$column_key] ) ) {
903
+ list( $orderby, $desc_first ) = $sortable[$column_key];
904
 
905
+ if ( $current_orderby == $orderby ) {
906
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
907
+ $class[] = 'sorted';
908
+ $class[] = $current_order;
909
+ } else {
910
+ $order = $desc_first ? 'desc' : 'asc';
911
+ $class[] = 'sortable';
912
+ $class[] = $desc_first ? 'asc' : 'desc';
913
  }
914
 
915
+ $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>';
916
  }
917
+
918
+ $id = $with_id ? "id='$column_key'" : '';
919
+
920
+ if ( !empty( $class ) )
921
+ $class = "class='" . join( ' ', $class ) . "'";
922
+
923
+ echo "<th scope='col' $id $class $style>$column_display_name</th>";
924
  }
925
+ }
926
 
927
+ /**
928
+ * Display the table
929
+ *
930
+ * @since 3.1.0
931
+ * @access public
932
+ */
933
+ public function display() {
934
+ $singular = $this->_args['singular'];
935
 
936
+ $this->display_tablenav( 'top' );
937
 
938
+ ?>
939
  <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
940
  <thead>
941
  <tr>
942
+ <?php $this->print_column_headers(); ?>
943
  </tr>
944
  </thead>
945
 
946
+ <tbody id="the-list"<?php
947
+ if ( $singular ) {
948
+ echo " data-wp-lists='list:$singular'";
949
+ } ?>>
950
+ <?php $this->display_rows_or_placeholder(); ?>
 
 
 
951
  </tbody>
952
 
953
  <tfoot>
954
  <tr>
955
+ <?php $this->print_column_headers( false ); ?>
956
  </tr>
957
  </tfoot>
958
 
959
  </table>
960
+ <?php
961
+ $this->display_tablenav( 'bottom' );
962
+ }
963
 
964
+ /**
965
+ * Get a list of CSS classes for the list table table tag.
966
+ *
967
+ * @since 3.1.0
968
+ * @access protected
969
+ *
970
+ * @return array List of CSS classes for the table tag.
971
+ */
972
+ protected function get_table_classes() {
973
+ return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
974
+ }
975
 
976
+ /**
977
+ * Generate the table navigation above or below the table
978
+ *
979
+ * @since 3.1.0
980
+ * @access protected
981
+ * @param string $which
982
+ */
983
+ protected function display_tablenav( $which ) {
984
+ if ( 'top' == $which )
985
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
986
+ ?>
 
987
  <div class="tablenav <?php echo esc_attr( $which ); ?>">
988
 
989
  <div class="alignleft actions bulkactions">
990
  <?php $this->bulk_actions( $which ); ?>
991
  </div>
992
+ <?php
993
+ $this->extra_tablenav( $which );
994
+ $this->pagination( $which );
995
+ ?>
996
 
997
  <br class="clear">
998
  </div>
999
+ <?php
1000
+ }
 
 
 
 
 
 
 
 
 
 
1001
 
1002
+ /**
1003
+ * Extra controls to be displayed between bulk actions and pagination
1004
+ *
1005
+ * @since 3.1.0
1006
+ * @access protected
1007
+ *
1008
+ * @param string $which
1009
+ */
1010
+ protected function extra_tablenav( $which ) {}
1011
+
1012
+ /**
1013
+ * Generate the tbody element for the list table.
1014
+ *
1015
+ * @since 3.1.0
1016
+ * @access public
1017
+ */
1018
+ public function display_rows_or_placeholder() {
1019
+ if ( $this->has_items() ) {
1020
+ $this->display_rows();
1021
+ } else {
1022
+ echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1023
+ $this->no_items();
1024
+ echo '</td></tr>';
1025
  }
1026
+ }
1027
 
1028
+ /**
1029
+ * Generate the table rows
1030
+ *
1031
+ * @since 3.1.0
1032
+ * @access public
1033
+ */
1034
+ public function display_rows() {
1035
+ foreach ( $this->items as $item )
1036
+ $this->single_row( $item );
1037
+ }
 
1038
 
1039
+ /**
1040
+ * Generates content for a single row of the table
1041
+ *
1042
+ * @since 3.1.0
1043
+ * @access public
1044
+ *
1045
+ * @param object $item The current item
1046
+ */
1047
+ public function single_row( $item ) {
1048
+ echo '<tr>';
1049
+ $this->single_row_columns( $item );
1050
+ echo '</tr>';
1051
+ }
1052
 
1053
+ protected function column_default( $item, $column_name ) {}
1054
 
1055
+ protected function column_cb( $item ) {}
1056
 
1057
+ /**
1058
+ * Generates the columns for a single row of the table
1059
+ *
1060
+ * @since 3.1.0
1061
+ * @access protected
1062
+ *
1063
+ * @param object $item The current item
1064
+ */
1065
+ protected function single_row_columns( $item ) {
1066
+ list( $columns, $hidden ) = $this->get_column_info();
1067
 
1068
+ foreach ( $columns as $column_name => $column_display_name ) {
1069
+ $class = "class='$column_name column-$column_name'";
1070
 
1071
+ $style = '';
1072
+ if ( in_array( $column_name, $hidden ) )
1073
+ $style = ' style="display:none;"';
 
1074
 
1075
+ $attributes = "$class$style";
1076
 
1077
+ if ( 'cb' == $column_name ) {
1078
+ echo '<th scope="row" class="check-column">';
1079
+ echo $this->column_cb( $item );
1080
+ echo '</th>';
1081
+ }
1082
+ elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1083
+ echo "<td $attributes>";
1084
+ echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1085
+ echo "</td>";
1086
+ }
1087
+ else {
1088
+ echo "<td $attributes>";
1089
+ echo $this->column_default( $item, $column_name );
1090
+ echo "</td>";
1091
  }
1092
  }
1093
+ }
1094
 
1095
+ /**
1096
+ * Handle an incoming ajax request (called from admin-ajax.php)
1097
+ *
1098
+ * @since 3.1.0
1099
+ * @access public
1100
+ */
1101
+ public function ajax_response() {
1102
+ $this->prepare_items();
1103
+
1104
+ ob_start();
1105
+ if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1106
+ $this->display_rows();
1107
+ } else {
1108
+ $this->display_rows_or_placeholder();
1109
+ }
1110
 
1111
+ $rows = ob_get_clean();
1112
 
1113
+ $response = array( 'rows' => $rows );
1114
 
1115
+ if ( isset( $this->_pagination_args['total_items'] ) ) {
1116
+ $response['total_items_i18n'] = sprintf(
1117
+ _n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
1118
+ number_format_i18n( $this->_pagination_args['total_items'] )
1119
+ );
1120
+ }
1121
+ if ( isset( $this->_pagination_args['total_pages'] ) ) {
1122
+ $response['total_pages'] = $this->_pagination_args['total_pages'];
1123
+ $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
 
 
 
1124
  }
1125
 
1126
+ die( wp_json_encode( $response ) );
1127
+ }
 
 
 
 
 
 
 
 
 
 
 
1128
 
1129
+ /**
1130
+ * Send required variables to JavaScript land
1131
+ *
1132
+ * @access public
1133
+ */
1134
+ public function _js_vars() {
1135
+ $args = array(
1136
+ 'class' => get_class( $this ),
1137
+ 'screen' => array(
1138
+ 'id' => $this->screen->id,
1139
+ 'base' => $this->screen->base,
1140
+ )
1141
+ );
1142
+
1143
+ printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1144
  }
1145
+ }
1146
 
1147
  endif;
admin/class-strong-testimonials-page-shortcodes.php CHANGED
@@ -29,57 +29,57 @@ class Strong_Testimonials_Page_Shortcodes {
29
  ?>
30
  <div class="wrap wpmtst shortcodes has-stars">
31
 
32
- <h1><?php esc_html_e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
33
 
34
- <h2><?php esc_html_e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
35
 
36
  <p>
37
- <?php echo wp_kses_post( _e( 'Each view has a unique shortcode like <code>&#91;testimonial_view id="1"&#93;</code>.', 'strong-testimonials' ) ); ?>
38
- <?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' ) ); ?>
39
  </p>
40
 
41
- <h2><?php esc_html_e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
42
 
43
- <p><?php printf( esc_html__( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
44
 
45
  <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
46
  <tr>
47
  <td>
48
- <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
49
  </td>
50
  <td class="shortcode">
51
  <?php /* translators: %s is a shortcode */ ?>
52
  <p>
53
- <?php printf( esc_html__( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
54
  </p>
55
  </td>
56
  </tr>
57
  <tr>
58
  <td>
59
  <?php /* translators: %s is a shortcode attribute */ ?>
60
- <p><?php printf( esc_html__( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
61
  </td>
62
  <td class="shortcode">
63
  <?php /* translators: %s is a shortcode */ ?>
64
  <p>
65
- <?php printf( esc_html__( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
66
  </p>
67
  </td>
68
  </tr>
69
  </table>
70
 
71
- <h2><?php esc_html_e( 'Average Rating', 'strong-testimonials' ); ?></h2>
72
 
73
  <p>
74
  <?php /* translators: %s is a shortcode */ ?>
75
- <?php echo wp_kses_post( 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>' ) ); ?>
76
  </p>
77
 
78
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
79
  <tr>
80
  <td>
81
- <p><?php esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
82
- <p class="description"><?php echo wp_kses_post( _e( 'You must use the closing slash <code>/</code> if using the shortcode with content elsewhere on your page.', 'strong-testimonials' ) ); ?></p>
83
  </td>
84
  <td class="has-inner">
85
  <table class="inner" cellpadding="0" cellspacing="0">
@@ -90,7 +90,7 @@ class Strong_Testimonials_Page_Shortcodes {
90
  <td>
91
  <div class="strong-rating-wrapper average">
92
  <span class="strong-rating-title">Average Rating:</span>
93
- <?php echo wp_kses_post( $stars ); ?>
94
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
95
  </div>
96
  </td>
@@ -103,8 +103,8 @@ class Strong_Testimonials_Page_Shortcodes {
103
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
104
  <tr>
105
  <td>
106
- <p><?php esc_html_e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
107
- <p><?php esc_html_e( 'Default:', 'strong-testimonials' ); ?></p>
108
  <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
109
  </td>
110
  <td class="has-inner">
@@ -116,7 +116,7 @@ class Strong_Testimonials_Page_Shortcodes {
116
  <td>
117
  <div class="strong-rating-wrapper average">
118
  <span class="strong-rating-title">Average Rating:</span>
119
- <?php echo wp_kses_post( $stars ); ?>
120
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
121
  </div>
122
  </td>
@@ -129,7 +129,7 @@ class Strong_Testimonials_Page_Shortcodes {
129
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
130
  <tr>
131
  <td>
132
- <p><?php esc_html_e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
133
  <p><code>{title2}</code><br><code>{summary2}</code></p>
134
  </td>
135
  <td class="has-inner">
@@ -141,7 +141,7 @@ class Strong_Testimonials_Page_Shortcodes {
141
  <td>
142
  <div class="strong-rating-wrapper average">
143
  <span class="strong-rating-title">Average of 9 Ratings:</span>
144
- <?php echo wp_kses_post( $stars ); ?>
145
  <span class="strong-rating-summary">4.3 stars</span>
146
  </div>
147
  </td>
@@ -154,7 +154,7 @@ class Strong_Testimonials_Page_Shortcodes {
154
  <table class="form-table shortcodes average">
155
  <tr>
156
  <td>
157
- <p><?php esc_html_e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
158
  </td>
159
  <td class="has-inner">
160
  <table class="inner" cellpadding="0" cellspacing="0">
@@ -164,7 +164,7 @@ class Strong_Testimonials_Page_Shortcodes {
164
  <tr>
165
  <td>
166
  <div class="strong-rating-wrapper average">
167
- <?php echo wp_kses_post( $stars ); ?>
168
  Our average rating is <b><span class="strong-rating-summary">4.3 stars</span></b>
169
  </div>
170
  </td>
@@ -187,7 +187,7 @@ class Strong_Testimonials_Page_Shortcodes {
187
  <tr>
188
  <td>
189
  <div class="strong-rating-wrapper average">
190
- <?php echo wp_kses_post( $stars ); ?>
191
  </div>
192
  </td>
193
  </tr>
@@ -249,7 +249,7 @@ class Strong_Testimonials_Page_Shortcodes {
249
  <tr>
250
  <td>
251
  <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
252
- <?php echo wp_kses_post( $stars ); ?>
253
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
254
  </div>
255
  </td>
@@ -272,7 +272,7 @@ class Strong_Testimonials_Page_Shortcodes {
272
  <tr>
273
  <td>
274
  <div class="strong-rating-wrapper average centered"><span class="strong-rating-title">Average Rating:</span>
275
- <?php echo wp_kses_post( $stars ); ?>
276
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
277
  </div>
278
  </td>
@@ -295,7 +295,7 @@ class Strong_Testimonials_Page_Shortcodes {
295
  <tr>
296
  <td>
297
  <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title">Average Rating:</span>
298
- <?php echo wp_kses_post( $stars ); ?>
299
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
300
  </div>
301
  </td>
@@ -308,7 +308,7 @@ class Strong_Testimonials_Page_Shortcodes {
308
  <table class="form-table shortcodes average">
309
  <tr>
310
  <td>
311
- <p><?php echo wp_kses_post( _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ) ); ?></p>
312
  </td>
313
  <td class="has-inner">
314
  <table class="inner" cellpadding="0" cellspacing="0">
@@ -319,7 +319,7 @@ class Strong_Testimonials_Page_Shortcodes {
319
  <td>
320
  <span class="strong-rating-wrapper average">
321
  <span class="strong-rating-title">Average Rating:</span>
322
- <?php echo wp_kses_post( $stars ); ?>
323
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
324
  </span>
325
  </td>
29
  ?>
30
  <div class="wrap wpmtst shortcodes has-stars">
31
 
32
+ <h1><?php _e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
33
 
34
+ <h2><?php _e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
35
 
36
  <p>
37
+ <?php _e( 'Each view has a unique shortcode like <code>&#91;testimonial_view id="1"&#93;</code>.', 'strong-testimonials' ); ?>
38
+ <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), __( 'Go to views', 'strong-testimonials' ) ); ?>
39
  </p>
40
 
41
+ <h2><?php _e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
42
 
43
+ <p><?php printf( __( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
44
 
45
  <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
46
  <tr>
47
  <td>
48
+ <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
49
  </td>
50
  <td class="shortcode">
51
  <?php /* translators: %s is a shortcode */ ?>
52
  <p>
53
+ <?php printf( __( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
54
  </p>
55
  </td>
56
  </tr>
57
  <tr>
58
  <td>
59
  <?php /* translators: %s is a shortcode attribute */ ?>
60
+ <p><?php printf( __( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
61
  </td>
62
  <td class="shortcode">
63
  <?php /* translators: %s is a shortcode */ ?>
64
  <p>
65
+ <?php printf( __( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
66
  </p>
67
  </td>
68
  </tr>
69
  </table>
70
 
71
+ <h2><?php _e( 'Average Rating', 'strong-testimonials' ); ?></h2>
72
 
73
  <p>
74
  <?php /* translators: %s is a shortcode */ ?>
75
+ <?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>' ); ?>
76
  </p>
77
 
78
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
79
  <tr>
80
  <td>
81
+ <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
82
+ <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>
83
  </td>
84
  <td class="has-inner">
85
  <table class="inner" cellpadding="0" cellspacing="0">
90
  <td>
91
  <div class="strong-rating-wrapper average">
92
  <span class="strong-rating-title">Average Rating:</span>
93
+ <?php echo $stars; ?>
94
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
95
  </div>
96
  </td>
103
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
104
  <tr>
105
  <td>
106
+ <p><?php _e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
107
+ <p><?php _e( 'Default:', 'strong-testimonials' ); ?></p>
108
  <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
109
  </td>
110
  <td class="has-inner">
116
  <td>
117
  <div class="strong-rating-wrapper average">
118
  <span class="strong-rating-title">Average Rating:</span>
119
+ <?php echo $stars; ?>
120
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
121
  </div>
122
  </td>
129
  <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
130
  <tr>
131
  <td>
132
+ <p><?php _e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
133
  <p><code>{title2}</code><br><code>{summary2}</code></p>
134
  </td>
135
  <td class="has-inner">
141
  <td>
142
  <div class="strong-rating-wrapper average">
143
  <span class="strong-rating-title">Average of 9 Ratings:</span>
144
+ <?php echo $stars; ?>
145
  <span class="strong-rating-summary">4.3 stars</span>
146
  </div>
147
  </td>
154
  <table class="form-table shortcodes average">
155
  <tr>
156
  <td>
157
+ <p><?php _e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
158
  </td>
159
  <td class="has-inner">
160
  <table class="inner" cellpadding="0" cellspacing="0">
164
  <tr>
165
  <td>
166
  <div class="strong-rating-wrapper average">
167
+ <?php echo $stars; ?>
168
  Our average rating is <b><span class="strong-rating-summary">4.3 stars</span></b>
169
  </div>
170
  </td>
187
  <tr>
188
  <td>
189
  <div class="strong-rating-wrapper average">
190
+ <?php echo $stars; ?>
191
  </div>
192
  </td>
193
  </tr>
249
  <tr>
250
  <td>
251
  <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
252
+ <?php echo $stars; ?>
253
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
254
  </div>
255
  </td>
272
  <tr>
273
  <td>
274
  <div class="strong-rating-wrapper average centered"><span class="strong-rating-title">Average Rating:</span>
275
+ <?php echo $stars; ?>
276
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
277
  </div>
278
  </td>
295
  <tr>
296
  <td>
297
  <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title">Average Rating:</span>
298
+ <?php echo $stars; ?>
299
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
300
  </div>
301
  </td>
308
  <table class="form-table shortcodes average">
309
  <tr>
310
  <td>
311
+ <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
312
  </td>
313
  <td class="has-inner">
314
  <table class="inner" cellpadding="0" cellspacing="0">
319
  <td>
320
  <span class="strong-rating-wrapper average">
321
  <span class="strong-rating-title">Average Rating:</span>
322
+ <?php echo $stars; ?>
323
  <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
324
  </span>
325
  </td>
admin/class-strong-testimonials-post-editor.php CHANGED
@@ -54,12 +54,12 @@ class Strong_Testimonials_Post_Editor {
54
  $is_new = ( 'post-new.php' == $pagenow );
55
  ?>
56
  <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
57
- <table class="options">
58
- <tr>
59
- <td colspan="2">
60
- <p><?php echo esc_html_x( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
61
- </td>
62
- </tr>
63
  <?php
64
  do_action( 'wpmtst_before_client_fields' );
65
  foreach ( $fields as $key => $field ) {
@@ -69,23 +69,23 @@ class Strong_Testimonials_Post_Editor {
69
  continue;
70
  }
71
  ?>
72
- <tr>
73
- <th>
74
- <label for="<?php echo esc_attr( $field['name'] ); ?>">
75
- <?php echo wp_kses_post( apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ) ); ?>
76
- </label>
77
- </th>
78
- <td>
79
- <div class="<?php echo esc_attr( $field['input_type'] ); ?>">
80
  <?php self::meta_option( $field, $post, $is_new ); ?>
81
- </div>
82
- </td>
83
- </tr>
84
  <?php
85
  }
86
  do_action( 'wpmtst_after_client_fields' );
87
  ?>
88
- </table>
89
  <?php
90
  do_action( 'wpmtst_after_client_fields_table' );
91
  }
@@ -107,27 +107,27 @@ class Strong_Testimonials_Post_Editor {
107
  // Check field type.
108
  else {
109
  switch ( $field['input_type'] ) {
110
- case 'rating':
111
  self::meta_option__rating( $field, $post, $is_new );
112
  break;
113
- case 'url':
114
  self::meta_option__url( $field, $post, $is_new );
115
  break;
116
- case 'checkbox':
117
  self::meta_option__checkbox( $field, $post, $is_new );
118
  break;
119
- case 'shortcode':
120
  self::meta_option__shortcode( $field, $post, $is_new );
121
  break;
122
- default:
123
  self::meta_option__text( $field, $post, $is_new );
124
  }
125
  }
126
  }
127
 
128
  /**
129
- * Custom action callback.
130
- *
131
  * @param $field
132
  * @param $post
133
  * @param $is_new
@@ -146,12 +146,8 @@ class Strong_Testimonials_Post_Editor {
146
  * @param $is_new
147
  */
148
  private static function meta_option__text( $field, $post, $is_new ) {
149
- printf(
150
- '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
151
- esc_attr( $field['input_type'] ),
152
- esc_attr( $field['name'] ),
153
- esc_attr( $post->{$field['name']} )
154
- );
155
  }
156
 
157
  /**
@@ -163,24 +159,18 @@ class Strong_Testimonials_Post_Editor {
163
  */
164
  private static function meta_option__url( $field, $post, $is_new ) {
165
  ?>
166
- <div class="input-url">
167
- <?php
168
- printf(
169
- '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
170
- esc_attr( $field['input_type'] ),
171
- esc_attr( $field['name'] ),
172
- esc_attr( $post->{$field['name']} )
173
- );
174
- ?>
175
- </div>
176
- <div class="input-nofollow">
177
- <label for="custom_nofollow"><code>rel="nofollow"</code></label>
178
- <select id="custom_nofollow" name="custom[nofollow]">
179
- <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
180
- <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
181
- <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
182
- </select>
183
- </div>
184
  <?php
185
  }
186
 
@@ -192,13 +182,8 @@ class Strong_Testimonials_Post_Editor {
192
  * @param $is_new
193
  */
194
  private static function meta_option__checkbox( $field, $post, $is_new ) {
195
- printf(
196
- '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
197
- esc_attr( $field['input_type'] ),
198
- esc_attr( $field['name'] ),
199
- 1,
200
- checked( $post->{$field['name']}, 1, false )
201
- );
202
  }
203
 
204
  /**
@@ -214,41 +199,45 @@ class Strong_Testimonials_Post_Editor {
214
  $rating = 0;
215
  }
216
  ?>
217
- <div class="edit-rating-box hide-if-no-js" data-field="<?php echo esc_attr( $field['name'] ); ?>">
218
 
219
  <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
220
- <input type="hidden" class="current-rating" value="<?php echo esc_attr( $rating ); ?>">
221
 
222
- <!-- form -->
223
- <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
224
- <span class="inner">
225
- <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
226
- </span>
227
  <?php if ( ! $is_new ) : ?>
228
- <span class="edit-rating-buttons-2">
229
- <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
230
- <button type="button" class="save button button-small"><?php esc_html_e( 'OK' ); ?></button>&nbsp;
231
- <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel' ); ?></button>
232
- </span>
 
233
  <?php endif; ?>
234
- </div>
235
 
236
- <!-- display -->
237
- <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
238
- <span class="inner">
239
- <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
240
- </span>
241
 
242
  <?php if ( ! $is_new ) : ?>
243
- <span class="edit-rating-buttons-1">
244
- <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit' ); ?></button>
245
- </span>
 
 
 
246
  <?php endif; ?>
247
- </div>
248
 
249
- <span class="edit-rating-success"></span>
250
 
251
- </div>
252
  <?php
253
  }
254
 
@@ -260,12 +249,12 @@ class Strong_Testimonials_Post_Editor {
260
  * @param $is_new
261
  */
262
  public static function meta_option__shortcode( $field, $post, $is_new ) {
263
- $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
264
- if ( shortcode_exists( $shortcode ) ) {
265
- echo do_shortcode( $field['shortcode_on_display'] );
266
- } else {
267
- echo '<div class="custom-input not-found">' . sprintf( esc_html__( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . esc_html( $field['shortcode_on_display'] ) . '</code>' ) . '</div>';
268
- }
269
  }
270
 
271
  /**
@@ -296,10 +285,10 @@ class Strong_Testimonials_Post_Editor {
296
  // Determine whether to update or delete.
297
  // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
298
  foreach ( $custom as $key => $value ) {
299
- $action = 'update';
300
 
301
- if ( isset( $custom_fields[ $key ] ) ) {
302
- if ( 'rating' == $custom_fields[ $key ]['input_type'] && ! $value ) {
303
  $action = 'delete';
304
  }
305
  }
@@ -307,7 +296,8 @@ class Strong_Testimonials_Post_Editor {
307
  if ( 'update' == $action ) {
308
  // empty values replace existing values
309
  update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
310
- } else {
 
311
  // delete value; e.g. zero rating
312
  delete_post_meta( $_POST['post_ID'], $key );
313
  }
@@ -316,19 +306,19 @@ class Strong_Testimonials_Post_Editor {
316
 
317
  /**
318
  * Prevent use of this plugin's shortcode in a testimonial.
319
- *
320
- * @since 2.32.2
321
  * @param $data
322
  * @param $postarr
323
  *
324
  * @return mixed
325
  */
326
  public static function prevent_shortcode( $data, $postarr ) {
327
- if ( 'wpm-testimonial' == $data['post_type'] ) {
328
- $data['post_content'] = preg_replace( '/\[testimonial_view (.*)\]/', '', $data['post_content'] );
329
- }
330
 
331
- return $data;
332
  }
333
 
334
  /**
@@ -354,10 +344,7 @@ class Strong_Testimonials_Post_Editor {
354
  }
355
 
356
  $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
357
- $response = array(
358
- 'display' => $display,
359
- 'message' => $message,
360
- );
361
  echo json_encode( $response );
362
  wp_die();
363
  }
54
  $is_new = ( 'post-new.php' == $pagenow );
55
  ?>
56
  <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
57
+ <table class="options">
58
+ <tr>
59
+ <td colspan="2">
60
+ <p><?php _ex( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
61
+ </td>
62
+ </tr>
63
  <?php
64
  do_action( 'wpmtst_before_client_fields' );
65
  foreach ( $fields as $key => $field ) {
69
  continue;
70
  }
71
  ?>
72
+ <tr>
73
+ <th>
74
+ <label for="<?php esc_attr_e( $field['name'] ); ?>">
75
+ <?php echo apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ); ?>
76
+ </label>
77
+ </th>
78
+ <td>
79
+ <div class="<?php esc_attr_e( $field['input_type'] ); ?>">
80
  <?php self::meta_option( $field, $post, $is_new ); ?>
81
+ </div>
82
+ </td>
83
+ </tr>
84
  <?php
85
  }
86
  do_action( 'wpmtst_after_client_fields' );
87
  ?>
88
+ </table>
89
  <?php
90
  do_action( 'wpmtst_after_client_fields_table' );
91
  }
107
  // Check field type.
108
  else {
109
  switch ( $field['input_type'] ) {
110
+ case 'rating' :
111
  self::meta_option__rating( $field, $post, $is_new );
112
  break;
113
+ case 'url' :
114
  self::meta_option__url( $field, $post, $is_new );
115
  break;
116
+ case 'checkbox' :
117
  self::meta_option__checkbox( $field, $post, $is_new );
118
  break;
119
+ case 'shortcode' :
120
  self::meta_option__shortcode( $field, $post, $is_new );
121
  break;
122
+ default :
123
  self::meta_option__text( $field, $post, $is_new );
124
  }
125
  }
126
  }
127
 
128
  /**
129
+ * Custom action callback.
130
+ *
131
  * @param $field
132
  * @param $post
133
  * @param $is_new
146
  * @param $is_new
147
  */
148
  private static function meta_option__text( $field, $post, $is_new ) {
149
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
150
+ $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
 
 
 
 
151
  }
152
 
153
  /**
159
  */
160
  private static function meta_option__url( $field, $post, $is_new ) {
161
  ?>
162
+ <div class="input-url">
163
+ <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
164
+ $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) ); ?>
165
+ </div>
166
+ <div class="input-nofollow">
167
+ <label for="custom_nofollow"><code>rel="nofollow"</code></label>
168
+ <select id="custom_nofollow" name="custom[nofollow]">
169
+ <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php _e( 'default', 'strong-testimonials' ); ?></option>
170
+ <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php _e( 'yes', 'strong-testimonials' ); ?></option>
171
+ <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php _e( 'no', 'strong-testimonials' ); ?></option>
172
+ </select>
173
+ </div>
 
 
 
 
 
 
174
  <?php
175
  }
176
 
182
  * @param $is_new
183
  */
184
  private static function meta_option__checkbox( $field, $post, $is_new ) {
185
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
186
+ $field['input_type'], $field['name'], 1, checked( $post->{$field['name']}, 1, false ) );
 
 
 
 
 
187
  }
188
 
189
  /**
199
  $rating = 0;
200
  }
201
  ?>
202
+ <div class="edit-rating-box hide-if-no-js" data-field="<?php echo $field['name']; ?>">
203
 
204
  <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
205
+ <input type="hidden" class="current-rating" value="<?php echo $rating; ?>">
206
 
207
+ <!-- form -->
208
+ <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
209
+ <span class="inner">
210
+ <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
211
+ </span>
212
  <?php if ( ! $is_new ) : ?>
213
+ <span class="edit-rating-buttons-2">
214
+ <button type="button"
215
+ class="zero button-link"><?php _e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
216
+ <button type="button" class="save button button-small"><?php _e( 'OK' ); ?></button>&nbsp;
217
+ <button type="button" class="cancel button-link"><?php _e( 'Cancel' ); ?></button>
218
+ </span>
219
  <?php endif; ?>
220
+ </div>
221
 
222
+ <!-- display -->
223
+ <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
224
+ <span class="inner">
225
+ <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
226
+ </span>
227
 
228
  <?php if ( ! $is_new ) : ?>
229
+ <span class="edit-rating-buttons-1">
230
+ <button type="button"
231
+ id=""
232
+ class="edit-rating button button-small hide-if-no-js"
233
+ aria-label="Edit rating"><?php _e( 'Edit' ); ?></button>
234
+ </span>
235
  <?php endif; ?>
236
+ </div>
237
 
238
+ <span class="edit-rating-success"></span>
239
 
240
+ </div>
241
  <?php
242
  }
243
 
249
  * @param $is_new
250
  */
251
  public static function meta_option__shortcode( $field, $post, $is_new ) {
252
+ $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
253
+ if ( shortcode_exists( $shortcode ) ) {
254
+ echo do_shortcode( $field['shortcode_on_display'] );
255
+ } else {
256
+ echo '<div class="custom-input not-found">' . sprintf( __( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . $field['shortcode_on_display'] . '</code>' ) . '</div>';
257
+ }
258
  }
259
 
260
  /**
285
  // Determine whether to update or delete.
286
  // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
287
  foreach ( $custom as $key => $value ) {
288
+ $action = 'update';
289
 
290
+ if ( isset( $custom_fields[ $key ] ) ) {
291
+ if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
292
  $action = 'delete';
293
  }
294
  }
296
  if ( 'update' == $action ) {
297
  // empty values replace existing values
298
  update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
299
+ }
300
+ else {
301
  // delete value; e.g. zero rating
302
  delete_post_meta( $_POST['post_ID'], $key );
303
  }
306
 
307
  /**
308
  * Prevent use of this plugin's shortcode in a testimonial.
309
+ *
310
+ * @since 2.32.2
311
  * @param $data
312
  * @param $postarr
313
  *
314
  * @return mixed
315
  */
316
  public static function prevent_shortcode( $data, $postarr ) {
317
+ if ( 'wpm-testimonial' == $data['post_type'] ) {
318
+ $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
319
+ }
320
 
321
+ return $data;
322
  }
323
 
324
  /**
344
  }
345
 
346
  $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
347
+ $response = array( 'display' => $display, 'message' => $message );
 
 
 
348
  echo json_encode( $response );
349
  wp_die();
350
  }
admin/class-strong-testimonials-updater.php CHANGED
@@ -29,7 +29,8 @@ class Strong_Testimonials_Updater {
29
  $this->old_version = get_option( 'wpmtst_plugin_version', false );
30
  if ( $this->old_version ) {
31
  $this->log( __CLASS__, 'old: ' . $this->old_version . ' --> new: ' . WPMTST_VERSION );
32
- } else {
 
33
  $this->log( __CLASS__, 'NEW INSTALL', WPMTST_VERSION );
34
  }
35
  }
@@ -53,13 +54,16 @@ class Strong_Testimonials_Updater {
53
  $this->new_log[] = $x;
54
  // then log the variable
55
  $this->new_log[] = $var;
56
- } else {
 
57
  $this->new_log[] = $x . $var;
58
  }
59
- } else {
 
60
  $this->new_log[] = $x;
61
  }
62
- } else {
 
63
  $this->new_log[] = $x;
64
  }
65
  }
@@ -244,7 +248,8 @@ class Strong_Testimonials_Updater {
244
  $admins->add_cap( 'strong_testimonials_fields' );
245
  $admins->add_cap( 'strong_testimonials_options' );
246
  $admins->add_cap( 'strong_testimonials_about' );
247
- } else {
 
248
  $this->log( __FUNCTION__, 'failed' );
249
  }
250
  }
@@ -345,6 +350,7 @@ class Strong_Testimonials_Updater {
345
  if ( isset( $options['client_section'] ) ) {
346
  unset( $options['client_section'] );
347
  }
 
348
  }
349
 
350
  /**
@@ -468,6 +474,7 @@ class Strong_Testimonials_Updater {
468
  if ( $new_default ) {
469
  $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
470
  }
 
471
  }
472
  }
473
 
@@ -561,39 +568,39 @@ class Strong_Testimonials_Updater {
561
  */
562
  switch ( $form_options['captcha'] ) {
563
 
564
- case 'gglcptch':
565
  // Google Captcha by BestWebSoft
566
  $form_options['captcha'] = 'google-captcha';
567
  $notice = false;
568
  break;
569
 
570
- case 'bwsmathpro':
571
  // Captcha Pro by BestWebSoft
572
  $form_options['captcha'] = 'captcha-pro';
573
  $notice = false;
574
  break;
575
 
576
- case 'miyoshi':
577
  // Really Simple Captcha by Takayuki Miyoshi
578
  $form_options['captcha'] = 'really-simple-captcha';
579
  $notice = false;
580
  break;
581
 
582
- case 'advnore':
583
  // Advanced noCaptcha reCaptcha by Shamim Hasan
584
  // Integration dropped @since 2.29.0
585
  $form_options['captcha'] = '';
586
  $notice = true;
587
  break;
588
 
589
- case 'bwsmath':
590
  // Craptcha by simplywordpress
591
  // Integration dropped @since 2.29.0
592
  $form_options['captcha'] = '';
593
  $notice = true;
594
  break;
595
 
596
- default:
597
  $notice = false;
598
  }
599
 
@@ -827,8 +834,8 @@ class Strong_Testimonials_Updater {
827
 
828
  $view_data['slideshow_settings']['show_single'] = array(
829
  'max_slides' => $view_data['slideshow_settings']['max_slides'],
830
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
831
- 'margin' => 1,
832
  );
833
 
834
  } else {
@@ -867,68 +874,68 @@ class Strong_Testimonials_Updater {
867
  /*
868
  Array
869
  (
870
- [0] => default:content
871
- [1] => default-dark:form
872
- [2] => default-dark:content
873
- [3] => default:form
874
- [4] => image-right:content
875
- [5] => no-quotes:content
876
- [6] => large:widget
877
- [7] => modern:content
878
- [8] => simple:content
879
- [9] => simple:form
880
- [10] => unstyled:content
881
- [11] => unstyled:form
882
- [12] => default:widget
883
- [13] => image-right:widget
884
  )
885
  */
886
  switch ( $view_data['template'] ) {
887
- case 'default:content':
888
  $view_data['template'] = 'default';
889
  break;
890
- case 'default-dark:form':
891
- $view_data['template'] = 'default-form';
892
  $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
893
  break;
894
- case 'default-dark:content':
895
- $view_data['template'] = 'default';
896
  $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
897
  break;
898
- case 'default:form':
899
  $view_data['template'] = 'default-form';
900
  break;
901
- case 'image-right:content':
902
- $view_data['template'] = 'default';
903
  $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
904
  break;
905
- case 'no-quotes:content':
906
- $view_data['template'] = 'default';
907
  $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
908
  break;
909
- case 'large:widget':
910
  $view_data['template'] = 'bold';
911
  break;
912
- case 'modern:content':
913
  $view_data['template'] = 'modern';
914
  break;
915
- case 'simple:content':
916
  $view_data['template'] = 'simple';
917
  break;
918
- case 'simple:form':
919
  $view_data['template'] = 'simple-form';
920
  break;
921
- case 'unstyled:content':
922
  $view_data['template'] = 'unstyled';
923
  break;
924
- case 'unstyled:form':
925
  $view_data['template'] = 'unstyled-form';
926
  break;
927
- case 'default:widget':
928
  $view_data['template'] = 'small-widget';
929
  break;
930
- case 'image-right:widget':
931
- $view_data['template'] = 'small-widget';
932
  $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
933
  break;
934
  default:
@@ -950,16 +957,19 @@ class Strong_Testimonials_Updater {
950
  if ( ! $view_data['template'] ) {
951
  if ( 'form' == $view_data['mode'] ) {
952
  $type = 'form';
953
- } else {
 
954
  $type = 'content';
955
  }
956
 
957
  $view_data['template'] = "default:$type";
958
- } else {
 
959
  // Convert name; e.g. 'simple/testimonials.php'
960
  if ( 'widget/testimonials.php' == $view_data['template'] ) {
961
  $view_data['template'] = 'default:widget';
962
- } else {
 
963
  $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
964
  $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
965
  $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
@@ -989,7 +999,8 @@ class Strong_Testimonials_Updater {
989
  $word_count = $word_count < 5 ? 5 : $word_count;
990
  $word_count = $word_count > 300 ? 300 : $word_count;
991
  $view_data['excerpt_length'] = $word_count;
992
- } else {
 
993
  $view_data['excerpt_length'] = $default_view['excerpt_length'];
994
  }
995
 
@@ -1015,7 +1026,8 @@ class Strong_Testimonials_Updater {
1015
  $view_data['more_page_id'] = $view_data['more_page'];
1016
  $view_data['more_page'] = 1;
1017
  $view_data['more_page_text'] = $view_data['more_text'];
1018
- } elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
 
1019
  $view_data['more_post_text'] = $view_data['more_text'];
1020
  }
1021
  unset( $view_data['more_text'] );
@@ -1248,16 +1260,21 @@ class Strong_Testimonials_Updater {
1248
 
1249
  if ( 'on' == $nofollow ) {
1250
  $new_value = 'yes';
1251
- } elseif ( 1 === $nofollow ) {
 
1252
  $new_value = 'yes';
1253
- } elseif ( 'off' == $nofollow ) {
 
1254
  $new_value = 'no';
1255
- } elseif ( 0 === $nofollow ) {
 
1256
  $new_value = 'no';
1257
- } elseif ( is_bool( $nofollow ) ) {
 
1258
  if ( $nofollow ) {
1259
  $new_value = 'yes';
1260
- } else {
 
1261
  $new_value = 'default';
1262
  }
1263
  }
29
  $this->old_version = get_option( 'wpmtst_plugin_version', false );
30
  if ( $this->old_version ) {
31
  $this->log( __CLASS__, 'old: ' . $this->old_version . ' --> new: ' . WPMTST_VERSION );
32
+ }
33
+ else {
34
  $this->log( __CLASS__, 'NEW INSTALL', WPMTST_VERSION );
35
  }
36
  }
54
  $this->new_log[] = $x;
55
  // then log the variable
56
  $this->new_log[] = $var;
57
+ }
58
+ else {
59
  $this->new_log[] = $x . $var;
60
  }
61
+ }
62
+ else {
63
  $this->new_log[] = $x;
64
  }
65
+ }
66
+ else {
67
  $this->new_log[] = $x;
68
  }
69
  }
248
  $admins->add_cap( 'strong_testimonials_fields' );
249
  $admins->add_cap( 'strong_testimonials_options' );
250
  $admins->add_cap( 'strong_testimonials_about' );
251
+ }
252
+ else {
253
  $this->log( __FUNCTION__, 'failed' );
254
  }
255
  }
350
  if ( isset( $options['client_section'] ) ) {
351
  unset( $options['client_section'] );
352
  }
353
+
354
  }
355
 
356
  /**
474
  if ( $new_default ) {
475
  $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
476
  }
477
+
478
  }
479
  }
480
 
568
  */
569
  switch ( $form_options['captcha'] ) {
570
 
571
+ case 'gglcptch' :
572
  // Google Captcha by BestWebSoft
573
  $form_options['captcha'] = 'google-captcha';
574
  $notice = false;
575
  break;
576
 
577
+ case 'bwsmathpro' :
578
  // Captcha Pro by BestWebSoft
579
  $form_options['captcha'] = 'captcha-pro';
580
  $notice = false;
581
  break;
582
 
583
+ case 'miyoshi' :
584
  // Really Simple Captcha by Takayuki Miyoshi
585
  $form_options['captcha'] = 'really-simple-captcha';
586
  $notice = false;
587
  break;
588
 
589
+ case 'advnore' :
590
  // Advanced noCaptcha reCaptcha by Shamim Hasan
591
  // Integration dropped @since 2.29.0
592
  $form_options['captcha'] = '';
593
  $notice = true;
594
  break;
595
 
596
+ case 'bwsmath' :
597
  // Craptcha by simplywordpress
598
  // Integration dropped @since 2.29.0
599
  $form_options['captcha'] = '';
600
  $notice = true;
601
  break;
602
 
603
+ default :
604
  $notice = false;
605
  }
606
 
834
 
835
  $view_data['slideshow_settings']['show_single'] = array(
836
  'max_slides' => $view_data['slideshow_settings']['max_slides'],
837
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
838
+ 'margin' => 1,
839
  );
840
 
841
  } else {
874
  /*
875
  Array
876
  (
877
+ [0] => default:content
878
+ [1] => default-dark:form
879
+ [2] => default-dark:content
880
+ [3] => default:form
881
+ [4] => image-right:content
882
+ [5] => no-quotes:content
883
+ [6] => large:widget
884
+ [7] => modern:content
885
+ [8] => simple:content
886
+ [9] => simple:form
887
+ [10] => unstyled:content
888
+ [11] => unstyled:form
889
+ [12] => default:widget
890
+ [13] => image-right:widget
891
  )
892
  */
893
  switch ( $view_data['template'] ) {
894
+ case 'default:content' :
895
  $view_data['template'] = 'default';
896
  break;
897
+ case 'default-dark:form' :
898
+ $view_data['template'] = 'default-form';
899
  $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
900
  break;
901
+ case 'default-dark:content' :
902
+ $view_data['template'] = 'default';
903
  $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
904
  break;
905
+ case 'default:form' :
906
  $view_data['template'] = 'default-form';
907
  break;
908
+ case 'image-right:content' :
909
+ $view_data['template'] = 'default';
910
  $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
911
  break;
912
+ case 'no-quotes:content' :
913
+ $view_data['template'] = 'default';
914
  $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
915
  break;
916
+ case 'large:widget' :
917
  $view_data['template'] = 'bold';
918
  break;
919
+ case 'modern:content' :
920
  $view_data['template'] = 'modern';
921
  break;
922
+ case 'simple:content' :
923
  $view_data['template'] = 'simple';
924
  break;
925
+ case 'simple:form' :
926
  $view_data['template'] = 'simple-form';
927
  break;
928
+ case 'unstyled:content' :
929
  $view_data['template'] = 'unstyled';
930
  break;
931
+ case 'unstyled:form' :
932
  $view_data['template'] = 'unstyled-form';
933
  break;
934
+ case 'default:widget' :
935
  $view_data['template'] = 'small-widget';
936
  break;
937
+ case 'image-right:widget' :
938
+ $view_data['template'] = 'small-widget';
939
  $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
940
  break;
941
  default:
957
  if ( ! $view_data['template'] ) {
958
  if ( 'form' == $view_data['mode'] ) {
959
  $type = 'form';
960
+ }
961
+ else {
962
  $type = 'content';
963
  }
964
 
965
  $view_data['template'] = "default:$type";
966
+ }
967
+ else {
968
  // Convert name; e.g. 'simple/testimonials.php'
969
  if ( 'widget/testimonials.php' == $view_data['template'] ) {
970
  $view_data['template'] = 'default:widget';
971
+ }
972
+ else {
973
  $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
974
  $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
975
  $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
999
  $word_count = $word_count < 5 ? 5 : $word_count;
1000
  $word_count = $word_count > 300 ? 300 : $word_count;
1001
  $view_data['excerpt_length'] = $word_count;
1002
+ }
1003
+ else {
1004
  $view_data['excerpt_length'] = $default_view['excerpt_length'];
1005
  }
1006
 
1026
  $view_data['more_page_id'] = $view_data['more_page'];
1027
  $view_data['more_page'] = 1;
1028
  $view_data['more_page_text'] = $view_data['more_text'];
1029
+ }
1030
+ elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
1031
  $view_data['more_post_text'] = $view_data['more_text'];
1032
  }
1033
  unset( $view_data['more_text'] );
1260
 
1261
  if ( 'on' == $nofollow ) {
1262
  $new_value = 'yes';
1263
+ }
1264
+ elseif ( 1 === $nofollow ) {
1265
  $new_value = 'yes';
1266
+ }
1267
+ elseif ( 'off' == $nofollow ) {
1268
  $new_value = 'no';
1269
+ }
1270
+ elseif ( 0 === $nofollow ) {
1271
  $new_value = 'no';
1272
+ }
1273
+ elseif ( is_bool( $nofollow ) ) {
1274
  if ( $nofollow ) {
1275
  $new_value = 'yes';
1276
+ }
1277
+ else {
1278
  $new_value = 'default';
1279
  }
1280
  }
admin/class-strong-views-list-table.php CHANGED
@@ -7,7 +7,7 @@
7
 
8
  class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
 
10
- public $stickies;
11
 
12
  /**
13
  * Message to be displayed when there are no items
@@ -16,11 +16,11 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
16
  * @access public
17
  */
18
  public function no_items() {
19
- esc_html_e( 'No views found.', 'strong-testimonials' );
20
  }
21
 
22
  public function prepare_list( $data = array() ) {
23
- $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
 
25
  $columns = $this->get_columns();
26
  $hidden = $this->get_hidden_columns();
@@ -32,16 +32,16 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
32
  if ( isset( $_GET['orderby'] ) ) {
33
  usort( $data, array( &$this, 'usort_reorder' ) );
34
  }
35
- $data = $this->move_sticky( $data );
36
  $this->items = $data;
37
  }
38
 
39
- /**
40
- * Move sticky views to the top
41
- *
42
  * @param $data
43
- * @since 0.2.0
44
- * @return array
45
  */
46
  public function move_sticky( $data ) {
47
  $sticky_views = $views = array();
@@ -76,8 +76,8 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
76
 
77
  public function get_sortable_columns() {
78
  return array(
79
- 'id' => array( 'id', false ),
80
- 'name' => array( 'name', false ),
81
  );
82
  }
83
 
@@ -86,13 +86,13 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
86
  $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'name';
87
 
88
  // If no order, default to asc
89
- $order = ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'asc';
90
 
91
  // Determine sort order
92
  if ( 'id' == $orderby ) {
93
  $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
94
  } else {
95
- $result = strcasecmp( $a[ $orderby ], $b[ $orderby ] );
96
  }
97
 
98
  // Send final sort direction to usort
@@ -113,7 +113,7 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
113
 
114
  // Edit link
115
  $edit_link = $url . '&page=testimonial-views&action=edit&id=' . $item['id'];
116
- echo '<a class="row-title" href="' . esc_url( $edit_link ) . '">' . esc_html( $item['name'] ) . '</a>';
117
 
118
  // Duplicate link
119
  // @since 2.1.0
@@ -123,12 +123,12 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
123
  $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
124
 
125
  // Assemble links
126
- $actions = array();
127
  $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
128
  $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate' ) . '</a>';
129
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete' ) . '</a>';
130
 
131
- echo wp_kses_post( $this->row_actions( $actions ) );
132
  }
133
 
134
  public function column_default( $item, $column_name ) {
@@ -137,18 +137,18 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
137
  $text = $item['id'];
138
  break;
139
  case 'sticky':
140
- $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
141
- $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
142
  break;
143
  case 'name':
144
  $text = $item['name'];
145
  break;
146
  case 'mode':
147
- $mode = $item['data']['mode'];
148
- $text = $mode;
149
  $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
150
  if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
151
- $text = $view_options['mode'][ $mode ]['label'];
152
  }
153
  break;
154
  case 'template':
@@ -195,37 +195,34 @@ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
195
  //$this->display_tablenav( 'top' );
196
 
197
  ?>
198
- <div class="wp-list-table-wrap">
199
- <div class="overlay" style="display: none;"></div>
200
- <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>">
201
- <thead>
202
- <tr>
203
- <?php $this->print_column_headers(); ?>
204
- </tr>
205
- </thead>
206
-
207
- <tbody id="the-list"
208
- <?php
209
- if ( $singular ) {
210
- echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
211
- }
212
- ?>
213
- >
214
- <?php $this->display_rows_or_placeholder(); ?>
215
- </tbody>
216
-
217
- <tfoot>
218
- <tr>
219
- <?php $this->print_column_headers( false ); ?>
220
- </tr>
221
- </tfoot>
222
-
223
- </table>
224
- <?php
225
- //$this->display_tablenav( 'bottom' );
226
- ?>
227
- </div>
228
- <?php
229
  }
230
 
231
  }
7
 
8
  class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
 
10
+ public $stickies;
11
 
12
  /**
13
  * Message to be displayed when there are no items
16
  * @access public
17
  */
18
  public function no_items() {
19
+ _e( 'No views found.', 'strong-testimonials' );
20
  }
21
 
22
  public function prepare_list( $data = array() ) {
23
+ $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
 
25
  $columns = $this->get_columns();
26
  $hidden = $this->get_hidden_columns();
32
  if ( isset( $_GET['orderby'] ) ) {
33
  usort( $data, array( &$this, 'usort_reorder' ) );
34
  }
35
+ $data = $this->move_sticky( $data );
36
  $this->items = $data;
37
  }
38
 
39
+ /**
40
+ * Move sticky views to the top
41
+ *
42
  * @param $data
43
+ * @since 0.2.0
44
+ * @return array
45
  */
46
  public function move_sticky( $data ) {
47
  $sticky_views = $views = array();
76
 
77
  public function get_sortable_columns() {
78
  return array(
79
+ 'id' => array( 'id', false ),
80
+ 'name' => array( 'name', false ),
81
  );
82
  }
83
 
86
  $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'name';
87
 
88
  // If no order, default to asc
89
+ $order = ( ! empty($_GET['order'] ) ) ? $_GET['order'] : 'asc';
90
 
91
  // Determine sort order
92
  if ( 'id' == $orderby ) {
93
  $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
94
  } else {
95
+ $result = strcasecmp( $a[$orderby], $b[$orderby] );
96
  }
97
 
98
  // Send final sort direction to usort
113
 
114
  // Edit link
115
  $edit_link = $url . '&page=testimonial-views&action=edit&id=' . $item['id'];
116
+ echo '<a class="row-title" href="' . $edit_link . '">' . $item['name'] . '</a>';
117
 
118
  // Duplicate link
119
  // @since 2.1.0
123
  $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
124
 
125
  // Assemble links
126
+ $actions = array();
127
  $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
128
  $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate' ) . '</a>';
129
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "Delete \"%s\"?" ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete' ) . "</a>";
130
 
131
+ echo $this->row_actions( $actions );
132
  }
133
 
134
  public function column_default( $item, $column_name ) {
137
  $text = $item['id'];
138
  break;
139
  case 'sticky':
140
+ $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
141
+ $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
142
  break;
143
  case 'name':
144
  $text = $item['name'];
145
  break;
146
  case 'mode':
147
+ $mode = $item['data']['mode'];
148
+ $text = $mode;
149
  $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
150
  if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
151
+ $text = $view_options['mode'][ $mode ]['label'];
152
  }
153
  break;
154
  case 'template':
195
  //$this->display_tablenav( 'top' );
196
 
197
  ?>
198
+ <div class="wp-list-table-wrap">
199
+ <div class="overlay" style="display: none;"></div>
200
+ <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
201
+ <thead>
202
+ <tr>
203
+ <?php $this->print_column_headers(); ?>
204
+ </tr>
205
+ </thead>
206
+
207
+ <tbody id="the-list"<?php
208
+ if ( $singular ) {
209
+ echo " data-wp-lists='list:$singular'";
210
+ } ?>>
211
+ <?php $this->display_rows_or_placeholder(); ?>
212
+ </tbody>
213
+
214
+ <tfoot>
215
+ <tr>
216
+ <?php $this->print_column_headers( false ); ?>
217
+ </tr>
218
+ </tfoot>
219
+
220
+ </table>
221
+ <?php
222
+ //$this->display_tablenav( 'bottom' );
223
+ ?>
224
+ </div>
225
+ <?php
 
 
 
226
  }
227
 
228
  }
admin/class-walker-strong-category-checklist.php CHANGED
@@ -16,10 +16,7 @@
16
  */
17
  class Walker_Strong_Category_Checklist extends Walker {
18
  public $tree_type = 'category';
19
- public $db_fields = array(
20
- 'parent' => 'parent',
21
- 'id' => 'term_id',
22
- ); //TODO: decouple this
23
 
24
  /**
25
  * Starts the list before the elements are added.
@@ -33,7 +30,7 @@ class Walker_Strong_Category_Checklist extends Walker {
33
  * @param array $args An array of arguments. @see wp_terms_checklist()
34
  */
35
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
36
- $indent = str_repeat( "\t", $depth );
37
  $output .= "$indent<ul class='children'>\n";
38
  }
39
 
@@ -49,7 +46,7 @@ class Walker_Strong_Category_Checklist extends Walker {
49
  * @param array $args An array of arguments. @see wp_terms_checklist()
50
  */
51
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
52
- $indent = str_repeat( "\t", $depth );
53
  $output .= "$indent</ul>\n";
54
  }
55
 
@@ -73,10 +70,10 @@ class Walker_Strong_Category_Checklist extends Walker {
73
  $taxonomy = $args['taxonomy'];
74
  }
75
 
76
- $name = 'view[data][category]';
77
 
78
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
79
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
80
 
81
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
82
 
@@ -84,7 +81,7 @@ class Walker_Strong_Category_Checklist extends Walker {
84
 
85
  if ( ! empty( $args['list_only'] ) ) {
86
  $aria_cheched = 'false';
87
- $inner_class = 'category';
88
 
89
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
90
  $inner_class .= ' selected';
@@ -96,7 +93,8 @@ class Walker_Strong_Category_Checklist extends Walker {
96
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
97
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
98
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
99
- } else {
 
100
  /** This filter is documented in wp-includes/category-template.php */
101
  // newlines make for consistent spacing without extra CSS
102
  $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
16
  */
17
  class Walker_Strong_Category_Checklist extends Walker {
18
  public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
 
 
 
20
 
21
  /**
22
  * Starts the list before the elements are added.
30
  * @param array $args An array of arguments. @see wp_terms_checklist()
31
  */
32
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
  $output .= "$indent<ul class='children'>\n";
35
  }
36
 
46
  * @param array $args An array of arguments. @see wp_terms_checklist()
47
  */
48
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
  $output .= "$indent</ul>\n";
51
  }
52
 
70
  $taxonomy = $args['taxonomy'];
71
  }
72
 
73
+ $name = "view[data][category]";
74
 
75
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
 
78
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
 
81
 
82
  if ( ! empty( $args['list_only'] ) ) {
83
  $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
 
86
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
  $inner_class .= ' selected';
93
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
  /** This filter is documented in wp-includes/category-template.php */
99
  // newlines make for consistent spacing without extra CSS
100
  $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
admin/class-walker-strong-form-category-checklist.php CHANGED
@@ -16,10 +16,7 @@
16
  */
17
  class Walker_Strong_Form_Category_Checklist extends Walker {
18
  public $tree_type = 'category';
19
- public $db_fields = array(
20
- 'parent' => 'parent',
21
- 'id' => 'term_id',
22
- ); //TODO: decouple this
23
 
24
  /**
25
  * Starts the list before the elements are added.
@@ -33,7 +30,7 @@ class Walker_Strong_Form_Category_Checklist extends Walker {
33
  * @param array $args An array of arguments. @see wp_terms_checklist()
34
  */
35
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
36
- $indent = str_repeat( "\t", $depth );
37
  $output .= "$indent<ul class='children'>\n";
38
  }
39
 
@@ -49,7 +46,7 @@ class Walker_Strong_Form_Category_Checklist extends Walker {
49
  * @param array $args An array of arguments. @see wp_terms_checklist()
50
  */
51
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
52
- $indent = str_repeat( "\t", $depth );
53
  $output .= "$indent</ul>\n";
54
  }
55
 
@@ -73,10 +70,10 @@ class Walker_Strong_Form_Category_Checklist extends Walker {
73
  $taxonomy = $args['taxonomy'];
74
  }
75
 
76
- $name = 'view[data][category-form]';
77
 
78
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
79
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
80
 
81
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
82
 
@@ -84,7 +81,7 @@ class Walker_Strong_Form_Category_Checklist extends Walker {
84
 
85
  if ( ! empty( $args['list_only'] ) ) {
86
  $aria_cheched = 'false';
87
- $inner_class = 'category';
88
 
89
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
90
  $inner_class .= ' selected';
@@ -96,7 +93,8 @@ class Walker_Strong_Form_Category_Checklist extends Walker {
96
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
97
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
98
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
99
- } else {
 
100
  /** This filter is documented in wp-includes/category-template.php */
101
  // newlines make for consistent spacing without extra CSS
102
  $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
16
  */
17
  class Walker_Strong_Form_Category_Checklist extends Walker {
18
  public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
 
 
 
20
 
21
  /**
22
  * Starts the list before the elements are added.
30
  * @param array $args An array of arguments. @see wp_terms_checklist()
31
  */
32
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
  $output .= "$indent<ul class='children'>\n";
35
  }
36
 
46
  * @param array $args An array of arguments. @see wp_terms_checklist()
47
  */
48
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
  $output .= "$indent</ul>\n";
51
  }
52
 
70
  $taxonomy = $args['taxonomy'];
71
  }
72
 
73
+ $name = "view[data][category-form]";
74
 
75
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
 
78
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
 
81
 
82
  if ( ! empty( $args['list_only'] ) ) {
83
  $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
 
86
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
  $inner_class .= ' selected';
93
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
  /** This filter is documented in wp-includes/category-template.php */
99
  // newlines make for consistent spacing without extra CSS
100
  $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
admin/compat.php CHANGED
@@ -38,7 +38,7 @@ function wpmtst_compat_admin_init() {
38
  * 1. on the `admin_init` hook
39
  * 2. UNconditionally
40
  */
41
- if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
 
43
  /** Screen information is not available yet. */
44
  //$screen = get_current_screen();
@@ -49,6 +49,7 @@ function wpmtst_compat_admin_init() {
49
  remove_action( 'admin_init', 'pp_add_init' );
50
  }
51
  }
 
52
  }
53
  }
54
  add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
@@ -66,25 +67,24 @@ function wpmtst_deny_plugins_init() {
66
  */
67
  if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
68
  $options = get_option( 'hicpo_options' );
69
- $update = false;
70
 
71
  if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
72
  if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
73
  $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
74
- $update = true;
75
  }
76
  }
77
 
78
  if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
79
  if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
80
  $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
81
- $update = true;
82
  }
83
  }
84
 
85
- if ( $update ) {
86
  update_option( 'hicpo_options', $options );
87
- }
88
  }
89
 
90
  /**
@@ -92,25 +92,24 @@ function wpmtst_deny_plugins_init() {
92
  */
93
  if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
  $options = get_option( 'scporder_options' );
95
- $update = false;
96
 
97
  if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
  if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
  $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
- $update = true;
101
  }
102
  }
103
 
104
  if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
  if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
  $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
- $update = true;
108
  }
109
  }
110
 
111
- if ( $update ) {
112
  update_option( 'scporder_options', $options );
113
- }
114
  }
115
 
116
  }
38
  * 1. on the `admin_init` hook
39
  * 2. UNconditionally
40
  */
41
+ if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
 
43
  /** Screen information is not available yet. */
44
  //$screen = get_current_screen();
49
  remove_action( 'admin_init', 'pp_add_init' );
50
  }
51
  }
52
+
53
  }
54
  }
55
  add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
67
  */
68
  if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
69
  $options = get_option( 'hicpo_options' );
70
+ $update = false;
71
 
72
  if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
73
  if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
74
  $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
75
+ $update = true;
76
  }
77
  }
78
 
79
  if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
80
  if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
81
  $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
82
+ $update = true;
83
  }
84
  }
85
 
86
+ if ( $update )
87
  update_option( 'hicpo_options', $options );
 
88
  }
89
 
90
  /**
92
  */
93
  if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
  $options = get_option( 'scporder_options' );
95
+ $update = false;
96
 
97
  if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
  if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
  $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
+ $update = true;
101
  }
102
  }
103
 
104
  if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
  if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
  $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
+ $update = true;
108
  }
109
  }
110
 
111
+ if ( $update )
112
  update_option( 'scporder_options', $options );
 
113
  }
114
 
115
  }
admin/custom-fields-ajax.php CHANGED
@@ -19,7 +19,7 @@ function wpmtst_add_field_function() {
19
  'label' => __( 'New Field', 'strong-testimonials' ),
20
  'show_label' => 1,
21
  );
22
- echo wp_kses_post( wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true ) );
23
  wp_die();
24
  }
25
  add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
@@ -36,10 +36,10 @@ function wpmtst_add_field_2_function() {
36
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
 
38
  $empty_field = array_merge(
39
- $fields['field_types'][ $new_field_class ][ $new_field_type ],
40
  array( 'record_type' => $new_field_class )
41
  );
42
- echo wp_kses_post( wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field ) );
43
  wp_die();
44
  }
45
  add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
@@ -56,10 +56,10 @@ function wpmtst_add_field_3_function() {
56
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
57
 
58
  $empty_field = array_merge(
59
- $fields['field_types'][ $new_field_class ][ $new_field_type ],
60
  array( 'record_type' => $new_field_class )
61
  );
62
- echo wp_kses_post( wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field ) );
63
  wp_die();
64
  }
65
  add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
@@ -75,13 +75,13 @@ function wpmtst_add_field_4_function() {
75
  $new_field_class = $_REQUEST['fieldClass'];
76
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
77
  $empty_field = array();
78
- if ( isset( $fields['field_types'][ $new_field_class ][ $new_field_type ] ) ) {
79
  $empty_field = array_merge(
80
  $fields['field_types'][ $new_field_class ][ $new_field_type ],
81
  array( 'record_type' => $new_field_class )
82
  );
83
  }
84
- echo wp_kses_post( wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field ) );
85
  wp_die();
86
  }
87
  add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
@@ -93,7 +93,7 @@ add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
93
  function wpmtst_ajax_cat_count() {
94
  check_ajax_referer( 'wpmtst-admin', 'security', false );
95
 
96
- echo wp_kses_post( wpmtst_get_cat_count() );
97
  wp_die();
98
  }
99
  add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
19
  'label' => __( 'New Field', 'strong-testimonials' ),
20
  'show_label' => 1,
21
  );
22
+ echo wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true );
23
  wp_die();
24
  }
25
  add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
36
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
 
38
  $empty_field = array_merge(
39
+ $fields['field_types'][$new_field_class][$new_field_type],
40
  array( 'record_type' => $new_field_class )
41
  );
42
+ echo wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field );
43
  wp_die();
44
  }
45
  add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
56
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
57
 
58
  $empty_field = array_merge(
59
+ $fields['field_types'][$new_field_class][$new_field_type],
60
  array( 'record_type' => $new_field_class )
61
  );
62
+ echo wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field );
63
  wp_die();
64
  }
65
  add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
75
  $new_field_class = $_REQUEST['fieldClass'];
76
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
77
  $empty_field = array();
78
+ if ( isset( $fields['field_types'][$new_field_class][$new_field_type] ) ) {
79
  $empty_field = array_merge(
80
  $fields['field_types'][ $new_field_class ][ $new_field_type ],
81
  array( 'record_type' => $new_field_class )
82
  );
83
  }
84
+ echo wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field );
85
  wp_die();
86
  }
87
  add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
93
  function wpmtst_ajax_cat_count() {
94
  check_ajax_referer( 'wpmtst-admin', 'security', false );
95
 
96
+ echo wpmtst_get_cat_count();
97
  wp_die();
98
  }
99
  add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
admin/custom-fields.php CHANGED
@@ -31,99 +31,101 @@ function wpmtst_update_custom_fields() {
31
  exit;
32
  }
33
 
34
- $form_id = $_POST['form_id'];
35
- $forms = get_option( 'wpmtst_custom_forms' );
36
- $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
 
38
- if ( isset( $_POST['reset'] ) ) {
39
 
40
- // Undo changes
41
  wpmtst_add_admin_notice( 'changes-cancelled' );
42
 
43
- } elseif ( isset( $_POST['restore-defaults'] ) ) {
 
44
 
45
- // Restore defaults
46
- $default_forms = Strong_Testimonials_Defaults::get_base_forms();
47
- $fields = $default_forms['default']['fields'];
48
- $forms[ $form_id ]['fields'] = $fields;
49
- update_option( 'wpmtst_custom_forms', $forms );
50
- do_action( 'wpmtst_fields_updated', $fields );
51
 
52
  wpmtst_add_admin_notice( 'defaults-restored' );
53
 
54
- } else {
 
55
 
56
- // Save changes
57
- $fields = array();
58
- $new_key = 0;
59
 
60
- /**
61
- * Strip the dang slashes from the dang magic quotes.
62
- *
63
- * @since 2.0.0
64
- */
65
- $post_fields = stripslashes_deep( $_POST['fields'] );
66
 
67
- foreach ( $post_fields as $key => $field ) {
68
 
69
- /*
70
- * Before merging onto base field, catch fields that are "off"
71
- * which the form does not submit. Otherwise, the default "on"
72
- * would override the requested (but not submitted) "off".
73
- */
74
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
75
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
76
 
77
- $field = array_merge( $field_options['field_base'], $field );
78
 
79
- $field['name'] = sanitize_text_field( $field['name'] );
80
- $field['label'] = sanitize_text_field( $field['label'] );
81
 
82
- // TODO Replace this special handling
83
- if ( 'checkbox' == $field['input_type'] ) {
84
- $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
85
- } else {
86
- $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
87
- }
88
- $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
89
- $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
90
 
91
- $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
92
 
93
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
94
 
95
- if ( isset( $field['text'] ) ) {
96
- $field['text'] = wp_kses_post( $field['text'] );
97
- }
98
- $field['before'] = wp_kses_post( $field['before'] );
99
- $field['after'] = wp_kses_post( $field['after'] );
100
 
101
- $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
102
- $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
103
- $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
104
 
105
- // Hidden options (no need to check if isset)
106
- $field['admin_table'] = $field['admin_table'] ? 1 : 0;
107
- $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
108
- $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
109
- $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
110
- $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
111
 
112
- // add to fields array in display order
113
- $fields[ $new_key++ ] = $field;
114
 
115
- }
116
 
117
- $forms[ $form_id ]['fields'] = $fields;
118
 
119
- if ( isset( $_POST['field_group_label'] ) ) {
120
- // TODO Catch if empty.
121
- $new_label = sanitize_text_field( $_POST['field_group_label'] );
122
- $forms[ $form_id ]['label'] = $new_label;
123
- }
124
 
125
- update_option( 'wpmtst_custom_forms', $forms );
126
- do_action( 'wpmtst_fields_updated', $fields );
127
 
128
  wpmtst_add_admin_notice( 'fields-saved' );
129
 
@@ -142,70 +144,70 @@ add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fiel
142
  */
143
  function wpmtst_settings_custom_fields( $form_id = 1 ) {
144
  if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
145
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) );
146
  }
147
 
148
  if ( ! $form_id ) {
149
- echo '<div class="wrap wpmtst"><p>' . esc_html__( 'No fields selected.', 'strong-testimonials' ) . '</p></div>';
150
  return;
151
  }
152
 
153
  $forms = get_option( 'wpmtst_custom_forms' );
154
- $fields = $forms[ $form_id ]['fields'];
155
  ?>
156
- <div class="wrap wpmtst">
157
- <h1 class="wp-heading-inline"><?php esc_html_e( 'Fields', 'strong-testimonials' ); ?></h1>
158
- <hr class="wp-header-end">
159
- <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
160
-
161
- <div id="left-col">
162
- <div>
163
- <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
164
- <p>
165
- <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
166
- <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help' ); ?></a>
167
- </p>
168
- <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
169
- </div>
170
-
171
- <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
172
- <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
173
- <input type="hidden" name="action" value="wpmtst_update_custom_fields">
174
- <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
175
-
176
- <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
177
-
178
- <ul id="custom-field-list">
179
- <?php
180
- foreach ( $fields as $key => $field ) {
181
- echo '<li id="field-' . esc_attr( $key ) . '">' . wp_kses_post( wpmtst_show_field( $key, $field, false ) ) . '</li>' . "\n";
182
- }
183
- ?>
184
- </ul>
185
-
186
- <div id="add-field-bar">
187
- <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
188
- </div>
189
-
190
- <div id="field-group-actions">
191
- <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
192
- <div><?php submit_button( __( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
193
- <div><?php submit_button( __( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
194
- </div>
195
- </form>
196
- </div><!-- #left-col -->
197
-
198
- <div id="right-col">
199
- <div class="intro">
200
- <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
201
- <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
202
- </div>
203
- <div id="fields-editor-preview">
204
- <div><!-- placeholder --></div>
205
- </div>
206
- </div><!-- #right-col -->
207
-
208
- </div><!-- .wrap -->
209
  <?php
210
  }
211
 
@@ -222,33 +224,33 @@ function wpmtst_show_field( $key, $field, $adding ) {
222
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
223
  $field_types = $fields['field_types'];
224
 
225
- ob_start();
226
 
227
  include 'partials/fields/field-header.php';
228
- ?>
229
  <div class="custom-field" style="display: none;">
230
- <table class="field-table">
231
- <?php
232
- include 'partials/fields/field-type.php';
233
- include 'partials/fields/field-label.php';
234
- include 'partials/fields/field-name.php';
235
-
236
- if ( ! $adding ) {
237
- echo wp_kses_post( wpmtst_show_field_secondary( $key, $field ) );
238
- echo wp_kses_post( wpmtst_show_field_admin_table( $key, $field ) );
239
- }
240
- ?>
241
- </table>
242
-
243
- <?php
244
- if ( ! $adding ) {
245
- echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
246
- }
247
- include 'partials/fields/field-controls.php';
248
- ?>
249
  </div><!-- .custom-field -->
250
 
251
- <?php
252
  $html = ob_get_contents();
253
  ob_end_clean();
254
 
@@ -266,31 +268,31 @@ function wpmtst_show_field( $key, $field, $adding ) {
266
  * @return string
267
  */
268
  function wpmtst_show_field_secondary( $key, $field ) {
269
- $html = '';
270
 
271
  /*
272
  * Required
273
  */
274
- if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
275
- // Disable option if this is a core field like post_content.
276
- if ( isset( $field['core'] ) && $field['core'] ) {
277
- $disabled = ' disabled="disabled"';
278
- } else {
279
- $disabled = false;
280
- }
281
-
282
- $html .= '<tr class="field-secondary">' . "\n";
283
- $html .= '<th>' . __( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
284
- $html .= '<td>' . "\n";
285
- if ( $disabled ) {
286
- $html .= '<input type="hidden" name="fields[' . $key . '][required]" value="' . $field['required'] . '">';
287
- $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
288
- } else {
289
- $html .= '<input type="checkbox" name="fields[' . $key . '][required]" ' . checked( $field['required'], true, false ) . '>';
290
- }
291
- $html .= '</td>' . "\n";
292
- $html .= '</tr>' . "\n";
293
- }
294
 
295
  /*
296
  * Placeholder
@@ -306,8 +308,8 @@ function wpmtst_show_field_secondary( $key, $field ) {
306
 
307
  /**
308
  * Text (checkbox, radio)
309
- *
310
- * @since 2.23.0
311
  */
312
  if ( $field['show_text_option'] ) {
313
  if ( isset( $field['text'] ) ) {
@@ -348,19 +350,19 @@ function wpmtst_show_field_secondary( $key, $field ) {
348
 
349
  $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
350
  $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
351
- $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
352
 
353
  } elseif ( 'checkbox' == $field['input_type'] ) {
354
 
355
- $html .= '<label>';
356
- $html .= '<input type="checkbox" name="fields[' . $key . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
357
  $html .= '<span class="help inline">' . __( 'Checked by default.', 'strong-testimonials' ) . '</span>';
358
  $html .= '</label>';
359
 
360
- } else {
361
 
362
  $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
363
- $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
364
 
365
  }
366
 
@@ -373,7 +375,7 @@ function wpmtst_show_field_secondary( $key, $field ) {
373
  * Default Display Value
374
  */
375
  if ( $field['show_default_options'] ) {
376
- // TODO Replace this special handling for checkbox type
377
  if ( 'checkbox' != $field['input_type'] ) {
378
  if ( isset( $field['default_display_value'] ) ) {
379
  $html .= '<tr class="field-secondary">' . "\n";
@@ -433,7 +435,7 @@ function wpmtst_show_field_admin_table( $key, $field ) {
433
  return $html;
434
  }
435
 
436
- $html = '<tr class="field-admin-table">' . "\n";
437
  $html .= '<th>' . __( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
438
  $html .= '<td>' . "\n";
439
  if ( $field['admin_table_option'] ) {
@@ -462,7 +464,7 @@ function wpmtst_show_field_admin_table( $key, $field ) {
462
  function wpmtst_show_field_hidden( $key, $field ) {
463
  $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
464
 
465
- $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
466
  $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
467
  if ( isset( $field['action_input'] ) ) {
468
  $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
31
  exit;
32
  }
33
 
34
+ $form_id = $_POST['form_id'];
35
+ $forms = get_option( 'wpmtst_custom_forms' );
36
+ $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
 
38
+ if ( isset( $_POST['reset'] ) ) {
39
 
40
+ // Undo changes
41
  wpmtst_add_admin_notice( 'changes-cancelled' );
42
 
43
+ }
44
+ elseif ( isset( $_POST['restore-defaults'] ) ) {
45
 
46
+ // Restore defaults
47
+ $default_forms = Strong_Testimonials_Defaults::get_base_forms();
48
+ $fields = $default_forms['default']['fields'];
49
+ $forms[ $form_id ]['fields'] = $fields;
50
+ update_option( 'wpmtst_custom_forms', $forms );
51
+ do_action( 'wpmtst_fields_updated', $fields );
52
 
53
  wpmtst_add_admin_notice( 'defaults-restored' );
54
 
55
+ }
56
+ else {
57
 
58
+ // Save changes
59
+ $fields = array();
60
+ $new_key = 0;
61
 
62
+ /**
63
+ * Strip the dang slashes from the dang magic quotes.
64
+ *
65
+ * @since 2.0.0
66
+ */
67
+ $post_fields = stripslashes_deep( $_POST['fields'] );
68
 
69
+ foreach ( $post_fields as $key => $field ) {
70
 
71
+ /*
72
+ * Before merging onto base field, catch fields that are "off"
73
+ * which the form does not submit. Otherwise, the default "on"
74
+ * would override the requested (but not submitted) "off".
75
+ */
76
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
77
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
78
 
79
+ $field = array_merge( $field_options['field_base'], $field );
80
 
81
+ $field['name'] = sanitize_text_field( $field['name'] );
82
+ $field['label'] = sanitize_text_field( $field['label'] );
83
 
84
+ // TODO Replace this special handling
85
+ if ( 'checkbox' == $field['input_type'] ) {
86
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
87
+ } else {
88
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
89
+ }
90
+ $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
91
+ $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
92
 
93
+ $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
94
 
95
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
96
 
97
+ if ( isset( $field['text'] ) ) {
98
+ $field['text'] = wp_kses_post( $field['text'] );
99
+ }
100
+ $field['before'] = wp_kses_post( $field['before'] );
101
+ $field['after'] = wp_kses_post( $field['after'] );
102
 
103
+ $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
104
+ $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
105
+ $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
106
 
107
+ // Hidden options (no need to check if isset)
108
+ $field['admin_table'] = $field['admin_table'] ? 1 : 0;
109
+ $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
+ $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
+ $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
+ $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
 
114
+ // add to fields array in display order
115
+ $fields[ $new_key++ ] = $field;
116
 
117
+ }
118
 
119
+ $forms[ $form_id ]['fields'] = $fields;
120
 
121
+ if ( isset( $_POST['field_group_label'] ) ) {
122
+ // TODO Catch if empty.
123
+ $new_label = sanitize_text_field( $_POST['field_group_label'] );
124
+ $forms[ $form_id ]['label'] = $new_label;
125
+ }
126
 
127
+ update_option( 'wpmtst_custom_forms', $forms );
128
+ do_action( 'wpmtst_fields_updated', $fields );
129
 
130
  wpmtst_add_admin_notice( 'fields-saved' );
131
 
144
  */
145
  function wpmtst_settings_custom_fields( $form_id = 1 ) {
146
  if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
147
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
148
  }
149
 
150
  if ( ! $form_id ) {
151
+ echo '<div class="wrap wpmtst"><p>' . __( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
152
  return;
153
  }
154
 
155
  $forms = get_option( 'wpmtst_custom_forms' );
156
+ $fields = $forms[$form_id]['fields'];
157
  ?>
158
+ <div class="wrap wpmtst">
159
+ <h1 class="wp-heading-inline"><?php _e( 'Fields', 'strong-testimonials' ); ?></h1>
160
+ <hr class="wp-header-end">
161
+ <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
162
+
163
+ <div id="left-col">
164
+ <div>
165
+ <h3><?php _e( 'Editor', 'strong-testimonials' ); ?></h3>
166
+ <p>
167
+ <?php _e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
168
+ <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php _e( 'Help' ); ?></a>
169
+ </p>
170
+ <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
171
+ </div>
172
+
173
+ <form id="wpmtst-custom-fields-form" method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>" autocomplete="off">
174
+ <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
175
+ <input type="hidden" name="action" value="wpmtst_update_custom_fields">
176
+ <input type="hidden" name="form_id" value="<?php echo $form_id; ?>">
177
+
178
+ <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
179
+
180
+ <ul id="custom-field-list">
181
+ <?php
182
+ foreach ( $fields as $key => $field ) {
183
+ echo '<li id="field-' . $key . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
184
+ }
185
+ ?>
186
+ </ul>
187
+
188
+ <div id="add-field-bar">
189
+ <input id="add-field" type="button" class="button" name="add-field" value="<?php _e( 'Add New Field', 'strong-testimonials' ); ?>">
190
+ </div>
191
+
192
+ <div id="field-group-actions">
193
+ <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
194
+ <div><?php submit_button( __( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
195
+ <div><?php submit_button( __( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
196
+ </div>
197
+ </form>
198
+ </div><!-- #left-col -->
199
+
200
+ <div id="right-col">
201
+ <div class="intro">
202
+ <h3><?php _e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
203
+ <p><?php _e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
204
+ </div>
205
+ <div id="fields-editor-preview">
206
+ <div><!-- placeholder --></div>
207
+ </div>
208
+ </div><!-- #right-col -->
209
+
210
+ </div><!-- .wrap -->
211
  <?php
212
  }
213
 
224
  $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
225
  $field_types = $fields['field_types'];
226
 
227
+ ob_start();
228
 
229
  include 'partials/fields/field-header.php';
230
+ ?>
231
  <div class="custom-field" style="display: none;">
232
+ <table class="field-table">
233
+ <?php
234
+ include 'partials/fields/field-type.php';
235
+ include 'partials/fields/field-label.php';
236
+ include 'partials/fields/field-name.php';
237
+
238
+ if ( ! $adding ) {
239
+ echo wpmtst_show_field_secondary( $key, $field );
240
+ echo wpmtst_show_field_admin_table( $key, $field );
241
+ }
242
+ ?>
243
+ </table>
244
+
245
+ <?php
246
+ if ( ! $adding ) {
247
+ echo wpmtst_show_field_hidden( $key, $field );
248
+ }
249
+ include 'partials/fields/field-controls.php';
250
+ ?>
251
  </div><!-- .custom-field -->
252
 
253
+ <?php
254
  $html = ob_get_contents();
255
  ob_end_clean();
256
 
268
  * @return string
269
  */
270
  function wpmtst_show_field_secondary( $key, $field ) {
271
+ $html = '';
272
 
273
  /*
274
  * Required
275
  */
276
+ if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
277
+ // Disable option if this is a core field like post_content.
278
+ if ( isset( $field['core'] ) && $field['core'] ) {
279
+ $disabled = ' disabled="disabled"';
280
+ } else {
281
+ $disabled = false;
282
+ }
283
+
284
+ $html .= '<tr class="field-secondary">' . "\n";
285
+ $html .= '<th>' . __( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
286
+ $html .= '<td>' . "\n";
287
+ if ( $disabled ) {
288
+ $html .= '<input type="hidden" name="fields[' . $key . '][required]" value="' . $field['required'] . '">';
289
+ $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
290
+ } else {
291
+ $html .= '<input type="checkbox" name="fields[' . $key . '][required]" ' . checked( $field['required'], true, false ) . '>';
292
+ }
293
+ $html .= '</td>' . "\n";
294
+ $html .= '</tr>' . "\n";
295
+ }
296
 
297
  /*
298
  * Placeholder
308
 
309
  /**
310
  * Text (checkbox, radio)
311
+ *
312
+ * @since 2.23.0
313
  */
314
  if ( $field['show_text_option'] ) {
315
  if ( isset( $field['text'] ) ) {
350
 
351
  $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
352
  $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
353
+ $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
354
 
355
  } elseif ( 'checkbox' == $field['input_type'] ) {
356
 
357
+ $html .= '<label>';
358
+ $html .= '<input type="checkbox" name="fields[' . $key . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
359
  $html .= '<span class="help inline">' . __( 'Checked by default.', 'strong-testimonials' ) . '</span>';
360
  $html .= '</label>';
361
 
362
+ } else {
363
 
364
  $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
365
+ $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
366
 
367
  }
368
 
375
  * Default Display Value
376
  */
377
  if ( $field['show_default_options'] ) {
378
+ // TODO Replace this special handling for checkbox type
379
  if ( 'checkbox' != $field['input_type'] ) {
380
  if ( isset( $field['default_display_value'] ) ) {
381
  $html .= '<tr class="field-secondary">' . "\n";
435
  return $html;
436
  }
437
 
438
+ $html = '<tr class="field-admin-table">' . "\n";
439
  $html .= '<th>' . __( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
440
  $html .= '<td>' . "\n";
441
  if ( $field['admin_table_option'] ) {
464
  function wpmtst_show_field_hidden( $key, $field ) {
465
  $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
466
 
467
+ $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
468
  $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
469
  if ( isset( $field['action_input'] ) ) {
470
  $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
admin/form-preview.php CHANGED
@@ -1,15 +1,13 @@
1
  <?php
2
 
3
  function wpmtst_get_form_preview() {
4
- if ( ! isset( $_POST['fields'] ) ) {
5
- exit;
6
- }
7
 
8
  // parse_str decodes too; no need to use urldecode
9
  parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
10
 
11
  $new_fields = array();
12
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
13
 
14
  foreach ( $preview['fields'] as $key => $field ) {
15
  /*
@@ -17,8 +15,8 @@ function wpmtst_get_form_preview() {
17
  * which the form does not submit. Otherwise, the default "on"
18
  * would override the requested (but not submitted) "off".
19
  */
20
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
21
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
22
 
23
  $field = array_merge( $fields['field_base'], $field );
24
 
@@ -26,17 +24,17 @@ function wpmtst_get_form_preview() {
26
  $field['input_type'] = 'text';
27
  }
28
 
29
- $field['name'] = sanitize_text_field( $field['name'] );
30
- $field['label'] = sanitize_text_field( $field['label'] );
31
  // TODO Replace this special handling
32
  if ( 'checkbox' == $field['input_type'] ) {
33
  $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
34
  } else {
35
  $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
36
  }
37
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
38
- $field['before'] = sanitize_text_field( $field['before'] );
39
- $field['after'] = sanitize_text_field( $field['after'] );
40
 
41
  // add to fields array in display order
42
  $new_fields[] = $field;
@@ -46,7 +44,7 @@ function wpmtst_get_form_preview() {
46
  include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
47
  $html = ob_get_contents();
48
  ob_end_clean();
49
- echo wp_kses_post( $html );
50
 
51
  exit;
52
  }
1
  <?php
2
 
3
  function wpmtst_get_form_preview() {
4
+ if ( ! isset( $_POST['fields'] ) ) exit;
 
 
5
 
6
  // parse_str decodes too; no need to use urldecode
7
  parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
 
9
  $new_fields = array();
10
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
 
12
  foreach ( $preview['fields'] as $key => $field ) {
13
  /*
15
  * which the form does not submit. Otherwise, the default "on"
16
  * would override the requested (but not submitted) "off".
17
  */
18
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
 
21
  $field = array_merge( $fields['field_base'], $field );
22
 
24
  $field['input_type'] = 'text';
25
  }
26
 
27
+ $field['name'] = sanitize_text_field( $field['name'] );
28
+ $field['label'] = sanitize_text_field( $field['label'] );
29
  // TODO Replace this special handling
30
  if ( 'checkbox' == $field['input_type'] ) {
31
  $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32
  } else {
33
  $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34
  }
35
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36
+ $field['before'] = sanitize_text_field( $field['before'] );
37
+ $field['after'] = sanitize_text_field( $field['after'] );
38
 
39
  // add to fields array in display order
40
  $new_fields[] = $field;
44
  include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45
  $html = ob_get_contents();
46
  ob_end_clean();
47
+ echo $html;
48
 
49
  exit;
50
  }
admin/menu/class-strong-testimonials-menu-fields.php CHANGED
@@ -43,8 +43,8 @@ class Strong_Testimonials_Menu_Fields {
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => apply_filters( 'wpmtst_fields_page_title', __( 'Fields', 'strong-testimonials' ) ),
46
- 'menu_title' => apply_filters( 'wpmtst_fields_menu_title', __( 'Fields', 'strong-testimonials' ) ),
47
- 'capability' => 'strong_testimonials_fields',
48
  'menu_slug' => 'testimonial-fields',
49
  'function' => 'wpmtst_form_admin',
50
  );
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => apply_filters( 'wpmtst_fields_page_title', __( 'Fields', 'strong-testimonials' ) ),
46
+ 'menu_title' => apply_filters( 'wpmtst_fields_menu_title', __( 'Fields', 'strong-testimonials' ) ),
47
+ 'capability' => 'strong_testimonials_fields',
48
  'menu_slug' => 'testimonial-fields',
49
  'function' => 'wpmtst_form_admin',
50
  );
admin/menu/class-strong-testimonials-menu-settings.php CHANGED
@@ -4,7 +4,7 @@
4
  */
5
  class Strong_Testimonials_Menu_Settings {
6
 
7
- public static $callbacks;
8
 
9
  /**
10
  * Strong_Testimonials_Menu_Settings constructor.
@@ -26,8 +26,8 @@ class Strong_Testimonials_Menu_Settings {
26
  }
27
 
28
  /**
29
- * Add submenu page.
30
- *
31
  * @param $pages
32
  *
33
  * @return mixed
@@ -38,15 +38,15 @@ class Strong_Testimonials_Menu_Settings {
38
  }
39
 
40
  /**
41
- * Return submenu page parameters.
42
- *
43
  * @return array
44
  */
45
  public static function get_submenu() {
46
  return array(
47
  'page_title' => __( 'Settings', 'strong-testimonials' ),
48
- 'menu_title' => __( 'Settings', 'strong-testimonials' ),
49
- 'capability' => 'strong_testimonials_options',
50
  'menu_slug' => 'testimonial-settings',
51
  'function' => array( 'Strong_Testimonials_Settings', 'settings_page' ),
52
  );
4
  */
5
  class Strong_Testimonials_Menu_Settings {
6
 
7
+ public static $callbacks;
8
 
9
  /**
10
  * Strong_Testimonials_Menu_Settings constructor.
26
  }
27
 
28
  /**
29
+ * Add submenu page.
30
+ *
31
  * @param $pages
32
  *
33
  * @return mixed
38
  }
39
 
40
  /**
41
+ * Return submenu page parameters.
42
+ *
43
  * @return array
44
  */
45
  public static function get_submenu() {
46
  return array(
47
  'page_title' => __( 'Settings', 'strong-testimonials' ),
48
+ 'menu_title' => __( 'Settings', 'strong-testimonials' ),
49
+ 'capability' => 'strong_testimonials_options',
50
  'menu_slug' => 'testimonial-settings',
51
  'function' => array( 'Strong_Testimonials_Settings', 'settings_page' ),
52
  );
admin/menu/class-strong-testimonials-menu-shortcodes.php CHANGED
@@ -43,8 +43,8 @@ class Strong_Testimonials_Menu_Shortcodes {
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => apply_filters( 'wpmtst_shortcodes_page_title', __( 'Shortcodes', 'strong-testimonials' ) ),
46
- 'menu_title' => apply_filters( 'wpmtst_shortcodes_menu_title', __( 'Shortcodes', 'strong-testimonials' ) ),
47
- 'capability' => 'strong_testimonials_options',
48
  'menu_slug' => 'testimonial-shortcodes',
49
  'function' => array( 'Strong_Testimonials_Page_Shortcodes', 'render_page' ),
50
  );
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => apply_filters( 'wpmtst_shortcodes_page_title', __( 'Shortcodes', 'strong-testimonials' ) ),
46
+ 'menu_title' => apply_filters( 'wpmtst_shortcodes_menu_title', __( 'Shortcodes', 'strong-testimonials' ) ),
47
+ 'capability' => 'strong_testimonials_options',
48
  'menu_slug' => 'testimonial-shortcodes',
49
  'function' => array( 'Strong_Testimonials_Page_Shortcodes', 'render_page' ),
50
  );
admin/menu/class-strong-testimonials-menu-views.php CHANGED
@@ -43,8 +43,8 @@ class Strong_Testimonials_Menu_Views {
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => __( 'Views', 'strong-testimonials' ),
46
- 'menu_title' => __( 'Views', 'strong-testimonials' ),
47
- 'capability' => 'strong_testimonials_views',
48
  'menu_slug' => 'testimonial-views',
49
  'function' => 'wpmtst_views_admin',
50
  );
43
  public static function get_submenu() {
44
  return array(
45
  'page_title' => __( 'Views', 'strong-testimonials' ),
46
+ 'menu_title' => __( 'Views', 'strong-testimonials' ),
47
+ 'capability' => 'strong_testimonials_views',
48
  'menu_slug' => 'testimonial-views',
49
  'function' => 'wpmtst_views_admin',
50
  );
admin/menu/class-strong-testimonials-menu.php CHANGED
@@ -7,44 +7,44 @@ class Strong_Testimonials_Menu {
7
  /**
8
  * The common parent slug.
9
  */
10
- const PARENT_SLUG = 'edit.php?post_type=wpm-testimonial';
11
 
12
  /**
13
  * Strong_Testimonials_Menu constructor.
14
  */
15
- public function __construct() {}
16
 
17
  /**
18
  * Initialize.
19
  */
20
- public static function init() {
21
- self::add_actions();
22
- }
23
 
24
  /**
25
  * Add actions and filters.
26
  */
27
- public static function add_actions() {
28
- add_action( 'admin_menu', array( __CLASS__, 'settings_menu' ) );
29
- }
30
 
31
  /**
32
  * Add submenu pages.
33
  */
34
- public static function settings_menu() {
35
- $submenu_pages = apply_filters( 'wpmtst_submenu_pages', array() );
36
- ksort( $submenu_pages );
37
- foreach ( $submenu_pages as $key => $submenu ) {
38
- add_submenu_page(
39
- self::PARENT_SLUG,
40
- $submenu['page_title'],
41
- $submenu['menu_title'],
42
- $submenu['capability'],
43
- $submenu['menu_slug'],
44
- $submenu['function']
45
- );
46
- }
47
- }
48
 
49
  }
50
 
7
  /**
8
  * The common parent slug.
9
  */
10
+ const PARENT_SLUG = 'edit.php?post_type=wpm-testimonial';
11
 
12
  /**
13
  * Strong_Testimonials_Menu constructor.
14
  */
15
+ public function __construct() {}
16
 
17
  /**
18
  * Initialize.
19
  */
20
+ public static function init() {
21
+ self::add_actions();
22
+ }
23
 
24
  /**
25
  * Add actions and filters.
26
  */
27
+ public static function add_actions() {
28
+ add_action( 'admin_menu', array( __CLASS__, 'settings_menu' ) );
29
+ }
30
 
31
  /**
32
  * Add submenu pages.
33
  */
34
+ public static function settings_menu() {
35
+ $submenu_pages = apply_filters( 'wpmtst_submenu_pages', array() );
36
+ ksort( $submenu_pages );
37
+ foreach ( $submenu_pages as $key => $submenu ) {
38
+ add_submenu_page(
39
+ self::PARENT_SLUG,
40
+ $submenu['page_title'],
41
+ $submenu['menu_title'],
42
+ $submenu['capability'],
43
+ $submenu['menu_slug'],
44
+ $submenu['function']
45
+ );
46
+ }
47
+ }
48
 
49
  }
50
 
admin/partials/fields/field-controls.php CHANGED
@@ -6,7 +6,7 @@ $is_core = ( isset( $field['core'] ) && $field['core'] );
6
  ?>
7
  <div class="controls">
8
  <?php if ( $adding || ! $is_core ) : ?>
9
- <span><a href="#" class="delete-field"><?php esc_html_e( 'Delete' ); ?></a></span>
10
  <?php endif; ?>
11
- <span class="close-field"><a href="#"><?php echo esc_html_x( 'Close', 'verb', 'strong-testimonials' ); ?></a></span>
12
  </div>
6
  ?>
7
  <div class="controls">
8
  <?php if ( $adding || ! $is_core ) : ?>
9
+ <span><a href="#" class="delete-field"><?php _e( 'Delete' ); ?></a></span>
10
  <?php endif; ?>
11
+ <span class="close-field"><a href="#"><?php _ex( 'Close', 'verb', 'strong-testimonials' ); ?></a></span>
12
  </div>
admin/partials/fields/field-header.php CHANGED
@@ -5,9 +5,9 @@
5
  $field_link = $field['label'] ? $field['label'] : ucwords( $field['name'] );
6
  ?>
7
  <div class="custom-field-header">
8
- <span class="link" title="<?php esc_html_e( 'click to open or close', 'strong-testimonials' ); ?>">
9
- <a class="field" href="#"><?php echo esc_html( $field_link ); ?></a>
10
- <span class="handle" title="<?php esc_html_e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
11
  <span class="toggle"></span>
12
  </span>
13
  </div>
5
  $field_link = $field['label'] ? $field['label'] : ucwords( $field['name'] );
6
  ?>
7
  <div class="custom-field-header">
8
+ <span class="link" title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>">
9
+ <a class="field" href="#"><?php echo $field_link; ?></a>
10
+ <span class="handle" title="<?php _e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
11
  <span class="toggle"></span>
12
  </span>
13
  </div>
admin/partials/fields/field-label.php CHANGED
@@ -4,12 +4,12 @@
4
  */
5
  ?>
6
  <tr class="field-label-row">
7
- <th><?php echo esc_html_x( 'Label', 'noun', 'strong-testimonials' ); ?></th>
8
- <td>
9
- <input class="field-label" type="text" name="fields[<?php echo esc_attr( $key ); ?>][label]" value="<?php echo esc_attr( $field['label'] ); ?>">
10
- <label>
11
- <input type="checkbox" name="fields[<?php echo esc_attr( $key ); ?>][show_label]" <?php checked( $field['show_label'], true ); ?>>
12
- <span class="help inline"><?php esc_html_e( 'Show this label on the form.', 'strong-testimonials' ); ?></span>
13
- </label>
14
- </td>
15
  </tr>
4
  */
5
  ?>
6
  <tr class="field-label-row">
7
+ <th><?php _ex( 'Label', 'noun', 'strong-testimonials' ); ?></th>
8
+ <td>
9
+ <input class="field-label" type="text" name="fields[<?php echo $key; ?>][label]" value="<?php echo esc_attr( $field['label'] ); ?>">
10
+ <label>
11
+ <input type="checkbox" name="fields[<?php echo $key; ?>][show_label]" <?php checked( $field['show_label'], true ); ?>>
12
+ <span class="help inline"><?php _e( 'Show this label on the form.', 'strong-testimonials' ); ?></span>
13
+ </label>
14
+ </td>
15
  </tr>
admin/partials/fields/field-name.php CHANGED
@@ -6,18 +6,17 @@
6
  */
7
  ?>
8
  <tr class="field-name-row">
9
- <th><?php echo esc_html_x( 'Name', 'noun', 'strong-testimonials' ); ?></th>
10
  <td>
11
  <?php
12
  // Field names for certain types are read-only.
13
- if ( $field['name_mutable'] ) :
14
- ?>
15
- <input class="field-name" type="text" name="fields[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo isset( $field['name'] ) ? esc_attr( $field['name'] ) : ''; ?>">
16
- <span class="help field-name-help"><?php esc_html_e( 'Use only lowercase letters, numbers, and underscores.', 'strong-testimonials' ); ?></span>
17
- <span class="help field-name-help important"><?php esc_html_e( 'Cannot be "name" or "date".', 'strong-testimonials' ); ?></span>
18
  <?php else : ?>
19
- <input class="field-name" type="text" value="<?php echo esc_attr( $field['name'] ); ?>" disabled="disabled">
20
- <input type="hidden" name="fields[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo esc_attr( $field['name'] ); ?>">
21
  <?php endif ?>
22
  </td>
23
  </tr>
6
  */
7
  ?>
8
  <tr class="field-name-row">
9
+ <th><?php _ex( 'Name', 'noun', 'strong-testimonials' ); ?></th>
10
  <td>
11
  <?php
12
  // Field names for certain types are read-only.
13
+ if ( $field['name_mutable'] ) : ?>
14
+ <input class="field-name" type="text" name="fields[<?php echo $key; ?>][name]" value="<?php echo isset( $field['name'] ) ? esc_attr( $field['name'] ) : ''; ?>">
15
+ <span class="help field-name-help"><?php _e( 'Use only lowercase letters, numbers, and underscores.', 'strong-testimonials' ); ?></span>
16
+ <span class="help field-name-help important"><?php _e( 'Cannot be "name" or "date".', 'strong-testimonials' ); ?></span>
 
17
  <?php else : ?>
18
+ <input class="field-name" type="text" value="<?php echo $field['name']; ?>" disabled="disabled">
19
+ <input type="hidden" name="fields[<?php echo $key; ?>][name]" value="<?php echo $field['name']; ?>">
20
  <?php endif ?>
21
  </td>
22
  </tr>
admin/partials/fields/field-text.php CHANGED
@@ -4,8 +4,11 @@
4
  */
5
  ?>
6
  <tr class="field-label-row">
7
- <th><?php echo esc_html_x( 'Text', 'noun', 'strong-testimonials' ); ?></th>
8
  <td>
9
- <input type="text" class="field-label" name="fields[<?php echo esc_attr( $key ); ?>][text]" value="<?php echo esc_attr( $field['text'] ); ?>" placeholder="<?php esc_html_e( 'next to the checkbox', 'strong-testimonials' ); ?>">
 
 
 
10
  </td>
11
  </tr>
4
  */
5
  ?>
6
  <tr class="field-label-row">
7
+ <th><?php _ex( 'Text', 'noun', 'strong-testimonials' ); ?></th>
8
  <td>
9
+ <input type="text" class="field-label"
10
+ name="fields[<?php echo $key; ?>][text]"
11
+ value="<?php echo esc_attr( $field['text'] ); ?>"
12
+ placeholder="<?php _e('next to the checkbox', 'strong-testimonials' ); ?>">
13
  </td>
14
  </tr>
admin/partials/fields/field-type.php CHANGED
@@ -6,41 +6,41 @@
6
  */
7
  ?>
8
  <tr>
9
- <th><?php echo esc_html_x( 'Type', 'noun', 'strong-testimonials' ); ?></th>
10
  <td>
11
  <?php
12
  if ( $adding ) :
13
- ?>
14
- <select class="first-field field-type new" name="fields[<?php echo esc_attr( $key ); ?>][input_type]">
15
 
16
  <?php /* Start with a blank option with event trigger to update optgroups */ ?>
17
  <option class="no-selection" value="none" name="none">&mdash;</option>
18
 
19
  <?php /* Post fields */ ?>
20
- <optgroup class="post" label="<?php esc_attr_e( 'Post Fields', 'strong-testimonials' ); ?>">
21
  <?php foreach ( $field_types['post'] as $field_key => $field_parts ) : ?>
22
- <option value="<?php echo esc_attr( $field_key ); ?>"><?php echo esc_html( $field_parts['option_label'] ); ?></option>
23
  <?php endforeach; ?>
24
  </optgroup>
25
 
26
  <?php /* Custom fields */ ?>
27
- <optgroup class="custom" label="<?php esc_attr_e( 'Custom Fields', 'strong-testimonials' ); ?>">
28
  <?php foreach ( $field_types['custom'] as $field_key => $field_parts ) : ?>
29
- <option value="<?php echo esc_attr( $field_key ); ?>"><?php echo esc_html( $field_parts['option_label'] ); ?></option>
30
  <?php endforeach; ?>
31
  </optgroup>
32
 
33
  <?php /* Special fields */ ?>
34
- <optgroup class="optional" label="<?php esc_attr_e( 'Special Fields', 'strong-testimonials' ); ?>">
35
  <?php foreach ( $field_types['optional'] as $field_key => $field_parts ) : ?>
36
- <?php $data = ( $field_parts['name'] ) ? ' data-force-name="' . esc_attr( $field_parts['name'] ) . '"' : ''; ?>
37
- <option value="<?php echo esc_attr( $field_key ); ?>"<?php echo $data; ?>><?php echo esc_html( $field_parts['option_label'] ); ?></option>
38
  <?php endforeach; ?>
39
  </optgroup>
40
 
41
  </select>
42
 
43
- <span class="help form-error-text" style="display: none;"><?php esc_html_e( 'Select a field type or delete this field.', 'strong-testimonials' ); ?></span>
44
 
45
  <?php else : ?>
46
 
@@ -48,27 +48,28 @@
48
  if ( 'post' == $field['record_type'] ) {
49
  foreach ( $field_types['post'] as $field_key => $field_parts ) {
50
  // compare field *name*
51
- if ( $field['name'] == $field_key ) {
52
- echo wp_kses_post( $field_parts['option_label'] );
53
- }
54
  }
55
- } elseif ( 'custom' == $field['record_type'] ) {
 
56
  foreach ( $field_types['custom'] as $field_key => $field_parts ) {
57
  // compare field *type*
58
  if ( $field['input_type'] == $field_key ) {
59
- echo wp_kses_post( $field_parts['option_label'] );
60
  }
61
  }
62
- } elseif ( 'optional' == $field['record_type'] ) {
 
63
  foreach ( $field_types['optional'] as $field_key => $field_parts ) {
64
  // compare field *type*
65
  if ( $field['input_type'] == $field_key ) {
66
- echo wp_kses_post( $field_parts['option_label'] );
67
  }
68
  }
69
  }
70
 
71
  endif; // editing
72
- ?>
73
  </td>
74
  </tr>
6
  */
7
  ?>
8
  <tr>
9
+ <th><?php _ex( 'Type', 'noun', 'strong-testimonials' ); ?></th>
10
  <td>
11
  <?php
12
  if ( $adding ) :
13
+ ?>
14
+ <select class="first-field field-type new" name="fields[<?php echo $key; ?>][input_type]">
15
 
16
  <?php /* Start with a blank option with event trigger to update optgroups */ ?>
17
  <option class="no-selection" value="none" name="none">&mdash;</option>
18
 
19
  <?php /* Post fields */ ?>
20
+ <optgroup class="post" label="<?php _e( 'Post Fields', 'strong-testimonials' ); ?>">
21
  <?php foreach ( $field_types['post'] as $field_key => $field_parts ) : ?>
22
+ <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
23
  <?php endforeach; ?>
24
  </optgroup>
25
 
26
  <?php /* Custom fields */ ?>
27
+ <optgroup class="custom" label="<?php _e( 'Custom Fields', 'strong-testimonials' ); ?>">
28
  <?php foreach ( $field_types['custom'] as $field_key => $field_parts ) : ?>
29
+ <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
30
  <?php endforeach; ?>
31
  </optgroup>
32
 
33
  <?php /* Special fields */ ?>
34
+ <optgroup class="optional" label="<?php _e( 'Special Fields', 'strong-testimonials' ); ?>">
35
  <?php foreach ( $field_types['optional'] as $field_key => $field_parts ) : ?>
36
+ <?php $data = ( $field_parts['name'] ) ? ' data-force-name="'.$field_parts['name'].'"' : ''; ?>
37
+ <option value="<?php echo $field_key; ?>"<?php echo $data; ?>><?php echo $field_parts['option_label']; ?></option>
38
  <?php endforeach; ?>
39
  </optgroup>
40
 
41
  </select>
42
 
43
+ <span class="help form-error-text" style="display: none;"><?php _e( 'Select a field type or delete this field.', 'strong-testimonials' ); ?></span>
44
 
45
  <?php else : ?>
46
 
48
  if ( 'post' == $field['record_type'] ) {
49
  foreach ( $field_types['post'] as $field_key => $field_parts ) {
50
  // compare field *name*
51
+ if ( $field['name'] == $field_key )
52
+ echo $field_parts['option_label'];
 
53
  }
54
+ }
55
+ elseif ( 'custom' == $field['record_type'] ) {
56
  foreach ( $field_types['custom'] as $field_key => $field_parts ) {
57
  // compare field *type*
58
  if ( $field['input_type'] == $field_key ) {
59
+ echo $field_parts['option_label'];
60
  }
61
  }
62
+ }
63
+ elseif ( 'optional' == $field['record_type'] ) {
64
  foreach ( $field_types['optional'] as $field_key => $field_parts ) {
65
  // compare field *type*
66
  if ( $field['input_type'] == $field_key ) {
67
+ echo $field_parts['option_label'];
68
  }
69
  }
70
  }
71
 
72
  endif; // editing
73
+ ?>
74
  </td>
75
  </tr>
admin/partials/templates/form-preview-template.php CHANGED
@@ -8,20 +8,20 @@
8
 
9
  <div id="wpmtst-form">
10
 
11
- <div class="strong-form-inner">
12
 
13
- <?php wpmtst_field_required_notice(); ?>
14
 
15
- <form enctype="multipart/form-data" autocomplete="off">
16
 
17
- <?php wpmtst_all_form_fields( $new_fields ); ?>
18
 
19
- <?php wpmtst_form_submit_button( true ); ?>
20
 
21
- </form>
22
 
23
- </div>
24
 
25
  </div>
26
 
27
- </div>
8
 
9
  <div id="wpmtst-form">
10
 
11
+ <div class="strong-form-inner">
12
 
13
+ <?php wpmtst_field_required_notice(); ?>
14
 
15
+ <form enctype="multipart/form-data" autocomplete="off">
16
 
17
+ <?php wpmtst_all_form_fields( $new_fields ); ?>
18
 
19
+ <?php wpmtst_form_submit_button( true ); ?>
20
 
21
+ </form>
22
 
23
+ </div>
24
 
25
  </div>
26
 
27
+ </div>
admin/partials/views/group-compat.php CHANGED
@@ -7,11 +7,11 @@ $then_classes = array(
7
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
8
  <h3>
9
  <?php /* translators: On the Views admin screen. */ ?>
10
- <?php esc_html_e( 'Compatibility', 'strong-testimonials' ); ?>
11
  </h3>
12
  <table class="form-table multiple group-general">
13
  <tr class="then then_display then_form then_slideshow then_not_single_template" style="display: none;">
14
- <?php require 'option-divi.php'; ?>
15
  </tr>
16
  </table>
17
  </div>
7
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
8
  <h3>
9
  <?php /* translators: On the Views admin screen. */ ?>
10
+ <?php _e( 'Compatibility', 'strong-testimonials' ); ?>
11
  </h3>
12
  <table class="form-table multiple group-general">
13
  <tr class="then then_display then_form then_slideshow then_not_single_template" style="display: none;">
14
+ <?php include( 'option-divi.php' ); ?>
15
  </tr>
16
  </table>
17
  </div>
admin/partials/views/group-extra.php CHANGED
@@ -11,14 +11,14 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
- <?php esc_html_e( 'Extra', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-layout">
17
  <tr class="then then_display then_not_form then_not_slideshow then_not_single then_multiple" style="display: none;">
18
- <?php require 'option-pagination.php'; ?>
19
  </tr>
20
  <tr class="then then_display then_not_form then_slideshow read-more" style="display: none;">
21
- <?php require 'option-read-more-page.php'; ?>
22
  </tr>
23
  </table>
24
  </div>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Extra', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-layout">
17
  <tr class="then then_display then_not_form then_not_slideshow then_not_single then_multiple" style="display: none;">
18
+ <?php include( 'option-pagination.php' ); ?>
19
  </tr>
20
  <tr class="then then_display then_not_form then_slideshow read-more" style="display: none;">
21
+ <?php include( 'option-read-more-page.php' ); ?>
22
  </tr>
23
  </table>
24
  </div>
admin/partials/views/group-fields.php CHANGED
@@ -11,7 +11,7 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
- <?php esc_html_e( 'Fields', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-show">
17
 
@@ -26,7 +26,7 @@ $then_classes = array(
26
  );
27
  ?>
28
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
29
- <?php require 'option-title.php'; ?>
30
  </tr>
31
 
32
  <?php
@@ -40,7 +40,7 @@ $then_classes = array(
40
  );
41
  ?>
42
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
43
- <?php require 'option-thumbnail.php'; ?>
44
  </tr>
45
 
46
  <?php
@@ -54,7 +54,7 @@ $then_classes = array(
54
  );
55
  ?>
56
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
57
- <?php require 'option-content.php'; ?>
58
  </tr>
59
 
60
  <?php
@@ -68,7 +68,7 @@ $then_classes = array(
68
  );
69
  ?>
70
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
71
- <?php require 'option-client-section.php'; ?>
72
  </tr>
73
 
74
  </table>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Fields', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-show">
17
 
26
  );
27
  ?>
28
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
29
+ <?php include( 'option-title.php' ); ?>
30
  </tr>
31
 
32
  <?php
40
  );
41
  ?>
42
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
43
+ <?php include( 'option-thumbnail.php' ); ?>
44
  </tr>
45
 
46
  <?php
54
  );
55
  ?>
56
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
57
+ <?php include( 'option-content.php' ); ?>
58
  </tr>
59
 
60
  <?php
68
  );
69
  ?>
70
  <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
71
+ <?php include( 'option-client-section.php' ); ?>
72
  </tr>
73
 
74
  </table>
admin/partials/views/group-form.php CHANGED
@@ -11,14 +11,14 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
- <?php esc_html_e( 'Actions', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
  <tr>
18
- <?php require 'option-form-category.php'; ?>
19
  </tr>
20
  <tr>
21
- <?php require 'option-form-ajax.php'; ?>
22
  </tr>
23
  </table>
24
  </div>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Actions', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
  <tr>
18
+ <?php include('option-form-category.php'); ?>
19
  </tr>
20
  <tr>
21
+ <?php include('option-form-ajax.php'); ?>
22
  </tr>
23
  </table>
24
  </div>
admin/partials/views/group-query.php CHANGED
@@ -11,34 +11,34 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
- <?php esc_html_e( 'Query', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
- <tr class="subheading">
18
- <td><?php esc_html_e( 'Option', 'strong-testimonials' ); ?></td>
19
- <td><?php esc_html_e( 'Setting', 'strong-testimonials' ); ?></td>
20
- <td class="divider" colspan="2">
21
- <?php esc_html_e( 'or Shortcode Attribute', 'strong-testimonials' ); ?>
22
  <span class="help-links">
23
  <span class="description">
24
- <a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab"><?php esc_html_e( 'Help' ); ?></a>
25
  </span>
26
  </span>
27
  </td>
28
- <td>Example</td>
29
- </tr>
30
  <tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
31
- <?php require 'option-select.php'; ?>
32
  </tr>
33
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
34
- <?php require 'option-category.php'; ?>
35
  </tr>
36
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
37
- <?php require 'option-order.php'; ?>
38
  </tr>
39
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
40
- <?php require 'option-limit.php'; ?>
41
  </tr>
42
  <?php // TODO Add hook here ?>
43
- </table>
44
  </div>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Query', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
+ <tr class="subheading">
18
+ <td><?php _e( 'Option', 'strong-testimonials' ); ?></td>
19
+ <td><?php _e( 'Setting', 'strong-testimonials' ); ?></td>
20
+ <td class="divider" colspan="2">
21
+ <?php _e( 'or Shortcode Attribute', 'strong-testimonials' ); ?>
22
  <span class="help-links">
23
  <span class="description">
24
+ <a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab"><?php _e( 'Help' ); ?></a>
25
  </span>
26
  </span>
27
  </td>
28
+ <td>Example</td>
29
+ </tr>
30
  <tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
31
+ <?php include( 'option-select.php' ); ?>
32
  </tr>
33
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
34
+ <?php include( 'option-category.php' ); ?>
35
  </tr>
36
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
37
+ <?php include( 'option-order.php' ); ?>
38
  </tr>
39
  <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
40
+ <?php include( 'option-limit.php' ); ?>
41
  </tr>
42
  <?php // TODO Add hook here ?>
43
+ </table>
44
  </div>
admin/partials/views/group-slideshow.php CHANGED
@@ -11,20 +11,20 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: In the view editor. */ ?>
14
- <?php esc_html_e( 'Slideshow', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
  <tr>
18
- <?php require 'option-slideshow-num.php'; ?>
19
  </tr>
20
  <tr>
21
- <?php require 'option-slideshow-transition.php'; ?>
22
  </tr>
23
  <tr>
24
- <?php require 'option-slideshow-behavior.php'; ?>
25
  </tr>
26
  <tr>
27
- <?php require 'option-slideshow-navigation.php'; ?>
28
  </tr>
29
  </table>
30
  </div>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: In the view editor. */ ?>
14
+ <?php _e( 'Slideshow', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-select">
17
  <tr>
18
+ <?php include( 'option-slideshow-num.php' ); ?>
19
  </tr>
20
  <tr>
21
+ <?php include( 'option-slideshow-transition.php' ); ?>
22
  </tr>
23
  <tr>
24
+ <?php include( 'option-slideshow-behavior.php' ); ?>
25
  </tr>
26
  <tr>
27
+ <?php include( 'option-slideshow-navigation.php' ); ?>
28
  </tr>
29
  </table>
30
  </div>
admin/partials/views/group-style.php CHANGED
@@ -11,40 +11,40 @@ $then_classes = array(
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
- <?php esc_html_e( 'Style', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-style">
17
- <?php do_action( 'wpmtst_view_editor_before_template_list' ); ?>
18
  <tr class="then then_display then_not_form then_slideshow" style="display: none;">
19
  <?php
20
- $current_mode = 'template';
21
- $current_type = 'display';
22
- require 'option-template-list.php';
23
- ?>
24
  </tr>
25
  <tr class="then then_not_display then_form then_not_slideshow" style="display: none;">
26
  <?php
27
  $current_mode = 'form-template';
28
  $current_type = 'form';
29
- require 'option-template-list.php';
30
- ?>
31
  </tr>
32
  <?php do_action( 'wpmtst_view_editor_before_layout' ); ?>
33
  <tr class="then then_display then_not_form then_not_slideshow" style="display: none;">
34
- <?php require 'option-layout.php'; ?>
35
  </tr>
36
  <?php do_action( 'wpmtst_view_editor_before_background' ); ?>
37
 
38
- <tr id="group-style-option-background" class="then then_display then_form then_slideshow" style="display: none;">
39
- <?php require 'option-background.php'; ?>
40
  </tr>
41
- <tr id="group-style-option-color" class="then then_display then_form then_slideshow" style="display: none;">
42
- <?php require 'option-color.php'; ?>
43
  </tr>
44
 
45
  <?php do_action( 'wpmtst_view_editor_before_classes' ); ?>
46
  <tr class="then then_display then_form then_slideshow" style="display: none;">
47
- <?php require 'option-classes.php'; ?>
48
  </tr>
49
  <?php do_action( 'wpmtst_view_editor_after_style_section' ); ?>
50
  </table>
11
  <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
  <h3>
13
  <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Style', 'strong-testimonials' ); ?>
15
  </h3>
16
  <table class="form-table multiple group-style">
17
+ <?php do_action( 'wpmtst_view_editor_before_template_list' ); ?>
18
  <tr class="then then_display then_not_form then_slideshow" style="display: none;">
19
  <?php
20
+ $current_mode = 'template';
21
+ $current_type = 'display';
22
+ include( 'option-template-list.php' );
23
+ ?>
24
  </tr>
25
  <tr class="then then_not_display then_form then_not_slideshow" style="display: none;">
26
  <?php
27
  $current_mode = 'form-template';
28
  $current_type = 'form';
29
+ include( 'option-template-list.php' );
30
+ ?>
31
  </tr>
32
  <?php do_action( 'wpmtst_view_editor_before_layout' ); ?>
33
  <tr class="then then_display then_not_form then_not_slideshow" style="display: none;">
34
+ <?php include( 'option-layout.php' ); ?>
35
  </tr>
36
  <?php do_action( 'wpmtst_view_editor_before_background' ); ?>
37
 
38
+ <tr id="group-style-option-background" class="then then_display then_form then_slideshow" style="display: none;">
39
+ <?php include( 'option-background.php' ); ?>
40
  </tr>
41
+ <tr id="group-style-option-color" class="then then_display then_form then_slideshow" style="display: none;">
42
+ <?php include( 'option-color.php' ); ?>
43
  </tr>
44
 
45
  <?php do_action( 'wpmtst_view_editor_before_classes' ); ?>
46
  <tr class="then then_display then_form then_slideshow" style="display: none;">
47
+ <?php include( 'option-classes.php' ); ?>
48
  </tr>
49
  <?php do_action( 'wpmtst_view_editor_after_style_section' ); ?>
50
  </table>
admin/partials/views/option-background.php CHANGED
@@ -1,105 +1,105 @@
1
  <th>
2
- <?php esc_html_e( 'Background', 'strong-testimonials' ); ?>
3
  </th>
4
  <td>
5
- <div class="section-radios background-section">
6
 
7
- <!-- Inputs -->
8
- <div class="radio-buttons">
9
- <ul class="radio-list background-list">
10
  <li>
11
- <input type="radio"
12
- id="bg-none"
13
- name="view[data][background][type]"
14
- value="" <?php checked( $view['background']['type'], '' ); ?>>
15
- <label for="bg-none">
16
- <?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?>
17
- </label>
18
  </li>
19
  <li>
20
- <input type="radio"
21
- id="bg-single"
22
- name="view[data][background][type]"
23
- value="single" <?php checked( $view['background']['type'], 'single' ); ?>>
24
- <label for="bg-single">
25
- <?php esc_html_e( 'single color', 'strong-testimonials' ); ?>
26
- </label>
27
  </li>
28
  <li>
29
- <input type="radio"
30
- id="bg-gradient"
31
- name="view[data][background][type]"
32
- value="gradient" <?php checked( $view['background']['type'], 'gradient' ); ?>>
33
- <label for="bg-gradient">
34
- <?php esc_html_e( 'gradient', 'strong-testimonials' ); ?>
35
- </label>
36
  </li>
37
  <li>
38
- <input type="radio"
39
- id="bg-preset"
40
- name="view[data][background][type]"
41
- value="preset" <?php checked( $view['background']['type'], 'preset' ); ?>>
42
- <label for="bg-preset">
43
- <?php esc_html_e( 'preset', 'strong-testimonials' ); ?>
44
- </label>
45
  </li>
46
  </ul>
47
  </div>
48
 
49
- <!-- Background info -->
50
- <div class="radio-description" id="view-background-info">
51
 
52
- <div class="background-description bg-none">
53
- <div class="description-inner options">
54
- <div>
55
- <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
56
- </div>
57
- </div>
58
- </div>
59
 
60
  <div class="background-description bg-single">
61
- <div class="description-inner options">
62
- <div>
63
  <label>
64
- <input type="text"
65
- id="bg-color"
66
- name="view[data][background][color]"
67
- value="<?php echo esc_attr( $view['background']['color'] ); ?>"
68
- class="wp-color-picker-field">
69
  </label>
70
  </div>
71
  </div>
72
- </div>
73
 
74
  <div class="background-description bg-gradient">
75
- <div class="description-inner options">
76
- <div>
77
- <div class="color-picker-wrap">
78
- <div>
79
- <label for="bg-gradient1"><?php esc_html_e( 'From top', 'strong-testimonials' ); ?></label>
80
  </div>
81
- <div>
82
- <input type="text"
83
- id="bg-gradient1"
84
- name="view[data][background][gradient1]"
85
- value="<?php echo esc_attr( $view['background']['gradient1'] ); ?>"
86
- class="wp-color-picker-field gradient">
87
- </div>
88
  </div>
89
  </div>
90
- </div>
91
- <div class="description-inner options">
92
- <div>
93
- <div class="color-picker-wrap">
94
- <div>
95
- <label for ="bg-gradient2"><?php esc_html_e( 'To bottom', 'strong-testimonials' ); ?></label>
96
  </div>
97
- <div>
98
- <input type="text"
99
- id="bg-gradient2"
100
- name="view[data][background][gradient2]"
101
- value="<?php echo esc_attr( $view['background']['gradient2'] ); ?>"
102
- class="wp-color-picker-field gradient">
103
  </div>
104
  </div>
105
  </div>
@@ -108,16 +108,16 @@
108
  </div>
109
 
110
  <div class="background-description bg-preset">
111
- <div class="description-inner options">
112
- <div>
113
  <label for="view-background-preset">
114
  <select id="view-background-preset" name="view[data][background][preset]">
115
  <?php
116
- $presets = wpmtst_get_background_presets();
117
  $current_preset = ( isset( $view['background']['preset'] ) && $view['background']['preset'] ) ? $view['background']['preset'] : '';
118
  echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
119
  foreach ( $presets as $key => $preset ) {
120
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $current_preset, $key, false ) . '>' . esc_html( $preset['label'] ) . '</option>';
121
  }
122
  ?>
123
  </select>
@@ -135,17 +135,17 @@
135
  </td>
136
 
137
  <td rowspan="2" class="rowspan">
138
- <div id="view-color-preview" class="table-cell">
139
 
140
- <div class="background-preview-wrap">
141
 
142
- <div id="background-preview">
143
- Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse maiorum
144
- in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad vidisse
145
- expetendis.
146
- </div>
147
 
148
- </div>
149
 
150
- </div>
151
- </td>
1
  <th>
2
+ <?php _e( 'Background', 'strong-testimonials' ); ?>
3
  </th>
4
  <td>
5
+ <div class="section-radios background-section">
6
 
7
+ <!-- Inputs -->
8
+ <div class="radio-buttons">
9
+ <ul class="radio-list background-list">
10
  <li>
11
+ <input type="radio"
12
+ id="bg-none"
13
+ name="view[data][background][type]"
14
+ value="" <?php checked( $view['background']['type'], '' ); ?>>
15
+ <label for="bg-none">
16
+ <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
17
+ </label>
18
  </li>
19
  <li>
20
+ <input type="radio"
21
+ id="bg-single"
22
+ name="view[data][background][type]"
23
+ value="single" <?php checked( $view['background']['type'], 'single' ); ?>>
24
+ <label for="bg-single">
25
+ <?php _e( 'single color', 'strong-testimonials' ); ?>
26
+ </label>
27
  </li>
28
  <li>
29
+ <input type="radio"
30
+ id="bg-gradient"
31
+ name="view[data][background][type]"
32
+ value="gradient" <?php checked( $view['background']['type'], 'gradient' ); ?>>
33
+ <label for="bg-gradient">
34
+ <?php _e( 'gradient', 'strong-testimonials' ); ?>
35
+ </label>
36
  </li>
37
  <li>
38
+ <input type="radio"
39
+ id="bg-preset"
40
+ name="view[data][background][type]"
41
+ value="preset" <?php checked( $view['background']['type'], 'preset' ); ?>>
42
+ <label for="bg-preset">
43
+ <?php _e( 'preset', 'strong-testimonials' ); ?>
44
+ </label>
45
  </li>
46
  </ul>
47
  </div>
48
 
49
+ <!-- Background info -->
50
+ <div class="radio-description" id="view-background-info">
51
 
52
+ <div class="background-description bg-none">
53
+ <div class="description-inner options">
54
+ <div>
55
+ <?php _e( 'No options', 'strong-testimonials' ); ?>
56
+ </div>
57
+ </div>
58
+ </div>
59
 
60
  <div class="background-description bg-single">
61
+ <div class="description-inner options">
62
+ <div>
63
  <label>
64
+ <input type="text"
65
+ id="bg-color"
66
+ name="view[data][background][color]"
67
+ value="<?php echo $view['background']['color']; ?>"
68
+ class="wp-color-picker-field">
69
  </label>
70
  </div>
71
  </div>
72
+ </div>
73
 
74
  <div class="background-description bg-gradient">
75
+ <div class="description-inner options">
76
+ <div>
77
+ <div class="color-picker-wrap">
78
+ <div>
79
+ <label for="bg-gradient1"><?php _e( 'From top', 'strong-testimonials' ); ?></label>
80
  </div>
81
+ <div>
82
+ <input type="text"
83
+ id="bg-gradient1"
84
+ name="view[data][background][gradient1]"
85
+ value="<?php echo $view['background']['gradient1']; ?>"
86
+ class="wp-color-picker-field gradient">
87
+ </div>
88
  </div>
89
  </div>
90
+ </div>
91
+ <div class="description-inner options">
92
+ <div>
93
+ <div class="color-picker-wrap">
94
+ <div>
95
+ <label for ="bg-gradient2"><?php _e( 'To bottom', 'strong-testimonials' ); ?></label>
96
  </div>
97
+ <div>
98
+ <input type="text"
99
+ id="bg-gradient2"
100
+ name="view[data][background][gradient2]"
101
+ value="<?php echo $view['background']['gradient2']; ?>"
102
+ class="wp-color-picker-field gradient">
103
  </div>
104
  </div>
105
  </div>
108
  </div>
109
 
110
  <div class="background-description bg-preset">
111
+ <div class="description-inner options">
112
+ <div>
113
  <label for="view-background-preset">
114
  <select id="view-background-preset" name="view[data][background][preset]">
115
  <?php
116
+ $presets = wpmtst_get_background_presets();
117
  $current_preset = ( isset( $view['background']['preset'] ) && $view['background']['preset'] ) ? $view['background']['preset'] : '';
118
  echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
119
  foreach ( $presets as $key => $preset ) {
120
+ echo '<option value="' . $key . '" ' . selected( $current_preset, $key, false ) . '>' . $preset['label'] . '</option>';
121
  }
122
  ?>
123
  </select>
135
  </td>
136
 
137
  <td rowspan="2" class="rowspan">
138
+ <div id="view-color-preview" class="table-cell">
139
 
140
+ <div class="background-preview-wrap">
141
 
142
+ <div id="background-preview">
143
+ Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse maiorum
144
+ in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad vidisse
145
+ expetendis.
146
+ </div>
147
 
148
+ </div>
149
 
150
+ </div>
151
+ </td>
admin/partials/views/option-boilerplate.php CHANGED
@@ -1,39 +1,39 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-option">
4
- <?php esc_html_e( 'Option Name', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="inline">
9
  <select id="view-option" class="if selectper" name="view[data][option]">
10
  <option value="yes" <?php selected( 'yes', $view['option'] ); ?>>
11
- <?php esc_html_e( 'yes', 'strong-testimonials' ); ?>
12
  </option>
13
  <option value="no" <?php selected( 'no', $view['option'] ); ?>>
14
- <?php esc_html_e( 'no', 'strong-testimonials' ); ?>
15
  </option>
16
  <option value="maybe" <?php selected( 'maybe', $view['option'] ); ?>>
17
- <?php esc_html_e( 'maybe', 'strong-testimonials' ); ?>
18
  </option>
19
  </select>
20
  </div>
21
 
22
  <div class="inline then fast then_yes then_not_no then_not_maybe" style="display: none;">
23
  <p class="description tall">
24
- <?php esc_html_e( 'Yes', 'strong-testimonials' ); ?><br>
25
  </p>
26
  </div>
27
 
28
  <div class="inline then fast then_not_yes then_no then_not_maybe" style="display: none;">
29
  <p class="description tall">
30
- <?php esc_html_e( 'No', 'strong-testimonials' ); ?><br>
31
  </p>
32
  </div>
33
 
34
- <div class="inline then fast then_not_yes then_not_no then_maybe" style="display: none;">
35
- <p class="description tall">
36
- <?php esc_html_e( 'Maybe', 'strong-testimonials' ); ?><br>
37
- </p>
38
- </div>
39
  </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-option">
4
+ <?php _e( 'Option Name', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="inline">
9
  <select id="view-option" class="if selectper" name="view[data][option]">
10
  <option value="yes" <?php selected( 'yes', $view['option'] ); ?>>
11
+ <?php _e( 'yes', 'strong-testimonials' ); ?>
12
  </option>
13
  <option value="no" <?php selected( 'no', $view['option'] ); ?>>
14
+ <?php _e( 'no', 'strong-testimonials' ); ?>
15
  </option>
16
  <option value="maybe" <?php selected( 'maybe', $view['option'] ); ?>>
17
+ <?php _e( 'maybe', 'strong-testimonials' ); ?>
18
  </option>
19
  </select>
20
  </div>
21
 
22
  <div class="inline then fast then_yes then_not_no then_not_maybe" style="display: none;">
23
  <p class="description tall">
24
+ <?php _e( 'Yes', 'strong-testimonials' ); ?><br>
25
  </p>
26
  </div>
27
 
28
  <div class="inline then fast then_not_yes then_no then_not_maybe" style="display: none;">
29
  <p class="description tall">
30
+ <?php _e( 'No', 'strong-testimonials' ); ?><br>
31
  </p>
32
  </div>
33
 
34
+ <div class="inline then fast then_not_yes then_not_no then_maybe" style="display: none;">
35
+ <p class="description tall">
36
+ <?php _e( 'Maybe', 'strong-testimonials' ); ?><br>
37
+ </p>
38
+ </div>
39
  </td>
admin/partials/views/option-category.php CHANGED
@@ -1,56 +1,56 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <label for="view-category-select">
4
- <?php esc_html_e( 'Categories', 'strong-testimonials' ); ?>
5
- </label>
6
  </th>
7
  <?php if ( $cat_count ) : ?>
8
  <td>
9
- <div id="view-category" class="row">
10
- <div class="table inline">
11
- <div class="table-row">
12
- <div class="table-cell select-cell then_display then_slideshow then_not_form">
13
- <select id="view-category-select" class="if selectper" name="view[data][category_all]">
14
- <option value="allcats" <?php selected( $view['category'], 'all' ); ?>><?php esc_html_e( 'all', 'strong-testimonials' ); ?></option>
15
- <option value="somecats" <?php echo( 'all' != $view['category'] ? 'selected' : '' ); ?>><?php echo esc_html_x( 'select', 'verb', 'strong-testimonials' ); ?></option>
16
- </select>
17
- </div>
18
- <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
19
- <div class="table">
20
  <?php if ( $cat_count > 5 ) : ?>
21
- <div class="table-row">
22
- <div class="table-cell">
23
- <div class="row" style="text-align: right; padding-bottom: 5px;">
24
- <input type="button" class="expand-cats button" value="expand list"/>
25
- </div>
26
- </div>
27
- </div>
28
- <?php endif; ?>
29
- <div class="table-row">
30
- <div class="table-cell">
31
  <?php wpmtst_category_checklist( $view_cats_array ); ?>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
  </td>
40
  <?php else : ?>
41
  <td>
42
- <div id="view-category" class="row">
43
- <input type="hidden" name="view[data][category_all]" value="all">
44
- <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
45
- </div>
46
  </td>
47
  <?php endif; ?>
48
  <td class="divider">
49
- <p><?php echo wp_kses_post( _e( '<code>category</code>', 'strong-testimonials' ) ); ?></p>
50
  </td>
51
  <td>
52
- <p><?php echo wp_kses_post( _e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ) ); ?></p>
53
  </td>
54
  <td>
55
- <p><?php echo wp_kses_post( _e( '<code>category="accounting"</code>', 'strong-testimonials' ) ); ?></p>
56
- </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <label for="view-category-select">
4
+ <?php _e( 'Categories', 'strong-testimonials' ); ?>
5
+ </label>
6
  </th>
7
  <?php if ( $cat_count ) : ?>
8
  <td>
9
+ <div id="view-category" class="row">
10
+ <div class="table inline">
11
+ <div class="table-row">
12
+ <div class="table-cell select-cell then_display then_slideshow then_not_form">
13
+ <select id="view-category-select" class="if selectper" name="view[data][category_all]">
14
+ <option value="allcats" <?php selected( $view['category'], 'all' ); ?>><?php _e( 'all', 'strong-testimonials' ); ?></option>
15
+ <option value="somecats" <?php echo( 'all' != $view['category'] ? 'selected' : '' ); ?>><?php _ex( 'select', 'verb', 'strong-testimonials' ); ?></option>
16
+ </select>
17
+ </div>
18
+ <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
19
+ <div class="table">
20
  <?php if ( $cat_count > 5 ) : ?>
21
+ <div class="table-row">
22
+ <div class="table-cell">
23
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
24
+ <input type="button" class="expand-cats button" value="expand list"/>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <?php endif; ?>
29
+ <div class="table-row">
30
+ <div class="table-cell">
31
  <?php wpmtst_category_checklist( $view_cats_array ); ?>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
  </td>
40
  <?php else : ?>
41
  <td>
42
+ <div id="view-category" class="row">
43
+ <input type="hidden" name="view[data][category_all]" value="all">
44
+ <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
45
+ </div>
46
  </td>
47
  <?php endif; ?>
48
  <td class="divider">
49
+ <p><?php _e( '<code>category</code>', 'strong-testimonials' ); ?></p>
50
  </td>
51
  <td>
52
+ <p><?php _e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
53
  </td>
54
  <td>
55
+ <p><?php _e( '<code>category="accounting"</code>', 'strong-testimonials' ); ?></p>
56
+ </td>
admin/partials/views/option-classes.php CHANGED
@@ -1,14 +1,14 @@
1
  <th>
2
  <label for="view-class">
3
- <?php esc_html_e( 'CSS Classes', 'strong-testimonials' ); ?>
4
  </label>
5
  </th>
6
  <td colspan="2">
7
  <div class="then then_display then_form then_slideshow input" style="display: none;">
8
- <input type="text" id="view-class" class="long inline" name="view[data][class]" value="<?php echo esc_attr( $view['class'] ); ?>">
9
  <p class="inline description tall">
10
- <?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?>
11
- <?php esc_html_e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
12
  </p>
13
  </div>
14
  </td>
1
  <th>
2
  <label for="view-class">
3
+ <?php _e( 'CSS Classes', 'strong-testimonials' ); ?>
4
  </label>
5
  </th>
6
  <td colspan="2">
7
  <div class="then then_display then_form then_slideshow input" style="display: none;">
8
+ <input type="text" id="view-class" class="long inline" name="view[data][class]" value="<?php echo $view['class']; ?>">
9
  <p class="inline description tall">
10
+ <?php _e( 'For advanced users.', 'strong-testimonials' ); ?>
11
+ <?php _e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
12
  </p>
13
  </div>
14
  </td>
admin/partials/views/option-client-section.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Custom Fields', 'strong-testimonials' ); ?>
4
  </th>
5
  <td colspan="2">
6
 
@@ -19,7 +19,11 @@
19
  </div>
20
 
21
  <div id="add-field-bar" class="is-below">
22
- <input id="add-field" type="button" name="add-field" value="<?php esc_attr_e( 'Add Field', 'strong-testimonials' ); ?>" class="button-secondary" />
 
 
 
 
23
  </div>
24
 
25
  </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <?php _e( 'Custom Fields', 'strong-testimonials' ); ?>
4
  </th>
5
  <td colspan="2">
6
 
19
  </div>
20
 
21
  <div id="add-field-bar" class="is-below">
22
+ <input id="add-field"
23
+ type="button"
24
+ name="add-field"
25
+ value="<?php _e( 'Add Field', 'strong-testimonials' ); ?>"
26
+ class="button-secondary" />
27
  </div>
28
 
29
  </td>
admin/partials/views/option-color.php CHANGED
@@ -1,40 +1,50 @@
1
  <th>
2
- <?php esc_html_e( 'Font Color', 'strong-testimonials' ); ?>
3
  </th>
4
  <td>
5
- <div class="section-radios font-color-section">
6
 
7
- <div class="radio-buttons">
8
- <ul class="radio-list font-folor-list">
9
  <li>
10
- <input type="radio" id="fc-none" name="view[data][font-color][type]" value="" <?php checked( $view['font-color']['type'], '' ); ?>>
11
- <label for="fc-none">
12
- <?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?>
13
- </label>
 
 
 
14
  </li>
15
  <li>
16
- <input type="radio" id="fc-custom" name="view[data][font-color][type]" value="custom" <?php checked( $view['font-color']['type'], 'custom' ); ?>>
17
- <label for="fc-custom">
18
- <?php esc_html_e( 'custom', 'strong-testimonials' ); ?>
19
- </label>
 
 
 
20
  </li>
21
  </ul>
22
  </div>
23
 
24
- <div class="radio-description" id="view-font-color-info">
25
- <div class="font-color-description fc-none">
26
- <div class="description-inner options">
27
- <div>
28
- <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
29
- </div>
30
- </div>
31
- </div>
32
 
33
  <div class="font-color-description fc-custom">
34
- <div class="description-inner options">
35
- <div>
36
  <label>
37
- <input type="text" id="fc-color" name="view[data][font-color][color]" value="<?php echo esc_attr( $view['font-color']['color'] ); ?>" class="wp-color-picker-field">
 
 
 
 
38
  </label>
39
  </div>
40
  </div>
1
  <th>
2
+ <?php _e( 'Font Color', 'strong-testimonials' ); ?>
3
  </th>
4
  <td>
5
+ <div class="section-radios font-color-section">
6
 
7
+ <div class="radio-buttons">
8
+ <ul class="radio-list font-folor-list">
9
  <li>
10
+ <input type="radio"
11
+ id="fc-none"
12
+ name="view[data][font-color][type]"
13
+ value="" <?php checked( $view['font-color']['type'], '' ); ?>>
14
+ <label for="fc-none">
15
+ <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
16
+ </label>
17
  </li>
18
  <li>
19
+ <input type="radio"
20
+ id="fc-custom"
21
+ name="view[data][font-color][type]"
22
+ value="custom" <?php checked( $view['font-color']['type'], 'custom' ); ?>>
23
+ <label for="fc-custom">
24
+ <?php _e( 'custom', 'strong-testimonials' ); ?>
25
+ </label>
26
  </li>
27
  </ul>
28
  </div>
29
 
30
+ <div class="radio-description" id="view-font-color-info">
31
+ <div class="font-color-description fc-none">
32
+ <div class="description-inner options">
33
+ <div>
34
+ <?php _e( 'No options', 'strong-testimonials' ); ?>
35
+ </div>
36
+ </div>
37
+ </div>
38
 
39
  <div class="font-color-description fc-custom">
40
+ <div class="description-inner options">
41
+ <div>
42
  <label>
43
+ <input type="text"
44
+ id="fc-color"
45
+ name="view[data][font-color][color]"
46
+ value="<?php echo $view['font-color']['color']; ?>"
47
+ class="wp-color-picker-field">
48
  </label>
49
  </div>
50
  </div>
admin/partials/views/option-content.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-content">
4
- <?php esc_html_e( 'Content', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td colspan="2">
@@ -14,13 +14,13 @@
14
  <div class="inline">
15
  <select id="view-content" class="if selectper min-width-1 label-not-adjacent" name="view[data][content]">
16
  <option value="entire" <?php selected( 'entire', $view['content'] ); ?>>
17
- <?php echo esc_html_x( 'entire content', 'display setting', 'strong-testimonials' ); ?>
18
  </option>
19
  <option value="truncated" <?php selected( 'truncated', $view['content'] ); ?>>
20
- <?php echo esc_html_x( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?>
21
  </option>
22
  <option value="excerpt" <?php selected( 'excerpt', $view['content'] ); ?>>
23
- <?php echo esc_html_x( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?>
24
  </option>
25
  </select>
26
  </div>
@@ -28,14 +28,14 @@
28
  <!-- info & screenshot -->
29
  <div class="inline then fast then_truncated then_not_entire then_not_excerpt" style="display: none;">
30
  <p class="description">
31
- <?php esc_html_e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?>
32
  </p>
33
  </div>
34
  <div class="inline then fast then_not_truncated then_not_entire then_excerpt" style="display: none;">
35
  <p class="description">
36
- <?php echo wp_kses_post( 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' ) ) ); ?>
37
  <span class="screenshot" id="screenshot-screen-options" style="display: none;">
38
- <img src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>img/screen-options.png" width="600">
39
  </span>
40
  </p>
41
  </div>
@@ -51,7 +51,7 @@
51
  <!-- info -->
52
  <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
53
  <span>
54
- <?php esc_html_e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?>
55
  </span>
56
  </div>
57
 
@@ -60,10 +60,10 @@
60
  <label>
61
  <select id="view-use_default_length" class="if selectgroup min-width-1" name="view[data][use_default_length]">
62
  <option value="1" <?php selected( $view['use_default_length'] ); ?>>
63
- <?php echo esc_html_x( 'default length', 'display setting', 'strong-testimonials' ); ?>
64
  </option>
65
  <option value="0" <?php selected( ! $view['use_default_length'] ); ?>>
66
- <?php echo esc_html_x( 'custom length', 'display setting', 'strong-testimonials' ); ?>
67
  </option>
68
  </select>
69
  </label>
@@ -72,14 +72,14 @@
72
  <!-- 1st option: default -->
73
  <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
74
  <label for="view-use_default_length" class="inline-middle"><?php // Because partner option has <label>, this prevents micro-bounce ?>
75
- <p class="description tall"><?php esc_html_e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
76
  </label>
77
  </div>
78
 
79
  <!-- 2nd option: length -->
80
  <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
81
  <label class="inline-middle">
82
- <?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( $view['excerpt_length'] ) . '">' ); ?>
83
  </label>
84
  </div>
85
 
@@ -92,103 +92,103 @@
92
 
93
  <div class="row-inner subgroup">
94
 
95
- <!-- action: full post or in place -->
96
- <div class="row-inner">
97
- <div class="inline">
98
- <?php echo wp_kses_post( _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ) ); ?>
99
- </div>
100
- <div class="inline tight">
101
- <label>
102
- <select id="view-more_post_in_place"
103
- class="if selectgroup"
104
- name="view[data][more_post_in_place]">
105
- <option value="0" <?php selected( ! $view['more_post_in_place'] ); ?>>
106
- <?php // TODO Get label from Properties ?>
107
- <?php esc_html_e( 'the full testimonial', 'strong-testimonials' ); ?>
108
- </option>
109
- <option value="1" <?php selected( $view['more_post_in_place'] ); ?>>
110
- <?php esc_html_e( 'expand content in place', 'strong-testimonials' ); ?>
111
- </option>
112
- </select>
113
- </label>
114
- </div>
115
- </div>
116
-
117
- <!-- ellipsis -->
118
- <div class="row-inner">
119
- <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
120
  <div class="inline">
121
- <label>
122
- <select id="view-more_post_ellipsis"
123
- class="if selectgroup"
124
- name="view[data][more_post_ellipsis]">
125
- <option value="1" <?php selected( $view['more_post_ellipsis'] ); ?>>
126
- <?php esc_html_e( 'with an ellipsis', 'strong-testimonials' ); ?>
127
- </option>
128
- <option value="0" <?php selected( ! $view['more_post_ellipsis'] ); ?>>
129
- <?php esc_html_e( 'without an ellipsis', 'strong-testimonials' ); ?>
130
- </option>
131
- </select>
132
- </label>
133
  </div>
134
- <div class="inline then then_excerpt then_not_truncated" style="display: none;">
135
- <p class="description">
136
- <?php esc_html_e( 'Automatic excerpt only.', 'strong-testimonials' ); ?>
137
- </p>
138
- </div>
139
- </div>
140
- </div>
141
-
142
- <!-- default or custom -->
143
  <div class="row-inner">
144
- <div class="inline tight then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
145
- <?php esc_html_e( 'with link text to read more', 'strong-testimonials' ); ?>
146
- </div>
147
  <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
148
  <label>
149
  <select id="view-use_default_more"
150
- class="if selectgroup min-width-1"
151
- name="view[data][use_default_more]">
152
  <option value="1" <?php selected( $view['use_default_more'] ); ?>>
153
- <?php echo esc_html_x( 'with default link text', 'display setting', 'strong-testimonials' ); ?>
154
  </option>
155
  <option value="0" <?php selected( ! $view['use_default_more'] ); ?>>
156
- <?php echo esc_html_x( 'with custom link text', 'display setting', 'strong-testimonials' ); ?>
157
  </option>
158
  </select>
159
  </label>
160
- </div>
161
- <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
162
- <p class="description"><?php echo wp_kses_post( _e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ) ); ?></p>
163
- </div>
164
- <!-- read more -->
165
- <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
166
  <span id="option-link-text" class="inline-span">
167
  <label for="view-more_post_text">
168
  <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
169
- value="<?php echo esc_attr( $view['more_post_text'] ); ?>" size="22"
170
- placeholder="<?php esc_attr_e( 'enter a phrase', 'strong-testimonials' ); ?>">
171
  </label>
172
  </span>
173
- </div>
174
- </div>
175
-
176
- <!-- read less -->
177
- <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
178
- <div class="inline tight">
179
- <?php esc_html_e( 'and link text to read less', 'strong-testimonials' ); ?>
180
- </div>
181
- <div class="inline tight">
182
  <span id="option-link-text-less" class="inline-span">
183
  <label for="view-less_post_text">
184
  <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
185
- value="<?php echo esc_attr( $view['less_post_text'] ); ?>" size="22"
186
- placeholder="<?php esc_attr_e( 'enter a phrase', 'strong-testimonials' ); ?>">
187
  </label>
188
  </span>
189
- <p class="inline description"><?php esc_html_e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
190
- </div>
191
- </div>
192
 
193
  <!-- automatic or both -->
194
  <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
@@ -196,10 +196,10 @@
196
  <label>
197
  <select id="view-more_full_post" class="if selectgroup" name="view[data][more_full_post]">
198
  <option value="0" <?php selected( $view['more_full_post'], 0 ); ?>>
199
- <?php echo esc_html_x( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?>
200
  </option>
201
  <option value="1" <?php selected( $view['more_full_post'], 1 ); ?>>
202
- <?php echo esc_html_x( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?>
203
  </option>
204
  </select>
205
  </label>
@@ -210,7 +210,7 @@
210
 
211
  <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
212
  <p class="description tall solo">
213
- <?php echo wp_kses_post( printf( __( '<a href="%s" target="_blank">Learn more about WordPress excerpts</a>', 'strong-testimonials' ), esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ) ) ); ?>
214
  </p>
215
  </div>
216
 
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-content">
4
+ <?php _e( 'Content', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td colspan="2">
14
  <div class="inline">
15
  <select id="view-content" class="if selectper min-width-1 label-not-adjacent" name="view[data][content]">
16
  <option value="entire" <?php selected( 'entire', $view['content'] ); ?>>
17
+ <?php _ex( 'entire content', 'display setting', 'strong-testimonials' ); ?>
18
  </option>
19
  <option value="truncated" <?php selected( 'truncated', $view['content'] ); ?>>
20
+ <?php _ex( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?>
21
  </option>
22
  <option value="excerpt" <?php selected( 'excerpt', $view['content'] ); ?>>
23
+ <?php _ex( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?>
24
  </option>
25
  </select>
26
  </div>
28
  <!-- info & screenshot -->
29
  <div class="inline then fast then_truncated then_not_entire then_not_excerpt" style="display: none;">
30
  <p class="description">
31
+ <?php _e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?>
32
  </p>
33
  </div>
34
  <div class="inline then fast then_not_truncated then_not_entire then_excerpt" style="display: none;">
35
  <p class="description">
36
+ <?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' ) ); ?>
37
  <span class="screenshot" id="screenshot-screen-options" style="display: none;">
38
+ <img src="<?php echo WPMTST_ADMIN_URL; ?>img/screen-options.png" width="600">
39
  </span>
40
  </p>
41
  </div>
51
  <!-- info -->
52
  <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
53
  <span>
54
+ <?php _e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?>
55
  </span>
56
  </div>
57
 
60
  <label>
61
  <select id="view-use_default_length" class="if selectgroup min-width-1" name="view[data][use_default_length]">
62
  <option value="1" <?php selected( $view['use_default_length'] ); ?>>
63
+ <?php _ex( 'default length', 'display setting', 'strong-testimonials' ); ?>
64
  </option>
65
  <option value="0" <?php selected( ! $view['use_default_length'] ); ?>>
66
+ <?php _ex( 'custom length', 'display setting', 'strong-testimonials' ); ?>
67
  </option>
68
  </select>
69
  </label>
72
  <!-- 1st option: default -->
73
  <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
74
  <label for="view-use_default_length" class="inline-middle"><?php // Because partner option has <label>, this prevents micro-bounce ?>
75
+ <p class="description tall"><?php _e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
76
  </label>
77
  </div>
78
 
79
  <!-- 2nd option: length -->
80
  <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
81
  <label class="inline-middle">
82
+ <?php printf( _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="' . $view['excerpt_length'] . '">' ); ?>
83
  </label>
84
  </div>
85
 
92
 
93
  <div class="row-inner subgroup">
94
 
95
+ <!-- action: full post or in place -->
96
+ <div class="row-inner">
97
+ <div class="inline">
98
+ <?php _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ); ?>
99
+ </div>
100
+ <div class="inline tight">
101
+ <label>
102
+ <select id="view-more_post_in_place"
103
+ class="if selectgroup"
104
+ name="view[data][more_post_in_place]">
105
+ <option value="0" <?php selected( ! $view['more_post_in_place'] ); ?>>
106
+ <?php // TODO Get label from Properties ?>
107
+ <?php _e( 'the full testimonial', 'strong-testimonials' ); ?>
108
+ </option>
109
+ <option value="1" <?php selected( $view['more_post_in_place'] ); ?>>
110
+ <?php _e( 'expand content in place', 'strong-testimonials' ); ?>
111
+ </option>
112
+ </select>
113
+ </label>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- ellipsis -->
118
+ <div class="row-inner">
119
+ <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
120
  <div class="inline">
121
+ <label>
122
+ <select id="view-more_post_ellipsis"
123
+ class="if selectgroup"
124
+ name="view[data][more_post_ellipsis]">
125
+ <option value="1" <?php selected( $view['more_post_ellipsis'] ); ?>>
126
+ <?php _e( 'with an ellipsis', 'strong-testimonials' ); ?>
127
+ </option>
128
+ <option value="0" <?php selected( ! $view['more_post_ellipsis'] ); ?>>
129
+ <?php _e( 'without an ellipsis', 'strong-testimonials' ); ?>
130
+ </option>
131
+ </select>
132
+ </label>
133
  </div>
134
+ <div class="inline then then_excerpt then_not_truncated" style="display: none;">
135
+ <p class="description">
136
+ <?php _e( 'Automatic excerpt only.', 'strong-testimonials' ); ?>
137
+ </p>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <!-- default or custom -->
143
  <div class="row-inner">
144
+ <div class="inline tight then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
145
+ <?php _e( 'with link text to read more', 'strong-testimonials' ); ?>
146
+ </div>
147
  <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
148
  <label>
149
  <select id="view-use_default_more"
150
+ class="if selectgroup min-width-1"
151
+ name="view[data][use_default_more]">
152
  <option value="1" <?php selected( $view['use_default_more'] ); ?>>
153
+ <?php _ex( 'with default link text', 'display setting', 'strong-testimonials' ); ?>
154
  </option>
155
  <option value="0" <?php selected( ! $view['use_default_more'] ); ?>>
156
+ <?php _ex( 'with custom link text', 'display setting', 'strong-testimonials' ); ?>
157
  </option>
158
  </select>
159
  </label>
160
+ </div>
161
+ <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
162
+ <p class="description"><?php _e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
163
+ </div>
164
+ <!-- read more -->
165
+ <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
166
  <span id="option-link-text" class="inline-span">
167
  <label for="view-more_post_text">
168
  <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
169
+ value="<?php echo $view['more_post_text']; ?>" size="22"
170
+ placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
171
  </label>
172
  </span>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- read less -->
177
+ <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
178
+ <div class="inline tight">
179
+ <?php _e( 'and link text to read less', 'strong-testimonials' ); ?>
180
+ </div>
181
+ <div class="inline tight">
182
  <span id="option-link-text-less" class="inline-span">
183
  <label for="view-less_post_text">
184
  <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
185
+ value="<?php echo $view['less_post_text']; ?>" size="22"
186
+ placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
187
  </label>
188
  </span>
189
+ <p class="inline description"><?php _e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
190
+ </div>
191
+ </div>
192
 
193
  <!-- automatic or both -->
194
  <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
196
  <label>
197
  <select id="view-more_full_post" class="if selectgroup" name="view[data][more_full_post]">
198
  <option value="0" <?php selected( $view['more_full_post'], 0 ); ?>>
199
+ <?php _ex( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?>
200
  </option>
201
  <option value="1" <?php selected( $view['more_full_post'], 1 ); ?>>
202
+ <?php _ex( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?>
203
  </option>
204
  </select>
205
  </label>
210
 
211
  <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
212
  <p class="description tall solo">
213
+ <?php printf( __( '<a href="%s" target="_blank">Learn more about WordPress excerpts</a>', 'strong-testimonials' ), esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ) ); ?>
214
  </p>
215
  </div>
216
 
admin/partials/views/option-divi.php CHANGED
@@ -3,21 +3,22 @@
3
  global $view;
4
  ?>
5
  <th>
6
- <label for="view-divi_builder"><?php esc_html_e( 'Divi Builder', 'strong-testimonials' ); ?></label>
7
  </th>
8
  <td>
9
- <div class="row">
10
- <div class="row-inner">
11
- <input type="checkbox" id="view-divi_builder" class="if toggle checkbox" name="view[data][divi_builder]" value="1" <?php checked( $view['divi_builder'] ); ?>/>
12
- <label for="view-divi_builder">
13
- <?php esc_html_e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in Divi Builder version 2.', 'strong-testimonials' ); ?>
14
- </label>
15
- <p class="description short">
16
- <?php esc_html_e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?>
17
- </p>
18
- <p class="description short">
19
- <?php esc_html_e( 'Not required if simply adding this view in the Divi theme using either the default editor or Divi Builder.', 'strong-testimonials' ); ?>
20
- </p>
21
- </div>
22
- </div>
 
23
  </td>
3
  global $view;
4
  ?>
5
  <th>
6
+ <label for="view-divi_builder"><?php _e( 'Divi Builder', 'strong-testimonials' ); ?></label>
7
  </th>
8
  <td>
9
+ <div class="row">
10
+ <div class="row-inner">
11
+ <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
12
+ name="view[data][divi_builder]" value="1" <?php checked( $view['divi_builder'] ); ?>/>
13
+ <label for="view-divi_builder">
14
+ <?php _e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?>
15
+ </label>
16
+ <p class="description short">
17
+ <?php _e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?>
18
+ </p>
19
+ <p class="description short">
20
+ <?php _e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?>
21
+ </p>
22
+ </div>
23
+ </div>
24
  </td>
admin/partials/views/option-form-ajax.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <input type="checkbox" id="view-form_ajax" class="checkbox if toggle" name="view[data][form_ajax]" value="1" <?php checked( $view['form_ajax'] ); ?>>
 
4
  <label for="view-form_ajax">
5
- <?php esc_html_e( 'Submit form without reloading the page (Ajax)', 'strong-testimonials' ); ?>
6
  </label>
7
  </th>
8
  <td>
9
  <p class="description tall">
10
- <?php esc_html_e( 'This will override the Success Redirect setting.', 'strong-testimonials' ); ?>
11
  </p>
12
  </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <input type="checkbox" id="view-form_ajax" class="checkbox if toggle"
4
+ name="view[data][form_ajax]" value="1" <?php checked( $view['form_ajax'] ); ?>>
5
  <label for="view-form_ajax">
6
+ <?php _e( 'Submit form without reloading the page (Ajax)', 'strong-testimonials' ); ?>
7
  </label>
8
  </th>
9
  <td>
10
  <p class="description tall">
11
+ <?php _e( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ); ?>
12
  </p>
13
  </td>
admin/partials/views/option-form-category.php CHANGED
@@ -1,28 +1,28 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Assign to a category', 'strong-testimonials' ); ?>
4
  </th>
5
  <?php if ( $cat_count ) : ?>
6
- <td>
7
- <div class="table">
8
- <?php if ( $cat_count > 5 ) : ?>
9
- <div class="table-row">
10
- <div class="table-cell">
11
- <div class="row" style="text-align: right; padding-bottom: 5px;">
12
- <input type="button" class="expand-cats button" value="expand list"/>
13
- </div>
14
- </div>
15
- </div>
16
- <?php endif; ?>
17
- <div class="table-row">
18
- <div class="table-cell">
19
  <?php wpmtst_form_category_checklist( $view_cats_array ); ?>
20
- </div>
21
- </div>
22
- </div>
23
- </td>
24
  <?php else : ?>
25
- <td>
26
- <p class="description tall"><?php esc_html_e( 'No categories found', 'strong-testimonials' ); ?></p>
27
- </td>
28
  <?php endif; ?>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <?php _e( 'Assign to a category', 'strong-testimonials' ); ?>
4
  </th>
5
  <?php if ( $cat_count ) : ?>
6
+ <td>
7
+ <div class="table">
8
+ <?php if ( $cat_count > 5 ) : ?>
9
+ <div class="table-row">
10
+ <div class="table-cell">
11
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
12
+ <input type="button" class="expand-cats button" value="expand list"/>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ <?php endif; ?>
17
+ <div class="table-row">
18
+ <div class="table-cell">
19
  <?php wpmtst_form_category_checklist( $view_cats_array ); ?>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </td>
24
  <?php else : ?>
25
+ <td>
26
+ <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
27
+ </td>
28
  <?php endif; ?>
admin/partials/views/option-id.php CHANGED
@@ -6,16 +6,16 @@
6
  <select id="view-id" name="view[data][id]">
7
  <option value="0"><?php _e( '&mdash; select &mdash;' ); ?></option>
8
  <?php foreach ( $testimonials_list as $post ) : ?>
9
- <option value="<?php echo esc_attr( $post->ID ); ?>" <?php selected( $view['id'], $post->ID ); ?>>
10
- <?php echo $post->post_title ? esc_html( $post->post_title ) : esc_html__( '(untitled)', 'strong-testimonials' ); ?>
11
  </option>
12
  <?php endforeach; ?>
13
  </select>
14
  </label>
15
- </div>
16
- <div class="row-inner">
17
  <label for="view-post_id">
18
- <?php echo esc_html_x( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
19
  </label>
20
  <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
21
  </div>
6
  <select id="view-id" name="view[data][id]">
7
  <option value="0"><?php _e( '&mdash; select &mdash;' ); ?></option>
8
  <?php foreach ( $testimonials_list as $post ) : ?>
9
+ <option value="<?php echo $post->ID; ?>" <?php selected( $view['id'], $post->ID ); ?>>
10
+ <?php echo $post->post_title ? $post->post_title : __( '(untitled)', 'strong-testimonials' ); ?>
11
  </option>
12
  <?php endforeach; ?>
13
  </select>
14
  </label>
15
+ </div>
16
+ <div class="row-inner">
17
  <label for="view-post_id">
18
+ <?php _ex( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
19
  </label>
20
  <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
21
  </div>
admin/partials/views/option-layout.php CHANGED
@@ -1,97 +1,98 @@
1
  <th>
2
- <?php esc_html_e( 'Layout', 'strong-testimonials' ); ?>
3
  </th>
4
  <td colspan="2">
5
- <div class="section-radios layout-section">
6
 
7
- <!-- Inputs -->
8
- <div class="radio-buttons">
9
- <ul class="radio-list layout-list">
10
  <li>
11
- <input type="radio" id="view-layout-normal" name="view[data][layout]" value="" <?php checked( false, $view['layout'] ); ?>>
 
 
 
12
  <label for="view-layout-normal">
13
- <?php esc_html_e( 'normal', 'strong-testimonials' ); ?>
14
  </label>
15
  </li>
16
  <li>
17
- <input type="radio"
18
- id="view-layout-masonry"
19
- name="view[data][layout]"
20
- value="masonry" <?php checked( 'masonry', $view['layout'] ); ?>>
21
  <label for="view-layout-masonry">
22
- <?php esc_html_e( 'Masonry', 'strong-testimonials' ); ?>
23
  </label>
24
  </li>
25
  <li>
26
- <input type="radio"
27
- id="view-layout-columns"
28
- name="view[data][layout]"
29
- value="columns" <?php checked( 'columns', $view['layout'] ); ?>>
30
  <label for="view-layout-columns">
31
- <?php esc_html_e( 'columns', 'strong-testimonials' ); ?>
32
  </label>
33
  </li>
34
  <li>
35
- <input type="radio"
36
- id="view-layout-grid"
37
- name="view[data][layout]"
38
- value="grid" <?php checked( 'grid', $view['layout'] ); ?>>
39
  <label for="view-layout-grid">
40
- <?php esc_html_e( 'grid', 'strong-testimonials' ); ?>
41
  </label>
42
  </li>
43
  </ul>
44
  </div>
45
 
46
  <!-- Layout Info -->
47
- <div>
48
- <div class="radio-description" id="view-layout-info">
49
 
50
  <div class="layout-description view-layout-normal">
51
- <p><?php esc_html_e( 'A single column.', 'strong-testimonials' ); ?></p>
52
- </div>
53
 
54
- <div class="layout-description view-layout-masonry">
55
- <p><?php echo wp_kses_post( 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>
56
- <p><?php esc_html_e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
57
- <p><?php esc_html_e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
58
- </div>
59
 
60
- <div class="layout-description view-layout-columns">
61
- <p><?php echo wp_kses_post( 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>
62
- <p><?php esc_html_e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
63
- <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
64
- </div>
65
 
66
- <div class="layout-description view-layout-grid">
67
- <p>
68
- <?php
69
  $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
70
- echo wp_kses_post( printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) ) );
71
- ?>
72
- </p>
73
- <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>
74
- <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
75
- </div>
76
 
77
- </div>
78
 
79
- <!-- Column selector -->
80
- <div class="radio-description options" id="column-count-wrapper">
81
- <div>
82
- <label for="view-column-count"><?php esc_html_e( 'Number of columns', 'strong-testimonials' ); ?></label>
83
- <select id="view-column-count" name="view[data][column_count]">
84
- <option value="2" <?php selected( $view['column_count'], 2 ); ?>>2</option>
85
- <option value="3" <?php selected( $view['column_count'], 3 ); ?>>3</option>
86
- <option value="4" <?php selected( $view['column_count'], 4 ); ?>>4</option>
87
- </select>
88
- </div>
89
- </div>
90
- </div>
91
 
92
- <!-- Examples -->
93
- <div>
94
- <div class="layout-example view-layout-normal">
95
  <div class="example-container">
96
  <div class="box"><span>1</span></div>
97
  <div class="box size2"><span>2</span></div>
@@ -100,7 +101,7 @@
100
  <div class="box"><span>5</span></div>
101
  </div>
102
  </div>
103
- <div class="layout-example view-layout-masonry">
104
  <div class="example-container col-2">
105
  <div class="grid-sizer"></div>
106
  <div class="box"><span>1</span></div>
@@ -114,7 +115,7 @@
114
  <div class="box"><span>9</span></div>
115
  </div>
116
  </div>
117
- <div class="layout-example view-layout-columns">
118
  <div class="example-container col-2">
119
  <div class="box"><span>1</span></div>
120
  <div class="box size2"><span>2</span></div>
@@ -127,7 +128,7 @@
127
  <div class="box"><span>9</span></div>
128
  </div>
129
  </div>
130
- <div class="layout-example view-layout-grid">
131
  <div class="example-container col-2">
132
  <div class="box"><span>1</span></div>
133
  <div class="box"><span>2</span></div>
1
  <th>
2
+ <?php _e( 'Layout', 'strong-testimonials' ); ?>
3
  </th>
4
  <td colspan="2">
5
+ <div class="section-radios layout-section">
6
 
7
+ <!-- Inputs -->
8
+ <div class="radio-buttons">
9
+ <ul class="radio-list layout-list">
10
  <li>
11
+ <input type="radio"
12
+ id="view-layout-normal"
13
+ name="view[data][layout]"
14
+ value="" <?php checked( false, $view['layout'] ); ?>>
15
  <label for="view-layout-normal">
16
+ <?php _e( 'normal', 'strong-testimonials' ); ?>
17
  </label>
18
  </li>
19
  <li>
20
+ <input type="radio"
21
+ id="view-layout-masonry"
22
+ name="view[data][layout]"
23
+ value="masonry" <?php checked( 'masonry', $view['layout'] ); ?>>
24
  <label for="view-layout-masonry">
25
+ <?php _e( 'Masonry', 'strong-testimonials' ); ?>
26
  </label>
27
  </li>
28
  <li>
29
+ <input type="radio"
30
+ id="view-layout-columns"
31
+ name="view[data][layout]"
32
+ value="columns" <?php checked( 'columns', $view['layout'] ); ?>>
33
  <label for="view-layout-columns">
34
+ <?php _e( 'columns', 'strong-testimonials' ); ?>
35
  </label>
36
  </li>
37
  <li>
38
+ <input type="radio"
39
+ id="view-layout-grid"
40
+ name="view[data][layout]"
41
+ value="grid" <?php checked( 'grid', $view['layout'] ); ?>>
42
  <label for="view-layout-grid">
43
+ <?php _e( 'grid', 'strong-testimonials' ); ?>
44
  </label>
45
  </li>
46
  </ul>
47
  </div>
48
 
49
  <!-- Layout Info -->
50
+ <div>
51
+ <div class="radio-description" id="view-layout-info">
52
 
53
  <div class="layout-description view-layout-normal">
54
+ <p><?php _e( 'A single column.', 'strong-testimonials' ); ?></p>
55
+ </div>
56
 
57
+ <div class="layout-description view-layout-masonry">
58
+ <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>
59
+ <p><?php _e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
60
+ <p><?php _e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
61
+ </div>
62
 
63
+ <div class="layout-description view-layout-columns">
64
+ <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>
65
+ <p><?php _e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
66
+ <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
67
+ </div>
68
 
69
+ <div class="layout-description view-layout-grid">
70
+ <p><?php
 
71
  $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
72
+ printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) );
73
+ ?></p>
74
+ <p><?php _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>
75
+ <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
76
+ </div>
 
77
 
78
+ </div>
79
 
80
+ <!-- Column selector -->
81
+ <div class="radio-description options" id="column-count-wrapper">
82
+ <div>
83
+ <label for="view-column-count"><?php _e( 'Number of columns', 'strong-testimonials' ); ?></label>
84
+ <select id="view-column-count" name="view[data][column_count]">
85
+ <option value="2" <?php selected( $view['column_count'], 2 ); ?>>2</option>
86
+ <option value="3" <?php selected( $view['column_count'], 3 ); ?>>3</option>
87
+ <option value="4" <?php selected( $view['column_count'], 4 ); ?>>4</option>
88
+ </select>
89
+ </div>
90
+ </div>
91
+ </div>
92
 
93
+ <!-- Examples -->
94
+ <div>
95
+ <div class="layout-example view-layout-normal">
96
  <div class="example-container">
97
  <div class="box"><span>1</span></div>
98
  <div class="box size2"><span>2</span></div>
101
  <div class="box"><span>5</span></div>
102
  </div>
103
  </div>
104
+ <div class="layout-example view-layout-masonry">
105
  <div class="example-container col-2">
106
  <div class="grid-sizer"></div>
107
  <div class="box"><span>1</span></div>
115
  <div class="box"><span>9</span></div>
116
  </div>
117
  </div>
118
+ <div class="layout-example view-layout-columns">
119
  <div class="example-container col-2">
120
  <div class="box"><span>1</span></div>
121
  <div class="box size2"><span>2</span></div>
128
  <div class="box"><span>9</span></div>
129
  </div>
130
  </div>
131
+ <div class="layout-example view-layout-grid">
132
  <div class="example-container col-2">
133
  <div class="box"><span>1</span></div>
134
  <div class="box"><span>2</span></div>
admin/partials/views/option-limit.php CHANGED
@@ -1,31 +1,33 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-all">
4
- <?php esc_html_e( 'Quantity', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="row">
9
- <div class="inline">
10
- <select class="if select" id="view-all" name="view[data][all]">
11
- <option value="1" <?php selected( -1, $view['count'] ); ?>>
12
- <?php esc_html_e( 'all', 'strong-testimonials' ); ?>
13
- </option>
14
- <option class="trip" value="0" <?php selected( $view['count'] > 0 ); ?>>
15
- <?php echo esc_html_x( 'count', 'noun', 'strong-testimonials' ); ?>
16
- </option>
17
- </select>
18
- &nbsp;
19
- <label>
20
- <input class="input-incremental then_all" type="number" id="view-count" name="view[data][count]" value="<?php echo ( -1 == $view['count'] ) ? 1 : esc_attr( $view['count'] ); ?>" min="1" size="5" style="display: none;">
21
- </label>
22
- </div>
 
 
23
  </div>
24
  </td>
25
  <td class="divider">
26
- <p><?php echo wp_kses_post( _e( '<code>count</code>', 'strong-testimonials' ) ); ?></p>
27
  </td>
28
  <td></td>
29
  <td>
30
- <p><?php echo wp_kses_post( _e( '<code>count=5</code>', 'strong-testimonials' ) ); ?></p>
31
- </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-all">
4
+ <?php _e( 'Quantity', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="row">
9
+ <div class="inline">
10
+ <select class="if select" id="view-all" name="view[data][all]">
11
+ <option value="1" <?php selected( -1, $view['count'] ); ?>>
12
+ <?php _e( 'all', 'strong-testimonials' ); ?>
13
+ </option>
14
+ <option class="trip" value="0" <?php selected( $view['count'] > 0 ); ?>>
15
+ <?php _ex( 'count', 'noun', 'strong-testimonials' ); ?>
16
+ </option>
17
+ </select>
18
+ &nbsp;
19
+ <label>
20
+ <input class="input-incremental then_all" type="number" id="view-count"
21
+ name="view[data][count]" value="<?php echo ( -1 == $view['count'] ) ? 1 : $view['count']; ?>"
22
+ min="1" size="5" style="display: none;">
23
+ </label>
24
+ </div>
25
  </div>
26
  </td>
27
  <td class="divider">
28
+ <p><?php _e( '<code>count</code>', 'strong-testimonials' ); ?></p>
29
  </td>
30
  <td></td>
31
  <td>
32
+ <p><?php _e( '<code>count=5</code>', 'strong-testimonials' ); ?></p>
33
+ </td>
admin/partials/views/option-order.php CHANGED
@@ -1,26 +1,26 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-order">
4
- <?php echo esc_html_x( 'Order', 'noun', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="row">
9
- <div class="inline">
10
  <select id="view-order" name="view[data][order]">
11
  <?php foreach ( $view_options['order'] as $order => $order_label ) : ?>
12
- <option value="<?php echo esc_attr( $order ); ?>" <?php selected( $order, $view['order'] ); ?>><?php echo esc_html( $order_label ); ?></option>
13
  <?php endforeach; ?>
14
  </select>
15
  </div>
16
  </div>
17
  </td>
18
  <td class="divider">
19
- <p><?php echo wp_kses_post( _e( '<code>order</code>', 'strong-testimonials' ) ); ?></p>
20
  </td>
21
  <td>
22
- <p><?php echo wp_kses_post( _e( 'oldest | newest | random | menu_order', 'strong-testimonials' ) ); ?></p>
23
  </td>
24
  <td>
25
- <p><?php echo wp_kses_post( _e( '<code>order="random"</code>', 'strong-testimonials' ) ); ?></p>
26
- </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
  <label for="view-order">
4
+ <?php _ex( 'Order', 'noun', 'strong-testimonials' ); ?>
5
  </label>
6
  </th>
7
  <td>
8
  <div class="row">
9
+ <div class="inline">
10
  <select id="view-order" name="view[data][order]">
11
  <?php foreach ( $view_options['order'] as $order => $order_label ) : ?>
12
+ <option value="<?php echo $order; ?>" <?php selected( $order, $view['order'] ); ?>><?php echo $order_label; ?></option>
13
  <?php endforeach; ?>
14
  </select>
15
  </div>
16
  </div>
17
  </td>
18
  <td class="divider">
19
+ <p><?php _e( '<code>order</code>', 'strong-testimonials' ); ?></p>
20
  </td>
21
  <td>
22
+ <p><?php _e( 'oldest | newest | random | menu_order', 'strong-testimonials' ); ?></p>
23
  </td>
24
  <td>
25
+ <p><?php _e( '<code>order="random"</code>', 'strong-testimonials' ); ?></p>
26
+ </td>
admin/partials/views/option-pagination.php CHANGED
@@ -1,145 +1,165 @@
1
  <?php
2
- $links = '<span class="help-links">';
3
  $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help' ) . '</a>';
4
  $links .= '</span>';
5
  ?>
6
  <?php /* translators: On the Views admin screen. */ ?>
7
  <th>
8
- <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
9
- type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
10
- <label for="view-pagination">
11
- <?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?>
12
- </label>
13
  </th>
14
  <td>
15
- <div class="row then then_pagination" style="display: none;">
16
- <div class="row-inner">
17
- <div class="inline">
18
- <label for="view-pagination_type">
19
- <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
20
- <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
21
- <?php esc_html_e( 'simple', 'strong-testimonials' ); ?>
22
- </option>
23
- <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
24
- <?php esc_html_e( 'WordPress standard', 'strong-testimonials' ); ?>
25
- </option>
26
- </select>
27
- </label>
28
- </div>
29
- <div class="inline then fast then_simple then_not_standard" style="display: none;">
30
- <p class="description">
31
- <?php esc_html_e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
32
- <?php echo wp_kses_post( $links ); ?>
33
- </p>
34
- </div>
35
- <div class="inline then fast then_not_simple then_standard" style="display: none;">
36
- <p class="description">
37
- <?php esc_html_e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
38
- <?php echo wp_kses_post( $links ); ?>
39
- </p>
40
- </div>
41
- </div>
42
- </div>
43
 
44
- <div class="row then then_pagination" style="display: none;">
45
- <div class="row-inner">
46
- <div class="inline">
47
- <label for="view-per_page">
48
- <?php echo esc_html_x( 'Per page', 'quantity', 'strong-testimonials' ); ?>
49
- </label>
50
- <input class="input-incremental" id="view-per_page" name="view[data][pagination_settings][per_page]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['per_page'] ); ?>"/>
51
- </div>
 
 
 
52
 
53
- <div class="inline">
54
- <label for="view-nav">
55
- <?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?>
56
- </label>
57
- <select id="view-nav" name="view[data][pagination_settings][nav]">
58
- <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
59
- <?php esc_html_e( 'before', 'strong-testimonials' ); ?>
60
- </option>
61
- <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
62
- <?php esc_html_e( 'after', 'strong-testimonials' ); ?>
63
- </option>
64
- <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
65
- <?php esc_html_e( 'before & after', 'strong-testimonials' ); ?>
66
- </option>
67
- </select>
68
- </div>
69
- </div>
70
 
71
- <div class="row then then_not_simple then_standard" style="display: none;">
72
- <div class="row-inner">
73
- <div class="inline">
74
- <label for="view-pagination-show_all">
75
- <select class="if select" id="view-pagination-show_all"
76
- name="view[data][pagination_settings][show_all]">
77
- <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
78
- <?php esc_html_e( 'Show all page numbers', 'strong-testimonials' ); ?>
79
- </option>
80
- <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?> class="trip">
81
- <?php esc_html_e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
82
- </option>
83
- </select>
84
- </label>
85
- </div>
86
- <div class="inline then then_show_all" style="display: none;">
87
- <div class="inline">
88
- <label for="view-pagination-end_size">
89
- <?php echo esc_html_x( 'End size', 'quantity', 'strong-testimonials' ); ?>
90
- </label>
91
- <input class="input-incremental" id="view-pagination-end_size" name="view[data][pagination_settings][end_size]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['end_size'] ); ?>"/>
92
- </div>
93
- <div class="inline">
94
- <label for="view-pagination-mid_size">
95
- <?php echo esc_html_x( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
96
- </label>
97
- <input class="input-incremental" id="view-pagination-mid_size" name="view[data][pagination_settings][mid_size]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['mid_size'] ); ?>"/>
98
- </div>
99
- </div>
100
- </div>
101
- </div>
 
 
 
 
 
 
 
102
 
103
- <div class="row then then_not_simple then_standard" style="display: none;">
104
- <div class="row-inner">
105
- <div class="inline inline-middle">
106
- <input class="if toggle checkbox" id="view-pagination-prev_next" name="view[data][pagination_settings][prev_next]" type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
107
- <label for="view-pagination-prev_next">
108
- <?php esc_html_e( 'Show previous/next links', 'strong-testimonials' ); ?>
109
- </label>
110
- </div>
111
- <div class="then then_prev_next inline inline-middle">
112
- <label for="view-pagination-prev_text">
113
- <?php esc_html_e( 'Previous text', 'strong-testimonials' ); ?>
114
- </label>
115
- <input class="code" id="view-pagination-prev_text" name="view[data][pagination_settings][prev_text]" type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
116
- </div>
117
- <div class="then then_prev_next inline inline-middle">
118
- <label for="view-pagination-next_text">
119
- <?php esc_html_e( 'Next text', 'strong-testimonials' ); ?>
120
- </label>
121
- <input class="code" id="view-pagination-next_text" name="view[data][pagination_settings][next_text]" type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
122
- </div>
123
- </div>
124
- </div>
 
 
 
 
 
 
125
 
126
- <div class="row then then_not_simple then_standard" style="display: none;">
127
- <div class="row-inner">
128
- <div class="inline">
129
- <label for="view-pagination-before_page_number">
130
- <?php esc_html_e( 'Before page number', 'strong-testimonials' ); ?>
131
- </label>
132
- <input class="small-text" id="view-pagination-before_page_number" name="view[data][pagination_settings][before_page_number]" type="text" value="<?php echo esc_attr( $view['pagination_settings']['before_page_number'] ); ?>">
133
- </div>
134
- <div class="inline">
135
- <label for="view-pagination-after_page_number">
136
- <?php esc_html_e( 'After page number', 'strong-testimonials' ); ?>
137
- </label>
138
- <input class="small-text" id="view-pagination-after_page_number" name="view[data][pagination_settings][after_page_number]" type="text" value="<?php echo esc_attr( $view['pagination_settings']['after_page_number'] ); ?>">
139
- </div>
140
- </div>
141
- </div>
142
- </div>
 
 
 
 
143
 
144
  <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
145
  </td>
1
  <?php
2
+ $links = '<span class="help-links">';
3
  $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help' ) . '</a>';
4
  $links .= '</span>';
5
  ?>
6
  <?php /* translators: On the Views admin screen. */ ?>
7
  <th>
8
+ <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
9
+ type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
10
+ <label for="view-pagination">
11
+ <?php _e( 'Pagination', 'strong-testimonials' ); ?>
12
+ </label>
13
  </th>
14
  <td>
15
+ <div class="row then then_pagination" style="display: none;">
16
+ <div class="row-inner">
17
+ <div class="inline">
18
+ <label for="view-pagination_type">
19
+ <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
20
+ <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
21
+ <?php _e( 'simple', 'strong-testimonials' ); ?>
22
+ </option>
23
+ <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
24
+ <?php _e( 'WordPress standard', 'strong-testimonials' ); ?>
25
+ </option>
26
+ </select>
27
+ </label>
28
+ </div>
29
+ <div class="inline then fast then_simple then_not_standard" style="display: none;">
30
+ <p class="description">
31
+ <?php _e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
32
+ <?php echo $links; ?>
33
+ </p>
34
+ </div>
35
+ <div class="inline then fast then_not_simple then_standard" style="display: none;">
36
+ <p class="description">
37
+ <?php _e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
38
+ <?php echo $links; ?>
39
+ </p>
40
+ </div>
41
+ </div>
42
+ </div>
43
 
44
+ <div class="row then then_pagination" style="display: none;">
45
+ <div class="row-inner">
46
+ <div class="inline">
47
+ <label for="view-per_page">
48
+ <?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?>
49
+ </label>
50
+ <input class="input-incremental" id="view-per_page"
51
+ name="view[data][pagination_settings][per_page]"
52
+ type="number" min="1" step="1"
53
+ value="<?php echo $view['pagination_settings']['per_page']; ?>"/>
54
+ </div>
55
 
56
+ <div class="inline">
57
+ <label for="view-nav">
58
+ <?php _e( 'Navigation', 'strong-testimonials' ); ?>
59
+ </label>
60
+ <select id="view-nav" name="view[data][pagination_settings][nav]">
61
+ <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
62
+ <?php _e( 'before', 'strong-testimonials' ); ?>
63
+ </option>
64
+ <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
65
+ <?php _e( 'after', 'strong-testimonials' ); ?>
66
+ </option>
67
+ <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
68
+ <?php _e( 'before & after', 'strong-testimonials' ); ?>
69
+ </option>
70
+ </select>
71
+ </div>
72
+ </div>
73
 
74
+ <div class="row then then_not_simple then_standard" style="display: none;">
75
+ <div class="row-inner">
76
+ <div class="inline">
77
+ <label for="view-pagination-show_all">
78
+ <select class="if select" id="view-pagination-show_all"
79
+ name="view[data][pagination_settings][show_all]">
80
+ <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
81
+ <?php _e( 'Show all page numbers', 'strong-testimonials' ); ?>
82
+ </option>
83
+ <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?>
84
+ class="trip">
85
+ <?php _e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
86
+ </option>
87
+ </select>
88
+ </label>
89
+ </div>
90
+ <div class="inline then then_show_all" style="display: none;">
91
+ <div class="inline">
92
+ <label for="view-pagination-end_size">
93
+ <?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?>
94
+ </label>
95
+ <input class="input-incremental" id="view-pagination-end_size"
96
+ name="view[data][pagination_settings][end_size]"
97
+ type="number" min="1" step="1"
98
+ value="<?php echo $view['pagination_settings']['end_size']; ?>"/>
99
+ </div>
100
+ <div class="inline">
101
+ <label for="view-pagination-mid_size">
102
+ <?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
103
+ </label>
104
+ <input class="input-incremental" id="view-pagination-mid_size"
105
+ name="view[data][pagination_settings][mid_size]"
106
+ type="number" min="1" step="1"
107
+ value="<?php echo $view['pagination_settings']['mid_size']; ?>"/>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
 
113
+ <div class="row then then_not_simple then_standard" style="display: none;">
114
+ <div class="row-inner">
115
+ <div class="inline inline-middle">
116
+ <input class="if toggle checkbox" id="view-pagination-prev_next"
117
+ name="view[data][pagination_settings][prev_next]"
118
+ type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
119
+ <label for="view-pagination-prev_next">
120
+ <?php _e( 'Show previous/next links', 'strong-testimonials' ); ?>
121
+ </label>
122
+ </div>
123
+ <div class="then then_prev_next inline inline-middle">
124
+ <label for="view-pagination-prev_text">
125
+ <?php _e( 'Previous text', 'strong-testimonials' ); ?>
126
+ </label>
127
+ <input class="code" id="view-pagination-prev_text"
128
+ name="view[data][pagination_settings][prev_text]"
129
+ type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
130
+ </div>
131
+ <div class="then then_prev_next inline inline-middle">
132
+ <label for="view-pagination-next_text">
133
+ <?php _e( 'Next text', 'strong-testimonials' ); ?>
134
+ </label>
135
+ <input class="code" id="view-pagination-next_text"
136
+ name="view[data][pagination_settings][next_text]"
137
+ type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
138
+ </div>
139
+ </div>
140
+ </div>
141
 
142
+ <div class="row then then_not_simple then_standard" style="display: none;">
143
+ <div class="row-inner">
144
+ <div class="inline">
145
+ <label for="view-pagination-before_page_number">
146
+ <?php _e( 'Before page number', 'strong-testimonials' ); ?>
147
+ </label>
148
+ <input class="small-text" id="view-pagination-before_page_number"
149
+ name="view[data][pagination_settings][before_page_number]"
150
+ type="text" value="<?php echo $view['pagination_settings']['before_page_number']; ?>">
151
+ </div>
152
+ <div class="inline">
153
+ <label for="view-pagination-after_page_number">
154
+ <?php _e( 'After page number', 'strong-testimonials' ); ?>
155
+ </label>
156
+ <input class="small-text" id="view-pagination-after_page_number"
157
+ name="view[data][pagination_settings][after_page_number]"
158
+ type="text" value="<?php echo $view['pagination_settings']['after_page_number']; ?>">
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </div>
163
 
164
  <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
165
  </td>
admin/partials/views/option-read-more-page.php CHANGED
@@ -5,9 +5,9 @@
5
  <th>
6
  <div class="checkbox">
7
  <input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"
8
- <?php checked( isset( $view['more_page'] ) && $view['more_page'] ); ?> class="checkbox">
9
  <label for="view-more_page">
10
- <?php esc_html_e( '"Read more" link to a page or post', 'strong-testimonials' ); ?>
11
  </label>
12
  </div>
13
  </th>
@@ -20,34 +20,34 @@
20
  <label>
21
  <select id="view-page" name="view[data][more_page_id]">
22
  <option value=""><?php _e( '&mdash; select &mdash;' ); ?></option>
23
- <?php
24
- do_action( 'wpmtst_readmore_page_list', $view );
25
- if ( $custom_list ) {
26
- ?>
27
- <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
28
- <?php
29
- foreach ( $custom_list as $page ) {
30
- echo wp_kses_post( $page );
31
  }
32
- ?>
33
- </optgroup>
34
- <?php
35
  }
36
- ?>
37
- <optgroup label="<?php esc_attr_e( 'Pages' ); ?>">
38
  <?php foreach ( $pages_list as $pages ) : ?>
39
- <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $pages->ID ); ?>><?php echo esc_html( $pages->post_title ); ?></option>
40
  <?php endforeach; ?>
41
  </optgroup>
42
- <optgroup label="<?php esc_attr_e( 'Posts' ); ?>">
43
  <?php foreach ( $posts_list as $posts ) : ?>
44
- <option value="<?php echo esc_attr( $posts->ID ); ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $posts->ID ); ?>><?php echo esc_html( $posts->post_title ); ?></option>
45
  <?php endforeach; ?>
46
  </optgroup>
47
  </select>
48
  </label>
49
  <label for="view-page_id2">
50
- <?php echo esc_html_x( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
51
  </label>
52
  <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
53
  </div>
@@ -58,9 +58,10 @@
58
  <div class="row-inner">
59
  <div class="inline">
60
  <label for="view-more_page_text">
61
- <?php esc_html_e( 'with link text', 'strong-testimonials' ); ?>
62
  </label>
63
- <input type="text" id="view-more_page_text" name="view[data][more_page_text]" value="<?php echo esc_attr( $view['more_page_text'] ); ?>" size="50">
 
64
  </div>
65
  </div>
66
  </div>
@@ -71,10 +72,10 @@
71
  <label>
72
  <select id="view-more_page_hook" name="view[data][more_page_hook]">
73
  <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
74
- <?php echo esc_html_x( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
75
  </option>
76
  <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
77
- <?php echo esc_html_x( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
78
  </option>
79
  </select>
80
  </label>
5
  <th>
6
  <div class="checkbox">
7
  <input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"
8
+ <?php checked( isset( $view['more_page'] ) && $view['more_page'] );?> class="checkbox">
9
  <label for="view-more_page">
10
+ <?php _e( '"Read more" link to a page or post', 'strong-testimonials' ); ?>
11
  </label>
12
  </div>
13
  </th>
20
  <label>
21
  <select id="view-page" name="view[data][more_page_id]">
22
  <option value=""><?php _e( '&mdash; select &mdash;' ); ?></option>
23
+ <?php
24
+ do_action( 'wpmtst_readmore_page_list', $view );
25
+ if ( $custom_list ) {
26
+ ?>
27
+ <optgroup label="<?php _e( 'Custom', 'strong-testimonials' ); ?>">
28
+ <?php
29
+ foreach ( $custom_list as $page ) {
30
+ echo $page;
31
  }
32
+ ?>
33
+ </optgroup>
34
+ <?php
35
  }
36
+ ?>
37
+ <optgroup label="<?php _e( 'Pages' ); ?>">
38
  <?php foreach ( $pages_list as $pages ) : ?>
39
+ <option value="<?php echo $pages->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $pages->ID ); ?>><?php echo $pages->post_title; ?></option>
40
  <?php endforeach; ?>
41
  </optgroup>
42
+ <optgroup label="<?php _e( 'Posts' ); ?>">
43
  <?php foreach ( $posts_list as $posts ) : ?>
44
+ <option value="<?php echo $posts->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $posts->ID ); ?>><?php echo $posts->post_title; ?></option>
45
  <?php endforeach; ?>
46
  </optgroup>
47
  </select>
48
  </label>
49
  <label for="view-page_id2">
50
+ <?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
51
  </label>
52
  <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
53
  </div>
58
  <div class="row-inner">
59
  <div class="inline">
60
  <label for="view-more_page_text">
61
+ <?php _e( 'with link text', 'strong-testimonials' ); ?>
62
  </label>
63
+ <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
64
+ value="<?php echo $view['more_page_text']; ?>" size="50">
65
  </div>
66
  </div>
67
  </div>
72
  <label>
73
  <select id="view-more_page_hook" name="view[data][more_page_hook]">
74
  <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
75
+ <?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
76
  </option>
77
  <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
78
+ <?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
79
  </option>
80
  </select>
81
  </label>
admin/partials/views/option-select.php CHANGED
@@ -1,29 +1,29 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <label for="view-single_or_multiple"><?php echo esc_html_x( 'Select', 'verb', 'strong-testimonials' ); ?></label>
4
  </th>
5
  <td>
6
 
7
  <div class="row">
8
  <div class="row-inner">
9
  <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
10
- <option value="multiple" <?php echo (int) $view['id'] == 0 ? 'selected' : ''; ?>><?php esc_html_e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
11
- <option value="single" <?php echo (int) $view['id'] >= 1 ? 'selected' : ''; ?>><?php esc_html_e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
12
  </select>
13
  </div>
14
  </div>
15
 
16
  <div class="row">
17
- <?php require 'option-id.php'; ?>
18
  </div>
19
 
20
  </td>
21
  <td class="divider">
22
- <p><?php echo wp_kses_post( _e( '<code>post_ids</code>', 'strong-testimonials' ) ); ?></p>
23
  </td>
24
  <td>
25
- <p><?php echo wp_kses_post( _e( 'a comma-separated list of post ID\'s', 'strong-testimonials' ) ); ?></p>
26
  </td>
27
  <td>
28
- <p><?php echo wp_kses_post( _e( '<code>post_ids="123,456"</code>', 'strong-testimonials' ) ); ?></p>
29
- </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <label for="view-single_or_multiple"><?php _ex( 'Select', 'verb', 'strong-testimonials' ); ?></label>
4
  </th>
5
  <td>
6
 
7
  <div class="row">
8
  <div class="row-inner">
9
  <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
10
+ <option value="multiple" <?php echo (int) $view['id'] == 0 ? 'selected' : ''; ?>><?php _e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
11
+ <option value="single" <?php echo (int) $view['id'] >= 1 ? 'selected' : ''; ?>><?php _e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
12
  </select>
13
  </div>
14
  </div>
15
 
16
  <div class="row">
17
+ <?php include( 'option-id.php' ); ?>
18
  </div>
19
 
20
  </td>
21
  <td class="divider">
22
+ <p><?php _e( '<code>post_ids</code>' , 'strong-testimonials' ); ?></p>
23
  </td>
24
  <td>
25
+ <p><?php _e( 'a comma-separated list of post ID\'s' , 'strong-testimonials' ); ?></p>
26
  </td>
27
  <td>
28
+ <p><?php _e( '<code>post_ids="123,456"</code>', 'strong-testimonials' ); ?></p>
29
+ </td>
admin/partials/views/option-slideshow-behavior.php CHANGED
@@ -1,23 +1,25 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Behavior', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
 
7
- <div class="row">
8
  <div class="inline inline-middle">
9
- <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]" value="0" <?php checked( $view['slideshow_settings']['auto_start'] ); ?> class="checkbox">
 
10
  <label for="view-auto_start">
11
- <?php echo esc_html_x( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?>
12
  </label>
13
  </div>
14
  </div>
15
 
16
  <div class="row">
17
  <div class="inline inline-middle">
18
- <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]" value="0" <?php checked( $view['slideshow_settings']['auto_hover'] ); ?> class="checkbox">
 
19
  <label for="view-auto_hover">
20
- <?php echo esc_html_x( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?>
21
  </label>
22
  </div>
23
  </div>
@@ -25,14 +27,14 @@
25
  <div class="row">
26
  <div class="inline inline-middle">
27
  <input type="checkbox" id="view-stop_auto_on_click"
28
- name="view[data][slideshow_settings][stop_auto_on_click]" value="0"
29
  <?php checked( $view['slideshow_settings']['stop_auto_on_click'] ); ?> class="checkbox">
30
  <label for="view-stop_auto_on_click">
31
- <?php echo esc_html_x( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?>
32
  </label>
33
  </div>
34
  <div class="inline inline-middle">
35
- <p class="description"><?php esc_html_e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
36
  </div>
37
  </div>
38
 
@@ -41,7 +43,7 @@
41
  $height = 'dynamic';
42
  } else {
43
  $height = 'static';
44
- }
45
  ?>
46
  <div class="row">
47
  <div class="row-inner">
@@ -50,8 +52,9 @@
50
  <label for="view-slideshow_height">
51
  <select id="view-slideshow_height" name="view[data][slideshow_settings][height]" class="if selectgroup">
52
  <?php foreach ( $view_options['slideshow_height'] as $key => $type ) : ?>
53
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" <?php selected( $height, $key ); ?>>
54
- <?php echo esc_html( $type ); ?>
 
55
  </option>
56
  <?php endforeach; ?>
57
  </select>
@@ -60,28 +63,31 @@
60
 
61
  <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
62
  <label for="view-adapt_height_speed">
63
- <?php esc_html_e( 'Duration', 'strong-testimonials' ); ?>
64
  </label>
65
- <input type="number" id="view-adapt_height_speed" class="input-incremental" name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1" value="<?php echo esc_attr( $view['slideshow_settings']['adapt_height_speed'] ); ?>" size="3"/>
66
- <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
 
 
67
  </div>
68
 
69
  <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
70
- <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]" value="1" <?php checked( $view['slideshow_settings']['stretch'] ); ?> class="checkbox">
 
71
  <label for="view-stretch">
72
- <?php esc_html_e( 'Stretch slides vertically', 'strong-testimonials' ); ?>
73
  </label>
74
 
75
  <div class="inline description">
76
- <a href="#tab-panel-wpmtst-help-stretch" class="open-help-tab"><?php esc_html_e( 'Help' ); ?></a>
77
  </div>
78
  </div>
79
 
80
  </div>
81
  </div>
82
 
83
- <div class="row tall">
84
- <p class="description"><?php esc_html_e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
85
- </div>
86
 
87
  </td>
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
+ <?php _e( 'Behavior', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
 
7
+ <div class="row">
8
  <div class="inline inline-middle">
9
+ <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]" value="0"
10
+ <?php checked( $view['slideshow_settings']['auto_start'] ); ?> class="checkbox">
11
  <label for="view-auto_start">
12
+ <?php _ex( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?>
13
  </label>
14
  </div>
15
  </div>
16
 
17
  <div class="row">
18
  <div class="inline inline-middle">
19
+ <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]" value="0"
20
+ <?php checked( $view['slideshow_settings']['auto_hover'] ); ?> class="checkbox">
21
  <label for="view-auto_hover">
22
+ <?php _ex( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?>
23
  </label>
24
  </div>
25
  </div>
27
  <div class="row">
28
  <div class="inline inline-middle">
29
  <input type="checkbox" id="view-stop_auto_on_click"
30
+ name="view[data][slideshow_settings][stop_auto_on_click]" value="0"
31
  <?php checked( $view['slideshow_settings']['stop_auto_on_click'] ); ?> class="checkbox">
32
  <label for="view-stop_auto_on_click">
33
+ <?php _ex( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?>
34
  </label>
35
  </div>
36
  <div class="inline inline-middle">
37
+ <p class="description"><?php _e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
38
  </div>
39
  </div>
40
 
43
  $height = 'dynamic';
44
  } else {
45
  $height = 'static';
46
+ }
47
  ?>
48
  <div class="row">
49
  <div class="row-inner">
52
  <label for="view-slideshow_height">
53
  <select id="view-slideshow_height" name="view[data][slideshow_settings][height]" class="if selectgroup">
54
  <?php foreach ( $view_options['slideshow_height'] as $key => $type ) : ?>
55
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
+ <?php selected( $height, $key ); ?>>
57
+ <?php echo $type; ?>
58
  </option>
59
  <?php endforeach; ?>
60
  </select>
63
 
64
  <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
65
  <label for="view-adapt_height_speed">
66
+ <?php _e( 'Duration', 'strong-testimonials' ); ?>
67
  </label>
68
+ <input type="number" id="view-adapt_height_speed" class="input-incremental"
69
+ name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
70
+ value="<?php echo $view['slideshow_settings']['adapt_height_speed']; ?>" size="3"/>
71
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
72
  </div>
73
 
74
  <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
75
+ <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]" value="1"
76
+ <?php checked( $view['slideshow_settings']['stretch'] ); ?> class="checkbox">
77
  <label for="view-stretch">
78
+ <?php _e( 'Stretch slides vertically', 'strong-testimonials' ); ?>
79
  </label>
80
 
81
  <div class="inline description">
82
+ <a href="#tab-panel-wpmtst-help-stretch" class="open-help-tab"><?php _e( 'Help' ); ?></a>
83
  </div>
84
  </div>
85
 
86
  </div>
87
  </div>
88
 
89
+ <div class="row tall">
90
+ <p class="description"><?php _e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
91
+ </div>
92
 
93
  </td>
admin/partials/views/option-slideshow-breakpoints.php CHANGED
@@ -1,81 +1,95 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
3
- <div class="row">
4
 
5
- <div class="inner-table is-below">
6
- <div class="inner-table-row bordered header">
7
- <div class="inner-table-cell">
8
- <?php esc_html_e( 'minimum screen width', 'strong-testimonials' ); ?>
9
- </div>
10
- <div class="inner-table-cell">
11
- <?php esc_html_e( 'show', 'strong-testimonials' ); ?>
12
- </div>
13
- <div class="inner-table-cell">
14
- <?php esc_html_e( 'margin', 'strong-testimonials' ); ?>
15
- </div>
16
- <div class="inner-table-cell">
17
- <?php esc_html_e( 'move', 'strong-testimonials' ); ?>
18
- </div>
19
- </div>
20
 
21
  <?php foreach ( $view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
22
- <div class="inner-table-row bordered">
23
 
24
- <div class="inner-table-cell">
25
- <label>
26
- <input id="view-breakpoint_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][width]" value="<?php echo esc_attr( $breakpoint['width'] ); ?>" type="number" class="input-incremental">
27
- px
28
- </label>
29
- </div>
 
 
 
30
 
31
- <div class="inner-table-cell">
32
- <label>
33
- <select id="view-max_slides_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][max_slides]" class="if selectgroup">
34
- <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1</option>
35
- <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2</option>
36
- <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3</option>
37
- <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4</option>
38
- </select>
39
- </label>
40
- <div class="option-desc singular" style="display: none;">
41
- <?php esc_html_e( 'slide', 'strong-testimonials' ); ?>
42
- </div>
43
- <div class="option-desc plural" style="display: none;">
44
- <?php esc_html_e( 'slides', 'strong-testimonials' ); ?>
45
- </div>
46
- </div>
 
 
47
 
48
- <div class="inner-table-cell">
49
- <input id="view-margin_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][margin]" value="<?php echo esc_attr( $breakpoint['margin'] ); ?>" type="number" min="1" step="1" size="3" class="input-incremental"/>
50
- px
51
- </div>
 
 
 
52
 
53
- <div class="inner-table-cell">
54
- <label>
55
- <select id="view-move_slides_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][move_slides]" class="if selectgroup">
56
- <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1</option>
57
- <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2</option>
58
- <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3</option>
59
- <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4</option>
60
- </select>
61
- </label>
62
- <div class="option-desc singular" style="display: none;">
63
- <?php esc_html_e( 'slide', 'strong-testimonials' ); ?>
64
- </div>
65
- <div class="option-desc plural" style="display: none;">
66
- <?php esc_html_e( 'slides', 'strong-testimonials' ); ?>
67
- </div>
68
- </div>
 
 
69
 
70
- </div>
71
 
72
  <?php endforeach; ?>
73
- </div>
74
 
75
- </div>
76
 
77
- <div class="is-below">
78
- <input id="restore-default-breakpoints" type="button" name="restore-default-breakpoints" value="<?php esc_attr_e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>" class="button-secondary" />
79
- <span id="restored-message"><?php esc_html_e( 'defaults restored', 'strong-testimonials' ); ?></span>
80
- </div>
 
 
 
 
81
  </div>
1
  <?php /* translators: In the view editor. */ ?>
2
  <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
3
+ <div class="row">
4
 
5
+ <div class="inner-table is-below">
6
+ <div class="inner-table-row bordered header">
7
+ <div class="inner-table-cell">
8
+ <?php _e( 'minimum screen width', 'strong-testimonials' ); ?>
9
+ </div>
10
+ <div class="inner-table-cell">
11
+ <?php _e( 'show', 'strong-testimonials' ); ?>
12
+ </div>
13
+ <div class="inner-table-cell">
14
+ <?php _e( 'margin', 'strong-testimonials' ); ?>
15
+ </div>
16
+ <div class="inner-table-cell">
17
+ <?php _e( 'move', 'strong-testimonials' ); ?>
18
+ </div>
19
+ </div>
20
 
21
  <?php foreach ( $view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
22
+ <div class="inner-table-row bordered">
23
 
24
+ <div class="inner-table-cell">
25
+ <label>
26
+ <input id="view-breakpoint_<?php echo $key; ?>"
27
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][width]"
28
+ value="<?php echo $breakpoint['width']; ?>"
29
+ type="number"
30
+ class="input-incremental"> px
31
+ </label>
32
+ </div>
33
 
34
+ <div class="inner-table-cell">
35
+ <label>
36
+ <select id="view-max_slides_<?php echo $key; ?>"
37
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][max_slides]"
38
+ class="if selectgroup">
39
+ <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1</option>
40
+ <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2</option>
41
+ <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3</option>
42
+ <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4</option>
43
+ </select>
44
+ </label>
45
+ <div class="option-desc singular" style="display: none;">
46
+ <?php _e( 'slide', 'strong-testimonials' ); ?>
47
+ </div>
48
+ <div class="option-desc plural" style="display: none;">
49
+ <?php _e( 'slides', 'strong-testimonials' ); ?>
50
+ </div>
51
+ </div>
52
 
53
+ <div class="inner-table-cell">
54
+ <input id="view-margin_<?php echo $key; ?>"
55
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][margin]"
56
+ value="<?php echo $breakpoint['margin']; ?>"
57
+ type="number" min="1" step="1" size="3"
58
+ class="input-incremental"/> px
59
+ </div>
60
 
61
+ <div class="inner-table-cell">
62
+ <label>
63
+ <select id="view-move_slides_<?php echo $key; ?>"
64
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][move_slides]"
65
+ class="if selectgroup">
66
+ <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1</option>
67
+ <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2</option>
68
+ <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3</option>
69
+ <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4</option>
70
+ </select>
71
+ </label>
72
+ <div class="option-desc singular" style="display: none;">
73
+ <?php _e( 'slide', 'strong-testimonials' ); ?>
74
+ </div>
75
+ <div class="option-desc plural" style="display: none;">
76
+ <?php _e( 'slides', 'strong-testimonials' ); ?>
77
+ </div>
78
+ </div>
79
 
80
+ </div>
81
 
82
  <?php endforeach; ?>
83
+ </div>
84
 
85
+ </div>
86
 
87
+ <div class="is-below">
88
+ <input id="restore-default-breakpoints"
89
+ type="button"
90
+ name="restore-default-breakpoints"
91
+ value="<?php _e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
92
+ class="button-secondary" />
93
+ <span id="restored-message"><?php _e( 'defaults restored', 'strong-testimonials' ); ?></span>
94
+ </div>
95
  </div>
admin/partials/views/option-slideshow-navigation.php CHANGED
@@ -1,108 +1,104 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
- <label for="view-slideshow_nav">
4
- <?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?>
5
- </label>
6
  </th>
7
  <td>
8
 
9
  <?php /* ----- CONTROLS ----- */ ?>
10
- <div class="row">
11
- <div class="row-inner">
12
 
13
  <?php /* ----- TYPE ----- */ ?>
14
- <div class="inline">
15
- <label for="view-slideshow_controls_type"><?php esc_html_e( 'Controls', 'strong-testimonials' ); ?></label>
16
- <select id="view-slideshow_controls_type"
17
- name="view[data][slideshow_settings][controls_type]"
18
- class="if selectnot">
19
  <?php foreach ( $view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
20
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
21
  <?php selected( $view['slideshow_settings']['controls_type'], $key ); ?>
22
- <?php
23
- if ( 'none' == $key ) {
24
  echo ' class="trip"';
25
- }
26
- ?>
27
- >
28
- <?php echo esc_html( $type['label'] ); ?>
29
- </option>
30
  <?php endforeach; ?>
31
- </select>
32
- </div>
33
 
34
  <?php /* ----- STYLE ----- */ ?>
35
- <div class="inline then then_slideshow_controls_type" style="display: none;">
36
- <label for="view-slideshow_controls_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
37
- <select id="view-slideshow_controls_style" name="view[data][slideshow_settings][controls_style]">
38
  <?php foreach ( $view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
39
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['controls_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
40
  <?php endforeach; ?>
41
- </select>
42
- </div>
43
 
44
- </div>
45
- </div>
46
 
47
  <?php /* ----- PAGER ----- */ ?>
48
- <div class="row">
49
- <div class="row-inner then then_has-pager">
50
 
51
  <?php /* ----- TYPE ----- */ ?>
52
- <div class="inline">
53
- <label for="view-slideshow_pager_type"><?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?></label>
54
- <select id="view-slideshow_pager_type"
55
- name="view[data][slideshow_settings][pager_type]"
56
- class="if selectnot">
57
  <?php foreach ( $view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
58
- <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
59
  <?php selected( $view['slideshow_settings']['pager_type'], $key ); ?>
60
- <?php
61
- if ( 'none' == $key ) {
62
  echo ' class="trip"';
63
- }
64
- ?>
65
- >
66
- <?php echo esc_html( $type['label'] ); ?>
67
- </option>
68
  <?php endforeach; ?>
69
- </select>
70
- </div>
71
 
72
  <?php /* ----- STYLE ----- */ ?>
73
- <div class="inline then then_slideshow_pager_type" style="display: none;">
74
- <label for="view-slideshow_pager_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
75
- <select id="view-slideshow_pager_style" name="view[data][slideshow_settings][pager_style]" class="if selectnot">
 
 
76
  <?php foreach ( $view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
77
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['pager_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
78
  <?php endforeach; ?>
79
- </select>
80
- </div>
81
 
82
- </div>
83
- </div>
84
 
85
  <?php /* ----- POSITION ----- */ ?>
86
- <div class="row">
87
- <div class="row-inner">
88
 
89
- <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
90
- <div class="inline then then_has-position" style="display: none;">
91
- <label for="view-slideshow_nav_position"><?php esc_html_e( 'Position', 'strong-testimonials' ); ?></label>
92
 
93
- <select id="view-slideshow_nav_position" name="view[data][slideshow_settings][nav_position]">
94
  <?php foreach ( $view_options['slideshow_nav_position'] as $key => $label ) : ?>
95
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['nav_position'], $key ); ?>><?php echo esc_html( $label ); ?></option>
96
  <?php endforeach; ?>
97
- </select>
98
 
99
  <?php //_e( 'outside', 'strong-testimonials' ); ?>
100
 
101
- <?php esc_html_e( 'the testimonial frame', 'strong-testimonials' ); ?>
102
- </div>
103
- </div>
104
 
105
- </div>
106
- </div>
107
 
108
  </td>
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
+ <label for="view-slideshow_nav">
4
+ <?php _e( 'Navigation', 'strong-testimonials' ); ?>
5
+ </label>
6
  </th>
7
  <td>
8
 
9
  <?php /* ----- CONTROLS ----- */ ?>
10
+ <div class="row">
11
+ <div class="row-inner">
12
 
13
  <?php /* ----- TYPE ----- */ ?>
14
+ <div class="inline">
15
+ <label for="view-slideshow_controls_type"><?php _e( 'Controls', 'strong-testimonials' ); ?></label>
16
+ <select id="view-slideshow_controls_type"
17
+ name="view[data][slideshow_settings][controls_type]"
18
+ class="if selectnot">
19
  <?php foreach ( $view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
20
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
21
  <?php selected( $view['slideshow_settings']['controls_type'], $key ); ?>
22
+ <?php if ( 'none' == $key ) {
 
23
  echo ' class="trip"';
24
+ } ?>>
25
+ <?php echo $type['label']; ?>
26
+ </option>
 
 
27
  <?php endforeach; ?>
28
+ </select>
29
+ </div>
30
 
31
  <?php /* ----- STYLE ----- */ ?>
32
+ <div class="inline then then_slideshow_controls_type" style="display: none;">
33
+ <label for="view-slideshow_controls_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
34
+ <select id="view-slideshow_controls_style" name="view[data][slideshow_settings][controls_style]">
35
  <?php foreach ( $view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
36
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['controls_style'], $key ); ?>><?php echo $style['label']; ?></option>
37
  <?php endforeach; ?>
38
+ </select>
39
+ </div>
40
 
41
+ </div>
42
+ </div>
43
 
44
  <?php /* ----- PAGER ----- */ ?>
45
+ <div class="row">
46
+ <div class="row-inner then then_has-pager">
47
 
48
  <?php /* ----- TYPE ----- */ ?>
49
+ <div class="inline">
50
+ <label for="view-slideshow_pager_type"><?php _e( 'Pagination', 'strong-testimonials' ); ?></label>
51
+ <select id="view-slideshow_pager_type"
52
+ name="view[data][slideshow_settings][pager_type]"
53
+ class="if selectnot">
54
  <?php foreach ( $view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
55
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
  <?php selected( $view['slideshow_settings']['pager_type'], $key ); ?>
57
+ <?php if ( 'none' == $key ) {
 
58
  echo ' class="trip"';
59
+ } ?>>
60
+ <?php echo $type['label']; ?>
61
+ </option>
 
 
62
  <?php endforeach; ?>
63
+ </select>
64
+ </div>
65
 
66
  <?php /* ----- STYLE ----- */ ?>
67
+ <div class="inline then then_slideshow_pager_type" style="display: none;">
68
+ <label for="view-slideshow_pager_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
69
+ <select id="view-slideshow_pager_style"
70
+ name="view[data][slideshow_settings][pager_style]"
71
+ class="if selectnot">
72
  <?php foreach ( $view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
73
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['pager_style'], $key ); ?>><?php echo $style['label']; ?></option>
74
  <?php endforeach; ?>
75
+ </select>
76
+ </div>
77
 
78
+ </div>
79
+ </div>
80
 
81
  <?php /* ----- POSITION ----- */ ?>
82
+ <div class="row">
83
+ <div class="row-inner">
84
 
85
+ <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
86
+ <div class="inline then then_has-position" style="display: none;">
87
+ <label for="view-slideshow_nav_position"><?php _e( 'Position', 'strong-testimonials' ); ?></label>
88
 
89
+ <select id="view-slideshow_nav_position" name="view[data][slideshow_settings][nav_position]">
90
  <?php foreach ( $view_options['slideshow_nav_position'] as $key => $label ) : ?>
91
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['nav_position'], $key ); ?>><?php echo $label; ?></option>
92
  <?php endforeach; ?>
93
+ </select>
94
 
95
  <?php //_e( 'outside', 'strong-testimonials' ); ?>
96
 
97
+ <?php _e( 'the testimonial frame', 'strong-testimonials' ); ?>
98
+ </div>
99
+ </div>
100
 
101
+ </div>
102
+ </div>
103
 
104
  </td>
admin/partials/views/option-slideshow-num.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Show', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
- <?php require 'option-slideshow-type.php'; ?>
7
- <?php require 'option-slideshow-breakpoints.php'; ?>
8
  </td>
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
+ <?php _e( 'Show', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
+ <?php include( 'option-slideshow-type.php' ); ?>
7
+ <?php include( 'option-slideshow-breakpoints.php' ); ?>
8
  </td>
admin/partials/views/option-slideshow-transition.php CHANGED
@@ -1,41 +1,45 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Transition', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
  <div class="row">
7
 
8
  <div class="inline inline-middle">
9
  <label for="view-pause">
10
- <?php echo esc_html_x( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?>
11
  </label>
12
- <input type="number" id="view-pause" class="input-incremental" name="view[data][slideshow_settings][pause]" min=".1" step=".1" value="<?php echo esc_attr( $view['slideshow_settings']['pause'] ); ?>" size="3"/>
13
- <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
 
 
14
  </div>
15
 
16
  <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast" style="display: none;">
17
  <label for="view-effect">
18
- <?php esc_html_e( 'then', 'strong-testimonials' ); ?>
19
  </label>
20
  <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
21
  <?php foreach ( $view_options['slideshow_effect'] as $key => $label ) : ?>
22
- <option value="<?php echo esc_attr( $key ); ?>"
23
  <?php selected( $view['slideshow_settings']['effect'], $key ); ?>
24
- <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo esc_html( $label ); ?></option>
25
  <?php endforeach; ?>
26
  </select>
27
  </div>
28
 
29
- <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast" style="display: none;">
30
- <?php esc_html_e( 'then', 'strong-testimonials' ); ?> <?php echo esc_html_x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
31
- </div>
32
 
33
  <div class="inline inline-middle then then_effect then_none">
34
  <label for="view-speed">
35
- <?php esc_html_e( 'for', 'strong-testimonials' ); ?>
36
  </label>
37
- <input type="number" id="view-speed" class="input-incremental" name="view[data][slideshow_settings][speed]" min=".1" step=".1" value="<?php echo esc_attr( $view['slideshow_settings']['speed'] ); ?>" size="3"/>
38
- <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
 
 
39
  </div>
40
 
41
  </div>
1
  <?php /* translators: In the view editor. */ ?>
2
  <th>
3
+ <?php _e( 'Transition', 'strong-testimonials' ); ?>
4
  </th>
5
  <td>
6
  <div class="row">
7
 
8
  <div class="inline inline-middle">
9
  <label for="view-pause">
10
+ <?php _ex( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?>
11
  </label>
12
+ <input type="number" id="view-pause" class="input-incremental"
13
+ name="view[data][slideshow_settings][pause]" min=".1" step=".1"
14
+ value="<?php echo $view['slideshow_settings']['pause']; ?>" size="3"/>
15
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
16
  </div>
17
 
18
  <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast" style="display: none;">
19
  <label for="view-effect">
20
+ <?php _e( 'then', 'strong-testimonials' ); ?>
21
  </label>
22
  <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
23
  <?php foreach ( $view_options['slideshow_effect'] as $key => $label ) : ?>
24
+ <option value="<?php echo $key; ?>"
25
  <?php selected( $view['slideshow_settings']['effect'], $key ); ?>
26
+ <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo $label; ?></option>
27
  <?php endforeach; ?>
28
  </select>
29
  </div>
30
 
31
+ <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast" style="display: none;">
32
+ <?php _e( 'then', 'strong-testimonials' ); ?> <?php _ex( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
33
+ </div>
34
 
35
  <div class="inline inline-middle then then_effect then_none">
36
  <label for="view-speed">
37
+ <?php _e( 'for', 'strong-testimonials' ); ?>
38
  </label>
39
+ <input type="number" id="view-speed" class="input-incremental"
40
+ name="view[data][slideshow_settings][speed]" min=".1" step=".1"
41
+ value="<?php echo $view['slideshow_settings']['speed']; ?>" size="3"/>
42
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
43
  </div>
44
 
45
  </div>
admin/partials/views/option-slideshow-type.php CHANGED
@@ -1,19 +1,19 @@
1
  <?php /* translators: In the view editor. */ ?>
2
  <div class="row">
3
 
4
- <div class="inline inline-middle">
5
- <label>
6
- <select id="view-slider_type" name="view[data][slideshow_settings][type]" class="if selectgroup">
7
- <option value="show_single" <?php selected( $view['slideshow_settings']['type'], 'show_single' ); ?>><?php esc_html_e( 'single', 'strong-testimonials' ); ?></option>
8
- <option value="show_multiple" <?php selected( $view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php esc_html_e( 'multiple', 'strong-testimonials' ); ?></option>
9
- </select>
10
- </label>
11
- <div class="option-desc singular" style="display: none;">
12
- <?php esc_html_e( 'slide at a time', 'strong-testimonials' ); ?>
13
- </div>
14
- <div class="option-desc plural" style="display: none;">
15
- <?php esc_html_e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
16
- </div>
17
- </div>
18
 
19
  </div>
1
  <?php /* translators: In the view editor. */ ?>
2
  <div class="row">
3
 
4
+ <div class="inline inline-middle">
5
+ <label>
6
+ <select id="view-slider_type" name="view[data][slideshow_settings][type]" class="if selectgroup">
7
+ <option value="show_single" <?php selected( $view['slideshow_settings']['type'], 'show_single' ); ?>><?php _e( 'single', 'strong-testimonials' ); ?></option>
8
+ <option value="show_multiple" <?php selected( $view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php _e( 'multiple', 'strong-testimonials' ); ?></option>
9
+ </select>
10
+ </label>
11
+ <div class="option-desc singular" style="display: none;">
12
+ <?php _e( 'slide at a time', 'strong-testimonials' ); ?>
13
+ </div>
14
+ <div class="option-desc plural" style="display: none;">
15
+ <?php _e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
16
+ </div>
17
+ </div>
18
 
19
  </div>
admin/partials/views/option-template-list.php CHANGED
@@ -1,22 +1,22 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
- <?php esc_html_e( 'Template', 'strong-testimonials' ); ?>
4
  </th>
5
  <td colspan="2">
6
- <div id="view-template-list">
7
- <div class="radio-buttons">
8
 
9
- <?php require 'template-not-found.php'; ?>
10
 
11
- <ul class="radio-list template-list">
12
- <?php foreach ( $templates[ $current_type ] as $key => $template ) : ?>
13
- <li>
14
- <?php include 'template-input.php'; ?>
15
- <?php include 'template-options.php'; ?>
16
- </li>
17
- <?php endforeach; ?>
18
- </ul>
19
 
20
- </div>
21
- </div>
22
  </td>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <th>
3
+ <?php _e( 'Template', 'strong-testimonials' ); ?>
4
  </th>
5
  <td colspan="2">
6
+ <div id="view-template-list">
7
+ <div class="radio-buttons">
8
 
9
+ <?php include 'template-not-found.php'; ?>
10
 
11
+ <ul class="radio-list template-list">
12
+ <?php foreach ( $templates[ $current_type ] as $key => $template ) : ?>
13
+ <li>
14
+ <?php include 'template-input.php'; ?>
15
+ <?php include 'template-options.php'; ?>
16
+ </li>
17
+ <?php endforeach; ?>
18
+ </ul>
19
 
20
+ </div>
21
+ </div>
22
  </td>
admin/partials/views/option-thumbnail.php CHANGED
@@ -2,7 +2,7 @@
2
  <th>
3
  <input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1" <?php checked( $view['thumbnail'] ); ?>>
4
  <label for="view-images">
5
- <?php esc_html_e( 'Featured Image', 'strong-testimonials' ); ?>
6
  </label>
7
  </th>
8
  <td colspan="2">
@@ -17,25 +17,20 @@
17
  </label>
18
  <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
19
  <?php foreach ( $image_sizes as $key => $size ) : ?>
20
- <option
21
- <?php
22
- if ( 'custom' == $key ) {
23
- echo ' class="trip"';}
24
- ?>
25
- value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $view['thumbnail_size'] ); ?>><?php echo esc_html( $size['label'] ); ?></option>
26
  <?php endforeach; ?>
27
  </select>
28
  </div>
29
  <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
30
  <label for="thumbnail_width">
31
- <?php esc_html_e( 'width', 'strong-testimonials' ); ?>
32
  </label>
33
- <input id="thumbnail_width" class="input-number-px" type="text" name="view[data][thumbnail_width]" value="<?php echo esc_attr( $view['thumbnail_width'] ); ?>"> px
34
  <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
35
- <label for="thumbnail_height">
36
- <?php esc_html_e( 'height', 'strong-testimonials' ); ?>
37
  </label>
38
- <input id="thumbnail_height" class="input-number-px" type="text" name="view[data][thumbnail_height]" value="<?php echo esc_attr( $view['thumbnail_height'] ); ?>"> px
39
  </div>
40
  </div>
41
  </div>
@@ -46,26 +41,26 @@
46
  <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
47
  value="1" <?php checked( $view['lightbox'] ); ?> class="checkbox">
48
  <label for="view-lightbox">
49
- <?php esc_html_e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?>
50
  </label>
51
  </div>
52
  <div class="inline then then_lightbox">
53
- <p class="description"><?php esc_html_e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
54
  </div>
55
  </div>
56
  </div>
57
 
58
  <div class="row">
59
  <div class="row-inner">
60
- <div class="inline then then_lightbox input" style="display: none;">
61
- <label for="view-lightbox_class">
62
- <?php esc_html_e( 'CSS class', 'strong-testimonials' ); ?>
63
- </label>
64
- <input type="text" id="view-lightbox_class" class="medium inline" name="view[data][lightbox_class]" value="<?php echo esc_attr( $view['lightbox_class'] ); ?>">
65
- <p class="inline description tall">
66
- <?php esc_html_e( 'To add a class to the image link.', 'strong-testimonials' ); ?>
67
- </p>
68
- </div>
69
  </div>
70
  </div>
71
 
@@ -73,18 +68,18 @@
73
  <div class="row-inner">
74
  <div class="inline">
75
  <label for="view-gravatar">
76
- <?php esc_html_e( 'If no Featured Image', 'strong-testimonials' ); ?>
77
  </label>
78
  <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
79
- <option value="no" <?php selected( $view['gravatar'], 'no' ); ?>><?php esc_html_e( 'show nothing', 'strong-testimonials' ); ?></option>
80
- <option value="yes" <?php selected( $view['gravatar'], 'yes' ); ?>><?php esc_html_e( 'show Gravatar', 'strong-testimonials' ); ?></option>
81
- <option value="if" <?php selected( $view['gravatar'], 'if' ); ?>><?php esc_html_e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
82
  </select>
83
  </div>
84
  <div class="inline">
85
  <div class="then fast then_not_no then_yes then_if" style="display: none;">
86
  <p class="description tall">
87
- <a href="<?php echo esc_url( admin_url( 'options-discussion.php' ) ); ?>"><?php esc_html_e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
88
  </p>
89
  </div>
90
  </div>
2
  <th>
3
  <input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1" <?php checked( $view['thumbnail'] ); ?>>
4
  <label for="view-images">
5
+ <?php _e( 'Featured Image', 'strong-testimonials' ); ?>
6
  </label>
7
  </th>
8
  <td colspan="2">
17
  </label>
18
  <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
19
  <?php foreach ( $image_sizes as $key => $size ) : ?>
20
+ <option<?php if ( 'custom' == $key ) echo ' class="trip"'; ?> value="<?php echo $key; ?>"<?php selected( $key, $view['thumbnail_size'] ); ?>><?php echo $size['label']; ?></option>
 
 
 
 
 
21
  <?php endforeach; ?>
22
  </select>
23
  </div>
24
  <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
25
  <label for="thumbnail_width">
26
+ <?php _e( 'width', 'strong-testimonials' ); ?>
27
  </label>
28
+ <input id="thumbnail_width" class="input-number-px" type="text" name="view[data][thumbnail_width]" value="<?php echo $view['thumbnail_width']; ?>"> px
29
  <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
30
+ <label for="thumbnail_height">
31
+ <?php _e( 'height', 'strong-testimonials' ); ?>
32
  </label>
33
+ <input id="thumbnail_height" class="input-number-px" type="text" name="view[data][thumbnail_height]" value="<?php echo $view['thumbnail_height']; ?>"> px
34
  </div>
35
  </div>
36
  </div>
41
  <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
42
  value="1" <?php checked( $view['lightbox'] ); ?> class="checkbox">
43
  <label for="view-lightbox">
44
+ <?php _e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?>
45
  </label>
46
  </div>
47
  <div class="inline then then_lightbox">
48
+ <p class="description"><?php _e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
49
  </div>
50
  </div>
51
  </div>
52
 
53
  <div class="row">
54
  <div class="row-inner">
55
+ <div class="inline then then_lightbox input" style="display: none;">
56
+ <label for="view-lightbox_class">
57
+ <?php _e( 'CSS class', 'strong-testimonials' ); ?>
58
+ </label>
59
+ <input type="text" id="view-lightbox_class" class="medium inline" name="view[data][lightbox_class]" value="<?php echo $view['lightbox_class']; ?>">
60
+ <p class="inline description tall">
61
+ <?php _e( 'To add a class to the image link.', 'strong-testimonials' ); ?>
62
+ </p>
63
+ </div>
64
  </div>
65
  </div>
66
 
68
  <div class="row-inner">
69
  <div class="inline">
70
  <label for="view-gravatar">
71
+ <?php _e( 'If no Featured Image', 'strong-testimonials' ); ?>
72
  </label>
73
  <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
74
+ <option value="no" <?php selected( $view['gravatar'], 'no' ); ?>><?php _e( 'show nothing', 'strong-testimonials' ); ?></option>
75
+ <option value="yes" <?php selected( $view['gravatar'], 'yes' ); ?>><?php _e( 'show Gravatar', 'strong-testimonials' ); ?></option>
76
+ <option value="if" <?php selected( $view['gravatar'], 'if' ); ?>><?php _e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
77
  </select>
78
  </div>
79
  <div class="inline">
80
  <div class="then fast then_not_no then_yes then_if" style="display: none;">
81
  <p class="description tall">
82
+ <a href="<?php echo admin_url( 'options-discussion.php' ); ?>"><?php _e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
83
  </p>
84
  </div>
85
  </div>
admin/partials/views/option-title.php CHANGED
@@ -1,18 +1,20 @@
1
  <th>
2
- <input type="checkbox" id="view-title" name="view[data][title]" value="1" <?php checked( $view['title'] ); ?> class="checkbox if toggle">
3
- <label for="view-title">
4
- <?php esc_html_e( 'Title', 'strong-testimonials' ); ?>
5
- </label>
 
6
  </th>
7
  <td colspan="2">
8
- <div class="row">
9
- <div class="row-inner">
10
- <div class="then then_title" style="display: none;">
11
- <input type="checkbox" id="view-title_link" name="view[data][title_link]" value="1" <?php checked( $view['title_link'] ); ?> class="checkbox">
12
- <label for="view-title_link">
13
- <?php printf( esc_html_x( 'Link to full %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
14
- </label>
15
- </div>
16
- </div>
17
- </div>
 
18
  </td>
1
  <th>
2
+ <input type="checkbox" id="view-title" name="view[data][title]" value="1" <?php checked( $view['title'] ); ?>
3
+ class="checkbox if toggle">
4
+ <label for="view-title">
5
+ <?php _e( 'Title', 'strong-testimonials' ); ?>
6
+ </label>
7
  </th>
8
  <td colspan="2">
9
+ <div class="row">
10
+ <div class="row-inner">
11
+ <div class="then then_title" style="display: none;">
12
+ <input type="checkbox" id="view-title_link" name="view[data][title_link]"
13
+ value="1" <?php checked( $view['title_link'] ); ?> class="checkbox">
14
+ <label for="view-title_link">
15
+ <?php printf( _x( 'Link to full %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
16
+ </label>
17
+ </div>
18
+ </div>
19
+ </div>
20
  </td>
admin/partials/views/template-input.php CHANGED
@@ -1,6 +1,8 @@
1
  <div>
2
- <input type="radio" id="template-<?php echo esc_attr( $key ); ?>" name="view[data][<?php echo esc_attr( $current_mode ); ?>]" value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
3
- <label for="template-<?php echo esc_attr( $key ); ?>">
4
- <?php echo wp_kses_post( $template['config']['name'] ); ?>
5
- </label>
 
 
6
  </div>
1
  <div>
2
+ <input type="radio" id="template-<?php esc_attr_e( $key ); ?>"
3
+ name="view[data][<?php esc_attr_e( $current_mode ); ?>]"
4
+ value="<?php esc_attr_e( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
5
+ <label for="template-<?php esc_attr_e( $key ); ?>">
6
+ <?php echo $template['config']['name']; ?>
7
+ </label>
8
  </div>
admin/partials/views/template-not-found.php CHANGED
@@ -3,22 +3,23 @@
3
  /* translators: On the Views admin screen. */
4
  ?>
5
  <?php if ( ! $template_found ) : ?>
6
- <ul class="radio-list template-list">
7
- <li>
8
- <div>
9
- <input class="error" type="radio" id="<?php echo esc_attr( $view['template'] ); ?>" name="view[data][<?php echo esc_attr( $current_mode ); ?>]" value="<?php echo esc_attr( $view['template'] ); ?>" checked>
10
- <label for="<?php echo esc_attr( $view['template'] ); ?>">
11
- <?php echo esc_html( $view['template'] ); ?>
12
- </label>
13
- </div>
14
- <div class="template-description">
15
- <p>
16
- <span class="dashicons dashicons-warning error"></span>&nbsp;
17
- <span class="error"><?php esc_html_e( 'not found', 'strong-testimonials' ); ?></span>
18
- </p>
 
 
19
  <?php // TODO Explain: Add template key and explain this could be due to switching themes or deactivating a template plugin. It's OK to leave this setting as is if testing or troubleshooting. ?>
20
- </div>
21
- </li>
22
- </ul>
23
- <?php
24
- endif;
3
  /* translators: On the Views admin screen. */
4
  ?>
5
  <?php if ( ! $template_found ) : ?>
6
+ <ul class="radio-list template-list">
7
+ <li>
8
+ <div>
9
+ <input class="error" type="radio" id="<?php esc_attr_e( $view['template'] ); ?>"
10
+ name="view[data][<?php esc_attr_e( $current_mode ); ?>]"
11
+ value="<?php esc_attr_e( $view['template'] ); ?>" checked>
12
+ <label for="<?php esc_attr_e( $view['template'] ); ?>">
13
+ <?php echo $view['template']; ?>
14
+ </label>
15
+ </div>
16
+ <div class="template-description">
17
+ <p>
18
+ <span class="dashicons dashicons-warning error"></span>&nbsp;
19
+ <span class="error"><?php _e( 'not found', 'strong-testimonials' ); ?></span>
20
+ </p>
21
  <?php // TODO Explain: Add template key and explain this could be due to switching themes or deactivating a template plugin. It's OK to leave this setting as is if testing or troubleshooting. ?>
22
+ </div>
23
+ </li>
24
+ </ul>
25
+ <?php endif;
 
admin/partials/views/template-options.php CHANGED
@@ -1,77 +1,78 @@
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <div class="template-description">
3
- <p>
4
- <?php
5
- if ( isset( $template['config']['description'] ) && $template['config']['description'] ) {
6
- echo wp_kses_post( $template['config']['description'] );
7
- } else {
8
- esc_html_e( 'no description', 'strong-testimonials' );
9
- }
10
- ?>
11
- </p>
12
- <div class="options">
13
- <div>
14
- <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
15
- <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
16
- <?php else : ?>
17
- <span><?php esc_html_e( 'Options', 'strong-testimonials' ); ?></span>
 
18
 
19
- <?php foreach ( $template['config']['options'] as $option ) : ?>
20
- <span>
21
- <?php
22
- $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
23
- $id = $key . '-' . $option->name;
24
- switch ( $option->type ) {
25
- case 'select':
26
- // Get default if not set
27
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
28
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
29
- }
30
 
31
- if ( $option->label ) {
32
- printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
33
- }
34
 
35
- printf( '<select id="%s" name="%s">', esc_attr( $id ), esc_attr( $name ) );
36
 
37
- foreach ( $option->values as $value ) {
38
- $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
39
- printf( '<option value="%s" %s>%s</option>', esc_attr( $value->value ), esc_attr( $selected ), esc_html( $value->description ) );
40
- }
41
 
42
- echo '</select>';
43
- break;
44
 
45
- case 'radio':
46
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
47
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
48
- }
49
 
50
- foreach ( $option->values as $value ) {
51
- $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
52
- printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', esc_attr( $id ), esc_attr( $name ), esc_attr( $value->value ), esc_attr( $checked ) );
53
- printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $value->description ) );
54
- }
55
- break;
56
 
57
- case 'checkbox':
58
- /** This breaks checkboxes: */
59
- //if ( ! isset( $view['template_settings'][ $option->name ] ) ) {
60
- // $view['template_settings'][ $option->name ] = $option->default;
61
- //}
62
 
63
- $checked = checked( true, $view['template_settings'][ $key ][ $option->name ], false );
64
- printf( '<input type="checkbox" id="%s" name="%s" value="1" %s>', esc_attr( $id ), esc_attr( $name ), esc_attr( $checked ) );
65
- printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
66
- break;
67
 
68
- default:
69
- }
70
- ?>
71
- </span>
72
- <?php endforeach; ?>
73
 
74
- <?php endif; ?>
75
- </div>
76
- </div>
77
  </div>
1
  <?php /* translators: On the Views admin screen. */ ?>
2
  <div class="template-description">
3
+ <p>
4
+ <?php
5
+ if ( isset( $template['config']['description'] ) && $template['config']['description'] ) {
6
+ echo $template['config']['description'];
7
+ }
8
+ else {
9
+ _e( 'no description', 'strong-testimonials' );
10
+ }
11
+ ?>
12
+ </p>
13
+ <div class="options">
14
+ <div>
15
+ <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
16
+ <span><?php _e( 'No options', 'strong-testimonials' ); ?></span>
17
+ <?php else : ?>
18
+ <span><?php _e( 'Options', 'strong-testimonials' ); ?></span>
19
 
20
+ <?php foreach ( $template['config']['options'] as $option ) : ?>
21
+ <span>
22
+ <?php
23
+ $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
24
+ $id = $key . '-' . $option->name;
25
+ switch ( $option->type ) {
26
+ case 'select':
27
+ // Get default if not set
28
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
29
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
30
+ }
31
 
32
+ if ( $option->label ) {
33
+ printf( '<label for="%s">%s</label>', $id, $option->label );
34
+ }
35
 
36
+ printf( '<select id="%s" name="%s">', $id, $name );
37
 
38
+ foreach ( $option->values as $value ) {
39
+ $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
40
+ printf( '<option value="%s" %s>%s</option>', $value->value, $selected, $value->description );
41
+ }
42
 
43
+ echo '</select>';
44
+ break;
45
 
46
+ case 'radio':
47
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
48
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
49
+ }
50
 
51
+ foreach ( $option->values as $value ) {
52
+ $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
53
+ printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', $id, $name, $value->value, $checked );
54
+ printf( '<label for="%s">%s</label>', $id, $value->description );
55
+ }
56
+ break;
57
 
58
+ case 'checkbox':
59
+ /** This breaks checkboxes: */
60
+ //if ( ! isset( $view['template_settings'][ $option->name ] ) ) {
61
+ // $view['template_settings'][ $option->name ] = $option->default;
62
+ //}
63
 
64
+ $checked = checked( true, $view['template_settings'][ $key ][ $option->name ], false );
65
+ printf( '<input type="checkbox" id="%s" name="%s" value="1" %s>', $id, $name, $checked );
66
+ printf( '<label for="%s">%s</label>', $id, $option->label );
67
+ break;
68
 
69
+ default:
70
+ }
71
+ ?>
72
+ </span>
73
+ <?php endforeach; ?>
74
 
75
+ <?php endif; ?>
76
+ </div>
77
+ </div>
78
  </div>
admin/partials/views/view-mode.php CHANGED
@@ -1,17 +1,18 @@
1
  <div id="view-mode" class="table-row mode-select">
2
- <div class="table-cell">
3
- <?php esc_html_e( 'Mode', 'strong-testimonials' ); ?>
4
- </div>
5
- <div class="table-cell">
6
- <div class="mode-list">
7
- <?php foreach ( $view_options['mode'] as $mode ) : ?>
8
- <label>
9
- <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]" value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
10
- <?php echo esc_html( $mode['label'] ); ?>
11
- <div class="mode-line"></div>
12
- </label>
13
- <?php endforeach; ?>
14
- </div>
15
- <div class="mode-description"></div>
16
- </div>
 
17
  </div>
1
  <div id="view-mode" class="table-row mode-select">
2
+ <div class="table-cell">
3
+ <?php _e( 'Mode', 'strong-testimonials' ); ?>
4
+ </div>
5
+ <div class="table-cell">
6
+ <div class="mode-list">
7
+ <?php foreach ( $view_options['mode'] as $mode ) : ?>
8
+ <label>
9
+ <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
10
+ value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
11
+ <?php echo $mode['label']; ?>
12
+ <div class="mode-line"></div>
13
+ </label>
14
+ <?php endforeach; ?>
15
+ </div>
16
+ <div class="mode-description"></div>
17
+ </div>
18
  </div>
admin/partials/views/view-name.php CHANGED
@@ -5,12 +5,13 @@
5
  * @since 2.11.14
6
  */
7
  ?>
8
- <div class="table-cell">
9
- <label for="view-name">
10
- <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
11
- </label>
12
- </div>
13
- <div class="table-cell">
14
- <input type="text" id="view-name" class="view-name" name="view[name]" value="<?php echo esc_attr( htmlspecialchars( stripslashes( $view_name ) ) ); ?>" tabindex="1">
 
15
  </div>
16
  </div>
5
  * @since 2.11.14
6
  */
7
  ?>
8
+ <div class="table-cell">
9
+ <label for="view-name">
10
+ <?php _e( 'Name', 'strong-testimonials' ); ?>
11
+ </label>
12
+ </div>
13
+ <div class="table-cell">
14
+ <input type="text" id="view-name" class="view-name" name="view[name]"
15
+ value="<?php echo htmlspecialchars( stripslashes( $view_name ) ); ?>" tabindex="1">
16
  </div>
17
  </div>
admin/partials/views/view-shortcode.php CHANGED
@@ -1,4 +1,14 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
 
3
  $then_classes = array(
4
  'then',
@@ -12,21 +22,11 @@ $then_classes = array(
12
 
13
  <div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
14
  <div class="table-cell">
15
- <label for="view-shortcode">
16
- <?php esc_html_e( 'Shortcode', 'strong-testimonials' ); ?>
17
- </label>
18
  </div>
19
  <div class="table-cell">
20
- <?php if ( 'edit' == $action ) : ?>
21
- <div class="saved">
22
- <input id="view-shortcode" type="text" value="[testimonial_view id=&quot;<?php echo esc_attr( $view_id ); ?>&quot;]" readonly />
23
- <input id="copy-shortcode" class="button small" type="button" value="<?php echo esc_attr__( 'copy to clipboard', 'strong-testimonials' ); ?>" data-copytarget="#view-shortcode" />
24
- <span id="copy-message">copied</span>
25
- </div>
26
- <?php else : ?>
27
- <div class="unsaved">
28
- <?php echo esc_html_x( 'will be available after you save this view', 'The shortcode for a new View.', 'strong-testimonials' ); ?>
29
- </div>
30
- <?php endif; ?>
31
  </div>
32
  </div>
1
  <?php
2
+ // avoiding the tab character before the shortcode for better copy-n-paste
3
+ if ( 'edit' == $action ) {
4
+ $shortcode = '<div class="saved">';
5
+ $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $view_id ) . '&quot;]" readonly />';
6
+ $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
7
+ $shortcode .= '<span id="copy-message">copied</span>';
8
+ $shortcode .= '</div>';
9
+ } else {
10
+ $shortcode = '<div class="unsaved">' . _x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
11
+ }
12
 
13
  $then_classes = array(
14
  'then',
22
 
23
  <div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
24
  <div class="table-cell">
25
+ <label for="view-shortcode">
26
+ <?php _e( 'Shortcode', 'strong-testimonials' ); ?>
27
+ </label>
28
  </div>
29
  <div class="table-cell">
30
+ <?php echo $shortcode; ?>
 
 
 
 
 
 
 
 
 
 
31
  </div>
32
  </div>
admin/settings/class-strong-testimonials-settings-compat.php CHANGED
@@ -40,11 +40,10 @@ class Strong_Testimonials_Settings_Compat {
40
  * @param $url
41
  */
42
  public function register_tab( $active_tab, $url ) {
43
- printf(
44
- '<a href="%s" class="nav-tab %s">%s</a>',
45
- esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
46
- esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
47
- esc_html__( 'Compatibility', 'strong-testimonials' )
48
  );
49
  }
50
 
@@ -98,15 +97,15 @@ class Strong_Testimonials_Settings_Compat {
98
  $input['controller']['initialize_on'] = sanitize_text_field( $input['controller']['initialize_on'] );
99
 
100
  // FIXME: Special handling until proper use of default values in v3.0
101
- $default = array(
102
- 'enabled' => false,
103
- 'classes' => array(
104
- array(
105
- 'start' => '',
106
- 'finish' => '',
107
- ),
108
- ),
109
- );
110
 
111
  if ( ! isset( $input['lazyload'] ) ) {
112
 
@@ -121,24 +120,27 @@ class Strong_Testimonials_Settings_Compat {
121
  // May be multiple pairs.
122
  foreach ( $input['lazyload']['classes'] as $key => $classes ) {
123
 
124
- // Sanitize classes or remove empty pairs.
125
  // Reduce multiple empty pairs down to default value of single empty pair.
126
  if ( $classes['start'] || $classes['finish'] ) {
127
  $input['lazyload']['classes'][ $key ]['start'] = str_replace( '.', '', sanitize_text_field( $classes['start'] ) );
128
  $input['lazyload']['classes'][ $key ]['finish'] = str_replace( '.', '', sanitize_text_field( $classes['finish'] ) );
129
  } else {
130
- unset( $input['lazyload']['classes'][ $key ] );
131
  }
132
 
133
  if ( ! count( $input['lazyload']['classes'] ) ) {
134
  $input['lazyload'] = $default;
135
  }
 
136
  }
 
137
  } else {
138
 
139
  $input['lazyload'] = $default['classes'];
140
 
141
  }
 
142
  }
143
 
144
  return $input;
@@ -172,7 +174,7 @@ class Strong_Testimonials_Settings_Compat {
172
  */
173
  public function settings_intro() {
174
  ?>
175
- <h2><?php esc_html_e( 'Common Scenarios', 'strong-testimonials' ); ?></h2>
176
  <table class="form-table" cellpadding="0" cellspacing="0">
177
  <tr valign="top">
178
  <td>
@@ -180,31 +182,31 @@ class Strong_Testimonials_Settings_Compat {
180
 
181
  <div class="row header">
182
  <div>
183
- <?php esc_html_e( 'Symptom', 'strong-testimonials' ); ?>
184
  </div>
185
  <div>
186
- <?php esc_html_e( 'Possible Cause', 'strong-testimonials' ); ?>
187
  </div>
188
  <div>
189
- <?php esc_html_e( 'Try', 'strong-testimonials' ); ?>
190
  </div>
191
  </div>
192
 
193
  <div class="row">
194
  <div>
195
- <p><strong><?php esc_html_e( 'Views not working', 'strong-testimonials' ); ?></strong></p>
196
- <p><?php echo wp_kses_post( _e( 'A testimonial view does not appear correctly the <strong>first time</strong> you view the page but it does when you <strong>refresh</strong> the page.', 'strong-testimonials' ) ); ?></p>
197
- <p><?php esc_html_e( 'For example, it has no style, no pagination, or the slider has not started.', 'strong-testimonials' ); ?></p>
198
  </div>
199
  <div>
200
- <p><?php echo wp_kses_post( _e( 'Your site uses <strong>Ajax page loading</strong> &ndash; also known as page animations, transition effects or Pjax (pushState Ajax) &ndash; provided by your theme or another plugin.', 'strong-testimonials' ) ); ?></p>
201
- <p><?php esc_html_e( 'Instead of loading the entire page, this technique fetches only the new content.', 'strong-testimonials' ); ?></p>
202
  </div>
203
  <div>
204
- <p><strong><?php esc_html_e( 'Ajax Page Loading', 'strong-testimonials' ); ?>:</strong> <?php esc_html_e( 'General', 'strong-testimonials' ); ?></p>
205
  <p>
206
  <a href="#" id="set-scenario-1">
207
- <?php /* translators: link text on Settings > Compatibility tab */ esc_html_e( 'Set this now', 'strong-testimonials' ); ?>
208
  </a>
209
  </p>
210
  </div>
@@ -212,27 +214,27 @@ class Strong_Testimonials_Settings_Compat {
212
 
213
  <div class="row">
214
  <div>
215
- <p><strong><?php esc_html_e( 'Slider never starts', 'strong-testimonials' ); ?></strong></p>
216
- <p><?php esc_html_e( 'A testimonial slider does not start or is missing navigation controls.', 'strong-testimonials' ); ?></p>
217
  </div>
218
  <div>
219
- <p><?php esc_html_e( 'The page is very busy loading image galleries, other sliders or third-party resources like social media posts.', 'strong-testimonials' ); ?></p>
220
  </div>
221
  <div>
222
- <p><strong><?php esc_html_e( 'Load Event', 'strong-testimonials' ); ?>:</strong> <?php esc_html_e( 'window load', 'strong-testimonials' ); ?></p>
223
  </div>
224
  </div>
225
 
226
  <div class="row">
227
  <div>
228
- <p><strong><?php esc_html_e( 'Masonry layout not working', 'strong-testimonials' ); ?></strong></p>
229
- <p><?php esc_html_e( 'A testimonial view with the Masonry layout has only one column or works inconsistently in different browsers or devices.', 'strong-testimonials' ); ?></p>
230
  </div>
231
  <div>
232
- <p><?php esc_html_e( 'The page is very busy loading image galleries, other sliders or third-party resources like social media posts.', 'strong-testimonials' ); ?></p>
233
  </div>
234
  <div>
235
- <p><strong><?php esc_html_e( 'Load Event', 'strong-testimonials' ); ?>:</strong> <?php esc_html_e( 'window load', 'strong-testimonials' ); ?></p>
236
  </div>
237
  </div>
238
 
@@ -241,7 +243,7 @@ class Strong_Testimonials_Settings_Compat {
241
  </tr>
242
  </table>
243
 
244
- <h2><?php esc_html_e( 'Compatibility Settings', 'strong-testimonials' ); ?></h2>
245
 
246
  <?php
247
  }
@@ -254,13 +256,13 @@ class Strong_Testimonials_Settings_Compat {
254
  <table class="form-table" cellpadding="0" cellspacing="0">
255
  <tr valign="top">
256
  <th scope="row">
257
- <?php esc_html_e( 'Ajax Page Loading', 'strong-testimonials' ); ?>
258
  </th>
259
  <td>
260
  <div class="row header">
261
  <p>
262
- <?php esc_html_e( 'This does not perform Ajax page loading.', 'strong-testimonials' ); ?>
263
- <?php esc_html_e( 'It provides compatibility with themes and plugins that use Ajax to load pages, also known as page animation or transition effects.', 'strong-testimonials' ); ?>
264
  </p>
265
  </div>
266
  <fieldset data-radio-group="prerender">
@@ -283,15 +285,19 @@ class Strong_Testimonials_Settings_Compat {
283
  ?>
284
  <div class="row">
285
  <div>
286
- <label <?php echo esc_attr( $class ); ?> for="page-loading-none">
287
- <input id="page-loading-none" name="wpmtst_compat_options[page_loading]" type="radio" value="" <?php echo esc_attr( $checked ); ?> />
288
- <?php esc_html_e( 'None', 'strong-testimonials' ); ?>
289
- <em><?php esc_html_e( '(default)', 'strong-testimonials' ); ?></em>
 
 
 
 
290
  </label>
291
  </div>
292
  <div>
293
- <p class="about"><?php esc_html_e( 'No compatibility needed.', 'strong-testimonials' ); ?></p>
294
- <p class="about"><?php esc_html_e( 'This works well for most themes.', 'strong-testimonials' ); ?></p>
295
  </div>
296
  </div>
297
  <?php
@@ -306,14 +312,18 @@ class Strong_Testimonials_Settings_Compat {
306
  ?>
307
  <div class="row">
308
  <div>
309
- <label <?php echo esc_attr( $class ); ?> for="page-loading-general">
310
- <input id="page-loading-general" name="wpmtst_compat_options[page_loading]" type="radio" value="general" <?php echo esc_attr( $checked ); ?> />
311
- <?php esc_html_e( 'General', 'strong-testimonials' ); ?>
 
 
 
 
312
  </label>
313
  </div>
314
  <div>
315
- <p class="about"><?php esc_html_e( 'Be ready to render any view at any time.', 'strong-testimonials' ); ?></p>
316
- <p class="about"><?php esc_html_e( 'This works well with common Ajax methods.', 'strong-testimonials' ); ?></p>
317
  </div>
318
  </div>
319
  <?php
@@ -328,13 +338,18 @@ class Strong_Testimonials_Settings_Compat {
328
  ?>
329
  <div class="row">
330
  <div>
331
- <label <?php echo esc_attr( $class ); ?> for="page-loading-advanced">
332
- <input id="page-loading-advanced" name="wpmtst_compat_options[page_loading]" data-group="advanced" type="radio" value="advanced" <?php echo esc_attr( $checked ); ?> />
333
- <?php esc_html_e( 'Advanced', 'strong-testimonials' ); ?>
 
 
 
 
 
334
  </label>
335
  </div>
336
  <div>
337
- <p class="about"><?php esc_html_e( 'For specific configurations.', 'strong-testimonials' ); ?></p>
338
  </div>
339
  </div>
340
  <?php
@@ -348,12 +363,12 @@ class Strong_Testimonials_Settings_Compat {
348
  <table class="form-table" cellpadding="0" cellspacing="0" data-sub="advanced">
349
  <tr valign="top">
350
  <th scope="row">
351
- <?php esc_html_e( 'Prerender', 'strong-testimonials' ); ?>
352
  </th>
353
  <td>
354
  <div class="row header">
355
- <p><?php esc_html_e( 'Load stylesheets and populate script variables up front.', 'strong-testimonials' ); ?>
356
- <a class="open-help-tab" href="#tab-panel-wpmtst-help-prerender"><?php esc_html_e( 'Help' ); ?></a>
357
  </p>
358
  </div>
359
  <fieldset data-radio-group="prerender">
@@ -376,15 +391,19 @@ class Strong_Testimonials_Settings_Compat {
376
  ?>
377
  <div class="row">
378
  <div>
379
- <label <?php echo esc_attr( $class ); ?> for="prerender-current">
380
- <input id="prerender-current" name="wpmtst_compat_options[prerender]" type="radio" value="current" <?php echo esc_attr( $checked ); ?> />
381
- <?php esc_html_e( 'Current page', 'strong-testimonials' ); ?>
382
- <em><?php esc_html_e( '(default)', 'strong-testimonials' ); ?></em>
 
 
 
 
383
  </label>
384
  </div>
385
  <div>
386
- <p class="about"><?php esc_html_e( 'For the current page only.', 'strong-testimonials' ); ?></p>
387
- <p class="about"><?php esc_html_e( 'This works well for most themes.', 'strong-testimonials' ); ?></p>
388
  </div>
389
  </div>
390
  <?php
@@ -399,14 +418,18 @@ class Strong_Testimonials_Settings_Compat {
399
  ?>
400
  <div class="row">
401
  <div>
402
- <label <?php echo esc_attr( $class ); ?> for="prerender-all">
403
- <input id="prerender-all" type="radio" name="wpmtst_compat_options[prerender]" value="all" <?php echo esc_attr( $checked ); ?> />
404
- <?php esc_html_e( 'All views', 'strong-testimonials' ); ?>
 
 
 
 
405
  </label>
406
  </div>
407
  <div>
408
- <p class="about"><?php esc_html_e( 'For all views. Required for Ajax page loading.', 'strong-testimonials' ); ?></p>
409
- <p class="about"><?php echo wp_kses_post( _e( 'Then select an option for <strong>Monitor</strong> below.', 'strong-testimonials' ) ); ?></p>
410
  </div>
411
  </div>
412
  <?php
@@ -421,13 +444,17 @@ class Strong_Testimonials_Settings_Compat {
421
  ?>
422
  <div class="row">
423
  <div>
424
- <label <?php echo esc_attr( $class ); ?> for="prerender-none">
425
- <input id="prerender-none" type="radio" name="wpmtst_compat_options[prerender]" value="none" <?php echo esc_attr( $checked ); ?> />
426
- <?php esc_html_e( 'None', 'strong-testimonials' ); ?>
 
 
 
 
427
  </label>
428
  </div>
429
  <div>
430
- <p class="about"><?php esc_html_e( 'When the shortcode is rendered. May result in a flash of unstyled content.', 'strong-testimonials' ); ?></p>
431
  </div>
432
  </div>
433
  <?php
@@ -441,11 +468,11 @@ class Strong_Testimonials_Settings_Compat {
441
  <table class="form-table" cellpadding="0" cellspacing="0" data-sub="advanced">
442
  <tr valign="top">
443
  <th scope="row">
444
- <?php esc_html_e( 'Monitor', 'strong-testimonials' ); ?>
445
  </th>
446
  <td>
447
  <div class="row header">
448
- <p><?php esc_html_e( 'Initialize sliders, pagination and form validation as pages change.', 'strong-testimonials' ); ?></p>
449
  </div>
450
  <fieldset data-radio-group="method">
451
  <?php $this->settings_monitor_none(); ?>
@@ -469,14 +496,18 @@ class Strong_Testimonials_Settings_Compat {
469
  ?>
470
  <div class="row">
471
  <div>
472
- <label <?php echo esc_attr( $class ); ?> for="method-none">
473
- <input id="method-none" type="radio" name="wpmtst_compat_options[ajax][method]" value="" <?php echo esc_attr( $checked ); ?> />
474
- <?php esc_html_e( 'None', 'strong-testimonials' ); ?>
475
- <em><?php esc_html_e( '(default)', 'strong-testimonials' ); ?></em>
 
 
 
 
476
  </label>
477
  </div>
478
  <div>
479
- <p class="about"><?php esc_html_e( 'No compatibility needed.', 'strong-testimonials' ); ?></p>
480
  </div>
481
  </div>
482
  <?php
@@ -491,25 +522,35 @@ class Strong_Testimonials_Settings_Compat {
491
  ?>
492
  <div class="row">
493
  <div>
494
- <label <?php echo esc_attr( $class ); ?> for="method-universal">
495
- <input id="method-universal" name="wpmtst_compat_options[ajax][method]" type="radio" value="universal" data-group="universal" <?php echo esc_attr( $checked ); ?> />
496
- <?php esc_html_e( 'Universal', 'strong-testimonials' ); ?>
 
 
 
 
 
497
  </label>
498
  </div>
499
  <div>
500
- <p class="about"><?php esc_html_e( 'Watch for page changes on a timer.', 'strong-testimonials' ); ?></p>
501
  </div>
502
  </div>
503
 
504
  <div class="row" data-sub="universal">
505
  <div class="radio-sub">
506
  <label for="universal-timer">
507
- <?php echo esc_html_x( 'Check every', 'timer setting', 'strong-testimonials' ); ?>
508
  </label>
509
  </div>
510
  <div>
511
- <input id="universal-timer" name="wpmtst_compat_options[ajax][universal_timer]" type="number" min=".1" max="5" step=".1" value="<?php echo esc_attr( $this->options['ajax']['universal_timer'] ); ?>" size="3" />
512
- <?php echo esc_html_x( 'seconds', 'timer setting', 'strong-testimonials' ); ?>
 
 
 
 
 
513
  </div>
514
  </div>
515
  <?php
@@ -524,14 +565,19 @@ class Strong_Testimonials_Settings_Compat {
524
  ?>
525
  <div class="row">
526
  <div>
527
- <label <?php echo esc_attr( $class ); ?> for="method-observer">
528
- <input id="method-observer" name="wpmtst_compat_options[ajax][method]" data-group="observer" type="radio" value="observer" <?php echo esc_attr( $checked ); ?> />
529
- <?php esc_html_e( 'Observer', 'strong-testimonials' ); ?>
 
 
 
 
 
530
  </label>
531
  </div>
532
  <div>
533
- <p class="about"><?php esc_html_e( 'React to changes in specific page elements.', 'strong-testimonials' ); ?></p>
534
- <p class="description"><?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?></p>
535
  </div>
536
  </div>
537
 
@@ -543,12 +589,17 @@ class Strong_Testimonials_Settings_Compat {
543
  <div class="row" data-sub="observer">
544
  <div class="radio-sub">
545
  <label for="observer-timer">
546
- <?php echo esc_html_x( 'Check once after', 'timer setting', 'strong-testimonials' ); ?>
547
  </label>
548
  </div>
549
  <div>
550
- <input id="observer-timer" name="wpmtst_compat_options[ajax][observer_timer]" type="number" min=".1" max="5" step=".1" value="<?php echo esc_attr( $this->options['ajax']['observer_timer'] ); ?>" size="3" />
551
- <?php echo esc_html_x( 'seconds', 'timer setting', 'strong-testimonials' ); ?>
 
 
 
 
 
552
  </div>
553
  </div>
554
 
@@ -560,13 +611,17 @@ class Strong_Testimonials_Settings_Compat {
560
  <div class="row" data-sub="observer">
561
  <div class="radio-sub">
562
  <label for="container-id">
563
- <?php esc_html_e( 'Container ID', 'strong-testimonials' ); ?>
564
  </label>
565
  </div>
566
  <div>
567
  <span class="code input-before">#</span>
568
- <input class="code element" id="container-id" name="wpmtst_compat_options[ajax][container_id]" type="text" value="<?php echo esc_attr( $this->options['ajax']['container_id'] ); ?>" />
569
- <p class="about adjacent"><?php esc_html_e( 'the element to observe', 'strong-testimonials' ); ?></p>
 
 
 
 
570
  </div>
571
  </div>
572
 
@@ -578,13 +633,17 @@ class Strong_Testimonials_Settings_Compat {
578
  <div class="row" data-sub="observer">
579
  <div class="radio-sub">
580
  <label for="addednode-id">
581
- <?php esc_html_e( 'Added node ID', 'strong-testimonials' ); ?>
582
  </label>
583
  </div>
584
  <div>
585
  <span class="code input-before">#</span>
586
- <input class="code element" id="addednode-id" name="wpmtst_compat_options[ajax][addednode_id]" type="text" value="<?php echo esc_attr( $this->options['ajax']['addednode_id'] ); ?>" />
587
- <p class="about adjacent"><?php esc_html_e( 'the element being added', 'strong-testimonials' ); ?></p>
 
 
 
 
588
  </div>
589
  </div>
590
  <?php
@@ -595,29 +654,38 @@ class Strong_Testimonials_Settings_Compat {
595
  */
596
  public function settings_monitor_event() {
597
  $checked = checked( $this->options['ajax']['method'], 'event', false );
598
- $class = $checked ? ' class="current"' : '';
599
- ?>
600
  <div class="row">
601
  <div>
602
- <label <?php echo esc_attr( $class ); ?> for="method-event">
603
- <input id="method-event" name="wpmtst_compat_options[ajax][method]" data-group="event" type="radio" value="event" <?php echo esc_attr( $checked ); ?> />
604
- <?php esc_html_e( 'Custom event', 'strong-testimonials' ); ?>
 
 
 
 
 
605
  </label>
606
  </div>
607
  <div>
608
- <p class="about"><?php esc_html_e( 'Listen for specific events.', 'strong-testimonials' ); ?></p>
609
- <p class="description"><?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?></p>
610
  </div>
611
  </div>
612
 
613
  <div class="row" data-sub="event">
614
  <div class="radio-sub">
615
  <label for="event-name">
616
- <?php esc_html_e( 'Event name', 'strong-testimonials' ); ?>
617
  </label>
618
  </div>
619
  <div>
620
- <input class="code" id="event-name" name="wpmtst_compat_options[ajax][event]" type="text" value="<?php echo esc_attr( $this->options['ajax']['event'] ); ?>" size="30" />
 
 
 
 
 
621
  </div>
622
  </div>
623
  <?php
@@ -632,27 +700,32 @@ class Strong_Testimonials_Settings_Compat {
632
  ?>
633
  <div class="row">
634
  <div>
635
- <label <?php echo esc_attr( $class ); ?> for="method-script">
636
- <input id="method-script" name="wpmtst_compat_options[ajax][method]" data-group="script" type="radio" value="script" <?php echo esc_attr( $checked ); ?> />
637
- <?php esc_html_e( 'Specific script', 'strong-testimonials' ); ?>
 
 
 
 
 
638
  </label>
639
  </div>
640
  <div>
641
- <p class="about"><?php esc_html_e( 'Register a callback for a specific Ajax script.', 'strong-testimonials' ); ?></p>
642
- <p class="description"><?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?></p>
643
  </div>
644
  </div>
645
 
646
  <div class="row" data-sub="script">
647
  <div class="radio-sub">
648
  <label for="script-name">
649
- <?php esc_html_e( 'Script name', 'strong-testimonials' ); ?>
650
  </label>
651
  </div>
652
  <div>
653
  <select id="script-name" name="wpmtst_compat_options[ajax][script]">
654
  <option value="" <?php selected( $this->options['ajax']['script'], '' ); ?>>
655
- <?php esc_html_e( '&mdash; Select &mdash;' ); ?>
656
  </option>
657
  <option value="barba" <?php selected( $this->options['ajax']['script'], 'barba' ); ?>>
658
  Barba.js
@@ -673,11 +746,11 @@ class Strong_Testimonials_Settings_Compat {
673
  <table class="form-table" cellpadding="0" cellspacing="0">
674
  <tr valign="top">
675
  <th scope="row">
676
- <?php esc_html_e( 'Load Event', 'strong-testimonials' ); ?>
677
  </th>
678
  <td>
679
  <div class="row header">
680
- <p><?php esc_html_e( 'When to start sliders, Masonry, pagination and form validation.', 'strong-testimonials' ); ?></p>
681
  </div>
682
  <fieldset>
683
  <?php $this->settings_page_controller_documentready(); ?>
@@ -698,14 +771,18 @@ class Strong_Testimonials_Settings_Compat {
698
  ?>
699
  <div class="row">
700
  <div>
701
- <label <?php echo esc_attr( $class ); ?> for="controller-documentready">
702
- <input id="controller-documentready" name="wpmtst_compat_options[controller][initialize_on]" type="radio" value="documentReady" <?php echo esc_attr( $checked ); ?> />
703
- <?php esc_html_e( 'document ready', 'strong-testimonials' ); ?>
704
- <em><?php esc_html_e( '(default)', 'strong-testimonials' ); ?></em>
 
 
 
 
705
  </label>
706
  </div>
707
  <div>
708
- <p class="about"><?php esc_html_e( 'This works well if your page load time is less than a few seconds.', 'strong-testimonials' ); ?></p>
709
  </div>
710
  </div>
711
  <?php
@@ -720,13 +797,17 @@ class Strong_Testimonials_Settings_Compat {
720
  ?>
721
  <div class="row">
722
  <div>
723
- <label <?php echo esc_attr( $class ); ?> for="controller-windowload">
724
- <input id="controller-windowload" name="wpmtst_compat_options[controller][initialize_on]" type="radio" value="windowLoad" <?php echo esc_attr( $checked ); ?> />
725
- <?php esc_html_e( 'window load', 'strong-testimonials' ); ?>
 
 
 
 
726
  </label>
727
  </div>
728
  <div>
729
- <p class="about"><?php esc_html_e( 'Try this if your page load time is more than a few seconds.', 'strong-testimonials' ); ?></p>
730
  </div>
731
  </div>
732
  <?php
@@ -742,11 +823,11 @@ class Strong_Testimonials_Settings_Compat {
742
  <table class="form-table" cellpadding="0" cellspacing="0">
743
  <tr valign="top">
744
  <th scope="row">
745
- <?php esc_html_e( 'Lazy Loading Images', 'strong-testimonials' ); ?>
746
  </th>
747
  <td>
748
  <div class="row header">
749
- <p><?php esc_html_e( 'Watch for lazy loading images in themes and plugins.', 'strong-testimonials' ); ?></p>
750
  </div>
751
  <fieldset>
752
  <?php $this->settings_page_lazyload_enabled(); ?>
@@ -773,13 +854,13 @@ class Strong_Testimonials_Settings_Compat {
773
  name="wpmtst_compat_options[lazyload][enabled]"
774
  data-group="lazyload"
775
  type="checkbox"
776
- <?php echo esc_attr( $checked ); ?> />
777
- <?php esc_html_e( 'Enable watcher', 'strong-testimonials' ); ?>
778
  </label>
779
  </div>
780
  <div data-sub="lazyload">
781
- <p class="about"><?php esc_html_e( 'Most lazy loading techniques use one or two CSS class names to indicate which images to lazy load and when the lazy loading is finished.', 'strong-testimonials' ); ?></p>
782
- <p class="about"><?php esc_html_e( 'Contact support for your theme or plugin to ask if it uses CSS class names.', 'strong-testimonials' ); ?></p>
783
  </div>
784
  </div>
785
  <?php
@@ -795,7 +876,7 @@ class Strong_Testimonials_Settings_Compat {
795
  <div class="row" data-sub="lazyload">
796
  <div>
797
  <label>
798
- <?php esc_html_e( 'CSS Class Names', 'strong-testimonials' ); ?>
799
  </label>
800
  </div>
801
  <div class="lazyload-pairs">
@@ -807,7 +888,10 @@ class Strong_Testimonials_Settings_Compat {
807
  }
808
  ?>
809
  <div class="pair-actions">
810
- <input class="button" id="add-pair" value="<?php esc_attr_e( 'Add Classes', 'strong-testimonials' ); ?>" type="button" />
 
 
 
811
  </div>
812
  </div>
813
  </div>
@@ -823,13 +907,19 @@ class Strong_Testimonials_Settings_Compat {
823
  ?>
824
  <div class="pair">
825
  <label>
826
- <?php echo esc_html_x( 'start', 'noun', 'strong-testimonials' ); ?>
827
- <input class="element code" name="wpmtst_compat_options[lazyload][classes][<?php echo esc_attr( $key ); ?>][start]" type="text" value="<?php echo esc_attr( $pair['start'] ); ?>" />
 
 
 
828
  </label>
829
  <span class="pair-sep"></span>
830
  <label>
831
- <?php echo esc_html_x( 'finish', 'noun', 'strong-testimonials' ); ?>
832
- <input class="element code" name="wpmtst_compat_options[lazyload][classes][<?php echo esc_attr( $key ); ?>][finish]" type="text" value="<?php echo esc_attr( $pair['finish'] ); ?>" />
 
 
 
833
  </label>
834
  </div>
835
  <?php
@@ -840,13 +930,7 @@ class Strong_Testimonials_Settings_Compat {
840
  */
841
  public function add_lazyload_pair() {
842
  ob_start();
843
- $this->settings_page_lazyload_class_inputs(
844
- $_REQUEST['key'],
845
- array(
846
- 'start' => '',
847
- 'finish' => '',
848
- )
849
- );
850
  wp_send_json_success( ob_get_clean() );
851
  }
852
 
40
  * @param $url
41
  */
42
  public function register_tab( $active_tab, $url ) {
43
+ printf( '<a href="%s" class="nav-tab %s">%s</a>',
44
+ esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
45
+ esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
46
+ __( 'Compatibility', 'strong-testimonials' )
 
47
  );
48
  }
49
 
97
  $input['controller']['initialize_on'] = sanitize_text_field( $input['controller']['initialize_on'] );
98
 
99
  // FIXME: Special handling until proper use of default values in v3.0
100
+ $default = array(
101
+ 'enabled' => false,
102
+ 'classes' => array(
103
+ array(
104
+ 'start' => '',
105
+ 'finish' => '',
106
+ ),
107
+ ),
108
+ );
109
 
110
  if ( ! isset( $input['lazyload'] ) ) {
111
 
120
  // May be multiple pairs.
121
  foreach ( $input['lazyload']['classes'] as $key => $classes ) {
122
 
123
+ // Sanitize classes or remove empty pairs.
124
  // Reduce multiple empty pairs down to default value of single empty pair.
125
  if ( $classes['start'] || $classes['finish'] ) {
126
  $input['lazyload']['classes'][ $key ]['start'] = str_replace( '.', '', sanitize_text_field( $classes['start'] ) );
127
  $input['lazyload']['classes'][ $key ]['finish'] = str_replace( '.', '', sanitize_text_field( $classes['finish'] ) );
128
  } else {
129
+ unset( $input['lazyload']['classes'][$key] );
130
  }
131
 
132
  if ( ! count( $input['lazyload']['classes'] ) ) {
133
  $input['lazyload'] = $default;
134
  }
135
+
136
  }
137
+
138
  } else {
139
 
140
  $input['lazyload'] = $default['classes'];
141
 
142
  }
143
+
144
  }
145
 
146
  return $input;
174
  */
175
  public function settings_intro() {
176
  ?>
177
+ <h2><?php _e( 'Common Scenarios', 'strong-testimonials' ); ?></h2>
178
  <table class="form-table" cellpadding="0" cellspacing="0">
179
  <tr valign="top">
180
  <td>
182
 
183
  <div class="row header">
184
  <div>
185
+ <?php _e( 'Symptom', 'strong-testimonials' ); ?>
186
  </div>
187
  <div>
188
+ <?php _e( 'Possible Cause', 'strong-testimonials' ); ?>
189
  </div>
190
  <div>
191
+ <?php _e( 'Try', 'strong-testimonials' ); ?>
192
  </div>
193
  </div>
194
 
195
  <div class="row">
196
  <div>
197
+ <p><strong><?php _e( 'Views not working', 'strong-testimonials' ); ?></strong></p>
198
+ <p><?php _e( 'A testimonial view does not appear correctly the <strong>first time</strong> you view the page but it does when you <strong>refresh</strong> the page.', 'strong-testimonials' ); ?></p>
199
+ <p><?php _e( 'For example, it has no style, no pagination, or the slider has not started.', 'strong-testimonials' ); ?></p>
200
  </div>
201
  <div>
202
+ <p><?php _e( 'Your site uses <strong>Ajax page loading</strong> &ndash; also known as page animations, transition effects or Pjax (pushState Ajax) &ndash; provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
203
+ <p><?php _e( 'Instead of loading the entire page, this technique fetches only the new content.', 'strong-testimonials' ); ?></p>
204
  </div>
205
  <div>
206
+ <p><strong><?php _e( 'Ajax Page Loading', 'strong-testimonials' ); ?>:</strong> <?php _e( 'General', 'strong-testimonials' ); ?></p>
207
  <p>
208
  <a href="#" id="set-scenario-1">
209
+ <?php /* translators: link text on Settings > Compatibility tab */ _e( 'Set this now', 'strong-testimonials' ); ?>
210
  </a>
211
  </p>
212
  </div>
214
 
215
  <div class="row">
216
  <div>
217
+ <p><strong><?php _e( 'Slider never starts', 'strong-testimonials' ); ?></strong></p>
218
+ <p><?php _e( 'A testimonial slider does not start or is missing navigation controls.', 'strong-testimonials' ); ?></p>
219
  </div>
220
  <div>
221
+ <p><?php _e( 'The page is very busy loading image galleries, other sliders or third-party resources like social media posts.', 'strong-testimonials' ); ?></p>
222
  </div>
223
  <div>
224
+ <p><strong><?php _e( 'Load Event', 'strong-testimonials' ); ?>:</strong> <?php _e( 'window load', 'strong-testimonials' ); ?></p>
225
  </div>
226
  </div>
227
 
228
  <div class="row">
229
  <div>
230
+ <p><strong><?php _e( 'Masonry layout not working', 'strong-testimonials' ); ?></strong></p>
231
+ <p><?php _e( 'A testimonial view with the Masonry layout has only one column or works inconsistently in different browsers or devices.', 'strong-testimonials' ); ?></p>
232
  </div>
233
  <div>
234
+ <p><?php _e( 'The page is very busy loading image galleries, other sliders or third-party resources like social media posts.', 'strong-testimonials' ); ?></p>
235
  </div>
236
  <div>
237
+ <p><strong><?php _e( 'Load Event', 'strong-testimonials' ); ?>:</strong> <?php _e( 'window load', 'strong-testimonials' ); ?></p>
238
  </div>
239
  </div>
240
 
243
  </tr>
244
  </table>
245
 
246
+ <h2><?php _e( 'Compatibility Settings', 'strong-testimonials' ); ?></h2>
247
 
248
  <?php
249
  }
256
  <table class="form-table" cellpadding="0" cellspacing="0">
257
  <tr valign="top">
258
  <th scope="row">
259
+ <?php _e( 'Ajax Page Loading', 'strong-testimonials' ); ?>
260
  </th>
261
  <td>
262
  <div class="row header">
263
  <p>
264
+ <?php _e( 'This does not perform Ajax page loading.', 'strong-testimonials' ); ?>
265
+ <?php _e( 'It provides compatibility with themes and plugins that use Ajax to load pages, also known as page animation or transition effects.', 'strong-testimonials' ); ?>
266
  </p>
267
  </div>
268
  <fieldset data-radio-group="prerender">
285
  ?>
286
  <div class="row">
287
  <div>
288
+ <label<?php echo $class; ?> for="page-loading-none">
289
+ <input id="page-loading-none"
290
+ name="wpmtst_compat_options[page_loading]"
291
+ type="radio"
292
+ value=""
293
+ <?php echo $checked; ?> />
294
+ <?php _e( 'None', 'strong-testimonials' ); ?>
295
+ <em><?php _e( '(default)', 'strong-testimonials' ); ?></em>
296
  </label>
297
  </div>
298
  <div>
299
+ <p class="about"><?php _e( 'No compatibility needed.', 'strong-testimonials' ); ?></p>
300
+ <p class="about"><?php _e( 'This works well for most themes.', 'strong-testimonials' ); ?></p>
301
  </div>
302
  </div>
303
  <?php
312
  ?>
313
  <div class="row">
314
  <div>
315
+ <label<?php echo $class; ?> for="page-loading-general">
316
+ <input id="page-loading-general"
317
+ name="wpmtst_compat_options[page_loading]"
318
+ type="radio"
319
+ value="general"
320
+ <?php echo $checked; ?> />
321
+ <?php _e( 'General', 'strong-testimonials' ); ?>
322
  </label>
323
  </div>
324
  <div>
325
+ <p class="about"><?php _e( 'Be ready to render any view at any time.', 'strong-testimonials' ); ?></p>
326
+ <p class="about"><?php _e( 'This works well with common Ajax methods.', 'strong-testimonials' ); ?></p>
327
  </div>
328
  </div>
329
  <?php
338
  ?>
339
  <div class="row">
340
  <div>
341
+ <label<?php echo $class; ?> for="page-loading-advanced">
342
+ <input id="page-loading-advanced"
343
+ name="wpmtst_compat_options[page_loading]"
344
+ data-group="advanced"
345
+ type="radio"
346
+ value="advanced"
347
+ <?php echo $checked; ?> />
348
+ <?php _e( 'Advanced', 'strong-testimonials' ); ?>
349
  </label>
350
  </div>
351
  <div>
352
+ <p class="about"><?php _e( 'For specific configurations.', 'strong-testimonials' ); ?></p>
353
  </div>
354
  </div>
355
  <?php
363
  <table class="form-table" cellpadding="0" cellspacing="0" data-sub="advanced">
364
  <tr valign="top">
365
  <th scope="row">
366
+ <?php _e( 'Prerender', 'strong-testimonials' ); ?>
367
  </th>
368
  <td>
369
  <div class="row header">
370
+ <p><?php _e( 'Load stylesheets and populate script variables up front.', 'strong-testimonials' ); ?>
371
+ <a class="open-help-tab" href="#tab-panel-wpmtst-help-prerender"><?php _e( 'Help' ); ?></a>
372
  </p>
373
  </div>
374
  <fieldset data-radio-group="prerender">
391
  ?>
392
  <div class="row">
393
  <div>
394
+ <label<?php echo $class; ?> for="prerender-current">
395
+ <input id="prerender-current"
396
+ name="wpmtst_compat_options[prerender]"
397
+ type="radio"
398
+ value="current"
399
+ <?php echo $checked; ?> />
400
+ <?php _e( 'Current page', 'strong-testimonials' ); ?>
401
+ <em><?php _e( '(default)', 'strong-testimonials' ); ?></em>
402
  </label>
403
  </div>
404
  <div>
405
+ <p class="about"><?php _e( 'For the current page only.', 'strong-testimonials' ); ?></p>
406
+ <p class="about"><?php _e( 'This works well for most themes.', 'strong-testimonials' ); ?></p>
407
  </div>
408
  </div>
409
  <?php
418
  ?>
419
  <div class="row">
420
  <div>
421
+ <label<?php echo $class; ?> for="prerender-all">
422
+ <input id="prerender-all"
423
+ type="radio"
424
+ name="wpmtst_compat_options[prerender]"
425
+ value="all"
426
+ <?php echo $checked; ?> />
427
+ <?php _e( 'All views', 'strong-testimonials' ); ?>
428
  </label>
429
  </div>
430
  <div>
431
+ <p class="about"><?php _e( 'For all views. Required for Ajax page loading.', 'strong-testimonials' ); ?></p>
432
+ <p class="about"><?php _e( 'Then select an option for <strong>Monitor</strong> below.', 'strong-testimonials' ); ?></p>
433
  </div>
434
  </div>
435
  <?php
444
  ?>
445
  <div class="row">
446
  <div>
447
+ <label<?php echo $class; ?> for="prerender-none">
448
+ <input id="prerender-none"
449
+ type="radio"
450
+ name="wpmtst_compat_options[prerender]"
451
+ value="none"
452
+ <?php echo $checked; ?> />
453
+ <?php _e( 'None', 'strong-testimonials' ); ?>
454
  </label>
455
  </div>
456
  <div>
457
+ <p class="about"><?php _e( 'When the shortcode is rendered. May result in a flash of unstyled content.', 'strong-testimonials' ); ?></p>
458
  </div>
459
  </div>
460
  <?php
468
  <table class="form-table" cellpadding="0" cellspacing="0" data-sub="advanced">
469
  <tr valign="top">
470
  <th scope="row">
471
+ <?php _e( 'Monitor', 'strong-testimonials' ); ?>
472
  </th>
473
  <td>
474
  <div class="row header">
475
+ <p><?php _e( 'Initialize sliders, pagination and form validation as pages change.', 'strong-testimonials' ); ?></p>
476
  </div>
477
  <fieldset data-radio-group="method">
478
  <?php $this->settings_monitor_none(); ?>
496
  ?>
497
  <div class="row">
498
  <div>
499
+ <label<?php echo $class; ?> for="method-none">
500
+ <input id="method-none"
501
+ type="radio"
502
+ name="wpmtst_compat_options[ajax][method]"
503
+ value=""
504
+ <?php echo $checked; ?> />
505
+ <?php _e( 'None', 'strong-testimonials' ); ?>
506
+ <em><?php _e( '(default)', 'strong-testimonials' ); ?></em>
507
  </label>
508
  </div>
509
  <div>
510
+ <p class="about"><?php _e( 'No compatibility needed.', 'strong-testimonials' ); ?></p>
511
  </div>
512
  </div>
513
  <?php
522
  ?>
523
  <div class="row">
524
  <div>
525
+ <label<?php echo $class; ?> for="method-universal">
526
+ <input id="method-universal"
527
+ name="wpmtst_compat_options[ajax][method]"
528
+ type="radio"
529
+ value="universal"
530
+ data-group="universal"
531
+ <?php echo $checked; ?> />
532
+ <?php _e( 'Universal', 'strong-testimonials' ); ?>
533
  </label>
534
  </div>
535
  <div>
536
+ <p class="about"><?php _e( 'Watch for page changes on a timer.', 'strong-testimonials' ); ?></p>
537
  </div>
538
  </div>
539
 
540
  <div class="row" data-sub="universal">
541
  <div class="radio-sub">
542
  <label for="universal-timer">
543
+ <?php _ex( 'Check every', 'timer setting', 'strong-testimonials' ); ?>
544
  </label>
545
  </div>
546
  <div>
547
+ <input id="universal-timer"
548
+ name="wpmtst_compat_options[ajax][universal_timer]"
549
+ type="number"
550
+ min=".1" max="5" step=".1"
551
+ value="<?php echo $this->options['ajax']['universal_timer']; ?>"
552
+ size="3" />
553
+ <?php _ex( 'seconds', 'timer setting', 'strong-testimonials' ); ?>
554
  </div>
555
  </div>
556
  <?php
565
  ?>
566
  <div class="row">
567
  <div>
568
+ <label<?php echo $class; ?> for="method-observer">
569
+ <input id="method-observer"
570
+ name="wpmtst_compat_options[ajax][method]"
571
+ data-group="observer"
572
+ type="radio"
573
+ value="observer"
574
+ <?php echo $checked; ?> />
575
+ <?php _e( 'Observer', 'strong-testimonials' ); ?>
576
  </label>
577
  </div>
578
  <div>
579
+ <p class="about"><?php _e( 'React to changes in specific page elements.', 'strong-testimonials' ); ?></p>
580
+ <p class="description"><?php _e( 'For advanced users.', 'strong-testimonials' ); ?></p>
581
  </div>
582
  </div>
583
 
589
  <div class="row" data-sub="observer">
590
  <div class="radio-sub">
591
  <label for="observer-timer">
592
+ <?php _ex( 'Check once after', 'timer setting', 'strong-testimonials' ); ?>
593
  </label>
594
  </div>
595
  <div>
596
+ <input id="observer-timer"
597
+ name="wpmtst_compat_options[ajax][observer_timer]"
598
+ type="number"
599
+ min=".1" max="5" step=".1"
600
+ value="<?php echo $this->options['ajax']['observer_timer']; ?>"
601
+ size="3" />
602
+ <?php _ex( 'seconds', 'timer setting', 'strong-testimonials' ); ?>
603
  </div>
604
  </div>
605
 
611
  <div class="row" data-sub="observer">
612
  <div class="radio-sub">
613
  <label for="container-id">
614
+ <?php _e( 'Container ID', 'strong-testimonials' ); ?>
615
  </label>
616
  </div>
617
  <div>
618
  <span class="code input-before">#</span>
619
+ <input class="code element"
620
+ id="container-id"
621
+ name="wpmtst_compat_options[ajax][container_id]"
622
+ type="text"
623
+ value="<?php echo $this->options['ajax']['container_id']; ?>" />
624
+ <p class="about adjacent"><?php _e( 'the element to observe', 'strong-testimonials' ); ?></p>
625
  </div>
626
  </div>
627
 
633
  <div class="row" data-sub="observer">
634
  <div class="radio-sub">
635
  <label for="addednode-id">
636
+ <?php _e( 'Added node ID', 'strong-testimonials' ); ?>
637
  </label>
638
  </div>
639
  <div>
640
  <span class="code input-before">#</span>
641
+ <input class="code element"
642
+ id="addednode-id"
643
+ name="wpmtst_compat_options[ajax][addednode_id]"
644
+ type="text"
645
+ value="<?php echo $this->options['ajax']['addednode_id']; ?>" />
646
+ <p class="about adjacent"><?php _e( 'the element being added', 'strong-testimonials' ); ?></p>
647
  </div>
648
  </div>
649
  <?php
654
  */
655
  public function settings_monitor_event() {
656
  $checked = checked( $this->options['ajax']['method'], 'event', false );
657
+ $class = $checked ? ' class="current"' : ''; ?>
 
658
  <div class="row">
659
  <div>
660
+ <label<?php echo $class; ?> for="method-event">
661
+ <input id="method-event"
662
+ name="wpmtst_compat_options[ajax][method]"
663
+ data-group="event"
664
+ type="radio"
665
+ value="event"
666
+ <?php echo $checked; ?> />
667
+ <?php _e( 'Custom event', 'strong-testimonials' ); ?>
668
  </label>
669
  </div>
670
  <div>
671
+ <p class="about"><?php _e( 'Listen for specific events.', 'strong-testimonials' ); ?></p>
672
+ <p class="description"><?php _e( 'For advanced users.', 'strong-testimonials' ); ?></p>
673
  </div>
674
  </div>
675
 
676
  <div class="row" data-sub="event">
677
  <div class="radio-sub">
678
  <label for="event-name">
679
+ <?php _e( 'Event name', 'strong-testimonials' ); ?>
680
  </label>
681
  </div>
682
  <div>
683
+ <input class="code"
684
+ id="event-name"
685
+ name="wpmtst_compat_options[ajax][event]"
686
+ type="text"
687
+ value="<?php echo $this->options['ajax']['event']; ?>"
688
+ size="30" />
689
  </div>
690
  </div>
691
  <?php
700
  ?>
701
  <div class="row">
702
  <div>
703
+ <label<?php echo $class; ?> for="method-script">
704
+ <input id="method-script"
705
+ name="wpmtst_compat_options[ajax][method]"
706
+ data-group="script"
707
+ type="radio"
708
+ value="script"
709
+ <?php echo $checked; ?> />
710
+ <?php _e( 'Specific script', 'strong-testimonials' ); ?>
711
  </label>
712
  </div>
713
  <div>
714
+ <p class="about"><?php _e( 'Register a callback for a specific Ajax script.', 'strong-testimonials' ); ?></p>
715
+ <p class="description"><?php _e( 'For advanced users.', 'strong-testimonials' ); ?></p>
716
  </div>
717
  </div>
718
 
719
  <div class="row" data-sub="script">
720
  <div class="radio-sub">
721
  <label for="script-name">
722
+ <?php _e( 'Script name', 'strong-testimonials' ); ?>
723
  </label>
724
  </div>
725
  <div>
726
  <select id="script-name" name="wpmtst_compat_options[ajax][script]">
727
  <option value="" <?php selected( $this->options['ajax']['script'], '' ); ?>>
728
+ <?php _e( '&mdash; Select &mdash;' ); ?>
729
  </option>
730
  <option value="barba" <?php selected( $this->options['ajax']['script'], 'barba' ); ?>>
731
  Barba.js
746
  <table class="form-table" cellpadding="0" cellspacing="0">
747
  <tr valign="top">
748
  <th scope="row">
749
+ <?php _e( 'Load Event', 'strong-testimonials' ); ?>
750
  </th>
751
  <td>
752
  <div class="row header">
753
+ <p><?php _e( 'When to start sliders, Masonry, pagination and form validation.', 'strong-testimonials' ); ?></p>
754
  </div>
755
  <fieldset>
756
  <?php $this->settings_page_controller_documentready(); ?>
771
  ?>
772
  <div class="row">
773
  <div>
774
+ <label<?php echo $class; ?> for="controller-documentready">
775
+ <input id="controller-documentready"
776
+ name="wpmtst_compat_options[controller][initialize_on]"
777
+ type="radio"
778
+ value="documentReady"
779
+ <?php echo $checked; ?> />
780
+ <?php _e( 'document ready', 'strong-testimonials' ); ?>
781
+ <em><?php _e( '(default)', 'strong-testimonials' ); ?></em>
782
  </label>
783
  </div>
784
  <div>
785
+ <p class="about"><?php _e( 'This works well if your page load time is less than a few seconds.', 'strong-testimonials' ); ?></p>
786
  </div>
787
  </div>
788
  <?php
797
  ?>
798
  <div class="row">
799
  <div>
800
+ <label<?php echo $class; ?> for="controller-windowload">
801
+ <input id="controller-windowload"
802
+ name="wpmtst_compat_options[controller][initialize_on]"
803
+ type="radio"
804
+ value="windowLoad"
805
+ <?php echo $checked; ?> />
806
+ <?php _e( 'window load', 'strong-testimonials' ); ?>
807
  </label>
808
  </div>
809
  <div>
810
+ <p class="about"><?php _e( 'Try this if your page load time is more than a few seconds.', 'strong-testimonials' ); ?></p>
811
  </div>
812
  </div>
813
  <?php
823
  <table class="form-table" cellpadding="0" cellspacing="0">
824
  <tr valign="top">
825
  <th scope="row">
826
+ <?php _e( 'Lazy Loading Images', 'strong-testimonials' ); ?>
827
  </th>
828
  <td>
829
  <div class="row header">
830
+ <p><?php _e( 'Watch for lazy loading images in themes and plugins.', 'strong-testimonials' ); ?></p>
831
  </div>
832
  <fieldset>
833
  <?php $this->settings_page_lazyload_enabled(); ?>
854
  name="wpmtst_compat_options[lazyload][enabled]"
855
  data-group="lazyload"
856
  type="checkbox"
857
+ <?php echo $checked; ?> />
858
+ <?php _e( 'Enable watcher', 'strong-testimonials' ); ?>
859
  </label>
860
  </div>
861
  <div data-sub="lazyload">
862
+ <p class="about"><?php _e( 'Most lazy loading techniques use one or two CSS class names to indicate which images to lazy load and when the lazy loading is finished.', 'strong-testimonials' ); ?></p>
863
+ <p class="about"><?php _e( 'Contact support for your theme or plugin to ask if it uses CSS class names.', 'strong-testimonials' ); ?></p>
864
  </div>
865
  </div>
866
  <?php
876
  <div class="row" data-sub="lazyload">
877
  <div>
878
  <label>
879
+ <?php _e( 'CSS Class Names', 'strong-testimonials' ); ?>
880
  </label>
881
  </div>
882
  <div class="lazyload-pairs">
888
  }
889
  ?>
890
  <div class="pair-actions">
891
+ <input class="button"
892
+ id="add-pair"
893
+ value="<?php esc_attr_e( 'Add Classes', 'strong-testimonials' ); ?>"
894
+ type="button" />
895
  </div>
896
  </div>
897
  </div>
907
  ?>
908
  <div class="pair">
909
  <label>
910
+ <?php _ex( 'start', 'noun', 'strong-testimonials' ); ?>
911
+ <input class="element code"
912
+ name="wpmtst_compat_options[lazyload][classes][<?php echo $key; ?>][start]"
913
+ type="text"
914
+ value="<?php echo esc_attr( $pair['start'] ); ?>" />
915
  </label>
916
  <span class="pair-sep"></span>
917
  <label>
918
+ <?php _ex( 'finish', 'noun', 'strong-testimonials' ); ?>
919
+ <input class="element code"
920
+ name="wpmtst_compat_options[lazyload][classes][<?php echo $key; ?>][finish]"
921
+ type="text"
922
+ value="<?php echo esc_attr( $pair['finish'] ); ?>" />
923
  </label>
924
  </div>
925
  <?php
930
  */
931
  public function add_lazyload_pair() {
932
  ob_start();
933
+ $this->settings_page_lazyload_class_inputs( $_REQUEST['key'], array( 'start' => '', 'finish' => '' ) );
 
 
 
 
 
 
934
  wp_send_json_success( ob_get_clean() );
935
  }
936
 
admin/settings/class-strong-testimonials-settings-form.php CHANGED
@@ -26,7 +26,7 @@ class Strong_Testimonials_Settings_Form {
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
- add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
  add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 2, 2 );
31
  add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
 
@@ -43,11 +43,10 @@ class Strong_Testimonials_Settings_Form {
43
  * @param $url
44
  */
45
  public static function register_tab( $active_tab, $url ) {
46
- printf(
47
- '<a href="%s" class="nav-tab %s">%s</a>',
48
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
49
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
50
- esc_html__( 'Form', 'strong-testimonials' )
51
  );
52
  }
53
 
@@ -75,7 +74,7 @@ class Strong_Testimonials_Settings_Form {
75
  */
76
  public static function settings_page() {
77
  settings_fields( self::GROUP_NAME );
78
- include WPMTST_ADMIN . 'settings/partials/form.php';
79
  }
80
 
81
  /**
@@ -138,9 +137,9 @@ class Strong_Testimonials_Settings_Form {
138
  $input['email_subject'] = isset( $input['email_subject'] ) ? wp_kses_post( trim( $input['email_subject'] ) ) : '';
139
  $input['email_message'] = isset( $input['email_message'] ) ? wp_kses_post( rtrim( $input['email_message'] ) ) : '';
140
 
141
- $input['honeypot_before'] = wpmtst_sanitize_checkbox( $input, 'honeypot_before' );
142
- $input['honeypot_after'] = wpmtst_sanitize_checkbox( $input, 'honeypot_after' );
143
- $input['captcha'] = sanitize_text_field( $input['captcha'] );
144
 
145
  foreach ( $input['messages'] as $key => $message ) {
146
  if ( 'submission-success' == $key ) {
@@ -172,29 +171,17 @@ class Strong_Testimonials_Settings_Form {
172
  }
173
 
174
  // Check the "ID or slug" field next
175
- if ( isset( $input['success_redirect_2'] ) && $input['success_redirect_2'] ) {
176
 
177
  // is post ID?
178
  $id = sanitize_text_field( $input['success_redirect_2'] );
179
  if ( is_numeric( $id ) ) {
180
- if ( ! get_posts(
181
- array(
182
- 'p' => $id,
183
- 'post_type' => array( 'page' ),
184
- 'post_status' => 'publish',
185
- )
186
- ) ) {
187
  $id = null;
188
  }
189
  } else {
190
  // is post slug?
191
- $target = get_posts(
192
- array(
193
- 'name' => $id,
194
- 'post_type' => array( 'page' ),
195
- 'post_status' => 'publish',
196
- )
197
- );
198
  if ( $target ) {
199
  $id = $target[0]->ID;
200
  }
@@ -203,11 +190,13 @@ class Strong_Testimonials_Settings_Form {
203
  if ( $id ) {
204
  $input['success_redirect_id'] = $id;
205
  }
 
206
  } else {
207
 
208
  if ( isset( $input['success_redirect_id'] ) ) {
209
  $input['success_redirect_id'] = (int) sanitize_text_field( $input['success_redirect_id'] );
210
  }
 
211
  }
212
 
213
  unset( $input['success_redirect_2'] );
@@ -223,7 +212,7 @@ class Strong_Testimonials_Settings_Form {
223
  */
224
  public static function restore_default_messages_function() {
225
  $default_form_options = Strong_Testimonials_Defaults::get_form_options();
226
- $messages = $default_form_options['messages'];
227
  echo json_encode( $messages );
228
  wp_die();
229
  }
@@ -234,9 +223,9 @@ class Strong_Testimonials_Settings_Form {
234
  * @since 1.13
235
  */
236
  public static function restore_default_message_function() {
237
- $input = str_replace( '_', '-', $_REQUEST['field'] );
238
  $default_form_options = Strong_Testimonials_Defaults::get_form_options();
239
- $message = $default_form_options['messages'][ $input ];
240
  echo json_encode( $message );
241
  wp_die();
242
  }
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
+ add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
  add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 2, 2 );
31
  add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
 
43
  * @param $url
44
  */
45
  public static function register_tab( $active_tab, $url ) {
46
+ printf( '<a href="%s" class="nav-tab %s">%s</a>',
 
47
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
48
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
49
+ __( 'Form', 'strong-testimonials' )
50
  );
51
  }
52
 
74
  */
75
  public static function settings_page() {
76
  settings_fields( self::GROUP_NAME );
77
+ include( WPMTST_ADMIN . 'settings/partials/form.php' );
78
  }
79
 
80
  /**
137
  $input['email_subject'] = isset( $input['email_subject'] ) ? wp_kses_post( trim( $input['email_subject'] ) ) : '';
138
  $input['email_message'] = isset( $input['email_message'] ) ? wp_kses_post( rtrim( $input['email_message'] ) ) : '';
139
 
140
+ $input['honeypot_before'] = wpmtst_sanitize_checkbox( $input, 'honeypot_before' );
141
+ $input['honeypot_after'] = wpmtst_sanitize_checkbox( $input, 'honeypot_after' );
142
+ $input['captcha'] = sanitize_text_field( $input['captcha'] );
143
 
144
  foreach ( $input['messages'] as $key => $message ) {
145
  if ( 'submission-success' == $key ) {
171
  }
172
 
173
  // Check the "ID or slug" field next
174
+ if ( isset( $input['success_redirect_2']) && $input['success_redirect_2'] ) {
175
 
176
  // is post ID?
177
  $id = sanitize_text_field( $input['success_redirect_2'] );
178
  if ( is_numeric( $id ) ) {
179
+ if ( ! get_posts( array( 'p' => $id, 'post_type' => array( 'page' ), 'post_status' => 'publish' ) ) ) {
 
 
 
 
 
 
180
  $id = null;
181
  }
182
  } else {
183
  // is post slug?
184
+ $target = get_posts( array( 'name' => $id, 'post_type' => array( 'page' ), 'post_status' => 'publish' ) );
 
 
 
 
 
 
185
  if ( $target ) {
186
  $id = $target[0]->ID;
187
  }
190
  if ( $id ) {
191
  $input['success_redirect_id'] = $id;
192
  }
193
+
194
  } else {
195
 
196
  if ( isset( $input['success_redirect_id'] ) ) {
197
  $input['success_redirect_id'] = (int) sanitize_text_field( $input['success_redirect_id'] );
198
  }
199
+
200
  }
201
 
202
  unset( $input['success_redirect_2'] );
212
  */
213
  public static function restore_default_messages_function() {
214
  $default_form_options = Strong_Testimonials_Defaults::get_form_options();
215
+ $messages = $default_form_options['messages'];
216
  echo json_encode( $messages );
217
  wp_die();
218
  }
223
  * @since 1.13
224
  */
225
  public static function restore_default_message_function() {
226
+ $input = str_replace( '_', '-', $_REQUEST['field'] );
227
  $default_form_options = Strong_Testimonials_Defaults::get_form_options();
228
+ $message = $default_form_options['messages'][$input];
229
  echo json_encode( $message );
230
  wp_die();
231
  }
admin/settings/class-strong-testimonials-settings-general.php CHANGED
@@ -26,9 +26,9 @@ class Strong_Testimonials_Settings_General {
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
- add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
- add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 1, 2 );
31
- add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
  }
33
 
34
  /**
@@ -38,11 +38,10 @@ class Strong_Testimonials_Settings_General {
38
  * @param $url
39
  */
40
  public static function register_tab( $active_tab, $url ) {
41
- printf(
42
- '<a href="%s" class="nav-tab %s">%s</a>',
43
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
44
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
45
- esc_html_x( 'General', 'adjective', 'strong-testimonials' )
46
  );
47
  }
48
 
@@ -54,15 +53,15 @@ class Strong_Testimonials_Settings_General {
54
  }
55
 
56
  /**
57
- * Register settings page.
58
- *
59
  * @param $pages
60
  *
61
  * @return mixed
62
  */
63
  public static function register_settings_page( $pages ) {
64
- $pages[ self::TAB_NAME ] = array( __CLASS__, 'settings_page' );
65
- return $pages;
66
  }
67
 
68
  /**
@@ -70,7 +69,7 @@ class Strong_Testimonials_Settings_General {
70
  */
71
  public static function settings_page() {
72
  settings_fields( self::GROUP_NAME );
73
- include WPMTST_ADMIN . 'settings/partials/general.php';
74
  }
75
 
76
  /**
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
+ add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
+ add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 1, 2 );
31
+ add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
  }
33
 
34
  /**
38
  * @param $url
39
  */
40
  public static function register_tab( $active_tab, $url ) {
41
+ printf( '<a href="%s" class="nav-tab %s">%s</a>',
 
42
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
43
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
44
+ _x( 'General', 'adjective', 'strong-testimonials' )
45
  );
46
  }
47
 
53
  }
54
 
55
  /**
56
+ * Register settings page.
57
+ *
58
  * @param $pages
59
  *
60
  * @return mixed
61
  */
62
  public static function register_settings_page( $pages ) {
63
+ $pages[ self::TAB_NAME ] = array( __CLASS__, 'settings_page' );
64
+ return $pages;
65
  }
66
 
67
  /**
69
  */
70
  public static function settings_page() {
71
  settings_fields( self::GROUP_NAME );
72
+ include( WPMTST_ADMIN . 'settings/partials/general.php' );
73
  }
74
 
75
  /**
admin/settings/class-strong-testimonials-settings-licenses.php CHANGED
@@ -26,7 +26,7 @@ class Strong_Testimonials_Settings_Licenses {
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
- add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
  add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 90, 2 );
31
  add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
  }
@@ -48,11 +48,10 @@ class Strong_Testimonials_Settings_Licenses {
48
  */
49
  public static function register_tab( $active_tab, $url ) {
50
  if ( self::has_active_addons() ) {
51
- printf(
52
- '<a href="%s" class="nav-tab %s">%s</a>',
53
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
54
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
55
- esc_html__( 'Licenses', 'strong-testimonials' )
56
  );
57
  }
58
  }
@@ -81,7 +80,7 @@ class Strong_Testimonials_Settings_Licenses {
81
  */
82
  public static function settings_page() {
83
  settings_fields( self::GROUP_NAME );
84
- include WPMTST_ADMIN . 'settings/partials/licenses.php';
85
  }
86
 
87
  /**
26
  * Add actions and filters.
27
  */
28
  public static function add_actions() {
29
+ add_action( 'wpmtst_register_settings', array( __CLASS__, 'register_settings' ) );
30
  add_action( 'wpmtst_settings_tabs', array( __CLASS__, 'register_tab' ), 90, 2 );
31
  add_filter( 'wpmtst_settings_callbacks', array( __CLASS__, 'register_settings_page' ) );
32
  }
48
  */
49
  public static function register_tab( $active_tab, $url ) {
50
  if ( self::has_active_addons() ) {
51
+ printf( '<a href="%s" class="nav-tab %s">%s</a>',
 
52
  esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
53
  esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
54
+ __( 'Licenses', 'strong-testimonials' )
55
  );
56
  }
57
  }
80
  */
81
  public static function settings_page() {
82
  settings_fields( self::GROUP_NAME );
83
+ include( WPMTST_ADMIN . 'settings/partials/licenses.php' );
84
  }
85
 
86
  /**
admin/settings/class-strong-testimonials-settings.php CHANGED
@@ -4,9 +4,9 @@
4
  */
5
  class Strong_Testimonials_Settings {
6
 
7
- const DEFAULT_TAB = 'general';
8
 
9
- public static $callbacks;
10
 
11
  /**
12
  * Strong_Testimonials_Settings constructor.
@@ -33,27 +33,26 @@ class Strong_Testimonials_Settings {
33
  */
34
  public static function register_settings() {
35
  self::$callbacks = apply_filters( 'wpmtst_settings_callbacks', array() );
36
- do_action( 'wpmtst_register_settings' );
37
  }
38
 
39
  /**
40
  * Settings page
41
  */
42
  public static function settings_page() {
43
- if ( ! current_user_can( 'strong_testimonials_options' ) ) {
44
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) );
45
- }
46
 
47
  $tab = self::get_tab();
48
  $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings' );
49
  ?>
50
  <div class="wrap wpmtst">
51
 
52
- <h1><?php echo wp_kses_post( apply_filters( 'wpmtst_cpt_singular_name', esc_html__( 'Testimonial', 'strong-testimonials' ) ) ); ?> <?php esc_html_e( 'Settings' ); ?></h1>
53
 
54
  <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
55
  <div id="message" class="updated notice is-dismissible">
56
- <p><?php esc_html_e( 'Settings saved.' ); ?></p>
57
  </div>
58
  <?php endif; ?>
59
 
@@ -61,7 +60,7 @@ class Strong_Testimonials_Settings {
61
  <?php do_action( 'wpmtst_settings_tabs', $tab, $url ); ?>
62
  </h2>
63
 
64
- <form id="<?php echo esc_attr( $tab ); ?>-form" method="post" action="options.php">
65
  <?php
66
  if ( isset( self::$callbacks[ $tab ] ) && wpmtst_callback_exists( self::$callbacks[ $tab ] ) ) {
67
  call_user_func( self::$callbacks[ $tab ] );
@@ -70,11 +69,11 @@ class Strong_Testimonials_Settings {
70
  }
71
 
72
  if ( has_action( 'wpmtst_settings_submit_row' ) ) {
73
- echo '<p class="submit-buttons">';
74
  do_action( 'wpmtst_settings_submit_row' );
75
- echo '</p>';
76
- }
77
- ?>
78
  </form>
79
 
80
  </div><!-- .wrap -->
4
  */
5
  class Strong_Testimonials_Settings {
6
 
7
+ const DEFAULT_TAB = 'general';
8
 
9
+ public static $callbacks;
10
 
11
  /**
12
  * Strong_Testimonials_Settings constructor.
33
  */
34
  public static function register_settings() {
35
  self::$callbacks = apply_filters( 'wpmtst_settings_callbacks', array() );
36
+ do_action( 'wpmtst_register_settings' );
37
  }
38
 
39
  /**
40
  * Settings page
41
  */
42
  public static function settings_page() {
43
+ if ( ! current_user_can( 'strong_testimonials_options' ) )
44
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
 
45
 
46
  $tab = self::get_tab();
47
  $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings' );
48
  ?>
49
  <div class="wrap wpmtst">
50
 
51
+ <h1><?php echo apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ); ?> <?php _e( 'Settings' ); ?></h1>
52
 
53
  <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
54
  <div id="message" class="updated notice is-dismissible">
55
+ <p><?php _e( 'Settings saved.' ) ?></p>
56
  </div>
57
  <?php endif; ?>
58
 
60
  <?php do_action( 'wpmtst_settings_tabs', $tab, $url ); ?>
61
  </h2>
62
 
63
+ <form id="<?php esc_attr_e( $tab ); ?>-form" method="post" action="options.php">
64
  <?php
65
  if ( isset( self::$callbacks[ $tab ] ) && wpmtst_callback_exists( self::$callbacks[ $tab ] ) ) {
66
  call_user_func( self::$callbacks[ $tab ] );
69
  }
70
 
71
  if ( has_action( 'wpmtst_settings_submit_row' ) ) {
72
+ echo '<p class="submit-buttons">';
73
  do_action( 'wpmtst_settings_submit_row' );
74
+ echo '</p>';
75
+ }
76
+ ?>
77
  </form>
78
 
79
  </div><!-- .wrap -->
admin/settings/partials/email-from.php CHANGED
@@ -1,77 +1,93 @@
1
  <div class="match-height gutter">
2
- <fieldset>
3
- <label for="wpmtst-options-mail-queue">
4
- <input id="wpmtst-options-mail-queue" type="checkbox" name="wpmtst_form_options[mail_queue]" <?php checked( $form_options['mail_queue'] ); ?>>
5
- <?php esc_html_e( 'Use mail queue. For services like Mandrill. Off by default.', 'strong-testimonials' ); ?>
6
- </label>
7
- </fieldset>
 
 
8
  </div>
9
 
10
  <div class="email-option-first">
11
- <div class="email-option-row">
12
-
13
- <div class="email-option-desc">
14
- <?php esc_html_e( 'From', 'strong-testimonials' ); ?>
15
- </div>
16
-
17
- <div class="email-option-inputs">
18
-
19
- <div class="email-option header">
20
-
21
- <div class="email-option-part">
22
- <div class="email-option-label">
23
- <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
24
- </div>
25
- </div>
26
-
27
- <div class="email-option-part">
28
- <div class="email-option-label">
29
- <?php esc_html_e( 'Email', 'strong-testimonials' ); ?>
30
- </div>
31
- </div>
32
-
33
- </div>
34
-
35
- <div class="email-option body recipient">
36
-
37
- <div class="email-option-part">
38
- <div class="email-option-fieldset">
39
- <div class="controls"></div>
40
- <div class="fields">
41
- <input type="text" id="wpmtst-options-sender-name" name="wpmtst_form_options[sender_name]" value="<?php echo esc_attr( $form_options['sender_name'] ); ?>" placeholder="<?php esc_attr_e( '(optional)', 'strong-testimonials' ); ?>">
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <div class="email-option-part">
47
-
48
- <div class="email-option-fieldset">
49
-
50
- <div class="controls">
51
- <input type="radio" id="wpmtst-options-sender-site-email-1" name="wpmtst_form_options[sender_site_email]" <?php checked( $form_options['sender_site_email'], 1 ); ?> value="1">
52
- </div>
53
- <div class="fields">
54
- <?php esc_html_e( 'admin:', 'strong-testimonials' ); ?>
55
- &nbsp;<?php echo wp_kses_post( get_bloginfo( 'admin_email' ) ); ?>
56
- </div>
57
-
58
- </div>
59
-
60
- <div class="email-option-fieldset">
61
-
62
- <div class="controls">
63
- <input class="focus-next-field" type="radio" id="wpmtst-options-sender-site-email-0" name="wpmtst_form_options[sender_site_email]" <?php checked( $form_options['sender_site_email'], 0 ); ?> value="0">
64
- </div>
65
- <div class="fields">
66
- <input type="email" id="wpmtst-options-sender-email" name="wpmtst_form_options[sender_email]" value="<?php echo esc_attr( $form_options['sender_email'] ); ?>" placeholder="<?php esc_attr_e( 'email address', 'strong-testimonials' ); ?>">
67
- </div>
68
-
69
- </div>
70
- </div>
71
-
72
- </div>
73
-
74
- </div>
75
-
76
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  </div>
1
  <div class="match-height gutter">
2
+ <fieldset>
3
+ <label for="wpmtst-options-mail-queue">
4
+ <input id="wpmtst-options-mail-queue"
5
+ type="checkbox"
6
+ name="wpmtst_form_options[mail_queue]" <?php checked( $form_options['mail_queue'] ); ?>>
7
+ <?php _e( 'Use mail queue. For services like Mandrill. Off by default.', 'strong-testimonials' ); ?>
8
+ </label>
9
+ </fieldset>
10
  </div>
11
 
12
  <div class="email-option-first">
13
+ <div class="email-option-row">
14
+
15
+ <div class="email-option-desc">
16
+ <?php _e( "From", 'strong-testimonials' ); ?>
17
+ </div>
18
+
19
+ <div class="email-option-inputs">
20
+
21
+ <div class="email-option header">
22
+
23
+ <div class="email-option-part">
24
+ <div class="email-option-label">
25
+ <?php _e( "Name", 'strong-testimonials' ); ?>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="email-option-part">
30
+ <div class="email-option-label">
31
+ <?php _e( "Email", 'strong-testimonials' ); ?>
32
+ </div>
33
+ </div>
34
+
35
+ </div>
36
+
37
+ <div class="email-option body recipient">
38
+
39
+ <div class="email-option-part">
40
+ <div class="email-option-fieldset">
41
+ <div class="controls"></div>
42
+ <div class="fields">
43
+ <input type="text"
44
+ id="wpmtst-options-sender-name"
45
+ name="wpmtst_form_options[sender_name]"
46
+ value="<?php echo esc_attr( $form_options['sender_name'] ); ?>"
47
+ placeholder="<?php _e( '(optional)', 'strong-testimonials' ); ?>">
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ <div class="email-option-part">
53
+
54
+ <div class="email-option-fieldset">
55
+
56
+ <div class="controls">
57
+ <input type="radio"
58
+ id="wpmtst-options-sender-site-email-1"
59
+ name="wpmtst_form_options[sender_site_email]" <?php checked( $form_options['sender_site_email'], 1 ); ?>
60
+ value="1">
61
+ </div>
62
+ <div class="fields">
63
+ <?php _e( 'admin:', 'strong-testimonials' ); ?>
64
+ &nbsp;<?php echo get_bloginfo( 'admin_email' ); ?>
65
+ </div>
66
+
67
+ </div>
68
+
69
+ <div class="email-option-fieldset">
70
+
71
+ <div class="controls">
72
+ <input class="focus-next-field" type="radio"
73
+ id="wpmtst-options-sender-site-email-0"
74
+ name="wpmtst_form_options[sender_site_email]" <?php checked( $form_options['sender_site_email'], 0 ); ?>
75
+ value="0">
76
+ </div>
77
+ <div class="fields">
78
+ <input type="email"
79
+ id="wpmtst-options-sender-email"
80
+ name="wpmtst_form_options[sender_email]"
81
+ value="<?php echo esc_attr( $form_options['sender_email'] ); ?>"
82
+ placeholder="<?php _e( 'email address', 'strong-testimonials' ); ?>">
83
+ </div>
84
+
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+ </div>
91
+
92
+ </div>
93
  </div>
admin/settings/partials/email-to.php CHANGED
@@ -1,27 +1,27 @@
1
  <div>
2
- <div class="email-option-row">
3
 
4
- <div class="email-option-desc">
5
- <?php esc_html_e( 'To', 'strong-testimonials' ); ?>
6
- </div>
7
 
8
- <div class="email-option-inputs">
9
 
10
- <div class="email-option header">
11
 
12
- <div class="email-option-part">
13
- <div class="email-option-label">
14
- <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
15
- </div>
16
- </div>
17
 
18
- <div class="email-option-part">
19
- <div class="email-option-label">
20
- <?php esc_html_e( 'Email', 'strong-testimonials' ); ?>
21
- </div>
22
- </div>
23
 
24
- </div>
25
 
26
  <?php
27
  if ( isset( $form_options['recipients'] ) && $form_options['recipients'] ) {
@@ -31,12 +31,13 @@
31
  }
32
  ?>
33
 
34
- <div class="email-option footer">
35
- <input class="button" type="button" id="add-recipient" value="<?php esc_attr_e( 'Add recipient', 'strong-testimonials' ); ?>">
36
- </div>
 
37
 
38
- </div>
39
 
40
- </div>
41
 
42
- </div>
1
  <div>
2
+ <div class="email-option-row">
3
 
4
+ <div class="email-option-desc">
5
+ <?php _e( "To", 'strong-testimonials' ); ?>
6
+ </div>
7
 
8
+ <div class="email-option-inputs">
9
 
10
+ <div class="email-option header">
11
 
12
+ <div class="email-option-part">
13
+ <div class="email-option-label">
14
+ <?php _e( 'Name', 'strong-testimonials' ); ?>
15
+ </div>
16
+ </div>
17
 
18
+ <div class="email-option-part">
19
+ <div class="email-option-label">
20
+ <?php _e( 'Email', 'strong-testimonials' ); ?>
21
+ </div>
22
+ </div>
23
 
24
+ </div>
25
 
26
  <?php
27
  if ( isset( $form_options['recipients'] ) && $form_options['recipients'] ) {
31
  }
32
  ?>
33
 
34
+ <div class="email-option footer">
35
+ <input class="button" type="button" id="add-recipient"
36
+ value="<?php esc_attr_e( 'Add recipient', 'strong-testimonials' ); ?>">
37
+ </div>
38
 
39
+ </div>
40
 
41
+ </div>
42
 
43
+ </div>
admin/settings/partials/email.php CHANGED
@@ -1,55 +1,64 @@
1
  <div class="email-option-row">
2
 
3
- <div class="email-option-desc">
4
- <label for="wpmtst-option-email-subject">
5
- <?php esc_html_e( 'Subject', 'strong-testimonials' ); ?>
6
- </label>
7
- </div>
8
-
9
- <div class="email-option-inputs">
10
- <div class="email-option body">
11
- <input class="wide" type="text" id="wpmtst-option-email-subject" name="wpmtst_form_options[email_subject]" value="<?php echo esc_attr( $form_options['email_subject'] ); ?>" placeholder="<?php esc_attr_e( 'subject line', 'strong-testimonials' ); ?>" size="50">
12
- </div>
13
- </div>
 
 
 
 
 
 
14
 
15
  </div>
16
 
17
  <div class="email-option-row">
18
 
19
- <div class="email-option-desc">
20
- <label for="wpmtst-option-email-message">
21
- <?php esc_html_e( 'Message', 'strong-testimonials' ); ?>
22
- </label>
23
- </div>
24
 
25
  <?php $line_count = max( count( explode( "\n", $form_options['email_message'] ) ), 3 ); ?>
26
- <div class="email-option-inputs">
27
- <div class="email-option body">
28
- <textarea class="autosize" id="wpmtst-option-email-message" name="wpmtst_form_options[email_message]" rows="<?php echo esc_attr( $line_count ); ?>" placeholder="<?php esc_attr_e( 'message text', 'strong-testimonials' ); ?>"><?php echo esc_attr( $form_options['email_message'] ); ?></textarea>
29
- </div>
30
- </div>
 
 
 
31
 
32
  </div>
33
 
34
  <div class="email-option-row column no-padding">
35
 
36
- <div class="template-tags-help">
37
- <div class="title"><?php esc_html_e( 'Tags for Subject and Message', 'strong-testimonials' ); ?></div>
38
- <div class="content">
39
- <ul id="wpmtst-tags-list">
40
- <li>%BLOGNAME%</li>
41
- <li>%TITLE%</li>
42
- <li>%CONTENT%</li>
43
- <li>%STATUS%</li>
44
- <li>%SUBMIT_DATE%</li>
45
- <?php
46
  $custom_fields = wpmtst_get_custom_fields();
47
  foreach ( $custom_fields as $field ) {
48
- echo '<li>%' . esc_html( strtoupper( $field['name'] ) ) . '%</li>' . "\n";
49
  }
50
  ?>
51
- </ul>
52
- </div>
53
- </div>
54
 
55
  </div>
1
  <div class="email-option-row">
2
 
3
+ <div class="email-option-desc">
4
+ <label for="wpmtst-option-email-subject">
5
+ <?php _e( "Subject", 'strong-testimonials' ); ?>
6
+ </label>
7
+ </div>
8
+
9
+ <div class="email-option-inputs">
10
+ <div class="email-option body">
11
+ <input class="wide"
12
+ type="text"
13
+ id="wpmtst-option-email-subject"
14
+ name="wpmtst_form_options[email_subject]"
15
+ value="<?php echo esc_attr( $form_options['email_subject'] ); ?>"
16
+ placeholder="<?php _e( 'subject line', 'strong-testimonials' ); ?>"
17
+ size="50">
18
+ </div>
19
+ </div>
20
 
21
  </div>
22
 
23
  <div class="email-option-row">
24
 
25
+ <div class="email-option-desc">
26
+ <label for="wpmtst-option-email-message">
27
+ <?php _e( "Message", 'strong-testimonials' ); ?>
28
+ </label>
29
+ </div>
30
 
31
  <?php $line_count = max( count( explode( "\n", $form_options['email_message'] ) ), 3 ); ?>
32
+ <div class="email-option-inputs">
33
+ <div class="email-option body">
34
+ <textarea class="autosize"
35
+ id="wpmtst-option-email-message" name="wpmtst_form_options[email_message]"
36
+ rows="<?php echo esc_attr( $line_count ); ?>"
37
+ placeholder="<?php _e( 'message text', 'strong-testimonials' ); ?>"><?php echo esc_attr( $form_options['email_message'] ); ?></textarea>
38
+ </div>
39
+ </div>
40
 
41
  </div>
42
 
43
  <div class="email-option-row column no-padding">
44
 
45
+ <div class="template-tags-help">
46
+ <div class="title"><?php _e( "Tags for Subject and Message", 'strong-testimonials' ); ?></div>
47
+ <div class="content">
48
+ <ul id="wpmtst-tags-list">
49
+ <li>%BLOGNAME%</li>
50
+ <li>%TITLE%</li>
51
+ <li>%CONTENT%</li>
52
+ <li>%STATUS%</li>
53
+ <li>%SUBMIT_DATE%</li>
54
+ <?php
55
  $custom_fields = wpmtst_get_custom_fields();
56
  foreach ( $custom_fields as $field ) {
57
+ echo '<li>%' . strtoupper( $field['name'] ) . '%</li>' . "\n";
58
  }
59
  ?>
60
+ </ul>
61
+ </div>
62
+ </div>
63
 
64
  </div>
admin/settings/partials/form.php CHANGED
@@ -32,9 +32,12 @@ foreach ( $plugins as $key => $plugin ) {
32
  $form_options['captcha'] = '';
33
  update_option( 'wpmtst_form_options', $form_options );
34
  }
 
35
  }
36
  ?>
37
- <input type="hidden" name="wpmtst_form_options[default_recipient]" value="<?php echo esc_attr( htmlentities( serialize( $form_options['default_recipient'] ) ) ); ?>">
 
 
38
 
39
  <?php
40
  /**
@@ -43,14 +46,14 @@ foreach ( $plugins as $key => $plugin ) {
43
  * ========================================
44
  */
45
  ?>
46
- <h2><?php esc_html_e( 'Form Labels & Messages', 'strong-testimonials' ); ?></h2>
47
 
48
  <?php do_action( 'wpmtst_before_form_settings', 'form-messages' ); ?>
49
 
50
  <table class="form-table compact" cellpadding="0" cellspacing="0">
51
  <?php
52
  $messages = $form_options['messages'];
53
- foreach ( $messages as $key => $message ) :
54
  $required = isset( $message['required'] ) ? $message['required'] : true;
55
 
56
  $elid = str_replace( '-', '_', $key );
@@ -58,15 +61,16 @@ foreach ( $plugins as $key => $plugin ) {
58
  $content = apply_filters( 'wpmtst_l10n', $message['text'], 'strong-testimonials-form-messages', $message['description'] );
59
  ?>
60
 
61
- <tr>
62
- <th scope="row">
63
- <label for="<?php echo esc_attr( $elid ); ?>">
64
- <?php echo esc_html( $message['description'] ); ?>
65
- </label>
66
- <input type="hidden" name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][description]" value="<?php echo esc_attr( $message['description'] ); ?>"/>
67
- </th>
68
- <td>
69
- <?php if ( 'submission_success' == $elid ) : ?>
 
70
  <?php
71
  $settings = array(
72
  'textarea_name' => "wpmtst_form_options[messages][$key][text]",
@@ -74,54 +78,65 @@ foreach ( $plugins as $key => $plugin ) {
74
  );
75
  wp_editor( $content, $elid, $settings );
76
  ?>
77
- <?php else : ?>
78
- <?php if ( 'required_field' == $elid ) : ?>
79
- <fieldset>
80
- <label>
81
- <input type="checkbox" name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][enabled]" <?php checked( $message['enabled'] ); ?>">
82
- <?php esc_html_e( 'Display required notice at top of form', 'strong-testimonials' ); ?>
83
- </label
84
- </fieldset>
 
 
85
  <?php endif; ?>
86
- <input type="text" id="<?php echo esc_attr( $elid ); ?>" name="wpmtst_form_options[messages][<?php echo esc_attr( $key ); ?>][text]" value="<?php echo esc_attr( $content ); ?>" <?php echo $required ? 'required' : ''; ?>/>
 
 
 
87
  <?php endif; ?>
88
- </td>
89
- <td class="actions">
90
- <input type="button" class="button secondary restore-default-message" value="<?php echo esc_attr_x( 'restore default', 'singular', 'strong-testimonials' ); ?>" data-target-id="<?php echo esc_attr( $elid ); ?>"/>
91
- </td>
92
- </tr>
 
 
93
 
94
  <?php endforeach; ?>
95
 
96
- <tr>
97
- <td colspan="3">
98
- <input type="button" id="restore-default-messages" class="button" name="restore-default-messages" value="<?php esc_attr_e( 'Restore Default Messages', 'strong-testimonials' ); ?>"/>
99
- </td>
100
- </tr>
 
 
101
  </table>
102
 
103
  <table class="form-table" cellpadding="0" cellspacing="0">
104
- <tr>
105
- <th scope="row" class="tall">
106
- <?php esc_html_e( 'Scroll', 'strong-testimonials' ); ?>
107
- </th>
108
- <td>
109
- <fieldset>
110
- <div>
111
- <label>
112
- <input type="checkbox" name="wpmtst_form_options[scrolltop_error]" <?php checked( $form_options['scrolltop_error'] ); ?>/>
113
- <?php echo wp_kses_post( printf( __( 'If errors, scroll to the first error minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_error_offset]" value="' . $form_options['scrolltop_error_offset'] . '" size="3">' ) ); ?>
114
- </label>
115
- </div>
116
- <div>
117
- <label class="block">
118
- <input type="checkbox" name="wpmtst_form_options[scrolltop_success]" <?php checked( $form_options['scrolltop_success'] ); ?>/>
119
- <?php echo wp_kses_post( printf( __( 'If success, scroll to the success message minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_success_offset]" value="' . $form_options['scrolltop_success_offset'] . '" size="3">' ) ); ?>
120
- </label>
121
- </div>
122
- </fieldset>
123
- </td>
124
- </tr>
 
 
125
  </table>
126
 
127
  <?php
@@ -132,113 +147,127 @@ foreach ( $plugins as $key => $plugin ) {
132
  */
133
  ?>
134
  <hr>
135
- <h3><?php esc_html_e( 'Form Actions', 'strong-testimonials' ); ?></h3>
136
 
137
  <table class="form-table" cellpadding="0" cellspacing="0">
138
- <tr>
139
- <th scope="row">
140
- <label for="redirect-page">
141
- <?php esc_html_e( 'Upon Successful Submission', 'strong-testimonials' ); ?>
142
- </label>
143
- </th>
144
- <td>
145
- <div>
146
- <label class="success-action">
147
- <input type="radio" name="wpmtst_form_options[success_action]" value="message" <?php checked( 'message', $form_options['success_action'] ); ?>/> <?php esc_html_e( 'display message', 'strong-testimonials' ); ?>
148
- </label>
149
- </div>
150
-
151
- <div>
152
- <label class="success-action">
153
- <input type="radio" name="wpmtst_form_options[success_action]" value="id" <?php checked( 'id', $form_options['success_action'] ); ?>/> <?php esc_html_e( 'redirect to a page', 'strong-testimonials' ); ?>
154
- </label>
155
-
156
- <select id="redirect-page" name="wpmtst_form_options[success_redirect_id]">
157
-
158
- <option value=""><?php esc_html_e( '&mdash; select a page &mdash;' ); ?></option>
 
 
 
 
159
 
160
  <?php foreach ( $pages_list as $pages ) : ?>
161
 
162
- <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $form_options['success_redirect_id'] ) ? $form_options['success_redirect_id'] : 0, $pages->ID ); ?>>
163
- <?php echo esc_html( $pages->post_title ); ?>
164
- </option>
165
 
166
  <?php endforeach; ?>
167
 
168
- </select>
169
-
170
- <div style="display: inline-block; text-indent: 20px;">
171
- <label>
172
- <?php echo esc_html_x( 'or enter its ID or slug', 'to select a redirect page', 'strong-testimonials' ); ?>
173
- &nbsp;
174
- <input type="text" id="redirect-page-2" name="wpmtst_form_options[success_redirect_2]" size="30">
175
- </label>
176
- </div>
177
- </div>
178
-
179
- <div>
180
- <label class="success-action">
181
- <input type="radio" name="wpmtst_form_options[success_action]" value="url" <?php checked( 'url', $form_options['success_action'] ); ?>/>
182
- <?php esc_html_e( 'redirect to a URL', 'strong-testimonials' ); ?>
183
- </label>
184
- <label>
185
- <input type="text" id="redirect-page-3" name="wpmtst_form_options[success_redirect_url]" value="<?php echo esc_attr( $form_options['success_redirect_url'] ); ?>" size="75"/>
186
- </label>
187
- </div>
188
-
189
- </td>
190
- </tr>
191
-
192
- <tr>
193
- <th scope="row">
194
- <label>
195
- <?php esc_html_e( 'Post Status', 'strong-testimonials' ); ?>
196
- </label>
197
- </th>
198
- <td>
199
- <ul class="compact">
200
- <li>
201
- <label>
202
- <input type="radio" name="wpmtst_form_options[post_status]" value="pending" <?php checked( 'pending', $form_options['post_status'] ); ?>/>
203
- <?php esc_html_e( 'Pending', 'strong-testimonials' ); ?>
204
- </label>
205
- </li>
206
- <li>
207
- <label>
208
- <input type="radio" name="wpmtst_form_options[post_status]" value="publish" <?php checked( 'publish', $form_options['post_status'] ); ?>/>
209
- <?php esc_html_e( 'Published' ); ?>
210
- </label>
211
- </li>
212
- </ul>
213
- </td>
214
- </tr>
215
-
216
- <tr>
217
- <th scope="row">
218
- <label for="wpmtst-options-admin-notify">
219
- <?php esc_html_e( 'Notification Email', 'strong-testimonials' ); ?>
220
- </label>
221
- </th>
222
-
223
- <td>
224
- <div class="match-height">
225
- <fieldset>
226
- <label for="wpmtst-options-admin-notify">
227
- <input id="wpmtst-options-admin-notify" type="checkbox" name="wpmtst_form_options[admin_notify]" <?php checked( $form_options['admin_notify'] ); ?>/>
228
- <?php esc_html_e( 'Send an email upon new testimonial submission.', 'strong-testimonials' ); ?>
229
- </label>
230
- </fieldset>
231
- </div>
232
- <div class="email-container" id="admin-notify-fields" <?php echo ( $form_options['admin_notify'] ) ? '' : 'style="display: none;"'; ?>>
 
 
 
 
 
 
 
 
 
 
233
  <?php
234
- require 'email-from.php';
235
- require 'email-to.php';
236
- require 'email.php';
237
  do_action( 'wpmtst_after_notification_fields', 'notification' );
238
  ?>
239
- </div>
240
- </td>
241
- </tr>
242
  </table>
243
 
244
  <?php
@@ -249,120 +278,114 @@ foreach ( $plugins as $key => $plugin ) {
249
  */
250
  ?>
251
  <hr>
252
- <h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
253
 
254
  <table class="form-table" cellpadding="0" cellspacing="0">
255
- <tr>
256
- <th scope="row">
257
- <label>
258
- <?php echo esc_html_x( 'Honeypot', 'spam control techniques', 'strong-testimonials' ); ?>
259
- </label>
260
- </th>
261
- <td>
262
- <p>
263
- <?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
264
- </p>
265
- <p>
266
- <?php esc_html_e( 'However, honeypots may not be compatible with WP-SpamShield, Ajax page loading, caching or minification.', 'strong-testimonials' ); ?>
267
- </p>
268
- <p>
269
- <?php esc_html_e( 'If your form is not working properly, try disabling these.', 'strong-testimonials' ); ?>
270
- </p>
271
  <?php // TODO Add link to article that explains Ajax page loading. ?>
272
- <ul>
273
- <li class="checkbox">
274
- <label>
275
- <input type="checkbox" name="wpmtst_form_options[honeypot_before]" <?php checked( $form_options['honeypot_before'] ); ?>/>
276
- <?php esc_html_e( 'Before', 'strong-testimonials' ); ?>
277
- </label>
278
- <p class="description"><?php esc_html_e( 'Adds a new empty field that is invisible to humans. Spambots tend to fill in every field they find in the form. Empty field = human. Not empty = spambot.', 'strong-testimonials' ); ?></p>
279
- </li>
280
- <li class="checkbox">
281
- <label>
282
- <input type="checkbox" name="wpmtst_form_options[honeypot_after]" <?php checked( $form_options['honeypot_after'] ); ?>/>
283
- <?php esc_html_e( 'After', 'strong-testimonials' ); ?>
284
- </label>
285
- <p class="description"><?php esc_html_e( 'Adds a new field as soon as the form is submitted. Spambots cannot run JavaScript so the new field never gets added. New field = human. Missing = spambot.', 'strong-testimonials' ); ?></p>
286
- </li>
287
- </ul>
288
- </td>
289
- </tr>
290
- <tr valign="top">
291
- <th scope="row">
292
- <label>
293
- <a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
294
- </label>
295
- </th>
296
- <td class="stackem">
297
- <p>
298
- <?php esc_html_e( 'Enable Captcha using one of these plugins. Be sure to configure any plugins first, if necessary.', 'strong-testimonials' ); ?>
299
- <?php esc_html_e( 'May be used alongside honeypot methods.', 'strong-testimonials' ); ?>
300
- </p>
301
- <p>
302
- <?php esc_html_e( 'May not be compatible with Ajax page loading.', 'strong-testimonials' ); ?>
303
- </p>
304
- <ul>
305
- <li>
306
- <label>
307
- <input type="radio" name="wpmtst_form_options[captcha]" <?php checked( '', $form_options['captcha'] ); ?> value=""/>
308
- none
309
- </label>
310
- </li>
 
 
 
311
 
312
  <?php foreach ( $plugins as $key => $plugin ) : ?>
313
- <li>
314
- <label class="inline
315
- <?php
316
- if ( ! $plugin['active'] ) {
317
- echo 'disabled';}
318
- ?>
319
- ">
320
- <input type="radio" name="wpmtst_form_options[captcha]" <?php disabled( ! $plugin['active'] ); ?><?php checked( $key, $form_options['captcha'] ); ?> value="<?php echo esc_attr( $key ); ?>"/>
321
- <?php echo esc_html( $plugin['name'] ); ?>
322
- </label>
323
 
324
  <?php if ( isset( $plugin['installed'] ) && $plugin['installed'] ) : // installed ?>
325
 
326
  <?php if ( $plugin['active'] ) : // active ?>
327
 
328
  <?php if ( isset( $plugin['settings'] ) && $plugin['settings'] ) : ?>
329
- <span class="link"><a href="<?php echo esc_url( $plugin['settings'] ); ?>"><?php echo esc_html_x( 'settings', 'link', 'strong-testimonials' ); ?></a></span>
330
  <?php else : ?>
331
- <span class="notice"><?php esc_html_e( 'no settings', 'strong-testimonials' ); ?></span>
332
  <?php endif; ?>
333
 
334
  <?php else : // inactive ?>
335
 
336
- <span class="notice disabled"><?php echo esc_html_x( 'inactive', 'adjective', 'strong-testimonials' ); ?></span>
337
 
338
  <?php endif; ?>
339
- |
340
 
341
  <?php else : // not installed ?>
342
 
343
- <span class="notice disabled">(<?php esc_html_e( 'not installed', 'strong-testimonials' ); ?>)</span>
344
 
345
- <?php if ( isset( $plugin['search'] ) && $plugin['search'] ) : ?>
346
- <span class="link"><a href="<?php echo esc_url( $plugin['search'] ); ?>"><?php echo esc_html_x( 'install plugin', 'link', 'strong-testimonials' ); ?></a></span>
347
- |
348
- <?php endif; ?>
349
 
350
  <?php endif; // whether installed ?>
351
 
352
- <span class="link"><a href="<?php echo esc_url( $plugin['url'] ); ?>" target="_blank"><?php echo esc_html_x( 'plugin page', 'link', 'strong-testimonials' ); ?></a></span>
353
 
354
  <?php if ( isset( $plugin['desc'] ) && $plugin['desc'] ) : ?>
355
- <p class="description
356
- <?php
357
- if ( isset( $plugin['style'] ) ) {
358
- echo esc_attr( $plugin['style'] );
359
- }
360
- ?>
361
- "><?php echo wp_kses_post( $plugin['desc'] ); ?></p>
362
  <?php endif; ?>
363
- </li>
364
  <?php endforeach; ?>
365
- </ul>
366
- </td>
367
- </tr>
368
  </table>
32
  $form_options['captcha'] = '';
33
  update_option( 'wpmtst_form_options', $form_options );
34
  }
35
+
36
  }
37
  ?>
38
+ <input type="hidden"
39
+ name="wpmtst_form_options[default_recipient]"
40
+ value="<?php echo htmlentities( serialize( $form_options['default_recipient'] ) ); ?>">
41
 
42
  <?php
43
  /**
46
  * ========================================
47
  */
48
  ?>
49
+ <h2><?php _e( 'Form Labels & Messages', 'strong-testimonials' ); ?></h2>
50
 
51
  <?php do_action( 'wpmtst_before_form_settings', 'form-messages' ); ?>
52
 
53
  <table class="form-table compact" cellpadding="0" cellspacing="0">
54
  <?php
55
  $messages = $form_options['messages'];
56
+ foreach ( $messages as $key => $message ):
57
  $required = isset( $message['required'] ) ? $message['required'] : true;
58
 
59
  $elid = str_replace( '-', '_', $key );
61
  $content = apply_filters( 'wpmtst_l10n', $message['text'], 'strong-testimonials-form-messages', $message['description'] );
62
  ?>
63
 
64
+ <tr>
65
+ <th scope="row">
66
+ <label for="<?php echo $elid; ?>">
67
+ <?php _ex( $message['description'], 'description', 'strong-testimonials' ); ?>
68
+ </label>
69
+ <input type="hidden" name="wpmtst_form_options[messages][<?php echo $key; ?>][description]"
70
+ value="<?php esc_attr_e( $message['description'] ); ?>"/>
71
+ </th>
72
+ <td>
73
+ <?php if ( 'submission_success' == $elid ): ?>
74
  <?php
75
  $settings = array(
76
  'textarea_name' => "wpmtst_form_options[messages][$key][text]",
78
  );
79
  wp_editor( $content, $elid, $settings );
80
  ?>
81
+ <?php else: ?>
82
+ <?php if ( 'required_field' == $elid ): ?>
83
+ <fieldset>
84
+ <label>
85
+ <input type="checkbox"
86
+ name="wpmtst_form_options[messages][<?php echo $key; ?>][enabled]"
87
+ <?php checked( $message['enabled'] ); ?>">
88
+ <?php _e( 'Display required notice at top of form', 'strong-testimonials' ); ?>
89
+ </label
90
+ </fieldset>
91
  <?php endif; ?>
92
+ <input type="text" id="<?php echo $elid; ?>"
93
+ name="wpmtst_form_options[messages][<?php echo $key; ?>][text]"
94
+ value="<?php esc_attr_e( $content ); ?>"
95
+ <?php echo $required ? 'required' : '' ?>/>
96
  <?php endif; ?>
97
+ </td>
98
+ <td class="actions">
99
+ <input type="button" class="button secondary restore-default-message"
100
+ value="<?php _ex( 'restore default', 'singular', 'strong-testimonials' ); ?>"
101
+ data-target-id="<?php esc_attr_e( $elid ); ?>"/>
102
+ </td>
103
+ </tr>
104
 
105
  <?php endforeach; ?>
106
 
107
+ <tr>
108
+ <td colspan="3">
109
+ <input type="button" id="restore-default-messages" class="button"
110
+ name="restore-default-messages"
111
+ value="<?php _e( 'Restore Default Messages', 'strong-testimonials' ); ?>"/>
112
+ </td>
113
+ </tr>
114
  </table>
115
 
116
  <table class="form-table" cellpadding="0" cellspacing="0">
117
+ <tr>
118
+ <th scope="row" class="tall">
119
+ <?php _e( 'Scroll', 'strong-testimonials' ); ?>
120
+ </th>
121
+ <td>
122
+ <fieldset>
123
+ <div>
124
+ <label>
125
+ <input type="checkbox"
126
+ name="wpmtst_form_options[scrolltop_error]" <?php checked( $form_options['scrolltop_error'] ); ?>/>
127
+ <?php printf( __( 'If errors, scroll to the first error minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_error_offset]" value="' . $form_options['scrolltop_error_offset'] . '" size="3">' ); ?>
128
+ </label>
129
+ </div>
130
+ <div>
131
+ <label class="block">
132
+ <input type="checkbox"
133
+ name="wpmtst_form_options[scrolltop_success]" <?php checked( $form_options['scrolltop_success'] ); ?>/>
134
+ <?php printf( __( 'If success, scroll to the success message minus %s pixels. On by default.', 'strong-testimonials' ), '<input type="text" name="wpmtst_form_options[scrolltop_success_offset]" value="' . $form_options['scrolltop_success_offset'] . '" size="3">' ); ?>
135
+ </label>
136
+ </div>
137
+ </fieldset>
138
+ </td>
139
+ </tr>
140
  </table>
141
 
142
  <?php
147
  */
148
  ?>
149
  <hr>
150
+ <h3><?php _e( 'Form Actions', 'strong-testimonials' ); ?></h3>
151
 
152
  <table class="form-table" cellpadding="0" cellspacing="0">
153
+ <tr>
154
+ <th scope="row">
155
+ <label for="redirect-page">
156
+ <?php _e( 'Upon Successful Submission', 'strong-testimonials' ); ?>
157
+ </label>
158
+ </th>
159
+ <td>
160
+ <div>
161
+ <label class="success-action">
162
+ <input type="radio"
163
+ name="wpmtst_form_options[success_action]"
164
+ value="message" <?php checked( 'message', $form_options['success_action'] ); ?>/> <?php _e( 'display message', 'strong-testimonials' ); ?>
165
+ </label>
166
+ </div>
167
+
168
+ <div>
169
+ <label class="success-action">
170
+ <input type="radio"
171
+ name="wpmtst_form_options[success_action]"
172
+ value="id" <?php checked( 'id', $form_options['success_action'] ); ?>/> <?php _e( 'redirect to a page', 'strong-testimonials' ); ?>
173
+ </label>
174
+
175
+ <select id="redirect-page" name="wpmtst_form_options[success_redirect_id]">
176
+
177
+ <option value=""><?php _e( '&mdash; select a page &mdash;' ); ?></option>
178
 
179
  <?php foreach ( $pages_list as $pages ) : ?>
180
 
181
+ <option value="<?php echo $pages->ID; ?>" <?php selected( isset( $form_options['success_redirect_id'] ) ? $form_options['success_redirect_id'] : 0, $pages->ID ); ?>>
182
+ <?php echo $pages->post_title; ?>
183
+ </option>
184
 
185
  <?php endforeach; ?>
186
 
187
+ </select>
188
+
189
+ <div style="display: inline-block; text-indent: 20px;">
190
+ <label>
191
+ <?php _ex( 'or enter its ID or slug', 'to select a redirect page', 'strong-testimonials' ); ?>
192
+ &nbsp;
193
+ <input type="text"
194
+ id="redirect-page-2"
195
+ name="wpmtst_form_options[success_redirect_2]"
196
+ size="30">
197
+ </label>
198
+ </div>
199
+ </div>
200
+
201
+ <div>
202
+ <label class="success-action">
203
+ <input type="radio"
204
+ name="wpmtst_form_options[success_action]"
205
+ value="url" <?php checked( 'url', $form_options['success_action'] ); ?>/> <?php _e( 'redirect to a URL', 'strong-testimonials' ); ?>
206
+ </label>
207
+ <label>
208
+ <input type="text" id="redirect-page-3"
209
+ name="wpmtst_form_options[success_redirect_url]"
210
+ value="<?php echo $form_options['success_redirect_url']; ?>" size="75"/>
211
+ </label>
212
+ </div>
213
+
214
+ </td>
215
+ </tr>
216
+
217
+ <tr>
218
+ <th scope="row">
219
+ <label>
220
+ <?php _e( 'Post Status', 'strong-testimonials' ); ?>
221
+ </label>
222
+ </th>
223
+ <td>
224
+ <ul class="compact">
225
+ <li>
226
+ <label>
227
+ <input type="radio" name="wpmtst_form_options[post_status]" value="pending"
228
+ <?php checked( 'pending', $form_options['post_status'] ); ?>/>
229
+ <?php _e( 'Pending', 'strong-testimonials' ); ?>
230
+ </label>
231
+ </li>
232
+ <li>
233
+ <label>
234
+ <input type="radio" name="wpmtst_form_options[post_status]" value="publish"
235
+ <?php checked( 'publish', $form_options['post_status'] ); ?>/>
236
+ <?php _e( 'Published' ); ?>
237
+ </label>
238
+ </li>
239
+ </ul>
240
+ </td>
241
+ </tr>
242
+
243
+ <tr>
244
+ <th scope="row">
245
+ <label for="wpmtst-options-admin-notify">
246
+ <?php _e( 'Notification Email', 'strong-testimonials' ); ?>
247
+ </label>
248
+ </th>
249
+
250
+ <td>
251
+ <div class="match-height">
252
+ <fieldset>
253
+ <label for="wpmtst-options-admin-notify">
254
+ <input id="wpmtst-options-admin-notify" type="checkbox" name="wpmtst_form_options[admin_notify]"
255
+ <?php checked( $form_options['admin_notify'] ); ?>/>
256
+ <?php _e( 'Send an email upon new testimonial submission.', 'strong-testimonials' ); ?>
257
+ </label>
258
+ </fieldset>
259
+ </div>
260
+ <div class="email-container"
261
+ id="admin-notify-fields" <?php echo ( $form_options['admin_notify'] ) ? '' : 'style="display: none;"'; ?>>
262
  <?php
263
+ include 'email-from.php';
264
+ include 'email-to.php';
265
+ include 'email.php';
266
  do_action( 'wpmtst_after_notification_fields', 'notification' );
267
  ?>
268
+ </div>
269
+ </td>
270
+ </tr>
271
  </table>
272
 
273
  <?php
278
  */
279
  ?>
280
  <hr>
281
+ <h3><?php _e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
282
 
283
  <table class="form-table" cellpadding="0" cellspacing="0">
284
+ <tr>
285
+ <th scope="row">
286
+ <label>
287
+ <?php _ex( 'Honeypot', 'spam control techniques', 'strong-testimonials' ); ?>
288
+ </label>
289
+ </th>
290
+ <td>
291
+ <p>
292
+ <?php _e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
293
+ </p>
294
+ <p>
295
+ <?php _e( 'However, honeypots may not be compatible with WP-SpamShield, Ajax page loading, caching or minification.', 'strong-testimonials' ); ?>
296
+ </p>
297
+ <p>
298
+ <?php _e( 'If your form is not working properly, try disabling these.', 'strong-testimonials' ); ?>
299
+ </p>
300
  <?php // TODO Add link to article that explains Ajax page loading. ?>
301
+ <ul>
302
+ <li class="checkbox">
303
+ <label>
304
+ <input type="checkbox"
305
+ name="wpmtst_form_options[honeypot_before]" <?php checked( $form_options['honeypot_before'] ); ?>/>
306
+ <?php _e( 'Before', 'strong-testimonials' ); ?>
307
+ </label>
308
+ <p class="description"><?php _e( 'Adds a new empty field that is invisible to humans. Spambots tend to fill in every field they find in the form. Empty field = human. Not empty = spambot.', 'strong-testimonials' ); ?></p>
309
+ </li>
310
+ <li class="checkbox">
311
+ <label>
312
+ <input type="checkbox"
313
+ name="wpmtst_form_options[honeypot_after]" <?php checked( $form_options['honeypot_after'] ); ?>/>
314
+ <?php _e( 'After', 'strong-testimonials' ); ?>
315
+ </label>
316
+ <p class="description"><?php _e( 'Adds a new field as soon as the form is submitted. Spambots cannot run JavaScript so the new field never gets added. New field = human. Missing = spambot.', 'strong-testimonials' ); ?></p>
317
+ </li>
318
+ </ul>
319
+ </td>
320
+ </tr>
321
+ <tr valign="top">
322
+ <th scope="row">
323
+ <label>
324
+ <a name="captcha-section"></a><?php _e( 'Captcha', 'strong-testimonials' ); ?>
325
+ </label>
326
+ </th>
327
+ <td class="stackem">
328
+ <p>
329
+ <?php _e( 'Enable Captcha using one of these plugins. Be sure to configure any plugins first, if necessary.', 'strong-testimonials' ); ?>
330
+ <?php _e( 'May be used alongside honeypot methods.', 'strong-testimonials' ); ?>
331
+ </p>
332
+ <p>
333
+ <?php _e( 'May not be compatible with Ajax page loading.', 'strong-testimonials' ); ?>
334
+ </p>
335
+ <ul>
336
+ <li>
337
+ <label>
338
+ <input type="radio"
339
+ name="wpmtst_form_options[captcha]" <?php checked( '', $form_options['captcha'] ); ?>
340
+ value=""/> none
341
+ </label>
342
+ </li>
343
 
344
  <?php foreach ( $plugins as $key => $plugin ) : ?>
345
+ <li>
346
+ <label class="inline <?php if ( ! $plugin['active'] ) echo 'disabled'; ?>">
347
+ <input type="radio"
348
+ name="wpmtst_form_options[captcha]" <?php disabled( ! $plugin['active'] ); ?><?php checked( $key, $form_options['captcha'] ); ?>
349
+ value="<?php echo $key; ?>"/>
350
+ <?php echo $plugin['name']; ?>
351
+ </label>
 
 
 
352
 
353
  <?php if ( isset( $plugin['installed'] ) && $plugin['installed'] ) : // installed ?>
354
 
355
  <?php if ( $plugin['active'] ) : // active ?>
356
 
357
  <?php if ( isset( $plugin['settings'] ) && $plugin['settings'] ) : ?>
358
+ <span class="link"><a href="<?php echo $plugin['settings']; ?>"><?php _ex( 'settings', 'link', 'strong-testimonials' ); ?></a></span>
359
  <?php else : ?>
360
+ <span class="notice"><?php _e( 'no settings', 'strong-testimonials' ); ?></span>
361
  <?php endif; ?>
362
 
363
  <?php else : // inactive ?>
364
 
365
+ <span class="notice disabled"><?php _ex( 'inactive', 'adjective', 'strong-testimonials' ); ?></span>
366
 
367
  <?php endif; ?>
368
+ |
369
 
370
  <?php else : // not installed ?>
371
 
372
+ <span class="notice disabled">(<?php _e( 'not installed', 'strong-testimonials' ); ?>)</span>
373
 
374
+ <?php if ( isset( $plugin['search'] ) && $plugin['search'] ) : ?>
375
+ <span class="link"><a href="<?php echo $plugin['search']; ?>"><?php _ex( 'install plugin', 'link', 'strong-testimonials' ); ?></a></span>
376
+ |
377
+ <?php endif; ?>
378
 
379
  <?php endif; // whether installed ?>
380
 
381
+ <span class="link"><a href="<?php echo $plugin['url']; ?>" target="_blank"><?php _ex( 'plugin page', 'link', 'strong-testimonials' ); ?></a></span>
382
 
383
  <?php if ( isset( $plugin['desc'] ) && $plugin['desc'] ) : ?>
384
+ <p class="description <?php if ( isset( $plugin['style'] ) ) echo $plugin['style']; ?>"><?php echo $plugin['desc']; ?></p>
 
 
 
 
 
 
385
  <?php endif; ?>
386
+ </li>
387
  <?php endforeach; ?>
388
+ </ul>
389
+ </td>
390
+ </tr>
391
  </table>
admin/settings/partials/general.php CHANGED
@@ -7,20 +7,20 @@
7
 
8
  $options = get_option( 'wpmtst_options' );
9
  ?>
10
- <h2><?php esc_html_e( 'Admin', 'strong-testimonials' ); ?></h2>
11
 
12
  <table class="form-table" cellpadding="0" cellspacing="0">
13
 
14
  <tr valign="top">
15
  <th scope="row">
16
- <?php esc_html_e( 'Pending Indicator', 'strong-testimonials' ); ?>
17
  </th>
18
  <td>
19
  <fieldset>
20
  <label>
21
  <input type="checkbox" name="wpmtst_options[pending_indicator]" <?php checked( $options['pending_indicator'] ); ?>>
22
- <?php esc_html_e( 'Show indicator bubble when new submissions are awaiting moderation.', 'strong-testimonials' ); ?>
23
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
24
  </label>
25
  </fieldset>
26
  </td>
@@ -28,32 +28,32 @@ $options = get_option( 'wpmtst_options' );
28
 
29
  <tr valign="top">
30
  <th scope="row">
31
- <?php esc_html_e( 'Reordering', 'strong-testimonials' ); ?>
32
  </th>
33
  <td>
34
  <fieldset>
35
  <label>
36
  <input type="checkbox" name="wpmtst_options[reorder]" <?php checked( $options['reorder'] ); ?>>
37
- <?php esc_html_e( 'Enable drag-and-drop reordering in the testimonial list.', 'strong-testimonials' ); ?>
38
- <?php esc_html_e( 'Off by default.', 'strong-testimonials' ); ?>
39
  </label>
40
- <p class="description"><?php esc_html_e( 'Then set Order to "menu order" in the View.', 'strong-testimonials' ); ?></p>
41
  </fieldset>
42
  </td>
43
  </tr>
44
 
45
  <tr valign="top">
46
  <th scope="row">
47
- <?php esc_html_e( 'Custom Fields Meta Box', 'strong-testimonials' ); ?>
48
  </th>
49
  <td>
50
  <fieldset>
51
  <label>
52
  <input type="checkbox" name="wpmtst_options[support_custom_fields]" <?php checked( $options['support_custom_fields'] ); ?>>
53
- <?php echo wp_kses_post( _e( 'Show the <strong>Custom Fields</strong> meta box in the testimonial post editor. This does not affect the <strong>Client Details</strong> meta box.', 'strong-testimonials' ) ); ?>
54
- <?php esc_html_e( 'Off by default.', 'strong-testimonials' ); ?>
55
  </label>
56
- <p class="description"><?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?></p>
57
  </fieldset>
58
  </td>
59
  </tr>
@@ -61,36 +61,36 @@ $options = get_option( 'wpmtst_options' );
61
  </table>
62
 
63
  <hr/>
64
- <h2><?php esc_html_e( 'Output', 'strong-testimonials' ); ?></h2>
65
 
66
  <table class="form-table" cellpadding="0" cellspacing="0">
67
 
68
  <tr valign="top">
69
  <th scope="row">
70
- <?php esc_html_e( 'Enable Touch', 'strong-testimonials' ); ?>
71
  </th>
72
  <td>
73
  <fieldset>
74
  <label>
75
  <input type="checkbox" name="wpmtst_options[touch_enabled]" <?php checked( $options['touch_enabled'] ); ?>>
76
- <?php esc_html_e( 'Enable touch swipe navigation in slideshows.', 'strong-testimonials' ); ?>
77
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
78
  </label>
79
- <p class="description"><?php esc_html_e( 'If you are having trouble scrolling long testimonials on a small screen, try disabling this.', 'strong-testimonials' ); ?></p>
80
  </fieldset>
81
  </td>
82
  </tr>
83
 
84
  <tr valign="top">
85
  <th scope="row">
86
- <?php esc_html_e( 'Scroll Top', 'strong-testimonials' ); ?>
87
  </th>
88
  <td>
89
  <fieldset>
90
  <label>
91
  <input type="checkbox" name="wpmtst_options[scrolltop]" <?php checked( $options['scrolltop'] ); ?>>
92
- <?php echo wp_kses_post( printf( __( 'When a new page is selected in paginated Views, scroll to the top of the container minus %s pixels.', 'strong-testimonials' ), '<input type="text" name="wpmtst_options[scrolltop_offset]" value="' . $options['scrolltop_offset'] . '" size="3">' ) ); ?>
93
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
94
  </label>
95
  </fieldset>
96
  </td>
@@ -98,14 +98,14 @@ $options = get_option( 'wpmtst_options' );
98
 
99
  <tr valign="top">
100
  <th scope="row">
101
- <?php esc_html_e( 'Remove Whitespace', 'strong-testimonials' ); ?>
102
  </th>
103
  <td>
104
  <fieldset>
105
  <label>
106
  <input type="checkbox" name="wpmtst_options[remove_whitespace]" <?php checked( $options['remove_whitespace'] ); ?>>
107
- <?php echo wp_kses_post( _e( 'Remove space between HTML tags in View output to prevent double paragraphs <em>(wpautop)</em>.', 'strong-testimonials' ) ); ?>
108
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
109
  </label>
110
  </fieldset>
111
  </td>
@@ -113,137 +113,112 @@ $options = get_option( 'wpmtst_options' );
113
 
114
  <tr valign="top">
115
  <th scope="row">
116
- <?php esc_html_e( 'Comments', 'strong-testimonials' ); ?>
117
  </th>
118
  <td>
119
  <fieldset>
120
- <label>
121
- <input type="checkbox" name="wpmtst_options[support_comments]" <?php checked( $options['support_comments'] ); ?>>
122
- <?php esc_html_e( 'Allow comments on testimonials. Requires using your theme\'s single post template.', 'strong-testimonials' ); ?>
123
- <?php esc_html_e( 'Off by default.', 'strong-testimonials' ); ?>
124
- </label>
125
  </fieldset>
126
- <p class="description"><?php esc_html_e( 'To enable comments:', 'strong-testimonials' ); ?></p>
127
  <ul class="description">
128
- <li><?php echo wp_kses_post( _e( 'For individual testimonials, use the <strong>Discussion</strong> meta box in the post editor or <strong>Quick Edit</strong> in the testimonial list.', 'strong-testimonials' ) ); ?></li>
129
- <li><?php echo wp_kses_post( _e( 'For multiple testimonials, use <strong>Bulk Edit</strong> in the testimonial list.', 'strong-testimonials' ) ); ?></li>
130
  </ul>
131
  </td>
132
  </tr>
133
 
134
  <tr valign="top">
135
  <th scope="row">
136
- <?php esc_html_e( 'Embed Width', 'strong-testimonials' ); ?>
137
- </th>
138
- <td>
139
- <fieldset>
140
- <?php
141
- printf(
142
- /* Translators: %s is an input field. */
143
- esc_html__( 'For embedded links (YouTube, Twitter, etc.) set the frame width to %s pixels.', 'strong-testimonials' ),
144
- '<input type="text" name="wpmtst_options[embed_width]" value="' . esc_attr( $options['embed_width'] ) . '" size="3">'
145
- );
146
- ?>
147
- <p class="description"><?php esc_html_e( 'Leave empty for default width (usually 100% for videos). Height will be calculated automatically. This setting only applies to Views.', 'strong-testimonials' ); ?></p>
148
- <p class="description">
149
- <?php
150
- printf(
151
- '<a href="%s" target="_blank">%s</a>',
152
- esc_url( 'https://codex.wordpress.org/Embeds' ),
153
- esc_html__( 'More on embeds', 'strong-testimonials' )
154
- );
155
- ?>
156
- </p>
157
- </fieldset>
158
- </td>
159
- </tr>
160
-
161
- <tr valign="top">
162
- <th scope="row">
163
- <?php esc_html_e( 'Load Font Awesome', 'strong-testimonials' ); ?>
164
- </th>
165
- <td>
166
- <fieldset>
167
- <label>
168
- <input type="checkbox" name="wpmtst_options[load_font_awesome]" <?php checked( $options['load_font_awesome'] ); ?>>
169
- <?php
170
- echo wp_kses_post(
171
- printf(
172
- __( 'Load the icon font necessary for star ratings %1$s, slideshow controls %2$s, and some template quotation marks %3$s. ', 'strong-testimonials' ),
173
- '<i class="fa fa-star example" aria-hidden="true"></i>',
174
- '<i class="fa fa-play example" aria-hidden="true"></i>',
175
- '<i class="fa fa-quote-left example" aria-hidden="true"></i>'
176
- )
177
- );
178
- ?>
179
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
180
- </label>
181
- <p class="description">
182
- <?php esc_html_e( 'Some reasons to disable this:', 'strong-testimonials' ); ?>
183
- </p>
184
- <ul class="description">
185
- <li>
186
- <?php esc_html_e( 'Your theme or another plugin also loads Font Awesome and you want to make your site more efficient by only loading one copy.', 'strong-testimonials' ); ?>
187
- <?php
188
- echo wp_kses_post(
189
- printf(
190
- 'Try <a href="%s" target="_blank">%s</a> for even more control.',
191
- esc_url( 'https://wordpress.org/plugins/better-font-awesome/' ),
192
- __( 'Better Font Awesome', 'strong-testimonials' )
193
- )
194
- );
195
-
196
- ?>
197
- </li>
198
- <li><?php esc_html_e( 'You are overriding the icon CSS with images or another icon font.', 'strong-testimonials' ); ?></li>
199
- <li><?php esc_html_e( 'You have no need for stars, slideshow controls, or quotation mark icons.', 'strong-testimonials' ); ?></li>
200
- <li><?php esc_html_e( 'You know what you\'re doing.', 'strong-testimonials' ); ?></li>
201
- </ul>
202
- </fieldset>
203
- </td>
204
- </tr>
205
-
206
- <tr valign="top">
207
- <th scope="row">
208
- <?php esc_html_e( 'Nofollow Links', 'strong-testimonials' ); ?>
209
  </th>
210
  <td>
211
  <fieldset>
212
- <label>
213
- <input type="checkbox" name="wpmtst_options[nofollow]" <?php checked( $options['nofollow'] ); ?>>
214
- <?php echo wp_kses_post( _e( 'Add <code>rel="nofollow"</code> to URL custom fields.', 'strong-testimonials' ) ); ?>
215
- <?php esc_html_e( 'Off by default.', 'strong-testimonials' ); ?>
216
- </label>
217
- <p class="description">
218
- <?php
219
- printf(
220
- 'To edit this value on your existing testimonials in bulk, try <a href="%s" target="_blank">%s</a> and set <code>nofollow</code> to <b>default</b>, <b>yes</b> or <b>no</b>.',
221
- esc_url( 'https://wordpress.org/plugins/custom-field-bulk-editor/' ),
222
- esc_html__( 'Custom Field Bulk Editor', 'strong-testimonials' )
223
- );
224
- ?>
225
- </p>
226
  </fieldset>
227
  </td>
228
  </tr>
229
 
230
- <?php if ( wpmtst_is_plugin_active( 'lazy-loading-responsive-images' ) ) : ?>
231
- <tr valign="top">
232
- <th scope="row">
233
- <?php esc_html_e( 'No Lazy Loading', 'strong-testimonials' ); ?>
234
- </th>
235
- <td>
236
- <fieldset>
237
- <label>
238
- <input type="checkbox" name="wpmtst_options[no_lazyload]" <?php checked( $options['no_lazyload'] ); ?>>
239
- <?php echo wp_kses_post( printf( __( 'Exclude from <a href="%s" target="_blank">Lazy Loading Responsive Images</a> plugin.', 'strong-testimonials' ), esc_url( 'https://wordpress.org/plugins/lazy-loading-responsive-images/' ) ) ); ?>
240
- <?php esc_html_e( 'On by default.', 'strong-testimonials' ); ?>
241
- </label>
242
- </fieldset>
243
- </td>
244
- </tr>
245
- <?php else : ?>
246
- <input type="hidden" name="wpmtst_options[no_lazyload]" value="<?php echo esc_attr( $options['no_lazyload'] ); ?>">
247
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  </table>
7
 
8
  $options = get_option( 'wpmtst_options' );
9
  ?>
10
+ <h2><?php _e( 'Admin', 'strong-testimonials' ); ?></h2>
11
 
12
  <table class="form-table" cellpadding="0" cellspacing="0">
13
 
14
  <tr valign="top">
15
  <th scope="row">
16
+ <?php _e( 'Pending Indicator', 'strong-testimonials' ); ?>
17
  </th>
18
  <td>
19
  <fieldset>
20
  <label>
21
  <input type="checkbox" name="wpmtst_options[pending_indicator]" <?php checked( $options['pending_indicator'] ); ?>>
22
+ <?php _e( 'Show indicator bubble when new submissions are awaiting moderation.', 'strong-testimonials' ); ?>
23
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
24
  </label>
25
  </fieldset>
26
  </td>
28
 
29
  <tr valign="top">
30
  <th scope="row">
31
+ <?php _e( 'Reordering', 'strong-testimonials' ); ?>
32
  </th>
33
  <td>
34
  <fieldset>
35
  <label>
36
  <input type="checkbox" name="wpmtst_options[reorder]" <?php checked( $options['reorder'] ); ?>>
37
+ <?php _e( 'Enable drag-and-drop reordering in the testimonial list.', 'strong-testimonials' ); ?>
38
+ <?php _e( 'Off by default.', 'strong-testimonials' ); ?>
39
  </label>
40
+ <p class="description"><?php _e( 'Then set <b>Order</b> to "menu order" in the View.', 'strong-testimonials' ); ?></p>
41
  </fieldset>
42
  </td>
43
  </tr>
44
 
45
  <tr valign="top">
46
  <th scope="row">
47
+ <?php _e( 'Custom Fields Meta Box', 'strong-testimonials' ); ?>
48
  </th>
49
  <td>
50
  <fieldset>
51
  <label>
52
  <input type="checkbox" name="wpmtst_options[support_custom_fields]" <?php checked( $options['support_custom_fields'] ); ?>>
53
+ <?php _e( 'Show the <strong>Custom Fields</strong> meta box in the testimonial post editor. This does not affect the <strong>Client Details</strong> meta box.', 'strong-testimonials' ); ?>
54
+ <?php _e( 'Off by default.', 'strong-testimonials' ); ?>
55
  </label>
56
+ <p class="description"><?php _e( 'For advanced users.', 'strong-testimonials' ); ?></p>
57
  </fieldset>
58
  </td>
59
  </tr>
61
  </table>
62
 
63
  <hr/>
64
+ <h2><?php _e( 'Output', 'strong-testimonials' ); ?></h2>
65
 
66
  <table class="form-table" cellpadding="0" cellspacing="0">
67
 
68
  <tr valign="top">
69
  <th scope="row">
70
+ <?php _e( 'Enable Touch', 'strong-testimonials' ); ?>
71
  </th>
72
  <td>
73
  <fieldset>
74
  <label>
75
  <input type="checkbox" name="wpmtst_options[touch_enabled]" <?php checked( $options['touch_enabled'] ); ?>>
76
+ <?php _e( 'Enable touch swipe navigation in slideshows.', 'strong-testimonials' ); ?>
77
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
78
  </label>
79
+ <p class="description"><?php _e( 'If you are having trouble scrolling long testimonials on a small screen, try disabling this.', 'strong-testimonials' ); ?></p>
80
  </fieldset>
81
  </td>
82
  </tr>
83
 
84
  <tr valign="top">
85
  <th scope="row">
86
+ <?php _e( 'Scroll Top', 'strong-testimonials' ); ?>
87
  </th>
88
  <td>
89
  <fieldset>
90
  <label>
91
  <input type="checkbox" name="wpmtst_options[scrolltop]" <?php checked( $options['scrolltop'] ); ?>>
92
+ <?php printf( __( 'When a new page is selected in paginated Views, scroll to the top of the container minus %s pixels.', 'strong-testimonials' ), '<input type="text" name="wpmtst_options[scrolltop_offset]" value="' . $options['scrolltop_offset'] . '" size="3">' ); ?>
93
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
94
  </label>
95
  </fieldset>
96
  </td>
98
 
99
  <tr valign="top">
100
  <th scope="row">
101
+ <?php _e( 'Remove Whitespace', 'strong-testimonials' ); ?>
102
  </th>
103
  <td>
104
  <fieldset>
105
  <label>
106
  <input type="checkbox" name="wpmtst_options[remove_whitespace]" <?php checked( $options['remove_whitespace'] ); ?>>
107
+ <?php _e( 'Remove space between HTML tags in View output to prevent double paragraphs <em>(wpautop)</em>.', 'strong-testimonials' ); ?>
108
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
109
  </label>
110
  </fieldset>
111
  </td>
113
 
114
  <tr valign="top">
115
  <th scope="row">
116
+ <?php _e( 'Comments', 'strong-testimonials' ); ?>
117
  </th>
118
  <td>
119
  <fieldset>
120
+ <label>
121
+ <input type="checkbox" name="wpmtst_options[support_comments]" <?php checked( $options['support_comments'] ); ?>>
122
+ <?php _e( 'Allow comments on testimonials. Requires using your theme\'s single post template.', 'strong-testimonials' ); ?>
123
+ <?php _e( 'Off by default.', 'strong-testimonials' ); ?>
124
+ </label>
125
  </fieldset>
126
+ <p class="description"><?php _e( 'To enable comments:', 'strong-testimonials' ); ?></p>
127
  <ul class="description">
128
+ <li><?php _e( 'For individual testimonials, use the <strong>Discussion</strong> meta box in the post editor or <strong>Quick Edit</strong> in the testimonial list.', 'strong-testimonials' ); ?></li>
129
+ <li><?php _e( 'For multiple testimonials, use <strong>Bulk Edit</strong> in the testimonial list.', 'strong-testimonials' ); ?></li>
130
  </ul>
131
  </td>
132
  </tr>
133
 
134
  <tr valign="top">
135
  <th scope="row">
136
+ <?php _e( 'Embed Width', 'strong-testimonials' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  </th>
138
  <td>
139
  <fieldset>
140
+ <?php printf(
141
+ /* Translators: %s is an input field. */
142
+ __( 'For embedded links (YouTube, Twitter, etc.) set the frame width to %s pixels.', 'strong-testimonials' ),
143
+ '<input type="text" name="wpmtst_options[embed_width]" value="' . $options['embed_width'] . '" size="3">' ); ?>
144
+ <p class="description"><?php _e( 'Leave empty for default width (usually 100% for videos). Height will be calculated automatically. This setting only applies to Views.', 'strong-testimonials' ); ?></p>
145
+ <p class="description">
146
+ <?php printf( '<a href="%s" target="_blank">%s</a>',
147
+ esc_url( 'https://codex.wordpress.org/Embeds' ),
148
+ __( 'More on embeds', 'strong-testimonials' ) ); ?>
149
+ </p>
 
 
 
 
150
  </fieldset>
151
  </td>
152
  </tr>
153
 
154
+ <tr valign="top">
155
+ <th scope="row">
156
+ <?php _e( 'Load Font Awesome', 'strong-testimonials' ); ?>
157
+ </th>
158
+ <td>
159
+ <fieldset>
160
+ <label>
161
+ <input type="checkbox" name="wpmtst_options[load_font_awesome]" <?php checked( $options['load_font_awesome'] ); ?>>
162
+ <?php printf( __( 'Load the icon font necessary for star ratings %s, slideshow controls %s, and some template quotation marks %s. ','strong-testimonials' ),
163
+ '<i class="fa fa-star example" aria-hidden="true"></i>',
164
+ '<i class="fa fa-play example" aria-hidden="true"></i>',
165
+ '<i class="fa fa-quote-left example" aria-hidden="true"></i>' ); ?>
166
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
167
+ </label>
168
+ <p class="description">
169
+ <?php _e( 'Some reasons to disable this:', 'strong-testimonials' ); ?>
170
+ </p>
171
+ <ul class="description">
172
+ <li>
173
+ <?php _e( 'Your theme or another plugin also loads Font Awesome and you want to make your site more efficient by only loading one copy.', 'strong-testimonials' ); ?>
174
+ <?php printf( 'Try <a href="%s" target="_blank">%s</a> for even more control.',
175
+ esc_url( 'https://wordpress.org/plugins/better-font-awesome/' ),
176
+ __( 'Better Font Awesome', 'strong-testimonials' ) ); ?></li>
177
+ <li><?php _e( 'You are overriding the icon CSS with images or another icon font.', 'strong-testimonials' ); ?></li>
178
+ <li><?php _e( 'You have no need for stars, slideshow controls, or quotation mark icons.', 'strong-testimonials' ); ?></li>
179
+ <li><?php _e( 'You know what you\'re doing.', 'strong-testimonials' ); ?></li>
180
+ </ul>
181
+ </fieldset>
182
+ </td>
183
+ </tr>
184
+
185
+ <tr valign="top">
186
+ <th scope="row">
187
+ <?php _e( 'Nofollow Links', 'strong-testimonials' ); ?>
188
+ </th>
189
+ <td>
190
+ <fieldset>
191
+ <label>
192
+ <input type="checkbox" name="wpmtst_options[nofollow]" <?php checked( $options['nofollow'] ); ?>>
193
+ <?php _e( 'Add <code>rel="nofollow"</code> to URL custom fields.', 'strong-testimonials' ); ?>
194
+ <?php _e( 'Off by default.', 'strong-testimonials' ); ?>
195
+ </label>
196
+ <p class="description">
197
+ <?php printf( 'To edit this value on your existing testimonials in bulk, try <a href="%s" target="_blank">%s</a> and set <code>nofollow</code> to <b>default</b>, <b>yes</b> or <b>no</b>.',
198
+ esc_url( 'https://wordpress.org/plugins/custom-field-bulk-editor/' ),
199
+ __( 'Custom Field Bulk Editor', 'strong-testimonials' ) ); ?>
200
+ </p>
201
+ </fieldset>
202
+ </td>
203
+ </tr>
204
+
205
+ <?php if ( wpmtst_is_plugin_active( 'lazy-loading-responsive-images' ) ) : ?>
206
+ <tr valign="top">
207
+ <th scope="row">
208
+ <?php _e( 'No Lazy Loading', 'strong-testimonials' ); ?>
209
+ </th>
210
+ <td>
211
+ <fieldset>
212
+ <label>
213
+ <input type="checkbox" name="wpmtst_options[no_lazyload]" <?php checked( $options['no_lazyload'] ); ?>>
214
+ <?php printf( __( 'Exclude from <a href="%s" target="_blank">Lazy Loading Responsive Images</a> plugin.', 'strong-testimonials' ), esc_url( 'https://wordpress.org/plugins/lazy-loading-responsive-images/' ) ); ?>
215
+ <?php _e( 'On by default.', 'strong-testimonials' ); ?>
216
+ </label>
217
+ </fieldset>
218
+ </td>
219
+ </tr>
220
+ <?php else : ?>
221
+ <input type="hidden" name="wpmtst_options[no_lazyload]" value="<?php echo $options['no_lazyload']; ?>">
222
+ <?php endif; ?>
223
 
224
  </table>
admin/settings/partials/licenses.php CHANGED
@@ -8,17 +8,17 @@
8
  * TODO Add link to member account on website.
9
  */
10
  ?>
11
- <h2><?php esc_html_e( 'Add-on Licenses', 'strong-testimonials' ); ?></h2>
12
  <div class="tab-header">
13
- <p><?php esc_html_e( 'Valid license keys allow you to receive automatic updates and priority support.', 'strong-testimonials' ); ?></p>
14
- <p><?php esc_html_e( 'To transfer a license to another site or to uninstall the add-on, please deactivate the license here first.', 'strong-testimonials' ); ?></p>
15
  </div>
16
  <table class="form-table">
17
  <thead>
18
  <tr>
19
- <th><?php esc_html_e( 'Add-on', 'strong-testimonials' ); ?></th>
20
- <th class="for-license-key"><?php esc_html_e( 'License Key', 'strong-testimonials' ); ?></th>
21
- <th class="for-license-status"><?php esc_html_e( 'Status', 'strong-testimonials' ); ?></th>
22
  </tr>
23
  </thead>
24
  <tbody>
8
  * TODO Add link to member account on website.
9
  */
10
  ?>
11
+ <h2><?php _e( 'Add-on Licenses', 'strong-testimonials' ); ?></h2>
12
  <div class="tab-header">
13
+ <p><?php _e( 'Valid license keys allow you to receive automatic updates and priority support.', 'strong-testimonials' ); ?></p>
14
+ <p><?php _e( 'To transfer a license to another site or to uninstall the add-on, please deactivate the license here first.', 'strong-testimonials' ); ?></p>
15
  </div>
16
  <table class="form-table">
17
  <thead>
18
  <tr>
19
+ <th><?php _e( 'Add-on', 'strong-testimonials' ); ?></th>
20
+ <th class="for-license-key"><?php _e( 'License Key', 'strong-testimonials' ); ?></th>
21
+ <th class="for-license-status"><?php _e( 'Status', 'strong-testimonials' ); ?></th>
22
  </tr>
23
  </thead>
24
  <tbody>
admin/settings/partials/recipient.php CHANGED
@@ -1,53 +1,68 @@
1
  <div class="email-option body recipient">
2
 
3
- <div class="email-option-part">
4
- <div class="email-option-fieldset">
5
- <div class="controls">
6
  <?php if ( ! isset( $recipient['primary'] ) ) : ?>
7
- <div class="delete-recipient dashicons dashicons-no"></div>
8
  <?php endif; ?>
9
- </div>
10
- <div class="fields">
11
- <input class="admin_name" type="text" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][admin_name]" value="<?php echo esc_attr( $recipient['admin_name'] ); ?>" placeholder="<?php esc_attr_e( '(optional)', 'strong-testimonials' ); ?>">
12
- </div>
13
- </div>
14
- </div>
15
-
16
- <div class="email-option-part">
 
 
 
 
17
  <?php if ( isset( $recipient['primary'] ) ) : ?>
18
 
19
- <div class="email-option-fieldset primary-1">
20
- <div class="controls">
21
- <input type="hidden" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][primary]" value="1">
22
- <input type="radio" id="wpmtst-options-admin-site-email-1" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][admin_site_email]" <?php checked( $recipient['admin_site_email'], 1 ); ?> value="1">
23
- </div>
24
- <div class="fields">
25
- <label for="wpmtst-options-admin-site-email-1">
26
- <?php esc_html_e( 'admin:', 'strong-testimonials' ); ?>
27
- &nbsp;<?php echo wp_kses_post( get_bloginfo( 'admin_email' ) ); ?>
28
- </label>
29
- </div>
30
- </div>
31
-
32
- <div class="email-option-fieldset primary-2">
33
- <div class="controls">
34
- <input class="focus-next-field" type="radio" id="wpmtst-options-admin-site-email-0" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][admin_site_email]" <?php checked( $recipient['admin_site_email'], 0 ); ?> value="0">
35
- </div>
36
- <div class="fields">
37
- <input type="email" id="wpmtst-options-admin-email" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][admin_email]" value="<?php echo esc_attr( $recipient['admin_email'] ); ?>" placeholder="<?php esc_attr_e( 'email address', 'strong-testimonials' ); ?>">
38
- </div>
39
- </div>
 
 
 
 
 
 
 
 
40
 
41
  <?php else : ?>
42
 
43
- <div class="email-option-fieldset secondary">
44
- <div class="controls"></div>
45
- <div class="fields">
46
- <input type="email" name="wpmtst_form_options[recipients][<?php echo esc_attr( $key ); ?>][admin_email]" value="<?php echo esc_attr( $recipient['admin_email'] ); ?>" placeholder="<?php esc_attr_e( 'email address', 'strong-testimonials' ); ?>">
47
- </div>
48
- </div>
 
 
 
49
 
50
  <?php endif; ?>
51
- </div>
52
 
53
  </div>
1
  <div class="email-option body recipient">
2
 
3
+ <div class="email-option-part">
4
+ <div class="email-option-fieldset">
5
+ <div class="controls">
6
  <?php if ( ! isset( $recipient['primary'] ) ) : ?>
7
+ <div class="delete-recipient dashicons dashicons-no"></div>
8
  <?php endif; ?>
9
+ </div>
10
+ <div class="fields">
11
+ <input class="admin_name"
12
+ type="text"
13
+ name="wpmtst_form_options[recipients][<?php echo $key; ?>][admin_name]"
14
+ value="<?php echo esc_attr( $recipient['admin_name'] ); ?>"
15
+ placeholder="<?php _e( '(optional)', 'strong-testimonials' ); ?>">
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="email-option-part">
21
  <?php if ( isset( $recipient['primary'] ) ) : ?>
22
 
23
+ <div class="email-option-fieldset primary-1">
24
+ <div class="controls">
25
+ <input type="hidden" name="wpmtst_form_options[recipients][<?php echo $key; ?>][primary]" value="1">
26
+ <input type="radio" id="wpmtst-options-admin-site-email-1"
27
+ name="wpmtst_form_options[recipients][<?php echo $key; ?>][admin_site_email]" <?php checked( $recipient['admin_site_email'], 1 ); ?>
28
+ value="1">
29
+ </div>
30
+ <div class="fields">
31
+ <label for="wpmtst-options-admin-site-email-1">
32
+ <?php _e( 'admin:', 'strong-testimonials' ); ?>
33
+ &nbsp;<?php echo get_bloginfo( 'admin_email' ); ?>
34
+ </label>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="email-option-fieldset primary-2">
39
+ <div class="controls">
40
+ <input class="focus-next-field" type="radio"
41
+ id="wpmtst-options-admin-site-email-0"
42
+ name="wpmtst_form_options[recipients][<?php echo $key; ?>][admin_site_email]" <?php checked( $recipient['admin_site_email'], 0 ); ?>
43
+ value="0">
44
+ </div>
45
+ <div class="fields">
46
+ <input type="email" id="wpmtst-options-admin-email"
47
+ name="wpmtst_form_options[recipients][<?php echo $key; ?>][admin_email]"
48
+ value="<?php echo esc_attr( $recipient['admin_email'] ); ?>"
49
+ placeholder="<?php _e( 'email address', 'strong-testimonials' ); ?>">
50
+ </div>
51
+ </div>
52
 
53
  <?php else : ?>
54
 
55
+ <div class="email-option-fieldset secondary">
56
+ <div class="controls"></div>
57
+ <div class="fields">
58
+ <input type="email"
59
+ name="wpmtst_form_options[recipients][<?php echo $key; ?>][admin_email]"
60
+ value="<?php echo esc_attr( $recipient['admin_email'] ); ?>"
61
+ placeholder="<?php _e( 'email address', 'strong-testimonials' ); ?>">
62
+ </div>
63
+ </div>
64
 
65
  <?php endif; ?>
66
+ </div>
67
 
68
  </div>
admin/view-list-order.php CHANGED
@@ -7,13 +7,13 @@
7
  * Save
8
  */
9
  function wpmtst_save_view_list_order() {
10
- $name = $_REQUEST['name'];
11
- $order = $_REQUEST['order'];
12
  $success = '';
13
  if ( in_array( $name, array( 'name', 'id' ) ) ) {
14
  $success = update_user_meta( get_current_user_id(), 'strong_view_list_order', array( $name, $order ) );
15
  }
16
- echo wp_kses_post( $success );
17
  wp_die();
18
  }
19
  add_action( 'wp_ajax_wpmtst_save_view_list_order', 'wpmtst_save_view_list_order' );
@@ -31,7 +31,8 @@ function wpmtst_fetch_view_list_order() {
31
  && isset( $_GET['page'] )
32
  && 'testimonial-views' == $_GET['page']
33
  && ! isset( $_GET['orderby'] )
34
- && ! isset( $_GET['action'] ) ) {
 
35
  $order = get_user_meta( get_current_user_id(), 'strong_view_list_order', true );
36
  if ( $order ) {
37
  $url = admin_url( "edit.php?post_type=wpm-testimonial&page=testimonial-views&orderby={$order[0]}&order={$order[1]}" );
7
  * Save
8
  */
9
  function wpmtst_save_view_list_order() {
10
+ $name = $_REQUEST['name'];
11
+ $order = $_REQUEST['order'];
12
  $success = '';
13
  if ( in_array( $name, array( 'name', 'id' ) ) ) {
14
  $success = update_user_meta( get_current_user_id(), 'strong_view_list_order', array( $name, $order ) );
15
  }
16
+ echo $success;
17
  wp_die();
18
  }
19
  add_action( 'wp_ajax_wpmtst_save_view_list_order', 'wpmtst_save_view_list_order' );
31
  && isset( $_GET['page'] )
32
  && 'testimonial-views' == $_GET['page']
33
  && ! isset( $_GET['orderby'] )
34
+ && ! isset( $_GET['action'] ) )
35
+ {
36
  $order = get_user_meta( get_current_user_id(), 'strong_view_list_order', true );
37
  if ( $order ) {
38
  $url = admin_url( "edit.php?post_type=wpm-testimonial&page=testimonial-views&orderby={$order[0]}&order={$order[1]}" );
admin/views-ajax.php CHANGED
@@ -10,7 +10,7 @@
10
  * @since 1.25.0
11
  */
12
  function wpmtst_force_check() {
13
- $atts = array( 'template' => $_REQUEST['template'] );
14
  $force = WPMST()->templates->get_template_config( $atts, 'force', false );
15
  if ( $force ) {
16
  wp_send_json_success( (array) $force );
@@ -26,12 +26,8 @@ add_action( 'wp_ajax_wpmtst_force_check', 'wpmtst_force_check' );
26
  * @since 1.21.0
27
  */
28
  function wpmtst_view_add_field_function() {
29
- $new_key = (int) $_REQUEST['key'];
30
- $empty_field = array(
31
- 'field' => '',
32
- 'type' => 'text',
33
- 'class' => '',
34
- );
35
  wpmtst_view_field_inputs( $new_key, $empty_field, true );
36
  wp_die();
37
  }
@@ -47,11 +43,7 @@ function wpmtst_view_add_field_link_function() {
47
  $key = (int) $_REQUEST['key'];
48
  $field_name = $_REQUEST['fieldName'];
49
  $type = $_REQUEST['fieldType'];
50
- $empty_field = array(
51
- 'url' => '',
52
- 'link_text' => '',
53
- 'new_tab' => true,
54
- );
55
  wpmtst_view_field_link( $key, $field_name, $type, $empty_field );
56
  wp_die();
57
  }
@@ -66,7 +58,7 @@ add_action( 'wp_ajax_wpmtst_view_add_field_link', 'wpmtst_view_add_field_link_fu
66
  function wpmtst_view_get_label_function() {
67
  $field = array( 'field' => $_REQUEST['name'] );
68
  $label = wpmtst_get_field_label( $field );
69
- echo wp_kses_post( $label );
70
  wp_die();
71
  }
72
  add_action( 'wp_ajax_wpmtst_view_get_label', 'wpmtst_view_get_label_function' );
@@ -78,7 +70,7 @@ add_action( 'wp_ajax_wpmtst_view_get_label', 'wpmtst_view_get_label_function' );
78
  * @since 1.21.0
79
  */
80
  function wpmtst_view_add_field_date_function() {
81
- $key = (int) $_REQUEST['key'];
82
  $empty_field = array( 'format' => '' );
83
  wpmtst_view_field_date( $key, $empty_field );
84
  wp_die();
@@ -92,10 +84,10 @@ add_action( 'wp_ajax_wpmtst_view_add_field_date', 'wpmtst_view_add_field_date_fu
92
  * @since 2.22.0
93
  */
94
  function wpmtst_view_get_mode_description() {
95
- $mode = $_REQUEST['mode'];
96
  $options = get_option( 'wpmtst_view_options' );
97
  if ( isset( $options['mode'][ $mode ]['description'] ) ) {
98
- echo wp_kses_post( $options['mode'][ $mode ]['description'] );
99
  }
100
  wp_die();
101
  }
@@ -119,7 +111,7 @@ add_action( 'wp_ajax_wpmtst_get_background_preset_colors', 'wpmtst_get_backgroun
119
  * @since 2.32.2
120
  */
121
  function wpmtst_restore_default_breakpoints_function() {
122
- $options = Strong_Testimonials_Defaults::get_default_view();
123
  $breakpoints = $options['slideshow_settings']['breakpoints'];
124
  echo json_encode( $breakpoints );
125
  wp_die();
10
  * @since 1.25.0
11
  */
12
  function wpmtst_force_check() {
13
+ $atts = array( 'template' => $_REQUEST['template'] );
14
  $force = WPMST()->templates->get_template_config( $atts, 'force', false );
15
  if ( $force ) {
16
  wp_send_json_success( (array) $force );
26
  * @since 1.21.0
27
  */
28
  function wpmtst_view_add_field_function() {
29
+ $new_key = (int) $_REQUEST['key'];
30
+ $empty_field = array( 'field' => '', 'type' => 'text', 'class' => '' );
 
 
 
 
31
  wpmtst_view_field_inputs( $new_key, $empty_field, true );
32
  wp_die();
33
  }
43
  $key = (int) $_REQUEST['key'];
44
  $field_name = $_REQUEST['fieldName'];
45
  $type = $_REQUEST['fieldType'];
46
+ $empty_field = array( 'url' => '', 'link_text' => '', 'new_tab' => true );
 
 
 
 
47
  wpmtst_view_field_link( $key, $field_name, $type, $empty_field );
48
  wp_die();
49
  }
58
  function wpmtst_view_get_label_function() {
59
  $field = array( 'field' => $_REQUEST['name'] );
60
  $label = wpmtst_get_field_label( $field );
61
+ echo $label;
62
  wp_die();
63
  }
64
  add_action( 'wp_ajax_wpmtst_view_get_label', 'wpmtst_view_get_label_function' );
70
  * @since 1.21.0
71
  */
72
  function wpmtst_view_add_field_date_function() {
73
+ $key = (int) $_REQUEST['key'];
74
  $empty_field = array( 'format' => '' );
75
  wpmtst_view_field_date( $key, $empty_field );
76
  wp_die();
84
  * @since 2.22.0
85
  */
86
  function wpmtst_view_get_mode_description() {
87
+ $mode = $_REQUEST['mode'];
88
  $options = get_option( 'wpmtst_view_options' );
89
  if ( isset( $options['mode'][ $mode ]['description'] ) ) {
90
+ echo $options['mode'][ $mode ]['description'];
91
  }
92
  wp_die();
93
  }
111
  * @since 2.32.2
112
  */
113
  function wpmtst_restore_default_breakpoints_function() {
114
+ $options = Strong_Testimonials_Defaults::get_default_view();
115
  $breakpoints = $options['slideshow_settings']['breakpoints'];
116
  echo json_encode( $breakpoints );
117
  wp_die();
admin/views-validate.php CHANGED
@@ -10,10 +10,10 @@
10
  *
11
  * @return string
12
  */
13
- function wpmtst_validate_view_name( $name, $view_id ) {
14
  if ( '' == $name ) {
15
  $name = "Testimonial View $view_id";
16
- } else {
17
  $name = sanitize_text_field( stripslashes( $name ) );
18
  }
19
 
@@ -74,16 +74,17 @@ function wpmtst_sanitize_view( $input ) {
74
  // Limit
75
  if ( isset( $input['all'] ) && $input['all'] ) {
76
  $data['count'] = -1;
77
- } else {
78
- $data['count'] = (int) sanitize_text_field( $input['count'] );
 
79
  }
80
 
81
  // Pagination
82
  $data['pagination'] = isset( $input['pagination'] ) ? 1 : 0;
83
  $data['pagination_settings'] = wpmtst_sanitize_view_pagination( $input['pagination_settings'] );
84
 
85
- $data['title'] = isset( $input['title'] ) ? 1 : 0;
86
- $data['title_link'] = isset( $input['title_link'] ) ? 1 : 0;
87
 
88
  $data['content'] = sanitize_text_field( $input['content'] );
89
  $data['excerpt_length'] = (int) sanitize_text_field( $input['excerpt_length'] );
@@ -111,7 +112,8 @@ function wpmtst_sanitize_view( $input ) {
111
  $data['background'] = wpmtst_get_background_defaults();
112
  if ( ! isset( $input['background']['type'] ) ) {
113
  $data['background']['type'] = '';
114
- } else {
 
115
  $data['background']['type'] = sanitize_text_field( $input['background']['type'] );
116
  }
117
  $data['background']['color'] = sanitize_hex_color( $input['background']['color'] );
@@ -122,7 +124,8 @@ function wpmtst_sanitize_view( $input ) {
122
  // Font color
123
  if ( ! isset( $input['font-color']['type'] ) ) {
124
  $data['font-color']['type'] = '';
125
- } else {
 
126
  $data['font-color']['type'] = sanitize_text_field( $input['font-color']['type'] );
127
  }
128
  $data['font-color']['color'] = sanitize_hex_color( $input['font-color']['color'] );
@@ -130,7 +133,8 @@ function wpmtst_sanitize_view( $input ) {
130
  // Layout input may have been disabled by selecting the widget template so no value is posted.
131
  if ( ! isset( $input['layout'] ) ) {
132
  $data['layout'] = '';
133
- } else {
 
134
  // pagination and Masonry are incompatible
135
  $data['layout'] = sanitize_text_field( $input['layout'] );
136
  if ( isset( $input['pagination'] ) && 'masonry' == $data['layout'] ) {
@@ -151,7 +155,8 @@ function wpmtst_sanitize_view( $input ) {
151
  // Multiple Forms add-on
152
  if ( isset( $input['form_id'] ) ) {
153
  $data['form_id'] = $input['form_id'];
154
- } else {
 
155
  // hidden
156
  $data['form_id'] = $input['_form_id'];
157
  }
@@ -210,24 +215,12 @@ function wpmtst_sanitize_view_readmore( $data, $input, $default_view ) {
210
  // is post ID?
211
  $id = sanitize_text_field( $input['more_page_id2'] );
212
  if ( is_numeric( $id ) ) {
213
- if ( ! get_posts(
214
- array(
215
- 'p' => $id,
216
- 'post_type' => array( 'page', 'post' ),
217
- 'post_status' => 'publish',
218
- )
219
- ) ) {
220
  $id = null;
221
  }
222
  } else {
223
  // is post slug?
224
- $target = get_posts(
225
- array(
226
- 'name' => $id,
227
- 'post_type' => array( 'page', 'post' ),
228
- 'post_status' => 'publish',
229
- )
230
- );
231
  if ( $target ) {
232
  $id = $target[0]->ID;
233
  }
@@ -237,6 +230,7 @@ function wpmtst_sanitize_view_readmore( $data, $input, $default_view ) {
237
  $data['more_page_id'] = $id;
238
  unset( $data['more_page_id2'] );
239
  }
 
240
  } else {
241
 
242
  if ( $input['more_page_id'] ) {
@@ -246,6 +240,7 @@ function wpmtst_sanitize_view_readmore( $data, $input, $default_view ) {
246
  $data['more_page_id'] = sanitize_text_field( $input['more_page_id'] );
247
  }
248
  }
 
249
  }
250
 
251
  // Only enable more_page if a page was selected by either method.
@@ -304,9 +299,10 @@ function wpmtst_sanitize_view_post_id( $data, $input ) {
304
  if ( ! get_posts( $args ) ) {
305
  $id = null;
306
  }
307
- } else {
 
308
  // Is post slug?
309
- $args = array(
310
  'name' => $input['post_id'],
311
  'post_type' => 'wpm-testimonial',
312
  'post_status' => 'publish',
@@ -347,19 +343,22 @@ function wpmtst_sanitize_view_pagination( $in ) {
347
  */
348
  if ( isset( $in['end_size'] ) && intval( $in['end_size'] ) ) {
349
  $out['end_size'] = (int) sanitize_text_field( $in['end_size'] );
350
- } else {
 
351
  $out['end_size'] = 1;
352
  }
353
 
354
  if ( isset( $in['mid_size'] ) && intval( $in['mid_size'] ) ) {
355
  $out['mid_size'] = (int) sanitize_text_field( $in['mid_size'] );
356
- } else {
 
357
  $out['mid_size'] = 2;
358
  }
359
 
360
  if ( isset( $in['per_page'] ) && intval( $in['per_page'] ) ) {
361
  $out['per_page'] = (int) sanitize_text_field( $in['per_page'] );
362
- } else {
 
363
  $out['per_page'] = 5;
364
  }
365
 
@@ -377,7 +376,7 @@ function wpmtst_sanitize_view_pagination( $in ) {
377
  function wpmtst_sanitize_view_slideshow( $in ) {
378
  $out = array();
379
 
380
- $out['type'] = sanitize_text_field( $in['type'] );
381
 
382
  // Insert unused defaults.
383
  $out['show_single'] = array(
@@ -391,9 +390,9 @@ function wpmtst_sanitize_view_slideshow( $in ) {
391
 
392
  foreach ( $breakpoints as $key => $breakpoint ) {
393
 
394
- $out['breakpoints'][ $key ]['width'] = intval( sanitize_text_field( $breakpoint['width'] ) );
395
 
396
- $out['breakpoints'][ $key ]['max_slides'] = intval( sanitize_text_field( $breakpoint['max_slides'] ) );
397
 
398
  $out['breakpoints'][ $key ]['move_slides'] = intval( sanitize_text_field( $breakpoint['move_slides'] ) );
399
 
@@ -497,7 +496,8 @@ function wpmtst_sanitize_view_client_section( $in ) {
497
  unset( $out[ $key ]['link_text'] );
498
  unset( $out[ $key ]['link_text_custom'] );
499
  unset( $out[ $key ]['new_tab'] );
500
- } else {
 
501
  $out[ $key ]['url'] = sanitize_text_field( $field['url'] );
502
 
503
  $out[ $key ]['link_text'] = isset( $field['link_text'] ) ? sanitize_text_field( $field['link_text'] ) : '';
@@ -508,11 +508,12 @@ function wpmtst_sanitize_view_client_section( $in ) {
508
  }
509
  break;
510
  case 'date':
511
- $format = isset( $field['format'] ) ? sanitize_text_field( $field['format'] ) : '';
512
  $out[ $key ]['format'] = $format;
513
  break;
514
  default:
515
  }
 
516
  }
517
 
518
  return $out;
10
  *
11
  * @return string
12
  */
13
+ function wpmtst_validate_view_name( $name, $view_id ){
14
  if ( '' == $name ) {
15
  $name = "Testimonial View $view_id";
16
+ }else {
17
  $name = sanitize_text_field( stripslashes( $name ) );
18
  }
19
 
74
  // Limit
75
  if ( isset( $input['all'] ) && $input['all'] ) {
76
  $data['count'] = -1;
77
+ }
78
+ else {
79
+ $data['count'] = (int) sanitize_text_field( $input['count'] );
80
  }
81
 
82
  // Pagination
83
  $data['pagination'] = isset( $input['pagination'] ) ? 1 : 0;
84
  $data['pagination_settings'] = wpmtst_sanitize_view_pagination( $input['pagination_settings'] );
85
 
86
+ $data['title'] = isset( $input['title'] ) ? 1 : 0;
87
+ $data['title_link'] = isset( $input['title_link'] ) ? 1 : 0;
88
 
89
  $data['content'] = sanitize_text_field( $input['content'] );
90
  $data['excerpt_length'] = (int) sanitize_text_field( $input['excerpt_length'] );
112
  $data['background'] = wpmtst_get_background_defaults();
113
  if ( ! isset( $input['background']['type'] ) ) {
114
  $data['background']['type'] = '';
115
+ }
116
+ else {
117
  $data['background']['type'] = sanitize_text_field( $input['background']['type'] );
118
  }
119
  $data['background']['color'] = sanitize_hex_color( $input['background']['color'] );
124
  // Font color
125
  if ( ! isset( $input['font-color']['type'] ) ) {
126
  $data['font-color']['type'] = '';
127
+ }
128
+ else {
129
  $data['font-color']['type'] = sanitize_text_field( $input['font-color']['type'] );
130
  }
131
  $data['font-color']['color'] = sanitize_hex_color( $input['font-color']['color'] );
133
  // Layout input may have been disabled by selecting the widget template so no value is posted.
134
  if ( ! isset( $input['layout'] ) ) {
135
  $data['layout'] = '';
136
+ }
137
+ else {
138
  // pagination and Masonry are incompatible
139
  $data['layout'] = sanitize_text_field( $input['layout'] );
140
  if ( isset( $input['pagination'] ) && 'masonry' == $data['layout'] ) {
155
  // Multiple Forms add-on
156
  if ( isset( $input['form_id'] ) ) {
157
  $data['form_id'] = $input['form_id'];
158
+ }
159
+ else {
160
  // hidden
161
  $data['form_id'] = $input['_form_id'];
162
  }
215
  // is post ID?
216
  $id = sanitize_text_field( $input['more_page_id2'] );
217
  if ( is_numeric( $id ) ) {
218
+ if ( ! get_posts( array( 'p' => $id, 'post_type' => array( 'page', 'post' ), 'post_status' => 'publish' ) ) ) {
 
 
 
 
 
 
219
  $id = null;
220
  }
221
  } else {
222
  // is post slug?
223
+ $target = get_posts( array( 'name' => $id, 'post_type' => array( 'page', 'post' ), 'post_status' => 'publish' ) );
 
 
 
 
 
 
224
  if ( $target ) {
225
  $id = $target[0]->ID;
226
  }
230
  $data['more_page_id'] = $id;
231
  unset( $data['more_page_id2'] );
232
  }
233
+
234
  } else {
235
 
236
  if ( $input['more_page_id'] ) {
240
  $data['more_page_id'] = sanitize_text_field( $input['more_page_id'] );
241
  }
242
  }
243
+
244
  }
245
 
246
  // Only enable more_page if a page was selected by either method.
299
  if ( ! get_posts( $args ) ) {
300
  $id = null;
301
  }
302
+ }
303
+ else {
304
  // Is post slug?
305
+ $args = array(
306
  'name' => $input['post_id'],
307
  'post_type' => 'wpm-testimonial',
308
  'post_status' => 'publish',
343
  */
344
  if ( isset( $in['end_size'] ) && intval( $in['end_size'] ) ) {
345
  $out['end_size'] = (int) sanitize_text_field( $in['end_size'] );
346
+ }
347
+ else {
348
  $out['end_size'] = 1;
349
  }
350
 
351
  if ( isset( $in['mid_size'] ) && intval( $in['mid_size'] ) ) {
352
  $out['mid_size'] = (int) sanitize_text_field( $in['mid_size'] );
353
+ }
354
+ else {
355
  $out['mid_size'] = 2;
356
  }
357
 
358
  if ( isset( $in['per_page'] ) && intval( $in['per_page'] ) ) {
359
  $out['per_page'] = (int) sanitize_text_field( $in['per_page'] );
360
+ }
361
+ else {
362
  $out['per_page'] = 5;
363
  }
364
 
376
  function wpmtst_sanitize_view_slideshow( $in ) {
377
  $out = array();
378
 
379
+ $out['type'] = sanitize_text_field( $in['type'] );
380
 
381
  // Insert unused defaults.
382
  $out['show_single'] = array(
390
 
391
  foreach ( $breakpoints as $key => $breakpoint ) {
392
 
393
+ $out['breakpoints'][ $key ]['width'] = intval( sanitize_text_field( $breakpoint['width'] ) );
394
 
395
+ $out['breakpoints'][ $key ]['max_slides'] = intval( sanitize_text_field( $breakpoint['max_slides'] ) );
396
 
397
  $out['breakpoints'][ $key ]['move_slides'] = intval( sanitize_text_field( $breakpoint['move_slides'] ) );
398
 
496
  unset( $out[ $key ]['link_text'] );
497
  unset( $out[ $key ]['link_text_custom'] );
498
  unset( $out[ $key ]['new_tab'] );
499
+ }
500
+ else {
501
  $out[ $key ]['url'] = sanitize_text_field( $field['url'] );
502
 
503
  $out[ $key ]['link_text'] = isset( $field['link_text'] ) ? sanitize_text_field( $field['link_text'] ) : '';
508
  }
509
  break;
510
  case 'date':
511
+ $format = isset( $field['format'] ) ? sanitize_text_field( $field['format'] ) : '';
512
  $out[ $key ]['format'] = $format;
513
  break;
514
  default:
515
  }
516
+
517
  }
518
 
519
  return $out;
admin/views.php CHANGED
@@ -12,9 +12,8 @@
12
  * @since 1.21.0
13
  */
14
  function wpmtst_views_admin() {
15
- if ( ! current_user_can( 'strong_testimonials_views' ) ) {
16
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) );
17
- }
18
 
19
  $tags = array(
20
  'a' => array(
@@ -39,17 +38,18 @@ function wpmtst_views_admin() {
39
  );
40
 
41
  if ( in_array( $result, array_keys( $result_messages ) ) ) {
42
- printf( '<div class="notice notice-success is-dismissible"><p>%s</p></div>', wp_kses_post( $result_messages[ $result ] ) );
43
  }
 
44
  }
45
 
46
  if ( isset( $_REQUEST['error'] ) ) {
47
 
48
- echo '<h1>' . esc_html__( 'Edit View', 'strong-testimonials' ) . '</h1>';
49
 
50
- $message = esc_html__( 'An error occurred.', 'strong-testimonials' );
51
 
52
- wp_die( sprintf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_post( $message ) ) );
53
 
54
  }
55
 
@@ -63,13 +63,13 @@ function wpmtst_views_admin() {
63
  } else {
64
 
65
  /**
66
- * View list
67
- */
68
  ?>
69
  <h1>
70
- <?php esc_html_e( 'Views', 'strong-testimonials' ); ?>
71
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views&action=add' ) ); ?>" class="add-new-h2"><?php esc_html_e( 'Add New' ); ?></a>
72
- <a href="#tab-panel-wpmtst-help-views" class="add-new-h2 open-help-tab"><?php esc_html_e( 'Help' ); ?></a>
73
  </h1>
74
 
75
  <?php
@@ -79,14 +79,14 @@ function wpmtst_views_admin() {
79
  // Add button to clear sort value.
80
  if ( isset( $_GET['orderby'] ) ) {
81
  ?>
82
- <form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post" style="margin-bottom: 4px;">
83
- <input type="hidden" name="action" value="clear-view-sort">
84
- <input type="submit" value="clear sort" class="button">
85
- </form>
86
  <?php
87
  }
88
 
89
- // Display the table
90
  $views_table = new Strong_Views_List_Table();
91
  $views_table->prepare_list( wpmtst_unserialize_views( $views ) );
92
  $views_table->display();
@@ -110,12 +110,10 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
110
 
111
  $actions = array( 'edit', 'duplicate', 'add' );
112
  if ( ! in_array( $action, $actions ) ) {
113
- wp_die( esc_html__( 'Invalid request. Please try again.', 'strong-testimonials' ) );
114
  }
115
 
116
- if ( ( 'edit' == $action || 'duplicate' == $action ) && ! $view_id ) {
117
- return;
118
- }
119
 
120
  global $view;
121
  add_thickbox();
@@ -123,16 +121,14 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
123
  $fields = wpmtst_get_custom_fields();
124
  $all_fields = wpmtst_get_all_fields();
125
 
126
- $testimonials_list = get_posts(
127
- array(
128
- 'orderby' => 'post_date',
129
- 'order' => 'ASC',
130
- 'post_type' => 'wpm-testimonial',
131
- 'post_status' => 'publish',
132
- 'posts_per_page' => -1,
133
- 'suppress_filters' => true,
134
- )
135
- );
136
 
137
  $cat_count = wpmtst_get_cat_count();
138
 
@@ -182,7 +178,7 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
182
  $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
183
 
184
  // Select default template if necessary
185
- if ( ! $view['template'] ) {
186
  if ( 'form' == $view['mode'] ) {
187
  $view['template'] = 'default-form';
188
  } else {
@@ -193,7 +189,7 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
193
  $view_cats_array = apply_filters( 'wpmtst_l10n_cats', explode( ',', $view['category'] ) );
194
 
195
  // Assemble list of templates
196
- $templates = array(
197
  'display' => WPMST()->templates->get_templates( 'display' ),
198
  'form' => WPMST()->templates->get_templates( 'form' ),
199
  );
@@ -203,20 +199,20 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
203
  // Get list of image sizes
204
  $image_sizes = wpmtst_get_image_sizes();
205
 
206
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' );
207
  $url1 = $url . '&action=add';
208
  $url2 = $url . '&action=duplicate&id=' . $view_id;
209
  ?>
210
  <h1>
211
- <?php 'edit' == $action ? esc_html_e( 'Edit View', 'strong-testimonials' ) : esc_html_e( 'Add View', 'strong-testimonials' ); ?>
212
- <a href="<?php echo esc_url( $url1 ); ?>" class="add-new-h2"><?php esc_html_e( 'Add New' ); ?></a>
213
- <a href="<?php echo esc_url( $url ); ?>" class="add-new-h2"><?php esc_html_e( 'Return To List', 'strong-testimonials' ); ?></a>
214
- <?php if ( 'edit' == $action ) : ?>
215
- <a href="<?php echo esc_url( $url2 ); ?>" class="add-new-h2"><?php esc_html_e( 'Duplicate This View', 'strong-testimonials' ); ?></a>
216
- <?php endif; ?>
217
  </h1>
218
 
219
- <form id="wpmtst-views-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
220
 
221
  <?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
222
 
@@ -225,36 +221,36 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
225
  <input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $view['mode'] ); ?>">
226
  <input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $view['form_id'] ); ?>">
227
 
228
- <div class="table view-info">
229
- <?php include 'partials/views/view-name.php'; ?>
230
- <?php include 'partials/views/view-shortcode.php'; ?>
231
- <?php include 'partials/views/view-mode.php'; ?>
232
- </div>
233
 
234
- <?php
235
  // TODO Generify both hook and include
236
  do_action( 'wpmtst_view_editor_before_group_select' );
237
- include 'partials/views/group-query.php';
238
 
239
  do_action( 'wpmtst_view_editor_before_group_slideshow' );
240
- include 'partials/views/group-slideshow.php';
241
 
242
  do_action( 'wpmtst_view_editor_before_group_fields' );
243
- include 'partials/views/group-fields.php';
244
 
245
  do_action( 'wpmtst_view_editor_before_group_form' );
246
- include 'partials/views/group-form.php';
247
 
248
  do_action( 'wpmtst_view_editor_before_group_extra' );
249
- include 'partials/views/group-extra.php';
250
 
251
  do_action( 'wpmtst_view_editor_before_group_style' );
252
- include 'partials/views/group-style.php';
253
 
254
  do_action( 'wpmtst_view_editor_before_group_compat' );
255
- include 'partials/views/group-compat.php';
256
 
257
- // For back-compat. General group no longer used.
258
  do_action( 'wpmtst_view_editor_before_group_general' );
259
 
260
  do_action( 'wpmtst_view_editor_after_groups' );
@@ -288,8 +284,8 @@ function wpmtst_view_edit_form() {
288
  exit;
289
  }
290
 
291
- $view_id = abs( filter_var( $_POST['view']['id'], FILTER_SANITIZE_NUMBER_INT ) );
292
- $view_name = wpmtst_validate_view_name( $_POST['view']['name'], $view_id );
293
 
294
  if ( isset( $_POST['reset'] ) ) {
295
 
@@ -301,10 +297,10 @@ function wpmtst_view_edit_form() {
301
  // Restore defaults
302
  $default_view = wpmtst_get_view_default();
303
 
304
- $view = array(
305
  'id' => $view_id,
306
  'name' => $view_name,
307
- 'data' => $default_view,
308
  );
309
  $success = wpmtst_save_view( $view ); // num_rows
310
 
@@ -313,10 +309,11 @@ function wpmtst_view_edit_form() {
313
  } else {
314
  $goback = add_query_arg( 'result', 'error', $goback );
315
  }
 
316
  } elseif ( isset( $_POST['submit-form'] ) ) {
317
 
318
  // Sanitize & validate
319
- $view = array(
320
  'id' => $view_id,
321
  'name' => $view_name,
322
  'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
@@ -328,6 +325,7 @@ function wpmtst_view_edit_form() {
328
  } else {
329
  $goback = add_query_arg( 'result', 'error', $goback );
330
  }
 
331
  } else {
332
 
333
  $goback = add_query_arg( 'result', 'error', $goback );
@@ -364,7 +362,7 @@ function wpmtst_view_add_form() {
364
  // Restore defaults
365
  $default_view = wpmtst_get_view_default();
366
 
367
- $view = array(
368
  'id' => $view_id,
369
  'name' => $view_name,
370
  'data' => $default_view,
@@ -376,7 +374,7 @@ function wpmtst_view_add_form() {
376
  } elseif ( isset( $_POST['submit-form'] ) ) {
377
 
378
  // Sanitize & validate
379
- $view = array(
380
  'id' => 0,
381
  'name' => $view_name,
382
  'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
@@ -387,20 +385,13 @@ function wpmtst_view_add_form() {
387
 
388
  } else {
389
 
390
- $success = false;
391
  $query_arg = 'error';
392
 
393
  }
394
 
395
  if ( $success ) {
396
- $goback = add_query_arg(
397
- array(
398
- 'action' => 'edit',
399
- 'id' => $success,
400
- 'result' => $query_arg,
401
- ),
402
- $goback
403
- );
404
  } else {
405
  $goback = add_query_arg( 'result', 'error', $goback );
406
  }
@@ -490,8 +481,8 @@ function wpmtst_view_field_inputs( $key, $field, $adding = false ) {
490
  $builtin_fields = wpmtst_get_builtin_fields();
491
 
492
  $all_fields = array(
493
- __( 'custom', 'strong-testimonials' ) => $custom_fields,
494
- __( 'built-in', 'strong-testimonials' ) => $builtin_fields,
495
  );
496
 
497
  $allowed = array( 'custom', 'optional', 'builtin' );
@@ -510,127 +501,110 @@ function wpmtst_view_field_inputs( $key, $field, $adding = false ) {
510
  if ( isset( $custom_fields[ $field['field'] ] ) ) {
511
  $field_label = $custom_fields[ $field['field'] ]['label'];
512
  } else {
513
- $field_label = ucwords( str_replace( '_', ' ', $field['field'] ) );
514
  }
515
 
516
  /**
517
  * Catch and highlight fields not found in custom fields; i.e. it has been deleted.
518
  *
519
- * @since 2.17.0
520
  */
521
- $all_field_names = array_merge( array_keys( $custom_fields ), array( 'post_date', 'submit_date', 'category' ) );
522
- $label_class = '';
523
  if ( ! $adding && ! in_array( $field['field'], $all_field_names ) ) {
524
- $field_label .= ' < ERROR - not found >';
525
- $label_class = 'error';
526
  }
527
  ?>
528
- <div id="field-<?php echo esc_attr( $key ); ?>" class="field2">
529
 
530
- <div class="field3" data-key="<?php echo esc_attr( $key ); ?>">
531
 
532
- <div class="link" title="<?php esc_attr_e( 'click to open or close', 'strong-testimonials' ); ?>">
533
 
534
- <a href="#" class="field-description <?php echo esc_attr( $label_class ); ?>"><?php echo esc_html( $field_label ); ?></a>
535
 
536
  <div class="controls2 left">
537
- <span class="handle ui-sortable-handle icon-wrap" title="<?php esc_attr_e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
538
- <span class="delete icon-wrap" title="<?php esc_attr_e( 'remove this field', 'strong-testimonials' ); ?>"></span>
 
 
539
  </div>
540
 
541
  <div class="controls2 right">
542
- <span class="toggle icon-wrap" title="<?php esc_attr_e( 'click to open or close', 'strong-testimonials' ); ?>"></span>
 
543
  </div>
544
 
545
  </div>
546
 
547
  <div class="field-properties" style="display: none;">
548
 
549
- <!-- FIELD NAME -->
550
- <div class="field-property field-name">
551
- <label for="client_section_<?php echo esc_attr( $key ); ?>_field">
552
- <?php esc_html_e( 'Name', 'strong-testimonials' ); ?>
553
- </label>
554
- <select id="client_section_<?php echo esc_attr( $key ); ?>_field" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][field]" class="first-field">
555
- <option value="">&mdash; select a field &mdash;</option>
556
-
557
- <?php foreach ( $all_fields as $group_name => $group ) : ?>
558
- <optgroup label="<?php echo esc_attr( $group_name ); ?>">
559
-
560
- <?php foreach ( $group as $key2 => $field2 ) : ?>
561
- <?php if ( in_array( $field2['record_type'], $allowed ) && 'email' != $field2['input_type'] ) : ?>
562
- <option value="<?php echo esc_attr( $field2['name'] ); ?>" data-type="<?php echo esc_attr( $field2['input_type'] ); ?>"
563
- <?php selected( $field2['name'], $field['field'] ); ?>><?php echo esc_html( $field2['name'] ); ?></option>
564
- <?php endif; ?>
565
- <?php endforeach; ?>
566
-
567
- </optgroup>
568
- <?php endforeach; ?>
569
- </select>
570
- </div>
571
-
572
- <!-- FIELD TYPE -->
573
- <div class="field-property field-type field-dep"
574
- <?php
575
- if ( $adding ) {
576
- echo ' style="display: none;"';}
577
- ?>
578
- >
579
- <label for="client_section_<?php echo esc_attr( $key ); ?>_type">
580
- <?php esc_html_e( 'Display Type', 'strong-testimonials' ); ?>
581
- </label>
582
- <select id="client_section_<?php echo esc_attr( $key ); ?>_type" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][type]">
583
- <?php foreach ( $types as $type => $type_label ) : ?>
584
- <option value="<?php echo esc_attr( $type ); ?>" <?php selected( $type, $field['type'] ); ?>><?php echo esc_html( $type_label ); ?></option>
585
- <?php endforeach; ?>
586
- </select>
587
- </div>
588
-
589
- <!-- FIELD META -->
590
- <div class="field-property-box field-meta field-dep"
591
- <?php
592
- if ( $adding ) {
593
- echo ' style="display: none;"';}
594
- ?>
595
- >
596
- <?php
597
- if ( 'link' == $field['type'] || 'link2' == $field['type'] ) {
598
- wpmtst_view_field_link( $key, $field['field'], $field['type'], $field );
599
- }
600
-
601
- if ( 'date' == $field['type'] ) {
602
- wpmtst_view_field_date( $key, $field );
603
- }
604
- ?>
605
- </div>
606
-
607
- <!-- FIELD BEFORE -->
608
- <div class="field-property field-before field-dep"
609
- <?php
610
- if ( $adding ) {
611
- echo ' style="display: none;"';}
612
- ?>
613
- >
614
- <label for="client_section_<?php echo esc_attr( $key ); ?>_before">
615
- <?php esc_html_e( 'Before', 'strong-testimonials' ); ?>
616
- </label>
617
- <input id="client_section_<?php echo esc_attr( $key ); ?>_before" type="text" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][before]" value="<?php echo isset( $field['before'] ) ? esc_attr( $field['before'] ) : ''; ?>">
618
- </div>
619
-
620
- <!-- FIELD CSS CLASS -->
621
- <div class="field-property field-css field-dep"
622
- <?php
623
- if ( $adding ) {
624
- echo ' style="display: none;"';}
625
- ?>
626
- >
627
- <label for="client_section_<?php echo esc_attr( $key ); ?>_class">
628
- <?php esc_html_e( 'CSS Class', 'strong-testimonials' ); ?>
629
- </label>
630
- <input id="client_section_<?php echo esc_attr( $key ); ?>_class" type="text" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][class]" value="<?php echo esc_attr( $field['class'] ); ?>">
631
- </div>
632
-
633
- </div>
634
 
635
  </div>
636
 
@@ -672,34 +646,34 @@ function wpmtst_view_field_link( $key, $field_name, $type, $field, $adding = fal
672
 
673
  <?php // the link text ?>
674
  <div class="flex">
675
- <label for="view-fieldtext<?php echo esc_attr( $key ); ?>"><?php esc_html_e( 'Link Text', 'strong-testimonials' ); ?></label>
676
- <select id="view-fieldtext<?php echo esc_attr( $key ); ?>" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][link_text]" class="if selectgroup">
677
- <option value="value" <?php selected( $field['link_text'], 'value' ); ?>><?php esc_html_e( "this field's value", 'strong-testimonials' ); ?></option>
678
- <option value="label" <?php selected( $field['link_text'], 'label' ); ?>><?php esc_html_e( "this field's label", 'strong-testimonials' ); ?></option>
679
- <option value="custom" <?php selected( $field['link_text'], 'custom' ); ?>><?php esc_html_e( 'custom text', 'strong-testimonials' ); ?></option>
680
  </select>
681
  </div>
682
 
683
  <?php // the link text options ?>
684
  <?php // use the field label ?>
685
- <div class="flex then_fieldtext<?php echo esc_attr( $key ); ?> then_label then_not_value then_not_custom" style="display: none;">
686
  <div class="nolabel">&nbsp;</div>
687
- <input type="text" id="view-fieldtext<?php echo esc_attr( $key ); ?>-label" value="<?php echo esc_attr( $field['label'] ); ?>" readonly>
688
  </div>
689
  <?php // use custom text ?>
690
- <div class="flex then_fieldtext<?php echo esc_attr( $key ); ?> then_custom then_not_value then_not_label" style="display: none;">
691
  <div class="nolabel">&nbsp;</div>
692
- <input type="text" id="view-fieldtext<?php echo esc_attr( $key ); ?>-custom" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][link_text_custom]" value="<?php echo esc_attr( $field['link_text_custom'] ); ?>">
693
  </div>
694
 
695
  <?php // the URL ?>
696
  <?php if ( 'link' == $type ) : // URL = another field ?>
697
  <div class="flex">
698
- <label for="view-fieldurl<?php echo esc_attr( $key ); ?>"><?php esc_html_e( 'URL Field', 'strong-testimonials' ); ?></label>
699
- <select id="view-fieldurl<?php echo esc_attr( $key ); ?>" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][url]" class="field-type-select">
700
  <?php foreach ( $custom_fields as $key2 => $field2 ) : ?>
701
  <?php if ( 'url' == $field2['input_type'] ) : ?>
702
- <option value="<?php echo esc_attr( $field2['name'] ); ?>" <?php selected( $field2['name'], $field['url'] ); ?>><?php echo esc_html( $field2['name'] ); ?></option>
703
  <?php endif; ?>
704
  <?php endforeach; ?>
705
  </select>
@@ -708,15 +682,17 @@ function wpmtst_view_field_link( $key, $field_name, $type, $field, $adding = fal
708
  <?php // the URL options ?>
709
  <div class="nolabel"></div>
710
  <div class="new_tab">
711
- <input type="checkbox" id="view-fieldurl<?php echo esc_attr( $key ); ?>-newtab" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][new_tab]" value="1" <?php checked( $field['new_tab'] ); ?>>
712
- <label for="view-fieldurl<?php echo esc_attr( $key ); ?>-newtab">
713
- <?php esc_html_e( 'new tab', 'strong-testimonials' ); ?>
 
 
714
  </label>
715
  </div>
716
 
717
  </div>
718
  <?php else : // URL = this field ?>
719
- <input type="hidden" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][url]" value="<?php echo esc_attr( $field['name'] ); ?>">
720
  <?php endif; ?>
721
 
722
  <?php
@@ -735,19 +711,15 @@ function wpmtst_view_field_link( $key, $field_name, $type, $field, $adding = fal
735
  function wpmtst_view_field_date( $key, $field, $adding = false ) {
736
  ?>
737
  <div class="flex">
738
- <label for="view-<?php echo esc_attr( $key ); ?>-client-date-format"><span><?php esc_html_e( 'Format', 'strong-testimonials' ); ?></span></label>
739
- <input id="view-<?php echo esc_attr( $key ); ?>-client-date-format" type="text" name="view[data][client_section][<?php echo esc_attr( $key ); ?>][format]" class="field-type-date" value="<?php echo isset( $field['format'] ) ? esc_attr( $field['format'] ) : ''; ?>">
740
  </div>
741
  <div class="flex">
742
  <div class="nolabel">&nbsp;</div>
743
  <div class="help minor">
744
- <?php
745
- printf(
746
- '<a href="%s" target="_blank">%s</a>',
747
  esc_url( 'https://codex.wordpress.org/Formatting_Date_and_Time' ),
748
- esc_html__( 'more about date formats', 'strong-testimonials' )
749
- );
750
- ?>
751
  </div>
752
  </div>
753
  <?php
@@ -795,19 +767,18 @@ function wpmtst_category_checklist( $view_cats_array ) {
795
  ?>
796
  <div class="view-category-list-panel short-panel">
797
  <div class="fc-search-wrap">
798
- <input type="search" class="fc-search-field" placeholder="<?php esc_attr_e( 'filter categories', 'strong-testimonials' ); ?>"/>
 
799
  </div>
800
  <ul class="view-category-list">
801
- <?php
802
- $args = array(
803
  'descendants_and_self' => 0,
804
  'selected_cats' => $view_cats_array,
805
  'popular_cats' => false,
806
  'walker' => new Walker_Strong_Category_Checklist(),
807
- 'taxonomy' => 'wpm-testimonial-category',
808
  'checked_ontop' => true,
809
- );
810
- ?>
811
  <?php wp_terms_checklist( 0, $args ); ?>
812
  </ul>
813
  </div>
@@ -824,19 +795,18 @@ function wpmtst_form_category_checklist( $view_cats_array ) {
824
  ?>
825
  <div class="view-category-list-panel short-panel">
826
  <div class="fc-search-wrap">
827
- <input type="search" class="fc-search-field" placeholder="<?php esc_attr_e( 'filter categories', 'strong-testimonials' ); ?>"/>
 
828
  </div>
829
  <ul class="view-category-list">
830
- <?php
831
- $args = array(
832
  'descendants_and_self' => 0,
833
  'selected_cats' => $view_cats_array,
834
  'popular_cats' => false,
835
  'walker' => new Walker_Strong_Form_Category_Checklist(),
836
- 'taxonomy' => 'wpm-testimonial-category',
837
  'checked_ontop' => true,
838
- );
839
- ?>
840
  <?php wp_terms_checklist( 0, $args ); ?>
841
  </ul>
842
  </div>
@@ -850,14 +820,14 @@ function wpmtst_form_category_checklist( $view_cats_array ) {
850
  * @since 2.22.0
851
  */
852
  function wpmtst_save_view_sticky() {
853
- $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
854
  $stickies = get_option( 'wpmtst_sticky_views', array() );
855
  if ( in_array( $id, $stickies ) ) {
856
- $stickies = array_diff( $stickies, array( $id ) );
857
  $is_sticky = false;
858
  } else {
859
  $stickies[] = $id;
860
- $is_sticky = true;
861
  }
862
  update_option( 'wpmtst_sticky_views', $stickies );
863
  echo json_encode( $is_sticky );
@@ -877,10 +847,10 @@ add_action( 'wp_ajax_wpmtst_save_view_sticky', 'wpmtst_save_view_sticky' );
877
  * @return string
878
  */
879
  function wpmtst_view_section_filter( $classes, $section ) {
880
- if ( 'compat' == $section && wpmtst_divi_builder_active() ) {
881
- $classes = 'then_display then_form then_slideshow then_not_single_template';
882
  }
883
 
884
- return $classes;
885
  }
886
  add_filter( 'wpmtst_view_section', 'wpmtst_view_section_filter', 10, 2 );
12
  * @since 1.21.0
13
  */
14
  function wpmtst_views_admin() {
15
+ if ( ! current_user_can( 'strong_testimonials_views' ) )
16
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
 
17
 
18
  $tags = array(
19
  'a' => array(
38
  );
39
 
40
  if ( in_array( $result, array_keys( $result_messages ) ) ) {
41
+ printf( '<div class="notice notice-success is-dismissible"><p>%s</p></div>', $result_messages[ $result ] );
42
  }
43
+
44
  }
45
 
46
  if ( isset( $_REQUEST['error'] ) ) {
47
 
48
+ echo '<h1>' . __( 'Edit View', 'strong-testimonials' ) . '</h1>';
49
 
50
+ $message = __( 'An error occurred.', 'strong-testimonials' );
51
 
52
+ wp_die( sprintf( '<div class="notice notice-error"><p>%s</p></div>', $message ) );
53
 
54
  }
55
 
63
  } else {
64
 
65
  /**
66
+ * View list
67
+ */
68
  ?>
69
  <h1>
70
+ <?php _e( 'Views', 'strong-testimonials' ); ?>
71
+ <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views&action=add' ) ); ?>" class="add-new-h2"><?php _e( 'Add New' ); ?></a>
72
+ <a href="#tab-panel-wpmtst-help-views" class="add-new-h2 open-help-tab"><?php _e( 'Help' ); ?></a>
73
  </h1>
74
 
75
  <?php
79
  // Add button to clear sort value.
80
  if ( isset( $_GET['orderby'] ) ) {
81
  ?>
82
+ <form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post" style="margin-bottom: 4px;">
83
+ <input type="hidden" name="action" value="clear-view-sort">
84
+ <input type="submit" value="clear sort" class="button">
85
+ </form>
86
  <?php
87
  }
88
 
89
+ // Display the table
90
  $views_table = new Strong_Views_List_Table();
91
  $views_table->prepare_list( wpmtst_unserialize_views( $views ) );
92
  $views_table->display();
110
 
111
  $actions = array( 'edit', 'duplicate', 'add' );
112
  if ( ! in_array( $action, $actions ) ) {
113
+ wp_die( __( 'Invalid request. Please try again.', 'strong-testimonials' ) );
114
  }
115
 
116
+ if ( ( 'edit' == $action || 'duplicate' == $action ) && ! $view_id ) return;
 
 
117
 
118
  global $view;
119
  add_thickbox();
121
  $fields = wpmtst_get_custom_fields();
122
  $all_fields = wpmtst_get_all_fields();
123
 
124
+ $testimonials_list = get_posts( array(
125
+ 'orderby' => 'post_date',
126
+ 'order' => 'ASC',
127
+ 'post_type' => 'wpm-testimonial',
128
+ 'post_status' => 'publish',
129
+ 'posts_per_page' => -1,
130
+ 'suppress_filters' => true,
131
+ ) );
 
 
132
 
133
  $cat_count = wpmtst_get_cat_count();
134
 
178
  $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
179
 
180
  // Select default template if necessary
181
+ if ( !$view['template'] ) {
182
  if ( 'form' == $view['mode'] ) {
183
  $view['template'] = 'default-form';
184
  } else {
189
  $view_cats_array = apply_filters( 'wpmtst_l10n_cats', explode( ',', $view['category'] ) );
190
 
191
  // Assemble list of templates
192
+ $templates = array(
193
  'display' => WPMST()->templates->get_templates( 'display' ),
194
  'form' => WPMST()->templates->get_templates( 'form' ),
195
  );
199
  // Get list of image sizes
200
  $image_sizes = wpmtst_get_image_sizes();
201
 
202
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' );
203
  $url1 = $url . '&action=add';
204
  $url2 = $url . '&action=duplicate&id=' . $view_id;
205
  ?>
206
  <h1>
207
+ <?php 'edit' == $action ? _e( 'Edit View', 'strong-testimonials' ) : _e( 'Add View', 'strong-testimonials' ); ?>
208
+ <a href="<?php echo esc_url( $url1 ); ?>" class="add-new-h2"><?php _e( 'Add New' ); ?></a>
209
+ <a href="<?php echo esc_url( $url ); ?>" class="add-new-h2"><?php _e( 'Return To List', 'strong-testimonials' ); ?></a>
210
+ <?php if ( 'edit' == $action ) : ?>
211
+ <a href="<?php echo esc_url( $url2 ); ?>" class="add-new-h2"><?php _e( 'Duplicate This View', 'strong-testimonials' ); ?></a>
212
+ <?php endif; ?>
213
  </h1>
214
 
215
+ <form id="wpmtst-views-form" method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>" autocomplete="off">
216
 
217
  <?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
218
 
221
  <input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $view['mode'] ); ?>">
222
  <input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $view['form_id'] ); ?>">
223
 
224
+ <div class="table view-info">
225
+ <?php include( 'partials/views/view-name.php' ); ?>
226
+ <?php include( 'partials/views/view-shortcode.php' ); ?>
227
+ <?php include( 'partials/views/view-mode.php' ); ?>
228
+ </div>
229
 
230
+ <?php
231
  // TODO Generify both hook and include
232
  do_action( 'wpmtst_view_editor_before_group_select' );
233
+ include( 'partials/views/group-query.php' );
234
 
235
  do_action( 'wpmtst_view_editor_before_group_slideshow' );
236
+ include( 'partials/views/group-slideshow.php' );
237
 
238
  do_action( 'wpmtst_view_editor_before_group_fields' );
239
+ include( 'partials/views/group-fields.php' );
240
 
241
  do_action( 'wpmtst_view_editor_before_group_form' );
242
+ include( 'partials/views/group-form.php' );
243
 
244
  do_action( 'wpmtst_view_editor_before_group_extra' );
245
+ include( 'partials/views/group-extra.php' );
246
 
247
  do_action( 'wpmtst_view_editor_before_group_style' );
248
+ include( 'partials/views/group-style.php' );
249
 
250
  do_action( 'wpmtst_view_editor_before_group_compat' );
251
+ include( 'partials/views/group-compat.php' );
252
 
253
+ // For back-compat. General group no longer used.
254
  do_action( 'wpmtst_view_editor_before_group_general' );
255
 
256
  do_action( 'wpmtst_view_editor_after_groups' );
284
  exit;
285
  }
286
 
287
+ $view_id = abs( filter_var( $_POST['view']['id'], FILTER_SANITIZE_NUMBER_INT ) );
288
+ $view_name = wpmtst_validate_view_name( $_POST['view']['name'], $view_id );
289
 
290
  if ( isset( $_POST['reset'] ) ) {
291
 
297
  // Restore defaults
298
  $default_view = wpmtst_get_view_default();
299
 
300
+ $view = array(
301
  'id' => $view_id,
302
  'name' => $view_name,
303
+ 'data' => $default_view
304
  );
305
  $success = wpmtst_save_view( $view ); // num_rows
306
 
309
  } else {
310
  $goback = add_query_arg( 'result', 'error', $goback );
311
  }
312
+
313
  } elseif ( isset( $_POST['submit-form'] ) ) {
314
 
315
  // Sanitize & validate
316
+ $view = array(
317
  'id' => $view_id,
318
  'name' => $view_name,
319
  'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
325
  } else {
326
  $goback = add_query_arg( 'result', 'error', $goback );
327
  }
328
+
329
  } else {
330
 
331
  $goback = add_query_arg( 'result', 'error', $goback );
362
  // Restore defaults
363
  $default_view = wpmtst_get_view_default();
364
 
365
+ $view = array(
366
  'id' => $view_id,
367
  'name' => $view_name,
368
  'data' => $default_view,
374
  } elseif ( isset( $_POST['submit-form'] ) ) {
375
 
376
  // Sanitize & validate
377
+ $view = array(
378
  'id' => 0,
379
  'name' => $view_name,
380
  'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
385
 
386
  } else {
387
 
388
+ $success = false;
389
  $query_arg = 'error';
390
 
391
  }
392
 
393
  if ( $success ) {
394
+ $goback = add_query_arg( array( 'action' => 'edit', 'id' => $success, 'result' => $query_arg ), $goback );
 
 
 
 
 
 
 
395
  } else {
396
  $goback = add_query_arg( 'result', 'error', $goback );
397
  }
481
  $builtin_fields = wpmtst_get_builtin_fields();
482
 
483
  $all_fields = array(
484
+ __( 'custom', 'strong-testimonials' ) => $custom_fields,
485
+ __( 'built-in', 'strong-testimonials' ) => $builtin_fields
486
  );
487
 
488
  $allowed = array( 'custom', 'optional', 'builtin' );
501
  if ( isset( $custom_fields[ $field['field'] ] ) ) {
502
  $field_label = $custom_fields[ $field['field'] ]['label'];
503
  } else {
504
+ $field_label = ucwords( str_replace( '_', ' ', $field['field'] ) );
505
  }
506
 
507
  /**
508
  * Catch and highlight fields not found in custom fields; i.e. it has been deleted.
509
  *
510
+ * @since 2.17.0
511
  */
512
+ $all_field_names = array_merge( array_keys( $custom_fields), array( 'post_date', 'submit_date', 'category' ) );
513
+ $label_class = '';
514
  if ( ! $adding && ! in_array( $field['field'], $all_field_names ) ) {
515
+ $field_label .= ' < ERROR - not found >';
516
+ $label_class = 'error';
517
  }
518
  ?>
519
+ <div id="field-<?php echo $key; ?>" class="field2">
520
 
521
+ <div class="field3" data-key="<?php echo $key; ?>">
522
 
523
+ <div class="link" title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>">
524
 
525
+ <a href="#" class="field-description <?php echo $label_class; ?>"><?php echo $field_label; ?></a>
526
 
527
  <div class="controls2 left">
528
+ <span class="handle ui-sortable-handle icon-wrap"
529
+ title="<?php _e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
530
+ <span class="delete icon-wrap"
531
+ title="<?php _e( 'remove this field', 'strong-testimonials' ); ?>"></span>
532
  </div>
533
 
534
  <div class="controls2 right">
535
+ <span class="toggle icon-wrap"
536
+ title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>"></span>
537
  </div>
538
 
539
  </div>
540
 
541
  <div class="field-properties" style="display: none;">
542
 
543
+ <!-- FIELD NAME -->
544
+ <div class="field-property field-name">
545
+ <label for="client_section_<?php echo $key; ?>_field">
546
+ <?php _e( 'Name', 'strong-testimonials' ); ?>
547
+ </label>
548
+ <select id="client_section_<?php echo $key; ?>_field" name="view[data][client_section][<?php echo $key; ?>][field]" class="first-field">
549
+ <option value="">&mdash; select a field &mdash;</option>
550
+
551
+ <?php foreach ( $all_fields as $group_name => $group ) : ?>
552
+ <optgroup label="<?php echo $group_name; ?>">
553
+
554
+ <?php foreach ( $group as $key2 => $field2 ) : ?>
555
+ <?php if ( in_array( $field2['record_type'], $allowed ) && 'email' != $field2['input_type'] ) : ?>
556
+ <option value="<?php echo $field2['name']; ?>" data-type="<?php echo $field2['input_type']; ?>"
557
+ <?php selected( $field2['name'], $field['field'] ); ?>><?php echo $field2['name']; ?></option>
558
+ <?php endif; ?>
559
+ <?php endforeach; ?>
560
+
561
+ </optgroup>
562
+ <?php endforeach; ?>
563
+ </select>
564
+ </div>
565
+
566
+ <!-- FIELD TYPE -->
567
+ <div class="field-property field-type field-dep" <?php if ( $adding ) echo ' style="display: none;"'; ?>>
568
+ <label for="client_section_<?php echo $key; ?>_type">
569
+ <?php _e( 'Display Type', 'strong-testimonials' ); ?>
570
+ </label>
571
+ <select id="client_section_<?php echo $key; ?>_type" name="view[data][client_section][<?php echo $key; ?>][type]">
572
+ <?php foreach ( $types as $type => $type_label ) : ?>
573
+ <option value="<?php echo $type; ?>" <?php selected( $type, $field['type'] ); ?>><?php echo $type_label; ?></option>
574
+ <?php endforeach; ?>
575
+ </select>
576
+ </div>
577
+
578
+ <!-- FIELD META -->
579
+ <div class="field-property-box field-meta field-dep" <?php if ( $adding ) echo ' style="display: none;"'; ?>>
580
+ <?php
581
+ if ( 'link' == $field['type'] || 'link2' == $field['type'] ) {
582
+ wpmtst_view_field_link( $key, $field['field'], $field['type'], $field );
583
+ }
584
+
585
+ if ( 'date' == $field['type'] ) {
586
+ wpmtst_view_field_date( $key, $field );
587
+ }
588
+ ?>
589
+ </div>
590
+
591
+ <!-- FIELD BEFORE -->
592
+ <div class="field-property field-before field-dep" <?php if ( $adding ) echo ' style="display: none;"'; ?>>
593
+ <label for="client_section_<?php echo $key; ?>_before">
594
+ <?php _e( 'Before', 'strong-testimonials' ); ?>
595
+ </label>
596
+ <input id="client_section_<?php echo $key; ?>_before" type="text" name="view[data][client_section][<?php echo $key; ?>][before]" value="<?php echo isset( $field['before'] ) ? $field['before'] : ''; ?>">
597
+ </div>
598
+
599
+ <!-- FIELD CSS CLASS -->
600
+ <div class="field-property field-css field-dep" <?php if ( $adding ) echo ' style="display: none;"'; ?>>
601
+ <label for="client_section_<?php echo $key; ?>_class">
602
+ <?php _e( 'CSS Class', 'strong-testimonials' ); ?>
603
+ </label>
604
+ <input id="client_section_<?php echo $key; ?>_class" type="text" name="view[data][client_section][<?php echo $key; ?>][class]" value="<?php echo $field['class']; ?>">
605
+ </div>
606
+
607
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
 
609
  </div>
610
 
646
 
647
  <?php // the link text ?>
648
  <div class="flex">
649
+ <label for="view-fieldtext<?php echo $key; ?>"><?php _e( 'Link Text', 'strong-testimonials' ); ?></label>
650
+ <select id="view-fieldtext<?php echo $key; ?>" name="view[data][client_section][<?php echo $key; ?>][link_text]" class="if selectgroup">
651
+ <option value="value" <?php selected( $field['link_text'], 'value' ); ?>><?php _e( "this field's value", 'strong-testimonials' ); ?></option>
652
+ <option value="label" <?php selected( $field['link_text'], 'label' ); ?>><?php _e( "this field's label", 'strong-testimonials' ); ?></option>
653
+ <option value="custom" <?php selected( $field['link_text'], 'custom' ); ?>><?php _e( 'custom text', 'strong-testimonials' ); ?></option>
654
  </select>
655
  </div>
656
 
657
  <?php // the link text options ?>
658
  <?php // use the field label ?>
659
+ <div class="flex then_fieldtext<?php echo $key; ?> then_label then_not_value then_not_custom" style="display: none;">
660
  <div class="nolabel">&nbsp;</div>
661
+ <input type="text" id="view-fieldtext<?php echo $key; ?>-label" value="<?php echo $field['label']; ?>" readonly>
662
  </div>
663
  <?php // use custom text ?>
664
+ <div class="flex then_fieldtext<?php echo $key; ?> then_custom then_not_value then_not_label" style="display: none;">
665
  <div class="nolabel">&nbsp;</div>
666
+ <input type="text" id="view-fieldtext<?php echo $key; ?>-custom" name="view[data][client_section][<?php echo $key; ?>][link_text_custom]" value="<?php echo $field['link_text_custom']; ?>">
667
  </div>
668
 
669
  <?php // the URL ?>
670
  <?php if ( 'link' == $type ) : // URL = another field ?>
671
  <div class="flex">
672
+ <label for="view-fieldurl<?php echo $key; ?>"><?php _e( 'URL Field', 'strong-testimonials' ); ?></label>
673
+ <select id="view-fieldurl<?php echo $key; ?>" name="view[data][client_section][<?php echo $key; ?>][url]" class="field-type-select">
674
  <?php foreach ( $custom_fields as $key2 => $field2 ) : ?>
675
  <?php if ( 'url' == $field2['input_type'] ) : ?>
676
+ <option value="<?php echo $field2['name']; ?>" <?php selected( $field2['name'], $field['url'] ); ?>><?php echo $field2['name']; ?></option>
677
  <?php endif; ?>
678
  <?php endforeach; ?>
679
  </select>
682
  <?php // the URL options ?>
683
  <div class="nolabel"></div>
684
  <div class="new_tab">
685
+ <input type="checkbox" id="view-fieldurl<?php echo $key; ?>-newtab"
686
+ name="view[data][client_section][<?php echo $key; ?>][new_tab]"
687
+ value="1" <?php checked( $field['new_tab'] ); ?>>
688
+ <label for="view-fieldurl<?php echo $key; ?>-newtab">
689
+ <?php _e( 'new tab', 'strong-testimonials' ); ?>
690
  </label>
691
  </div>
692
 
693
  </div>
694
  <?php else : // URL = this field ?>
695
+ <input type="hidden" name="view[data][client_section][<?php echo $key; ?>][url]" value="<?php echo $field['name']; ?>">
696
  <?php endif; ?>
697
 
698
  <?php
711
  function wpmtst_view_field_date( $key, $field, $adding = false ) {
712
  ?>
713
  <div class="flex">
714
+ <label for="view-<?php echo $key; ?>-client-date-format"><span><?php _e( 'Format', 'strong-testimonials' ); ?></span></label>
715
+ <input id="view-<?php echo $key; ?>-client-date-format" type="text" name="view[data][client_section][<?php echo $key; ?>][format]" class="field-type-date" value="<?php echo isset( $field['format'] ) ? $field['format'] : ''; ?>">
716
  </div>
717
  <div class="flex">
718
  <div class="nolabel">&nbsp;</div>
719
  <div class="help minor">
720
+ <?php printf( '<a href="%s" target="_blank">%s</a>',
 
 
721
  esc_url( 'https://codex.wordpress.org/Formatting_Date_and_Time' ),
722
+ __( 'more about date formats', 'strong-testimonials' ) ); ?>
 
 
723
  </div>
724
  </div>
725
  <?php
767
  ?>
768
  <div class="view-category-list-panel short-panel">
769
  <div class="fc-search-wrap">
770
+ <input type="search" class="fc-search-field"
771
+ placeholder="<?php _e( 'filter categories', 'strong-testimonials' ); ?>"/>
772
  </div>
773
  <ul class="view-category-list">
774
+ <?php $args = array(
 
775
  'descendants_and_self' => 0,
776
  'selected_cats' => $view_cats_array,
777
  'popular_cats' => false,
778
  'walker' => new Walker_Strong_Category_Checklist(),
779
+ 'taxonomy' => "wpm-testimonial-category",
780
  'checked_ontop' => true,
781
+ ); ?>
 
782
  <?php wp_terms_checklist( 0, $args ); ?>
783
  </ul>
784
  </div>
795
  ?>
796
  <div class="view-category-list-panel short-panel">
797
  <div class="fc-search-wrap">
798
+ <input type="search" class="fc-search-field"
799
+ placeholder="<?php _e( 'filter categories', 'strong-testimonials' ); ?>"/>
800
  </div>
801
  <ul class="view-category-list">
802
+ <?php $args = array(
 
803
  'descendants_and_self' => 0,
804
  'selected_cats' => $view_cats_array,
805
  'popular_cats' => false,
806
  'walker' => new Walker_Strong_Form_Category_Checklist(),
807
+ 'taxonomy' => "wpm-testimonial-category",
808
  'checked_ontop' => true,
809
+ ); ?>
 
810
  <?php wp_terms_checklist( 0, $args ); ?>
811
  </ul>
812
  </div>
820
  * @since 2.22.0
821
  */
822
  function wpmtst_save_view_sticky() {
823
+ $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
824
  $stickies = get_option( 'wpmtst_sticky_views', array() );
825
  if ( in_array( $id, $stickies ) ) {
826
+ $stickies = array_diff( $stickies, array( $id ) );
827
  $is_sticky = false;
828
  } else {
829
  $stickies[] = $id;
830
+ $is_sticky = true;
831
  }
832
  update_option( 'wpmtst_sticky_views', $stickies );
833
  echo json_encode( $is_sticky );
847
  * @return string
848
  */
849
  function wpmtst_view_section_filter( $classes, $section ) {
850
+ if ( 'compat' == $section && wpmtst_divi_builder_active() ) {
851
+ $classes = 'then_display then_form then_slideshow then_not_single_template';
852
  }
853
 
854
+ return $classes;
855
  }
856
  add_filter( 'wpmtst_view_section', 'wpmtst_view_section_filter', 10, 2 );
changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 2.35 - Feb. 12, 2019 =
2
  * fixed multiple bugs with the submission form
3
  * fixes testimonial and star rating not displaying properly
@@ -740,4 +743,4 @@
740
  * Add content area to View widget.
741
  * Improve handling of special characters in Fields editor.
742
  * Fix bug in failed Captcha when submitting form via Ajax.
743
- * Compatible with [Profit Builder](http://wpprofitbuilder.com/) plugin.
1
+ = 2.36 - Feb. 15, 2019 =
2
+ * bug fixes and tweaks
3
+
4
  = 2.35 - Feb. 12, 2019 =
5
  * fixed multiple bugs with the submission form
6
  * fixes testimonial and star rating not displaying properly
743
  * Add content area to View widget.
744
  * Improve handling of special characters in Fields editor.
745
  * Fix bug in failed Captcha when submitting form via Ajax.
746
+ * Compatible with [Profit Builder](http://wpprofitbuilder.com/) plugin.
includes/class-strong-form.php CHANGED
@@ -19,7 +19,7 @@ class Strong_Testimonials_Form {
19
  */
20
  public function __construct() {
21
  $this->form_options = get_option( 'wpmtst_form_options' );
22
- $this->plugins = apply_filters( 'wpmtst_captcha_plugins', get_option( 'wpmtst_captcha_plugins' ) );
23
  $this->add_actions();
24
  $this->load_captcha();
25
  $this->load_honeypots();
@@ -126,7 +126,7 @@ class Strong_Testimonials_Form {
126
  } else {
127
  $return = array(
128
  'success' => false,
129
- 'errors' => $this->get_form_errors(),
130
  );
131
  }
132
  echo json_encode( $return );
@@ -198,7 +198,7 @@ class Strong_Testimonials_Form {
198
  // Init four arrays: post, post_meta, categories, attachment(s).
199
  $testimonial_post = array(
200
  'post_status' => $form_options['post_status'],
201
- 'post_type' => 'wpm-testimonial',
202
  );
203
  $testimonial_meta = array();
204
  $testimonial_cats = array();
@@ -244,7 +244,8 @@ class Strong_Testimonials_Form {
244
  // Assuming value can be stored as text field
245
  $testimonial_meta[ $field['name'] ] = sanitize_text_field( $new_post[ $field['name'] ] );
246
  // TODO Register a validator callback
247
- } else {
 
248
  switch ( $field['record_type'] ) {
249
  case 'post':
250
  if ( 'file' == $field['input_type'] ) {
@@ -260,7 +261,8 @@ class Strong_Testimonials_Form {
260
  if ( 'email' == $field['input_type'] && $new_post[ $field['name'] ] ) {
261
  if ( is_email( $new_post[ $field['name'] ] ) ) {
262
  $testimonial_meta[ $field['name'] ] = sanitize_email( $new_post[ $field['name'] ] );
263
- } else {
 
264
  $form_errors[ $field['name'] ] = $field['error'];
265
  }
266
  } elseif ( 'url' == $field['input_type'] ) {
@@ -280,9 +282,11 @@ class Strong_Testimonials_Form {
280
  case 'optional':
281
  if ( 'category' == strtok( $field['input_type'], '-' ) ) {
282
  $testimonial_meta[ $field['name'] ] = $new_post[ $field['name'] ];
283
- } elseif ( 'rating' == $field['input_type'] ) {
 
284
  $testimonial_meta[ $field['name'] ] = $new_post[ $field['name'] ];
285
- } else {
 
286
  $testimonial_meta[ $field['name'] ] = sanitize_text_field( $new_post[ $field['name'] ] );
287
  }
288
  break;
@@ -290,6 +294,7 @@ class Strong_Testimonials_Form {
290
  default:
291
  }
292
  }
 
293
  }
294
 
295
  /**
@@ -346,12 +351,13 @@ class Strong_Testimonials_Form {
346
  'post_type' => 'attachment',
347
  'post_parent' => null, // populated after inserting post
348
  'post_mime_type' => $file['type'],
349
- 'guid' => $uploaded_file['url'],
350
  );
351
 
352
  $testimonial_att[ $name ]['attachment'] = $attachment;
353
  $testimonial_att[ $name ]['uploaded_file'] = $uploaded_file;
354
  }
 
355
  }
356
  }
357
  }
@@ -420,16 +426,18 @@ class Strong_Testimonials_Form {
420
  foreach ( $testimonial_att as $name => $atts ) {
421
  if ( isset( $atts['attachment'] ) ) {
422
  $atts['attachment']['post_parent'] = $testimonial_id;
423
- $attach_id = wp_insert_attachment( $atts['attachment'], $atts['uploaded_file']['file'], $testimonial_id );
424
- $attach_data = wp_generate_attachment_metadata( $attach_id, $atts['uploaded_file']['file'] );
425
- $result = wp_update_attachment_metadata( $attach_id, $attach_data );
426
  add_post_meta( $testimonial_id, $name, $atts['uploaded_file']['url'] );
427
  if ( 'featured_image' == $atts['field'] ) {
428
  set_post_thumbnail( $testimonial_id, $attach_id );
429
  }
430
  }
431
  }
 
432
  }
 
433
  }
434
 
435
  remove_filter( 'upload_mimes', array( $this, 'restrict_mime' ) );
@@ -472,7 +480,7 @@ class Strong_Testimonials_Form {
472
  * Honeypot preprocessor
473
  */
474
  public function honeypot_after() {
475
- if ( ! isset( $_POST['wpmtst_after'] ) ) {
476
  do_action( 'honeypot_after_spam_testimonial', $_POST );
477
  }
478
  }
@@ -489,7 +497,7 @@ class Strong_Testimonials_Form {
489
  } else {
490
  $message = __( 'Unknown error.', 'strong-testimonials' );
491
  }
492
- wp_die( wp_kses_post( $message ) );
493
  }
494
 
495
  /**
@@ -518,9 +526,9 @@ class Strong_Testimonials_Form {
518
  * @return array
519
  */
520
  public function handle_upload( $file_handler, $overrides ) {
521
- require_once ABSPATH . 'wp-admin/includes/image.php';
522
- require_once ABSPATH . 'wp-admin/includes/file.php';
523
- require_once ABSPATH . 'wp-admin/includes/media.php';
524
 
525
  $upload = wp_handle_upload( $file_handler, $overrides );
526
 
@@ -545,11 +553,12 @@ class Strong_Testimonials_Form {
545
  }
546
 
547
  $post['has_image'] = has_post_thumbnail( $post['id'] );
548
- $fields = wpmtst_get_all_fields();
549
 
550
  if ( $form_options['sender_site_email'] ) {
551
  $sender_email = get_bloginfo( 'admin_email' );
552
- } else {
 
553
  $sender_email = $form_options['sender_email'];
554
  }
555
 
@@ -574,38 +583,38 @@ class Strong_Testimonials_Form {
574
 
575
  if ( isset( $recipient['admin_site_email'] ) && $recipient['admin_site_email'] ) {
576
  $admin_email = get_bloginfo( 'admin_email' );
577
- } else {
 
578
  $admin_email = $recipient['admin_email'];
579
  }
580
 
581
  // Mandrill rejects the 'name <email>' format
582
  if ( $recipient['admin_name'] && ! $form_options['mail_queue'] ) {
583
  $to = sprintf( '%s <%s>', $recipient['admin_name'], $admin_email );
584
- } else {
 
585
  $to = sprintf( '%s', $admin_email );
586
  }
587
 
588
  // Headers
589
- $headers = 'MIME-Version: 1.0' . "\n";
590
  $headers .= 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"' . "\n";
591
  if ( $form_options['sender_name'] ) {
592
  $headers .= sprintf( 'From: %s <%s>', $form_options['sender_name'], $sender_email ) . "\n";
593
- } else {
 
594
  $headers .= sprintf( 'From: %s', $sender_email ) . "\n";
595
  }
596
 
597
- $email = array(
598
- 'to' => $to,
599
- 'subject' => $subject,
600
- 'message' => $message,
601
- 'headers' => $headers,
602
- );
603
 
604
  if ( $form_options['mail_queue'] ) {
605
  WPMST()->mail->enqueue_mail( $email );
606
- } else {
 
607
  WPMST()->mail->send_mail( $email );
608
  }
 
609
  } // for each recipient
610
  }
611
 
@@ -629,11 +638,14 @@ class Strong_Testimonials_Form {
629
  if ( $term && ! is_wp_error( $term ) ) {
630
  $replace = $term->name;
631
  }
632
- } elseif ( 'rating' == $field['input_type'] ) {
 
633
  $replace = $post_field . ' ' . _n( 'star', 'stars', $post_field, 'strong-testimonials' );
634
- } elseif ( 'checkbox' == $field['input_type'] ) {
 
635
  $replace = $post_field ? 'yes' : 'no';
636
- } else {
 
637
  $replace = $post_field;
638
  }
639
  }
19
  */
20
  public function __construct() {
21
  $this->form_options = get_option( 'wpmtst_form_options' );
22
+ $this->plugins = apply_filters( 'wpmtst_captcha_plugins', get_option( 'wpmtst_captcha_plugins' ) );
23
  $this->add_actions();
24
  $this->load_captcha();
25
  $this->load_honeypots();
126
  } else {
127
  $return = array(
128
  'success' => false,
129
+ 'errors' => $this->get_form_errors()
130
  );
131
  }
132
  echo json_encode( $return );
198
  // Init four arrays: post, post_meta, categories, attachment(s).
199
  $testimonial_post = array(
200
  'post_status' => $form_options['post_status'],
201
+ 'post_type' => 'wpm-testimonial'
202
  );
203
  $testimonial_meta = array();
204
  $testimonial_cats = array();
244
  // Assuming value can be stored as text field
245
  $testimonial_meta[ $field['name'] ] = sanitize_text_field( $new_post[ $field['name'] ] );
246
  // TODO Register a validator callback
247
+ }
248
+ else {
249
  switch ( $field['record_type'] ) {
250
  case 'post':
251
  if ( 'file' == $field['input_type'] ) {
261
  if ( 'email' == $field['input_type'] && $new_post[ $field['name'] ] ) {
262
  if ( is_email( $new_post[ $field['name'] ] ) ) {
263
  $testimonial_meta[ $field['name'] ] = sanitize_email( $new_post[ $field['name'] ] );
264
+ }
265
+ else {
266
  $form_errors[ $field['name'] ] = $field['error'];
267
  }
268
  } elseif ( 'url' == $field['input_type'] ) {
282
  case 'optional':
283
  if ( 'category' == strtok( $field['input_type'], '-' ) ) {
284
  $testimonial_meta[ $field['name'] ] = $new_post[ $field['name'] ];
285
+ }
286
+ elseif ( 'rating' == $field['input_type'] ) {
287
  $testimonial_meta[ $field['name'] ] = $new_post[ $field['name'] ];
288
+ }
289
+ else {
290
  $testimonial_meta[ $field['name'] ] = sanitize_text_field( $new_post[ $field['name'] ] );
291
  }
292
  break;
294
  default:
295
  }
296
  }
297
+
298
  }
299
 
300
  /**
351
  'post_type' => 'attachment',
352
  'post_parent' => null, // populated after inserting post
353
  'post_mime_type' => $file['type'],
354
+ 'guid' => $uploaded_file['url']
355
  );
356
 
357
  $testimonial_att[ $name ]['attachment'] = $attachment;
358
  $testimonial_att[ $name ]['uploaded_file'] = $uploaded_file;
359
  }
360
+
361
  }
362
  }
363
  }
426
  foreach ( $testimonial_att as $name => $atts ) {
427
  if ( isset( $atts['attachment'] ) ) {
428
  $atts['attachment']['post_parent'] = $testimonial_id;
429
+ $attach_id = wp_insert_attachment( $atts['attachment'], $atts['uploaded_file']['file'], $testimonial_id );
430
+ $attach_data = wp_generate_attachment_metadata( $attach_id, $atts['uploaded_file']['file'] );
431
+ $result = wp_update_attachment_metadata( $attach_id, $attach_data );
432
  add_post_meta( $testimonial_id, $name, $atts['uploaded_file']['url'] );
433
  if ( 'featured_image' == $atts['field'] ) {
434
  set_post_thumbnail( $testimonial_id, $attach_id );
435
  }
436
  }
437
  }
438
+
439
  }
440
+
441
  }
442
 
443
  remove_filter( 'upload_mimes', array( $this, 'restrict_mime' ) );
480
  * Honeypot preprocessor
481
  */
482
  public function honeypot_after() {
483
+ if ( ! isset ( $_POST['wpmtst_after'] ) ) {
484
  do_action( 'honeypot_after_spam_testimonial', $_POST );
485
  }
486
  }
497
  } else {
498
  $message = __( 'Unknown error.', 'strong-testimonials' );
499
  }
500
+ wp_die( $message );
501
  }
502
 
503
  /**
526
  * @return array
527
  */
528
  public function handle_upload( $file_handler, $overrides ) {
529
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
530
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
531
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
532
 
533
  $upload = wp_handle_upload( $file_handler, $overrides );
534
 
553
  }
554
 
555
  $post['has_image'] = has_post_thumbnail( $post['id'] );
556
+ $fields = wpmtst_get_all_fields();
557
 
558
  if ( $form_options['sender_site_email'] ) {
559
  $sender_email = get_bloginfo( 'admin_email' );
560
+ }
561
+ else {
562
  $sender_email = $form_options['sender_email'];
563
  }
564
 
583
 
584
  if ( isset( $recipient['admin_site_email'] ) && $recipient['admin_site_email'] ) {
585
  $admin_email = get_bloginfo( 'admin_email' );
586
+ }
587
+ else {
588
  $admin_email = $recipient['admin_email'];
589
  }
590
 
591
  // Mandrill rejects the 'name <email>' format
592
  if ( $recipient['admin_name'] && ! $form_options['mail_queue'] ) {
593
  $to = sprintf( '%s <%s>', $recipient['admin_name'], $admin_email );
594
+ }
595
+ else {
596
  $to = sprintf( '%s', $admin_email );
597
  }
598
 
599
  // Headers
600
+ $headers = 'MIME-Version: 1.0' . "\n";
601
  $headers .= 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"' . "\n";
602
  if ( $form_options['sender_name'] ) {
603
  $headers .= sprintf( 'From: %s <%s>', $form_options['sender_name'], $sender_email ) . "\n";
604
+ }
605
+ else {
606
  $headers .= sprintf( 'From: %s', $sender_email ) . "\n";
607
  }
608
 
609
+ $email = array( 'to' => $to, 'subject' => $subject, 'message' => $message, 'headers' => $headers );
 
 
 
 
 
610
 
611
  if ( $form_options['mail_queue'] ) {
612
  WPMST()->mail->enqueue_mail( $email );
613
+ }
614
+ else {
615
  WPMST()->mail->send_mail( $email );
616
  }
617
+
618
  } // for each recipient
619
  }
620
 
638
  if ( $term && ! is_wp_error( $term ) ) {
639
  $replace = $term->name;
640
  }
641
+ }
642
+ elseif ( 'rating' == $field['input_type'] ) {
643
  $replace = $post_field . ' ' . _n( 'star', 'stars', $post_field, 'strong-testimonials' );
644
+ }
645
+ elseif ( 'checkbox' == $field['input_type'] ) {
646
  $replace = $post_field ? 'yes' : 'no';
647
+ }
648
+ else {
649
  $replace = $post_field;
650
  }
651
  }
includes/class-strong-log.php CHANGED
@@ -3,143 +3,139 @@
3
  * Debug Logger
4
  */
5
 
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- }
9
 
10
  if ( ! class_exists( 'Strong_Log' ) ) :
11
 
12
- class Strong_Log {
13
 
14
- public $name;
15
 
16
- public $filename;
17
 
18
- public $action;
19
 
20
- public function __construct( $name ) {
21
- $this->set_name( $name );
22
- $this->set_filename();
23
- $this->set_log_action();
24
- $this->add_actions();
25
- }
26
 
27
- private function set_name( $name = 'main' ) {
28
- $this->name = $name;
29
- }
30
 
31
- private function set_filename() {
32
- $this->filename = apply_filters(
33
- "strong_log_{$this->name}_filename",
34
- str_replace( '_', '-', "strong-{$this->name}-debug.log" )
35
- );
36
- }
37
 
38
- private function set_log_action() {
39
- $this->action = "strong_log_{$this->name}";
40
- }
41
 
42
- public function add_actions() {
43
- add_action( 'init', array( $this, 'init' ), 20 );
44
- add_action( 'shutdown', array( $this, 'on_shutdown' ), 20 );
45
- }
46
 
47
- public function init() {
48
- // TODO Make admin check optional.
49
- if ( $this->is_enabled() && current_user_can( 'administrator' ) ) {
50
- add_action( $this->action, array( $this, 'debug_log' ), 10, 3 );
51
- }
52
  }
 
53
 
54
- private function is_enabled() {
55
- $options = get_option( "wpmtst_{$this->name}_debug" );
56
- $is_enabled = ( isset( $options['log'] ) && $options['log'] );
57
-
58
- return apply_filters( $this->action, $is_enabled );
59
- }
60
 
61
- public function get_log_file_path() {
62
- return $this->get_log_file_base( 'basedir' ) . $this->filename;
63
- }
64
 
65
- public function get_log_file_url() {
66
- return $this->get_log_file_base( 'baseurl' ) . $this->filename;
67
- }
68
 
69
- public function get_log_file_base( $base = 'basedir' ) {
70
- $upload_dir = wp_upload_dir();
 
71
 
72
- if ( isset( $upload_dir[ $base ] ) ) {
73
- $log_file_base = $upload_dir[ $base ];
74
- } else {
75
- $log_file_base = $upload_dir['basedir'];
76
- }
77
 
78
- return trailingslashit( $log_file_base );
 
 
 
79
  }
80
 
81
- /**
82
- * Debug log entries.
83
- *
84
- * @param $entry
85
- * @param string $label
86
- * @param string $function
87
- */
88
- public function debug_log( $entry, $label = '', $function = '' ) {
89
- $this->log( $entry, $label, $function );
90
- }
91
 
92
- /**
93
- * Disable debug logging on shutdown.
94
- */
95
- public function on_shutdown() {
96
- if ( get_transient( $this->action ) ) {
97
- do_action( $this->action, str_repeat( '-', 50 ), '', current_filter() );
98
- delete_transient( $this->action );
99
- }
100
- }
 
101
 
102
- /**
103
- * Generic logging function.
104
- *
105
- * @param array|string $data
106
- * @param string $label
107
- * @param string $function
108
- */
109
- public function log( $data, $label = '', $function = '' ) {
 
110
 
111
- $entry = '[' . date( 'Y-m-d H:i:s' ) . ']';
 
 
 
 
 
 
 
112
 
113
- if ( wp_doing_ajax() ) {
114
- $entry .= ' | DOING_AJAX';
115
- }
116
 
117
- if ( $function ) {
118
- $entry .= ' | FN: ' . $function;
119
- }
120
 
121
- $entry .= ' | ';
 
 
122
 
123
- if ( $label ) {
124
- $entry .= $label . ' = ';
125
- }
126
 
127
- if ( is_array( $data ) || is_object( $data ) ) {
128
- $entry .= print_r( $data, true );
129
- } elseif ( is_bool( $data ) ) {
130
- $entry .= ( $entry ? 'true' : 'false' ) . PHP_EOL;
131
- } else {
132
- $entry .= $data . PHP_EOL;
133
- }
134
 
135
- //$entry .= PHP_EOL;
 
 
 
 
 
 
136
 
137
- error_log( $entry, 3, $this->get_log_file_path() );
138
 
139
- set_transient( $this->action, true );
140
 
141
- }
142
 
143
  }
144
 
 
 
145
  endif;
3
  * Debug Logger
4
  */
5
 
6
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
7
 
8
  if ( ! class_exists( 'Strong_Log' ) ) :
9
 
10
+ class Strong_Log {
11
 
12
+ public $name;
13
 
14
+ public $filename;
15
 
16
+ public $action;
17
 
18
+ public function __construct( $name ) {
19
+ $this->set_name( $name );
20
+ $this->set_filename();
21
+ $this->set_log_action();
22
+ $this->add_actions();
23
+ }
24
 
25
+ private function set_name( $name = 'main' ) {
26
+ $this->name = $name;
27
+ }
28
 
29
+ private function set_filename() {
30
+ $this->filename = apply_filters( "strong_log_{$this->name}_filename",
31
+ str_replace( '_', '-', "strong-{$this->name}-debug.log" ) );
32
+ }
 
 
33
 
34
+ private function set_log_action() {
35
+ $this->action = "strong_log_{$this->name}";
36
+ }
37
 
38
+ public function add_actions() {
39
+ add_action( 'init', array( $this, 'init' ), 20 );
40
+ add_action( 'shutdown', array( $this, 'on_shutdown' ), 20 );
41
+ }
42
 
43
+ public function init() {
44
+ // TODO Make admin check optional.
45
+ if ( $this->is_enabled() && current_user_can( 'administrator' ) ) {
46
+ add_action( $this->action, array( $this, 'debug_log' ), 10, 3 );
 
47
  }
48
+ }
49
 
50
+ private function is_enabled() {
51
+ $options = get_option( "wpmtst_{$this->name}_debug" );
52
+ $is_enabled = ( isset( $options['log'] ) && $options['log'] );
 
 
 
53
 
54
+ return apply_filters( $this->action, $is_enabled );
55
+ }
 
56
 
57
+ public function get_log_file_path() {
58
+ return $this->get_log_file_base( 'basedir' ) . $this->filename;
59
+ }
60
 
61
+ public function get_log_file_url() {
62
+ return $this->get_log_file_base( 'baseurl' ) . $this->filename;
63
+ }
64
 
65
+ public function get_log_file_base( $base = 'basedir' ) {
66
+ $upload_dir = wp_upload_dir();
 
 
 
67
 
68
+ if ( isset( $upload_dir[ $base ] ) ) {
69
+ $log_file_base = $upload_dir[ $base ];
70
+ } else {
71
+ $log_file_base = $upload_dir['basedir'];
72
  }
73
 
74
+ return trailingslashit( $log_file_base );
75
+ }
 
 
 
 
 
 
 
 
76
 
77
+ /**
78
+ * Debug log entries.
79
+ *
80
+ * @param $entry
81
+ * @param string $label
82
+ * @param string $function
83
+ */
84
+ public function debug_log( $entry, $label = '', $function = '' ) {
85
+ $this->log( $entry, $label, $function );
86
+ }
87
 
88
+ /**
89
+ * Disable debug logging on shutdown.
90
+ */
91
+ public function on_shutdown() {
92
+ if ( get_transient( $this->action ) ) {
93
+ do_action( $this->action, str_repeat( '-', 50 ), '', current_filter() );
94
+ delete_transient( $this->action );
95
+ }
96
+ }
97
 
98
+ /**
99
+ * Generic logging function.
100
+ *
101
+ * @param array|string $data
102
+ * @param string $label
103
+ * @param string $function
104
+ */
105
+ public function log( $data, $label = '', $function = '' ) {
106
 
107
+ $entry = '[' . date('Y-m-d H:i:s') . ']';
 
 
108
 
109
+ if ( wp_doing_ajax() ) {
110
+ $entry .= ' | DOING_AJAX';
111
+ }
112
 
113
+ if ( $function ) {
114
+ $entry .= ' | FN: ' . $function;
115
+ }
116
 
117
+ $entry .= ' | ';
 
 
118
 
119
+ if ( $label ) {
120
+ $entry .= $label . ' = ';
121
+ }
 
 
 
 
122
 
123
+ if ( is_array( $data ) || is_object( $data ) ) {
124
+ $entry .= print_r( $data, true );
125
+ } elseif ( is_bool( $data ) ) {
126
+ $entry .= ( $entry ? 'true' : 'false' ) . PHP_EOL;
127
+ } else {
128
+ $entry .= $data . PHP_EOL;
129
+ }
130
 
131
+ //$entry .= PHP_EOL;
132
 
133
+ error_log( $entry, 3, $this->get_log_file_path() );
134
 
135
+ set_transient( $this->action, true );
136
 
137
  }
138
 
139
+ }
140
+
141
  endif;
includes/class-strong-mail.php CHANGED
@@ -4,62 +4,59 @@
4
  */
5
 
6
  // Exit if accessed directly
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit;
9
- }
10
 
11
  if ( ! class_exists( 'Strong_Mail' ) ) :
12
 
13
- class Strong_Mail {
14
-
15
- public function __construct() {
16
- add_action( 'wp_loaded', array( $this, 'process_mail_queue' ), 20 );
17
- }
18
-
19
- /**
20
- * Process mail queue
21
- *
22
- * @since 2.8.0
23
- */
24
- public function process_mail_queue() {
25
- $current_queue = get_transient( 'wpmtst_mail_queue' );
26
- if ( ! $current_queue ) {
27
- return;
28
- }
29
 
30
- foreach ( $current_queue as $email ) {
31
- $this->send_mail( $email );
32
- }
33
 
34
- delete_transient( 'wpmtst_mail_queue' );
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
- public function send_mail( $email ) {
38
- if ( defined( 'IS_LOCALHOST' ) && IS_LOCALHOST ) {
39
- error_log( print_r( $email, true ) );
40
- } else {
41
- wp_mail( $email['to'], $email['subject'], $email['message'], $email['headers'] );
42
- }
43
- }
44
 
45
- /**
46
- * Enqueue mail.
47
- *
48
- * @since 2.8.0
49
- * @param $email
50
- */
51
- public function enqueue_mail( $email ) {
52
- $current_queue = get_transient( 'wpmtst_mail_queue' );
53
- if ( $current_queue ) {
54
- delete_transient( 'wpmtst_mail_queue' );
55
- } else {
56
- $current_queue = array();
57
- }
58
 
59
- $current_queue[] = $email;
60
- set_transient( 'wpmtst_mail_queue', $current_queue, DAY_IN_SECONDS );
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
 
 
63
  }
64
 
 
 
65
  endif;
4
  */
5
 
6
  // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
8
 
9
  if ( ! class_exists( 'Strong_Mail' ) ) :
10
 
11
+ class Strong_Mail {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ public function __construct() {
14
+ add_action( 'wp_loaded', array( $this, 'process_mail_queue' ), 20 );
15
+ }
16
 
17
+ /**
18
+ * Process mail queue
19
+ *
20
+ * @since 2.8.0
21
+ */
22
+ public function process_mail_queue() {
23
+ $current_queue = get_transient( 'wpmtst_mail_queue' );
24
+ if ( ! $current_queue )
25
+ return;
26
+
27
+ foreach ( $current_queue as $email ) {
28
+ $this->send_mail( $email );
29
  }
30
 
31
+ delete_transient( 'wpmtst_mail_queue' );
32
+ }
 
 
 
 
 
33
 
34
+ public function send_mail( $email ) {
35
+ if ( defined( 'IS_LOCALHOST') && IS_LOCALHOST ) {
36
+ error_log( print_r( $email, true ) );
37
+ } else {
38
+ wp_mail( $email['to'], $email['subject'], $email['message'], $email['headers'] );
39
+ }
40
+ }
 
 
 
 
 
 
41
 
42
+ /**
43
+ * Enqueue mail.
44
+ *
45
+ * @since 2.8.0
46
+ * @param $email
47
+ */
48
+ public function enqueue_mail( $email ) {
49
+ $current_queue = get_transient( 'wpmtst_mail_queue' );
50
+ if ( $current_queue ) {
51
+ delete_transient( 'wpmtst_mail_queue' );
52
+ } else {
53
+ $current_queue = array();
54
  }
55
 
56
+ $current_queue[] = $email;
57
+ set_transient( 'wpmtst_mail_queue', $current_queue, DAY_IN_SECONDS );
58
  }
59
 
60
+ }
61
+
62
  endif;
includes/class-strong-templates.php CHANGED
@@ -6,534 +6,537 @@
6
  */
7
 
8
  // Exit if accessed directly
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
 
13
  if ( ! class_exists( 'Strong_Templates' ) ) :
14
 
15
- class Strong_Templates {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
- * @var array
19
  */
20
- public $templates;
21
-
22
- public function __construct() {
23
- $this->templates = $this->find_templates();
24
- }
25
 
26
  /**
27
- * @param null $type
28
  *
29
- * @return array
30
  */
31
- public function find_templates( $type = null ) {
32
- $search = array(
33
- 'child_theme' => array(
34
- 'source' => __( 'Child Theme', 'strong-testimonials' ),
35
- 'path' => get_stylesheet_directory() . '/' . WPMTST,
36
- 'uri' => get_stylesheet_directory_uri() . '/' . WPMTST,
37
- 'order' => 2,
38
- ),
39
- 'parent_theme' => array(
40
- 'source' => __( 'Parent Theme', 'strong-testimonials' ),
41
- 'path' => get_template_directory() . '/' . WPMTST,
42
- 'uri' => get_template_directory_uri() . '/' . WPMTST,
43
- 'order' => 3,
44
- ),
45
- 'plugin' => array(
46
- 'source' => __( 'Plugin', 'strong-testimonials' ),
47
- 'path' => WPMTST_TPL,
48
- 'uri' => WPMTST_TPL_URI,
49
- 'order' => 4,
50
- ),
51
- );
52
-
53
- /**
54
- * Filter the search paths.
55
- */
56
- $search = apply_filters( 'wpmtst_template_search_paths', $search );
57
-
58
- /**
59
- * Insert order if necessary so custom templates appear first.
60
- *
61
- * @since 2.22
62
- */
63
- foreach ( $search as $key => $where ) {
64
- if ( ! isset( $where['source'] ) ) {
65
- $search[ $key ]['source'] = __( 'Custom', 'strong-testimonials' );
66
- }
67
- if ( ! isset( $where['order'] ) ) {
68
- $search[ $key ]['order'] = 1;
69
- }
70
  }
71
- // Reverse the search order so templates can be overridden.
72
- uasort( $search, array( $this, 'sort_array_by_search_order' ) );
73
-
74
- /**
75
- * Search
76
- */
77
- $files = array();
78
- foreach ( $search as $key => $bases ) {
79
- $new_files = $this->scandir_top( $key, $bases['path'], $bases['uri'], $type );
80
- // Merge (override) templates.
81
- if ( is_array( $new_files ) && $new_files ) {
82
- $files = array_merge( $files, $new_files );
83
- }
84
  }
85
- uasort( $files, array( $this, 'sort_array_by_order' ) );
86
-
87
- /**
88
- * Filter the list of found templates.
89
- */
90
- $files = array_filter( apply_filters( 'wpmtst_templates_found', array_filter( $files ) ) );
91
-
92
- return $files;
93
  }
 
 
94
 
95
  /**
96
- * @param string $name
97
- *
98
- * @return array|bool
99
  */
100
- public function get_template_by_name( $name = '' ) {
101
- if ( isset( $this->templates[ $name ] ) ) {
102
- return $this->templates[ $name ];
 
 
 
103
  }
104
-
105
- return false;
106
  }
 
107
 
108
  /**
109
- * @param null $types
110
- *
111
- * @return array
112
  */
113
- public function get_templates( $types = null ) {
114
- return $this->get_templates_by_type( $types );
115
- }
116
 
117
- /**
118
- * @param null $types
119
- *
120
- * @return array
121
- */
122
- public function get_templates_by_type( $types = null ) {
123
- if ( ! $types ) {
124
- return $this->templates;
125
- }
126
 
127
- $types = (array) $types;
128
- $filtered = array();
 
 
 
 
 
 
 
129
 
130
- foreach ( $this->templates as $key => $template ) {
131
- if ( isset( $template['config']['type'] ) ) {
132
- if ( in_array( $template['config']['type'], $types ) ) {
133
- $filtered[ $key ] = $template;
134
- }
135
- } else {
136
- $key_parts = explode( ':', $key );
137
- $type = $key_parts[1];
138
- if ( 'content' == $type ) {
139
- $type = 'display';
140
- }
141
- if ( in_array( $type, $types ) ) {
142
- $filtered[ $key ] = $template;
143
- }
144
- }
145
- }
146
 
147
- return array_filter( $filtered );
148
- }
 
 
 
 
 
 
149
 
150
- /**
151
- * Return list of templates by key.
152
- *
153
- * @return array
154
- */
155
- public function get_template_keys() {
156
- return array_keys( $this->templates );
 
157
  }
158
 
159
- /**
160
- * Get template attribute.
161
- *
162
- * @param $atts
163
- * @param string $part
164
- * @param bool|true $use_default
165
- *
166
- * @return string
167
- */
168
- public function get_template_attr( $atts, $part = 'template', $use_default = true ) {
169
- // Build a list of potential template part names.
170
- $template_search = array();
171
-
172
- // [1]
173
- /*
174
- * Divi Builder compatibility. Everybody has to be special.
175
- * @since 2.22.0
176
- * TODO Abstract this.
177
- */
178
- if ( 'stylesheet' == $part ) {
179
- if ( isset( $atts['divi_builder'] ) && $atts['divi_builder'] && wpmtst_divi_builder_active() ) {
180
- $template_search[] = $atts['template'] .= '-divi';
181
  }
182
  }
183
-
184
- // [2]
185
- if ( isset( $atts['template'] ) ) {
186
- $template_search[] = $atts['template'];
 
 
 
 
 
187
  }
 
188
 
189
- // [3]
190
- if ( $use_default ) {
191
- $template_search[] = apply_filters( 'wpmtst_default_template', 'default', $atts );
192
- }
193
 
194
- // Search list of already found template files. Stop at first match.
195
- $template_info = false;
196
- foreach ( $template_search as $template_key ) {
197
- if ( isset( $this->templates[ $template_key ] ) ) {
198
- $template_info = $this->templates[ $template_key ];
199
- break;
200
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  }
 
202
 
203
- // Return the requested part
204
- if ( $template_info && isset( $template_info[ $part ] ) && $template_info[ $part ] ) {
205
- return $template_info[ $part ];
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
 
207
 
208
- return '';
 
 
209
  }
210
 
211
- /**
212
- * Get template config.
213
- *
214
- * @param $atts
215
- * @param string $part
216
- * @param bool|true $use_default
217
- *
218
- * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  */
220
- public function get_template_config( $atts, $part = 'name', $use_default = true ) {
221
- // Build a list of potential template part names.
222
- $template_search = array();
223
-
224
- // [1]
225
- /*
226
- * Divi Builder compatibility. Everybody has to be special.
227
- * @since 2.22.0
228
- * TODO Abstract this.
229
- */
230
- if ( 'stylesheet' == $part ) {
231
- if ( isset( $atts['divi_builder'] ) && $atts['divi_builder'] && wpmtst_divi_builder_active() ) {
232
- $template_search[] = $atts['template'] .= '-divi';
233
- }
234
  }
 
235
 
236
- // [2]
237
- if ( isset( $atts['template'] ) ) {
238
- $template_search[] = $atts['template'];
239
- }
240
 
241
- // [3]
242
- if ( $use_default ) {
243
- $template_search[] = apply_filters( 'wpmtst_default_template', 'default', $atts );
244
- }
245
 
246
- // Search list of already found template files. Stop at first match.
247
- $template_info = false;
248
- foreach ( $template_search as $template_key ) {
249
- if ( isset( $this->templates[ $template_key ] ) ) {
250
- $template_info = $this->templates[ $template_key ];
251
- break;
252
- }
253
  }
 
254
 
255
- // Return the requested part (name, template, stylesheet,etc.)
256
- if ( $template_info && isset( $template_info['config'][ $part ] ) && $template_info['config'][ $part ] ) {
257
- return $template_info['config'][ $part ];
258
- }
 
 
 
259
 
260
- return '';
 
 
 
 
 
 
 
 
 
 
261
  }
262
 
263
- /**
264
- * @param $source_key
265
- * @param $path
266
- * @param $uri
267
- * @param $type
268
- *
269
- * @return array|bool
270
- */
271
- public function scandir_top( $source_key, $path, $uri, $type ) {
272
- if ( ! is_dir( $path ) ) {
273
- return false;
274
  }
275
 
276
- $files = array();
277
- $templates = scandir( $path );
278
- foreach ( $templates as $template ) {
279
- if ( '.' == $template[0] ) {
280
- continue;
281
- }
282
 
283
- if ( ! is_dir( $path . '/' . $template ) ) {
284
- continue;
285
- }
286
 
287
- // Find files in this directory
288
- $files_found = $this->scandir( $template, $path, $uri, array( 'json', 'php', 'css', 'js' ), $type );
 
289
 
290
- if ( ! $files_found ) {
291
- continue;
 
 
 
 
 
292
  }
293
-
294
- foreach ( $files_found as $key => $template_files ) {
295
- $template_files['source'] = $source_key;
296
- if ( isset( $template_files['config']['format_version'] ) && '1.0' == $template_files['config']['format_version'] ) {
297
- // Template format version 1 (no config file)
298
- $template_name = basename( $template_files['template'], '.php' );
299
- $new_key = $template . ':' . $template_name;
300
- $files[ $new_key ] = $template_files;
301
- } else {
302
- // Template format version 2 (has config.json)
303
- $files[ $template ] = $template_files;
304
- }
305
  }
 
306
  }
 
307
 
308
- return $files;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  }
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  /**
312
- * @param $template
313
- * @param $path
314
- * @param $uri
315
- * @param null $extensions
316
- * @param $type
317
  *
318
- * @return array|bool
319
  */
320
- public function scandir( $template, $path, $uri, $extensions = null, $type ) {
321
- if ( ! is_dir( $path . '/' . $template ) ) {
322
- return false;
323
- }
 
 
324
 
325
- if ( $extensions ) {
326
- $extensions = (array) $extensions;
327
- }
328
 
329
- // Bail if requested template type not found
330
- if ( $type && ! file_exists( $path . '/' . $template . '/' . $type . '.php' ) ) {
331
- return false;
 
 
 
 
 
332
  }
333
 
334
- $files = array();
335
-
336
- /**
337
- * Template header tags for template format version 1
338
- */
339
- $tags = apply_filters(
340
- 'wpmtst_template_header_tags',
341
- array(
342
- 'name' => 'Template Name',
343
- 'description' => 'Description',
344
- 'deps' => 'Scripts', // registered scripts
345
- 'styles' => 'Styles', // registered styles or fonts
346
- 'force' => 'Force', // dependent options
347
- )
348
- );
349
-
350
- /**
351
- * Check for config file first.
352
- *
353
- * @since 2.30.0
354
- */
355
- $config_found = false;
356
- $config = $path . '/' . $template . '/config.json';
357
- if ( file_exists( $config ) ) {
358
- $files[ $template ]['config'] = (array) json_decode( file_get_contents( $config ) );
359
- $config_found = true;
360
  }
361
 
362
- /**
363
- * Process the files.
364
- * This creates an array of properties: file paths and config parameters.
365
- */
366
- $results = scandir( $path . '/' . $template );
367
- foreach ( $results as $result ) {
368
- if ( '.' == $result[0] ) {
369
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  }
371
 
372
- if ( is_dir( $path . '/' . $template . '/' . $result ) ) {
373
- continue;
374
  }
375
 
376
- // If no extensions specified or if extension matches
377
- if ( ! $extensions || preg_match( '~\.(' . implode( '|', $extensions ) . ')$~', $result ) ) {
378
-
379
- $default_config = array(
380
- 'name' => '',
381
- 'description' => '',
382
- 'type' => 'display',
383
- 'order' => 10,
384
- 'scripts' => '',
385
- 'styles' => '',
386
- 'force' => '',
387
- 'options' => '',
388
- 'format_version' => '2.0',
389
  );
390
 
391
- $filename = pathinfo( $result, PATHINFO_FILENAME );
392
- $ext = pathinfo( $result, PATHINFO_EXTENSION );
393
-
394
- // Template, stylesheet, script, or other?
395
- switch ( $ext ) {
396
- //case 'json':
397
- // $key = 'config';
398
- // $base = $uri;
399
- // break;
400
- case 'php':
401
- $key = 'template';
402
- $base = $path;
403
- break;
404
- case 'css':
405
- $key = 'stylesheet';
406
- $base = $uri;
407
- break;
408
- case 'js':
409
- $key = 'script';
410
- $base = $uri;
411
- break;
412
- default:
413
- $key = '';
414
- $base = '';
415
- }
416
 
417
- if ( $key ) {
418
- $files[ $template ][ $key ] = $base . '/' . $template . '/' . $result;
419
- }
420
-
421
- // Convert V1 templates to V2 by creating config array from main template file.
422
- if ( 'template' == $key && ! $config_found ) {
423
- $file_data = get_file_data( $path . '/' . $template . '/' . $result, $tags );
424
-
425
- // Start config array
426
- $config = array(
427
- 'format_version' => '1.0',
428
- );
429
-
430
- // Store header tags
431
- foreach ( $tags as $tag => $label ) {
432
-
433
- if ( 'name' == $tag ) {
434
- // Get the template name
435
- if ( isset( $file_data['name'] ) && $file_data['name'] ) {
436
- $config['name'] = $file_data['name'];
437
- } else {
438
- // Use the directory name
439
- $config['name'] = ucwords( str_replace( array( '_', '-' ), ' ', basename( $path ) ) );
440
- }
441
  } else {
442
- $config[ $tag ] = $file_data[ $tag ];
 
443
  }
444
  }
445
-
446
- // Set the template type
447
- if ( 'form.php' == $filename ) {
448
- $config['type'] = 'form';
449
- } elseif ( 'widget.php' == $filename ) {
450
- $config['type'] = 'widget';
451
  }
452
 
453
- $files[ $template ]['config'] = array_merge( $default_config, $config );
454
  }
 
 
 
 
 
 
 
 
 
 
455
  }
456
- }
457
 
458
- return $files;
459
  }
460
 
461
- /**
462
- * @param $a
463
- * @param $b
464
- *
465
- * @return int
466
- */
467
- public function sort_array_by_name( $a, $b ) {
468
- if ( ! isset( $a['name'] ) ) {
469
- $a['name'] = '';
470
- }
471
- if ( ! isset( $b['name'] ) ) {
472
- $b['name'] = '';
473
- }
474
 
475
- return strcmp( $a['name'], $b['name'] );
 
 
 
 
 
 
 
 
 
 
 
476
  }
477
 
478
- /**
479
- * @param $a
480
- * @param $b
481
- *
482
- * @return int
483
- */
484
- public function sort_array_by_order( $a, $b ) {
485
- if ( ! isset( $a['config']['order'] ) ) {
486
- $a['config']['order'] = 0;
487
- }
488
- if ( ! isset( $b['config']['order'] ) ) {
489
- $b['config']['order'] = 0;
490
- }
491
 
492
- if ( $a['config']['order'] == $b['config']['order'] ) {
493
- return 0;
494
- }
 
 
 
 
 
 
 
 
 
 
495
 
496
- // `<` returns descending order
497
- return ( $a['config']['order'] < $b['config']['order'] ) ? -1 : 1;
498
  }
499
 
500
- /**
501
- * @param $a
502
- * @param $b
503
- *
504
- * @return int
505
- */
506
- public function sort_array_by_search_order( $a, $b ) {
507
- if ( ! isset( $a['order'] ) || ! isset( $b['order'] ) ) {
508
- return 0;
509
- }
510
 
511
- if ( $a['order'] == $b['order'] ) {
512
- return 0;
513
- }
 
 
 
 
 
 
 
514
 
515
- // `>` returns ascending order
516
- return ( $a['order'] > $b['order'] ) ? -1 : 1;
517
  }
518
 
519
- /**
520
- * @param $a
521
- * @param $b
522
- *
523
- * @return int
524
- */
525
- public function sort_array_by_order_name( $a, $b ) {
526
- if ( ! isset( $a['name'] ) || ! isset( $b['name'] ) ) {
527
- return 0;
528
- }
529
 
530
- if ( $a['order'] == $b['order'] ) {
531
- return strcasecmp( $a['name'], $b['name'] );
532
- }
 
 
 
 
 
 
 
533
 
534
- return ( $a['order'] < $b['order'] ) ? -1 : 1;
 
535
  }
536
 
 
537
  }
538
 
 
 
539
  endif;
6
  */
7
 
8
  // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
10
 
11
  if ( ! class_exists( 'Strong_Templates' ) ) :
12
 
13
+ class Strong_Templates {
14
+
15
+ /**
16
+ * @var array
17
+ */
18
+ public $templates;
19
+
20
+ public function __construct() {
21
+ $this->templates = $this->find_templates();
22
+ }
23
+
24
+ /**
25
+ * @param null $type
26
+ *
27
+ * @return array
28
+ */
29
+ public function find_templates( $type = null ) {
30
+ $search = array(
31
+ 'child_theme' => array(
32
+ 'source' => __( 'Child Theme', 'strong-testimonials' ),
33
+ 'path' => get_stylesheet_directory() . '/' . WPMTST,
34
+ 'uri' => get_stylesheet_directory_uri() . '/' . WPMTST,
35
+ 'order' => 2,
36
+ ),
37
+ 'parent_theme' => array(
38
+ 'source' => __( 'Parent Theme', 'strong-testimonials' ),
39
+ 'path' => get_template_directory() . '/' . WPMTST,
40
+ 'uri' => get_template_directory_uri() . '/' . WPMTST,
41
+ 'order' => 3,
42
+ ),
43
+ 'plugin' => array(
44
+ 'source' => __( 'Plugin', 'strong-testimonials' ),
45
+ 'path' => WPMTST_TPL,
46
+ 'uri' => WPMTST_TPL_URI,
47
+ 'order' => 4,
48
+ ),
49
+ );
50
 
51
  /**
52
+ * Filter the search paths.
53
  */
54
+ $search = apply_filters( 'wpmtst_template_search_paths', $search );
 
 
 
 
55
 
56
  /**
57
+ * Insert order if necessary so custom templates appear first.
58
  *
59
+ * @since 2.22
60
  */
61
+ foreach ( $search as $key => $where ) {
62
+ if ( ! isset( $where['source'] ) ) {
63
+ $search[ $key ]['source'] = __( 'Custom', 'strong-testimonials' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
+ if ( ! isset( $where['order'] ) ) {
66
+ $search[ $key ]['order'] = 1;
 
 
 
 
 
 
 
 
 
 
 
67
  }
 
 
 
 
 
 
 
 
68
  }
69
+ // Reverse the search order so templates can be overridden.
70
+ uasort( $search, array( $this, 'sort_array_by_search_order' ) );
71
 
72
  /**
73
+ * Search
 
 
74
  */
75
+ $files = array();
76
+ foreach ( $search as $key => $bases ) {
77
+ $new_files = $this->scandir_top( $key, $bases['path'], $bases['uri'], $type );
78
+ // Merge (override) templates.
79
+ if ( is_array( $new_files ) && $new_files ) {
80
+ $files = array_merge( $files, $new_files );
81
  }
 
 
82
  }
83
+ uasort( $files, array( $this, 'sort_array_by_order' ) );
84
 
85
  /**
86
+ * Filter the list of found templates.
 
 
87
  */
88
+ $files = array_filter( apply_filters( 'wpmtst_templates_found', array_filter( $files ) ) );
 
 
89
 
90
+ return $files;
91
+ }
 
 
 
 
 
 
 
92
 
93
+ /**
94
+ * @param string $name
95
+ *
96
+ * @return array|bool
97
+ */
98
+ public function get_template_by_name( $name = '' ) {
99
+ if ( isset( $this->templates[ $name ] ) ) {
100
+ return $this->templates[ $name ];
101
+ }
102
 
103
+ return false;
104
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
+ /**
107
+ * @param null $types
108
+ *
109
+ * @return array
110
+ */
111
+ public function get_templates( $types = null ) {
112
+ return $this->get_templates_by_type( $types );
113
+ }
114
 
115
+ /**
116
+ * @param null $types
117
+ *
118
+ * @return array
119
+ */
120
+ public function get_templates_by_type( $types = null ) {
121
+ if ( ! $types ) {
122
+ return $this->templates;
123
  }
124
 
125
+ $types = (array) $types;
126
+ $filtered = array();
127
+
128
+ foreach ( $this->templates as $key => $template ) {
129
+ if ( isset( $template['config']['type'] ) ) {
130
+ if ( in_array( $template['config']['type'], $types ) ) {
131
+ $filtered[ $key ] = $template;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
  }
134
+ else {
135
+ $key_parts = explode( ':', $key );
136
+ $type = $key_parts[1];
137
+ if ( 'content' == $type ) {
138
+ $type = 'display';
139
+ }
140
+ if ( in_array( $type, $types ) ) {
141
+ $filtered[ $key ] = $template;
142
+ }
143
  }
144
+ }
145
 
146
+ return array_filter( $filtered );
147
+ }
 
 
148
 
149
+ /**
150
+ * Return list of templates by key.
151
+ *
152
+ * @return array
153
+ */
154
+ public function get_template_keys() {
155
+ return array_keys( $this->templates );
156
+ }
157
+
158
+ /**
159
+ * Get template attribute.
160
+ *
161
+ * @param $atts
162
+ * @param string $part
163
+ * @param bool|true $use_default
164
+ *
165
+ * @return string
166
+ */
167
+ public function get_template_attr( $atts, $part = 'template', $use_default = true ) {
168
+ // Build a list of potential template part names.
169
+ $template_search = array();
170
+
171
+ // [1]
172
+ /*
173
+ * Divi Builder compatibility. Everybody has to be special.
174
+ * @since 2.22.0
175
+ * TODO Abstract this.
176
+ */
177
+ if ( 'stylesheet' == $part ) {
178
+ if ( isset( $atts['divi_builder'] ) && $atts['divi_builder'] && wpmtst_divi_builder_active() ) {
179
+ $template_search[] = $atts['template'] .= '-divi';
180
  }
181
+ }
182
 
183
+ // [2]
184
+ if ( isset( $atts['template'] ) ) {
185
+ $template_search[] = $atts['template'];
186
+ }
187
+
188
+ // [3]
189
+ if ( $use_default ) {
190
+ $template_search[] = apply_filters( 'wpmtst_default_template', 'default', $atts );
191
+ }
192
+
193
+ // Search list of already found template files. Stop at first match.
194
+ $template_info = false;
195
+ foreach ( $template_search as $template_key ) {
196
+ if ( isset( $this->templates[ $template_key ] ) ) {
197
+ $template_info = $this->templates[ $template_key ];
198
+ break;
199
  }
200
+ }
201
 
202
+ // Return the requested part
203
+ if ( $template_info && isset( $template_info[ $part ] ) && $template_info[ $part ] ) {
204
+ return $template_info[ $part ];
205
  }
206
 
207
+ return '';
208
+ }
209
+
210
+ /**
211
+ * Get template config.
212
+ *
213
+ * @param $atts
214
+ * @param string $part
215
+ * @param bool|true $use_default
216
+ *
217
+ * @return string
218
+ */
219
+ public function get_template_config( $atts, $part = 'name', $use_default = true ) {
220
+ // Build a list of potential template part names.
221
+ $template_search = array();
222
+
223
+ // [1]
224
+ /*
225
+ * Divi Builder compatibility. Everybody has to be special.
226
+ * @since 2.22.0
227
+ * TODO Abstract this.
228
  */
229
+ if ( 'stylesheet' == $part ) {
230
+ if ( isset( $atts['divi_builder'] ) && $atts['divi_builder'] && wpmtst_divi_builder_active() ) {
231
+ $template_search[] = $atts['template'] .= '-divi';
 
 
 
 
 
 
 
 
 
 
 
232
  }
233
+ }
234
 
235
+ // [2]
236
+ if ( isset( $atts['template'] ) ) {
237
+ $template_search[] = $atts['template'];
238
+ }
239
 
240
+ // [3]
241
+ if ( $use_default ) {
242
+ $template_search[] = apply_filters( 'wpmtst_default_template', 'default', $atts );
243
+ }
244
 
245
+ // Search list of already found template files. Stop at first match.
246
+ $template_info = false;
247
+ foreach ( $template_search as $template_key ) {
248
+ if ( isset( $this->templates[ $template_key ] ) ) {
249
+ $template_info = $this->templates[ $template_key ];
250
+ break;
 
251
  }
252
+ }
253
 
254
+ // Return the requested part (name, template, stylesheet,etc.)
255
+ if ( $template_info && isset( $template_info['config'][ $part ] ) && $template_info['config'][ $part ] ) {
256
+ return $template_info['config'][ $part ];
257
+ }
258
+
259
+ return '';
260
+ }
261
 
262
+ /**
263
+ * @param $source_key
264
+ * @param $path
265
+ * @param $uri
266
+ * @param $type
267
+ *
268
+ * @return array|bool
269
+ */
270
+ public function scandir_top( $source_key, $path, $uri, $type ) {
271
+ if ( ! is_dir( $path ) ) {
272
+ return false;
273
  }
274
 
275
+ $files = array();
276
+ $templates = scandir( $path );
277
+ foreach ( $templates as $template ) {
278
+ if ( '.' == $template[0] ) {
279
+ continue;
 
 
 
 
 
 
280
  }
281
 
282
+ if ( ! is_dir( $path . '/' . $template ) ) {
283
+ continue;
284
+ }
 
 
 
285
 
286
+ // Find files in this directory
287
+ $files_found = $this->scandir( $template, $path, $uri, array( 'json', 'php', 'css', 'js' ), $type );
 
288
 
289
+ if ( ! $files_found ) {
290
+ continue;
291
+ }
292
 
293
+ foreach ( $files_found as $key => $template_files ) {
294
+ $template_files['source'] = $source_key;
295
+ if ( isset( $template_files['config']['format_version'] ) && '1.0' == $template_files['config']['format_version'] ) {
296
+ // Template format version 1 (no config file)
297
+ $template_name = basename( $template_files['template'], '.php' );
298
+ $new_key = $template . ':' . $template_name;
299
+ $files[ $new_key ] = $template_files;
300
  }
301
+ else {
302
+ // Template format version 2 (has config.json)
303
+ $files[ $template ] = $template_files;
 
 
 
 
 
 
 
 
 
304
  }
305
+
306
  }
307
+ }
308
 
309
+ return $files;
310
+ }
311
+
312
+ /**
313
+ * @param $template
314
+ * @param $path
315
+ * @param $uri
316
+ * @param null $extensions
317
+ * @param $type
318
+ *
319
+ * @return array|bool
320
+ */
321
+ public function scandir( $template, $path, $uri, $extensions = null, $type ) {
322
+ if ( ! is_dir( $path . '/' . $template ) ) {
323
+ return false;
324
  }
325
 
326
+ if ( $extensions ) {
327
+ $extensions = (array) $extensions;
328
+ }
329
+
330
+ // Bail if requested template type not found
331
+ if ( $type && ! file_exists( $path . '/' . $template . '/' . $type . '.php' ) ) {
332
+ return false;
333
+ }
334
+
335
+ $files = array();
336
+
337
+ /**
338
+ * Template header tags for template format version 1
339
+ */
340
+ $tags = apply_filters( 'wpmtst_template_header_tags', array(
341
+ 'name' => 'Template Name',
342
+ 'description' => 'Description',
343
+ 'deps' => 'Scripts', // registered scripts
344
+ 'styles' => 'Styles', // registered styles or fonts
345
+ 'force' => 'Force', // dependent options
346
+ ) );
347
+
348
  /**
349
+ * Check for config file first.
 
 
 
 
350
  *
351
+ * @since 2.30.0
352
  */
353
+ $config_found = false;
354
+ $config = $path . '/' . $template . '/config.json';
355
+ if ( file_exists( $config ) ) {
356
+ $files[ $template ]['config'] = (array) json_decode( file_get_contents( $config ) );
357
+ $config_found = true;
358
+ }
359
 
 
 
 
360
 
361
+ /**
362
+ * Process the files.
363
+ * This creates an array of properties: file paths and config parameters.
364
+ */
365
+ $results = scandir( $path . '/' . $template );
366
+ foreach ( $results as $result ) {
367
+ if ( '.' == $result[0] ) {
368
+ continue;
369
  }
370
 
371
+ if ( is_dir( $path . '/' . $template . '/' . $result ) ) {
372
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  }
374
 
375
+ // If no extensions specified or if extension matches
376
+ if ( ! $extensions || preg_match( '~\.(' . implode( '|', $extensions ) . ')$~', $result ) ) {
377
+
378
+ $default_config = array(
379
+ 'name' => '',
380
+ 'description' => '',
381
+ 'type' => 'display',
382
+ 'order' => 10,
383
+ 'scripts' => '',
384
+ 'styles' => '',
385
+ 'force' => '',
386
+ 'options' => '',
387
+ 'format_version' => '2.0',
388
+ );
389
+
390
+ $filename = pathinfo( $result, PATHINFO_FILENAME );
391
+ $ext = pathinfo( $result, PATHINFO_EXTENSION );
392
+
393
+ // Template, stylesheet, script, or other?
394
+ switch ( $ext ) {
395
+ //case 'json':
396
+ // $key = 'config';
397
+ // $base = $uri;
398
+ // break;
399
+ case 'php':
400
+ $key = 'template';
401
+ $base = $path;
402
+ break;
403
+ case 'css':
404
+ $key = 'stylesheet';
405
+ $base = $uri;
406
+ break;
407
+ case 'js':
408
+ $key = 'script';
409
+ $base = $uri;
410
+ break;
411
+ default:
412
+ $key = '';
413
+ $base = '';
414
  }
415
 
416
+ if ( $key ) {
417
+ $files[ $template ][ $key ] = $base . '/' . $template . '/' . $result;
418
  }
419
 
420
+ // Convert V1 templates to V2 by creating config array from main template file.
421
+ if ( 'template' == $key && ! $config_found ) {
422
+ $file_data = get_file_data( $path . '/' . $template . '/' . $result, $tags );
423
+
424
+ // Start config array
425
+ $config = array(
426
+ 'format_version' => '1.0',
 
 
 
 
 
 
427
  );
428
 
429
+ // Store header tags
430
+ foreach ( $tags as $tag => $label ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
 
432
+ if ( 'name' == $tag ) {
433
+ // Get the template name
434
+ if ( isset( $file_data['name'] ) && $file_data['name'] ) {
435
+ $config['name'] = $file_data['name'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  } else {
437
+ // Use the directory name
438
+ $config['name'] = ucwords( str_replace( array( '_', '-' ), ' ', basename( $path ) ) );
439
  }
440
  }
441
+ else {
442
+ $config[ $tag ] = $file_data[ $tag ];
 
 
 
 
443
  }
444
 
 
445
  }
446
+
447
+ // Set the template type
448
+ if ( 'form.php' == $filename ) {
449
+ $config['type'] = 'form';
450
+ }
451
+ elseif ( 'widget.php' == $filename ) {
452
+ $config['type'] = 'widget';
453
+ }
454
+
455
+ $files[ $template ]['config'] = array_merge( $default_config, $config );
456
  }
 
457
 
458
+ }
459
  }
460
 
461
+ return $files;
462
+ }
 
 
 
 
 
 
 
 
 
 
 
463
 
464
+ /**
465
+ * @param $a
466
+ * @param $b
467
+ *
468
+ * @return int
469
+ */
470
+ public function sort_array_by_name( $a, $b ) {
471
+ if ( ! isset( $a['name'] ) ) {
472
+ $a['name'] = '';
473
+ }
474
+ if ( ! isset( $b['name'] ) ) {
475
+ $b['name'] = '';
476
  }
477
 
478
+ return strcmp( $a['name'], $b['name'] );
479
+ }
 
 
 
 
 
 
 
 
 
 
 
480
 
481
+ /**
482
+ * @param $a
483
+ * @param $b
484
+ *
485
+ * @return int
486
+ */
487
+ public function sort_array_by_order( $a, $b ) {
488
+ if ( ! isset( $a['config']['order'] ) ) {
489
+ $a['config']['order'] = 0;
490
+ }
491
+ if ( ! isset( $b['config']['order'] ) ) {
492
+ $b['config']['order'] = 0;
493
+ }
494
 
495
+ if ( $a['config']['order'] == $b['config']['order'] ) {
496
+ return 0;
497
  }
498
 
499
+ // `<` returns descending order
500
+ return ( $a['config']['order'] < $b['config']['order'] ) ? -1 : 1;
501
+ }
 
 
 
 
 
 
 
502
 
503
+ /**
504
+ * @param $a
505
+ * @param $b
506
+ *
507
+ * @return int
508
+ */
509
+ public function sort_array_by_search_order( $a, $b ) {
510
+ if ( ! isset( $a['order'] ) || ! isset( $b['order'] ) ) {
511
+ return 0;
512
+ }
513
 
514
+ if ( $a['order'] == $b['order'] ) {
515
+ return 0;
516
  }
517
 
518
+ // `>` returns ascending order
519
+ return ( $a['order'] > $b['order'] ) ? -1 : 1;
520
+ }
 
 
 
 
 
 
 
521
 
522
+ /**
523
+ * @param $a
524
+ * @param $b
525
+ *
526
+ * @return int
527
+ */
528
+ public function sort_array_by_order_name( $a, $b ) {
529
+ if ( ! isset( $a['name'] ) || ! isset( $b['name'] ) ) {
530
+ return 0;
531
+ }
532
 
533
+ if ( $a['order'] == $b['order'] ) {
534
+ return strcasecmp( $a['name'], $b['name'] );
535
  }
536
 
537
+ return ( $a['order'] < $b['order'] ) ? -1 : 1;
538
  }
539
 
540
+ }
541
+
542
  endif;
includes/class-strong-testimonials-order.php CHANGED
@@ -56,16 +56,10 @@ class Strong_Testimonials_Order {
56
  return;
57
  }
58
 
59
- wp_enqueue_script(
60
- 'wpmtst-admin-order-script',
61
- WPMTST_ADMIN_URL . 'js/admin-order.js',
62
- array(
63
- 'jquery-effects-highlight',
64
- 'jquery-ui-sortable',
65
- ),
66
- null,
67
- true
68
- );
69
 
70
  wp_enqueue_style( 'wpmtst-admin-order-style', WPMTST_ADMIN_URL . '/css/order.css', array(), null );
71
 
@@ -76,14 +70,12 @@ class Strong_Testimonials_Order {
76
  */
77
  public static function store_query_vars() {
78
  if ( is_admin() ) {
79
- set_transient(
80
- 'wpmtst_order_query',
81
  array(
82
  'paged' => get_query_var( 'paged' ),
83
  'posts_per_page' => get_query_var( 'posts_per_page' ),
84
  ),
85
- 24 * HOUR_IN_SECONDS
86
- );
87
  }
88
  }
89
 
@@ -116,6 +108,7 @@ class Strong_Testimonials_Order {
116
  foreach ( $results as $key => $result ) {
117
  $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
118
  }
 
119
  } else {
120
 
121
  // Consecutive reorder with new posts at top.
@@ -124,6 +117,7 @@ class Strong_Testimonials_Order {
124
  foreach ( $results as $key => $result ) {
125
  $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
126
  }
 
127
  }
128
 
129
  }
@@ -148,11 +142,13 @@ class Strong_Testimonials_Order {
148
  if ( ! in_array( 'wpm-testimonial', $query->query['post_type'] ) ) {
149
  return;
150
  }
 
151
  } else {
152
 
153
  if ( 'wpm-testimonial' != $query->query['post_type'] ) {
154
  return;
155
  }
 
156
  }
157
 
158
  // disable filter suppression
56
  return;
57
  }
58
 
59
+ wp_enqueue_script( 'wpmtst-admin-order-script', WPMTST_ADMIN_URL . 'js/admin-order.js', array(
60
+ 'jquery-effects-highlight',
61
+ 'jquery-ui-sortable',
62
+ ), null, true );
 
 
 
 
 
 
63
 
64
  wp_enqueue_style( 'wpmtst-admin-order-style', WPMTST_ADMIN_URL . '/css/order.css', array(), null );
65
 
70
  */
71
  public static function store_query_vars() {
72
  if ( is_admin() ) {
73
+ set_transient( 'wpmtst_order_query',
 
74
  array(
75
  'paged' => get_query_var( 'paged' ),
76
  'posts_per_page' => get_query_var( 'posts_per_page' ),
77
  ),
78
+ 24 * HOUR_IN_SECONDS );
 
79
  }
80
  }
81
 
108
  foreach ( $results as $key => $result ) {
109
  $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
110
  }
111
+
112
  } else {
113
 
114
  // Consecutive reorder with new posts at top.
117
  foreach ( $results as $key => $result ) {
118
  $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
119
  }
120
+
121
  }
122
 
123
  }
142
  if ( ! in_array( 'wpm-testimonial', $query->query['post_type'] ) ) {
143
  return;
144
  }
145
+
146
  } else {
147
 
148
  if ( 'wpm-testimonial' != $query->query['post_type'] ) {
149
  return;
150
  }
151
+
152
  }
153
 
154
  // disable filter suppression
includes/class-strong-testimonials-privacy.php CHANGED
@@ -81,6 +81,7 @@ class Strong_Testimonials_Privacy {
81
  'data' => $data,
82
  );
83
  }
 
84
  }
85
 
86
  // Tell core if we have more comments to work on still
@@ -124,6 +125,7 @@ class Strong_Testimonials_Privacy {
124
  $items_removed = true;
125
  }
126
  }
 
127
  }
128
 
129
  // Tell core if we have more comments to work on still
@@ -157,7 +159,7 @@ class Strong_Testimonials_Privacy {
157
  * @since 2.31.4
158
  * @return array
159
  */
160
- public function register_eraser( $erasers ) {
161
  $erasers['strong-testimonials'] = array(
162
  'eraser_friendly_name' => $this->get_friendly_name(),
163
  'callback' => array( $this, 'eraser' ),
81
  'data' => $data,
82
  );
83
  }
84
+
85
  }
86
 
87
  // Tell core if we have more comments to work on still
125
  $items_removed = true;
126
  }
127
  }
128
+
129
  }
130
 
131
  // Tell core if we have more comments to work on still
159
  * @since 2.31.4
160
  * @return array
161
  */
162
+ function register_eraser( $erasers ) {
163
  $erasers['strong-testimonials'] = array(
164
  'eraser_friendly_name' => $this->get_friendly_name(),
165
  'callback' => array( $this, 'eraser' ),
includes/class-strong-testimonials-render.php CHANGED
@@ -410,7 +410,9 @@ class Strong_Testimonials_Render {
410
  $widget = $strong_widgets[ $id ];
411
  $this->check_widget( $widget );
412
  }
 
413
  }
 
414
  } elseif ( 0 === strpos( $widget_name, 'text-' ) ) {
415
  // Text widgets
416
 
@@ -426,6 +428,7 @@ class Strong_Testimonials_Render {
426
  $this->process_content( $widget['text'] );
427
  }
428
  }
 
429
  } elseif ( 0 === strpos( $widget_name, 'custom_html-' ) ) {
430
  // Custom HTML widgets
431
 
@@ -441,6 +444,7 @@ class Strong_Testimonials_Render {
441
  $this->process_content( $widget['content'] );
442
  }
443
  }
 
444
  }
445
  } // foreach $widgets
446
  } // foreach $all_widgets
@@ -609,13 +613,13 @@ class Strong_Testimonials_Render {
609
  $this->set_atts( $atts );
610
 
611
  switch ( $atts['mode'] ) {
612
- case 'form':
613
  $view = new Strong_View_Form( $atts );
614
  break;
615
- case 'slideshow':
616
  $view = new Strong_View_Slideshow( $atts );
617
  break;
618
- default:
619
  $view = new Strong_View_Display( $atts );
620
  }
621
  $view->process();
@@ -695,7 +699,8 @@ class Strong_Testimonials_Render {
695
  foreach ( $items as $item ) {
696
  if ( is_numeric( $item ) ) {
697
  $cats[] = $item;
698
- } else {
 
699
  $term = get_term_by( 'slug', $item, 'wpm-testimonial-category' );
700
  if ( $term ) {
701
  $cats[] = $term->term_id;
410
  $widget = $strong_widgets[ $id ];
411
  $this->check_widget( $widget );
412
  }
413
+
414
  }
415
+
416
  } elseif ( 0 === strpos( $widget_name, 'text-' ) ) {
417
  // Text widgets
418
 
428
  $this->process_content( $widget['text'] );
429
  }
430
  }
431
+
432
  } elseif ( 0 === strpos( $widget_name, 'custom_html-' ) ) {
433
  // Custom HTML widgets
434
 
444
  $this->process_content( $widget['content'] );
445
  }
446
  }
447
+
448
  }
449
  } // foreach $widgets
450
  } // foreach $all_widgets
613
  $this->set_atts( $atts );
614
 
615
  switch ( $atts['mode'] ) {
616
+ case 'form' :
617
  $view = new Strong_View_Form( $atts );
618
  break;
619
+ case 'slideshow' :
620
  $view = new Strong_View_Slideshow( $atts );
621
  break;
622
+ default :
623
  $view = new Strong_View_Display( $atts );
624
  }
625
  $view->process();
699
  foreach ( $items as $item ) {
700
  if ( is_numeric( $item ) ) {
701
  $cats[] = $item;
702
+ }
703
+ else {
704
  $term = get_term_by( 'slug', $item, 'wpm-testimonial-category' );
705
  if ( $term ) {
706
  $cats[] = $term->term_id;
includes/class-strong-testimonials-shortcode-average.php CHANGED
@@ -49,7 +49,7 @@ class Strong_Testimonials_Average_Shortcode {
49
  }
50
 
51
  // set parts
52
- preg_match_all( '#{(.*?)}#', $content, $parts );
53
  /*
54
  * Example:
55
  *
@@ -102,21 +102,21 @@ class Strong_Testimonials_Average_Shortcode {
102
  * Example:
103
  *
104
  * Array
105
- * (
106
- * [review_count] => 2
107
- * [rating_count] => 2
108
- * [rating_sum] => 10
109
- * [rating_average] => 5
110
- * [rating_detail] => Array
111
- * (
112
- * [5] => 2
113
- * [4] => 0
114
- * [3] => 0
115
- * [2] => 0
116
- * [1] => 0
117
- * [0] => 0
118
- * )
119
- * )
120
  */
121
 
122
  // Want to build your own HTML? Return any truthy value to short-circuit this shortcode output.
@@ -140,7 +140,7 @@ class Strong_Testimonials_Average_Shortcode {
140
  }
141
  if ( isset( $parts['title2'] ) ) {
142
  /* translators: %s is a number */
143
- $count = sprintf( _n( 'Average of %s Rating:', 'Average of %s Ratings:', $summary['rating_count'], 'strong-testimonials' ), $summary['rating_count'] );
144
  $parts['title2'] = sprintf( '<span class="strong-rating-title">%s</span>', $count );
145
  }
146
 
@@ -163,14 +163,14 @@ class Strong_Testimonials_Average_Shortcode {
163
  if ( isset( $parts['summary'] ) ) {
164
 
165
  /* translators: %s is a number */
166
- $average = sprintf( _n( '%s star', '%s stars', $summary['rating_average'], 'strong-testimonials' ), $summary['rating_average'] );
167
- $count = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $summary['rating_count'], 'strong-testimonials' ), $summary['rating_count'] );
168
  $parts['summary'] = sprintf( '<span class="strong-rating-summary">%s</span>', $average . ' ' . $count );
169
 
170
  } elseif ( isset( $parts['summary2'] ) ) {
171
 
172
  /* translators: %s is a number */
173
- $average = sprintf( _n( '%s star', '%s stars', $summary['rating_average'], 'strong-testimonials' ), $summary['rating_average'] );
174
  $parts['summary2'] = sprintf( '<span class="strong-rating-summary">%s</span>', $average );
175
 
176
  }
@@ -208,9 +208,9 @@ class Strong_Testimonials_Average_Shortcode {
208
  if ( $posts ) {
209
 
210
  // initialize totals
211
- $review_count = count( $posts );
212
- $rating_count = 0;
213
- $rating_sum = 0;
214
  // initial values for each rating
215
  $rating_detail = array_fill_keys( array( 5, 4, 3, 2, 1, 0 ), 0 );
216
 
@@ -235,6 +235,7 @@ class Strong_Testimonials_Average_Shortcode {
235
  'rating_detail' => $rating_detail,
236
  );
237
  }
 
238
  }
239
 
240
  return $average;
@@ -251,10 +252,10 @@ class Strong_Testimonials_Average_Shortcode {
251
  $rating_field = $this->find_first_rating_field();
252
 
253
  if ( $rating_field ) {
254
- $rating = intval( get_post_meta( $post->ID, $rating_field['name'], true ) );
255
- if ( ! $rating ) {
256
- $rating = intval( $rating_field['default_display_value'] );
257
- }
258
  } else {
259
  $rating = 5;
260
  }
@@ -288,15 +289,15 @@ class Strong_Testimonials_Average_Shortcode {
288
  * @return string
289
  */
290
  public function print_stars( $rating = 0.0, $class = 'strong-rating' ) {
291
- $rating = (float) $rating;
292
  $is_zero = ( 0 == $rating ) ? ' current' : '';
293
  ob_start();
294
  ?>
295
  <span class="<?php echo esc_attr( $class ); ?>">
296
- <span class="star0 star<?php echo esc_attr( $is_zero ); ?>"></span>
297
  <?php
298
  if ( $is_zero ) {
299
- echo wp_kses_post( str_repeat( '<span class="star"></span>', 5 ) );
300
  } else {
301
  for ( $i = 1; $i <= 5; $i++ ) {
302
  $star_class = 'star';
@@ -306,7 +307,7 @@ class Strong_Testimonials_Average_Shortcode {
306
  if ( 0.5 == $i - $rating ) {
307
  $star_class .= ' half';
308
  }
309
- printf( '<span class="%s"></span>', esc_attr( $star_class ) );
310
  }
311
  }
312
  ?>
49
  }
50
 
51
  // set parts
52
+ preg_match_all( "#{(.*?)}#", $content, $parts );
53
  /*
54
  * Example:
55
  *
102
  * Example:
103
  *
104
  * Array
105
+ * (
106
+ * [review_count] => 2
107
+ * [rating_count] => 2
108
+ * [rating_sum] => 10
109
+ * [rating_average] => 5
110
+ * [rating_detail] => Array
111
+ * (
112
+ * [5] => 2
113
+ * [4] => 0
114
+ * [3] => 0
115
+ * [2] => 0
116
+ * [1] => 0
117
+ * [0] => 0
118
+ * )
119
+ * )
120
  */
121
 
122
  // Want to build your own HTML? Return any truthy value to short-circuit this shortcode output.
140
  }
141
  if ( isset( $parts['title2'] ) ) {
142
  /* translators: %s is a number */
143
+ $count = sprintf( _n( 'Average of %s Rating:', 'Average of %s Ratings:', $summary['rating_count'], 'strong-testimonials' ), $summary['rating_count'] );
144
  $parts['title2'] = sprintf( '<span class="strong-rating-title">%s</span>', $count );
145
  }
146
 
163
  if ( isset( $parts['summary'] ) ) {
164
 
165
  /* translators: %s is a number */
166
+ $average = sprintf( _n( '%s star', '%s stars', $summary['rating_average'], 'strong-testimonials' ), $summary['rating_average'] );
167
+ $count = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $summary['rating_count'], 'strong-testimonials' ), $summary['rating_count'] );
168
  $parts['summary'] = sprintf( '<span class="strong-rating-summary">%s</span>', $average . ' ' . $count );
169
 
170
  } elseif ( isset( $parts['summary2'] ) ) {
171
 
172
  /* translators: %s is a number */
173
+ $average = sprintf( _n( '%s star', '%s stars', $summary['rating_average'], 'strong-testimonials' ), $summary['rating_average'] );
174
  $parts['summary2'] = sprintf( '<span class="strong-rating-summary">%s</span>', $average );
175
 
176
  }
208
  if ( $posts ) {
209
 
210
  // initialize totals
211
+ $review_count = count( $posts );
212
+ $rating_count = 0;
213
+ $rating_sum = 0;
214
  // initial values for each rating
215
  $rating_detail = array_fill_keys( array( 5, 4, 3, 2, 1, 0 ), 0 );
216
 
235
  'rating_detail' => $rating_detail,
236
  );
237
  }
238
+
239
  }
240
 
241
  return $average;
252
  $rating_field = $this->find_first_rating_field();
253
 
254
  if ( $rating_field ) {
255
+ $rating = intval( get_post_meta( $post->ID, $rating_field['name'], true ) );
256
+ if ( ! $rating ) {
257
+ $rating = intval( $rating_field['default_display_value'] );
258
+ }
259
  } else {
260
  $rating = 5;
261
  }
289
  * @return string
290
  */
291
  public function print_stars( $rating = 0.0, $class = 'strong-rating' ) {
292
+ $rating = (double) $rating;
293
  $is_zero = ( 0 == $rating ) ? ' current' : '';
294
  ob_start();
295
  ?>
296
  <span class="<?php echo esc_attr( $class ); ?>">
297
+ <span class="star0 star<?php echo $is_zero; ?>"></span>
298
  <?php
299
  if ( $is_zero ) {
300
+ echo str_repeat( '<span class="star"></span>', 5 );
301
  } else {
302
  for ( $i = 1; $i <= 5; $i++ ) {
303
  $star_class = 'star';
307
  if ( 0.5 == $i - $rating ) {
308
  $star_class .= ' half';
309
  }
310
+ printf( '<span class="%s"></span>', $star_class );
311
  }
312
  }
313
  ?>
includes/class-strong-testimonials-shortcode-count.php CHANGED
@@ -53,7 +53,7 @@ class Strong_Testimonials_Count_Shortcode {
53
  'taxonomy' => 'wpm-testimonial-category',
54
  'field' => 'slug',
55
  'terms' => $atts['category'],
56
- ),
57
  );
58
 
59
  }
53
  'taxonomy' => 'wpm-testimonial-category',
54
  'field' => 'slug',
55
  'terms' => $atts['category'],
56
+ )
57
  );
58
 
59
  }
includes/class-strong-testimonials-shortcode.php CHANGED
@@ -74,8 +74,8 @@ class Strong_Testimonials_View_Shortcode {
74
  ob_start();
75
  ?>
76
  <p style="color: #CD0000;">
77
- <?php printf( esc_html__( 'Testimonial view %s not found.', 'strong-testimonials' ), esc_html( $out['view'] ) ); ?><br>
78
- <span style="color: #777; font-size: 0.9em;"><?php esc_html_e( '(Only administrators see this message.)', 'strong-testimonials' ); ?></span>
79
  </p>
80
  <?php
81
  return ob_get_clean();
@@ -83,21 +83,21 @@ class Strong_Testimonials_View_Shortcode {
83
  }
84
 
85
  switch ( $out['mode'] ) {
86
- case 'form':
87
  $view = new Strong_View_Form( $out );
88
  if ( isset( $_GET['success'] ) ) {
89
- $view->success();
90
  } else {
91
  $view->build();
92
  }
93
  break;
94
- case 'slideshow':
95
  $view = new Strong_View_Slideshow( $out );
96
- $view->build();
97
  break;
98
- default:
99
  $view = new Strong_View_Display( $out );
100
- $view->build();
101
  }
102
 
103
  return $view->output();
74
  ob_start();
75
  ?>
76
  <p style="color: #CD0000;">
77
+ <?php printf( __( 'Testimonial view %s not found.', 'strong-testimonials' ), $out['view'] ); ?><br>
78
+ <span style="color: #777; font-size: 0.9em;"><?php _e( '(Only administrators see this message.)', 'strong-testimonials' ); ?></span>
79
  </p>
80
  <?php
81
  return ob_get_clean();
83
  }
84
 
85
  switch ( $out['mode'] ) {
86
+ case 'form' :
87
  $view = new Strong_View_Form( $out );
88
  if ( isset( $_GET['success'] ) ) {
89
+ $view->success();
90
  } else {
91
  $view->build();
92
  }
93
  break;
94
+ case 'slideshow' :
95
  $view = new Strong_View_Slideshow( $out );
96
+ $view->build();
97
  break;
98
+ default :
99
  $view = new Strong_View_Display( $out );
100
+ $view->build();
101
  }
102
 
103
  return $view->output();
includes/class-strong-view-display.php CHANGED
@@ -6,473 +6,477 @@
6
  */
7
 
8
  // Exit if accessed directly
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
 
13
  if ( ! class_exists( 'Strong_View_Display' ) ) :
14
 
15
- class Strong_View_Display extends Strong_View {
16
-
17
- /**
18
- * The number of posts.
19
- *
20
- * @var int
21
- */
22
- public $post_count;
23
- public $found_posts;
24
-
25
- /**
26
- * The number of pages.
27
- *
28
- * @var int
29
- */
30
- public $page_count = 1;
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- /**
33
- * Strong_View constructor.
34
- *
35
- * @param array $atts
36
- */
37
- public function __construct( $atts = array() ) {
38
- parent::__construct( $atts );
39
- add_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) );
40
- add_action( 'wpmtst_view_processed', array( $this, 'reset_view' ) );
41
- }
42
 
43
- /**
44
- * Reset stuff after view is processed or rendered.
45
- *
46
- * @since 2.31.0
47
- */
48
- public function reset_view() {
49
- wp_reset_postdata();
50
- remove_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) );
 
 
 
 
 
51
  }
52
 
53
- /**
54
- * Adjust query for standard pagination.
55
- *
56
- * @param $args
57
- *
58
- * @return mixed
59
- */
60
- public function query_pagination( $args ) {
61
- if ( $this->atts['pagination'] && 'standard' == $this->atts['pagination_settings']['type'] ) {
62
- // Limit is not compatible with standard pagination.
63
- $this->atts['count'] = -1;
64
- $args['posts_per_page'] = $this->atts['pagination_settings']['per_page'];
65
- $args['paged'] = wpmtst_get_paged();
66
- }
67
-
68
- return $args;
69
- }
70
 
71
- /**
72
- * Process the view.
73
- *
74
- * Used by main class to load the scripts and styles for this View.
75
- */
76
- public function process() {
77
- $this->build_query();
78
- $this->build_classes();
79
 
80
- $this->find_stylesheet();
81
- $this->has_stars();
82
- $this->has_pagination();
83
- $this->has_layouts();
84
- $this->has_readmore();
85
 
86
- $this->load_extra_stylesheets();
87
 
88
- // If we can preprocess, we can add the inline style in <head>.
89
- add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
90
 
91
- do_action( 'wpmtst_view_processed' );
92
- }
93
 
94
- /**
95
- * Build the view.
96
- */
97
- public function build() {
98
- // May need to remove any hooks or filters that were set by other Views on the page.
99
 
100
- do_action( 'wpmtst_view_build_before', $this );
101
 
102
- $this->build_query();
103
- $this->build_classes();
104
 
105
- $this->find_stylesheet();
106
- $this->has_stars();
107
- $this->has_pagination();
108
- $this->has_layouts();
109
 
110
- $this->load_dependent_scripts();
111
- $this->load_extra_stylesheets();
112
 
113
- // If we cannot preprocess, add the inline style to the footer.
114
- add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
115
 
116
- /**
117
- * Add filters.
118
- */
119
- $this->add_content_filters();
120
- add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 );
121
- add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 );
122
 
123
- /**
124
- * Add actions.
125
- */
126
 
127
- // Standard pagination
128
- if ( $this->atts['pagination'] && 'standard' == $this->atts['pagination_settings']['type'] ) {
129
- if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'before' ) ) {
130
- add_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' );
131
- }
132
- if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'after' ) ) {
133
- add_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' );
134
- }
135
  }
 
 
 
 
136
 
137
- // Read more page
138
- add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
139
-
140
- /**
141
- * Locate template.
142
- */
143
- $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
144
-
145
- /**
146
- * Allow add-ons to hijack the output generation.
147
- */
148
- $query = $this->query;
149
- $atts = $this->atts;
150
- $html = '';
151
-
152
- if ( ! $this->found_posts ) {
153
-
154
- if ( current_user_can( 'strong_testimonials_views' ) ) {
155
- $html = $this->nothing_found();
156
- }
157
- } elseif ( has_filter( 'wpmtst_render_view_template' ) ) {
158
-
159
- $html = apply_filters( 'wpmtst_render_view_template', '', $this );
160
-
161
- } else {
162
 
163
- /**
164
- * Gutenberg. Yay.
165
- * @since 2.31.9
166
- */
167
- global $post;
168
- $post_before = $post;
169
 
170
- ob_start();
171
- /** @noinspection PhpIncludeInspection */
172
- include $this->template_file;
173
- $html = ob_get_clean();
 
 
174
 
175
- $post = $post_before;
176
 
 
 
177
  }
178
 
179
- /**
180
- * Remove filters.
181
- */
182
- $this->remove_content_filters();
183
- remove_filter( 'get_avatar', 'wpmtst_get_avatar' );
184
- remove_filter( 'embed_defaults', 'wpmtst_embed_size' );
185
 
186
- /**
187
- * Remove actions.
188
- */
189
- remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
190
- remove_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' );
191
- remove_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' );
192
 
193
  /**
194
- * Hook to enqueue scripts.
 
195
  */
196
- do_action( 'wpmtst_view_rendered', $this->atts );
 
197
 
198
- do_action( 'wpmtst_view_processed' );
 
 
 
199
 
200
- $this->html = apply_filters( 'strong_view_html', $html, $this );
201
 
202
  }
203
 
204
  /**
205
- * Build our query.
206
  */
207
- public function build_query() {
208
- $ids = explode( ',', $this->atts['id'] );
209
-
210
- $args = array(
211
- 'post_type' => 'wpm-testimonial',
212
- 'post_status' => 'publish',
213
- 'posts_per_page' => -1,
214
- 'paged' => null,
215
- );
216
- $args = apply_filters( 'wpmtst_build_query', $args );
217
-
218
- // id's override category
219
- if ( $this->atts['id'] ) {
220
- $args['post__in'] = $ids;
221
- } elseif ( $this->atts['category'] ) {
222
- $categories = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->atts['category'] ) );
223
- $args['tax_query'] = array(
224
- array(
225
- 'taxonomy' => 'wpm-testimonial-category',
226
- 'field' => 'id',
227
- 'terms' => $categories,
228
- ),
229
- );
230
- }
231
-
232
- // order by
233
- // TODO improve for allowable custom order
234
- if ( 'menu_order' == $this->atts['order'] ) {
235
- $args['orderby'] = 'menu_order';
236
- $args['order'] = 'ASC';
237
- } else {
238
- $args['orderby'] = 'post_date';
239
- if ( 'newest' == $this->atts['order'] ) {
240
- $args['order'] = 'DESC';
241
- } else {
242
- $args['order'] = 'ASC';
243
- }
244
- }
245
-
246
- // For Post Types Order plugin
247
- $args['ignore_custom_sort'] = true;
248
-
249
- $query = new WP_Query( apply_filters( 'wpmtst_query_args', $args, $this->atts ) );
250
-
251
- /**
252
- * Shuffle array in PHP instead of SQL.
253
- *
254
- * @since 1.16
255
- */
256
- if ( 'random' == $this->atts['order'] ) {
257
- shuffle( $query->posts );
258
- }
259
-
260
- /**
261
- * Extract slice of array, which may be shuffled.
262
- *
263
- * Use lesser value: requested count or actual count.
264
- * Thanks chestozo.
265
- *
266
- * @link https://github.com/cdillon/strong-testimonials/pull/5
267
- *
268
- * @since 1.16.1
269
- */
270
- if ( $this->atts['count'] > 0 ) {
271
- $count = min( $this->atts['count'], count( $query->posts ) );
272
- $query->posts = array_slice( $query->posts, 0, $count );
273
- $query->post_count = $count;
274
- $query->found_posts = $count;
275
- }
276
-
277
- $this->post_count = $query->post_count;
278
- $this->found_posts = $query->found_posts;
279
- $this->query = $query;
280
- WPMST()->set_query( $query );
281
- }
282
 
283
  /**
284
- * Build class list based on view attributes.
285
- *
286
- * This must happen after the query.
287
- * TODO DRY
288
  */
289
- public function build_classes() {
290
- $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
291
- $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
292
-
293
- if ( is_rtl() ) {
294
- $container_class_list[] = 'rtl';
295
- }
296
 
297
- if ( $this->atts['class'] ) {
298
- $container_class_list[] = $this->atts['class'];
299
- }
300
-
301
- $container_data_list = array(
302
- 'count' => $this->post_count,
303
- );
304
 
305
- $content_class_list = array();
306
 
307
- $post_class_list = array( 'testimonial' );
308
 
309
- if ( 'excerpt' == $this->atts['content'] ) {
310
- $post_class_list[] = 'excerpt';
311
- }
312
 
313
- if ( $this->is_paginated() && ! $this->is_masonry() ) {
314
- $content_class_list[] = 'strong-paginated';
315
- $container_class_list[] = 'strong-pager';
316
- $container_data_list['pager-var'] = $this->pager_signature();
317
- $container_data_list['state'] = 'idle';
318
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
- if ( $this->is_masonry() ) {
321
- $container_data_list['state'] = 'idle';
 
 
 
 
 
 
 
 
322
  }
323
-
324
- if ( $this->is_hybrid() ) {
325
- $container_class_list[] = 'more-in-place';
326
  }
 
327
 
328
- // layouts
329
- $content_class_list[] = 'strong-' . ( $this->atts['layout'] ? $this->atts['layout'] : 'normal' );
330
- $content_class_list[] = 'columns-' . ( $this->atts['layout'] ? $this->atts['column_count'] : '1' );
331
-
332
- /**
333
- * Filter classes.
334
- */
335
- $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
336
- $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', $container_class_list, $this->atts ) );
337
- $this->atts['content_class'] = join( ' ', apply_filters( 'wpmtst_view_content_class', $content_class_list, $this->atts ) );
338
- $this->atts['post_class'] = join( ' ', apply_filters( 'wpmtst_view_post_class', $post_class_list, $this->atts ) );
339
 
340
- /**
341
- * Store updated atts.
342
- */
343
- WPMST()->set_atts( $this->atts );
344
- }
345
 
346
  /**
347
- * Return true if using simple pagination (JavaScript).
348
- *
349
- * @since 2.28.0
350
  *
351
- * @return bool
352
  */
353
- public function is_paginated() {
354
- return ( $this->atts['pagination'] && 'simple' == $this->atts['pagination_settings']['type'] );
355
  }
356
 
357
  /**
358
- * Return true if using Masonry.
 
 
 
359
  *
360
- * @since 2.28.0
361
  *
362
- * @return bool
363
  */
364
- public function is_masonry() {
365
- return ( 'masonry' == $this->atts['layout'] );
 
 
 
366
  }
367
 
368
- /**
369
- * Return true if read-more in place.
370
- *
371
- * @since 2.33.0
372
- *
373
- * @return bool
374
- */
375
- public function is_hybrid() {
376
- return ( isset( $this->atts['more_post_in_place'] ) && $this->atts['more_post_in_place'] );
 
 
 
 
 
 
 
 
 
377
  }
378
 
379
- /**
380
- * Pagination
381
- *
382
- * @since 2.16.0 In Strong_View class.
383
- */
384
- public function has_pagination() {
385
- if ( $this->is_paginated() ) {
386
- WPMST()->render->add_script( 'wpmtst-pager' );
387
- WPMST()->render->add_script_var( 'wpmtst-pager', $this->pager_signature(), $this->pager_args() );
388
- WPMST()->render->add_script( 'wpmtst-controller' );
389
- }
 
 
 
 
 
 
 
 
 
 
390
  }
391
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  /**
393
- * Create unique pager signature.
394
- *
395
- * @since 2.13.2
396
- * @since 2.22.3 In this class.
397
- *
398
- * @return string
399
  */
400
- public function pager_signature() {
401
- return 'strong_pager_id_' . $this->atts['view'];
402
- }
 
403
 
404
  /**
405
- * Assemble pager settings.
406
- *
407
- * @since 2.13.2
408
- * @since 2.22.3 In this class.
409
- *
410
- * @return array
411
  */
412
- public function pager_args() {
413
- $options = get_option( 'wpmtst_options' );
414
 
415
- $nav = $this->atts['pagination_settings']['nav'];
416
- if ( false !== strpos( $nav, 'before' ) && false !== strpos( $nav, 'after' ) ) {
417
- $nav = 'both';
418
- }
 
 
 
 
 
 
419
 
420
- // Remember: top level is converted to strings!
421
- $args = array(
422
- 'config' => array(
423
- 'pageSize' => $this->atts['pagination_settings']['per_page'],
424
- 'currentPage' => 1,
425
- 'pagerLocation' => $nav,
426
- 'scrollTop' => $options['scrolltop'],
427
- 'offset' => $options['scrolltop_offset'],
428
- 'imagesLoaded' => true,
429
- ),
430
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
 
432
- return apply_filters( 'wpmtst_view_pagination', $args, $this->atts['view'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  }
434
 
435
- /**
436
- * Layouts
437
- *
438
- * @since 2.16.0 In Strong_View class.
439
- */
440
- public function has_layouts() {
441
- if ( $this->is_masonry() ) {
 
 
 
 
 
 
 
442
 
443
- WPMST()->render->add_script( 'jquery-masonry' );
444
- WPMST()->render->add_script( 'imagesloaded' );
 
 
 
 
 
445
 
446
- if ( apply_filters( 'wpmtst_load_masonry_style', true ) ) {
447
- WPMST()->render->add_style( 'wpmtst-masonry-style' );
448
- }
449
- } elseif ( 'columns' == $this->atts['layout'] ) {
 
 
450
 
451
- if ( apply_filters( 'wpmtst_load_columns_style', true ) ) {
452
- WPMST()->render->add_style( 'wpmtst-columns-style' );
453
- }
454
- } elseif ( 'grid' == $this->atts['layout'] ) {
455
 
456
- if ( apply_filters( 'wpmtst_load_grid_style', true ) ) {
457
- WPMST()->render->add_style( 'wpmtst-grid-style' );
458
- }
459
  }
460
 
461
- WPMST()->render->add_script( 'wpmtst-controller' );
462
- }
463
 
464
- /**
465
- * Read more in place
466
- *
467
- * @since 2.33.0
468
- */
469
- public function has_readmore() {
470
- if ( $this->is_hybrid() ) {
471
- WPMST()->render->add_style( 'wpmtst-animate' );
472
- WPMST()->render->add_script( 'wpmtst-readmore' );
473
  }
474
  }
475
 
 
476
  }
477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  endif;
6
  */
7
 
8
  // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
10
 
11
  if ( ! class_exists( 'Strong_View_Display' ) ) :
12
 
13
+ class Strong_View_Display extends Strong_View {
14
+
15
+ /**
16
+ * The number of posts.
17
+ *
18
+ * @var int
19
+ */
20
+ public $post_count;
21
+ public $found_posts;
22
+
23
+ /**
24
+ * The number of pages.
25
+ *
26
+ * @var int
27
+ */
28
+ public $page_count = 1;
29
+
30
+ /**
31
+ * Strong_View constructor.
32
+ *
33
+ * @param array $atts
34
+ */
35
+ public function __construct( $atts = array() ) {
36
+ parent::__construct( $atts );
37
+ add_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) );
38
+ add_action( 'wpmtst_view_processed', array( $this, 'reset_view' ) );
39
+ }
40
 
41
+ /**
42
+ * Reset stuff after view is processed or rendered.
43
+ *
44
+ * @since 2.31.0
45
+ */
46
+ public function reset_view() {
47
+ wp_reset_postdata();
48
+ remove_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) );
49
+ }
 
50
 
51
+ /**
52
+ * Adjust query for standard pagination.
53
+ *
54
+ * @param $args
55
+ *
56
+ * @return mixed
57
+ */
58
+ public function query_pagination( $args ) {
59
+ if ( $this->atts['pagination'] && 'standard' == $this->atts['pagination_settings']['type'] ) {
60
+ // Limit is not compatible with standard pagination.
61
+ $this->atts['count'] = -1;
62
+ $args['posts_per_page'] = $this->atts['pagination_settings']['per_page'];
63
+ $args['paged'] = wpmtst_get_paged();
64
  }
65
 
66
+ return $args;
67
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ /**
70
+ * Process the view.
71
+ *
72
+ * Used by main class to load the scripts and styles for this View.
73
+ */
74
+ public function process() {
75
+ $this->build_query();
76
+ $this->build_classes();
77
 
78
+ $this->find_stylesheet();
79
+ $this->has_stars();
80
+ $this->has_pagination();
81
+ $this->has_layouts();
82
+ $this->has_readmore();
83
 
84
+ $this->load_extra_stylesheets();
85
 
86
+ // If we can preprocess, we can add the inline style in <head>.
87
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
88
 
89
+ do_action( 'wpmtst_view_processed' );
90
+ }
91
 
92
+ /**
93
+ * Build the view.
94
+ */
95
+ public function build() {
96
+ // May need to remove any hooks or filters that were set by other Views on the page.
97
 
98
+ do_action( 'wpmtst_view_build_before', $this );
99
 
100
+ $this->build_query();
101
+ $this->build_classes();
102
 
103
+ $this->find_stylesheet();
104
+ $this->has_stars();
105
+ $this->has_pagination();
106
+ $this->has_layouts();
107
 
108
+ $this->load_dependent_scripts();
109
+ $this->load_extra_stylesheets();
110
 
111
+ // If we cannot preprocess, add the inline style to the footer.
112
+ add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
113
 
114
+ /**
115
+ * Add filters.
116
+ */
117
+ $this->add_content_filters();
118
+ add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 );
119
+ add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 );
120
 
121
+ /**
122
+ * Add actions.
123
+ */
124
 
125
+ // Standard pagination
126
+ if ( $this->atts['pagination'] && 'standard' == $this->atts['pagination_settings']['type'] ) {
127
+ if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'before' ) ) {
128
+ add_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' );
 
 
 
 
129
  }
130
+ if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'after' ) ) {
131
+ add_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' );
132
+ }
133
+ }
134
 
135
+ // Read more page
136
+ add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ /**
139
+ * Locate template.
140
+ */
141
+ $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
 
 
142
 
143
+ /**
144
+ * Allow add-ons to hijack the output generation.
145
+ */
146
+ $query = $this->query;
147
+ $atts = $this->atts;
148
+ $html = '';
149
 
150
+ if ( ! $this->found_posts ) {
151
 
152
+ if ( current_user_can( 'strong_testimonials_views' ) ) {
153
+ $html = $this->nothing_found();
154
  }
155
 
156
+ } elseif ( has_filter( 'wpmtst_render_view_template' ) ) {
 
 
 
 
 
157
 
158
+ $html = apply_filters( 'wpmtst_render_view_template', '', $this );
159
+
160
+ } else {
 
 
 
161
 
162
  /**
163
+ * Gutenberg. Yay.
164
+ * @since 2.31.9
165
  */
166
+ global $post;
167
+ $post_before = $post;
168
 
169
+ ob_start();
170
+ /** @noinspection PhpIncludeInspection */
171
+ include( $this->template_file );
172
+ $html = ob_get_clean();
173
 
174
+ $post = $post_before;
175
 
176
  }
177
 
178
  /**
179
+ * Remove filters.
180
  */
181
+ $this->remove_content_filters();
182
+ remove_filter( 'get_avatar', 'wpmtst_get_avatar' );
183
+ remove_filter( 'embed_defaults', 'wpmtst_embed_size' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
  /**
186
+ * Remove actions.
 
 
 
187
  */
188
+ remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
189
+ remove_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' );
190
+ remove_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' );
 
 
 
 
191
 
192
+ /**
193
+ * Hook to enqueue scripts.
194
+ */
195
+ do_action( 'wpmtst_view_rendered', $this->atts );
 
 
 
196
 
197
+ do_action( 'wpmtst_view_processed' );
198
 
199
+ $this->html = apply_filters( 'strong_view_html', $html, $this );
200
 
201
+ }
 
 
202
 
203
+ /**
204
+ * Build our query.
205
+ */
206
+ public function build_query() {
207
+ $ids = explode( ',', $this->atts['id'] );
208
+
209
+ $args = array(
210
+ 'post_type' => 'wpm-testimonial',
211
+ 'post_status' => 'publish',
212
+ 'posts_per_page' => -1,
213
+ 'paged' => null,
214
+ );
215
+ $args = apply_filters( 'wpmtst_build_query', $args );
216
+
217
+ // id's override category
218
+ if ( $this->atts['id'] ) {
219
+ $args['post__in'] = $ids;
220
+ }
221
+ elseif ( $this->atts['category'] ) {
222
+ $categories = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->atts['category'] ) );
223
+ $args['tax_query'] = array(
224
+ array(
225
+ 'taxonomy' => 'wpm-testimonial-category',
226
+ 'field' => 'id',
227
+ 'terms' => $categories,
228
+ ),
229
+ );
230
+ }
231
 
232
+ // order by
233
+ // TODO improve for allowable custom order
234
+ if ( 'menu_order' == $this->atts['order'] ) {
235
+ $args['orderby'] = 'menu_order';
236
+ $args['order'] = 'ASC';
237
+ }
238
+ else {
239
+ $args['orderby'] = 'post_date';
240
+ if ( 'newest' == $this->atts['order'] ) {
241
+ $args['order'] = 'DESC';
242
  }
243
+ else {
244
+ $args['order'] = 'ASC';
 
245
  }
246
+ }
247
 
248
+ // For Post Types Order plugin
249
+ $args['ignore_custom_sort'] = true;
 
 
 
 
 
 
 
 
 
250
 
251
+ $query = new WP_Query( apply_filters( 'wpmtst_query_args', $args, $this->atts ) );
 
 
 
 
252
 
253
  /**
254
+ * Shuffle array in PHP instead of SQL.
 
 
255
  *
256
+ * @since 1.16
257
  */
258
+ if ( 'random' == $this->atts['order'] ) {
259
+ shuffle( $query->posts );
260
  }
261
 
262
  /**
263
+ * Extract slice of array, which may be shuffled.
264
+ *
265
+ * Use lesser value: requested count or actual count.
266
+ * Thanks chestozo.
267
  *
268
+ * @link https://github.com/cdillon/strong-testimonials/pull/5
269
  *
270
+ * @since 1.16.1
271
  */
272
+ if ( $this->atts['count'] > 0 ) {
273
+ $count = min( $this->atts['count'], count( $query->posts ) );
274
+ $query->posts = array_slice( $query->posts, 0, $count );
275
+ $query->post_count = $count;
276
+ $query->found_posts = $count;
277
  }
278
 
279
+ $this->post_count = $query->post_count;
280
+ $this->found_posts = $query->found_posts;
281
+ $this->query = $query;
282
+ WPMST()->set_query( $query );
283
+ }
284
+
285
+ /**
286
+ * Build class list based on view attributes.
287
+ *
288
+ * This must happen after the query.
289
+ * TODO DRY
290
+ */
291
+ public function build_classes() {
292
+ $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
293
+ $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
294
+
295
+ if ( is_rtl() ) {
296
+ $container_class_list[] = 'rtl';
297
  }
298
 
299
+ if ( $this->atts['class'] ) {
300
+ $container_class_list[] = $this->atts['class'];
301
+ }
302
+
303
+ $container_data_list = array(
304
+ 'count' => $this->post_count,
305
+ );
306
+
307
+ $content_class_list = array();
308
+
309
+ $post_class_list = array( 'testimonial' );
310
+
311
+ if ( 'excerpt' == $this->atts['content'] ) {
312
+ $post_class_list[] = 'excerpt';
313
+ }
314
+
315
+ if ( $this->is_paginated() && ! $this->is_masonry() ) {
316
+ $content_class_list[] = 'strong-paginated';
317
+ $container_class_list[] = 'strong-pager';
318
+ $container_data_list['pager-var'] = $this->pager_signature();
319
+ $container_data_list['state'] = 'idle';
320
  }
321
 
322
+ if ( $this->is_masonry() ) {
323
+ $container_data_list['state'] = 'idle';
324
+ }
325
+
326
+ if ( $this->is_hybrid() ) {
327
+ $container_class_list[] = 'more-in-place';
328
+ }
329
+
330
+ // layouts
331
+ $content_class_list[] = 'strong-' . ( $this->atts['layout'] ? $this->atts['layout'] : 'normal' );
332
+ $content_class_list[] = 'columns-' . ( $this->atts['layout'] ? $this->atts['column_count'] : '1' );
333
+
334
  /**
335
+ * Filter classes.
 
 
 
 
 
336
  */
337
+ $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
338
+ $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', $container_class_list, $this->atts ) );
339
+ $this->atts['content_class'] = join( ' ', apply_filters( 'wpmtst_view_content_class', $content_class_list, $this->atts ) );
340
+ $this->atts['post_class'] = join( ' ', apply_filters( 'wpmtst_view_post_class', $post_class_list, $this->atts ) );
341
 
342
  /**
343
+ * Store updated atts.
 
 
 
 
 
344
  */
345
+ WPMST()->set_atts( $this->atts );
346
+ }
347
 
348
+ /**
349
+ * Return true if using simple pagination (JavaScript).
350
+ *
351
+ * @since 2.28.0
352
+ *
353
+ * @return bool
354
+ */
355
+ public function is_paginated() {
356
+ return ( $this->atts['pagination'] && 'simple' == $this->atts['pagination_settings']['type'] );
357
+ }
358
 
359
+ /**
360
+ * Return true if using Masonry.
361
+ *
362
+ * @since 2.28.0
363
+ *
364
+ * @return bool
365
+ */
366
+ public function is_masonry() {
367
+ return ( 'masonry' == $this->atts['layout'] );
368
+ }
369
+
370
+ /**
371
+ * Return true if read-more in place.
372
+ *
373
+ * @since 2.33.0
374
+ *
375
+ * @return bool
376
+ */
377
+ public function is_hybrid() {
378
+ return ( isset( $this->atts['more_post_in_place'] ) && $this->atts['more_post_in_place'] );
379
+ }
380
+
381
+ /**
382
+ * Pagination
383
+ *
384
+ * @since 2.16.0 In Strong_View class.
385
+ */
386
+ public function has_pagination() {
387
+ if ( $this->is_paginated() ) {
388
+ WPMST()->render->add_script( 'wpmtst-pager' );
389
+ WPMST()->render->add_script_var( 'wpmtst-pager', $this->pager_signature(), $this->pager_args() );
390
+ WPMST()->render->add_script( 'wpmtst-controller' );
391
+ }
392
+ }
393
 
394
+ /**
395
+ * Create unique pager signature.
396
+ *
397
+ * @since 2.13.2
398
+ * @since 2.22.3 In this class.
399
+ *
400
+ * @return string
401
+ */
402
+ public function pager_signature() {
403
+ return 'strong_pager_id_' . $this->atts['view'];
404
+ }
405
+
406
+ /**
407
+ * Assemble pager settings.
408
+ *
409
+ * @since 2.13.2
410
+ * @since 2.22.3 In this class.
411
+ *
412
+ * @return array
413
+ */
414
+ public function pager_args() {
415
+ $options = get_option( 'wpmtst_options' );
416
+
417
+ $nav = $this->atts['pagination_settings']['nav'];
418
+ if ( false !== strpos( $nav, 'before' ) && false !== strpos( $nav, 'after' ) ) {
419
+ $nav = 'both';
420
  }
421
 
422
+ // Remember: top level is converted to strings!
423
+ $args = array(
424
+ 'config' => array(
425
+ 'pageSize' => $this->atts['pagination_settings']['per_page'],
426
+ 'currentPage' => 1,
427
+ 'pagerLocation' => $nav,
428
+ 'scrollTop' => $options['scrolltop'],
429
+ 'offset' => $options['scrolltop_offset'],
430
+ 'imagesLoaded' => true,
431
+ ),
432
+ );
433
+
434
+ return apply_filters( 'wpmtst_view_pagination', $args, $this->atts['view'] );
435
+ }
436
 
437
+ /**
438
+ * Layouts
439
+ *
440
+ * @since 2.16.0 In Strong_View class.
441
+ */
442
+ public function has_layouts() {
443
+ if ( $this->is_masonry() ) {
444
 
445
+ WPMST()->render->add_script( 'jquery-masonry' );
446
+ WPMST()->render->add_script( 'imagesloaded' );
447
+
448
+ if ( apply_filters( 'wpmtst_load_masonry_style', true ) ) {
449
+ WPMST()->render->add_style( 'wpmtst-masonry-style' );
450
+ }
451
 
452
+ } elseif ( 'columns' == $this->atts['layout'] ) {
 
 
 
453
 
454
+ if ( apply_filters( 'wpmtst_load_columns_style', true ) ) {
455
+ WPMST()->render->add_style( 'wpmtst-columns-style' );
 
456
  }
457
 
458
+ } elseif ( 'grid' == $this->atts['layout'] ) {
 
459
 
460
+ if ( apply_filters( 'wpmtst_load_grid_style', true ) ) {
461
+ WPMST()->render->add_style( 'wpmtst-grid-style' );
 
 
 
 
 
 
 
462
  }
463
  }
464
 
465
+ WPMST()->render->add_script( 'wpmtst-controller' );
466
  }
467
 
468
+ /**
469
+ * Read more in place
470
+ *
471
+ * @since 2.33.0
472
+ */
473
+ public function has_readmore() {
474
+ if ( $this->is_hybrid() ) {
475
+ WPMST()->render->add_style( 'wpmtst-animate' );
476
+ WPMST()->render->add_script( 'wpmtst-readmore' );
477
+ }
478
+ }
479
+
480
+ }
481
+
482
  endif;
includes/class-strong-view-form.php CHANGED
@@ -6,289 +6,288 @@
6
  */
7
 
8
  // Exit if accessed directly
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
 
13
  if ( ! class_exists( 'Strong_View_Form' ) ) :
14
 
15
- class Strong_View_Form extends Strong_View {
16
 
17
- /**
18
- * Strong_View_Form constructor.
19
- *
20
- * @param array $atts
21
- */
22
- public function __construct( $atts = array() ) {
23
- parent::__construct( $atts );
24
- }
25
 
26
- /**
27
- * Process the view.
28
- *
29
- * Used by main class to load the scripts and styles for this View.
30
- */
31
- public function process() {
32
- $this->build_classes();
33
- $this->find_stylesheet();
34
- $this->load_dependent_scripts();
35
- $this->load_extra_stylesheets();
36
- $this->load_validator();
37
-
38
- // If we can preprocess, we can add the inline style in the <head>.
39
- add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
40
- }
41
 
42
- /**
43
- * Print overlay while form data is submitted.
44
- *
45
- * This helps when uploading large files and on slow connections.
46
- *
47
- * @since 2.31.5
48
- */
49
- public function print_overlay() {
50
- if ( apply_filters( 'wpmtst_form_wait', true ) ) {
51
- WPMST()->render->add_style( 'wpmtst-font-awesome' );
52
- ?>
53
  <div class="strong-form-wait">
54
  <div class="message">
55
  <?php echo wp_kses_post( apply_filters( 'wpmtst_form_wait_message', '<i class="fa fa-2x fa-spinner fa-pulse" aria-hidden="true"></i>' ) ); ?>
56
  </div>
57
  </div>
58
- <?php
59
- }
60
  }
 
61
 
62
- /**
63
- * Load resources on form success.
64
- *
65
- * When using normal form submission (not Ajax)
66
- * and displaying a success message (not redirecting).
67
- */
68
- public function success() {
69
- $form_options = get_option( 'wpmtst_form_options' );
70
-
71
- // Remember: top level is converted to strings!
72
- $args = array(
73
- 'display' => array(
74
- 'successMessage' => true,
75
- ),
76
- 'scroll' => array(
77
- 'onSuccess' => $form_options['scrolltop_success'],
78
- 'onSuccessOffset' => $form_options['scrolltop_success_offset'],
79
- ),
80
- );
81
-
82
- WPMST()->render->add_script( 'wpmtst-form-validation' );
83
- WPMST()->render->add_script_var( 'wpmtst-form-validation', 'strongForm', $args );
84
 
85
- $this->find_stylesheet();
86
- $this->html = wpmtst_get_success_message();
87
 
88
- do_action( 'wpmtst_form_success', $this->atts );
89
- }
90
 
91
- /**
92
- * Build the view.
93
- */
94
- public function build() {
95
 
96
- do_action( 'wpmtst_view_build_before', $this );
 
 
 
97
 
98
- $this->build_classes();
99
- $this->find_stylesheet();
100
- $this->load_dependent_scripts();
101
- $this->load_extra_stylesheets();
102
- $this->custom_background();
103
- $this->load_validator();
104
 
105
- // If we cannot preprocess, add the inline style to the footer.
106
- add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
107
- add_action( 'wp_footer', array( $this, 'load_honeypots' ) );
 
 
 
108
 
109
- $form_values = array( 'category' => $this->atts['category'] );
 
 
110
 
111
- $fields = wpmtst_get_form_fields( $this->atts['form_id'] );
112
- if ( $fields ) {
113
- foreach ( $fields as $key => $field ) {
114
- $form_values[ $field['name'] ] = '';
115
- }
116
- }
117
 
118
- $previous_values = WPMST()->form->get_form_values();
119
- if ( $previous_values ) {
120
- $form_values = array_merge( $form_values, $previous_values );
 
121
  }
 
122
 
123
- WPMST()->form->set_form_values( $form_values );
124
-
125
- /**
126
- * Add filters here.
127
- */
128
- add_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
129
-
130
- /**
131
- * Locate template.
132
- */
133
- $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
134
-
135
- /**
136
- * Allow add-ons to hijack the output generation.
137
- */
138
- $atts = $this->atts;
139
- if ( has_filter( 'wpmtst_render_view_template' ) ) {
140
- $html = apply_filters( 'wpmtst_render_view_template', '', $this );
141
- } else {
142
 
143
- /**
144
- * Gutenberg. Yay.
145
- * @since 2.31.9
146
- */
147
- global $post;
148
- $post_before = $post;
149
 
150
- ob_start();
151
- /** @noinspection PhpIncludeInspection */
152
- include $this->template_file;
153
- $html = ob_get_clean();
154
 
155
- $post = $post_before;
 
 
 
156
 
157
- }
158
- // TODO apply content filters
 
 
 
 
 
159
 
160
  /**
161
- * Remove filters here.
 
162
  */
163
- remove_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
 
164
 
165
- /**
166
- * Trigger stuff.
167
- */
168
- do_action( 'wpmtst_form_rendered', $this->atts );
169
 
170
- $this->html = apply_filters( 'strong_view_form_html', $html, $this );
171
 
172
  }
 
173
 
174
  /**
175
- * Build class list based on view attributes.
176
  */
177
- public function build_classes() {
178
 
179
- $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
180
- $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
 
 
181
 
182
- if ( is_rtl() ) {
183
- $container_class_list[] = 'rtl';
184
- }
185
 
186
- if ( $this->atts['class'] ) {
187
- $container_class_list[] = $this->atts['class'];
188
- }
189
 
190
- $container_data_list = array();
191
- $container_data_list['state'] = 'idle';
 
 
192
 
193
- /**
194
- * Filter classes.
195
- */
196
- $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
197
- $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', $container_class_list, $this->atts ) );
198
 
199
- /**
200
- * Store updated atts.
201
- */
202
- WPMST()->set_atts( $this->atts );
203
 
 
 
204
  }
205
 
 
 
 
206
  /**
207
- * Load validator script.
208
  */
209
- public function load_validator() {
 
210
 
211
- // Assemble list of field properties for validation script.
212
- $form_id = isset( $this->atts['form_id'] ) ? $this->atts['form_id'] : 1;
213
- $form_fields = wpmtst_get_form_fields( $form_id );
214
- $fields = array();
215
 
216
- foreach ( $form_fields as $field ) {
217
 
218
- $fields[] = array(
219
- 'name' => $field['name'],
220
- 'type' => $field['input_type'],
221
- 'required' => $field['required'],
222
- );
223
 
224
- // Load rating stylesheet if necessary.
225
- if ( isset( $field['input_type'] ) && 'rating' == $field['input_type'] ) {
226
- WPMST()->render->add_style( 'wpmtst-rating-form' );
227
- }
228
- }
229
 
230
- // Load validation scripts
231
- WPMST()->render->add_script( 'wpmtst-form-validation' );
232
- if ( wp_script_is( 'wpmtst-validation-lang', 'registered' ) ) {
233
- WPMST()->render->add_script( 'wpmtst-validation-lang' );
 
 
 
 
 
 
 
234
  }
235
 
236
- $form_options = get_option( 'wpmtst_form_options' );
237
 
238
- // Assemble script variable.
239
- // Remember: top level is converted to strings!
240
- $scroll = array(
241
- 'onError' => $form_options['scrolltop_error'] ? true : false,
242
- 'onErrorOffset' => $form_options['scrolltop_error_offset'],
243
- 'onSuccess' => $form_options['scrolltop_success'] ? true : false,
244
- 'onSuccessOffset' => $form_options['scrolltop_success_offset'],
245
- );
246
 
247
- $args = array(
248
- 'scroll' => $scroll,
249
- 'fields' => $fields,
250
- );
251
 
252
- if ( $this->atts['form_ajax'] ) {
253
- $args['ajaxUrl'] = admin_url( 'admin-ajax.php' );
254
- }
 
 
 
 
 
 
 
 
 
 
255
 
256
- WPMST()->render->add_script_var( 'wpmtst-form-validation', 'strongForm', $args );
257
- WPMST()->render->add_script( 'wpmtst-controller' );
258
  }
259
 
260
- /**
261
- * Load honeypots.
262
- */
263
- public function load_honeypots() {
264
- $form_options = get_option( 'wpmtst_form_options' );
265
 
266
- if ( $form_options['honeypot_before'] ) {
267
- ?>
268
- <script type="text/javascript">
269
- (function () { document.getElementById("wpmtst_if_visitor").value = '' })()
270
- </script>
271
- <?php
272
- }
273
 
274
- if ( $form_options['honeypot_after'] ) {
275
- ?>
276
  <script type="text/javascript">
277
- (function () {
278
- var myForm = document.getElementById("wpmtst-submission-form")
279
- myForm.addEventListener("submit", function(e){
280
- var x = document.createElement("input")
281
- x.type = "hidden"
282
- x.name = "wpmtst_after"
283
- x.value = 1
284
- myForm.appendChild(x)
285
- });
286
- })()
287
- </script>
288
- <?php
289
- }
290
  }
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
 
 
 
294
  endif;
6
  */
7
 
8
  // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
10
 
11
  if ( ! class_exists( 'Strong_View_Form' ) ) :
12
 
13
+ class Strong_View_Form extends Strong_View {
14
 
15
+ /**
16
+ * Strong_View_Form constructor.
17
+ *
18
+ * @param array $atts
19
+ */
20
+ public function __construct( $atts = array() ) {
21
+ parent::__construct( $atts );
22
+ }
23
 
24
+ /**
25
+ * Process the view.
26
+ *
27
+ * Used by main class to load the scripts and styles for this View.
28
+ */
29
+ public function process() {
30
+ $this->build_classes();
31
+ $this->find_stylesheet();
32
+ $this->load_dependent_scripts();
33
+ $this->load_extra_stylesheets();
34
+ $this->load_validator();
35
+
36
+ // If we can preprocess, we can add the inline style in the <head>.
37
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
38
+ }
39
 
40
+ /**
41
+ * Print overlay while form data is submitted.
42
+ *
43
+ * This helps when uploading large files and on slow connections.
44
+ *
45
+ * @since 2.31.5
46
+ */
47
+ public function print_overlay() {
48
+ if ( apply_filters( 'wpmtst_form_wait', true ) ) {
49
+ WPMST()->render->add_style( 'wpmtst-font-awesome' );
50
+ ?>
51
  <div class="strong-form-wait">
52
  <div class="message">
53
  <?php echo wp_kses_post( apply_filters( 'wpmtst_form_wait_message', '<i class="fa fa-2x fa-spinner fa-pulse" aria-hidden="true"></i>' ) ); ?>
54
  </div>
55
  </div>
56
+ <?php
 
57
  }
58
+ }
59
 
60
+ /**
61
+ * Load resources on form success.
62
+ *
63
+ * When using normal form submission (not Ajax)
64
+ * and displaying a success message (not redirecting).
65
+ */
66
+ public function success() {
67
+ $form_options = get_option( 'wpmtst_form_options' );
68
+
69
+ // Remember: top level is converted to strings!
70
+ $args = array(
71
+ 'display' => array(
72
+ 'successMessage' => true,
73
+ ),
74
+ 'scroll' => array(
75
+ 'onSuccess' => $form_options['scrolltop_success'],
76
+ 'onSuccessOffset' => $form_options['scrolltop_success_offset'],
77
+ ),
78
+ );
 
 
 
79
 
80
+ WPMST()->render->add_script( 'wpmtst-form-validation' );
81
+ WPMST()->render->add_script_var( 'wpmtst-form-validation', 'strongForm', $args );
82
 
83
+ $this->find_stylesheet();
84
+ $this->html = wpmtst_get_success_message();
85
 
86
+ do_action( 'wpmtst_form_success', $this->atts );
87
+ }
 
 
88
 
89
+ /**
90
+ * Build the view.
91
+ */
92
+ public function build() {
93
 
94
+ do_action( 'wpmtst_view_build_before', $this );
 
 
 
 
 
95
 
96
+ $this->build_classes();
97
+ $this->find_stylesheet();
98
+ $this->load_dependent_scripts();
99
+ $this->load_extra_stylesheets();
100
+ $this->custom_background();
101
+ $this->load_validator();
102
 
103
+ // If we cannot preprocess, add the inline style to the footer.
104
+ add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
105
+ add_action( 'wp_footer', array( $this, 'load_honeypots' ) );
106
 
107
+ $form_values = array( 'category' => $this->atts['category'] );
 
 
 
 
 
108
 
109
+ $fields = wpmtst_get_form_fields( $this->atts['form_id'] );
110
+ if ( $fields ) {
111
+ foreach ( $fields as $key => $field ) {
112
+ $form_values[ $field['name'] ] = '';
113
  }
114
+ }
115
 
116
+ $previous_values = WPMST()->form->get_form_values();
117
+ if ( $previous_values ) {
118
+ $form_values = array_merge( $form_values, $previous_values );
119
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
+ WPMST()->form->set_form_values( $form_values );
 
 
 
 
 
122
 
123
+ /**
124
+ * Add filters here.
125
+ */
126
+ add_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
127
 
128
+ /**
129
+ * Locate template.
130
+ */
131
+ $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
132
 
133
+ /**
134
+ * Allow add-ons to hijack the output generation.
135
+ */
136
+ $atts = $this->atts;
137
+ if ( has_filter( 'wpmtst_render_view_template' ) ) {
138
+ $html = apply_filters( 'wpmtst_render_view_template', '', $this );
139
+ } else {
140
 
141
  /**
142
+ * Gutenberg. Yay.
143
+ * @since 2.31.9
144
  */
145
+ global $post;
146
+ $post_before = $post;
147
 
148
+ ob_start();
149
+ /** @noinspection PhpIncludeInspection */
150
+ include( $this->template_file );
151
+ $html = ob_get_clean();
152
 
153
+ $post = $post_before;
154
 
155
  }
156
+ // TODO apply content filters
157
 
158
  /**
159
+ * Remove filters here.
160
  */
161
+ remove_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
162
 
163
+ /**
164
+ * Trigger stuff.
165
+ */
166
+ do_action( 'wpmtst_form_rendered', $this->atts );
167
 
168
+ $this->html = apply_filters( 'strong_view_form_html', $html, $this );
 
 
169
 
170
+ }
 
 
171
 
172
+ /**
173
+ * Build class list based on view attributes.
174
+ */
175
+ public function build_classes() {
176
 
177
+ $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
178
+ $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
 
 
 
179
 
180
+ if ( is_rtl() ) {
181
+ $container_class_list[] = 'rtl';
182
+ }
 
183
 
184
+ if ( $this->atts['class'] ) {
185
+ $container_class_list[] = $this->atts['class'];
186
  }
187
 
188
+ $container_data_list = array();
189
+ $container_data_list['state'] = 'idle';
190
+
191
  /**
192
+ * Filter classes.
193
  */
194
+ $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
195
+ $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', $container_class_list, $this->atts ) );
196
 
197
+ /**
198
+ * Store updated atts.
199
+ */
200
+ WPMST()->set_atts( $this->atts );
201
 
202
+ }
203
 
204
+ /**
205
+ * Load validator script.
206
+ */
207
+ public function load_validator() {
 
208
 
209
+ // Assemble list of field properties for validation script.
210
+ $form_id = isset( $this->atts['form_id'] ) ? $this->atts['form_id'] : 1;
211
+ $form_fields = wpmtst_get_form_fields( $form_id );
212
+ $fields = array();
 
213
 
214
+ foreach ( $form_fields as $field ) {
215
+
216
+ $fields[] = array(
217
+ 'name' => $field['name'],
218
+ 'type' => $field['input_type'],
219
+ 'required' => $field['required'],
220
+ );
221
+
222
+ // Load rating stylesheet if necessary.
223
+ if ( isset( $field['input_type'] ) && 'rating' == $field['input_type'] ) {
224
+ WPMST()->render->add_style( 'wpmtst-rating-form' );
225
  }
226
 
227
+ }
228
 
229
+ // Load validation scripts
230
+ WPMST()->render->add_script( 'wpmtst-form-validation' );
231
+ if ( wp_script_is( 'wpmtst-validation-lang', 'registered' ) ) {
232
+ WPMST()->render->add_script( 'wpmtst-validation-lang' );
233
+ }
 
 
 
234
 
235
+ $form_options = get_option( 'wpmtst_form_options' );
 
 
 
236
 
237
+ // Assemble script variable.
238
+ // Remember: top level is converted to strings!
239
+ $scroll = array(
240
+ 'onError' => $form_options['scrolltop_error'] ? true : false,
241
+ 'onErrorOffset' => $form_options['scrolltop_error_offset'],
242
+ 'onSuccess' => $form_options['scrolltop_success'] ? true : false,
243
+ 'onSuccessOffset' => $form_options['scrolltop_success_offset'],
244
+ );
245
+
246
+ $args = array(
247
+ 'scroll' => $scroll,
248
+ 'fields' => $fields,
249
+ );
250
 
251
+ if ( $this->atts['form_ajax'] ) {
252
+ $args['ajaxUrl'] = admin_url( 'admin-ajax.php' );
253
  }
254
 
255
+ WPMST()->render->add_script_var( 'wpmtst-form-validation', 'strongForm', $args );
256
+ WPMST()->render->add_script( 'wpmtst-controller' );
257
+ }
 
 
258
 
259
+ /**
260
+ * Load honeypots.
261
+ */
262
+ public function load_honeypots() {
263
+ $form_options = get_option( 'wpmtst_form_options' );
 
 
264
 
265
+ if ( $form_options['honeypot_before'] ) {
266
+ ?>
267
  <script type="text/javascript">
268
+ (function () { document.getElementById("wpmtst_if_visitor").value = '' })()
269
+ </script>
270
+ <?php
 
 
 
 
 
 
 
 
 
 
271
  }
272
 
273
+ if ( $form_options['honeypot_after'] ) {
274
+ ?>
275
+ <script type="text/javascript">
276
+ (function () {
277
+ var myForm = document.getElementById("wpmtst-submission-form")
278
+ myForm.addEventListener("submit", function(e){
279
+ var x = document.createElement("input")
280
+ x.type = "hidden"
281
+ x.name = "wpmtst_after"
282
+ x.value = 1
283
+ myForm.appendChild(x)
284
+ });
285
+ })()
286
+ </script>
287
+ <?php
288
+ }
289
  }
290
 
291
+ }
292
+
293
  endif;
includes/class-strong-view-slideshow.php CHANGED
@@ -6,473 +6,475 @@
6
  */
7
 
8
  // Exit if accessed directly
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
 
13
  if ( ! class_exists( 'Strong_View_Slideshow' ) ) :
14
 
15
- class Strong_View_Slideshow extends Strong_View_Display {
16
-
17
- /**
18
- * Strong_View constructor.
19
- *
20
- * @param array $atts
21
- */
22
- public function __construct( $atts = array() ) {
23
- parent::__construct( $atts );
24
- }
25
-
26
- /**
27
- * Process the view.
28
- *
29
- * Used by main class to load the scripts and styles for this View.
30
- */
31
- public function process() {
32
- $this->build_query();
33
- $this->build_classes();
34
 
35
- $this->find_stylesheet();
36
- $this->has_slideshow();
37
- $this->has_stars();
38
- $this->has_readmore();
 
 
 
 
39
 
40
- $this->load_extra_stylesheets();
 
 
 
 
 
 
 
41
 
42
- // If we can preprocess, we can add the inline style in the <head>.
43
- add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
 
 
44
 
45
- wp_reset_postdata();
46
- }
47
 
48
- /**
49
- * Build the view.
50
- */
51
- public function build() {
52
- // May need to remove any hooks or filters that were set by other Views on the page.
53
 
54
- do_action( 'wpmtst_view_build_before', $this );
 
55
 
56
- $this->build_query();
57
- $this->build_classes();
 
 
 
58
 
59
- $this->find_stylesheet();
60
- $this->has_slideshow();
61
- $this->has_stars();
62
 
63
- $this->load_dependent_scripts();
64
- $this->load_extra_stylesheets();
65
 
66
- // If we cannot preprocess, add the inline style to the footer.
67
- add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
 
68
 
69
- /**
70
- * Add filters.
71
- */
72
- $this->add_content_filters();
73
- add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 );
74
- add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 );
75
 
76
- /**
77
- * Add actions.
78
- */
79
 
80
- // Read more page
81
- add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
 
 
 
 
82
 
83
- /**
84
- * Locate template.
85
- */
86
- $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
87
 
88
- /**
89
- * Allow add-ons to hijack the output generation.
90
- */
91
- $query = $this->query;
92
- $atts = $this->atts;
93
- if ( has_filter( 'wpmtst_render_view_template' ) ) {
94
- $html = apply_filters( 'wpmtst_render_view_template', '', $this );
95
- } else {
96
-
97
- /**
98
- * Gutenberg. Yay.
99
- * @since 2.31.9
100
- */
101
- global $post;
102
- $post_before = $post;
103
-
104
- ob_start();
105
- /** @noinspection PhpIncludeInspection */
106
- include $this->template_file;
107
- $html = ob_get_clean();
108
-
109
- $post = $post_before;
110
 
111
- }
 
 
 
112
 
113
- /**
114
- * Remove filters.
115
- */
116
- $this->remove_content_filters();
117
- remove_filter( 'get_avatar', 'wpmtst_get_avatar' );
118
- remove_filter( 'embed_defaults', 'wpmtst_embed_size' );
 
 
119
 
120
  /**
121
- * Remove actions.
 
122
  */
123
- remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
 
124
 
125
- /**
126
- * Hook to enqueue scripts.
127
- */
128
- do_action( 'wpmtst_view_rendered', $this->atts );
129
 
130
- wp_reset_postdata();
131
 
132
- $this->html = apply_filters( 'strong_view_html', $html, $this );
133
  }
134
 
135
  /**
136
- * Build class list based on view attributes.
137
- *
138
- * This must happen after the query.
139
- * TODO DRY
140
  */
141
- public function build_classes() {
142
- $options = get_option( 'wpmtst_view_options' );
 
143
 
144
- $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
145
- $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
 
 
146
 
147
- if ( is_rtl() ) {
148
- $container_class_list[] = 'rtl';
149
- }
 
150
 
151
- if ( $this->atts['class'] ) {
152
- $container_class_list[] = $this->atts['class'];
153
- }
154
 
155
- $container_data_list = array(
156
- 'count' => $this->post_count,
157
- );
158
 
159
- $content_class_list = array();
 
 
 
 
 
 
 
160
 
161
- $post_class_list = array( 'testimonial' );
 
162
 
163
- if ( 'excerpt' == $this->atts['content'] ) {
164
- $post_class_list[] = 'excerpt';
165
- }
166
 
167
- /**
168
- * Slideshow
169
- */
170
- $settings = $this->atts['slideshow_settings'];
171
 
172
- $container_class_list[] = 'slider-container';
 
 
173
 
174
- if ( 'show_multiple' == $settings['type'] ) {
175
- $container_class_list[] = 'carousel';
176
- }
177
 
178
- $container_class_list[] = 'slider-mode-' . $settings['effect'];
179
 
180
- if ( $settings['adapt_height'] ) {
181
- $container_class_list[] = 'slider-adaptive';
182
- } elseif ( $settings['stretch'] ) {
183
- $container_class_list[] = 'slider-stretch';
184
- }
185
 
186
- $nav_methods = $options['slideshow_nav_method'];
187
- $nav_styles = $options['slideshow_nav_style'];
188
- $control = $settings['controls_type'];
189
- $control_style = $settings['controls_style'];
190
- $pager = $settings['pager_type'];
191
- $pager_style = $settings['pager_style'];
192
-
193
- // Controls
194
- if ( isset( $nav_methods['controls'][ $control ]['class'] ) && $nav_methods['controls'][ $control ]['class'] ) {
195
- if ( 'sides' == $control ) {
196
- if ( 'show_single' == $settings['type'] ) {
197
- $container_class_list[] = $nav_methods['controls'][ $control ]['class'];
198
- } else {
199
- $container_class_list[] = $nav_methods['controls'][ $control ]['class'] . '-outside';
200
- }
201
- }
202
- }
203
 
204
- if ( 'none' != $control ) {
205
- if ( isset( $nav_styles['controls'][ $control_style ]['class'] ) && $nav_styles['controls'][ $control_style ]['class'] ) {
206
- $container_class_list[] = $nav_styles['controls'][ $control_style ]['class'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
  }
 
209
 
210
- // Pager
211
- if ( isset( $nav_methods['pager'][ $pager ]['class'] ) && $nav_methods['pager'][ $pager ]['class'] ) {
212
- $container_class_list[] = $nav_methods['pager'][ $pager ]['class'];
213
  }
 
214
 
215
- if ( 'none' != $pager ) {
216
- if ( isset( $nav_styles['pager'][ $pager_style ]['class'] ) && $nav_styles['pager'][ $pager_style ]['class'] ) {
217
- $container_class_list[] = $nav_styles['pager'][ $pager_style ]['class'];
218
- }
219
- }
220
 
221
- // Position
222
- // TODO Simplify logic.
223
- if ( 'none' != $pager || ( 'none' != $control && 'sides' != $control ) ) {
224
- if ( 'show_multiple' == $settings['type'] ) {
225
- $settings['nav_position'] = 'outside';
226
- }
227
- $container_class_list[] = 'nav-position-' . $settings['nav_position'];
228
  }
 
229
 
230
- $container_data_list['slider-var'] = $this->slideshow_signature();
231
- $container_data_list['state'] = 'idle';
 
 
 
 
 
 
232
 
233
- $content_class_list[] = 'wpmslider-content';
 
234
 
235
- $post_class_list[] = 't-slide';
236
 
237
- /**
238
- * Filter classes.
239
- */
240
- $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
241
- $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', array_filter( $container_class_list ), $this->atts ) );
242
- $this->atts['content_class'] = join( ' ', apply_filters( 'wpmtst_view_content_class', array_filter( $content_class_list ), $this->atts ) );
243
- $this->atts['post_class'] = join( ' ', apply_filters( 'wpmtst_view_post_class', array_filter( $post_class_list ), $this->atts ) );
244
 
245
- /**
246
- * Store updated atts.
247
- */
248
- WPMST()->set_atts( $this->atts );
249
- }
 
 
250
 
251
  /**
252
- * Slideshow
253
- *
254
- * @since 2.16.0 In Strong_View class.
255
  */
256
- public function has_slideshow() {
257
- WPMST()->render->add_style( 'wpmtst-font-awesome' );
258
 
259
- $settings = $this->atts['slideshow_settings'];
260
- $not_full_controls = ( 'none' != $settings['controls_type'] || 'full' != $settings['controls_type'] );
 
 
 
 
 
261
 
262
- /*
263
- * Controls with or without Pagination
264
- */
265
- if ( isset( $settings['controls_type'] ) && 'none' != $settings['controls_type'] ) {
266
 
267
- $controls_type = $settings['controls_type'];
268
- if ( 'sides' == $controls_type && 'show_multiple' == $settings['type'] ) {
269
- $controls_type .= '-outside';
270
- }
271
 
272
- $filename = 'slider-controls-' . $controls_type . '-' . $settings['controls_style'];
 
 
 
 
 
273
 
274
- if ( 'full' != $settings['controls_type'] ) {
275
- if ( isset( $settings['pager_style'] ) && 'none' != $settings['pager_type'] ) {
276
- $filename .= '-pager-' . $settings['pager_style'];
277
- }
278
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
  if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) {
281
  wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version );
282
  WPMST()->render->add_style( "wpmtst-$filename" );
283
  }
284
- } elseif ( $not_full_controls ) {
285
 
286
- /*
287
- * Pagination only
288
- */
289
- if ( isset( $settings['pager_type'] ) && 'none' != $settings['pager_type'] ) {
290
-
291
- //TODO Adapt for multiple pager types (only one right now).
292
- $filename = 'slider-pager-' . $settings['pager_style'];
293
-
294
- if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) {
295
- wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version );
296
- WPMST()->render->add_style( "wpmtst-$filename" );
297
- }
298
- }
299
  }
300
 
301
- WPMST()->render->add_script( 'wpmtst-slider' );
302
- WPMST()->render->add_script_var( 'wpmtst-slider', $this->slideshow_signature(), $this->slideshow_args() );
303
- WPMST()->render->add_script( 'wpmtst-controller' );
304
  }
305
 
306
- /**
307
- * Create unique slideshow signature.
308
- *
309
- * @since 2.7.0
310
- * @private
311
- *
312
- * @return string
313
- */
314
- private function slideshow_signature() {
315
- return 'strong_slider_id_' . $this->atts['view'];
316
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
  /**
319
- * Assemble slideshow settings.
320
- *
321
- * @since 2.7.0
322
- * @private
323
  *
324
- * @return array
325
  */
326
- private function slideshow_args() {
327
- $options = get_option( 'wpmtst_options' );
328
- $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
329
- $compat_options = get_option( 'wpmtst_compat_options' );
330
-
331
- /**
332
- * Compatibility with lazy loading and use of imagesLoaded.
333
- *
334
- * @since 2.31.0 As user-configurable.
335
- */
336
- $compat = array();
337
- $enabled = false;
338
- $pairs = array();
339
-
340
- // Presets
341
- // Flatsome theme
342
- if ( class_exists( 'FL_LazyLoad_Images' ) && get_theme_mod( 'lazy_load_images' ) ) {
343
- $enabled = true;
344
- $pairs[] = array(
345
- 'start' => 'lazy-load',
346
- 'finish' => '',
347
- );
348
- }
349
-
350
- // User settings
351
- if ( $compat_options['lazyload']['enabled'] ) {
352
- $enabled = true;
353
- foreach ( $compat_options['lazyload']['classes'] as $key => $pair ) {
354
- $pairs[] = $pair;
355
- }
356
- }
357
-
358
- // Bring together the presets and user settings.
359
- $compat['lazyload'] = array(
360
- 'active' => $enabled,
361
- 'classes' => $pairs,
362
  );
 
363
 
364
- // Convert breakpoint variable names
365
- // TODO Refactor to make this unnecessary.
366
- $new_breakpoints = array();
 
 
 
 
367
 
368
- // Fallback
369
- $new_breakpoints['single'] = array(
370
- 'maxSlides' => $this->atts['slideshow_settings']['show_single']['max_slides'],
371
- 'moveSlides' => $this->atts['slideshow_settings']['show_single']['move_slides'],
372
- 'slideMargin' => $this->atts['slideshow_settings']['show_single']['margin'],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  );
 
374
 
375
- $breakpoints = $this->atts['slideshow_settings']['breakpoints'];
376
- foreach ( $breakpoints as $key => $breakpoint ) {
377
- $new_breakpoints['multiple'][ $key ] = array(
378
- 'width' => $breakpoints[ $key ]['width'],
379
- 'maxSlides' => $breakpoints[ $key ]['max_slides'],
380
- 'moveSlides' => $breakpoints[ $key ]['move_slides'],
381
- 'slideMargin' => $breakpoints[ $key ]['margin'],
382
- );
383
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
 
385
- $args = array(
386
- 'mode' => $this->atts['slideshow_settings']['effect'],
387
- 'speed' => $this->atts['slideshow_settings']['speed'] * 1000,
388
- 'pause' => $this->atts['slideshow_settings']['pause'] * 1000,
389
- 'autoHover' => $this->atts['slideshow_settings']['auto_hover'] ? 1 : 0,
390
- 'autoStart' => $this->atts['slideshow_settings']['auto_start'] ? 1 : 0,
391
- 'stopAutoOnClick' => $this->atts['slideshow_settings']['stop_auto_on_click'] ? 1 : 0,
392
- 'adaptiveHeight' => $this->atts['slideshow_settings']['adapt_height'] ? 1 : 0,
393
- 'adaptiveHeightSpeed' => $this->atts['slideshow_settings']['adapt_height_speed'] * 1000,
394
- 'controls' => 0,
395
- 'autoControls' => 0,
396
- 'pager' => 0,
397
- 'slideCount' => $this->post_count,
398
- 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_slider', true ),
399
- 'compat' => $compat,
400
- 'touchEnabled' => $options['touch_enabled'],
401
- 'type' => $this->atts['slideshow_settings']['type'],
402
- 'breakpoints' => $new_breakpoints,
403
- );
404
 
405
- if ( ! $this->atts['slideshow_settings']['adapt_height'] ) {
406
- $args['stretch'] = $this->atts['slideshow_settings']['stretch'] ? 1 : 0;
 
 
 
407
  }
408
 
409
  /**
410
- * Controls
 
 
 
411
  */
412
- $options = $view_options['slideshow_nav_method']['controls'];
413
- $control_setting = $this->atts['slideshow_settings']['controls_type'];
414
- if ( ! $control_setting ) {
415
- $control_setting = 'none';
416
- }
417
- if ( isset( $options[ $control_setting ] ) && isset( $options[ $control_setting ]['args'] ) ) {
418
- $args['controls'] = 1;
419
- $args = array_merge( $args, $options[ $control_setting ]['args'] );
420
  }
421
 
422
- if ( 'none' != $control_setting ) {
423
- $options = $view_options['slideshow_nav_style']['controls'];
424
- $setting = $this->atts['slideshow_settings']['controls_style'];
425
- if ( ! $setting ) {
426
- $setting = 'none';
427
- }
428
-
429
- /**
430
- * Quick fix for ticket 12014 to translate slider text controls.
431
- * TODO Refactor; see fix-i18n branch in translations.strong.test.
432
- *
433
- * @since 2.32.1
434
- */
435
- if ( 'text' == $setting ) {
436
- $options['text']['args'] = array(
437
- 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
438
- 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
439
- 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
440
- 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
441
- );
442
- }
443
-
444
- if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) {
445
- $args = array_merge( $args, $options[ $setting ]['args'] );
446
- }
447
  }
 
448
 
449
- /**
450
- * Pager
451
- */
452
- $options = $view_options['slideshow_nav_method']['pager'];
453
- $pager_setting = $this->atts['slideshow_settings']['pager_type'];
454
- if ( ! $pager_setting ) {
455
- $pager_setting = 'none';
456
- }
457
- if ( isset( $options[ $pager_setting ] ) && isset( $options[ $pager_setting ]['args'] ) ) {
458
- $args = array_merge( $args, $options[ $pager_setting ]['args'] );
459
- }
460
 
461
- if ( 'none' != $pager_setting ) {
462
- $options = $view_options['slideshow_nav_style']['pager'];
463
- $setting = $this->atts['slideshow_settings']['pager_style'];
464
- if ( ! $setting ) {
465
- $setting = 'none';
466
- }
467
- if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) {
468
- $args['pager'] = 1;
469
- $args = array_merge( $args, $options[ $setting ]['args'] );
470
- }
471
  }
472
-
473
- return array( 'config' => apply_filters( 'wpmtst_slider_args', $args, $this->atts ) );
474
  }
475
 
 
476
  }
477
 
 
 
478
  endif;
6
  */
7
 
8
  // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
10
 
11
  if ( ! class_exists( 'Strong_View_Slideshow' ) ) :
12
 
13
+ class Strong_View_Slideshow extends Strong_View_Display {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ /**
16
+ * Strong_View constructor.
17
+ *
18
+ * @param array $atts
19
+ */
20
+ public function __construct( $atts = array() ) {
21
+ parent::__construct( $atts );
22
+ }
23
 
24
+ /**
25
+ * Process the view.
26
+ *
27
+ * Used by main class to load the scripts and styles for this View.
28
+ */
29
+ public function process() {
30
+ $this->build_query();
31
+ $this->build_classes();
32
 
33
+ $this->find_stylesheet();
34
+ $this->has_slideshow();
35
+ $this->has_stars();
36
+ $this->has_readmore();
37
 
38
+ $this->load_extra_stylesheets();
 
39
 
40
+ // If we can preprocess, we can add the inline style in the <head>.
41
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
 
 
 
42
 
43
+ wp_reset_postdata();
44
+ }
45
 
46
+ /**
47
+ * Build the view.
48
+ */
49
+ public function build() {
50
+ // May need to remove any hooks or filters that were set by other Views on the page.
51
 
52
+ do_action( 'wpmtst_view_build_before', $this );
 
 
53
 
54
+ $this->build_query();
55
+ $this->build_classes();
56
 
57
+ $this->find_stylesheet();
58
+ $this->has_slideshow();
59
+ $this->has_stars();
60
 
61
+ $this->load_dependent_scripts();
62
+ $this->load_extra_stylesheets();
 
 
 
 
63
 
64
+ // If we cannot preprocess, add the inline style to the footer.
65
+ add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
 
66
 
67
+ /**
68
+ * Add filters.
69
+ */
70
+ $this->add_content_filters();
71
+ add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 );
72
+ add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 );
73
 
74
+ /**
75
+ * Add actions.
76
+ */
 
77
 
78
+ // Read more page
79
+ add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ /**
82
+ * Locate template.
83
+ */
84
+ $this->template_file = WPMST()->templates->get_template_attr( $this->atts, 'template' );
85
 
86
+ /**
87
+ * Allow add-ons to hijack the output generation.
88
+ */
89
+ $query = $this->query;
90
+ $atts = $this->atts;
91
+ if ( has_filter( 'wpmtst_render_view_template' ) ) {
92
+ $html = apply_filters( 'wpmtst_render_view_template', '', $this );
93
+ } else {
94
 
95
  /**
96
+ * Gutenberg. Yay.
97
+ * @since 2.31.9
98
  */
99
+ global $post;
100
+ $post_before = $post;
101
 
102
+ ob_start();
103
+ /** @noinspection PhpIncludeInspection */
104
+ include( $this->template_file );
105
+ $html = ob_get_clean();
106
 
107
+ $post = $post_before;
108
 
 
109
  }
110
 
111
  /**
112
+ * Remove filters.
 
 
 
113
  */
114
+ $this->remove_content_filters();
115
+ remove_filter( 'get_avatar', 'wpmtst_get_avatar' );
116
+ remove_filter( 'embed_defaults', 'wpmtst_embed_size' );
117
 
118
+ /**
119
+ * Remove actions.
120
+ */
121
+ remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' );
122
 
123
+ /**
124
+ * Hook to enqueue scripts.
125
+ */
126
+ do_action( 'wpmtst_view_rendered', $this->atts );
127
 
128
+ wp_reset_postdata();
 
 
129
 
130
+ $this->html = apply_filters( 'strong_view_html', $html, $this );
131
+ }
 
132
 
133
+ /**
134
+ * Build class list based on view attributes.
135
+ *
136
+ * This must happen after the query.
137
+ * TODO DRY
138
+ */
139
+ public function build_classes() {
140
+ $options = get_option( 'wpmtst_view_options' );
141
 
142
+ $container_class_list = array( 'strong-view-id-' . $this->atts['view'] );
143
+ $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() );
144
 
145
+ if ( is_rtl() ) {
146
+ $container_class_list[] = 'rtl';
147
+ }
148
 
149
+ if ( $this->atts['class'] ) {
150
+ $container_class_list[] = $this->atts['class'];
151
+ }
 
152
 
153
+ $container_data_list = array(
154
+ 'count' => $this->post_count,
155
+ );
156
 
157
+ $content_class_list = array();
 
 
158
 
159
+ $post_class_list = array( 'testimonial' );
160
 
161
+ if ( 'excerpt' == $this->atts['content'] ) {
162
+ $post_class_list[] = 'excerpt';
163
+ }
 
 
164
 
165
+ /**
166
+ * Slideshow
167
+ */
168
+ $settings = $this->atts['slideshow_settings'];
169
+
170
+ $container_class_list[] = 'slider-container';
 
 
 
 
 
 
 
 
 
 
 
171
 
172
+ if ( 'show_multiple' == $settings['type'] ) {
173
+ $container_class_list[] = 'carousel';
174
+ }
175
+
176
+ $container_class_list[] = 'slider-mode-' . $settings['effect'];
177
+
178
+ if ( $settings['adapt_height'] ) {
179
+ $container_class_list[] = 'slider-adaptive';
180
+ } elseif ( $settings['stretch'] ) {
181
+ $container_class_list[] = 'slider-stretch';
182
+ }
183
+
184
+ $nav_methods = $options['slideshow_nav_method'];
185
+ $nav_styles = $options['slideshow_nav_style'];
186
+ $control = $settings['controls_type'];
187
+ $control_style = $settings['controls_style'];
188
+ $pager = $settings['pager_type'];
189
+ $pager_style = $settings['pager_style'];
190
+
191
+ // Controls
192
+ if ( isset( $nav_methods['controls'][ $control ]['class'] ) && $nav_methods['controls'][ $control ]['class'] ) {
193
+ if ( 'sides' == $control ) {
194
+ if ( 'show_single' == $settings['type'] ) {
195
+ $container_class_list[] = $nav_methods['controls'][ $control ]['class'];
196
+ } else {
197
+ $container_class_list[] = $nav_methods['controls'][ $control ]['class'] . '-outside';
198
  }
199
  }
200
+ }
201
 
202
+ if ( 'none' != $control ) {
203
+ if ( isset( $nav_styles['controls'][ $control_style ]['class'] ) && $nav_styles['controls'][ $control_style ]['class'] ) {
204
+ $container_class_list[] = $nav_styles['controls'][ $control_style ]['class'];
205
  }
206
+ }
207
 
208
+ // Pager
209
+ if ( isset( $nav_methods['pager'][ $pager ]['class'] ) && $nav_methods['pager'][ $pager ]['class'] ) {
210
+ $container_class_list[] = $nav_methods['pager'][ $pager ]['class'];
211
+ }
 
212
 
213
+ if ( 'none' != $pager ) {
214
+ if ( isset( $nav_styles['pager'][ $pager_style ]['class'] ) && $nav_styles['pager'][ $pager_style ]['class'] ) {
215
+ $container_class_list[] = $nav_styles['pager'][ $pager_style ]['class'];
 
 
 
 
216
  }
217
+ }
218
 
219
+ // Position
220
+ // TODO Simplify logic.
221
+ if ( 'none' != $pager || ( 'none' != $control && 'sides' != $control ) ) {
222
+ if ( 'show_multiple' == $settings['type'] ) {
223
+ $settings['nav_position'] = 'outside';
224
+ }
225
+ $container_class_list[] = 'nav-position-' . $settings['nav_position'];
226
+ }
227
 
228
+ $container_data_list['slider-var'] = $this->slideshow_signature();
229
+ $container_data_list['state'] = 'idle';
230
 
231
+ $content_class_list[] = 'wpmslider-content';
232
 
233
+ $post_class_list[] = 't-slide';
 
 
 
 
 
 
234
 
235
+ /**
236
+ * Filter classes.
237
+ */
238
+ $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts );
239
+ $this->atts['container_class'] = join( ' ', apply_filters( 'wpmtst_view_container_class', array_filter( $container_class_list ), $this->atts ) );
240
+ $this->atts['content_class'] = join( ' ', apply_filters( 'wpmtst_view_content_class', array_filter( $content_class_list ), $this->atts ) );
241
+ $this->atts['post_class'] = join( ' ', apply_filters( 'wpmtst_view_post_class', array_filter( $post_class_list ), $this->atts ) );
242
 
243
  /**
244
+ * Store updated atts.
 
 
245
  */
246
+ WPMST()->set_atts( $this->atts );
247
+ }
248
 
249
+ /**
250
+ * Slideshow
251
+ *
252
+ * @since 2.16.0 In Strong_View class.
253
+ */
254
+ public function has_slideshow() {
255
+ WPMST()->render->add_style( 'wpmtst-font-awesome' );
256
 
257
+ $settings = $this->atts['slideshow_settings'];
258
+ $not_full_controls = ( 'none' != $settings['controls_type'] || 'full' != $settings['controls_type'] );
 
 
259
 
260
+ /*
261
+ * Controls with or without Pagination
262
+ */
263
+ if ( isset( $settings['controls_type'] ) && 'none' != $settings['controls_type'] ) {
264
 
265
+ $controls_type = $settings['controls_type'];
266
+ if ( 'sides' == $controls_type && 'show_multiple' == $settings['type'] ) {
267
+ $controls_type .= '-outside';
268
+ }
269
+
270
+ $filename = 'slider-controls-' . $controls_type . '-' . $settings['controls_style'];
271
 
272
+ if ( 'full' != $settings['controls_type'] ) {
273
+ if ( isset( $settings['pager_style'] ) && 'none' != $settings['pager_type'] ) {
274
+ $filename .= '-pager-' . $settings['pager_style'];
 
275
  }
276
+ }
277
+
278
+ if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) {
279
+ wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version );
280
+ WPMST()->render->add_style( "wpmtst-$filename" );
281
+ }
282
+
283
+ } elseif ( $not_full_controls ) {
284
+
285
+ /*
286
+ * Pagination only
287
+ */
288
+ if ( isset( $settings['pager_type'] ) && 'none' != $settings['pager_type'] ) {
289
+
290
+ //TODO Adapt for multiple pager types (only one right now).
291
+ $filename = 'slider-pager-' . $settings['pager_style'];
292
 
293
  if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) {
294
  wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version );
295
  WPMST()->render->add_style( "wpmtst-$filename" );
296
  }
 
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
 
 
 
 
300
  }
301
 
302
+ WPMST()->render->add_script( 'wpmtst-slider' );
303
+ WPMST()->render->add_script_var( 'wpmtst-slider', $this->slideshow_signature(), $this->slideshow_args() );
304
+ WPMST()->render->add_script( 'wpmtst-controller' );
305
+ }
306
+
307
+ /**
308
+ * Create unique slideshow signature.
309
+ *
310
+ * @since 2.7.0
311
+ * @private
312
+ *
313
+ * @return string
314
+ */
315
+ private function slideshow_signature() {
316
+ return 'strong_slider_id_' . $this->atts['view'];
317
+ }
318
+
319
+ /**
320
+ * Assemble slideshow settings.
321
+ *
322
+ * @since 2.7.0
323
+ * @private
324
+ *
325
+ * @return array
326
+ */
327
+ private function slideshow_args() {
328
+ $options = get_option( 'wpmtst_options' );
329
+ $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
330
+ $compat_options = get_option( 'wpmtst_compat_options' );
331
 
332
  /**
333
+ * Compatibility with lazy loading and use of imagesLoaded.
 
 
 
334
  *
335
+ * @since 2.31.0 As user-configurable.
336
  */
337
+ $compat = array();
338
+ $enabled = false;
339
+ $pairs = array();
340
+
341
+ // Presets
342
+ // Flatsome theme
343
+ if ( class_exists( 'FL_LazyLoad_Images' ) && get_theme_mod( 'lazy_load_images' ) ) {
344
+ $enabled = true;
345
+ $pairs[] = array(
346
+ 'start' => 'lazy-load',
347
+ 'finish' => '',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  );
349
+ }
350
 
351
+ // User settings
352
+ if ( $compat_options['lazyload']['enabled'] ) {
353
+ $enabled = true;
354
+ foreach ( $compat_options['lazyload']['classes'] as $key => $pair ) {
355
+ $pairs[] = $pair;
356
+ }
357
+ }
358
 
359
+ // Bring together the presets and user settings.
360
+ $compat['lazyload'] = array(
361
+ 'active' => $enabled,
362
+ 'classes' => $pairs,
363
+ );
364
+
365
+
366
+ // Convert breakpoint variable names
367
+ // TODO Refactor to make this unnecessary.
368
+ $new_breakpoints = array();
369
+
370
+ // Fallback
371
+ $new_breakpoints['single'] = array(
372
+ 'maxSlides' => $this->atts['slideshow_settings']['show_single']['max_slides'],
373
+ 'moveSlides' => $this->atts['slideshow_settings']['show_single']['move_slides'],
374
+ 'slideMargin' => $this->atts['slideshow_settings']['show_single']['margin'],
375
+ );
376
+
377
+ $breakpoints = $this->atts['slideshow_settings']['breakpoints'];
378
+ foreach ( $breakpoints as $key => $breakpoint ) {
379
+ $new_breakpoints['multiple'][ $key ] = array(
380
+ 'width' => $breakpoints[ $key ]['width'],
381
+ 'maxSlides' => $breakpoints[ $key ]['max_slides'],
382
+ 'moveSlides' => $breakpoints[ $key ]['move_slides'],
383
+ 'slideMargin' => $breakpoints[ $key ]['margin'],
384
  );
385
+ }
386
 
387
+ $args = array(
388
+ 'mode' => $this->atts['slideshow_settings']['effect'],
389
+ 'speed' => $this->atts['slideshow_settings']['speed'] * 1000,
390
+ 'pause' => $this->atts['slideshow_settings']['pause'] * 1000,
391
+ 'autoHover' => $this->atts['slideshow_settings']['auto_hover'] ? 1 : 0,
392
+ 'autoStart' => $this->atts['slideshow_settings']['auto_start'] ? 1 : 0,
393
+ 'stopAutoOnClick' => $this->atts['slideshow_settings']['stop_auto_on_click'] ? 1 : 0,
394
+ 'adaptiveHeight' => $this->atts['slideshow_settings']['adapt_height'] ? 1 : 0,
395
+ 'adaptiveHeightSpeed' => $this->atts['slideshow_settings']['adapt_height_speed'] * 1000,
396
+ 'controls' => 0,
397
+ 'autoControls' => 0,
398
+ 'pager' => 0,
399
+ 'slideCount' => $this->post_count,
400
+ 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_slider', true ),
401
+ 'compat' => $compat,
402
+ 'touchEnabled' => $options['touch_enabled'],
403
+ 'type' => $this->atts['slideshow_settings']['type'],
404
+ 'breakpoints' => $new_breakpoints,
405
+ );
406
+
407
+ if ( ! $this->atts['slideshow_settings']['adapt_height'] ) {
408
+ $args['stretch'] = $this->atts['slideshow_settings']['stretch'] ? 1 : 0;
409
+ }
410
 
411
+ /**
412
+ * Controls
413
+ */
414
+ $options = $view_options['slideshow_nav_method']['controls'];
415
+ $control_setting = $this->atts['slideshow_settings']['controls_type'];
416
+ if ( ! $control_setting ) {
417
+ $control_setting = 'none';
418
+ }
419
+ if ( isset( $options[ $control_setting ] ) && isset( $options[ $control_setting ]['args'] ) ) {
420
+ $args['controls'] = 1;
421
+ $args = array_merge( $args, $options[ $control_setting ]['args'] );
422
+ }
 
 
 
 
 
 
 
423
 
424
+ if ( 'none' != $control_setting ) {
425
+ $options = $view_options['slideshow_nav_style']['controls'];
426
+ $setting = $this->atts['slideshow_settings']['controls_style'];
427
+ if ( ! $setting ) {
428
+ $setting = 'none';
429
  }
430
 
431
  /**
432
+ * Quick fix for ticket 12014 to translate slider text controls.
433
+ * TODO Refactor; see fix-i18n branch in translations.strong.test.
434
+ *
435
+ * @since 2.32.1
436
  */
437
+ if ( 'text' == $setting ) {
438
+ $options['text']['args'] = array(
439
+ 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
440
+ 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
441
+ 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
442
+ 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
443
+ );
 
444
  }
445
 
446
+ if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) {
447
+ $args = array_merge( $args, $options[ $setting ]['args'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
449
+ }
450
 
451
+ /**
452
+ * Pager
453
+ */
454
+ $options = $view_options['slideshow_nav_method']['pager'];
455
+ $pager_setting = $this->atts['slideshow_settings']['pager_type'];
456
+ if ( ! $pager_setting ) {
457
+ $pager_setting = 'none';
458
+ }
459
+ if ( isset( $options[ $pager_setting ] ) && isset( $options[ $pager_setting ]['args'] ) ) {
460
+ $args = array_merge( $args, $options[ $pager_setting ]['args'] );
461
+ }
462
 
463
+ if ( 'none' != $pager_setting ) {
464
+ $options = $view_options['slideshow_nav_style']['pager'];
465
+ $setting = $this->atts['slideshow_settings']['pager_style'];
466
+ if ( ! $setting ) {
467
+ $setting = 'none';
468
+ }
469
+ if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) {
470
+ $args['pager'] = 1;
471
+ $args = array_merge( $args, $options[ $setting ]['args'] );
 
472
  }
 
 
473
  }
474
 
475
+ return array( 'config' => apply_filters( 'wpmtst_slider_args', $args, $this->atts ) );
476
  }
477
 
478
+ }
479
+
480
  endif;
includes/class-strong-view.php CHANGED
@@ -6,534 +6,538 @@
6
  */
7
 
8
  // Exit if accessed directly
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
 
13
  if ( ! class_exists( 'Strong_View' ) ) :
14
 
15
- class Strong_View {
16
-
17
- /**
18
- * The view settings.
19
- *
20
- * @var array
21
- */
22
- public $atts;
23
-
24
- /**
25
- * The query.
26
- */
27
- public $query;
28
-
29
- /**
30
- * The template file.
31
- */
32
- public $template_file;
33
-
34
- /**
35
- * The view output.
36
- *
37
- * @var string
38
- */
39
- public $html;
40
-
41
- /**
42
- * The plugin version.
43
- *
44
- * @var string
45
- */
46
- public $plugin_version;
47
-
48
- /**
49
- * The stylesheet handle. For adding inline style.
50
- *
51
- * @since 2.31.8
52
- * @var string
53
- */
54
- public $stylesheet;
55
-
56
- /**
57
- * Strong_View constructor.
58
- *
59
- * @param array $atts
60
- */
61
- public function __construct( $atts = array() ) {
62
- $this->atts = apply_filters( 'wpmtst_view_atts', $atts );
63
- $this->plugin_version = get_option( 'wpmtst_plugin_version' );
64
- }
65
 
66
- /**
67
- * Return a specific view attribute.
68
- *
69
- * @param $att
70
- * @since 2.33.0
71
- *
72
- * @return mixed|null
73
- */
74
- public function get_att( $att ) {
75
- return isset( $this->atts[ $att ] ) ? $this->atts[ $att ] : null;
76
- }
77
 
78
- /**
79
- * Return our rendered template.
80
- *
81
- * @return string
82
- */
83
- public function output() {
84
- return $this->html;
85
- }
86
 
87
- /**
88
- * Warning message of view not found.
89
- *
90
- * @return string
91
- */
92
- public function nothing_found() {
93
- ob_start();
94
- ?>
95
  <p style="color: #CD0000;">
96
- <?php esc_html_e( 'No testimonials found. Check your view settings.', 'strong-testimonials' ); ?><br>
97
- <span style="color: #777; font-size: 0.9em;"><?php esc_html_e( '(Only administrators see this message.)', 'strong-testimonials' ); ?></span>
98
  </p>
99
- <?php
100
 
101
- return apply_filters( 'wpmtst_message_nothing_found', ob_get_clean() );
102
- }
103
 
104
- /**
105
- * Process the view.
106
- *
107
- * Used by main class to load the scripts and styles for this View.
108
- */
109
- public function process() {}
110
 
111
- /**
112
- * Build the view.
113
- */
114
- public function build() {}
115
 
116
- /**
117
- * Add content filters.
118
- */
119
- public function add_content_filters() {
120
 
121
- if ( 'truncated' == $this->get_att( 'content' ) ) {
122
 
123
- // automatic excerpt
124
 
125
- $this->excerpt_filters();
126
 
127
- $this->hybrid_content();
128
 
129
- add_filter( 'wpmtst_get_the_excerpt', 'wpmtst_bypass_excerpt', 1 );
130
 
131
- if ( $this->get_att( 'more_post_ellipsis' ) ) {
132
- add_filter( 'wpmtst_use_ellipsis', '__return_true' );
133
- }
134
- } elseif ( 'excerpt' == $this->get_att( 'content' ) ) {
135
 
136
- // manual excerpt (if no excerpt then use automatic excerpt)
137
 
138
- $this->excerpt_filters();
139
 
140
- $this->hybrid_content();
141
 
142
- if ( $this->get_att( 'more_full_post' ) ) {
143
- add_filter( 'wpmtst_get_the_excerpt', array( $this, 'manual_excerpt_more' ), 20 );
144
- }
145
 
146
- if ( $this->get_att( 'more_post_ellipsis' ) ) {
147
- add_filter( 'wpmtst_use_ellipsis', array( $this, 'has_no_excerpt' ) );
148
- } else {
149
- add_filter( 'wpmtst_use_ellipsis', '__return_false' );
150
- }
151
- } else {
152
 
153
- // full content
154
- add_filter( 'wpmtst_get_the_content', 'wpmtst_the_content_filtered' );
 
 
 
155
 
156
- }
157
 
158
- }
 
159
 
160
- /**
161
- * Add excerpt filters.
162
- *
163
- * @since 2.33.0
164
- */
165
- public function excerpt_filters() {
166
- add_filter( 'wpmtst_get_the_content', 'wpmtst_the_excerpt_filtered' );
167
- add_filter( 'wpmtst_get_the_excerpt', 'wpmtst_trim_excerpt' );
168
 
169
- if ( ! $this->get_att( 'use_default_length' ) ) {
170
- add_filter( 'excerpt_length', array( $this, 'excerpt_length' ) );
171
- }
172
-
173
- if ( ! $this->get_att( 'use_default_more' ) ) {
174
- add_filter( 'excerpt_more', array( $this, 'excerpt_more' ) );
175
- }
176
- }
177
 
178
- /**
179
- * Add hybrid content filters.
180
- *
181
- * @since 2.33.0
182
- */
183
- public function hybrid_content() {
184
- if ( $this->get_att( 'more_post_in_place' ) ) {
185
- add_filter( 'wpmtst_is_hybrid_content', '__return_true' );
186
- } else {
187
- add_filter( 'wpmtst_read_more_post_link', 'wpmtst_prepend_ellipsis' );
188
- }
189
  }
190
 
191
- /**
192
- * Remove content filters.
193
- *
194
- * @since 2.33.0
195
- */
196
- public function remove_content_filters() {
197
- remove_filter( 'wpmtst_get_the_content', 'wpmtst_the_content_filtered' );
198
- remove_filter( 'wpmtst_get_the_content', 'wpmtst_the_excerpt_filtered' );
199
-
200
- remove_filter( 'excerpt_length', array( $this, 'excerpt_length' ) );
201
- remove_filter( 'excerpt_more', array( $this, 'excerpt_more' ) );
202
- remove_filter( 'wpmtst_read_more_post_link', 'wpmtst_prepend_ellipsis' );
203
-
204
- remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_bypass_excerpt', 1 );
205
- remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_hybrid_excerpt' );
206
- remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_trim_excerpt' );
207
- remove_filter( 'wpmtst_get_the_excerpt', array( $this, 'manual_excerpt_more' ), 20 );
208
-
209
- remove_filter( 'wpmtst_is_hybrid_content', '__return_true' );
210
- remove_filter( 'wpmtst_use_ellipsis', '__return_true' );
211
- remove_filter( 'wpmtst_use_ellipsis', array( $this, 'has_no_excerpt' ) );
212
  }
 
213
 
214
- /**
215
- * Return true if post has no manual excerpt.
216
- *
217
- * @since 2.33.0
218
- *
219
- * @return bool
220
- */
221
- public function has_no_excerpt() {
222
- return ! has_excerpt();
 
223
  }
 
224
 
225
- /**
226
- * Set custom excerpt length.
227
- *
228
- * @param $words
229
- * @since 2.33.0
230
- *
231
- * @return mixed|null
232
- */
233
- public function excerpt_length( $words ) {
234
- $excerpt_length = $this->get_att( 'excerpt_length' );
 
 
 
 
 
 
 
 
 
 
 
 
235
 
236
- return $excerpt_length ? $excerpt_length : $words;
237
- }
 
 
 
 
 
 
 
 
238
 
239
- /**
240
- * The read-more link, maybe prepended with an ellipsis.
241
- *
242
- * @param $more
243
- * @since 2.33.0
244
- *
245
- * @return string
246
- */
247
- public function excerpt_more( $more ) {
248
- return wpmtst_get_excerpt_more_link();
249
- }
 
 
250
 
251
- /**
252
- * Maybe add read-more to manual excerpt.
253
- *
254
- * @since 2.26.0
255
- * @param $excerpt
256
- *
257
- * @return string
258
- */
259
- public function manual_excerpt_more( $excerpt ) {
260
- if ( has_excerpt() ) {
261
- $excerpt .= apply_filters( 'excerpt_more', ' [&hellip;]' );
262
- }
263
 
264
- return $excerpt;
 
 
 
 
 
 
 
 
 
 
265
  }
266
 
267
- /**
268
- * Build our query based on view attributes.
269
- */
270
- public function build_query() {}
271
-
272
- /**
273
- * Build class list based on view attributes.
274
- *
275
- * This must happen after the query.
276
- */
277
- public function build_classes() {}
278
 
279
- /**
280
- * Load template's extra stylesheets.
281
- *
282
- * @since 2.11.12
283
- * @since 2.16.0 In Strong_View class.
284
- */
285
- public function load_extra_stylesheets() {
286
- $styles = WPMST()->templates->get_template_config( $this->atts, 'styles', false );
287
- if ( $styles ) {
288
- $styles_array = explode( ',', str_replace( ' ', '', $styles ) );
289
- foreach ( $styles_array as $handle ) {
290
- WPMST()->render->add_style( $handle );
291
- }
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
  }
 
294
 
295
- /**
296
- * Load template's script and/or dependencies.
297
- *
298
- * @since 1.25.0
299
- * @since 2.16.0 In Strong_View class.
300
- */
301
- public function load_dependent_scripts() {
302
- // Scripts that are already registered.
303
- $deps = WPMST()->templates->get_template_config( $this->atts, 'scripts', false );
304
- $deps_array = $deps ? explode( ',', str_replace( ' ', '', $deps ) ) : array();
305
-
306
- // A single script included in directory.
307
- $script = WPMST()->templates->get_template_config( $this->atts, 'script', false );
308
-
309
- if ( $script ) {
310
- $handle = 'testimonials-' . $this->get_att( 'template' );
311
- wp_register_script( $handle, $script, $deps_array );
 
 
 
312
  WPMST()->render->add_script( $handle );
313
- } else {
314
- foreach ( $deps_array as $handle ) {
315
- WPMST()->render->add_script( $handle );
316
- }
317
  }
318
  }
 
319
 
320
- /**
321
- * Find a template's associated stylesheet.
322
- *
323
- * @since 1.23.0
324
- * @since 2.16.0 In Strong_View class.
325
- *
326
- * @param bool $enqueue True = enqueue the stylesheet, @since 2.3
327
- *
328
- * @return bool|string
329
- */
330
- public function find_stylesheet( $enqueue = true ) {
331
- // In case of deactivated widgets still referencing deleted Views
332
- if ( ! $this->get_att( 'template' ) ) {
333
- return false;
334
- }
335
 
336
- $stylesheet = WPMST()->templates->get_template_attr( $this->atts, 'stylesheet', false );
337
- if ( $stylesheet ) {
338
- $handle = 'testimonials-' . str_replace( ':', '-', $this->get_att( 'template' ) );
339
- $this->set_stylesheet( $handle );
340
- wp_register_style( $handle, $stylesheet, array(), $this->plugin_version );
341
- if ( $enqueue ) {
342
- WPMST()->render->add_style( $handle );
343
- } else {
344
- return $handle;
345
- }
346
  }
347
-
348
- return false;
349
  }
350
 
351
- /**
352
- * Assemble list of CSS classes.
353
- *
354
- * @since 2.11.0
355
- * @since 2.30.0 Adding template option classes.
356
- *
357
- * @return array
358
- */
359
- public function get_template_css_class() {
360
- $template_name = $this->get_att( 'template' );
361
- $template_settings = $this->get_att( 'template_settings' );
 
 
 
362
 
363
- // Maintain back-compat with template format version 1.0.
364
- $class = str_replace( ':content', '', $template_name );
365
- $class = str_replace( ':', '-', $class );
366
- $class = str_replace( '-form-form', '-form', $class );
367
- $class_list = array( $class );
368
 
369
- $template_object = WPMST()->templates->get_template_by_name( $template_name );
370
 
371
- if ( isset( $template_object['config']['options'] ) && is_array( ( $template_object['config']['options'] ) ) ) {
372
 
373
- foreach ( $template_object['config']['options'] as $option ) {
374
 
375
- if ( isset( $template_settings[ $template_name ][ $option->name ] ) ) {
376
 
377
- foreach ( $option->values as $value ) {
378
- if ( $value->value == $template_settings[ $template_name ][ $option->name ] ) {
379
- if ( isset( $value->class_name ) ) {
380
- $class_list[] = $value->class_name;
381
- }
382
  }
383
  }
384
  }
 
385
  }
 
386
  }
387
 
388
- return array_filter( $class_list );
389
  }
390
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  /**
392
- * Print our custom style.
393
  *
394
  * @since 2.22.0
395
  */
396
- public function add_custom_style() {
397
- $this->custom_background();
398
- $this->custom_font_color();
399
-
400
- /**
401
- * Hook to add more inline style.
402
- *
403
- * @since 2.22.0
404
- */
405
- do_action( 'wpmtst_view_custom_style', $this );
406
- }
407
 
408
- /**
409
- * Is this a form view?
410
- *
411
- * @since 2.30.0
412
- *
413
- * @return bool
414
- */
415
- public function is_form() {
416
- return ( 'form' == $this->get_att( 'mode' ) );
 
 
 
 
 
 
 
 
 
 
 
417
  }
418
 
419
- /**
420
- * Build CSS for custom font color.
421
- *
422
- * @since 2.30.0
423
- */
424
- public function custom_font_color() {
425
- $font_color = $this->get_att( 'font-color' );
426
- if ( ! isset( $font_color['type'] ) || 'custom' != $font_color['type'] ) {
427
- return;
428
- }
429
 
430
- $c1 = isset( $font_color['color'] ) ? $font_color['color'] : '';
431
-
432
- if ( $c1 ) {
433
- $view_el = ".strong-view-id-{$this->get_att( 'view' )}";
434
- $handle = $this->get_stylesheet();
435
-
436
- if ( $this->is_form() ) {
437
- wp_add_inline_style(
438
- $handle,
439
- "$view_el .strong-form-inner { color: $c1; }"
440
- );
441
- } else {
442
- wp_add_inline_style(
443
- $handle,
444
- "$view_el .testimonial-heading, " .
445
- "$view_el .testimonial-content p, " .
446
- "$view_el .testimonial-content a.readmore, " .
447
- "$view_el .testimonial-client div, " .
448
- "$view_el .testimonial-client a { color: $c1; }"
449
- );
450
- }
451
  }
452
  }
 
453
 
454
- /**
455
- * Build CSS for custom background.
456
- */
457
- public function custom_background() {
458
- $background = $this->get_att( 'background' );
459
- if ( ! isset( $background['type'] ) ) {
460
- return;
461
- }
462
 
463
- $handle = $this->get_stylesheet();
464
- $c1 = '';
465
- $c2 = '';
466
-
467
- switch ( $background['type'] ) {
468
- case 'preset':
469
- $preset = wpmtst_get_background_presets( $background['preset'] );
470
- $c1 = $preset['color'];
471
- if ( isset( $preset['color2'] ) ) {
472
- $c2 = $preset['color2'];
473
- }
474
- break;
475
- case 'gradient':
476
- $c1 = $background['gradient1'];
477
- $c2 = $background['gradient2'];
478
- break;
479
- case 'single':
480
- $c1 = $background['color'];
481
- break;
482
- default:
483
- }
484
 
485
- // Special handling for Divi Builder
486
- $prefix = '';
487
- if ( $this->get_att( 'divi_builder' ) && wpmtst_divi_builder_active() ) {
488
- $prefix = '#et_builder_outer_content ';
489
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
- $view_el = "$prefix.strong-view-id-{$this->get_att( 'view' )}";
492
 
493
- // Includes special handling for Bold template.
494
- if ( $c1 && $c2 ) {
495
 
496
- $gradient = self::gradient_rules( $c1, $c2 );
497
 
498
- if ( $this->is_form() ) {
499
 
500
- wp_add_inline_style( $handle, "$view_el .strong-form-inner { $gradient }" );
501
 
502
- } else {
503
 
504
- wp_add_inline_style( $handle, "$view_el .testimonial-inner { $gradient }" );
505
 
506
- if ( 'bold' == WPMST()->atts( 'template' ) ) {
507
- wp_add_inline_style( $handle, "$view_el .readmore-page { background: $c2 }" );
508
- }
509
  }
510
- } elseif ( $c1 ) {
511
 
512
- if ( $this->is_form() ) {
 
 
 
 
513
 
514
- wp_add_inline_style( $handle, "$view_el .strong-form-inner { background: $c1; }" );
515
 
516
- } else {
517
 
518
- wp_add_inline_style( $handle, "$view_el .testimonial-inner { background: $c1; }" );
519
 
520
- if ( 'bold' == WPMST()->atts( 'template' ) ) {
521
- wp_add_inline_style( $handle, "$view_el .readmore-page { background: $c1 }" );
522
- }
523
  }
 
524
  }
 
525
  }
 
526
 
527
- /**
528
- * Print gradient rules.
529
- *
530
- * @param $c1
531
- * @param $c2
532
- *
533
- * @return string
534
- */
535
- public function gradient_rules( $c1, $c2 ) {
536
- return "background: {$c1};
537
  background: -moz-linear-gradient(top, {$c1} 0%, {$c2} 100%);
538
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, {$c1}), color-stop(100%, {$c2}));
539
  background: -webkit-linear-gradient(top, {$c1} 0%, {$c2} 100%);
@@ -541,32 +545,32 @@ if ( ! class_exists( 'Strong_View' ) ) :
541
  background: -ms-linear-gradient(top, {$c1} 0%, {$c2} 100%);
542
  background: linear-gradient(to bottom, {$c1} 0%, {$c2} 100%);
543
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='{$c1}', endColorstr='{$c2}', GradientType=0);";
544
- }
545
 
546
- /**
547
- * Stars
548
- *
549
- * @since 2.16.0 In Strong_View class.
550
- */
551
- public function has_stars() {
552
- if ( $this->get_att( 'client_section' ) ) {
553
- foreach ( $this->get_att( 'client_section' ) as $field ) {
554
- if ( 'rating' == $field['type'] ) {
555
- WPMST()->render->add_style( 'wpmtst-rating-display' );
556
- break;
557
- }
558
  }
559
  }
560
  }
 
561
 
562
- public function set_stylesheet( $handle = '' ) {
563
- $this->stylesheet = $handle;
564
- }
565
-
566
- public function get_stylesheet() {
567
- return $this->stylesheet;
568
- }
569
 
 
 
570
  }
571
 
 
 
572
  endif;
6
  */
7
 
8
  // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
10
 
11
  if ( ! class_exists( 'Strong_View' ) ) :
12
 
13
+ class Strong_View {
14
+
15
+ /**
16
+ * The view settings.
17
+ *
18
+ * @var array
19
+ */
20
+ public $atts;
21
+
22
+ /**
23
+ * The query.
24
+ */
25
+ public $query;
26
+
27
+ /**
28
+ * The template file.
29
+ */
30
+ public $template_file;
31
+
32
+ /**
33
+ * The view output.
34
+ *
35
+ * @var string
36
+ */
37
+ public $html;
38
+
39
+ /**
40
+ * The plugin version.
41
+ *
42
+ * @var string
43
+ */
44
+ public $plugin_version;
45
+
46
+ /**
47
+ * The stylesheet handle. For adding inline style.
48
+ *
49
+ * @since 2.31.8
50
+ * @var string
51
+ */
52
+ public $stylesheet;
53
+
54
+ /**
55
+ * Strong_View constructor.
56
+ *
57
+ * @param array $atts
58
+ */
59
+ function __construct( $atts = array() ) {
60
+ $this->atts = apply_filters( 'wpmtst_view_atts', $atts );
61
+ $this->plugin_version = get_option( 'wpmtst_plugin_version' );
62
+ }
63
 
64
+ /**
65
+ * Return a specific view attribute.
66
+ *
67
+ * @param $att
68
+ * @since 2.33.0
69
+ *
70
+ * @return mixed|null
71
+ */
72
+ public function get_att( $att ) {
73
+ return isset( $this->atts[ $att ] ) ? $this->atts[ $att ] : null;
74
+ }
75
 
76
+ /**
77
+ * Return our rendered template.
78
+ *
79
+ * @return string
80
+ */
81
+ public function output() {
82
+ return $this->html;
83
+ }
84
 
85
+ /**
86
+ * Warning message of view not found.
87
+ *
88
+ * @return string
89
+ */
90
+ public function nothing_found() {
91
+ ob_start();
92
+ ?>
93
  <p style="color: #CD0000;">
94
+ <?php _e( 'No testimonials found. Check your view settings.', 'strong-testimonials' ); ?><br>
95
+ <span style="color: #777; font-size: 0.9em;"><?php _e( '(Only administrators see this message.)', 'strong-testimonials' ); ?></span>
96
  </p>
97
+ <?php
98
 
99
+ return apply_filters( 'wpmtst_message_nothing_found', ob_get_clean() );
100
+ }
101
 
102
+ /**
103
+ * Process the view.
104
+ *
105
+ * Used by main class to load the scripts and styles for this View.
106
+ */
107
+ public function process() {}
108
 
109
+ /**
110
+ * Build the view.
111
+ */
112
+ public function build() {}
113
 
114
+ /**
115
+ * Add content filters.
116
+ */
117
+ public function add_content_filters() {
118
 
119
+ if ( 'truncated' == $this->get_att( 'content' ) ) {
120
 
121
+ // automatic excerpt
122
 
123
+ $this->excerpt_filters();
124
 
125
+ $this->hybrid_content();
126
 
127
+ add_filter( 'wpmtst_get_the_excerpt', 'wpmtst_bypass_excerpt', 1 );
128
 
129
+ if ( $this->get_att( 'more_post_ellipsis' ) ) {
130
+ add_filter( 'wpmtst_use_ellipsis', '__return_true' );
131
+ }
 
132
 
133
+ } elseif ( 'excerpt' == $this->get_att( 'content' ) ) {
134
 
135
+ // manual excerpt (if no excerpt then use automatic excerpt)
136
 
137
+ $this->excerpt_filters();
138
 
139
+ $this->hybrid_content();
 
 
140
 
141
+ if ( $this->get_att( 'more_full_post' ) ) {
142
+ add_filter( 'wpmtst_get_the_excerpt', array( $this, 'manual_excerpt_more' ), 20 );
143
+ }
 
 
 
144
 
145
+ if ( $this->get_att( 'more_post_ellipsis' ) ) {
146
+ add_filter( 'wpmtst_use_ellipsis', array( $this, 'has_no_excerpt' ) );
147
+ } else {
148
+ add_filter( 'wpmtst_use_ellipsis', '__return_false' );
149
+ }
150
 
151
+ } else {
152
 
153
+ // full content
154
+ add_filter( 'wpmtst_get_the_content', 'wpmtst_the_content_filtered' );
155
 
156
+ }
 
 
 
 
 
 
 
157
 
158
+ }
 
 
 
 
 
 
 
159
 
160
+ /**
161
+ * Add excerpt filters.
162
+ *
163
+ * @since 2.33.0
164
+ */
165
+ public function excerpt_filters() {
166
+ add_filter( 'wpmtst_get_the_content', 'wpmtst_the_excerpt_filtered' );
167
+ add_filter( 'wpmtst_get_the_excerpt', 'wpmtst_trim_excerpt' );
168
+
169
+ if ( ! $this->get_att( 'use_default_length' ) ) {
170
+ add_filter( 'excerpt_length', array( $this, 'excerpt_length' ) );
171
  }
172
 
173
+ if ( ! $this->get_att( 'use_default_more' ) ) {
174
+ add_filter( 'excerpt_more', array( $this, 'excerpt_more' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
+ }
177
 
178
+ /**
179
+ * Add hybrid content filters.
180
+ *
181
+ * @since 2.33.0
182
+ */
183
+ public function hybrid_content() {
184
+ if ( $this->get_att( 'more_post_in_place' ) ) {
185
+ add_filter( 'wpmtst_is_hybrid_content', '__return_true' );
186
+ } else {
187
+ add_filter( 'wpmtst_read_more_post_link', 'wpmtst_prepend_ellipsis' );
188
  }
189
+ }
190
 
191
+ /**
192
+ * Remove content filters.
193
+ *
194
+ * @since 2.33.0
195
+ */
196
+ public function remove_content_filters() {
197
+ remove_filter( 'wpmtst_get_the_content', 'wpmtst_the_content_filtered' );
198
+ remove_filter( 'wpmtst_get_the_content', 'wpmtst_the_excerpt_filtered' );
199
+
200
+ remove_filter( 'excerpt_length', array( $this, 'excerpt_length' ) );
201
+ remove_filter( 'excerpt_more', array( $this, 'excerpt_more' ) );
202
+ remove_filter( 'wpmtst_read_more_post_link', 'wpmtst_prepend_ellipsis' );
203
+
204
+ remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_bypass_excerpt', 1 );
205
+ remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_hybrid_excerpt' );
206
+ remove_filter( 'wpmtst_get_the_excerpt', 'wpmtst_trim_excerpt' );
207
+ remove_filter( 'wpmtst_get_the_excerpt', array( $this, 'manual_excerpt_more' ), 20 );
208
+
209
+ remove_filter( 'wpmtst_is_hybrid_content', '__return_true' );
210
+ remove_filter( 'wpmtst_use_ellipsis', '__return_true' );
211
+ remove_filter( 'wpmtst_use_ellipsis', array( $this, 'has_no_excerpt' ) );
212
+ }
213
 
214
+ /**
215
+ * Return true if post has no manual excerpt.
216
+ *
217
+ * @since 2.33.0
218
+ *
219
+ * @return bool
220
+ */
221
+ public function has_no_excerpt() {
222
+ return ! has_excerpt();
223
+ }
224
 
225
+ /**
226
+ * Set custom excerpt length.
227
+ *
228
+ * @param $words
229
+ * @since 2.33.0
230
+ *
231
+ * @return mixed|null
232
+ */
233
+ public function excerpt_length( $words ) {
234
+ $excerpt_length = $this->get_att( 'excerpt_length' );
235
+
236
+ return $excerpt_length ? $excerpt_length : $words;
237
+ }
238
 
239
+ /**
240
+ * The read-more link, maybe prepended with an ellipsis.
241
+ *
242
+ * @param $more
243
+ * @since 2.33.0
244
+ *
245
+ * @return string
246
+ */
247
+ public function excerpt_more( $more ) {
248
+ return wpmtst_get_excerpt_more_link();
249
+ }
 
250
 
251
+ /**
252
+ * Maybe add read-more to manual excerpt.
253
+ *
254
+ * @since 2.26.0
255
+ * @param $excerpt
256
+ *
257
+ * @return string
258
+ */
259
+ public function manual_excerpt_more( $excerpt ) {
260
+ if ( has_excerpt() ) {
261
+ $excerpt .= apply_filters( 'excerpt_more', ' [&hellip;]' );
262
  }
263
 
264
+ return $excerpt;
265
+ }
 
 
 
 
 
 
 
 
 
266
 
267
+ /**
268
+ * Build our query based on view attributes.
269
+ */
270
+ public function build_query() {}
271
+
272
+ /**
273
+ * Build class list based on view attributes.
274
+ *
275
+ * This must happen after the query.
276
+ */
277
+ public function build_classes() {}
278
+
279
+ /**
280
+ * Load template's extra stylesheets.
281
+ *
282
+ * @since 2.11.12
283
+ * @since 2.16.0 In Strong_View class.
284
+ */
285
+ public function load_extra_stylesheets() {
286
+ $styles = WPMST()->templates->get_template_config( $this->atts, 'styles', false );
287
+ if ( $styles ) {
288
+ $styles_array = explode( ',', str_replace( ' ', '', $styles ) );
289
+ foreach ( $styles_array as $handle ) {
290
+ WPMST()->render->add_style( $handle );
291
  }
292
  }
293
+ }
294
 
295
+ /**
296
+ * Load template's script and/or dependencies.
297
+ *
298
+ * @since 1.25.0
299
+ * @since 2.16.0 In Strong_View class.
300
+ */
301
+ public function load_dependent_scripts() {
302
+ // Scripts that are already registered.
303
+ $deps = WPMST()->templates->get_template_config( $this->atts, 'scripts', false );
304
+ $deps_array = $deps ? explode( ',', str_replace( ' ', '', $deps ) ) : array();
305
+
306
+ // A single script included in directory.
307
+ $script = WPMST()->templates->get_template_config( $this->atts, 'script', false );
308
+
309
+ if ( $script ) {
310
+ $handle = 'testimonials-' . $this->get_att( 'template' );
311
+ wp_register_script( $handle, $script, $deps_array );
312
+ WPMST()->render->add_script( $handle );
313
+ } else {
314
+ foreach ( $deps_array as $handle ) {
315
  WPMST()->render->add_script( $handle );
 
 
 
 
316
  }
317
  }
318
+ }
319
 
320
+ /**
321
+ * Find a template's associated stylesheet.
322
+ *
323
+ * @since 1.23.0
324
+ * @since 2.16.0 In Strong_View class.
325
+ *
326
+ * @param bool $enqueue True = enqueue the stylesheet, @since 2.3
327
+ *
328
+ * @return bool|string
329
+ */
330
+ public function find_stylesheet( $enqueue = true ) {
331
+ // In case of deactivated widgets still referencing deleted Views
332
+ if ( ! $this->get_att( 'template' ) ) {
333
+ return false;
334
+ }
335
 
336
+ $stylesheet = WPMST()->templates->get_template_attr( $this->atts, 'stylesheet', false );
337
+ if ( $stylesheet ) {
338
+ $handle = 'testimonials-' . str_replace( ':', '-', $this->get_att( 'template' ) );
339
+ $this->set_stylesheet( $handle );
340
+ wp_register_style( $handle, $stylesheet, array(), $this->plugin_version );
341
+ if ( $enqueue ) {
342
+ WPMST()->render->add_style( $handle );
343
+ } else {
344
+ return $handle;
 
345
  }
 
 
346
  }
347
 
348
+ return false;
349
+ }
350
+
351
+ /**
352
+ * Assemble list of CSS classes.
353
+ *
354
+ * @since 2.11.0
355
+ * @since 2.30.0 Adding template option classes.
356
+ *
357
+ * @return array
358
+ */
359
+ public function get_template_css_class() {
360
+ $template_name = $this->get_att( 'template' );
361
+ $template_settings = $this->get_att( 'template_settings' );
362
 
363
+ // Maintain back-compat with template format version 1.0.
364
+ $class = str_replace( ':content', '', $template_name );
365
+ $class = str_replace( ':', '-', $class );
366
+ $class = str_replace( '-form-form', '-form', $class );
367
+ $class_list = array( $class );
368
 
369
+ $template_object = WPMST()->templates->get_template_by_name( $template_name );
370
 
371
+ if ( isset( $template_object['config']['options'] ) && is_array( ( $template_object['config']['options'] ) ) ) {
372
 
373
+ foreach ( $template_object['config']['options'] as $option ) {
374
 
375
+ if ( isset( $template_settings[ $template_name ][ $option->name ] ) ) {
376
 
377
+ foreach ( $option->values as $value ) {
378
+ if ( $value->value == $template_settings[ $template_name ][ $option->name ] ) {
379
+ if ( isset( $value->class_name ) ) {
380
+ $class_list[] = $value->class_name;
 
381
  }
382
  }
383
  }
384
+
385
  }
386
+
387
  }
388
 
 
389
  }
390
 
391
+ return array_filter( $class_list );
392
+ }
393
+
394
+ /**
395
+ * Print our custom style.
396
+ *
397
+ * @since 2.22.0
398
+ */
399
+ public function add_custom_style() {
400
+ $this->custom_background();
401
+ $this->custom_font_color();
402
+
403
  /**
404
+ * Hook to add more inline style.
405
  *
406
  * @since 2.22.0
407
  */
408
+ do_action( 'wpmtst_view_custom_style', $this );
409
+ }
 
 
 
 
 
 
 
 
 
410
 
411
+ /**
412
+ * Is this a form view?
413
+ *
414
+ * @since 2.30.0
415
+ *
416
+ * @return bool
417
+ */
418
+ public function is_form() {
419
+ return ( 'form' == $this->get_att( 'mode' ) );
420
+ }
421
+
422
+ /**
423
+ * Build CSS for custom font color.
424
+ *
425
+ * @since 2.30.0
426
+ */
427
+ public function custom_font_color() {
428
+ $font_color = $this->get_att( 'font-color' );
429
+ if ( ! isset( $font_color['type'] ) || 'custom' != $font_color['type'] ) {
430
+ return;
431
  }
432
 
433
+ $c1 = isset( $font_color['color'] ) ? $font_color['color'] : '';
 
 
 
 
 
 
 
 
 
434
 
435
+ if ( $c1 ) {
436
+ $view_el = ".strong-view-id-{$this->get_att( 'view' )}";
437
+ $handle = $this->get_stylesheet();
438
+
439
+ if ( $this->is_form() ) {
440
+ wp_add_inline_style( $handle,
441
+ "$view_el .strong-form-inner { color: $c1; }" );
442
+ }
443
+ else {
444
+ wp_add_inline_style( $handle,
445
+ "$view_el .testimonial-heading, " .
446
+ "$view_el .testimonial-content p, " .
447
+ "$view_el .testimonial-content a.readmore, " .
448
+ "$view_el .testimonial-client div, " .
449
+ "$view_el .testimonial-client a { color: $c1; }" );
 
 
 
 
 
 
450
  }
451
  }
452
+ }
453
 
454
+ /**
455
+ * Build CSS for custom background.
456
+ */
457
+ public function custom_background() {
458
+ $background = $this->get_att( 'background' );
459
+ if ( ! isset( $background['type'] ) ) {
460
+ return;
461
+ }
462
 
463
+ $handle = $this->get_stylesheet();
464
+ $c1 = '';
465
+ $c2 = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
 
467
+ switch ( $background['type'] ) {
468
+ case 'preset':
469
+ $preset = wpmtst_get_background_presets( $background['preset'] );
470
+ $c1 = $preset['color'];
471
+ if ( isset( $preset['color2'] ) ) {
472
+ $c2 = $preset['color2'];
473
+ }
474
+ break;
475
+ case 'gradient':
476
+ $c1 = $background['gradient1'];
477
+ $c2 = $background['gradient2'];
478
+ break;
479
+ case 'single':
480
+ $c1 = $background['color'];
481
+ break;
482
+ default:
483
+ }
484
+
485
+ // Special handling for Divi Builder
486
+ $prefix = '';
487
+ if ( $this->get_att( 'divi_builder' ) && wpmtst_divi_builder_active() ) {
488
+ $prefix = '#et_builder_outer_content ';
489
+ }
490
 
491
+ $view_el = "$prefix.strong-view-id-{$this->get_att( 'view' )}";
492
 
493
+ // Includes special handling for Bold template.
494
+ if ( $c1 && $c2 ) {
495
 
496
+ $gradient = self::gradient_rules( $c1, $c2 );
497
 
498
+ if ( $this->is_form() ) {
499
 
500
+ wp_add_inline_style( $handle, "$view_el .strong-form-inner { $gradient }" );
501
 
502
+ } else {
503
 
504
+ wp_add_inline_style( $handle, "$view_el .testimonial-inner { $gradient }" );
505
 
506
+ if ( 'bold' == WPMST()->atts( 'template' ) ) {
507
+ wp_add_inline_style( $handle, "$view_el .readmore-page { background: $c2 }" );
 
508
  }
 
509
 
510
+ }
511
+
512
+ } elseif ( $c1 ) {
513
+
514
+ if ( $this->is_form() ) {
515
 
516
+ wp_add_inline_style( $handle, "$view_el .strong-form-inner { background: $c1; }" );
517
 
518
+ } else {
519
 
520
+ wp_add_inline_style( $handle, "$view_el .testimonial-inner { background: $c1; }" );
521
 
522
+ if ( 'bold' == WPMST()->atts( 'template' ) ) {
523
+ wp_add_inline_style( $handle, "$view_el .readmore-page { background: $c1 }" );
 
524
  }
525
+
526
  }
527
+
528
  }
529
+ }
530
 
531
+ /**
532
+ * Print gradient rules.
533
+ *
534
+ * @param $c1
535
+ * @param $c2
536
+ *
537
+ * @return string
538
+ */
539
+ public function gradient_rules( $c1, $c2 ) {
540
+ return "background: {$c1};
541
  background: -moz-linear-gradient(top, {$c1} 0%, {$c2} 100%);
542
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, {$c1}), color-stop(100%, {$c2}));
543
  background: -webkit-linear-gradient(top, {$c1} 0%, {$c2} 100%);
545
  background: -ms-linear-gradient(top, {$c1} 0%, {$c2} 100%);
546
  background: linear-gradient(to bottom, {$c1} 0%, {$c2} 100%);
547
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='{$c1}', endColorstr='{$c2}', GradientType=0);";
548
+ }
549
 
550
+ /**
551
+ * Stars
552
+ *
553
+ * @since 2.16.0 In Strong_View class.
554
+ */
555
+ public function has_stars() {
556
+ if ( $this->get_att( 'client_section' ) ) {
557
+ foreach ( $this->get_att( 'client_section' ) as $field ) {
558
+ if ( 'rating' == $field['type'] ) {
559
+ WPMST()->render->add_style( 'wpmtst-rating-display' );
560
+ break;
 
561
  }
562
  }
563
  }
564
+ }
565
 
566
+ public function set_stylesheet( $handle = '' ) {
567
+ $this->stylesheet = $handle;
568
+ }
 
 
 
 
569
 
570
+ public function get_stylesheet() {
571
+ return $this->stylesheet;
572
  }
573
 
574
+ }
575
+
576
  endif;
includes/class-walker-strong-category-checklist-front.php CHANGED
@@ -16,10 +16,7 @@
16
  */
17
  class Walker_Strong_Category_Checklist_Front extends Walker {
18
  public $tree_type = 'category';
19
- public $db_fields = array(
20
- 'parent' => 'parent',
21
- 'id' => 'term_id',
22
- );
23
 
24
  /**
25
  * Starts the list before the elements are added.
@@ -33,7 +30,7 @@ class Walker_Strong_Category_Checklist_Front extends Walker {
33
  * @param array $args An array of arguments. @see wp_terms_checklist()
34
  */
35
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
36
- $indent = str_repeat( "\t", $depth );
37
  $output .= "$indent<ul class='children'>\n";
38
  }
39
 
@@ -49,7 +46,7 @@ class Walker_Strong_Category_Checklist_Front extends Walker {
49
  * @param array $args An array of arguments. @see wp_terms_checklist()
50
  */
51
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
52
- $indent = str_repeat( "\t", $depth );
53
  $output .= "$indent</ul>\n";
54
  }
55
 
@@ -73,10 +70,10 @@ class Walker_Strong_Category_Checklist_Front extends Walker {
73
  $taxonomy = $args['taxonomy'];
74
  }
75
 
76
- $name = 'category';
77
 
78
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
79
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
80
 
81
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
82
 
@@ -84,7 +81,7 @@ class Walker_Strong_Category_Checklist_Front extends Walker {
84
 
85
  if ( ! empty( $args['list_only'] ) ) {
86
  $aria_cheched = 'false';
87
- $inner_class = 'category';
88
 
89
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
90
  $inner_class .= ' selected';
@@ -96,7 +93,8 @@ class Walker_Strong_Category_Checklist_Front extends Walker {
96
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
97
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
98
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
99
- } else {
 
100
  /** This filter is documented in wp-includes/category-template.php */
101
  // newlines make for consistent spacing without extra CSS
102
  $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
16
  */
17
  class Walker_Strong_Category_Checklist_Front extends Walker {
18
  public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
 
 
 
20
 
21
  /**
22
  * Starts the list before the elements are added.
30
  * @param array $args An array of arguments. @see wp_terms_checklist()
31
  */
32
  public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
  $output .= "$indent<ul class='children'>\n";
35
  }
36
 
46
  * @param array $args An array of arguments. @see wp_terms_checklist()
47
  */
48
  public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
  $output .= "$indent</ul>\n";
51
  }
52
 
70
  $taxonomy = $args['taxonomy'];
71
  }
72
 
73
+ $name = "category";
74
 
75
  $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
 
78
  $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
 
81
 
82
  if ( ! empty( $args['list_only'] ) ) {
83
  $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
 
86
  if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
  $inner_class .= ' selected';
93
  '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
  ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
  esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
  /** This filter is documented in wp-includes/category-template.php */
99
  // newlines make for consistent spacing without extra CSS
100
  $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
includes/filters.php CHANGED
@@ -50,101 +50,3 @@ function wpmtst_content_filters() {
50
  add_filter( 'wpmtst_the_excerpt', 'convert_smilies', 20 );
51
  }
52
  add_action( 'init', 'wpmtst_content_filters' );
53
-
54
-
55
-
56
- function wpmtst_add_allowed_tags( $tags ) {
57
-
58
- // iframe
59
- $tags['iframe'] = array(
60
- 'src' => true,
61
- 'height' => true,
62
- 'width' => true,
63
- 'frameborder' => true,
64
- 'allowfullscreen' => true,
65
- 'style' => true,
66
- 'data-*' => true,
67
- 'hidden' => true,
68
- );
69
- // form fields - input
70
- $tags['input'] = array(
71
- 'class' => true,
72
- 'id' => true,
73
- 'name' => true,
74
- 'value' => true,
75
- 'type' => true,
76
- 'placeholder' => true,
77
- 'required' => true,
78
- 'checked' => true,
79
- 'title' => true,
80
- 'style' => true,
81
- 'data-*' => true,
82
- 'hidden' => true,
83
- );
84
- // textarea
85
- $tags['textarea'] = array(
86
- 'class' => true,
87
- 'id' => true,
88
- 'name' => true,
89
- 'value' => true,
90
- 'type' => true,
91
- 'placeholder' => true,
92
- 'required' => true,
93
- 'style' => true,
94
- 'data-*' => true,
95
- 'hidden' => true,
96
- );
97
- // select
98
- $tags['select'] = array(
99
- 'class' => true,
100
- 'id' => true,
101
- 'name' => true,
102
- 'value' => true,
103
- 'type' => true,
104
- 'style' => true,
105
- 'data-*' => true,
106
- 'hidden' => true,
107
- );
108
- // select options
109
- $tags['option'] = array(
110
- 'selected' => true,
111
- 'class' => true,
112
- 'id' => true,
113
- 'name' => true,
114
- 'value' => true,
115
- 'style' => true,
116
- 'data-*' => true,
117
- 'hidden' => true,
118
- );
119
- $tags['optgroup'] = array(
120
- 'class' => true,
121
- 'id' => true,
122
- 'name' => true,
123
- 'value' => true,
124
- 'label' => true,
125
- 'style' => true,
126
- 'data-*' => true,
127
- 'hidden' => true,
128
- );
129
-
130
- $tags['span']['hidden'] = true;
131
-
132
- $tags['img']['srcset'] = true;
133
- $tags['img']['sizes'] = true;
134
-
135
- $tags['noscript'] = array();
136
-
137
- $tags['style'] = array(
138
- 'types' => true,
139
- );
140
-
141
- return $tags;
142
- }
143
- add_filter( 'wp_kses_allowed_html', 'wpmtst_add_allowed_tags' );
144
-
145
-
146
- function wpmtst_safe_style_css( $styles ) {
147
- $styles[] = 'display';
148
- return $styles;
149
- }
150
- add_filter( 'safe_style_css', 'wpmtst_safe_style_css' );
50
  add_filter( 'wpmtst_the_excerpt', 'convert_smilies', 20 );
51
  }
52
  add_action( 'init', 'wpmtst_content_filters' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions-activation.php CHANGED
@@ -7,7 +7,7 @@
7
  */
8
  function wpmtst_update_tables() {
9
  global $wpdb;
10
- require_once ABSPATH . 'wp-admin/includes/upgrade.php';
11
 
12
  $charset_collate = $wpdb->get_charset_collate();
13
 
@@ -26,14 +26,14 @@ function wpmtst_update_tables() {
26
 
27
  if ( $wpdb->last_error ) {
28
  deactivate_plugins( 'strong-testimonials/strong-testimonials.php' );
29
- $message = '<p><span style="color: #CD0000;">';
30
  $message .= __( 'An error occurred:', 'strong-testimonials' ) . '</span>&nbsp;';
31
  $message .= __( 'The plugin has been deactivated.', 'strong-testimonials' );
32
  $message .= '</p>';
33
  $message .= '<p><code>' . $wpdb->last_error . '</code></p>';
34
  $message .= '<p>' . sprintf( __( '<a href="%s">Go back to Dashboard</a>', 'strong-testimonials' ), esc_url( admin_url() ) ) . '</p>';
35
 
36
- wp_die( sprintf( '<div class="error strong-view-error">%s</div>', wp_kses_post( $message ) ) );
37
  }
38
 
39
  update_option( 'wpmtst_db_version', WPMST()->get_db_version() );
7
  */
8
  function wpmtst_update_tables() {
9
  global $wpdb;
10
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
11
 
12
  $charset_collate = $wpdb->get_charset_collate();
13
 
26
 
27
  if ( $wpdb->last_error ) {
28
  deactivate_plugins( 'strong-testimonials/strong-testimonials.php' );
29
+ $message = '<p><span style="color: #CD0000;">';
30
  $message .= __( 'An error occurred:', 'strong-testimonials' ) . '</span>&nbsp;';
31
  $message .= __( 'The plugin has been deactivated.', 'strong-testimonials' );
32
  $message .= '</p>';
33
  $message .= '<p><code>' . $wpdb->last_error . '</code></p>';
34
  $message .= '<p>' . sprintf( __( '<a href="%s">Go back to Dashboard</a>', 'strong-testimonials' ), esc_url( admin_url() ) ) . '</p>';
35
 
36
+ wp_die( sprintf( '<div class="error strong-view-error">%s</div>', $message ) );
37
  }
38
 
39
  update_option( 'wpmtst_db_version', WPMST()->get_db_version() );
includes/functions-content.php CHANGED
@@ -11,7 +11,7 @@
11
  *
12
  * @return string
13
  */
14
- function wpmtst_the_content_filtered( $more_link_text = null, $strip_teaser = false ) {
15
  $content = get_the_content( $more_link_text, $strip_teaser );
16
  $content = apply_filters( 'wpmtst_the_content', $content );
17
  $content = str_replace( ']]>', ']]&gt;', $content );
@@ -138,24 +138,21 @@ function wpmtst_get_the_prepared_text( $hybrid = false ) {
138
  function wpmtst_get_excerpt_more_link() {
139
  $url = apply_filters( 'wpmtst_read_more_post_url', get_permalink(), WPMST()->atts() );
140
 
141
- $link_text = sprintf(
142
- '%s<span class="screen-reader-text"> "%s"</span>',
143
- apply_filters( 'wpmtst_read_more_post_link_text', WPMST()->atts( 'more_post_text' ), WPMST()->atts() ),
144
- get_the_title()
145
  );
146
 
147
  $link_class = apply_filters( 'wpmtst_read_more_post_link_class', 'readmore' );
148
 
149
  if ( apply_filters( 'wpmtst_is_hybrid_content', false ) ) {
150
- // no href
151
- $link = sprintf(
152
- '<a aria-expanded="false" aria-controls="more-%1$d" class="%2s readmore-toggle"><span class="readmore-text" data-more-text="%4$s" data-less-text="%5$s">%3$s</span></a>',
153
- get_the_ID(), // 1
154
- $link_class, // 2
155
- $link_text, // 3
156
- WPMST()->atts( 'more_post_text' ), // 4
157
- WPMST()->atts( 'less_post_text' ) // 5
158
- );
159
  } else {
160
  $link = sprintf( '<a href="%s" class="%s">%s</a>', esc_url( $url ), $link_class, $link_text );
161
  }
@@ -189,11 +186,11 @@ function wpmtst_trim_words( $text, $num_words = 55, $more = null, $hybrid = fals
189
  $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
190
  preg_match_all( '/./u', $text, $words_array );
191
  $words_array = array_slice( $words_array[0], 0, $num_words + 1 );
192
- $sep = '';
193
  } else {
194
- $offset = $hybrid ? 0 : $num_words + 1;
195
  $words_array = preg_split( "/[\n\r\t ]+/", $text, $offset, PREG_SPLIT_NO_EMPTY );
196
- $sep = ' ';
197
  }
198
 
199
  if ( count( $words_array ) > $num_words ) {
11
  *
12
  * @return string
13
  */
14
+ function wpmtst_the_content_filtered( $more_link_text = null, $strip_teaser = false) {
15
  $content = get_the_content( $more_link_text, $strip_teaser );
16
  $content = apply_filters( 'wpmtst_the_content', $content );
17
  $content = str_replace( ']]>', ']]&gt;', $content );
138
  function wpmtst_get_excerpt_more_link() {
139
  $url = apply_filters( 'wpmtst_read_more_post_url', get_permalink(), WPMST()->atts() );
140
 
141
+ $link_text = sprintf( '%s<span class="screen-reader-text"> "%s"</span>',
142
+ apply_filters( 'wpmtst_read_more_post_link_text', WPMST()->atts( 'more_post_text' ), WPMST()->atts() ), get_the_title()
 
 
143
  );
144
 
145
  $link_class = apply_filters( 'wpmtst_read_more_post_link_class', 'readmore' );
146
 
147
  if ( apply_filters( 'wpmtst_is_hybrid_content', false ) ) {
148
+ // no href
149
+ $link = sprintf( '<a aria-expanded="false" aria-controls="more-%1$d" class="%2s readmore-toggle"><span class="readmore-text" data-more-text="%4$s" data-less-text="%5$s">%3$s</span></a>',
150
+ get_the_ID(), // 1
151
+ $link_class, // 2
152
+ $link_text, // 3
153
+ WPMST()->atts( 'more_post_text' ), // 4
154
+ WPMST()->atts( 'less_post_text' ) // 5
155
+ );
 
156
  } else {
157
  $link = sprintf( '<a href="%s" class="%s">%s</a>', esc_url( $url ), $link_class, $link_text );
158
  }
186
  $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
187
  preg_match_all( '/./u', $text, $words_array );
188
  $words_array = array_slice( $words_array[0], 0, $num_words + 1 );
189
+ $sep = '';
190
  } else {
191
+ $offset = $hybrid ? 0 : $num_words + 1;
192
  $words_array = preg_split( "/[\n\r\t ]+/", $text, $offset, PREG_SPLIT_NO_EMPTY );
193
+ $sep = ' ';
194
  }
195
 
196
  if ( count( $words_array ) > $num_words ) {
includes/functions-image.php CHANGED
@@ -9,18 +9,17 @@
9
  * @return mixed|string
10
  */
11
  function wpmtst_get_thumbnail( $size = null ) {
12
- if ( ! WPMST()->atts( 'thumbnail' ) ) {
13
  return '';
14
- }
15
 
16
  // let arg override view setting
17
- $size = ( null === $size ) ? WPMST()->atts( 'thumbnail_size' ) : $size;
18
  if ( 'custom' == $size ) {
19
  $size = array( WPMST()->atts( 'thumbnail_width' ), WPMST()->atts( 'thumbnail_height' ) );
20
  }
21
 
22
- $id = get_the_ID();
23
- $img = '';
24
 
25
  // check for a featured image
26
  if ( has_post_thumbnail( $id ) ) {
@@ -45,6 +44,7 @@ function wpmtst_get_thumbnail( $size = null ) {
45
  $img = get_avatar( wpmtst_get_field( 'email' ), apply_filters( 'wpmtst_gravatar_size', $size ) );
46
  }
47
  }
 
48
  }
49
 
50
  return apply_filters( 'wpmtst_thumbnail_img', $img, $id );
@@ -125,7 +125,7 @@ function wpmtst_gravatar_size_filter( $size = array( 150, 150 ) ) {
125
  } else {
126
  // if named size
127
  $image_sizes = wpmtst_get_image_sizes();
128
- $gravatar_size = $image_sizes[ $size ]['width'];
129
  }
130
 
131
  return $gravatar_size;
@@ -142,7 +142,7 @@ add_filter( 'wpmtst_gravatar_size', 'wpmtst_gravatar_size_filter' );
142
  */
143
  function wpmtst_has_gravatar( $email_address ) {
144
  // Build the Gravatar URL by hashing the email address
145
- $url = 'http://www.gravatar.com/avatar/' . md5( strtolower( trim( $email_address ) ) ) . '?d=404';
146
 
147
  // Now check the headers...
148
  $headers = @get_headers( $url );
@@ -161,9 +161,8 @@ function wpmtst_has_gravatar( $email_address ) {
161
  * @return bool
162
  */
163
  function wpmtst_get_avatar( $url, $id_or_email, $args ) {
164
- if ( 'if' == WPMST()->atts( 'gravatar' ) && ! wpmtst_has_gravatar( $id_or_email ) ) {
165
  return false;
166
- }
167
 
168
  return $url;
169
  }
9
  * @return mixed|string
10
  */
11
  function wpmtst_get_thumbnail( $size = null ) {
12
+ if ( ! WPMST()->atts( 'thumbnail' ) )
13
  return '';
 
14
 
15
  // let arg override view setting
16
+ $size = ( null === $size ) ? WPMST()->atts( 'thumbnail_size' ) : $size ;
17
  if ( 'custom' == $size ) {
18
  $size = array( WPMST()->atts( 'thumbnail_width' ), WPMST()->atts( 'thumbnail_height' ) );
19
  }
20
 
21
+ $id = get_the_ID();
22
+ $img = '';
23
 
24
  // check for a featured image
25
  if ( has_post_thumbnail( $id ) ) {
44
  $img = get_avatar( wpmtst_get_field( 'email' ), apply_filters( 'wpmtst_gravatar_size', $size ) );
45
  }
46
  }
47
+
48
  }
49
 
50
  return apply_filters( 'wpmtst_thumbnail_img', $img, $id );
125
  } else {
126
  // if named size
127
  $image_sizes = wpmtst_get_image_sizes();
128
+ $gravatar_size = $image_sizes[$size]['width'];
129
  }
130
 
131
  return $gravatar_size;
142
  */
143
  function wpmtst_has_gravatar( $email_address ) {
144
  // Build the Gravatar URL by hashing the email address
145
+ $url = 'http://www.gravatar.com/avatar/' . md5( strtolower( trim ( $email_address ) ) ) . '?d=404';
146
 
147
  // Now check the headers...
148
  $headers = @get_headers( $url );
161
  * @return bool
162
  */
163
  function wpmtst_get_avatar( $url, $id_or_email, $args ) {
164
+ if ( 'if' == WPMST()->atts( 'gravatar' ) && ! wpmtst_has_gravatar( $id_or_email ) )
165
  return false;
 
166
 
167
  return $url;
168
  }
includes/functions-rating.php CHANGED
@@ -15,36 +15,41 @@
15
  * @return string
16
  */
17
  function wpmtst_star_rating_form( $field, $value = 0, $class, $echo = true, $field_array = '' ) {
18
- $value = (int) $value;
19
  if ( $field && is_array( $field ) && isset( $field['name'] ) ) {
20
  $name = $field['name'];
21
  if ( $field_array ) {
22
- $name = $field_array . '[' . $name . ']';
23
  }
24
  } else {
25
  $name = 'rating';
26
  }
27
  ob_start(); ?>
28
- <div class="strong-rating-wrapper field-wrap <?php echo esc_attr( $class ); ?>"><!-- cheap trick to collapse whitespace around inline-blocks
29
- --><fieldset contenteditable=false id="wpmtst_<?php echo esc_attr( $field['name'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>" class="strong-rating" data-field-type="rating" tabindex="0"><!--
 
 
 
 
 
30
 
31
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star0" name="<?php echo esc_attr( $name ); ?>" value="0" <?php checked( $value, 0 ); ?> /><!--
32
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star0" title="No stars"></label><!--
33
 
34
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star1" name="<?php echo esc_attr( $name ); ?>" value="1" <?php checked( $value, 1 ); ?> /><!--
35
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star1" title="1 star"></label><!--
36
 
37
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star2" name="<?php echo esc_attr( $name ); ?>" value="2" <?php checked( $value, 2 ); ?> /><!--
38
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star2" title="2 stars"></label><!--
39
 
40
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star3" name="<?php echo esc_attr( $name ); ?>" value="3" <?php checked( $value, 3 ); ?> /><!--
41
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star3" title="3 stars"></label><!--
42
 
43
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star4" name="<?php echo esc_attr( $name ); ?>" value="4" <?php checked( $value, 4 ); ?> /><!--
44
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star4" title="4 stars"></label><!--
45
 
46
- --><input type="radio" id="<?php echo esc_attr( $field['name'] ); ?>-star5" name="<?php echo esc_attr( $name ); ?>" value="5" <?php checked( $value, 5 ); ?> /><!--
47
- --><label for="<?php echo esc_attr( $field['name'] ); ?>-star5" title="5 stars"></label><!--
48
 
49
  --></fieldset><!--
50
  --></div>
@@ -54,11 +59,11 @@ function wpmtst_star_rating_form( $field, $value = 0, $class, $echo = true, $fie
54
  $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
55
 
56
  if ( $echo ) {
57
- echo wp_kses_post( $html );
58
- return true;
59
  }
60
 
61
- return $html;
62
  }
63
 
64
  /**
@@ -69,17 +74,16 @@ function wpmtst_star_rating_form( $field, $value = 0, $class, $echo = true, $fie
69
  * @return bool|string
70
  */
71
  function wpmtst_star_rating_display( $value = 0, $class = 'in-view', $echo = true ) {
72
- $value = (int) $value;
73
- ob_start();
74
- ?>
75
- <span class="strong-rating-wrapper <?php echo esc_attr( $class ); ?>">
76
  <span class="strong-rating"><!-- cheap trick to collapse whitespace around inline-blocks
77
- --><span class="star<?php echo ( 0 == $value ) ? ' current' : ''; ?>" style="display: none;"></span><!--
78
- --><span class="star<?php echo ( 1 == $value ) ? ' current' : ''; ?>"></span><!--
79
- --><span class="star<?php echo ( 2 == $value ) ? ' current' : ''; ?>"></span><!--
80
- --><span class="star<?php echo ( 3 == $value ) ? ' current' : ''; ?>"></span><!--
81
- --><span class="star<?php echo ( 4 == $value ) ? ' current' : ''; ?>"></span><!--
82
- --><span class="star<?php echo ( 5 == $value ) ? ' current' : ''; ?>"></span><!--
83
  --></span>
84
  </span>
85
  <?php
@@ -88,9 +92,9 @@ function wpmtst_star_rating_display( $value = 0, $class = 'in-view', $echo = tru
88
  $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
89
 
90
  if ( $echo ) {
91
- echo wp_kses_post( $html );
92
- return true;
93
  }
94
 
95
- return $html;
96
  }
15
  * @return string
16
  */
17
  function wpmtst_star_rating_form( $field, $value = 0, $class, $echo = true, $field_array = '' ) {
18
+ $value = (int) $value;
19
  if ( $field && is_array( $field ) && isset( $field['name'] ) ) {
20
  $name = $field['name'];
21
  if ( $field_array ) {
22
+ $name = $field_array . '[' . $name . ']';
23
  }
24
  } else {
25
  $name = 'rating';
26
  }
27
  ob_start(); ?>
28
+ <div class="strong-rating-wrapper field-wrap <?php echo $class; ?>"><!-- cheap trick to collapse whitespace around inline-blocks
29
+ --><fieldset contenteditable=false
30
+ id="wpmtst_<?php echo $field['name']; ?>"
31
+ name="<?php echo $field['name']; ?>"
32
+ class="strong-rating"
33
+ data-field-type="rating"
34
+ tabindex="0"><!--
35
 
36
+ --><input type="radio" id="<?php echo $field['name']; ?>-star0" name="<?php echo $name; ?>" value="0" <?php checked( $value, 0 ); ?> /><!--
37
+ --><label for="<?php echo $field['name']; ?>-star0" title="No stars"></label><!--
38
 
39
+ --><input type="radio" id="<?php echo $field['name']; ?>-star1" name="<?php echo $name; ?>" value="1" <?php checked( $value, 1 ); ?> /><!--
40
+ --><label for="<?php echo $field['name']; ?>-star1" title="1 star"></label><!--
41
 
42
+ --><input type="radio" id="<?php echo $field['name']; ?>-star2" name="<?php echo $name; ?>" value="2" <?php checked( $value, 2 ); ?> /><!--
43
+ --><label for="<?php echo $field['name']; ?>-star2" title="2 stars"></label><!--
44
 
45
+ --><input type="radio" id="<?php echo $field['name']; ?>-star3" name="<?php echo $name; ?>" value="3" <?php checked( $value, 3 ); ?> /><!--
46
+ --><label for="<?php echo $field['name']; ?>-star3" title="3 stars"></label><!--
47
 
48
+ --><input type="radio" id="<?php echo $field['name']; ?>-star4" name="<?php echo $name; ?>" value="4" <?php checked( $value, 4 ); ?> /><!--
49
+ --><label for="<?php echo $field['name']; ?>-star4" title="4 stars"></label><!--
50
 
51
+ --><input type="radio" id="<?php echo $field['name']; ?>-star5" name="<?php echo $name; ?>" value="5" <?php checked( $value, 5 ); ?> /><!--
52
+ --><label for="<?php echo $field['name']; ?>-star5" title="5 stars"></label><!--
53
 
54
  --></fieldset><!--
55
  --></div>
59
  $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
60
 
61
  if ( $echo ) {
62
+ echo $html;
63
+ return true;
64
  }
65
 
66
+ return $html;
67
  }
68
 
69
  /**
74
  * @return bool|string
75
  */
76
  function wpmtst_star_rating_display( $value = 0, $class = 'in-view', $echo = true ) {
77
+ $value = (int) $value;
78
+ ob_start(); ?>
79
+ <span class="strong-rating-wrapper <?php echo $class; ?>">
 
80
  <span class="strong-rating"><!-- cheap trick to collapse whitespace around inline-blocks
81
+ --><span class="star<?php echo ( 0 == $value ) ? ' current' : '' ; ?>" style="display: none;"></span><!--
82
+ --><span class="star<?php echo ( 1 == $value ) ? ' current' : '' ; ?>"></span><!--
83
+ --><span class="star<?php echo ( 2 == $value ) ? ' current' : '' ; ?>"></span><!--
84
+ --><span class="star<?php echo ( 3 == $value ) ? ' current' : '' ; ?>"></span><!--
85
+ --><span class="star<?php echo ( 4 == $value ) ? ' current' : '' ; ?>"></span><!--
86
+ --><span class="star<?php echo ( 5 == $value ) ? ' current' : '' ; ?>"></span><!--
87
  --></span>
88
  </span>
89
  <?php
92
  $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
93
 
94
  if ( $echo ) {
95
+ echo $html;
96
+ return true;
97
  }
98
 
99
+ return $html;
100
  }
includes/functions-template-form.php CHANGED
@@ -9,26 +9,26 @@ function wpmtst_form_info() {
9
 
10
  function wpmtst_form_setup() {
11
  $form_values = WPMST()->form->get_form_values();
12
- $cats = (array) $form_values['category'];
13
 
14
  echo '<div style="display: none;">';
15
  wp_nonce_field( 'wpmtst_form_action', 'wpmtst_form_nonce', true, true );
16
  echo '<input type="hidden" name="action" value="wpmtst_form">';
17
- echo '<input type="hidden" name="form_id" value="' . esc_attr( WPMST()->atts( 'form_id' ) ) . '">';
18
- echo '<input type="hidden" name="default_category" value="' . esc_attr( WPMST()->atts( 'category' ) ) . '">';
19
- echo '<input type="hidden" name="category" value="' . esc_attr( implode( ',', $cats ) ) . '">';
20
  echo '</div>';
21
  }
22
 
23
  function wpmtst_form_message( $part ) {
24
- echo wp_kses_post( wpmtst_get_form_message( $part ) );
25
  }
26
 
27
  function wpmtst_get_form_message( $part ) {
28
  $form_options = get_option( 'wpmtst_form_options' );
29
- $messages = $form_options['messages'];
30
- if ( isset( $messages[ $part ]['text'] ) ) {
31
- return apply_filters( 'wpmtst_form_message', $messages[ $part ]['text'], $messages[ $part ] );
32
  }
33
 
34
  return '';
@@ -65,141 +65,131 @@ function wpmtst_form_field( $field_name ) {
65
  function wpmtst_single_form_field( $field ) {
66
  $form_values = WPMST()->form->get_form_values();
67
 
68
- echo '<div class="' . esc_attr( wpmtst_field_group_classes( $field['input_type'], $field['name'] ) ) . '">';
69
 
70
  if ( 'checkbox' != $field['input_type'] ) {
71
 
72
  if ( ! isset( $field['show_label'] ) || $field['show_label'] ) {
73
- printf(
74
- '<label for="wpmtst_%s" class="%s">%s</label>',
75
- esc_attr( $field['name'] ),
76
- esc_attr( wpmtst_field_label_classes( $field['input_type'], $field['name'] ) ),
77
- esc_html( wpmtst_form_field_meta_l10n( $field['label'], $field, 'label' ) )
78
- );
79
 
80
  if ( isset( $field['required'] ) && $field['required'] ) {
81
  wpmtst_field_required_symbol();
82
  }
83
  }
84
- wpmtst_field_before( $field );
85
 
86
  }
87
 
88
  // Check for callback first.
89
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
90
-
91
- $value = ( isset( $form_values[ $field['name'] ] ) && $form_values[ $field['name'] ] ) ? $form_values[ $field['name'] ] : '';
92
- do_action( $field['action_input'], $field, $value );
93
-
94
- } else {
95
-
96
- // Check field type.
97
- switch ( $field['input_type'] ) {
98
-
99
- case 'category-selector':
100
- $value = isset( $form_values[ $field['name'] ] ) ? (array) $form_values[ $field['name'] ] : array();
101
-
102
- echo '<div class="field-wrap">';
103
- printf(
104
- '<select id="wpmtst_%s" name="%s" class="%s" %s tabindex="0">',
105
- esc_attr( $field['name'] ),
106
- esc_attr( $field['name'] ),
107
- esc_attr( wpmtst_field_classes( $field['input_type'], $field['name'] ) ),
108
- esc_attr( wpmtst_field_required_tag( $field ) )
109
- );
110
-
111
- echo '<option value="">&mdash;</option>';
112
- wpmtst_nested_cats( $value );
113
- echo '</select>';
114
- echo '</div>';
115
- break;
116
-
117
- case 'category-checklist':
118
- $value = isset( $form_values[ $field['name'] ] ) ? (array) $form_values[ $field['name'] ] : array();
119
- echo '<div class="field-wrap">';
120
- wpmtst_form_category_checklist_frontend( $value );
121
- echo '</div>';
122
- break;
123
-
124
- case 'textarea':
125
- $value = ( isset( $form_values[ $field['name'] ] ) && $form_values[ $field['name'] ] ) ? $form_values[ $field['name'] ] : '';
126
- // textarea tags must be on same line for placeholder to work
127
- printf(
128
- '<textarea id="wpmtst_%s" name="%s" class="%s" %s placeholder="%s" tabindex="0">%s</textarea>',
129
- esc_attr( $field['name'] ),
130
- esc_attr( $field['name'] ),
131
- esc_attr( wpmtst_field_classes( $field['input_type'], $field['name'] ) ),
132
- esc_attr( wpmtst_field_required_tag( $field ) ),
133
- esc_attr( wpmtst_field_placeholder( $field ) ),
134
- esc_textarea( $value )
135
- );
136
- break;
137
-
138
- case 'file':
139
- echo '<div class="field-wrap">';
140
- echo '<input id="wpmtst_' . esc_attr( $field['name'] ) . '" type="file" name="' . esc_attr( $field['name'] ) . '"' . esc_attr( wpmtst_field_required_tag( $field ) ) . ' tabindex="0">';
141
- echo '</div>';
142
- break;
143
-
144
- case 'shortcode':
145
- if ( isset( $field['shortcode_on_form'] ) && $field['shortcode_on_form'] ) {
146
- echo do_shortcode( $field['shortcode_on_form'], true );
147
- }
148
- break;
149
-
150
- case 'rating':
151
- wpmtst_star_rating_form( $field, $field['default_form_value'], 'in-form' );
152
- break;
153
-
154
- case 'checkbox':
155
- if ( ! isset( $field['show_label'] ) || $field['show_label'] ) {
156
- printf(
157
- '<label for="wpmtst_%s" class="%s">%s</label>',
158
- esc_attr( $field['name'] ),
159
- esc_attr( wpmtst_field_label_classes( $field['input_type'], $field['name'] ) ),
160
- esc_html( wpmtst_form_field_meta_l10n( $field['label'], $field, 'label' ) )
161
- );
162
- }
163
-
164
- wpmtst_field_before( $field );
165
-
166
- echo '<div class="field-wrap">';
167
-
168
- printf(
169
- '<input id="wpmtst_%s" type="%s" class="%s" name="%s" %s %s tabindex="0">',
170
- esc_attr( $field['name'] ),
171
- esc_attr( $field['input_type'] ),
172
- esc_attr( wpmtst_field_classes( $field['input_type'], $field['name'] ) ),
173
- esc_attr( $field['name'] ),
174
- esc_attr( wpmtst_field_required_tag( $field ) ),
175
- checked( $field['default_form_value'], 1, false )
176
- );
177
-
178
- if ( isset( $field['text'] ) ) {
179
- echo '<label for="wpmtst_' . esc_attr( $field['name'] ) . '" class="checkbox-label">' . esc_html( wpmtst_form_field_meta_l10n( $field['text'], $field, 'text' ) ) . '</label>';
180
 
181
  if ( isset( $field['required'] ) && $field['required'] ) {
182
  wpmtst_field_required_symbol();
183
  }
184
- }
185
-
186
- echo '</div>';
187
- break;
188
-
189
- default: // text, email, url
190
- printf(
191
- '<input id="wpmtst_%s" type="%s" class="%s" name="%s" value="%s" placeholder="%s" %s tabindex="0">',
192
- esc_attr( $field['name'] ),
193
- esc_attr( $field['input_type'] ),
194
- esc_attr( wpmtst_field_classes( $field['input_type'], $field['name'] ) ),
195
- esc_attr( $field['name'] ),
196
- esc_attr( wpmtst_field_value( $field, $form_values ) ),
197
- esc_attr( wpmtst_field_placeholder( $field ) ),
198
- esc_attr( wpmtst_field_required_tag( $field ) )
199
- );
200
 
201
- }
202
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  wpmtst_field_after( $field );
205
  wpmtst_field_error( $field );
@@ -255,10 +245,10 @@ function wpmtst_field_label_classes( $type, $name ) {
255
  * @return string
256
  */
257
  function wpmtst_field_classes( $type = null, $name = null ) {
258
- $errors = WPMST()->form->get_form_errors();
259
  $class_list = array();
260
 
261
- switch ( $type ) {
262
  case 'email':
263
  $class_list[] = 'text';
264
  $class_list[] = 'email';
@@ -300,7 +290,8 @@ function wpmtst_field_value( $field, $form_values ) {
300
  }
301
 
302
  $value = apply_filters( 'wpmtst_field_value', $value, $field, $form_values );
303
- return $value;
 
304
  }
305
 
306
  /**
@@ -312,7 +303,7 @@ function wpmtst_field_value( $field, $form_values ) {
312
  */
313
  function wpmtst_field_placeholder( $field ) {
314
  if ( isset( $field['placeholder'] ) && $field['placeholder'] ) {
315
- return esc_attr( wpmtst_form_field_meta_l10n( $field['placeholder'], $field, 'placeholder' ) );
316
  }
317
 
318
  return '';
@@ -345,21 +336,21 @@ function wpmtst_field_required_notice() {
345
  if ( isset( $notice['enabled'] ) && $notice['enabled'] ) {
346
  ob_start();
347
  ?>
348
- <p class="required-notice">
349
  <?php wpmtst_field_required_symbol(); ?><?php wpmtst_form_message( 'required-field' ); ?>
350
- </p>
351
  <?php
352
  $html = ob_get_clean();
353
  }
354
  // Echo even if disabled to allow a custom notice.
355
- echo wp_kses_post( apply_filters( 'wpmtst_field_required', $html ) );
356
  }
357
 
358
  /**
359
  * Print required field symbol.
360
  */
361
  function wpmtst_field_required_symbol() {
362
- echo wp_kses_post( apply_filters( 'wpmtst_field_required_symbol', '<span class="required symbol"></span>' ) );
363
  }
364
 
365
  /**
@@ -368,10 +359,10 @@ function wpmtst_field_required_symbol() {
368
  * @param $field
369
  */
370
  function wpmtst_field_before( $field ) {
371
- $before = wpmtst_get_form_field_meta( $field, 'before' );
372
- if ( $before ) {
373
- echo '<span class="before">' . wp_kses_post( $before ) . '</span>';
374
- }
375
  }
376
 
377
  /**
@@ -380,8 +371,8 @@ function wpmtst_field_before( $field ) {
380
  * @param $field
381
  */
382
  function wpmtst_field_after( $field ) {
383
- $after = wpmtst_get_form_field_meta( $field, 'after' );
384
- echo '<span class="after">' . wp_kses_post( $after ) . '</span>';
385
  }
386
 
387
  /**
@@ -393,11 +384,11 @@ function wpmtst_field_after( $field ) {
393
  * @return mixed|string
394
  */
395
  function wpmtst_get_form_field_meta( $field, $meta ) {
396
- if ( isset( $field[ $meta ] ) && $field[ $meta ] ) {
397
- return apply_filters( 'wpmtst_form_field_meta', $field[ $meta ], $field, $meta );
398
- }
399
 
400
- return '';
401
  }
402
 
403
  /**
@@ -464,33 +455,33 @@ function wpmtst_form_captcha() {
464
  /**
465
  * To display or not to display.
466
  */
467
- if ( $invisible && 'captcha-pro' == $form_options['captcha'] ) {
468
 
469
- echo '<div class="form-field wpmtst-captcha">';
470
- echo wp_kses_post( $captcha_html );
471
- echo '</div>';
472
 
473
- } elseif ( $invisible ) {
474
 
475
- echo wp_kses_post( $captcha_html );
476
 
477
- } else {
478
 
479
- ?>
480
- <div class="form-field wpmtst-captcha">
481
  <?php if ( wpmtst_get_form_message( 'captcha' ) ) : ?>
482
- <label for="wpmtst_captcha"><?php wpmtst_form_message( 'captcha' ); ?></label><span class="required symbol"></span>
483
  <?php endif; ?>
484
- <div>
485
- <?php echo wp_kses_post( $captcha_html ); ?>
486
- <?php if ( isset( $errors['captcha'] ) ) : ?>
487
- <p><label class="error"><?php echo esc_html( $errors['captcha'] ); ?></label></p>
488
- <?php endif; ?>
489
- </div>
490
- </div>
491
- <?php
492
-
493
- }
494
  }
495
  add_action( 'wpmtst_form_after_fields', 'wpmtst_form_captcha' );
496
 
@@ -536,7 +527,7 @@ function wpmtst_form_captcha_invisible() {
536
  function wpmtst_form_submit_button( $preview = false ) {
537
  ?>
538
  <div class="form-field wpmtst-submit">
539
- <label><input type="<?php echo $preview ? 'button' : 'submit'; ?>" id="wpmtst_submit_testimonial" name="wpmtst_submit_testimonial" value="<?php echo esc_attr( wpmtst_get_form_message( 'form-submit-button' ) ); ?>" class="<?php echo esc_attr( apply_filters( 'wpmtst_submit_button_class', 'button' ) ); ?>" tabindex="0"></label>
540
  </div>
541
  <?php
542
  }
@@ -549,17 +540,15 @@ function wpmtst_form_submit_button( $preview = false ) {
549
  */
550
  function wpmtst_form_category_checklist_frontend( $default_cats = array() ) {
551
  ?>
552
- <div class="strong-category-list-panel">
553
- <ul class="strong-category-list">
554
- <?php
555
- $args = array(
556
  'selected_cats' => $default_cats,
557
  'checked_ontop' => false,
558
- );
559
- ?>
560
  <?php wpmtst_terms_checklist( $args ); ?>
561
- </ul>
562
- </div>
563
  <?php
564
  }
565
 
@@ -605,12 +594,12 @@ function wpmtst_terms_checklist( $args = array() ) {
605
  $r = wp_parse_args( $params, $defaults );
606
 
607
  if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {
608
- $walker = new Walker_Strong_Category_Checklist_Front();
609
  } else {
610
  $walker = $r['walker'];
611
  }
612
 
613
- $taxonomy = $r['taxonomy'];
614
  $descendants_and_self = (int) $r['descendants_and_self'];
615
 
616
  $args = array( 'taxonomy' => $taxonomy );
@@ -624,30 +613,24 @@ function wpmtst_terms_checklist( $args = array() ) {
624
  if ( is_array( $r['popular_cats'] ) ) {
625
  $args['popular_cats'] = $r['popular_cats'];
626
  } else {
627
- $args['popular_cats'] = get_terms(
628
- $taxonomy,
629
- array(
630
- 'fields' => 'ids',
631
- 'orderby' => 'count',
632
- 'order' => 'DESC',
633
- 'number' => 10,
634
- 'hierarchical' => false,
635
- )
636
- );
637
  }
638
 
639
  // Select a _single_ sibling and its descendants.
640
  // Assembling a list of _multiple_ siblings would go here.
641
  if ( $descendants_and_self ) {
642
- $categories = (array) get_terms(
643
- $taxonomy,
644
- array(
645
- 'child_of' => $descendants_and_self,
646
- 'hierarchical' => 0,
647
- 'hide_empty' => 0,
648
- )
649
- );
650
- $self = get_term( $descendants_and_self, $taxonomy );
651
  array_unshift( $categories, $self );
652
  } else {
653
  $categories = (array) get_terms( $taxonomy, array( 'get' => 'all' ) );
@@ -657,14 +640,14 @@ function wpmtst_terms_checklist( $args = array() ) {
657
 
658
  if ( $r['checked_ontop'] ) {
659
  // Post-process $categories rather than adding an exclude to the get_terms() query
660
- // to keep the query the same across all posts (for any query cache)
661
  $checked_categories = array();
662
- $keys = array_keys( $categories );
663
 
664
  foreach ( $keys as $k ) {
665
- if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) {
666
- $checked_categories[] = $categories[ $k ];
667
- unset( $categories[ $k ] );
668
  }
669
  }
670
 
@@ -675,7 +658,7 @@ function wpmtst_terms_checklist( $args = array() ) {
675
  $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
676
 
677
  if ( $r['echo'] ) {
678
- echo wp_kses_post( $output );
679
  }
680
 
681
  return $output;
9
 
10
  function wpmtst_form_setup() {
11
  $form_values = WPMST()->form->get_form_values();
12
+ $cats = (array) $form_values['category'];
13
 
14
  echo '<div style="display: none;">';
15
  wp_nonce_field( 'wpmtst_form_action', 'wpmtst_form_nonce', true, true );
16
  echo '<input type="hidden" name="action" value="wpmtst_form">';
17
+ echo '<input type="hidden" name="form_id" value="'. WPMST()->atts( 'form_id' ) .'">';
18
+ echo '<input type="hidden" name="default_category" value="'. WPMST()->atts( 'category' ) .'">';
19
+ echo '<input type="hidden" name="category" value="'. implode( ',', $cats ) .'">';
20
  echo '</div>';
21
  }
22
 
23
  function wpmtst_form_message( $part ) {
24
+ echo wpmtst_get_form_message( $part );
25
  }
26
 
27
  function wpmtst_get_form_message( $part ) {
28
  $form_options = get_option( 'wpmtst_form_options' );
29
+ $messages = $form_options['messages'];
30
+ if ( isset( $messages[$part]['text'] ) ) {
31
+ return apply_filters( 'wpmtst_form_message', $messages[ $part ]['text'], $messages[ $part ] );
32
  }
33
 
34
  return '';
65
  function wpmtst_single_form_field( $field ) {
66
  $form_values = WPMST()->form->get_form_values();
67
 
68
+ echo '<div class="' . wpmtst_field_group_classes( $field['input_type'], $field['name'] ) . '">';
69
 
70
  if ( 'checkbox' != $field['input_type'] ) {
71
 
72
  if ( ! isset( $field['show_label'] ) || $field['show_label'] ) {
73
+ printf( '<label for="wpmtst_%s" class="%s">%s</label>',
74
+ $field['name'],
75
+ wpmtst_field_label_classes( $field['input_type'], $field['name'] ),
76
+ wpmtst_form_field_meta_l10n( $field['label'], $field, 'label' ) );
 
 
77
 
78
  if ( isset( $field['required'] ) && $field['required'] ) {
79
  wpmtst_field_required_symbol();
80
  }
81
  }
82
+ wpmtst_field_before( $field );
83
 
84
  }
85
 
86
  // Check for callback first.
87
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
88
+
89
+ $value = ( isset( $form_values[ $field['name'] ] ) && $form_values[ $field['name'] ] ) ? $form_values[ $field['name'] ] : '';
90
+ do_action( $field['action_input'], $field, $value );
91
+
92
+ } else {
93
+
94
+ // Check field type.
95
+ switch ( $field['input_type'] ) {
96
+
97
+ case 'category-selector' :
98
+ $value = isset( $form_values[ $field['name'] ] ) ? (array) $form_values[ $field['name'] ] : array();
99
+
100
+ echo '<div class="field-wrap">';
101
+ printf( '<select id="wpmtst_%s" name="%s" class="%s" %s tabindex="0">',
102
+ $field['name'],
103
+ $field['name'],
104
+ wpmtst_field_classes( $field['input_type'], $field['name'] ),
105
+ wpmtst_field_required_tag( $field ) );
106
+
107
+ echo '<option value="">&mdash;</option>';
108
+ wpmtst_nested_cats( $value );
109
+ echo '</select>';
110
+ echo '</div>';
111
+ break;
112
+
113
+ case 'category-checklist' :
114
+ $value = isset( $form_values[ $field['name'] ] ) ? (array) $form_values[ $field['name'] ] : array();
115
+ echo '<div class="field-wrap">';
116
+ wpmtst_form_category_checklist_frontend( $value );
117
+ echo '</div>';
118
+ break;
119
+
120
+ case 'textarea' :
121
+ $value = ( isset( $form_values[ $field['name'] ] ) && $form_values[ $field['name'] ] ) ? $form_values[ $field['name'] ] : '';
122
+
123
+ // textarea tags must be on same line for placeholder to work
124
+ printf( '<textarea id="wpmtst_%s" name="%s" class="%s" %s %s tabindex="0">%s</textarea>',
125
+ $field['name'],
126
+ $field['name'],
127
+ wpmtst_field_classes( $field['input_type'], $field['name'] ),
128
+ wpmtst_field_required_tag( $field ),
129
+ wpmtst_field_placeholder( $field ),
130
+ esc_textarea( $value ) );
131
+ break;
132
+
133
+ case 'file' :
134
+ echo '<div class="field-wrap">';
135
+ echo '<input id="wpmtst_' . $field['name'] . '" type="file" name="' . $field['name'] . '"' . wpmtst_field_required_tag( $field ) . ' tabindex="0">';
136
+ echo '</div>';
137
+ break;
138
+
139
+ case 'shortcode' :
140
+ if ( isset( $field['shortcode_on_form'] ) && $field['shortcode_on_form'] ) {
141
+ echo do_shortcode( $field['shortcode_on_form'], true );
142
+ }
143
+ break;
144
+
145
+ case 'rating' :
146
+ wpmtst_star_rating_form( $field, $field['default_form_value'], 'in-form' );
147
+ break;
148
+
149
+ case 'checkbox' :
150
+ if ( ! isset( $field['show_label'] ) || $field['show_label'] ) {
151
+ printf( '<label for="wpmtst_%s" class="%s">%s</label>',
152
+ $field['name'],
153
+ wpmtst_field_label_classes($field['input_type'], $field['name']),
154
+ wpmtst_form_field_meta_l10n( $field['label'], $field, 'label' ) );
155
+ }
156
+
157
+ wpmtst_field_before( $field );
158
+
159
+ echo '<div class="field-wrap">';
160
+
161
+ printf( '<input id="wpmtst_%s" type="%s" class="%s" name="%s" %s %s tabindex="0">',
162
+ $field['name'],
163
+ $field['input_type'],
164
+ wpmtst_field_classes( $field['input_type'], $field['name'] ),
165
+ $field['name'],
166
+ wpmtst_field_required_tag( $field ),
167
+ checked( $field['default_form_value'], 1, false ) );
168
+
169
+ if ( isset( $field['text'] ) ) {
170
+ echo '<label for="wpmtst_' . $field['name'] . '" class="checkbox-label">' . wpmtst_form_field_meta_l10n( $field['text'], $field, 'text' ) . '</label>';
 
 
 
 
 
 
 
171
 
172
  if ( isset( $field['required'] ) && $field['required'] ) {
173
  wpmtst_field_required_symbol();
174
  }
175
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
+ echo '</div>';
178
+ break;
179
+
180
+ default: // text, email, url
181
+ printf( '<input id="wpmtst_%s" type="%s" class="%s" name="%s" %s %s %s tabindex="0">',
182
+ $field['name'],
183
+ $field['input_type'],
184
+ wpmtst_field_classes( $field['input_type'], $field['name'] ),
185
+ $field['name'],
186
+ wpmtst_field_value( $field, $form_values ),
187
+ wpmtst_field_placeholder( $field ),
188
+ wpmtst_field_required_tag( $field ) );
189
+
190
+ }
191
+
192
+ }
193
 
194
  wpmtst_field_after( $field );
195
  wpmtst_field_error( $field );
245
  * @return string
246
  */
247
  function wpmtst_field_classes( $type = null, $name = null ) {
248
+ $errors = WPMST()->form->get_form_errors();
249
  $class_list = array();
250
 
251
+ switch( $type ) {
252
  case 'email':
253
  $class_list[] = 'text';
254
  $class_list[] = 'email';
290
  }
291
 
292
  $value = apply_filters( 'wpmtst_field_value', $value, $field, $form_values );
293
+
294
+ return ' value="' . esc_attr( $value ) . '"';
295
  }
296
 
297
  /**
303
  */
304
  function wpmtst_field_placeholder( $field ) {
305
  if ( isset( $field['placeholder'] ) && $field['placeholder'] ) {
306
+ return ' placeholder="' . esc_attr( wpmtst_form_field_meta_l10n( $field['placeholder'], $field, 'placeholder' ) ) . '"';
307
  }
308
 
309
  return '';
336
  if ( isset( $notice['enabled'] ) && $notice['enabled'] ) {
337
  ob_start();
338
  ?>
339
+ <p class="required-notice">
340
  <?php wpmtst_field_required_symbol(); ?><?php wpmtst_form_message( 'required-field' ); ?>
341
+ </p>
342
  <?php
343
  $html = ob_get_clean();
344
  }
345
  // Echo even if disabled to allow a custom notice.
346
+ echo( apply_filters( 'wpmtst_field_required', $html ) );
347
  }
348
 
349
  /**
350
  * Print required field symbol.
351
  */
352
  function wpmtst_field_required_symbol() {
353
+ echo apply_filters( 'wpmtst_field_required_symbol', '<span class="required symbol"></span>' );
354
  }
355
 
356
  /**
359
  * @param $field
360
  */
361
  function wpmtst_field_before( $field ) {
362
+ $before = wpmtst_get_form_field_meta( $field, 'before' );
363
+ if ( $before ) {
364
+ echo '<span class="before">' . $before . '</span>';
365
+ }
366
  }
367
 
368
  /**
371
  * @param $field
372
  */
373
  function wpmtst_field_after( $field ) {
374
+ $after = wpmtst_get_form_field_meta( $field, 'after' );
375
+ echo '<span class="after">' . $after . '</span>';
376
  }
377
 
378
  /**
384
  * @return mixed|string
385
  */
386
  function wpmtst_get_form_field_meta( $field, $meta ) {
387
+ if ( isset( $field[ $meta ] ) && $field[ $meta ] ) {
388
+ return apply_filters( 'wpmtst_form_field_meta', $field[ $meta ], $field, $meta );
389
+ }
390
 
391
+ return '';
392
  }
393
 
394
  /**
455
  /**
456
  * To display or not to display.
457
  */
458
+ if ( $invisible && 'captcha-pro' == $form_options['captcha']) {
459
 
460
+ echo '<div class="form-field wpmtst-captcha">';
461
+ echo $captcha_html;
462
+ echo '</div>';
463
 
464
+ } elseif ( $invisible ) {
465
 
466
+ echo $captcha_html;
467
 
468
+ } else {
469
 
470
+ ?>
471
+ <div class="form-field wpmtst-captcha">
472
  <?php if ( wpmtst_get_form_message( 'captcha' ) ) : ?>
473
+ <label for="wpmtst_captcha"><?php wpmtst_form_message( 'captcha' ); ?></label><span class="required symbol"></span>
474
  <?php endif; ?>
475
+ <div>
476
+ <?php echo $captcha_html; ?>
477
+ <?php if ( isset( $errors['captcha'] ) ) : ?>
478
+ <p><label class="error"><?php echo esc_html( $errors['captcha'] ); ?></label></p>
479
+ <?php endif; ?>
480
+ </div>
481
+ </div>
482
+ <?php
483
+
484
+ }
485
  }
486
  add_action( 'wpmtst_form_after_fields', 'wpmtst_form_captcha' );
487
 
527
  function wpmtst_form_submit_button( $preview = false ) {
528
  ?>
529
  <div class="form-field wpmtst-submit">
530
+ <label><input type="<?php echo $preview ? 'button' : 'submit'; ?>" id="wpmtst_submit_testimonial" name="wpmtst_submit_testimonial" value="<?php esc_attr_e( wpmtst_get_form_message( 'form-submit-button' ) ); ?>" class="<?php echo esc_attr( apply_filters( 'wpmtst_submit_button_class', 'button' ) ); ?>" tabindex="0"></label>
531
  </div>
532
  <?php
533
  }
540
  */
541
  function wpmtst_form_category_checklist_frontend( $default_cats = array() ) {
542
  ?>
543
+ <div class="strong-category-list-panel">
544
+ <ul class="strong-category-list">
545
+ <?php $args = array(
 
546
  'selected_cats' => $default_cats,
547
  'checked_ontop' => false,
548
+ ); ?>
 
549
  <?php wpmtst_terms_checklist( $args ); ?>
550
+ </ul>
551
+ </div>
552
  <?php
553
  }
554
 
594
  $r = wp_parse_args( $params, $defaults );
595
 
596
  if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {
597
+ $walker = new Walker_Strong_Category_Checklist_Front;
598
  } else {
599
  $walker = $r['walker'];
600
  }
601
 
602
+ $taxonomy = $r['taxonomy'];
603
  $descendants_and_self = (int) $r['descendants_and_self'];
604
 
605
  $args = array( 'taxonomy' => $taxonomy );
613
  if ( is_array( $r['popular_cats'] ) ) {
614
  $args['popular_cats'] = $r['popular_cats'];
615
  } else {
616
+ $args['popular_cats'] = get_terms( $taxonomy, array(
617
+ 'fields' => 'ids',
618
+ 'orderby' => 'count',
619
+ 'order' => 'DESC',
620
+ 'number' => 10,
621
+ 'hierarchical' => false,
622
+ ) );
 
 
 
623
  }
624
 
625
  // Select a _single_ sibling and its descendants.
626
  // Assembling a list of _multiple_ siblings would go here.
627
  if ( $descendants_and_self ) {
628
+ $categories = (array) get_terms( $taxonomy, array(
629
+ 'child_of' => $descendants_and_self,
630
+ 'hierarchical' => 0,
631
+ 'hide_empty' => 0,
632
+ ) );
633
+ $self = get_term( $descendants_and_self, $taxonomy );
 
 
 
634
  array_unshift( $categories, $self );
635
  } else {
636
  $categories = (array) get_terms( $taxonomy, array( 'get' => 'all' ) );
640
 
641
  if ( $r['checked_ontop'] ) {
642
  // Post-process $categories rather than adding an exclude to the get_terms() query
643
+ // to keep the query the same across all posts (for any query cache)
644
  $checked_categories = array();
645
+ $keys = array_keys( $categories );
646
 
647
  foreach ( $keys as $k ) {
648
+ if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
649
+ $checked_categories[] = $categories[$k];
650
+ unset( $categories[$k] );
651
  }
652
  }
653
 
658
  $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
659
 
660
  if ( $r['echo'] ) {
661
+ echo $output;
662
  }
663
 
664
  return $output;
includes/functions-template.php CHANGED
@@ -20,7 +20,7 @@ function strong_testimonials_view( $id = null ) {
20
  $atts = array( 'id' => $id );
21
  $out = WPMST()->render->parse_view( $out, $pairs, $atts );
22
 
23
- echo wp_kses_post( WPMST()->shortcode->render_view( $out ) );
24
  }
25
 
26
  /**
@@ -38,7 +38,7 @@ function wpmtst_the_title( $before = '', $after = '' ) {
38
 
39
  if ( WPMST()->atts( 'title_link' ) ) {
40
  $before .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
41
- $after = '</a>' . $after;
42
  }
43
 
44
  the_title( $before, $after );
@@ -72,7 +72,7 @@ function wpmtst_the_content() {
72
  */
73
  do_action( 'wpmtst_before_content_filters' );
74
 
75
- echo wp_kses_post( apply_filters( 'wpmtst_get_the_content', '' ) );
76
 
77
  /**
78
  * Restore content filters that were removed.
@@ -88,7 +88,7 @@ function wpmtst_the_content() {
88
  * @since 2.33.0
89
  */
90
  function wpmtst_the_excerpt() {
91
- echo wp_kses_post( wpmtst_the_excerpt_filtered() );
92
  }
93
 
94
  /**
@@ -141,8 +141,9 @@ function wpmtst_read_more_page() {
141
  $classname = 'readmore-page';
142
  }
143
  $classname = apply_filters( 'wpmtst_read_more_page_class', $classname );
144
- echo wp_kses_post( apply_filters( 'wpmtst_read_more_page_output', sprintf( '<div class="%s"><a href="%s">%s</a></div>', $classname, esc_url( $permalink ), $link_text ) ) );
145
  }
 
146
  }
147
  }
148
 
@@ -157,12 +158,8 @@ function wpmtst_read_more_page() {
157
  * @return string
158
  */
159
  function wpmtst_read_more_page_link_text_l10n( $text, $atts ) {
160
- return apply_filters(
161
- 'wpmtst_l10n',
162
- $text,
163
- 'strong-testimonials-read-more',
164
- sprintf( 'View %s : Read more (page or post)', $atts['view'] )
165
- );
166
 
167
  }
168
  add_filter( 'wpmtst_read_more_page_link_text', 'wpmtst_read_more_page_link_text_l10n', 10, 2 );
@@ -178,12 +175,8 @@ add_filter( 'wpmtst_read_more_page_link_text', 'wpmtst_read_more_page_link_text_
178
  * @return string
179
  */
180
  function wpmtst_read_more_post_link_text_l10n( $text, $atts ) {
181
- return apply_filters(
182
- 'wpmtst_l10n',
183
- $text,
184
- 'strong-testimonials-read-more',
185
- sprintf( 'View %s : Read more (testimonial)', $atts['view'] )
186
- );
187
 
188
  }
189
  add_filter( 'wpmtst_read_more_post_link_text', 'wpmtst_read_more_post_link_text_l10n', 10, 2 );
@@ -240,7 +233,7 @@ function wpmtst_the_thumbnail( $size = null, $before = '<div class="testimonial-
240
 
241
  $img = wpmtst_get_thumbnail( $size );
242
  if ( $img ) {
243
- echo wp_kses_post( $before . $img . $after );
244
  }
245
  }
246
 
@@ -261,7 +254,7 @@ function wpmtst_the_date( $format = '', $class = '' ) {
261
  }
262
 
263
  $the_date = apply_filters( 'wpmtst_the_date', mysql2date( $format, $post->post_date ), $format, $post );
264
- echo '<div class="' . esc_attr( $class ) . '">' . wp_kses_post( $the_date ) . '</div>';
265
  }
266
 
267
  /**
@@ -272,7 +265,7 @@ function wpmtst_the_date( $format = '', $class = '' ) {
272
  function wpmtst_the_client() {
273
  $atts = WPMST()->atts();
274
  if ( isset( $atts['client_section'] ) ) {
275
- echo wp_kses_post( wpmtst_client_section( $atts['client_section'] ) );
276
  }
277
  }
278
 
@@ -293,11 +286,12 @@ function wpmtst_client_section( $client_section ) {
293
  $html = '';
294
 
295
  foreach ( $client_section as $field ) {
296
- $output = '';
297
- $field_name = $field['field'];
298
  if ( isset( $custom_fields[ $field_name ] ) ) {
299
  $field['prop'] = $custom_fields[ $field_name ];
300
- } else {
 
301
  $field['prop'] = array();
302
  }
303
 
@@ -311,8 +305,8 @@ function wpmtst_client_section( $client_section ) {
311
  else {
312
  switch ( $field['type'] ) {
313
 
314
- case 'link':
315
- case 'link2':
316
  // use default if missing
317
  if ( ! isset( $field['link_text'] ) ) {
318
  $field['link_text'] = 'value';
@@ -324,15 +318,15 @@ function wpmtst_client_section( $client_section ) {
324
  * but don't display 'LinkedIn' if no URL given.
325
  */
326
  switch ( $field['link_text'] ) {
327
- case 'custom':
328
  $text = $field['link_text_custom'];
329
  $output = '';
330
  break;
331
- case 'label':
332
  $text = $field['prop']['field_label'];
333
  $output = '';
334
  break;
335
- default: // value
336
  $text = get_post_meta( $post->ID, $field_name, true );
337
  // if no URL (next condition), show the alternate (the field)
338
  $output = $text;
@@ -344,7 +338,8 @@ function wpmtst_client_section( $client_section ) {
344
  if ( $url ) {
345
  if ( isset( $field['new_tab'] ) && $field['new_tab'] ) {
346
  $newtab = ' target="_blank"';
347
- } else {
 
348
  $newtab = '';
349
  }
350
 
@@ -356,7 +351,8 @@ function wpmtst_client_section( $client_section ) {
356
  }
357
  if ( 'yes' == $is_nofollow ) {
358
  $nofollow = ' rel="nofollow"';
359
- } else {
 
360
  $nofollow = '';
361
  }
362
 
@@ -367,10 +363,11 @@ function wpmtst_client_section( $client_section ) {
367
 
368
  $output = sprintf( '<a href="%s"%s%s>%s</a>', $url, $newtab, $nofollow, $text );
369
  }
 
370
  }
371
  break;
372
 
373
- case 'date':
374
  $format = isset( $field['format'] ) && $field['format'] ? $field['format'] : get_option( 'date_format' );
375
 
376
  // Fall back to post_date if submit_date missing.
@@ -391,26 +388,27 @@ function wpmtst_client_section( $client_section ) {
391
  $output = apply_filters( 'wpmtst_the_date', $the_date, $format, $post );
392
  break;
393
 
394
- case 'category':
395
  $categories = get_the_terms( $post->ID, 'wpm-testimonial-category' );
396
  if ( $categories && ! is_wp_error( $categories ) ) {
397
  $list = array();
398
  foreach ( $categories as $cat ) {
399
  $list[] = $cat->name;
400
  }
401
- $output = join( ', ', $list );
402
- } else {
 
403
  $output = '';
404
  }
405
  break;
406
 
407
- case 'shortcode':
408
  if ( isset( $field['prop']['shortcode_on_display'] ) && $field['prop']['shortcode_on_display'] ) {
409
  $output = do_shortcode( $field['prop']['shortcode_on_display'] );
410
  }
411
  break;
412
 
413
- case 'rating':
414
  $output = get_post_meta( $post->ID, $field_name, true );
415
  // Check default value
416
  if ( '' == $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
@@ -422,12 +420,13 @@ function wpmtst_client_section( $client_section ) {
422
  }
423
  break;
424
 
425
- default:
426
  // text field
427
  $output = get_post_meta( $post->ID, $field_name, true );
428
  if ( '' == $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
429
  $output = $field['prop']['default_display_value'];
430
  }
 
431
  }
432
  }
433
 
@@ -443,7 +442,7 @@ function wpmtst_client_section( $client_section ) {
443
  }
444
 
445
  function wpmtst_container_class() {
446
- echo wp_kses_post( apply_filters( 'wpmtst_container_class', WPMST()->atts( 'container_class' ) ) );
447
  }
448
 
449
  function wpmtst_container_data() {
@@ -453,16 +452,16 @@ function wpmtst_container_data() {
453
  foreach ( $data_array as $attr => $value ) {
454
  $data .= " data-$attr=$value";
455
  }
456
- echo esc_attr( $data );
457
  }
458
  }
459
 
460
  function wpmtst_content_class() {
461
- echo wp_kses_post( apply_filters( 'wpmtst_content_class', WPMST()->atts( 'content_class' ) ) );
462
  }
463
 
464
  function wpmtst_post_class( $args = null ) {
465
- echo wp_kses_post( apply_filters( 'wpmtst_post_class', WPMST()->atts( 'post_class' ) . ' post-' . get_the_ID(), $args ) );
466
  }
467
 
468
  /**
@@ -474,7 +473,7 @@ function wpmtst_post_class( $args = null ) {
474
  * @param array $args
475
  */
476
  function wpmtst_field( $field = null, $args = array() ) {
477
- echo wp_kses_post( wpmtst_get_field( $field, $args ) );
478
  }
479
 
480
  /**
@@ -501,12 +500,12 @@ function wpmtst_get_field( $field, $args = array() ) {
501
  switch ( $field ) {
502
 
503
  // Apply a character limit to post content.
504
- case 'truncated':
505
  $html = wpmtst_truncate( $post->post_content, $args['char_limit'] );
506
  break;
507
 
508
  // Get the custom field.
509
- default:
510
  $html = get_post_meta( $post->ID, $field, true );
511
 
512
  }
@@ -546,8 +545,8 @@ if ( ! function_exists( 'wpmtst_standard_pagination' ) ) :
546
  if ( $paginate_links ) {
547
  echo "<nav class='nav-links'>";
548
  //echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
549
- echo wp_kses_post( $paginate_links );
550
- echo '</nav>';
551
  }
552
  }
553
  endif;
20
  $atts = array( 'id' => $id );
21
  $out = WPMST()->render->parse_view( $out, $pairs, $atts );
22
 
23
+ echo WPMST()->shortcode->render_view( $out );
24
  }
25
 
26
  /**
38
 
39
  if ( WPMST()->atts( 'title_link' ) ) {
40
  $before .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
41
+ $after = '</a>' . $after;
42
  }
43
 
44
  the_title( $before, $after );
72
  */
73
  do_action( 'wpmtst_before_content_filters' );
74
 
75
+ echo apply_filters( 'wpmtst_get_the_content', '' );
76
 
77
  /**
78
  * Restore content filters that were removed.
88
  * @since 2.33.0
89
  */
90
  function wpmtst_the_excerpt() {
91
+ echo wpmtst_the_excerpt_filtered();
92
  }
93
 
94
  /**
141
  $classname = 'readmore-page';
142
  }
143
  $classname = apply_filters( 'wpmtst_read_more_page_class', $classname );
144
+ echo apply_filters('wpmtst_read_more_page_output', sprintf( '<div class="%s"><a href="%s">%s</a></div>', $classname, esc_url( $permalink ), $link_text ));
145
  }
146
+
147
  }
148
  }
149
 
158
  * @return string
159
  */
160
  function wpmtst_read_more_page_link_text_l10n( $text, $atts ) {
161
+ return apply_filters( 'wpmtst_l10n', $text, 'strong-testimonials-read-more',
162
+ sprintf( 'View %s : Read more (page or post)', $atts['view'] ) );
 
 
 
 
163
 
164
  }
165
  add_filter( 'wpmtst_read_more_page_link_text', 'wpmtst_read_more_page_link_text_l10n', 10, 2 );
175
  * @return string
176
  */
177
  function wpmtst_read_more_post_link_text_l10n( $text, $atts ) {
178
+ return apply_filters( 'wpmtst_l10n', $text, 'strong-testimonials-read-more',
179
+ sprintf( 'View %s : Read more (testimonial)', $atts['view'] ) );
 
 
 
 
180
 
181
  }
182
  add_filter( 'wpmtst_read_more_post_link_text', 'wpmtst_read_more_post_link_text_l10n', 10, 2 );
233
 
234
  $img = wpmtst_get_thumbnail( $size );
235
  if ( $img ) {
236
+ echo $before . $img . $after;
237
  }
238
  }
239
 
254
  }
255
 
256
  $the_date = apply_filters( 'wpmtst_the_date', mysql2date( $format, $post->post_date ), $format, $post );
257
+ echo '<div class="' . $class . '">' . $the_date . '</div>';
258
  }
259
 
260
  /**
265
  function wpmtst_the_client() {
266
  $atts = WPMST()->atts();
267
  if ( isset( $atts['client_section'] ) ) {
268
+ echo wpmtst_client_section( $atts['client_section'] );
269
  }
270
  }
271
 
286
  $html = '';
287
 
288
  foreach ( $client_section as $field ) {
289
+ $output = '';
290
+ $field_name = $field['field'];
291
  if ( isset( $custom_fields[ $field_name ] ) ) {
292
  $field['prop'] = $custom_fields[ $field_name ];
293
+ }
294
+ else {
295
  $field['prop'] = array();
296
  }
297
 
305
  else {
306
  switch ( $field['type'] ) {
307
 
308
+ case 'link' :
309
+ case 'link2' :
310
  // use default if missing
311
  if ( ! isset( $field['link_text'] ) ) {
312
  $field['link_text'] = 'value';
318
  * but don't display 'LinkedIn' if no URL given.
319
  */
320
  switch ( $field['link_text'] ) {
321
+ case 'custom' :
322
  $text = $field['link_text_custom'];
323
  $output = '';
324
  break;
325
+ case 'label' :
326
  $text = $field['prop']['field_label'];
327
  $output = '';
328
  break;
329
+ default : // value
330
  $text = get_post_meta( $post->ID, $field_name, true );
331
  // if no URL (next condition), show the alternate (the field)
332
  $output = $text;
338
  if ( $url ) {
339
  if ( isset( $field['new_tab'] ) && $field['new_tab'] ) {
340
  $newtab = ' target="_blank"';
341
+ }
342
+ else {
343
  $newtab = '';
344
  }
345
 
351
  }
352
  if ( 'yes' == $is_nofollow ) {
353
  $nofollow = ' rel="nofollow"';
354
+ }
355
+ else {
356
  $nofollow = '';
357
  }
358
 
363
 
364
  $output = sprintf( '<a href="%s"%s%s>%s</a>', $url, $newtab, $nofollow, $text );
365
  }
366
+
367
  }
368
  break;
369
 
370
+ case 'date' :
371
  $format = isset( $field['format'] ) && $field['format'] ? $field['format'] : get_option( 'date_format' );
372
 
373
  // Fall back to post_date if submit_date missing.
388
  $output = apply_filters( 'wpmtst_the_date', $the_date, $format, $post );
389
  break;
390
 
391
+ case 'category' :
392
  $categories = get_the_terms( $post->ID, 'wpm-testimonial-category' );
393
  if ( $categories && ! is_wp_error( $categories ) ) {
394
  $list = array();
395
  foreach ( $categories as $cat ) {
396
  $list[] = $cat->name;
397
  }
398
+ $output = join( ", ", $list );
399
+ }
400
+ else {
401
  $output = '';
402
  }
403
  break;
404
 
405
+ case 'shortcode' :
406
  if ( isset( $field['prop']['shortcode_on_display'] ) && $field['prop']['shortcode_on_display'] ) {
407
  $output = do_shortcode( $field['prop']['shortcode_on_display'] );
408
  }
409
  break;
410
 
411
+ case 'rating' :
412
  $output = get_post_meta( $post->ID, $field_name, true );
413
  // Check default value
414
  if ( '' == $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
420
  }
421
  break;
422
 
423
+ default :
424
  // text field
425
  $output = get_post_meta( $post->ID, $field_name, true );
426
  if ( '' == $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
427
  $output = $field['prop']['default_display_value'];
428
  }
429
+
430
  }
431
  }
432
 
442
  }
443
 
444
  function wpmtst_container_class() {
445
+ echo apply_filters( 'wpmtst_container_class', WPMST()->atts( 'container_class' ) );
446
  }
447
 
448
  function wpmtst_container_data() {
452
  foreach ( $data_array as $attr => $value ) {
453
  $data .= " data-$attr=$value";
454
  }
455
+ echo $data;
456
  }
457
  }
458
 
459
  function wpmtst_content_class() {
460
+ echo apply_filters( 'wpmtst_content_class', WPMST()->atts( 'content_class' ) );
461
  }
462
 
463
  function wpmtst_post_class( $args = null ) {
464
+ echo apply_filters( 'wpmtst_post_class', WPMST()->atts( 'post_class' ) . ' post-' . get_the_ID(), $args );
465
  }
466
 
467
  /**
473
  * @param array $args
474
  */
475
  function wpmtst_field( $field = null, $args = array() ) {
476
+ echo wpmtst_get_field( $field, $args );
477
  }
478
 
479
  /**
500
  switch ( $field ) {
501
 
502
  // Apply a character limit to post content.
503
+ case 'truncated' :
504
  $html = wpmtst_truncate( $post->post_content, $args['char_limit'] );
505
  break;
506
 
507
  // Get the custom field.
508
+ default :
509
  $html = get_post_meta( $post->ID, $field, true );
510
 
511
  }
545
  if ( $paginate_links ) {
546
  echo "<nav class='nav-links'>";
547
  //echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
548
+ echo $paginate_links;
549
+ echo "</nav>";
550
  }
551
  }
552
  endif;
includes/functions-views.php CHANGED
@@ -27,16 +27,16 @@ function wpmtst_get_views() {
27
  global $wpdb;
28
  $wpdb->show_errors();
29
  $table_name = $wpdb->prefix . 'strong_views';
30
- $results = $wpdb->get_results( "SELECT * FROM $table_name ORDER BY id ASC", ARRAY_A );
31
  $wpdb->hide_errors();
32
 
33
  if ( $wpdb->last_error ) {
34
  deactivate_plugins( 'strong-testimonials/strong-testimonials.php' );
35
- $message = '<p><span style="color: #CD0000;">';
36
  $message .= __( 'An error occurred.', 'strong-testimonials' ) . '</span>&nbsp;';
37
  $message .= __( 'The plugin has been deactivated.', 'strong-testimonials' ) . '&nbsp;';
38
  $message .= '<p>' . sprintf( __( '<a href="%s">Go back to Dashboard</a>', 'strong-testimonials' ), esc_url( admin_url() ) ) . '</p>';
39
- wp_die( sprintf( '<div class="error strong-view-error">%s</div>', wp_kses_post( $message ) ) );
40
  }
41
 
42
  return $results;
@@ -48,8 +48,8 @@ function wpmtst_get_views() {
48
  * @return mixed
49
  */
50
  function wpmtst_unserialize_views( $views ) {
51
- foreach ( $views as $key => $view ) {
52
- $views[ $key ]['data'] = unserialize( $view['value'] );
53
  }
54
 
55
  return $views;
@@ -63,7 +63,7 @@ function wpmtst_unserialize_views( $views ) {
63
  function wpmtst_get_view( $id ) {
64
  global $wpdb;
65
  $table_name = $wpdb->prefix . 'strong_views';
66
- $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d", (int) $id ), ARRAY_A );
67
 
68
  return $row;
69
  }
@@ -77,8 +77,8 @@ function wpmtst_find_single_template_view() {
77
  $views = wpmtst_get_views();
78
  /*
79
  * [id] => 1
80
- * [name] => TEST
81
- * [value] => {serialized_array}
82
  */
83
 
84
  foreach ( $views as $view ) {
27
  global $wpdb;
28
  $wpdb->show_errors();
29
  $table_name = $wpdb->prefix . 'strong_views';
30
+ $results = $wpdb->get_results( "SELECT * FROM $table_name ORDER BY id ASC", ARRAY_A );
31
  $wpdb->hide_errors();
32
 
33
  if ( $wpdb->last_error ) {
34
  deactivate_plugins( 'strong-testimonials/strong-testimonials.php' );
35
+ $message = '<p><span style="color: #CD0000;">';
36
  $message .= __( 'An error occurred.', 'strong-testimonials' ) . '</span>&nbsp;';
37
  $message .= __( 'The plugin has been deactivated.', 'strong-testimonials' ) . '&nbsp;';
38
  $message .= '<p>' . sprintf( __( '<a href="%s">Go back to Dashboard</a>', 'strong-testimonials' ), esc_url( admin_url() ) ) . '</p>';
39
+ wp_die( sprintf( '<div class="error strong-view-error">%s</div>', $message ) );
40
  }
41
 
42
  return $results;
48
  * @return mixed
49
  */
50
  function wpmtst_unserialize_views( $views ) {
51
+ foreach( $views as $key => $view ) {
52
+ $views[$key]['data'] = unserialize( $view['value'] );
53
  }
54
 
55
  return $views;
63
  function wpmtst_get_view( $id ) {
64
  global $wpdb;
65
  $table_name = $wpdb->prefix . 'strong_views';
66
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d", (int) $id ), ARRAY_A );
67
 
68
  return $row;
69
  }
77
  $views = wpmtst_get_views();
78
  /*
79
  * [id] => 1
80
+ * [name] => TEST
81
+ * [value] => {serialized_array}
82
  */
83
 
84
  foreach ( $views as $view ) {
includes/functions.php CHANGED
@@ -16,7 +16,7 @@ function wpmtst_support_url() {
16
  * @return string
17
  */
18
  function wpmtst_l10n_default( $string ) {
19
- return esc_html( $string );
20
  }
21
  add_filter( 'wpmtst_l10n', 'wpmtst_l10n_default' );
22
 
@@ -37,10 +37,12 @@ function wpmtst_get_post( $post ) {
37
 
38
  if ( 'featured_image' == $name ) {
39
  $post->thumbnail_id = get_post_thumbnail_id( $post->ID );
40
- } else {
 
41
  if ( isset( $custom[ $name ] ) ) {
42
  $post->$name = $custom[ $name ][0];
43
- } else {
 
44
  $post->$name = '';
45
  }
46
  }
@@ -56,9 +58,8 @@ function wpmtst_get_post( $post ) {
56
  * @return string
57
  */
58
  function wpmtst_get_website( $url ) {
59
- if ( ! preg_match( '~^(?:f|ht)tps?://~i', $url ) ) {
60
  $url = 'https://' . $url;
61
- }
62
 
63
  return $url;
64
  }
@@ -95,9 +96,7 @@ function wpmtst_is_registered( $filenames ) {
95
  global $wp_scripts;
96
 
97
  // Bail if called too early.
98
- if ( ! $wp_scripts ) {
99
- return false;
100
- }
101
 
102
  $script_handle = '';
103
 
@@ -112,23 +111,22 @@ function wpmtst_is_registered( $filenames ) {
112
  }
113
 
114
  if ( ! function_exists( 'get_page_by_slug' ) ) {
115
- /**
116
- * Get page ID by slug.
117
- *
118
- * Thanks http://wordpress.stackexchange.com/a/102845/32076
119
- * Does not require parent slug.
120
- *
121
- * @since 1.11.0
122
- */
123
- function get_page_by_slug( $page_slug, $output = OBJECT, $post_type = 'page' ) {
124
- global $wpdb;
125
- $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s AND post_status = 'publish'", $page_slug, $post_type ) );
126
- if ( $page ) {
127
- return get_post( $page, $output );
128
- } else {
129
- return null;
130
- }
131
- }
132
  }
133
 
134
  /**
@@ -139,16 +137,16 @@ if ( ! function_exists( 'get_page_by_slug' ) ) {
139
  if ( ! function_exists( 'reverse_wpautop' ) ) {
140
  function reverse_wpautop( $s ) {
141
  // remove any new lines already in there
142
- $s = str_replace( "\n", '', $s );
143
 
144
  // remove all <p>
145
- $s = str_replace( '<p>', '', $s );
146
 
147
  // remove <br>
148
- $s = str_replace( array( '<br />', '<br/>', '<br>' ), '', $s );
149
 
150
  // remove </p>
151
- $s = str_replace( '</p>', '', $s );
152
 
153
  return $s;
154
  }
@@ -192,15 +190,15 @@ function wpmtst_get_form_fields( $form_id = 1 ) {
192
  */
193
  function wpmtst_get_custom_fields() {
194
  $all_fields = array();
195
- $forms = get_option( 'wpmtst_custom_forms' );
196
  if ( ! $forms ) {
197
- return $all_fields;
198
  }
199
 
200
  // use default group as base
201
  $fields = $forms[1]['fields'];
202
  if ( ! $fields ) {
203
- return $all_fields;
204
  }
205
 
206
  // replace key with field name
@@ -213,7 +211,7 @@ function wpmtst_get_custom_fields() {
213
  // merge remaining form fields
214
  foreach ( $forms as $form ) {
215
  $custom_fields = array();
216
- $fields = $form['fields'];
217
  foreach ( $fields as $field ) {
218
  if ( 'post' != $field['record_type'] ) {
219
  $custom_fields[ $field['name'] ] = $field;
@@ -233,7 +231,7 @@ function wpmtst_get_custom_fields() {
233
  * @return array
234
  */
235
  function wpmtst_get_all_fields() {
236
- $forms = get_option( 'wpmtst_custom_forms' );
237
  $all_fields = array();
238
 
239
  /**
@@ -251,7 +249,7 @@ function wpmtst_get_all_fields() {
251
  // merge remaining form fields
252
  foreach ( $forms as $form ) {
253
  $custom_fields = array();
254
- $fields = $form['fields'];
255
  foreach ( $fields as $field ) {
256
  $custom_fields[ $field['name'] ] = $field;
257
  }
@@ -268,7 +266,7 @@ function wpmtst_get_all_fields() {
268
  */
269
  function wpmtst_get_builtin_fields() {
270
  return array(
271
- 'post_date' => array(
272
  'name' => 'post_date',
273
  'label' => 'Post Date',
274
  'input_type' => 'date',
@@ -282,7 +280,7 @@ function wpmtst_get_builtin_fields() {
282
  'type' => 'date',
283
  'record_type' => 'builtin',
284
  ),
285
- 'category' => array(
286
  'name' => 'category',
287
  'label' => 'Category',
288
  'input_type' => 'category',
@@ -357,7 +355,7 @@ function wpmtst_get_image_sizes( $size = '' ) {
357
 
358
  global $_wp_additional_image_sizes;
359
 
360
- $sizes = array();
361
  $get_intermediate_image_sizes = get_intermediate_image_sizes();
362
 
363
  /**
@@ -372,16 +370,18 @@ function wpmtst_get_image_sizes( $size = '' ) {
372
 
373
  $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
374
  $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
375
- $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
376
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
 
377
 
378
  $sizes[ $_size ] = array(
379
  'width' => $_wp_additional_image_sizes[ $_size ]['width'],
380
  'height' => $_wp_additional_image_sizes[ $_size ]['height'],
381
- 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
382
  );
383
 
384
  }
 
385
  }
386
 
387
  // Sort by width
@@ -394,16 +394,8 @@ function wpmtst_get_image_sizes( $size = '' ) {
394
  }
395
 
396
  // Add extra options
397
- $sizes['full'] = array(
398
- 'label' => 'original size uploaded',
399
- 'width' => 0,
400
- 'height' => 0,
401
- );
402
- $sizes['custom'] = array(
403
- 'label' => 'custom size',
404
- 'width' => 0,
405
- 'height' => 0,
406
- );
407
 
408
  // Get only one size if found
409
  if ( $size ) {
@@ -427,7 +419,7 @@ function wpmtst_compare_width( $a, $b ) {
427
  if ( $a['width'] == $b['width'] ) {
428
  return 0;
429
  }
430
- return ( $a['width'] < $b['width'] ) ? -1 : 1;
431
  }
432
 
433
  /**
@@ -447,13 +439,10 @@ function wpmtst_get_cat_count() {
447
  * @return array|int|WP_Error
448
  */
449
  function wpmtst_get_cats( $parent = 0 ) {
450
- return get_terms(
451
- 'wpm-testimonial-category',
452
- array(
453
- 'hide_empty' => false,
454
- 'parent' => $parent,
455
- )
456
- );
457
  }
458
 
459
  /**
@@ -466,16 +455,15 @@ function wpmtst_nested_cats( $value, $parent = 0, $level = 0 ) {
466
  if ( $cats ) {
467
  foreach ( $cats as $cat ) {
468
  $selected = in_array( $cat->term_id, $value ) ? ' selected' : '';
469
- printf( '<option value="%s"%s>%s%s</option>', esc_attr( $cat->term_id ), esc_attr( $selected ), esc_html( str_repeat( '&nbsp;&nbsp;&nbsp;', $level ) ), esc_html( $cat->name ) );
470
  wpmtst_nested_cats( $value, $cat->term_id, $level + 1 );
471
  }
472
  }
473
  }
474
 
475
  function wpmtst_sort_array_by_name( $a, $b ) {
476
- if ( $a['name'] == $b['name'] ) {
477
  return 0;
478
- }
479
 
480
  return ( $a['name'] < $b['name'] ) ? -1 : 1;
481
  }
@@ -501,11 +489,11 @@ function wpmtst_using_form_validation_script() {
501
  */
502
  function wpmtst_embed_size( $dimensions, $url ) {
503
  $options = get_option( 'wpmtst_options' );
504
- $width = (int) $options['embed_width'];
505
  if ( $width ) {
506
  $dimensions = array(
507
  'width' => $width,
508
- 'height' => min( ceil( $width * 1.5 ), 1000 ),
509
  );
510
  }
511
 
@@ -522,9 +510,8 @@ function wpmtst_embed_size( $dimensions, $url ) {
522
  * @return bool
523
  */
524
  function wpmtst_insert_post_empty_content( $maybe_empty, $postarr ) {
525
- if ( 'wpm-testimonial' == $postarr['post_type'] ) {
526
  return false;
527
- }
528
 
529
  return $maybe_empty;
530
  }
@@ -546,7 +533,7 @@ function wpmtst_post_submitbox_misc_actions( $post ) {
546
  echo '<span id="submit-timestamp">&nbsp;';
547
  $submit_date = get_post_meta( $post->ID, 'submit_date', true );
548
  if ( $submit_date ) {
549
- echo 'Submitted on: <strong>' . wp_kses_post( date_i18n( __( 'M j, Y @ H:i' ), strtotime( $submit_date ) ) ) . '</strong>';
550
  } else {
551
  echo 'No submit date';
552
  }
@@ -560,16 +547,13 @@ add_action( 'post_submitbox_misc_actions', 'wpmtst_post_submitbox_misc_actions'
560
  * @return mixed
561
  */
562
  function wpmtst_get_background_defaults() {
563
- return apply_filters(
564
- 'wpmtst_default_template_background',
565
- array(
566
- 'color' => '',
567
- 'type' => '',
568
- 'preset' => '',
569
- 'gradient1' => '',
570
- 'gradient2' => '',
571
- )
572
- );
573
  }
574
 
575
  /**
@@ -580,12 +564,12 @@ function wpmtst_get_background_defaults() {
580
  */
581
  function wpmtst_get_background_presets( $preset = null ) {
582
  $presets = array(
583
- 'light-blue-gradient' => array(
584
  'label' => __( 'light blue gradient', 'strong-testimonials' ),
585
  'color' => '#E7EFFE',
586
  'color2' => '#B8CFFB',
587
  ),
588
- 'light-gray-gradient' => array(
589
  'label' => __( 'light gray gradient', 'strong-testimonials' ),
590
  'color' => '#FBFBFB',
591
  'color2' => '#EDEDED',
@@ -595,17 +579,17 @@ function wpmtst_get_background_presets( $preset = null ) {
595
  'color' => '#F2FBE9',
596
  'color2' => '#E0F7CC',
597
  ),
598
- 'light-latte-gradient' => array(
599
  'label' => __( 'light latte gradient', 'strong-testimonials' ),
600
  'color' => '#F8F3EC',
601
  'color2' => '#E0C8AB',
602
  ),
603
- 'light-plum-gradient' => array(
604
  'label' => __( 'light plum gradient', 'strong-testimonials' ),
605
  'color' => '#F7EEF7',
606
  'color2' => '#E9D0E9',
607
  ),
608
- 'sky-blue-gradient' => array(
609
  'label' => __( 'sky blue gradient', 'strong-testimonials' ),
610
  'color' => '#E9F6FB',
611
  'color2' => '#C8E9F6',
@@ -616,7 +600,7 @@ function wpmtst_get_background_presets( $preset = null ) {
616
  if ( isset( $presets[ $preset ] ) ) {
617
  return $presets[ $preset ];
618
  } else {
619
- return wpmtst_get_background_defaults();
620
  }
621
  }
622
 
@@ -705,31 +689,27 @@ add_filter( 'the_content', 'wpmtst_single_template_add_content' );
705
  * @return bool
706
  */
707
  function wpmtst_is_plugin_active( $plugin = '' ) {
708
- if ( ! $plugin ) {
709
  return false;
710
- }
711
 
712
  $plugins = array(
713
- 'wpml' => 'sitepress-multilingual-cms/sitepress.php',
714
- 'polylang' => 'polylang/polylang.php',
715
- 'lazy-loading-responsive-images' => 'lazy-loading-responsive-images/lazy-load-responsive-images.php',
716
  );
717
  if ( isset( $plugins[ $plugin ] ) ) {
718
  $plugin = $plugins[ $plugin ];
719
  }
720
 
721
- if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) ) {
722
- return true;
723
- }
724
 
725
- if ( ! is_multisite() ) {
726
  return false;
727
- }
728
 
729
- $plugins = get_site_option( 'active_sitewide_plugins' );
730
- if ( isset( $plugins[ $plugin ] ) ) {
731
  return true;
732
- }
733
 
734
  return false;
735
  }
@@ -813,28 +793,28 @@ function wpmtst_trim_array( $input ) {
813
  }
814
 
815
  if ( ! function_exists( 'normalize_empty_atts' ) ) {
816
- /**
817
- * Normalize empty shortcode attributes.
818
- *
819
- * Turns atts into tags - brilliant!
820
- * Thanks http://wordpress.stackexchange.com/a/123073/32076
821
- *
822
- * @param $atts
823
- *
824
- * @return mixed
825
- */
826
- function normalize_empty_atts( $atts ) {
827
- if ( ! empty( $atts ) ) {
828
- foreach ( $atts as $attribute => $value ) {
829
- if ( is_int( $attribute ) ) {
830
- $atts[ strtolower( $value ) ] = true;
831
- unset( $atts[ $attribute ] );
832
- }
833
- }
834
- }
835
-
836
- return $atts;
837
- }
838
  }
839
 
840
  if ( ! function_exists( 'wpmtst_round_to_half' ) ) {
@@ -870,11 +850,11 @@ if ( ! function_exists( 'wpmtst_strip_whitespace' ) ) {
870
 
871
  if ( ! function_exists( 'wpmtst_current_url' ) ) {
872
  /**
873
- * Assemble and return the current URL.
874
- *
875
- * @since 2.31.0
876
  * @return string
877
- */
878
  function wpmtst_current_url() {
879
  global $wp;
880
 
16
  * @return string
17
  */
18
  function wpmtst_l10n_default( $string ) {
19
+ return __( $string, 'strong-testimonials' );
20
  }
21
  add_filter( 'wpmtst_l10n', 'wpmtst_l10n_default' );
22
 
37
 
38
  if ( 'featured_image' == $name ) {
39
  $post->thumbnail_id = get_post_thumbnail_id( $post->ID );
40
+ }
41
+ else {
42
  if ( isset( $custom[ $name ] ) ) {
43
  $post->$name = $custom[ $name ][0];
44
+ }
45
+ else {
46
  $post->$name = '';
47
  }
48
  }
58
  * @return string
59
  */
60
  function wpmtst_get_website( $url ) {
61
+ if ( !preg_match( "~^(?:f|ht)tps?://~i", $url ) )
62
  $url = 'https://' . $url;
 
63
 
64
  return $url;
65
  }
96
  global $wp_scripts;
97
 
98
  // Bail if called too early.
99
+ if ( ! $wp_scripts ) return false;
 
 
100
 
101
  $script_handle = '';
102
 
111
  }
112
 
113
  if ( ! function_exists( 'get_page_by_slug' ) ) {
114
+ /**
115
+ * Get page ID by slug.
116
+ *
117
+ * Thanks http://wordpress.stackexchange.com/a/102845/32076
118
+ * Does not require parent slug.
119
+ *
120
+ * @since 1.11.0
121
+ */
122
+ function get_page_by_slug( $page_slug, $output = OBJECT, $post_type = 'page' ) {
123
+ global $wpdb;
124
+ $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s AND post_status = 'publish'", $page_slug, $post_type ) );
125
+ if ( $page )
126
+ return get_post($page, $output);
127
+ else
128
+ return null;
129
+ }
 
130
  }
131
 
132
  /**
137
  if ( ! function_exists( 'reverse_wpautop' ) ) {
138
  function reverse_wpautop( $s ) {
139
  // remove any new lines already in there
140
+ $s = str_replace("\n", "", $s);
141
 
142
  // remove all <p>
143
+ $s = str_replace("<p>", "", $s);
144
 
145
  // remove <br>
146
+ $s = str_replace(array("<br />", "<br/>", "<br>"), "", $s);
147
 
148
  // remove </p>
149
+ $s = str_replace("</p>", "", $s);
150
 
151
  return $s;
152
  }
190
  */
191
  function wpmtst_get_custom_fields() {
192
  $all_fields = array();
193
+ $forms = get_option( 'wpmtst_custom_forms' );
194
  if ( ! $forms ) {
195
+ return $all_fields;
196
  }
197
 
198
  // use default group as base
199
  $fields = $forms[1]['fields'];
200
  if ( ! $fields ) {
201
+ return $all_fields;
202
  }
203
 
204
  // replace key with field name
211
  // merge remaining form fields
212
  foreach ( $forms as $form ) {
213
  $custom_fields = array();
214
+ $fields = $form['fields'];
215
  foreach ( $fields as $field ) {
216
  if ( 'post' != $field['record_type'] ) {
217
  $custom_fields[ $field['name'] ] = $field;
231
  * @return array
232
  */
233
  function wpmtst_get_all_fields() {
234
+ $forms = get_option( 'wpmtst_custom_forms' );
235
  $all_fields = array();
236
 
237
  /**
249
  // merge remaining form fields
250
  foreach ( $forms as $form ) {
251
  $custom_fields = array();
252
+ $fields = $form['fields'];
253
  foreach ( $fields as $field ) {
254
  $custom_fields[ $field['name'] ] = $field;
255
  }
266
  */
267
  function wpmtst_get_builtin_fields() {
268
  return array(
269
+ 'post_date' => array(
270
  'name' => 'post_date',
271
  'label' => 'Post Date',
272
  'input_type' => 'date',
280
  'type' => 'date',
281
  'record_type' => 'builtin',
282
  ),
283
+ 'category' => array(
284
  'name' => 'category',
285
  'label' => 'Category',
286
  'input_type' => 'category',
355
 
356
  global $_wp_additional_image_sizes;
357
 
358
+ $sizes = array();
359
  $get_intermediate_image_sizes = get_intermediate_image_sizes();
360
 
361
  /**
370
 
371
  $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
372
  $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
373
+ $sizes[ $_size ]['crop'] = (bool)get_option( $_size . '_crop' );
374
+ }
375
+ elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
376
 
377
  $sizes[ $_size ] = array(
378
  'width' => $_wp_additional_image_sizes[ $_size ]['width'],
379
  'height' => $_wp_additional_image_sizes[ $_size ]['height'],
380
+ 'crop' => $_wp_additional_image_sizes[ $_size ]['crop']
381
  );
382
 
383
  }
384
+
385
  }
386
 
387
  // Sort by width
394
  }
395
 
396
  // Add extra options
397
+ $sizes['full'] = array( 'label' => 'original size uploaded', 'width' => 0, 'height' => 0 );
398
+ $sizes['custom'] = array( 'label' => 'custom size', 'width' => 0, 'height' => 0 );
 
 
 
 
 
 
 
 
399
 
400
  // Get only one size if found
401
  if ( $size ) {
419
  if ( $a['width'] == $b['width'] ) {
420
  return 0;
421
  }
422
+ return ($a['width'] < $b['width']) ? -1 : 1;
423
  }
424
 
425
  /**
439
  * @return array|int|WP_Error
440
  */
441
  function wpmtst_get_cats( $parent = 0 ) {
442
+ return get_terms( 'wpm-testimonial-category', array(
443
+ 'hide_empty' => false,
444
+ 'parent' => $parent,
445
+ ) );
 
 
 
446
  }
447
 
448
  /**
455
  if ( $cats ) {
456
  foreach ( $cats as $cat ) {
457
  $selected = in_array( $cat->term_id, $value ) ? ' selected' : '';
458
+ printf( '<option value="%s"%s>%s%s</option>', $cat->term_id, $selected, str_repeat( '&nbsp;&nbsp;&nbsp;', $level ), $cat->name );
459
  wpmtst_nested_cats( $value, $cat->term_id, $level + 1 );
460
  }
461
  }
462
  }
463
 
464
  function wpmtst_sort_array_by_name( $a, $b ) {
465
+ if ( $a['name'] == $b['name'] )
466
  return 0;
 
467
 
468
  return ( $a['name'] < $b['name'] ) ? -1 : 1;
469
  }
489
  */
490
  function wpmtst_embed_size( $dimensions, $url ) {
491
  $options = get_option( 'wpmtst_options' );
492
+ $width = (int) $options['embed_width'];
493
  if ( $width ) {
494
  $dimensions = array(
495
  'width' => $width,
496
+ 'height' => min( ceil( $width * 1.5 ), 1000 )
497
  );
498
  }
499
 
510
  * @return bool
511
  */
512
  function wpmtst_insert_post_empty_content( $maybe_empty, $postarr ) {
513
+ if ( 'wpm-testimonial' == $postarr['post_type'] )
514
  return false;
 
515
 
516
  return $maybe_empty;
517
  }
533
  echo '<span id="submit-timestamp">&nbsp;';
534
  $submit_date = get_post_meta( $post->ID, 'submit_date', true );
535
  if ( $submit_date ) {
536
+ echo 'Submitted on: <strong>' . date_i18n( __( 'M j, Y @ H:i' ), strtotime( $submit_date ) ) . '</strong>';
537
  } else {
538
  echo 'No submit date';
539
  }
547
  * @return mixed
548
  */
549
  function wpmtst_get_background_defaults() {
550
+ return apply_filters( 'wpmtst_default_template_background', array(
551
+ 'color' => '',
552
+ 'type' => '',
553
+ 'preset' => '',
554
+ 'gradient1' => '',
555
+ 'gradient2' => '',
556
+ ) );
 
 
 
557
  }
558
 
559
  /**
564
  */
565
  function wpmtst_get_background_presets( $preset = null ) {
566
  $presets = array(
567
+ 'light-blue-gradient' => array(
568
  'label' => __( 'light blue gradient', 'strong-testimonials' ),
569
  'color' => '#E7EFFE',
570
  'color2' => '#B8CFFB',
571
  ),
572
+ 'light-gray-gradient' => array(
573
  'label' => __( 'light gray gradient', 'strong-testimonials' ),
574
  'color' => '#FBFBFB',
575
  'color2' => '#EDEDED',
579
  'color' => '#F2FBE9',
580
  'color2' => '#E0F7CC',
581
  ),
582
+ 'light-latte-gradient' => array(
583
  'label' => __( 'light latte gradient', 'strong-testimonials' ),
584
  'color' => '#F8F3EC',
585
  'color2' => '#E0C8AB',
586
  ),
587
+ 'light-plum-gradient' => array(
588
  'label' => __( 'light plum gradient', 'strong-testimonials' ),
589
  'color' => '#F7EEF7',
590
  'color2' => '#E9D0E9',
591
  ),
592
+ 'sky-blue-gradient' => array(
593
  'label' => __( 'sky blue gradient', 'strong-testimonials' ),
594
  'color' => '#E9F6FB',
595
  'color2' => '#C8E9F6',
600
  if ( isset( $presets[ $preset ] ) ) {
601
  return $presets[ $preset ];
602
  } else {
603
+ return wpmtst_get_background_defaults();
604
  }
605
  }
606
 
689
  * @return bool
690
  */
691
  function wpmtst_is_plugin_active( $plugin = '' ) {
692
+ if ( ! $plugin )
693
  return false;
 
694
 
695
  $plugins = array(
696
+ 'wpml' => 'sitepress-multilingual-cms/sitepress.php',
697
+ 'polylang' => 'polylang/polylang.php',
698
+ 'lazy-loading-responsive-images' => 'lazy-loading-responsive-images/lazy-load-responsive-images.php',
699
  );
700
  if ( isset( $plugins[ $plugin ] ) ) {
701
  $plugin = $plugins[ $plugin ];
702
  }
703
 
704
+ if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) )
705
+ return true;
 
706
 
707
+ if ( ! is_multisite() )
708
  return false;
 
709
 
710
+ $plugins = get_site_option( 'active_sitewide_plugins');
711
+ if ( isset( $plugins[ $plugin ] ) )
712
  return true;
 
713
 
714
  return false;
715
  }
793
  }
794
 
795
  if ( ! function_exists( 'normalize_empty_atts' ) ) {
796
+ /**
797
+ * Normalize empty shortcode attributes.
798
+ *
799
+ * Turns atts into tags - brilliant!
800
+ * Thanks http://wordpress.stackexchange.com/a/123073/32076
801
+ *
802
+ * @param $atts
803
+ *
804
+ * @return mixed
805
+ */
806
+ function normalize_empty_atts( $atts ) {
807
+ if ( ! empty( $atts ) ) {
808
+ foreach ( $atts as $attribute => $value ) {
809
+ if ( is_int( $attribute ) ) {
810
+ $atts[ strtolower( $value ) ] = true;
811
+ unset( $atts[ $attribute ] );
812
+ }
813
+ }
814
+ }
815
+
816
+ return $atts;
817
+ }
818
  }
819
 
820
  if ( ! function_exists( 'wpmtst_round_to_half' ) ) {
850
 
851
  if ( ! function_exists( 'wpmtst_current_url' ) ) {
852
  /**
853
+ * Assemble and return the current URL.
854
+ *
855
+ * @since 2.31.0
856
  * @return string
857
+ */
858
  function wpmtst_current_url() {
859
  global $wp;
860
 
includes/integrations/class-integration-captcha-pro.php CHANGED
@@ -8,7 +8,7 @@ class Strong_Testimonials_Integration_Captcha_Pro extends Strong_Testimonials_In
8
  public function add_captcha() {
9
  if ( function_exists( 'cptch_display_captcha_custom' ) ) {
10
  return '<input type="hidden" name="cntctfrm_contact_action" value="true">' .
11
- cptch_display_captcha_custom();
12
  }
13
 
14
  return '';
8
  public function add_captcha() {
9
  if ( function_exists( 'cptch_display_captcha_custom' ) ) {
10
  return '<input type="hidden" name="cntctfrm_contact_action" value="true">' .
11
+ cptch_display_captcha_custom();
12
  }
13
 
14
  return '';
includes/integrations/class-integration-captcha.php CHANGED
@@ -11,4 +11,4 @@ class Strong_Testimonials_Integration_Captcha {
11
  return $form_errors;
12
  }
13
 
14
- }
11
  return $form_errors;
12
  }
13
 
14
+ }
includes/integrations/class-integration-really-simple-captcha.php CHANGED
@@ -8,11 +8,11 @@ class Strong_Testimonials_Integration_Really_Simple_Captcha extends Strong_Testi
8
  public function add_captcha() {
9
  if ( class_exists( 'ReallySimpleCaptcha' ) ) {
10
  $captcha_instance = new ReallySimpleCaptcha();
11
- $word = $captcha_instance->generate_random_word();
12
- $prefix = mt_rand();
13
- $image = $captcha_instance->generate_image( $prefix, $word );
14
- $html = '<span>' . _x( 'Input this code:', 'Captcha', 'strong-testimonials' ) . '&nbsp;<input type="hidden" name="captchac" value="' . $prefix . '"><img class="captcha" src="' . plugins_url( 'really-simple-captcha/tmp/' ) . $image . '"></span>';
15
- $html .= '<input type="text" class="captcha" name="captchar" maxlength="4" size="5">';
16
  return $html;
17
  }
18
 
@@ -22,10 +22,10 @@ class Strong_Testimonials_Integration_Really_Simple_Captcha extends Strong_Testi
22
  public function check_captcha( $form_errors ) {
23
  if ( class_exists( 'ReallySimpleCaptcha' ) ) {
24
  $captcha_instance = new ReallySimpleCaptcha();
25
- $prefix = isset( $_POST['captchac'] ) ? (string) $_POST['captchac'] : '';
26
- $response = isset( $_POST['captchar'] ) ? (string) $_POST['captchar'] : '';
27
- $correct = $captcha_instance->check( $prefix, $response );
28
- if ( ! $correct ) {
29
  $errors['captcha'] = __( 'The Captcha failed. Please try again.', 'strong-testimonials' );
30
  }
31
  // remove the temporary image and text files (except on Windows)
8
  public function add_captcha() {
9
  if ( class_exists( 'ReallySimpleCaptcha' ) ) {
10
  $captcha_instance = new ReallySimpleCaptcha();
11
+ $word = $captcha_instance->generate_random_word();
12
+ $prefix = mt_rand();
13
+ $image = $captcha_instance->generate_image( $prefix, $word );
14
+ $html = '<span>' . _x( 'Input this code:', 'Captcha', 'strong-testimonials' ) . '&nbsp;<input type="hidden" name="captchac" value="'.$prefix.'"><img class="captcha" src="' . plugins_url( 'really-simple-captcha/tmp/' ) . $image . '"></span>';
15
+ $html .= '<input type="text" class="captcha" name="captchar" maxlength="4" size="5">';
16
  return $html;
17
  }
18
 
22
  public function check_captcha( $form_errors ) {
23
  if ( class_exists( 'ReallySimpleCaptcha' ) ) {
24
  $captcha_instance = new ReallySimpleCaptcha();
25
+ $prefix = isset( $_POST['captchac'] ) ? (string) $_POST['captchac'] : '';
26
+ $response = isset( $_POST['captchar'] ) ? (string) $_POST['captchar'] : '';
27
+ $correct = $captcha_instance->check( $prefix, $response );
28
+ if ( !$correct ) {
29
  $errors['captcha'] = __( 'The Captcha failed. Please try again.', 'strong-testimonials' );
30
  }
31
  // remove the temporary image and text files (except on Windows)
includes/l10n-polylang.php CHANGED
@@ -87,7 +87,7 @@ function wpmtst_form_options_polylang( $options ) {
87
  // Form messages
88
  $context = 'strong-testimonials-form-messages';
89
  foreach ( $options['messages'] as $key => $field ) {
90
- pll_register_string( esc_html( $field['description'] ), $field['text'], $context );
91
  }
92
 
93
  // Form notification
@@ -117,32 +117,14 @@ function wpmtst_readmore_polylang() {
117
  continue;
118
  }
119
 
120
- pll_register_string(
121
- sprintf(
122
- __( 'View %s : Read more (testimonial)', 'strong-testimonials' ),
123
- $view['id']
124
- ),
125
- $view_data['more_post_text'],
126
- $context
127
- );
128
-
129
- pll_register_string(
130
- sprintf(
131
- __( 'View %s : Read less (testimonial)', 'strong-testimonials' ),
132
- $view['id']
133
- ),
134
- $view_data['less_post_text'],
135
- $context
136
- );
137
-
138
- pll_register_string(
139
- sprintf(
140
- __( 'View %s : Read more (page or post)', 'strong-testimonials' ),
141
- $view['id']
142
- ),
143
- $view_data['more_page_text'],
144
- $context
145
- );
146
  }
147
  }
148
  }
@@ -183,9 +165,7 @@ add_action( 'admin_init', 'wpmtst_admin_polylang' );
183
  function wpmtst_help_link_polylang( $context ) {
184
  echo '<p>';
185
  echo '<span class="dashicons dashicons-info icon-blue"></span>&nbsp;';
186
- printf(
187
- wp_kses_post( __( 'Translate these fields in <a href="%s">Polylang String Translations</a>', 'strong-testimonials' ) ),
188
- esc_url( admin_url( 'admin.php?page=mlang_strings&group=strong-testimonials-' . $context . '&paged=1' ) )
189
- );
190
  echo '</p>';
191
  }
87
  // Form messages
88
  $context = 'strong-testimonials-form-messages';
89
  foreach ( $options['messages'] as $key => $field ) {
90
+ pll_register_string( __( $field['description'], 'strong-testimonials' ), $field['text'], $context );
91
  }
92
 
93
  // Form notification
117
  continue;
118
  }
119
 
120
+ pll_register_string( sprintf( __( 'View %s : Read more (testimonial)', 'strong-testimonials', false ),
121
+ $view['id'] ), $view_data['more_post_text'], $context );
122
+
123
+ pll_register_string( sprintf( __( 'View %s : Read less (testimonial)', 'strong-testimonials', false ),
124
+ $view['id'] ), $view_data['less_post_text'], $context );
125
+
126
+ pll_register_string( sprintf( __( 'View %s : Read more (page or post)', 'strong-testimonials', false ),
127
+ $view['id'] ), $view_data['more_page_text'], $context );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
  }
130
  }
165
  function wpmtst_help_link_polylang( $context ) {
166
  echo '<p>';
167
  echo '<span class="dashicons dashicons-info icon-blue"></span>&nbsp;';
168
+ printf( __( 'Translate these fields in <a href="%s">Polylang String Translations</a>', 'strong-testimonials' ),
169
+ admin_url( 'admin.php?page=mlang_strings&group=strong-testimonials-' . $context . '&paged=1' ) );
 
 
170
  echo '</p>';
171
  }
includes/l10n-wpml.php CHANGED
@@ -81,19 +81,19 @@ function wpmtst_wpml_translate_object_ids( $object_id, $type = 'wpm-testimonial-
81
  // if string
82
  elseif ( is_string( $object_id ) ) {
83
  // check if we have a comma separated ID string
84
- $is_comma_separated = strpos( $object_id, ',' );
85
 
86
- if ( $is_comma_separated !== false ) {
87
  // explode the comma to create an array of IDs
88
- $object_id = explode( ',', $object_id );
89
 
90
  $translated_object_ids = array();
91
  foreach ( $object_id as $id ) {
92
- $translated_object_ids[] = apply_filters( 'wpml_object_id', $id, $type, true );
93
  }
94
 
95
  // make sure the output is a comma separated string (the same way it came in!)
96
- return implode( ',', $translated_object_ids );
97
  }
98
  // if we don't find a comma in the string then this is a single ID
99
  else {
@@ -176,7 +176,7 @@ function wpmtst_form_options_wpml( $oldvalue, $newvalue, $option = 'wpmtst_form_
176
  krsort( $wpml );
177
  foreach ( $wpml as $key => $field ) {
178
  // We can translate here because the description was localized when added.
179
- do_action( 'wpml_register_single_string', $context, $field['description'], $field['text'] );
180
  }
181
 
182
  // Form notification
@@ -234,9 +234,7 @@ function wpmtst_update_view_wpml( $view ) {
234
  function wpmtst_help_link_wpml( $context ) {
235
  echo '<p>';
236
  echo '<span class="dashicons dashicons-info icon-blue"></span>&nbsp;';
237
- printf(
238
- wp_kses_post( __( 'Translate these fields in <a href="%s">WPML String Translations</a>', 'strong-testimonials' ) ),
239
- esc_url( admin_url( 'admin.php?page=wpml-string-translation%2Fmenu%2Fstring-translation.php&context=strong-testimonials-' . $context ) )
240
- );
241
  echo '</p>';
242
  }
81
  // if string
82
  elseif ( is_string( $object_id ) ) {
83
  // check if we have a comma separated ID string
84
+ $is_comma_separated = strpos( $object_id,"," );
85
 
86
+ if ( $is_comma_separated !== FALSE ) {
87
  // explode the comma to create an array of IDs
88
+ $object_id = explode( ',', $object_id );
89
 
90
  $translated_object_ids = array();
91
  foreach ( $object_id as $id ) {
92
+ $translated_object_ids[] = apply_filters ( 'wpml_object_id', $id, $type, true );
93
  }
94
 
95
  // make sure the output is a comma separated string (the same way it came in!)
96
+ return implode ( ',', $translated_object_ids );
97
  }
98
  // if we don't find a comma in the string then this is a single ID
99
  else {
176
  krsort( $wpml );
177
  foreach ( $wpml as $key => $field ) {
178
  // We can translate here because the description was localized when added.
179
+ do_action( 'wpml_register_single_string', $context, __( $field['description'], 'strong-testimonials' ), $field['text'] );
180
  }
181
 
182
  // Form notification
234
  function wpmtst_help_link_wpml( $context ) {
235
  echo '<p>';
236
  echo '<span class="dashicons dashicons-info icon-blue"></span>&nbsp;';
237
+ printf( __( 'Translate these fields in <a href="%s">WPML String Translations</a>', 'strong-testimonials' ),
238
+ admin_url( 'admin.php?page=wpml-string-translation%2Fmenu%2Fstring-translation.php&context=strong-testimonials-' . $context ) );
 
 
239
  echo '</p>';
240
  }
includes/post-types.php CHANGED
@@ -150,13 +150,11 @@ function wpmtst_get_tax_defaults() {
150
  function wpmtst_testimonial_supports( $supports ) {
151
  $options = get_option( 'wpmtst_options' );
152
 
153
- if ( isset( $options['support_custom_fields'] ) && $options['support_custom_fields'] ) {
154
  $supports[] = 'custom-fields';
155
- }
156
 
157
- if ( isset( $options['support_comments'] ) && $options['support_comments'] ) {
158
  $supports[] = 'comments';
159
- }
160
 
161
  return $supports;
162
  }
@@ -183,22 +181,19 @@ function wpmtst_updated_messages( $messages ) {
183
 
184
  // TODO Use WordPress translations as a basis for adding these to existing translation files.
185
  // Preview post link.
186
- $preview_post_link_html = sprintf(
187
- ' <a target="_blank" href="%1$s">%2$s</a>',
188
  esc_url( $preview_url ),
189
  __( 'Preview testimonial', 'strong-testimonials' )
190
  );
191
 
192
  // View post link.
193
- $view_post_link_html = sprintf(
194
- ' <a href="%1$s">%2$s</a>',
195
  esc_url( $permalink ),
196
  __( 'View testimonial', 'strong-testimonials' )
197
  );
198
 
199
  // Scheduled post preview link.
200
- $scheduled_post_link_html = sprintf(
201
- ' <a target="_blank" href="%1$s">%2$s</a>',
202
  esc_url( $permalink ),
203
  __( 'Preview testimonial', 'strong-testimonials' )
204
  );
@@ -207,17 +202,17 @@ function wpmtst_updated_messages( $messages ) {
207
  $scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
208
 
209
  $messages['wpm-testimonial'] = array(
210
- 0 => '', // Unused. Messages start at index 1.
211
- 1 => __( 'Testimonial updated.', 'strong-testimonials' ) . $view_post_link_html,
212
- 2 => __( 'Custom field updated.' ),
213
- 3 => __( 'Custom field deleted.' ),
214
- 4 => __( 'Testimonial updated.', 'strong-testimonials' ),
215
  /* translators: %s: date and time of the revision */
216
- 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Testimonial restored to revision from %s.', 'strong-testimonials' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
217
- 6 => __( 'Testimonial published.', 'strong-testimonials' ) . $view_post_link_html,
218
- 7 => __( 'Testimonial saved.', 'strong-testimonials' ),
219
- 8 => __( 'Testimonial submitted.', 'strong-testimonials' ) . $preview_post_link_html,
220
- 9 => sprintf( __( 'Testimonial scheduled for: %s.', 'strong-testimonials' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
221
  10 => __( 'Testimonial draft updated.', 'strong-testimonials' ) . $preview_post_link_html,
222
  );
223
 
150
  function wpmtst_testimonial_supports( $supports ) {
151
  $options = get_option( 'wpmtst_options' );
152
 
153
+ if ( isset( $options['support_custom_fields'] ) && $options['support_custom_fields'] )
154
  $supports[] = 'custom-fields';
 
155
 
156
+ if ( isset( $options['support_comments'] ) && $options['support_comments'] )
157
  $supports[] = 'comments';
 
158
 
159
  return $supports;
160
  }
181
 
182
  // TODO Use WordPress translations as a basis for adding these to existing translation files.
183
  // Preview post link.
184
+ $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
 
185
  esc_url( $preview_url ),
186
  __( 'Preview testimonial', 'strong-testimonials' )
187
  );
188
 
189
  // View post link.
190
+ $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
 
191
  esc_url( $permalink ),
192
  __( 'View testimonial', 'strong-testimonials' )
193
  );
194
 
195
  // Scheduled post preview link.
196
+ $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
 
197
  esc_url( $permalink ),
198
  __( 'Preview testimonial', 'strong-testimonials' )
199
  );
202
  $scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
203
 
204
  $messages['wpm-testimonial'] = array(
205
+ 0 => '', // Unused. Messages start at index 1.
206
+ 1 => __( 'Testimonial updated.', 'strong-testimonials' ) . $view_post_link_html,
207
+ 2 => __( 'Custom field updated.' ),
208
+ 3 => __( 'Custom field deleted.' ),
209
+ 4 => __( 'Testimonial updated.', 'strong-testimonials' ),
210
  /* translators: %s: date and time of the revision */
211
+ 5 => isset($_GET['revision']) ? sprintf( __( 'Testimonial restored to revision from %s.', 'strong-testimonials' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
212
+ 6 => __( 'Testimonial published.', 'strong-testimonials' ) . $view_post_link_html,
213
+ 7 => __( 'Testimonial saved.', 'strong-testimonials' ),
214
+ 8 => __( 'Testimonial submitted.', 'strong-testimonials' ) . $preview_post_link_html,
215
+ 9 => sprintf( __( 'Testimonial scheduled for: %s.', 'strong-testimonials' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
216
  10 => __( 'Testimonial draft updated.', 'strong-testimonials' ) . $preview_post_link_html,
217
  );
218
 
includes/retro.php CHANGED
@@ -2,77 +2,77 @@
2
 
3
  if ( ! function_exists( 'get_preview_post_link' ) ) :
4
 
5
- /**
6
- * Retrieves the URL used for the post preview.
7
- *
8
- * Allows additional query args to be appended.
9
- *
10
- * @since 4.4.0
11
- *
12
- * @param int|WP_Post $post Optional. Post ID or `WP_Post` object. Defaults to global `$post`.
13
- * @param array $query_args Optional. Array of additional query args to be appended to the link.
14
- * Default empty array.
15
- * @param string $preview_link Optional. Base preview link to be used if it should differ from the
16
- * post permalink. Default empty.
17
- * @return string|null URL used for the post preview, or null if the post does not exist.
18
- */
19
- function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
20
- $post = get_post( $post );
21
- if ( ! $post ) {
22
- return;
23
- }
24
-
25
- $post_type_object = get_post_type_object( $post->post_type );
26
- if ( is_post_type_viewable( $post_type_object ) ) {
27
- if ( ! $preview_link ) {
28
- $preview_link = set_url_scheme( get_permalink( $post ) );
29
- }
30
 
31
- $query_args['preview'] = 'true';
32
- $preview_link = add_query_arg( $query_args, $preview_link );
 
 
33
  }
34
 
35
- /**
36
- * Filters the URL used for a post preview.
37
- *
38
- * @since 2.0.5
39
- * @since 4.0.0 Added the `$post` parameter.
40
- *
41
- * @param string $preview_link URL used for the post preview.
42
- * @param WP_Post $post Post object.
43
- */
44
- return apply_filters( 'preview_post_link', $preview_link, $post );
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  endif;
48
 
49
 
50
  if ( ! function_exists( 'is_post_type_viewable' ) ) :
51
 
52
- /**
53
- * Determines whether a post type is considered "viewable".
54
- *
55
- * For built-in post types such as posts and pages, the 'public' value will be evaluated.
56
- * For all others, the 'publicly_queryable' value will be used.
57
- *
58
- * @since 4.4.0
59
- * @since 4.5.0 Added the ability to pass a post type name in addition to object.
60
- * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.
61
- *
62
- * @param string|WP_Post_Type $post_type Post type name or object.
63
- * @return bool Whether the post type should be considered viewable.
64
- */
65
- function is_post_type_viewable( $post_type ) {
66
- if ( is_scalar( $post_type ) ) {
67
- $post_type = get_post_type_object( $post_type );
68
- if ( ! $post_type ) {
69
- return false;
70
- }
71
  }
72
-
73
- return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
74
  }
75
 
 
 
 
76
  endif;
77
 
78
 
@@ -81,58 +81,58 @@ endif;
81
  */
82
  if ( ! function_exists( 'wp_make_content_images_responsive' ) ) :
83
 
84
- function wp_make_content_images_responsive( $content ) {
85
- return $content;
86
- }
87
 
88
  endif;
89
 
90
 
91
  if ( ! function_exists( 'wp_doing_ajax' ) ) :
92
 
 
 
 
 
 
 
 
 
93
  /**
94
- * Determines whether the current request is a WordPress Ajax request.
95
  *
96
  * @since 4.7.0
97
  *
98
- * @return bool True if it's a WordPress Ajax request, false otherwise.
99
  */
100
- function wp_doing_ajax() {
101
- /**
102
- * Filters whether the current request is a WordPress Ajax request.
103
- *
104
- * @since 4.7.0
105
- *
106
- * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
107
- */
108
- return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
109
- }
110
 
111
  endif;
112
 
113
 
114
  if ( ! function_exists( 'sanitize_hex_color' ) ) :
115
 
116
- /**
117
- * Sanitizes a hex color.
118
- *
119
- * Returns either '', a 3 or 6 digit hex color (with #), or nothing.
120
- * For sanitizing values without a #, see sanitize_hex_color_no_hash().
121
- *
122
- * @since 3.4.0
123
- *
124
- * @param string $color
125
- * @return string|void
126
- */
127
- function sanitize_hex_color( $color ) {
128
- if ( '' === $color ) {
129
- return '';
130
- }
131
 
132
- // 3 or 6 hex digits, or the empty string.
133
- if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
134
- return $color;
135
- }
136
  }
 
137
 
138
  endif;
2
 
3
  if ( ! function_exists( 'get_preview_post_link' ) ) :
4
 
5
+ /**
6
+ * Retrieves the URL used for the post preview.
7
+ *
8
+ * Allows additional query args to be appended.
9
+ *
10
+ * @since 4.4.0
11
+ *
12
+ * @param int|WP_Post $post Optional. Post ID or `WP_Post` object. Defaults to global `$post`.
13
+ * @param array $query_args Optional. Array of additional query args to be appended to the link.
14
+ * Default empty array.
15
+ * @param string $preview_link Optional. Base preview link to be used if it should differ from the
16
+ * post permalink. Default empty.
17
+ * @return string|null URL used for the post preview, or null if the post does not exist.
18
+ */
19
+ function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
20
+ $post = get_post( $post );
21
+ if ( ! $post ) {
22
+ return;
23
+ }
 
 
 
 
 
 
24
 
25
+ $post_type_object = get_post_type_object( $post->post_type );
26
+ if ( is_post_type_viewable( $post_type_object ) ) {
27
+ if ( ! $preview_link ) {
28
+ $preview_link = set_url_scheme( get_permalink( $post ) );
29
  }
30
 
31
+ $query_args['preview'] = 'true';
32
+ $preview_link = add_query_arg( $query_args, $preview_link );
 
 
 
 
 
 
 
 
33
  }
34
 
35
+ /**
36
+ * Filters the URL used for a post preview.
37
+ *
38
+ * @since 2.0.5
39
+ * @since 4.0.0 Added the `$post` parameter.
40
+ *
41
+ * @param string $preview_link URL used for the post preview.
42
+ * @param WP_Post $post Post object.
43
+ */
44
+ return apply_filters( 'preview_post_link', $preview_link, $post );
45
+ }
46
+
47
  endif;
48
 
49
 
50
  if ( ! function_exists( 'is_post_type_viewable' ) ) :
51
 
52
+ /**
53
+ * Determines whether a post type is considered "viewable".
54
+ *
55
+ * For built-in post types such as posts and pages, the 'public' value will be evaluated.
56
+ * For all others, the 'publicly_queryable' value will be used.
57
+ *
58
+ * @since 4.4.0
59
+ * @since 4.5.0 Added the ability to pass a post type name in addition to object.
60
+ * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.
61
+ *
62
+ * @param string|WP_Post_Type $post_type Post type name or object.
63
+ * @return bool Whether the post type should be considered viewable.
64
+ */
65
+ function is_post_type_viewable( $post_type ) {
66
+ if ( is_scalar( $post_type ) ) {
67
+ $post_type = get_post_type_object( $post_type );
68
+ if ( ! $post_type ) {
69
+ return false;
 
70
  }
 
 
71
  }
72
 
73
+ return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
74
+ }
75
+
76
  endif;
77
 
78
 
81
  */
82
  if ( ! function_exists( 'wp_make_content_images_responsive' ) ) :
83
 
84
+ function wp_make_content_images_responsive( $content ) {
85
+ return $content;
86
+ }
87
 
88
  endif;
89
 
90
 
91
  if ( ! function_exists( 'wp_doing_ajax' ) ) :
92
 
93
+ /**
94
+ * Determines whether the current request is a WordPress Ajax request.
95
+ *
96
+ * @since 4.7.0
97
+ *
98
+ * @return bool True if it's a WordPress Ajax request, false otherwise.
99
+ */
100
+ function wp_doing_ajax() {
101
  /**
102
+ * Filters whether the current request is a WordPress Ajax request.
103
  *
104
  * @since 4.7.0
105
  *
106
+ * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
107
  */
108
+ return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
109
+ }
 
 
 
 
 
 
 
 
110
 
111
  endif;
112
 
113
 
114
  if ( ! function_exists( 'sanitize_hex_color' ) ) :
115
 
116
+ /**
117
+ * Sanitizes a hex color.
118
+ *
119
+ * Returns either '', a 3 or 6 digit hex color (with #), or nothing.
120
+ * For sanitizing values without a #, see sanitize_hex_color_no_hash().
121
+ *
122
+ * @since 3.4.0
123
+ *
124
+ * @param string $color
125
+ * @return string|void
126
+ */
127
+ function sanitize_hex_color( $color ) {
128
+ if ( '' === $color ) {
129
+ return '';
130
+ }
131
 
132
+ // 3 or 6 hex digits, or the empty string.
133
+ if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
134
+ return $color;
 
135
  }
136
+ }
137
 
138
  endif;
includes/scripts.php CHANGED
@@ -16,13 +16,11 @@ function wpmtst_scripts() {
16
  *
17
  * @since 2.28.0
18
  */
19
- wp_register_script(
20
- 'wpmtst-controller',
21
- WPMTST_PUBLIC_URL . "js/controller{$min}.js",
22
- array( 'jquery' ),
23
- $plugin_version,
24
- true
25
- );
26
 
27
  /**
28
  * Key : Description
@@ -42,7 +40,7 @@ function wpmtst_scripts() {
42
 
43
  //TODO Use defaults + array_merge instead
44
  $parms = array(
45
- 'initializeOn' => isset( $controller['initialize_on'] ) ? $controller['initialize_on'] : '',
46
  'method' => isset( $ajax['method'] ) ? $ajax['method'] : '',
47
  'universalTimer' => isset( $ajax['universal_timer'] ) ? $ajax['universal_timer'] * 1000 : 0,
48
  'observerTimer' => isset( $ajax['observer_timer'] ) ? $ajax['observer_timer'] * 1000 : 0,
@@ -50,73 +48,61 @@ function wpmtst_scripts() {
50
  'script' => isset( $ajax['script'] ) ? $ajax['script'] : '',
51
  'containerId' => isset( $ajax['container_id'] ) ? $ajax['container_id'] : '',
52
  'addedNodeId' => isset( $ajax['addednode_id'] ) ? $ajax['addednode_id'] : '',
53
- 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_controller', true ),
54
  );
55
  wp_localize_script( 'wpmtst-controller', 'strongControllerParms', $parms );
56
 
57
  /**
58
  * Fonts
59
  */
60
- wp_register_style(
61
- 'wpmtst-font-awesome',
62
- WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
63
- array(),
64
- '4.6.3'
65
- );
66
 
67
  /**
68
  * Simple pagination
69
  */
70
- wp_register_script(
71
- 'wpmtst-pager',
72
- WPMTST_PUBLIC_URL . "js/lib/strongpager/jquery.strongpager{$min}.js",
73
- array( 'jquery', 'imagesloaded' ),
74
- false,
75
- true
76
- );
77
 
78
  /**
79
  * imagesLoaded, if less than WordPress 4.6
80
  */
81
  if ( ! wp_script_is( 'imagesloaded', 'registered' ) ) {
82
- wp_register_script(
83
- 'imagesloaded',
84
- WPMTST_PUBLIC_URL . 'js/lib/imagesloaded/imagesloaded.pkgd.min.js',
85
- array(),
86
- '3.2.0',
87
- true
88
- );
89
  }
90
 
91
  /**
92
  * Masonry
93
  */
94
- wp_register_style(
95
- 'wpmtst-masonry-style',
96
- WPMTST_PUBLIC_URL . 'css/masonry.css',
97
- array(),
98
- $plugin_version
99
- );
100
 
101
  /**
102
  * Columns
103
  */
104
- wp_register_style(
105
- 'wpmtst-columns-style',
106
- WPMTST_PUBLIC_URL . 'css/columns.css',
107
- array(),
108
- $plugin_version
109
- );
110
 
111
  /**
112
  * Grid
113
  */
114
- wp_register_style(
115
- 'wpmtst-grid-style',
116
- WPMTST_PUBLIC_URL . 'css/grid.css',
117
- array(),
118
- $plugin_version
119
- );
120
 
121
  /**
122
  * Ratings
@@ -126,38 +112,30 @@ function wpmtst_scripts() {
126
  $deps = array( 'wpmtst-font-awesome' );
127
  }
128
 
129
- wp_register_style(
130
- 'wpmtst-rating-form',
131
- WPMTST_PUBLIC_URL . 'css/rating-form.css',
132
- $deps,
133
- $plugin_version
134
- );
135
 
136
- wp_register_style(
137
- 'wpmtst-rating-display',
138
- WPMTST_PUBLIC_URL . 'css/rating-display.css',
139
- $deps,
140
- $plugin_version
141
- );
142
 
143
  /**
144
  * Form handling
145
  */
146
- wp_register_script(
147
- 'wpmtst-validation-plugin',
148
- WPMTST_PUBLIC_URL . "js/lib/validate/jquery.validate{$min}.js",
149
- array( 'jquery' ),
150
- '1.16.0',
151
- true
152
- );
153
-
154
- wp_register_script(
155
- 'wpmtst-form-validation',
156
- WPMTST_PUBLIC_URL . "js/lib/form-validation/form-validation{$min}.js",
157
- array( 'wpmtst-validation-plugin', 'jquery-form' ),
158
- $plugin_version,
159
- true
160
- );
161
 
162
  /**
163
  * Localize jQuery Validate plugin.
@@ -182,52 +160,43 @@ function wpmtst_scripts() {
182
  break;
183
  }
184
  }
 
185
  }
186
 
187
  /**
188
  * Slider
189
  */
190
- wp_register_script(
191
- 'jquery-actual',
192
- WPMTST_PUBLIC_URL . "js/lib/actual/jquery.actual{$min}.js",
193
- array( 'jquery' ),
194
- '1.0.16',
195
- true
196
- );
197
-
198
- wp_register_script(
199
- 'verge',
200
- WPMTST_PUBLIC_URL . "js/lib/verge/verge{$min}.js",
201
- array(),
202
- '1.10.2',
203
- true
204
- );
205
-
206
- wp_register_script(
207
- 'wpmtst-slider',
208
- WPMTST_PUBLIC_URL . "js/lib/strongslider/jquery.strongslider{$min}.js",
209
- array( 'jquery-actual', 'imagesloaded', 'underscore', 'verge' ),
210
- $plugin_version,
211
- true
212
- );
213
 
214
  /**
215
  * Read more in place
216
  */
217
- wp_register_script(
218
- 'wpmtst-readmore',
219
- WPMTST_PUBLIC_URL . "js/lib/readmore/readmore{$min}.js",
220
- array(),
221
- $plugin_version,
222
- true
223
- );
224
-
225
- wp_register_style(
226
- 'wpmtst-animate',
227
- WPMTST_PUBLIC_URL . 'css/animate.min.css',
228
- array(),
229
- ''
230
- );
231
 
232
  }
233
  add_action( 'wp_enqueue_scripts', 'wpmtst_scripts' );
16
  *
17
  * @since 2.28.0
18
  */
19
+ wp_register_script( 'wpmtst-controller',
20
+ WPMTST_PUBLIC_URL . "js/controller{$min}.js",
21
+ array( 'jquery' ),
22
+ $plugin_version,
23
+ true );
 
 
24
 
25
  /**
26
  * Key : Description
40
 
41
  //TODO Use defaults + array_merge instead
42
  $parms = array(
43
+ 'initializeOn' => isset( $controller['initialize_on'] ) ? $controller['initialize_on'] : '',
44
  'method' => isset( $ajax['method'] ) ? $ajax['method'] : '',
45
  'universalTimer' => isset( $ajax['universal_timer'] ) ? $ajax['universal_timer'] * 1000 : 0,
46
  'observerTimer' => isset( $ajax['observer_timer'] ) ? $ajax['observer_timer'] * 1000 : 0,
48
  'script' => isset( $ajax['script'] ) ? $ajax['script'] : '',
49
  'containerId' => isset( $ajax['container_id'] ) ? $ajax['container_id'] : '',
50
  'addedNodeId' => isset( $ajax['addednode_id'] ) ? $ajax['addednode_id'] : '',
51
+ 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_controller', true ),
52
  );
53
  wp_localize_script( 'wpmtst-controller', 'strongControllerParms', $parms );
54
 
55
  /**
56
  * Fonts
57
  */
58
+ wp_register_style( 'wpmtst-font-awesome',
59
+ WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
60
+ array(),
61
+ '4.6.3' );
 
 
62
 
63
  /**
64
  * Simple pagination
65
  */
66
+ wp_register_script( 'wpmtst-pager',
67
+ WPMTST_PUBLIC_URL . "js/lib/strongpager/jquery.strongpager{$min}.js",
68
+ array( 'jquery', 'imagesloaded' ),
69
+ false,
70
+ true );
 
 
71
 
72
  /**
73
  * imagesLoaded, if less than WordPress 4.6
74
  */
75
  if ( ! wp_script_is( 'imagesloaded', 'registered' ) ) {
76
+ wp_register_script( 'imagesloaded',
77
+ WPMTST_PUBLIC_URL . 'js/lib/imagesloaded/imagesloaded.pkgd.min.js',
78
+ array(),
79
+ '3.2.0',
80
+ true );
 
 
81
  }
82
 
83
  /**
84
  * Masonry
85
  */
86
+ wp_register_style( 'wpmtst-masonry-style',
87
+ WPMTST_PUBLIC_URL . 'css/masonry.css',
88
+ array(),
89
+ $plugin_version );
 
 
90
 
91
  /**
92
  * Columns
93
  */
94
+ wp_register_style( 'wpmtst-columns-style',
95
+ WPMTST_PUBLIC_URL . 'css/columns.css',
96
+ array(),
97
+ $plugin_version );
 
 
98
 
99
  /**
100
  * Grid
101
  */
102
+ wp_register_style( 'wpmtst-grid-style',
103
+ WPMTST_PUBLIC_URL . 'css/grid.css',
104
+ array(),
105
+ $plugin_version );
 
 
106
 
107
  /**
108
  * Ratings
112
  $deps = array( 'wpmtst-font-awesome' );
113
  }
114
 
115
+ wp_register_style( 'wpmtst-rating-form',
116
+ WPMTST_PUBLIC_URL . 'css/rating-form.css',
117
+ $deps,
118
+ $plugin_version );
 
 
119
 
120
+ wp_register_style( 'wpmtst-rating-display',
121
+ WPMTST_PUBLIC_URL . 'css/rating-display.css',
122
+ $deps,
123
+ $plugin_version );
 
 
124
 
125
  /**
126
  * Form handling
127
  */
128
+ wp_register_script( 'wpmtst-validation-plugin',
129
+ WPMTST_PUBLIC_URL . "js/lib/validate/jquery.validate{$min}.js",
130
+ array( 'jquery' ),
131
+ '1.16.0',
132
+ true );
133
+
134
+ wp_register_script( 'wpmtst-form-validation',
135
+ WPMTST_PUBLIC_URL . "js/lib/form-validation/form-validation{$min}.js",
136
+ array( 'wpmtst-validation-plugin', 'jquery-form' ),
137
+ $plugin_version,
138
+ true );
 
 
 
 
139
 
140
  /**
141
  * Localize jQuery Validate plugin.
160
  break;
161
  }
162
  }
163
+
164
  }
165
 
166
  /**
167
  * Slider
168
  */
169
+ wp_register_script( 'jquery-actual',
170
+ WPMTST_PUBLIC_URL . "js/lib/actual/jquery.actual{$min}.js",
171
+ array( 'jquery' ),
172
+ '1.0.16',
173
+ true );
174
+
175
+ wp_register_script( 'verge',
176
+ WPMTST_PUBLIC_URL . "js/lib/verge/verge{$min}.js",
177
+ array(),
178
+ '1.10.2',
179
+ true );
180
+
181
+ wp_register_script( 'wpmtst-slider',
182
+ WPMTST_PUBLIC_URL . "js/lib/strongslider/jquery.strongslider{$min}.js",
183
+ array( 'jquery-actual', 'imagesloaded', 'underscore', 'verge' ),
184
+ $plugin_version,
185
+ true );
 
 
 
 
 
 
186
 
187
  /**
188
  * Read more in place
189
  */
190
+ wp_register_script( 'wpmtst-readmore',
191
+ WPMTST_PUBLIC_URL . "js/lib/readmore/readmore{$min}.js",
192
+ array(),
193
+ $plugin_version,
194
+ true );
195
+
196
+ wp_register_style( 'wpmtst-animate',
197
+ WPMTST_PUBLIC_URL . 'css/animate.min.css',
198
+ array(),
199
+ '' );
 
 
 
 
200
 
201
  }
202
  add_action( 'wp_enqueue_scripts', 'wpmtst_scripts' );
includes/widget2.php CHANGED
@@ -9,9 +9,9 @@ class Strong_Testimonials_View_Widget extends WP_Widget {
9
 
10
  function __construct() {
11
 
12
- $widget_ops = array(
13
  'classname' => 'strong-testimonials-view-widget',
14
- 'description' => _x( 'Add one of your testimonial views.', 'widget description', 'strong-testimonials' ),
15
  );
16
  $control_ops = array(
17
  'id_base' => 'strong-testimonials-view-widget',
@@ -24,10 +24,10 @@ class Strong_Testimonials_View_Widget extends WP_Widget {
24
  );
25
 
26
  $this->defaults = array(
27
- 'title' => _x( 'Testimonials', 'widget title', 'strong-testimonials' ),
28
- 'text' => '',
29
- 'filter' => 0,
30
- 'view' => '0',
31
  );
32
 
33
  }
@@ -37,17 +37,16 @@ class Strong_Testimonials_View_Widget extends WP_Widget {
37
  $title = apply_filters( 'widget_title', empty( $data['title'] ) ? '' : $data['title'], $instance, $this->id_base );
38
 
39
  $widget_text = ! empty( $data['text'] ) ? $data['text'] : '';
40
- $text = apply_filters( 'widget_text', $widget_text, $data, $this );
41
 
42
- echo wp_kses_post( $data['before_widget'] );
43
 
44
- if ( ! empty( $title ) ) {
45
- echo wp_kses_post( $data['before_title'] . $title . $data['after_title'] );
46
- }
47
 
48
  if ( ! empty( $text ) ) {
49
  ?>
50
- <div class="textwidget"><?php echo ! empty( $data['filter'] ) ? wp_kses_post( wpautop( $text ) ) : wp_kses_post( $text ); ?></div>
51
  <?php
52
  }
53
 
@@ -61,41 +60,43 @@ class Strong_Testimonials_View_Widget extends WP_Widget {
61
  */
62
  ob_start();
63
  strong_testimonials_view( $instance['view'] );
64
- echo wp_kses_post( apply_filters( 'wpmtst_widget_text', ob_get_clean() ) );
65
  }
66
 
67
- echo wp_kses_post( $data['after_widget'] );
68
  }
69
 
70
  function form( $instance ) {
71
  $instance = wp_parse_args( (array) $instance, $this->defaults );
72
- $filter = isset( $instance['filter'] ) ? $instance['filter'] : 0;
73
- $title = sanitize_text_field( $instance['title'] );
74
- $views = wpmtst_get_views();
75
  ?>
76
  <div class="wpmtst-widget-form">
77
  <p>
78
- <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
79
- <?php esc_html_e( 'Title:' ); ?>
80
  </label>
81
- <input class="widefat" type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>">
 
82
  </p>
83
  <p>
84
- <label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Content:' ); ?></label>
85
- <textarea class="widefat" rows="8" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea>
86
  </p>
87
  <p>
88
- <input id="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'filter' ) ); ?>" type="checkbox"<?php checked( $filter ); ?> />&nbsp;<label for="<?php echo esc_attr( $this->get_field_id( 'filter' ) ); ?>"><?php esc_html_e( 'Automatically add paragraphs to above Content only', 'strong-testimonials' ); ?></label>
89
  </p>
90
  <p>
91
- <label for="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>">
92
- <?php echo esc_html_x( 'View:', 'widget setting', 'strong-testimonials' ); ?>
93
  </label>
94
- <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'view' ) ); ?>" autocomplete="off">
95
- <option value=""><?php esc_html_e( '&mdash; Select &mdash;' ); ?></option>
 
96
  <?php
97
  foreach ( $views as $view ) {
98
- printf( '<option value="%s" %s>%s</option>', esc_attr( $view['id'] ), selected( $view['id'], $instance['view'] ), esc_html( $view['name'] ) );
99
  }
100
  ?>
101
  </select>
@@ -105,14 +106,15 @@ class Strong_Testimonials_View_Widget extends WP_Widget {
105
  }
106
 
107
  function update( $new_instance, $old_instance ) {
108
- $instance = $old_instance;
109
  $instance['title'] = sanitize_text_field( $new_instance['title'] );
110
  if ( current_user_can( 'unfiltered_html' ) ) {
111
  $instance['text'] = $new_instance['text'];
112
- } else {
 
113
  $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
114
  }
115
- $instance['filter'] = ! empty( $new_instance['filter'] );
116
  $instance['view'] = sanitize_text_field( $new_instance['view'] );
117
  return array_merge( $this->defaults, $instance );
118
  }
9
 
10
  function __construct() {
11
 
12
+ $widget_ops = array(
13
  'classname' => 'strong-testimonials-view-widget',
14
+ 'description' => _x( 'Add one of your testimonial views.', 'widget description', 'strong-testimonials' )
15
  );
16
  $control_ops = array(
17
  'id_base' => 'strong-testimonials-view-widget',
24
  );
25
 
26
  $this->defaults = array(
27
+ 'title' => _x( 'Testimonials', 'widget title', 'strong-testimonials' ),
28
+ 'text' => '',
29
+ 'filter' => 0,
30
+ 'view' => '0',
31
  );
32
 
33
  }
37
  $title = apply_filters( 'widget_title', empty( $data['title'] ) ? '' : $data['title'], $instance, $this->id_base );
38
 
39
  $widget_text = ! empty( $data['text'] ) ? $data['text'] : '';
40
+ $text = apply_filters( 'widget_text', $widget_text, $data, $this );
41
 
42
+ echo $data['before_widget'];
43
 
44
+ if ( ! empty( $title ) )
45
+ echo $data['before_title'] . $title . $data['after_title'];
 
46
 
47
  if ( ! empty( $text ) ) {
48
  ?>
49
+ <div class="textwidget"><?php echo !empty( $data['filter'] ) ? wpautop( $text ) : $text; ?></div>
50
  <?php
51
  }
52
 
60
  */
61
  ob_start();
62
  strong_testimonials_view( $instance['view'] );
63
+ echo apply_filters( 'wpmtst_widget_text', ob_get_clean() );
64
  }
65
 
66
+ echo $data['after_widget'];
67
  }
68
 
69
  function form( $instance ) {
70
  $instance = wp_parse_args( (array) $instance, $this->defaults );
71
+ $filter = isset( $instance['filter'] ) ? $instance['filter'] : 0;
72
+ $title = sanitize_text_field( $instance['title'] );
73
+ $views = wpmtst_get_views();
74
  ?>
75
  <div class="wpmtst-widget-form">
76
  <p>
77
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>">
78
+ <?php _e( 'Title:' ); ?>
79
  </label>
80
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>"
81
+ name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>">
82
  </p>
83
  <p>
84
+ <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
85
+ <textarea class="widefat" rows="8" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea>
86
  </p>
87
  <p>
88
+ <input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox"<?php checked( $filter ); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e( 'Automatically add paragraphs to above Content only', 'strong-testimonials' ); ?></label>
89
  </p>
90
  <p>
91
+ <label for="<?php echo $this->get_field_id( 'view' ); ?>">
92
+ <?php _ex( 'View:', 'widget setting', 'strong-testimonials' ); ?>
93
  </label>
94
+ <select class="widefat" id="<?php echo $this->get_field_id( 'view' ); ?>"
95
+ name="<?php echo $this->get_field_name( 'view' ); ?>" autocomplete="off">
96
+ <option value=""><?php _e( '&mdash; Select &mdash;' ); ?></option>
97
  <?php
98
  foreach ( $views as $view ) {
99
+ printf( '<option value="%s" %s>%s</option>', $view['id'], selected( $view['id'], $instance['view'] ), $view['name'] );
100
  }
101
  ?>
102
  </select>
106
  }
107
 
108
  function update( $new_instance, $old_instance ) {
109
+ $instance = $old_instance;
110
  $instance['title'] = sanitize_text_field( $new_instance['title'] );
111
  if ( current_user_can( 'unfiltered_html' ) ) {
112
  $instance['text'] = $new_instance['text'];
113
+ }
114
+ else {
115
  $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
116
  }
117
+ $instance['filter'] = !empty( $new_instance['filter'] );
118
  $instance['view'] = sanitize_text_field( $new_instance['view'] );
119
  return array_merge( $this->defaults, $instance );
120
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: testimonials, testimonial slider, testimonial form, star ratings
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.1
7
- Stable tag: 2.35
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -190,4 +190,4 @@ New adjustable responsive breakpoints for carousels.
190
  Fix stretched slide height in carousel.
191
 
192
  = 2.32.4 =
193
- Improved compatibility with WordPress Custom HTML widgets.
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.1
7
+ Stable tag: 2.36
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
190
  Fix stretched slide height in carousel.
191
 
192
  = 2.32.4 =
193
+ Improved compatibility with WordPress Custom HTML widgets.
strong-testimonials.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
- * Version: 2.35
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  exit;
45
  }
46
 
47
- define( 'WPMTST_VERSION', '2.35' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  define( 'STRONGPLUGINS_STORE_URL', '#' );
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
+ * Version: 2.36
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
44
  exit;
45
  }
46
 
47
+ define( 'WPMTST_VERSION', '2.36' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  define( 'STRONGPLUGINS_STORE_URL', '#' );
templates/default-form/form.php CHANGED
@@ -10,25 +10,25 @@
10
 
11
  <div id="wpmtst-form">
12
 
13
- <div class="strong-form-inner">
14
 
15
- <?php wpmtst_field_required_notice(); ?>
16
 
17
- <form <?php wpmtst_form_info(); ?>>
18
 
19
- <?php wpmtst_form_setup(); ?>
20
 
21
- <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
- <?php wpmtst_all_form_fields(); ?>
24
 
25
- <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
- <?php wpmtst_form_submit_button(); ?>
28
 
29
- </form>
30
 
31
- </div>
32
 
33
  </div>
34
 
10
 
11
  <div id="wpmtst-form">
12
 
13
+ <div class="strong-form-inner">
14
 
15
+ <?php wpmtst_field_required_notice(); ?>
16
 
17
+ <form <?php wpmtst_form_info(); ?>>
18
 
19
+ <?php wpmtst_form_setup(); ?>
20
 
21
+ <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
+ <?php wpmtst_all_form_fields(); ?>
24
 
25
+ <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
+ <?php wpmtst_form_submit_button(); ?>
28
 
29
+ </form>
30
 
31
+ </div>
32
 
33
  </div>
34
 
templates/simple-form/form.php CHANGED
@@ -10,25 +10,25 @@
10
 
11
  <div id="wpmtst-form">
12
 
13
- <div class="strong-form-inner">
14
 
15
- <?php wpmtst_field_required_notice(); ?>
16
 
17
- <form <?php wpmtst_form_info(); ?>>
18
 
19
- <?php wpmtst_form_setup(); ?>
20
 
21
- <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
- <?php wpmtst_all_form_fields(); ?>
24
 
25
- <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
- <?php wpmtst_form_submit_button(); ?>
28
 
29
- </form>
30
 
31
- </div>
32
 
33
  </div>
34
 
10
 
11
  <div id="wpmtst-form">
12
 
13
+ <div class="strong-form-inner">
14
 
15
+ <?php wpmtst_field_required_notice(); ?>
16
 
17
+ <form <?php wpmtst_form_info(); ?>>
18
 
19
+ <?php wpmtst_form_setup(); ?>
20
 
21
+ <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
+ <?php wpmtst_all_form_fields(); ?>
24
 
25
+ <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
+ <?php wpmtst_form_submit_button(); ?>
28
 
29
+ </form>
30
 
31
+ </div>
32
 
33
  </div>
34
 
templates/unstyled-form/form.php CHANGED
@@ -10,25 +10,25 @@
10
 
11
  <div id="wpmtst-form">
12
 
13
- <div class="strong-form-inner">
14
 
15
- <?php wpmtst_field_required_notice(); ?>
16
 
17
- <form <?php wpmtst_form_info(); ?>>
18
 
19
- <?php wpmtst_form_setup(); ?>
20
 
21
- <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
- <?php wpmtst_all_form_fields(); ?>
24
 
25
- <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
- <?php wpmtst_form_submit_button(); ?>
28
 
29
- </form>
30
 
31
- </div>
32
 
33
  </div>
34
 
10
 
11
  <div id="wpmtst-form">
12
 
13
+ <div class="strong-form-inner">
14
 
15
+ <?php wpmtst_field_required_notice(); ?>
16
 
17
+ <form <?php wpmtst_form_info(); ?>>
18
 
19
+ <?php wpmtst_form_setup(); ?>
20
 
21
+ <?php do_action( 'wpmtst_form_before_fields' ); ?>
22
 
23
+ <?php wpmtst_all_form_fields(); ?>
24
 
25
+ <?php do_action( 'wpmtst_form_after_fields' ); ?>
26
 
27
+ <?php wpmtst_form_submit_button(); ?>
28
 
29
+ </form>
30
 
31
+ </div>
32
 
33
  </div>
34