Version Description
Download this release
Release Info
Developer | giucu91 |
Plugin | Strong Testimonials |
Version | 2.51.6 |
Comparing to | |
See all releases |
Code changes from version 2.51.5 to 2.51.6
- admin/about/class-strong-testimonials-welcome.php +256 -256
- admin/admin-notices.php +181 -180
- admin/admin.php +334 -334
- admin/class-strong-testimonials-addons.php +132 -132
- admin/class-strong-testimonials-admin-category-list.php +69 -69
- admin/class-strong-testimonials-admin-list.php +347 -347
- admin/class-strong-testimonials-admin-scripts.php +424 -424
- admin/class-strong-testimonials-defaults.php +874 -873
- admin/class-strong-testimonials-exporter.php +80 -80
- admin/class-strong-testimonials-help.php +226 -226
- admin/class-strong-testimonials-helper.php +2559 -2559
- admin/class-strong-testimonials-list-table.php +1212 -1212
- admin/class-strong-testimonials-page-shortcodes.php +415 -415
- admin/class-strong-testimonials-post-editor.php +401 -401
- admin/class-strong-testimonials-review.php +169 -169
- admin/class-strong-testimonials-updater.php +1387 -1387
- admin/class-strong-testimonials-upsell.php +831 -831
- admin/class-strong-views-list-table.php +276 -276
- admin/class-walker-strong-category-checklist.php +127 -127
- admin/class-walker-strong-form-category-checklist.php +127 -127
- admin/compat.php +116 -116
- admin/css/about.css +53 -53
- admin/css/admin-compat.css +178 -178
- admin/css/admin-form.css +138 -138
- admin/css/fields.css +317 -317
- admin/css/form-preview.css +135 -135
- admin/css/number-spinner.css +98 -98
- admin/css/order.css +129 -129
- admin/css/polylang.css +7 -7
- admin/css/post-editor.css +114 -114
- admin/css/selectize.default.css +408 -408
- admin/css/uninstall.css +113 -113
- admin/css/views.css +1031 -1031
- admin/css/wpml.css +31 -31
- admin/custom-fields-ajax.php +123 -123
- admin/custom-fields.php +529 -529
- admin/form-preview.php +51 -51
- admin/img/features/email.svg +21 -21
- admin/img/features/filter.svg +21 -21
- admin/img/features/infinitescroll.svg +15 -15
- admin/img/features/mailchimp.svg +34 -34
- admin/img/features/rolemanagement.svg +17 -17
- admin/img/logo-long.svg +91 -91
- admin/js/addon-licenses.js +163 -163
- admin/js/admin-compat.js +117 -117
- admin/js/admin-fields.js +603 -603
- admin/js/admin-form.js +163 -163
- admin/js/admin-global.js +35 -35
- admin/js/admin-order.js +129 -129
- admin/js/custom-spinner.js +0 -70
admin/about/class-strong-testimonials-welcome.php
CHANGED
@@ -1,256 +1,256 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Strong_Testimonials_Welcome {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
add_action( 'admin_menu', array( $this, 'register' ) );
|
7 |
-
add_action( 'admin_head', array( $this, 'hide_menu' ) );
|
8 |
-
}
|
9 |
-
|
10 |
-
public function hide_menu() {
|
11 |
-
remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
|
12 |
-
}
|
13 |
-
|
14 |
-
public function register() {
|
15 |
-
|
16 |
-
add_dashboard_page(
|
17 |
-
esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
|
18 |
-
esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
|
19 |
-
'manage_options',
|
20 |
-
'wpmtst-getting-started',
|
21 |
-
array( $this, 'output' )
|
22 |
-
);
|
23 |
-
}
|
24 |
-
|
25 |
-
public function output() {
|
26 |
-
?>
|
27 |
-
<div id="wpmtst-welcome">
|
28 |
-
|
29 |
-
<div class="container">
|
30 |
-
|
31 |
-
<div class="hero features">
|
32 |
-
|
33 |
-
<div class="mascot">
|
34 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
|
35 |
-
</div>
|
36 |
-
|
37 |
-
<div class="block">
|
38 |
-
<h1><?php esc_html_e( 'Welcome to Strong Testimonials', 'strong-testimonials' ); ?></h1>
|
39 |
-
<h6><?php esc_html_e( 'Thank you for choosing Strong Testimonials - Build trust and credibility with your products.', 'strong-testimonials' ); ?></h6>
|
40 |
-
</div>
|
41 |
-
|
42 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
|
43 |
-
|
44 |
-
<div class="block">
|
45 |
-
|
46 |
-
<div class="feature-list clear">
|
47 |
-
|
48 |
-
<div class="feature-block first">
|
49 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/7.svg">
|
50 |
-
<h5><?php esc_html_e( 'Increase Conversions', 'strong-testimonials' ); ?></h5>
|
51 |
-
<p><?php esc_html_e( 'Make customers 63% more likely to purchase with testimonials that drive sales.', 'strong-testimonials' ); ?></p>
|
52 |
-
</div>
|
53 |
-
|
54 |
-
<div class="feature-block last">
|
55 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/8.svg">
|
56 |
-
<h5><?php esc_html_e( 'Collect Testimonials', 'strong-testimonials' ); ?></h5>
|
57 |
-
<p><?php esc_html_e( 'Easily collect testimonials from customers by creating forms.', 'strong-testimonials' ); ?></p>
|
58 |
-
</div>
|
59 |
-
|
60 |
-
<div class="feature-block first">
|
61 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/5.svg">
|
62 |
-
<h5><?php esc_html_e( 'Multiple Layouts', 'strong-testimonials' ); ?></h5>
|
63 |
-
<p><?php esc_html_e( 'Choose from four unique layouts for your testimonials.', 'strong-testimonials' ); ?></p>
|
64 |
-
</div>
|
65 |
-
|
66 |
-
<div class="feature-block last">
|
67 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
|
68 |
-
<h5><?php esc_html_e( 'SEO-friendly', 'strong-testimonials' ); ?></h5>
|
69 |
-
<p><?php esc_html_e( 'SEO-friendly testimonials that your customers and Search Engines can understand.', 'strong-testimonials' ); ?></p>
|
70 |
-
</div>
|
71 |
-
|
72 |
-
</div>
|
73 |
-
|
74 |
-
<div class="button-wrap clear">
|
75 |
-
<div class="left">
|
76 |
-
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>" class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
77 |
-
<?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
|
78 |
-
</a>
|
79 |
-
</div>
|
80 |
-
<div class="right">
|
81 |
-
<a href="https://strongtestimonials.com/docs?utm_source=welcome_banner&utm_medium=readdocs&utm_campaign=welcome_banner"
|
82 |
-
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg" target="_blank">
|
83 |
-
<?php esc_html_e( 'Read the Docs', 'strong-testimonials' ); ?>
|
84 |
-
</a>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
|
88 |
-
</div>
|
89 |
-
|
90 |
-
</div><!-- hero -->
|
91 |
-
|
92 |
-
<div class="features">
|
93 |
-
|
94 |
-
<div class="block">
|
95 |
-
|
96 |
-
<h1><?php esc_html_e( 'Strong Testimonials Extensions', 'strong-testimonials' ); ?></h1>
|
97 |
-
<h6><?php esc_html_e( 'Sales copy grabs attention - testimonials drive sales.', 'strong-testimonials' ); ?></h6>
|
98 |
-
|
99 |
-
<div class="feature-list clear">
|
100 |
-
|
101 |
-
<div class="feature-block first">
|
102 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/1.svg">
|
103 |
-
<h5><?php esc_html_e( 'Pro Templates', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
104 |
-
<p><?php esc_html_e( 'Create beautiful testimonial designs with a number of predesigned and easy-to-use premium templates.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/pro-templates?utm_source=welcome_banner&utm_medium=pro-templates&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
105 |
-
</div>
|
106 |
-
|
107 |
-
<div class="feature-block last">
|
108 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/infinitescroll.svg">
|
109 |
-
<h5><?php esc_html_e( 'Infinite Scroll', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
110 |
-
<p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/infinite-scroll/?utm_source=welcome_banner&utm_medium=infinite-scroll&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
111 |
-
</div>
|
112 |
-
|
113 |
-
<div class="feature-block first">
|
114 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/12.svg">
|
115 |
-
<h5><?php esc_html_e( 'Testimonial Assignment', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
116 |
-
<p><?php esc_html_e( 'Assign testimonials to custom post types for easy management and filtering.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/assignment?utm_source=welcome_banner&utm_medium=assignment&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
117 |
-
</div>
|
118 |
-
|
119 |
-
<div class="feature-block last">
|
120 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/11.svg">
|
121 |
-
<h5><?php esc_html_e( 'Custom Properties', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
122 |
-
<p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/properties?utm_source=welcome_banner&utm_medium=properties&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
123 |
-
</div>
|
124 |
-
|
125 |
-
<div class="feature-block first">
|
126 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/6.svg">
|
127 |
-
<h5><?php esc_html_e( 'Advanced View Settings', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
128 |
-
<p><?php esc_html_e( 'Customize your testimonials beyond star ratings, reorder fields and more.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/advanced-views?utm_source=welcome_banner&utm_medium=advanced-views&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
129 |
-
</div>
|
130 |
-
|
131 |
-
<div class="feature-block last">
|
132 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/9.svg">
|
133 |
-
<h5><?php esc_html_e( 'Multiple Submission Forms', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
134 |
-
<p><?php esc_html_e( 'Easily collect testimonials from customers by creating and customizing multiple forms at once.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/multiple-forms?utm_source=welcome_banner&utm_medium=multiple-forms&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
135 |
-
</div>
|
136 |
-
|
137 |
-
<div class="feature-block first">
|
138 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/10.svg">
|
139 |
-
<h5><?php esc_html_e( 'Custom Form Fields', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
140 |
-
<p><?php esc_html_e( 'Enhance your submission forms to both collect and display additional information.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/custom-fields?utm_source=welcome_banner&utm_medium=custom-fields&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
141 |
-
</div>
|
142 |
-
|
143 |
-
<div class="feature-block last">
|
144 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
|
145 |
-
<h5><?php esc_html_e( 'SEO-friendly Testimonials', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
146 |
-
<p><?php esc_html_e( 'Take full advantage of your testimonials with our Schema.org Markup extension.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/review-markup?utm_source=welcome_banner&utm_medium=review-markup&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
147 |
-
</div>
|
148 |
-
|
149 |
-
<div class="feature-block first">
|
150 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/13.svg">
|
151 |
-
<h5><?php esc_html_e( 'Spam Control', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
152 |
-
<p><?php esc_html_e( 'Protect your testimonial submission forms from spam and other types of automated abuse.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/captcha?utm_source=welcome_banner&utm_medium=captcha&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
153 |
-
</div>
|
154 |
-
|
155 |
-
<div class="feature-block last">
|
156 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/15.svg">
|
157 |
-
<h5><?php esc_html_e( 'Testimonial Importer', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
158 |
-
<p><?php esc_html_e( 'Import reviews from 3rd party sites like: Facebook, Google, Yelp, Zomato & WooCommerce', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/importer?utm_source=welcome_banner&utm_medium=importer&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
159 |
-
</div>
|
160 |
-
|
161 |
-
<div class="feature-block first">
|
162 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/email.svg">
|
163 |
-
<h5><?php esc_html_e( 'Enhanced Emails', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
164 |
-
<p><?php esc_html_e( 'We added the option to send an email to the customer upon new testimonial submission. Also, to send an email to the customer when the testimonial is approved.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/enhanced-emails/?utm_source=welcome_banner&utm_medium=enhanced-emails&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
165 |
-
</div>
|
166 |
-
|
167 |
-
<div class="feature-block last">
|
168 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/filter.svg">
|
169 |
-
<h5><?php esc_html_e( 'Filters', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
170 |
-
<p><?php esc_html_e( 'Now you can use categories to group your testimonials and have your clients read reviews grouped by service/product type.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/filters/?utm_source=welcome_banner&utm_medium=filters&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
171 |
-
</div>
|
172 |
-
|
173 |
-
<div class="feature-block first">
|
174 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/rolemanagement.svg">
|
175 |
-
<h5><?php esc_html_e( 'Role Management', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
176 |
-
<p><?php esc_html_e( 'We’re giving power back to the users and admins can decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/role-management/?utm_source=welcome_banner&utm_medium=role-management&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
177 |
-
</div>
|
178 |
-
|
179 |
-
<div class="feature-block last">
|
180 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/mailchimp.svg">
|
181 |
-
<h5><?php esc_html_e( 'Mailchimp integration', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
182 |
-
<p><?php esc_html_e( 'Now you can subscribe your customers to a Mailchimp list.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
183 |
-
</div>
|
184 |
-
|
185 |
-
</div><!-- feature-list -->
|
186 |
-
|
187 |
-
</div>
|
188 |
-
|
189 |
-
</div><!-- features -->
|
190 |
-
|
191 |
-
<div class="upgrade">
|
192 |
-
<div class="block">
|
193 |
-
<a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
|
194 |
-
class="wpmtst-btn wpmtst-btn-lg wpmtst-btn-orange">
|
195 |
-
<?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?>
|
196 |
-
</a>
|
197 |
-
|
198 |
-
</div>
|
199 |
-
</div><!--/.upgrade-->
|
200 |
-
|
201 |
-
|
202 |
-
<div class="testimonials">
|
203 |
-
|
204 |
-
<div class="block clear">
|
205 |
-
<h1>Happy users of the Strong Testimonials - premium version</h1>
|
206 |
-
<div class="testimonial-block left">
|
207 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-1.jpg">
|
208 |
-
<p><?php esc_html_e( 'Strong Testimonials is my new, go-to resource for creating pages with multiple staff bios or testimonials. It’s extremely easy to use, update, and customize, and that makes it an invaluable asset. Highly recommend!', 'strong-testimonials' ); ?>
|
209 |
-
<div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
|
210 |
-
<p><strong><?php esc_html_e( 'Ryan Haught' ); ?></strong><br/><?php esc_html_e( 'Digital Marketer at Heaven’s Family' ); ?></p>
|
211 |
-
</div>
|
212 |
-
|
213 |
-
<div class="testimonial-block right">
|
214 |
-
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-2.jpeg">
|
215 |
-
<p><?php esc_html_e( 'I have used various testimonials plugins. What I get here for free is just amazing. The support is great. And updates fresh. Looking at the ability to get reviews indexed by Google is more than enough reason to get an upgrade.', 'strong-testimonials' ); ?>
|
216 |
-
<div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
|
217 |
-
<p><strong><?php esc_html_e( 'Johan Horak' ); ?></strong><br/><?php esc_html_e( 'Marketing at CapeHolidays' ); ?></p>
|
218 |
-
</div>
|
219 |
-
|
220 |
-
</div>
|
221 |
-
|
222 |
-
</div><!-- testimonials -->
|
223 |
-
|
224 |
-
<div class="footer">
|
225 |
-
|
226 |
-
<div class="block clear">
|
227 |
-
|
228 |
-
<div class="button-wrap clear">
|
229 |
-
<div class="left">
|
230 |
-
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>"
|
231 |
-
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
232 |
-
<?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
|
233 |
-
</a>
|
234 |
-
</div>
|
235 |
-
<div class="right">
|
236 |
-
<a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
|
237 |
-
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
238 |
-
<?php esc_html_e( 'Upgrade now', 'strong-testimonials' ); ?>
|
239 |
-
</a>
|
240 |
-
</div>
|
241 |
-
</div>
|
242 |
-
|
243 |
-
</div>
|
244 |
-
|
245 |
-
</div><!-- footer -->
|
246 |
-
|
247 |
-
</div><!-- container -->
|
248 |
-
|
249 |
-
</div><!-- wpmtst welcome -->
|
250 |
-
<?php
|
251 |
-
}
|
252 |
-
|
253 |
-
|
254 |
-
}
|
255 |
-
|
256 |
-
new Strong_Testimonials_Welcome();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Strong_Testimonials_Welcome {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
add_action( 'admin_menu', array( $this, 'register' ) );
|
7 |
+
add_action( 'admin_head', array( $this, 'hide_menu' ) );
|
8 |
+
}
|
9 |
+
|
10 |
+
public function hide_menu() {
|
11 |
+
remove_submenu_page( 'index.php', 'wpmtst-getting-started' );
|
12 |
+
}
|
13 |
+
|
14 |
+
public function register() {
|
15 |
+
|
16 |
+
add_dashboard_page(
|
17 |
+
esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
|
18 |
+
esc_html__( 'Welcome to Strong Testimonials', 'strong-testimonials' ),
|
19 |
+
'manage_options',
|
20 |
+
'wpmtst-getting-started',
|
21 |
+
array( $this, 'output' )
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function output() {
|
26 |
+
?>
|
27 |
+
<div id="wpmtst-welcome">
|
28 |
+
|
29 |
+
<div class="container">
|
30 |
+
|
31 |
+
<div class="hero features">
|
32 |
+
|
33 |
+
<div class="mascot">
|
34 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/mascot-2.svg" alt="<?php esc_attr_e( 'Strong Testimonials Mascot', 'strong-testimonials' ); ?>">
|
35 |
+
</div>
|
36 |
+
|
37 |
+
<div class="block">
|
38 |
+
<h1><?php esc_html_e( 'Welcome to Strong Testimonials', 'strong-testimonials' ); ?></h1>
|
39 |
+
<h6><?php esc_html_e( 'Thank you for choosing Strong Testimonials - Build trust and credibility with your products.', 'strong-testimonials' ); ?></h6>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/banner.png" alt="<?php esc_attr_e( 'Watch how to', 'strong-testimonials' ); ?>" class="video-thumbnail">
|
43 |
+
|
44 |
+
<div class="block">
|
45 |
+
|
46 |
+
<div class="feature-list clear">
|
47 |
+
|
48 |
+
<div class="feature-block first">
|
49 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/7.svg">
|
50 |
+
<h5><?php esc_html_e( 'Increase Conversions', 'strong-testimonials' ); ?></h5>
|
51 |
+
<p><?php esc_html_e( 'Make customers 63% more likely to purchase with testimonials that drive sales.', 'strong-testimonials' ); ?></p>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<div class="feature-block last">
|
55 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/8.svg">
|
56 |
+
<h5><?php esc_html_e( 'Collect Testimonials', 'strong-testimonials' ); ?></h5>
|
57 |
+
<p><?php esc_html_e( 'Easily collect testimonials from customers by creating forms.', 'strong-testimonials' ); ?></p>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div class="feature-block first">
|
61 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/5.svg">
|
62 |
+
<h5><?php esc_html_e( 'Multiple Layouts', 'strong-testimonials' ); ?></h5>
|
63 |
+
<p><?php esc_html_e( 'Choose from four unique layouts for your testimonials.', 'strong-testimonials' ); ?></p>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<div class="feature-block last">
|
67 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
|
68 |
+
<h5><?php esc_html_e( 'SEO-friendly', 'strong-testimonials' ); ?></h5>
|
69 |
+
<p><?php esc_html_e( 'SEO-friendly testimonials that your customers and Search Engines can understand.', 'strong-testimonials' ); ?></p>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
</div>
|
73 |
+
|
74 |
+
<div class="button-wrap clear">
|
75 |
+
<div class="left">
|
76 |
+
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>" class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
77 |
+
<?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
|
78 |
+
</a>
|
79 |
+
</div>
|
80 |
+
<div class="right">
|
81 |
+
<a href="https://strongtestimonials.com/docs?utm_source=welcome_banner&utm_medium=readdocs&utm_campaign=welcome_banner"
|
82 |
+
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg" target="_blank">
|
83 |
+
<?php esc_html_e( 'Read the Docs', 'strong-testimonials' ); ?>
|
84 |
+
</a>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
|
88 |
+
</div>
|
89 |
+
|
90 |
+
</div><!-- hero -->
|
91 |
+
|
92 |
+
<div class="features">
|
93 |
+
|
94 |
+
<div class="block">
|
95 |
+
|
96 |
+
<h1><?php esc_html_e( 'Strong Testimonials Extensions', 'strong-testimonials' ); ?></h1>
|
97 |
+
<h6><?php esc_html_e( 'Sales copy grabs attention - testimonials drive sales.', 'strong-testimonials' ); ?></h6>
|
98 |
+
|
99 |
+
<div class="feature-list clear">
|
100 |
+
|
101 |
+
<div class="feature-block first">
|
102 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/1.svg">
|
103 |
+
<h5><?php esc_html_e( 'Pro Templates', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
104 |
+
<p><?php esc_html_e( 'Create beautiful testimonial designs with a number of predesigned and easy-to-use premium templates.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/pro-templates?utm_source=welcome_banner&utm_medium=pro-templates&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="feature-block last">
|
108 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/infinitescroll.svg">
|
109 |
+
<h5><?php esc_html_e( 'Infinite Scroll', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
110 |
+
<p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/infinite-scroll/?utm_source=welcome_banner&utm_medium=infinite-scroll&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<div class="feature-block first">
|
114 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/12.svg">
|
115 |
+
<h5><?php esc_html_e( 'Testimonial Assignment', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
116 |
+
<p><?php esc_html_e( 'Assign testimonials to custom post types for easy management and filtering.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/assignment?utm_source=welcome_banner&utm_medium=assignment&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div class="feature-block last">
|
120 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/11.svg">
|
121 |
+
<h5><?php esc_html_e( 'Custom Properties', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
122 |
+
<p><?php esc_html_e( 'Change properties of the testimonial post type: labels, permalink structure, admin options and post editor features.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/properties?utm_source=welcome_banner&utm_medium=properties&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
<div class="feature-block first">
|
126 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/6.svg">
|
127 |
+
<h5><?php esc_html_e( 'Advanced View Settings', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
128 |
+
<p><?php esc_html_e( 'Customize your testimonials beyond star ratings, reorder fields and more.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/advanced-views?utm_source=welcome_banner&utm_medium=advanced-views&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
129 |
+
</div>
|
130 |
+
|
131 |
+
<div class="feature-block last">
|
132 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/9.svg">
|
133 |
+
<h5><?php esc_html_e( 'Multiple Submission Forms', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
134 |
+
<p><?php esc_html_e( 'Easily collect testimonials from customers by creating and customizing multiple forms at once.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/multiple-forms?utm_source=welcome_banner&utm_medium=multiple-forms&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<div class="feature-block first">
|
138 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/10.svg">
|
139 |
+
<h5><?php esc_html_e( 'Custom Form Fields', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
140 |
+
<p><?php esc_html_e( 'Enhance your submission forms to both collect and display additional information.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/custom-fields?utm_source=welcome_banner&utm_medium=custom-fields&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<div class="feature-block last">
|
144 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/14.svg">
|
145 |
+
<h5><?php esc_html_e( 'SEO-friendly Testimonials', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
146 |
+
<p><?php esc_html_e( 'Take full advantage of your testimonials with our Schema.org Markup extension.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/review-markup?utm_source=welcome_banner&utm_medium=review-markup&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<div class="feature-block first">
|
150 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/13.svg">
|
151 |
+
<h5><?php esc_html_e( 'Spam Control', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
152 |
+
<p><?php esc_html_e( 'Protect your testimonial submission forms from spam and other types of automated abuse.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/captcha?utm_source=welcome_banner&utm_medium=captcha&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
<div class="feature-block last">
|
156 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/15.svg">
|
157 |
+
<h5><?php esc_html_e( 'Testimonial Importer', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
158 |
+
<p><?php esc_html_e( 'Import reviews from 3rd party sites like: Facebook, Google, Yelp, Zomato & WooCommerce', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/importer?utm_source=welcome_banner&utm_medium=importer&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
159 |
+
</div>
|
160 |
+
|
161 |
+
<div class="feature-block first">
|
162 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/email.svg">
|
163 |
+
<h5><?php esc_html_e( 'Enhanced Emails', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
164 |
+
<p><?php esc_html_e( 'We added the option to send an email to the customer upon new testimonial submission. Also, to send an email to the customer when the testimonial is approved.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/enhanced-emails/?utm_source=welcome_banner&utm_medium=enhanced-emails&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
165 |
+
</div>
|
166 |
+
|
167 |
+
<div class="feature-block last">
|
168 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/filter.svg">
|
169 |
+
<h5><?php esc_html_e( 'Filters', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
170 |
+
<p><?php esc_html_e( 'Now you can use categories to group your testimonials and have your clients read reviews grouped by service/product type.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/filters/?utm_source=welcome_banner&utm_medium=filters&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
<div class="feature-block first">
|
174 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/rolemanagement.svg">
|
175 |
+
<h5><?php esc_html_e( 'Role Management', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
176 |
+
<p><?php esc_html_e( 'We’re giving power back to the users and admins can decide which user roles are worthy of adding, editing, or removing testimonials.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/extensions/role-management/?utm_source=welcome_banner&utm_medium=role-management&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<div class="feature-block last">
|
180 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/features/mailchimp.svg">
|
181 |
+
<h5><?php esc_html_e( 'Mailchimp integration', 'strong-testimonials' ); ?><div class="pro-label">PRO</div></h5>
|
182 |
+
<p><?php esc_html_e( 'Now you can subscribe your customers to a Mailchimp list.', 'strong-testimonials' ); ?><br/><a target="_blank" href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a></p>
|
183 |
+
</div>
|
184 |
+
|
185 |
+
</div><!-- feature-list -->
|
186 |
+
|
187 |
+
</div>
|
188 |
+
|
189 |
+
</div><!-- features -->
|
190 |
+
|
191 |
+
<div class="upgrade">
|
192 |
+
<div class="block">
|
193 |
+
<a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
|
194 |
+
class="wpmtst-btn wpmtst-btn-lg wpmtst-btn-orange">
|
195 |
+
<?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?>
|
196 |
+
</a>
|
197 |
+
|
198 |
+
</div>
|
199 |
+
</div><!--/.upgrade-->
|
200 |
+
|
201 |
+
|
202 |
+
<div class="testimonials">
|
203 |
+
|
204 |
+
<div class="block clear">
|
205 |
+
<h1>Happy users of the Strong Testimonials - premium version</h1>
|
206 |
+
<div class="testimonial-block left">
|
207 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-1.jpg">
|
208 |
+
<p><?php esc_html_e( 'Strong Testimonials is my new, go-to resource for creating pages with multiple staff bios or testimonials. It’s extremely easy to use, update, and customize, and that makes it an invaluable asset. Highly recommend!', 'strong-testimonials' ); ?>
|
209 |
+
<div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
|
210 |
+
<p><strong><?php esc_html_e( 'Ryan Haught' ); ?></strong><br/><?php esc_html_e( 'Digital Marketer at Heaven’s Family' ); ?></p>
|
211 |
+
</div>
|
212 |
+
|
213 |
+
<div class="testimonial-block right">
|
214 |
+
<img src="<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/testimonial-image-2.jpeg">
|
215 |
+
<p><?php esc_html_e( 'I have used various testimonials plugins. What I get here for free is just amazing. The support is great. And updates fresh. Looking at the ability to get reviews indexed by Google is more than enough reason to get an upgrade.', 'strong-testimonials' ); ?>
|
216 |
+
<div style="background-image: url(<?php echo esc_attr( WPMTST_ADMIN_URL ); ?>/img/star.svg)" class="testimonial-stars"></div>
|
217 |
+
<p><strong><?php esc_html_e( 'Johan Horak' ); ?></strong><br/><?php esc_html_e( 'Marketing at CapeHolidays' ); ?></p>
|
218 |
+
</div>
|
219 |
+
|
220 |
+
</div>
|
221 |
+
|
222 |
+
</div><!-- testimonials -->
|
223 |
+
|
224 |
+
<div class="footer">
|
225 |
+
|
226 |
+
<div class="block clear">
|
227 |
+
|
228 |
+
<div class="button-wrap clear">
|
229 |
+
<div class="left">
|
230 |
+
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?>"
|
231 |
+
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
232 |
+
<?php esc_html_e( 'Start Adding Testimonials', 'strong-testimonials' ); ?>
|
233 |
+
</a>
|
234 |
+
</div>
|
235 |
+
<div class="right">
|
236 |
+
<a href="https://strongtestimonials.com/pricing/?utm_source=welcome_banner&utm_medium=upgradenow&utm_campaign=welcome_banner" target="_blank"
|
237 |
+
class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg wpmtst-btn-purple">
|
238 |
+
<?php esc_html_e( 'Upgrade now', 'strong-testimonials' ); ?>
|
239 |
+
</a>
|
240 |
+
</div>
|
241 |
+
</div>
|
242 |
+
|
243 |
+
</div>
|
244 |
+
|
245 |
+
</div><!-- footer -->
|
246 |
+
|
247 |
+
</div><!-- container -->
|
248 |
+
|
249 |
+
</div><!-- wpmtst welcome -->
|
250 |
+
<?php
|
251 |
+
}
|
252 |
+
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
new Strong_Testimonials_Welcome();
|
admin/admin-notices.php
CHANGED
@@ -1,180 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin notices
|
4 |
-
*/
|
5 |
-
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Dismiss persistent notices.
|
9 |
-
*
|
10 |
-
* @since 2.29.0
|
11 |
-
*/
|
12 |
-
function wpmtst_dismiss_notice_ajax() {
|
13 |
-
if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
|
14 |
-
echo 0;
|
15 |
-
wp_die();
|
16 |
-
}
|
17 |
-
|
18 |
-
check_ajax_referer( 'wpmtst-admin', 'nonce' );
|
19 |
-
wpmtst_delete_admin_notice( $_POST['key'] );
|
20 |
-
wp_die();
|
21 |
-
}
|
22 |
-
|
23 |
-
add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Print admin notices.
|
27 |
-
*
|
28 |
-
* @since 2.24.0
|
29 |
-
*/
|
30 |
-
function wpmtst_admin_notices() {
|
31 |
-
$notices = get_option( 'wpmtst_admin_notices' );
|
32 |
-
if ( ! $notices ) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
foreach ( $notices as $key => $notice ) {
|
37 |
-
$message = apply_filters( 'wpmtst_admin_notice', '', $key );
|
38 |
-
if ( $message ) {
|
39 |
-
echo $message;
|
40 |
-
}
|
41 |
-
if ( ! $notice['persist'] ) {
|
42 |
-
wpmtst_delete_admin_notice( $key );
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
46 |
-
add_action( 'admin_notices', 'wpmtst_admin_notices' );
|
47 |
-
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Return specific admin notice text.
|
51 |
-
*
|
52 |
-
* @since 2.28.5
|
53 |
-
* @param string $html
|
54 |
-
* @param $key
|
55 |
-
*
|
56 |
-
* @return string
|
57 |
-
*/
|
58 |
-
function wpmtst_admin_notice_text( $html, $key, $persist = false ) {
|
59 |
-
|
60 |
-
switch ( $key ) {
|
61 |
-
case 'defaults-restored' :
|
62 |
-
ob_start();
|
63 |
-
?>
|
64 |
-
<div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
|
65 |
-
<p>
|
66 |
-
<?php 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( '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 ), esc_html__( 'settings', 'strong-testimonials' ) );
|
102 |
-
|
103 |
-
ob_start();
|
104 |
-
?>
|
105 |
-
<div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
|
106 |
-
<p>
|
107 |
-
<?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
|
108 |
-
<?php echo esc_url( $settings_link ); ?>
|
109 |
-
</p>
|
110 |
-
</div>
|
111 |
-
<?php
|
112 |
-
$html = ob_get_clean();
|
113 |
-
break;
|
114 |
-
|
115 |
-
default :
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
*
|
127 |
-
*
|
128 |
-
*
|
129 |
-
*
|
130 |
-
* @param $
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
$notices
|
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 |
-
* @param $
|
161 |
-
* @param $
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin notices
|
4 |
+
*/
|
5 |
+
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Dismiss persistent notices.
|
9 |
+
*
|
10 |
+
* @since 2.29.0
|
11 |
+
*/
|
12 |
+
function wpmtst_dismiss_notice_ajax() {
|
13 |
+
if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
|
14 |
+
echo 0;
|
15 |
+
wp_die();
|
16 |
+
}
|
17 |
+
|
18 |
+
check_ajax_referer( 'wpmtst-admin', 'nonce' );
|
19 |
+
wpmtst_delete_admin_notice( $_POST['key'] );
|
20 |
+
wp_die();
|
21 |
+
}
|
22 |
+
|
23 |
+
add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Print admin notices.
|
27 |
+
*
|
28 |
+
* @since 2.24.0
|
29 |
+
*/
|
30 |
+
function wpmtst_admin_notices() {
|
31 |
+
$notices = get_option( 'wpmtst_admin_notices' );
|
32 |
+
if ( ! $notices ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
foreach ( $notices as $key => $notice ) {
|
37 |
+
$message = apply_filters( 'wpmtst_admin_notice', '', $key );
|
38 |
+
if ( $message ) {
|
39 |
+
echo $message;
|
40 |
+
}
|
41 |
+
if ( ! $notice['persist'] ) {
|
42 |
+
wpmtst_delete_admin_notice( $key );
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
add_action( 'admin_notices', 'wpmtst_admin_notices' );
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Return specific admin notice text.
|
51 |
+
*
|
52 |
+
* @since 2.28.5
|
53 |
+
* @param string $html
|
54 |
+
* @param $key
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
function wpmtst_admin_notice_text( $html, $key, $persist = false ) {
|
59 |
+
|
60 |
+
switch ( $key ) {
|
61 |
+
case 'defaults-restored' :
|
62 |
+
ob_start();
|
63 |
+
?>
|
64 |
+
<div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
|
65 |
+
<p>
|
66 |
+
<?php 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( '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 ), esc_html__( 'settings', 'strong-testimonials' ) );
|
102 |
+
|
103 |
+
ob_start();
|
104 |
+
?>
|
105 |
+
<div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
|
106 |
+
<p>
|
107 |
+
<?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
|
108 |
+
<?php echo esc_url( $settings_link ); ?>
|
109 |
+
</p>
|
110 |
+
</div>
|
111 |
+
<?php
|
112 |
+
$html = ob_get_clean();
|
113 |
+
break;
|
114 |
+
|
115 |
+
default :
|
116 |
+
$html = apply_filters( 'wpmtst_' . $key . '_notice', '' );
|
117 |
+
// nothing
|
118 |
+
}
|
119 |
+
|
120 |
+
return $html;
|
121 |
+
}
|
122 |
+
add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Add admin notice to queue.
|
127 |
+
*
|
128 |
+
* @since 2.24.0
|
129 |
+
*
|
130 |
+
* @param $key
|
131 |
+
* @param $persist
|
132 |
+
*/
|
133 |
+
function wpmtst_add_admin_notice( $key, $persist = false ) {
|
134 |
+
$notices = get_option( 'wpmtst_admin_notices', array() );
|
135 |
+
$notices[ $key ] = array( 'persist' => $persist );
|
136 |
+
update_option( 'wpmtst_admin_notices', $notices, 'no' );
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Delete admin notice from queue.
|
142 |
+
*
|
143 |
+
* @since 2.24.0
|
144 |
+
*
|
145 |
+
* @param $key
|
146 |
+
*/
|
147 |
+
function wpmtst_delete_admin_notice( $key ) {
|
148 |
+
$notices = get_option( 'wpmtst_admin_notices', array() );
|
149 |
+
if ( isset( $notices[ $key ] ) ) {
|
150 |
+
unset( $notices[ $key ] );
|
151 |
+
update_option( 'wpmtst_admin_notices', $notices, 'no' );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Automatically dismiss specific notices when settings are saved.
|
158 |
+
*
|
159 |
+
* @since 2.29.0
|
160 |
+
* @param $option
|
161 |
+
* @param $old_value
|
162 |
+
* @param $value
|
163 |
+
*/
|
164 |
+
function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
|
165 |
+
if ( ! function_exists( 'get_current_screen' ) ) {
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
|
169 |
+
$screen = get_current_screen();
|
170 |
+
if ( $screen && 'options' == $screen->base ) {
|
171 |
+
if ( 'wpmtst_form_options' == $option ) {
|
172 |
+
$notices = get_option( 'wpmtst_admin_notices', array() );
|
173 |
+
if ( isset( $notices['captcha-options-changed'] ) ) {
|
174 |
+
unset( $notices['captcha-options-changed'] );
|
175 |
+
update_option( 'wpmtst_admin_notices', $notices, 'no' );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
|
181 |
+
|
admin/admin.php
CHANGED
@@ -1,335 +1,335 @@
|
|
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( esc_html_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>' . esc_html_x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
|
24 |
-
$message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
|
25 |
-
wp_die( $message );
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
add_action( 'admin_init', 'wpmtst_version_check', 1 );
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Check for plugin update.
|
33 |
-
*
|
34 |
-
* @since 2.28.4 Before other admin_init actions.
|
35 |
-
*/
|
36 |
-
function wpmtst_update_check() {
|
37 |
-
$version = get_option( 'wpmtst_plugin_version', false );
|
38 |
-
if ( $version == WPMTST_VERSION ) {
|
39 |
-
return;
|
40 |
-
}
|
41 |
-
// Redirect to About page afterwards. On new install or (de)activation only.
|
42 |
-
if ( false === $version ) {
|
43 |
-
add_option( 'wpmtst_do_activation_redirect', true );
|
44 |
-
}
|
45 |
-
|
46 |
-
Strong_Testimonials_Updater::update();
|
47 |
-
}
|
48 |
-
|
49 |
-
add_action( 'admin_init', 'wpmtst_update_check', 5 );
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Initialize.
|
53 |
-
*/
|
54 |
-
function wpmtst_admin_init() {
|
55 |
-
/**
|
56 |
-
* Redirect to About page for new installs only
|
57 |
-
*
|
58 |
-
* @since 2.28.4
|
59 |
-
*/
|
60 |
-
wpmtst_activation_redirect();
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Custom action hooks
|
64 |
-
*
|
65 |
-
* @since 1.18.4
|
66 |
-
*/
|
67 |
-
if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
|
68 |
-
$action = sanitize_text_field( $_REQUEST['action'] );
|
69 |
-
do_action( 'wpmtst_' . $action );
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
add_action( 'admin_init', 'wpmtst_admin_init' );
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Custom action link in admin notice.
|
77 |
-
*
|
78 |
-
* @since 2.29.0
|
79 |
-
*/
|
80 |
-
function wpmtst_action_captcha_options_changed() {
|
81 |
-
wpmtst_delete_admin_notice( 'captcha-options-changed' );
|
82 |
-
wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
|
83 |
-
exit;
|
84 |
-
}
|
85 |
-
|
86 |
-
add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Redirect to About page.
|
90 |
-
*
|
91 |
-
* @since 2.28.4
|
92 |
-
*/
|
93 |
-
function wpmtst_activation_redirect() {
|
94 |
-
if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
|
95 |
-
delete_option( 'wpmtst_do_activation_redirect' );
|
96 |
-
wp_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
|
97 |
-
exit;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Are we on a testimonial admin screen?
|
103 |
-
*
|
104 |
-
* Used by add-ons too!
|
105 |
-
*
|
106 |
-
* @return bool
|
107 |
-
*/
|
108 |
-
function wpmtst_is_testimonial_screen() {
|
109 |
-
$screen = get_current_screen();
|
110 |
-
return ( $screen && 'wpm-testimonial' == $screen->post_type );
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Add pending numbers to post types on admin menu.
|
115 |
-
* Thanks http://wordpress.stackexchange.com/a/105470/32076
|
116 |
-
*
|
117 |
-
* @param $menu
|
118 |
-
*
|
119 |
-
* @return mixed
|
120 |
-
*/
|
121 |
-
function wpmtst_pending_indicator( $menu ) {
|
122 |
-
if ( ! current_user_can( 'edit_posts' ) )
|
123 |
-
return $menu;
|
124 |
-
|
125 |
-
$options = get_option( 'wpmtst_options' );
|
126 |
-
if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
|
127 |
-
return $menu;
|
128 |
-
|
129 |
-
$types = array( 'wpm-testimonial' );
|
130 |
-
$status = 'pending';
|
131 |
-
foreach ( $types as $type ) {
|
132 |
-
$num_posts = wp_count_posts( $type, 'readable' );
|
133 |
-
$pending_count = 0;
|
134 |
-
if ( ! empty( $num_posts->$status ) )
|
135 |
-
$pending_count = $num_posts->$status;
|
136 |
-
|
137 |
-
if ( $type == 'post' )
|
138 |
-
$menu_str = 'edit.php';
|
139 |
-
else
|
140 |
-
$menu_str = 'edit.php?post_type=' . $type;
|
141 |
-
|
142 |
-
foreach ( $menu as $menu_key => $menu_data ) {
|
143 |
-
if ( $menu_str != $menu_data[2] )
|
144 |
-
continue;
|
145 |
-
$menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
return $menu;
|
150 |
-
}
|
151 |
-
add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
|
152 |
-
|
153 |
-
/**
|
154 |
-
* The [restore default] icon.
|
155 |
-
*
|
156 |
-
* @param $for
|
157 |
-
*
|
158 |
-
* @since 2.18.0
|
159 |
-
*/
|
160 |
-
function wpmtst_restore_default_icon( $for ) {
|
161 |
-
if ( !$for ) return;
|
162 |
-
?>
|
163 |
-
<input type="button" class="button secondary restore-default"
|
164 |
-
title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
|
165 |
-
value=""
|
166 |
-
data-for="<?php echo esc_attr( $for ); ?>"/>
|
167 |
-
<?php
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Check for configuration issues when options are updated.
|
174 |
-
*
|
175 |
-
* @since 2.24.0
|
176 |
-
* @param $option
|
177 |
-
* @param $old_value
|
178 |
-
* @param $value
|
179 |
-
*/
|
180 |
-
function wpmtst_updated_option( $option, $old_value, $value ) {
|
181 |
-
if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
|
182 |
-
do_action( 'wpmtst_check_config' );
|
183 |
-
}
|
184 |
-
}
|
185 |
-
add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
|
186 |
-
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Store configuration error.
|
190 |
-
*
|
191 |
-
* @since 2.24.0
|
192 |
-
* @param $key
|
193 |
-
*/
|
194 |
-
function wpmtst_add_config_error( $key ) {
|
195 |
-
$errors = get_option( 'wpmtst_config_errors', array() );
|
196 |
-
$errors[] = $key;
|
197 |
-
update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
|
198 |
-
|
199 |
-
wpmtst_add_admin_notice( $key, true );
|
200 |
-
}
|
201 |
-
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Delete configuration error.
|
205 |
-
*
|
206 |
-
* @since 2.24.0
|
207 |
-
* @param $key
|
208 |
-
*/
|
209 |
-
function wpmtst_delete_config_error( $key ) {
|
210 |
-
$errors = get_option( 'wpmtst_config_errors', array() );
|
211 |
-
$errors = array_diff( $errors, array ( $key ) );
|
212 |
-
update_option( 'wpmtst_config_errors', $errors, 'no' );
|
213 |
-
|
214 |
-
wpmtst_delete_admin_notice( $key );
|
215 |
-
}
|
216 |
-
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Save a View.
|
220 |
-
*
|
221 |
-
* @param $view
|
222 |
-
* @param string $action
|
223 |
-
* @usedby Strong_Testimonials_Update:update_views
|
224 |
-
*
|
225 |
-
* @return bool|false|int
|
226 |
-
*/
|
227 |
-
function wpmtst_save_view( $view, $action = 'edit' ) {
|
228 |
-
global $wpdb;
|
229 |
-
|
230 |
-
if ( ! $view ) return false;
|
231 |
-
|
232 |
-
$table_name = $wpdb->prefix . 'strong_views';
|
233 |
-
$serialized = serialize( $view['data'] );
|
234 |
-
|
235 |
-
if ( 'add' == $action || 'duplicate' == $action ) {
|
236 |
-
$sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
|
237 |
-
$sql = $wpdb->prepare( $sql, $view['name'], $serialized );
|
238 |
-
$wpdb->query( $sql );
|
239 |
-
$view['id'] = $wpdb->insert_id;
|
240 |
-
$return = $view['id'];
|
241 |
-
}
|
242 |
-
else {
|
243 |
-
$sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
|
244 |
-
$sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
|
245 |
-
$wpdb->query( $sql );
|
246 |
-
$return = $wpdb->last_error ? 0 : 1;
|
247 |
-
}
|
248 |
-
|
249 |
-
do_action( 'wpmtst_view_saved', $view );
|
250 |
-
|
251 |
-
return $return;
|
252 |
-
}
|
253 |
-
|
254 |
-
|
255 |
-
/**
|
256 |
-
* @param $field
|
257 |
-
*
|
258 |
-
* @return mixed
|
259 |
-
*/
|
260 |
-
function wpmtst_get_field_label( $field ) {
|
261 |
-
if ( isset( $field['field'] ) ) {
|
262 |
-
$custom_fields = wpmtst_get_custom_fields();
|
263 |
-
if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
|
264 |
-
return $custom_fields[ $field['field'] ]['label'];
|
265 |
-
}
|
266 |
-
$builtin_fields = wpmtst_get_builtin_fields();
|
267 |
-
if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
|
268 |
-
return $builtin_fields[ $field['field'] ]['label'];
|
269 |
-
}
|
270 |
-
}
|
271 |
-
|
272 |
-
return '';
|
273 |
-
}
|
274 |
-
|
275 |
-
function wpmtst_get_field_text( $field ) {
|
276 |
-
if ( isset( $field['field'] ) ) {
|
277 |
-
$custom_fields = wpmtst_get_custom_fields();
|
278 |
-
if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
|
279 |
-
return $custom_fields[ $field['field'] ]['text'];
|
280 |
-
}
|
281 |
-
$builtin_fields = wpmtst_get_builtin_fields();
|
282 |
-
if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
|
283 |
-
return $builtin_fields[ $field['field'] ]['text'];
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
return '';
|
288 |
-
}
|
289 |
-
|
290 |
-
|
291 |
-
/**
|
292 |
-
* @param string $field_name
|
293 |
-
*
|
294 |
-
* @return mixed
|
295 |
-
*/
|
296 |
-
function wpmtst_get_field_by_name( $field_name = '' ) {
|
297 |
-
if ( $field_name ) {
|
298 |
-
$custom_fields = wpmtst_get_custom_fields();
|
299 |
-
if ( isset( $custom_fields[ $field_name ] ) ) {
|
300 |
-
return $custom_fields[ $field_name ];
|
301 |
-
}
|
302 |
-
}
|
303 |
-
|
304 |
-
return '';
|
305 |
-
}
|
306 |
-
|
307 |
-
/**
|
308 |
-
* Returns true if at least one extension is installed
|
309 |
-
*/
|
310 |
-
function wpmtst_extensions_installed() {
|
311 |
-
|
312 |
-
if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
|
313 |
-
return true;
|
314 |
-
}
|
315 |
-
if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
|
316 |
-
return true;
|
317 |
-
}
|
318 |
-
if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
|
319 |
-
return true;
|
320 |
-
}
|
321 |
-
if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
|
322 |
-
return true;
|
323 |
-
}
|
324 |
-
if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
|
325 |
-
return true;
|
326 |
-
}
|
327 |
-
if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
|
328 |
-
return true;
|
329 |
-
}
|
330 |
-
if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
|
331 |
-
return true;
|
332 |
-
}
|
333 |
-
|
334 |
-
return false;
|
335 |
Â
}
|
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( esc_html_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>' . esc_html_x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
|
24 |
+
$message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
|
25 |
+
wp_die( $message );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
add_action( 'admin_init', 'wpmtst_version_check', 1 );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Check for plugin update.
|
33 |
+
*
|
34 |
+
* @since 2.28.4 Before other admin_init actions.
|
35 |
+
*/
|
36 |
+
function wpmtst_update_check() {
|
37 |
+
$version = get_option( 'wpmtst_plugin_version', false );
|
38 |
+
if ( $version == WPMTST_VERSION ) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
// Redirect to About page afterwards. On new install or (de)activation only.
|
42 |
+
if ( false === $version ) {
|
43 |
+
add_option( 'wpmtst_do_activation_redirect', true );
|
44 |
+
}
|
45 |
+
|
46 |
+
Strong_Testimonials_Updater::update();
|
47 |
+
}
|
48 |
+
|
49 |
+
add_action( 'admin_init', 'wpmtst_update_check', 5 );
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Initialize.
|
53 |
+
*/
|
54 |
+
function wpmtst_admin_init() {
|
55 |
+
/**
|
56 |
+
* Redirect to About page for new installs only
|
57 |
+
*
|
58 |
+
* @since 2.28.4
|
59 |
+
*/
|
60 |
+
wpmtst_activation_redirect();
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Custom action hooks
|
64 |
+
*
|
65 |
+
* @since 1.18.4
|
66 |
+
*/
|
67 |
+
if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
|
68 |
+
$action = sanitize_text_field( $_REQUEST['action'] );
|
69 |
+
do_action( 'wpmtst_' . $action );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
add_action( 'admin_init', 'wpmtst_admin_init' );
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Custom action link in admin notice.
|
77 |
+
*
|
78 |
+
* @since 2.29.0
|
79 |
+
*/
|
80 |
+
function wpmtst_action_captcha_options_changed() {
|
81 |
+
wpmtst_delete_admin_notice( 'captcha-options-changed' );
|
82 |
+
wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
|
83 |
+
exit;
|
84 |
+
}
|
85 |
+
|
86 |
+
add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Redirect to About page.
|
90 |
+
*
|
91 |
+
* @since 2.28.4
|
92 |
+
*/
|
93 |
+
function wpmtst_activation_redirect() {
|
94 |
+
if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
|
95 |
+
delete_option( 'wpmtst_do_activation_redirect' );
|
96 |
+
wp_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
|
97 |
+
exit;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Are we on a testimonial admin screen?
|
103 |
+
*
|
104 |
+
* Used by add-ons too!
|
105 |
+
*
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
function wpmtst_is_testimonial_screen() {
|
109 |
+
$screen = get_current_screen();
|
110 |
+
return ( $screen && 'wpm-testimonial' == $screen->post_type );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Add pending numbers to post types on admin menu.
|
115 |
+
* Thanks http://wordpress.stackexchange.com/a/105470/32076
|
116 |
+
*
|
117 |
+
* @param $menu
|
118 |
+
*
|
119 |
+
* @return mixed
|
120 |
+
*/
|
121 |
+
function wpmtst_pending_indicator( $menu ) {
|
122 |
+
if ( ! current_user_can( 'edit_posts' ) )
|
123 |
+
return $menu;
|
124 |
+
|
125 |
+
$options = get_option( 'wpmtst_options' );
|
126 |
+
if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
|
127 |
+
return $menu;
|
128 |
+
|
129 |
+
$types = array( 'wpm-testimonial' );
|
130 |
+
$status = 'pending';
|
131 |
+
foreach ( $types as $type ) {
|
132 |
+
$num_posts = wp_count_posts( $type, 'readable' );
|
133 |
+
$pending_count = 0;
|
134 |
+
if ( ! empty( $num_posts->$status ) )
|
135 |
+
$pending_count = $num_posts->$status;
|
136 |
+
|
137 |
+
if ( $type == 'post' )
|
138 |
+
$menu_str = 'edit.php';
|
139 |
+
else
|
140 |
+
$menu_str = 'edit.php?post_type=' . $type;
|
141 |
+
|
142 |
+
foreach ( $menu as $menu_key => $menu_data ) {
|
143 |
+
if ( $menu_str != $menu_data[2] )
|
144 |
+
continue;
|
145 |
+
$menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
return $menu;
|
150 |
+
}
|
151 |
+
add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
|
152 |
+
|
153 |
+
/**
|
154 |
+
* The [restore default] icon.
|
155 |
+
*
|
156 |
+
* @param $for
|
157 |
+
*
|
158 |
+
* @since 2.18.0
|
159 |
+
*/
|
160 |
+
function wpmtst_restore_default_icon( $for ) {
|
161 |
+
if ( !$for ) return;
|
162 |
+
?>
|
163 |
+
<input type="button" class="button secondary restore-default"
|
164 |
+
title="<?php esc_html_e( 'restore default', 'strong-testimonials' ); ?>"
|
165 |
+
value=""
|
166 |
+
data-for="<?php echo esc_attr( $for ); ?>"/>
|
167 |
+
<?php
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Check for configuration issues when options are updated.
|
174 |
+
*
|
175 |
+
* @since 2.24.0
|
176 |
+
* @param $option
|
177 |
+
* @param $old_value
|
178 |
+
* @param $value
|
179 |
+
*/
|
180 |
+
function wpmtst_updated_option( $option, $old_value, $value ) {
|
181 |
+
if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
|
182 |
+
do_action( 'wpmtst_check_config' );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
|
186 |
+
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Store configuration error.
|
190 |
+
*
|
191 |
+
* @since 2.24.0
|
192 |
+
* @param $key
|
193 |
+
*/
|
194 |
+
function wpmtst_add_config_error( $key ) {
|
195 |
+
$errors = get_option( 'wpmtst_config_errors', array() );
|
196 |
+
$errors[] = $key;
|
197 |
+
update_option( 'wpmtst_config_errors', array_unique( $errors ), 'no' );
|
198 |
+
|
199 |
+
wpmtst_add_admin_notice( $key, true );
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Delete configuration error.
|
205 |
+
*
|
206 |
+
* @since 2.24.0
|
207 |
+
* @param $key
|
208 |
+
*/
|
209 |
+
function wpmtst_delete_config_error( $key ) {
|
210 |
+
$errors = get_option( 'wpmtst_config_errors', array() );
|
211 |
+
$errors = array_diff( $errors, array ( $key ) );
|
212 |
+
update_option( 'wpmtst_config_errors', $errors, 'no' );
|
213 |
+
|
214 |
+
wpmtst_delete_admin_notice( $key );
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Save a View.
|
220 |
+
*
|
221 |
+
* @param $view
|
222 |
+
* @param string $action
|
223 |
+
* @usedby Strong_Testimonials_Update:update_views
|
224 |
+
*
|
225 |
+
* @return bool|false|int
|
226 |
+
*/
|
227 |
+
function wpmtst_save_view( $view, $action = 'edit' ) {
|
228 |
+
global $wpdb;
|
229 |
+
|
230 |
+
if ( ! $view ) return false;
|
231 |
+
|
232 |
+
$table_name = $wpdb->prefix . 'strong_views';
|
233 |
+
$serialized = serialize( $view['data'] );
|
234 |
+
|
235 |
+
if ( 'add' == $action || 'duplicate' == $action ) {
|
236 |
+
$sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
|
237 |
+
$sql = $wpdb->prepare( $sql, $view['name'], $serialized );
|
238 |
+
$wpdb->query( $sql );
|
239 |
+
$view['id'] = $wpdb->insert_id;
|
240 |
+
$return = $view['id'];
|
241 |
+
}
|
242 |
+
else {
|
243 |
+
$sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
|
244 |
+
$sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
|
245 |
+
$wpdb->query( $sql );
|
246 |
+
$return = $wpdb->last_error ? 0 : 1;
|
247 |
+
}
|
248 |
+
|
249 |
+
do_action( 'wpmtst_view_saved', $view );
|
250 |
+
|
251 |
+
return $return;
|
252 |
+
}
|
253 |
+
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @param $field
|
257 |
+
*
|
258 |
+
* @return mixed
|
259 |
+
*/
|
260 |
+
function wpmtst_get_field_label( $field ) {
|
261 |
+
if ( isset( $field['field'] ) ) {
|
262 |
+
$custom_fields = wpmtst_get_custom_fields();
|
263 |
+
if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
|
264 |
+
return $custom_fields[ $field['field'] ]['label'];
|
265 |
+
}
|
266 |
+
$builtin_fields = wpmtst_get_builtin_fields();
|
267 |
+
if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
|
268 |
+
return $builtin_fields[ $field['field'] ]['label'];
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
return '';
|
273 |
+
}
|
274 |
+
|
275 |
+
function wpmtst_get_field_text( $field ) {
|
276 |
+
if ( isset( $field['field'] ) ) {
|
277 |
+
$custom_fields = wpmtst_get_custom_fields();
|
278 |
+
if ( isset( $custom_fields[ $field['field'] ]['text'] ) ) {
|
279 |
+
return $custom_fields[ $field['field'] ]['text'];
|
280 |
+
}
|
281 |
+
$builtin_fields = wpmtst_get_builtin_fields();
|
282 |
+
if ( isset( $builtin_fields[ $field['field'] ]['text'] ) ) {
|
283 |
+
return $builtin_fields[ $field['field'] ]['text'];
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
return '';
|
288 |
+
}
|
289 |
+
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @param string $field_name
|
293 |
+
*
|
294 |
+
* @return mixed
|
295 |
+
*/
|
296 |
+
function wpmtst_get_field_by_name( $field_name = '' ) {
|
297 |
+
if ( $field_name ) {
|
298 |
+
$custom_fields = wpmtst_get_custom_fields();
|
299 |
+
if ( isset( $custom_fields[ $field_name ] ) ) {
|
300 |
+
return $custom_fields[ $field_name ];
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
return '';
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Returns true if at least one extension is installed
|
309 |
+
*/
|
310 |
+
function wpmtst_extensions_installed() {
|
311 |
+
|
312 |
+
if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
|
313 |
+
return true;
|
314 |
+
}
|
315 |
+
if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
|
316 |
+
return true;
|
317 |
+
}
|
318 |
+
if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
|
319 |
+
return true;
|
320 |
+
}
|
321 |
+
if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
|
322 |
+
return true;
|
323 |
+
}
|
324 |
+
if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
|
325 |
+
return true;
|
326 |
+
}
|
327 |
+
if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
|
328 |
+
return true;
|
329 |
+
}
|
330 |
+
if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
|
331 |
+
return true;
|
332 |
+
}
|
333 |
+
|
334 |
+
return false;
|
335 |
Â
}
|
admin/class-strong-testimonials-addons.php
CHANGED
@@ -1,132 +1,132 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Strong_Testimonials_Addons
|
4 |
-
*
|
5 |
-
* @since 2.38
|
6 |
-
*/
|
7 |
-
class Strong_Testimonials_Addons {
|
8 |
-
|
9 |
-
private $addons = array();
|
10 |
-
|
11 |
-
public function __construct() {
|
12 |
-
add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
|
13 |
-
|
14 |
-
// Add ajax action to reload extensions
|
15 |
-
add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
|
16 |
-
}
|
17 |
-
|
18 |
-
private function check_for_addons() {
|
19 |
-
|
20 |
-
if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
|
21 |
-
return $data;
|
22 |
-
}
|
23 |
-
|
24 |
-
$addons = array();
|
25 |
-
|
26 |
-
$url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
|
27 |
-
|
28 |
-
// Get data from the remote URL.
|
29 |
-
$response = wp_remote_get( $url );
|
30 |
-
|
31 |
-
if ( ! is_wp_error( $response ) ) {
|
32 |
-
|
33 |
-
// Decode the data that we got.
|
34 |
-
$data = json_decode( wp_remote_retrieve_body( $response ), true );
|
35 |
-
|
36 |
-
if ( ! empty( $data ) && is_array( $data ) ) {
|
37 |
-
$addons = $data;
|
38 |
-
// Store the data for a week.
|
39 |
-
set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return apply_filters( 'wpmtst_addons', $addons );
|
44 |
-
}
|
45 |
-
|
46 |
-
public function render_addons() {
|
47 |
-
|
48 |
-
wp_enqueue_style( 'wpmtst-admin-style' );
|
49 |
-
wp_enqueue_script( 'wpmtst-admin-script' );
|
50 |
-
|
51 |
-
if ( ! empty( $this->addons ) ) {
|
52 |
-
foreach ( $this->addons as $addon ) {
|
53 |
-
$image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
|
54 |
-
echo '<div class="wpmtst-addon">';
|
55 |
-
echo '<div class="wpmtst-addon-box">';
|
56 |
-
echo '<img src="' . esc_attr( $image ) . '">';
|
57 |
-
echo '<div class="wpmtst-addon-content">';
|
58 |
-
echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
|
59 |
-
echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
|
60 |
-
echo '</div>';
|
61 |
-
echo '</div>';
|
62 |
-
echo '<div class="wpmtst-addon-actions">';
|
63 |
-
echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade now', 'strong-testimonials' ) . '</a>', $addon );
|
64 |
-
echo '</div>';
|
65 |
-
echo '</div>';
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Add submenu page.
|
73 |
-
*
|
74 |
-
* @param $pages
|
75 |
-
*
|
76 |
-
* @return mixed
|
77 |
-
*/
|
78 |
-
public function add_submenu( $pages ) {
|
79 |
-
$pages[91] = $this->get_submenu();
|
80 |
-
return $pages;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Return submenu page parameters.
|
85 |
-
*
|
86 |
-
* @return array
|
87 |
-
*/
|
88 |
-
public function get_submenu() {
|
89 |
-
return array(
|
90 |
-
'page_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
|
91 |
-
'menu_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
|
92 |
-
'capability' => 'strong_testimonials_options',
|
93 |
-
'menu_slug' => 'strong-testimonials-addons',
|
94 |
-
'function' => array( $this, 'addons_page' ),
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Print the Addons page.
|
101 |
-
*/
|
102 |
-
public function addons_page() {
|
103 |
-
|
104 |
-
$this->addons = $this->check_for_addons();
|
105 |
-
?>
|
106 |
-
|
107 |
-
<div class="wrap">
|
108 |
-
<h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
|
109 |
-
|
110 |
-
<a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
|
111 |
-
|
112 |
-
<div class="wpmtst-addons-container">
|
113 |
-
<?php $this->render_addons(); ?>
|
114 |
-
</div>
|
115 |
-
</div>
|
116 |
-
<?php
|
117 |
-
}
|
118 |
-
|
119 |
-
public function reload_extensions() {
|
120 |
-
// Run a security check first.
|
121 |
-
check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
|
122 |
-
|
123 |
-
delete_transient( 'strong_testimonials_all_extensions' );
|
124 |
-
|
125 |
-
die;
|
126 |
-
}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
}
|
131 |
-
|
132 |
-
new Strong_Testimonials_Addons();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Strong_Testimonials_Addons
|
4 |
+
*
|
5 |
+
* @since 2.38
|
6 |
+
*/
|
7 |
+
class Strong_Testimonials_Addons {
|
8 |
+
|
9 |
+
private $addons = array();
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
|
13 |
+
|
14 |
+
// Add ajax action to reload extensions
|
15 |
+
add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
|
16 |
+
}
|
17 |
+
|
18 |
+
private function check_for_addons() {
|
19 |
+
|
20 |
+
if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
|
21 |
+
return $data;
|
22 |
+
}
|
23 |
+
|
24 |
+
$addons = array();
|
25 |
+
|
26 |
+
$url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
|
27 |
+
|
28 |
+
// Get data from the remote URL.
|
29 |
+
$response = wp_remote_get( $url );
|
30 |
+
|
31 |
+
if ( ! is_wp_error( $response ) ) {
|
32 |
+
|
33 |
+
// Decode the data that we got.
|
34 |
+
$data = json_decode( wp_remote_retrieve_body( $response ), true );
|
35 |
+
|
36 |
+
if ( ! empty( $data ) && is_array( $data ) ) {
|
37 |
+
$addons = $data;
|
38 |
+
// Store the data for a week.
|
39 |
+
set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return apply_filters( 'wpmtst_addons', $addons );
|
44 |
+
}
|
45 |
+
|
46 |
+
public function render_addons() {
|
47 |
+
|
48 |
+
wp_enqueue_style( 'wpmtst-admin-style' );
|
49 |
+
wp_enqueue_script( 'wpmtst-admin-script' );
|
50 |
+
|
51 |
+
if ( ! empty( $this->addons ) ) {
|
52 |
+
foreach ( $this->addons as $addon ) {
|
53 |
+
$image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
|
54 |
+
echo '<div class="wpmtst-addon">';
|
55 |
+
echo '<div class="wpmtst-addon-box">';
|
56 |
+
echo '<img src="' . esc_attr( $image ) . '">';
|
57 |
+
echo '<div class="wpmtst-addon-content">';
|
58 |
+
echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
|
59 |
+
echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
|
60 |
+
echo '</div>';
|
61 |
+
echo '</div>';
|
62 |
+
echo '<div class="wpmtst-addon-actions">';
|
63 |
+
echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade now', 'strong-testimonials' ) . '</a>', $addon );
|
64 |
+
echo '</div>';
|
65 |
+
echo '</div>';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Add submenu page.
|
73 |
+
*
|
74 |
+
* @param $pages
|
75 |
+
*
|
76 |
+
* @return mixed
|
77 |
+
*/
|
78 |
+
public function add_submenu( $pages ) {
|
79 |
+
$pages[91] = $this->get_submenu();
|
80 |
+
return $pages;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Return submenu page parameters.
|
85 |
+
*
|
86 |
+
* @return array
|
87 |
+
*/
|
88 |
+
public function get_submenu() {
|
89 |
+
return array(
|
90 |
+
'page_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
|
91 |
+
'menu_title' => esc_html__( 'Extensions', 'strong-testimonials' ),
|
92 |
+
'capability' => 'strong_testimonials_options',
|
93 |
+
'menu_slug' => 'strong-testimonials-addons',
|
94 |
+
'function' => array( $this, 'addons_page' ),
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Print the Addons page.
|
101 |
+
*/
|
102 |
+
public function addons_page() {
|
103 |
+
|
104 |
+
$this->addons = $this->check_for_addons();
|
105 |
+
?>
|
106 |
+
|
107 |
+
<div class="wrap">
|
108 |
+
<h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
|
109 |
+
|
110 |
+
<a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
|
111 |
+
|
112 |
+
<div class="wpmtst-addons-container">
|
113 |
+
<?php $this->render_addons(); ?>
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
|
119 |
+
public function reload_extensions() {
|
120 |
+
// Run a security check first.
|
121 |
+
check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
|
122 |
+
|
123 |
+
delete_transient( 'strong_testimonials_all_extensions' );
|
124 |
+
|
125 |
+
die;
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
new Strong_Testimonials_Addons();
|
admin/class-strong-testimonials-admin-category-list.php
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Strong_Testimonials_Admin_Category_List
|
4 |
-
*
|
5 |
-
* @since 2.28.0
|
6 |
-
*/
|
7 |
-
class Strong_Testimonials_Admin_Category_List {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Strong_Testimonials_Admin_list constructor.
|
11 |
-
*/
|
12 |
-
public function __construct() {}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Initialize.
|
16 |
-
*/
|
17 |
-
public static function init() {
|
18 |
-
self::add_actions();
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Add actions and filters.
|
23 |
-
*/
|
24 |
-
public static function add_actions() {
|
25 |
-
add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
|
26 |
-
add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Add columns to the testimonials categories screen
|
31 |
-
*
|
32 |
-
* @param $columns
|
33 |
-
*
|
34 |
-
* @return array
|
35 |
-
*/
|
36 |
-
public static function manage_categories( $columns ) {
|
37 |
-
$new_columns = array(
|
38 |
-
'cb' => '<input type="checkbox">',
|
39 |
-
'ID' => esc_html__( 'ID', 'strong-testimonials' ),
|
40 |
-
'name' => esc_html__( 'Name', 'strong-testimonials' ),
|
41 |
-
'slug' => esc_html__( 'Slug', 'strong-testimonials' ),
|
42 |
-
'posts' => esc_html__( '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' => esc_html__( 'ID', 'strong-testimonials' ),
|
40 |
+
'name' => esc_html__( 'Name', 'strong-testimonials' ),
|
41 |
+
'slug' => esc_html__( 'Slug', 'strong-testimonials' ),
|
42 |
+
'posts' => esc_html__( '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,347 +1,347 @@
|
|
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' => esc_html__( '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'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
|
107 |
-
} elseif ( 'rating' == $field['input_type'] ) {
|
108 |
-
$fields_to_add[ $field['name'] ] = esc_html__( 'Rating', 'strong-testimonials' );
|
109 |
-
} else {
|
110 |
-
$fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
|
111 |
-
}
|
112 |
-
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
116 |
-
|
117 |
-
// 5. add [category], [comments] and [date]
|
118 |
-
// The slug "categories" slug is reserved by WordPress.
|
119 |
-
if ( wpmtst_get_cat_count() ) {
|
120 |
-
$fields_to_add['category'] = esc_html__( 'Categories', 'strong-testimonials' );
|
121 |
-
}
|
122 |
-
|
123 |
-
if ( $comments ) {
|
124 |
-
$fields_to_add['comments'] = $comments;
|
125 |
-
}
|
126 |
-
|
127 |
-
$fields_to_add['date'] = esc_html__( 'Date', 'strong-testimonials' );
|
128 |
-
|
129 |
-
$options = get_option( 'wpmtst_options' );
|
130 |
-
if ( isset( $options['include_platform'] ) && $options['include_platform'] === true ) {
|
131 |
-
$fields_to_add['platform'] = esc_html__( 'Platform', 'strong-testimonials' );
|
132 |
-
}
|
133 |
-
|
134 |
-
// Push other added columns like [search_exclude] to the end.
|
135 |
-
$columns = array_merge(
|
136 |
-
array_slice( $columns, 0, $offset ),
|
137 |
-
$fields_to_add,
|
138 |
-
array_slice( $columns, $offset, null )
|
139 |
-
);
|
140 |
-
|
141 |
-
return $columns;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Show custom values
|
146 |
-
*
|
147 |
-
* @param $column
|
148 |
-
*/
|
149 |
-
public static function custom_columns( $column ) {
|
150 |
-
global $post;
|
151 |
-
|
152 |
-
switch ( $column ) {
|
153 |
-
|
154 |
-
case 'post_id' :
|
155 |
-
echo absint( $post->ID );
|
156 |
-
break;
|
157 |
-
|
158 |
-
case 'post_content' :
|
159 |
-
echo substr( $post->post_content, 0, 100 ) . '…';
|
160 |
-
break;
|
161 |
-
|
162 |
-
case 'post_excerpt' :
|
163 |
-
echo $post->post_excerpt;
|
164 |
-
break;
|
165 |
-
|
166 |
-
case 'strong_thumbnail' :
|
167 |
-
echo wpmtst_get_thumbnail( array( 60, 60 ) );
|
168 |
-
break;
|
169 |
-
|
170 |
-
case 'category' :
|
171 |
-
$categories = get_the_terms( 0, 'wpm-testimonial-category' );
|
172 |
-
if ( $categories && ! is_wp_error( $categories ) ) {
|
173 |
-
$list = array();
|
174 |
-
foreach ( $categories as $cat ) {
|
175 |
-
$list[] = $cat->name;
|
176 |
-
}
|
177 |
-
echo implode( ", ", $list );
|
178 |
-
}
|
179 |
-
break;
|
180 |
-
|
181 |
-
case 'handle' :
|
182 |
-
if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
|
183 |
-
echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
|
184 |
-
}
|
185 |
-
break;
|
186 |
-
|
187 |
-
case 'platform':
|
188 |
-
$platform = get_post_meta( $post->ID, 'platform', true );
|
189 |
-
|
190 |
-
if ( $platform ) {
|
191 |
-
?>
|
192 |
-
<img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="26" height="26" src="<?php esc_attr_e( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php esc_attr_e( $platform ); ?>.svg"/>
|
193 |
-
<?php
|
194 |
-
}
|
195 |
-
|
196 |
-
break;
|
197 |
-
|
198 |
-
default :
|
199 |
-
// custom field?
|
200 |
-
$custom = get_post_custom();
|
201 |
-
$fields = wpmtst_get_custom_fields();
|
202 |
-
|
203 |
-
if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
|
204 |
-
|
205 |
-
if ( isset( $fields[ $column ] ) ) {
|
206 |
-
|
207 |
-
switch ( $fields[ $column ]['input_type'] ) {
|
208 |
-
case 'rating' :
|
209 |
-
wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
|
210 |
-
break;
|
211 |
-
case 'checkbox' :
|
212 |
-
echo $custom[ $column ][0] ? 'yes' : 'no';
|
213 |
-
break;
|
214 |
-
default :
|
215 |
-
echo $custom[ $column ][0];
|
216 |
-
}
|
217 |
-
|
218 |
-
}
|
219 |
-
|
220 |
-
} else {
|
221 |
-
|
222 |
-
if ( isset( $fields[ $column ] ) ) {
|
223 |
-
|
224 |
-
if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
|
225 |
-
echo 'no';
|
226 |
-
} else {
|
227 |
-
// display nothing
|
228 |
-
}
|
229 |
-
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Add thumbnail column to admin list
|
238 |
-
*
|
239 |
-
* @param $columns
|
240 |
-
*
|
241 |
-
* @return array
|
242 |
-
*/
|
243 |
-
public static function add_thumbnail_column( $columns ) {
|
244 |
-
$columns['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
|
245 |
-
|
246 |
-
return $columns;
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Make columns sortable.
|
251 |
-
*
|
252 |
-
* @param $columns
|
253 |
-
*
|
254 |
-
* @since 1.12.0
|
255 |
-
* @since 2.2.0 category
|
256 |
-
*
|
257 |
-
* @return mixed
|
258 |
-
*/
|
259 |
-
public static function manage_sortable_columns( $columns ) {
|
260 |
-
$columns['client_name'] = 'client_name';
|
261 |
-
$columns['category'] = 'categories';
|
262 |
-
$columns['date'] = 'date';
|
263 |
-
|
264 |
-
return $columns;
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Add category filter to testimonial list table.
|
269 |
-
*
|
270 |
-
* @since 2.2.0
|
271 |
-
*/
|
272 |
-
public static function add_taxonomy_filters() {
|
273 |
-
global $typenow;
|
274 |
-
|
275 |
-
if ( $typenow != 'wpm-testimonial' ) {
|
276 |
-
return;
|
277 |
-
}
|
278 |
-
|
279 |
-
$taxonomies = array( 'wpm-testimonial-category' );
|
280 |
-
|
281 |
-
foreach ( $taxonomies as $tax ) {
|
282 |
-
$tax_obj = get_taxonomy( $tax );
|
283 |
-
$args = array(
|
284 |
-
'show_option_all' => $tax_obj->labels->all_items,
|
285 |
-
'show_option_none' => '',
|
286 |
-
'option_none_value' => '-1',
|
287 |
-
'orderby' => 'NAME',
|
288 |
-
'order' => 'ASC',
|
289 |
-
'show_count' => 1,
|
290 |
-
'hide_empty' => 1,
|
291 |
-
'child_of' => 0,
|
292 |
-
'exclude' => '',
|
293 |
-
'echo' => 1,
|
294 |
-
'selected' => isset( $_GET[ $tax ] ) ? sanitize_text_field( $_GET[ $tax ] ) : '',
|
295 |
-
'hierarchical' => 1,
|
296 |
-
'name' => $tax,
|
297 |
-
'id' => $tax,
|
298 |
-
'class' => 'postform',
|
299 |
-
'depth' => 0,
|
300 |
-
'tab_index' => 0,
|
301 |
-
'taxonomy' => $tax,
|
302 |
-
'hide_if_empty' => true,
|
303 |
-
'value_field' => 'slug',
|
304 |
-
);
|
305 |
-
|
306 |
-
wp_dropdown_categories( $args );
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Sort columns.
|
312 |
-
*
|
313 |
-
* @since 1.12.0
|
314 |
-
*
|
315 |
-
* @param $query
|
316 |
-
*/
|
317 |
-
public static function pre_get_posts( $query ) {
|
318 |
-
// Only in main WP query AND if an orderby query variable is designated.
|
319 |
-
if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
|
320 |
-
if ( 'client_name' == $query->get( 'orderby' ) ) {
|
321 |
-
$query->set( 'meta_key', 'client_name' );
|
322 |
-
$query->set( 'orderby', 'meta_value' );
|
323 |
-
}
|
324 |
-
}
|
325 |
-
}
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Check if we are viewing the Trash.
|
329 |
-
*
|
330 |
-
* @since 1.16.0
|
331 |
-
*/
|
332 |
-
public static function is_viewing_trash() {
|
333 |
-
return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
|
334 |
-
}
|
335 |
-
|
336 |
-
/**
|
337 |
-
* Check if a column in admin list table is sorted.
|
338 |
-
*
|
339 |
-
* @since 1.16.0
|
340 |
-
*/
|
341 |
-
public static function is_column_sorted() {
|
342 |
-
return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
|
343 |
-
}
|
344 |
-
|
345 |
-
}
|
346 |
-
|
347 |
-
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' => esc_html__( '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'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
|
107 |
+
} elseif ( 'rating' == $field['input_type'] ) {
|
108 |
+
$fields_to_add[ $field['name'] ] = esc_html__( 'Rating', 'strong-testimonials' );
|
109 |
+
} else {
|
110 |
+
$fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
// 5. add [category], [comments] and [date]
|
118 |
+
// The slug "categories" slug is reserved by WordPress.
|
119 |
+
if ( wpmtst_get_cat_count() ) {
|
120 |
+
$fields_to_add['category'] = esc_html__( 'Categories', 'strong-testimonials' );
|
121 |
+
}
|
122 |
+
|
123 |
+
if ( $comments ) {
|
124 |
+
$fields_to_add['comments'] = $comments;
|
125 |
+
}
|
126 |
+
|
127 |
+
$fields_to_add['date'] = esc_html__( 'Date', 'strong-testimonials' );
|
128 |
+
|
129 |
+
$options = get_option( 'wpmtst_options' );
|
130 |
+
if ( isset( $options['include_platform'] ) && $options['include_platform'] === true ) {
|
131 |
+
$fields_to_add['platform'] = esc_html__( 'Platform', 'strong-testimonials' );
|
132 |
+
}
|
133 |
+
|
134 |
+
// Push other added columns like [search_exclude] to the end.
|
135 |
+
$columns = array_merge(
|
136 |
+
array_slice( $columns, 0, $offset ),
|
137 |
+
$fields_to_add,
|
138 |
+
array_slice( $columns, $offset, null )
|
139 |
+
);
|
140 |
+
|
141 |
+
return $columns;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Show custom values
|
146 |
+
*
|
147 |
+
* @param $column
|
148 |
+
*/
|
149 |
+
public static function custom_columns( $column ) {
|
150 |
+
global $post;
|
151 |
+
|
152 |
+
switch ( $column ) {
|
153 |
+
|
154 |
+
case 'post_id' :
|
155 |
+
echo absint( $post->ID );
|
156 |
+
break;
|
157 |
+
|
158 |
+
case 'post_content' :
|
159 |
+
echo substr( $post->post_content, 0, 100 ) . '…';
|
160 |
+
break;
|
161 |
+
|
162 |
+
case 'post_excerpt' :
|
163 |
+
echo $post->post_excerpt;
|
164 |
+
break;
|
165 |
+
|
166 |
+
case 'strong_thumbnail' :
|
167 |
+
echo wpmtst_get_thumbnail( array( 60, 60 ) );
|
168 |
+
break;
|
169 |
+
|
170 |
+
case 'category' :
|
171 |
+
$categories = get_the_terms( 0, 'wpm-testimonial-category' );
|
172 |
+
if ( $categories && ! is_wp_error( $categories ) ) {
|
173 |
+
$list = array();
|
174 |
+
foreach ( $categories as $cat ) {
|
175 |
+
$list[] = $cat->name;
|
176 |
+
}
|
177 |
+
echo implode( ", ", $list );
|
178 |
+
}
|
179 |
+
break;
|
180 |
+
|
181 |
+
case 'handle' :
|
182 |
+
if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
|
183 |
+
echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
|
184 |
+
}
|
185 |
+
break;
|
186 |
+
|
187 |
+
case 'platform':
|
188 |
+
$platform = get_post_meta( $post->ID, 'platform', true );
|
189 |
+
|
190 |
+
if ( $platform ) {
|
191 |
+
?>
|
192 |
+
<img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="26" height="26" src="<?php esc_attr_e( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php esc_attr_e( $platform ); ?>.svg"/>
|
193 |
+
<?php
|
194 |
+
}
|
195 |
+
|
196 |
+
break;
|
197 |
+
|
198 |
+
default :
|
199 |
+
// custom field?
|
200 |
+
$custom = get_post_custom();
|
201 |
+
$fields = wpmtst_get_custom_fields();
|
202 |
+
|
203 |
+
if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
|
204 |
+
|
205 |
+
if ( isset( $fields[ $column ] ) ) {
|
206 |
+
|
207 |
+
switch ( $fields[ $column ]['input_type'] ) {
|
208 |
+
case 'rating' :
|
209 |
+
wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
|
210 |
+
break;
|
211 |
+
case 'checkbox' :
|
212 |
+
echo $custom[ $column ][0] ? 'yes' : 'no';
|
213 |
+
break;
|
214 |
+
default :
|
215 |
+
echo $custom[ $column ][0];
|
216 |
+
}
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
} else {
|
221 |
+
|
222 |
+
if ( isset( $fields[ $column ] ) ) {
|
223 |
+
|
224 |
+
if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
|
225 |
+
echo 'no';
|
226 |
+
} else {
|
227 |
+
// display nothing
|
228 |
+
}
|
229 |
+
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Add thumbnail column to admin list
|
238 |
+
*
|
239 |
+
* @param $columns
|
240 |
+
*
|
241 |
+
* @return array
|
242 |
+
*/
|
243 |
+
public static function add_thumbnail_column( $columns ) {
|
244 |
+
$columns['strong_thumbnail'] = esc_html__( 'Thumbnail', 'strong-testimonials' );
|
245 |
+
|
246 |
+
return $columns;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Make columns sortable.
|
251 |
+
*
|
252 |
+
* @param $columns
|
253 |
+
*
|
254 |
+
* @since 1.12.0
|
255 |
+
* @since 2.2.0 category
|
256 |
+
*
|
257 |
+
* @return mixed
|
258 |
+
*/
|
259 |
+
public static function manage_sortable_columns( $columns ) {
|
260 |
+
$columns['client_name'] = 'client_name';
|
261 |
+
$columns['category'] = 'categories';
|
262 |
+
$columns['date'] = 'date';
|
263 |
+
|
264 |
+
return $columns;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Add category filter to testimonial list table.
|
269 |
+
*
|
270 |
+
* @since 2.2.0
|
271 |
+
*/
|
272 |
+
public static function add_taxonomy_filters() {
|
273 |
+
global $typenow;
|
274 |
+
|
275 |
+
if ( $typenow != 'wpm-testimonial' ) {
|
276 |
+
return;
|
277 |
+
}
|
278 |
+
|
279 |
+
$taxonomies = array( 'wpm-testimonial-category' );
|
280 |
+
|
281 |
+
foreach ( $taxonomies as $tax ) {
|
282 |
+
$tax_obj = get_taxonomy( $tax );
|
283 |
+
$args = array(
|
284 |
+
'show_option_all' => $tax_obj->labels->all_items,
|
285 |
+
'show_option_none' => '',
|
286 |
+
'option_none_value' => '-1',
|
287 |
+
'orderby' => 'NAME',
|
288 |
+
'order' => 'ASC',
|
289 |
+
'show_count' => 1,
|
290 |
+
'hide_empty' => 1,
|
291 |
+
'child_of' => 0,
|
292 |
+
'exclude' => '',
|
293 |
+
'echo' => 1,
|
294 |
+
'selected' => isset( $_GET[ $tax ] ) ? sanitize_text_field( $_GET[ $tax ] ) : '',
|
295 |
+
'hierarchical' => 1,
|
296 |
+
'name' => $tax,
|
297 |
+
'id' => $tax,
|
298 |
+
'class' => 'postform',
|
299 |
+
'depth' => 0,
|
300 |
+
'tab_index' => 0,
|
301 |
+
'taxonomy' => $tax,
|
302 |
+
'hide_if_empty' => true,
|
303 |
+
'value_field' => 'slug',
|
304 |
+
);
|
305 |
+
|
306 |
+
wp_dropdown_categories( $args );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Sort columns.
|
312 |
+
*
|
313 |
+
* @since 1.12.0
|
314 |
+
*
|
315 |
+
* @param $query
|
316 |
+
*/
|
317 |
+
public static function pre_get_posts( $query ) {
|
318 |
+
// Only in main WP query AND if an orderby query variable is designated.
|
319 |
+
if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
|
320 |
+
if ( 'client_name' == $query->get( 'orderby' ) ) {
|
321 |
+
$query->set( 'meta_key', 'client_name' );
|
322 |
+
$query->set( 'orderby', 'meta_value' );
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Check if we are viewing the Trash.
|
329 |
+
*
|
330 |
+
* @since 1.16.0
|
331 |
+
*/
|
332 |
+
public static function is_viewing_trash() {
|
333 |
+
return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Check if a column in admin list table is sorted.
|
338 |
+
*
|
339 |
+
* @since 1.16.0
|
340 |
+
*/
|
341 |
+
public static function is_column_sorted() {
|
342 |
+
return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
|
343 |
+
}
|
344 |
+
|
345 |
+
}
|
346 |
+
|
347 |
+
Strong_Testimonials_Admin_List::init();
|
admin/class-strong-testimonials-admin-scripts.php
CHANGED
@@ -1,424 +1,424 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Strong_Testimonials_Admin_Scripts
|
4 |
-
*/
|
5 |
-
class Strong_Testimonials_Admin_Scripts {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Strong_Testimonials_Admin_Scripts constructor.
|
9 |
-
*/
|
10 |
-
public function __construct() {}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Initialize.
|
14 |
-
*/
|
15 |
-
public static function init() {
|
16 |
-
self::add_actions();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Add actions and filters.
|
21 |
-
*/
|
22 |
-
public static function add_actions() {
|
23 |
-
add_action( 'admin_init', array( __CLASS__, 'admin_register' ) );
|
24 |
-
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_dequeue_scripts' ), 500 );
|
25 |
-
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
|
26 |
-
|
27 |
-
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'admin_views' ) );
|
28 |
-
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'admin_fields' ) );
|
29 |
-
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'admin_settings' ) );
|
30 |
-
add_action( 'admin_print_styles-wpm-testimonial_page_about-strong-testimonials', array( __CLASS__, 'admin_about' ) );
|
31 |
-
add_action( 'admin_print_styles-wpm-testimonial_page_testimonial-shortcodes', array( __CLASS__, 'admin_shortcodes' ) );
|
32 |
-
|
33 |
-
add_action( 'load-edit.php', array( __CLASS__, 'admin_load_edit' ) );
|
34 |
-
add_action( 'load-post.php', array( __CLASS__, 'admin_load_post' ) );
|
35 |
-
add_action( 'load-post-new.php', array( __CLASS__, 'admin_load_post' ) );
|
36 |
-
add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_load_edit_tags' ) );
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Register admin scripts.
|
41 |
-
*/
|
42 |
-
public static function admin_register() {
|
43 |
-
|
44 |
-
$plugin_version = get_option( 'wpmtst_plugin_version' );
|
45 |
-
|
46 |
-
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
47 |
-
|
48 |
-
wp_register_script( 'wpmtst-help',
|
49 |
-
WPMTST_ADMIN_URL . 'js/help.js',
|
50 |
-
array( 'jquery' ),
|
51 |
-
$plugin_version,
|
52 |
-
true );
|
53 |
-
|
54 |
-
|
55 |
-
wp_register_script(
|
56 |
-
'wpmtst-admin-script',
|
57 |
-
WPMTST_ASSETS_JS . 'admin-js.js',
|
58 |
-
array( 'jquery', 'underscore' ),
|
59 |
-
$plugin_version,
|
60 |
-
true );
|
61 |
-
|
62 |
-
wp_register_style(
|
63 |
-
'wpmtst-admin-global-style',
|
64 |
-
WPMTST_ASSETS_CSS . 'admin-global.css',
|
65 |
-
array(),
|
66 |
-
$plugin_version );
|
67 |
-
|
68 |
-
wp_register_style(
|
69 |
-
'wpmtst-admin-welcome-style',
|
70 |
-
WPMTST_ASSETS_CSS . 'admin-welcome.css',
|
71 |
-
array(),
|
72 |
-
$plugin_version );
|
73 |
-
|
74 |
-
wp_register_style(
|
75 |
-
'wpmtst-admin-style',
|
76 |
-
WPMTST_ASSETS_CSS . 'admin.css',
|
77 |
-
array( ),
|
78 |
-
$plugin_version );
|
79 |
-
|
80 |
-
wp_register_style( 'wpmtst-post-editor',
|
81 |
-
WPMTST_ADMIN_URL . 'css/post-editor.css',
|
82 |
-
array( ),
|
83 |
-
$plugin_version );
|
84 |
-
|
85 |
-
wp_register_script( 'wpmtst-custom-spinner',
|
86 |
-
WPMTST_ADMIN_URL . 'js/custom-spinner.js',
|
87 |
-
array( 'jquery' ),
|
88 |
-
$plugin_version,
|
89 |
-
true );
|
90 |
-
|
91 |
-
wp_register_script( 'autosize',
|
92 |
-
WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
|
93 |
-
array(),
|
94 |
-
'4.0.1',
|
95 |
-
true );
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Form tab
|
99 |
-
*/
|
100 |
-
wp_register_style( 'wpmtst-admin-form-style',
|
101 |
-
WPMTST_ADMIN_URL . 'css/admin-form.css',
|
102 |
-
array( 'wpmtst-admin-style' ),
|
103 |
-
$plugin_version );
|
104 |
-
|
105 |
-
wp_register_script( 'wpmtst-admin-form-script',
|
106 |
-
WPMTST_ADMIN_URL . 'js/admin-form.js',
|
107 |
-
array( 'wpmtst-admin-script', 'autosize' ),
|
108 |
-
$plugin_version,
|
109 |
-
true );
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Compatibility tab
|
113 |
-
*/
|
114 |
-
wp_register_style( 'wpmtst-admin-compat-style',
|
115 |
-
WPMTST_ADMIN_URL . 'css/admin-compat.css',
|
116 |
-
array(),
|
117 |
-
$plugin_version );
|
118 |
-
|
119 |
-
wp_register_script( 'wpmtst-admin-compat-script',
|
120 |
-
WPMTST_ADMIN_URL . 'js/admin-compat.js',
|
121 |
-
array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
|
122 |
-
$plugin_version,
|
123 |
-
true );
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Fields
|
127 |
-
*/
|
128 |
-
wp_register_style( 'wpmtst-admin-fields-style',
|
129 |
-
WPMTST_ADMIN_URL . 'css/fields.css',
|
130 |
-
array(),
|
131 |
-
$plugin_version );
|
132 |
-
|
133 |
-
wp_register_style( 'wpmtst-admin-form-preview',
|
134 |
-
WPMTST_ADMIN_URL . 'css/form-preview.css',
|
135 |
-
array(),
|
136 |
-
$plugin_version );
|
137 |
-
|
138 |
-
wp_register_script( 'wpmtst-admin-fields-script',
|
139 |
-
WPMTST_ADMIN_URL . 'js/admin-fields.js',
|
140 |
-
array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
|
141 |
-
$plugin_version,
|
142 |
-
true );
|
143 |
-
|
144 |
-
$params = array(
|
145 |
-
'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
|
146 |
-
'newField' => esc_html_x( 'New |