Strong Testimonials - Version 2.34

Version Description

Download this release

Release Info

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

Code changes from version 2.33 to 2.34

Files changed (130) hide show
  1. .gitignore +0 -26
  2. admin/about/addons.php +23 -31
  3. admin/about/class-strong-testimonials-about.php +100 -100
  4. admin/about/how-to.php +41 -41
  5. admin/about/links.php +17 -76
  6. admin/about/privacy.php +13 -13
  7. admin/about/whats-new.php +107 -107
  8. admin/admin-notices.php +182 -177
  9. admin/admin.php +297 -329
  10. admin/class-strong-testimonials-admin-category-list.php +69 -69
  11. admin/class-strong-testimonials-admin-list.php +323 -331
  12. admin/class-strong-testimonials-admin-scripts.php +443 -395
  13. admin/class-strong-testimonials-defaults.php +885 -882
  14. admin/class-strong-testimonials-help.php +277 -227
  15. admin/class-strong-testimonials-list-table.php +1212 -1147
  16. admin/class-strong-testimonials-page-shortcodes.php +336 -336
  17. admin/class-strong-testimonials-post-editor.php +367 -354
  18. admin/class-strong-testimonials-updater.php +1328 -1345
  19. admin/class-strong-views-list-table.php +231 -228
  20. admin/class-walker-strong-category-checklist.php +129 -127
  21. admin/class-walker-strong-form-category-checklist.php +129 -127
  22. admin/compat.php +117 -116
  23. admin/css/about.css +53 -53
  24. admin/css/admin-compat.css +178 -178
  25. admin/css/admin-form.css +138 -138
  26. admin/css/admin.css +822 -822
  27. admin/css/fields.css +317 -317
  28. admin/css/form-preview.css +135 -135
  29. admin/css/number-spinner.css +98 -98
  30. admin/css/order.css +102 -102
  31. admin/css/polylang.css +7 -7
  32. admin/css/post-editor.css +110 -110
  33. admin/css/views.css +1010 -1010
  34. admin/css/wpml.css +31 -31
  35. admin/custom-fields-ajax.php +99 -99
  36. admin/custom-fields.php +490 -492
  37. admin/form-preview.php +53 -51
  38. admin/js/addon-licenses.js +79 -79
  39. admin/js/admin-compat.js +130 -130
  40. admin/js/admin-fields.js +602 -602
  41. admin/js/admin-form.js +164 -164
  42. admin/js/admin-global.js +26 -26
  43. admin/js/admin-order.js +128 -128
  44. admin/js/admin.js +106 -106
  45. admin/js/custom-spinner.js +81 -81
  46. admin/js/help.js +22 -22
  47. admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -192
  48. admin/js/lib/autosize/autosize.min.js +5 -5
  49. admin/js/rating-edit.js +85 -85
  50. admin/js/view-category-filter.js +47 -47
  51. admin/js/views.js +1336 -1336
  52. admin/menu/class-strong-testimonials-menu-fields.php +55 -55
  53. admin/menu/class-strong-testimonials-menu-settings.php +57 -57
  54. admin/menu/class-strong-testimonials-menu-shortcodes.php +55 -55
  55. admin/menu/class-strong-testimonials-menu-views.php +55 -55
  56. admin/menu/class-strong-testimonials-menu.php +51 -51
  57. admin/partials/fields/field-controls.php +12 -12
  58. admin/partials/fields/field-header.php +13 -13
  59. admin/partials/fields/field-label.php +15 -15
  60. admin/partials/fields/field-name.php +23 -22
  61. admin/partials/fields/field-text.php +11 -14
  62. admin/partials/fields/field-type.php +74 -75
  63. admin/partials/templates/form-preview-template.php +27 -27
  64. admin/partials/views/group-compat.php +17 -17
  65. admin/partials/views/group-extra.php +24 -24
  66. admin/partials/views/group-fields.php +75 -75
  67. admin/partials/views/group-form.php +24 -24
  68. admin/partials/views/group-query.php +44 -44
  69. admin/partials/views/group-slideshow.php +30 -30
  70. admin/partials/views/group-style.php +51 -51
  71. admin/partials/views/option-background.php +151 -151
  72. admin/partials/views/option-boilerplate.php +39 -39
  73. admin/partials/views/option-category.php +56 -56
  74. admin/partials/views/option-classes.php +14 -14
  75. admin/partials/views/option-client-section.php +25 -29
  76. admin/partials/views/option-color.php +47 -57
  77. admin/partials/views/option-content.php +217 -217
  78. admin/partials/views/option-divi.php +23 -24
  79. admin/partials/views/option-form-ajax.php +12 -13
  80. admin/partials/views/option-form-category.php +28 -28
  81. admin/partials/views/option-id.php +23 -23
  82. admin/partials/views/option-layout.php +146 -147
  83. admin/partials/views/option-limit.php +31 -33
  84. admin/partials/views/option-order.php +26 -26
  85. admin/partials/views/option-pagination.php +145 -167
  86. admin/partials/views/option-read-more-page.php +86 -87
  87. admin/partials/views/option-select.php +29 -29
  88. admin/partials/views/option-slideshow-behavior.php +87 -93
  89. admin/partials/views/option-slideshow-breakpoints.php +81 -95
  90. admin/partials/views/option-slideshow-navigation.php +108 -104
  91. admin/partials/views/option-slideshow-num.php +8 -8
  92. admin/partials/views/option-slideshow-transition.php +42 -46
  93. admin/partials/views/option-slideshow-type.php +19 -19
  94. admin/partials/views/option-template-list.php +22 -22
  95. admin/partials/views/option-thumbnail.php +96 -91
  96. admin/partials/views/option-title.php +18 -20
  97. admin/partials/views/template-input.php +6 -8
  98. admin/partials/views/template-not-found.php +24 -25
  99. admin/partials/views/template-options.php +77 -78
  100. admin/partials/views/view-mode.php +17 -18
  101. admin/partials/views/view-name.php +16 -17
  102. admin/partials/views/view-shortcode.php +32 -32
  103. admin/scss/_partials/_background.scss +30 -30
  104. admin/scss/_partials/_category-checkboxes.scss +19 -19
  105. admin/scss/_partials/_category-filter.scss +58 -58
  106. admin/scss/_partials/_checkbox-icons.scss +52 -52
  107. admin/scss/_partials/_custom-fields.scss +169 -169
  108. admin/scss/_partials/_elements.scss +93 -93
  109. admin/scss/_partials/_form-table.scss +98 -98
  110. admin/scss/_partials/_help-tab.scss +50 -50
  111. admin/scss/_partials/_inner-table.scss +31 -31
  112. admin/scss/_partials/_inputs.scss +48 -48
  113. admin/scss/_partials/_layout-example-columns.scss +42 -42
  114. admin/scss/_partials/_layout-example-grid.scss +33 -33
  115. admin/scss/_partials/_layout-example-masonry.scss +22 -22
  116. admin/scss/_partials/_layout-examples.scss +40 -40
  117. admin/scss/_partials/_layout.scss +15 -15
  118. admin/scss/_partials/_list-radio-buttons.scss +139 -139
  119. admin/scss/_partials/_misc.scss +88 -88
  120. admin/scss/_partials/_screenshots.scss +10 -10
  121. admin/scss/_partials/_sticky-views.scss +48 -48
  122. admin/scss/_partials/_structure.scss +41 -41
  123. admin/scss/_partials/_template.scss +43 -43
  124. admin/scss/_partials/_view-info.scss +178 -178
  125. admin/scss/about.scss +76 -76
  126. admin/scss/admin-compat.scss +166 -166
  127. admin/scss/number-spinner.scss +107 -107
  128. admin/scss/post-editor.scss +111 -111
  129. admin/scss/views.scss +47 -47
  130. admin/settings/class-strong-testimonials-settings-compat.php +0 -54
