Strong Testimonials - Version 2.39.3

Version Description

Download this release

Release Info

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

Code changes from version 2.39.2 to 2.39.3

Files changed (125) hide show
  1. admin/about/addons.php +23 -23
  2. admin/about/class-strong-testimonials-about.php +100 -100
  3. admin/about/how-to.php +41 -41
  4. admin/about/links.php +21 -21
  5. admin/about/privacy.php +13 -13
  6. admin/about/upsell.php +10 -10
  7. admin/about/whats-new.php +107 -107
  8. admin/admin-notices.php +178 -178
  9. admin/admin.php +320 -320
  10. admin/class-strong-testimonials-addons.php +132 -132
  11. admin/class-strong-testimonials-admin-category-list.php +69 -69
  12. admin/class-strong-testimonials-admin-list.php +331 -331
  13. admin/class-strong-testimonials-admin-scripts.php +406 -406
  14. admin/class-strong-testimonials-defaults.php +830 -830
  15. admin/class-strong-testimonials-exporter.php +80 -80
  16. admin/class-strong-testimonials-help.php +226 -226
  17. admin/class-strong-testimonials-list-table.php +1211 -1211
  18. admin/class-strong-testimonials-page-shortcodes.php +336 -336
  19. admin/class-strong-testimonials-post-editor.php +368 -368
  20. admin/class-strong-testimonials-updater.php +1293 -1293
  21. admin/class-strong-testimonials-upsell.php +303 -301
  22. admin/class-strong-views-list-table.php +229 -229
  23. admin/class-walker-strong-category-checklist.php +127 -127
  24. admin/class-walker-strong-form-category-checklist.php +127 -127
  25. admin/compat.php +116 -116
  26. admin/css/about.css +53 -53
  27. admin/css/admin-compat.css +178 -178
  28. admin/css/admin-form.css +138 -138
  29. admin/css/fields.css +317 -317
  30. admin/css/form-preview.css +135 -135
  31. admin/css/number-spinner.css +98 -98
  32. admin/css/order.css +102 -102
  33. admin/css/polylang.css +7 -7
  34. admin/css/post-editor.css +111 -111
  35. admin/css/views.css +1009 -1012
  36. admin/css/wpml.css +31 -31
  37. admin/custom-fields-ajax.php +99 -99
  38. admin/custom-fields.php +517 -517
  39. admin/form-preview.php +51 -51
  40. admin/img/logo-long.svg +91 -91
  41. admin/js/addon-licenses.js +79 -79
  42. admin/js/admin-compat.js +130 -130
  43. admin/js/admin-fields.js +603 -603
  44. admin/js/admin-form.js +164 -164
  45. admin/js/admin-global.js +26 -26
  46. admin/js/admin-order.js +128 -128
  47. admin/js/custom-spinner.js +81 -81
  48. admin/js/help.js +22 -22
  49. admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -192
  50. admin/js/lib/autosize/autosize.min.js +5 -5
  51. admin/js/rating-edit.js +85 -85
  52. admin/js/view-category-filter.js +47 -47
  53. admin/js/views.js +1346 -1346
  54. admin/menu/class-strong-testimonials-menu-fields.php +55 -55
  55. admin/menu/class-strong-testimonials-menu-settings.php +57 -57
  56. admin/menu/class-strong-testimonials-menu-shortcodes.php +55 -55
  57. admin/menu/class-strong-testimonials-menu-views.php +55 -55
  58. admin/menu/class-strong-testimonials-menu.php +51 -51
  59. admin/partials/fields/field-controls.php +12 -12
  60. admin/partials/fields/field-header.php +13 -13
  61. admin/partials/fields/field-label.php +15 -15
  62. admin/partials/fields/field-name.php +22 -22
  63. admin/partials/fields/field-text.php +14 -14
  64. admin/partials/fields/field-type.php +77 -77
  65. admin/partials/templates/form-preview-template.php +26 -26
  66. admin/partials/views/group-compat.php +17 -17
  67. admin/partials/views/group-extra.php +24 -24
  68. admin/partials/views/group-fields.php +75 -75
  69. admin/partials/views/group-form.php +24 -24
  70. admin/partials/views/group-query.php +44 -44
  71. admin/partials/views/group-slideshow.php +30 -30
  72. admin/partials/views/group-style.php +51 -51
  73. admin/partials/views/option-background.php +150 -150
  74. admin/partials/views/option-boilerplate.php +39 -39
  75. admin/partials/views/option-category.php +56 -56
  76. admin/partials/views/option-classes.php +14 -14
  77. admin/partials/views/option-client-section.php +29 -29
  78. admin/partials/views/option-color.php +57 -57
  79. admin/partials/views/option-content.php +226 -226
  80. admin/partials/views/option-divi.php +24 -24
  81. admin/partials/views/option-form-ajax.php +13 -13
  82. admin/partials/views/option-form-category.php +28 -28
  83. admin/partials/views/option-id.php +23 -23
  84. admin/partials/views/option-layout.php +147 -147
  85. admin/partials/views/option-limit.php +33 -33
  86. admin/partials/views/option-order.php +26 -26
  87. admin/partials/views/option-pagination.php +166 -166
  88. admin/partials/views/option-read-more-page.php +88 -88
  89. admin/partials/views/option-select.php +29 -29
  90. admin/partials/views/option-slideshow-behavior.php +93 -93
  91. admin/partials/views/option-slideshow-breakpoints.php +95 -95
  92. admin/partials/views/option-slideshow-navigation.php +104 -104
  93. admin/partials/views/option-slideshow-num.php +8 -8
  94. admin/partials/views/option-slideshow-transition.php +46 -46
  95. admin/partials/views/option-slideshow-type.php +19 -19
  96. admin/partials/views/option-template-list.php +27 -27
  97. admin/partials/views/option-thumbnail.php +91 -91
  98. admin/partials/views/option-title.php +20 -20
  99. admin/partials/views/template-input.php +8 -8
  100. admin/partials/views/template-not-found.php +25 -25
  101. admin/partials/views/template-options.php +80 -81
  102. admin/partials/views/view-mode.php +18 -18
  103. admin/partials/views/view-name.php +17 -17
  104. admin/partials/views/view-shortcode.php +32 -32
  105. admin/scss/_partials/_background.scss +30 -30
  106. admin/scss/_partials/_category-checkboxes.scss +19 -19
  107. admin/scss/_partials/_category-filter.scss +58 -58
  108. admin/scss/_partials/_checkbox-icons.scss +52 -52
  109. admin/scss/_partials/_custom-fields.scss +169 -169
  110. admin/scss/_partials/_elements.scss +93 -93
  111. admin/scss/_partials/_form-table.scss +98 -98
  112. admin/scss/_partials/_help-tab.scss +50 -50
  113. admin/scss/_partials/_inner-table.scss +31 -31
  114. admin/scss/_partials/_inputs.scss +48 -48
  115. admin/scss/_partials/_layout-example-columns.scss +42 -42
  116. admin/scss/_partials/_layout-example-grid.scss +33 -33
  117. admin/scss/_partials/_layout-example-masonry.scss +22 -22
  118. admin/scss/_partials/_layout-examples.scss +40 -40
  119. admin/scss/_partials/_layout.scss +15 -15
  120. admin/scss/_partials/_list-radio-buttons.scss +133 -139
  121. admin/scss/_partials/_misc.scss +88 -88
  122. admin/scss/_partials/_screenshots.scss +10 -10
  123. admin/scss/_partials/_sticky-views.scss +48 -48
  124. admin/scss/_partials/_structure.scss +41 -41
  125. admin/scss/_partials/_template.scss +0 -0
