Version Description
- May 6, 2018 =
- Fix bug in add-on activation process.
Download this release
Release Info
Developer | cdillon27 |
Plugin | Strong Testimonials |
Version | 2.30.9 |
Comparing to | |
See all releases |
Version 2.30.9
- .gitignore +26 -0
- admin/about/about.php +10 -0
- admin/about/addons.php +40 -0
- admin/about/class-strong-testimonials-about.php +113 -0
- admin/about/how-to.php +70 -0
- admin/about/links.php +83 -0
- admin/about/whats-new.php +66 -0
- admin/admin-notices.php +177 -0
- admin/admin.php +329 -0
- admin/class-strong-testimonials-admin-category-list.php +69 -0
- admin/class-strong-testimonials-admin-list.php +315 -0
- admin/class-strong-testimonials-admin-scripts.php +384 -0
- admin/class-strong-testimonials-defaults.php +829 -0
- admin/class-strong-testimonials-help.php +227 -0
- admin/class-strong-testimonials-list-table.php +1150 -0
- admin/class-strong-testimonials-post-editor.php +336 -0
- admin/class-strong-testimonials-updater.php +1270 -0
- admin/class-strong-views-list-table.php +218 -0
- admin/class-walker-strong-category-checklist.php +128 -0
- admin/class-walker-strong-form-category-checklist.php +128 -0
- admin/compat.php +116 -0
- admin/css/about.css +53 -0
- admin/css/admin-compat.css +200 -0
- admin/css/admin-form.css +138 -0
- admin/css/admin.css +780 -0
- admin/css/fields.css +317 -0
- admin/css/form-preview.css +135 -0
- admin/css/number-spinner.css +98 -0
- admin/css/order.css +102 -0
- admin/css/polylang.css +8 -0
- admin/css/post-editor.css +110 -0
- admin/css/views.css +955 -0
- admin/css/views.css.map +7 -0
- admin/css/wpml.css +31 -0
- admin/custom-fields-ajax.php +99 -0
- admin/custom-fields.php +492 -0
- admin/edd/EDD_SL_Plugin_Updater.php +500 -0
- admin/edd/Strong_Plugin_Updater.php +234 -0
- admin/form-preview.php +51 -0
- admin/img/quotes.png +0 -0
- admin/img/screen-options.png +0 -0
- admin/img/strong-date.png +0 -0
- admin/img/strong-testimonials-badge.png +0 -0
- admin/js/addon-licenses.js +79 -0
- admin/js/admin-compat.js +115 -0
- admin/js/admin-fields.js +602 -0
- admin/js/admin-form.js +164 -0
- admin/js/admin-global.js +26 -0
- admin/js/admin-order.js +128 -0
- admin/js/admin.js +106 -0
- admin/js/custom-spinner.js +81 -0
- admin/js/help.js +22 -0
- admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -0
- admin/js/lib/are-you-sure/jquery.are-you-sure.min.js +1 -0
- admin/js/lib/autosize/autosize.min.js +6 -0
- admin/js/rating-edit.js +85 -0
- admin/js/view-category-filter.js +47 -0
- admin/js/views.js +1137 -0
- admin/menu/class-strong-testimonials-menu-fields.php +55 -0
- admin/menu/class-strong-testimonials-menu-settings.php +57 -0
- admin/menu/class-strong-testimonials-menu-views.php +55 -0
- admin/menu/class-strong-testimonials-menu.php +51 -0
- admin/partials/fields/field-controls.php +12 -0
- admin/partials/fields/field-header.php +13 -0
- admin/partials/fields/field-label.php +15 -0
- admin/partials/fields/field-name.php +22 -0
- admin/partials/fields/field-text.php +14 -0
- admin/partials/fields/field-type.php +75 -0
- admin/partials/templates/form-preview-template.php +27 -0
- admin/partials/views/group-compat.php +10 -0
- admin/partials/views/group-extra.php +14 -0
- admin/partials/views/group-fields.php +20 -0
- admin/partials/views/group-form.php +14 -0
- admin/partials/views/group-query.php +27 -0
- admin/partials/views/group-slideshow.php +17 -0
- admin/partials/views/group-style.php +41 -0
- admin/partials/views/option-background.php +151 -0
- admin/partials/views/option-boilerplate.php +39 -0
- admin/partials/views/option-category.php +56 -0
- admin/partials/views/option-classes.php +14 -0
- admin/partials/views/option-client-section.php +26 -0
- admin/partials/views/option-color.php +57 -0
- admin/partials/views/option-content.php +185 -0
- admin/partials/views/option-divi.php +24 -0
- admin/partials/views/option-form-ajax.php +13 -0
- admin/partials/views/option-form-category.php +28 -0
- admin/partials/views/option-id.php +23 -0
- admin/partials/views/option-layout.php +147 -0
- admin/partials/views/option-limit.php +33 -0
- admin/partials/views/option-order.php +26 -0
- admin/partials/views/option-pagination.php +167 -0
- admin/partials/views/option-read-more-page.php +87 -0
- admin/partials/views/option-select.php +29 -0
- admin/partials/views/option-slideshow-behavior.php +93 -0
- admin/partials/views/option-slideshow-navigation.php +88 -0
- admin/partials/views/option-slideshow-transition.php +42 -0
- admin/partials/views/option-template-list.php +22 -0
- admin/partials/views/option-thumbnail.php +91 -0
- admin/partials/views/option-title.php +20 -0
- admin/partials/views/template-input.php +8 -0
- admin/partials/views/template-not-found.php +25 -0
- admin/partials/views/template-options.php +78 -0
- admin/partials/views/view-mode.php +18 -0
- admin/partials/views/view-name.php +17 -0
- admin/partials/views/view-shortcode.php +23 -0
- admin/scss/_partials/_background.scss +30 -0
- admin/scss/_partials/_category-checkboxes.scss +19 -0
- admin/scss/_partials/_category-filter.scss +58 -0
- admin/scss/_partials/_checkbox-icons.scss +52 -0
- admin/scss/_partials/_custom-fields.scss +173 -0
- admin/scss/_partials/_elements.scss +93 -0
- admin/scss/_partials/_form-table.scss +98 -0
- admin/scss/_partials/_help-tab.scss +50 -0
- admin/scss/_partials/_inputs.scss +49 -0
- admin/scss/_partials/_layout-example-columns.scss +42 -0
- admin/scss/_partials/_layout-example-grid.scss +33 -0
- admin/scss/_partials/_layout-example-masonry.scss +22 -0
- admin/scss/_partials/_layout-examples.scss +40 -0
- admin/scss/_partials/_layout.scss +15 -0
- admin/scss/_partials/_list-radio-buttons.scss +139 -0
- admin/scss/_partials/_misc.scss +49 -0
- admin/scss/_partials/_screenshots.scss +10 -0
- admin/scss/_partials/_sticky-views.scss +48 -0
- admin/scss/_partials/_structure.scss +41 -0
- admin/scss/_partials/_template.scss +43 -0
- admin/scss/_partials/_view-info.scss +177 -0
- admin/scss/about.scss +76 -0
- admin/scss/admin-compat.scss +141 -0
- admin/scss/number-spinner.scss +107 -0
- admin/scss/post-editor.scss +111 -0
- admin/scss/views.scss +33 -0
- admin/settings/class-strong-testimonials-settings-compat.php +590 -0
- admin/settings/class-strong-testimonials-settings-form.php +246 -0
- admin/settings/class-strong-testimonials-settings-general.php +101 -0
- admin/settings/class-strong-testimonials-settings-licenses.php +111 -0
- admin/settings/class-strong-testimonials-settings.php +92 -0
- admin/settings/partials/email-from.php +93 -0
- admin/settings/partials/email-to.php +43 -0
- admin/settings/partials/email.php +64 -0
- admin/settings/partials/form.php +389 -0
- admin/settings/partials/general.php +231 -0
- admin/settings/partials/licenses.php +27 -0
- admin/settings/partials/recipient.php +68 -0
- admin/view-list-order.php +55 -0
- admin/views-ajax.php +105 -0
- admin/views-validate.php +477 -0
- admin/views.php +844 -0
- changelog.txt +602 -0
- includes/class-strong-form.php +659 -0
- includes/class-strong-log.php +141 -0
- includes/class-strong-mail.php +62 -0
- includes/class-strong-templates.php +542 -0
- includes/class-strong-testimonials-order.php +291 -0
- includes/class-strong-testimonials-render.php +702 -0
- includes/class-strong-testimonials-shortcodes.php +188 -0
- includes/class-strong-view-display.php +432 -0
- includes/class-strong-view-form.php +265 -0
- includes/class-strong-view-slideshow.php +386 -0
- includes/class-strong-view.php +421 -0
- includes/class-walker-strong-category-checklist-front.php +127 -0
- includes/deprecated.php +73 -0
- includes/filters.php +23 -0
- includes/functions-activation.php +42 -0
- includes/functions-content.php +240 -0
- includes/functions-image.php +170 -0
- includes/functions-rating.php +100 -0
- includes/functions-template-form.php +610 -0
- includes/functions-template.php +604 -0
- includes/functions-views.php +96 -0
- includes/functions.php +824 -0
- includes/integrations/class-integration-captcha-pro.php +25 -0
- includes/integrations/class-integration-captcha.php +14 -0
- includes/integrations/class-integration-google-captcha.php +24 -0
- includes/integrations/class-integration-really-simple-captcha.php +40 -0
- includes/l10n-polylang.php +168 -0
- includes/l10n-wpml.php +234 -0
- includes/post-types.php +248 -0
- includes/retro.php +138 -0
- includes/scripts.php +217 -0
- includes/widget2.php +153 -0
- languages/strong-testimonials-ar_AR.mo +0 -0
- languages/strong-testimonials-ar_AR.po +3333 -0
- languages/strong-testimonials-es_ES.mo +0 -0
- languages/strong-testimonials-es_ES.po +35 -0
.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/about.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php _e( 'Flexible Features. Strong Support.', 'strong-testimonials' ); ?></h2>
|
2 |
+
<p class="lead-description"><?php _e( 'The highest-rated free testimonials plugin trusted by more than 50,000 people keeps getting better.', 'strong-testimonials' ); ?></p>
|
3 |
+
<div class="feature-section one-col">
|
4 |
+
<div class="col">
|
5 |
+
<p><?php _e( 'Your site is unique, right? So are your testimonials. This plugin is designed from the ground up to simplify the process of customizing your testimonials or reviews.', 'strong-testimonials' ); ?></p>
|
6 |
+
<p><?php _e( '<strong>Custom fields</strong> are deeply integrated into Strong Testimonials so it\'s simple to configure the fields on your testimonial submission form, update those fields when adding or editing testimonials, and select which fields to display on your testimonials. The plugin even includes a default set of custom fields so you can get started quickly.', 'strong-testimonials' ); ?></p>
|
7 |
+
<p><?php _e( 'Forget about complicated shortcodes. Use <strong>views</strong> to construct unlimited testimonial displays including grids and slideshows with features like excerpts and pagination in a variety of templates.', 'strong-testimonials' ); ?></p>
|
8 |
+
<p><?php _e( 'Power up with plugins like Popup Maker or Google Captcha. For developers, actions and filters allow further customization.', 'strong-testimonials' ); ?></p>
|
9 |
+
</div>
|
10 |
+
</div>
|
admin/about/addons.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<hr />
|
2 |
+
|
3 |
+
<h2><?php _e( 'Get More Features With Pro Add-ons', 'strong-testimonials' ); ?></h2>
|
4 |
+
|
5 |
+
<div id="addons" class="feature-section three-col">
|
6 |
+
<div class="col sidebar-block sidebar-news addon review-markup">
|
7 |
+
<h3>Review Markup</h3>
|
8 |
+
<p>Improve your search engine results and get Rich Snippets by adding review markup to your testimonials. </p>
|
9 |
+
<div class="actions">
|
10 |
+
<a href="https://strongplugins.com/plugins/strong-testimonials-review-markup/?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
|
11 |
+
•
|
12 |
+
<a href="https://strongdemos.com/strong-testimonials-review-markup/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<div class="col sidebar-block sidebar-news addon multiple-forms">
|
16 |
+
<h3>Multiple Forms</h3>
|
17 |
+
<p>Need more forms for different products or services? No problem. Create unlimited forms.</p>
|
18 |
+
<div class="actions">
|
19 |
+
<a href="https://strongplugins.com/plugins/strong-testimonials-multiple-forms?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
<div class="col sidebar-block sidebar-news addon properties">
|
23 |
+
<h3>Properties</h3>
|
24 |
+
<p>Want to rebrand 'testimonials' as 'reviews'? Want to completely customize the permalink structure? Gain maximum control.</p>
|
25 |
+
<div class="actions">
|
26 |
+
<a href="https://strongplugins.com/plugins/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
|
27 |
+
•
|
28 |
+
<a href="https://strongdemos.com/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div class="col sidebar-block sidebar-news addon assignment">
|
32 |
+
<h3>Assignment</h3>
|
33 |
+
<p>Assign testimonials to any object (posts, pages, media or custom content types) with features designed to simplify your workflow. Works well with portfolio, directory and service business themes.</p>
|
34 |
+
<div class="actions">
|
35 |
+
<a href="https://strongplugins.com/plugins/strong-testimonials-assignment?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
|
36 |
+
•
|
37 |
+
<a href="https://strongdemos.com/strong-testimonials-assignment-1/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
</div>
|
admin/about/class-strong-testimonials-about.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Initialize.
|
18 |
+
*/
|
19 |
+
public function init() {
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Add actions and filters.
|
24 |
+
*/
|
25 |
+
public function add_actions() {
|
26 |
+
add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Add submenu page.
|
31 |
+
*
|
32 |
+
* @param $pages
|
33 |
+
*
|
34 |
+
* @return mixed
|
35 |
+
*/
|
36 |
+
public function add_submenu( $pages ) {
|
37 |
+
$pages[90] = $this->get_submenu();
|
38 |
+
return $pages;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return submenu page parameters.
|
43 |
+
*
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function get_submenu() {
|
47 |
+
return array(
|
48 |
+
'page_title' => __( 'About' ),
|
49 |
+
'menu_title' => __( 'About' ),
|
50 |
+
'capability' => 'strong_testimonials_about',
|
51 |
+
'menu_slug' => 'about-strong-testimonials',
|
52 |
+
'function' => array( $this, 'about_page' ),
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Print the About page.
|
58 |
+
*/
|
59 |
+
public function about_page() {
|
60 |
+
$major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
|
61 |
+
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'about';
|
62 |
+
$url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
|
63 |
+
?>
|
64 |
+
<div class="wrap about-wrap">
|
65 |
+
|
66 |
+
<h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), $major_minor ); ?></h1>
|
67 |
+
|
68 |
+
<p class="about-text">
|
69 |
+
<?php _e( 'Thank you for updating to the latest version!' ); ?>
|
70 |
+
<?php printf( 'Strong Testimonials %s offers improved view options.', $major_minor ); ?>
|
71 |
+
</p>
|
72 |
+
|
73 |
+
<div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
|
74 |
+
|
75 |
+
<h2 class="nav-tab-wrapper wp-clearfix">
|
76 |
+
|
77 |
+
<a href="<?php echo $url; ?>" class="nav-tab <?php echo $active_tab == 'about' ? 'nav-tab-active' : ''; ?>"><?php _e( 'About' ); ?></a>
|
78 |
+
|
79 |
+
<a href="<?php echo add_query_arg( 'tab', 'whats-new', $url ); ?>" class="nav-tab <?php echo $active_tab == 'whats-new' ? 'nav-tab-active' : ''; ?>"><?php _e( 'What’s New' ); ?></a>
|
80 |
+
|
81 |
+
<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>
|
82 |
+
|
83 |
+
</h2>
|
84 |
+
|
85 |
+
<!--
|
86 |
+
<div class="changelog point-releases">
|
87 |
+
</div>
|
88 |
+
-->
|
89 |
+
|
90 |
+
<?php
|
91 |
+
switch( $active_tab ) {
|
92 |
+
case 'how-to':
|
93 |
+
include WPMTST_ADMIN . 'about/how-to.php';
|
94 |
+
break;
|
95 |
+
case 'whats-new':
|
96 |
+
include WPMTST_ADMIN . 'about/whats-new.php';
|
97 |
+
break;
|
98 |
+
default:
|
99 |
+
include WPMTST_ADMIN. 'about/about.php';
|
100 |
+
}
|
101 |
+
|
102 |
+
include WPMTST_ADMIN. 'about/links.php';
|
103 |
+
include WPMTST_ADMIN. 'about/addons.php';
|
104 |
+
?>
|
105 |
+
|
106 |
+
</div>
|
107 |
+
<?php
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
new Strong_Testimonials_About();
|
admin/about/how-to.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 one-col">
|
8 |
+
<p><?php printf( __( 'Testimonials are like posts. They can be viewed individually. For example, a testimonial with the title "Highly recommended!" is viewable at <a href="#" class="nogo">%1$s</a>.', 'strong-testimonials' ), home_url( 'testimonial/highly-recommended' ) ); ?></p>
|
9 |
+
|
10 |
+
<script>
|
11 |
+
document.querySelector(".nogo").addEventListener("click", function (e) {
|
12 |
+
e.preventDefault();
|
13 |
+
this.blur();
|
14 |
+
});
|
15 |
+
</script>
|
16 |
+
|
17 |
+
<p><?php _e( 'The more common approach is to display a group of testimonials. Among the many options, you can select which testimonials to include, what fields to show, and the layout.', 'strong-testimonials' ); ?></p>
|
18 |
+
|
19 |
+
<p><?php _e( 'The plugin provides a tool for configuring those displays: <strong>Views</strong>.', 'strong-testimonials' ); ?>
|
20 |
+
<?php _e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
|
21 |
+
<?php _e( 'You can create <em>unlimited</em> views.', 'strong-testimonials' ); ?>
|
22 |
+
<?php _e( 'Each view has its own simple shortcode.', 'strong-testimonials' ); ?>
|
23 |
+
</p>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="feature-section two-col">
|
27 |
+
<div class="col">
|
28 |
+
<h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
|
29 |
+
<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' ) ); ?>
|
30 |
+
</p>
|
31 |
+
<p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
|
32 |
+
<?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
|
33 |
+
</p>
|
34 |
+
<p>3. <?php echo $add_the_view; ?></p>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
<div class="col">
|
38 |
+
<h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
|
39 |
+
<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>
|
40 |
+
<p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
|
41 |
+
<?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
|
42 |
+
</p>
|
43 |
+
<p>3. <?php echo $add_the_view; ?></p>
|
44 |
+
</div>
|
45 |
+
|
46 |
+
<div class="col">
|
47 |
+
<h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
|
48 |
+
<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>
|
49 |
+
<p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
|
50 |
+
<?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
|
51 |
+
</p>
|
52 |
+
<p>3. <?php echo $add_the_view; ?></p>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<div class="col">
|
56 |
+
<h3><?php _e( 'How to Display the Number of Testimonials', 'strong-testimonials' ); ?></h3>
|
57 |
+
<p><?php printf( __( 'Use the %s shortcode.', 'strong-testimonials' ), '<code>[testimonial_count]</code>' ); ?>
|
58 |
+
<?php _e( 'For example:', 'strong-testimonials' ); ?></p>
|
59 |
+
<p><span class="code"><?php printf( __( 'Read some of our %s testimonials!', 'strong-testimonials' ), '[testimonial_count]' ); ?></span></p>
|
60 |
+
<p><?php printf( __( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
|
61 |
+
<?php _e( 'For example:', 'strong-testimonials' ); ?></p>
|
62 |
+
<p><span class="code"><?php printf( __( 'Here\'s what %s local clients say', 'strong-testimonials' ), '[testimonial_count category="local"]' ); ?></span></p>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<div class="col">
|
66 |
+
<h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
|
67 |
+
<p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
|
68 |
+
<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>
|
69 |
+
</div>
|
70 |
+
</div>
|
admin/about/links.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 public support forum', 'strong-testimonials' ) );
|
12 |
+
|
13 |
+
$links[] = __( 'or', 'strong-testimonials' ) . ' ' . sprintf( '<a href="%s" target="_blank">%s</a>',
|
14 |
+
esc_url( 'https://support.strongplugins.com' ),
|
15 |
+
__( 'submit a private support ticket', 'strong-testimonials' ) );
|
16 |
+
|
17 |
+
$links[] = __( 'or', 'strong-testimonials' ) . ' ' . sprintf( '<a href="%s" target="_blank">%s</a>',
|
18 |
+
esc_url( 'https://strongplugins.com/contact/' ),
|
19 |
+
__( 'contact the developer', 'strong-testimonials' ) );
|
20 |
+
?>
|
21 |
+
<ul>
|
22 |
+
<?php foreach ( $links as $link ) : ?>
|
23 |
+
<li><?php echo $link; ?></li>
|
24 |
+
<?php endforeach; ?>
|
25 |
+
</ul>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<div class="col">
|
29 |
+
<h3><?php _e( 'Tutorials', 'strong-testimonials' ); ?></h3>
|
30 |
+
<?php
|
31 |
+
$links = array();
|
32 |
+
|
33 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
34 |
+
esc_url( 'https://strongplugins.com/document/strong-testimonials/troubleshooting/' ),
|
35 |
+
__( 'Troubleshooting', 'strong-testimonials' ) );
|
36 |
+
|
37 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
38 |
+
esc_url( 'https://strongplugins.com/document/strong-testimonials/embed-social-media/' ),
|
39 |
+
__( 'How to add YouTube or Twitter', 'strong-testimonials' ) );
|
40 |
+
|
41 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
42 |
+
esc_url( 'https://strongplugins.com/document/strong-testimonials/custom-css/' ),
|
43 |
+
__( 'Using custom CSS', 'strong-testimonials' ) );
|
44 |
+
|
45 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
46 |
+
esc_url( 'https://strongplugins.com/document/strong-testimonials/enable-comments/' ),
|
47 |
+
__( 'How to enable comments', 'strong-testimonials' ) );
|
48 |
+
|
49 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
50 |
+
esc_url( 'https://strongplugins.com/document/strong-testimonials/complete-example-customizing-form/' ),
|
51 |
+
__( 'How to customize the form', 'strong-testimonials' ) );
|
52 |
+
?>
|
53 |
+
<ul>
|
54 |
+
<?php foreach ( $links as $link ) : ?>
|
55 |
+
<li><?php echo $link; ?></li>
|
56 |
+
<?php endforeach; ?>
|
57 |
+
</ul>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div class="col">
|
61 |
+
<h3><?php _e( 'Demos', 'strong-testimonials' ); ?></h3>
|
62 |
+
<?php
|
63 |
+
$links = array();
|
64 |
+
|
65 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
66 |
+
esc_url( 'https://strongdemos.com/strong-testimonials/display-examples/' ),
|
67 |
+
__( 'Display examples', 'strong-testimonials' ) );
|
68 |
+
|
69 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
70 |
+
esc_url( 'https://strongdemos.com/strong-testimonials/slideshow-examples/' ),
|
71 |
+
__( 'Slideshow examples', 'strong-testimonials' ) );
|
72 |
+
|
73 |
+
$links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
|
74 |
+
esc_url( 'https://strongdemos.com/strong-testimonials/form-examples/' ),
|
75 |
+
__( 'Form examples', 'strong-testimonials' ) );
|
76 |
+
?>
|
77 |
+
<ul>
|
78 |
+
<?php foreach ( $links as $link ) : ?>
|
79 |
+
<li><?php echo $link; ?></li>
|
80 |
+
<?php endforeach; ?>
|
81 |
+
</ul>
|
82 |
+
</div>
|
83 |
+
</div>
|
admin/about/whats-new.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<h2>Now Even Stronger</h2>
|
3 |
+
|
4 |
+
<p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
|
5 |
+
|
6 |
+
<div class="feature-section one-col">
|
7 |
+
<div class="col">
|
8 |
+
<p>NEW: Option to select the font color in views. Finally!</p>
|
9 |
+
<p>NEW: Option to add a CSS class to the image for lightboxes.</p>
|
10 |
+
<p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
|
11 |
+
<p>NEW: Using the WordPress email validation function for increased security.</p>
|
12 |
+
<p>NEW: Using the WordPress number format function in the [testimonial_count] shortcode so the thousands separator will be properly localized.</p>
|
13 |
+
<p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
|
14 |
+
<p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
|
15 |
+
<p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
|
16 |
+
<p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
|
17 |
+
|
18 |
+
<div class="feature-section-sub">
|
19 |
+
|
20 |
+
<h3 class="heading">Point Releases</h3>
|
21 |
+
|
22 |
+
<p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
|
23 |
+
|
24 |
+
<ul>
|
25 |
+
<li>Version 2.30.1</li>
|
26 |
+
<li>Version 2.30.2</li>
|
27 |
+
<li>Version 2.30.3</li>
|
28 |
+
<li>Version 2.30.4</li>
|
29 |
+
<li>Version 2.30.5</li>
|
30 |
+
<li>Version 2.30.6</li>
|
31 |
+
<li>Version 2.30.7</li>
|
32 |
+
<li>Version 2.30.8</li>
|
33 |
+
</ul>
|
34 |
+
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
|
40 |
+
|
41 |
+
<div class="feature-section one-col">
|
42 |
+
<div class="col">
|
43 |
+
<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>
|
44 |
+
<p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
|
45 |
+
<p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
|
46 |
+
<p>FIXED: The notification email now displays a category name properly.</p>
|
47 |
+
<p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
|
48 |
+
<p>NEW: A new filter on the "Read more" page for total control over that link.</p>
|
49 |
+
<p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
|
54 |
+
|
55 |
+
<div class="feature-section one-col">
|
56 |
+
<div class="col">
|
57 |
+
<p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
|
58 |
+
<p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
|
59 |
+
<p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
|
60 |
+
<p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
|
61 |
+
<p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
|
62 |
+
<p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
|
63 |
+
<p>FIXED: Capabilities check in multisite.</p>
|
64 |
+
<p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
|
65 |
+
</div>
|
66 |
+
</div>
|
admin/admin-notices.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 );
|
admin/admin.php
ADDED
@@ -0,0 +1,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( $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=""
|
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 |
+
|
admin/class-strong-testimonials-admin-category-list.php
ADDED
@@ -0,0 +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();
|
admin/class-strong-testimonials-admin-list.php
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Add custom columns to the admin list.
|
35 |
+
*
|
36 |
+
* @param $columns
|
37 |
+
*
|
38 |
+
* @since 1.4.0
|
39 |
+
* @since 2.5.1 Added comments column.
|
40 |
+
*
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public static function edit_columns( $columns ) {
|
44 |
+
$fields = wpmtst_get_all_fields();
|
45 |
+
|
46 |
+
$comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
|
47 |
+
|
48 |
+
/*
|
49 |
+
INCOMING COLUMNS = Array (
|
50 |
+
[cb] => <input type="checkbox" />
|
51 |
+
[title] => Title
|
52 |
+
[comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
|
53 |
+
[date] => Date
|
54 |
+
[search_exclude] => Search Exclude // other plugin
|
55 |
+
[strong_thumbnail] => Thumbnail
|
56 |
+
)
|
57 |
+
*/
|
58 |
+
|
59 |
+
// 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
|
60 |
+
unset( $columns['strong_thumbnail'], $columns['date'] );
|
61 |
+
|
62 |
+
if ( $comments ) {
|
63 |
+
unset( $columns['comments'] );
|
64 |
+
}
|
65 |
+
|
66 |
+
// 2. insert [order] after [cb]
|
67 |
+
if ( ! self::is_column_sorted()
|
68 |
+
&& ! self::is_viewing_trash()
|
69 |
+
&& class_exists( 'Strong_Testimonials_Order' ) ) {
|
70 |
+
$columns = array_merge(
|
71 |
+
array_slice( $columns, 0, 1 ),
|
72 |
+
array( 'handle' => 'Order' ),
|
73 |
+
array_slice( $columns, 1, null )
|
74 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
+
// 3. insert [excerpt] after [title]
|
78 |
+
$key = 'title';
|
79 |
+
$offset = array_search( $key, array_keys( $columns ) ) + 1;
|
80 |
+
$fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
|
81 |
+
|
82 |
+
// 4. add custom fields
|
83 |
+
foreach ( $fields as $key => $field ) {
|
84 |
+
|
85 |
+
if ( $field['admin_table'] ) {
|
86 |
+
|
87 |
+
if ( 'post_title' == $field['name'] ) {
|
88 |
+
continue;
|
89 |
+
} elseif ( 'featured_image' == $field['name'] ) {
|
90 |
+
$fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
|
91 |
+
} elseif ( 'rating' == $field['input_type'] ) {
|
92 |
+
$fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
|
93 |
+
} else {
|
94 |
+
$fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
// 5. add [category], [comments] and [date]
|
102 |
+
// The slug "categories" slug is reserved by WordPress.
|
103 |
+
if ( wpmtst_get_cat_count() ) {
|
104 |
+
$fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( $comments ) {
|
108 |
+
$fields_to_add['comments'] = $comments;
|
109 |
+
}
|
110 |
+
|
111 |
+
$fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
|
112 |
+
|
113 | < |