.gitignore DELETED
@@ -1,26 +0,0 @@
1
- #################
2
- ## PhpStorm
3
- #################
4
-
5
- .idea
6
-
7
- #############
8
- ## Windows detritus
9
- #############
10
-
11
- # Windows image file caches
12
- Thumbs.db
13
- ehthumbs.db
14
-
15
- # Folder config file
16
- Desktop.ini
17
-
18
- # Recycle Bin used on file shares
19
- $RECYCLE.BIN/
20
-
21
- # Mac crap
22
- .DS_Store
23
-
24
- # Plugin logs
25
- strong-debug.log
26
- strong-testimonials.log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/about/addons.php CHANGED
@@ -1,31 +1,23 @@
1
- <hr />
2
-
3
- <h2><?php _e( 'Get More Features With Free Add-ons', 'strong-testimonials' ); ?></h2>
4
-
5
- <div id="addons" class="feature-section three-col">
6
- <div class="col sidebar-block sidebar-news addon multiple-forms">
7
- <h3>Multiple Forms</h3>
8
- <p>Need more forms for different products or services? No problem. Create unlimited forms.</p>
9
- <div class="actions">
10
- <a href="https://strongplugins.com/plugins/strong-testimonials-multiple-forms?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
11
- </div>
12
- </div>
13
- <div class="col sidebar-block sidebar-news addon properties">
14
- <h3>Properties</h3>
15
- <p>Want to rebrand 'testimonials' as 'reviews'? Want to completely customize the permalink structure? Gain maximum control.</p>
16
- <div class="actions">
17
- <a href="https://strongplugins.com/plugins/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
18
- &nbsp;&bull;&nbsp;
19
- <a href="https://strongdemos.com/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
20
- </div>
21
- </div>
22
- <div class="col sidebar-block sidebar-news addon assignment">
23
- <h3>Assignment</h3>
24
- <p>Assign testimonials to any content type with features designed to simplify your workflow. Works well with portfolio, directory and service business themes.</p>
25
- <div class="actions">
26
- <a href="https://strongplugins.com/plugins/strong-testimonials-assignment?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
27
- &nbsp;&bull;&nbsp;
28
- <a href="https://strongdemos.com/strong-testimonials-assignment/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
29
- </div>
30
- </div>
31
- </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' ),
43
- 'menu_title' => __( 'About' ),
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
- $major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
55
- $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
56
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
57
- ?>
58
- <div class="wrap about-wrap">
59
-
60
- <?php /* translators: %s is the plugin version number */ ?>
61
- <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), $major_minor ); ?></h1>
62
-
63
- <p class="about-text">
64
- <?php _e( 'Thank you for updating to the latest version!' ); ?>
65
- <?php /* translators: %s is the plugin version number */ ?>
66
- </p>
67
-
68
- <div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
69
-
70
- <h2 class="nav-tab-wrapper wp-clearfix">
71
-
72
- <a href="<?php echo add_query_arg( 'tab', 'how-to', $url ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php _e( 'How To', 'strong-testimonials' ); ?></a>
73
-
74
- <a href="<?php echo add_query_arg( 'tab', 'privacy', $url ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Privacy' ); ?></a>
75
-
76
- </h2>
77
-
78
-
79
- <?php
80
- switch( $active_tab ) {
81
- case 'privacy':
82
- include WPMTST_ADMIN . 'about/privacy.php';
83
- break;
84
- default:
85
- include WPMTST_ADMIN . 'about/how-to.php';
86
- break;
87
- }
88
-
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' ),
43
+ 'menu_title' => __( 'About' ),
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
+ $major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
55
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
56
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
57
+ ?>
58
+ <div class="wrap about-wrap">
59
+
60
+ <?php /* translators: %s is the plugin version number */ ?>
61
+ <h1><?php printf( esc_html__( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), esc_html( $major_minor ) ); ?></h1>
62
+
63
+ <p class="about-text">
64
+ <?php esc_html_e( 'Thank you for updating to the latest version!' ); ?>
65
+ <?php /* translators: %s is the plugin version number */ ?>
66
+ </p>
67
+
68
+ <div class="wp-badge strong-testimonials"><?php printf( esc_html__( 'Version %s' ), esc_html( $major_minor ) ); ?></div>
69
+
70
+ <h2 class="nav-tab-wrapper wp-clearfix">
71
+
72
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'how-to', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'How To', 'strong-testimonials' ); ?></a>
73
+
74
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'privacy', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Privacy' ); ?></a>
75
+
76
+ </h2>
77
+
78
+
79
+ <?php
80
+ switch ( $active_tab ) {
81
+ case 'privacy':
82
+ include WPMTST_ADMIN . 'about/privacy.php';
83
+ break;
84
+ default:
85
+ include WPMTST_ADMIN . 'about/how-to.php';
86
+ break;
87
+ }
88
+
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 two-col">
8
- <div class="col">
9
- <h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
10
- <p>1. <?php printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ); ?>
11
- </p>
12
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
13
- <?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
14
- </p>
15
- <p>3. <?php echo $add_the_view; ?></p>
16
- </div>
17
-
18
- <div class="col">
19
- <h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
21
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
22
- <?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
23
- </p>
24
- <p>3. <?php echo $add_the_view; ?></p>
25
- </div>
26
-
27
- <div class="col">
28
- <h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
30
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
31
- <?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
32
- </p>
33
- <p>3. <?php echo $add_the_view; ?></p>
34
- </div>
35
-
36
- <div class="col">
37
- <h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
- <p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
- <p><?php _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ); ?></p>
40
- </div>
41
- </div>
1
+ <?php
2
+ $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
+ ?>
4
+ <h2><?php esc_html_e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
+ <p class="lead-description"><?php esc_html_e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
+
7
+ <div class="feature-section two-col">
8
+ <div class="col">
9
+ <h3><?php esc_html_e( 'How to Add the Form', 'strong-testimonials' ); ?></h3>
10
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ) ) ); ?>
11
+ </p>
12
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
13
+ <?php wp_kses_post( _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ) ); ?>
14
+ </p>
15
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
16
+ </div>
17
+
18
+ <div class="col">
19
+ <h3><?php esc_html_e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
21
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
22
+ <?php wp_kses_post( _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ) ); ?>
23
+ </p>
24
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
25
+ </div>
26
+
27
+ <div class="col">
28
+ <h3><?php esc_html_e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
30
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
31
+ <?php wp_kses_post( _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ) ); ?>
32
+ </p>
33
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
34
+ </div>
35
+
36
+ <div class="col">
37
+ <h3><?php esc_html_e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
+ <p><?php esc_html_e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
+ <p><?php wp_kses_post( _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ) ); ?></p>
40
+ </div>
41
+ </div>
admin/about/links.php CHANGED
@@ -1,76 +1,17 @@
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 class="col">
22
- <h3><?php _e( 'Tutorials', 'strong-testimonials' ); ?></h3>
23
- <?php
24
- $links = array();
25
-
26
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
27
- esc_url( 'https://strongplugins.com/document/strong-testimonials/troubleshooting/' ),
28
- __( 'Troubleshooting', 'strong-testimonials' ) );
29
-
30
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
31
- esc_url( 'https://strongplugins.com/document/strong-testimonials/embed-social-media/' ),
32
- __( 'How to add YouTube or Twitter', 'strong-testimonials' ) );
33
-
34
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
35
- esc_url( 'https://strongplugins.com/document/strong-testimonials/custom-css/' ),
36
- __( 'Using custom CSS', 'strong-testimonials' ) );
37
-
38
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
39
- esc_url( 'https://strongplugins.com/document/strong-testimonials/enable-comments/' ),
40
- __( 'How to enable comments', 'strong-testimonials' ) );
41
-
42
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
43
- esc_url( 'https://strongplugins.com/document/strong-testimonials/complete-example-customizing-form/' ),
44
- __( 'How to customize the form', 'strong-testimonials' ) );
45
- ?>
46
- <ul>
47
- <?php foreach ( $links as $link ) : ?>
48
- <li><?php echo $link; ?></li>
49
- <?php endforeach; ?>
50
- </ul>
51
- </div>
52
-
53
- <div class="col">
54
- <h3><?php _e( 'Demos', 'strong-testimonials' ); ?></h3>
55
- <?php
56
- $links = array();
57
-
58
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
59
- esc_url( 'https://strongdemos.com/strong-testimonials/display-examples/' ),
60
- __( 'Display examples', 'strong-testimonials' ) );
61
-
62
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
63
- esc_url( 'https://strongdemos.com/strong-testimonials/slideshow-examples/' ),
64
- __( 'Slideshow examples', 'strong-testimonials' ) );
65
-
66
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
67
- esc_url( 'https://strongdemos.com/strong-testimonials/form-examples/' ),
68
- __( 'Form examples', 'strong-testimonials' ) );
69
- ?>
70
- <ul>
71
- <?php foreach ( $links as $link ) : ?>
72
- <li><?php echo $link; ?></li>
73
- <?php endforeach; ?>
74
- </ul>
75
- </div>
76
- </div>
1
+ <hr />
2
+
3
+ <div class="feature-section three-col">
4
+ <div class="col">
5
+ <h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
6
+ <?php
7
+ $links = array();
8
+ $links[] = sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ), __( 'Use the community support forum', 'strong-testimonials' ) );
9
+ ?>
10
+ <ul>
11
+ <?php foreach ( $links as $link ) : ?>
12
+ <li><?php echo wp_kses_post( $link ); ?></li>
13
+ <?php endforeach; ?>
14
+ </ul>
15
+ </div>
16
+
17
+ </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 esc_html_e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
+ <p class="lead-description"><?php esc_html_e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
+ <div class="feature-section one-col">
4
+ <div class="col">
5
+ <p><?php esc_html_e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
+ <p><?php esc_html_e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
+ <p><strong><?php esc_html_e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
+ <p><?php esc_html_e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
+ <p><?php esc_html_e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
+ <p><?php esc_html_e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
+ <p><?php esc_html_e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
+ </div>
13
+ </div>
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,177 +1,182 @@
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 esc_attr_e( $key ); ?>">
65
- <p>
66
- <?php _e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
- </p>
68
- </div>
69
- <?php
70
- $html = ob_get_clean();
71
- break;
72
-
73
- case 'fields-saved' :
74
- ob_start();
75
- ?>
76
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
77
- <p>
78
- <?php _e( 'Fields saved.', 'strong-testimonials' ); ?>
79
- </p>
80
- </div>
81
- <?php
82
- $html = ob_get_clean();
83
- break;
84
-
85
- case 'changes-cancelled' :
86
- ob_start();
87
- ?>
88
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
89
- <p>
90
- <?php _e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
- </p>
92
- </div>
93
- <?php
94
- $html = ob_get_clean();
95
- break;
96
-
97
- case 'captcha-options-changed' :
98
- $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
- //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
- $settings_url = admin_url( '?action=captcha-options-changed' );
101
- $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
102
-
103
- ob_start();
104
- ?>
105
- <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
106
- <p>
107
- <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
- <?php echo $settings_link; ?>
109
- </p>
110
- </div>
111
- <?php
112
- $html = ob_get_clean();
113
- break;
114
-
115
- default :
116
- // nothing
117
- }
118
-
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 );
 
 
 
 
 
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 wp_kses_post( $message );
40
+ }
41
+ if ( ! $notice['persist'] ) {
42
+ wpmtst_delete_admin_notice( $key );
43
+ }
44
+ }
45
+ }
46
+ add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
+
48
+
49
+ /**
50
+ * Return specific admin notice text.
51
+ *
52
+ * @since 2.28.5
53
+ * @param string $html
54
+ * @param $key
55
+ *
56
+ * @return string
57
+ */
58
+ function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
+
60
+ switch ( $key ) {
61
+ case 'defaults-restored':
62
+ ob_start();
63
+ ?>
64
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
+ <p>
66
+ <?php esc_html_e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
+ </p>
68
+ </div>
69
+ <?php
70
+ $html = ob_get_clean();
71
+ break;
72
+
73
+ case 'fields-saved':
74
+ ob_start();
75
+ ?>
76
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
+ <p>
78
+ <?php esc_html_e( 'Fields saved.', 'strong-testimonials' ); ?>
79
+ </p>
80
+ </div>
81
+ <?php
82
+ $html = ob_get_clean();
83
+ break;
84
+
85
+ case 'changes-cancelled':
86
+ ob_start();
87
+ ?>
88
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
+ <p>
90
+ <?php esc_html_e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
+ </p>
92
+ </div>
93
+ <?php
94
+ $html = ob_get_clean();
95
+ break;
96
+
97
+ case 'captcha-options-changed':
98
+ $tags = array(
99
+ 'a' => array(
100
+ 'class' => array(),
101
+ 'href' => array(),
102
+ ),
103
+ );
104
+ //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
105
+ $settings_url = admin_url( '?action=captcha-options-changed' );
106
+ $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%1$s">%2$s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
107
+
108
+ ob_start();
109
+ ?>
110
+ <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
111
+ <p>
112
+ <?php echo wp_kses_post( _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ) ); ?>
113
+ <?php echo wp_kses_post( $settings_link ); ?>
114
+ </p>
115
+ </div>
116
+ <?php
117
+ $html = ob_get_clean();
118
+ break;
119
+
120
+ default:
121
+ // nothing
122
+ }
123
+
124
+ return $html;
125
+ }
126
+ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
127
+
128
+
129
+ /**
130
+ * Add admin notice to queue.
131
+ *
132
+ * @since 2.24.0
133
+ *
134
+ * @param $key
135
+ * @param $persist
136
+ */
137
+ function wpmtst_add_admin_notice( $key, $persist = false ) {
138
+ $notices = get_option( 'wpmtst_admin_notices', array() );
139
+ $notices[ $key ] = array( 'persist' => $persist );
140
+ update_option( 'wpmtst_admin_notices', $notices );
141
+ }
142
+
143
+
144
+ /**
145
+ * Delete admin notice from queue.
146
+ *
147
+ * @since 2.24.0
148
+ *
149
+ * @param $key
150
+ */
151
+ function wpmtst_delete_admin_notice( $key ) {
152
+ $notices = get_option( 'wpmtst_admin_notices', array() );
153
+ unset( $notices[ $key ] );
154
+ update_option( 'wpmtst_admin_notices', $notices );
155
+ }
156
+
157
+
158
+ /**
159
+ * Automatically dismiss specific notices when settings are saved.
160
+ *
161
+ * @since 2.29.0
162
+ * @param $option
163
+ * @param $old_value
164
+ * @param $value
165
+ */
166
+ function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
167
+ if ( ! function_exists( 'get_current_screen' ) ) {
168
+ return;
169
+ }
170
+
171
+ $screen = get_current_screen();
172
+ if ( $screen && 'options' == $screen->base ) {
173
+ if ( 'wpmtst_form_options' == $option ) {
174
+ $notices = get_option( 'wpmtst_admin_notices', array() );
175
+ if ( isset( $notices['captcha-options-changed'] ) ) {
176
+ unset( $notices['captcha-options-changed'] );
177
+ update_option( 'wpmtst_admin_notices', $notices );
178
+ }
179
+ }
180
+ }
181
+ }
182
+ add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
admin/admin.php CHANGED
@@ -1,329 +1,297 @@
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
- require_once WPMTST_ADMIN . 'class-strong-testimonials-updater.php';
47
- $updater = new Strong_Testimonials_Updater();
48
- $updater->update();
49
- }
50
-
51
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
52
-
53
- /**
54
- * Initialize.
55
- */
56
- function wpmtst_admin_init() {
57
- /**
58
- * Redirect to About page for new installs only
59
- *
60
- * @since 2.28.4
61
- */
62
- wpmtst_activation_redirect();
63
-
64
- /**
65
- * Custom action hooks
66
- *
67
- * @since 1.18.4
68
- */
69
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
70
- do_action( 'wpmtst_' . $_REQUEST['action'] );
71
- }
72
- }
73
-
74
- add_action( 'admin_init', 'wpmtst_admin_init' );
75
-
76
- /**
77
- * Custom action link in admin notice.
78
- *
79
- * @since 2.29.0
80
- */
81
- function wpmtst_action_captcha_options_changed() {
82
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
- exit;
85
- }
86
-
87
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
88
-
89
- /**
90
- * Redirect to About page.
91
- *
92
- * @since 2.28.4
93
- */
94
- function wpmtst_activation_redirect() {
95
- if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
96
- delete_option( 'wpmtst_do_activation_redirect' );
97
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
98
- exit;
99
- }
100
- }
101
-
102
- /**
103
- * Are we on a testimonial admin screen?
104
- *
105
- * Used by add-ons too!
106
- *
107
- * @return bool
108
- */
109
- function wpmtst_is_testimonial_screen() {
110
- $screen = get_current_screen();
111
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
112
- }
113
-
114
- /**
115
- * Add pending numbers to post types on admin menu.
116
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
117
- *
118
- * @param $menu
119
- *
120
- * @return mixed
121
- */
122
- function wpmtst_pending_indicator( $menu ) {
123
- if ( ! current_user_can( 'edit_posts' ) )
124
- return $menu;
125
-
126
- $options = get_option( 'wpmtst_options' );
127
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
128
- return $menu;
129
-
130
- $types = array( 'wpm-testimonial' );
131
- $status = 'pending';
132
- foreach ( $types as $type ) {
133
- $num_posts = wp_count_posts( $type, 'readable' );
134
- $pending_count = 0;
135
- if ( ! empty( $num_posts->$status ) )
136
- $pending_count = $num_posts->$status;
137
-
138
- if ( $type == 'post' )
139
- $menu_str = 'edit.php';
140
- else
141
- $menu_str = 'edit.php?post_type=' . $type;
142
-
143
- foreach ( $menu as $menu_key => $menu_data ) {
144
- if ( $menu_str != $menu_data[2] )
145
- continue;
146
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
147
- }
148
- }
149
-
150
- return $menu;
151
- }
152
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
153
-
154
- /**
155
- * The [restore default] icon.
156
- *
157
- * @param $for
158
- *
159
- * @since 2.18.0
160
- */
161
- function wpmtst_restore_default_icon( $for ) {
162
- if ( !$for ) return;
163
- ?>
164
- <input type="button" class="button secondary restore-default"
165
- title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
166
- value="&#xf171"
167
- data-for="<?php echo $for; ?>"/>
168
- <?php
169
- }
170
-
171
- /**
172
- * Add plugin links.
173
- *
174
- * @param $plugin_meta
175
- * @param $plugin_file
176
- * @param array $plugin_data
177
- * @param string $status
178
- *
179
- * @return array
180
- */
181
- function wpmtst_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data = array(), $status = '' ) {
182
-
183
- if ( $plugin_file == WPMTST_PLUGIN ) {
184
-
185
- $plugin_meta[] = sprintf(
186
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
187
- 'https://strongplugins.com/documents/',
188
- __( 'For guides and tutorials', 'strong-testimonials' ),
189
- __( 'Documentation', 'strong-testimonials' ) );
190
-
191
- $plugin_meta[] = sprintf(
192
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
193
- 'https://support.strongplugins.com/',
194
- __( 'For direct support requests', 'strong-testimonials' ),
195
- __( 'Support', 'strong-testimonials' ) );
196
-
197
- $plugin_meta[] = sprintf(
198
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
199
- 'https://strongplugins.com/',
200
- __( 'Get more features with premium add-ons', 'strong-testimonials' ),
201
- __( 'Add-ons', 'strong-testimonials' ) );
202
-
203
- }
204
-
205
- return $plugin_meta;
206
- }
207
- //add_filter( 'plugin_row_meta', 'wpmtst_plugin_row_meta' , 10, 4 );
208
-
209
-
210
- /**
211
- * Check for configuration issues when options are updated.
212
- *
213
- * @since 2.24.0
214
- * @param $option
215
- * @param $old_value
216
- * @param $value
217
- */
218
- function wpmtst_updated_option( $option, $old_value, $value ) {
219
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
220
- do_action( 'wpmtst_check_config' );
221
- }
222
- }
223
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
224
-
225
-
226
- /**
227
- * Store configuration error.
228
- *
229
- * @since 2.24.0
230
- * @param $key
231
- */
232
- function wpmtst_add_config_error( $key ) {
233
- $errors = get_option( 'wpmtst_config_errors', array() );
234
- $errors[] = $key;
235
- update_option( 'wpmtst_config_errors', array_unique( $errors ) );
236
-
237
- wpmtst_add_admin_notice( $key, true );
238
- }
239
-
240
-
241
- /**
242
- * Delete configuration error.
243
- *
244
- * @since 2.24.0
245
- * @param $key
246
- */
247
- function wpmtst_delete_config_error( $key ) {
248
- $errors = get_option( 'wpmtst_config_errors', array() );
249
- $errors = array_diff( $errors, array ( $key ) );
250
- update_option( 'wpmtst_config_errors', $errors );
251
-
252
- wpmtst_delete_admin_notice( $key );
253
- }
254
-
255
-
256
- /**
257
- * Save a View.
258
- *
259
- * @param $view
260
- * @param string $action
261
- * @usedby Strong_Testimonials_Update:update_views
262
- *
263
- * @return bool|false|int
264
- */
265
- function wpmtst_save_view( $view, $action = 'edit' ) {
266
- global $wpdb;
267
-
268
- if ( ! $view ) return false;
269
-
270
- $table_name = $wpdb->prefix . 'strong_views';
271
- $serialized = serialize( $view['data'] );
272
-
273
- if ( 'add' == $action || 'duplicate' == $action ) {
274
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
275
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
276
- $wpdb->query( $sql );
277
- $view['id'] = $wpdb->insert_id;
278
- $return = $view['id'];
279
- }
280
- else {
281
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
282
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
283
- $wpdb->query( $sql );
284
- $return = $wpdb->last_error ? 0 : 1;
285
- }
286
-
287
- do_action( 'wpmtst_view_saved', $view );
288
-
289
- return $return;
290
- }
291
-
292
-
293
- /**
294
- * @param $field
295
- *
296
- * @return mixed
297
- */
298
- function wpmtst_get_field_label( $field ) {
299
- if ( isset( $field['field'] ) ) {
300
- $custom_fields = wpmtst_get_custom_fields();
301
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
302
- return $custom_fields[ $field['field'] ]['label'];
303
- }
304
- $builtin_fields = wpmtst_get_builtin_fields();
305
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
306
- return $builtin_fields[ $field['field'] ]['label'];
307
- }
308
- }
309
-
310
- return '';
311
- }
312
-
313
-
314
- /**
315
- * @param string $field_name
316
- *
317
- * @return mixed
318
- */
319
- function wpmtst_get_field_by_name( $field_name = '' ) {
320
- if ( $field_name ) {
321
- $custom_fields = wpmtst_get_custom_fields();
322
- if ( isset( $custom_fields[ $field_name ] ) ) {
323
- return $custom_fields[ $field_name ];
324
- }
325
- }
326
-
327
- return '';
328
- }
329
-
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( wp_kses_post( $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
+ require_once WPMTST_ADMIN . 'class-strong-testimonials-updater.php';
47
+ $updater = new Strong_Testimonials_Updater();
48
+ $updater->update();
49
+ }
50
+
51
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
52
+
53
+ /**
54
+ * Initialize.
55
+ */
56
+ function wpmtst_admin_init() {
57
+ /**
58
+ * Redirect to About page for new installs only
59
+ *
60
+ * @since 2.28.4
61
+ */
62
+ wpmtst_activation_redirect();
63
+
64
+ /**
65
+ * Custom action hooks
66
+ *
67
+ * @since 1.18.4
68
+ */
69
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
70
+ do_action( 'wpmtst_' . $_REQUEST['action'] );
71
+ }
72
+ }
73
+
74
+ add_action( 'admin_init', 'wpmtst_admin_init' );
75
+
76
+ /**
77
+ * Custom action link in admin notice.
78
+ *
79
+ * @since 2.29.0
80
+ */
81
+ function wpmtst_action_captcha_options_changed() {
82
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
+ exit;
85
+ }
86
+
87
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
88
+
89
+ /**
90
+ * Redirect to About page.
91
+ *
92
+ * @since 2.28.4
93
+ */
94
+ function wpmtst_activation_redirect() {
95
+ if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
96
+ delete_option( 'wpmtst_do_activation_redirect' );
97
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
98
+ exit;
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Are we on a testimonial admin screen?
104
+ *
105
+ * Used by add-ons too!
106
+ *
107
+ * @return bool
108
+ */
109
+ function wpmtst_is_testimonial_screen() {
110
+ $screen = get_current_screen();
111
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
112
+ }
113
+
114
+ /**
115
+ * Add pending numbers to post types on admin menu.
116
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
117
+ *
118
+ * @param $menu
119
+ *
120
+ * @return mixed
121
+ */
122
+ function wpmtst_pending_indicator( $menu ) {
123
+ if ( ! current_user_can( 'edit_posts' ) ) {
124
+ return $menu;
125
+ }
126
+
127
+ $options = get_option( 'wpmtst_options' );
128
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] ) {
129
+ return $menu;
130
+ }
131
+
132
+ $types = array( 'wpm-testimonial' );
133
+ $status = 'pending';
134
+ foreach ( $types as $type ) {
135
+ $num_posts = wp_count_posts( $type, 'readable' );
136
+ $pending_count = 0;
137
+ if ( ! empty( $num_posts->$status ) ) {
138
+ $pending_count = $num_posts->$status;
139
+ }
140
+
141
+ if ( $type == 'post' ) {
142
+ $menu_str = 'edit.php';
143
+ } else {
144
+ $menu_str = 'edit.php?post_type=' . $type;
145
+ }
146
+
147
+ foreach ( $menu as $menu_key => $menu_data ) {
148
+ if ( $menu_str != $menu_data[2] ) {
149
+ continue;
150
+ }
151
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
152
+ }
153
+ }
154
+
155
+ return $menu;
156
+ }
157
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
158
+
159
+ /**
160
+ * The [restore default] icon.
161
+ *
162
+ * @param $for
163
+ *
164
+ * @since 2.18.0
165
+ */
166
+ function wpmtst_restore_default_icon( $for ) {
167
+ if ( ! $for ) {
168
+ return;
169
+ }
170
+ ?>
171
+ <input type="button" class="button secondary restore-default" title="<?php esc_attr_e( 'restore default', 'strong-testimonials' ); ?>" value="&#xf171" data-for="<?php echo esc_attr( $for ); ?>"/>
172
+ <?php
173
+ }
174
+
175
+
176
+
177
+ /**
178
+ * Check for configuration issues when options are updated.
179
+ *
180
+ * @since 2.24.0
181
+ * @param $option
182
+ * @param $old_value
183
+ * @param $value
184
+ */
185
+ function wpmtst_updated_option( $option, $old_value, $value ) {
186
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
187
+ do_action( 'wpmtst_check_config' );
188
+ }
189
+ }
190
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
191
+
192
+
193
+ /**
194
+ * Store configuration error.
195
+ *
196
+ * @since 2.24.0
197
+ * @param $key
198
+ */
199
+ function wpmtst_add_config_error( $key ) {
200
+ $errors = get_option( 'wpmtst_config_errors', array() );
201
+ $errors[] = $key;
202
+ update_option( 'wpmtst_config_errors', array_unique( $errors ) );
203
+
204
+ wpmtst_add_admin_notice( $key, true );
205
+ }
206
+
207
+
208
+ /**
209
+ * Delete configuration error.
210
+ *
211
+ * @since 2.24.0
212
+ * @param $key
213
+ */
214
+ function wpmtst_delete_config_error( $key ) {
215
+ $errors = get_option( 'wpmtst_config_errors', array() );
216
+ $errors = array_diff( $errors, array( $key ) );
217
+ update_option( 'wpmtst_config_errors', $errors );
218
+
219
+ wpmtst_delete_admin_notice( $key );
220
+ }
221
+
222
+
223
+ /**
224
+ * Save a View.
225
+ *
226
+ * @param $view
227
+ * @param string $action
228
+ * @usedby Strong_Testimonials_Update:update_views
229
+ *
230
+ * @return bool|false|int
231
+ */
232
+ function wpmtst_save_view( $view, $action = 'edit' ) {
233
+ global $wpdb;
234
+
235
+ if ( ! $view ) {
236
+ return false;
237
+ }
238
+
239
+ $table_name = $wpdb->prefix . 'strong_views';
240
+ $serialized = serialize( $view['data'] );
241
+
242
+ if ( 'add' == $action || 'duplicate' == $action ) {
243
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
244
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
245
+ $wpdb->query( $sql );
246
+ $view['id'] = $wpdb->insert_id;
247
+ $return = $view['id'];
248
+ } else {
249
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
250
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
251
+ $wpdb->query( $sql );
252
+ $return = $wpdb->last_error ? 0 : 1;
253
+ }
254
+
255
+ do_action( 'wpmtst_view_saved', $view );
256
+
257
+ return $return;
258
+ }
259
+
260
+
261
+ /**
262
+ * @param $field
263
+ *
264
+ * @return mixed
265
+ */
266
+ function wpmtst_get_field_label( $field ) {
267
+ if ( isset( $field['field'] ) ) {
268
+ $custom_fields = wpmtst_get_custom_fields();
269
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
270
+ return $custom_fields[ $field['field'] ]['label'];
271
+ }
272
+ $builtin_fields = wpmtst_get_builtin_fields();
273
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
274
+ return $builtin_fields[ $field['field'] ]['label'];
275
+ }
276
+ }
277
+
278
+ return '';
279
+ }
280
+
281
+
282
+ /**
283
+ * @param string $field_name
284
+ *
285
+ * @return mixed
286
+ */
287
+ function wpmtst_get_field_by_name( $field_name = '' ) {
288
+ if ( $field_name ) {
289
+ $custom_fields = wpmtst_get_custom_fields();
290
+ if ( isset( $custom_fields[ $field_name ] ) ) {
291
+ return $custom_fields[ $field_name ];
292
+ }
293
+ }
294
+
295
+ return '';
296
+ }
297
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,323 @@
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
+ // 5. add [category], [comments] and [date]
116
+ // The slug "categories" slug is reserved by WordPress.
117
+ if ( wpmtst_get_cat_count() ) {
118
+ $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
119
+ }
120
+
121
+ if ( $comments ) {
122
+ $fields_to_add['comments'] = $comments;
123
+ }
124
+
125
+ $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
126
+
127
+ // Push other added columns like [search_exclude] to the end.
128
+ $columns = array_merge(
129
+ array_slice( $columns, 0, $offset ),
130
+ $fields_to_add,
131
+ array_slice( $columns, $offset, null )
132
+ );
133
+
134
+ return $columns;
135
+ }
136
+
137
+ /**
138
+ * Show custom values
139
+ *
140
+ * @param $column
141
+ */
142
+ public static function custom_columns( $column ) {
143
+ global $post;
144
+
145
+ switch ( $column ) {
146
+
147
+ case 'post_id':
148
+ echo wp_kses_post( $post->ID );
149
+ break;
150
+
151
+ case 'post_content':
152
+ echo wp_kses_post( substr( $post->post_content, 0, 100 ) ) . '&hellip;';
153
+ break;
154
+
155
+ case 'post_excerpt':
156
+ echo wp_kses_post( $post->post_excerpt );
157
+ break;
158
+
159
+ case 'strong_thumbnail':
160
+ echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
161
+ break;
162
+
163
+ case 'category':
164
+ $categories = get_the_terms( 0, 'wpm-testimonial-category' );
165
+ if ( $categories && ! is_wp_error( $categories ) ) {
166
+ $list = array();
167
+ foreach ( $categories as $cat ) {
168
+ $list[] = $cat->name;
169
+ }
170
+ echo wp_kses_post( join( ', ', $list ) );
171
+ }
172
+ break;
173
+
174
+ case 'handle':
175
+ if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
176
+ echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
177
+ }
178
+ break;
179
+
180
+ default:
181
+ // custom field?
182
+ $custom = get_post_custom();
183
+ $fields = wpmtst_get_custom_fields();
184
+
185
+ if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
186
+
187
+ if ( isset( $fields[ $column ] ) ) {
188
+
189
+ switch ( $fields[ $column ]['input_type'] ) {
190
+ case 'rating':
191
+ wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
192
+ break;
193
+ case 'checkbox':
194
+ echo $custom[ $column ][0] ? 'yes' : 'no';
195
+ break;
196
+ default:
197
+ echo wp_kses_post( $custom[ $column ][0] );
198
+ }
199
+ }
200
+ } else {
201
+
202
+ if ( isset( $fields[ $column ] ) ) {
203
+
204
+ if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
205
+ echo 'no';
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Add thumbnail column to admin list
214
+ *
215
+ * @param $columns
216
+ *
217
+ * @return array
218
+ */
219
+ public static function add_thumbnail_column( $columns ) {
220
+ $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
221
+
222
+ return $columns;
223
+ }
224
+
225
+ /**
226
+ * Make columns sortable.
227
+ *
228
+ * @param $columns
229
+ *
230
+ * @since 1.12.0
231
+ * @since 2.2.0 category
232
+ *
233
+ * @return mixed
234
+ */
235
+ public static function manage_sortable_columns( $columns ) {
236
+ $columns['client_name'] = 'client_name';
237
+ $columns['category'] = 'categories';
238
+ $columns['date'] = 'date';
239
+
240
+ return $columns;
241
+ }
242
+
243
+ /**
244
+ * Add category filter to testimonial list table.
245
+ *
246
+ * @since 2.2.0
247
+ */
248
+ public static function add_taxonomy_filters() {
249
+ global $typenow;
250
+
251
+ if ( $typenow != 'wpm-testimonial' ) {
252
+ return;
253
+ }
254
+
255
+ $taxonomies = array( 'wpm-testimonial-category' );
256
+
257
+ foreach ( $taxonomies as $tax ) {
258
+ $tax_obj = get_taxonomy( $tax );
259
+ $args = array(
260
+ 'show_option_all' => $tax_obj->labels->all_items,
261
+ 'show_option_none' => '',
262
+ 'option_none_value' => '-1',
263
+ 'orderby' => 'NAME',
264
+ 'order' => 'ASC',
265
+ 'show_count' => 1,
266
+ 'hide_empty' => 1,
267
+ 'child_of' => 0,
268
+ 'exclude' => '',
269
+ 'echo' => 1,
270
+ 'selected' => isset( $_GET[ $tax ] ) ? $_GET[ $tax ] : '',
271
+ 'hierarchical' => 1,
272
+ 'name' => $tax,
273
+ 'id' => $tax,
274
+ 'class' => 'postform',
275
+ 'depth' => 0,
276
+ 'tab_index' => 0,
277
+ 'taxonomy' => $tax,
278
+ 'hide_if_empty' => true,
279
+ 'value_field' => 'slug',
280
+ );
281
+
282
+ wp_dropdown_categories( $args );