admin/about/addons.php CHANGED
@@ -1,23 +1,23 @@
1
- <hr />
2
-
3
- <!-- <div id="addons" class="feature-section three-col">
4
- <div class="col sidebar-block sidebar-news addon multiple-forms">
5
- <h3></h3>
6
- <p></p>
7
- <div class="actions">
8
- <a href="" target="_blank">Learn more</a>
9
- </div>
10
- </div>
11
- <div class="col sidebar-block sidebar-news addon properties">
12
- <h3></h3>
13
- <p></p>
14
- <div class="actions">
15
- </div>
16
- </div>
17
- <div class="col sidebar-block sidebar-news addon assignment">
18
- <h3></h3>
19
- <p></p>
20
- <div class="actions">
21
- </div>
22
- </div>
23
- </div> -->
1
+ <hr />
2
+
3
+ <!-- <div id="addons" class="feature-section three-col">
4
+ <div class="col sidebar-block sidebar-news addon multiple-forms">
5
+ <h3></h3>
6
+ <p></p>
7
+ <div class="actions">
8
+ <a href="" target="_blank">Learn more</a>
9
+ </div>
10
+ </div>
11
+ <div class="col sidebar-block sidebar-news addon properties">
12
+ <h3></h3>
13
+ <p></p>
14
+ <div class="actions">
15
+ </div>
16
+ </div>
17
+ <div class="col sidebar-block sidebar-news addon assignment">
18
+ <h3></h3>
19
+ <p></p>
20
+ <div class="actions">
21
+ </div>
22
+ </div>
23
+ </div> -->
admin/about/class-strong-testimonials-about.php CHANGED
@@ -1,100 +1,100 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_About
4
- *
5
- * @since 2.27.0
6
- */
7
- class Strong_Testimonials_About {
8
-
9
- /**
10
- * Strong_Testimonials_About constructor.
11
- */
12
- public function __construct() {
13
- $this->add_actions();
14
- }
15
-
16
- /**
17
- * Add actions and filters.
18
- */
19
- public function add_actions() {
20
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
- }
22
-
23
- /**
24
- * Add submenu page.
25
- *
26
- * @param $pages
27
- *
28
- * @return mixed
29
- */
30
- public function add_submenu( $pages ) {
31
- $pages[90] = $this->get_submenu();
32
- return $pages;
33
- }
34
-
35
- /**
36
- * Return submenu page parameters.
37
- *
38
- * @return array
39
- */
40
- public function get_submenu() {
41
- return array(
42
- 'page_title' => __( 'About', 'strong-testimonials' ),
43
- 'menu_title' => __( 'About', 'strong-testimonials' ),
44
- 'capability' => 'strong_testimonials_about',
45
- 'menu_slug' => 'about-strong-testimonials',
46
- 'function' => array( $this, 'about_page' ),
47
- );
48
- }
49
-
50
- /**
51
- * Print the About page.
52
- */
53
- public function about_page() {
54
- $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
55
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
56
- ?>
57
- <div class="wrap about-wrap">
58
-
59
- <img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
60
-
61
- <?php /* translators: %s is the plugin version number */ ?>
62
- <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), WPMTST_VERSION ); ?></h1>
63
-
64
- <p class="about-text">
65
- <?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
66
- <?php /* translators: %s is the plugin version number */ ?>
67
- </p>
68
- <br/>
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
- <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', 'strong-testimonials' ); ?></a>
74
-
75
- </h2>
76
-
77
-
78
- <?php
79
- switch( $active_tab ) {
80
- case 'privacy':
81
- include WPMTST_ADMIN . 'about/privacy.php';
82
- break;
83
- default:
84
- include WPMTST_ADMIN . 'about/how-to.php';
85
- break;
86
- }
87
-
88
- include WPMTST_ADMIN . 'about/upsell.php';
89
- include WPMTST_ADMIN . 'about/links.php';
90
- include WPMTST_ADMIN . 'about/addons.php';
91
- ?>
92
-
93
- </div>
94
- <?php
95
- }
96
-
97
-
98
- }
99
-
100
- new Strong_Testimonials_About();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_About
4
+ *
5
+ * @since 2.27.0
6
+ */
7
+ class Strong_Testimonials_About {
8
+
9
+ /**
10
+ * Strong_Testimonials_About constructor.
11
+ */
12
+ public function __construct() {
13
+ $this->add_actions();
14
+ }
15
+
16
+ /**
17
+ * Add actions and filters.
18
+ */
19
+ public function add_actions() {
20
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
+ }
22
+
23
+ /**
24
+ * Add submenu page.
25
+ *
26
+ * @param $pages
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function add_submenu( $pages ) {
31
+ $pages[90] = $this->get_submenu();
32
+ return $pages;
33
+ }
34
+
35
+ /**
36
+ * Return submenu page parameters.
37
+ *
38
+ * @return array
39
+ */
40
+ public function get_submenu() {
41
+ return array(
42
+ 'page_title' => __( 'About', 'strong-testimonials' ),
43
+ 'menu_title' => __( 'About', 'strong-testimonials' ),
44
+ 'capability' => 'strong_testimonials_about',
45
+ 'menu_slug' => 'about-strong-testimonials',
46
+ 'function' => array( $this, 'about_page' ),
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Print the About page.
52
+ */
53
+ public function about_page() {
54
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
55
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
56
+ ?>
57
+ <div class="wrap about-wrap">
58
+
59
+ <img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
60
+
61
+ <?php /* translators: %s is the plugin version number */ ?>
62
+ <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), WPMTST_VERSION ); ?></h1>
63
+
64
+ <p class="about-text">
65
+ <?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
66
+ <?php /* translators: %s is the plugin version number */ ?>
67
+ </p>
68
+ <br/>
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
+ <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', 'strong-testimonials' ); ?></a>
74
+
75
+ </h2>
76
+
77
+
78
+ <?php
79
+ switch( $active_tab ) {
80
+ case 'privacy':
81
+ include WPMTST_ADMIN . 'about/privacy.php';
82
+ break;
83
+ default:
84
+ include WPMTST_ADMIN . 'about/how-to.php';
85
+ break;
86
+ }
87
+
88
+ include WPMTST_ADMIN . 'about/upsell.php';
89
+ include WPMTST_ADMIN . 'about/links.php';
90
+ include WPMTST_ADMIN . 'about/addons.php';
91
+ ?>
92
+
93
+ </div>
94
+ <?php
95
+ }
96
+
97
+
98
+ }
99
+
100
+ new Strong_Testimonials_About();
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 _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 has-4-columns is-fullwidth four-col">
8
- <div class="col column">
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 column">
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 column">
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 column">
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>
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 has-4-columns is-fullwidth four-col">
8
+ <div class="col column">
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 column">
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 column">
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 column">
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,21 +1,21 @@
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>
20
-
21
- </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>
20
+
21
+ </div>
admin/about/privacy.php CHANGED
@@ -1,13 +1,13 @@
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>
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/about/upsell.php CHANGED
@@ -1,10 +1,10 @@
1
- <div class="wpmtst-notice wpmtst-notice--upsell">
2
- <div class="wpmtst-notice--upsell__bg"></div>
3
- <h3><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h3>
4
- <p>
5
- <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
6
- <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
7
- </p>
8
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=about-page-upsell' ); ?>""><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
9
- <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-addons' ) ); ?>"><?php esc_html_e( 'View Extensions', 'strong-testimonials' ); ?></a>
10
- </div>
1
+ <div class="wpmtst-notice wpmtst-notice--upsell">
2
+ <div class="wpmtst-notice--upsell__bg"></div>
3
+ <h3><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h3>
4
+ <p>
5
+ <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
6
+ <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
7
+ </p>
8
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=about-page-upsell' ); ?>""><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
9
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-addons' ) ); ?>"><?php esc_html_e( 'View Extensions', 'strong-testimonials' ); ?></a>
10
+ </div>
admin/about/whats-new.php CHANGED
@@ -1,107 +1,107 @@
1
-
2
- <h2>Now Even Stronger</h2>
3
-
4
- <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
-
6
- <div class="feature-section one-col">
7
- <div class="col">
8
- <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
- </div>
10
- </div>
11
-
12
- <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
-
14
- <div class="feature-section one-col">
15
- <div class="col">
16
- <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
- <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
- <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
- <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
- <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
- <div class="feature-section-sub">
22
-
23
- <h3 class="heading">Point Releases</h3>
24
-
25
- <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
-
27
- <ul>
28
- <li>Version 2.31.1</li>
29
- <li>Version 2.31.2</li>
30
- <li>Version 2.31.3</li>
31
- <li>Version 2.31.4</li>
32
- <li>Version 2.31.5</li>
33
- <li>Version 2.31.6</li>
34
- <li>Version 2.31.7</li>
35
- <li>Version 2.31.8</li>
36
- <li>Version 2.31.9</li>
37
- <li>Version 2.31.10</li>
38
- </ul>
39
-
40
- </div>
41
- </div>
42
- </div>
43
-
44
- <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
-
46
- <div class="feature-section one-col">
47
- <div class="col">
48
- <p>NEW: Option to select the font color in views. Finally!</p>
49
- <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
- <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
- <p>NEW: Using the WordPress email validation function for increased security.</p>
52
- <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
- <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
- <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
- <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
- <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
-
58
- <div class="feature-section-sub">
59
-
60
- <h3 class="heading">Point Releases</h3>
61
-
62
- <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
-
64
- <ul>
65
- <li>Version 2.30.1</li>
66
- <li>Version 2.30.2</li>
67
- <li>Version 2.30.3</li>
68
- <li>Version 2.30.4</li>
69
- <li>Version 2.30.5</li>
70
- <li>Version 2.30.6</li>
71
- <li>Version 2.30.7</li>
72
- <li>Version 2.30.8</li>
73
- <li>Version 2.30.9</li>
74
- </ul>
75
-
76
- </div>
77
- </div>
78
- </div>
79
-
80
- <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
-
82
- <div class="feature-section one-col">
83
- <div class="col">
84
- <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
- <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
- <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
- <p>FIXED: The notification email now displays a category name properly.</p>
88
- <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
- <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
- <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
- </div>
92
- </div>
93
-
94
- <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
-
96
- <div class="feature-section one-col">
97
- <div class="col">
98
- <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
- <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
- <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
- <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
- <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
- <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
- <p>FIXED: Capabilities check in multisite.</p>
105
- <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
- </div>
107
- </div>
1
+
2
+ <h2>Now Even Stronger</h2>
3
+
4
+ <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
+
6
+ <div class="feature-section one-col">
7
+ <div class="col">
8
+ <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
+ </div>
10
+ </div>
11
+
12
+ <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
+
14
+ <div class="feature-section one-col">
15
+ <div class="col">
16
+ <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
+ <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
+ <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
+ <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
+ <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
+ <div class="feature-section-sub">
22
+
23
+ <h3 class="heading">Point Releases</h3>
24
+
25
+ <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
+
27
+ <ul>
28
+ <li>Version 2.31.1</li>
29
+ <li>Version 2.31.2</li>
30
+ <li>Version 2.31.3</li>
31
+ <li>Version 2.31.4</li>
32
+ <li>Version 2.31.5</li>
33
+ <li>Version 2.31.6</li>
34
+ <li>Version 2.31.7</li>
35
+ <li>Version 2.31.8</li>
36
+ <li>Version 2.31.9</li>
37
+ <li>Version 2.31.10</li>
38
+ </ul>
39
+
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
+
46
+ <div class="feature-section one-col">
47
+ <div class="col">
48
+ <p>NEW: Option to select the font color in views. Finally!</p>
49
+ <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
+ <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
+ <p>NEW: Using the WordPress email validation function for increased security.</p>
52
+ <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
+ <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
+ <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
+ <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
+ <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
+
58
+ <div class="feature-section-sub">
59
+
60
+ <h3 class="heading">Point Releases</h3>
61
+
62
+ <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
+
64
+ <ul>
65
+ <li>Version 2.30.1</li>
66
+ <li>Version 2.30.2</li>
67
+ <li>Version 2.30.3</li>
68
+ <li>Version 2.30.4</li>
69
+ <li>Version 2.30.5</li>
70
+ <li>Version 2.30.6</li>
71
+ <li>Version 2.30.7</li>
72
+ <li>Version 2.30.8</li>
73
+ <li>Version 2.30.9</li>
74
+ </ul>
75
+
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
+
82
+ <div class="feature-section one-col">
83
+ <div class="col">
84
+ <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
+ <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
+ <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
+ <p>FIXED: The notification email now displays a category name properly.</p>
88
+ <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
+ <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
+ <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
+ </div>
92
+ </div>
93
+
94
+ <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
+
96
+ <div class="feature-section one-col">
97
+ <div class="col">
98
+ <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
+ <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
+ <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
+ <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
+ <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
+ <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
+ <p>FIXED: Capabilities check in multisite.</p>
105
+ <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
+ </div>
107
+ </div>
admin/admin-notices.php CHANGED
@@ -1,178 +1,178 @@
1
- <?php
2
- /**
3
- * Admin notices
4
- */
5
-
6
-
7
- /**
8
- * Dismiss persistent notices.
9
- *
10
- * @since 2.29.0
11
- */
12
- function wpmtst_dismiss_notice_ajax() {
13
- if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
- echo 0;
15
- wp_die();
16
- }
17
-
18
- check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
- wpmtst_delete_admin_notice( $_POST['key'] );
20
- wp_die();
21
- }
22
-
23
- add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
-
25
- /**
26
- * Print admin notices.
27
- *
28
- * @since 2.24.0
29
- */
30
- function wpmtst_admin_notices() {
31
- $notices = get_option( 'wpmtst_admin_notices' );
32
- if ( ! $notices ) {
33
- return;
34
- }
35
-
36
- foreach ( $notices as $key => $notice ) {
37
- $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
- if ( $message ) {
39
- echo $message;
40
- }
41
- if ( ! $notice['persist'] ) {
42
- wpmtst_delete_admin_notice( $key );
43
- }
44
- }
45
- }
46
- add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
-
48
-
49
- /**
50
- * Return specific admin notice text.
51
- *
52
- * @since 2.28.5
53
- * @param string $html
54
- * @param $key
55
- *
56
- * @return string
57
- */
58
- function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
-
60
- switch ( $key ) {
61
- case 'defaults-restored' :
62
- ob_start();
63
- ?>
64
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
- <p>
66
- <?php _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 _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 _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 echo esc_attr( $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
-
119
- return $html;
120
- }
121
- add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
-
123
-
124
- /**
125
- * Add admin notice to queue.
126
- *
127
- * @since 2.24.0
128
- *
129
- * @param $key
130
- * @param $persist
131
- */
132
- function wpmtst_add_admin_notice( $key, $persist = false ) {
133
- $notices = get_option( 'wpmtst_admin_notices', array() );
134
- $notices[ $key ] = array( 'persist' => $persist );
135
- update_option( 'wpmtst_admin_notices', $notices );
136
- }
137
-
138
-
139
- /**
140
- * Delete admin notice from queue.
141
- *
142
- * @since 2.24.0
143
- *
144
- * @param $key
145
- */
146
- function wpmtst_delete_admin_notice( $key ) {
147
- $notices = get_option( 'wpmtst_admin_notices', array() );
148
- unset( $notices[ $key ] );
149
- update_option( 'wpmtst_admin_notices', $notices );
150
- }
151
-
152
-
153
- /**
154
- * Automatically dismiss specific notices when settings are saved.
155
- *
156
- * @since 2.29.0
157
- * @param $option
158
- * @param $old_value
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
-
1
+ <?php
2
+ /**
3
+ * Admin notices
4
+ */
5
+
6
+
7
+ /**
8
+ * Dismiss persistent notices.
9
+ *
10
+ * @since 2.29.0
11
+ */
12
+ function wpmtst_dismiss_notice_ajax() {
13
+ if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
+ echo 0;
15
+ wp_die();
16
+ }
17
+
18
+ check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
+ wpmtst_delete_admin_notice( $_POST['key'] );
20
+ wp_die();
21
+ }
22
+
23
+ add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
+
25
+ /**
26
+ * Print admin notices.
27
+ *
28
+ * @since 2.24.0
29
+ */
30
+ function wpmtst_admin_notices() {
31
+ $notices = get_option( 'wpmtst_admin_notices' );
32
+ if ( ! $notices ) {
33
+ return;
34
+ }
35
+
36
+ foreach ( $notices as $key => $notice ) {
37
+ $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
+ if ( $message ) {
39
+ echo $message;
40
+ }
41
+ if ( ! $notice['persist'] ) {
42
+ wpmtst_delete_admin_notice( $key );
43
+ }
44
+ }
45
+ }
46
+ add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
+
48
+
49
+ /**
50
+ * Return specific admin notice text.
51
+ *
52
+ * @since 2.28.5
53
+ * @param string $html
54
+ * @param $key
55
+ *
56
+ * @return string
57
+ */
58
+ function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
+
60
+ switch ( $key ) {
61
+ case 'defaults-restored' :
62
+ ob_start();
63
+ ?>
64
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
+ <p>
66
+ <?php _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 _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 _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 echo esc_attr( $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
+
119
+ return $html;
120
+ }
121
+ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
+
123
+
124
+ /**
125
+ * Add admin notice to queue.
126
+ *
127
+ * @since 2.24.0
128
+ *
129
+ * @param $key
130
+ * @param $persist
131
+ */
132
+ function wpmtst_add_admin_notice( $key, $persist = false ) {
133
+ $notices = get_option( 'wpmtst_admin_notices', array() );
134
+ $notices[ $key ] = array( 'persist' => $persist );
135
+ update_option( 'wpmtst_admin_notices', $notices );
136
+ }
137
+
138
+
139
+ /**
140
+ * Delete admin notice from queue.
141
+ *
142
+ * @since 2.24.0
143
+ *
144
+ * @param $key
145
+ */
146
+ function wpmtst_delete_admin_notice( $key ) {
147
+ $notices = get_option( 'wpmtst_admin_notices', array() );
148
+ unset( $notices[ $key ] );
149
+ update_option( 'wpmtst_admin_notices', $notices );
150
+ }
151
+
152
+
153
+ /**
154
+ * Automatically dismiss specific notices when settings are saved.
155
+ *
156
+ * @since 2.29.0
157
+ * @param $option
158
+ * @param $old_value
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
+
admin/admin.php CHANGED
@@ -1,320 +1,320 @@
1
- <?php
2
- /**
3
- * Strong Testimonials admin functions.
4
- *
5
- * 1. Check for required WordPress version.
6
- * 2. Check for plugin update.
7
- * 3. Initialize.
8
- */
9
-
10
- /**
11
- * Check for required WordPress version.
12
- */
13
- function wpmtst_version_check() {
14
- global $wp_version;
15
- $require_wp_version = "3.7";
16
-
17
- if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
- deactivate_plugins( WPMTST_PLUGIN );
19
- /* translators: %s is the name of the plugin. */
20
- $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
- /* translators: %s is a WordPress version number. */
22
- $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
- $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
- $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
- wp_die( $message );
26
- }
27
- }
28
-
29
- add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
-
31
- /**
32
- * Check for plugin update.
33
- *
34
- * @since 2.28.4 Before other admin_init actions.
35
- */
36
- function wpmtst_update_check() {
37
- $version = get_option( 'wpmtst_plugin_version', false );
38
- if ( $version == WPMTST_VERSION ) {
39
- return;
40
- }
41
- // Redirect to About page afterwards. On new install or (de)activation only.
42
- if ( false === $version ) {
43
- add_option( 'wpmtst_do_activation_redirect', true );
44
- }
45
-
46
- Strong_Testimonials_Updater::update();
47
- }
48
-
49
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
-
51
- /**
52
- * Initialize.
53
- */
54
- function wpmtst_admin_init() {
55
- /**
56
- * Redirect to About page for new installs only
57
- *
58
- * @since 2.28.4
59
- */
60
- wpmtst_activation_redirect();
61
-
62
- /**
63
- * Custom action hooks
64
- *
65
- * @since 1.18.4
66
- */
67
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
- do_action( 'wpmtst_' . $_REQUEST['action'] );
69
- }
70
- }
71
-
72
- add_action( 'admin_init', 'wpmtst_admin_init' );
73
-
74
- /**
75
- * Custom action link in admin notice.
76
- *
77
- * @since 2.29.0
78
- */
79
- function wpmtst_action_captcha_options_changed() {
80
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
81
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
82
- exit;
83
- }
84
-
85
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
86
-
87
- /**
88
- * Redirect to About page.
89
- *
90
- * @since 2.28.4
91
- */
92
- function wpmtst_activation_redirect() {
93
- if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
94
- delete_option( 'wpmtst_do_activation_redirect' );
95
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
96
- exit;
97
- }
98
- }
99
-
100
- /**
101
- * Are we on a testimonial admin screen?
102
- *
103
- * Used by add-ons too!
104
- *
105
- * @return bool
106
- */
107
- function wpmtst_is_testimonial_screen() {
108
- $screen = get_current_screen();
109
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
110
- }
111
-
112
- /**
113
- * Add pending numbers to post types on admin menu.
114
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
115
- *
116
- * @param $menu
117
- *
118
- * @return mixed
119
- */
120
- function wpmtst_pending_indicator( $menu ) {
121
- if ( ! current_user_can( 'edit_posts' ) )
122
- return $menu;
123
-
124
- $options = get_option( 'wpmtst_options' );
125
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
126
- return $menu;
127
-
128
- $types = array( 'wpm-testimonial' );
129
- $status = 'pending';
130
- foreach ( $types as $type ) {
131
- $num_posts = wp_count_posts( $type, 'readable' );
132
- $pending_count = 0;
133
- if ( ! empty( $num_posts->$status ) )
134
- $pending_count = $num_posts->$status;
135
-
136
- if ( $type == 'post' )
137
- $menu_str = 'edit.php';
138
- else
139
- $menu_str = 'edit.php?post_type=' . $type;
140
-
141
- foreach ( $menu as $menu_key => $menu_data ) {
142
- if ( $menu_str != $menu_data[2] )
143
- continue;
144
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
145
- }
146
- }
147
-
148
- return $menu;
149
- }
150
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
151
-
152
- /**
153
- * The [restore default] icon.
154
- *
155
- * @param $for
156
- *
157
- * @since 2.18.0
158
- */
159
- function wpmtst_restore_default_icon( $for ) {
160
- if ( !$for ) return;
161
- ?>
162
- <input type="button" class="button secondary restore-default"
163
- title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
164
- value="&#xf171"
165
- data-for="<?php echo $for; ?>"/>
166
- <?php
167
- }
168
-
169
-
170
-
171
- /**
172
- * Check for configuration issues when options are updated.
173
- *
174
- * @since 2.24.0
175
- * @param $option
176
- * @param $old_value
177
- * @param $value
178
- */
179
- function wpmtst_updated_option( $option, $old_value, $value ) {
180
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
181
- do_action( 'wpmtst_check_config' );
182
- }
183
- }
184
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
185
-
186
-
187
- /**
188
- * Store configuration error.
189
- *
190
- * @since 2.24.0
191
- * @param $key
192
- */
193
- function wpmtst_add_config_error( $key ) {
194
- $errors = get_option( 'wpmtst_config_errors', array() );
195
- $errors[] = $key;
196
- update_option( 'wpmtst_config_errors', array_unique( $errors ) );
197
-
198
- wpmtst_add_admin_notice( $key, true );
199
- }
200
-
201
-
202
- /**
203
- * Delete configuration error.
204
- *
205
- * @since 2.24.0
206
- * @param $key
207
- */
208
- function wpmtst_delete_config_error( $key ) {
209
- $errors = get_option( 'wpmtst_config_errors', array() );
210
- $errors = array_diff( $errors, array ( $key ) );
211
- update_option( 'wpmtst_config_errors', $errors );
212
-
213
- wpmtst_delete_admin_notice( $key );
214
- }
215
-
216
-
217
- /**
218
- * Save a View.
219
- *
220
- * @param $view
221
- * @param string $action
222
- * @usedby Strong_Testimonials_Update:update_views
223
- *
224
- * @return bool|false|int
225
- */
226
- function wpmtst_save_view( $view, $action = 'edit' ) {
227
- global $wpdb;
228
-
229
- if ( ! $view ) return false;
230
-
231
- $table_name = $wpdb->prefix . 'strong_views';
232
- $serialized = serialize( $view['data'] );
233
-
234
- if ( 'add' == $action || 'duplicate' == $action ) {
235
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
236
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
237
- $wpdb->query( $sql );
238
- $view['id'] = $wpdb->insert_id;
239
- $return = $view['id'];
240
- }
241
- else {
242
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
243
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
244
- $wpdb->query( $sql );
245
- $return = $wpdb->last_error ? 0 : 1;
246
- }
247
-
248
- do_action( 'wpmtst_view_saved', $view );
249
-
250
- return $return;
251
- }
252
-
253
-
254
- /**
255
- * @param $field
256
- *
257
- * @return mixed
258
- */
259
- function wpmtst_get_field_label( $field ) {
260
- if ( isset( $field['field'] ) ) {
261
- $custom_fields = wpmtst_get_custom_fields();
262
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
263
- return $custom_fields[ $field['field'] ]['label'];
264
- }
265
- $builtin_fields = wpmtst_get_builtin_fields();
266
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
267
- return $builtin_fields[ $field['field'] ]['label'];
268
- }
269
- }
270
-
271
- return '';
272
- }
273
-
274
-
275
- /**
276
- * @param string $field_name
277
- *
278
- * @return mixed
279
- */
280
- function wpmtst_get_field_by_name( $field_name = '' ) {
281
- if ( $field_name ) {
282
- $custom_fields = wpmtst_get_custom_fields();
283
- if ( isset( $custom_fields[ $field_name ] ) ) {
284
- return $custom_fields[ $field_name ];
285
- }
286
- }
287
-
288
- return '';
289
- }
290
-
291
- /**
292
- * Returns true if at least one extension is installed
293
- */
294
- function wpmtst_extensions_installed() {
295
-
296
- if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
297
- return true;
298
- }
299
- if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
300
- return true;
301
- }
302
- if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
303
- return true;
304
- }
305
- if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
306
- return true;
307
- }
308
- if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
309
- return true;
310
- }
311
- if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
312
- return true;
313
- }
314
- if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
315
- return true;
316
- }
317
-
318
- return false;
319
- }
320
-
1
+ <?php
2
+ /**
3
+ * Strong Testimonials admin functions.
4
+ *
5
+ * 1. Check for required WordPress version.
6
+ * 2. Check for plugin update.
7
+ * 3. Initialize.
8
+ */
9
+
10
+ /**
11
+ * Check for required WordPress version.
12
+ */
13
+ function wpmtst_version_check() {
14
+ global $wp_version;
15
+ $require_wp_version = "3.7";
16
+
17
+ if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
+ deactivate_plugins( WPMTST_PLUGIN );
19
+ /* translators: %s is the name of the plugin. */
20
+ $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
+ /* translators: %s is a WordPress version number. */
22
+ $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
+ $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
+ $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
+ wp_die( $message );
26
+ }
27
+ }
28
+
29
+ add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
+
31
+ /**
32
+ * Check for plugin update.
33
+ *
34
+ * @since 2.28.4 Before other admin_init actions.
35
+ */
36
+ function wpmtst_update_check() {
37
+ $version = get_option( 'wpmtst_plugin_version', false );
38
+ if ( $version == WPMTST_VERSION ) {
39
+ return;
40
+ }
41
+ // Redirect to About page afterwards. On new install or (de)activation only.
42
+ if ( false === $version ) {
43
+ add_option( 'wpmtst_do_activation_redirect', true );
44
+ }
45
+
46
+ Strong_Testimonials_Updater::update();
47
+ }
48
+
49
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
+
51
+ /**
52
+ * Initialize.
53
+ */
54
+ function wpmtst_admin_init() {
55
+ /**
56
+ * Redirect to About page for new installs only
57
+ *
58
+ * @since 2.28.4
59
+ */
60
+ wpmtst_activation_redirect();
61
+
62
+ /**
63
+ * Custom action hooks
64
+ *
65
+ * @since 1.18.4
66
+ */
67
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
+ do_action( 'wpmtst_' . $_REQUEST['action'] );
69
+ }
70
+ }
71
+
72
+ add_action( 'admin_init', 'wpmtst_admin_init' );
73
+
74
+ /**
75
+ * Custom action link in admin notice.
76
+ *
77
+ * @since 2.29.0
78
+ */
79
+ function wpmtst_action_captcha_options_changed() {
80
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
81
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
82
+ exit;
83
+ }
84
+
85
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
86
+
87
+ /**
88
+ * Redirect to About page.
89
+ *
90
+ * @since 2.28.4
91
+ */
92
+ function wpmtst_activation_redirect() {
93
+ if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
94
+ delete_option( 'wpmtst_do_activation_redirect' );
95
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
96
+ exit;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Are we on a testimonial admin screen?
102
+ *
103
+ * Used by add-ons too!
104
+ *
105
+ * @return bool
106
+ */
107
+ function wpmtst_is_testimonial_screen() {
108
+ $screen = get_current_screen();
109
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
110
+ }
111
+
112
+ /**
113
+ * Add pending numbers to post types on admin menu.
114
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
115
+ *
116
+ * @param $menu
117
+ *
118
+ * @return mixed
119
+ */
120
+ function wpmtst_pending_indicator( $menu ) {
121
+ if ( ! current_user_can( 'edit_posts' ) )
122
+ return $menu;
123
+
124
+ $options = get_option( 'wpmtst_options' );
125
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
126
+ return $menu;
127
+
128
+ $types = array( 'wpm-testimonial' );
129
+ $status = 'pending';
130
+ foreach ( $types as $type ) {
131
+ $num_posts = wp_count_posts( $type, 'readable' );
132
+ $pending_count = 0;
133
+ if ( ! empty( $num_posts->$status ) )
134
+ $pending_count = $num_posts->$status;
135
+
136
+ if ( $type == 'post' )
137
+ $menu_str = 'edit.php';
138
+ else
139
+ $menu_str = 'edit.php?post_type=' . $type;
140
+
141
+ foreach ( $menu as $menu_key => $menu_data ) {
142
+ if ( $menu_str != $menu_data[2] )
143
+ continue;
144
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
145
+ }
146
+ }
147
+
148
+ return $menu;
149
+ }
150
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
151
+
152
+ /**
153
+ * The [restore default] icon.
154
+ *
155
+ * @param $for
156
+ *
157
+ * @since 2.18.0
158
+ */
159
+ function wpmtst_restore_default_icon( $for ) {
160
+ if ( !$for ) return;
161
+ ?>
162
+ <input type="button" class="button secondary restore-default"
163
+ title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
164
+ value="&#xf171"
165
+ data-for="<?php echo $for; ?>"/>
166
+ <?php
167
+ }
168
+
169
+
170
+
171
+ /**
172
+ * Check for configuration issues when options are updated.
173
+ *
174
+ * @since 2.24.0
175
+ * @param $option
176
+ * @param $old_value
177
+ * @param $value
178
+ */
179
+ function wpmtst_updated_option( $option, $old_value, $value ) {
180
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
181
+ do_action( 'wpmtst_check_config' );
182
+ }
183
+ }
184
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
185
+
186
+
187
+ /**
188
+ * Store configuration error.
189
+ *
190
+ * @since 2.24.0
191
+ * @param $key
192
+ */
193
+ function wpmtst_add_config_error( $key ) {
194
+ $errors = get_option( 'wpmtst_config_errors', array() );
195
+ $errors[] = $key;
196
+ update_option( 'wpmtst_config_errors', array_unique( $errors ) );
197
+
198
+ wpmtst_add_admin_notice( $key, true );
199
+ }
200
+
201
+
202
+ /**
203
+ * Delete configuration error.
204
+ *
205
+ * @since 2.24.0
206
+ * @param $key
207
+ */
208
+ function wpmtst_delete_config_error( $key ) {
209
+ $errors = get_option( 'wpmtst_config_errors', array() );
210
+ $errors = array_diff( $errors, array ( $key ) );
211
+ update_option( 'wpmtst_config_errors', $errors );
212
+
213
+ wpmtst_delete_admin_notice( $key );
214
+ }
215
+
216
+
217
+ /**
218
+ * Save a View.
219
+ *
220
+ * @param $view
221
+ * @param string $action
222
+ * @usedby Strong_Testimonials_Update:update_views
223
+ *
224
+ * @return bool|false|int
225
+ */
226
+ function wpmtst_save_view( $view, $action = 'edit' ) {
227
+ global $wpdb;
228
+
229
+ if ( ! $view ) return false;
230
+
231
+ $table_name = $wpdb->prefix . 'strong_views';
232
+ $serialized = serialize( $view['data'] );
233
+
234
+ if ( 'add' == $action || 'duplicate' == $action ) {
235
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
236
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
237
+ $wpdb->query( $sql );
238
+ $view['id'] = $wpdb->insert_id;
239
+ $return = $view['id'];
240
+ }
241
+ else {
242
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
243
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
244
+ $wpdb->query( $sql );
245
+ $return = $wpdb->last_error ? 0 : 1;
246
+ }
247
+
248
+ do_action( 'wpmtst_view_saved', $view );
249
+
250
+ return $return;
251
+ }
252
+
253
+
254
+ /**
255
+ * @param $field
256
+ *
257
+ * @return mixed
258
+ */
259
+ function wpmtst_get_field_label( $field ) {
260
+ if ( isset( $field['field'] ) ) {
261
+ $custom_fields = wpmtst_get_custom_fields();
262
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
263
+ return $custom_fields[ $field['field'] ]['label'];
264
+ }
265
+ $builtin_fields = wpmtst_get_builtin_fields();
266
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
267
+ return $builtin_fields[ $field['field'] ]['label'];
268
+ }
269
+ }
270
+
271
+ return '';
272
+ }
273
+
274
+
275
+ /**
276
+ * @param string $field_name
277
+ *
278
+ * @return mixed
279
+ */
280
+ function wpmtst_get_field_by_name( $field_name = '' ) {
281
+ if ( $field_name ) {
282
+ $custom_fields = wpmtst_get_custom_fields();
283
+ if ( isset( $custom_fields[ $field_name ] ) ) {
284
+ return $custom_fields[ $field_name ];
285
+ }
286
+ }
287
+
288
+ return '';
289
+ }
290
+
291
+ /**
292
+ * Returns true if at least one extension is installed
293
+ */
294
+ function wpmtst_extensions_installed() {
295
+
296
+ if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
297
+ return true;
298
+ }
299
+ if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
300
+ return true;
301
+ }
302
+ if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
303
+ return true;
304
+ }
305
+ if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
306
+ return true;
307
+ }
308
+ if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
309
+ return true;
310
+ }
311
+ if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
312
+ return true;
313
+ }
314
+ if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
315
+ return true;
316
+ }
317
+
318
+ return false;
319
+ }
320
+
admin/class-strong-testimonials-addons.php CHANGED
@@ -1,132 +1,132 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Addons
4
- *
5
- * @since 2.38
6
- */
7
- class Strong_Testimonials_Addons {
8
-
9
- private $addons = array();
10
-
11
- public function __construct() {
12
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
-
14
- // Add ajax action to reload extensions
15
- add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
- }
17
-
18
- private function check_for_addons() {
19
-
20
- if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
- return $data;
22
- }
23
-
24
- $addons = array();
25
-
26
- $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
-
28
- // Get data from the remote URL.
29
- $response = wp_remote_get( $url );
30
-
31
- if ( ! is_wp_error( $response ) ) {
32
-
33
- // Decode the data that we got.
34
- $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
-
36
- if ( ! empty( $data ) && is_array( $data ) ) {
37
- $addons = $data;
38
- // Store the data for a week.
39
- set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
- }
41
- }
42
-
43
- return apply_filters( 'wpmtst_addons', $addons );
44
- }
45
-
46
- public function render_addons() {
47
-
48
- wp_enqueue_style( 'wpmtst-admin-style' );
49
- wp_enqueue_script( 'wpmtst-admin-script' );
50
-
51
- if ( ! empty( $this->addons ) ) {
52
- foreach ( $this->addons as $addon ) {
53
- $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
- echo '<div class="wpmtst-addon">';
55
- echo '<div class="wpmtst-addon-box">';
56
- echo '<img src="' . esc_attr( $image ) . '">';
57
- echo '<div class="wpmtst-addon-content">';
58
- echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
- echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
- echo '</div>';
61
- echo '</div>';
62
- echo '<div class="wpmtst-addon-actions">';
63
- echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade to PRO', 'strong-testimonials' ) . '</a>', $addon );
64
- echo '</div>';
65
- echo '</div>';
66
- }
67
- }
68
-
69
- }
70
-
71
- /**
72
- * Add submenu page.
73
- *
74
- * @param $pages
75
- *
76
- * @return mixed
77
- */
78
- public function add_submenu( $pages ) {
79
- $pages[91] = $this->get_submenu();
80
- return $pages;
81
- }
82
-
83
- /**
84
- * Return submenu page parameters.
85
- *
86
- * @return array
87
- */
88
- public function get_submenu() {
89
- return array(
90
- 'page_title' => __( 'Extensions', 'strong-testimonials' ),
91
- 'menu_title' => __( 'Extensions', 'strong-testimonials' ),
92
- 'capability' => 'strong_testimonials_options',
93
- 'menu_slug' => 'strong-testimonials-addons',
94
- 'function' => array( $this, 'addons_page' ),
95
- );
96
- }
97
-
98
-
99
- /**
100
- * Print the Addons page.
101
- */
102
- public function addons_page() {
103
-
104
- $this->addons = $this->check_for_addons();
105
- ?>
106
-
107
- <div class="wrap">
108
- <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
-
110
- <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
-
112
- <div class="wpmtst-addons-container">
113
- <?php $this->render_addons(); ?>
114
- </div>
115
- </div>
116
- <?php
117
- }
118
-
119
- public function reload_extensions() {
120
- // Run a security check first.
121
- check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
-
123
- delete_transient( 'strong_testimonials_all_extensions' );
124
-
125
- die;
126
- }
127
-
128
-
129
-
130
- }
131
-
132
- new Strong_Testimonials_Addons();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Addons
4
+ *
5
+ * @since 2.38
6
+ */
7
+ class Strong_Testimonials_Addons {
8
+
9
+ private $addons = array();
10
+
11
+ public function __construct() {
12
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
+
14
+ // Add ajax action to reload extensions
15
+ add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
+ }
17
+
18
+ private function check_for_addons() {
19
+
20
+ if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
+ return $data;
22
+ }
23
+
24
+ $addons = array();
25
+
26
+ $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
+
28
+ // Get data from the remote URL.
29
+ $response = wp_remote_get( $url );
30
+
31
+ if ( ! is_wp_error( $response ) ) {
32
+
33
+ // Decode the data that we got.
34
+ $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
+
36
+ if ( ! empty( $data ) && is_array( $data ) ) {
37
+ $addons = $data;
38
+ // Store the data for a week.
39
+ set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
+ }
41
+ }
42
+
43
+ return apply_filters( 'wpmtst_addons', $addons );
44
+ }
45
+
46
+ public function render_addons() {
47
+
48
+ wp_enqueue_style( 'wpmtst-admin-style' );
49
+ wp_enqueue_script( 'wpmtst-admin-script' );
50
+
51
+ if ( ! empty( $this->addons ) ) {
52
+ foreach ( $this->addons as $addon ) {
53
+ $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
+ echo '<div class="wpmtst-addon">';
55
+ echo '<div class="wpmtst-addon-box">';
56
+ echo '<img src="' . esc_attr( $image ) . '">';
57
+ echo '<div class="wpmtst-addon-content">';
58
+ echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
+ echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
+ echo '</div>';
61
+ echo '</div>';
62
+ echo '<div class="wpmtst-addon-actions">';
63
+ echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade to PRO', 'strong-testimonials' ) . '</a>', $addon );
64
+ echo '</div>';
65
+ echo '</div>';
66
+ }
67
+ }
68
+
69
+ }
70
+
71
+ /**
72
+ * Add submenu page.
73
+ *
74
+ * @param $pages
75
+ *
76
+ * @return mixed
77
+ */
78
+ public function add_submenu( $pages ) {
79
+ $pages[91] = $this->get_submenu();
80
+ return $pages;
81
+ }
82
+
83
+ /**
84
+ * Return submenu page parameters.
85
+ *
86
+ * @return array
87
+ */
88
+ public function get_submenu() {
89
+ return array(
90
+ 'page_title' => __( 'Extensions', 'strong-testimonials' ),
91
+ 'menu_title' => __( 'Extensions', 'strong-testimonials' ),
92
+ 'capability' => 'strong_testimonials_options',
93
+ 'menu_slug' => 'strong-testimonials-addons',
94
+ 'function' => array( $this, 'addons_page' ),
95
+ );
96
+ }
97
+
98
+
99
+ /**
100
+ * Print the Addons page.
101
+ */
102
+ public function addons_page() {
103
+
104
+ $this->addons = $this->check_for_addons();
105
+ ?>
106
+
107
+ <div class="wrap">
108
+ <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
+
110
+ <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
+
112
+ <div class="wpmtst-addons-container">
113
+ <?php $this->render_addons(); ?>
114
+ </div>
115
+ </div>
116
+ <?php
117
+ }
118
+
119
+ public function reload_extensions() {
120
+ // Run a security check first.
121
+ check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
+
123
+ delete_transient( 'strong_testimonials_all_extensions' );
124
+
125
+ die;
126
+ }
127
+
128
+
129
+
130
+ }
131
+
132
+ new Strong_Testimonials_Addons();
admin/class-strong-testimonials-admin-category-list.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_Category_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_Category_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_list constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
- add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
- }
28
-
29
- /**
30
- * Add columns to the testimonials categories screen
31
- *
32
- * @param $columns
33
- *
34
- * @return array
35
- */
36
- public static function manage_categories( $columns ) {
37
- $new_columns = array(
38
- 'cb' => '<input type="checkbox">',
39
- 'ID' => __( 'ID', 'strong-testimonials' ),
40
- 'name' => __( 'Name', 'strong-testimonials' ),
41
- 'slug' => __( 'Slug', 'strong-testimonials' ),
42
- 'posts' => __( 'Posts', 'strong-testimonials' ),
43
- );
44
-
45
- return $new_columns;
46
- }
47
-
48
- /**
49
- * Show custom column
50
- *
51
- * @param $out
52
- * @param $column_name
53
- * @param $id
54
- *
55
- * @return string
56
- */
57
- public static function manage_columns( $out, $column_name, $id ) {
58
- if ( 'ID' == $column_name ) {
59
- $output = $id;
60
- } else {
61
- $output = '';
62
- }
63
-
64
- return $output;
65
- }
66
-
67
- }
68
-
69
- Strong_Testimonials_Admin_Category_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_Category_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_Category_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_list constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
+ add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
+ }
28
+
29
+ /**
30
+ * Add columns to the testimonials categories screen
31
+ *
32
+ * @param $columns
33
+ *
34
+ * @return array
35
+ */
36
+ public static function manage_categories( $columns ) {
37
+ $new_columns = array(
38
+ 'cb' => '<input type="checkbox">',
39
+ 'ID' => __( 'ID', 'strong-testimonials' ),
40
+ 'name' => __( 'Name', 'strong-testimonials' ),
41
+ 'slug' => __( 'Slug', 'strong-testimonials' ),
42
+ 'posts' => __( 'Posts', 'strong-testimonials' ),
43
+ );
44
+
45
+ return $new_columns;
46
+ }
47
+
48
+ /**
49
+ * Show custom column
50
+ *
51
+ * @param $out
52
+ * @param $column_name
53
+ * @param $id
54
+ *
55
+ * @return string
56
+ */
57
+ public static function manage_columns( $out, $column_name, $id ) {
58
+ if ( 'ID' == $column_name ) {
59
+ $output = $id;
60
+ } else {
61
+ $output = '';
62
+ }
63
+
64
+ return $output;
65
+ }
66
+
67
+ }
68
+
69
+ Strong_Testimonials_Admin_Category_List::init();
admin/class-strong-testimonials-admin-list.php CHANGED
@@ -1,331 +1,331 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_List constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
- add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
- add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
- add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
- add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
- add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
- add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
- }
33
-
34
- /**
35
- * Add post ID to post row actions.
36
- *
37
- * @param $actions
38
- * @param $post
39
- * @since 2.32.2
40
- *
41
- * @return array
42
- */
43
- public static function post_row_actions( $actions, $post ) {
44
- if ( 'wpm-testimonial' == $post->post_type ) {
45
- $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
- }
47
-
48
- return $actions;
49
- }
50
-
51
- /**
52
- * Add custom columns to the admin list.
53
- *
54
- * @param $columns
55
- *
56
- * @since 1.4.0
57
- * @since 2.5.1 Added comments column.
58
- *
59
- * @return array
60
- */
61
- public static function edit_columns( $columns ) {
62
- $fields = wpmtst_get_all_fields();
63
-
64
- $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
-
66
- /*
67
- INCOMING COLUMNS = Array (
68
- [cb] => <input type="checkbox" />
69
- [title] => Title
70
- [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
- [date] => Date
72
- [search_exclude] => Search Exclude // other plugin
73
- [strong_thumbnail] => Thumbnail
74
- )
75
- */
76
-
77
- // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
- unset( $columns['strong_thumbnail'], $columns['date'] );
79
-
80
- if ( $comments ) {
81
- unset( $columns['comments'] );
82
- }
83
-
84
- // 2. insert [order] after [cb]
85
- if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
- $columns = array_merge(
87
- array_slice( $columns, 0, 1 ),
88
- array( 'handle' => 'Order' ),
89
- array_slice( $columns, 1, null )
90
- );
91
- }
92
-
93
- // 3. insert [excerpt] after [title]
94
- $key = 'title';
95
- $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
- $fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
97
-
98
- // 4. add custom fields
99
- foreach ( $fields as $key => $field ) {
100
-
101
- if ( $field['admin_table'] ) {
102
-
103
- if ( 'post_title' == $field['name'] ) {
104
- continue;
105
- } elseif ( 'featured_image' == $field['name'] ) {
106
- $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
- } elseif ( 'rating' == $field['input_type'] ) {
108
- $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
- } else {
110
- $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
- }
112
-
113
- }
114
-
115
- }
116
-
117
- // 5. add [category], [comments] and [date]
118
- // The slug "categories" slug is reserved by WordPress.
119
- if ( wpmtst_get_cat_count() ) {
120
- $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
121
- }
122
-
123
- if ( $comments ) {
124
- $fields_to_add['comments'] = $comments;
125
- }
126
-
127
- $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
128
-
129
- // Push other added columns like [search_exclude] to the end.
130
- $columns = array_merge(
131
- array_slice( $columns, 0, $offset ),
132
- $fields_to_add,
133
- array_slice( $columns, $offset, null )
134
- );
135
-
136
- return $columns;
137
- }
138
-
139
- /**
140
- * Show custom values
141
- *
142
- * @param $column
143
- */
144
- public static function custom_columns( $column ) {
145
- global $post;
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();
186
-
187
- if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
188
-
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
-
220
- /**
221
- * Add thumbnail column to admin list
222
- *
223
- * @param $columns
224
- *
225
- * @return array
226
- */
227
- public static function add_thumbnail_column( $columns ) {
228
- $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
229
-
230
- return $columns;
231
- }
232
-
233
- /**
234
- * Make columns sortable.
235
- *
236
- * @param $columns
237
- *
238
- * @since 1.12.0
239
- * @since 2.2.0 category
240
- *
241
- * @return mixed
242
- */
243
- public static function manage_sortable_columns( $columns ) {
244
- $columns['client_name'] = 'client_name';
245
- $columns['category'] = 'categories';
246
- $columns['date'] = 'date';
247
-
248
- return $columns;
249
- }
250
-
251
- /**
252
- * Add category filter to testimonial list table.
253
- *
254
- * @since 2.2.0
255
- */
256
- public static function add_taxonomy_filters() {
257
- global $typenow;
258
-
259
- if ( $typenow != 'wpm-testimonial' ) {
260
- return;
261
- }
262
-
263
- $taxonomies = array( 'wpm-testimonial-category' );
264
-
265
- foreach ( $taxonomies as $tax ) {
266
- $tax_obj = get_taxonomy( $tax );
267
- $args = array(
268
- 'show_option_all' => $tax_obj->labels->all_items,
269
- 'show_option_none' => '',
270
- 'option_none_value' => '-1',
271
- 'orderby' => 'NAME',
272
- 'order' => 'ASC',
273
- 'show_count' => 1,
274
- 'hide_empty' => 1,
275
- 'child_of' => 0,
276
- 'exclude' => '',
277
- 'echo' => 1,
278
- 'selected' => isset( $_GET[ $tax ] ) ? $_GET[ $tax ] : '',
279
- 'hierarchical' => 1,
280
- 'name' => $tax,
281
- 'id' => $tax,
282
- 'class' => 'postform',
283
- 'depth' => 0,
284
- 'tab_index' => 0,
285
- 'taxonomy' => $tax,
286
- 'hide_if_empty' => true,
287
- 'value_field' => 'slug',
288
- );
289
-
290
- wp_dropdown_categories( $args );
291
- }
292
- }
293
-
294
- /**
295
- * Sort columns.
296
- *
297
- * @since 1.12.0
298
- *
299
- * @param $query
300
- */
301
- public static function pre_get_posts( $query ) {
302
- // Only in main WP query AND if an orderby query variable is designated.
303
- if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
304
- if ( 'client_name' == $query->get( 'orderby' ) ) {
305
- $query->set( 'meta_key', 'client_name' );
306
- $query->set( 'orderby', 'meta_value' );
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * Check if we are viewing the Trash.
313
- *
314
- * @since 1.16.0
315
- */
316
- public static function is_viewing_trash() {
317
- return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
318
- }
319
-
320
- /**
321
- * Check if a column in admin list table is sorted.
322
- *
323
- * @since 1.16.0
324
- */
325
- public static function is_column_sorted() {
326
- return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
327
- }
328
-
329
- }
330
-
331
- Strong_Testimonials_Admin_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_List constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
+ add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
+ add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
+ add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
+ add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
+ add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
+ add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
+ }
33
+
34
+ /**
35
+ * Add post ID to post row actions.
36
+ *
37
+ * @param $actions
38
+ * @param $post
39
+ * @since 2.32.2
40
+ *
41
+ * @return array
42
+ */
43
+ public static function post_row_actions( $actions, $post ) {
44
+ if ( 'wpm-testimonial' == $post->post_type ) {
45
+ $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
+ }
47
+
48
+ return $actions;
49
+ }
50
+
51
+ /**
52
+ * Add custom columns to the admin list.
53
+ *
54
+ * @param $columns
55
+ *
56
+ * @since 1.4.0
57
+ * @since 2.5.1 Added comments column.
58
+ *
59
+ * @return array
60
+ */
61
+ public static function edit_columns( $columns ) {
62
+ $fields = wpmtst_get_all_fields();
63
+
64
+ $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
+
66
+ /*
67
+ INCOMING COLUMNS = Array (
68
+ [cb] => <input type="checkbox" />
69
+ [title] => Title
70
+ [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
+ [date] => Date
72
+ [search_exclude] => Search Exclude // other plugin
73
+ [strong_thumbnail] => Thumbnail
74
+ )
75
+ */
76
+
77
+ // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
+ unset( $columns['strong_thumbnail'], $columns['date'] );
79
+
80
+ if ( $comments ) {
81
+ unset( $columns['comments'] );
82
+ }
83
+
84
+ // 2. insert [order] after [cb]
85
+ if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
+ $columns = array_merge(
87
+ array_slice( $columns, 0, 1 ),
88
+ array( 'handle' => 'Order' ),
89
+ array_slice( $columns, 1, null )
90
+ );
91
+ }
92
+
93
+ // 3. insert [excerpt] after [title]
94
+ $key = 'title';
95
+ $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
+ $fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
97
+
98
+ // 4. add custom fields
99
+ foreach ( $fields as $key => $field ) {
100
+
101
+ if ( $field['admin_table'] ) {
102
+
103
+ if ( 'post_title' == $field['name'] ) {
104
+ continue;
105
+ } elseif ( 'featured_image' == $field['name'] ) {
106
+ $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
+ } elseif ( 'rating' == $field['input_type'] ) {
108
+ $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
+ } else {
110
+ $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
+ }
112
+
113
+ }
114
+
115
+ }
116
+
117
+ // 5. add [category], [comments] and [date]
118
+ // The slug "categories" slug is reserved by WordPress.
119
+ if ( wpmtst_get_cat_count() ) {
120
+ $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
121
+ }
122
+
123
+ if ( $comments ) {
124
+ $fields_to_add['comments'] = $comments;
125
+ }
126
+
127
+ $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
128
+
129
+ // Push other added columns like [search_exclude] to the end.
130
+ $columns = array_merge(
131
+ array_slice( $columns, 0, $offset ),
132
+ $fields_to_add,
133
+ array_slice( $columns, $offset, null )
134
+ );
135
+
136
+ return $columns;
137
+ }
138
+
139
+ /**
140
+ * Show custom values
141
+ *
142
+ * @param $column
143
+ */
144
+ public static function custom_columns( $column ) {
145
+ global $post;
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();
186
+
187
+ if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
188
+
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
+
220
+ /**
221
+ * Add thumbnail column to admin list
222
+ *
223
+ * @param $columns
224
+ *
225
+ * @return array
226
+ */
227
+ public static function add_thumbnail_column( $columns ) {
228
+ $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
229
+
230
+ return $columns;
231
+ }
232
+
233
+ /**
234
+ * Make columns sortable.
235
+ *
236
+ * @param $columns
237
+ *
238
+ * @since 1.12.0
239
+ * @since 2.2.0 category
240
+ *
241
+ * @return mixed
242
+ */
243
+ public static function manage_sortable_columns( $columns ) {
244
+ $columns['client_name'] = 'client_name';
245
+ $columns['category'] = 'categories';
246
+ $columns['date'] = 'date';
247
+
248
+ return $columns;
249
+ }
250
+
251
+ /**
252
+ * Add category filter to testimonial list table.
253
+ *
254
+ * @since 2.2.0
255
+ */
256
+ public static function add_taxonomy_filters() {
257
+ global $typenow;
258
+
259
+ if ( $typenow != 'wpm-testimonial' ) {
260
+ return;
261
+ }
262
+
263
+ $taxonomies = array( 'wpm-testimonial-category' );
264
+
265
+ foreach ( $taxonomies as $tax ) {
266
+ $tax_obj = get_taxonomy( $tax );
267
+ $args = array(
268
+ 'show_option_all' => $tax_obj->labels->all_items,
269
+ 'show_option_none' => '',
270
+ 'option_none_value' => '-1',
271
+ 'orderby' => 'NAME',
272
+ 'order' => 'ASC',
273
+ 'show_count' => 1,
274
+ 'hide_empty' => 1,
275
+ 'child_of' => 0,
276
+ 'exclude' => '',
277
+ 'echo' => 1,
278
+ 'se