Version Description
Download this release
Release Info
Developer | machothemes |
Plugin | Strong Testimonials |
Version | 2.34 |
Comparing to | |
See all releases |
Code changes from version 2.33 to 2.34
- .gitignore +0 -26
- admin/about/addons.php +23 -31
- admin/about/class-strong-testimonials-about.php +100 -100
- admin/about/how-to.php +41 -41
- admin/about/links.php +17 -76
- admin/about/privacy.php +13 -13
- admin/about/whats-new.php +107 -107
- admin/admin-notices.php +182 -177
- admin/admin.php +297 -329
- admin/class-strong-testimonials-admin-category-list.php +69 -69
- admin/class-strong-testimonials-admin-list.php +323 -331
- admin/class-strong-testimonials-admin-scripts.php +443 -395
- admin/class-strong-testimonials-defaults.php +885 -882
- admin/class-strong-testimonials-help.php +277 -227
- admin/class-strong-testimonials-list-table.php +1212 -1147
- admin/class-strong-testimonials-page-shortcodes.php +336 -336
- admin/class-strong-testimonials-post-editor.php +367 -354
- admin/class-strong-testimonials-updater.php +1328 -1345
- admin/class-strong-views-list-table.php +231 -228
- admin/class-walker-strong-category-checklist.php +129 -127
- admin/class-walker-strong-form-category-checklist.php +129 -127
- admin/compat.php +117 -116
- admin/css/about.css +53 -53
- admin/css/admin-compat.css +178 -178
- admin/css/admin-form.css +138 -138
- admin/css/admin.css +822 -822
- admin/css/fields.css +317 -317
- admin/css/form-preview.css +135 -135
- admin/css/number-spinner.css +98 -98
- admin/css/order.css +102 -102
- admin/css/polylang.css +7 -7
- admin/css/post-editor.css +110 -110
- admin/css/views.css +1010 -1010
- admin/css/wpml.css +31 -31
- admin/custom-fields-ajax.php +99 -99
- admin/custom-fields.php +490 -492
- admin/form-preview.php +53 -51
- admin/js/addon-licenses.js +79 -79
- admin/js/admin-compat.js +130 -130
- admin/js/admin-fields.js +602 -602
- admin/js/admin-form.js +164 -164
- admin/js/admin-global.js +26 -26
- admin/js/admin-order.js +128 -128
- admin/js/admin.js +106 -106
- admin/js/custom-spinner.js +81 -81
- admin/js/help.js +22 -22
- admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -192
- admin/js/lib/autosize/autosize.min.js +5 -5
- admin/js/rating-edit.js +85 -85
- admin/js/view-category-filter.js +47 -47
- admin/js/views.js +1336 -1336
- admin/menu/class-strong-testimonials-menu-fields.php +55 -55
- admin/menu/class-strong-testimonials-menu-settings.php +57 -57
- admin/menu/class-strong-testimonials-menu-shortcodes.php +55 -55
- admin/menu/class-strong-testimonials-menu-views.php +55 -55
- admin/menu/class-strong-testimonials-menu.php +51 -51
- admin/partials/fields/field-controls.php +12 -12
- admin/partials/fields/field-header.php +13 -13
- admin/partials/fields/field-label.php +15 -15
- admin/partials/fields/field-name.php +23 -22
- admin/partials/fields/field-text.php +11 -14
- admin/partials/fields/field-type.php +74 -75
- admin/partials/templates/form-preview-template.php +27 -27
- admin/partials/views/group-compat.php +17 -17
- admin/partials/views/group-extra.php +24 -24
- admin/partials/views/group-fields.php +75 -75
- admin/partials/views/group-form.php +24 -24
- admin/partials/views/group-query.php +44 -44
- admin/partials/views/group-slideshow.php +30 -30
- admin/partials/views/group-style.php +51 -51
- admin/partials/views/option-background.php +151 -151
- admin/partials/views/option-boilerplate.php +39 -39
- admin/partials/views/option-category.php +56 -56
- admin/partials/views/option-classes.php +14 -14
- admin/partials/views/option-client-section.php +25 -29
- admin/partials/views/option-color.php +47 -57
- admin/partials/views/option-content.php +217 -217
- admin/partials/views/option-divi.php +23 -24
- admin/partials/views/option-form-ajax.php +12 -13
- admin/partials/views/option-form-category.php +28 -28
- admin/partials/views/option-id.php +23 -23
- admin/partials/views/option-layout.php +146 -147
- admin/partials/views/option-limit.php +31 -33
- admin/partials/views/option-order.php +26 -26
- admin/partials/views/option-pagination.php +145 -167
- admin/partials/views/option-read-more-page.php +86 -87
- admin/partials/views/option-select.php +29 -29
- admin/partials/views/option-slideshow-behavior.php +87 -93
- admin/partials/views/option-slideshow-breakpoints.php +81 -95
- admin/partials/views/option-slideshow-navigation.php +108 -104
- admin/partials/views/option-slideshow-num.php +8 -8
- admin/partials/views/option-slideshow-transition.php +42 -46
- admin/partials/views/option-slideshow-type.php +19 -19
- admin/partials/views/option-template-list.php +22 -22
- admin/partials/views/option-thumbnail.php +96 -91
- admin/partials/views/option-title.php +18 -20
- admin/partials/views/template-input.php +6 -8
- admin/partials/views/template-not-found.php +24 -25
- admin/partials/views/template-options.php +77 -78
- admin/partials/views/view-mode.php +17 -18
- admin/partials/views/view-name.php +16 -17
- admin/partials/views/view-shortcode.php +32 -32
- admin/scss/_partials/_background.scss +30 -30
- admin/scss/_partials/_category-checkboxes.scss +19 -19
- admin/scss/_partials/_category-filter.scss +58 -58
- admin/scss/_partials/_checkbox-icons.scss +52 -52
- admin/scss/_partials/_custom-fields.scss +169 -169
- admin/scss/_partials/_elements.scss +93 -93
- admin/scss/_partials/_form-table.scss +98 -98
- admin/scss/_partials/_help-tab.scss +50 -50
- admin/scss/_partials/_inner-table.scss +31 -31
- admin/scss/_partials/_inputs.scss +48 -48
- admin/scss/_partials/_layout-example-columns.scss +42 -42
- admin/scss/_partials/_layout-example-grid.scss +33 -33
- admin/scss/_partials/_layout-example-masonry.scss +22 -22
- admin/scss/_partials/_layout-examples.scss +40 -40
- admin/scss/_partials/_layout.scss +15 -15
- admin/scss/_partials/_list-radio-buttons.scss +139 -139
- admin/scss/_partials/_misc.scss +88 -88
- admin/scss/_partials/_screenshots.scss +10 -10
- admin/scss/_partials/_sticky-views.scss +48 -48
- admin/scss/_partials/_structure.scss +41 -41
- admin/scss/_partials/_template.scss +43 -43
- admin/scss/_partials/_view-info.scss +178 -178
- admin/scss/about.scss +76 -76
- admin/scss/admin-compat.scss +166 -166
- admin/scss/number-spinner.scss +107 -107
- admin/scss/post-editor.scss +111 -111
- admin/scss/views.scss +47 -47
- 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 |
-
<
|
4 |
-
|
5 |
-
<
|
6 |
-
|
7 |
-
<
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
<
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
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 |
-
•
|
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 |
-
|
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 |
-
|
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 |
-
|
44 |
-
|
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(
|
62 |
-
|
63 |
-
<p class="about-text">
|
64 |
-
|
65 |
-
<?php /* translators: %s is the plugin version number */ ?>
|
66 |
-
|
67 |
-
|
68 |
-
<div class="wp-badge strong-testimonials"><?php printf(
|
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
|
73 |
-
|
74 |
-
<a href="<?php echo add_query_arg( 'tab', 'privacy', $url ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php
|
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
|
5 |
-
<p class="lead-description"><?php
|
6 |
-
|
7 |
-
<div class="feature-section two-col">
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
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 |
-
|
5 |
-
|
6 |
-
<?php
|
7 |
-
$links
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
?>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
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
|
2 |
-
<p class="lead-description"><?php
|
3 |
-
<div class="feature-section one-col">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
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>[testimonial_average_rating]</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 [testimonial_count] 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>[testimonial_average_rating]</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 [testimonial_count] 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 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
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
|
65 |
-
<p>
|
66 |
-
<?php
|
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
|
77 |
-
<p>
|
78 |
-
<?php
|
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
|
89 |
-
<p>
|
90 |
-
<?php
|
91 |
-
</p>
|
92 |
-
</div>
|
93 |
-
<?php
|
94 |
-
$html = ob_get_clean();
|
95 |
-
break;
|
96 |
-
|
97 |
-
case 'captcha-options-changed'
|
98 |
-
$tags
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
*
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
*
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
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 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 =
|
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 |
-
|
84 |
-
|
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 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
}
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
*
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
*
|
212 |
-
*
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
*
|
228 |
-
*
|
229 |
-
*
|
230 |
-
* @
|
231 |
-
*/
|
232 |
-
function
|
233 |
-
$
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
*
|
263 |
-
*
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
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="" 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 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
array_slice( $columns,
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
*
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
$
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
'
|
269 |
-
'
|
270 |
-
'
|
271 |
-
'
|
272 |
-
'
|
273 |
-
'
|
274 |
-
'
|
275 |
-
'
|
276 |
-
'
|
277 |
-
'
|
278 |
-
'
|
279 |
-
'
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
*
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
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 ) ) . '…';
|
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 );
|