Strong Testimonials - Version 2.40.0

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon 128x128 Strong Testimonials
Version 2.40.0
Comparing to
See all releases

Code changes from version 2.39.3 to 2.40.0

Files changed (124) hide show
  1. admin/about/addons.php +23 -23
  2. admin/about/class-strong-testimonials-about.php +100 -100
  3. admin/about/how-to.php +41 -41
  4. admin/about/links.php +21 -21
  5. admin/about/privacy.php +13 -13
  6. admin/about/upsell.php +10 -10
  7. admin/about/whats-new.php +107 -107
  8. admin/admin-notices.php +178 -178
  9. admin/admin.php +320 -320
  10. admin/class-strong-testimonials-addons.php +132 -132
  11. admin/class-strong-testimonials-admin-category-list.php +69 -69
  12. admin/class-strong-testimonials-admin-list.php +347 -331
  13. admin/class-strong-testimonials-admin-scripts.php +407 -406
  14. admin/class-strong-testimonials-defaults.php +830 -830
  15. admin/class-strong-testimonials-exporter.php +80 -80
  16. admin/class-strong-testimonials-help.php +226 -226
  17. admin/class-strong-testimonials-list-table.php +1211 -1211
  18. admin/class-strong-testimonials-page-shortcodes.php +336 -336
  19. admin/class-strong-testimonials-post-editor.php +368 -368
  20. admin/class-strong-testimonials-updater.php +1293 -1293
  21. admin/class-strong-testimonials-upsell.php +341 -303
  22. admin/class-strong-views-list-table.php +229 -229
  23. admin/class-walker-strong-category-checklist.php +127 -127
  24. admin/class-walker-strong-form-category-checklist.php +127 -127
  25. admin/compat.php +116 -116
  26. admin/css/about.css +53 -53
  27. admin/css/admin-compat.css +178 -178
  28. admin/css/admin-form.css +138 -138
  29. admin/css/fields.css +317 -317
  30. admin/css/form-preview.css +135 -135
  31. admin/css/number-spinner.css +98 -98
  32. admin/css/order.css +102 -102
  33. admin/css/polylang.css +7 -7
  34. admin/css/post-editor.css +111 -111
  35. admin/css/views.css +1009 -1009
  36. admin/css/wpml.css +31 -31
  37. admin/custom-fields-ajax.php +99 -99
  38. admin/custom-fields.php +517 -517
  39. admin/form-preview.php +51 -51
  40. admin/img/logo-long.svg +91 -91
  41. admin/js/addon-licenses.js +79 -79
  42. admin/js/admin-compat.js +130 -130
  43. admin/js/admin-fields.js +603 -603
  44. admin/js/admin-form.js +164 -164
  45. admin/js/admin-global.js +26 -26
  46. admin/js/admin-order.js +128 -128
  47. admin/js/custom-spinner.js +81 -81
  48. admin/js/help.js +22 -22
  49. admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -192
  50. admin/js/lib/autosize/autosize.min.js +5 -5
  51. admin/js/rating-edit.js +85 -85
  52. admin/js/view-category-filter.js +47 -47
  53. admin/js/views.js +1354 -1346
  54. admin/menu/class-strong-testimonials-menu-fields.php +55 -55
  55. admin/menu/class-strong-testimonials-menu-settings.php +57 -57
  56. admin/menu/class-strong-testimonials-menu-shortcodes.php +55 -55
  57. admin/menu/class-strong-testimonials-menu-views.php +55 -55
  58. admin/menu/class-strong-testimonials-menu.php +51 -51
  59. admin/partials/fields/field-controls.php +12 -12
  60. admin/partials/fields/field-header.php +13 -13
  61. admin/partials/fields/field-label.php +15 -15
  62. admin/partials/fields/field-name.php +22 -22
  63. admin/partials/fields/field-text.php +14 -14
  64. admin/partials/fields/field-type.php +77 -77
  65. admin/partials/templates/form-preview-template.php +26 -26
  66. admin/partials/views/group-compat.php +17 -17
  67. admin/partials/views/group-extra.php +24 -24
  68. admin/partials/views/group-fields.php +75 -75
  69. admin/partials/views/group-form.php +24 -24
  70. admin/partials/views/group-query.php +44 -44
  71. admin/partials/views/group-slideshow.php +30 -30
  72. admin/partials/views/group-style.php +51 -51
  73. admin/partials/views/option-background.php +150 -150
  74. admin/partials/views/option-boilerplate.php +39 -39
  75. admin/partials/views/option-category.php +56 -56
  76. admin/partials/views/option-classes.php +14 -14
  77. admin/partials/views/option-client-section.php +29 -29
  78. admin/partials/views/option-color.php +57 -57
  79. admin/partials/views/option-content.php +226 -226
  80. admin/partials/views/option-divi.php +24 -24
  81. admin/partials/views/option-form-ajax.php +13 -13
  82. admin/partials/views/option-form-category.php +28 -28
  83. admin/partials/views/option-id.php +23 -23
  84. admin/partials/views/option-layout.php +147 -147
  85. admin/partials/views/option-limit.php +33 -33
  86. admin/partials/views/option-order.php +26 -26
  87. admin/partials/views/option-pagination.php +166 -166
  88. admin/partials/views/option-read-more-page.php +88 -88
  89. admin/partials/views/option-select.php +29 -29
  90. admin/partials/views/option-slideshow-behavior.php +93 -93
  91. admin/partials/views/option-slideshow-breakpoints.php +95 -95
  92. admin/partials/views/option-slideshow-navigation.php +104 -104
  93. admin/partials/views/option-slideshow-num.php +8 -8
  94. admin/partials/views/option-slideshow-transition.php +46 -46
  95. admin/partials/views/option-slideshow-type.php +19 -19
  96. admin/partials/views/option-template-list.php +27 -27
  97. admin/partials/views/option-thumbnail.php +91 -91
  98. admin/partials/views/option-title.php +20 -20
  99. admin/partials/views/template-input.php +8 -8
  100. admin/partials/views/template-not-found.php +25 -25
  101. admin/partials/views/template-options.php +80 -80
  102. admin/partials/views/view-mode.php +18 -18
  103. admin/partials/views/view-name.php +17 -17
  104. admin/partials/views/view-shortcode.php +32 -32
  105. admin/scss/_partials/_background.scss +30 -30
  106. admin/scss/_partials/_category-checkboxes.scss +19 -19
  107. admin/scss/_partials/_category-filter.scss +58 -58
  108. admin/scss/_partials/_checkbox-icons.scss +52 -52
  109. admin/scss/_partials/_custom-fields.scss +169 -169
  110. admin/scss/_partials/_elements.scss +93 -93
  111. admin/scss/_partials/_form-table.scss +98 -98
  112. admin/scss/_partials/_help-tab.scss +50 -50
  113. admin/scss/_partials/_inner-table.scss +31 -31
  114. admin/scss/_partials/_inputs.scss +48 -48
  115. admin/scss/_partials/_layout-example-columns.scss +42 -42
  116. admin/scss/_partials/_layout-example-grid.scss +33 -33
  117. admin/scss/_partials/_layout-example-masonry.scss +22 -22
  118. admin/scss/_partials/_layout-examples.scss +40 -40
  119. admin/scss/_partials/_layout.scss +15 -15
  120. admin/scss/_partials/_list-radio-buttons.scss +133 -133
  121. admin/scss/_partials/_misc.scss +88 -88
  122. admin/scss/_partials/_screenshots.scss +10 -10
  123. admin/scss/_partials/_sticky-views.scss +48 -48
  124. admin/scss/_partials/_structure.scss +18 -41
admin/about/addons.php CHANGED
@@ -1,23 +1,23 @@
1
- <hr />
2
-
3
- <!-- <div id="addons" class="feature-section three-col">
4
- <div class="col sidebar-block sidebar-news addon multiple-forms">
5
- <h3></h3>
6
- <p></p>
7
- <div class="actions">
8
- <a href="" target="_blank">Learn more</a>
9
- </div>
10
- </div>
11
- <div class="col sidebar-block sidebar-news addon properties">
12
- <h3></h3>
13
- <p></p>
14
- <div class="actions">
15
- </div>
16
- </div>
17
- <div class="col sidebar-block sidebar-news addon assignment">
18
- <h3></h3>
19
- <p></p>
20
- <div class="actions">
21
- </div>
22
- </div>
23
- </div> -->
1
+ <hr />
2
+
3
+ <!-- <div id="addons" class="feature-section three-col">
4
+ <div class="col sidebar-block sidebar-news addon multiple-forms">
5
+ <h3></h3>
6
+ <p></p>
7
+ <div class="actions">
8
+ <a href="" target="_blank">Learn more</a>
9
+ </div>
10
+ </div>
11
+ <div class="col sidebar-block sidebar-news addon properties">
12
+ <h3></h3>
13
+ <p></p>
14
+ <div class="actions">
15
+ </div>
16
+ </div>
17
+ <div class="col sidebar-block sidebar-news addon assignment">
18
+ <h3></h3>
19
+ <p></p>
20
+ <div class="actions">
21
+ </div>
22
+ </div>
23
+ </div> -->
admin/about/class-strong-testimonials-about.php CHANGED
@@ -1,100 +1,100 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_About
4
- *
5
- * @since 2.27.0
6
- */
7
- class Strong_Testimonials_About {
8
-
9
- /**
10
- * Strong_Testimonials_About constructor.
11
- */
12
- public function __construct() {
13
- $this->add_actions();
14
- }
15
-
16
- /**
17
- * Add actions and filters.
18
- */
19
- public function add_actions() {
20
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
- }
22
-
23
- /**
24
- * Add submenu page.
25
- *
26
- * @param $pages
27
- *
28
- * @return mixed
29
- */
30
- public function add_submenu( $pages ) {
31
- $pages[90] = $this->get_submenu();
32
- return $pages;
33
- }
34
-
35
- /**
36
- * Return submenu page parameters.
37
- *
38
- * @return array
39
- */
40
- public function get_submenu() {
41
- return array(
42
- 'page_title' => __( 'About', 'strong-testimonials' ),
43
- 'menu_title' => __( 'About', 'strong-testimonials' ),
44
- 'capability' => 'strong_testimonials_about',
45
- 'menu_slug' => 'about-strong-testimonials',
46
- 'function' => array( $this, 'about_page' ),
47
- );
48
- }
49
-
50
- /**
51
- * Print the About page.
52
- */
53
- public function about_page() {
54
- $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
55
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
56
- ?>
57
- <div class="wrap about-wrap">
58
-
59
- <img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
60
-
61
- <?php /* translators: %s is the plugin version number */ ?>
62
- <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), WPMTST_VERSION ); ?></h1>
63
-
64
- <p class="about-text">
65
- <?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
66
- <?php /* translators: %s is the plugin version number */ ?>
67
- </p>
68
- <br/>
69
-
70
- <h2 class="nav-tab-wrapper wp-clearfix">
71
-
72
- <a href="<?php echo add_query_arg( 'tab', 'how-to', $url ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php _e( 'How To', 'strong-testimonials' ); ?></a>
73
- <a href="<?php echo esc_url( add_query_arg( 'tab', 'privacy', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Privacy', 'strong-testimonials' ); ?></a>
74
-
75
- </h2>
76
-
77
-
78
- <?php
79
- switch( $active_tab ) {
80
- case 'privacy':
81
- include WPMTST_ADMIN . 'about/privacy.php';
82
- break;
83
- default:
84
- include WPMTST_ADMIN . 'about/how-to.php';
85
- break;
86
- }
87
-
88
- include WPMTST_ADMIN . 'about/upsell.php';
89
- include WPMTST_ADMIN . 'about/links.php';
90
- include WPMTST_ADMIN . 'about/addons.php';
91
- ?>
92
-
93
- </div>
94
- <?php
95
- }
96
-
97
-
98
- }
99
-
100
- new Strong_Testimonials_About();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_About
4
+ *
5
+ * @since 2.27.0
6
+ */
7
+ class Strong_Testimonials_About {
8
+
9
+ /**
10
+ * Strong_Testimonials_About constructor.
11
+ */
12
+ public function __construct() {
13
+ $this->add_actions();
14
+ }
15
+
16
+ /**
17
+ * Add actions and filters.
18
+ */
19
+ public function add_actions() {
20
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
+ }
22
+
23
+ /**
24
+ * Add submenu page.
25
+ *
26
+ * @param $pages
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function add_submenu( $pages ) {
31
+ $pages[90] = $this->get_submenu();
32
+ return $pages;
33
+ }
34
+
35
+ /**
36
+ * Return submenu page parameters.
37
+ *
38
+ * @return array
39
+ */
40
+ public function get_submenu() {
41
+ return array(
42
+ 'page_title' => __( 'About', 'strong-testimonials' ),
43
+ 'menu_title' => __( 'About', 'strong-testimonials' ),
44
+ 'capability' => 'strong_testimonials_about',
45
+ 'menu_slug' => 'about-strong-testimonials',
46
+ 'function' => array( $this, 'about_page' ),
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Print the About page.
52
+ */
53
+ public function about_page() {
54
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
55
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
56
+ ?>
57
+ <div class="wrap about-wrap">
58
+
59
+ <img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
60
+
61
+ <?php /* translators: %s is the plugin version number */ ?>
62
+ <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), WPMTST_VERSION ); ?></h1>
63
+
64
+ <p class="about-text">
65
+ <?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
66
+ <?php /* translators: %s is the plugin version number */ ?>
67
+ </p>
68
+ <br/>
69
+
70
+ <h2 class="nav-tab-wrapper wp-clearfix">
71
+
72
+ <a href="<?php echo add_query_arg( 'tab', 'how-to', $url ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php _e( 'How To', 'strong-testimonials' ); ?></a>
73
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'privacy', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Privacy', 'strong-testimonials' ); ?></a>
74
+
75
+ </h2>
76
+
77
+
78
+ <?php
79
+ switch( $active_tab ) {
80
+ case 'privacy':
81
+ include WPMTST_ADMIN . 'about/privacy.php';
82
+ break;
83
+ default:
84
+ include WPMTST_ADMIN . 'about/how-to.php';
85
+ break;
86
+ }
87
+
88
+ include WPMTST_ADMIN . 'about/upsell.php';
89
+ include WPMTST_ADMIN . 'about/links.php';
90
+ include WPMTST_ADMIN . 'about/addons.php';
91
+ ?>
92
+
93
+ </div>
94
+ <?php
95
+ }
96
+
97
+
98
+ }
99
+
100
+ new Strong_Testimonials_About();
admin/about/how-to.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
- ?>
4
- <h2><?php _e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
- <p class="lead-description"><?php _e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
-
7
- <div class="feature-section has-4-columns is-fullwidth four-col">
8
- <div class="col column">
9
- <h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
10
- <p>1. <?php printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ); ?>
11
- </p>
12
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
13
- <?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
14
- </p>
15
- <p>3. <?php echo $add_the_view; ?></p>
16
- </div>
17
-
18
- <div class="col column">
19
- <h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
21
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
22
- <?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
23
- </p>
24
- <p>3. <?php echo $add_the_view; ?></p>
25
- </div>
26
-
27
- <div class="col column">
28
- <h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
30
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
31
- <?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
32
- </p>
33
- <p>3. <?php echo $add_the_view; ?></p>
34
- </div>
35
-
36
- <div class="col column">
37
- <h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
- <p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
- <p><?php _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ); ?></p>
40
- </div>
41
- </div>
1
+ <?php
2
+ $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
+ ?>
4
+ <h2><?php _e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
+ <p class="lead-description"><?php _e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
+
7
+ <div class="feature-section has-4-columns is-fullwidth four-col">
8
+ <div class="col column">
9
+ <h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
10
+ <p>1. <?php printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ); ?>
11
+ </p>
12
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
13
+ <?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
14
+ </p>
15
+ <p>3. <?php echo $add_the_view; ?></p>
16
+ </div>
17
+
18
+ <div class="col column">
19
+ <h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
+ <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
21
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
22
+ <?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
23
+ </p>
24
+ <p>3. <?php echo $add_the_view; ?></p>
25
+ </div>
26
+
27
+ <div class="col column">
28
+ <h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
+ <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
30
+ <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
31
+ <?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
32
+ </p>
33
+ <p>3. <?php echo $add_the_view; ?></p>
34
+ </div>
35
+
36
+ <div class="col column">
37
+ <h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
+ <p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
+ <p><?php _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ); ?></p>
40
+ </div>
41
+ </div>
admin/about/links.php CHANGED
@@ -1,21 +1,21 @@
1
- <hr />
2
-
3
- <div class="feature-section three-col">
4
- <div class="col">
5
- <h3><?php _e( 'Support', 'strong-testimonials' ); ?></h3>
6
- <?php
7
- $links = array();
8
-
9
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
10
- esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ),
11
- __( 'Use the community support forum', 'strong-testimonials' ) );
12
-
13
- ?>
14
- <ul>
15
- <?php foreach ( $links as $link ) : ?>
16
- <li><?php echo $link; ?></li>
17
- <?php endforeach; ?>
18
- </ul>
19
- </div>
20
-
21
- </div>
1
+ <hr />
2
+
3
+ <div class="feature-section three-col">
4
+ <div class="col">
5
+ <h3><?php _e( 'Support', 'strong-testimonials' ); ?></h3>
6
+ <?php
7
+ $links = array();
8
+
9
+ $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
10
+ esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ),
11
+ __( 'Use the community support forum', 'strong-testimonials' ) );
12
+
13
+ ?>
14
+ <ul>
15
+ <?php foreach ( $links as $link ) : ?>
16
+ <li><?php echo $link; ?></li>
17
+ <?php endforeach; ?>
18
+ </ul>
19
+ </div>
20
+
21
+ </div>
admin/about/privacy.php CHANGED
@@ -1,13 +1,13 @@
1
- <h2><?php _e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
- <p class="lead-description"><?php _e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
- <div class="feature-section one-col">
4
- <div class="col">
5
- <p><?php _e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
- <p><?php _e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
- <p><strong><?php _e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
- <p><?php _e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
- <p><?php _e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
- <p><?php _e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
- <p><?php _e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
- </div>
13
- </div>
1
+ <h2><?php _e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
+ <p class="lead-description"><?php _e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
+ <div class="feature-section one-col">
4
+ <div class="col">
5
+ <p><?php _e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
+ <p><?php _e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
+ <p><strong><?php _e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
+ <p><?php _e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
+ <p><?php _e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
+ <p><?php _e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
+ <p><?php _e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
+ </div>
13
+ </div>
admin/about/upsell.php CHANGED
@@ -1,10 +1,10 @@
1
- <div class="wpmtst-notice wpmtst-notice--upsell">
2
- <div class="wpmtst-notice--upsell__bg"></div>
3
- <h3><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h3>
4
- <p>
5
- <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
6
- <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
7
- </p>
8
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=about-page-upsell' ); ?>""><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
9
- <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-addons' ) ); ?>"><?php esc_html_e( 'View Extensions', 'strong-testimonials' ); ?></a>
10
- </div>
1
+ <div class="wpmtst-notice wpmtst-notice--upsell">
2
+ <div class="wpmtst-notice--upsell__bg"></div>
3
+ <h3><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h3>
4
+ <p>
5
+ <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
6
+ <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
7
+ </p>
8
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=about-page-upsell' ); ?>""><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
9
+ <a class="button button-secondary" href="<?php echo esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=strong-testimonials-addons' ) ); ?>"><?php esc_html_e( 'View Extensions', 'strong-testimonials' ); ?></a>
10
+ </div>
admin/about/whats-new.php CHANGED
@@ -1,107 +1,107 @@
1
-
2
- <h2>Now Even Stronger</h2>
3
-
4
- <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
-
6
- <div class="feature-section one-col">
7
- <div class="col">
8
- <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
- </div>
10
- </div>
11
-
12
- <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
-
14
- <div class="feature-section one-col">
15
- <div class="col">
16
- <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
- <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
- <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
- <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
- <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
- <div class="feature-section-sub">
22
-
23
- <h3 class="heading">Point Releases</h3>
24
-
25
- <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
-
27
- <ul>
28
- <li>Version 2.31.1</li>
29
- <li>Version 2.31.2</li>
30
- <li>Version 2.31.3</li>
31
- <li>Version 2.31.4</li>
32
- <li>Version 2.31.5</li>
33
- <li>Version 2.31.6</li>
34
- <li>Version 2.31.7</li>
35
- <li>Version 2.31.8</li>
36
- <li>Version 2.31.9</li>
37
- <li>Version 2.31.10</li>
38
- </ul>
39
-
40
- </div>
41
- </div>
42
- </div>
43
-
44
- <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
-
46
- <div class="feature-section one-col">
47
- <div class="col">
48
- <p>NEW: Option to select the font color in views. Finally!</p>
49
- <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
- <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
- <p>NEW: Using the WordPress email validation function for increased security.</p>
52
- <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
- <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
- <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
- <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
- <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
-
58
- <div class="feature-section-sub">
59
-
60
- <h3 class="heading">Point Releases</h3>
61
-
62
- <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
-
64
- <ul>
65
- <li>Version 2.30.1</li>
66
- <li>Version 2.30.2</li>
67
- <li>Version 2.30.3</li>
68
- <li>Version 2.30.4</li>
69
- <li>Version 2.30.5</li>
70
- <li>Version 2.30.6</li>
71
- <li>Version 2.30.7</li>
72
- <li>Version 2.30.8</li>
73
- <li>Version 2.30.9</li>
74
- </ul>
75
-
76
- </div>
77
- </div>
78
- </div>
79
-
80
- <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
-
82
- <div class="feature-section one-col">
83
- <div class="col">
84
- <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
- <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
- <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
- <p>FIXED: The notification email now displays a category name properly.</p>
88
- <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
- <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
- <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
- </div>
92
- </div>
93
-
94
- <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
-
96
- <div class="feature-section one-col">
97
- <div class="col">
98
- <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
- <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
- <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
- <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
- <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
- <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
- <p>FIXED: Capabilities check in multisite.</p>
105
- <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
- </div>
107
- </div>
1
+
2
+ <h2>Now Even Stronger</h2>
3
+
4
+ <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
+
6
+ <div class="feature-section one-col">
7
+ <div class="col">
8
+ <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
+ </div>
10
+ </div>
11
+
12
+ <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
+
14
+ <div class="feature-section one-col">
15
+ <div class="col">
16
+ <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
+ <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
+ <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
+ <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
+ <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
+ <div class="feature-section-sub">
22
+
23
+ <h3 class="heading">Point Releases</h3>
24
+
25
+ <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
+
27
+ <ul>
28
+ <li>Version 2.31.1</li>
29
+ <li>Version 2.31.2</li>
30
+ <li>Version 2.31.3</li>
31
+ <li>Version 2.31.4</li>
32
+ <li>Version 2.31.5</li>
33
+ <li>Version 2.31.6</li>
34
+ <li>Version 2.31.7</li>
35
+ <li>Version 2.31.8</li>
36
+ <li>Version 2.31.9</li>
37
+ <li>Version 2.31.10</li>
38
+ </ul>
39
+
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
+
46
+ <div class="feature-section one-col">
47
+ <div class="col">
48
+ <p>NEW: Option to select the font color in views. Finally!</p>
49
+ <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
+ <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
+ <p>NEW: Using the WordPress email validation function for increased security.</p>
52
+ <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
+ <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
+ <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
+ <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
+ <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
+
58
+ <div class="feature-section-sub">
59
+
60
+ <h3 class="heading">Point Releases</h3>
61
+
62
+ <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
+
64
+ <ul>
65
+ <li>Version 2.30.1</li>
66
+ <li>Version 2.30.2</li>
67
+ <li>Version 2.30.3</li>
68
+ <li>Version 2.30.4</li>
69
+ <li>Version 2.30.5</li>
70
+ <li>Version 2.30.6</li>
71
+ <li>Version 2.30.7</li>
72
+ <li>Version 2.30.8</li>
73
+ <li>Version 2.30.9</li>
74
+ </ul>
75
+
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
+
82
+ <div class="feature-section one-col">
83
+ <div class="col">
84
+ <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
+ <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
+ <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
+ <p>FIXED: The notification email now displays a category name properly.</p>
88
+ <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
+ <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
+ <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
+ </div>
92
+ </div>
93
+
94
+ <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
+
96
+ <div class="feature-section one-col">
97
+ <div class="col">
98
+ <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
+ <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
+ <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
+ <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
+ <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
+ <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
+ <p>FIXED: Capabilities check in multisite.</p>
105
+ <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
+ </div>
107
+ </div>
admin/admin-notices.php CHANGED
@@ -1,178 +1,178 @@
1
- <?php
2
- /**
3
- * Admin notices
4
- */
5
-
6
-
7
- /**
8
- * Dismiss persistent notices.
9
- *
10
- * @since 2.29.0
11
- */
12
- function wpmtst_dismiss_notice_ajax() {
13
- if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
- echo 0;
15
- wp_die();
16
- }
17
-
18
- check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
- wpmtst_delete_admin_notice( $_POST['key'] );
20
- wp_die();
21
- }
22
-
23
- add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
-
25
- /**
26
- * Print admin notices.
27
- *
28
- * @since 2.24.0
29
- */
30
- function wpmtst_admin_notices() {
31
- $notices = get_option( 'wpmtst_admin_notices' );
32
- if ( ! $notices ) {
33
- return;
34
- }
35
-
36
- foreach ( $notices as $key => $notice ) {
37
- $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
- if ( $message ) {
39
- echo $message;
40
- }
41
- if ( ! $notice['persist'] ) {
42
- wpmtst_delete_admin_notice( $key );
43
- }
44
- }
45
- }
46
- add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
-
48
-
49
- /**
50
- * Return specific admin notice text.
51
- *
52
- * @since 2.28.5
53
- * @param string $html
54
- * @param $key
55
- *
56
- * @return string
57
- */
58
- function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
-
60
- switch ( $key ) {
61
- case 'defaults-restored' :
62
- ob_start();
63
- ?>
64
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
- <p>
66
- <?php _e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
- </p>
68
- </div>
69
- <?php
70
- $html = ob_get_clean();
71
- break;
72
-
73
- case 'fields-saved' :
74
- ob_start();
75
- ?>
76
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
- <p>
78
- <?php _e( 'Fields saved.', 'strong-testimonials' ); ?>
79
- </p>
80
- </div>
81
- <?php
82
- $html = ob_get_clean();
83
- break;
84
-
85
- case 'changes-cancelled' :
86
- ob_start();
87
- ?>
88
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
- <p>
90
- <?php _e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
- </p>
92
- </div>
93
- <?php
94
- $html = ob_get_clean();
95
- break;
96
-
97
- case 'captcha-options-changed' :
98
- $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
- //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
- $settings_url = admin_url( '?action=captcha-options-changed' );
101
- $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
102
-
103
- ob_start();
104
- ?>
105
- <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
106
- <p>
107
- <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
- <?php echo $settings_link; ?>
109
- </p>
110
- </div>
111
- <?php
112
- $html = ob_get_clean();
113
- break;
114
-
115
- default :
116
- // nothing
117
- }
118
-
119
- return $html;
120
- }
121
- add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
-
123
-
124
- /**
125
- * Add admin notice to queue.
126
- *
127
- * @since 2.24.0
128
- *
129
- * @param $key
130
- * @param $persist
131
- */
132
- function wpmtst_add_admin_notice( $key, $persist = false ) {
133
- $notices = get_option( 'wpmtst_admin_notices', array() );
134
- $notices[ $key ] = array( 'persist' => $persist );
135
- update_option( 'wpmtst_admin_notices', $notices );
136
- }
137
-
138
-
139
- /**
140
- * Delete admin notice from queue.
141
- *
142
- * @since 2.24.0
143
- *
144
- * @param $key
145
- */
146
- function wpmtst_delete_admin_notice( $key ) {
147
- $notices = get_option( 'wpmtst_admin_notices', array() );
148
- unset( $notices[ $key ] );
149
- update_option( 'wpmtst_admin_notices', $notices );
150
- }
151
-
152
-
153
- /**
154
- * Automatically dismiss specific notices when settings are saved.
155
- *
156
- * @since 2.29.0
157
- * @param $option
158
- * @param $old_value
159
- * @param $value
160
- */
161
- function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
162
- if ( ! function_exists( 'get_current_screen' ) ) {
163
- return;
164
- }
165
-
166
- $screen = get_current_screen();
167
- if ( $screen && 'options' == $screen->base ) {
168
- if ( 'wpmtst_form_options' == $option ) {
169
- $notices = get_option( 'wpmtst_admin_notices', array() );
170
- if ( isset( $notices['captcha-options-changed'] ) ) {
171
- unset( $notices['captcha-options-changed'] );
172
- update_option( 'wpmtst_admin_notices', $notices );
173
- }
174
- }
175
- }
176
- }
177
- add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
178
-
1
+ <?php
2
+ /**
3
+ * Admin notices
4
+ */
5
+
6
+
7
+ /**
8
+ * Dismiss persistent notices.
9
+ *
10
+ * @since 2.29.0
11
+ */
12
+ function wpmtst_dismiss_notice_ajax() {
13
+ if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
+ echo 0;
15
+ wp_die();
16
+ }
17
+
18
+ check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
+ wpmtst_delete_admin_notice( $_POST['key'] );
20
+ wp_die();
21
+ }
22
+
23
+ add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
+
25
+ /**
26
+ * Print admin notices.
27
+ *
28
+ * @since 2.24.0
29
+ */
30
+ function wpmtst_admin_notices() {
31
+ $notices = get_option( 'wpmtst_admin_notices' );
32
+ if ( ! $notices ) {
33
+ return;
34
+ }
35
+
36
+ foreach ( $notices as $key => $notice ) {
37
+ $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
+ if ( $message ) {
39
+ echo $message;
40
+ }
41
+ if ( ! $notice['persist'] ) {
42
+ wpmtst_delete_admin_notice( $key );
43
+ }
44
+ }
45
+ }
46
+ add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
+
48
+
49
+ /**
50
+ * Return specific admin notice text.
51
+ *
52
+ * @since 2.28.5
53
+ * @param string $html
54
+ * @param $key
55
+ *
56
+ * @return string
57
+ */
58
+ function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
+
60
+ switch ( $key ) {
61
+ case 'defaults-restored' :
62
+ ob_start();
63
+ ?>
64
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
+ <p>
66
+ <?php _e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
+ </p>
68
+ </div>
69
+ <?php
70
+ $html = ob_get_clean();
71
+ break;
72
+
73
+ case 'fields-saved' :
74
+ ob_start();
75
+ ?>
76
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
+ <p>
78
+ <?php _e( 'Fields saved.', 'strong-testimonials' ); ?>
79
+ </p>
80
+ </div>
81
+ <?php
82
+ $html = ob_get_clean();
83
+ break;
84
+
85
+ case 'changes-cancelled' :
86
+ ob_start();
87
+ ?>
88
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
+ <p>
90
+ <?php _e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
+ </p>
92
+ </div>
93
+ <?php
94
+ $html = ob_get_clean();
95
+ break;
96
+
97
+ case 'captcha-options-changed' :
98
+ $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
+ //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
+ $settings_url = admin_url( '?action=captcha-options-changed' );
101
+ $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
102
+
103
+ ob_start();
104
+ ?>
105
+ <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
106
+ <p>
107
+ <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
+ <?php echo $settings_link; ?>
109
+ </p>
110
+ </div>
111
+ <?php
112
+ $html = ob_get_clean();
113
+ break;
114
+
115
+ default :
116
+ // nothing
117
+ }
118
+
119
+ return $html;
120
+ }
121
+ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
+
123
+
124
+ /**
125
+ * Add admin notice to queue.
126
+ *
127
+ * @since 2.24.0
128
+ *
129
+ * @param $key
130
+ * @param $persist
131
+ */
132
+ function wpmtst_add_admin_notice( $key, $persist = false ) {
133
+ $notices = get_option( 'wpmtst_admin_notices', array() );
134
+ $notices[ $key ] = array( 'persist' => $persist );
135
+ update_option( 'wpmtst_admin_notices', $notices );
136
+ }
137
+
138
+
139
+ /**
140
+ * Delete admin notice from queue.
141
+ *
142
+ * @since 2.24.0
143
+ *
144
+ * @param $key
145
+ */
146
+ function wpmtst_delete_admin_notice( $key ) {
147
+ $notices = get_option( 'wpmtst_admin_notices', array() );
148
+ unset( $notices[ $key ] );
149
+ update_option( 'wpmtst_admin_notices', $notices );
150
+ }
151
+
152
+
153
+ /**
154
+ * Automatically dismiss specific notices when settings are saved.
155
+ *
156
+ * @since 2.29.0
157
+ * @param $option
158
+ * @param $old_value
159
+ * @param $value
160
+ */
161
+ function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
162
+ if ( ! function_exists( 'get_current_screen' ) ) {
163
+ return;
164
+ }
165
+
166
+ $screen = get_current_screen();
167
+ if ( $screen && 'options' == $screen->base ) {
168
+ if ( 'wpmtst_form_options' == $option ) {
169
+ $notices = get_option( 'wpmtst_admin_notices', array() );
170
+ if ( isset( $notices['captcha-options-changed'] ) ) {
171
+ unset( $notices['captcha-options-changed'] );
172
+ update_option( 'wpmtst_admin_notices', $notices );
173
+ }
174
+ }
175
+ }
176
+ }
177
+ add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
178
+
admin/admin.php CHANGED
@@ -1,320 +1,320 @@
1
- <?php
2
- /**
3
- * Strong Testimonials admin functions.
4
- *
5
- * 1. Check for required WordPress version.
6
- * 2. Check for plugin update.
7
- * 3. Initialize.
8
- */
9
-
10
- /**
11
- * Check for required WordPress version.
12
- */
13
- function wpmtst_version_check() {
14
- global $wp_version;
15
- $require_wp_version = "3.7";
16
-
17
- if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
- deactivate_plugins( WPMTST_PLUGIN );
19
- /* translators: %s is the name of the plugin. */
20
- $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
- /* translators: %s is a WordPress version number. */
22
- $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
- $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
- $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
- wp_die( $message );
26
- }
27
- }
28
-
29
- add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
-
31
- /**
32
- * Check for plugin update.
33
- *
34
- * @since 2.28.4 Before other admin_init actions.
35
- */
36
- function wpmtst_update_check() {
37
- $version = get_option( 'wpmtst_plugin_version', false );
38
- if ( $version == WPMTST_VERSION ) {
39
- return;
40
- }
41
- // Redirect to About page afterwards. On new install or (de)activation only.
42
- if ( false === $version ) {
43
- add_option( 'wpmtst_do_activation_redirect', true );
44
- }
45
-
46
- Strong_Testimonials_Updater::update();
47
- }
48
-
49
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
-
51
- /**
52
- * Initialize.
53
- */
54
- function wpmtst_admin_init() {
55
- /**
56
- * Redirect to About page for new installs only
57
- *
58
- * @since 2.28.4
59
- */
60
- wpmtst_activation_redirect();
61
-
62
- /**
63
- * Custom action hooks
64
- *
65
- * @since 1.18.4
66
- */
67
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
- do_action( 'wpmtst_' . $_REQUEST['action'] );
69
- }
70
- }
71
-
72
- add_action( 'admin_init', 'wpmtst_admin_init' );
73
-
74
- /**
75
- * Custom action link in admin notice.
76
- *
77
- * @since 2.29.0
78
- */
79
- function wpmtst_action_captcha_options_changed() {
80
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
81
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
82
- exit;
83
- }
84
-
85
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
86
-
87
- /**
88
- * Redirect to About page.
89
- *
90
- * @since 2.28.4
91
- */
92
- function wpmtst_activation_redirect() {
93
- if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
94
- delete_option( 'wpmtst_do_activation_redirect' );
95
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
96
- exit;
97
- }
98
- }
99
-
100
- /**
101
- * Are we on a testimonial admin screen?
102
- *
103
- * Used by add-ons too!
104
- *
105
- * @return bool
106
- */
107
- function wpmtst_is_testimonial_screen() {
108
- $screen = get_current_screen();
109
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
110
- }
111
-
112
- /**
113
- * Add pending numbers to post types on admin menu.
114
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
115
- *
116
- * @param $menu
117
- *
118
- * @return mixed
119
- */
120
- function wpmtst_pending_indicator( $menu ) {
121
- if ( ! current_user_can( 'edit_posts' ) )
122
- return $menu;
123
-
124
- $options = get_option( 'wpmtst_options' );
125
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
126
- return $menu;
127
-
128
- $types = array( 'wpm-testimonial' );
129
- $status = 'pending';
130
- foreach ( $types as $type ) {
131
- $num_posts = wp_count_posts( $type, 'readable' );
132
- $pending_count = 0;
133
- if ( ! empty( $num_posts->$status ) )
134
- $pending_count = $num_posts->$status;
135
-
136
- if ( $type == 'post' )
137
- $menu_str = 'edit.php';
138
- else
139
- $menu_str = 'edit.php?post_type=' . $type;
140
-
141
- foreach ( $menu as $menu_key => $menu_data ) {
142
- if ( $menu_str != $menu_data[2] )
143
- continue;
144
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
145
- }
146
- }
147
-
148
- return $menu;
149
- }
150
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
151
-
152
- /**
153
- * The [restore default] icon.
154
- *
155
- * @param $for
156
- *
157
- * @since 2.18.0
158
- */
159
- function wpmtst_restore_default_icon( $for ) {
160
- if ( !$for ) return;
161
- ?>
162
- <input type="button" class="button secondary restore-default"
163
- title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
164
- value="&#xf171"
165
- data-for="<?php echo $for; ?>"/>
166
- <?php
167
- }
168
-
169
-
170
-
171
- /**
172
- * Check for configuration issues when options are updated.
173
- *
174
- * @since 2.24.0
175
- * @param $option
176
- * @param $old_value
177
- * @param $value
178
- */
179
- function wpmtst_updated_option( $option, $old_value, $value ) {
180
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
181
- do_action( 'wpmtst_check_config' );
182
- }
183
- }
184
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
185
-
186
-
187
- /**
188
- * Store configuration error.
189
- *
190
- * @since 2.24.0
191
- * @param $key
192
- */
193
- function wpmtst_add_config_error( $key ) {
194
- $errors = get_option( 'wpmtst_config_errors', array() );
195
- $errors[] = $key;
196
- update_option( 'wpmtst_config_errors', array_unique( $errors ) );
197
-
198
- wpmtst_add_admin_notice( $key, true );
199
- }
200
-
201
-
202
- /**
203
- * Delete configuration error.
204
- *
205
- * @since 2.24.0
206
- * @param $key
207
- */
208
- function wpmtst_delete_config_error( $key ) {
209
- $errors = get_option( 'wpmtst_config_errors', array() );
210
- $errors = array_diff( $errors, array ( $key ) );
211
- update_option( 'wpmtst_config_errors', $errors );
212
-
213
- wpmtst_delete_admin_notice( $key );
214
- }
215
-
216
-
217
- /**
218
- * Save a View.
219
- *
220
- * @param $view
221
- * @param string $action
222
- * @usedby Strong_Testimonials_Update:update_views
223
- *
224
- * @return bool|false|int
225
- */
226
- function wpmtst_save_view( $view, $action = 'edit' ) {
227
- global $wpdb;
228
-
229
- if ( ! $view ) return false;
230
-
231
- $table_name = $wpdb->prefix . 'strong_views';
232
- $serialized = serialize( $view['data'] );
233
-
234
- if ( 'add' == $action || 'duplicate' == $action ) {
235
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
236
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
237
- $wpdb->query( $sql );
238
- $view['id'] = $wpdb->insert_id;
239
- $return = $view['id'];
240
- }
241
- else {
242
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
243
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
244
- $wpdb->query( $sql );
245
- $return = $wpdb->last_error ? 0 : 1;
246
- }
247
-
248
- do_action( 'wpmtst_view_saved', $view );
249
-
250
- return $return;
251
- }
252
-
253
-
254
- /**
255
- * @param $field
256
- *
257
- * @return mixed
258
- */
259
- function wpmtst_get_field_label( $field ) {
260
- if ( isset( $field['field'] ) ) {
261
- $custom_fields = wpmtst_get_custom_fields();
262
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
263
- return $custom_fields[ $field['field'] ]['label'];
264
- }
265
- $builtin_fields = wpmtst_get_builtin_fields();
266
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
267
- return $builtin_fields[ $field['field'] ]['label'];
268
- }
269
- }
270
-
271
- return '';
272
- }
273
-
274
-
275
- /**
276
- * @param string $field_name
277
- *
278
- * @return mixed
279
- */
280
- function wpmtst_get_field_by_name( $field_name = '' ) {
281
- if ( $field_name ) {
282
- $custom_fields = wpmtst_get_custom_fields();
283
- if ( isset( $custom_fields[ $field_name ] ) ) {
284
- return $custom_fields[ $field_name ];
285
- }
286
- }
287
-
288
- return '';
289
- }
290
-
291
- /**
292
- * Returns true if at least one extension is installed
293
- */
294
- function wpmtst_extensions_installed() {
295
-
296
- if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
297
- return true;
298
- }
299
- if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
300
- return true;
301
- }
302
- if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
303
- return true;
304
- }
305
- if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
306
- return true;
307
- }
308
- if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
309
- return true;
310
- }
311
- if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
312
- return true;
313
- }
314
- if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
315
- return true;
316
- }
317
-
318
- return false;
319
- }
320
-
1
+ <?php
2
+ /**
3
+ * Strong Testimonials admin functions.
4
+ *
5
+ * 1. Check for required WordPress version.
6
+ * 2. Check for plugin update.
7
+ * 3. Initialize.
8
+ */
9
+
10
+ /**
11
+ * Check for required WordPress version.
12
+ */
13
+ function wpmtst_version_check() {
14
+ global $wp_version;
15
+ $require_wp_version = "3.7";
16
+
17
+ if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
+ deactivate_plugins( WPMTST_PLUGIN );
19
+ /* translators: %s is the name of the plugin. */
20
+ $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
+ /* translators: %s is a WordPress version number. */
22
+ $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
+ $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
+ $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
+ wp_die( $message );
26
+ }
27
+ }
28
+
29
+ add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
+
31
+ /**
32
+ * Check for plugin update.
33
+ *
34
+ * @since 2.28.4 Before other admin_init actions.
35
+ */
36
+ function wpmtst_update_check() {
37
+ $version = get_option( 'wpmtst_plugin_version', false );
38
+ if ( $version == WPMTST_VERSION ) {
39
+ return;
40
+ }
41
+ // Redirect to About page afterwards. On new install or (de)activation only.
42
+ if ( false === $version ) {
43
+ add_option( 'wpmtst_do_activation_redirect', true );
44
+ }
45
+
46
+ Strong_Testimonials_Updater::update();
47
+ }
48
+
49
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
50
+
51
+ /**
52
+ * Initialize.
53
+ */
54
+ function wpmtst_admin_init() {
55
+ /**
56
+ * Redirect to About page for new installs only
57
+ *
58
+ * @since 2.28.4
59
+ */
60
+ wpmtst_activation_redirect();
61
+
62
+ /**
63
+ * Custom action hooks
64
+ *
65
+ * @since 1.18.4
66
+ */
67
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
68
+ do_action( 'wpmtst_' . $_REQUEST['action'] );
69
+ }
70
+ }
71
+
72
+ add_action( 'admin_init', 'wpmtst_admin_init' );
73
+
74
+ /**
75
+ * Custom action link in admin notice.
76
+ *
77
+ * @since 2.29.0
78
+ */
79
+ function wpmtst_action_captcha_options_changed() {
80
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
81
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
82
+ exit;
83
+ }
84
+
85
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
86
+
87
+ /**
88
+ * Redirect to About page.
89
+ *
90
+ * @since 2.28.4
91
+ */
92
+ function wpmtst_activation_redirect() {
93
+ if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
94
+ delete_option( 'wpmtst_do_activation_redirect' );
95
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
96
+ exit;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Are we on a testimonial admin screen?
102
+ *
103
+ * Used by add-ons too!
104
+ *
105
+ * @return bool
106
+ */
107
+ function wpmtst_is_testimonial_screen() {
108
+ $screen = get_current_screen();
109
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
110
+ }
111
+
112
+ /**
113
+ * Add pending numbers to post types on admin menu.
114
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
115
+ *
116
+ * @param $menu
117
+ *
118
+ * @return mixed
119
+ */
120
+ function wpmtst_pending_indicator( $menu ) {
121
+ if ( ! current_user_can( 'edit_posts' ) )
122
+ return $menu;
123
+
124
+ $options = get_option( 'wpmtst_options' );
125
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
126
+ return $menu;
127
+
128
+ $types = array( 'wpm-testimonial' );
129
+ $status = 'pending';
130
+ foreach ( $types as $type ) {
131
+ $num_posts = wp_count_posts( $type, 'readable' );
132
+ $pending_count = 0;
133
+ if ( ! empty( $num_posts->$status ) )
134
+ $pending_count = $num_posts->$status;
135
+
136
+ if ( $type == 'post' )
137
+ $menu_str = 'edit.php';
138
+ else
139
+ $menu_str = 'edit.php?post_type=' . $type;
140
+
141
+ foreach ( $menu as $menu_key => $menu_data ) {
142
+ if ( $menu_str != $menu_data[2] )
143
+ continue;
144
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
145
+ }
146
+ }
147
+
148
+ return $menu;
149
+ }
150
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
151
+
152
+ /**
153
+ * The [restore default] icon.
154
+ *
155
+ * @param $for
156
+ *
157
+ * @since 2.18.0
158
+ */
159
+ function wpmtst_restore_default_icon( $for ) {
160
+ if ( !$for ) return;
161
+ ?>
162
+ <input type="button" class="button secondary restore-default"
163
+ title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
164
+ value="&#xf171"
165
+ data-for="<?php echo $for; ?>"/>
166
+ <?php
167
+ }
168
+
169
+
170
+
171
+ /**
172
+ * Check for configuration issues when options are updated.
173
+ *
174
+ * @since 2.24.0
175
+ * @param $option
176
+ * @param $old_value
177
+ * @param $value
178
+ */
179
+ function wpmtst_updated_option( $option, $old_value, $value ) {
180
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
181
+ do_action( 'wpmtst_check_config' );
182
+ }
183
+ }
184
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
185
+
186
+
187
+ /**
188
+ * Store configuration error.
189
+ *
190
+ * @since 2.24.0
191
+ * @param $key
192
+ */
193
+ function wpmtst_add_config_error( $key ) {
194
+ $errors = get_option( 'wpmtst_config_errors', array() );
195
+ $errors[] = $key;
196
+ update_option( 'wpmtst_config_errors', array_unique( $errors ) );
197
+
198
+ wpmtst_add_admin_notice( $key, true );
199
+ }
200
+
201
+
202
+ /**
203
+ * Delete configuration error.
204
+ *
205
+ * @since 2.24.0
206
+ * @param $key
207
+ */
208
+ function wpmtst_delete_config_error( $key ) {
209
+ $errors = get_option( 'wpmtst_config_errors', array() );
210
+ $errors = array_diff( $errors, array ( $key ) );
211
+ update_option( 'wpmtst_config_errors', $errors );
212
+
213
+ wpmtst_delete_admin_notice( $key );
214
+ }
215
+
216
+
217
+ /**
218
+ * Save a View.
219
+ *
220
+ * @param $view
221
+ * @param string $action
222
+ * @usedby Strong_Testimonials_Update:update_views
223
+ *
224
+ * @return bool|false|int
225
+ */
226
+ function wpmtst_save_view( $view, $action = 'edit' ) {
227
+ global $wpdb;
228
+
229
+ if ( ! $view ) return false;
230
+
231
+ $table_name = $wpdb->prefix . 'strong_views';
232
+ $serialized = serialize( $view['data'] );
233
+
234
+ if ( 'add' == $action || 'duplicate' == $action ) {
235
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
236
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
237
+ $wpdb->query( $sql );
238
+ $view['id'] = $wpdb->insert_id;
239
+ $return = $view['id'];
240
+ }
241
+ else {
242
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
243
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
244
+ $wpdb->query( $sql );
245
+ $return = $wpdb->last_error ? 0 : 1;
246
+ }
247
+
248
+ do_action( 'wpmtst_view_saved', $view );
249
+
250
+ return $return;
251
+ }
252
+
253
+
254
+ /**
255
+ * @param $field
256
+ *
257
+ * @return mixed
258
+ */
259
+ function wpmtst_get_field_label( $field ) {
260
+ if ( isset( $field['field'] ) ) {
261
+ $custom_fields = wpmtst_get_custom_fields();
262
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
263
+ return $custom_fields[ $field['field'] ]['label'];
264
+ }
265
+ $builtin_fields = wpmtst_get_builtin_fields();
266
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
267
+ return $builtin_fields[ $field['field'] ]['label'];
268
+ }
269
+ }
270
+
271
+ return '';
272
+ }
273
+
274
+
275
+ /**
276
+ * @param string $field_name
277
+ *
278
+ * @return mixed
279
+ */
280
+ function wpmtst_get_field_by_name( $field_name = '' ) {
281
+ if ( $field_name ) {
282
+ $custom_fields = wpmtst_get_custom_fields();
283
+ if ( isset( $custom_fields[ $field_name ] ) ) {
284
+ return $custom_fields[ $field_name ];
285
+ }
286
+ }
287
+
288
+ return '';
289
+ }
290
+
291
+ /**
292
+ * Returns true if at least one extension is installed
293
+ */
294
+ function wpmtst_extensions_installed() {
295
+
296
+ if ( defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) {
297
+ return true;
298
+ }
299
+ if ( defined( 'WPMTST_ASSIGNMENT_VERSION' ) ) {
300
+ return true;
301
+ }
302
+ if ( defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) {
303
+ return true;
304
+ }
305
+ if ( defined( 'WPMTST_PROPERTIES_VERSION' ) ) {
306
+ return true;
307
+ }
308
+ if ( defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) {
309
+ return true;
310
+ }
311
+ if ( defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) {
312
+ return true;
313
+ }
314
+ if ( defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) {
315
+ return true;
316
+ }
317
+
318
+ return false;
319
+ }
320
+
admin/class-strong-testimonials-addons.php CHANGED
@@ -1,132 +1,132 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Addons
4
- *
5
- * @since 2.38
6
- */
7
- class Strong_Testimonials_Addons {
8
-
9
- private $addons = array();
10
-
11
- public function __construct() {
12
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
-
14
- // Add ajax action to reload extensions
15
- add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
- }
17
-
18
- private function check_for_addons() {
19
-
20
- if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
- return $data;
22
- }
23
-
24
- $addons = array();
25
-
26
- $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
-
28
- // Get data from the remote URL.
29
- $response = wp_remote_get( $url );
30
-
31
- if ( ! is_wp_error( $response ) ) {
32
-
33
- // Decode the data that we got.
34
- $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
-
36
- if ( ! empty( $data ) && is_array( $data ) ) {
37
- $addons = $data;
38
- // Store the data for a week.
39
- set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
- }
41
- }
42
-
43
- return apply_filters( 'wpmtst_addons', $addons );
44
- }
45
-
46
- public function render_addons() {
47
-
48
- wp_enqueue_style( 'wpmtst-admin-style' );
49
- wp_enqueue_script( 'wpmtst-admin-script' );
50
-
51
- if ( ! empty( $this->addons ) ) {
52
- foreach ( $this->addons as $addon ) {
53
- $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
- echo '<div class="wpmtst-addon">';
55
- echo '<div class="wpmtst-addon-box">';
56
- echo '<img src="' . esc_attr( $image ) . '">';
57
- echo '<div class="wpmtst-addon-content">';
58
- echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
- echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
- echo '</div>';
61
- echo '</div>';
62
- echo '<div class="wpmtst-addon-actions">';
63
- echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade to PRO', 'strong-testimonials' ) . '</a>', $addon );
64
- echo '</div>';
65
- echo '</div>';
66
- }
67
- }
68
-
69
- }
70
-
71
- /**
72
- * Add submenu page.
73
- *
74
- * @param $pages
75
- *
76
- * @return mixed
77
- */
78
- public function add_submenu( $pages ) {
79
- $pages[91] = $this->get_submenu();
80
- return $pages;
81
- }
82
-
83
- /**
84
- * Return submenu page parameters.
85
- *
86
- * @return array
87
- */
88
- public function get_submenu() {
89
- return array(
90
- 'page_title' => __( 'Extensions', 'strong-testimonials' ),
91
- 'menu_title' => __( 'Extensions', 'strong-testimonials' ),
92
- 'capability' => 'strong_testimonials_options',
93
- 'menu_slug' => 'strong-testimonials-addons',
94
- 'function' => array( $this, 'addons_page' ),
95
- );
96
- }
97
-
98
-
99
- /**
100
- * Print the Addons page.
101
- */
102
- public function addons_page() {
103
-
104
- $this->addons = $this->check_for_addons();
105
- ?>
106
-
107
- <div class="wrap">
108
- <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
-
110
- <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
-
112
- <div class="wpmtst-addons-container">
113
- <?php $this->render_addons(); ?>
114
- </div>
115
- </div>
116
- <?php
117
- }
118
-
119
- public function reload_extensions() {
120
- // Run a security check first.
121
- check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
-
123
- delete_transient( 'strong_testimonials_all_extensions' );
124
-
125
- die;
126
- }
127
-
128
-
129
-
130
- }
131
-
132
- new Strong_Testimonials_Addons();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Addons
4
+ *
5
+ * @since 2.38
6
+ */
7
+ class Strong_Testimonials_Addons {
8
+
9
+ private $addons = array();
10
+
11
+ public function __construct() {
12
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
13
+
14
+ // Add ajax action to reload extensions
15
+ add_action( 'wp_ajax_wpmtst_reload_extensions', array( $this, 'reload_extensions' ), 20 );
16
+ }
17
+
18
+ private function check_for_addons() {
19
+
20
+ if ( false !== ( $data = get_transient( 'strong_testimonials_all_extensions' ) ) ) {
21
+ return $data;
22
+ }
23
+
24
+ $addons = array();
25
+
26
+ $url = apply_filters( 'strong_testimonials_addon_server_url', WPMTST_STORE_URL . '/wp-json/mt/v1/get-all-extensions' );
27
+
28
+ // Get data from the remote URL.
29
+ $response = wp_remote_get( $url );
30
+
31
+ if ( ! is_wp_error( $response ) ) {
32
+
33
+ // Decode the data that we got.
34
+ $data = json_decode( wp_remote_retrieve_body( $response ), true );
35
+
36
+ if ( ! empty( $data ) && is_array( $data ) ) {
37
+ $addons = $data;
38
+ // Store the data for a week.
39
+ set_transient( 'strong_testimonials_all_extensions', $data, 7 * DAY_IN_SECONDS );
40
+ }
41
+ }
42
+
43
+ return apply_filters( 'wpmtst_addons', $addons );
44
+ }
45
+
46
+ public function render_addons() {
47
+
48
+ wp_enqueue_style( 'wpmtst-admin-style' );
49
+ wp_enqueue_script( 'wpmtst-admin-script' );
50
+
51
+ if ( ! empty( $this->addons ) ) {
52
+ foreach ( $this->addons as $addon ) {
53
+ $image = ( '' != $addon['image'] ) ? $addon['image'] : WPMTST_ASSETS_IMG . '/logo.png';
54
+ echo '<div class="wpmtst-addon">';
55
+ echo '<div class="wpmtst-addon-box">';
56
+ echo '<img src="' . esc_attr( $image ) . '">';
57
+ echo '<div class="wpmtst-addon-content">';
58
+ echo '<h3>' . esc_html( $addon['name'] ) . '</h3>';
59
+ echo '<div class="wpmtst-addon-description">' . wp_kses_post( $addon['description'] ) . '</div>';
60
+ echo '</div>';
61
+ echo '</div>';
62
+ echo '<div class="wpmtst-addon-actions">';
63
+ echo apply_filters( 'wpmtst_addon_button_action', '<a href="' . esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=' . esc_attr( $addon['slug'] ) ) . '" target="_blank" class="button primary-button">' . esc_html__( 'Upgrade to PRO', 'strong-testimonials' ) . '</a>', $addon );
64
+ echo '</div>';
65
+ echo '</div>';
66
+ }
67
+ }
68
+
69
+ }
70
+
71
+ /**
72
+ * Add submenu page.
73
+ *
74
+ * @param $pages
75
+ *
76
+ * @return mixed
77
+ */
78
+ public function add_submenu( $pages ) {
79
+ $pages[91] = $this->get_submenu();
80
+ return $pages;
81
+ }
82
+
83
+ /**
84
+ * Return submenu page parameters.
85
+ *
86
+ * @return array
87
+ */
88
+ public function get_submenu() {
89
+ return array(
90
+ 'page_title' => __( 'Extensions', 'strong-testimonials' ),
91
+ 'menu_title' => __( 'Extensions', 'strong-testimonials' ),
92
+ 'capability' => 'strong_testimonials_options',
93
+ 'menu_slug' => 'strong-testimonials-addons',
94
+ 'function' => array( $this, 'addons_page' ),
95
+ );
96
+ }
97
+
98
+
99
+ /**
100
+ * Print the Addons page.
101
+ */
102
+ public function addons_page() {
103
+
104
+ $this->addons = $this->check_for_addons();
105
+ ?>
106
+
107
+ <div class="wrap">
108
+ <h1 style="margin-bottom: 20px; display: inline-block;"><?php esc_html_e( 'Extensions', 'strong-testimonials' ); ?></h1>
109
+
110
+ <a id="wpmtst-reload-extensions" class="button button-primary" style="margin: 10px 0 0 30px;" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-reload-extensions' ) ); ?>"><?php esc_html_e( 'Reload Extensions', 'strong-testimonials' ); ?></a>
111
+
112
+ <div class="wpmtst-addons-container">
113
+ <?php $this->render_addons(); ?>
114
+ </div>
115
+ </div>
116
+ <?php
117
+ }
118
+
119
+ public function reload_extensions() {
120
+ // Run a security check first.
121
+ check_admin_referer( 'wpmtst-reload-extensions', 'nonce' );
122
+
123
+ delete_transient( 'strong_testimonials_all_extensions' );
124
+
125
+ die;
126
+ }
127
+
128
+
129
+
130
+ }
131
+
132
+ new Strong_Testimonials_Addons();
admin/class-strong-testimonials-admin-category-list.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_Category_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_Category_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_list constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
- add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
- }
28
-
29
- /**
30
- * Add columns to the testimonials categories screen
31
- *
32
- * @param $columns
33
- *
34
- * @return array
35
- */
36
- public static function manage_categories( $columns ) {
37
- $new_columns = array(
38
- 'cb' => '<input type="checkbox">',
39
- 'ID' => __( 'ID', 'strong-testimonials' ),
40
- 'name' => __( 'Name', 'strong-testimonials' ),
41
- 'slug' => __( 'Slug', 'strong-testimonials' ),
42
- 'posts' => __( 'Posts', 'strong-testimonials' ),
43
- );
44
-
45
- return $new_columns;
46
- }
47
-
48
- /**
49
- * Show custom column
50
- *
51
- * @param $out
52
- * @param $column_name
53
- * @param $id
54
- *
55
- * @return string
56
- */
57
- public static function manage_columns( $out, $column_name, $id ) {
58
- if ( 'ID' == $column_name ) {
59
- $output = $id;
60
- } else {
61
- $output = '';
62
- }
63
-
64
- return $output;
65
- }
66
-
67
- }
68
-
69
- Strong_Testimonials_Admin_Category_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_Category_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_Category_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_list constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
+ add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
+ }
28
+
29
+ /**
30
+ * Add columns to the testimonials categories screen
31
+ *
32
+ * @param $columns
33
+ *
34
+ * @return array
35
+ */
36
+ public static function manage_categories( $columns ) {
37
+ $new_columns = array(
38
+ 'cb' => '<input type="checkbox">',
39
+ 'ID' => __( 'ID', 'strong-testimonials' ),
40
+ 'name' => __( 'Name', 'strong-testimonials' ),
41
+ 'slug' => __( 'Slug', 'strong-testimonials' ),
42
+ 'posts' => __( 'Posts', 'strong-testimonials' ),
43
+ );
44
+
45
+ return $new_columns;
46
+ }
47
+
48
+ /**
49
+ * Show custom column
50
+ *
51
+ * @param $out
52
+ * @param $column_name
53
+ * @param $id
54
+ *
55
+ * @return string
56
+ */
57
+ public static function manage_columns( $out, $column_name, $id ) {
58
+ if ( 'ID' == $column_name ) {
59
+ $output = $id;
60
+ } else {
61
+ $output = '';
62
+ }
63
+
64
+ return $output;
65
+ }
66
+
67
+ }
68
+
69
+ Strong_Testimonials_Admin_Category_List::init();
admin/class-strong-testimonials-admin-list.php CHANGED
@@ -1,331 +1,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' => __( 'Excerpt', 'strong-testimonials' ) );
97
-
98
- // 4. add custom fields
99
- foreach ( $fields as $key => $field ) {
100
-
101
- if ( $field['admin_table'] ) {
102
-
103
- if ( 'post_title' == $field['name'] ) {
104
- continue;
105
- } elseif ( 'featured_image' == $field['name'] ) {
106
- $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
- } elseif ( 'rating' == $field['input_type'] ) {
108
- $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
- } else {
110
- $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
- }
112
-
113
- }
114
-
115
- }
116
-
117
- // 5. add [category], [comments] and [date]
118
- // The slug "categories" slug is reserved by WordPress.
119
- if ( wpmtst_get_cat_count() ) {
120
- $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
121
- }
122
-
123
- if ( $comments ) {
124
- $fields_to_add['comments'] = $comments;
125
- }
126
-
127
- $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
128
-
129
- // Push other added columns like [search_exclude] to the end.
130
- $columns = array_merge(
131
- array_slice( $columns, 0, $offset ),
132
- $fields_to_add,
133
- array_slice( $columns, $offset, null )
134
- );
135
-
136
- return $columns;
137
- }
138
-
139
- /**
140
- * Show custom values
141
- *
142
- * @param $column
143
- */
144
- public static function custom_columns( $column ) {
145
- global $post;
146
-
147
- switch ( $column ) {
148
-
149
- case 'post_id' :
150
- echo $post->ID;
151
- break;
152
-
153
- case 'post_content' :
154
- echo substr( $post->post_content, 0, 100 ) . '&hellip;';
155
- break;
156
-
157
- case 'post_excerpt' :
158
- echo $post->post_excerpt;
159
- break;
160
-
161
- case 'strong_thumbnail' :
162
- echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
163
- break;
164
-
165
- case 'category' :
166
- $categories = get_the_terms( 0, 'wpm-testimonial-category' );
167
- if ( $categories && ! is_wp_error( $categories ) ) {
168
- $list = array();
169
- foreach ( $categories as $cat ) {
170
- $list[] = $cat->name;
171
- }
172
- echo join( ", ", $list );
173
- }
174
- break;
175
-
176
- case 'handle' :
177
- if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
178
- echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
179
- }
180
- break;
181
-
182
- default :
183
- // custom field?
184
- $custom = get_post_custom();
185
- $fields = wpmtst_get_custom_fields();
186
-
187
- if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
188
-
189
- if ( isset( $fields[ $column ] ) ) {
190
-
191
- switch ( $fields[ $column ]['input_type'] ) {
192
- case 'rating' :
193
- wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
194
- break;
195
- case 'checkbox' :
196
- echo $custom[ $column ][0] ? 'yes' : 'no';
197
- break;
198
- default :
199
- echo $custom[ $column ][0];
200
- }
201
-
202
- }
203
-
204
- } else {
205
-
206
- if ( isset( $fields[ $column ] ) ) {
207
-
208
- if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
209
- echo 'no';
210
- } else {
211
- // display nothing
212
- }
213
-
214
- }
215
- }
216
-
217
- }
218
- }
219
-
220
- /**
221
- * Add thumbnail column to admin list
222
- *
223
- * @param $columns
224
- *
225
- * @return array
226
- */
227
- public static function add_thumbnail_column( $columns ) {
228
- $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
229
-
230
- return $columns;
231
- }
232
-
233
- /**
234
- * Make columns sortable.
235
- *
236
- * @param $columns
237
- *
238
- * @since 1.12.0
239
- * @since 2.2.0 category
240
- *
241
- * @return mixed
242
- */
243
- public static function manage_sortable_columns( $columns ) {
244
- $columns['client_name'] = 'client_name';
245
- $columns['category'] = 'categories';
246
- $columns['date'] = 'date';
247
-
248
- return $columns;
249
- }
250
-
251
- /**
252
- * Add category filter to testimonial list table.
253
- *
254
- * @since 2.2.0
255
- */
256
- public static function add_taxonomy_filters() {
257
- global $typenow;
258
-
259
- if ( $typenow != 'wpm-testimonial' ) {
260
- return;
261
- }
262
-
263
- $taxonomies = array( 'wpm-testimonial-category' );
264
-
265
- foreach ( $taxonomies as $tax ) {
266
- $tax_obj = get_taxonomy( $tax );
267
- $args = array(
268
- 'show_option_all' => $tax_obj->labels->all_items,
269
- 'show_option_none' => '',
270
- 'option_none_value' => '-1',
271
- 'orderby' => 'NAME',
272
- 'order' => 'ASC',
273
- 'show_count' => 1,
274
- 'hide_empty' => 1,
275
- 'child_of' => 0,
276
- 'exclude' => '',
277
- 'echo' => 1,
278
- 'selected' => isset( $_GET[ $tax ] ) ? $_GET[ $tax ] : '',
279
- 'hierarchical' => 1,
280
- 'name' => $tax,
281
- 'id' => $tax,
282
- 'class' => 'postform',
283
- 'depth' => 0,
284
- 'tab_index' => 0,
285
- 'taxonomy' => $tax,
286
- 'hide_if_empty' => true,
287
- 'value_field' => 'slug',
288
- );
289
-
290
- wp_dropdown_categories( $args );
291
- }
292
- }
293
-
294
- /**
295
- * Sort columns.
296
- *
297
- * @since 1.12.0
298
- *
299
- * @param $query
300
- */
301
- public static function pre_get_posts( $query ) {
302
- // Only in main WP query AND if an orderby query variable is designated.
303
- if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
304
- if ( 'client_name' == $query->get( 'orderby' ) ) {
305
- $query->set( 'meta_key', 'client_name' );
306
- $query->set( 'orderby', 'meta_value' );
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * Check if we are viewing the Trash.
313
- *
314
- * @since 1.16.0
315
- */
316
- public static function is_viewing_trash() {
317
- return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
318
- }
319
-
320
- /**
321
- * Check if a column in admin list table is sorted.
322
- *
323
- * @since 1.16.0
324
- */
325
- public static function is_column_sorted() {
326
- return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
327
- }
328
-
329
- }
330
-
331
- Strong_Testimonials_Admin_List::init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_List constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
+ add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
+ add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
+ add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
+ add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
+ add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
+ add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
+ }
33
+
34
+ /**
35
+ * Add post ID to post row actions.
36
+ *
37
+ * @param $actions
38
+ * @param $post
39
+ * @since 2.32.2
40
+ *
41
+ * @return array
42
+ */
43
+ public static function post_row_actions( $actions, $post ) {
44
+ if ( 'wpm-testimonial' == $post->post_type ) {
45
+ $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
+ }
47
+
48
+ return $actions;
49
+ }
50
+
51
+ /**
52
+ * Add custom columns to the admin list.
53
+ *
54
+ * @param $columns
55
+ *
56
+ * @since 1.4.0
57
+ * @since 2.5.1 Added comments column.
58
+ *
59
+ * @return array
60
+ */
61
+ public static function edit_columns( $columns ) {
62
+ $fields = wpmtst_get_all_fields();
63
+
64
+ $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
+
66
+ /*
67
+ INCOMING COLUMNS = Array (
68
+ [cb] => <input type="checkbox" />
69
+ [title] => Title
70
+ [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
+ [date] => Date
72
+ [search_exclude] => Search Exclude // other plugin
73
+ [strong_thumbnail] => Thumbnail
74
+ )
75
+ */
76
+
77
+ // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
+ unset( $columns['strong_thumbnail'], $columns['date'] );
79
+
80
+ if ( $comments ) {
81
+ unset( $columns['comments'] );
82
+ }
83
+
84
+ // 2. insert [order] after [cb]
85
+ if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
+ $columns = array_merge(
87
+ array_slice( $columns, 0, 1 ),
88
+ array( 'handle' => 'Order' ),
89
+ array_slice( $columns, 1, null )
90
+ );
91
+ }
92
+
93
+ // 3. insert [excerpt] after [title]
94
+ $key = 'title';
95
+ $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
+ $fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
97
+
98
+ // 4. add custom fields
99
+ foreach ( $fields as $key => $field ) {
100
+
101
+ if ( $field['admin_table'] ) {
102
+
103
+ if ( 'post_title' == $field['name'] ) {
104
+ continue;
105
+ } elseif ( 'featured_image' == $field['name'] ) {
106
+ $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
+ } elseif ( 'rating' == $field['input_type'] ) {
108
+ $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
+ } else {
110
+ $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
+ }
112
+
113
+ }
114
+
115
+ }
116
+
117
+ // 5. add [category], [comments] and [date]
118
+ // The slug "categories" slug is reserved by WordPress.
119
+ if ( wpmtst_get_cat_count() ) {
120
+ $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
121
+ }
122
+
123
+ if ( $comments ) {
124
+ $fields_to_add['comments'] = $comments;
125
+ }
126
+
127
+ $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
128
+
129
+ $options = get_option( 'wpmtst_options' );
130
+ if ( isset( $options['include_platform'] ) && $options['include_platform'] === true ) {
131
+ $fields_to_add['platform'] = __( '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 $post->ID;
156
+ break;
157
+
158
+ case 'post_content' :
159
+ echo substr( $post->post_content, 0, 100 ) . '&hellip;';
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 join( ", ", $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'] = __( '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 ] ) ? $_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,406 +1,407 @@
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_style( 'wpmtst-font-awesome',
49
- WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
50
- array(),
51
- '4.6.3' );
52
-
53
- wp_register_script( 'wpmtst-help',
54
- WPMTST_ADMIN_URL . 'js/help.js',
55
- array( 'jquery' ),
56
- $plugin_version,
57
- true );
58
-
59
-
60
- wp_register_script(
61
- 'wpmtst-admin-script',
62
- WPMTST_ASSETS_JS . 'admin-js.js',
63
- array( 'jquery', 'underscore' ),
64
- $plugin_version,
65
- true );
66
-
67
- wp_register_style(
68
- 'wpmtst-admin-global-style',
69
- WPMTST_ASSETS_CSS . 'admin-global.css',
70
- array(),
71
- $plugin_version );
72
-
73
- wp_register_style(
74
- 'wpmtst-admin-style',
75
- WPMTST_ASSETS_CSS . 'admin.css',
76
- array( 'wpmtst-font-awesome' ),
77
- $plugin_version );
78
-
79
- wp_register_style( 'wpmtst-post-editor',
80
- WPMTST_ADMIN_URL . 'css/post-editor.css',
81
- array( 'wpmtst-font-awesome' ),
82
- $plugin_version );
83
-
84
- wp_register_script( 'wpmtst-custom-spinner',
85
- WPMTST_ADMIN_URL . 'js/custom-spinner.js',
86
- array( 'jquery' ),
87
- $plugin_version,
88
- true );
89
-
90
- wp_register_script( 'autosize',
91
- WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
92
- array(),
93
- '4.0.1',
94
- true );
95
-
96
- /**
97
- * Form tab
98
- */
99
- wp_register_style( 'wpmtst-admin-form-style',
100
- WPMTST_ADMIN_URL . 'css/admin-form.css',
101
- array( 'wpmtst-admin-style' ),
102
- $plugin_version );
103
-
104
- wp_register_script( 'wpmtst-admin-form-script',
105
- WPMTST_ADMIN_URL . 'js/admin-form.js',
106
- array( 'wpmtst-admin-script', 'autosize' ),
107
- $plugin_version,
108
- true );
109
-
110
- /**
111
- * Compatibility tab
112
- */
113
- wp_register_style( 'wpmtst-admin-compat-style',
114
- WPMTST_ADMIN_URL . 'css/admin-compat.css',
115
- array(),
116
- $plugin_version );
117
-
118
- wp_register_script( 'wpmtst-admin-compat-script',
119
- WPMTST_ADMIN_URL . 'js/admin-compat.js',
120
- array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
121
- $plugin_version,
122
- true );
123
-
124
- /**
125
- * Fields
126
- */
127
- wp_register_style( 'wpmtst-admin-fields-style',
128
- WPMTST_ADMIN_URL . 'css/fields.css',
129
- array(),
130
- $plugin_version );
131
-
132
- wp_register_style( 'wpmtst-admin-form-preview',
133
- WPMTST_ADMIN_URL . 'css/form-preview.css',
134
- array(),
135
- $plugin_version );
136
-
137
- wp_register_script( 'wpmtst-admin-fields-script',
138
- WPMTST_ADMIN_URL . 'js/admin-fields.js',
139
- array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
140
- $plugin_version,
141
- true );
142
-
143
- $params = array(
144
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
145
- 'newField' => _x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
146
- 'inUse' => _x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
147
- 'noneFound' => _x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
148
- );
149
- wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
150
-
151
- /**
152
- * Ratings
153
- */
154
- wp_register_style( 'wpmtst-rating-display',
155
- WPMTST_PUBLIC_URL . 'css/rating-display.css',
156
- array( 'wpmtst-font-awesome' ),
157
- $plugin_version );
158
-
159
- wp_register_style( 'wpmtst-rating-form',
160
- WPMTST_PUBLIC_URL . 'css/rating-form.css',
161
- array( 'wpmtst-font-awesome' ),
162
- $plugin_version );
163
-
164
- wp_register_script( 'wpmtst-rating-script',
165
- WPMTST_ADMIN_URL . 'js/rating-edit.js',
166
- array( 'jquery' ),
167
- $plugin_version,
168
- true );
169
-
170
- /**
171
- * Views
172
- */
173
- wp_register_style( 'wpmtst-admin-views-style',
174
- WPMTST_ADMIN_URL . 'css/views.css',
175
- array(),
176
- $plugin_version );
177
-
178
- wp_register_script( 'wpmtst-admin-views-script',
179
- WPMTST_ADMIN_URL . 'js/views.js',
180
- array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
181
- $plugin_version,
182
- true );
183
-
184
- /**
185
- * Category filter in View editor.
186
- *
187
- * JavaScript adapted under GPL-2.0+ license
188
- * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
189
- *
190
- * @since 2.2.0
191
- */
192
- wp_register_script( 'wpmtst-view-category-filter-script',
193
- WPMTST_ADMIN_URL . 'js/view-category-filter.js',
194
- array( 'jquery' ),
195
- $plugin_version,
196
- true );
197
-
198
- wp_register_style( 'wpmtst-about-style',
199
- WPMTST_ADMIN_URL . 'css/about.css',
200
- array(),
201
- $plugin_version );
202
-
203
- /**
204
- * Add-on licenses
205
- *
206
- * @since 2.18
207
- */
208
- wp_register_script( 'wpmtst-addons-script',
209
- WPMTST_ADMIN_URL . 'js/addon-licenses.js',
210
- array( 'jquery' ),
211
- $plugin_version,
212
- true );
213
-
214
- $params = array(
215
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
216
- 'requiredField' => __( 'This field is required.', 'strong-testimonials' ),
217
- 'errorMessage' => __( 'An error occurred, please try again.', 'strong-testimonials' ),
218
- 'restoreDefault' => __( 'Restore the default settings?', 'strong-testimonials' ),
219
- );
220
- wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
221
-
222
- /**
223
- * Are You Sure? for dirty forms
224
- *
225
- * @since 2.18
226
- */
227
- wp_register_script( 'wpmtst-ays-script',
228
- WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
229
- array( 'jquery' ),
230
- $plugin_version,
231
- true );
232
- }
233
-
234
- /**
235
- * Enqueue global admin scripts.
236
- */
237
- public static function admin_enqueue_scripts() {
238
- $plugin_version = get_option( 'wpmtst_plugin_version' );
239
-
240
- wp_enqueue_style( 'wpmtst-admin-global-style' );
241
-
242
- wp_enqueue_script( 'wpmtst-admin-global',
243
- WPMTST_ADMIN_URL . 'js/admin-global.js',
244
- array( 'jquery' ),
245
- $plugin_version,
246
- true );
247
-
248
- wp_localize_script(
249
- 'wpmtst-admin-global',
250
- 'wpmtst_admin',
251
- array(
252
- 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
253
- 'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
254
- )
255
- );
256
- }
257
-
258
- /**
259
- * Enqueue specific styles and scripts.
260
- *
261
- * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
262
- *
263
- * @since 2.12.0
264
- */
265
-
266
- /**
267
- * Views
268
- */
269
- public static function admin_views() {
270
- wp_enqueue_style( 'wpmtst-admin-style' );
271
- wp_enqueue_script( 'wpmtst-admin-script' );
272
-
273
- wp_enqueue_style( 'wpmtst-admin-views-style' );
274
- wp_enqueue_script( 'wpmtst-admin-views-script' );
275
- wp_enqueue_script( 'wpmtst-view-category-filter-script' );
276
-
277
- wp_enqueue_style( 'wp-color-picker' );
278
- }
279
-
280
- /**
281
- * Fields
282
- */
283
- public static function admin_fields() {
284
- wp_enqueue_style( 'wpmtst-admin-style' );
285
- wp_enqueue_script( 'wpmtst-admin-script' );
286
-
287
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
288
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
289
-
290
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
291
- wp_enqueue_style( 'wpmtst-rating-form' );
292
- }
293
-
294
- /**
295
- * Settings
296
- */
297
- public static function admin_settings() {
298
- $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
299
-
300
- switch ( $tab ) {
301
- case 'form':
302
- wp_enqueue_style( 'wpmtst-admin-form-style' );
303
- wp_enqueue_script( 'wpmtst-admin-form-script' );
304
- break;
305
- case 'compat':
306
- wp_enqueue_style( 'wpmtst-admin-compat-style' );
307
- wp_enqueue_script( 'wpmtst-admin-compat-script' );
308
- break;
309
- case 'licenses':
310
- wp_enqueue_style( 'wpmtst-admin-style' );
311
- wp_enqueue_script( 'wpmtst-addons-script' );
312
- break;
313
- default:
314
- wp_enqueue_style( 'wpmtst-admin-style' );
315
- wp_enqueue_script( 'wpmtst-admin-script' );
316
- }
317
- }
318
-
319
- /**
320
- * About
321
- */
322
- public static function admin_about() {
323
- wp_enqueue_style( 'wpmtst-admin-style' );
324
- wp_enqueue_script( 'wpmtst-admin-script' );
325
- wp_enqueue_style( 'wpmtst-about-style' );
326
- }
327
-
328
- /**
329
- * Shortcodes
330
- *
331
- * @since 2.31.0
332
- */
333
- public static function admin_shortcodes() {
334
- wp_enqueue_style( 'wpmtst-admin-style' );
335
- wp_enqueue_style( 'wpmtst-rating-display' );
336
- }
337
-
338
- /**
339
- * List table
340
- */
341
- public static function admin_load_edit() {
342
- if ( wpmtst_is_testimonial_screen() ) {
343
- wp_enqueue_style( 'wpmtst-admin-style' );
344
- wp_enqueue_script( 'wpmtst-admin-script' );
345
- wp_enqueue_style( 'wpmtst-rating-display' );
346
- }
347
- }
348
-
349
- /**
350
- * Categories
351
- */
352
- public static function admin_load_edit_tags() {
353
- if ( wpmtst_is_testimonial_screen() ) {
354
- wp_enqueue_style( 'wpmtst-admin-style' );
355
- }
356
- }
357
-
358
- /**
359
- * Edit post
360
- */
361
- public static function admin_load_post() {
362
- if ( wpmtst_is_testimonial_screen() ) {
363
- wp_enqueue_style( 'wpmtst-post-editor' );
364
- wp_enqueue_script( 'wpmtst-admin-script' );
365
-
366
- wp_enqueue_style( 'wpmtst-rating-display' );
367
- wp_enqueue_style( 'wpmtst-rating-form' );
368
- wp_enqueue_script( 'wpmtst-rating-script' );
369
- }
370
- }
371
-
372
- /**
373
- * Known theme and plugin conflicts.
374
- *
375
- * @param $hook
376
- */
377
- public static function admin_dequeue_scripts( $hook ) {
378
- if ( wp_style_is( 'CPTStyleSheets' ) ) {
379
- wp_dequeue_style( 'CPTStyleSheets' );
380
- }
381
-
382
- $hooks_to_script = array(
383
- 'wpm-testimonial_page_testimonial-views',
384
- 'wpm-testimonial_page_testimonial-fields',
385
- 'wpm-testimonial_page_testimonial-settings',
386
- 'wpm-testimonial_page_about-strong-testimonials',
387
- );
388
-
389
- if ( wpmtst_is_testimonial_screen() ) {
390
- $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
391
- }
392
-
393
- /**
394
- * Block RT Themes and their overzealous JavaScript on our admin pages.
395
- * @since 2.2.12.1
396
- */
397
- if ( in_array( $hook, $hooks_to_script ) ) {
398
- if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
399
- wp_dequeue_script( 'admin-scripts' );
400
- }
401
- }
402
- }
403
-
404
- }
405
-
406
- Strong_Testimonials_Admin_Scripts::init();
 
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_style( 'wpmtst-font-awesome',
49
+ WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
50
+ array(),
51
+ '4.6.3' );
52
+
53
+ wp_register_script( 'wpmtst-help',
54
+ WPMTST_ADMIN_URL . 'js/help.js',
55
+ array( 'jquery' ),
56
+ $plugin_version,
57
+ true );
58
+
59
+
60
+ wp_register_script(
61
+ 'wpmtst-admin-script',
62
+ WPMTST_ASSETS_JS . 'admin-js.js',
63
+ array( 'jquery', 'underscore' ),
64
+ $plugin_version,
65
+ true );
66
+
67
+ wp_register_style(
68
+ 'wpmtst-admin-global-style',
69
+ WPMTST_ASSETS_CSS . 'admin-global.css',
70
+ array(),
71
+ $plugin_version );
72
+
73
+ wp_register_style(
74
+ 'wpmtst-admin-style',
75
+ WPMTST_ASSETS_CSS . 'admin.css',
76
+ array( 'wpmtst-font-awesome' ),
77
+ $plugin_version );
78
+
79
+ wp_register_style( 'wpmtst-post-editor',
80
+ WPMTST_ADMIN_URL . 'css/post-editor.css',
81
+ array( 'wpmtst-font-awesome' ),
82
+ $plugin_version );
83
+
84
+ wp_register_script( 'wpmtst-custom-spinner',
85
+ WPMTST_ADMIN_URL . 'js/custom-spinner.js',
86
+ array( 'jquery' ),
87
+ $plugin_version,
88
+ true );
89
+
90
+ wp_register_script( 'autosize',
91
+ WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
92
+ array(),
93
+ '4.0.1',
94
+ true );
95
+
96
+ /**
97
+ * Form tab
98
+ */
99
+ wp_register_style( 'wpmtst-admin-form-style',
100
+ WPMTST_ADMIN_URL . 'css/admin-form.css',
101
+ array( 'wpmtst-admin-style' ),
102
+ $plugin_version );
103
+
104
+ wp_register_script( 'wpmtst-admin-form-script',
105
+ WPMTST_ADMIN_URL . 'js/admin-form.js',
106
+ array( 'wpmtst-admin-script', 'autosize' ),
107
+ $plugin_version,
108
+ true );
109
+
110
+ /**
111
+ * Compatibility tab
112
+ */
113
+ wp_register_style( 'wpmtst-admin-compat-style',
114
+ WPMTST_ADMIN_URL . 'css/admin-compat.css',
115
+ array(),
116
+ $plugin_version );
117
+
118
+ wp_register_script( 'wpmtst-admin-compat-script',
119
+ WPMTST_ADMIN_URL . 'js/admin-compat.js',
120
+ array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
121
+ $plugin_version,
122
+ true );
123
+
124
+ /**
125
+ * Fields
126
+ */
127
+ wp_register_style( 'wpmtst-admin-fields-style',
128
+ WPMTST_ADMIN_URL . 'css/fields.css',
129
+ array(),
130
+ $plugin_version );
131
+
132
+ wp_register_style( 'wpmtst-admin-form-preview',
133
+ WPMTST_ADMIN_URL . 'css/form-preview.css',
134
+ array(),
135
+ $plugin_version );
136
+
137
+ wp_register_script( 'wpmtst-admin-fields-script',
138
+ WPMTST_ADMIN_URL . 'js/admin-fields.js',
139
+ array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
140
+ $plugin_version,
141
+ true );
142
+
143
+ $params = array(
144
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
145
+ 'newField' => _x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
146
+ 'inUse' => _x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
147
+ 'noneFound' => _x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
148
+ );
149
+ wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
150
+
151
+ /**
152
+ * Ratings
153
+ */
154
+ wp_register_style( 'wpmtst-rating-display',
155
+ WPMTST_PUBLIC_URL . 'css/rating-display.css',
156
+ array( 'wpmtst-font-awesome' ),
157
+ $plugin_version );
158
+
159
+ wp_register_style( 'wpmtst-rating-form',
160
+ WPMTST_PUBLIC_URL . 'css/rating-form.css',
161
+ array( 'wpmtst-font-awesome' ),
162
+ $plugin_version );
163
+
164
+ wp_register_script( 'wpmtst-rating-script',
165
+ WPMTST_ADMIN_URL . 'js/rating-edit.js',
166
+ array( 'jquery' ),
167
+ $plugin_version,
168
+ true );
169
+
170
+ /**
171
+ * Views
172
+ */
173
+ wp_register_style( 'wpmtst-admin-views-style',
174
+ WPMTST_ADMIN_URL . 'css/views.css',
175
+ array(),
176
+ $plugin_version );
177
+
178
+ wp_register_script( 'wpmtst-admin-views-script',
179
+ WPMTST_ADMIN_URL . 'js/views.js',
180
+ array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
181
+ $plugin_version,
182
+ true );
183
+
184
+ /**
185
+ * Category filter in View editor.
186
+ *
187
+ * JavaScript adapted under GPL-2.0+ license
188
+ * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
189
+ *
190
+ * @since 2.2.0
191
+ */
192
+ wp_register_script( 'wpmtst-view-category-filter-script',
193
+ WPMTST_ADMIN_URL . 'js/view-category-filter.js',
194
+ array( 'jquery' ),
195
+ $plugin_version,
196
+ true );
197
+
198
+ wp_register_style( 'wpmtst-about-style',
199
+ WPMTST_ADMIN_URL . 'css/about.css',
200
+ array(),
201
+ $plugin_version );
202
+
203
+ /**
204
+ * Add-on licenses
205
+ *
206
+ * @since 2.18
207
+ */
208
+ wp_register_script( 'wpmtst-addons-script',
209
+ WPMTST_ADMIN_URL . 'js/addon-licenses.js',
210
+ array( 'jquery' ),
211
+ $plugin_version,
212
+ true );
213
+
214
+ $params = array(
215
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
216
+ 'requiredField' => __( 'This field is required.', 'strong-testimonials' ),
217
+ 'errorMessage' => __( 'An error occurred, please try again.', 'strong-testimonials' ),
218
+ 'restoreDefault' => __( 'Restore the default settings?', 'strong-testimonials' ),
219
+ );
220
+ wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
221
+
222
+ /**
223
+ * Are You Sure? for dirty forms
224
+ *
225
+ * @since 2.18
226
+ */
227
+ wp_register_script( 'wpmtst-ays-script',
228
+ WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
229
+ array( 'jquery' ),
230
+ $plugin_version,
231
+ true );
232
+ }
233
+
234
+ /**
235
+ * Enqueue global admin scripts.
236
+ */
237
+ public static function admin_enqueue_scripts() {
238
+ $plugin_version = get_option( 'wpmtst_plugin_version' );
239
+
240
+ wp_enqueue_style( 'wpmtst-admin-global-style' );
241
+
242
+ wp_enqueue_script( 'wpmtst-admin-global',
243
+ WPMTST_ADMIN_URL . 'js/admin-global.js',
244
+ array( 'jquery' ),
245
+ $plugin_version,
246
+ true );
247
+
248
+ wp_localize_script(
249
+ 'wpmtst-admin-global',
250
+ 'wpmtst_admin',
251
+ array(
252
+ 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
253
+ 'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
254
+ )
255
+ );
256
+ }
257
+
258
+ /**
259
+ * Enqueue specific styles and scripts.
260
+ *
261
+ * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
262
+ *
263
+ * @since 2.12.0
264
+ */
265
+
266
+ /**
267
+ * Views
268
+ */
269
+ public static function admin_views() {
270
+ wp_enqueue_style( 'wpmtst-admin-style' );
271
+ wp_enqueue_script( 'wpmtst-admin-script' );
272
+
273
+ wp_enqueue_style( 'wpmtst-admin-views-style' );
274
+ wp_enqueue_script( 'wpmtst-admin-views-script' );
275
+ wp_enqueue_script( 'wpmtst-view-category-filter-script' );
276
+
277
+ wp_enqueue_style( 'wp-color-picker' );
278
+ }
279
+
280
+ /**
281
+ * Fields
282
+ */
283
+ public static function admin_fields() {
284
+ wp_enqueue_style( 'wpmtst-admin-style' );
285
+ wp_enqueue_script( 'wpmtst-admin-script' );
286
+
287
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
288
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
289
+
290
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
291
+ wp_enqueue_style( 'wpmtst-rating-form' );
292
+ }
293
+
294
+ /**
295
+ * Settings
296
+ */
297
+ public static function admin_settings() {
298
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
299
+
300
+ switch ( $tab ) {
301
+ case 'form':
302
+ wp_enqueue_style( 'wpmtst-admin-form-style' );
303
+ wp_enqueue_script( 'wpmtst-admin-form-script' );
304
+ break;
305
+ case 'compat':
306
+ wp_enqueue_style( 'wpmtst-admin-compat-style' );
307
+ wp_enqueue_script( 'wpmtst-admin-compat-script' );
308
+ break;
309
+ case 'licenses':
310
+ wp_enqueue_style( 'wpmtst-admin-style' );
311
+ wp_enqueue_script( 'wpmtst-addons-script' );
312
+ break;
313
+ default:
314
+ wp_enqueue_style( 'wpmtst-admin-style' );
315
+ wp_enqueue_script( 'wpmtst-admin-script' );
316
+ }
317
+ }
318
+
319
+ /**
320
+ * About
321
+ */
322
+ public static function admin_about() {
323
+ wp_enqueue_style( 'wpmtst-admin-style' );
324
+ wp_enqueue_script( 'wpmtst-admin-script' );
325
+ wp_enqueue_style( 'wpmtst-about-style' );
326
+ }
327
+
328
+ /**
329
+ * Shortcodes
330
+ *
331
+ * @since 2.31.0
332
+ */
333
+ public static function admin_shortcodes() {
334
+ wp_enqueue_style( 'wpmtst-admin-style' );
335
+ wp_enqueue_style( 'wpmtst-rating-display' );
336
+ }
337
+
338
+ /**
339
+ * List table
340
+ */
341
+ public static function admin_load_edit() {
342
+ if ( wpmtst_is_testimonial_screen() ) {
343
+ wp_enqueue_style( 'wpmtst-admin-style' );
344
+ wp_enqueue_script( 'wpmtst-admin-script' );
345
+ wp_enqueue_style( 'wpmtst-rating-display' );
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Categories
351
+ */
352
+ public static function admin_load_edit_tags() {
353
+ if ( wpmtst_is_testimonial_screen() ) {
354
+ wp_enqueue_style( 'wpmtst-admin-style' );
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Edit post
360
+ */
361
+ public static function admin_load_post() {
362
+ if ( wpmtst_is_testimonial_screen() ) {
363
+ wp_enqueue_style( 'wpmtst-admin-style' );
364
+ wp_enqueue_style( 'wpmtst-post-editor' );
365
+ wp_enqueue_script( 'wpmtst-admin-script' );
366
+
367
+ wp_enqueue_style( 'wpmtst-rating-display' );
368
+ wp_enqueue_style( 'wpmtst-rating-form' );
369
+ wp_enqueue_script( 'wpmtst-rating-script' );
370
+ }
371
+ }
372
+
373
+ /**
374
+ * Known theme and plugin conflicts.
375
+ *
376
+ * @param $hook
377
+ */
378
+ public static function admin_dequeue_scripts( $hook ) {
379
+ if ( wp_style_is( 'CPTStyleSheets' ) ) {
380
+ wp_dequeue_style( 'CPTStyleSheets' );
381
+ }
382
+
383
+ $hooks_to_script = array(
384
+ 'wpm-testimonial_page_testimonial-views',
385
+ 'wpm-testimonial_page_testimonial-fields',
386
+ 'wpm-testimonial_page_testimonial-settings',
387
+ 'wpm-testimonial_page_about-strong-testimonials',
388
+ );
389
+
390
+ if ( wpmtst_is_testimonial_screen() ) {
391
+ $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
392
+ }
393
+
394
+ /**
395
+ * Block RT Themes and their overzealous JavaScript on our admin pages.
396
+ * @since 2.2.12.1
397
+ */
398
+ if ( in_array( $hook, $hooks_to_script ) ) {
399
+ if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
400
+ wp_dequeue_script( 'admin-scripts' );
401
+ }
402
+ }
403
+ }
404
+
405
+ }
406
+
407
+ Strong_Testimonials_Admin_Scripts::init();
admin/class-strong-testimonials-defaults.php CHANGED
@@ -1,830 +1,830 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Defaults
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Defaults {
9
-
10
- /**
11
- * Strong_Testimonials_Defaults constructor.
12
- */
13
- public function __construct() { }
14
-
15
- /**
16
- * Settings
17
- *
18
- * @since 1.13.0 reorder
19
- * @since 2.2.11 scrolltop
20
- * @since 2.3.0 remove whitespace
21
- * @since 2.6.0 embed width
22
- * @since 2.6.2 slideshow z-index
23
- * @since 2.10.0 pending indicator
24
- * @since 2.21.0 load Font Awesome
25
- * @since 2.22.5 nofollow
26
- * @since 2.27.0 no_lazyload
27
- *
28
- * @return array
29
- */
30
- public static function get_options() {
31
- $default_options = array(
32
- 'embed_width' => '',
33
- 'load_font_awesome' => true,
34
- 'nofollow' => false,
35
- 'pending_indicator' => true,
36
- 'remove_whitespace' => true,
37
- 'reorder' => false,
38
- 'support_comments' => false,
39
- 'support_custom_fields' => false,
40
- 'single_testimonial_slug' => 'testimonial',
41
- 'scrolltop' => true,
42
- 'scrolltop_offset' => 80,
43
- 'no_lazyload' => true,
44
- 'touch_enabled' => true,
45
- );
46
-
47
- return $default_options;
48
- }
49
-
50
- /**
51
- * Custom field base.
52
- *
53
- * @since 2.28.0 Use 'action' to register a callback.
54
- *
55
- * @return array
56
- */
57
- public static function get_field_base() {
58
- return apply_filters( 'wpmtst_field_base', array(
59
- 'name' => '',
60
- 'name_mutable' => 1,
61
- 'label' => '',
62
- 'show_label' => 1,
63
- 'input_type' => '',
64
- 'action_input' => '',
65
- 'action_output' => '',
66
- 'text' => '',
67
- 'show_text_option' => 0,
68
- 'required' => 0,
69
- 'show_required_option' => 1,
70
- 'default_form_value' => '',
71
- 'default_display_value' => '',
72
- 'show_default_options' => 1,
73
- 'error' => __( 'This field is required.', 'strong-testimonials' ),
74
- 'placeholder' => '',
75
- 'show_placeholder_option' => 1,
76
- 'before' => '',
77
- 'after' => '',
78
- 'admin_table' => 0,
79
- 'admin_table_option' => 1,
80
- 'show_admin_table_option' => 1,
81
- 'shortcode_on_form' => '',
82
- 'shortcode_on_display' => '',
83
- 'show_shortcode_options' => 0,
84
- ) );
85
- }
86
-
87
- /**
88
- * Custom fields.
89
- *
90
- * @return array
91
- */
92
- public static function get_fields() {
93
- $field_base = self::get_field_base();
94
- $field_types = array();
95
-
96
- /*
97
- * Assemble post field types
98
- */
99
- $field_types['post'] = array(
100
- 'post_title' => array(
101
- 'input_type' => 'text',
102
- 'option_label' => __( 'Testimonial Title', 'strong-testimonials' ),
103
- 'map' => 'post_title',
104
- 'show_default_options' => 0,
105
- 'admin_table' => 1,
106
- 'admin_table_option' => 0,
107
- 'show_admin_table_option' => 0,
108
- 'name_mutable' => 0,
109
- ),
110
- 'post_content' => array(
111
- 'input_type' => 'textarea',
112
- 'option_label' => __( 'Testimonial Content', 'strong-testimonials' ),
113
- 'map' => 'post_content',
114
- 'required' => 1,
115
- 'show_default_options' => 0,
116
- 'core' => 0,
117
- 'admin_table' => 0,
118
- 'show_admin_table_option' => 0,
119
- 'name_mutable' => 0,
120
- ),
121
- 'featured_image' => array(
122
- 'input_type' => 'file',
123
- 'option_label' => __( 'Featured Image', 'strong-testimonials' ),
124
- 'map' => 'featured_image',
125
- 'show_default_options' => 0,
126
- 'show_placeholder_option' => 0,
127
- 'admin_table' => 0,
128
- 'name_mutable' => 0,
129
- ),
130
- );
131
- foreach ( $field_types['post'] as $key => $array ) {
132
- $field_types['post'][ $key ] = array_merge( $field_base, $array );
133
- }
134
-
135
- /*
136
- * Assemble custom field types
137
- */
138
- $field_types['custom'] = array(
139
- 'text' => array(
140
- 'input_type' => 'text',
141
- 'option_label' => __( 'text', 'strong-testimonials' ),
142
- ),
143
- 'email' => array(
144
- 'input_type' => 'email',
145
- 'option_label' => __( 'email', 'strong-testimonials' ),
146
- 'show_default_options' => 0,
147
- ),
148
- 'url' => array(
149
- 'input_type' => 'url',
150
- 'option_label' => __( 'URL', 'strong-testimonials' ),
151
- 'show_default_options' => 0,
152
- ),
153
- 'checkbox' => array(
154
- 'input_type' => 'checkbox',
155
- 'option_label' => __( 'checkbox', 'strong-testimonials' ),
156
- 'show_text_option' => 1,
157
- 'show_placeholder_option' => 0,
158
- ),
159
- );
160
- foreach ( $field_types['custom'] as $key => $array ) {
161
- $field_types['custom'][ $key ] = array_merge( $field_base, $array );
162
- }
163
-
164
- /*
165
- * Assemble special field types (FKA Optional)
166
- *
167
- * @since 1.18
168
- * @since 2.2.2 Fix bug caused by localizing 'categories'
169
- */
170
- $field_types['optional'] = array(
171
- 'category-selector' => array(
172
- 'input_type' => 'category-selector',
173
- 'option_label' => __( 'category selector', 'strong-testimonials' ),
174
- 'show_default_options' => 0,
175
- 'show_placeholder_option' => 0,
176
- 'show_admin_table_option' => 0,
177
- 'name_mutable' => 0,
178
- ),
179
- 'category-checklist' => array(
180
- 'input_type' => 'category-checklist',
181
- 'option_label' => __( 'category checklist', 'strong-testimonials' ),
182
- 'show_default_options' => 0,
183
- 'show_placeholder_option' => 0,
184
- 'show_admin_table_option' => 0,
185
- 'name_mutable' => 0,
186
- ),
187
- 'shortcode' => array(
188
- 'input_type' => 'shortcode',
189
- 'option_label' => __( 'shortcode', 'strong-testimonials' ),
190
- 'show_label' => 0,
191
- 'required' => 0,
192
- 'show_required_option' => 0,
193
- 'show_default_options' => 0,
194
- 'show_placeholder_option' => 0,
195
- 'show_admin_table_option' => 0,
196
- 'show_shortcode_options' => 1,
197
- ),
198
- 'rating' => array(
199
- 'input_type' => 'rating',
200
- 'option_label' => __( 'star rating', 'strong-testimonials' ),
201
- 'show_placeholder_option' => 0,
202
- 'admin_table' => 1,
203
- 'admin_table_option' => 1,
204
- 'show_admin_table_option' => 1,
205
- ),
206
- );
207
-
208
- /*
209
- * Merge each one onto base field
210
- */
211
- foreach ( $field_types['optional'] as $key => $array ) {
212
- $field_types['optional'][ $key ] = array_merge( $field_base, $array );
213
- }
214
-
215
- /*
216
- * Assemble all fields
217
- */
218
- $default_fields = array(
219
- 'field_base' => $field_base,
220
- 'field_types' => $field_types,
221
- );
222
-
223
- return apply_filters( 'wpmtst_default_fields', $default_fields );
224
- }
225
-
226
- /**
227
- * Default forms.
228
- *
229
- * @return array
230
- */
231
- public static function get_base_forms() {
232
- $default_fields = self::get_fields();
233
-
234
- // Assemble field groups.
235
- $forms = array(
236
- 'default' => array(
237
- 'name' => 'default',
238
- 'label' => __( 'Default Form', 'strong-testimonials' ),
239
- 'readonly' => 1,
240
- 'fields' => array(
241
- // ------
242
- // CUSTOM
243
- // ------
244
- 0 => array(
245
- 'record_type' => 'custom',
246
- 'name' => 'client_name',
247
- 'label' => __( 'Full Name', 'strong-testimonials' ),
248
- 'input_type' => 'text',
249
- 'required' => 1,
250
- 'after' => __( 'What is your full name?', 'strong-testimonials' ),
251
- 'admin_table' => 1,
252
- ),
253
- 1 => array(
254
- 'record_type' => 'custom',
255
- 'name' => 'email',
256
- 'label' => __( 'Email', 'strong-testimonials' ),
257
- 'input_type' => 'email',
258
- 'required' => 1,
259
- 'after' => __( 'What is your email address?', 'strong-testimonials' ),
260
- ),
261
- 3 => array(
262
- 'record_type' => 'custom',
263
- 'name' => 'company_name',
264
- 'label' => __( 'Company Name', 'strong-testimonials' ),
265
- 'input_type' => 'text',
266
- 'after' => __( 'What is your company name?', 'strong-testimonials' ),
267
- ),
268
- 4 => array(
269
- 'record_type' => 'custom',
270
- 'name' => 'company_website',
271
- 'label' => __( 'Company Website', 'strong-testimonials' ),
272
- 'input_type' => 'url',
273
- 'after' => __( 'Does your company have a website?', 'strong-testimonials' ),
274
- ),
275
- // ----
276
- // POST
277
- // ----
278
- 5 => array(
279
- 'record_type' => 'post',
280
- 'name' => 'post_title',
281
- 'label' => __( 'Heading', 'strong-testimonials' ),
282
- 'input_type' => 'text',
283
- 'required' => 0,
284
- 'after' => __( 'A headline for your testimonial.', 'strong-testimonials' ),
285
- ),
286
- 6 => array(
287
- 'record_type' => 'post',
288
- 'name' => 'post_content',
289
- 'label' => __( 'Testimonial', 'strong-testimonials' ),
290
- 'input_type' => 'textarea',
291
- 'required' => 1,
292
- 'after' => __( 'What do you think about us?', 'strong-testimonials' ),
293
- ),
294
- 7 => array(
295
- 'record_type' => 'post',
296
- 'name' => 'featured_image',
297
- 'label' => __( 'Photo', 'strong-testimonials' ),
298
- 'input_type' => 'file',
299
- 'after' => __( 'Would you like to include a photo?', 'strong-testimonials' ),
300
- 'admin_table' => 1,
301
- ),
302
- ),
303
- ),
304
- );
305
-
306
- $forms['minimal'] = array(
307
- 'name' => 'minimal',
308
- 'label' => __( 'Minimal Form', 'strong-testimonials' ),
309
- 'readonly' => 1,
310
- 'fields' => array(
311
- // ------
312
- // CUSTOM
313
- // ------
314
- 0 => array(
315
- 'record_type' => 'custom',
316
- 'name' => 'client_name',
317
- 'label' => __( 'Name', 'strong-testimonials' ),
318
- 'input_type' => 'text',
319
- 'required' => 1,
320
- 'after' => '',
321
- 'admin_table' => 1,
322
- ),
323
- 1 => array(
324
- 'record_type' => 'custom',
325
- 'name' => 'email',
326
- 'label' => __( 'Email', 'strong-testimonials' ),
327
- 'input_type' => 'email',
328
- 'required' => 1,
329
- 'after' => '',
330
- ),
331
- // ----
332
- // POST
333
- // ----
334
- 2 => array(
335
- 'record_type' => 'post',
336
- 'name' => 'post_content',
337
- 'label' => __( 'Testimonial', 'strong-testimonials' ),
338
- 'input_type' => 'textarea',
339
- 'required' => 1,
340
- 'after' => '',
341
- ),
342
- ),
343
- );
344
-
345
- foreach ( $forms as $form_name => $form ) {
346
- foreach ( $form['fields'] as $key => $array ) {
347
- if ( 'post' == $array['record_type'] ) {
348
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
349
- } else {
350
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
351
- }
352
- }
353
- }
354
-
355
- return $forms;
356
- }
357
-
358
- /**
359
- * Custom forms.
360
- *
361
- * @return array
362
- */
363
- public static function get_custom_forms() {
364
-
365
- $base_forms = self::get_base_forms();
366
-
367
- // Copy default fields to custom fields.
368
- $forms[1] = array(
369
- 'name' => 'custom',
370
- 'label' => __( 'Custom Form', 'strong-testimonials' ),
371
- 'readonly' => 0,
372
- 'fields' => $base_forms['default']['fields'],
373
- );
374
-
375
- return $forms;
376
- }
377
-
378
- /**
379
- * Form options.
380
- *
381
- * @return array
382
- */
383
- public static function get_form_options() {
384
- /**
385
- * Messages
386
- *
387
- * @since 1.13
388
- */
389
- $default_messages = array(
390
- 'required-field' => array(
391
- 'order' => 1,
392
- /* translators: Settings > Form > Messages tab */
393
- 'description' => _x( 'Required', 'setting description', 'strong-testimonials' ),
394
- 'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
395
- 'enabled' => 1,
396
- ),
397
- 'form-submit-button' => array(
398
- 'order' => 2,
399
- /* translators: Settings > Form > Messages tab */
400
- 'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
401
- /* translators: Default label for the Submit button on testimonial form. */
402
- 'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
403
- ),
404
- 'submission-error' => array(
405
- 'order' => 3,
406
- /* translators: Settings > Form > Messages tab */
407
- 'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
408
- /* translators: Default message for submission form error. */
409
- 'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
410
- ),
411
- 'submission-success' => array(
412
- 'order' => 4,
413
- /* translators: Settings > Form > Messages tab */
414
- 'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
415
- /* translators: Default message for submission form success message. */
416
- 'text' => _x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
417
- ),
418
- );
419
-
420
- uasort( $default_messages, 'wpmtst_uasort' );
421
-
422
- $default_form_options = array(
423
- 'post_status' => 'pending',
424
- 'admin_notify' => false,
425
- 'mail_queue' => false,
426
- 'sender_name' => get_bloginfo( 'name' ),
427
- 'sender_site_email' => true,
428
- 'sender_email' => '',
429
- 'recipients' => array(
430
- array(
431
- 'admin_name' => '',
432
- 'admin_email' => '',
433
- 'admin_site_email' => true,
434
- 'primary' => true, // cannot be deleted
435
- ),
436
- ),
437
- 'default_recipient' => array(
438
- 'admin_name' => '',
439
- 'admin_email' => '',
440
- ),
441
- /* translators: Default subject line for new testimonial notification email. */
442
- 'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
443
- /* translators: Default message for new testimonial notification email. */
444
- 'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
445
- 'messages' => $default_messages,
446
- 'scrolltop_success' => true,
447
- 'scrolltop_success_offset' => 80,
448
- 'scrolltop_error' => true,
449
- 'scrolltop_error_offset' => 80,
450
- 'success_action' => 'message', // message | id | url
451
- 'success_redirect_id' => '',
452
- 'success_redirect_url' => '',
453
- );
454
-
455
- return apply_filters( 'wpmtst_default_form_options', $default_form_options );
456
- }
457
-
458
- /**
459
- * Default view options.
460
- *
461
- * @since 1.21.0
462
- *
463
- * @return array
464
- */
465
- public static function get_view_options() {
466
- $default_view_options = array(
467
-
468
- 'mode' => array(
469
- 'display' => array(
470
- 'name' => 'display',
471
- 'label' => __( 'Display', 'strong-testimonials' ),
472
- 'description' => __( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
473
- ),
474
- 'slideshow' => array(
475
- 'name' => 'slideshow',
476
- 'label' => __( 'Slideshow', 'strong-testimonials' ),
477
- 'description' => __( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
478
- ),
479
- 'form' => array(
480
- 'name' => 'form',
481
- 'label' => __( 'Form', 'strong-testimonials' ),
482
- 'description' => __( 'Display a testimonial submission form.', 'strong-testimonials' ),
483
- ),
484
- 'single_template' => array(
485
- 'name' => 'single_template',
486
- 'label' => __( 'Single Template', 'strong-testimonials' ),
487
- 'description' => __( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
488
- ),
489
- ),
490
-
491
- 'order' => array(
492
- 'random' => _x( 'random', 'display order', 'strong-testimonials' ),
493
- 'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
494
- 'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
495
- 'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
496
- ),
497
-
498
- 'slideshow_effect' => array(
499
- 'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
500
- 'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
501
- 'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
502
- 'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
503
- ),
504
-
505
- 'slideshow_height' => array(
506
- 'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
507
- 'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
508
- ),
509
-
510
- 'slideshow_nav_method' => array(
511
- 'controls' => array(
512
- 'none' => array(
513
- 'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
514
- 'args' => array( // base args; style will add more args
515
- 'controls' => 0,
516
- 'pager' => 0,
517
- 'autoControls' => 0,
518
- ),
519
- ),
520
- 'full' => array(
521
- 'label' => _x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
522
- 'class' => 'controls-type-full',
523
- 'add_position_class' => 1,
524
- 'args' => array(
525
- 'pager' => 0,
526
- 'autoControls' => 1,
527
- 'autoControlsCombine' => 1,
528
- 'fullSetButtons' => 1,
529
- 'fullSetText' => 1,
530
- ),
531
- ),
532
- 'simple' => array(
533
- 'label' => _x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
534
- 'class' => 'controls-type-simple',
535
- 'add_position_class' => 1,
536
- 'args' => array(
537
- 'controls' => 1,
538
- 'autoControls' => 0,
539
- ),
540
- ),
541
- 'sides' => array(
542
- 'label' => _x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
543
- 'class' => 'controls-type-sides',
544
- 'add_position_class' => 0,
545
- 'args' => array(
546
- 'controls' => 1,
547
- 'autoControls' => 0,
548
- 'prevText' => '',
549
- 'nextText' => '',
550
- ),
551
- ),
552
- ),
553
- 'pager' => array(
554
- 'none' => array(
555
- 'label' => _x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
556
- 'args' => array(),
557
- ),
558
- 'full' => array(
559
- 'label' => _x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
560
- //'class' => 'controls-pager-full',
561
- 'class' => 'pager-type-full',
562
- 'args' => array(
563
- 'pager' => 1,
564
- ),
565
- ),
566
- ),
567
- ),
568
-
569
- 'slideshow_nav_style' => array(
570
- 'controls' => array(
571
- 'buttons' => array(
572
- 'label' => _x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
573
- 'class' => 'controls-style-buttons',
574
- 'args' => array(
575
- 'startText' => '',
576
- 'stopText' => '',
577
- 'prevText' => '',
578
- 'nextText' => '',
579
- ),
580
- ),
581
- 'buttons2' => array(
582
- 'label' => _x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
583
- 'class' => 'controls-style-buttons2',
584
- 'args' => array(
585
- 'startText' => '',
586
- 'stopText' => '',
587
- 'prevText' => '',
588
- 'nextText' => '',
589
- ),
590
- ),
591
- 'buttons3' => array(
592
- 'label' => _x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
593
- 'class' => 'controls-style-buttons3',
594
- 'args' => array(
595
- 'startText' => '',
596
- 'stopText' => '',
597
- 'prevText' => '',
598
- 'nextText' => '',
599
- ),
600
- ),
601
- 'text' => array(
602
- 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
603
- 'class' => 'controls-style-text',
604
- 'args' => array(
605
- 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
606
- 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
607
- 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
608
- 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
609
- ),
610
- ),
611
- ),
612
- 'pager' => array(
613
- 'buttons' => array(
614
- 'label' => _x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
615
- 'class' => 'pager-style-buttons',
616
- 'args' => array(
617
- 'buildPager' => 'icons',
618
- 'simpleSetPager' => 1,
619
- ),
620
- ),
621
- 'text' => array(
622
- 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
623
- 'class' => 'pager-style-text',
624
- 'args' => array(
625
- 'buildPager' => null,
626
- 'simpleSetText' => 1,
627
- ),
628
- ),
629
- ),
630
- ),
631
-
632
- // Position is shared by Controls and Pagination.
633
- 'slideshow_nav_position' => array(
634
- 'inside' => _x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
635
- 'outside' => _x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
636
- ),
637
- );
638
-
639
- return $default_view_options;
640
- }
641
-
642
- /**
643
- * Default view configuration.
644
- *
645
- * @since 1.21.0
646
- *
647
- * @return array
648
- */
649
- public static function get_default_view() {
650
- $default_view = array(
651
- 'background' => array(
652
- 'color' => '',
653
- 'type' => '',
654
- 'preset' => '',
655
- 'gradient1' => '',
656
- 'gradient2' => '',
657
- ),
658
- 'category' => 'all',
659
- 'class' => '',
660
- 'client_section' => array(
661
- 0 => array(
662
- 'field' => 'client_name',
663
- 'type' => 'text',
664
- 'before' => '',
665
- 'class' => 'testimonial-name',
666
- ),
667
- 1 => array(
668
- 'field' => 'company_name',
669
- 'type' => 'link',
670
- 'before' => '',
671
- 'url' => 'company_website',
672
- 'class' => 'testimonial-company',
673
- 'new_tab' => true,
674
- ),
675
- ),
676
- 'column_count' => 2,
677
- 'container_class' => '',
678
- 'container_data' => '',
679
- 'content' => 'entire',
680
- 'count' => -1,
681
- 'divi_builder' => 0,
682
- 'excerpt_length' => 55,
683
- 'font-color' => array(
684
- 'color' => '',
685
- 'type' => '',
686
- ),
687
- 'form_ajax' => 0,
688
- 'form_id' => 1,
689
- 'gravatar' => 'no',
690
- 'id' => '',
691
- 'layout' => '',
692
- 'lightbox' => '',
693
- 'lightbox_class' => '',
694
- 'mode' => 'display',
695
- 'more_full_post' => false,
696
- 'more_post' => true,
697
- 'more_post_ellipsis' => true,
698
- 'more_post_text' => _x( 'Read more', 'link', 'strong-testimonials' ),
699
- 'more_post_in_place' => false,
700
- 'less_post' => false,
701
- 'less_post_text' => __( 'Show less', 'strong-testimonials' ),
702
- 'more_page' => false,
703
- 'more_page_hook' => 'wpmtst_view_footer',
704
- 'more_page_id' => 0,
705
- 'more_page_text' => _x( 'Read more testimonials', 'link', 'strong-testimonials' ),
706
- 'note' => '',
707
- 'order' => 'oldest',
708
- 'page' => '',
709
- 'pagination' => false,
710
- 'pagination_settings' => array(
711
- 'type' => 'simple',
712
- 'nav' => 'after',
713
- 'per_page' => 5,
714
- 'show_all' => 0,
715
- 'end_size' => 1,
716
- 'mid_size' => 2,
717
- 'prev_next' => 1,
718
- 'prev_text' => __( '&laquo; Previous', 'strong-testimonials' ),
719
- 'next_text' => __( 'Next &raquo;', 'strong-testimonials' ),
720
- 'before_page_number' => '',
721
- 'after_page_number' => '',
722
- ),
723
- 'slideshow_settings' => array(
724
- 'type' => 'show_single', // or show_multiple
725
- 'show_single' => array(
726
- 'max_slides' => 1,
727
- 'move_slides' => 1,
728
- 'margin' => 1,
729
- ),
730
- 'breakpoints' => array(
731
- 'desktop' => array(
732
- 'description' => 'Desktop',
733
- 'width' => 1200,
734
- 'max_slides' => 2,
735
- 'move_slides' => 1,
736
- 'margin' => 20,
737
- ),
738
- 'large' => array(
739
- 'description' => 'Large',
740
- 'width' => 1024,
741
- 'max_slides' => 2,
742
- 'move_slides' => 1,
743
- 'margin' => 20,
744
- ),
745
- 'medium' => array(
746
- 'description' => 'Medium',
747
- 'width' => 640,
748
- 'max_slides' => 1,
749
- 'move_slides' => 1,
750
- 'margin' => 10,
751
- ),
752
- 'small' => array(
753
- 'description' => 'Small',
754
- 'width' => 480,
755
- 'max_slides' => 1,
756
- 'move_slides' => 1,
757
- 'margin' => 1,
758
- ),
759
- ),
760
- 'effect' => 'fade',
761
- 'speed' => 1,
762
- 'pause' => 8,
763
- 'auto_start' => true,
764
- 'auto_hover' => true,
765
- 'adapt_height' => true,
766
- 'adapt_height_speed' => .5,
767
- 'stretch' => 0,
768
- 'stop_auto_on_click' => true,
769
- 'controls_type' => 'none',
770
- 'controls_style' => 'buttons',
771
- 'pager_type' => 'none',
772
- 'pager_style' => 'buttons',
773
- 'nav_position' => 'inside',
774
- ),
775
- 'template' => 'default',
776
- 'template_settings' => array(),
777
- 'thumbnail' => true,
778
- 'thumbnail_size' => 'thumbnail',
779
- 'thumbnail_height' => null,
780
- 'thumbnail_width' => null,
781
- 'title' => true,
782
- 'title_link' => false,
783
- 'use_default_length' => true,
784
- 'use_default_more' => false,
785
- 'view' => '',
786
- );
787
- ksort( $default_view );
788
-
789
- return $default_view;
790
- }
791
-
792
- /**
793
- * Compatibility options.
794
- *
795
- * @since 2.28.0
796
- * @since 2.31.0 controller
797
- * @since 2.31.0 lazyload
798
- * @return array
799
- */
800
- public static function get_compat_options() {
801
- $options = array(
802
- 'page_loading' => '', // (blank) | general | advanced
803
- 'prerender' => 'current', // current | all | none
804
- 'ajax' => array(
805
- 'method' => '', // (blank) | universal | observer | event | script
806
- 'universal_timer' => 0.5,
807
- 'observer_timer' => 0.5,
808
- 'container_id' => 'page', // = what we listen to (try page > content > primary)
809
- 'addednode_id' => 'content', // = what we listen for
810
- 'event' => '',
811
- 'script' => '',
812
- ),
813
- 'controller' => array(
814
- 'initialize_on' => 'documentReady', // or windowLoad
815
- ),
816
- 'lazyload' => array(
817
- 'enabled' => '',
818
- 'classes' => array( // may be multiple pairs
819
- array(
820
- 'start' => '',
821
- 'finish' => '',
822
- )
823
- ),
824
- ),
825
- );
826
-
827
- return $options;
828
- }
829
-
830
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Defaults
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Defaults {
9
+
10
+ /**
11
+ * Strong_Testimonials_Defaults constructor.
12
+ */
13
+ public function __construct() { }
14
+
15
+ /**
16
+ * Settings
17
+ *
18
+ * @since 1.13.0 reorder
19
+ * @since 2.2.11 scrolltop
20
+ * @since 2.3.0 remove whitespace
21
+ * @since 2.6.0 embed width
22
+ * @since 2.6.2 slideshow z-index
23
+ * @since 2.10.0 pending indicator
24
+ * @since 2.21.0 load Font Awesome
25
+ * @since 2.22.5 nofollow
26
+ * @since 2.27.0 no_lazyload
27
+ *
28
+ * @return array
29
+ */
30
+ public static function get_options() {
31
+ $default_options = array(
32
+ 'embed_width' => '',
33
+ 'load_font_awesome' => true,
34
+ 'nofollow' => false,
35
+ 'pending_indicator' => true,
36
+ 'remove_whitespace' => true,
37
+ 'reorder' => false,
38
+ 'support_comments' => false,
39
+ 'support_custom_fields' => false,
40
+ 'single_testimonial_slug' => 'testimonial',
41
+ 'scrolltop' => true,
42
+ 'scrolltop_offset' => 80,
43
+ 'no_lazyload' => true,
44
+ 'touch_enabled' => true,
45
+ );
46
+
47
+ return $default_options;
48
+ }
49
+
50
+ /**
51
+ * Custom field base.
52
+ *
53
+ * @since 2.28.0 Use 'action' to register a callback.
54
+ *
55
+ * @return array
56
+ */
57
+ public static function get_field_base() {
58
+ return apply_filters( 'wpmtst_field_base', array(
59
+ 'name' => '',
60
+ 'name_mutable' => 1,
61
+ 'label' => '',
62
+ 'show_label' => 1,
63
+ 'input_type' => '',
64
+ 'action_input' => '',
65
+ 'action_output' => '',
66
+ 'text' => '',
67
+ 'show_text_option' => 0,
68
+ 'required' => 0,
69
+ 'show_required_option' => 1,
70
+ 'default_form_value' => '',
71
+ 'default_display_value' => '',
72
+ 'show_default_options' => 1,
73
+ 'error' => __( 'This field is required.', 'strong-testimonials' ),
74
+ 'placeholder' => '',
75
+ 'show_placeholder_option' => 1,
76
+ 'before' => '',
77
+ 'after' => '',
78
+ 'admin_table' => 0,
79
+ 'admin_table_option' => 1,
80
+ 'show_admin_table_option' => 1,
81
+ 'shortcode_on_form' => '',
82
+ 'shortcode_on_display' => '',
83
+ 'show_shortcode_options' => 0,
84
+ ) );
85
+ }
86
+
87
+ /**
88
+ * Custom fields.
89
+ *
90
+ * @return array
91
+ */
92
+ public static function get_fields() {
93
+ $field_base = self::get_field_base();
94
+ $field_types = array();
95
+
96
+ /*
97
+ * Assemble post field types
98
+ */
99
+ $field_types['post'] = array(
100
+ 'post_title' => array(
101
+ 'input_type' => 'text',
102
+ 'option_label' => __( 'Testimonial Title', 'strong-testimonials' ),
103
+ 'map' => 'post_title',
104
+ 'show_default_options' => 0,
105
+ 'admin_table' => 1,
106
+ 'admin_table_option' => 0,
107
+ 'show_admin_table_option' => 0,
108
+ 'name_mutable' => 0,
109
+ ),
110
+ 'post_content' => array(
111
+ 'input_type' => 'textarea',
112
+ 'option_label' => __( 'Testimonial Content', 'strong-testimonials' ),
113
+ 'map' => 'post_content',
114
+ 'required' => 1,
115
+ 'show_default_options' => 0,
116
+ 'core' => 0,
117
+ 'admin_table' => 0,
118
+ 'show_admin_table_option' => 0,
119
+ 'name_mutable' => 0,
120
+ ),
121
+ 'featured_image' => array(
122
+ 'input_type' => 'file',
123
+ 'option_label' => __( 'Featured Image', 'strong-testimonials' ),
124
+ 'map' => 'featured_image',
125
+ 'show_default_options' => 0,
126
+ 'show_placeholder_option' => 0,
127
+ 'admin_table' => 0,
128
+ 'name_mutable' => 0,
129
+ ),
130
+ );
131
+ foreach ( $field_types['post'] as $key => $array ) {
132
+ $field_types['post'][ $key ] = array_merge( $field_base, $array );
133
+ }
134
+
135
+ /*
136
+ * Assemble custom field types
137
+ */
138
+ $field_types['custom'] = array(
139
+ 'text' => array(
140
+ 'input_type' => 'text',
141
+ 'option_label' => __( 'text', 'strong-testimonials' ),
142
+ ),
143
+ 'email' => array(
144
+ 'input_type' => 'email',
145
+ 'option_label' => __( 'email', 'strong-testimonials' ),
146
+ 'show_default_options' => 0,
147
+ ),
148
+ 'url' => array(
149
+ 'input_type' => 'url',
150
+ 'option_label' => __( 'URL', 'strong-testimonials' ),
151
+ 'show_default_options' => 0,
152
+ ),
153
+ 'checkbox' => array(
154
+ 'input_type' => 'checkbox',
155
+ 'option_label' => __( 'checkbox', 'strong-testimonials' ),
156
+ 'show_text_option' => 1,
157
+ 'show_placeholder_option' => 0,
158
+ ),
159
+ );
160
+ foreach ( $field_types['custom'] as $key => $array ) {
161
+ $field_types['custom'][ $key ] = array_merge( $field_base, $array );
162
+ }
163
+
164
+ /*
165
+ * Assemble special field types (FKA Optional)
166
+ *
167
+ * @since 1.18
168
+ * @since 2.2.2 Fix bug caused by localizing 'categories'
169
+ */
170
+ $field_types['optional'] = array(
171
+ 'category-selector' => array(
172
+ 'input_type' => 'category-selector',
173
+ 'option_label' => __( 'category selector', 'strong-testimonials' ),
174
+ 'show_default_options' => 0,
175
+ 'show_placeholder_option' => 0,
176
+ 'show_admin_table_option' => 0,
177
+ 'name_mutable' => 0,
178
+ ),
179
+ 'category-checklist' => array(
180
+ 'input_type' => 'category-checklist',
181
+ 'option_label' => __( 'category checklist', 'strong-testimonials' ),
182
+ 'show_default_options' => 0,
183
+ 'show_placeholder_option' => 0,
184
+ 'show_admin_table_option' => 0,
185
+ 'name_mutable' => 0,
186
+ ),
187
+ 'shortcode' => array(
188
+ 'input_type' => 'shortcode',
189
+ 'option_label' => __( 'shortcode', 'strong-testimonials' ),
190
+ 'show_label' => 0,
191
+ 'required' => 0,
192
+ 'show_required_option' => 0,
193
+ 'show_default_options' => 0,
194
+ 'show_placeholder_option' => 0,
195
+ 'show_admin_table_option' => 0,
196
+ 'show_shortcode_options' => 1,
197
+ ),
198
+ 'rating' => array(
199
+ 'input_type' => 'rating',
200
+ 'option_label' => __( 'star rating', 'strong-testimonials' ),
201
+ 'show_placeholder_option' => 0,
202
+ 'admin_table' => 1,
203
+ 'admin_table_option' => 1,
204
+ 'show_admin_table_option' => 1,
205
+ ),
206
+ );
207
+
208
+ /*
209
+ * Merge each one onto base field
210
+ */
211
+ foreach ( $field_types['optional'] as $key => $array ) {
212
+ $field_types['optional'][ $key ] = array_merge( $field_base, $array );
213
+ }
214
+
215
+ /*
216
+ * Assemble all fields
217
+ */
218
+ $default_fields = array(
219
+ 'field_base' => $field_base,
220
+ 'field_types' => $field_types,
221
+ );
222
+
223
+ return apply_filters( 'wpmtst_default_fields', $default_fields );
224
+ }
225
+
226
+ /**
227
+ * Default forms.
228
+ *
229
+ * @return array
230
+ */
231
+ public static function get_base_forms() {
232
+ $default_fields = self::get_fields();
233
+
234
+ // Assemble field groups.
235
+ $forms = array(
236
+ 'default' => array(
237
+ 'name' => 'default',
238
+ 'label' => __( 'Default Form', 'strong-testimonials' ),
239
+ 'readonly' => 1,
240
+ 'fields' => array(
241
+ // ------
242
+ // CUSTOM
243
+ // ------
244
+ 0 => array(
245
+ 'record_type' => 'custom',
246
+ 'name' => 'client_name',
247
+ 'label' => __( 'Full Name', 'strong-testimonials' ),
248
+ 'input_type' => 'text',
249
+ 'required' => 1,
250
+ 'after' => __( 'What is your full name?', 'strong-testimonials' ),
251
+ 'admin_table' => 1,
252
+ ),
253
+ 1 => array(
254
+ 'record_type' => 'custom',
255
+ 'name' => 'email',
256
+ 'label' => __( 'Email', 'strong-testimonials' ),
257
+ 'input_type' => 'email',
258
+ 'required' => 1,
259
+ 'after' => __( 'What is your email address?', 'strong-testimonials' ),
260
+ ),
261
+ 3 => array(
262
+ 'record_type' => 'custom',
263
+ 'name' => 'company_name',
264
+ 'label' => __( 'Company Name', 'strong-testimonials' ),
265
+ 'input_type' => 'text',
266
+ 'after' => __( 'What is your company name?', 'strong-testimonials' ),
267
+ ),
268
+ 4 => array(
269
+ 'record_type' => 'custom',
270
+ 'name' => 'company_website',
271
+ 'label' => __( 'Company Website', 'strong-testimonials' ),
272
+ 'input_type' => 'url',
273
+ 'after' => __( 'Does your company have a website?', 'strong-testimonials' ),
274
+ ),
275
+ // ----
276
+ // POST
277
+ // ----
278
+ 5 => array(
279
+ 'record_type' => 'post',
280
+ 'name' => 'post_title',
281
+ 'label' => __( 'Heading', 'strong-testimonials' ),
282
+ 'input_type' => 'text',
283
+ 'required' => 0,
284
+ 'after' => __( 'A headline for your testimonial.', 'strong-testimonials' ),
285
+ ),
286
+ 6 => array(
287
+ 'record_type' => 'post',
288
+ 'name' => 'post_content',
289
+ 'label' => __( 'Testimonial', 'strong-testimonials' ),
290
+ 'input_type' => 'textarea',
291
+ 'required' => 1,
292
+ 'after' => __( 'What do you think about us?', 'strong-testimonials' ),
293
+ ),
294
+ 7 => array(
295
+ 'record_type' => 'post',
296
+ 'name' => 'featured_image',
297
+ 'label' => __( 'Photo', 'strong-testimonials' ),
298
+ 'input_type' => 'file',
299
+ 'after' => __( 'Would you like to include a photo?', 'strong-testimonials' ),
300
+ 'admin_table' => 1,
301
+ ),
302
+ ),
303
+ ),
304
+ );
305
+
306
+ $forms['minimal'] = array(
307
+ 'name' => 'minimal',
308
+ 'label' => __( 'Minimal Form', 'strong-testimonials' ),
309
+ 'readonly' => 1,
310
+ 'fields' => array(
311
+ // ------
312
+ // CUSTOM
313
+ // ------
314
+ 0 => array(
315
+ 'record_type' => 'custom',
316
+ 'name' => 'client_name',
317
+ 'label' => __( 'Name', 'strong-testimonials' ),
318
+ 'input_type' => 'text',
319
+ 'required' => 1,
320
+ 'after' => '',
321
+ 'admin_table' => 1,
322
+ ),
323
+ 1 => array(
324
+ 'record_type' => 'custom',
325
+ 'name' => 'email',
326
+ 'label' => __( 'Email', 'strong-testimonials' ),
327
+ 'input_type' => 'email',
328
+ 'required' => 1,
329
+ 'after' => '',
330
+ ),
331
+ // ----
332
+ // POST
333
+ // ----
334
+ 2 => array(
335
+ 'record_type' => 'post',
336
+ 'name' => 'post_content',
337
+ 'label' => __( 'Testimonial', 'strong-testimonials' ),
338
+ 'input_type' => 'textarea',
339
+ 'required' => 1,
340
+ 'after' => '',
341
+ ),
342
+ ),
343
+ );
344
+
345
+ foreach ( $forms as $form_name => $form ) {
346
+ foreach ( $form['fields'] as $key => $array ) {
347
+ if ( 'post' == $array['record_type'] ) {
348
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
349
+ } else {
350
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
351
+ }
352
+ }
353
+ }
354
+
355
+ return $forms;
356
+ }
357
+
358
+ /**
359
+ * Custom forms.
360
+ *
361
+ * @return array
362
+ */
363
+ public static function get_custom_forms() {
364
+
365
+ $base_forms = self::get_base_forms();
366
+
367
+ // Copy default fields to custom fields.
368
+ $forms[1] = array(
369
+ 'name' => 'custom',
370
+ 'label' => __( 'Custom Form', 'strong-testimonials' ),
371
+ 'readonly' => 0,
372
+ 'fields' => $base_forms['default']['fields'],
373
+ );
374
+
375
+ return $forms;
376
+ }
377
+
378
+ /**
379
+ * Form options.
380
+ *
381
+ * @return array
382
+ */
383
+ public static function get_form_options() {
384
+ /**
385
+ * Messages
386
+ *
387
+ * @since 1.13
388
+ */
389
+ $default_messages = array(
390
+ 'required-field' => array(
391
+ 'order' => 1,
392
+ /* translators: Settings > Form > Messages tab */
393
+ 'description' => _x( 'Required', 'setting description', 'strong-testimonials' ),
394
+ 'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
395
+ 'enabled' => 1,
396
+ ),
397
+ 'form-submit-button' => array(
398
+ 'order' => 2,
399
+ /* translators: Settings > Form > Messages tab */
400
+ 'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
401
+ /* translators: Default label for the Submit button on testimonial form. */
402
+ 'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
403
+ ),
404
+ 'submission-error' => array(
405
+ 'order' => 3,
406
+ /* translators: Settings > Form > Messages tab */
407
+ 'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
408
+ /* translators: Default message for submission form error. */
409
+ 'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
410
+ ),
411
+ 'submission-success' => array(
412
+ 'order' => 4,
413
+ /* translators: Settings > Form > Messages tab */
414
+ 'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
415
+ /* translators: Default message for submission form success message. */
416
+ 'text' => _x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
417
+ ),
418
+ );
419
+
420
+ uasort( $default_messages, 'wpmtst_uasort' );
421
+
422
+ $default_form_options = array(
423
+ 'post_status' => 'pending',
424
+ 'admin_notify' => false,
425
+ 'mail_queue' => false,
426
+ 'sender_name' => get_bloginfo( 'name' ),
427
+ 'sender_site_email' => true,
428
+ 'sender_email' => '',
429
+ 'recipients' => array(
430
+ array(
431
+ 'admin_name' => '',
432
+ 'admin_email' => '',
433
+ 'admin_site_email' => true,
434
+ 'primary' => true, // cannot be deleted
435
+ ),
436
+ ),
437
+ 'default_recipient' => array(
438
+ 'admin_name' => '',
439
+ 'admin_email' => '',
440
+ ),
441
+ /* translators: Default subject line for new testimonial notification email. */
442
+ 'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
443
+ /* translators: Default message for new testimonial notification email. */
444
+ 'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
445
+ 'messages' => $default_messages,
446
+ 'scrolltop_success' => true,
447
+ 'scrolltop_success_offset' => 80,
448
+ 'scrolltop_error' => true,
449
+ 'scrolltop_error_offset' => 80,
450
+ 'success_action' => 'message', // message | id | url
451
+ 'success_redirect_id' => '',
452
+ 'success_redirect_url' => '',
453
+ );
454
+
455
+ return apply_filters( 'wpmtst_default_form_options', $default_form_options );
456
+ }
457
+
458
+ /**
459
+ * Default view options.
460
+ *
461
+ * @since 1.21.0
462
+ *
463
+ * @return array
464
+ */
465
+ public static function get_view_options() {
466
+ $default_view_options = array(
467
+
468
+ 'mode' => array(
469
+ 'display' => array(
470
+ 'name' => 'display',
471
+ 'label' => __( 'Display', 'strong-testimonials' ),
472
+ 'description' => __( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
473
+ ),
474
+ 'slideshow' => array(
475
+ 'name' => 'slideshow',
476
+ 'label' => __( 'Slideshow', 'strong-testimonials' ),
477
+ 'description' => __( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
478
+ ),
479
+ 'form' => array(
480
+ 'name' => 'form',
481
+ 'label' => __( 'Form', 'strong-testimonials' ),
482
+ 'description' => __( 'Display a testimonial submission form.', 'strong-testimonials' ),
483
+ ),
484
+ 'single_template' => array(
485
+ 'name' => 'single_template',
486
+ 'label' => __( 'Single Template', 'strong-testimonials' ),
487
+ 'description' => __( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
488
+ ),
489
+ ),
490
+
491
+ 'order' => array(
492
+ 'random' => _x( 'random', 'display order', 'strong-testimonials' ),
493
+ 'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
494
+ 'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
495
+ 'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
496
+ ),
497
+
498
+ 'slideshow_effect' => array(
499
+ 'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
500
+ 'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
501
+ 'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
502
+ 'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
503
+ ),
504
+
505
+ 'slideshow_height' => array(
506
+ 'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
507
+ 'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
508
+ ),
509
+
510
+ 'slideshow_nav_method' => array(
511
+ 'controls' => array(
512
+ 'none' => array(
513
+ 'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
514
+ 'args' => array( // base args; style will add more args
515
+ 'controls' => 0,
516
+ 'pager' => 0,
517
+ 'autoControls' => 0,
518
+ ),
519
+ ),
520
+ 'full' => array(
521
+ 'label' => _x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
522
+ 'class' => 'controls-type-full',
523
+ 'add_position_class' => 1,
524
+ 'args' => array(
525
+ 'pager' => 0,
526
+ 'autoControls' => 1,
527
+ 'autoControlsCombine' => 1,
528
+ 'fullSetButtons' => 1,
529
+ 'fullSetText' => 1,
530
+ ),
531
+ ),
532
+ 'simple' => array(
533
+ 'label' => _x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
534
+ 'class' => 'controls-type-simple',
535
+ 'add_position_class' => 1,
536
+ 'args' => array(
537
+ 'controls' => 1,
538
+ 'autoControls' => 0,
539
+ ),
540
+ ),
541
+ 'sides' => array(
542
+ 'label' => _x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
543
+ 'class' => 'controls-type-sides',
544
+ 'add_position_class' => 0,
545
+ 'args' => array(
546
+ 'controls' => 1,
547
+ 'autoControls' => 0,
548
+ 'prevText' => '',
549
+ 'nextText' => '',
550
+ ),
551
+ ),
552
+ ),
553
+ 'pager' => array(
554
+ 'none' => array(
555
+ 'label' => _x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
556
+ 'args' => array(),
557
+ ),
558
+ 'full' => array(
559
+ 'label' => _x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
560
+ //'class' => 'controls-pager-full',
561
+ 'class' => 'pager-type-full',
562
+ 'args' => array(
563
+ 'pager' => 1,
564
+ ),
565
+ ),
566
+ ),
567
+ ),
568
+
569
+ 'slideshow_nav_style' => array(
570
+ 'controls' => array(
571
+ 'buttons' => array(
572
+ 'label' => _x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
573
+ 'class' => 'controls-style-buttons',
574
+ 'args' => array(
575
+ 'startText' => '',
576
+ 'stopText' => '',
577
+ 'prevText' => '',
578
+ 'nextText' => '',
579
+ ),
580
+ ),
581
+ 'buttons2' => array(
582
+ 'label' => _x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
583
+ 'class' => 'controls-style-buttons2',
584
+ 'args' => array(
585
+ 'startText' => '',
586
+ 'stopText' => '',
587
+ 'prevText' => '',
588
+ 'nextText' => '',
589
+ ),
590
+ ),
591
+ 'buttons3' => array(
592
+ 'label' => _x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
593
+ 'class' => 'controls-style-buttons3',
594
+ 'args' => array(
595
+ 'startText' => '',
596
+ 'stopText' => '',
597
+ 'prevText' => '',
598
+ 'nextText' => '',
599
+ ),
600
+ ),
601
+ 'text' => array(
602
+ 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
603
+ 'class' => 'controls-style-text',
604
+ 'args' => array(
605
+ 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
606
+ 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
607
+ 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
608
+ 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
609
+ ),
610
+ ),
611
+ ),
612
+ 'pager' => array(
613
+ 'buttons' => array(
614
+ 'label' => _x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
615
+ 'class' => 'pager-style-buttons',
616
+ 'args' => array(
617
+ 'buildPager' => 'icons',
618
+ 'simpleSetPager' => 1,
619
+ ),
620
+ ),
621
+ 'text' => array(
622
+ 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
623
+ 'class' => 'pager-style-text',
624
+ 'args' => array(
625
+ 'buildPager' => null,
626
+ 'simpleSetText' => 1,
627
+ ),
628
+ ),
629
+ ),
630
+ ),
631
+
632
+ // Position is shared by Controls and Pagination.
633
+ 'slideshow_nav_position' => array(
634
+ 'inside' => _x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
635
+ 'outside' => _x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
636
+ ),
637
+ );
638
+
639
+ return $default_view_options;
640
+ }
641
+
642
+ /**
643
+ * Default view configuration.
644
+ *
645
+ * @since 1.21.0
646
+ *
647
+ * @return array
648
+ */
649
+ public static function get_default_view() {
650
+ $default_view = array(
651
+ 'background' => array(
652
+ 'color' => '',
653
+ 'type' => '',
654
+ 'preset' => '',
655
+ 'gradient1' => '',
656
+ 'gradient2' => '',
657
+ ),
658
+ 'category' => 'all',
659
+ 'class' => '',
660
+ 'client_section' => array(
661
+ 0 => array(
662
+ 'field' => 'client_name',
663
+ 'type' => 'text',
664
+ 'before' => '',
665
+ 'class' => 'testimonial-name',
666
+ ),
667
+ 1 => array(
668
+ 'field' => 'company_name',
669
+ 'type' => 'link',
670
+ 'before' => '',
671
+ 'url' => 'company_website',
672
+ 'class' => 'testimonial-company',
673
+ 'new_tab' => true,
674
+ ),
675
+ ),
676
+ 'column_count' => 2,
677
+ 'container_class' => '',
678
+ 'container_data' => '',
679
+ 'content' => 'entire',
680
+ 'count' => -1,
681
+ 'divi_builder' => 0,
682
+ 'excerpt_length' => 55,
683
+ 'font-color' => array(
684
+ 'color' => '',
685
+ 'type' => '',
686
+ ),
687
+ 'form_ajax' => 0,
688
+ 'form_id' => 1,
689
+ 'gravatar' => 'no',
690
+ 'id' => '',
691
+ 'layout' => '',
692
+ 'lightbox' => '',
693
+ 'lightbox_class' => '',
694
+ 'mode' => 'display',
695
+ 'more_full_post' => false,
696
+ 'more_post' => true,
697
+ 'more_post_ellipsis' => true,
698
+ 'more_post_text' => _x( 'Read more', 'link', 'strong-testimonials' ),
699
+ 'more_post_in_place' => false,
700
+ 'less_post' => false,
701
+ 'less_post_text' => __( 'Show less', 'strong-testimonials' ),
702
+ 'more_page' => false,
703
+ 'more_page_hook' => 'wpmtst_view_footer',
704
+ 'more_page_id' => 0,
705
+ 'more_page_text' => _x( 'Read more testimonials', 'link', 'strong-testimonials' ),
706
+ 'note' => '',
707
+ 'order' => 'oldest',
708
+ 'page' => '',
709
+ 'pagination' => false,
710
+ 'pagination_settings' => array(
711
+ 'type' => 'simple',
712
+ 'nav' => 'after',
713
+ 'per_page' => 5,
714
+ 'show_all' => 0,
715
+ 'end_size' => 1,
716
+ 'mid_size' => 2,
717
+ 'prev_next' => 1,
718
+ 'prev_text' => __( '&laquo; Previous', 'strong-testimonials' ),
719
+ 'next_text' => __( 'Next &raquo;', 'strong-testimonials' ),
720
+ 'before_page_number' => '',
721
+ 'after_page_number' => '',
722
+ ),
723
+ 'slideshow_settings' => array(
724
+ 'type' => 'show_single', // or show_multiple
725
+ 'show_single' => array(
726
+ 'max_slides' => 1,
727
+ 'move_slides' => 1,
728
+ 'margin' => 1,
729
+ ),
730
+ 'breakpoints' => array(
731
+ 'desktop' => array(
732
+ 'description' => 'Desktop',
733
+ 'width' => 1200,
734
+ 'max_slides' => 2,
735
+ 'move_slides' => 1,
736
+ 'margin' => 20,
737
+ ),
738
+ 'large' => array(
739
+ 'description' => 'Large',
740
+ 'width' => 1024,
741
+ 'max_slides' => 2,
742
+ 'move_slides' => 1,
743
+ 'margin' => 20,
744
+ ),
745
+ 'medium' => array(
746
+ 'description' => 'Medium',
747
+ 'width' => 640,
748
+ 'max_slides' => 1,
749
+ 'move_slides' => 1,
750
+ 'margin' => 10,
751
+ ),
752
+ 'small' => array(
753
+ 'description' => 'Small',
754
+ 'width' => 480,
755
+ 'max_slides' => 1,
756
+ 'move_slides' => 1,
757
+ 'margin' => 1,
758
+ ),
759
+ ),
760
+ 'effect' => 'fade',
761
+ 'speed' => 1,
762
+ 'pause' => 8,
763
+ 'auto_start' => true,
764
+ 'auto_hover' => true,
765
+ 'adapt_height' => true,
766
+ 'adapt_height_speed' => .5,
767
+ 'stretch' => 0,
768
+ 'stop_auto_on_click' => true,
769
+ 'controls_type' => 'none',
770
+ 'controls_style' => 'buttons',
771
+ 'pager_type' => 'none',
772
+ 'pager_style' => 'buttons',
773
+ 'nav_position' => 'inside',
774
+ ),
775
+ 'template' => 'default',
776
+ 'template_settings' => array(),
777
+ 'thumbnail' => true,
778
+ 'thumbnail_size' => 'thumbnail',
779
+ 'thumbnail_height' => null,
780
+ 'thumbnail_width' => null,
781
+ 'title' => true,
782
+ 'title_link' => false,
783
+ 'use_default_length' => true,
784
+ 'use_default_more' => false,
785
+ 'view' => '',
786
+ );
787
+ ksort( $default_view );
788
+
789
+ return $default_view;
790
+ }
791
+
792
+ /**
793
+ * Compatibility options.
794
+ *
795
+ * @since 2.28.0
796
+ * @since 2.31.0 controller
797
+ * @since 2.31.0 lazyload
798
+ * @return array
799
+ */
800
+ public static function get_compat_options() {
801
+ $options = array(
802
+ 'page_loading' => '', // (blank) | general | advanced
803
+ 'prerender' => 'current', // current | all | none
804
+ 'ajax' => array(
805
+ 'method' => '', // (blank) | universal | observer | event | script
806
+ 'universal_timer' => 0.5,
807
+ 'observer_timer' => 0.5,
808
+ 'container_id' => 'page', // = what we listen to (try page > content > primary)
809
+ 'addednode_id' => 'content', // = what we listen for
810
+ 'event' => '',
811
+ 'script' => '',
812
+ ),
813
+ 'controller' => array(
814
+ 'initialize_on' => 'documentReady', // or windowLoad
815
+ ),
816
+ 'lazyload' => array(
817
+ 'enabled' => '',
818
+ 'classes' => array( // may be multiple pairs
819
+ array(
820
+ 'start' => '',
821
+ 'finish' => '',
822
+ )
823
+ ),
824
+ ),
825
+ );
826
+
827
+ return $options;
828
+ }
829
+
830
+ }
admin/class-strong-testimonials-exporter.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Exporter
5
- *
6
- * exports testimonials along with their featured media
7
- *
8
- * @since 2.36
9
- */
10
- class Strong_Testimonials_Exporter {
11
-
12
- public $args = array();
13
- public $query_done = false;
14
-
15
- public function __construct() {
16
- add_action( 'export_wp', array( $this, 'export_wp' ), 10, 1 );
17
- add_filter( 'export_query', array( $this, 'export_query' ), 10, 1 );
18
- }
19
-
20
- public function export_wp( $args ) {
21
- $this->args = $args;
22
- add_filter( 'query', array( $this, 'export_query_filter' ), 10, 1 );
23
- }
24
-
25
- public function export_query_filter( $query ) {
26
-
27
- global $wpdb;
28
- if ( false === $this->query_done && 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} " ) ) {
29
- $this->query_done = true;
30
- remove_filter( 'query', array( $this, 'export_query_filter' ), 10 );
31
- $query = apply_filters( 'export_query', $query );
32
- }
33
- return $query;
34
- }
35
-
36
- public function export_query( $query ) {
37
- global $wpdb;
38
-
39
- if ( isset( $this->args['content'] ) && 'wpm-testimonial' === $this->args['content'] ) {
40
-
41
- $attachments = $wpdb->get_results( "SELECT ID, guid, post_parent FROM {$wpdb->posts} WHERE post_type = 'attachment'", OBJECT_K );
42
- if ( empty( $attachments ) ) {
43
- return $query;
44
- }
45
-
46
- $ids = array();
47
-
48
- // get attachments who are post thumbnails
49
- $posts = $wpdb->get_col( $query );
50
- if ( $posts ) {
51
- $ids = $wpdb->get_col( sprintf( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_thumbnail_id' AND post_id IN(%s)", implode( ',', $posts ) ) );
52
- }
53
-
54
- // get atachments who have a post parent.
55
- foreach ( $attachments as $id => $att ) {
56
- if ( in_array( $att->post_parent, $posts ) ) {
57
- $ids[] = $id;
58
- }
59
- }
60
-
61
- $ids = array_unique( $ids );
62
- if ( count( $ids ) === 0 ) {
63
- return $query;
64
- }
65
-
66
- if ( 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} " ) ) {
67
- // replace INNER JOIN with LEFT JOIN.
68
- $query = str_replace( "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} ", "SELECT ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ", $query );
69
- }
70
- $query .= sprintf( " OR {$wpdb->posts}.ID IN (%s) ", implode( ',', $ids ) );
71
-
72
- }
73
- return $query;
74
- }
75
-
76
-
77
- }
78
-
79
- new Strong_Testimonials_Exporter();
80
-
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Exporter
5
+ *
6
+ * exports testimonials along with their featured media
7
+ *
8
+ * @since 2.36
9
+ */
10
+ class Strong_Testimonials_Exporter {
11
+
12
+ public $args = array();
13
+ public $query_done = false;
14
+
15
+ public function __construct() {
16
+ add_action( 'export_wp', array( $this, 'export_wp' ), 10, 1 );
17
+ add_filter( 'export_query', array( $this, 'export_query' ), 10, 1 );
18
+ }
19
+
20
+ public function export_wp( $args ) {
21
+ $this->args = $args;
22
+ add_filter( 'query', array( $this, 'export_query_filter' ), 10, 1 );
23
+ }
24
+
25
+ public function export_query_filter( $query ) {
26
+
27
+ global $wpdb;
28
+ if ( false === $this->query_done && 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} " ) ) {
29
+ $this->query_done = true;
30
+ remove_filter( 'query', array( $this, 'export_query_filter' ), 10 );
31
+ $query = apply_filters( 'export_query', $query );
32
+ }
33
+ return $query;
34
+ }
35
+
36
+ public function export_query( $query ) {
37
+ global $wpdb;
38
+
39
+ if ( isset( $this->args['content'] ) && 'wpm-testimonial' === $this->args['content'] ) {
40
+
41
+ $attachments = $wpdb->get_results( "SELECT ID, guid, post_parent FROM {$wpdb->posts} WHERE post_type = 'attachment'", OBJECT_K );
42
+ if ( empty( $attachments ) ) {
43
+ return $query;
44
+ }
45
+
46
+ $ids = array();
47
+
48
+ // get attachments who are post thumbnails
49
+ $posts = $wpdb->get_col( $query );
50
+ if ( $posts ) {
51
+ $ids = $wpdb->get_col( sprintf( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_thumbnail_id' AND post_id IN(%s)", implode( ',', $posts ) ) );
52
+ }
53
+
54
+ // get atachments who have a post parent.
55
+ foreach ( $attachments as $id => $att ) {
56
+ if ( in_array( $att->post_parent, $posts ) ) {
57
+ $ids[] = $id;
58
+ }
59
+ }
60
+
61
+ $ids = array_unique( $ids );
62
+ if ( count( $ids ) === 0 ) {
63
+ return $query;
64
+ }
65
+
66
+ if ( 0 === strpos( $query, "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} " ) ) {
67
+ // replace INNER JOIN with LEFT JOIN.
68
+ $query = str_replace( "SELECT ID FROM {$wpdb->posts} INNER JOIN {$wpdb->term_relationships} ", "SELECT ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ", $query );
69
+ }
70
+ $query .= sprintf( " OR {$wpdb->posts}.ID IN (%s) ", implode( ',', $ids ) );
71
+
72
+ }
73
+ return $query;
74
+ }
75
+
76
+
77
+ }
78
+
79
+ new Strong_Testimonials_Exporter();
80
+
admin/class-strong-testimonials-help.php CHANGED
@@ -1,226 +1,226 @@
1
- <?php
2
- /**
3
- * Contextual help.
4
- */
5
-
6
- class Strong_Testimonials_Help {
7
-
8
- public function __construct() {}
9
-
10
- public static function init() {
11
- add_action( 'load-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'fields_editor' ) );
12
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'views_list' ) );
13
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'shortcode_attributes' ) );
14
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_pagination' ) );
15
- add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_stretch' ) );
16
-
17
- add_action( 'load-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'settings_compat' ) );
18
- }
19
-
20
- /**
21
- * Compatibility settings.
22
- */
23
- public static function settings_compat() {
24
- if ( ! isset( $_GET['tab'] ) || 'compat' != $_GET['tab'] ) {
25
- return;
26
- }
27
-
28
- ob_start();
29
- ?>
30
- <p><?php _e( 'Normally, a web page will load its stylesheets (font, color, size, etc.) before the content. When the content is displayed, the style is ready and the page appears as it was designed.', 'strong-testimonials' ); ?></p>
31
- <p><?php _e( 'When a browser displays the content before all the stylesheets have been loaded, a flash of unstyled content can occur.', 'strong-testimonials' ); ?></p>
32
- <p>
33
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' ) ); ?>
34
- |
35
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://codepen.io/micikato/full/JroPNm/' ) ); ?>
36
- |
37
- <?php printf( wp_kses( __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://css-tricks.com/fout-foit-foft/' ) ); ?>
38
- </p>
39
- <p><?php _e( 'When this occurs with plugins that use shortcodes, it means the plugin\'s stylesheet was enqueued when the shortcode was rendered so it gets loaded after the content instead of in the normal sequence.', 'strong-testimonials' ); ?></p>
40
- <p><?php _e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
41
- <?php
42
- $content = ob_get_clean();
43
-
44
- get_current_screen()->add_help_tab( array(
45
- 'id' => 'wpmtst-help-prerender',
46
- 'title' => __( 'Prerender', 'strong-testimonials' ),
47
- 'content' => $content,
48
- ) );
49
- }
50
-
51
- /**
52
- * Custom fields editor.
53
- */
54
- public static function fields_editor() {
55
- ob_start();
56
- ?>
57
- <p><?php _e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
58
- <p><?php _e( 'This editor serves two purposes: (1) to modify the form as it appears on your site, and (2) to modify the custom fields added to each testimonial.', 'strong-testimonials' ); ?></p>
59
- <p><?php _e( 'The default fields are designed to fit most situations. You can quickly add or remove fields and change several display properties.', 'strong-testimonials' ); ?></p>
60
- <p><?php _e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( __( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
61
- <p><?php _e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
62
- <?php
63
- $content = ob_get_clean();
64
-
65
- // Links
66
-
67
- $links = array(
68
- '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
69
- );
70
-
71
- $content .= '<p>' . implode( ' | ', $links ) . '</p>';
72
-
73
- get_current_screen()->add_help_tab( array(
74
- 'id' => 'wpmtst-help',
75
- 'title' => __( 'Form Fields', 'strong-testimonials' ),
76
- 'content' => $content,
77
- ) );
78
- }
79
-
80
- /**
81
- * About views.
82
- */
83
- public static function views_list() {
84
- ob_start();
85
- ?>
86
- <div>
87
- <p><?php _e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
88
- <p><?php _e( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ); ?></p>
89
- <p><?php _e( 'For example:', 'strong-testimonials' ); ?></p>
90
- <ul class="standard">
91
- <li><?php _e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
92
- <li><?php _e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
93
- <li><?php _e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
94
- <?php do_action( 'wpmtst_views_intro_list' ); ?>
95
- </ul>
96
- <p><?php _e( 'Add a view to a page with its unique shortcode or add it to a sidebar with the Strong Testimonials widget.', 'strong-testimonials' ); ?></p>
97
- </div>
98
- <?php
99
- $content = ob_get_clean();
100
-
101
- get_current_screen()->add_help_tab( array(
102
- 'id' => 'wpmtst-help-views',
103
- 'title' => __( 'About Views', 'strong-testimonials' ),
104
- 'content' => $content,
105
- ) );
106
- }
107
-
108
- /**
109
- * Shortcode attributes.
110
- */
111
- public static function shortcode_attributes() {
112
- if ( ! isset( $_GET['action'] ) ) {
113
- return;
114
- }
115
-
116
- ob_start();
117
- ?>
118
- <div>
119
- <p><?php echo wp_kses_post( _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ) ); ?>
120
- <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
121
- <p><?php echo wp_kses_post( _e( 'For example, imagine you have five services, a sales page for each service, and a testimonial category for each service. To display the testimonials on each service page, you can create five duplicate views, one for each category.', 'strong-testimonials' ) ); ?>
122
- <p><?php echo wp_kses_post( _e( 'Or you can configure one view as a pattern and add it to each service page with the <code>category</code> attribute.', 'strong-testimonials' ) ); ?>
123
- <p>
124
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-1"]</code>' ); ?>,
125
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-2"]</code>' ); ?>, etc.
126
- </p>
127
- <p>
128
- <?php echo wp_kses_post( _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
129
- <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>' ); ?>
130
- </p>
131
- <p><?php echo wp_kses_post( _e( 'Using <code>post_ids</code> is the most specific method and it will override category and count (whether settings or attributes).', 'strong-testimonials' ) ); ?></p>
132
- </div>
133
- <?php
134
- $content = ob_get_clean();
135
-
136
- get_current_screen()->add_help_tab( array(
137
- 'id' => 'wpmtst-help-shortcode',
138
- 'title' => __( 'Shortcode Attributes', 'strong-testimonials' ),
139
- 'content' => $content,
140
- ) );
141
- }
142
-
143
- /**
144
- * Pagination comparison.
145
- */
146
- public static function view_editor_pagination() {
147
- if ( ! isset( $_GET['action'] ) ) {
148
- return;
149
- }
150
-
151
- ob_start();
152
- ?>
153
- <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
154
-
155
- <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
156
- <thead>
157
- <tr>
158
- <th></th>
159
- <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
160
- <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
161
- </tr>
162
- </thead>
163
- <tbody>
164
- <tr>
165
- <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
166
- <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
167
- <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
168
- </tr>
169
- <tr>
170
- <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
171
- <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
172
- <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
173
- </tr>
174
- <tr>
175
- <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
176
- <td><?php esc_html_e( 'It does not remember which page of testimonials you are on. If you click away &ndash; for example, on a "Read more" link &ndash; then click back, you will return to page one.', 'strong-testimonials' ); ?></td>
177
- <td><?php esc_html_e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td>
178
- </tr>
179
- <tr>
180
- <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
181
- <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
182
- <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
183
- </tr>
184
- <tr>
185
- <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
186
- <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
187
- <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
188
- </tr>
189
- </tbody>
190
- </table>
191
- <?php
192
- $content = ob_get_clean();
193
-
194
- get_current_screen()->add_help_tab( array(
195
- 'id' => 'wpmtst-help-pagination',
196
- 'title' => __( 'Pagination', 'strong-testimonials' ),
197
- 'content' => $content,
198
- ) );
199
- }
200
-
201
- /**
202
- * Slideshow stretch explanation.
203
- */
204
- public static function view_editor_stretch() {
205
- if ( ! isset( $_GET['action'] ) ) {
206
- return;
207
- }
208
-
209
- ob_start();
210
- ?>
211
- <p><?php _e( 'This will set the height of the <b>slideshow container</b> to match the tallest slide in order to keep elements below it from bouncing up and down during slide transitions. With testimonials of uneven length, the result is whitespace underneath the shorter testimonials.', 'strong-testimonials' ); ?></p>
212
- <p><?php _e( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
213
- <p><?php _e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
214
- <?php
215
- $content = ob_get_clean();
216
-
217
- get_current_screen()->add_help_tab( array(
218
- 'id' => 'wpmtst-help-stretch',
219
- 'title' => __( 'Stretch', 'strong-testimonials' ),
220
- 'content' => $content,
221
- ) );
222
- }
223
-
224
- }
225
-
226
- Strong_Testimonials_Help::init();
1
+ <?php
2
+ /**
3
+ * Contextual help.
4
+ */
5
+
6
+ class Strong_Testimonials_Help {
7
+
8
+ public function __construct() {}
9
+
10
+ public static function init() {
11
+ add_action( 'load-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'fields_editor' ) );
12
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'views_list' ) );
13
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'shortcode_attributes' ) );
14
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_pagination' ) );
15
+ add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_stretch' ) );
16
+
17
+ add_action( 'load-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'settings_compat' ) );
18
+ }
19
+
20
+ /**
21
+ * Compatibility settings.
22
+ */
23
+ public static function settings_compat() {
24
+ if ( ! isset( $_GET['tab'] ) || 'compat' != $_GET['tab'] ) {
25
+ return;
26
+ }
27
+
28
+ ob_start();
29
+ ?>
30
+ <p><?php _e( 'Normally, a web page will load its stylesheets (font, color, size, etc.) before the content. When the content is displayed, the style is ready and the page appears as it was designed.', 'strong-testimonials' ); ?></p>
31
+ <p><?php _e( 'When a browser displays the content before all the stylesheets have been loaded, a flash of unstyled content can occur.', 'strong-testimonials' ); ?></p>
32
+ <p>
33
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' ) ); ?>
34
+ |
35
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://codepen.io/micikato/full/JroPNm/' ) ); ?>
36
+ |
37
+ <?php printf( wp_kses( __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://css-tricks.com/fout-foit-foft/' ) ); ?>
38
+ </p>
39
+ <p><?php _e( 'When this occurs with plugins that use shortcodes, it means the plugin\'s stylesheet was enqueued when the shortcode was rendered so it gets loaded after the content instead of in the normal sequence.', 'strong-testimonials' ); ?></p>
40
+ <p><?php _e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
41
+ <?php
42
+ $content = ob_get_clean();
43
+
44
+ get_current_screen()->add_help_tab( array(
45
+ 'id' => 'wpmtst-help-prerender',
46
+ 'title' => __( 'Prerender', 'strong-testimonials' ),
47
+ 'content' => $content,
48
+ ) );
49
+ }
50
+
51
+ /**
52
+ * Custom fields editor.
53
+ */
54
+ public static function fields_editor() {
55
+ ob_start();
56
+ ?>
57
+ <p><?php _e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
58
+ <p><?php _e( 'This editor serves two purposes: (1) to modify the form as it appears on your site, and (2) to modify the custom fields added to each testimonial.', 'strong-testimonials' ); ?></p>
59
+ <p><?php _e( 'The default fields are designed to fit most situations. You can quickly add or remove fields and change several display properties.', 'strong-testimonials' ); ?></p>
60
+ <p><?php _e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( __( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
61
+ <p><?php _e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
62
+ <?php
63
+ $content = ob_get_clean();
64
+
65
+ // Links
66
+
67
+ $links = array(
68
+ '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
69
+ );
70
+
71
+ $content .= '<p>' . implode( ' | ', $links ) . '</p>';
72
+
73
+ get_current_screen()->add_help_tab( array(
74
+ 'id' => 'wpmtst-help',
75
+ 'title' => __( 'Form Fields', 'strong-testimonials' ),
76
+ 'content' => $content,
77
+ ) );
78
+ }
79
+
80
+ /**
81
+ * About views.
82
+ */
83
+ public static function views_list() {
84
+ ob_start();
85
+ ?>
86
+ <div>
87
+ <p><?php _e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
88
+ <p><?php _e( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ); ?></p>
89
+ <p><?php _e( 'For example:', 'strong-testimonials' ); ?></p>
90
+ <ul class="standard">
91
+ <li><?php _e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
92
+ <li><?php _e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
93
+ <li><?php _e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
94
+ <?php do_action( 'wpmtst_views_intro_list' ); ?>
95
+ </ul>
96
+ <p><?php _e( 'Add a view to a page with its unique shortcode or add it to a sidebar with the Strong Testimonials widget.', 'strong-testimonials' ); ?></p>
97
+ </div>
98
+ <?php
99
+ $content = ob_get_clean();
100
+
101
+ get_current_screen()->add_help_tab( array(
102
+ 'id' => 'wpmtst-help-views',
103
+ 'title' => __( 'About Views', 'strong-testimonials' ),
104
+ 'content' => $content,
105
+ ) );
106
+ }
107
+
108
+ /**
109
+ * Shortcode attributes.
110
+ */
111
+ public static function shortcode_attributes() {
112
+ if ( ! isset( $_GET['action'] ) ) {
113
+ return;
114
+ }
115
+
116
+ ob_start();
117
+ ?>
118
+ <div>
119
+ <p><?php echo wp_kses_post( _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ) ); ?>
120
+ <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
121
+ <p><?php echo wp_kses_post( _e( 'For example, imagine you have five services, a sales page for each service, and a testimonial category for each service. To display the testimonials on each service page, you can create five duplicate views, one for each category.', 'strong-testimonials' ) ); ?>
122
+ <p><?php echo wp_kses_post( _e( 'Or you can configure one view as a pattern and add it to each service page with the <code>category</code> attribute.', 'strong-testimonials' ) ); ?>
123
+ <p>
124
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-1"]</code>' ); ?>,
125
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-2"]</code>' ); ?>, etc.
126
+ </p>
127
+ <p>
128
+ <?php echo wp_kses_post( _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
129
+ <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>' ); ?>
130
+ </p>
131
+ <p><?php echo wp_kses_post( _e( 'Using <code>post_ids</code> is the most specific method and it will override category and count (whether settings or attributes).', 'strong-testimonials' ) ); ?></p>
132
+ </div>
133
+ <?php
134
+ $content = ob_get_clean();
135
+
136
+ get_current_screen()->add_help_tab( array(
137
+ 'id' => 'wpmtst-help-shortcode',
138
+ 'title' => __( 'Shortcode Attributes', 'strong-testimonials' ),
139
+ 'content' => $content,
140
+ ) );
141
+ }
142
+
143
+ /**
144
+ * Pagination comparison.
145
+ */
146
+ public static function view_editor_pagination() {
147
+ if ( ! isset( $_GET['action'] ) ) {
148
+ return;
149
+ }
150
+
151
+ ob_start();
152
+ ?>
153
+ <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
154
+
155
+ <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
156
+ <thead>
157
+ <tr>
158
+ <th></th>
159
+ <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
160
+ <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
161
+ </tr>
162
+ </thead>
163
+ <tbody>
164
+ <tr>
165
+ <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
166
+ <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
167
+ <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
168
+ </tr>
169
+ <tr>
170
+ <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
171
+ <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
172
+ <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
173
+ </tr>
174
+ <tr>
175
+ <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
176
+ <td><?php esc_html_e( 'It does not remember which page of testimonials you are on. If you click away &ndash; for example, on a "Read more" link &ndash; then click back, you will return to page one.', 'strong-testimonials' ); ?></td>
177
+ <td><?php esc_html_e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td>
178
+ </tr>
179
+ <tr>
180
+ <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
181
+ <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
182
+ <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
183
+ </tr>
184
+ <tr>
185
+ <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
186
+ <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td>
187
+ <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td>
188
+ </tr>
189
+ </tbody>
190
+ </table>
191
+ <?php
192
+ $content = ob_get_clean();
193
+
194
+ get_current_screen()->add_help_tab( array(
195
+ 'id' => 'wpmtst-help-pagination',
196
+ 'title' => __( 'Pagination', 'strong-testimonials' ),
197
+ 'content' => $content,
198
+ ) );
199
+ }
200
+
201
+ /**
202
+ * Slideshow stretch explanation.
203
+ */
204
+ public static function view_editor_stretch() {
205
+ if ( ! isset( $_GET['action'] ) ) {
206
+ return;
207
+ }
208
+
209
+ ob_start();
210
+ ?>
211
+ <p><?php _e( 'This will set the height of the <b>slideshow container</b> to match the tallest slide in order to keep elements below it from bouncing up and down during slide transitions. With testimonials of uneven length, the result is whitespace underneath the shorter testimonials.', 'strong-testimonials' ); ?></p>
212
+ <p><?php _e( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
213
+ <p><?php _e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
214
+ <?php
215
+ $content = ob_get_clean();
216
+
217
+ get_current_screen()->add_help_tab( array(
218
+ 'id' => 'wpmtst-help-stretch',
219
+ 'title' => __( 'Stretch', 'strong-testimonials' ),
220
+ 'content' => $content,
221
+ ) );
222
+ }
223
+
224
+ }
225
+
226
+ Strong_Testimonials_Help::init();
admin/class-strong-testimonials-list-table.php CHANGED
@@ -1,1212 +1,1212 @@
1
- <?php
2
- /**
3
- * Base class for displaying a list of items in an ajaxified HTML table.
4
- *
5
- * -!- This is a copy of /wp-admin/includes/class-wp-list-table.php. -!-
6
- * See Codex for reasoning.
7
- * @link http://codex.wordpress.org/Class_Reference/WP_List_Table
8
- *
9
- * @since 3.1.0
10
- * @access private
11
- */
12
-
13
- if ( ! class_exists( 'Strong_Testimonials_List_Table' ) ) :
14
-
15
- class Strong_Testimonials_List_Table {
16
-
17
- /**
18
- * The current list of items
19
- *
20
- * @since 3.1.0
21
- * @var array
22
- * @access public
23
- */
24
- public $items;
25
-
26
- /**
27
- * Various information about the current table
28
- *
29
- * @since 3.1.0
30
- * @var array
31
- * @access protected
32
- */
33
- protected $_args;
34
-
35
- /**
36
- * Various information needed for displaying the pagination
37
- *
38
- * @since 3.1.0
39
- * @var array
40
- */
41
- protected $_pagination_args = array();
42
-
43
- /**
44
- * The current screen
45
- *
46
- * @since 3.1.0
47
- * @var object
48
- * @access protected
49
- */
50
- protected $screen;
51
-
52
- /**
53
- * Cached bulk actions
54
- *
55
- * @since 3.1.0
56
- * @var array
57
- * @access private
58
- */
59
- private $_actions;
60
-
61
- /**
62
- * Cached pagination output
63
- *
64
- * @since 3.1.0
65
- * @var string
66
- * @access private
67
- */
68
- private $_pagination;
69
-
70
- /**
71
- * The view switcher modes.
72
- *
73
- * @since 4.1.0
74
- * @var array
75
- * @access protected
76
- */
77
- protected $modes = array();
78
-
79
- /**
80
- * Stores the value returned by ->get_column_info()
81
- *
82
- * @var array
83
- */
84
- protected $_column_headers;
85
-
86
- protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
87
-
88
- protected $compat_methods = array(
89
- 'set_pagination_args',
90
- 'get_views',
91
- 'get_bulk_actions',
92
- 'bulk_actions',
93
- 'row_actions',
94
- 'months_dropdown',
95
- 'view_switcher',
96
- 'comments_bubble',
97
- 'get_items_per_page',
98
- 'pagination',
99
- 'get_sortable_columns',
100
- 'get_column_info',
101
- 'get_table_classes',
102
- 'display_tablenav',
103
- 'extra_tablenav',
104
- 'single_row_columns',
105
- );
106
-
107
- /**
108
- * Constructor.
109
- *
110
- * The child class should call this constructor from its own constructor to override
111
- * the default $args.
112
- *
113
- * @since 3.1.0
114
- * @access public
115
- *
116
- * @param array|string $args {
117
- * Array or string of arguments.
118
- *
119
- * @type string $plural Plural value used for labels and the objects being listed.
120
- * This affects things such as CSS class-names and nonces used
121
- * in the list table, e.g. 'posts'. Default empty.
122
- * @type string $singular Singular label for an object being listed, e.g. 'post'.
123
- * Default empty
124
- * @type bool $ajax Whether the list table supports AJAX. This includes loading
125
- * and sorting data, for example. If true, the class will call
126
- * the {@see _js_vars()} method in the footer to provide variables
127
- * to any scripts handling AJAX events. Default false.
128
- * @type string $screen String containing the hook name used to determine the current
129
- * screen. If left null, the current screen will be automatically set.
130
- * Default null.
131
- * }
132
- */
133
- public function __construct( $args = array() ) {
134
- $args = wp_parse_args(
135
- $args,
136
- array(
137
- 'plural' => '',
138
- 'singular' => '',
139
- 'ajax' => false,
140
- 'screen' => null,
141
- )
142
- );
143
-
144
- $this->screen = convert_to_screen( $args['screen'] );
145
-
146
- add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
147
-
148
- if ( ! $args['plural'] ) {
149
- $args['plural'] = $this->screen->base;
150
- }
151
-
152
- $args['plural'] = sanitize_key( $args['plural'] );
153
- $args['singular'] = sanitize_key( $args['singular'] );
154
-
155
- $this->_args = $args;
156
-
157
- if ( $args['ajax'] ) {
158
- // wp_enqueue_script( 'list-table' );
159
- add_action( 'admin_footer', array( $this, '_js_vars' ) );
160
- }
161
-
162
- if ( empty( $this->modes ) ) {
163
- $this->modes = array(
164
- 'list' => __( 'List View', 'strong-testimonials' ),
165
- 'excerpt' => __( 'Excerpt View', 'strong-testimonials' ),
166
- );
167
- }
168
- }
169
-
170
- /**
171
- * Make private properties readable for backwards compatibility.
172
- *
173
- * @since 4.0.0
174
- * @access public
175
- *
176
- * @param string $name Property to get.
177
- * @return mixed Property.
178
- */
179
- public function __get( $name ) {
180
- if ( in_array( $name, $this->compat_fields ) ) {
181
- return $this->$name;
182
- }
183
- }
184
-
185
- /**
186
- * Make private properties settable for backwards compatibility.
187
- *
188
- * @since 4.0.0
189
- * @access public
190
- *
191
- * @param string $name Property to check if set.
192
- * @param mixed $value Property value.
193
- * @return mixed Newly-set property.
194
- */
195
- public function __set( $name, $value ) {
196
- if ( in_array( $name, $this->compat_fields ) ) {
197
- return $this->$name = $value;
198
- }
199
- }
200
-
201
- /**
202
- * Make private properties checkable for backwards compatibility.
203
- *
204
- * @since 4.0.0
205
- * @access public
206
- *
207
- * @param string $name Property to check if set.
208
- * @return bool Whether the property is set.
209
- */
210
- public function __isset( $name ) {
211
- if ( in_array( $name, $this->compat_fields ) ) {
212
- return isset( $this->$name );
213
- }
214
- }
215
-
216
- /**
217
- * Make private properties un-settable for backwards compatibility.
218
- *
219
- * @since 4.0.0
220
- * @access public
221
- *
222
- * @param string $name Property to unset.
223
- */
224
- public function __unset( $name ) {
225
- if ( in_array( $name, $this->compat_fields ) ) {
226
- unset( $this->$name );
227
- }
228
- }
229
-
230
- /**
231
- * Make private/protected methods readable for backwards compatibility.
232
- *
233
- * @since 4.0.0
234
- * @access public
235
- *
236
- * @param callable $name Method to call.
237
- * @param array $arguments Arguments to pass when calling.
238
- * @return mixed|bool Return value of the callback, false otherwise.
239
- */
240
- public function __call( $name, $arguments ) {
241
- if ( in_array( $name, $this->compat_methods ) ) {
242
- return call_user_func_array( array( $this, $name ), $arguments );
243
- }
244
- return false;
245
- }
246
-
247
- /**
248
- * Checks the current user's permissions
249
- *
250
- * @since 3.1.0
251
- * @access public
252
- * @abstract
253
- */
254
- public function ajax_user_can() {
255
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
256
- }
257
-
258
- /**
259
- * Prepares the list of items for displaying.
260
- * @uses WP_List_Table::set_pagination_args()
261
- *
262
- * @since 3.1.0
263
- * @access public
264
- * @abstract
265
- */
266
- public function prepare_items() {
267
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
268
- }
269
-
270
- /**
271
- * An internal method that sets all the necessary pagination arguments
272
- *
273
- * @param array $args An associative array with information about the pagination
274
- * @access protected
275
- */
276
- protected function set_pagination_args( $args ) {
277
- $args = wp_parse_args(
278
- $args,
279
- array(
280
- 'total_items' => 0,
281
- 'total_pages' => 0,
282
- 'per_page' => 0,
283
- )
284
- );
285
-
286
- if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
287
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
288
- }
289
-
290
- // Redirect if page number is invalid and headers are not already sent.
291
- if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
292
- wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
293
- exit;
294
- }
295
-
296
- $this->_pagination_args = $args;
297
- }
298
-
299
- /**
300
- * Access the pagination args.
301
- *
302
- * @since 3.1.0
303
- * @access public
304
- *
305
- * @param string $key Pagination argument to retrieve. Common values include 'total_items',
306
- * 'total_pages', 'per_page', or 'infinite_scroll'.
307
- * @return int Number of items that correspond to the given pagination argument.
308
- */
309
- public function get_pagination_arg( $key ) {
310
- if ( 'page' == $key ) {
311
- return $this->get_pagenum();
312
- }
313
-
314
- if ( isset( $this->_pagination_args[ $key ] ) ) {
315
- return $this->_pagination_args[ $key ];
316
- }
317
- }
318
-
319
- /**
320
- * Whether the table has items to display or not
321
- *
322
- * @since 3.1.0
323
- * @access public
324
- *
325
- * @return bool
326
- */
327
- public function has_items() {
328
- return ! empty( $this->items );
329
- }
330
-
331
- /**
332
- * Message to be displayed when there are no items
333
- *
334
- * @since 3.1.0
335
- * @access public
336
- */
337
- public function no_items() {
338
- esc_html_e( 'No items found.', 'strong-testimonials' );
339
- }
340
-
341
- /**
342
- * Display the search box.
343
- *
344
- * @since 3.1.0
345
- * @access public
346
- *
347
- * @param string $text The search button text
348
- * @param string $input_id The search input id
349
- */
350
- public function search_box( $text, $input_id ) {
351
- if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
- return;
353
- }
354
-
355
- $input_id = $input_id . '-search-input';
356
-
357
- if ( ! empty( $_REQUEST['orderby'] ) ) {
358
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
359
- }
360
- if ( ! empty( $_REQUEST['order'] ) ) {
361
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
362
- }
363
- if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
- echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
365
- }
366
- if ( ! empty( $_REQUEST['detached'] ) ) {
367
- echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
368
- }
369
- ?>
370
- <p class="search-box">
371
- <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
372
- <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>">
373
- <?php submit_button( $text, 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
374
- </p>
375
- <?php
376
- }
377
-
378
- /**
379
- * Get an associative array ( id => link ) with the list
380
- * of views available on this table.
381
- *
382
- * @since 3.1.0
383
- * @access protected
384
- *
385
- * @return array
386
- */
387
- protected function get_views() {
388
- return array();
389
- }
390
-
391
- /**
392
- * Display the list of views available on this table.
393
- *
394
- * @since 3.1.0
395
- * @access public
396
- */
397
- public function views() {
398
- $views = $this->get_views();
399
- /**
400
- * Filter the list of available list table views.
401
- *
402
- * The dynamic portion of the hook name, `$this->screen->id`, refers
403
- * to the ID of the current screen, usually a string.
404
- *
405
- * @since 3.5.0
406
- *
407
- * @param array $views An array of available list table views.
408
- */
409
- $views = apply_filters( "views_{$this->screen->id}", $views );
410
-
411
- if ( empty( $views ) ) {
412
- return;
413
- }
414
-
415
- echo "<ul class='subsubsub'>\n";
416
- foreach ( $views as $class => $view ) {
417
- $views[ $class ] = "\t<li class='$class'>$view";
418
- }
419
- echo implode( " |</li>\n", wp_kses_post( $views ) ) . "</li>\n";
420
- echo '</ul>';
421
- }
422
-
423
- /**
424
- * Get an associative array ( option_name => option_title ) with the list
425
- * of bulk actions available on this table.
426
- *
427
- * @since 3.1.0
428
- * @access protected
429
- *
430
- * @return array
431
- */
432
- protected function get_bulk_actions() {
433
- return array();
434
- }
435
-
436
- /**
437
- * Display the bulk actions dropdown.
438
- *
439
- * @since 3.1.0
440
- * @access protected
441
- *
442
- * @param string $which The location of the bulk actions: 'top' or 'bottom'.
443
- * This is designated as optional for backwards-compatibility.
444
- */
445
- protected function bulk_actions( $which = '' ) {
446
- if ( is_null( $this->_actions ) ) {
447
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
448
- /**
449
- * Filter the list table Bulk Actions drop-down.
450
- *
451
- * The dynamic portion of the hook name, `$this->screen->id`, refers
452
- * to the ID of the current screen, usually a string.
453
- *
454
- * This filter can currently only be used to remove bulk actions.
455
- *
456
- * @since 3.5.0
457
- *
458
- * @param array $actions An array of the available bulk actions.
459
- */
460
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
461
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
462
- $two = '';
463
- } else {
464
- $two = '2';
465
- }
466
-
467
- if ( empty( $this->_actions ) ) {
468
- return;
469
- }
470
-
471
- echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_html__( 'Select bulk action', 'strong-testimonials' ) . '</label>';
472
- echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
473
- echo "<option value='-1' selected='selected'>" . esc_html__( 'Bulk Actions', 'strong-testimonials' ) . "</option>\n";
474
-
475
- foreach ( $this->_actions as $name => $title ) {
476
- $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
477
-
478
- echo "\t<option value='$name'$class>$title</option>\n";
479
- }
480
-
481
- echo "</select>\n";
482
-
483
- submit_button( __( 'Apply', 'strong-testimonials' ), 'action', '', false, array( 'id' => "doaction$two" ) );
484
- echo "\n";
485
- }
486
-
487
- /**
488
- * Get the current action selected from the bulk actions dropdown.
489
- *
490
- * @since 3.1.0
491
- * @access public
492
- *
493
- * @return string|bool The action name or False if no action was selected
494
- */
495
- public function current_action() {
496
- if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
497
- return false;
498
- }
499
-
500
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
501
- return $_REQUEST['action'];
502
- }
503
-
504
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
505
- return $_REQUEST['action2'];
506
- }
507
-
508
- return false;
509
- }
510
-
511
- /**
512
- * Generate row actions div
513
- *
514
- * @since 3.1.0
515
- * @access protected
516
- *
517
- * @param array $actions The list of actions
518
- * @param bool $always_visible Whether the actions should be always visible
519
- * @return string
520
- */
521
- protected function row_actions( $actions, $always_visible = false ) {
522
- $action_count = count( $actions );
523
- $i = 0;
524
-
525
- if ( ! $action_count ) {
526
- return '';
527
- }
528
-
529
- $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
530
- foreach ( $actions as $action => $link ) {
531
- ++$i;
532
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
533
- $out .= "<span class='$action'>$link$sep</span>";
534
- }
535
- $out .= '</div>';
536
-
537
- return $out;
538
- }
539
-
540
- /**
541
- * Display a monthly dropdown for filtering items
542
- *
543
- * @since 3.1.0
544
- * @access protected
545
- *
546
- * @param string $post_type
547
- */
548
- protected function months_dropdown( $post_type ) {
549
- global $wpdb, $wp_locale;
550
-
551
- /**
552
- * Filter whether to remove the 'Months' drop-down from the post list table.
553
- *
554
- * @since 4.2.0
555
- *
556
- * @param bool $disable Whether to disable the drop-down. Default false.
557
- * @param string $post_type The post type.
558
- */
559
- if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
560
- return;
561
- }
562
-
563
- $months = $wpdb->get_results(
564
- $wpdb->prepare(
565
- "
566
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
567
- FROM $wpdb->posts
568
- WHERE post_type = %s
569
- ORDER BY post_date DESC
570
- ",
571
- $post_type
572
- )
573
- );
574
-
575
- /**
576
- * Filter the 'Months' drop-down results.
577
- *
578
- * @since 3.7.0
579
- *
580
- * @param object $months The months drop-down query results.
581
- * @param string $post_type The post type.
582
- */
583
- $months = apply_filters( 'months_dropdown_results', $months, $post_type );
584
-
585
- $month_count = count( $months );
586
-
587
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
588
- return;
589
- }
590
-
591
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
592
- ?>
593
- <label for="filter-by-date" class="screen-reader-text"><?php esc_html_e( 'Filter by date', 'strong-testimonials' ); ?></label>
594
- <select name="m" id="filter-by-date">
595
- <option<?php selected( $m, 0 ); ?> value="0"><?php esc_html_e( 'All dates', 'strong-testimonials' ); ?></option>
596
- <?php
597
- foreach ( $months as $arc_row ) {
598
- if ( 0 == $arc_row->year ) {
599
- continue;
600
- }
601
-
602
- $month = zeroise( $arc_row->month, 2 );
603
- $year = $arc_row->year;
604
-
605
- printf(
606
- "<option %s value='%s'>%s</option>\n",
607
- selected( $m, $year . $month, false ),
608
- esc_attr( $arc_row->year . $month ),
609
- /* translators: 1: month name, 2: 4-digit year */
610
- sprintf( '%1$s %2$d', $wp_locale->get_month( $month ), $year )
611
- );
612
- }
613
- ?>
614
- </select>
615
- <?php
616
- }
617
-
618
- /**
619
- * Display a view switcher
620
- *
621
- * @since 3.1.0
622
- * @access protected
623
- *
624
- * @param string $current_mode
625
- */
626
- protected function view_switcher( $current_mode ) {
627
- ?>
628
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
629
- <div class="view-switch">
630
- <?php
631
- foreach ( $this->modes as $mode => $title ) {
632
- $classes = array( 'view-' . $mode );
633
- if ( $current_mode == $mode ) {
634
- $classes[] = 'current';
635
- }
636
- printf(
637
- "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
638
- esc_url( add_query_arg( 'mode', $mode ) ),
639
- implode( ' ', $classes ),
640
- $title
641
- );
642
- }
643
- ?>
644
- </div>
645
- <?php
646
- }
647
-
648
- /**
649
- * Display a comment count bubble
650
- *
651
- * @since 3.1.0
652
- * @access protected
653
- *
654
- * @param int $post_id The post ID.
655
- * @param int $pending_comments Number of pending comments.
656
- */
657
- protected function comments_bubble( $post_id, $pending_comments ) {
658
- $pending_phrase = sprintf( __( '%s pending', 'strong-testimonials' ), number_format( $pending_comments ) );
659
-
660
- if ( $pending_comments ) {
661
- echo '<strong>';
662
- }
663
-
664
- echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . '</span></a>';
665
-
666
- if ( $pending_comments ) {
667
- echo '</strong>';
668
- }
669
- }
670
-
671
- /**
672
- * Get the current page number
673
- *
674
- * @since 3.1.0
675
- * @access public
676
- *
677
- * @return int
678
- */
679
- public function get_pagenum() {
680
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
681
-
682
- if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
683
- $pagenum = $this->_pagination_args['total_pages'];
684
- }
685
-
686
- return max( 1, $pagenum );
687
- }
688
-
689
- /**
690
- * Get number of items to display on a single page
691
- *
692
- * @since 3.1.0
693
- * @access protected
694
- *
695
- * @param string $option
696
- * @param int $default
697
- * @return int
698
- */
699
- protected function get_items_per_page( $option, $default = 20 ) {
700
- $per_page = (int) get_user_option( $option );
701
- if ( empty( $per_page ) || $per_page < 1 ) {
702
- $per_page = $default;
703
- }
704
-
705
- /**
706
- * Filter the number of items to be displayed on each page of the list table.
707
- *
708
- * The dynamic hook name, $option, refers to the `per_page` option depending
709
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
710
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
711
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
712
- * 'edit_{$post_type}_per_page', etc.
713
- *
714
- * @since 2.9.0
715
- *
716
- * @param int $per_page Number of items to be displayed. Default 20.
717
- */
718
- return (int) apply_filters( $option, $per_page );
719
- }
720
-
721
- /**
722
- * Display the pagination.
723
- *
724
- * @since 3.1.0
725
- * @access protected
726
- *
727
- * @param string $which
728
- */
729
- protected function pagination( $which ) {
730
- if ( empty( $this->_pagination_args ) ) {
731
- return;
732
- }
733
-
734
- $total_items = $this->_pagination_args['total_items'];
735
- $total_pages = $this->_pagination_args['total_pages'];
736
- $infinite_scroll = false;
737
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
738
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
739
- }
740
-
741
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items, 'strong-testimonials' ), number_format_i18n( $total_items ) ) . '</span>';
742
-
743
- $current = $this->get_pagenum();
744
-
745
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
746
-
747
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
748
-
749
- $page_links = array();
750
-
751
- $disable_first = $disable_last = '';
752
- if ( $current == 1 ) {
753
- $disable_first = ' disabled';
754
- }
755
- if ( $current == $total_pages ) {
756
- $disable_last = ' disabled';
757
- }
758
- $page_links[] = sprintf(
759
- "<a class='%s' title='%s' href='%s'>%s</a>",
760
- 'first-page' . $disable_first,
761
- esc_attr__( 'Go to the first page', 'strong-testimonials' ),
762
- esc_url( remove_query_arg( 'paged', $current_url ) ),
763
- '&laquo;'
764
- );
765
-
766
- $page_links[] = sprintf(
767
- "<a class='%s' title='%s' href='%s'>%s</a>",
768
- 'prev-page' . $disable_first,
769
- esc_attr__( 'Go to the previous page', 'strong-testimonials' ),
770
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
771
- '&lsaquo;'
772
- );
773
-
774
- if ( 'bottom' == $which ) {
775
- $html_current_page = $current;
776
- } else {
777
- $html_current_page = sprintf(
778
- "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
779
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page', 'strong-testimonials' ) . '</label>',
780
- esc_attr__( 'Current page', 'strong-testimonials' ),
781
- $current,
782
- strlen( $total_pages )
783
- );
784
- }
785
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
786
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging', 'strong-testimonials' ), $html_current_page, $html_total_pages ) . '</span>';
787
-
788
- $page_links[] = sprintf(
789
- "<a class='%s' title='%s' href='%s'>%s</a>",
790
- 'next-page' . $disable_last,
791
- esc_attr__( 'Go to the next page', 'strong-testimonials' ),
792
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
793
- '&rsaquo;'
794
- );
795
-
796
- $page_links[] = sprintf(
797
- "<a class='%s' title='%s' href='%s'>%s</a>",
798
- 'last-page' . $disable_last,
799
- esc_attr__( 'Go to the last page', 'strong-testimonials' ),
800
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
801
- '&raquo;'
802
- );
803
-
804
- $pagination_links_class = 'pagination-links';
805
- if ( ! empty( $infinite_scroll ) ) {
806
- $pagination_links_class = ' hide-if-js';
807
- }
808
- $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
809
-
810
- if ( $total_pages ) {
811
- $page_class = $total_pages < 2 ? ' one-page' : '';
812
- } else {
813
- $page_class = ' no-pages';
814
- }
815
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
816
-
817
- echo $this->_pagination;
818
- }
819
-
820
- /**
821
- * Get a list of columns. The format is:
822
- * 'internal-name' => 'Title'
823
- *
824
- * @since 3.1.0
825
- * @access public
826
- * @abstract
827
- *
828
- * @return array
829
- */
830
- public function get_columns() {
831
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
832
- }
833
-
834
- /**
835
- * Get a list of sortable columns. The format is:
836
- * 'internal-name' => 'orderby'
837
- * or
838
- * 'internal-name' => array( 'orderby', true )
839
- *
840
- * The second format will make the initial sorting order be descending
841
- *
842
- * @since 3.1.0
843
- * @access protected
844
- *
845
- * @return array
846
- */
847
- protected function get_sortable_columns() {
848
- return array();
849
- }
850
-
851
- /**
852
- * Get a list of all, hidden and sortable columns, with filter applied
853
- *
854
- * @since 3.1.0
855
- * @access protected
856
- *
857
- * @return array
858
- */
859
- protected function get_column_info() {
860
- if ( isset( $this->_column_headers ) ) {
861
- return $this->_column_headers;
862
- }
863
-
864
- $columns = get_column_headers( $this->screen );
865
- $hidden = get_hidden_columns( $this->screen );
866
-
867
- $sortable_columns = $this->get_sortable_columns();
868
- /**
869
- * Filter the list table sortable columns for a specific screen.
870
- *
871
- * The dynamic portion of the hook name, `$this->screen->id`, refers
872
- * to the ID of the current screen, usually a string.
873
- *
874
- * @since 3.5.0
875
- *
876
- * @param array $sortable_columns An array of sortable columns.
877
- */
878
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
879
-
880
- $sortable = array();
881
- foreach ( $_sortable as $id => $data ) {
882
- if ( empty( $data ) ) {
883
- continue;
884
- }
885
-
886
- $data = (array) $data;
887
- if ( ! isset( $data[1] ) ) {
888
- $data[1] = false;
889
- }
890
-
891
- $sortable[ $id ] = $data;
892
- }
893
-
894
- $this->_column_headers = array( $columns, $hidden, $sortable );
895
-
896
- return $this->_column_headers;
897
- }
898
-
899
- /**
900
- * Return number of visible columns
901
- *
902
- * @since 3.1.0
903
- * @access public
904
- *
905
- * @return int
906
- */
907
- public function get_column_count() {
908
- list ( $columns, $hidden ) = $this->get_column_info();
909
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
910
- return count( $columns ) - count( $hidden );
911
- }
912
-
913
- /**
914
- * Print column headers, accounting for hidden and sortable columns.
915
- *
916
- * @since 3.1.0
917
- * @access public
918
- *
919
- * @param bool $with_id Whether to set the id attribute or not
920
- */
921
- public function print_column_headers( $with_id = true ) {
922
- list( $columns, $hidden, $sortable ) = $this->get_column_info();
923
-
924
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
925
- $current_url = remove_query_arg( 'paged', $current_url );
926
-
927
- if ( isset( $_GET['orderby'] ) ) {
928
- $current_orderby = $_GET['orderby'];
929
- } else {
930
- $current_orderby = '';
931
- }
932
-
933
- if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) {
934
- $current_order = 'desc';
935
- } else {
936
- $current_order = 'asc';
937
- }
938
-
939
- if ( ! empty( $columns['cb'] ) ) {
940
- static $cb_counter = 1;
941
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'strong-testimonials' ) . '</label>'
942
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
943
- $cb_counter++;
944
- }
945
-
946
- foreach ( $columns as $column_key => $column_display_name ) {
947
- $class = array( 'manage-column', "column-$column_key" );
948
-
949
- $style = '';
950
- if ( in_array( $column_key, $hidden ) ) {
951
- $style = 'display:none;';
952
- }
953
-
954
- $style = ' style="' . $style . '"';
955
-
956
- if ( 'cb' == $column_key ) {
957
- $class[] = 'check-column';
958
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
959
- $class[] = 'num';
960
- }
961
-
962
- if ( isset( $sortable[ $column_key ] ) ) {
963
- list( $orderby, $desc_first ) = $sortable[ $column_key ];
964
-
965
- if ( $current_orderby == $orderby ) {
966
- $order = 'asc' == $current_order ? 'desc' : 'asc';
967
- $class[] = 'sorted';
968
- $class[] = $current_order;
969
- } else {
970
- $order = $desc_first ? 'desc' : 'asc';
971
- $class[] = 'sortable';
972
- $class[] = $desc_first ? 'asc' : 'desc';
973
- }
974
-
975
- $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
976
- }
977
-
978
- $id = $with_id ? "id='$column_key'" : '';
979
-
980
- if ( ! empty( $class ) ) {
981
- $class = "class='" . join( ' ', $class ) . "'";
982
- }
983
-
984
- echo "<th scope='col' $id $class $style>$column_display_name</th>";
985
- }
986
- }
987
-
988
- /**
989
- * Display the table
990
- *
991
- * @since 3.1.0
992
- * @access public
993
- */
994
- public function display() {
995
- $singular = $this->_args['singular'];
996
-
997
- $this->display_tablenav( 'top' );
998
-
999
- ?>
1000
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1001
- <thead>
1002
- <tr>
1003
- <?php $this->print_column_headers(); ?>
1004
- </tr>
1005
- </thead>
1006
-
1007
- <tbody id="the-list"
1008
- <?php
1009
- if ( $singular ) {
1010
- echo " data-wp-lists='list:$singular'";
1011
- }
1012
- ?>
1013
- >
1014
- <?php $this->display_rows_or_placeholder(); ?>
1015
- </tbody>
1016
-
1017
- <tfoot>
1018
- <tr>
1019
- <?php $this->print_column_headers( false ); ?>
1020
- </tr>
1021
- </tfoot>
1022
-
1023
- </table>
1024
- <?php
1025
- $this->display_tablenav( 'bottom' );
1026
- }
1027
-
1028
- /**
1029
- * Get a list of CSS classes for the list table table tag.
1030
- *
1031
- * @since 3.1.0
1032
- * @access protected
1033
- *
1034
- * @return array List of CSS classes for the table tag.
1035
- */
1036
- protected function get_table_classes() {
1037
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1038
- }
1039
-
1040
- /**
1041
- * Generate the table navigation above or below the table
1042
- *
1043
- * @since 3.1.0
1044
- * @access protected
1045
- * @param string $which
1046
- */
1047
- protected function display_tablenav( $which ) {
1048
- if ( 'top' == $which ) {
1049
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1050
- }
1051
- ?>
1052
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
1053
-
1054
- <div class="alignleft actions bulkactions">
1055
- <?php $this->bulk_actions( $which ); ?>
1056
- </div>
1057
- <?php
1058
- $this->extra_tablenav( $which );
1059
- $this->pagination( $which );
1060
- ?>
1061
-
1062
- <br class="clear">
1063
- </div>
1064
- <?php
1065
- }
1066
-
1067
- /**
1068
- * Extra controls to be displayed between bulk actions and pagination
1069
- *
1070
- * @since 3.1.0
1071
- * @access protected
1072
- *
1073
- * @param string $which
1074
- */
1075
- protected function extra_tablenav( $which ) {}
1076
-
1077
- /**
1078
- * Generate the tbody element for the list table.
1079
- *
1080
- * @since 3.1.0
1081
- * @access public
1082
- */
1083
- public function display_rows_or_placeholder() {
1084
- if ( $this->has_items() ) {
1085
- $this->display_rows();
1086
- } else {
1087
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1088
- $this->no_items();
1089
- echo '</td></tr>';
1090
- }
1091
- }
1092
-
1093
- /**
1094
- * Generate the table rows
1095
- *
1096
- * @since 3.1.0
1097
- * @access public
1098
- */
1099
- public function display_rows() {
1100
- foreach ( $this->items as $item ) {
1101
- $this->single_row( $item );
1102
- }
1103
- }
1104
-
1105
- /**
1106
- * Generates content for a single row of the table
1107
- *
1108
- * @since 3.1.0
1109
- * @access public
1110
- *
1111
- * @param object $item The current item
1112
- */
1113
- public function single_row( $item ) {
1114
- echo '<tr>';
1115
- $this->single_row_columns( $item );
1116
- echo '</tr>';
1117
- }
1118
-
1119
- protected function column_default( $item, $column_name ) {}
1120
-
1121
- protected function column_cb( $item ) {}
1122
-
1123
- /**
1124
- * Generates the columns for a single row of the table
1125
- *
1126
- * @since 3.1.0
1127
- * @access protected
1128
- *
1129
- * @param object $item The current item
1130
- */
1131
- protected function single_row_columns( $item ) {
1132
- list( $columns, $hidden ) = $this->get_column_info();
1133
-
1134
- foreach ( $columns as $column_name => $column_display_name ) {
1135
- $class = "class='$column_name column-$column_name'";
1136
-
1137
- $style = '';
1138
- if ( in_array( $column_name, $hidden ) ) {
1139
- $style = ' style="display:none;"';
1140
- }
1141
-
1142
- $attributes = "$class$style";
1143
-
1144
- if ( 'cb' == $column_name ) {
1145
- echo '<th scope="row" class="check-column">';
1146
- echo $this->column_cb( $item );
1147
- echo '</th>';
1148
- } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1149
- echo "<td $attributes>";
1150
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1151
- echo '</td>';
1152
- } else {
1153
- echo "<td $attributes>";
1154
- echo $this->column_default( $item, $column_name );
1155
- echo '</td>';
1156
- }
1157
- }
1158
- }
1159
-
1160
- /**
1161
- * Handle an incoming ajax request (called from admin-ajax.php)
1162
- *
1163
- * @since 3.1.0
1164
- * @access public
1165
- */
1166
- public function ajax_response() {
1167
- $this->prepare_items();
1168
-
1169
- ob_start();
1170
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1171
- $this->display_rows();
1172
- } else {
1173
- $this->display_rows_or_placeholder();
1174
- }
1175
-
1176
- $rows = ob_get_clean();
1177
-
1178
- $response = array( 'rows' => $rows );
1179
-
1180
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1181
- $response['total_items_i18n'] = sprintf(
1182
- _n( '1 item', '%s items', $this->_pagination_args['total_items'], 'strong-testimonials' ),
1183
- number_format_i18n( $this->_pagination_args['total_items'] )
1184
- );
1185
- }
1186
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1187
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1188
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1189
- }
1190
-
1191
- die( wp_json_encode( $response ) );
1192
- }
1193
-
1194
- /**
1195
- * Send required variables to JavaScript land
1196
- *
1197
- * @access public
1198
- */
1199
- public function _js_vars() {
1200
- $args = array(
1201
- 'class' => get_class( $this ),
1202
- 'screen' => array(
1203
- 'id' => $this->screen->id,
1204
- 'base' => $this->screen->base,
1205
- ),
1206
- );
1207
-
1208
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1209
- }
1210
- }
1211
-
1212
  endif;
1
+ <?php
2
+ /**
3
+ * Base class for displaying a list of items in an ajaxified HTML table.
4
+ *
5
+ * -!- This is a copy of /wp-admin/includes/class-wp-list-table.php. -!-
6
+ * See Codex for reasoning.
7
+ * @link http://codex.wordpress.org/Class_Reference/WP_List_Table
8
+ *
9
+ * @since 3.1.0
10
+ * @access private
11
+ */
12
+
13
+ if ( ! class_exists( 'Strong_Testimonials_List_Table' ) ) :
14
+
15
+ class Strong_Testimonials_List_Table {
16
+
17
+ /**
18
+ * The current list of items
19
+ *
20
+ * @since 3.1.0
21
+ * @var array
22
+ * @access public
23
+ */
24
+ public $items;
25
+
26
+ /**
27
+ * Various information about the current table
28
+ *
29
+ * @since 3.1.0
30
+ * @var array
31
+ * @access protected
32
+ */
33
+ protected $_args;
34
+
35
+ /**
36
+ * Various information needed for displaying the pagination
37
+ *
38
+ * @since 3.1.0
39
+ * @var array
40
+ */
41
+ protected $_pagination_args = array();
42
+
43
+ /**
44
+ * The current screen
45
+ *
46
+ * @since 3.1.0
47
+ * @var object
48
+ * @access protected
49
+ */
50
+ protected $screen;
51
+
52
+ /**
53
+ * Cached bulk actions
54
+ *
55
+ * @since 3.1.0
56
+ * @var array
57
+ * @access private
58
+ */
59
+ private $_actions;
60
+
61
+ /**
62
+ * Cached pagination output
63
+ *
64
+ * @since 3.1.0
65
+ * @var string
66
+ * @access private
67
+ */
68
+ private $_pagination;
69
+
70
+ /**
71
+ * The view switcher modes.
72
+ *
73
+ * @since 4.1.0
74
+ * @var array
75
+ * @access protected
76
+ */
77
+ protected $modes = array();
78
+
79
+ /**
80
+ * Stores the value returned by ->get_column_info()
81
+ *
82
+ * @var array
83
+ */
84
+ protected $_column_headers;
85
+
86
+ protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
87
+
88
+ protected $compat_methods = array(
89
+ 'set_pagination_args',
90
+ 'get_views',
91
+ 'get_bulk_actions',
92
+ 'bulk_actions',
93
+ 'row_actions',
94
+ 'months_dropdown',
95
+ 'view_switcher',
96
+ 'comments_bubble',
97
+ 'get_items_per_page',
98
+ 'pagination',
99
+ 'get_sortable_columns',
100
+ 'get_column_info',
101
+ 'get_table_classes',
102
+ 'display_tablenav',
103
+ 'extra_tablenav',
104
+ 'single_row_columns',
105
+ );
106
+
107
+ /**
108
+ * Constructor.
109
+ *
110
+ * The child class should call this constructor from its own constructor to override
111
+ * the default $args.
112
+ *
113
+ * @since 3.1.0
114
+ * @access public
115
+ *
116
+ * @param array|string $args {
117
+ * Array or string of arguments.
118
+ *
119
+ * @type string $plural Plural value used for labels and the objects being listed.
120
+ * This affects things such as CSS class-names and nonces used
121
+ * in the list table, e.g. 'posts'. Default empty.
122
+ * @type string $singular Singular label for an object being listed, e.g. 'post'.
123
+ * Default empty
124
+ * @type bool $ajax Whether the list table supports AJAX. This includes loading
125
+ * and sorting data, for example. If true, the class will call
126
+ * the {@see _js_vars()} method in the footer to provide variables
127
+ * to any scripts handling AJAX events. Default false.
128
+ * @type string $screen String containing the hook name used to determine the current
129
+ * screen. If left null, the current screen will be automatically set.
130
+ * Default null.
131
+ * }
132
+ */
133
+ public function __construct( $args = array() ) {
134
+ $args = wp_parse_args(
135
+ $args,
136
+ array(
137
+ 'plural' => '',
138
+ 'singular' => '',
139
+ 'ajax' => false,
140
+ 'screen' => null,
141
+ )
142
+ );
143
+
144
+ $this->screen = convert_to_screen( $args['screen'] );
145
+
146
+ add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
147
+
148
+ if ( ! $args['plural'] ) {
149
+ $args['plural'] = $this->screen->base;
150
+ }
151
+
152
+ $args['plural'] = sanitize_key( $args['plural'] );
153
+ $args['singular'] = sanitize_key( $args['singular'] );
154
+
155
+ $this->_args = $args;
156
+
157
+ if ( $args['ajax'] ) {
158
+ // wp_enqueue_script( 'list-table' );
159
+ add_action( 'admin_footer', array( $this, '_js_vars' ) );
160
+ }
161
+
162
+ if ( empty( $this->modes ) ) {
163
+ $this->modes = array(
164
+ 'list' => __( 'List View', 'strong-testimonials' ),
165
+ 'excerpt' => __( 'Excerpt View', 'strong-testimonials' ),
166
+ );
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Make private properties readable for backwards compatibility.
172
+ *
173
+ * @since 4.0.0
174
+ * @access public
175
+ *
176
+ * @param string $name Property to get.
177
+ * @return mixed Property.
178
+ */
179
+ public function __get( $name ) {
180
+ if ( in_array( $name, $this->compat_fields ) ) {
181
+ return $this->$name;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Make private properties settable for backwards compatibility.
187
+ *
188
+ * @since 4.0.0
189
+ * @access public
190
+ *
191
+ * @param string $name Property to check if set.
192
+ * @param mixed $value Property value.
193
+ * @return mixed Newly-set property.
194
+ */
195
+ public function __set( $name, $value ) {
196
+ if ( in_array( $name, $this->compat_fields ) ) {
197
+ return $this->$name = $value;
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Make private properties checkable for backwards compatibility.
203
+ *
204
+ * @since 4.0.0
205
+ * @access public
206
+ *
207
+ * @param string $name Property to check if set.
208
+ * @return bool Whether the property is set.
209
+ */
210
+ public function __isset( $name ) {
211
+ if ( in_array( $name, $this->compat_fields ) ) {
212
+ return isset( $this->$name );
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Make private properties un-settable for backwards compatibility.
218
+ *
219
+ * @since 4.0.0
220
+ * @access public
221
+ *
222
+ * @param string $name Property to unset.
223
+ */
224
+ public function __unset( $name ) {
225
+ if ( in_array( $name, $this->compat_fields ) ) {
226
+ unset( $this->$name );
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Make private/protected methods readable for backwards compatibility.
232
+ *
233
+ * @since 4.0.0
234
+ * @access public
235
+ *
236
+ * @param callable $name Method to call.
237
+ * @param array $arguments Arguments to pass when calling.
238
+ * @return mixed|bool Return value of the callback, false otherwise.
239
+ */
240
+ public function __call( $name, $arguments ) {
241
+ if ( in_array( $name, $this->compat_methods ) ) {
242
+ return call_user_func_array( array( $this, $name ), $arguments );
243
+ }
244
+ return false;
245
+ }
246
+
247
+ /**
248
+ * Checks the current user's permissions
249
+ *
250
+ * @since 3.1.0
251
+ * @access public
252
+ * @abstract
253
+ */
254
+ public function ajax_user_can() {
255
+ die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
256
+ }
257
+
258
+ /**
259
+ * Prepares the list of items for displaying.
260
+ * @uses WP_List_Table::set_pagination_args()
261
+ *
262
+ * @since 3.1.0
263
+ * @access public
264
+ * @abstract
265
+ */
266
+ public function prepare_items() {
267
+ die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
268
+ }
269
+
270
+ /**
271
+ * An internal method that sets all the necessary pagination arguments
272
+ *
273
+ * @param array $args An associative array with information about the pagination
274
+ * @access protected
275
+ */
276
+ protected function set_pagination_args( $args ) {
277
+ $args = wp_parse_args(
278
+ $args,
279
+ array(
280
+ 'total_items' => 0,
281
+ 'total_pages' => 0,
282
+ 'per_page' => 0,
283
+ )
284
+ );
285
+
286
+ if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
287
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
288
+ }
289
+
290
+ // Redirect if page number is invalid and headers are not already sent.
291
+ if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
292
+ wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
293
+ exit;
294
+ }
295
+
296
+ $this->_pagination_args = $args;
297
+ }
298
+
299
+ /**
300
+ * Access the pagination args.
301
+ *
302
+ * @since 3.1.0
303
+ * @access public
304
+ *
305
+ * @param string $key Pagination argument to retrieve. Common values include 'total_items',
306
+ * 'total_pages', 'per_page', or 'infinite_scroll'.
307
+ * @return int Number of items that correspond to the given pagination argument.
308
+ */
309
+ public function get_pagination_arg( $key ) {
310
+ if ( 'page' == $key ) {
311
+ return $this->get_pagenum();
312
+ }
313
+
314
+ if ( isset( $this->_pagination_args[ $key ] ) ) {
315
+ return $this->_pagination_args[ $key ];
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Whether the table has items to display or not
321
+ *
322
+ * @since 3.1.0
323
+ * @access public
324
+ *
325
+ * @return bool
326
+ */
327
+ public function has_items() {
328
+ return ! empty( $this->items );
329
+ }
330
+
331
+ /**
332
+ * Message to be displayed when there are no items
333
+ *
334
+ * @since 3.1.0
335
+ * @access public
336
+ */
337
+ public function no_items() {
338
+ esc_html_e( 'No items found.', 'strong-testimonials' );
339
+ }
340
+
341
+ /**
342
+ * Display the search box.
343
+ *
344
+ * @since 3.1.0
345
+ * @access public
346
+ *
347
+ * @param string $text The search button text
348
+ * @param string $input_id The search input id
349
+ */
350
+ public function search_box( $text, $input_id ) {
351
+ if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
+ return;
353
+ }
354
+
355
+ $input_id = $input_id . '-search-input';
356
+
357
+ if ( ! empty( $_REQUEST['orderby'] ) ) {
358
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
359
+ }
360
+ if ( ! empty( $_REQUEST['order'] ) ) {
361
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
362
+ }
363
+ if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
365
+ }
366
+ if ( ! empty( $_REQUEST['detached'] ) ) {
367
+ echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
368
+ }
369
+ ?>
370
+ <p class="search-box">
371
+ <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
372
+ <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>">
373
+ <?php submit_button( $text, 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
374
+ </p>
375
+ <?php
376
+ }
377
+
378
+ /**
379
+ * Get an associative array ( id => link ) with the list
380
+ * of views available on this table.
381
+ *
382
+ * @since 3.1.0
383
+ * @access protected
384
+ *
385
+ * @return array
386
+ */
387
+ protected function get_views() {
388
+ return array();
389
+ }
390
+
391
+ /**
392
+ * Display the list of views available on this table.
393
+ *
394
+ * @since 3.1.0
395
+ * @access public
396
+ */
397
+ public function views() {
398
+ $views = $this->get_views();
399
+ /**
400
+ * Filter the list of available list table views.
401
+ *
402
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
403
+ * to the ID of the current screen, usually a string.
404
+ *
405
+ * @since 3.5.0
406
+ *
407
+ * @param array $views An array of available list table views.
408
+ */
409
+ $views = apply_filters( "views_{$this->screen->id}", $views );
410
+
411
+ if ( empty( $views ) ) {
412
+ return;
413
+ }
414
+
415
+ echo "<ul class='subsubsub'>\n";
416
+ foreach ( $views as $class => $view ) {
417
+ $views[ $class ] = "\t<li class='$class'>$view";
418
+ }
419
+ echo implode( " |</li>\n", wp_kses_post( $views ) ) . "</li>\n";
420
+ echo '</ul>';
421
+ }
422
+
423
+ /**
424
+ * Get an associative array ( option_name => option_title ) with the list
425
+ * of bulk actions available on this table.
426
+ *
427
+ * @since 3.1.0
428
+ * @access protected
429
+ *
430
+ * @return array
431
+ */
432
+ protected function get_bulk_actions() {
433
+ return array();
434
+ }
435
+
436
+ /**
437
+ * Display the bulk actions dropdown.
438
+ *
439
+ * @since 3.1.0
440
+ * @access protected
441
+ *
442
+ * @param string $which The location of the bulk actions: 'top' or 'bottom'.
443
+ * This is designated as optional for backwards-compatibility.
444
+ */
445
+ protected function bulk_actions( $which = '' ) {
446
+ if ( is_null( $this->_actions ) ) {
447
+ $no_new_actions = $this->_actions = $this->get_bulk_actions();
448
+ /**
449
+ * Filter the list table Bulk Actions drop-down.
450
+ *
451
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
452
+ * to the ID of the current screen, usually a string.
453
+ *
454
+ * This filter can currently only be used to remove bulk actions.
455
+ *
456
+ * @since 3.5.0
457
+ *
458
+ * @param array $actions An array of the available bulk actions.
459
+ */
460
+ $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
461
+ $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
462
+ $two = '';
463
+ } else {
464
+ $two = '2';
465
+ }
466
+
467
+ if ( empty( $this->_actions ) ) {
468
+ return;
469
+ }
470
+
471
+ echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_html__( 'Select bulk action', 'strong-testimonials' ) . '</label>';
472
+ echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
473
+ echo "<option value='-1' selected='selected'>" . esc_html__( 'Bulk Actions', 'strong-testimonials' ) . "</option>\n";
474
+
475
+ foreach ( $this->_actions as $name => $title ) {
476
+ $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
477
+
478
+ echo "\t<option value='$name'$class>$title</option>\n";
479
+ }
480
+
481
+ echo "</select>\n";
482
+
483
+ submit_button( __( 'Apply', 'strong-testimonials' ), 'action', '', false, array( 'id' => "doaction$two" ) );
484
+ echo "\n";
485
+ }
486
+
487
+ /**
488
+ * Get the current action selected from the bulk actions dropdown.
489
+ *
490
+ * @since 3.1.0
491
+ * @access public
492
+ *
493
+ * @return string|bool The action name or False if no action was selected
494
+ */
495
+ public function current_action() {
496
+ if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
497
+ return false;
498
+ }
499
+
500
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
501
+ return $_REQUEST['action'];
502
+ }
503
+
504
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
505
+ return $_REQUEST['action2'];
506
+ }
507
+
508
+ return false;
509
+ }
510
+
511
+ /**
512
+ * Generate row actions div
513
+ *
514
+ * @since 3.1.0
515
+ * @access protected
516
+ *
517
+ * @param array $actions The list of actions
518
+ * @param bool $always_visible Whether the actions should be always visible
519
+ * @return string
520
+ */
521
+ protected function row_actions( $actions, $always_visible = false ) {
522
+ $action_count = count( $actions );
523
+ $i = 0;
524
+
525
+ if ( ! $action_count ) {
526
+ return '';
527
+ }
528
+
529
+ $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
530
+ foreach ( $actions as $action => $link ) {
531
+ ++$i;
532
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
533
+ $out .= "<span class='$action'>$link$sep</span>";
534
+ }
535
+ $out .= '</div>';
536
+
537
+ return $out;
538
+ }
539
+
540
+ /**
541
+ * Display a monthly dropdown for filtering items
542
+ *
543
+ * @since 3.1.0
544
+ * @access protected
545
+ *
546
+ * @param string $post_type
547
+ */
548
+ protected function months_dropdown( $post_type ) {
549
+ global $wpdb, $wp_locale;
550
+
551
+ /**
552
+ * Filter whether to remove the 'Months' drop-down from the post list table.
553
+ *
554
+ * @since 4.2.0
555
+ *
556
+ * @param bool $disable Whether to disable the drop-down. Default false.
557
+ * @param string $post_type The post type.
558
+ */
559
+ if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
560
+ return;
561
+ }
562
+
563
+ $months = $wpdb->get_results(
564
+ $wpdb->prepare(
565
+ "
566
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
567
+ FROM $wpdb->posts
568
+ WHERE post_type = %s
569
+ ORDER BY post_date DESC
570
+ ",
571
+ $post_type
572
+ )
573
+ );
574
+
575
+ /**
576
+ * Filter the 'Months' drop-down results.
577
+ *
578
+ * @since 3.7.0
579
+ *
580
+ * @param object $months The months drop-down query results.
581
+ * @param string $post_type The post type.
582
+ */
583
+ $months = apply_filters( 'months_dropdown_results', $months, $post_type );
584
+
585
+ $month_count = count( $months );
586
+
587
+ if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
588
+ return;
589
+ }
590
+
591
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
592
+ ?>
593
+ <label for="filter-by-date" class="screen-reader-text"><?php esc_html_e( 'Filter by date', 'strong-testimonials' ); ?></label>
594
+ <select name="m" id="filter-by-date">
595
+ <option<?php selected( $m, 0 ); ?> value="0"><?php esc_html_e( 'All dates', 'strong-testimonials' ); ?></option>
596
+ <?php
597
+ foreach ( $months as $arc_row ) {
598
+ if ( 0 == $arc_row->year ) {
599
+ continue;
600
+ }
601
+
602
+ $month = zeroise( $arc_row->month, 2 );
603
+ $year = $arc_row->year;
604
+
605
+ printf(
606
+ "<option %s value='%s'>%s</option>\n",
607
+ selected( $m, $year . $month, false ),
608
+ esc_attr( $arc_row->year . $month ),
609
+ /* translators: 1: month name, 2: 4-digit year */
610
+ sprintf( '%1$s %2$d', $wp_locale->get_month( $month ), $year )
611
+ );
612
+ }
613
+ ?>
614
+ </select>
615
+ <?php
616
+ }
617
+
618
+ /**
619
+ * Display a view switcher
620
+ *
621
+ * @since 3.1.0
622
+ * @access protected
623
+ *
624
+ * @param string $current_mode
625
+ */
626
+ protected function view_switcher( $current_mode ) {
627
+ ?>
628
+ <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
629
+ <div class="view-switch">
630
+ <?php
631
+ foreach ( $this->modes as $mode => $title ) {
632
+ $classes = array( 'view-' . $mode );
633
+ if ( $current_mode == $mode ) {
634
+ $classes[] = 'current';
635
+ }
636
+ printf(
637
+ "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
638
+ esc_url( add_query_arg( 'mode', $mode ) ),
639
+ implode( ' ', $classes ),
640
+ $title
641
+ );
642
+ }
643
+ ?>
644
+ </div>
645
+ <?php
646
+ }
647
+
648
+ /**
649
+ * Display a comment count bubble
650
+ *
651
+ * @since 3.1.0
652
+ * @access protected
653
+ *
654
+ * @param int $post_id The post ID.
655
+ * @param int $pending_comments Number of pending comments.
656
+ */
657
+ protected function comments_bubble( $post_id, $pending_comments ) {
658
+ $pending_phrase = sprintf( __( '%s pending', 'strong-testimonials' ), number_format( $pending_comments ) );
659
+
660
+ if ( $pending_comments ) {
661
+ echo '<strong>';
662
+ }
663
+
664
+ echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . '</span></a>';
665
+
666
+ if ( $pending_comments ) {
667
+ echo '</strong>';
668
+ }
669
+ }
670
+
671
+ /**
672
+ * Get the current page number
673
+ *
674
+ * @since 3.1.0
675
+ * @access public
676
+ *
677
+ * @return int
678
+ */
679
+ public function get_pagenum() {
680
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
681
+
682
+ if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
683
+ $pagenum = $this->_pagination_args['total_pages'];
684
+ }
685
+
686
+ return max( 1, $pagenum );
687
+ }
688
+
689
+ /**
690
+ * Get number of items to display on a single page
691
+ *
692
+ * @since 3.1.0
693
+ * @access protected
694
+ *
695
+ * @param string $option
696
+ * @param int $default
697
+ * @return int
698
+ */
699
+ protected function get_items_per_page( $option, $default = 20 ) {
700
+ $per_page = (int) get_user_option( $option );
701
+ if ( empty( $per_page ) || $per_page < 1 ) {
702
+ $per_page = $default;
703
+ }
704
+
705
+ /**
706
+ * Filter the number of items to be displayed on each page of the list table.
707
+ *
708
+ * The dynamic hook name, $option, refers to the `per_page` option depending
709
+ * on the type of list table in use. Possible values include: 'edit_comments_per_page',
710
+ * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
711
+ * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
712
+ * 'edit_{$post_type}_per_page', etc.
713
+ *
714
+ * @since 2.9.0
715
+ *
716
+ * @param int $per_page Number of items to be displayed. Default 20.
717
+ */
718
+ return (int) apply_filters( $option, $per_page );
719
+ }
720
+
721
+ /**
722
+ * Display the pagination.
723
+ *
724
+ * @since 3.1.0
725
+ * @access protected
726
+ *
727
+ * @param string $which
728
+ */
729
+ protected function pagination( $which ) {
730
+ if ( empty( $this->_pagination_args ) ) {
731
+ return;
732
+ }
733
+
734
+ $total_items = $this->_pagination_args['total_items'];
735
+ $total_pages = $this->_pagination_args['total_pages'];
736
+ $infinite_scroll = false;
737
+ if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
738
+ $infinite_scroll = $this->_pagination_args['infinite_scroll'];
739
+ }
740
+
741
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items, 'strong-testimonials' ), number_format_i18n( $total_items ) ) . '</span>';
742
+
743
+ $current = $this->get_pagenum();
744
+
745
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
746
+
747
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
748
+
749
+ $page_links = array();
750
+
751
+ $disable_first = $disable_last = '';
752
+ if ( $current == 1 ) {
753
+ $disable_first = ' disabled';
754
+ }
755
+ if ( $current == $total_pages ) {
756
+ $disable_last = ' disabled';
757
+ }
758
+ $page_links[] = sprintf(
759
+ "<a class='%s' title='%s' href='%s'>%s</a>",
760
+ 'first-page' . $disable_first,
761
+ esc_attr__( 'Go to the first page', 'strong-testimonials' ),
762
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
763
+ '&laquo;'
764
+ );
765
+
766
+ $page_links[] = sprintf(
767
+ "<a class='%s' title='%s' href='%s'>%s</a>",
768
+ 'prev-page' . $disable_first,
769
+ esc_attr__( 'Go to the previous page', 'strong-testimonials' ),
770
+ esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
771
+ '&lsaquo;'
772
+ );
773
+
774
+ if ( 'bottom' == $which ) {
775
+ $html_current_page = $current;
776
+ } else {
777
+ $html_current_page = sprintf(
778
+ "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
779
+ '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page', 'strong-testimonials' ) . '</label>',
780
+ esc_attr__( 'Current page', 'strong-testimonials' ),
781
+ $current,
782
+ strlen( $total_pages )
783
+ );
784
+ }
785
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
786
+ $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging', 'strong-testimonials' ), $html_current_page, $html_total_pages ) . '</span>';
787
+
788
+ $page_links[] = sprintf(
789
+ "<a class='%s' title='%s' href='%s'>%s</a>",
790
+ 'next-page' . $disable_last,
791
+ esc_attr__( 'Go to the next page', 'strong-testimonials' ),
792
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
793
+ '&rsaquo;'
794
+ );
795
+
796
+ $page_links[] = sprintf(
797
+ "<a class='%s' title='%s' href='%s'>%s</a>",
798
+ 'last-page' . $disable_last,
799
+ esc_attr__( 'Go to the last page', 'strong-testimonials' ),
800
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
801
+ '&raquo;'
802
+ );
803
+
804
+ $pagination_links_class = 'pagination-links';
805
+ if ( ! empty( $infinite_scroll ) ) {
806
+ $pagination_links_class = ' hide-if-js';
807
+ }
808
+ $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
809
+
810
+ if ( $total_pages ) {
811
+ $page_class = $total_pages < 2 ? ' one-page' : '';
812
+ } else {
813
+ $page_class = ' no-pages';
814
+ }
815
+ $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
816
+
817
+ echo $this->_pagination;
818
+ }
819
+
820
+ /**
821
+ * Get a list of columns. The format is:
822
+ * 'internal-name' => 'Title'
823
+ *
824
+ * @since 3.1.0
825
+ * @access public
826
+ * @abstract
827
+ *
828
+ * @return array
829
+ */
830
+ public function get_columns() {
831
+ die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
832
+ }
833
+
834
+ /**
835
+ * Get a list of sortable columns. The format is:
836
+ * 'internal-name' => 'orderby'
837
+ * or
838
+ * 'internal-name' => array( 'orderby', true )
839
+ *
840
+ * The second format will make the initial sorting order be descending
841
+ *
842
+ * @since 3.1.0
843
+ * @access protected
844
+ *
845
+ * @return array
846
+ */
847
+ protected function get_sortable_columns() {
848
+ return array();
849
+ }
850
+
851
+ /**
852
+ * Get a list of all, hidden and sortable columns, with filter applied
853
+ *
854
+ * @since 3.1.0
855
+ * @access protected
856
+ *
857
+ * @return array
858
+ */
859
+ protected function get_column_info() {
860
+ if ( isset( $this->_column_headers ) ) {
861
+ return $this->_column_headers;
862
+ }
863
+
864
+ $columns = get_column_headers( $this->screen );
865
+ $hidden = get_hidden_columns( $this->screen );
866
+
867
+ $sortable_columns = $this->get_sortable_columns();
868
+ /**
869
+ * Filter the list table sortable columns for a specific screen.
870
+ *
871
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
872
+ * to the ID of the current screen, usually a string.
873
+ *
874
+ * @since 3.5.0
875
+ *
876
+ * @param array $sortable_columns An array of sortable columns.
877
+ */
878
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
879
+
880
+ $sortable = array();
881
+ foreach ( $_sortable as $id => $data ) {
882
+ if ( empty( $data ) ) {
883
+ continue;
884
+ }
885
+
886
+ $data = (array) $data;
887
+ if ( ! isset( $data[1] ) ) {
888
+ $data[1] = false;
889
+ }
890
+
891
+ $sortable[ $id ] = $data;
892
+ }
893
+
894
+ $this->_column_headers = array( $columns, $hidden, $sortable );
895
+
896
+ return $this->_column_headers;
897
+ }
898
+
899
+ /**
900
+ * Return number of visible columns
901
+ *
902
+ * @since 3.1.0
903
+ * @access public
904
+ *
905
+ * @return int
906
+ */
907
+ public function get_column_count() {
908
+ list ( $columns, $hidden ) = $this->get_column_info();
909
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
910
+ return count( $columns ) - count( $hidden );
911
+ }
912
+
913
+ /**
914
+ * Print column headers, accounting for hidden and sortable columns.
915
+ *
916
+ * @since 3.1.0
917
+ * @access public
918
+ *
919
+ * @param bool $with_id Whether to set the id attribute or not
920
+ */
921
+ public function print_column_headers( $with_id = true ) {
922
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
923
+
924
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
925
+ $current_url = remove_query_arg( 'paged', $current_url );
926
+
927
+ if ( isset( $_GET['orderby'] ) ) {
928
+ $current_orderby = $_GET['orderby'];
929
+ } else {
930
+ $current_orderby = '';
931
+ }
932
+
933
+ if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) {
934
+ $current_order = 'desc';
935
+ } else {
936
+ $current_order = 'asc';
937
+ }
938
+
939
+ if ( ! empty( $columns['cb'] ) ) {
940
+ static $cb_counter = 1;
941
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'strong-testimonials' ) . '</label>'
942
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
943
+ $cb_counter++;
944
+ }
945
+
946
+ foreach ( $columns as $column_key => $column_display_name ) {
947
+ $class = array( 'manage-column', "column-$column_key" );
948
+
949
+ $style = '';
950
+ if ( in_array( $column_key, $hidden ) ) {
951
+ $style = 'display:none;';
952
+ }
953
+
954
+ $style = ' style="' . $style . '"';
955
+
956
+ if ( 'cb' == $column_key ) {
957
+ $class[] = 'check-column';
958
+ } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
959
+ $class[] = 'num';
960
+ }
961
+
962
+ if ( isset( $sortable[ $column_key ] ) ) {
963
+ list( $orderby, $desc_first ) = $sortable[ $column_key ];
964
+
965
+ if ( $current_orderby == $orderby ) {
966
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
967
+ $class[] = 'sorted';
968
+ $class[] = $current_order;
969
+ } else {
970
+ $order = $desc_first ? 'desc' : 'asc';
971
+ $class[] = 'sortable';
972
+ $class[] = $desc_first ? 'asc' : 'desc';
973
+ }
974
+
975
+ $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
976
+ }
977
+
978
+ $id = $with_id ? "id='$column_key'" : '';
979
+
980
+ if ( ! empty( $class ) ) {
981
+ $class = "class='" . join( ' ', $class ) . "'";
982
+ }
983
+
984
+ echo "<th scope='col' $id $class $style>$column_display_name</th>";
985
+ }
986
+ }
987
+
988
+ /**
989
+ * Display the table
990
+ *
991
+ * @since 3.1.0
992
+ * @access public
993
+ */
994
+ public function display() {
995
+ $singular = $this->_args['singular'];
996
+
997
+ $this->display_tablenav( 'top' );
998
+
999
+ ?>
1000
+ <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1001
+ <thead>
1002
+ <tr>
1003
+ <?php $this->print_column_headers(); ?>
1004
+ </tr>
1005
+ </thead>
1006
+
1007
+ <tbody id="the-list"
1008
+ <?php
1009
+ if ( $singular ) {
1010
+ echo " data-wp-lists='list:$singular'";
1011
+ }
1012
+ ?>
1013
+ >
1014
+ <?php $this->display_rows_or_placeholder(); ?>
1015
+ </tbody>
1016
+
1017
+ <tfoot>
1018
+ <tr>
1019
+ <?php $this->print_column_headers( false ); ?>
1020
+ </tr>
1021
+ </tfoot>
1022
+
1023
+ </table>
1024
+ <?php
1025
+ $this->display_tablenav( 'bottom' );
1026
+ }
1027
+
1028
+ /**
1029
+ * Get a list of CSS classes for the list table table tag.
1030
+ *
1031
+ * @since 3.1.0
1032
+ * @access protected
1033
+ *
1034
+ * @return array List of CSS classes for the table tag.
1035
+ */
1036
+ protected function get_table_classes() {
1037
+ return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1038
+ }
1039
+
1040
+ /**
1041
+ * Generate the table navigation above or below the table
1042
+ *
1043
+ * @since 3.1.0
1044
+ * @access protected
1045
+ * @param string $which
1046
+ */
1047
+ protected function display_tablenav( $which ) {
1048
+ if ( 'top' == $which ) {
1049
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1050
+ }
1051
+ ?>
1052
+ <div class="tablenav <?php echo esc_attr( $which ); ?>">
1053
+
1054
+ <div class="alignleft actions bulkactions">
1055
+ <?php $this->bulk_actions( $which ); ?>
1056
+ </div>
1057
+ <?php
1058
+ $this->extra_tablenav( $which );
1059
+ $this->pagination( $which );
1060
+ ?>
1061
+
1062
+ <br class="clear">
1063
+ </div>
1064
+ <?php
1065
+ }
1066
+
1067
+ /**
1068
+ * Extra controls to be displayed between bulk actions and pagination
1069
+ *
1070
+ * @since 3.1.0
1071
+ * @access protected
1072
+ *
1073
+ * @param string $which
1074
+ */
1075
+ protected function extra_tablenav( $which ) {}
1076
+
1077
+ /**
1078
+ * Generate the tbody element for the list table.
1079
+ *
1080
+ * @since 3.1.0
1081
+ * @access public
1082
+ */
1083
+ public function display_rows_or_placeholder() {
1084
+ if ( $this->has_items() ) {
1085
+ $this->display_rows();
1086
+ } else {
1087
+ echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1088
+ $this->no_items();
1089
+ echo '</td></tr>';
1090
+ }
1091
+ }
1092
+
1093
+ /**
1094
+ * Generate the table rows
1095
+ *
1096
+ * @since 3.1.0
1097
+ * @access public
1098
+ */
1099
+ public function display_rows() {
1100
+ foreach ( $this->items as $item ) {
1101
+ $this->single_row( $item );
1102
+ }
1103
+ }
1104
+
1105
+ /**
1106
+ * Generates content for a single row of the table
1107
+ *
1108
+ * @since 3.1.0
1109
+ * @access public
1110
+ *
1111
+ * @param object $item The current item
1112
+ */
1113
+ public function single_row( $item ) {
1114
+ echo '<tr>';
1115
+ $this->single_row_columns( $item );
1116
+ echo '</tr>';
1117
+ }
1118
+
1119
+ protected function column_default( $item, $column_name ) {}
1120
+
1121
+ protected function column_cb( $item ) {}
1122
+
1123
+ /**
1124
+ * Generates the columns for a single row of the table
1125
+ *
1126
+ * @since 3.1.0
1127
+ * @access protected
1128
+ *
1129
+ * @param object $item The current item
1130
+ */
1131
+ protected function single_row_columns( $item ) {
1132
+ list( $columns, $hidden ) = $this->get_column_info();
1133
+
1134
+ foreach ( $columns as $column_name => $column_display_name ) {
1135
+ $class = "class='$column_name column-$column_name'";
1136
+
1137
+ $style = '';
1138
+ if ( in_array( $column_name, $hidden ) ) {
1139
+ $style = ' style="display:none;"';
1140
+ }
1141
+
1142
+ $attributes = "$class$style";
1143
+
1144
+ if ( 'cb' == $column_name ) {
1145
+ echo '<th scope="row" class="check-column">';
1146
+ echo $this->column_cb( $item );
1147
+ echo '</th>';
1148
+ } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1149
+ echo "<td $attributes>";
1150
+ echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1151
+ echo '</td>';
1152
+ } else {
1153
+ echo "<td $attributes>";
1154
+ echo $this->column_default( $item, $column_name );
1155
+ echo '</td>';
1156
+ }
1157
+ }
1158
+ }
1159
+
1160
+ /**
1161
+ * Handle an incoming ajax request (called from admin-ajax.php)
1162
+ *
1163
+ * @since 3.1.0
1164
+ * @access public
1165
+ */
1166
+ public function ajax_response() {
1167
+ $this->prepare_items();
1168
+
1169
+ ob_start();
1170
+ if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1171
+ $this->display_rows();
1172
+ } else {
1173
+ $this->display_rows_or_placeholder();
1174
+ }
1175
+
1176
+ $rows = ob_get_clean();
1177
+
1178
+ $response = array( 'rows' => $rows );
1179
+
1180
+ if ( isset( $this->_pagination_args['total_items'] ) ) {
1181
+ $response['total_items_i18n'] = sprintf(
1182
+ _n( '1 item', '%s items', $this->_pagination_args['total_items'], 'strong-testimonials' ),
1183
+ number_format_i18n( $this->_pagination_args['total_items'] )
1184
+ );
1185
+ }
1186
+ if ( isset( $this->_pagination_args['total_pages'] ) ) {
1187
+ $response['total_pages'] = $this->_pagination_args['total_pages'];
1188
+ $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1189
+ }
1190
+
1191
+ die( wp_json_encode( $response ) );
1192
+ }
1193
+
1194
+ /**
1195
+ * Send required variables to JavaScript land
1196
+ *
1197
+ * @access public
1198
+ */
1199
+ public function _js_vars() {
1200
+ $args = array(
1201
+ 'class' => get_class( $this ),
1202
+ 'screen' => array(
1203
+ 'id' => $this->screen->id,
1204
+ 'base' => $this->screen->base,
1205
+ ),
1206
+ );
1207
+
1208
+ printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1209
+ }
1210
+ }
1211
+
1212
  endif;
admin/class-strong-testimonials-page-shortcodes.php CHANGED
@@ -1,336 +1,336 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Page_Shortcodes
5
- *
6
- * @since 2.31.0
7
- */
8
- class Strong_Testimonials_Page_Shortcodes {
9
-
10
- /**
11
- * Strong_Testimonials_Page_Shortcodes constructor.
12
- */
13
- private function __construct() {
14
- }
15
-
16
- /**
17
- * Render the shortcode instructions page.
18
- */
19
- public static function render_page() {
20
-
21
- $stars = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current half"></span></span>';
22
-
23
- $tags = array(
24
- 'a' => array(
25
- 'href' => array(),
26
- 'target' => array(),
27
- ),
28
- );
29
- ?>
30
- <div class="wrap wpmtst shortcodes has-stars">
31
-
32
- <h1><?php _e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
33
-
34
- <h2><?php _e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
35
-
36
- <p>
37
- <?php echo wp_kses_post( _e( 'Each view has a unique shortcode like ', 'strong-testimonials' ) ); ?><code>&#91;testimonial_view id="1"&#93;</code>.
38
- <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), esc_html__( 'Go to views', 'strong-testimonials' ) ); ?>
39
- </p>
40
-
41
- <h2><?php _e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
42
-
43
- <p><?php printf( __( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
44
-
45
- <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
46
- <tr>
47
- <td>
48
- <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
49
- </td>
50
- <td class="shortcode">
51
- <?php /* translators: %s is a shortcode */ ?>
52
- <p>
53
- <?php printf( __( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
54
- </p>
55
- </td>
56
- </tr>
57
- <tr>
58
- <td>
59
- <?php /* translators: %s is a shortcode attribute */ ?>
60
- <p><?php printf( __( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
61
- </td>
62
- <td class="shortcode">
63
- <?php /* translators: %s is a shortcode */ ?>
64
- <p>
65
- <?php printf( __( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
66
- </p>
67
- </td>
68
- </tr>
69
- </table>
70
-
71
- <h2><?php _e( 'Average Rating', 'strong-testimonials' ); ?></h2>
72
-
73
- <p>
74
- <?php /* translators: %s is a shortcode */ ?>
75
- <?php printf( __( 'If using a <strong>single</strong> rating field, use %s to display the average rating.', 'strong-testimonials' ), '<code>&#91;testimonial_average_rating&#93;</code>' ); ?>
76
- </p>
77
-
78
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
79
- <tr>
80
- <td>
81
- <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
82
- <p class="description"><?php _e( 'You must use the closing slash <code>/</code> if using the shortcode with content elsewhere on your page.', 'strong-testimonials' ); ?></p>
83
- </td>
84
- <td class="has-inner">
85
- <table class="inner" cellpadding="0" cellspacing="0">
86
- <tr>
87
- <td class="shortcode">&#91;testimonial_average_rating /&#93;</td>
88
- </tr>
89
- <tr>
90
- <td>
91
- <div class="strong-rating-wrapper average">
92
- <span class="strong-rating-title">Average Rating:</span>
93
- <?php echo $stars; ?>
94
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
95
- </div>
96
- </td>
97
- </tr>
98
- </table>
99
- </td>
100
- </tr>
101
- </table>
102
-
103
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
104
- <tr>
105
- <td>
106
- <p><?php _e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
107
- <p><?php _e( 'Default:', 'strong-testimonials' ); ?></p>
108
- <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
109
- </td>
110
- <td class="has-inner">
111
- <table class="inner" cellpadding="0" cellspacing="0">
112
- <tr>
113
- <td class="shortcode">&#91;testimonial_average_rating&#93;{title} {stars} {summary}&#91;/testimonial_average_rating&#93;</td>
114
- </tr>
115
- <tr>
116
- <td>
117
- <div class="strong-rating-wrapper average">
118
- <span class="strong-rating-title">Average Rating:</span>
119
- <?php echo $stars; ?>
120
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
121
- </div>
122
- </td>
123
- </tr>
124
- </table>
125
- </td>
126
- </tr>
127
- </table>
128
-
129
- <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
130
- <tr>
131
- <td>
132
- <p><?php _e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
133
- <p><code>{title2}</code><br><code>{summary2}</code></p>
134
- </td>
135
- <td class="has-inner">
136
- <table class="inner" cellpadding="0" cellspacing="0">
137
- <tr>
138
- <td class="shortcode">&#91;testimonial_average_rating&#93;{title2} {stars} {summary2}&#91;/testimonial_average_rating&#93;</td>
139
- </tr>
140
- <tr>
141
- <td>
142
- <div class="strong-rating-wrapper average">
143
- <span class="strong-rating-title">Average of 9 Ratings:</span>
144
- <?php echo $stars; ?>
145
- <span class="strong-rating-summary">4.3 stars</span>
146
- </div>
147
- </td>
148
- <tr>
149
- </tr>
150
- </table>
151
- </tr>
152
- </table>
153
-
154
- <table class="form-table shortcodes average">
155
- <tr>
156
- <td>
157
- <p><?php _e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
158
- </td>
159
- <td class="has-inner">
160
- <table class="inner" cellpadding="0" cellspacing="0">
161
- <tr>
162
- <td class="shortcode">&#91;testimonial_average_rating&#93;{stars} Our average rating is &lt;b&gt;{summary2}&lt;/b&gt;&#91;/testimonial_average_rating&#93;</td>
163
- </tr>
164
- <tr>
165
- <td>
166
- <div class="strong-rating-wrapper average">
167
- <?php echo $stars; ?>
168
- Our average rating is <b><span class="strong-rating-summary">4.3 stars</span></b>
169
- </div>
170
- </td>
171
- </tr>
172
- </table>
173
- </td>
174
- </tr>
175
- </table>
176
-
177
- <table class="form-table shortcodes average">
178
- <tr>
179
- <td>
180
- <p><code>{stars}</code></p>
181
- </td>
182
- <td class="has-inner">
183
- <table class="inner" cellpadding="0" cellspacing="0">
184
- <tr>
185
- <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}&#91;/testimonial_average_rating&#93;</td>
186
- </tr>
187
- <tr>
188
- <td>
189
- <div class="strong-rating-wrapper average">
190
- <?php echo $stars; ?>
191
- </div>
192
- </td>
193
- </tr>
194
- </table>
195
- </td>
196
- </tr>
197
- </table>
198
-
199
- <table class="form-table shortcodes average">
200
- <tr>
201
- <td>
202
- <p><code>{average}</code></p>
203
- </td>
204
- <td class="has-inner">
205
- <table class="inner" cellpadding="0" cellspacing="0">
206
- <tr>
207
- <td class="shortcode">&#91;testimonial_average_rating&#93;{average}&#91;/testimonial_average_rating&#93;</td>
208
- </tr>
209
- <tr>
210
- <td>
211
- <div class="strong-rating-wrapper average"><span class="strong-rating-average">4.3</span></div>
212
- </td>
213
- </tr>
214
- </table>
215
- </td>
216
- </tr>
217
- </table>
218
-
219
- <table class="form-table shortcodes average">
220
- <tr>
221
- <td>
222
- <p><code>{count}</code></p>
223
- </td>
224
- <td class="has-inner">
225
- <table class="inner" cellpadding="0" cellspacing="0">
226
- <tr>
227
- <td class="shortcode">&#91;testimonial_average_rating&#93;{count}&#91;/testimonial_average_rating&#93;</td>
228
- </tr>
229
- <tr>
230
- <td>
231
- <div class="strong-rating-wrapper average"><span class="strong-rating-count">9</span></div>
232
- </td>
233
- </tr>
234
- </table>
235
- </td>
236
- </tr>
237
- </table>
238
-
239
- <table class="form-table shortcodes average">
240
- <tr>
241
- <td>
242
- <p><code>block</code></p>
243
- </td>
244
- <td class="has-inner">
245
- <table class="inner" cellpadding="0" cellspacing="0">
246
- <tr>
247
- <td class="shortcode">&#91;testimonial_average_rating block /&#93;</td>
248
- </tr>
249
- <tr>
250
- <td>
251
- <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
252
- <?php echo $stars; ?>
253
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
254
- </div>
255
- </td>
256
- </tr>
257
- </table>
258
- </td>
259
- </tr>
260
- </table>
261
-
262
- <table class="form-table shortcodes average">
263
- <tr>
264
- <td>
265
- <p><code>centered</code></p>
266
- </td>
267
- <td class="has-inner">
268
- <table class="inner" cellpadding="0" cellspacing="0">
269
- <tr>
270
- <td class="shortcode">&#91;testimonial_average_rating centered /&#93;</td>
271
- </tr>
272
- <tr>
273
- <td>
274
- <div class="strong-rating-wrapper average centered"><span class="strong-rating-title">Average Rating:</span>
275
- <?php echo $stars; ?>
276
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
277
- </div>
278
- </td>
279
- </tr>
280
- </table>
281
- </td>
282
- </tr>
283
- </table>
284
-
285
- <table class="form-table shortcodes average">
286
- <tr>
287
- <td>
288
- <p><code>block</code> and <code>centered</code></p>
289
- </td>
290
- <td class="has-inner">
291
- <table class="inner" cellpadding="0" cellspacing="0">
292
- <tr>
293
- <td class="shortcode">&#91;testimonial_average_rating block centered /&#93;</td>
294
- </tr>
295
- <tr>
296
- <td>
297
- <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title">Average Rating:</span>
298
- <?php echo $stars; ?>
299
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
300
- </div>
301
- </td>
302
- </tr>
303
- </table>
304
- </td>
305
- </tr>
306
- </table>
307
-
308
- <table class="form-table shortcodes average">
309
- <tr>
310
- <td>
311
- <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
312
- </td>
313
- <td class="has-inner">
314
- <table class="inner" cellpadding="0" cellspacing="0">
315
- <tr>
316
- <td class="shortcode">&#91;testimonial_average_rating element="span" /&#93;</td>
317
- </tr>
318
- <tr>
319
- <td>
320
- <span class="strong-rating-wrapper average">
321
- <span class="strong-rating-title">Average Rating:</span>
322
- <?php echo $stars; ?>
323
- <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
324
- </span>
325
- </td>
326
- </tr>
327
- </table>
328
- </td>
329
- </tr>
330
- </table>
331
-
332
- </div>
333
- <?php
334
- }
335
-
336
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Page_Shortcodes
5
+ *
6
+ * @since 2.31.0
7
+ */
8
+ class Strong_Testimonials_Page_Shortcodes {
9
+
10
+ /**
11
+ * Strong_Testimonials_Page_Shortcodes constructor.
12
+ */
13
+ private function __construct() {
14
+ }
15
+
16
+ /**
17
+ * Render the shortcode instructions page.
18
+ */
19
+ public static function render_page() {
20
+
21
+ $stars = '<span class="strong-rating"><span class="star0 star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star"></span><span class="star current half"></span></span>';
22
+
23
+ $tags = array(
24
+ 'a' => array(
25
+ 'href' => array(),
26
+ 'target' => array(),
27
+ ),
28
+ );
29
+ ?>
30
+ <div class="wrap wpmtst shortcodes has-stars">
31
+
32
+ <h1><?php _e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
33
+
34
+ <h2><?php _e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
35
+
36
+ <p>
37
+ <?php echo wp_kses_post( _e( 'Each view has a unique shortcode like ', 'strong-testimonials' ) ); ?><code>&#91;testimonial_view id="1"&#93;</code>.
38
+ <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), esc_html__( 'Go to views', 'strong-testimonials' ) ); ?>
39
+ </p>
40
+
41
+ <h2><?php _e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
42
+
43
+ <p><?php printf( __( 'Use %s to display the number of testimonials.', 'strong-testimonials' ), '<code>&#91;testimonial_count&#93;</code>' ); ?></p>
44
+
45
+ <table class="form-table shortcodes" cellpadding="0" cellspacing="0">
46
+ <tr>
47
+ <td>
48
+ <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
49
+ </td>
50
+ <td class="shortcode">
51
+ <?php /* translators: %s is a shortcode */ ?>
52
+ <p>
53
+ <?php printf( __( 'Read some of our %s testimonials!', 'strong-testimonials' ), '&#91;testimonial_count&#93;' ); ?>
54
+ </p>
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td>
59
+ <?php /* translators: %s is a shortcode attribute */ ?>
60
+ <p><?php printf( __( 'To count for a specific category, add the %s attribute with the category slug.', 'strong-testimonials' ), '<code>category</code>' ); ?>
61
+ </td>
62
+ <td class="shortcode">
63
+ <?php /* translators: %s is a shortcode */ ?>
64
+ <p>
65
+ <?php printf( __( 'Here\'s what %s local clients say', 'strong-testimonials' ), '&#91;testimonial_count category="local"&#93;' ); ?>
66
+ </p>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+
71
+ <h2><?php _e( 'Average Rating', 'strong-testimonials' ); ?></h2>
72
+
73
+ <p>
74
+ <?php /* translators: %s is a shortcode */ ?>
75
+ <?php printf( __( 'If using a <strong>single</strong> rating field, use %s to display the average rating.', 'strong-testimonials' ), '<code>&#91;testimonial_average_rating&#93;</code>' ); ?>
76
+ </p>
77
+
78
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
79
+ <tr>
80
+ <td>
81
+ <p><?php _e( 'Default', 'strong-testimonials' ); ?></p>
82
+ <p class="description"><?php _e( 'You must use the closing slash <code>/</code> if using the shortcode with content elsewhere on your page.', 'strong-testimonials' ); ?></p>
83
+ </td>
84
+ <td class="has-inner">
85
+ <table class="inner" cellpadding="0" cellspacing="0">
86
+ <tr>
87
+ <td class="shortcode">&#91;testimonial_average_rating /&#93;</td>
88
+ </tr>
89
+ <tr>
90
+ <td>
91
+ <div class="strong-rating-wrapper average">
92
+ <span class="strong-rating-title">Average Rating:</span>
93
+ <?php echo $stars; ?>
94
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
95
+ </div>
96
+ </td>
97
+ </tr>
98
+ </table>
99
+ </td>
100
+ </tr>
101
+ </table>
102
+
103
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
104
+ <tr>
105
+ <td>
106
+ <p><?php _e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
107
+ <p><?php _e( 'Default:', 'strong-testimonials' ); ?></p>
108
+ <p><code>{title}</code><br><code>{stars}</code><br><code>{summary}</code></p>
109
+ </td>
110
+ <td class="has-inner">
111
+ <table class="inner" cellpadding="0" cellspacing="0">
112
+ <tr>
113
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title} {stars} {summary}&#91;/testimonial_average_rating&#93;</td>
114
+ </tr>
115
+ <tr>
116
+ <td>
117
+ <div class="strong-rating-wrapper average">
118
+ <span class="strong-rating-title">Average Rating:</span>
119
+ <?php echo $stars; ?>
120
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
121
+ </div>
122
+ </td>
123
+ </tr>
124
+ </table>
125
+ </td>
126
+ </tr>
127
+ </table>
128
+
129
+ <table class="form-table shortcodes average" cellpadding="0" cellspacing="0">
130
+ <tr>
131
+ <td>
132
+ <p><?php _e( 'Alternate content tags.', 'strong-testimonials' ); ?></p>
133
+ <p><code>{title2}</code><br><code>{summary2}</code></p>
134
+ </td>
135
+ <td class="has-inner">
136
+ <table class="inner" cellpadding="0" cellspacing="0">
137
+ <tr>
138
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{title2} {stars} {summary2}&#91;/testimonial_average_rating&#93;</td>
139
+ </tr>
140
+ <tr>
141
+ <td>
142
+ <div class="strong-rating-wrapper average">
143
+ <span class="strong-rating-title">Average of 9 Ratings:</span>
144
+ <?php echo $stars; ?>
145
+ <span class="strong-rating-summary">4.3 stars</span>
146
+ </div>
147
+ </td>
148
+ <tr>
149
+ </tr>
150
+ </table>
151
+ </tr>
152
+ </table>
153
+
154
+ <table class="form-table shortcodes average">
155
+ <tr>
156
+ <td>
157
+ <p><?php _e( 'Insert tags into your custom content.', 'strong-testimonials' ); ?></p>
158
+ </td>
159
+ <td class="has-inner">
160
+ <table class="inner" cellpadding="0" cellspacing="0">
161
+ <tr>
162
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{stars} Our average rating is &lt;b&gt;{summary2}&lt;/b&gt;&#91;/testimonial_average_rating&#93;</td>
163
+ </tr>
164
+ <tr>
165
+ <td>
166
+ <div class="strong-rating-wrapper average">
167
+ <?php echo $stars; ?>
168
+ Our average rating is <b><span class="strong-rating-summary">4.3 stars</span></b>
169
+ </div>
170
+ </td>
171
+ </tr>
172
+ </table>
173
+ </td>
174
+ </tr>
175
+ </table>
176
+
177
+ <table class="form-table shortcodes average">
178
+ <tr>
179
+ <td>
180
+ <p><code>{stars}</code></p>
181
+ </td>
182
+ <td class="has-inner">
183
+ <table class="inner" cellpadding="0" cellspacing="0">
184
+ <tr>
185
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{stars}&#91;/testimonial_average_rating&#93;</td>
186
+ </tr>
187
+ <tr>
188
+ <td>
189
+ <div class="strong-rating-wrapper average">
190
+ <?php echo $stars; ?>
191
+ </div>
192
+ </td>
193
+ </tr>
194
+ </table>
195
+ </td>
196
+ </tr>
197
+ </table>
198
+
199
+ <table class="form-table shortcodes average">
200
+ <tr>
201
+ <td>
202
+ <p><code>{average}</code></p>
203
+ </td>
204
+ <td class="has-inner">
205
+ <table class="inner" cellpadding="0" cellspacing="0">
206
+ <tr>
207
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{average}&#91;/testimonial_average_rating&#93;</td>
208
+ </tr>
209
+ <tr>
210
+ <td>
211
+ <div class="strong-rating-wrapper average"><span class="strong-rating-average">4.3</span></div>
212
+ </td>
213
+ </tr>
214
+ </table>
215
+ </td>
216
+ </tr>
217
+ </table>
218
+
219
+ <table class="form-table shortcodes average">
220
+ <tr>
221
+ <td>
222
+ <p><code>{count}</code></p>
223
+ </td>
224
+ <td class="has-inner">
225
+ <table class="inner" cellpadding="0" cellspacing="0">
226
+ <tr>
227
+ <td class="shortcode">&#91;testimonial_average_rating&#93;{count}&#91;/testimonial_average_rating&#93;</td>
228
+ </tr>
229
+ <tr>
230
+ <td>
231
+ <div class="strong-rating-wrapper average"><span class="strong-rating-count">9</span></div>
232
+ </td>
233
+ </tr>
234
+ </table>
235
+ </td>
236
+ </tr>
237
+ </table>
238
+
239
+ <table class="form-table shortcodes average">
240
+ <tr>
241
+ <td>
242
+ <p><code>block</code></p>
243
+ </td>
244
+ <td class="has-inner">
245
+ <table class="inner" cellpadding="0" cellspacing="0">
246
+ <tr>
247
+ <td class="shortcode">&#91;testimonial_average_rating block /&#93;</td>
248
+ </tr>
249
+ <tr>
250
+ <td>
251
+ <div class="strong-rating-wrapper average block"><span class="strong-rating-title">Average Rating:</span>
252
+ <?php echo $stars; ?>
253
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
254
+ </div>
255
+ </td>
256
+ </tr>
257
+ </table>
258
+ </td>
259
+ </tr>
260
+ </table>
261
+
262
+ <table class="form-table shortcodes average">
263
+ <tr>
264
+ <td>
265
+ <p><code>centered</code></p>
266
+ </td>
267
+ <td class="has-inner">
268
+ <table class="inner" cellpadding="0" cellspacing="0">
269
+ <tr>
270
+ <td class="shortcode">&#91;testimonial_average_rating centered /&#93;</td>
271
+ </tr>
272
+ <tr>
273
+ <td>
274
+ <div class="strong-rating-wrapper average centered"><span class="strong-rating-title">Average Rating:</span>
275
+ <?php echo $stars; ?>
276
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
277
+ </div>
278
+ </td>
279
+ </tr>
280
+ </table>
281
+ </td>
282
+ </tr>
283
+ </table>
284
+
285
+ <table class="form-table shortcodes average">
286
+ <tr>
287
+ <td>
288
+ <p><code>block</code> and <code>centered</code></p>
289
+ </td>
290
+ <td class="has-inner">
291
+ <table class="inner" cellpadding="0" cellspacing="0">
292
+ <tr>
293
+ <td class="shortcode">&#91;testimonial_average_rating block centered /&#93;</td>
294
+ </tr>
295
+ <tr>
296
+ <td>
297
+ <div class="strong-rating-wrapper average block centered"><span class="strong-rating-title">Average Rating:</span>
298
+ <?php echo $stars; ?>
299
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
300
+ </div>
301
+ </td>
302
+ </tr>
303
+ </table>
304
+ </td>
305
+ </tr>
306
+ </table>
307
+
308
+ <table class="form-table shortcodes average">
309
+ <tr>
310
+ <td>
311
+ <p><?php _e( 'The default container element is <code>div</code>. Select another element using <code>element</code>.', 'strong-testimonials' ); ?></p>
312
+ </td>
313
+ <td class="has-inner">
314
+ <table class="inner" cellpadding="0" cellspacing="0">
315
+ <tr>
316
+ <td class="shortcode">&#91;testimonial_average_rating element="span" /&#93;</td>
317
+ </tr>
318
+ <tr>
319
+ <td>
320
+ <span class="strong-rating-wrapper average">
321
+ <span class="strong-rating-title">Average Rating:</span>
322
+ <?php echo $stars; ?>
323
+ <span class="strong-rating-summary">4.3 stars (based on 9 ratings)</span>
324
+ </span>
325
+ </td>
326
+ </tr>
327
+ </table>
328
+ </td>
329
+ </tr>
330
+ </table>
331
+
332
+ </div>
333
+ <?php
334
+ }
335
+
336
+ }
admin/class-strong-testimonials-post-editor.php CHANGED
@@ -1,368 +1,368 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Post_Editor
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Post_Editor {
9
-
10
- /**
11
- * Strong_Testimonials_Post_Editor constructor.
12
- */
13
- public function __construct() {
14
- }
15
-
16
- /**
17
- * Initialize.
18
- */
19
- public static function init() {
20
- self::add_actions();
21
- }
22
-
23
- /**
24
- * Add actions and filters.
25
- */
26
- public static function add_actions() {
27
- add_action( 'add_meta_boxes_wpm-testimonial', array( __CLASS__, 'add_meta_boxes' ) );
28
- add_action( 'save_post_wpm-testimonial', array( __CLASS__, 'save_details' ) );
29
- add_action( 'wp_ajax_wpmtst_edit_rating', array( __CLASS__, 'edit_rating' ) );
30
- add_filter( 'wp_insert_post_data', array( __CLASS__, 'prevent_shortcode' ), 10, 2 );
31
- }
32
-
33
- /**
34
- * Add meta box to the post editor screen.
35
- */
36
- public static function add_meta_boxes() {
37
- add_meta_box(
38
- 'details',
39
- _x( 'Client Details', 'post editor', 'strong-testimonials' ),
40
- array( __CLASS__, 'meta_options' ),
41
- 'wpm-testimonial',
42
- 'normal',
43
- 'high'
44
- );
45
- }
46
-
47
- /**
48
- * Add custom fields to the testimonial editor.
49
- */
50
- public static function meta_options() {
51
- global $post, $pagenow;
52
- $post = wpmtst_get_post( $post );
53
- $fields = wpmtst_get_custom_fields();
54
- $is_new = ( 'post-new.php' == $pagenow );
55
- ?>
56
- <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
57
- <table class="options">
58
- <tr>
59
- <td colspan="2">
60
- <p><?php _ex( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
61
- </td>
62
- </tr>
63
- <?php
64
- do_action( 'wpmtst_before_client_fields' );
65
- foreach ( $fields as $key => $field ) {
66
- // TODO Use field property to bypass instead
67
- // short-circuit
68
- if ( 'category' == strtok( $field['input_type'], '-' ) ) {
69
- continue;
70
- }
71
- ?>
72
- <tr>
73
- <th>
74
- <label for="<?php echo esc_attr( $field['name'] ); ?>">
75
- <?php echo apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ); ?>
76
- </label>
77
- </th>
78
- <td>
79
- <div class="<?php echo esc_attr( $field['input_type'] ); ?>">
80
- <?php self::meta_option( $field, $post, $is_new ); ?>
81
- </div>
82
- </td>
83
- </tr>
84
- <?php
85
- }
86
- do_action( 'wpmtst_after_client_fields' );
87
- ?>
88
- </table>
89
- <?php
90
- do_action( 'wpmtst_after_client_fields_table' );
91
- }
92
-
93
- /**
94
- * Input type for a single custom field.
95
- *
96
- * @since 2.23.0
97
- *
98
- * @param $field
99
- * @param $post
100
- * @param $is_new
101
- */
102
- public static function meta_option( $field, $post, $is_new ) {
103
- // Check for callback first.
104
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
105
- self::meta_option__action( $field, $post, $is_new );
106
- }
107
- // Check field type.
108
- else {
109
- switch ( $field['input_type'] ) {
110
- case 'rating' :
111
- self::meta_option__rating( $field, $post, $is_new );
112
- break;
113
- case 'url' :
114
- self::meta_option__url( $field, $post, $is_new );
115
- break;
116
- case 'checkbox' :
117
- self::meta_option__checkbox( $field, $post, $is_new );
118
- break;
119
- case 'shortcode' :
120
- self::meta_option__shortcode( $field, $post, $is_new );
121
- break;
122
- case 'textarea' :
123
- self::meta_option__textarea( $field, $post, $is_new );
124
- break;
125
- default :
126
- self::meta_option__text( $field, $post, $is_new );
127
- }
128
- }
129
- }
130
-
131
- /**
132
- * Custom action callback.
133
- *
134
- * @param $field
135
- * @param $post
136
- * @param $is_new
137
- */
138
- private static function meta_option__action( $field, $post, $is_new ) {
139
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
140
- do_action( $field['action_input'], $field, $post->{$field['name']} );
141
- }
142
- }
143
-
144
- /**
145
- * Text input.
146
- *
147
- * @param $field
148
- * @param $post
149
- * @param $is_new
150
- */
151
- private static function meta_option__text( $field, $post, $is_new ) {
152
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
153
- $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
154
- }
155
-
156
- /**
157
- * Textarea.
158
- *
159
- * @param $field
160
- * @param $post
161
- * @param $is_new
162
- */
163
- private static function meta_option__textarea( $field, $post, $is_new ) {
164
- printf(
165
- '<textarea id="%1$s" name="custom[%1$s]" class="custom-input">%2$s</textarea>',
166
- esc_attr( $field['name'] ),
167
- esc_attr( $post->{$field['name']} )
168
- );
169
- }
170
-
171
- /**
172
- * URL input.
173
- *
174
- * @param $field
175
- * @param $post
176
- * @param $is_new
177
- */
178
- private static function meta_option__url( $field, $post, $is_new ) {
179
- ?>
180
- <div class="input-url">
181
- <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
182
- $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) ); ?>
183
- </div>
184
- <div class="input-nofollow">
185
- <label for="custom_nofollow"><code>rel="nofollow"</code></label>
186
- <select id="custom_nofollow" name="custom[nofollow]">
187
- <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php _e( 'default', 'strong-testimonials' ); ?></option>
188
- <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php _e( 'yes', 'strong-testimonials' ); ?></option>
189
- <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php _e( 'no', 'strong-testimonials' ); ?></option>
190
- </select>
191
- </div>
192
- <?php
193
- }
194
-
195
- /**
196
- * Checkbox input.
197
- *
198
- * @param $field
199
- * @param $post
200
- * @param $is_new
201
- */
202
- private static function meta_option__checkbox( $field, $post, $is_new ) {
203
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
204
- $field['input_type'], $field['name'], 1, checked( $post->{$field['name']}, 1, false ) );
205
- }
206
-
207
- /**
208
- * Rating input.
209
- *
210
- * @param $field
211
- * @param $post
212
- * @param $is_new
213
- */
214
- private static function meta_option__rating( $field, $post, $is_new ) {
215
- $rating = get_post_meta( $post->ID, $field['name'], true );
216
- if ( ! $rating || $is_new ) {
217
- $rating = 0;
218
- }
219
- ?>
220
- <div class="edit-rating-box hide-if-no-js" data-field="<?php echo $field['name']; ?>">
221
-
222
- <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
223
- <input type="hidden" class="current-rating" value="<?php echo $rating; ?>">
224
-
225
- <!-- form -->
226
- <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
227
- <span class="inner">
228
- <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
229
- </span>
230
- <?php if ( ! $is_new ) : ?>
231
- <span class="edit-rating-buttons-2">
232
- <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
233
- <button type="button" class="save button button-small"><?php esc_html_e( 'OK', 'strong-testimonials' ); ?></button>&nbsp;
234
- <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel', 'strong-testimonials' ); ?></button>
235
- </span>
236
- <?php endif; ?>
237
- </div>
238
-
239
- <!-- display -->
240
- <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
241
- <span class="inner">
242
- <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
243
- </span>
244
-
245
- <?php if ( ! $is_new ) : ?>
246
- <span class="edit-rating-buttons-1">
247
- <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit', 'strong-testimonials' ); ?></button>
248
- </span>
249
- <?php endif; ?>
250
- </div>
251
-
252
- <span class="edit-rating-success"></span>
253
-
254
- </div>
255
- <?php
256
- }
257
-
258
- /**
259
- * Shortcode for custom input.
260
- *
261
- * @param $field
262
- * @param $post
263
- * @param $is_new
264
- */
265
- public static function meta_option__shortcode( $field, $post, $is_new ) {
266
- $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
267
- if ( shortcode_exists( $shortcode ) ) {
268
- echo do_shortcode( $field['shortcode_on_display'] );
269
- } else {
270
- echo '<div class="custom-input not-found">' . sprintf( __( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . $field['shortcode_on_display'] . '</code>' ) . '</div>';
271
- }
272
- }
273
-
274
- /**
275
- * Save custom fields.
276
- *
277
- * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
278
- */
279
- public static function save_details() {
280
- if ( ! isset( $_POST['custom'] ) ) {
281
- return;
282
- }
283
-
284
- $custom = $_POST['custom'];
285
-
286
- $custom_fields = wpmtst_get_custom_fields();
287
-
288
- // Construct array of checkbox empty values because blank checkboxes are not POSTed.
289
- $checkboxes = array();
290
- foreach ( $custom_fields as $key => $field ) {
291
- if ( 'checkbox' == $field['input_type'] ) {
292
- $checkboxes[ $key ] = 0;
293
- }
294
- }
295
- if ( $checkboxes ) {
296
- $custom = array_merge( $checkboxes, $custom );
297
- }
298
-
299
- // Determine whether to update or delete.
300
- // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
301
- foreach ( $custom as $key => $value ) {
302
- $action = 'update';
303
-
304
- if ( isset( $custom_fields[ $key ] ) ) {
305
- if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
306
- $action = 'delete';
307
- }
308
- }
309
-
310
- if ( 'update' == $action ) {
311
- // empty values replace existing values
312
- update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
313
- }
314
- else {
315
- // delete value; e.g. zero rating
316
- delete_post_meta( $_POST['post_ID'], $key );
317
- }
318
- }
319
- }
320
-
321
- /**
322
- * Prevent use of this plugin's shortcode in a testimonial.
323
- *
324
- * @since 2.32.2
325
- * @param $data
326
- * @param $postarr
327
- *
328
- * @return mixed
329
- */
330
- public static function prevent_shortcode( $data, $postarr ) {
331
- if ( 'wpm-testimonial' == $data['post_type'] ) {
332
- $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
333
- }
334
-
335
- return $data;
336
- }
337
-
338
- /**
339
- * Ajax handler to edit a rating.
340
- *
341
- * @since 2.12.0
342
- */
343
- public static function edit_rating() {
344
- $message = '';
345
- $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
346
- $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
347
- $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
348
-
349
- check_ajax_referer( 'editrating', 'editratingnonce' );
350
-
351
- if ( $post_id ) {
352
- if ( $rating ) {
353
- update_post_meta( $post_id, $name, $rating );
354
- } else {
355
- delete_post_meta( $post_id, $name );
356
- }
357
- $message = 'New rating saved';
358
- }
359
-
360
- $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
361
- $response = array( 'display' => $display, 'message' => $message );
362
- echo json_encode( $response );
363
- wp_die();
364
- }
365
-
366
- }
367
-
368
- Strong_Testimonials_Post_Editor::init();
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Post_Editor
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Post_Editor {
9
+
10
+ /**
11
+ * Strong_Testimonials_Post_Editor constructor.
12
+ */
13
+ public function __construct() {
14
+ }
15
+
16
+ /**
17
+ * Initialize.
18
+ */
19
+ public static function init() {
20
+ self::add_actions();
21
+ }
22
+
23
+ /**
24
+ * Add actions and filters.
25
+ */
26
+ public static function add_actions() {
27
+ add_action( 'add_meta_boxes_wpm-testimonial', array( __CLASS__, 'add_meta_boxes' ) );
28
+ add_action( 'save_post_wpm-testimonial', array( __CLASS__, 'save_details' ) );
29
+ add_action( 'wp_ajax_wpmtst_edit_rating', array( __CLASS__, 'edit_rating' ) );
30
+ add_filter( 'wp_insert_post_data', array( __CLASS__, 'prevent_shortcode' ), 10, 2 );
31
+ }
32
+
33
+ /**
34
+ * Add meta box to the post editor screen.
35
+ */
36
+ public static function add_meta_boxes() {
37
+ add_meta_box(
38
+ 'details',
39
+ _x( 'Client Details', 'post editor', 'strong-testimonials' ),
40
+ array( __CLASS__, 'meta_options' ),
41
+ 'wpm-testimonial',
42
+ 'normal',
43
+ 'high'
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Add custom fields to the testimonial editor.
49
+ */
50
+ public static function meta_options() {
51
+ global $post, $pagenow;
52
+ $post = wpmtst_get_post( $post );
53
+ $fields = wpmtst_get_custom_fields();
54
+ $is_new = ( 'post-new.php' == $pagenow );
55
+ ?>
56
+ <?php do_action( 'wpmtst_before_client_fields_table' ); ?>
57
+ <table class="options">
58
+ <tr>
59
+ <td colspan="2">
60
+ <p><?php _ex( 'To add a photo or logo, use the Featured Image option.', 'post editor', 'strong-testimonials' ); ?></p>
61
+ </td>
62
+ </tr>
63
+ <?php
64
+ do_action( 'wpmtst_before_client_fields' );
65
+ foreach ( $fields as $key => $field ) {
66
+ // TODO Use field property to bypass instead
67
+ // short-circuit
68
+ if ( 'category' == strtok( $field['input_type'], '-' ) ) {
69
+ continue;
70
+ }
71
+ ?>
72
+ <tr>
73
+ <th>
74
+ <label for="<?php echo esc_attr( $field['name'] ); ?>">
75
+ <?php echo apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' ); ?>
76
+ </label>
77
+ </th>
78
+ <td>
79
+ <div class="<?php echo esc_attr( $field['input_type'] ); ?>">
80
+ <?php self::meta_option( $field, $post, $is_new ); ?>
81
+ </div>
82
+ </td>
83
+ </tr>
84
+ <?php
85
+ }
86
+ do_action( 'wpmtst_after_client_fields' );
87
+ ?>
88
+ </table>
89
+ <?php
90
+ do_action( 'wpmtst_after_client_fields_table' );
91
+ }
92
+
93
+ /**
94
+ * Input type for a single custom field.
95
+ *
96
+ * @since 2.23.0
97
+ *
98
+ * @param $field
99
+ * @param $post
100
+ * @param $is_new
101
+ */
102
+ public static function meta_option( $field, $post, $is_new ) {
103
+ // Check for callback first.
104
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
105
+ self::meta_option__action( $field, $post, $is_new );
106
+ }
107
+ // Check field type.
108
+ else {
109
+ switch ( $field['input_type'] ) {
110
+ case 'rating' :
111
+ self::meta_option__rating( $field, $post, $is_new );
112
+ break;
113
+ case 'url' :
114
+ self::meta_option__url( $field, $post, $is_new );
115
+ break;
116
+ case 'checkbox' :
117
+ self::meta_option__checkbox( $field, $post, $is_new );
118
+ break;
119
+ case 'shortcode' :
120
+ self::meta_option__shortcode( $field, $post, $is_new );
121
+ break;
122
+ case 'textarea' :
123
+ self::meta_option__textarea( $field, $post, $is_new );
124
+ break;
125
+ default :
126
+ self::meta_option__text( $field, $post, $is_new );
127
+ }
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Custom action callback.
133
+ *
134
+ * @param $field
135
+ * @param $post
136
+ * @param $is_new
137
+ */
138
+ private static function meta_option__action( $field, $post, $is_new ) {
139
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
140
+ do_action( $field['action_input'], $field, $post->{$field['name']} );
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Text input.
146
+ *
147
+ * @param $field
148
+ * @param $post
149
+ * @param $is_new
150
+ */
151
+ private static function meta_option__text( $field, $post, $is_new ) {
152
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
153
+ $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
154
+ }
155
+
156
+ /**
157
+ * Textarea.
158
+ *
159
+ * @param $field
160
+ * @param $post
161
+ * @param $is_new
162
+ */
163
+ private static function meta_option__textarea( $field, $post, $is_new ) {
164
+ printf(
165
+ '<textarea id="%1$s" name="custom[%1$s]" class="custom-input">%2$s</textarea>',
166
+ esc_attr( $field['name'] ),
167
+ esc_attr( $post->{$field['name']} )
168
+ );
169
+ }
170
+
171
+ /**
172
+ * URL input.
173
+ *
174
+ * @param $field
175
+ * @param $post
176
+ * @param $is_new
177
+ */
178
+ private static function meta_option__url( $field, $post, $is_new ) {
179
+ ?>
180
+ <div class="input-url">
181
+ <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
182
+ $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) ); ?>
183
+ </div>
184
+ <div class="input-nofollow">
185
+ <label for="custom_nofollow"><code>rel="nofollow"</code></label>
186
+ <select id="custom_nofollow" name="custom[nofollow]">
187
+ <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php _e( 'default', 'strong-testimonials' ); ?></option>
188
+ <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php _e( 'yes', 'strong-testimonials' ); ?></option>
189
+ <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php _e( 'no', 'strong-testimonials' ); ?></option>
190
+ </select>
191
+ </div>
192
+ <?php
193
+ }
194
+
195
+ /**
196
+ * Checkbox input.
197
+ *
198
+ * @param $field
199
+ * @param $post
200
+ * @param $is_new
201
+ */
202
+ private static function meta_option__checkbox( $field, $post, $is_new ) {
203
+ printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
204
+ $field['input_type'], $field['name'], 1, checked( $post->{$field['name']}, 1, false ) );
205
+ }
206
+
207
+ /**
208
+ * Rating input.
209
+ *
210
+ * @param $field
211
+ * @param $post
212
+ * @param $is_new
213
+ */
214
+ private static function meta_option__rating( $field, $post, $is_new ) {
215
+ $rating = get_post_meta( $post->ID, $field['name'], true );
216
+ if ( ! $rating || $is_new ) {
217
+ $rating = 0;
218
+ }
219
+ ?>
220
+ <div class="edit-rating-box hide-if-no-js" data-field="<?php echo $field['name']; ?>">
221
+
222
+ <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
223
+ <input type="hidden" class="current-rating" value="<?php echo $rating; ?>">
224
+
225
+ <!-- form -->
226
+ <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
227
+ <span class="inner">
228
+ <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
229
+ </span>
230
+ <?php if ( ! $is_new ) : ?>
231
+ <span class="edit-rating-buttons-2">
232
+ <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
233
+ <button type="button" class="save button button-small"><?php esc_html_e( 'OK', 'strong-testimonials' ); ?></button>&nbsp;
234
+ <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel', 'strong-testimonials' ); ?></button>
235
+ </span>
236
+ <?php endif; ?>
237
+ </div>
238
+
239
+ <!-- display -->
240
+ <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
241
+ <span class="inner">
242
+ <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
243
+ </span>
244
+
245
+ <?php if ( ! $is_new ) : ?>
246
+ <span class="edit-rating-buttons-1">
247
+ <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit', 'strong-testimonials' ); ?></button>
248
+ </span>
249
+ <?php endif; ?>
250
+ </div>
251
+
252
+ <span class="edit-rating-success"></span>
253
+
254
+ </div>
255
+ <?php
256
+ }
257
+
258
+ /**
259
+ * Shortcode for custom input.
260
+ *
261
+ * @param $field
262
+ * @param $post
263
+ * @param $is_new
264
+ */
265
+ public static function meta_option__shortcode( $field, $post, $is_new ) {
266
+ $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
267
+ if ( shortcode_exists( $shortcode ) ) {
268
+ echo do_shortcode( $field['shortcode_on_display'] );
269
+ } else {
270
+ echo '<div class="custom-input not-found">' . sprintf( __( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . $field['shortcode_on_display'] . '</code>' ) . '</div>';
271
+ }
272
+ }
273
+
274
+ /**
275
+ * Save custom fields.
276
+ *
277
+ * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
278
+ */
279
+ public static function save_details() {
280
+ if ( ! isset( $_POST['custom'] ) ) {
281
+ return;
282
+ }
283
+
284
+ $custom = $_POST['custom'];
285
+
286
+ $custom_fields = wpmtst_get_custom_fields();
287
+
288
+ // Construct array of checkbox empty values because blank checkboxes are not POSTed.
289
+ $checkboxes = array();
290
+ foreach ( $custom_fields as $key => $field ) {
291
+ if ( 'checkbox' == $field['input_type'] ) {
292
+ $checkboxes[ $key ] = 0;
293
+ }
294
+ }
295
+ if ( $checkboxes ) {
296
+ $custom = array_merge( $checkboxes, $custom );
297
+ }
298
+
299
+ // Determine whether to update or delete.
300
+ // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
301
+ foreach ( $custom as $key => $value ) {
302
+ $action = 'update';
303
+
304
+ if ( isset( $custom_fields[ $key ] ) ) {
305
+ if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
306
+ $action = 'delete';
307
+ }
308
+ }
309
+
310
+ if ( 'update' == $action ) {
311
+ // empty values replace existing values
312
+ update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
313
+ }
314
+ else {
315
+ // delete value; e.g. zero rating
316
+ delete_post_meta( $_POST['post_ID'], $key );
317
+ }
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Prevent use of this plugin's shortcode in a testimonial.
323
+ *
324
+ * @since 2.32.2
325
+ * @param $data
326
+ * @param $postarr
327
+ *
328
+ * @return mixed
329
+ */
330
+ public static function prevent_shortcode( $data, $postarr ) {
331
+ if ( 'wpm-testimonial' == $data['post_type'] ) {
332
+ $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
333
+ }
334
+
335
+ return $data;
336
+ }
337
+
338
+ /**
339
+ * Ajax handler to edit a rating.
340
+ *
341
+ * @since 2.12.0
342
+ */
343
+ public static function edit_rating() {
344
+ $message = '';
345
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
346
+ $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
347
+ $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
348
+
349
+ check_ajax_referer( 'editrating', 'editratingnonce' );
350
+
351
+ if ( $post_id ) {
352
+ if ( $rating ) {
353
+ update_post_meta( $post_id, $name, $rating );
354
+ } else {
355
+ delete_post_meta( $post_id, $name );
356
+ }
357
+ $message = 'New rating saved';
358
+ }
359
+
360
+ $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
361
+ $response = array( 'display' => $display, 'message' => $message );
362
+ echo json_encode( $response );
363
+ wp_die();
364
+ }
365
+
366
+ }
367
+
368
+ Strong_Testimonials_Post_Editor::init();
admin/class-strong-testimonials-updater.php CHANGED
@@ -1,1293 +1,1293 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Updater
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Updater {
9
-
10
- /**
11
- * The version before updating.
12
- *
13
- * @var string
14
- */
15
- private static $old_version;
16
-
17
- /**
18
- * Log steps during update process.
19
- *
20
- * @var array
21
- */
22
- private static $new_log;
23
-
24
- /**
25
- * Strong_Testimonials_Updater constructor.
26
- */
27
- public function __construct() {
28
-
29
- }
30
-
31
- /**
32
- * Add a log entry.
33
- *
34
- * @param $name
35
- * @param string $entry
36
- * @param string $var
37
- */
38
- private static function log( $name, $entry = '', $var = '' ) {
39
- if ( $name ) {
40
- $x = $name;
41
- if ( $entry ) {
42
- $x .= ' : ' . $entry;
43
- if ( $var ) {
44
- $x .= ' = ';
45
- if ( is_array( $var ) || is_object( $var ) ) {
46
- // log the text
47
- self::$new_log[] = $x;
48
- // then log the variable
49
- self::$new_log[] = $var;
50
- }
51
- else {
52
- self::$new_log[] = $x . $var;
53
- }
54
- }
55
- else {
56
- self::$new_log[] = $x;
57
- }
58
- }
59
- else {
60
- self::$new_log[] = $x;
61
- }
62
- }
63
- }
64
-
65
- /**
66
- * Plugin activation and update.
67
- *
68
- * ---------
69
- * REMEMBER!
70
- * ---------
71
- * If you are changing the value of a default field property,
72
- * then you need to unset that value in the current field
73
- * before merging in the new default values.
74
- *
75
- * For example, when changing a rating field property from
76
- * disabled (0) to enabled (1) in order for the property to
77
- * be displayed in the form editor.
78
- */
79
- public static function update() {
80
- if ( get_transient( 'wpmtst_update_in_progress' ) ) {
81
- return;
82
- }
83
-
84
- set_transient( 'wpmtst_update_in_progress', 1, 10 );
85
-
86
- /**
87
- * Add custom capablities.
88
- *
89
- * @since 2.27.1
90
- */
91
- self::add_caps();
92
-
93
- /**
94
- * Check DB version.
95
- */
96
- self::update_db_check();
97
-
98
- /**
99
- * Let's start updating.
100
- */
101
- $history = get_option( 'wpmtst_history', array() );
102
-
103
- /**
104
- * Options.
105
- */
106
- update_option( 'wpmtst_options', self::update_options() );
107
-
108
- /**
109
- * Custom fields.
110
- */
111
- update_option( 'wpmtst_fields', self::update_fields() );
112
-
113
- /**
114
- * Forms.
115
- */
116
- update_option( 'wpmtst_base_forms', self::update_base_forms() );
117
- update_option( 'wpmtst_custom_forms', self::update_custom_forms() );
118
- update_option( 'wpmtst_form_options', self::update_form_options() );
119
-
120
- /**
121
- * Compatibility options.
122
- *
123
- * @since 2.28.0
124
- */
125
- update_option( 'wpmtst_compat_options', self::update_compat_options() );
126
-
127
- /**
128
- * Overwrite default view options.
129
- *
130
- * @since 2.15.0
131
- */
132
- update_option( 'wpmtst_view_options', self::update_view_options() );
133
-
134
- /**
135
- * Overwrite default view settings.
136
- *
137
- * @since 2.15.0
138
- */
139
- update_option( 'wpmtst_view_default', self::update_default_view() );
140
-
141
- /**
142
- * Update views.
143
- */
144
- self::update_views();
145
-
146
- /**
147
- * Convert nofollow
148
- */
149
- if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
150
- self::convert_nofollow();
151
- self::update_history_log( '2.23.0_convert_nofollow' );
152
- }
153
-
154
-
155
- /**
156
- * Legacy stuff.
157
- */
158
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
159
- // Upgrade from version 1.x
160
- delete_option( 'wpmtst_cycle' );
161
-
162
- // L10n context no longer used.
163
- delete_option( 'wpmtst_l10n_contexts' );
164
-
165
- // Remove older attempts at admin notices.
166
- delete_option( 'wpmtst_news_flag' );
167
-
168
- self::update_history_log( '2.28_new_update_process' );
169
- }
170
-
171
- /**
172
- * Fix add-ons.
173
- */
174
- self::update_addons();
175
-
176
- /**
177
- * Update the plugin version.
178
- */
179
- update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
180
-
181
- /**
182
- * Update log.
183
- */
184
- self::update_log();
185
-
186
- /**
187
- * Update admin notices.
188
- */
189
- self::update_admin_notices();
190
-
191
- delete_transient( 'wpmtst_update_in_progress' );
192
- }
193
-
194
- /**
195
- * Fix add-on file names.
196
- *
197
- * @since 2.30.9
198
- */
199
- public static function update_addons() {
200
- $addons = get_option( 'wpmtst_addons' );
201
- if ( $addons ) {
202
- foreach ( $addons as $addon => $data ) {
203
- if ( isset( $addons[ $addon ]['file'] ) ) {
204
- $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
205
- }
206
- }
207
- update_option( 'wpmtst_addons', $addons );
208
- }
209
- }
210
-
211
- /**
212
- * Update the log in options table.
213
- */
214
- public static function update_log() {
215
- $log = get_option( 'wpmtst_update_log', array() );
216
- $log[ current_time( 'mysql' ) ] = self::$new_log;
217
- update_option( 'wpmtst_update_log', $log );
218
- }
219
-
220
- public static function update_admin_notices() {
221
- wpmtst_add_admin_notice( 'feedback-notice', true );
222
- wpmtst_add_admin_notice( 'upsell-notice', true );
223
- }
224
-
225
- /**
226
- * Return admin role.
227
- *
228
- * @since 2.27.0
229
- *
230
- * @return bool|null|WP_Role
231
- */
232
- public static function get_admins() {
233
- return get_role( 'administrator' );
234
- }
235
-
236
- /**
237
- * Add custom capabilities.
238
- *
239
- * @since 2.27.1
240
- */
241
- public static function add_caps() {
242
- $admins = self::get_admins();
243
- if ( $admins ) {
244
- $admins->add_cap( 'strong_testimonials_views' );
245
- $admins->add_cap( 'strong_testimonials_fields' );
246
- $admins->add_cap( 'strong_testimonials_options' );
247
- $admins->add_cap( 'strong_testimonials_about' );
248
- }
249
- else {
250
- self::log( __FUNCTION__, 'failed' );
251
- }
252
- }
253
-
254
- /**
255
- * Remove custom capabilities.
256
- *
257
- * Was part of uninstall process but cannot be run from static class.
258
- *
259
- * @todo Move to Leave No Trace.
260
- *
261
- * @since 2.27.1
262
- */
263
- public static function remove_caps() {
264
- if ( $admins = self::get_admins() ) {
265
- $admins->remove_cap( 'strong_testimonials_views' );
266
- $admins->remove_cap( 'strong_testimonials_fields' );
267
- $admins->remove_cap( 'strong_testimonials_options' );
268
- $admins->remove_cap( 'strong_testimonials_about' );
269
- }
270
- }
271
-
272
- /**
273
- * Update tables.
274
- *
275
- * @since 1.21.0 Checking for new table version.
276
- */
277
- public static function update_db_check() {
278
- if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
279
- wpmtst_update_tables();
280
- self::log( __FUNCTION__, 'tables updated' );
281
- }
282
- }
283
-
284
- /**
285
- * Update history log.
286
- *
287
- * @param $event
288
- */
289
- public static function update_history_log( $event ) {
290
- $history = get_option( 'wpmtst_history', array() );
291
- $history[ $event ] = current_time( 'mysql' );
292
- update_option( 'wpmtst_history', $history );
293
- }
294
-
295
- /**
296
- * Update options.
297
- *
298
- * @return array
299
- */
300
- public static function update_options() {
301
- $options = get_option( 'wpmtst_options' );
302
- if ( ! $options ) {
303
- return Strong_Testimonials_Defaults::get_options();
304
- }
305
-
306
- /**
307
- * Remove version 1 options
308
- */
309
- if ( version_compare( '2.0', self::$old_version ) ) {
310
-
311
- if ( isset( $options['captcha'] ) ) {
312
- unset( $options['captcha'] );
313
- }
314
-
315
- if ( isset( $options['plugin_version'] ) ) {
316
- unset( $options['plugin_version'] );
317
- }
318
-
319
- if ( isset( $options['per_page'] ) ) {
320
- unset( $options['per_page'] );
321
- }
322
-
323
- if ( isset( $options['load_page_style'] ) ) {
324
- unset( $options['load_page_style'] );
325
- }
326
-
327
- if ( isset( $options['load_widget_style'] ) ) {
328
- unset( $options['load_widget_style'] );
329
- }
330
-
331
- if ( isset( $options['load_form_style'] ) ) {
332
- unset( $options['load_form_style'] );
333
- }
334
-
335
- if ( isset( $options['load_rtl_style'] ) ) {
336
- unset( $options['load_rtl_style'] );
337
- }
338
-
339
- if ( isset( $options['shortcode'] ) ) {
340
- unset( $options['shortcode'] );
341
- }
342
-
343
- if ( isset( $options['default_template'] ) ) {
344
- unset( $options['default_template'] );
345
- }
346
-
347
- if ( isset( $options['client_section'] ) ) {
348
- unset( $options['client_section'] );
349
- }
350
-
351
- }
352
-
353
- /**
354
- * Remove slideshow z-index (Cycle)
355
- *
356
- * @since 2.15.0
357
- */
358
- if ( isset( $options['slideshow_zindex'] ) ) {
359
- unset( $options['slideshow_zindex'] );
360
- }
361
-
362
- /**
363
- * Replace zero embed_width with empty value.
364
- *
365
- * @since 2.27.0
366
- */
367
- if ( 0 === $options['embed_width'] ) {
368
- $options['embed_width'] = '';
369
- }
370
-
371
- /**
372
- * Remove email logging.
373
- *
374
- * @since 2.28.4
375
- */
376
- if ( isset( $options['email_log_level'] ) ) {
377
- unset( $options['email_log_level'] );
378
- }
379
-
380
- // Merge in new options
381
- $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
382
-
383
- return $options;
384
- }
385
-
386
- /**
387
- * Default custom fields.
388
- *
389
- * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
390
- * Overwrite existing fields on every update to auto-repair.
391
- *
392
- * @return array
393
- */
394
- public static function update_fields() {
395
- return Strong_Testimonials_Defaults::get_fields();
396
- }
397
-
398
- /**
399
- * Base forms.
400
- *
401
- * @return array
402
- */
403
- public static function update_base_forms() {
404
- return Strong_Testimonials_Defaults::get_base_forms();
405
- }
406
-
407
- /**
408
- * Custom forms.
409
- *
410
- * @return array
411
- */
412
- public static function update_custom_forms() {
413
- $custom_forms = get_option( 'wpmtst_custom_forms' );
414
- if ( ! $custom_forms ) {
415
- return Strong_Testimonials_Defaults::get_custom_forms();
416
- }
417
-
418
- foreach ( $custom_forms as $form_id => $form_properties ) {
419
- foreach ( $form_properties['fields'] as $key => $form_field ) {
420
-
421
- /*
422
- * Convert categories to category-selector.
423
- * @since 2.17.0
424
- */
425
- if ( 'categories' == $form_field['input_type'] ) {
426
- $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
427
- }
428
-
429
- /*
430
- * Unset `show_default_options` for rating field. Going from 0 to 1.
431
- * @since 2.21.0
432
- */
433
- if ( 'rating' == $form_field['input_type'] ) {
434
- unset( $form_field['show_default_options'] );
435
- }
436
-
437
- /*
438
- * Add `show_required_option` to shortcode field. Initial value is false.
439
- * @since 2.22.0
440
- */
441
- if ( 'shortcode' == $form_field['input_type'] ) {
442
- $form_field['show_required_option'] = false;
443
- }
444
-
445
- /*
446
- * Add `show_default_options` to checkbox field.
447
- *
448
- * @since 2.27.0
449
- */
450
- if ( 'checkbox' == $form_field['input_type'] ) {
451
- $form_field['show_default_options'] = 1;
452
- }
453
-
454
- /*
455
- * Merge in new default.
456
- * Custom fields are in display order (not associative) so we must find them by `input_type`.
457
- * @since 2.21.0 Using default fields instead of default form as source
458
- */
459
- $new_default = array();
460
- $fields = get_option( 'wpmtst_fields', array() );
461
-
462
- foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
463
- foreach ( $field_type_group as $field_type_key => $field_type_field ) {
464
- if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
465
- $new_default = $field_type_field;
466
- break;
467
- }
468
- }
469
- }
470
-
471
- if ( $new_default ) {
472
- $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
473
- }
474
-
475
- }
476
- }
477
-
478
- return $custom_forms;
479
- }
480
-
481
- /**
482
- * Form options.
483
- *
484
- * @return array
485
- */
486
- public static function update_form_options() {
487
- $form_options = get_option( 'wpmtst_form_options' );
488
- if ( ! $form_options ) {
489
- return Strong_Testimonials_Defaults::get_form_options();
490
- }
491
-
492
- $options = get_option( 'wpmtst_options', array() );
493
- $history = get_option( 'wpmtst_history', array() );
494
-
495
- /**
496
- * Move existing options.
497
- */
498
- if ( isset( $options['admin_notify'] ) ) {
499
- $form_options['admin_notify'] = $options['admin_notify'];
500
- unset( $options['admin_notify'] );
501
-
502
- $form_options['admin_email'] = $options['admin_email'];
503
- unset( $options['admin_email'] );
504
-
505
- update_option( 'wpmtst_options', $options );
506
- }
507
-
508
- /**
509
- * Update single email recipient to multiple.
510
- *
511
- * @since 1.18
512
- */
513
- if ( ! isset( $form_options['recipients'] ) ) {
514
- $form_options['recipients'] = array(
515
- array(
516
- 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
517
- 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
518
- 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
519
- 'primary' => 1, // cannot be deleted
520
- ),
521
- );
522
-
523
- unset( $form_options['admin_name'] );
524
- unset( $form_options['admin_site_email'] );
525
- unset( $form_options['admin_email'] );
526
- }
527
-
528
- /**
529
- * Add default required-notice setting
530
- *
531
- * @since 2.24.1
532
- */
533
- if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
534
- $form_options['messages']['required-field']['enabled'] = 1;
535
- }
536
-
537
- /**
538
- * Delete form options
539
- *
540
- * @since 2.38
541
- */
542
- unset( $form_options['captcha'] );
543
- unset( $form_options['messages']['captcha'] );
544
-
545
-
546
- /**
547
- * Merge in new options.
548
- */
549
- $defaults = Strong_Testimonials_Defaults::get_form_options();
550
-
551
- $form_options = array_merge( $defaults, $form_options );
552
-
553
- // Merge nested arrays individually. Don't use array_merge_recursive.
554
-
555
- $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
556
- foreach ( $defaults['messages'] as $key => $message ) {
557
- if( isset( $form_options['messages'][ $key ] ) ) {
558
- $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
559
- }
560
- }
561
-
562
- if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
563
- self::update_history_log( '2.29_captcha_options_changed' );
564
- if ( $notice ) {
565
- wpmtst_add_admin_notice( 'captcha-options-changed', true );
566
- }
567
- }
568
-
569
- return $form_options;
570
- }
571
-
572
- /**
573
- * Compatibility options.
574
- *
575
- * @since 2.28.0
576
- *
577
- * @return array
578
- */
579
- public static function update_compat_options() {
580
- $options = get_option( 'wpmtst_compat_options' );
581
- if ( ! $options ) {
582
- return Strong_Testimonials_Defaults::get_compat_options();
583
- }
584
-
585
- // Merge in new options.
586
- $defaults = Strong_Testimonials_Defaults::get_compat_options();
587
-
588
- // Merge nested arrays individually. Don't use array_merge_recursive.
589
-
590
- if ( isset( $options['controller'] ) ) {
591
- $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
592
- } else {
593
- $options['ajax'] = $defaults['ajax'];
594
- }
595
-
596
- /**
597
- * Controller
598
- *
599
- * @since 2.31.0
600
- */
601
- if ( isset( $options['controller'] ) ) {
602
- $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
603
- } else {
604
- $options['controller'] = $defaults['controller'];
605
- }
606
-
607
- /**
608
- * Lazy load
609
- *
610
- * @since 2.31.0
611
- */
612
- if ( isset( $options['lazyload'] ) ) {
613
- // first level only: enabled, classes (array)
614
- $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
615
- } else {
616
- $options['lazyload'] = $defaults['lazyload'];
617
- }
618
-
619
- $options = array_merge( $defaults, $options );
620
-
621
- return $options;
622
- }
623
-
624
- /**
625
- * View options.
626
- *
627
- * @return array
628
- */
629
- public static function update_view_options() {
630
- return Strong_Testimonials_Defaults::get_view_options();
631
- }
632
-
633
- /**
634
- * Default view.
635
- *
636
- * @return array
637
- */
638
- public static function update_default_view() {
639
- return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
640
- }
641
-
642
- /**
643
- * Update views.
644
- *
645
- * @uses wpmtst_save_view
646
- */
647
- public static function update_views() {
648
- $views = wpmtst_get_views();
649
-
650
- if ( ! $views ) {
651
- return;
652
- }
653
-
654
- $default_view = wpmtst_get_view_default();
655
- $history = get_option( 'wpmtst_history', array() );
656
-
657
- foreach ( $views as $key => $view ) {
658
-
659
- $view_data = unserialize( $view['value'] );
660
- if ( ! is_array( $view_data ) ) {
661
- self::log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
662
- continue;
663
- }
664
-
665
- /**
666
- * For version 2.28.
667
- */
668
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
669
- /**
670
- * Compat mode no longer needed.
671
- *
672
- * @since 2.22.0
673
- */
674
- unset( $view_data['compat'] );
675
-
676
- $view_data = self::convert_template_name( $view_data );
677
- $view_data = self::convert_background_color( $view_data );
678
- $view_data = self::convert_form_ajax( $view_data );
679
- $view_data = self::convert_layout( $view_data );
680
- $view_data = self::convert_word_count( $view_data );
681
- $view_data = self::convert_excerpt_length( $view_data );
682
- $view_data = self::convert_more_text( $view_data );
683
- $view_data = self::convert_modern_title( $view_data );
684
- $view_data = self::convert_slideshow( $view_data );
685
- $view_data = self::convert_title_link( $view_data );
686
- $view_data = self::convert_pagination_type( $view_data );
687
- }
688
-
689
- /**
690
- * For version 2.30.
691
- */
692
- if ( ! isset( $history['2.30_new_template_structure'] ) ) {
693
- $view_data = self::convert_template_structure( $view_data );
694
- $view_data = self::convert_count( $view_data );
695
- if ( isset( $view_data['background']['example-font-color'] ) ) {
696
- unset( $view_data['background']['example-font-color'] );
697
- }
698
-
699
- self::update_history_log( '2.30_new_template_structure' );
700
- }
701
-
702
- /**
703
- * Add carousel breakpoints.
704
- *
705
- * @since 2.32.2
706
- */
707
- if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
708
- $view['data'] = self::add_carousel_breakpoints( $view_data );
709
- self::update_history_log( '2.32.2_carousel_breakpoints' );
710
- }
711
-
712
- /**
713
- * Merge in new default values.
714
- * Merge nested arrays individually. Don't use array_merge_recursive.
715
- */
716
- $view['data'] = array_merge( $default_view, $view_data );
717
-
718
- /**
719
- * Background defaults.
720
- */
721
- $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
722
-
723
- /**
724
- * Pagination defaults.
725
- * Attempt to repair bug from 2.28.2
726
- *
727
- * @since 2.28.3
728
- */
729
- if ( isset( $view_data['pagination_settings'] ) ) {
730
- $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
731
-
732
- if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
733
- $view['data']['pagination_settings']['end_size'] = 1;
734
- }
735
- if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
736
- $view['data']['pagination_settings']['mid_size'] = 2;
737
- }
738
- if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
739
- $view['data']['pagination_settings']['per_page'] = 5;
740
- }
741
- } else {
742
- $view['data']['pagination_settings'] = $default_view['pagination_settings'];
743
- }
744
-
745
- /**
746
- * Slideshow defaults.
747
- */
748
- if ( isset( $view_data['slideshow_settings'] ) ) {
749
- $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
750
- } else {
751
- $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
752
- }
753
- ksort( $view['data']['slideshow_settings'] );
754
-
755
- /**
756
- * Save it.
757
- */
758
- wpmtst_save_view( $view );
759
-
760
- } // foreach $view
761
- }
762
-
763
- /**
764
- * Add carousel breakpoints.
765
- *
766
- * @param array $view_data
767
- * @since 2.32.2
768
- *
769
- * @return array
770
- */
771
- public static function add_carousel_breakpoints( $view_data ) {
772
- if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
773
- return $view_data;
774
- }
775
-
776
- if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
777
-
778
- // Convert to single
779
- $view_data['slideshow_settings']['type'] = 'show_single';
780
-
781
- $view_data['slideshow_settings']['show_single'] = array(
782
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
783
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
784
- 'margin' => 1,
785
- );
786
-
787
- } else {
788
-
789
- // Convert to multiple
790
- $view_data['slideshow_settings']['type'] = 'show_multiple';
791
-
792
- $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
793
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
794
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
795
- 'margin' => 1,
796
- );
797
-
798
- }
799
-
800
- // Remove old values
801
- unset(
802
- $view_data['slideshow_settings']['max_slides'],
803
- $view_data['slideshow_settings']['move_slides'],
804
- $view_data['slideshow_settings']['margin']
805
- );
806
-
807
- return $view_data;
808
- }
809
-
810
- /**
811
- * Convert template naming structure.
812
- *
813
- * @since 2.30.0
814
- *
815
- * @param $view_data
816
- *
817
- * @return array
818
- */
819
- public static function convert_template_structure( $view_data ) {
820
- /*
821
- Array
822
- (
823
- [0] => default:content
824
- [1] => default-dark:form
825
- [2] => default-dark:content
826
- [3] => default:form
827
- [4] => image-right:content
828
- [5] => no-quotes:content
829
- [6] => large:widget
830
- [7] => modern:content
831
- [8] => simple:content
832
- [9] => simple:form
833
- [10] => unstyled:content
834
- [11] => unstyled:form
835
- [12] => default:widget
836
- [13] => image-right:widget
837
- )
838
- */
839
- switch ( $view_data['template'] ) {
840
- case 'default:content' :
841
- $view_data['template'] = 'default';
842
- break;
843
- case 'default-dark:form' :
844
- $view_data['template'] = 'default-form';
845
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
846
- break;
847
- case 'default-dark:content' :
848
- $view_data['template'] = 'default';
849
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
850
- break;
851
- case 'default:form' :
852
- $view_data['template'] = 'default-form';
853
- break;
854
- case 'image-right:content' :
855
- $view_data['template'] = 'default';
856
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
857
- break;
858
- case 'no-quotes:content' :
859
- $view_data['template'] = 'default';
860
- $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
861
- break;
862
- case 'large:widget' :
863
- $view_data['template'] = 'bold';
864
- break;
865
- case 'modern:content' :
866
- $view_data['template'] = 'modern';
867
- break;
868
- case 'simple:content' :
869
- $view_data['template'] = 'simple';
870
- break;
871
- case 'simple:form' :
872
- $view_data['template'] = 'simple-form';
873
- break;
874
- case 'unstyled:content' :
875
- $view_data['template'] = 'unstyled';
876
- break;
877
- case 'unstyled:form' :
878
- $view_data['template'] = 'unstyled-form';
879
- break;
880
- case 'default:widget' :
881
- $view_data['template'] = 'small-widget';
882
- break;
883
- case 'image-right:widget' :
884
- $view_data['template'] = 'small-widget';
885
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
886
- break;
887
- default:
888
- // Keep existing value; it's probably a custom template.
889
- }
890
-
891
- return $view_data;
892
- }
893
-
894
- /**
895
- * Update template naming structure.
896
- *
897
- * @param $view_data
898
- *
899
- * @return array
900
- */
901
- public static function convert_template_name( $view_data ) {
902
- // Change default template from empty to 'default:{type}'
903
- if ( ! $view_data['template'] ) {
904
- if ( 'form' == $view_data['mode'] ) {
905
- $type = 'form';
906
- }
907
- else {
908
- $type = 'content';
909
- }
910
-
911
- $view_data['template'] = "default:$type";
912
- }
913
- else {
914
- // Convert name; e.g. 'simple/testimonials.php'
915
- if ( 'widget/testimonials.php' == $view_data['template'] ) {
916
- $view_data['template'] = 'default:widget';
917
- }
918
- else {
919
- $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
920
- $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
921
- $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
922
- }
923
- }
924
-
925
- return $view_data;
926
- }
927
-
928
- /**
929
- * Convert length (characters).
930
- *
931
- * @since 2.10.0 word_count (deprecated)
932
- * @since 2.11.4 excerpt_length
933
- *
934
- * @param $view_data
935
- *
936
- * @return array
937
- */
938
- public static function convert_excerpt_length( $view_data ) {
939
- if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
940
- $default_view = Strong_Testimonials_Defaults::get_default_view();
941
- $average_word_length = self::get_average_word_length();
942
-
943
- if ( isset( $view_data['length'] ) && $view_data['length'] ) {
944
- $word_count = round( $view_data['length'] / $average_word_length );
945
- $word_count = $word_count < 5 ? 5 : $word_count;
946
- $word_count = $word_count > 300 ? 300 : $word_count;
947
- $view_data['excerpt_length'] = $word_count;
948
- }
949
- else {
950
- $view_data['excerpt_length'] = $default_view['excerpt_length'];
951
- }
952
-
953
- unset( $view_data['length'] );
954
- }
955
-
956
- return $view_data;
957
- }
958
-
959
- /**
960
- * Convert more_text to post or page.
961
- *
962
- * @since 2.10.0
963
- *
964
- * @param $view_data
965
- *
966
- * @return array
967
- */
968
- public static function convert_more_text( $view_data ) {
969
- if ( isset( $view_data['more_text'] ) ) {
970
- if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
971
- // convert more_page to toggle and move page id to more_page_id
972
- $view_data['more_page_id'] = $view_data['more_page'];
973
- $view_data['more_page'] = 1;
974
- $view_data['more_page_text'] = $view_data['more_text'];
975
- }
976
- elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
977
- $view_data['more_post_text'] = $view_data['more_text'];
978
- }
979
- unset( $view_data['more_text'] );
980
- }
981
-
982
- return $view_data;
983
- }
984
-
985
- /**
986
- * Convert slideshow settings.
987
- *
988
- * @since 2.15.0
989
- *
990
- * @param $view_data
991
- *
992
- * @return array
993
- */
994
- public static function convert_slideshow( $view_data ) {
995
- if ( isset( $view_data['slideshow_settings'] ) ) {
996
- return $view_data;
997
- }
998
-
999
- if ( 'scrollHorz' == $view_data['effect'] ) {
1000
- $view_data['effect'] = 'horizontal';
1001
- }
1002
-
1003
- $view_data['slideshow_settings'] = array(
1004
- 'effect' => $view_data['effect'],
1005
- 'speed' => $view_data['effect_for'],
1006
- 'pause' => $view_data['show_for'],
1007
- 'auto_hover' => ! $view_data['no_pause'],
1008
- 'adapt_height' => false,
1009
- 'adapt_height_speed' => .5,
1010
- 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1011
- );
1012
-
1013
- unset(
1014
- $view_data['effect'],
1015
- $view_data['effect_for'],
1016
- $view_data['no_pause'],
1017
- $view_data['show_for'],
1018
- $view_data['stretch']
1019
- );
1020
-
1021
- if ( isset( $view_data['slideshow_nav'] ) ) {
1022
- switch ( $view_data['slideshow_nav'] ) {
1023
- case 'simple':
1024
- $view_data['slideshow_settings']['controls_type'] = 'none';
1025
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1026
- $view_data['slideshow_settings']['pager_type'] = 'full';
1027
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1028
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1029
- break;
1030
- case 'buttons1':
1031
- $view_data['slideshow_settings']['controls_type'] = 'sides';
1032
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1033
- $view_data['slideshow_settings']['pager_type'] = 'none';
1034
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1035
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1036
- break;
1037
- case 'buttons2':
1038
- $view_data['slideshow_settings']['controls_type'] = 'simple';
1039
- $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1040
- $view_data['slideshow_settings']['pager_type'] = 'none';
1041
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1042
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1043
- break;
1044
- case 'indexed':
1045
- $view_data['slideshow_settings']['controls_type'] = 'none';
1046
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1047
- $view_data['slideshow_settings']['pager_type'] = 'full';
1048
- $view_data['slideshow_settings']['pager_style'] = 'text';
1049
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1050
- break;
1051
- default:
1052
- // none
1053
- }
1054
- unset( $view_data['slideshow_nav'] );
1055
- }
1056
-
1057
- return $view_data;
1058
- }
1059
-
1060
- /**
1061
- * Convert 'all' to 'count'.
1062
- *
1063
- * @param $view_data
1064
- *
1065
- * @return array
1066
- */
1067
- public static function convert_count( $view_data ) {
1068
- if ( isset( $view_data['all'] ) ) {
1069
- if ( $view_data['all'] ) {
1070
- $view_data['count'] = -1;
1071
- }
1072
- unset( $view_data['all'] );
1073
- }
1074
-
1075
- return $view_data;
1076
- }
1077
-
1078
- /**
1079
- * Convert background color.
1080
- *
1081
- * @param $view_data
1082
- *
1083
- * @return array
1084
- */
1085
- public static function convert_background_color( $view_data ) {
1086
- if ( ! is_array( $view_data['background'] ) ) {
1087
- $view_data['background'] = array(
1088
- 'color' => $view_data['background'],
1089
- 'type' => 'single',
1090
- );
1091
- }
1092
-
1093
- return $view_data;
1094
- }
1095
-
1096
- /**
1097
- * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1098
- *
1099
- * @param $view_data
1100
- *
1101
- * @return array
1102
- */
1103
- public static function convert_form_ajax( $view_data ) {
1104
- if ( isset( $view_data['form-ajax'] ) ) {
1105
- $view_data['form_ajax'] = $view_data['form-ajax'];
1106
- unset( $view_data['form-ajax'] );
1107
- }
1108
-
1109
- return $view_data;
1110
- }
1111
-
1112
- /**
1113
- * Prevent incompatible layouts.
1114
- *
1115
- * @param $view_data
1116
- *
1117
- * @return array
1118
- */
1119
- public static function convert_layout( $view_data ) {
1120
- if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1121
- if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1122
- $view_data['layout'] = '';
1123
- }
1124
- }
1125
-
1126
- return $view_data;
1127
- }
1128
-
1129
- /**
1130
- * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1131
- *
1132
- * @since 2.11.4
1133
- *
1134
- * @param $view_data
1135
- *
1136
- * @return array
1137
- */
1138
- public static function convert_word_count( $view_data ) {
1139
- if ( isset( $view_data['word_count'] ) ) {
1140
- $view_data['excerpt_length'] = $view_data['word_count'];
1141
- unset( $view_data['word_count'] );
1142
- }
1143
-
1144
- return $view_data;
1145
- }
1146
-
1147
- /**
1148
- * Disable title on Modern template because new version of template has the title.
1149
- * Only if updating from version earlier than 2.12.4.
1150
- *
1151
- * @param $view_data
1152
- *
1153
- * @return array
1154
- */
1155
- public static function convert_modern_title( $view_data ) {
1156
- if ( 'modern:content' == $view_data['template'] ) {
1157
- if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1158
- $view_data['title'] = 0;
1159
- self::update_history_log( '2.12.4_convert_modern_template' );
1160
- }
1161
- }
1162
-
1163
- return $view_data;
1164
- }
1165
-
1166
- /**
1167
- * Title link
1168
- *
1169
- * @since 2.26.0
1170
- *
1171
- * @param $view_data
1172
- *
1173
- * @return array
1174
- */
1175
- public static function convert_title_link( $view_data ) {
1176
- if ( ! isset( $view_data['title_link'] ) ) {
1177
- $view_data['title_link'] = 0;
1178
- }
1179
-
1180
- return $view_data;
1181
- }
1182
-
1183
- /**
1184
- * Convert nofollow from (on|off) to (1|0).
1185
- *
1186
- * @since 2.23.0
1187
- */
1188
- public static function convert_nofollow() {
1189
- $args = array(
1190
- 'posts_per_page' => - 1,
1191
- 'post_type' => 'wpm-testimonial',
1192
- 'post_status' => 'publish',
1193
- 'suppress_filters' => true,
1194
- );
1195
- $posts = get_posts( $args );
1196
- if ( ! $posts ) {
1197
- return;
1198
- }
1199
-
1200
- /**
1201
- * Remove the equivocation. There is no false.
1202
- */
1203
- foreach ( $posts as $post ) {
1204
- $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1205
- $new_value = 'default';
1206
-
1207
- if ( 'on' == $nofollow ) {
1208
- $new_value = 'yes';
1209
- }
1210
- elseif ( 1 === $nofollow ) {
1211
- $new_value = 'yes';
1212
- }
1213
- elseif ( 'off' == $nofollow ) {
1214
- $new_value = 'no';
1215
- }
1216
- elseif ( 0 === $nofollow ) {
1217
- $new_value = 'no';
1218
- }
1219
- elseif ( is_bool( $nofollow ) ) {
1220
- if ( $nofollow ) {
1221
- $new_value = 'yes';
1222
- }
1223
- else {
1224
- $new_value = 'default';
1225
- }
1226
- }
1227
-
1228
- update_post_meta( $post->ID, 'nofollow', $new_value );
1229
- }
1230
- }
1231
-
1232
- /**
1233
- * Convert pagination settings.
1234
- *
1235
- * @since 2.28.0
1236
- *
1237
- * @param $view_data
1238
- *
1239
- * @return mixed
1240
- */
1241
- public static function convert_pagination_type( $view_data ) {
1242
- if ( isset( $view_data['pagination_type'] ) ) {
1243
- $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1244
- unset( $view_data['pagination_type'] );
1245
- }
1246
-
1247
- if ( isset( $view_data['nav'] ) ) {
1248
- $view_data['pagination_settings']['nav'] = $view_data['nav'];
1249
- unset( $view_data['nav'] );
1250
- }
1251
-
1252
- if ( isset( $view_data['per_page'] ) ) {
1253
- $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1254
- unset( $view_data['per_page'] );
1255
- }
1256
-
1257
- return $view_data;
1258
- }
1259
-
1260
- /**
1261
- * Convert length to excerpt_length.
1262
- *
1263
- * @since 2.10.0
1264
- */
1265
- public static function get_average_word_length() {
1266
- $args = array(
1267
- 'posts_per_page' => - 1,
1268
- 'post_type' => 'wpm-testimonial',
1269
- 'post_status' => 'publish',
1270
- 'suppress_filters' => true,
1271
- );
1272
- $posts = get_posts( $args );
1273
- if ( ! $posts ) {
1274
- return 5;
1275
- }
1276
-
1277
- $allwords = array();
1278
-
1279
- foreach ( $posts as $post ) {
1280
- $words = explode( ' ', $post->post_content );
1281
- if ( count( $words ) > 5 ) {
1282
- $allwords = $allwords + $words;
1283
- }
1284
- }
1285
-
1286
- $wordstring = join( '', $allwords );
1287
-
1288
- return round( strlen( $wordstring ) / count( $allwords ) );
1289
- }
1290
-
1291
- }
1292
-
1293
- new Strong_Testimonials_Updater();
1
+ <?php
2
+
3
+ /**
4
+ * Class Strong_Testimonials_Updater
5
+ *
6
+ * @since 2.28.0
7
+ */
8
+ class Strong_Testimonials_Updater {
9
+
10
+ /**
11
+ * The version before updating.
12
+ *
13
+ * @var string
14
+ */
15
+ private static $old_version;
16
+
17
+ /**
18
+ * Log steps during update process.
19
+ *
20
+ * @var array
21
+ */
22
+ private static $new_log;
23
+
24
+ /**
25
+ * Strong_Testimonials_Updater constructor.
26
+ */
27
+ public function __construct() {
28
+
29
+ }
30
+
31
+ /**
32
+ * Add a log entry.
33
+ *
34
+ * @param $name
35
+ * @param string $entry
36
+ * @param string $var
37
+ */
38
+ private static function log( $name, $entry = '', $var = '' ) {
39
+ if ( $name ) {
40
+ $x = $name;
41
+ if ( $entry ) {
42
+ $x .= ' : ' . $entry;
43
+ if ( $var ) {
44
+ $x .= ' = ';
45
+ if ( is_array( $var ) || is_object( $var ) ) {
46
+ // log the text
47
+ self::$new_log[] = $x;
48
+ // then log the variable
49
+ self::$new_log[] = $var;
50
+ }
51
+ else {
52
+ self::$new_log[] = $x . $var;
53
+ }
54
+ }
55
+ else {
56
+ self::$new_log[] = $x;
57
+ }
58
+ }
59
+ else {
60
+ self::$new_log[] = $x;
61
+ }
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Plugin activation and update.
67
+ *
68
+ * ---------
69
+ * REMEMBER!
70
+ * ---------
71
+ * If you are changing the value of a default field property,
72
+ * then you need to unset that value in the current field
73
+ * before merging in the new default values.
74
+ *
75
+ * For example, when changing a rating field property from
76
+ * disabled (0) to enabled (1) in order for the property to
77
+ * be displayed in the form editor.
78
+ */
79
+ public static function update() {
80
+ if ( get_transient( 'wpmtst_update_in_progress' ) ) {
81
+ return;
82
+ }
83
+
84
+ set_transient( 'wpmtst_update_in_progress', 1, 10 );
85
+
86
+ /**
87
+ * Add custom capablities.
88
+ *
89
+ * @since 2.27.1
90
+ */
91
+ self::add_caps();
92
+
93
+ /**
94
+ * Check DB version.
95
+ */
96
+ self::update_db_check();
97
+
98
+ /**
99
+ * Let's start updating.
100
+ */
101
+ $history = get_option( 'wpmtst_history', array() );
102
+
103
+ /**
104
+ * Options.
105
+ */
106
+ update_option( 'wpmtst_options', self::update_options() );
107
+
108
+ /**
109
+ * Custom fields.
110
+ */
111
+ update_option( 'wpmtst_fields', self::update_fields() );
112
+
113
+ /**
114
+ * Forms.
115
+ */
116
+ update_option( 'wpmtst_base_forms', self::update_base_forms() );
117
+ update_option( 'wpmtst_custom_forms', self::update_custom_forms() );
118
+ update_option( 'wpmtst_form_options', self::update_form_options() );
119
+
120
+ /**
121
+ * Compatibility options.
122
+ *
123
+ * @since 2.28.0
124
+ */
125
+ update_option( 'wpmtst_compat_options', self::update_compat_options() );
126
+
127
+ /**
128
+ * Overwrite default view options.
129
+ *
130
+ * @since 2.15.0
131
+ */
132
+ update_option( 'wpmtst_view_options', self::update_view_options() );
133
+
134
+ /**
135
+ * Overwrite default view settings.
136
+ *
137
+ * @since 2.15.0
138
+ */
139
+ update_option( 'wpmtst_view_default', self::update_default_view() );
140
+
141
+ /**
142
+ * Update views.
143
+ */
144
+ self::update_views();
145
+
146
+ /**
147
+ * Convert nofollow
148
+ */
149
+ if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
150
+ self::convert_nofollow();
151
+ self::update_history_log( '2.23.0_convert_nofollow' );
152
+ }
153
+
154
+
155
+ /**
156
+ * Legacy stuff.
157
+ */
158
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
159
+ // Upgrade from version 1.x
160
+ delete_option( 'wpmtst_cycle' );
161
+
162
+ // L10n context no longer used.
163
+ delete_option( 'wpmtst_l10n_contexts' );
164
+
165
+ // Remove older attempts at admin notices.
166
+ delete_option( 'wpmtst_news_flag' );
167
+
168
+ self::update_history_log( '2.28_new_update_process' );
169
+ }
170
+
171
+ /**
172
+ * Fix add-ons.
173
+ */
174
+ self::update_addons();
175
+
176
+ /**
177
+ * Update the plugin version.
178
+ */
179
+ update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
180
+
181
+ /**
182
+ * Update log.
183
+ */
184
+ self::update_log();
185
+
186
+ /**
187
+ * Update admin notices.
188
+ */
189
+ self::update_admin_notices();
190
+
191
+ delete_transient( 'wpmtst_update_in_progress' );
192
+ }
193
+
194
+ /**
195
+ * Fix add-on file names.
196
+ *
197
+ * @since 2.30.9
198
+ */
199
+ public static function update_addons() {
200
+ $addons = get_option( 'wpmtst_addons' );
201
+ if ( $addons ) {
202
+ foreach ( $addons as $addon => $data ) {
203
+ if ( isset( $addons[ $addon ]['file'] ) ) {
204
+ $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
205
+ }
206
+ }
207
+ update_option( 'wpmtst_addons', $addons );
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Update the log in options table.
213
+ */
214
+ public static function update_log() {
215
+ $log = get_option( 'wpmtst_update_log', array() );
216
+ $log[ current_time( 'mysql' ) ] = self::$new_log;
217
+ update_option( 'wpmtst_update_log', $log );
218
+ }
219
+
220
+ public static function update_admin_notices() {
221
+ wpmtst_add_admin_notice( 'feedback-notice', true );
222
+ wpmtst_add_admin_notice( 'upsell-notice', true );
223
+ }
224
+
225
+ /**
226
+ * Return admin role.
227
+ *
228
+ * @since 2.27.0
229
+ *
230
+ * @return bool|null|WP_Role
231
+ */
232
+ public static function get_admins() {
233
+ return get_role( 'administrator' );
234
+ }
235
+
236
+ /**
237
+ * Add custom capabilities.
238
+ *
239
+ * @since 2.27.1
240
+ */
241
+ public static function add_caps() {
242
+ $admins = self::get_admins();
243
+ if ( $admins ) {
244
+ $admins->add_cap( 'strong_testimonials_views' );
245
+ $admins->add_cap( 'strong_testimonials_fields' );
246
+ $admins->add_cap( 'strong_testimonials_options' );
247
+ $admins->add_cap( 'strong_testimonials_about' );
248
+ }
249
+ else {
250
+ self::log( __FUNCTION__, 'failed' );
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Remove custom capabilities.
256
+ *
257
+ * Was part of uninstall process but cannot be run from static class.
258
+ *
259
+ * @todo Move to Leave No Trace.
260
+ *
261
+ * @since 2.27.1
262
+ */
263
+ public static function remove_caps() {
264
+ if ( $admins = self::get_admins() ) {
265
+ $admins->remove_cap( 'strong_testimonials_views' );
266
+ $admins->remove_cap( 'strong_testimonials_fields' );
267
+ $admins->remove_cap( 'strong_testimonials_options' );
268
+ $admins->remove_cap( 'strong_testimonials_about' );
269
+ }
270
+ }
271
+
272
+ /**
273
+ * Update tables.
274
+ *
275
+ * @since 1.21.0 Checking for new table version.
276
+ */
277
+ public static function update_db_check() {
278
+ if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
279
+ wpmtst_update_tables();
280
+ self::log( __FUNCTION__, 'tables updated' );
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Update history log.
286
+ *
287
+ * @param $event
288
+ */
289
+ public static function update_history_log( $event ) {
290
+ $history = get_option( 'wpmtst_history', array() );
291
+ $history[ $event ] = current_time( 'mysql' );
292
+ update_option( 'wpmtst_history', $history );
293
+ }
294
+
295
+ /**
296
+ * Update options.
297
+ *
298
+ * @return array
299
+ */
300
+ public static function update_options() {
301
+ $options = get_option( 'wpmtst_options' );
302
+ if ( ! $options ) {
303
+ return Strong_Testimonials_Defaults::get_options();
304
+ }
305
+
306
+ /**
307
+ * Remove version 1 options
308
+ */
309
+ if ( version_compare( '2.0', self::$old_version ) ) {
310
+
311
+ if ( isset( $options['captcha'] ) ) {
312
+ unset( $options['captcha'] );
313
+ }
314
+
315
+ if ( isset( $options['plugin_version'] ) ) {
316
+ unset( $options['plugin_version'] );
317
+ }
318
+
319
+ if ( isset( $options['per_page'] ) ) {
320
+ unset( $options['per_page'] );
321
+ }
322
+
323
+ if ( isset( $options['load_page_style'] ) ) {
324
+ unset( $options['load_page_style'] );
325
+ }
326
+
327
+ if ( isset( $options['load_widget_style'] ) ) {
328
+ unset( $options['load_widget_style'] );
329
+ }
330
+
331
+ if ( isset( $options['load_form_style'] ) ) {
332
+ unset( $options['load_form_style'] );
333
+ }
334
+
335
+ if ( isset( $options['load_rtl_style'] ) ) {
336
+ unset( $options['load_rtl_style'] );
337
+ }
338
+
339
+ if ( isset( $options['shortcode'] ) ) {
340
+ unset( $options['shortcode'] );
341
+ }
342
+
343
+ if ( isset( $options['default_template'] ) ) {
344
+ unset( $options['default_template'] );
345
+ }
346
+
347
+ if ( isset( $options['client_section'] ) ) {
348
+ unset( $options['client_section'] );
349
+ }
350
+
351
+ }
352
+
353
+ /**
354
+ * Remove slideshow z-index (Cycle)
355
+ *
356
+ * @since 2.15.0
357
+ */
358
+ if ( isset( $options['slideshow_zindex'] ) ) {
359
+ unset( $options['slideshow_zindex'] );
360
+ }
361
+
362
+ /**
363
+ * Replace zero embed_width with empty value.
364
+ *
365
+ * @since 2.27.0
366
+ */
367
+ if ( 0 === $options['embed_width'] ) {
368
+ $options['embed_width'] = '';
369
+ }
370
+
371
+ /**
372
+ * Remove email logging.
373
+ *
374
+ * @since 2.28.4
375
+ */
376
+ if ( isset( $options['email_log_level'] ) ) {
377
+ unset( $options['email_log_level'] );
378
+ }
379
+
380
+ // Merge in new options
381
+ $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
382
+
383
+ return $options;
384
+ }
385
+
386
+ /**
387
+ * Default custom fields.
388
+ *
389
+ * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
390
+ * Overwrite existing fields on every update to auto-repair.
391
+ *
392
+ * @return array
393
+ */
394
+ public static function update_fields() {
395
+ return Strong_Testimonials_Defaults::get_fields();
396
+ }
397
+
398
+ /**
399
+ * Base forms.
400
+ *
401
+ * @return array
402
+ */
403
+ public static function update_base_forms() {
404
+ return Strong_Testimonials_Defaults::get_base_forms();
405
+ }
406
+
407
+ /**
408
+ * Custom forms.
409
+ *
410
+ * @return array
411
+ */
412
+ public static function update_custom_forms() {
413
+ $custom_forms = get_option( 'wpmtst_custom_forms' );
414
+ if ( ! $custom_forms ) {
415
+ return Strong_Testimonials_Defaults::get_custom_forms();
416
+ }
417
+
418
+ foreach ( $custom_forms as $form_id => $form_properties ) {
419
+ foreach ( $form_properties['fields'] as $key => $form_field ) {
420
+
421
+ /*
422
+ * Convert categories to category-selector.
423
+ * @since 2.17.0
424
+ */
425
+ if ( 'categories' == $form_field['input_type'] ) {
426
+ $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
427
+ }
428
+
429
+ /*
430
+ * Unset `show_default_options` for rating field. Going from 0 to 1.
431
+ * @since 2.21.0
432
+ */
433
+ if ( 'rating' == $form_field['input_type'] ) {
434
+ unset( $form_field['show_default_options'] );
435
+ }
436
+
437
+ /*
438
+ * Add `show_required_option` to shortcode field. Initial value is false.
439
+ * @since 2.22.0
440
+ */
441
+ if ( 'shortcode' == $form_field['input_type'] ) {
442
+ $form_field['show_required_option'] = false;
443
+ }
444
+
445
+ /*
446
+ * Add `show_default_options` to checkbox field.
447
+ *
448
+ * @since 2.27.0
449
+ */
450
+ if ( 'checkbox' == $form_field['input_type'] ) {
451
+ $form_field['show_default_options'] = 1;
452
+ }
453
+
454
+ /*
455
+ * Merge in new default.
456
+ * Custom fields are in display order (not associative) so we must find them by `input_type`.
457
+ * @since 2.21.0 Using default fields instead of default form as source
458
+ */
459
+ $new_default = array();
460
+ $fields = get_option( 'wpmtst_fields', array() );
461
+
462
+ foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
463
+ foreach ( $field_type_group as $field_type_key => $field_type_field ) {
464
+ if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
465
+ $new_default = $field_type_field;
466
+ break;
467
+ }
468
+ }
469
+ }
470
+
471
+ if ( $new_default ) {
472
+ $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
473
+ }
474
+
475
+ }
476
+ }
477
+
478
+ return $custom_forms;
479
+ }
480
+
481
+ /**
482
+ * Form options.
483
+ *
484
+ * @return array
485
+ */
486
+ public static function update_form_options() {
487
+ $form_options = get_option( 'wpmtst_form_options' );
488
+ if ( ! $form_options ) {
489
+ return Strong_Testimonials_Defaults::get_form_options();
490
+ }
491
+
492
+ $options = get_option( 'wpmtst_options', array() );
493
+ $history = get_option( 'wpmtst_history', array() );
494
+
495
+ /**
496
+ * Move existing options.
497
+ */
498
+ if ( isset( $options['admin_notify'] ) ) {
499
+ $form_options['admin_notify'] = $options['admin_notify'];
500
+ unset( $options['admin_notify'] );
501
+
502
+ $form_options['admin_email'] = $options['admin_email'];
503
+ unset( $options['admin_email'] );
504
+
505
+ update_option( 'wpmtst_options', $options );
506
+ }
507
+
508
+ /**
509
+ * Update single email recipient to multiple.
510
+ *
511
+ * @since 1.18
512
+ */
513
+ if ( ! isset( $form_options['recipients'] ) ) {
514
+ $form_options['recipients'] = array(
515
+ array(
516
+ 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
517
+ 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
518
+ 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
519
+ 'primary' => 1, // cannot be deleted
520
+ ),
521
+ );
522
+
523
+ unset( $form_options['admin_name'] );
524
+ unset( $form_options['admin_site_email'] );
525
+ unset( $form_options['admin_email'] );
526
+ }
527
+
528
+ /**
529
+ * Add default required-notice setting
530
+ *
531
+ * @since 2.24.1
532
+ */
533
+ if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
534
+ $form_options['messages']['required-field']['enabled'] = 1;
535
+ }
536
+
537
+ /**
538
+ * Delete form options
539
+ *
540
+ * @since 2.38
541
+ */
542
+ unset( $form_options['captcha'] );
543
+ unset( $form_options['messages']['captcha'] );
544
+
545
+
546
+ /**
547
+ * Merge in new options.
548
+ */
549
+ $defaults = Strong_Testimonials_Defaults::get_form_options();
550
+
551
+ $form_options = array_merge( $defaults, $form_options );
552
+
553
+ // Merge nested arrays individually. Don't use array_merge_recursive.
554
+
555
+ $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
556
+ foreach ( $defaults['messages'] as $key => $message ) {
557
+ if( isset( $form_options['messages'][ $key ] ) ) {
558
+ $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
559
+ }
560
+ }
561
+
562
+ if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
563
+ self::update_history_log( '2.29_captcha_options_changed' );
564
+ if ( $notice ) {
565
+ wpmtst_add_admin_notice( 'captcha-options-changed', true );
566
+ }
567
+ }
568
+
569
+ return $form_options;
570
+ }
571
+
572
+ /**
573
+ * Compatibility options.
574
+ *
575
+ * @since 2.28.0
576
+ *
577
+ * @return array
578
+ */
579
+ public static function update_compat_options() {
580
+ $options = get_option( 'wpmtst_compat_options' );
581
+ if ( ! $options ) {
582
+ return Strong_Testimonials_Defaults::get_compat_options();
583
+ }
584
+
585
+ // Merge in new options.
586
+ $defaults = Strong_Testimonials_Defaults::get_compat_options();
587
+
588
+ // Merge nested arrays individually. Don't use array_merge_recursive.
589
+
590
+ if ( isset( $options['controller'] ) ) {
591
+ $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
592
+ } else {
593
+ $options['ajax'] = $defaults['ajax'];
594
+ }
595
+
596
+ /**
597
+ * Controller
598
+ *
599
+ * @since 2.31.0
600
+ */
601
+ if ( isset( $options['controller'] ) ) {
602
+ $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
603
+ } else {
604
+ $options['controller'] = $defaults['controller'];
605
+ }
606
+
607
+ /**
608
+ * Lazy load
609
+ *
610
+ * @since 2.31.0
611
+ */
612
+ if ( isset( $options['lazyload'] ) ) {
613
+ // first level only: enabled, classes (array)
614
+ $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
615
+ } else {
616
+ $options['lazyload'] = $defaults['lazyload'];
617
+ }
618
+
619
+ $options = array_merge( $defaults, $options );
620
+
621
+ return $options;
622
+ }
623
+
624
+ /**
625
+ * View options.
626
+ *
627
+ * @return array
628
+ */
629
+ public static function update_view_options() {
630
+ return Strong_Testimonials_Defaults::get_view_options();
631
+ }
632
+
633
+ /**
634
+ * Default view.
635
+ *
636
+ * @return array
637
+ */
638
+ public static function update_default_view() {
639
+ return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
640
+ }
641
+
642
+ /**
643
+ * Update views.
644
+ *
645
+ * @uses wpmtst_save_view
646
+ */
647
+ public static function update_views() {
648
+ $views = wpmtst_get_views();
649
+
650
+ if ( ! $views ) {
651
+ return;
652
+ }
653
+
654
+ $default_view = wpmtst_get_view_default();
655
+ $history = get_option( 'wpmtst_history', array() );
656
+
657
+ foreach ( $views as $key => $view ) {
658
+
659
+ $view_data = unserialize( $view['value'] );
660
+ if ( ! is_array( $view_data ) ) {
661
+ self::log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
662
+ continue;
663
+ }
664
+
665
+ /**
666
+ * For version 2.28.
667
+ */
668
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
669
+ /**
670
+ * Compat mode no longer needed.
671
+ *
672
+ * @since 2.22.0
673
+ */
674
+ unset( $view_data['compat'] );
675
+
676
+ $view_data = self::convert_template_name( $view_data );
677
+ $view_data = self::convert_background_color( $view_data );
678
+ $view_data = self::convert_form_ajax( $view_data );
679
+ $view_data = self::convert_layout( $view_data );
680
+ $view_data = self::convert_word_count( $view_data );
681
+ $view_data = self::convert_excerpt_length( $view_data );
682
+ $view_data = self::convert_more_text( $view_data );
683
+ $view_data = self::convert_modern_title( $view_data );
684
+ $view_data = self::convert_slideshow( $view_data );
685
+ $view_data = self::convert_title_link( $view_data );
686
+ $view_data = self::convert_pagination_type( $view_data );
687
+ }
688
+
689
+ /**
690
+ * For version 2.30.
691
+ */
692
+ if ( ! isset( $history['2.30_new_template_structure'] ) ) {
693
+ $view_data = self::convert_template_structure( $view_data );
694
+ $view_data = self::convert_count( $view_data );
695
+ if ( isset( $view_data['background']['example-font-color'] ) ) {
696
+ unset( $view_data['background']['example-font-color'] );
697
+ }
698
+
699
+ self::update_history_log( '2.30_new_template_structure' );
700
+ }
701
+
702
+ /**
703
+ * Add carousel breakpoints.
704
+ *
705
+ * @since 2.32.2
706
+ */
707
+ if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
708
+ $view['data'] = self::add_carousel_breakpoints( $view_data );
709
+ self::update_history_log( '2.32.2_carousel_breakpoints' );
710
+ }
711
+
712
+ /**
713
+ * Merge in new default values.
714
+ * Merge nested arrays individually. Don't use array_merge_recursive.
715
+ */
716
+ $view['data'] = array_merge( $default_view, $view_data );
717
+
718
+ /**
719
+ * Background defaults.
720
+ */
721
+ $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
722
+
723
+ /**
724
+ * Pagination defaults.
725
+ * Attempt to repair bug from 2.28.2
726
+ *
727
+ * @since 2.28.3
728
+ */
729
+ if ( isset( $view_data['pagination_settings'] ) ) {
730
+ $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
731
+
732
+ if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
733
+ $view['data']['pagination_settings']['end_size'] = 1;
734
+ }
735
+ if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
736
+ $view['data']['pagination_settings']['mid_size'] = 2;
737
+ }
738
+ if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
739
+ $view['data']['pagination_settings']['per_page'] = 5;
740
+ }
741
+ } else {
742
+ $view['data']['pagination_settings'] = $default_view['pagination_settings'];
743
+ }
744
+
745
+ /**
746
+ * Slideshow defaults.
747
+ */
748
+ if ( isset( $view_data['slideshow_settings'] ) ) {
749
+ $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
750
+ } else {
751
+ $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
752
+ }
753
+ ksort( $view['data']['slideshow_settings'] );
754
+
755
+ /**
756
+ * Save it.
757
+ */
758
+ wpmtst_save_view( $view );
759
+
760
+ } // foreach $view
761
+ }
762
+
763
+ /**
764
+ * Add carousel breakpoints.
765
+ *
766
+ * @param array $view_data
767
+ * @since 2.32.2
768
+ *
769
+ * @return array
770
+ */
771
+ public static function add_carousel_breakpoints( $view_data ) {
772
+ if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
773
+ return $view_data;
774
+ }
775
+
776
+ if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
777
+
778
+ // Convert to single
779
+ $view_data['slideshow_settings']['type'] = 'show_single';
780
+
781
+ $view_data['slideshow_settings']['show_single'] = array(
782
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
783
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
784
+ 'margin' => 1,
785
+ );
786
+
787
+ } else {
788
+
789
+ // Convert to multiple
790
+ $view_data['slideshow_settings']['type'] = 'show_multiple';
791
+
792
+ $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
793
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
794
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
795
+ 'margin' => 1,
796
+ );
797
+
798
+ }
799
+
800
+ // Remove old values
801
+ unset(
802
+ $view_data['slideshow_settings']['max_slides'],
803
+ $view_data['slideshow_settings']['move_slides'],
804
+ $view_data['slideshow_settings']['margin']
805
+ );
806
+
807
+ return $view_data;
808
+ }
809
+
810
+ /**
811
+ * Convert template naming structure.
812
+ *
813
+ * @since 2.30.0
814
+ *
815
+ * @param $view_data
816
+ *
817
+ * @return array
818
+ */
819
+ public static function convert_template_structure( $view_data ) {
820
+ /*
821
+ Array
822
+ (
823
+ [0] => default:content
824
+ [1] => default-dark:form
825
+ [2] => default-dark:content
826
+ [3] => default:form
827
+ [4] => image-right:content
828
+ [5] => no-quotes:content
829
+ [6] => large:widget
830
+ [7] => modern:content
831
+ [8] => simple:content
832
+ [9] => simple:form
833
+ [10] => unstyled:content
834
+ [11] => unstyled:form
835
+ [12] => default:widget
836
+ [13] => image-right:widget
837
+ )
838
+ */
839
+ switch ( $view_data['template'] ) {
840
+ case 'default:content' :
841
+ $view_data['template'] = 'default';
842
+ break;
843
+ case 'default-dark:form' :
844
+ $view_data['template'] = 'default-form';
845
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
846
+ break;
847
+ case 'default-dark:content' :
848
+ $view_data['template'] = 'default';
849
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
850
+ break;
851
+ case 'default:form' :
852
+ $view_data['template'] = 'default-form';
853
+ break;
854
+ case 'image-right:content' :
855
+ $view_data['template'] = 'default';
856
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
857
+ break;
858
+ case 'no-quotes:content' :
859
+ $view_data['template'] = 'default';
860
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
861
+ break;
862
+ case 'large:widget' :
863
+ $view_data['template'] = 'bold';
864
+ break;
865
+ case 'modern:content' :
866
+ $view_data['template'] = 'modern';
867
+ break;
868
+ case 'simple:content' :
869
+ $view_data['template'] = 'simple';
870
+ break;
871
+ case 'simple:form' :
872
+ $view_data['template'] = 'simple-form';
873
+ break;
874
+ case 'unstyled:content' :
875
+ $view_data['template'] = 'unstyled';
876
+ break;
877
+ case 'unstyled:form' :
878
+ $view_data['template'] = 'unstyled-form';
879
+ break;
880
+ case 'default:widget' :
881
+ $view_data['template'] = 'small-widget';
882
+ break;
883
+ case 'image-right:widget' :
884
+ $view_data['template'] = 'small-widget';
885
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
886
+ break;
887
+ default:
888
+ // Keep existing value; it's probably a custom template.
889
+ }
890
+
891
+ return $view_data;
892
+ }
893
+
894
+ /**
895
+ * Update template naming structure.
896
+ *
897
+ * @param $view_data
898
+ *
899
+ * @return array
900
+ */
901
+ public static function convert_template_name( $view_data ) {
902
+ // Change default template from empty to 'default:{type}'
903
+ if ( ! $view_data['template'] ) {
904
+ if ( 'form' == $view_data['mode'] ) {
905
+ $type = 'form';
906
+ }
907
+ else {
908
+ $type = 'content';
909
+ }
910
+
911
+ $view_data['template'] = "default:$type";
912
+ }
913
+ else {
914
+ // Convert name; e.g. 'simple/testimonials.php'
915
+ if ( 'widget/testimonials.php' == $view_data['template'] ) {
916
+ $view_data['template'] = 'default:widget';
917
+ }
918
+ else {
919
+ $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
920
+ $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
921
+ $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
922
+ }
923
+ }
924
+
925
+ return $view_data;
926
+ }
927
+
928
+ /**
929
+ * Convert length (characters).
930
+ *
931
+ * @since 2.10.0 word_count (deprecated)
932
+ * @since 2.11.4 excerpt_length
933
+ *
934
+ * @param $view_data
935
+ *
936
+ * @return array
937
+ */
938
+ public static function convert_excerpt_length( $view_data ) {
939
+ if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
940
+ $default_view = Strong_Testimonials_Defaults::get_default_view();
941
+ $average_word_length = self::get_average_word_length();
942
+
943
+ if ( isset( $view_data['length'] ) && $view_data['length'] ) {
944
+ $word_count = round( $view_data['length'] / $average_word_length );
945
+ $word_count = $word_count < 5 ? 5 : $word_count;
946
+ $word_count = $word_count > 300 ? 300 : $word_count;
947
+ $view_data['excerpt_length'] = $word_count;
948
+ }
949
+ else {
950
+ $view_data['excerpt_length'] = $default_view['excerpt_length'];
951
+ }
952
+
953
+ unset( $view_data['length'] );
954
+ }
955
+
956
+ return $view_data;
957
+ }
958
+
959
+ /**
960
+ * Convert more_text to post or page.
961
+ *
962
+ * @since 2.10.0
963
+ *
964
+ * @param $view_data
965
+ *
966
+ * @return array
967
+ */
968
+ public static function convert_more_text( $view_data ) {
969
+ if ( isset( $view_data['more_text'] ) ) {
970
+ if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
971
+ // convert more_page to toggle and move page id to more_page_id
972
+ $view_data['more_page_id'] = $view_data['more_page'];
973
+ $view_data['more_page'] = 1;
974
+ $view_data['more_page_text'] = $view_data['more_text'];
975
+ }
976
+ elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
977
+ $view_data['more_post_text'] = $view_data['more_text'];
978
+ }
979
+ unset( $view_data['more_text'] );
980
+ }
981
+
982
+ return $view_data;
983
+ }
984
+
985
+ /**
986
+ * Convert slideshow settings.
987
+ *
988
+ * @since 2.15.0
989
+ *
990
+ * @param $view_data
991
+ *
992
+ * @return array
993
+ */
994
+ public static function convert_slideshow( $view_data ) {
995
+ if ( isset( $view_data['slideshow_settings'] ) ) {
996
+ return $view_data;
997
+ }
998
+
999
+ if ( 'scrollHorz' == $view_data['effect'] ) {
1000
+ $view_data['effect'] = 'horizontal';
1001
+ }
1002
+
1003
+ $view_data['slideshow_settings'] = array(
1004
+ 'effect' => $view_data['effect'],
1005
+ 'speed' => $view_data['effect_for'],
1006
+ 'pause' => $view_data['show_for'],
1007
+ 'auto_hover' => ! $view_data['no_pause'],
1008
+ 'adapt_height' => false,
1009
+ 'adapt_height_speed' => .5,
1010
+ 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1011
+ );
1012
+
1013
+ unset(
1014
+ $view_data['effect'],
1015
+ $view_data['effect_for'],
1016
+ $view_data['no_pause'],
1017
+ $view_data['show_for'],
1018
+ $view_data['stretch']
1019
+ );
1020
+
1021
+ if ( isset( $view_data['slideshow_nav'] ) ) {
1022
+ switch ( $view_data['slideshow_nav'] ) {
1023
+ case 'simple':
1024
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1025
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1026
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1027
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1028
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1029
+ break;
1030
+ case 'buttons1':
1031
+ $view_data['slideshow_settings']['controls_type'] = 'sides';
1032
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1033
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1034
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1035
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1036
+ break;
1037
+ case 'buttons2':
1038
+ $view_data['slideshow_settings']['controls_type'] = 'simple';
1039
+ $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1040
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1041
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1042
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1043
+ break;
1044
+ case 'indexed':
1045
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1046
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1047
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1048
+ $view_data['slideshow_settings']['pager_style'] = 'text';
1049
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1050
+ break;
1051
+ default:
1052
+ // none
1053
+ }
1054
+ unset( $view_data['slideshow_nav'] );
1055
+ }
1056
+
1057
+ return $view_data;
1058
+ }
1059
+
1060
+ /**
1061
+ * Convert 'all' to 'count'.
1062
+ *
1063
+ * @param $view_data
1064
+ *
1065
+ * @return array
1066
+ */
1067
+ public static function convert_count( $view_data ) {
1068
+ if ( isset( $view_data['all'] ) ) {
1069
+ if ( $view_data['all'] ) {
1070
+ $view_data['count'] = -1;
1071
+ }
1072
+ unset( $view_data['all'] );
1073
+ }
1074
+
1075
+ return $view_data;
1076
+ }
1077
+
1078
+ /**
1079
+ * Convert background color.
1080
+ *
1081
+ * @param $view_data
1082
+ *
1083
+ * @return array
1084
+ */
1085
+ public static function convert_background_color( $view_data ) {
1086
+ if ( ! is_array( $view_data['background'] ) ) {
1087
+ $view_data['background'] = array(
1088
+ 'color' => $view_data['background'],
1089
+ 'type' => 'single',
1090
+ );
1091
+ }
1092
+
1093
+ return $view_data;
1094
+ }
1095
+
1096
+ /**
1097
+ * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1098
+ *
1099
+ * @param $view_data
1100
+ *
1101
+ * @return array
1102
+ */
1103
+ public static function convert_form_ajax( $view_data ) {
1104
+ if ( isset( $view_data['form-ajax'] ) ) {
1105
+ $view_data['form_ajax'] = $view_data['form-ajax'];
1106
+ unset( $view_data['form-ajax'] );
1107
+ }
1108
+
1109
+ return $view_data;
1110
+ }
1111
+
1112
+ /**
1113
+ * Prevent incompatible layouts.
1114
+ *
1115
+ * @param $view_data
1116
+ *
1117
+ * @return array
1118
+ */
1119
+ public static function convert_layout( $view_data ) {
1120
+ if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1121
+ if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1122
+ $view_data['layout'] = '';
1123
+ }
1124
+ }
1125
+
1126
+ return $view_data;
1127
+ }
1128
+
1129
+ /**
1130
+ * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1131
+ *
1132
+ * @since 2.11.4
1133
+ *
1134
+ * @param $view_data
1135
+ *
1136
+ * @return array
1137
+ */
1138
+ public static function convert_word_count( $view_data ) {
1139
+ if ( isset( $view_data['word_count'] ) ) {
1140
+ $view_data['excerpt_length'] = $view_data['word_count'];
1141
+ unset( $view_data['word_count'] );
1142
+ }
1143
+
1144
+ return $view_data;
1145
+ }
1146
+
1147
+ /**
1148
+ * Disable title on Modern template because new version of template has the title.
1149
+ * Only if updating from version earlier than 2.12.4.
1150
+ *
1151
+ * @param $view_data
1152
+ *
1153
+ * @return array
1154
+ */
1155
+ public static function convert_modern_title( $view_data ) {
1156
+ if ( 'modern:content' == $view_data['template'] ) {
1157
+ if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1158
+ $view_data['title'] = 0;
1159
+ self::update_history_log( '2.12.4_convert_modern_template' );
1160
+ }
1161
+ }
1162
+
1163
+ return $view_data;
1164
+ }
1165
+
1166
+ /**
1167
+ * Title link
1168
+ *
1169
+ * @since 2.26.0
1170
+ *
1171
+ * @param $view_data
1172
+ *
1173
+ * @return array
1174
+ */
1175
+ public static function convert_title_link( $view_data ) {
1176
+ if ( ! isset( $view_data['title_link'] ) ) {
1177
+ $view_data['title_link'] = 0;
1178
+ }
1179
+
1180
+ return $view_data;
1181
+ }
1182
+
1183
+ /**
1184
+ * Convert nofollow from (on|off) to (1|0).
1185
+ *
1186
+ * @since 2.23.0
1187
+ */
1188
+ public static function convert_nofollow() {
1189
+ $args = array(
1190
+ 'posts_per_page' => - 1,
1191
+ 'post_type' => 'wpm-testimonial',
1192
+ 'post_status' => 'publish',
1193
+ 'suppress_filters' => true,
1194
+ );
1195
+ $posts = get_posts( $args );
1196
+ if ( ! $posts ) {
1197
+ return;
1198
+ }
1199
+
1200
+ /**
1201
+ * Remove the equivocation. There is no false.
1202
+ */
1203
+ foreach ( $posts as $post ) {
1204
+ $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1205
+ $new_value = 'default';
1206
+
1207
+ if ( 'on' == $nofollow ) {
1208
+ $new_value = 'yes';
1209
+ }
1210
+ elseif ( 1 === $nofollow ) {
1211
+ $new_value = 'yes';
1212
+ }
1213
+ elseif ( 'off' == $nofollow ) {
1214
+ $new_value = 'no';
1215
+ }
1216
+ elseif ( 0 === $nofollow ) {
1217
+ $new_value = 'no';
1218
+ }
1219
+ elseif ( is_bool( $nofollow ) ) {
1220
+ if ( $nofollow ) {
1221
+ $new_value = 'yes';
1222
+ }
1223
+ else {
1224
+ $new_value = 'default';
1225
+ }
1226
+ }
1227
+
1228
+ update_post_meta( $post->ID, 'nofollow', $new_value );
1229
+ }
1230
+ }
1231
+
1232
+ /**
1233
+ * Convert pagination settings.
1234
+ *
1235
+ * @since 2.28.0
1236
+ *
1237
+ * @param $view_data
1238
+ *
1239
+ * @return mixed
1240
+ */
1241
+ public static function convert_pagination_type( $view_data ) {
1242
+ if ( isset( $view_data['pagination_type'] ) ) {
1243
+ $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1244
+ unset( $view_data['pagination_type'] );
1245
+ }
1246
+
1247
+ if ( isset( $view_data['nav'] ) ) {
1248
+ $view_data['pagination_settings']['nav'] = $view_data['nav'];
1249
+ unset( $view_data['nav'] );
1250
+ }
1251
+
1252
+ if ( isset( $view_data['per_page'] ) ) {
1253
+ $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1254
+ unset( $view_data['per_page'] );
1255
+ }
1256
+
1257
+ return $view_data;
1258
+ }
1259
+
1260
+ /**
1261
+ * Convert length to excerpt_length.
1262
+ *
1263
+ * @since 2.10.0
1264
+ */
1265
+ public static function get_average_word_length() {
1266
+ $args = array(
1267
+ 'posts_per_page' => - 1,
1268
+ 'post_type' => 'wpm-testimonial',
1269
+ 'post_status' => 'publish',
1270
+ 'suppress_filters' => true,
1271
+ );
1272
+ $posts = get_posts( $args );
1273
+ if ( ! $posts ) {
1274
+ return 5;
1275
+ }
1276
+
1277
+ $allwords = array();
1278
+
1279
+ foreach ( $posts as $post ) {
1280
+ $words = explode( ' ', $post->post_content );
1281
+ if ( count( $words ) > 5 ) {
1282
+ $allwords = $allwords + $words;
1283
+ }
1284
+ }
1285
+
1286
+ $wordstring = join( '', $allwords );
1287
+
1288
+ return round( strlen( $wordstring ) / count( $allwords ) );
1289
+ }
1290
+
1291
+ }
1292
+
1293
+ new Strong_Testimonials_Updater();
admin/class-strong-testimonials-upsell.php CHANGED
@@ -1,303 +1,341 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Upsell
4
- *
5
- * @since 2.38
6
- */
7
- class Strong_Testimonials_Upsell {
8
-
9
- public $store_upgrade_url;
10
-
11
- public function __construct() {
12
- $this->set_store_upgrade_url();
13
-
14
- add_action( 'admin_notices', array( $this, 'add_general_upsell_notice' ), 11 );
15
- add_action( 'wpmtst_after_form_type_selection', array( $this, 'add_upsells_1' ) );
16
- add_action( 'wpmtst_before_fields_settings', array( $this, 'add_upsells_2' ) );
17
- add_action( 'wpmtst_view_editor_after_groups', array( $this, 'add_upsells_3' ) );
18
- add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'add_upsells_4' ) );
19
- add_action( 'wpmtst_fields_before_fields_editor_preview', array( $this, 'add_upsells_5' ) );
20
- add_action( 'wpmtst_after_form_settings', array( $this, 'add_upsells_6' ) );
21
- add_action( 'wpmtst_views_after_template_list', array( $this, 'add_upsells_7' ) );
22
- }
23
-
24
- public function set_store_upgrade_url() {
25
-
26
- $this->store_upgrade_url = WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell';
27
-
28
- //append license key
29
- $license = trim( get_option( 'strong_testimonials_license_key' ) );
30
- if ( $license ) {
31
- $this->store_upgrade_url .= '&license=' . $license;
32
- }
33
-
34
- }
35
-
36
- public function add_general_upsell_notice() {
37
- $screen = get_current_screen();
38
- if ( $screen->id !== 'edit-wpm-testimonial' && $screen->id !== 'wpm-testimonial_page_testimonial-views' ) {
39
- return;
40
- }
41
-
42
- $notices = get_option( 'wpmtst_admin_notices', array() );
43
- ?>
44
-
45
- <div class="notice wpmtst-notice-wrap">
46
-
47
- <?php if ( array_key_exists( 'feedback-notice', $notices ) ) : ?>
48
- <div class="wpmtst-notice wpmtst-notice--feedback" data-key="feedback-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-admin' ) ); ?>">
49
- <div class="wpmtst-notice--feedback__bg"></div>
50
- <h2><?php esc_html_e( 'Feature Request', 'strong-testimonials' ); ?></h2>
51
- <p><?php esc_html_e( 'Do you enjoy using Strong Testimonials? Please take a minute to suggest a feature or tell us what you think.', 'strong-testimonials' ); ?></p>
52
- <a class="button" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScch0AchtnzxJsSrjUcW9ypcr1fZ9r-vyk3emEp8Sv47brb2g/viewform"><?php esc_html_e( 'Submit Feedback', 'strong-testimonials' ); ?></a>
53
- <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'strong-testimonials' ); ?></span></button>
54
- </div><!-- wpmtst-notice--feedback -->
55
- <?php endif; ?>
56
-
57
- <?php if ( array_key_exists( 'upsell-notice', $notices ) && ! wpmtst_extensions_installed() ) : ?>
58
- <div class="wpmtst-notice wpmtst-notice--upsell" data-key="upsell-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-admin' ) ); ?>">
59
- <div class="wpmtst-notice--upsell__bg"></div>
60
- <h2><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h2>
61
- <p>
62
- <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
63
- <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
64
- </p>
65
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=' . $screen->id . '-notice-upsell' ); ?>"><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
66
- <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'strong-testimonials' ); ?></span></button>
67
- </div><!-- wpmtst-notice--upsell -->
68
- <?php endif; ?>
69
-
70
- </div><!-- wpmtst-notice-wrap -->
71
- <?php
72
- }
73
-
74
- public function add_upsells_1() {
75
-
76
- if ( ! defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) :
77
- ?>
78
- <div class="wpmtst-alert" style="margin-top: 10px">
79
- <?php esc_html_e( 'Want to know where are your customers located?', 'strong-testimonials' ); ?>
80
- <br/>
81
- <?php
82
- printf(
83
- esc_html__( 'Install the %s extension', 'strong-testimonials' ),
84
- sprintf(
85
- '<a href="%s" target="_blank">%s</a>',
86
- esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ),
87
- esc_html__( 'Strong Testimonials: Country Selector', 'strong-testimonials' )
88
- )
89
- );
90
- ?>
91
- <p>
92
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
93
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
94
- </p>
95
- </div>
96
- <?php
97
- endif;
98
-
99
- if ( ! defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) :
100
- ?>
101
- <div class="wpmtst-alert" style="margin-top: 10px">
102
- <?php esc_html_e( 'Know your customers by having access to more advanced custom fields.', 'strong-testimonials' ); ?>
103
- <br/>
104
- <?php
105
- printf(
106
- esc_html__( 'Install the %s extension', 'strong-testimonials' ),
107
- sprintf(
108
- '<a href="%s" target="_blank">%s</a>',
109
- esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ),
110
- esc_html__( 'Strong Testimonials: Custom Fields', 'strong-testimonials' )
111
- )
112
- );
113
- ?>
114
- <p>
115
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
116
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
117
- </p>
118
- </div>
119
- <?php
120
- endif;
121
- }
122
-
123
- public function add_upsells_2() {
124
- if ( ! defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) :
125
- ?>
126
- <div class="wpmtst-alert" style="margin-top: 10px">
127
- <?php
128
- printf(
129
- esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
130
- sprintf(
131
- '<a href="%s" target="_blank">%s</a>',
132
- esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ),
133
- esc_html__( 'Strong Testimonials: Multiple Forms', 'strong-testimonials' )
134
- )
135
- );
136
- ?>
137
- <p>
138
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
139
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
140
- </p>
141
- </div>
142
- <?php
143
- endif;
144
- }
145
-
146
- public function add_upsells_3() {
147
- if ( ! defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) :
148
- ?>
149
- <div class="wpmtst-alert" style="margin-top: 10px">
150
- <?php
151
- printf(
152
- esc_html__( 'Add SEO-friendly Testimonials with our %s extension.', 'strong-testimonials' ),
153
- sprintf(
154
- '<a href="%s" target="_blank">%s</a>',
155
- esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ),
156
- esc_html__( 'Strong Testimonials: Review Markup', 'strong-testimonials' )
157
- )
158
- );
159
- ?>
160
- <p>
161
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
162
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
163
- </p>
164
- </div>
165
- <?php
166
- endif;
167
- }
168
-
169
- public function add_upsells_4() {
170
- if ( ! defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) :
171
- ?>
172
- <div class="wpmtst-alert" style="margin-top: 1.5rem">
173
- <?php
174
- printf(
175
- esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
176
- sprintf(
177
- '<a href="%s" target="_blank">%s</a>',
178
- esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ),
179
- esc_html__( 'Strong Testimonials: Advanced Views', 'strong-testimonials' )
180
- )
181
- );
182
-
183
- ?>
184
- <ul>
185
- <li><?php esc_html_e( '- display testimonials based on their rating.', 'strong-testimonials' ); ?></li>
186
- <li><?php esc_html_e( '- easily define the display order of your testimonial fields.', 'strong-testimonials' ); ?></li>
187
- <li><?php esc_html_e( '- customize & edit your template settings in the customizer.', 'strong-testimonials' ); ?></li>
188
- </ul>
189
- <p>
190
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
191
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
192
- </p>
193
- </div>
194
- <?php
195
- endif;
196
- }
197
-
198
- public function add_upsells_5() {
199
- if ( ! defined( 'WPMTST_CAPTCHA_VERSION' ) ) :
200
- ?>
201
- <div class="wpmtst-alert">
202
- <?php
203
- printf(
204
- esc_html__( 'Protect your form against spam with the %s extension.', 'strong-testimonials' ),
205
- sprintf(
206
- '<a href="%s" target="_blank">%s</a>',
207
- esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
208
- esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
209
- )
210
- );
211
- ?>
212
- <p>
213
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
214
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
215
- </p>
216
- </div>
217
- <?php
218
- endif;
219
- }
220
-
221
- public function add_upsells_6() {
222
- if ( defined( 'WPMTST_CAPTCHA_VERSION' ) ) {
223
- return;
224
- }
225
- ?>
226
- <hr>
227
-
228
- <h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
229
-
230
- <div class="wpmtst-alert">
231
- <?php
232
- printf(
233
- esc_html__( 'Protect your form against spam. Add Google recaptcha or honeypots with the %s extension.', 'strong-testimonials' ),
234
- sprintf(
235
- '<a href="%s" target="_blank">%s</a>',
236
- esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
237
- esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
238
- )
239
- );
240
- ?>
241
- <p>
242
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
243
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
244
- </p>
245
- </div>
246
-
247
- <table class="form-table" cellpadding="0" cellspacing="0">
248
- <tr>
249
- <th scope="row">
250
- <label>
251
- <?php esc_html_e( 'Honeypot', 'strong-testimonials' ); ?>
252
- </label>
253
- </th>
254
- <td>
255
- <p>
256
- <?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
257
- </p>
258
- </td>
259
- </tr>
260
- <tr valign="top">
261
- <th scope="row">
262
- <label>
263
- <a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
264
- </label>
265
- </th>
266
- <td>
267
- <?php esc_html_e( 'Google reCAPTCHA prompts visitors to check a box to prove that they’re not a robot before they submit the form.', 'strong-testimonials' ); ?>
268
- <br/>
269
- <?php esc_html_e( 'In some cases, they’re prompted to complete another task, like identify a string of letters.', 'strong-testimonials' ); ?>
270
- <br/>
271
- <?php esc_html_e( 'This method makes it difficult for spambots to complete form submissions.', 'strong-testimonials' ); ?>
272
- </td>
273
- </tr>
274
- </table>
275
- <?php
276
- }
277
-
278
- public function add_upsells_7() {
279
- if ( ! defined( 'WPMTST_PRO_TEMPLATES_VERSION' ) ) :
280
- ?>
281
- <div class="wpmtst-alert">
282
- <?php
283
- printf(
284
- esc_html__( 'Create beautiful testimonial designs with our %s extension.', 'strong-testimonials' ),
285
- sprintf(
286
- '<a href="%s" target="_blank">%s</a>',
287
- esc_url( WPMTST_STORE_URL . '/extensions/pro-templates?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-template-list' ),
288
- esc_html__( 'Strong Testimonials: Pro Templates', 'strong-testimonials' )
289
- )
290
- );
291
- ?>
292
- <p>
293
- <a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/pro-templates?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-template-list' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
294
- <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-pro-templates-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
295
- </p>
296
- </div>
297
- <?php
298
- endif;
299
- }
300
-
301
- }
302
-
303
- new Strong_Testimonials_Upsell();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Upsell
4
+ *
5
+ * @since 2.38
6
+ */
7
+ class Strong_Testimonials_Upsell {
8
+
9
+ public $store_upgrade_url;
10
+
11
+ public function __construct() {
12
+ $this->set_store_upgrade_url();
13
+
14
+ add_action( 'admin_notices', array( $this, 'add_general_upsell_notice' ), 11 );
15
+ add_action( 'wpmtst_after_form_type_selection', array( $this, 'add_upsells_1' ) );
16
+ add_action( 'wpmtst_before_fields_settings', array( $this, 'add_upsells_2' ) );
17
+ add_action( 'wpmtst_view_editor_after_groups', array( $this, 'add_upsells_3' ) );
18
+ add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'add_upsells_4' ) );
19
+ add_action( 'wpmtst_fields_before_fields_editor_preview', array( $this, 'add_upsells_5' ) );
20
+ add_action( 'wpmtst_after_form_settings', array( $this, 'add_upsells_6' ) );
21
+ add_action( 'wpmtst_views_after_template_list', array( $this, 'add_upsells_7' ) );
22
+
23
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
24
+ }
25
+
26
+ public function add_meta_boxes() {
27
+
28
+
29
+ if ( ! defined( 'WPMTST_IMPORTER_VERSION' ) ) {
30
+ add_meta_box(
31
+ 'wpmtst-importer-upsell', // Unique ID
32
+ esc_html__( 'Import', 'strong-testimonials' ), // Title
33
+ array( $this, 'output_importer_upsell' ), // Callback function
34
+ 'wpm-testimonial', // Admin page (or post type)
35
+ 'side', // Context
36
+ 'high' // Priority
37
+ );
38
+ }
39
+
40
+ }
41
+
42
+ public function output_importer_upsell() {
43
+ ?>
44
+ <div class="wpmtst-alert"">
45
+ <h2><?php esc_html_e( 'Automatically pull in & display new reviews as your customers leave their feedback on external platforms', 'strong-testimonials' ) ?></h2>
46
+ <p><?php esc_html_e( 'Upgrade today and get the ability to import testimonials from:', 'strong-testimonials' ) ?></p>
47
+ <ul>
48
+ <li>Facebook</li>
49
+ <li>Google</li>
50
+ <li>Yelp</li>
51
+ <li>Zomato</li>
52
+ <li>WooCommerce</li>
53
+ <li>and more...</li>
54
+ </ul>
55
+ <p>
56
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=importer-metabox' ); ?>"><?php esc_html_e( 'Upgrade Now', 'strong-testimonials' ); ?></a>
57
+ </p>
58
+ </div>
59
+ <?php
60
+ }
61
+
62
+ public function set_store_upgrade_url() {
63
+
64
+ $this->store_upgrade_url = WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell';
65
+
66
+ //append license key
67
+ $license = trim( get_option( 'strong_testimonials_license_key' ) );
68
+ if ( $license ) {
69
+ $this->store_upgrade_url .= '&license=' . $license;
70
+ }
71
+
72
+ }
73
+
74
+ public function add_general_upsell_notice() {
75
+ $screen = get_current_screen();
76
+ if ( $screen->id !== 'edit-wpm-testimonial' && $screen->id !== 'wpm-testimonial_page_testimonial-views' ) {
77
+ return;
78
+ }
79
+
80
+ $notices = get_option( 'wpmtst_admin_notices', array() );
81
+ ?>
82
+
83
+ <div class="notice wpmtst-notice-wrap">
84
+
85
+ <?php if ( array_key_exists( 'feedback-notice', $notices ) ) : ?>
86
+ <div class="wpmtst-notice wpmtst-notice--feedback" data-key="feedback-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-admin' ) ); ?>">
87
+ <div class="wpmtst-notice--feedback__bg"></div>
88
+ <h2><?php esc_html_e( 'Feature Request', 'strong-testimonials' ); ?></h2>
89
+ <p><?php esc_html_e( 'Do you enjoy using Strong Testimonials? Please take a minute to suggest a feature or tell us what you think.', 'strong-testimonials' ); ?></p>
90
+ <a class="button" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScch0AchtnzxJsSrjUcW9ypcr1fZ9r-vyk3emEp8Sv47brb2g/viewform"><?php esc_html_e( 'Submit Feedback', 'strong-testimonials' ); ?></a>
91
+ <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'strong-testimonials' ); ?></span></button>
92
+ </div><!-- wpmtst-notice--feedback -->
93
+ <?php endif; ?>
94
+
95
+ <?php if ( array_key_exists( 'upsell-notice', $notices ) && ! wpmtst_extensions_installed() ) : ?>
96
+ <div class="wpmtst-notice wpmtst-notice--upsell" data-key="upsell-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpmtst-admin' ) ); ?>">
97
+ <div class="wpmtst-notice--upsell__bg"></div>
98
+ <h2><?php esc_html_e( 'Upgrade to PRO', 'strong-testimonials' ); ?></h2>
99
+ <p>
100
+ <?php esc_html_e( 'Build trust and credibility with your products.', 'strong-testimonials' ); ?><br/>
101
+ <?php esc_html_e( 'Do more with Strong Testimonials extensions.', 'strong-testimonials' ); ?>
102
+ </p>
103
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=' . $screen->id . '-notice-upsell' ); ?>"><?php esc_html_e( 'View pricing', 'strong-testimonials' ); ?></a>
104
+ <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'strong-testimonials' ); ?></span></button>
105
+ </div><!-- wpmtst-notice--upsell -->
106
+ <?php endif; ?>
107
+
108
+ </div><!-- wpmtst-notice-wrap -->
109
+ <?php
110
+ }
111
+
112
+ public function add_upsells_1() {
113
+
114
+ if ( ! defined( 'WPMTST_COUNTRY_SELECTOR_VERSION' ) ) :
115
+ ?>
116
+ <div class="wpmtst-alert" style="margin-top: 10px">
117
+ <?php esc_html_e( 'Want to know where are your customers located?', 'strong-testimonials' ); ?>
118
+ <br/>
119
+ <?php
120
+ printf(
121
+ esc_html__( 'Install the %s extension', 'strong-testimonials' ),
122
+ sprintf(
123
+ '<a href="%s" target="_blank">%s</a>',
124
+ esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ),
125
+ esc_html__( 'Strong Testimonials: Country Selector', 'strong-testimonials' )
126
+ )
127
+ );
128
+ ?>
129
+ <p>
130
+
131
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
132
+ </p>
133
+ </div>
134
+ <?php
135
+ endif;
136
+
137
+ if ( ! defined( 'WPMTST_CUSTOM_FIELDS_VERSION' ) ) :
138
+ ?>
139
+ <div class="wpmtst-alert" style="margin-top: 10px">
140
+ <?php esc_html_e( 'Know your customers by having access to more advanced custom fields.', 'strong-testimonials' ); ?>
141
+ <br/>
142
+ <?php
143
+ printf(
144
+ esc_html__( 'Install the %s extension', 'strong-testimonials' ),
145
+ sprintf(
146
+ '<a href="%s" target="_blank">%s</a>',
147
+ esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ),
148
+ esc_html__( 'Strong Testimonials: Custom Fields', 'strong-testimonials' )
149
+ )
150
+ );
151
+ ?>
152
+ <p>
153
+
154
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
155
+ </p>
156
+ </div>
157
+ <?php
158
+ endif;
159
+ }
160
+
161
+ public function add_upsells_2() {
162
+ if ( ! defined( 'WPMTST_MULTIPLE_FORMS_VERSION' ) ) :
163
+ ?>
164
+ <div class="wpmtst-alert" style="margin-top: 10px">
165
+ <?php
166
+ printf(
167
+ esc_html__( 'Create multiple submission forms by installing the %s extension.', 'strong-testimonials' ),
168
+ sprintf(
169
+ '<a href="%s" target="_blank">%s</a>',
170
+ esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ),
171
+ esc_html__( 'Strong Testimonials: Multiple Forms', 'strong-testimonials' )
172
+ )
173
+ );
174
+ ?>
175
+ <p>
176
+
177
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
178
+ </p>
179
+ </div>
180
+ <?php
181
+ endif;
182
+ }
183
+
184
+ public function add_upsells_3() {
185
+ if ( ! defined( 'WPMTST_REVIEW_MARKUP_VERSION' ) ) :
186
+ ?>
187
+ <div class="wpmtst-alert" style="margin-top: 10px">
188
+ <?php
189
+ printf(
190
+ esc_html__( 'Add SEO-friendly & Schema.org compliant Testimonials with our %s extension.', 'strong-testimonials' ),
191
+ sprintf(
192
+ '<a href="%s" target="_blank">%s</a>',
193
+ esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ),
194
+ esc_html__( 'Strong Testimonials: Review Markup', 'strong-testimonials' )
195
+ )
196
+ );
197
+ ?>
198
+ <ul>
199
+ <li><?php esc_html_e( '- With this extensions, search engines will display star ratings in search results for your site.', 'strong-testimonials' ); ?></li>
200
+ </ul>
201
+ <p>
202
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
203
+ </p>
204
+ </div>
205
+ <?php
206
+ endif;
207
+ }
208
+
209
+ public function add_upsells_4() {
210
+ if ( ! defined( 'WPMTST_ADVANCED_VIEWS_VERSION' ) ) :
211
+ ?>
212
+ <div class="wpmtst-alert" style="margin-top: 1.5rem">
213
+ <?php
214
+ printf(
215
+ esc_html__( 'With the %s extension you can:', 'strong-testimonials' ),
216
+ sprintf(
217
+ '<a href="%s" target="_blank">%s</a>',
218
+ esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ),
219
+ esc_html__( 'Strong Testimonials: Advanced Views', 'strong-testimonials' )
220
+ )
221
+ );
222
+
223
+ ?>
224
+ <ul>
225
+ <li><?php esc_html_e( '- filter & display testimonials based on their rating or on a pre-defined condition.', 'strong-testimonials' ); ?></li>
226
+ <li><?php esc_html_e( '- easily define the display order of your testimonial fields. Re-order the name, image, url and testimonial content fields through drag & drop.', 'strong-testimonials' ); ?></li>
227
+ <li><?php esc_html_e( '- edit, in real time, the way your testimonials will look on your site. Stop loosing clients because of poor design.', 'strong-testimonials' ); ?></li>
228
+
229
+ </ul>
230
+ <p>
231
+
232
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
233
+ </p>
234
+ </div>
235
+ <?php
236
+ endif;
237
+ }
238
+
239
+ public function add_upsells_5() {
240
+ if ( ! defined( 'WPMTST_CAPTCHA_VERSION' ) ) :
241
+ ?>
242
+ <div class="wpmtst-alert">
243
+ <?php
244
+ printf(
245
+ esc_html__( 'Protect your form against spam with the %s extension.', 'strong-testimonials' ),
246
+ sprintf(
247
+ '<a href="%s" target="_blank">%s</a>',
248
+ esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
249
+ esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
250
+ )
251
+ );
252
+ ?>
253
+ <p>
254
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
255
+ </p>
256
+ </div>
257
+ <?php
258
+ endif;
259
+ }
260
+
261
+ public function add_upsells_6() {
262
+ if ( defined( 'WPMTST_CAPTCHA_VERSION' ) ) {
263
+ return;
264
+ }
265
+ ?>
266
+ <hr>
267
+
268
+ <h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
269
+
270
+ <div class="wpmtst-alert">
271
+ <?php
272
+ printf(
273
+ esc_html__( 'Protect your form against spam. Add Google recaptcha or honeypots with the %s extension.', 'strong-testimonials' ),
274
+ sprintf(
275
+ '<a href="%s" target="_blank">%s</a>',
276
+ esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
277
+ esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
278
+ )
279
+ );
280
+ ?>
281
+ <p>
282
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
283
+ </p>
284
+ </div>
285
+
286
+ <table class="form-table" cellpadding="0" cellspacing="0">
287
+ <tr>
288
+ <th scope="row">
289
+ <label>
290
+ <?php esc_html_e( 'Honeypot', 'strong-testimonials' ); ?>
291
+ </label>
292
+ </th>
293
+ <td>
294
+ <p>
295
+ <?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
296
+ </p>
297
+ </td>
298
+ </tr>
299
+ <tr valign="top">
300
+ <th scope="row">
301
+ <label>
302
+ <a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
303
+ </label>
304
+ </th>
305
+ <td>
306
+ <?php esc_html_e( 'Google reCAPTCHA prompts visitors to check a box to prove that they’re not a robot before they submit the form.', 'strong-testimonials' ); ?>
307
+ <br/>
308
+ <?php esc_html_e( 'In some cases, they’re prompted to complete another task, like identify a string of letters.', 'strong-testimonials' ); ?>
309
+ <br/>
310
+ <?php esc_html_e( 'This method makes it difficult for spambots to complete form submissions.', 'strong-testimonials' ); ?>
311
+ </td>
312
+ </tr>
313
+ </table>
314
+ <?php
315
+ }
316
+
317
+ public function add_upsells_7() {
318
+ if ( ! defined( 'WPMTST_PRO_TEMPLATES_VERSION' ) ) :
319
+ ?>
320
+ <div class="wpmtst-alert">
321
+ <?php
322
+ printf(
323
+ esc_html__( 'Get access to profesionally designed testimonial templates with the %s extension.', 'strong-testimonials' ),
324
+ sprintf(
325
+ '<a href="%s" target="_blank">%s</a>',
326
+ esc_url( WPMTST_STORE_URL . '/extensions/pro-templates?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-template-list' ),
327
+ esc_html__( 'Strong Testimonials: Pro Templates', 'strong-testimonials' )
328
+ )
329
+ );
330
+ ?>
331
+ <p>
332
+ <a class="button button-primary" target="_blank" href="<?php echo esc_url( $this->store_upgrade_url . '&utm_medium=views-pro-templates-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
333
+ </p>
334
+ </div>
335
+ <?php
336
+ endif;
337
+ }
338
+
339
+ }
340
+
341
+ new Strong_Testimonials_Upsell();
admin/class-strong-views-list-table.php CHANGED
@@ -1,229 +1,229 @@
1
- <?php
2
- /**
3
- * Admin List Table
4
- *
5
- * @version 0.2.1
6
- */
7
-
8
- class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
-
10
- public $stickies;
11
-
12
- /**
13
- * Message to be displayed when there are no items
14
- *
15
- * @since 0.2.1
16
- * @access public
17
- */
18
- public function no_items() {
19
- _e( 'No views found.', 'strong-testimonials' );
20
- }
21
-
22
- public function prepare_list( $data = array() ) {
23
- $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
-
25
- $columns = $this->get_columns();
26
- $hidden = $this->get_hidden_columns();
27
- $sortable = $this->get_sortable_columns();
28
-
29
- $this->_column_headers = array( $columns, $hidden, $sortable );
30
-
31
- // Sort the list
32
- if ( isset( $_GET['orderby'] ) ) {
33
- usort( $data, array( &$this, 'usort_reorder' ) );
34
- }
35
- $data = $this->move_sticky( $data );
36
- $this->items = $data;
37
- }
38
-
39
- /**
40
- * Move sticky views to the top
41
- *
42
- * @param $data
43
- * @since 0.2.0
44
- * @return array
45
- */
46
- public function move_sticky( $data ) {
47
- $sticky_views = $views = array();
48
- foreach ( $data as $view ) {
49
- if ( in_array( $view['id'], $this->stickies ) ) {
50
- $sticky_views[] = $view;
51
- } else {
52
- $views[] = $view;
53
- }
54
- }
55
-
56
- return array_merge( $sticky_views, $views );
57
- }
58
-
59
- public function get_columns() {
60
- $columns = array(
61
- 'id' => __( 'ID', 'strong-testimonials' ),
62
- //'sticky' => __( 'Sticky', 'strong-testimonials' ),
63
- 'sticky' => '',
64
- 'name' => __( 'Name', 'strong-testimonials' ),
65
- 'mode' => __( 'Mode', 'strong-testimonials' ),
66
- 'template' => __( 'Template', 'strong-testimonials' ),
67
- 'shortcode' => __( 'Shortcode', 'strong-testimonials' ),
68
- );
69
-
70
- return $columns;
71
- }
72
-
73
- public function get_hidden_columns() {
74
- return array();
75
- }
76
-
77
- public function get_sortable_columns() {
78
- return array(
79
- 'id' => array( 'id', false ),
80
- 'name' => array( 'name', false ),
81
- );
82
- }
83
-
84
- public function usort_reorder( $a, $b ) {
85
- // If no sort, default to name
86
- $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'name';
87
-
88
- // If no order, default to asc
89
- $order = ( ! empty($_GET['order'] ) ) ? $_GET['order'] : 'asc';
90
-
91
- // Determine sort order
92
- if ( 'id' == $orderby ) {
93
- $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
94
- } else {
95
- $result = strcasecmp( $a[$orderby], $b[$orderby] );
96
- }
97
-
98
- // Send final sort direction to usort
99
- return ( $order === 'asc' ) ? $result : -$result;
100
- }
101
-
102
- public function cmp( $a, $b ) {
103
- if ( $a == $b ) {
104
- return 0;
105
- }
106
-
107
- return ( $a < $b ) ? -1 : 1;
108
- }
109
-
110
- public function column_name( $item ) {
111
- $screen = get_current_screen();
112
- $url = $screen->parent_file;
113
-
114
- // Edit link
115
- $edit_link = $url . '&page=testimonial-views&action=edit&id=' . $item['id'];
116
- echo '<a class="row-title" href="' . $edit_link . '">' . $item['name'] . '</a>';
117
-
118
- // Duplicate link
119
- // @since 2.1.0
120
- $duplicate_link = $url . '&page=testimonial-views&action=duplicate&id=' . $item['id'];
121
-
122
- // Delete link
123
- $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
124
-
125
- // Assemble links
126
-
127
- $actions = array();
128
- $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit', 'strong-testimonials' ) . '</a>';
129
- $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate', 'strong-testimonials' ) . '</a>';
130
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?', 'strong-testimonials' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete', 'strong-testimonials' ) . '</a>';
131
-
132
- echo $this->row_actions( $actions );
133
- }
134
-
135
- public function column_default( $item, $column_name ) {
136
- switch ( $column_name ) {
137
- case 'id':
138
- $text = $item['id'];
139
- break;
140
- case 'sticky':
141
- $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
142
- $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
143
- break;
144
- case 'name':
145
- $text = $item['name'];
146
- break;
147
- case 'mode':
148
- $mode = $item['data']['mode'];
149
- $text = $mode;
150
- $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
151
- if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
152
- $text = $view_options['mode'][ $mode ]['label'];
153
- }
154
- break;
155
- case 'template':
156
- if ( 'single_template' == $item['data']['mode'] ) {
157
- $text = __( 'theme single post template', 'strong-testimonials' );
158
- } else {
159
- $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
160
- }
161
- break;
162
- case 'shortcode':
163
- if ( 'single_template' == $item['data']['mode'] ) {
164
- $text = '';
165
- } else {
166
- $text = '[testimonial_view id="' . $item['id'] . '"]';
167
- }
168
- break;
169
- default:
170
- $text = print_r( $item, true );
171
- }
172
-
173
- return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
174
- }
175
-
176
- public function is_stuck( $id ) {
177
- $stickies = get_option( 'wpmtst_sticky_views', array() );
178
- return ( $stickies && in_array( $id, $stickies ) );
179
- }
180
-
181
- public function find_template( $atts = '' ) {
182
- $name = WPMST()->templates->get_template_config( $atts, 'name', false );
183
- return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'not found', 'strong-testimonials' ) . '</span>';
184
- }
185
-
186
- /**
187
- * Display the table
188
- *
189
- * @since 3.1.0
190
- * @access public
191
- */
192
- public function display() {
193
- $singular = $this->_args['singular'];
194
-
195
- // Disabling the table nav options to regain some real estate.
196
- //$this->display_tablenav( 'top' );
197
-
198
- ?>
199
- <div class="wp-list-table-wrap">
200
- <div class="overlay" style="display: none;"></div>
201
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
202
- <thead>
203
- <tr>
204
- <?php $this->print_column_headers(); ?>
205
- </tr>
206
- </thead>
207
-
208
- <tbody id="the-list"<?php
209
- if ( $singular ) {
210
- echo " data-wp-lists='list:$singular'";
211
- } ?>>
212
- <?php $this->display_rows_or_placeholder(); ?>
213
- </tbody>
214
-
215
- <tfoot>
216
- <tr>
217
- <?php $this->print_column_headers( false ); ?>
218
- </tr>
219
- </tfoot>
220
-
221
- </table>
222
- <?php
223
- //$this->display_tablenav( 'bottom' );
224
- ?>
225
- </div>
226
- <?php
227
- }
228
-
229
- }
1
+ <?php
2
+ /**
3
+ * Admin List Table
4
+ *
5
+ * @version 0.2.1
6
+ */
7
+
8
+ class Strong_Views_List_Table extends Strong_Testimonials_List_Table {
9
+
10
+ public $stickies;
11
+
12
+ /**
13
+ * Message to be displayed when there are no items
14
+ *
15
+ * @since 0.2.1
16
+ * @access public
17
+ */
18
+ public function no_items() {
19
+ _e( 'No views found.', 'strong-testimonials' );
20
+ }
21
+
22
+ public function prepare_list( $data = array() ) {
23
+ $this->stickies = get_option( 'wpmtst_sticky_views', array() );
24
+
25
+ $columns = $this->get_columns();
26
+ $hidden = $this->get_hidden_columns();
27
+ $sortable = $this->get_sortable_columns();
28
+
29
+ $this->_column_headers = array( $columns, $hidden, $sortable );
30
+
31
+ // Sort the list
32
+ if ( isset( $_GET['orderby'] ) ) {
33
+ usort( $data, array( &$this, 'usort_reorder' ) );
34
+ }
35
+ $data = $this->move_sticky( $data );
36
+ $this->items = $data;
37
+ }
38
+
39
+ /**
40
+ * Move sticky views to the top
41
+ *
42
+ * @param $data
43
+ * @since 0.2.0
44
+ * @return array
45
+ */
46
+ public function move_sticky( $data ) {
47
+ $sticky_views = $views = array();
48
+ foreach ( $data as $view ) {
49
+ if ( in_array( $view['id'], $this->stickies ) ) {
50
+ $sticky_views[] = $view;
51
+ } else {
52
+ $views[] = $view;
53
+ }
54
+ }
55
+
56
+ return array_merge( $sticky_views, $views );
57
+ }
58
+
59
+ public function get_columns() {
60
+ $columns = array(
61
+ 'id' => __( 'ID', 'strong-testimonials' ),
62
+ //'sticky' => __( 'Sticky', 'strong-testimonials' ),
63
+ 'sticky' => '',
64
+ 'name' => __( 'Name', 'strong-testimonials' ),
65
+ 'mode' => __( 'Mode', 'strong-testimonials' ),
66
+ 'template' => __( 'Template', 'strong-testimonials' ),
67
+ 'shortcode' => __( 'Shortcode', 'strong-testimonials' ),
68
+ );
69
+
70
+ return $columns;
71
+ }
72
+
73
+ public function get_hidden_columns() {
74
+ return array();
75
+ }
76
+
77
+ public function get_sortable_columns() {
78
+ return array(
79
+ 'id' => array( 'id', false ),
80
+ 'name' => array( 'name', false ),
81
+ );
82
+ }
83
+
84
+ public function usort_reorder( $a, $b ) {
85
+ // If no sort, default to name
86
+ $orderby = ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'name';
87
+
88
+ // If no order, default to asc
89
+ $order = ( ! empty($_GET['order'] ) ) ? $_GET['order'] : 'asc';
90
+
91
+ // Determine sort order
92
+ if ( 'id' == $orderby ) {
93
+ $result = $this->cmp( intval( $a[ $orderby ] ), intval( $b[ $orderby ] ) );
94
+ } else {
95
+ $result = strcasecmp( $a[$orderby], $b[$orderby] );
96
+ }
97
+
98
+ // Send final sort direction to usort
99
+ return ( $order === 'asc' ) ? $result : -$result;
100
+ }
101
+
102
+ public function cmp( $a, $b ) {
103
+ if ( $a == $b ) {
104
+ return 0;
105
+ }
106
+
107
+ return ( $a < $b ) ? -1 : 1;
108
+ }
109
+
110
+ public function column_name( $item ) {
111
+ $screen = get_current_screen();
112
+ $url = $screen->parent_file;
113
+
114
+ // Edit link
115
+ $edit_link = $url . '&page=testimonial-views&action=edit&id=' . $item['id'];
116
+ echo '<a class="row-title" href="' . $edit_link . '">' . $item['name'] . '</a>';
117
+
118
+ // Duplicate link
119
+ // @since 2.1.0
120
+ $duplicate_link = $url . '&page=testimonial-views&action=duplicate&id=' . $item['id'];
121
+
122
+ // Delete link
123
+ $delete_link = 'admin.php?action=delete-strong-view&id=' . $item['id'];
124
+
125
+ // Assemble links
126
+
127
+ $actions = array();
128
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit', 'strong-testimonials' ) . '</a>';
129
+ $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate', 'strong-testimonials' ) . '</a>';
130
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?', 'strong-testimonials' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete', 'strong-testimonials' ) . '</a>';
131
+
132
+ echo $this->row_actions( $actions );
133
+ }
134
+
135
+ public function column_default( $item, $column_name ) {
136
+ switch ( $column_name ) {
137
+ case 'id':
138
+ $text = $item['id'];
139
+ break;
140
+ case 'sticky':
141
+ $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
142
+ $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
143
+ break;
144
+ case 'name':
145
+ $text = $item['name'];
146
+ break;
147
+ case 'mode':
148
+ $mode = $item['data']['mode'];
149
+ $text = $mode;
150
+ $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
151
+ if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
152
+ $text = $view_options['mode'][ $mode ]['label'];
153
+ }
154
+ break;
155
+ case 'template':
156
+ if ( 'single_template' == $item['data']['mode'] ) {
157
+ $text = __( 'theme single post template', 'strong-testimonials' );
158
+ } else {
159
+ $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
160
+ }
161
+ break;
162
+ case 'shortcode':
163
+ if ( 'single_template' == $item['data']['mode'] ) {
164
+ $text = '';
165
+ } else {
166
+ $text = '[testimonial_view id="' . $item['id'] . '"]';
167
+ }
168
+ break;
169
+ default:
170
+ $text = print_r( $item, true );
171
+ }
172
+
173
+ return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
174
+ }
175
+
176
+ public function is_stuck( $id ) {
177
+ $stickies = get_option( 'wpmtst_sticky_views', array() );
178
+ return ( $stickies && in_array( $id, $stickies ) );
179
+ }
180
+
181
+ public function find_template( $atts = '' ) {
182
+ $name = WPMST()->templates->get_template_config( $atts, 'name', false );
183
+ return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'not found', 'strong-testimonials' ) . '</span>';
184
+ }
185
+
186
+ /**
187
+ * Display the table
188
+ *
189
+ * @since 3.1.0
190
+ * @access public
191
+ */
192
+ public function display() {
193
+ $singular = $this->_args['singular'];
194
+
195
+ // Disabling the table nav options to regain some real estate.
196
+ //$this->display_tablenav( 'top' );
197
+
198
+ ?>
199
+ <div class="wp-list-table-wrap">
200
+ <div class="overlay" style="display: none;"></div>
201
+ <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
202
+ <thead>
203
+ <tr>
204
+ <?php $this->print_column_headers(); ?>
205
+ </tr>
206
+ </thead>
207
+
208
+ <tbody id="the-list"<?php
209
+ if ( $singular ) {
210
+ echo " data-wp-lists='list:$singular'";
211
+ } ?>>
212
+ <?php $this->display_rows_or_placeholder(); ?>
213
+ </tbody>
214
+
215
+ <tfoot>
216
+ <tr>
217
+ <?php $this->print_column_headers( false ); ?>
218
+ </tr>
219
+ </tfoot>
220
+
221
+ </table>
222
+ <?php
223
+ //$this->display_tablenav( 'bottom' );
224
+ ?>
225
+ </div>
226
+ <?php
227
+ }
228
+
229
+ }
admin/class-walker-strong-category-checklist.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
- /**
3
- * Taxonomy API: Walker_Strong_Category_Checklist class
4
- *
5
- * @since 2.2.0
6
- */
7
-
8
- /**
9
- * Custom walker class to output an unordered list of category checkbox input elements.
10
- *
11
- * @since 2.5.1
12
- *
13
- * @see Walker
14
- * @see wp_category_checklist()
15
- * @see wp_terms_checklist()
16
- */
17
- class Walker_Strong_Category_Checklist extends Walker {
18
- public $tree_type = 'category';
19
- public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
-
21
- /**
22
- * Starts the list before the elements are added.
23
- *
24
- * @see Walker:start_lvl()
25
- *
26
- * @since 2.5.1
27
- *
28
- * @param string $output Passed by reference. Used to append additional content.
29
- * @param int $depth Depth of category. Used for tab indentation.
30
- * @param array $args An array of arguments. @see wp_terms_checklist()
31
- */
32
- public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
- $indent = str_repeat("\t", $depth);
34
- $output .= "$indent<ul class='children'>\n";
35
- }
36
-
37
- /**
38
- * Ends the list of after the elements are added.
39
- *
40
- * @see Walker::end_lvl()
41
- *
42
- * @since 2.5.1
43
- *
44
- * @param string $output Passed by reference. Used to append additional content.
45
- * @param int $depth Depth of category. Used for tab indentation.
46
- * @param array $args An array of arguments. @see wp_terms_checklist()
47
- */
48
- public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
- $indent = str_repeat("\t", $depth);
50
- $output .= "$indent</ul>\n";
51
- }
52
-
53
- /**
54
- * Start the element output.
55
- *
56
- * @see Walker::start_el()
57
- *
58
- * @since 2.5.1
59
- *
60
- * @param string $output Passed by reference. Used to append additional content.
61
- * @param object $category The current term object.
62
- * @param int $depth Depth of the term in reference to parents. Default 0.
63
- * @param array $args An array of arguments. @see wp_terms_checklist()
64
- * @param int $id ID of the current term.
65
- */
66
- public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
- if ( empty( $args['taxonomy'] ) ) {
68
- $taxonomy = 'wpm-testimonial-category';
69
- } else {
70
- $taxonomy = $args['taxonomy'];
71
- }
72
-
73
- $name = "view[data][category]";
74
-
75
- $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
-
78
- $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
-
80
- $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
-
82
- if ( ! empty( $args['list_only'] ) ) {
83
- $aria_cheched = 'false';
84
- $inner_class = 'category';
85
-
86
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
- $inner_class .= ' selected';
88
- $aria_cheched = 'true';
89
- }
90
-
91
- /** This filter is documented in wp-includes/category-template.php */
92
- $output .= "\n" . '<li' . $class . '>' .
93
- '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
- ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
- esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
- }
97
- else {
98
- /** This filter is documented in wp-includes/category-template.php */
99
- // newlines make for consistent spacing without extra CSS
100
- $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
101
- $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
- . ' id="category-' . $category->term_id . '"'
103
- . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
- . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
- $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
106
- $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
- . ' <span class="cat-count">(' . $category->count . ')</span>';
108
- $output .= '</label>';
109
- }
110
- }
111
-
112
- /**
113
- * Ends the element output, if needed.
114
- *
115
- * @see Walker::end_el()
116
- *
117
- * @since 2.5.1
118
- *
119
- * @param string $output Passed by reference. Used to append additional content.
120
- * @param object $category The current term object.
121
- * @param int $depth Depth of the term in reference to parents. Default 0.
122
- * @param array $args An array of arguments. @see wp_terms_checklist()
123
- */
124
- public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
- $output .= "</li>\n";
126
- }
127
- }
1
+ <?php
2
+ /**
3
+ * Taxonomy API: Walker_Strong_Category_Checklist class
4
+ *
5
+ * @since 2.2.0
6
+ */
7
+
8
+ /**
9
+ * Custom walker class to output an unordered list of category checkbox input elements.
10
+ *
11
+ * @since 2.5.1
12
+ *
13
+ * @see Walker
14
+ * @see wp_category_checklist()
15
+ * @see wp_terms_checklist()
16
+ */
17
+ class Walker_Strong_Category_Checklist extends Walker {
18
+ public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
+
21
+ /**
22
+ * Starts the list before the elements are added.
23
+ *
24
+ * @see Walker:start_lvl()
25
+ *
26
+ * @since 2.5.1
27
+ *
28
+ * @param string $output Passed by reference. Used to append additional content.
29
+ * @param int $depth Depth of category. Used for tab indentation.
30
+ * @param array $args An array of arguments. @see wp_terms_checklist()
31
+ */
32
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
+ $output .= "$indent<ul class='children'>\n";
35
+ }
36
+
37
+ /**
38
+ * Ends the list of after the elements are added.
39
+ *
40
+ * @see Walker::end_lvl()
41
+ *
42
+ * @since 2.5.1
43
+ *
44
+ * @param string $output Passed by reference. Used to append additional content.
45
+ * @param int $depth Depth of category. Used for tab indentation.
46
+ * @param array $args An array of arguments. @see wp_terms_checklist()
47
+ */
48
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
+ $output .= "$indent</ul>\n";
51
+ }
52
+
53
+ /**
54
+ * Start the element output.
55
+ *
56
+ * @see Walker::start_el()
57
+ *
58
+ * @since 2.5.1
59
+ *
60
+ * @param string $output Passed by reference. Used to append additional content.
61
+ * @param object $category The current term object.
62
+ * @param int $depth Depth of the term in reference to parents. Default 0.
63
+ * @param array $args An array of arguments. @see wp_terms_checklist()
64
+ * @param int $id ID of the current term.
65
+ */
66
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
+ if ( empty( $args['taxonomy'] ) ) {
68
+ $taxonomy = 'wpm-testimonial-category';
69
+ } else {
70
+ $taxonomy = $args['taxonomy'];
71
+ }
72
+
73
+ $name = "view[data][category]";
74
+
75
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
+
78
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
+
80
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
+
82
+ if ( ! empty( $args['list_only'] ) ) {
83
+ $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
+
86
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
+ $inner_class .= ' selected';
88
+ $aria_cheched = 'true';
89
+ }
90
+
91
+ /** This filter is documented in wp-includes/category-template.php */
92
+ $output .= "\n" . '<li' . $class . '>' .
93
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
+ /** This filter is documented in wp-includes/category-template.php */
99
+ // newlines make for consistent spacing without extra CSS
100
+ $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
101
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
+ . ' id="category-' . $category->term_id . '"'
103
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
+ $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
106
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
108
+ $output .= '</label>';
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Ends the element output, if needed.
114
+ *
115
+ * @see Walker::end_el()
116
+ *
117
+ * @since 2.5.1
118
+ *
119
+ * @param string $output Passed by reference. Used to append additional content.
120
+ * @param object $category The current term object.
121
+ * @param int $depth Depth of the term in reference to parents. Default 0.
122
+ * @param array $args An array of arguments. @see wp_terms_checklist()
123
+ */
124
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
+ $output .= "</li>\n";
126
+ }
127
+ }
admin/class-walker-strong-form-category-checklist.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
- /**
3
- * Taxonomy API: Walker_Strong_Form_Category_Checklist class
4
- *
5
- * @since 2.2.0
6
- */
7
-
8
- /**
9
- * Custom walker class to output an unordered list of category checkbox input elements.
10
- *
11
- * @since 2.5.1
12
- *
13
- * @see Walker
14
- * @see wp_category_checklist()
15
- * @see wp_terms_checklist()
16
- */
17
- class Walker_Strong_Form_Category_Checklist extends Walker {
18
- public $tree_type = 'category';
19
- public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
-
21
- /**
22
- * Starts the list before the elements are added.
23
- *
24
- * @see Walker:start_lvl()
25
- *
26
- * @since 2.5.1
27
- *
28
- * @param string $output Passed by reference. Used to append additional content.
29
- * @param int $depth Depth of category. Used for tab indentation.
30
- * @param array $args An array of arguments. @see wp_terms_checklist()
31
- */
32
- public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
- $indent = str_repeat("\t", $depth);
34
- $output .= "$indent<ul class='children'>\n";
35
- }
36
-
37
- /**
38
- * Ends the list of after the elements are added.
39
- *
40
- * @see Walker::end_lvl()
41
- *
42
- * @since 2.5.1
43
- *
44
- * @param string $output Passed by reference. Used to append additional content.
45
- * @param int $depth Depth of category. Used for tab indentation.
46
- * @param array $args An array of arguments. @see wp_terms_checklist()
47
- */
48
- public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
- $indent = str_repeat("\t", $depth);
50
- $output .= "$indent</ul>\n";
51
- }
52
-
53
- /**
54
- * Start the element output.
55
- *
56
- * @see Walker::start_el()
57
- *
58
- * @since 2.5.1
59
- *
60
- * @param string $output Passed by reference. Used to append additional content.
61
- * @param object $category The current term object.
62
- * @param int $depth Depth of the term in reference to parents. Default 0.
63
- * @param array $args An array of arguments. @see wp_terms_checklist()
64
- * @param int $id ID of the current term.
65
- */
66
- public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
- if ( empty( $args['taxonomy'] ) ) {
68
- $taxonomy = 'wpm-testimonial-category';
69
- } else {
70
- $taxonomy = $args['taxonomy'];
71
- }
72
-
73
- $name = "view[data][category-form]";
74
-
75
- $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
- $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
-
78
- $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
-
80
- $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
-
82
- if ( ! empty( $args['list_only'] ) ) {
83
- $aria_cheched = 'false';
84
- $inner_class = 'category';
85
-
86
- if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
- $inner_class .= ' selected';
88
- $aria_cheched = 'true';
89
- }
90
-
91
- /** This filter is documented in wp-includes/category-template.php */
92
- $output .= "\n" . '<li' . $class . '>' .
93
- '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
- ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
- esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
- }
97
- else {
98
- /** This filter is documented in wp-includes/category-template.php */
99
- // newlines make for consistent spacing without extra CSS
100
- $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
101
- $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
- . ' id="category-form-' . $category->term_id . '"'
103
- . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
- . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
- $output .= '<label class="selectit" for="category-form-' . $category->term_id . '">' . "\n";
106
- $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
- . ' <span class="cat-count">(' . $category->count . ')</span>';
108
- $output .= '</label>';
109
- }
110
- }
111
-
112
- /**
113
- * Ends the element output, if needed.
114
- *
115
- * @see Walker::end_el()
116
- *
117
- * @since 2.5.1
118
- *
119
- * @param string $output Passed by reference. Used to append additional content.
120
- * @param object $category The current term object.
121
- * @param int $depth Depth of the term in reference to parents. Default 0.
122
- * @param array $args An array of arguments. @see wp_terms_checklist()
123
- */
124
- public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
- $output .= "</li>\n";
126
- }
127
- }
1
+ <?php
2
+ /**
3
+ * Taxonomy API: Walker_Strong_Form_Category_Checklist class
4
+ *
5
+ * @since 2.2.0
6
+ */
7
+
8
+ /**
9
+ * Custom walker class to output an unordered list of category checkbox input elements.
10
+ *
11
+ * @since 2.5.1
12
+ *
13
+ * @see Walker
14
+ * @see wp_category_checklist()
15
+ * @see wp_terms_checklist()
16
+ */
17
+ class Walker_Strong_Form_Category_Checklist extends Walker {
18
+ public $tree_type = 'category';
19
+ public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
+
21
+ /**
22
+ * Starts the list before the elements are added.
23
+ *
24
+ * @see Walker:start_lvl()
25
+ *
26
+ * @since 2.5.1
27
+ *
28
+ * @param string $output Passed by reference. Used to append additional content.
29
+ * @param int $depth Depth of category. Used for tab indentation.
30
+ * @param array $args An array of arguments. @see wp_terms_checklist()
31
+ */
32
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
33
+ $indent = str_repeat("\t", $depth);
34
+ $output .= "$indent<ul class='children'>\n";
35
+ }
36
+
37
+ /**
38
+ * Ends the list of after the elements are added.
39
+ *
40
+ * @see Walker::end_lvl()
41
+ *
42
+ * @since 2.5.1
43
+ *
44
+ * @param string $output Passed by reference. Used to append additional content.
45
+ * @param int $depth Depth of category. Used for tab indentation.
46
+ * @param array $args An array of arguments. @see wp_terms_checklist()
47
+ */
48
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
49
+ $indent = str_repeat("\t", $depth);
50
+ $output .= "$indent</ul>\n";
51
+ }
52
+
53
+ /**
54
+ * Start the element output.
55
+ *
56
+ * @see Walker::start_el()
57
+ *
58
+ * @since 2.5.1
59
+ *
60
+ * @param string $output Passed by reference. Used to append additional content.
61
+ * @param object $category The current term object.
62
+ * @param int $depth Depth of the term in reference to parents. Default 0.
63
+ * @param array $args An array of arguments. @see wp_terms_checklist()
64
+ * @param int $id ID of the current term.
65
+ */
66
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67
+ if ( empty( $args['taxonomy'] ) ) {
68
+ $taxonomy = 'wpm-testimonial-category';
69
+ } else {
70
+ $taxonomy = $args['taxonomy'];
71
+ }
72
+
73
+ $name = "view[data][category-form]";
74
+
75
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
+
78
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
+
80
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
+
82
+ if ( ! empty( $args['list_only'] ) ) {
83
+ $aria_cheched = 'false';
84
+ $inner_class = 'category';
85
+
86
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87
+ $inner_class .= ' selected';
88
+ $aria_cheched = 'true';
89
+ }
90
+
91
+ /** This filter is documented in wp-includes/category-template.php */
92
+ $output .= "\n" . '<li' . $class . '>' .
93
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96
+ }
97
+ else {
98
+ /** This filter is documented in wp-includes/category-template.php */
99
+ // newlines make for consistent spacing without extra CSS
100
+ $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
101
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102
+ . ' id="category-form-' . $category->term_id . '"'
103
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105
+ $output .= '<label class="selectit" for="category-form-' . $category->term_id . '">' . "\n";
106
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
108
+ $output .= '</label>';
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Ends the element output, if needed.
114
+ *
115
+ * @see Walker::end_el()
116
+ *
117
+ * @since 2.5.1
118
+ *
119
+ * @param string $output Passed by reference. Used to append additional content.
120
+ * @param object $category The current term object.
121
+ * @param int $depth Depth of the term in reference to parents. Default 0.
122
+ * @param array $args An array of arguments. @see wp_terms_checklist()
123
+ */
124
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125
+ $output .= "</li>\n";
126
+ }
127
+ }
admin/compat.php CHANGED
@@ -1,116 +1,116 @@
1
- <?php
2
-
3
- /**
4
- * Prevent other post ordering plugins, in admin_menu hook.
5
- *
6
- * @since 1.16.0
7
- */
8
- function wpmtst_deny_plugins_menu() {
9
-
10
- /**
11
- * Post Types Order
12
- */
13
- if ( is_plugin_active( 'post-types-order/post-types-order.php' ) ) {
14
- remove_submenu_page( 'edit.php?post_type=wpm-testimonial', 'order-post-types-wpm-testimonial' );
15
- }
16
-
17
- }
18
- add_action( 'admin_menu', 'wpmtst_deny_plugins_menu', 200 );
19
-
20
-
21
- /**
22
- * Plugin and theme compatibility in admin.
23
- *
24
- * @since 2.4.0
25
- */
26
- function wpmtst_compat_admin_init() {
27
- $theme = wp_get_theme();
28
-
29
- /* ------------------------------------------------------------
30
- * Theme Name: Mercury
31
- * Theme URI: http://themes.themegoods2.com/mercury
32
- * Description: Premium Template for Photography Portfolio
33
- * Version: 1.7.5
34
- * Author: Peerapong Pulpipatnan
35
- * Author URI: http://themeforest.net/user/peerapong
36
- * ------------------------------------------------------------
37
- * Mercury enqueues its scripts and styles poorly.
38
- * 1. on the `admin_init` hook
39
- * 2. UNconditionally
40
- */
41
- if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
-
43
- /** Screen information is not available yet. */
44
- //$screen = get_current_screen();
45
- //if ( $screen && 'wpm-testimonial' == $screen->post_type ) {
46
-
47
- if ( false !== strpos( $_SERVER['QUERY_STRING'], 'post_type=wpm-testimonial' ) ) {
48
- if ( function_exists( 'pp_add_init' ) ) {
49
- remove_action( 'admin_init', 'pp_add_init' );
50
- }
51
- }
52
-
53
- }
54
- }
55
- add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
56
-
57
-
58
- /**
59
- * Prevent other post ordering plugins, in admin_init hook.
60
- *
61
- * @since 1.16.0
62
- */
63
- function wpmtst_deny_plugins_init() {
64
-
65
- /**
66
- * Intuitive Custom Post Order
67
- */
68
- if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
69
- $options = get_option( 'hicpo_options' );
70
- $update = false;
71
-
72
- if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
73
- if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
74
- $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
75
- $update = true;
76
- }
77
- }
78
-
79
- if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
80
- if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
81
- $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
82
- $update = true;
83
- }
84
- }
85
-
86
- if ( $update )
87
- update_option( 'hicpo_options', $options );
88
- }
89
-
90
- /**
91
- * Simple Custom Post Order
92
- */
93
- if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
- $options = get_option( 'scporder_options' );
95
- $update = false;
96
-
97
- if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
- if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
- $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
- $update = true;
101
- }
102
- }
103
-
104
- if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
- if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
- $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
- $update = true;
108
- }
109
- }
110
-
111
- if ( $update )
112
- update_option( 'scporder_options', $options );
113
- }
114
-
115
- }
116
- add_action( 'admin_init', 'wpmtst_deny_plugins_init', 200 );
1
+ <?php
2
+
3
+ /**
4
+ * Prevent other post ordering plugins, in admin_menu hook.
5
+ *
6
+ * @since 1.16.0
7
+ */
8
+ function wpmtst_deny_plugins_menu() {
9
+
10
+ /**
11
+ * Post Types Order
12
+ */
13
+ if ( is_plugin_active( 'post-types-order/post-types-order.php' ) ) {
14
+ remove_submenu_page( 'edit.php?post_type=wpm-testimonial', 'order-post-types-wpm-testimonial' );
15
+ }
16
+
17
+ }
18
+ add_action( 'admin_menu', 'wpmtst_deny_plugins_menu', 200 );
19
+
20
+
21
+ /**
22
+ * Plugin and theme compatibility in admin.
23
+ *
24
+ * @since 2.4.0
25
+ */
26
+ function wpmtst_compat_admin_init() {
27
+ $theme = wp_get_theme();
28
+
29
+ /* ------------------------------------------------------------
30
+ * Theme Name: Mercury
31
+ * Theme URI: http://themes.themegoods2.com/mercury
32
+ * Description: Premium Template for Photography Portfolio
33
+ * Version: 1.7.5
34
+ * Author: Peerapong Pulpipatnan
35
+ * Author URI: http://themeforest.net/user/peerapong
36
+ * ------------------------------------------------------------
37
+ * Mercury enqueues its scripts and styles poorly.
38
+ * 1. on the `admin_init` hook
39
+ * 2. UNconditionally
40
+ */
41
+ if ( 'Mercury' == $theme->get( 'Name' ) && 'http://themes.themegoods2.com/mercury' == $theme->get( 'ThemeURI' ) ) {
42
+
43
+ /** Screen information is not available yet. */
44
+ //$screen = get_current_screen();
45
+ //if ( $screen && 'wpm-testimonial' == $screen->post_type ) {
46
+
47
+ if ( false !== strpos( $_SERVER['QUERY_STRING'], 'post_type=wpm-testimonial' ) ) {
48
+ if ( function_exists( 'pp_add_init' ) ) {
49
+ remove_action( 'admin_init', 'pp_add_init' );
50
+ }
51
+ }
52
+
53
+ }
54
+ }
55
+ add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
56
+
57
+
58
+ /**
59
+ * Prevent other post ordering plugins, in admin_init hook.
60
+ *
61
+ * @since 1.16.0
62
+ */
63
+ function wpmtst_deny_plugins_init() {
64
+
65
+ /**
66
+ * Intuitive Custom Post Order
67
+ */
68
+ if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
69
+ $options = get_option( 'hicpo_options' );
70
+ $update = false;
71
+
72
+ if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
73
+ if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
74
+ $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
75
+ $update = true;
76
+ }
77
+ }
78
+
79
+ if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
80
+ if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
81
+ $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
82
+ $update = true;
83
+ }
84
+ }
85
+
86
+ if ( $update )
87
+ update_option( 'hicpo_options', $options );
88
+ }
89
+
90
+ /**
91
+ * Simple Custom Post Order
92
+ */
93
+ if ( is_plugin_active( 'simple-custom-post-order/simple-custom-post-order.php' ) ) {
94
+ $options = get_option( 'scporder_options' );
95
+ $update = false;
96
+
97
+ if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
98
+ if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
99
+ $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
100
+ $update = true;
101
+ }
102
+ }
103
+
104
+ if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
105
+ if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
106
+ $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
107
+ $update = true;
108
+ }
109
+ }
110
+
111
+ if ( $update )
112
+ update_option( 'scporder_options', $options );
113
+ }
114
+
115
+ }
116
+ add_action( 'admin_init', 'wpmtst_deny_plugins_init', 200 );
admin/css/about.css CHANGED
@@ -1,53 +1,53 @@
1
- /**
2
- * About Strong Testimonials page
3
- */
4
- /* == Elements
5
- --------------------------------------------------*/
6
- .highlight {
7
- background: #FFFF99;
8
- border: 1px solid #EEEE00;
9
- display: inline-block;
10
- padding: 3px 6px 2px; }
11
-
12
- .code {
13
- display: inline-block;
14
- font-family: Consolas, Monaco, monospace;
15
- font-size: 13px;
16
- background: white;
17
- padding: 4px 8px;
18
- box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
19
- max-width: 90%; }
20
-
21
- .highlight {
22
- background: rgba(255, 229, 135, 0.5);
23
- border: 1px solid #FFDC5D;
24
- border-radius: 3px;
25
- color: #1E1800;
26
- padding: 5px 15px; }
27
-
28
- .feature-section-sub {
29
- margin-top: 2em; }
30
- .feature-section-sub h3.heading {
31
- font-size: 1.2em; }
32
- .feature-section-sub ul {
33
- font-size: 14px;
34
- list-style: square;
35
- margin-left: 1em; }
36
- .feature-section-sub ul li {
37
- margin-left: 1em;
38
- text-indent: 4px; }
39
-
40
- /* == Extending WordPress about.css
41
- --------------------------------------------------*/
42
- .about-wrap [class$="-col"] .col {
43
- align-self: flex-start; }
44
-
45
- .wp-badge {
46
- color: #FFF; }
47
-
48
- .wp-badge.strong-testimonials {
49
- background-image: url(../img/strong-testimonials-badge.png);
50
- background-color: #8224E3; }
51
-
52
- .feature-section code {
53
- font-size: 13px; }
1
+ /**
2
+ * About Strong Testimonials page
3
+ */
4
+ /* == Elements
5
+ --------------------------------------------------*/
6
+ .highlight {
7
+ background: #FFFF99;
8
+ border: 1px solid #EEEE00;
9
+ display: inline-block;
10
+ padding: 3px 6px 2px; }
11
+
12
+ .code {
13
+ display: inline-block;
14
+ font-family: Consolas, Monaco, monospace;
15
+ font-size: 13px;
16
+ background: white;
17
+ padding: 4px 8px;
18
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
19
+ max-width: 90%; }
20
+
21
+ .highlight {
22
+ background: rgba(255, 229, 135, 0.5);
23
+ border: 1px solid #FFDC5D;
24
+ border-radius: 3px;
25
+ color: #1E1800;
26
+ padding: 5px 15px; }
27
+
28
+ .feature-section-sub {
29
+ margin-top: 2em; }
30
+ .feature-section-sub h3.heading {
31
+ font-size: 1.2em; }
32
+ .feature-section-sub ul {
33
+ font-size: 14px;
34
+ list-style: square;
35
+ margin-left: 1em; }
36
+ .feature-section-sub ul li {
37
+ margin-left: 1em;
38
+ text-indent: 4px; }
39
+
40
+ /* == Extending WordPress about.css
41
+ --------------------------------------------------*/
42
+ .about-wrap [class$="-col"] .col {
43
+ align-self: flex-start; }
44
+
45
+ .wp-badge {
46
+ color: #FFF; }
47
+
48
+ .wp-badge.strong-testimonials {
49
+ background-image: url(../img/strong-testimonials-badge.png);
50
+ background-color: #8224E3; }
51
+
52
+ .feature-section code {
53
+ font-size: 13px; }
admin/css/admin-compat.css CHANGED
@@ -1,178 +1,178 @@
1
- /**
2
- * Compatibility settings tab
3
- */
4
- /**
5
- * Basic structure
6
- */
7
- div.row {
8
- display: table-row; }
9
- div.row > div {
10
- display: table-cell; }
11
- div.row > div:first-child {
12
- width: 200px; }
13
- div.row:not(:last-child) > div {
14
- padding-bottom: 0.5em; }
15
- div.row p {
16
- margin-bottom: 0.5em; }
17
- div.row.header p {
18
- margin-bottom: 1em; }
19
-
20
- /**
21
- * Elements
22
- */
23
- .wrap.wpmtst h2 {
24
- margin: 2em 0 1em; }
25
- .wrap.wpmtst h2.nav-tab-wrapper {
26
- margin-top: 6px; }
27
-
28
- input.element {
29
- width: 15em; }
30
-
31
- /**
32
- * Behavior
33
- */
34
- .hidden {
35
- display: none; }
36
-
37
- [data-sub] {
38
- display: none; }
39
-
40
- /**
41
- * Common scenarios table
42
- */
43
- div.scenarios div.row {
44
- border: 1px solid #DDD; }
45
- div.scenarios div.row > div {
46
- padding: 1em; }
47
- div.scenarios div.row > div:first-child {
48
- width: 35%;
49
- border-right: 1px dotted #DDD; }
50
- div.scenarios div.row > div:last-child {
51
- width: 30%;
52
- border-left: 1px dotted #DDD; }
53
- div.scenarios div.row p {
54
- font-size: 14px;
55
- margin: 0; }
56
- div.scenarios div.row p:not(:last-child) {
57
- margin-bottom: 1em; }
58
- div.scenarios div.row.header > div {
59
- font-weight: 600;
60
- padding: 0.5em 1em; }
61
-
62
- /**
63
- * Settings table
64
- */
65
- div.row:not(:last-child) > div:nth-child(2) {
66
- padding-bottom: 0.5em; }
67
- div.row > div.radio-sub label {
68
- text-indent: 24px;
69
- width: 200px; }
70
- div.row p.about {
71
- display: inline-block;
72
- vertical-align: middle; }
73
- div.row p.about.adjacent {
74
- margin-left: 0.5em; }
75
- div.row p.description {
76
- display: inline-block;
77
- font-size: 14px; }
78
- div.row label.current {
79
- font-weight: 600; }
80
-
81
- /**
82
- * Lazy load class name pairs
83
- */
84
- .pair-actions {
85
- margin-top: 10px; }
86
-
87
- .pair-sep {
88
- margin-right: 1em; }
89
-
90
- @media only screen and (max-width: 1024px) {
91
- .lazyload-pairs .pair {
92
- border: 1px solid #DDD;
93
- padding: 5px 10px; } }
94
- /**
95
- * Number spinner
96
- */
97
- .number-style {
98
- display: inline-block;
99
- margin-right: 10px;
100
- /**
101
- * Disable text selection on buttons. Seems to help jittery pointers.
102
- */ }
103
- .number-style input {
104
- margin: 0 5px;
105
- font-family: Consolas, Monaco, monospace;
106
- text-align: center;
107
- width: 4em; }
108
- .number-style > span {
109
- cursor: pointer; }
110
- .number-style > span.number-minus, .number-style > span.number-plus {
111
- height: 24px;
112
- width: 24px;
113
- display: inline-block;
114
- text-align: center;
115
- vertical-align: top;
116
- border-radius: 3px;
117
- background: #0085ba;
118
- border-width: 1px;
119
- border-style: solid;
120
- border-color: #0073aa #006799 #006799;
121
- -webkit-box-shadow: 0 1px 0 #006799;
122
- box-shadow: 0 1px 0 #006799;
123
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
124
- color: #FFF; }
125
- .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
126
- background: #008ec2; }
127
- .number-style > span.number-minus:active, .number-style > span.number-plus:active {
128
- background: #0073aa;
129
- border-color: #006799;
130
- -webkit-box-shadow: inset 0 2px 0 #006799;
131
- box-shadow: inset 0 2px 0 #006799;
132
- -webkit-transform: translateY(1px);
133
- -ms-transform: translateY(1px);
134
- transform: translateY(1px);
135
- outline: none; }
136
- .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
137
- background: #AAA;
138
- border-color: #999 #777 #777;
139
- -webkit-box-shadow: 0 1px 0 #777;
140
- box-shadow: 0 1px 0 #777;
141
- text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777; }
142
- .number-style > span.number-minus::after, .number-style > span.number-plus::after {
143
- font-family: dashicons;
144
- font-size: 24px;
145
- line-height: 24px;
146
- height: 24px;
147
- width: 24px;
148
- display: inline-block;
149
- color: #FFF;
150
- text-align: center;
151
- position: relative;
152
- left: -1px; }
153
- .number-style > span.number-minus::after {
154
- content: "\f140"; }
155
- .number-style > span.number-plus::after {
156
- content: "\f142"; }
157
- .number-style input[type='number'] {
158
- -moz-appearance: textfield; }
159
- .number-style input::-webkit-outer-spin-button,
160
- .number-style input::-webkit-inner-spin-button {
161
- -webkit-appearance: none; }
162
- .number-style .number-minus,
163
- .number-style .number-plus,
164
- .number-style .number-minus::after,
165
- .number-style .number-plus::after {
166
- -webkit-touch-callout: none;
167
- /* iOS Safari */
168
- -webkit-user-select: none;
169
- /* Safari */
170
- -khtml-user-select: none;
171
- /* Konqueror HTML */
172
- -moz-user-select: none;
173
- /* Firefox */
174
- -ms-user-select: none;
175
- /* Internet Explorer/Edge */
176
- user-select: none;
177
- /* Non-prefixed version, currently
178
- supported by Chrome and Opera */ }
1
+ /**
2
+ * Compatibility settings tab
3
+ */
4
+ /**
5
+ * Basic structure
6
+ */
7
+ div.row {
8
+ display: table-row; }
9
+ div.row > div {
10
+ display: table-cell; }
11
+ div.row > div:first-child {
12
+ width: 200px; }
13
+ div.row:not(:last-child) > div {
14
+ padding-bottom: 0.5em; }
15
+ div.row p {
16
+ margin-bottom: 0.5em; }
17
+ div.row.header p {
18
+ margin-bottom: 1em; }
19
+
20
+ /**
21
+ * Elements
22
+ */
23
+ .wrap.wpmtst h2 {
24
+ margin: 2em 0 1em; }
25
+ .wrap.wpmtst h2.nav-tab-wrapper {
26
+ margin-top: 6px; }
27
+
28
+ input.element {
29
+ width: 15em; }
30
+
31
+ /**
32
+ * Behavior
33
+ */
34
+ .hidden {
35
+ display: none; }
36
+
37
+ [data-sub] {
38
+ display: none; }
39
+
40
+ /**
41
+ * Common scenarios table
42
+ */
43
+ div.scenarios div.row {
44
+ border: 1px solid #DDD; }
45
+ div.scenarios div.row > div {
46
+ padding: 1em; }
47
+ div.scenarios div.row > div:first-child {
48
+ width: 35%;
49
+ border-right: 1px dotted #DDD; }
50
+ div.scenarios div.row > div:last-child {
51
+ width: 30%;
52
+ border-left: 1px dotted #DDD; }
53
+ div.scenarios div.row p {
54
+ font-size: 14px;
55
+ margin: 0; }
56
+ div.scenarios div.row p:not(:last-child) {
57
+ margin-bottom: 1em; }
58
+ div.scenarios div.row.header > div {
59
+ font-weight: 600;
60
+ padding: 0.5em 1em; }
61
+
62
+ /**
63
+ * Settings table
64
+ */
65
+ div.row:not(:last-child) > div:nth-child(2) {
66
+ padding-bottom: 0.5em; }
67
+ div.row > div.radio-sub label {
68
+ text-indent: 24px;
69
+ width: 200px; }
70
+ div.row p.about {
71
+ display: inline-block;
72
+ vertical-align: middle; }
73
+ div.row p.about.adjacent {
74
+ margin-left: 0.5em; }
75
+ div.row p.description {
76
+ display: inline-block;
77
+ font-size: 14px; }
78
+ div.row label.current {
79
+ font-weight: 600; }
80
+
81
+ /**
82
+ * Lazy load class name pairs
83
+ */
84
+ .pair-actions {
85
+ margin-top: 10px; }
86
+
87
+ .pair-sep {
88
+ margin-right: 1em; }
89
+
90
+ @media only screen and (max-width: 1024px) {
91
+ .lazyload-pairs .pair {
92
+ border: 1px solid #DDD;
93
+ padding: 5px 10px; } }
94
+ /**
95
+ * Number spinner
96
+ */
97
+ .number-style {
98
+ display: inline-block;
99
+ margin-right: 10px;
100
+ /**
101
+ * Disable text selection on buttons. Seems to help jittery pointers.
102
+ */ }
103
+ .number-style input {
104
+ margin: 0 5px;
105
+ font-family: Consolas, Monaco, monospace;
106
+ text-align: center;
107
+ width: 4em; }
108
+ .number-style > span {
109
+ cursor: pointer; }
110
+ .number-style > span.number-minus, .number-style > span.number-plus {
111
+ height: 24px;
112
+ width: 24px;
113
+ display: inline-block;
114
+ text-align: center;
115
+ vertical-align: top;
116
+ border-radius: 3px;
117
+ background: #0085ba;
118
+ border-width: 1px;
119
+ border-style: solid;
120
+ border-color: #0073aa #006799 #006799;
121
+ -webkit-box-shadow: 0 1px 0 #006799;
122
+ box-shadow: 0 1px 0 #006799;
123
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
124
+ color: #FFF; }
125
+ .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
126
+ background: #008ec2; }
127
+ .number-style > span.number-minus:active, .number-style > span.number-plus:active {
128
+ background: #0073aa;
129
+ border-color: #006799;
130
+ -webkit-box-shadow: inset 0 2px 0 #006799;
131
+ box-shadow: inset 0 2px 0 #006799;
132
+ -webkit-transform: translateY(1px);
133
+ -ms-transform: translateY(1px);
134
+ transform: translateY(1px);
135
+ outline: none; }
136
+ .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
137
+ background: #AAA;
138
+ border-color: #999 #777 #777;
139
+ -webkit-box-shadow: 0 1px 0 #777;
140
+ box-shadow: 0 1px 0 #777;
141
+ text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777; }
142
+ .number-style > span.number-minus::after, .number-style > span.number-plus::after {
143
+ font-family: dashicons;
144
+ font-size: 24px;
145
+ line-height: 24px;
146
+ height: 24px;
147
+ width: 24px;
148
+ display: inline-block;
149
+ color: #FFF;
150
+ text-align: center;
151
+ position: relative;
152
+ left: -1px; }
153
+ .number-style > span.number-minus::after {
154
+ content: "\f140"; }
155
+ .number-style > span.number-plus::after {
156
+ content: "\f142"; }
157
+ .number-style input[type='number'] {
158
+ -moz-appearance: textfield; }
159
+ .number-style input::-webkit-outer-spin-button,
160
+ .number-style input::-webkit-inner-spin-button {
161
+ -webkit-appearance: none; }
162
+ .number-style .number-minus,
163
+ .number-style .number-plus,
164
+ .number-style .number-minus::after,
165
+ .number-style .number-plus::after {
166
+ -webkit-touch-callout: none;
167
+ /* iOS Safari */
168
+ -webkit-user-select: none;
169
+ /* Safari */
170
+ -khtml-user-select: none;
171
+ /* Konqueror HTML */
172
+ -moz-user-select: none;
173
+ /* Firefox */
174
+ -ms-user-select: none;
175
+ /* Internet Explorer/Edge */
176
+ user-select: none;
177
+ /* Non-prefixed version, currently
178
+ supported by Chrome and Opera */ }
admin/css/admin-form.css CHANGED
@@ -1,138 +1,138 @@
1
-
2
- /* Settings tab for Form Notification Email
3
- ------------------------------------------------*/
4
- .match-height {
5
- /* match WordPress - divs with text inputs are taller than ones with radio buttons */
6
- margin: 0.25em 0 0.5em !important;
7
- }
8
- .email-container {
9
- display: flex;
10
- flex-direction: column;
11
- max-width: 900px;
12
- }
13
- .email-container > div {
14
- margin-bottom: 2px;
15
- }
16
- .email-option-row {
17
- display: flex;
18
- flex-direction: row;
19
- background: #FFF;
20
- padding: 0 10px;
21
- }
22
- .no-padding {
23
- padding: 0;
24
- }
25
- .email-option-row.column {
26
- flex-direction: column;
27
- }
28
- /* row > column 1 */
29
- .email-option-desc {
30
- flex: 0 0 8%;
31
- min-width: 80px;
32
- padding: 10px 0;
33
- font-weight: 600;
34
- }
35
- /* row > column 2 */
36
- .email-option-inputs {
37
- flex: 1 0 auto;
38
- flex-direction: column;
39
- }
40
- .email-option {
41
- flex: 0 0 100%;
42
- display: flex;
43
- flex-direction: row;
44
- }
45
- .email-option.header {
46
- padding: 10px 0;
47
- }
48
- .email-option.body {
49
- padding: 10px 0;
50
- }
51
- .email-option.footer {
52
- padding: 10px 0;
53
- }
54
- .email-option-first {
55
- margin-top: 10px ;
56
- }
57
- .email-option.single {
58
- }
59
- .email-option:not(:last-child) {
60
- border-bottom: 1px solid #F2F2F2;
61
- }
62
- .email-option-part { /* 2 columns */
63
- flex: 1 0 auto;
64
- display: flex;
65
- flex-direction: column;
66
- }
67
- .email-option-part:first-child {
68
- flex: 0 1 40%;
69
- padding-right: 20px;
70
- }
71
- .email-option-part input[type="text"],
72
- .email-option-part input[type="email"],
73
- input.wide {
74
- width: 100%;
75
- }
76
- .email-option-label {
77
- padding-left: 3px;
78
- }
79
- .email-option-fieldset {
80
- display: flex;
81
- flex-direction: row;
82
- }
83
- .email-option-fieldset .controls {
84
- flex: 0 0 30px;
85
- justify-content: center;
86
- }
87
- .email-option-fieldset .controls input[type="radio"] {
88
- margin-top: 2px;
89
- }
90
- .email-option-fieldset .fields {
91
- flex: 1 0 auto;
92
- }
93
- .email-option-fieldset .controls,
94
- .email-option-fieldset .fields {
95
- display: flex;
96
- height: 30px;
97
- align-items: center;
98
- }
99
-
100
- /* delete email recipient */
101
- .delete-recipient {
102
- color: #999;
103
- display: inline-block;
104
- transition: all 0.2s ease;
105
- }
106
- .delete-recipient:hover {
107
- cursor: pointer;
108
- color: #FFF;
109
- background: #FF0000;
110
- border-radius: 1px;
111
- }
112
-
113
- /* message */
114
- .email-container textarea {
115
- white-space: pre-wrap;
116
- width: 100%;
117
- }
118
-
119
- /* template tags */
120
- .template-tags-help {
121
- flex: 2 0 auto;
122
- background: #FFFFE0;
123
- }
124
- .template-tags-help ul {
125
- margin: 0;
126
- }
127
- .template-tags-help .title {
128
- background: rgba(0, 0, 0, 0.1);
129
- padding: 10px;
130
- }
131
- .template-tags-help .content {
132
- padding: 10px;
133
- }
134
- .template-tags-help ul li {
135
- display: inline-block;
136
- cursor: pointer;
137
- margin-right: 1em;
138
- }
1
+
2
+ /* Settings tab for Form Notification Email
3
+ ------------------------------------------------*/
4
+ .match-height {
5
+ /* match WordPress - divs with text inputs are taller than ones with radio buttons */
6
+ margin: 0.25em 0 0.5em !important;
7
+ }
8
+ .email-container {
9
+ display: flex;
10
+ flex-direction: column;
11
+ max-width: 900px;
12
+ }
13
+ .email-container > div {
14
+ margin-bottom: 2px;
15
+ }
16
+ .email-option-row {
17
+ display: flex;
18
+ flex-direction: row;
19
+ background: #FFF;
20
+ padding: 0 10px;
21
+ }
22
+ .no-padding {
23
+ padding: 0;
24
+ }
25
+ .email-option-row.column {
26
+ flex-direction: column;
27
+ }
28
+ /* row > column 1 */
29
+ .email-option-desc {
30
+ flex: 0 0 8%;
31
+ min-width: 80px;
32
+ padding: 10px 0;
33
+ font-weight: 600;
34
+ }
35
+ /* row > column 2 */
36
+ .email-option-inputs {
37
+ flex: 1 0 auto;
38
+ flex-direction: column;
39
+ }
40
+ .email-option {
41
+ flex: 0 0 100%;
42
+ display: flex;
43
+ flex-direction: row;
44
+ }
45
+ .email-option.header {
46
+ padding: 10px 0;
47
+ }
48
+ .email-option.body {
49
+ padding: 10px 0;
50
+ }
51
+ .email-option.footer {
52
+ padding: 10px 0;
53
+ }
54
+ .email-option-first {
55
+ margin-top: 10px ;
56
+ }
57
+ .email-option.single {
58
+ }
59
+ .email-option:not(:last-child) {
60
+ border-bottom: 1px solid #F2F2F2;
61
+ }
62
+ .email-option-part { /* 2 columns */
63
+ flex: 1 0 auto;
64
+ display: flex;
65
+ flex-direction: column;
66
+ }
67
+ .email-option-part:first-child {
68
+ flex: 0 1 40%;
69
+ padding-right: 20px;
70
+ }
71
+ .email-option-part input[type="text"],
72
+ .email-option-part input[type="email"],
73
+ input.wide {
74
+ width: 100%;
75
+ }
76
+ .email-option-label {
77
+ padding-left: 3px;
78
+ }
79
+ .email-option-fieldset {
80
+ display: flex;
81
+ flex-direction: row;
82
+ }
83
+ .email-option-fieldset .controls {
84
+ flex: 0 0 30px;
85
+ justify-content: center;
86
+ }
87
+ .email-option-fieldset .controls input[type="radio"] {
88
+ margin-top: 2px;
89
+ }
90
+ .email-option-fieldset .fields {
91
+ flex: 1 0 auto;
92
+ }
93
+ .email-option-fieldset .controls,
94
+ .email-option-fieldset .fields {
95
+ display: flex;
96
+ height: 30px;
97
+ align-items: center;
98
+ }
99
+
100
+ /* delete email recipient */
101
+ .delete-recipient {
102
+ color: #999;
103
+ display: inline-block;
104
+ transition: all 0.2s ease;
105
+ }
106
+ .delete-recipient:hover {
107
+ cursor: pointer;
108
+ color: #FFF;
109
+ background: #FF0000;
110
+ border-radius: 1px;
111
+ }
112
+
113
+ /* message */
114
+ .email-container textarea {
115
+ white-space: pre-wrap;
116
+ width: 100%;
117
+ }
118
+
119
+ /* template tags */
120
+ .template-tags-help {
121
+ flex: 2 0 auto;
122
+ background: #FFFFE0;
123
+ }
124
+ .template-tags-help ul {
125
+ margin: 0;
126
+ }
127
+ .template-tags-help .title {
128
+ background: rgba(0, 0, 0, 0.1);
129
+ padding: 10px;
130
+ }
131
+ .template-tags-help .content {
132
+ padding: 10px;
133
+ }
134
+ .template-tags-help ul li {
135
+ display: inline-block;
136
+ cursor: pointer;
137
+ margin-right: 1em;
138
+ }
admin/css/fields.css CHANGED
@@ -1,317 +1,317 @@
1
- /**
2
- * Strong Testimonials admin stylesheet
3
- */
4
-
5
- optgroup,
6
- optgroup option {
7
- /* Firefox */
8
- font-family: inherit;
9
- }
10
-
11
- /* structure */
12
-
13
- #left-col,
14
- #right-col {
15
- box-sizing: border-box;
16
- }
17
-
18
- #left-col {
19
- width: 55%;
20
- float: left;
21
- padding: 20px 0;
22
- }
23
-
24
- #right-col {
25
- width: calc(45% - 30px);
26
- float: right;
27
- padding: 20px 0 20px 0;
28
- }
29
-
30
- #wpmtst-custom-fields-form {
31
- width: 100%;
32
- }
33
-
34
- #fields-editor-preview {
35
- background: #fdfdfd;
36
- border: 1px solid #bbb;
37
- box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
38
- min-height: 300px;
39
- }
40
-
41
- .wrap.wpmtst {
42
- /*max-width: 1024px;*/
43
- max-width: 1366px;
44
- }
45
-
46
- .wrap.wpmtst h3 {
47
- margin-top: 0;
48
- }
49
-
50
- /* Custom fields
51
- ---------------------------------------------------------*/
52
-
53
- #custom-field-list {
54
- margin-bottom: 0;
55
- }
56
-
57
- #custom-field-list li {
58
- background: #fff;
59
- margin: 0;
60
- border: 1px solid #DDD;
61
- border-top-width: 0;
62
- }
63
-
64
- #custom-field-list li:first-child {
65
- border-top-width: 1px;
66
- }
67
-
68
- #custom-field-list li.ui-sortable-helper {
69
- border-bottom-width: 1px;
70
- box-shadow: 0 0 10px rgba(0,0,0,0.3);
71
- }
72
-
73
- #custom-field-list .custom-field-header {
74
- /*padding: 10px;*/
75
- font-size: 1.1em;
76
- height: 40px;
77
- }
78
-
79
- #custom-field-list span.link {
80
- display: inline-block;
81
- cursor: pointer;
82
- padding: 10px;
83
- width: calc(100% - 20px);
84
- }
85
-
86
- /* toggle */
87
-
88
- #custom-field-list span.link span.toggle:before {
89
- content: "\f140";
90
- display: inline-block;
91
- font: normal 20px/1 dashicons;
92
- float: right;
93
- color: #999;
94
- width: 20px;
95
- height: 20px;
96
- }
97
-
98
- /* handle */
99
-
100
- #custom-field-list .handle:before {
101
- content: "\f333";
102
- display: inline-block;
103
- font: normal 20px/1 dashicons;
104
- float: left;
105
- color: #999;
106
- width: 20px;
107
- height: 20px;
108
- margin-right: 10px;
109
- }
110
-
111
- #custom-field-list .handle:hover {
112
- color: #111;
113
- cursor: move;
114
- }
115
-
116
- #custom-field-list a.field {
117
- text-decoration: none;
118
- }
119
-
120
- /* open */
121
-
122
- #custom-field-list li.open {
123
- border-color: #2ea2cc;
124
- }
125
-
126
- #custom-field-list li .custom-field-header {
127
- transition: background 0.2s ease;
128
- }
129
-
130
- #custom-field-list li.open .custom-field-header {
131
- background: #2ea2cc;
132
- }
133
-
134
- #custom-field-list li.open span.toggle:before {
135
- content: "\f142";
136
- }
137
-
138
- #custom-field-list li.open span.handle:before,
139
- #custom-field-list li.open span.link a,
140
- #custom-field-list li.open span.toggle:before {
141
- color: #fff;
142
- }
143
-
144
- /* field inputs */
145
-
146
- #custom-field-list .custom-field {
147
- display: none;
148
- }
149
-
150
- #custom-field-list select.field-type {
151
- min-width: 120px;
152
- }
153
-
154
- #custom-field-list option[disabled] {
155
- color: #999;
156
- }
157
-
158
- #custom-field-list optgroup {
159
- font-weight: 600;
160
- }
161
-
162
- #custom-field-list optgroup:before {
163
- color: #333;
164
- content: attr(label);
165
- display: block;
166
- font-style: normal;
167
- padding-left: 4px;
168
- }
169
-
170
- #wpmtst-custom-fields-form .controls {
171
- padding: 10px 15px;
172
- background: #e7f5fa;
173
- border-top: 1px solid #A9D9EB;
174
- }
175
-
176
- #wpmtst-custom-fields-form .controls > span:nth-child(n+2):before {
177
- content: " | ";
178
- }
179
-
180
- #wpmtst-custom-fields-form .controls a.delete-field {
181
- color: #F00;
182
- }
183
-
184
- #custom-field-list .sortable-placeholder {
185
- border: 1px dashed #ccc !important;
186
- background: lightyellow !important;
187
- height: 40px;
188
- }
189
-
190
- #custom-field-list .field-table {
191
- border-collapse: collapse;
192
- width: 100%;
193
- }
194
-
195
- #custom-field-list .field-table th,
196
- #custom-field-list .field-table td {
197
- border-bottom: 1px solid #E8E8E8;
198
- padding: 10px;
199
- }
200
-
201
- #custom-field-list .field-table th {
202
- font-weight: 600;
203
- width: 160px;
204
- padding-top: 14px;
205
- text-align: left;
206
- vertical-align: top;
207
- white-space: nowrap;
208
- }
209
-
210
- #custom-field-list .field-table td input[type="text"] {
211
- width: 100%;
212
- }
213
-
214
- #custom-field-list .field-table td input[type="text"].as-number {
215
- width: 4em;
216
- }
217
-
218
- #custom-field-list .field-table td span.help {
219
- display: block;
220
- padding: 3px;
221
- }
222
-
223
- #custom-field-list .field-table td span.help.inline {
224
- display: inline-block;
225
- }
226
-
227
- #custom-field-list .field-table td span.help:first-of-type {
228
- margin-top: 5px;
229
- }
230
-
231
- #custom-field-list .form-error {
232
- background: rgba(242, 0, 0, 0.05);
233
- }
234
- #custom-field-list .form-error-text {
235
- color: #EE0000;
236
- }
237
-
238
- #custom-field-list .field-table tr:last-of-type th,
239
- #custom-field-list .field-table tr:last-of-type td {
240
- border-bottom: 0;
241
- }
242
-
243
- #add-field-bar {
244
- padding-top: 10px;
245
- text-align: right;
246
- }
247
-
248
- #add-field-bar input {
249
- margin-right: 0;
250
- margin-left: 10px;
251
- }
252
-
253
- /* field group actions */
254
-
255
- #field-group-actions {
256
- margin-top: 2em;
257
- }
258
-
259
- #field-group-actions > div {
260
- display: inline-block;
261
- float: left;
262
- margin-bottom: 1em;
263
- }
264
-
265
- #field-group-actions > div:not(:last-child) {
266
- margin-right: 1em;
267
- }
268
-
269
- /* field group label */
270
-
271
- p.field-group-label-wrap {
272
- display: table;
273
- width: 100%;
274
- }
275
-
276
- p.field-group-label-wrap > label,
277
- p.field-group-label-wrap > input {
278
- display: table-cell;
279
- font-size: 20px;
280
- line-height: 1.4em;
281
- }
282
-
283
- .field-group-label-wrap label {
284
- width: 6.5em;
285
- }
286
-
287
- p.field-group-label-wrap input {
288
- width: 100%;
289
- margin: 0;
290
- padding: 4px 8px;
291
- }
292
-
293
- /* fields editor */
294
-
295
- #fields-editor-wrap {
296
- display: inline-block;
297
- float: left;
298
- width: 540px;
299
- }
300
-
301
- /*--------------------------------------------------*
302
- Responsive
303
- *--------------------------------------------------*/
304
- @media only screen and (max-width: 1024px) {
305
-
306
- #left-col {
307
- width: 100%;
308
- padding: 20px 0;
309
- }
310
-
311
- #right-col {
312
- width: 100%;
313
- border-left: 0;
314
- padding: 20px;
315
- }
316
-
317
- }
1
+ /**
2
+ * Strong Testimonials admin stylesheet
3
+ */
4
+
5
+ optgroup,
6
+ optgroup option {
7
+ /* Firefox */
8
+ font-family: inherit;
9
+ }
10
+
11
+ /* structure */
12
+
13
+ #left-col,
14
+ #right-col {
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ #left-col {
19
+ width: 55%;
20
+ float: left;
21
+ padding: 20px 0;
22
+ }
23
+
24
+ #right-col {
25
+ width: calc(45% - 30px);
26
+ float: right;
27
+ padding: 20px 0 20px 0;
28
+ }
29
+
30
+ #wpmtst-custom-fields-form {
31
+ width: 100%;
32
+ }
33
+
34
+ #fields-editor-preview {
35
+ background: #fdfdfd;
36
+ border: 1px solid #bbb;
37
+ box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
38
+ min-height: 300px;
39
+ }
40
+
41
+ .wrap.wpmtst {
42
+ /*max-width: 1024px;*/
43
+ max-width: 1366px;
44
+ }
45
+
46
+ .wrap.wpmtst h3 {
47
+ margin-top: 0;
48
+ }
49
+
50
+ /* Custom fields
51
+ ---------------------------------------------------------*/
52
+
53
+ #custom-field-list {
54
+ margin-bottom: 0;
55
+ }
56
+
57
+ #custom-field-list li {
58
+ background: #fff;
59
+ margin: 0;
60
+ border: 1px solid #DDD;
61
+ border-top-width: 0;
62
+ }
63
+
64
+ #custom-field-list li:first-child {
65
+ border-top-width: 1px;
66
+ }
67
+
68
+ #custom-field-list li.ui-sortable-helper {
69
+ border-bottom-width: 1px;
70
+ box-shadow: 0 0 10px rgba(0,0,0,0.3);
71
+ }
72
+
73
+ #custom-field-list .custom-field-header {
74
+ /*padding: 10px;*/
75
+ font-size: 1.1em;
76
+ height: 40px;
77
+ }
78
+
79
+ #custom-field-list span.link {
80
+ display: inline-block;
81
+ cursor: pointer;
82
+ padding: 10px;
83
+ width: calc(100% - 20px);
84
+ }
85
+
86
+ /* toggle */
87
+
88
+ #custom-field-list span.link span.toggle:before {
89
+ content: "\f140";
90
+ display: inline-block;
91
+ font: normal 20px/1 dashicons;
92
+ float: right;
93
+ color: #999;
94
+ width: 20px;
95
+ height: 20px;
96
+ }
97
+
98
+ /* handle */
99
+
100
+ #custom-field-list .handle:before {
101
+ content: "\f333";
102
+ display: inline-block;
103
+ font: normal 20px/1 dashicons;
104
+ float: left;
105
+ color: #999;
106
+ width: 20px;
107
+ height: 20px;
108
+ margin-right: 10px;
109
+ }
110
+
111
+ #custom-field-list .handle:hover {
112
+ color: #111;
113
+ cursor: move;
114
+ }
115
+
116
+ #custom-field-list a.field {
117
+ text-decoration: none;
118
+ }
119
+
120
+ /* open */
121
+
122
+ #custom-field-list li.open {
123
+ border-color: #2ea2cc;
124
+ }
125
+
126
+ #custom-field-list li .custom-field-header {
127
+ transition: background 0.2s ease;
128
+ }
129
+
130
+ #custom-field-list li.open .custom-field-header {
131
+ background: #2ea2cc;
132
+ }
133
+
134
+ #custom-field-list li.open span.toggle:before {
135
+ content: "\f142";
136
+ }
137
+
138
+ #custom-field-list li.open span.handle:before,
139
+ #custom-field-list li.open span.link a,
140
+ #custom-field-list li.open span.toggle:before {
141
+ color: #fff;
142
+ }
143
+
144
+ /* field inputs */
145
+
146
+ #custom-field-list .custom-field {
147
+ display: none;
148
+ }
149
+
150
+ #custom-field-list select.field-type {
151
+ min-width: 120px;
152
+ }
153
+
154
+ #custom-field-list option[disabled] {
155
+ color: #999;
156
+ }
157
+
158
+ #custom-field-list optgroup {
159
+ font-weight: 600;
160
+ }
161
+
162
+ #custom-field-list optgroup:before {
163
+ color: #333;
164
+ content: attr(label);
165
+ display: block;
166
+ font-style: normal;
167
+ padding-left: 4px;
168
+ }
169
+
170
+ #wpmtst-custom-fields-form .controls {
171
+ padding: 10px 15px;
172
+ background: #e7f5fa;
173
+ border-top: 1px solid #A9D9EB;
174
+ }
175
+
176
+ #wpmtst-custom-fields-form .controls > span:nth-child(n+2):before {
177
+ content: " | ";
178
+ }
179
+
180
+ #wpmtst-custom-fields-form .controls a.delete-field {
181
+ color: #F00;
182
+ }
183
+
184
+ #custom-field-list .sortable-placeholder {
185
+ border: 1px dashed #ccc !important;
186
+ background: lightyellow !important;
187
+ height: 40px;
188
+ }
189
+
190
+ #custom-field-list .field-table {
191
+ border-collapse: collapse;
192
+ width: 100%;
193
+ }
194
+
195
+ #custom-field-list .field-table th,
196
+ #custom-field-list .field-table td {
197
+ border-bottom: 1px solid #E8E8E8;
198
+ padding: 10px;
199
+ }
200
+
201
+ #custom-field-list .field-table th {
202
+ font-weight: 600;
203
+ width: 160px;
204
+ padding-top: 14px;
205
+ text-align: left;
206
+ vertical-align: top;
207
+ white-space: nowrap;
208
+ }
209
+
210
+ #custom-field-list .field-table td input[type="text"] {
211
+ width: 100%;
212
+ }
213
+
214
+ #custom-field-list .field-table td input[type="text"].as-number {
215
+ width: 4em;
216
+ }
217
+
218
+ #custom-field-list .field-table td span.help {
219
+ display: block;
220
+ padding: 3px;
221
+ }
222
+
223
+ #custom-field-list .field-table td span.help.inline {
224
+ display: inline-block;
225
+ }
226
+
227
+ #custom-field-list .field-table td span.help:first-of-type {
228
+ margin-top: 5px;
229
+ }
230
+
231
+ #custom-field-list .form-error {
232
+ background: rgba(242, 0, 0, 0.05);
233
+ }
234
+ #custom-field-list .form-error-text {
235
+ color: #EE0000;
236
+ }
237
+
238
+ #custom-field-list .field-table tr:last-of-type th,
239
+ #custom-field-list .field-table tr:last-of-type td {
240
+ border-bottom: 0;
241
+ }
242
+
243
+ #add-field-bar {
244
+ padding-top: 10px;
245
+ text-align: right;
246
+ }
247
+
248
+ #add-field-bar input {
249
+ margin-right: 0;
250
+ margin-left: 10px;
251
+ }
252
+
253
+ /* field group actions */
254
+
255
+ #field-group-actions {
256
+ margin-top: 2em;
257
+ }
258
+
259
+ #field-group-actions > div {
260
+ display: inline-block;
261
+ float: left;
262
+ margin-bottom: 1em;
263
+ }
264
+
265
+ #field-group-actions > div:not(:last-child) {
266
+ margin-right: 1em;
267
+ }
268
+
269
+ /* field group label */
270
+
271
+ p.field-group-label-wrap {
272
+ display: table;
273
+ width: 100%;
274
+ }
275
+
276
+ p.field-group-label-wrap > label,
277
+ p.field-group-label-wrap > input {
278
+ display: table-cell;
279
+ font-size: 20px;
280
+ line-height: 1.4em;
281
+ }
282
+
283
+ .field-group-label-wrap label {
284
+ width: 6.5em;
285
+ }
286
+
287
+ p.field-group-label-wrap input {
288
+ width: 100%;
289
+ margin: 0;
290
+ padding: 4px 8px;
291
+ }
292
+
293
+ /* fields editor */
294
+
295
+ #fields-editor-wrap {
296
+ display: inline-block;
297
+ float: left;
298
+ width: 540px;
299
+ }
300
+
301
+ /*--------------------------------------------------*
302
+ Responsive
303
+ *--------------------------------------------------*/
304
+ @media only screen and (max-width: 1024px) {
305
+
306
+ #left-col {
307
+ width: 100%;
308
+ padding: 20px 0;
309
+ }
310
+
311
+ #right-col {
312
+ width: 100%;
313
+ border-left: 0;
314
+ padding: 20px;
315
+ }
316
+
317
+ }
admin/css/form-preview.css CHANGED
@@ -1,135 +1,135 @@
1
- /**
2
- * Strong Testimonials Default Form template
3
- */
4
- .strong-form {
5
- margin: 0 auto;
6
- padding: 20px;
7
- }
8
-
9
- .strong-form .form-field {
10
- margin-bottom: 1.5em;
11
- }
12
-
13
- .strong-form .form-field.submit {
14
- margin-bottom: 1em;
15
- padding: 0;
16
- }
17
-
18
- .strong-form .required.symbol:after {
19
- content: '*';
20
- color: #FF0000;
21
- margin: 0 4px;
22
- }
23
-
24
- .strong-form label {
25
- display: inline-block;
26
- float: none;
27
- }
28
-
29
- .strong-form input[type="text"],
30
- .strong-form input[type="email"],
31
- .strong-form input[type="url"],
32
- .strong-form input[type="file"],
33
- .strong-form select,
34
- .strong-form textarea {
35
- box-sizing: border-box;
36
- display: block;
37
- float: none;
38
- width: 100%;
39
- margin: 3px 0;
40
- padding: 1px 5px;
41
- }
42
-
43
- .strong-form input[type="checkbox"] {
44
- margin-right: 0.5em;
45
- }
46
-
47
- .strong-form input[type="checkbox"] + label {
48
- font-weight: 400;
49
- }
50
-
51
- .strong-form textarea {
52
- height: 12em;
53
- }
54
-
55
- .strong-form span.error,
56
- .strong-form label.error {
57
- display: block;
58
- }
59
-
60
- .strong-form .before {
61
- display: block;
62
- }
63
-
64
- .strong-form .after {
65
- display: block;
66
- }
67
-
68
- input.captcha {
69
- display: block;
70
- width: auto;
71
- }
72
-
73
- img.captcha {
74
- border: 0;
75
- }
76
-
77
- .wpmtst-captcha {
78
- margin-bottom: 1em;
79
- }
80
-
81
- .strong-form label {
82
- font-weight: 700;
83
- }
84
-
85
- .strong-form .form-field .after {
86
- font-style: italic;
87
- }
88
-
89
- .strong-form input.error,
90
- .strong-form textarea.error,
91
- .strong-form select.error {
92
- background: #F9E5E6;
93
- border: 1px solid #E8AAAD;
94
- color: #B50007;
95
- }
96
-
97
- .strong-form span.error,
98
- .strong-form label.error {
99
- color: #B50007;
100
- }
101
-
102
- /* category checklist */
103
-
104
- .strong-category-list-panel {
105
- margin: 3px 0;
106
- }
107
-
108
- .strong-category-list,
109
- .strong-category-list ul {
110
- list-style-type: none;
111
- }
112
-
113
- .strong-category-list {
114
- margin: 0;
115
- }
116
-
117
- .strong-category-list ul {
118
- margin-left: 20px;
119
- }
120
-
121
- .strong-category-list li {
122
- line-height: normal;
123
- margin-bottom: 0;
124
- }
125
-
126
- .strong-category-list input[type="checkbox"] {
127
- margin: 0;
128
- }
129
-
130
- .strong-category-list label {
131
- font-weight: 400;
132
- white-space: nowrap;
133
- word-wrap: break-word;
134
- }
135
-
1
+ /**
2
+ * Strong Testimonials Default Form template
3
+ */
4
+ .strong-form {
5
+ margin: 0 auto;
6
+ padding: 20px;
7
+ }
8
+
9
+ .strong-form .form-field {
10
+ margin-bottom: 1.5em;
11
+ }
12
+
13
+ .strong-form .form-field.submit {
14
+ margin-bottom: 1em;
15
+ padding: 0;
16
+ }
17
+
18
+ .strong-form .required.symbol:after {
19
+ content: '*';
20
+ color: #FF0000;
21
+ margin: 0 4px;
22
+ }
23
+
24
+ .strong-form label {
25
+ display: inline-block;
26
+ float: none;
27
+ }
28
+
29
+ .strong-form input[type="text"],
30
+ .strong-form input[type="email"],
31
+ .strong-form input[type="url"],
32
+ .strong-form input[type="file"],
33
+ .strong-form select,
34
+ .strong-form textarea {
35
+ box-sizing: border-box;
36
+ display: block;
37
+ float: none;
38
+ width: 100%;
39
+ margin: 3px 0;
40
+ padding: 1px 5px;
41
+ }
42
+
43
+ .strong-form input[type="checkbox"] {
44
+ margin-right: 0.5em;
45
+ }
46
+
47
+ .strong-form input[type="checkbox"] + label {
48
+ font-weight: 400;
49
+ }
50
+
51
+ .strong-form textarea {
52
+ height: 12em;
53
+ }
54
+
55
+ .strong-form span.error,
56
+ .strong-form label.error {
57
+ display: block;
58
+ }
59
+
60
+ .strong-form .before {
61
+ display: block;
62
+ }
63
+
64
+ .strong-form .after {
65
+ display: block;
66
+ }
67
+
68
+ input.captcha {
69
+ display: block;
70
+ width: auto;
71
+ }
72
+
73
+ img.captcha {
74
+ border: 0;
75
+ }
76
+
77
+ .wpmtst-captcha {
78
+ margin-bottom: 1em;
79
+ }
80
+
81
+ .strong-form label {
82
+ font-weight: 700;
83
+ }
84
+
85
+ .strong-form .form-field .after {
86
+ font-style: italic;
87
+ }
88
+
89
+ .strong-form input.error,
90
+ .strong-form textarea.error,
91
+ .strong-form select.error {
92
+ background: #F9E5E6;
93
+ border: 1px solid #E8AAAD;
94
+ color: #B50007;
95
+ }
96
+
97
+ .strong-form span.error,
98
+ .strong-form label.error {
99
+ color: #B50007;
100
+ }
101
+
102
+ /* category checklist */
103
+
104
+ .strong-category-list-panel {
105
+ margin: 3px 0;
106
+ }
107
+
108
+ .strong-category-list,
109
+ .strong-category-list ul {
110
+ list-style-type: none;
111
+ }
112
+
113
+ .strong-category-list {
114
+ margin: 0;
115
+ }
116
+
117
+ .strong-category-list ul {
118
+ margin-left: 20px;
119
+ }
120
+
121
+ .strong-category-list li {
122
+ line-height: normal;
123
+ margin-bottom: 0;
124
+ }
125
+
126
+ .strong-category-list input[type="checkbox"] {
127
+ margin: 0;
128
+ }
129
+
130
+ .strong-category-list label {
131
+ font-weight: 400;
132
+ white-space: nowrap;
133
+ word-wrap: break-word;
134
+ }
135
+
admin/css/number-spinner.css CHANGED
@@ -1,98 +1,98 @@
1
- /**
2
- * Number spinner
3
- */
4
- .number-style {
5
- display: inline-block;
6
- margin-right: 10px;
7
- /**
8
- * Disable text selection on buttons. Seems to help jittery pointers.
9
- */
10
- }
11
- .number-style input {
12
- margin: 0 5px;
13
- font-family: Consolas, Monaco, monospace;
14
- text-align: center;
15
- width: 4em;
16
- }
17
- .number-style > span {
18
- cursor: pointer;
19
- }
20
- .number-style > span.number-minus, .number-style > span.number-plus {
21
- height: 24px;
22
- width: 24px;
23
- display: inline-block;
24
- text-align: center;
25
- vertical-align: top;
26
- border-radius: 3px;
27
- background: #0085ba;
28
- border-width: 1px;
29
- border-style: solid;
30
- border-color: #0073aa #006799 #006799;
31
- -webkit-box-shadow: 0 1px 0 #006799;
32
- box-shadow: 0 1px 0 #006799;
33
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
34
- color: #FFF;
35
- }
36
- .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
37
- background: #008ec2;
38
- }
39
- .number-style > span.number-minus:active, .number-style > span.number-plus:active {
40
- background: #0073aa;
41
- border-color: #006799;
42
- -webkit-box-shadow: inset 0 2px 0 #006799;
43
- box-shadow: inset 0 2px 0 #006799;
44
- -webkit-transform: translateY(1px);
45
- -ms-transform: translateY(1px);
46
- transform: translateY(1px);
47
- outline: none;
48
- }
49
- .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
50
- background: #AAA;
51
- border-color: #999 #777 #777;
52
- -webkit-box-shadow: 0 1px 0 #777;
53
- box-shadow: 0 1px 0 #777;
54
- text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
55
- }
56
- .number-style > span.number-minus::after, .number-style > span.number-plus::after {
57
- font-family: dashicons;
58
- font-size: 24px;
59
- line-height: 24px;
60
- height: 24px;
61
- width: 24px;
62
- display: inline-block;
63
- color: #FFF;
64
- text-align: center;
65
- position: relative;
66
- left: -1px;
67
- }
68
- .number-style > span.number-minus::after {
69
- content: "\f140";
70
- }
71
- .number-style > span.number-plus::after {
72
- content: "\f142";
73
- }
74
- .number-style input[type='number'] {
75
- -moz-appearance: textfield;
76
- }
77
- .number-style input::-webkit-outer-spin-button,
78
- .number-style input::-webkit-inner-spin-button {
79
- -webkit-appearance: none;
80
- }
81
- .number-style .number-minus,
82
- .number-style .number-plus,
83
- .number-style .number-minus::after,
84
- .number-style .number-plus::after {
85
- -webkit-touch-callout: none;
86
- /* iOS Safari */
87
- -webkit-user-select: none;
88
- /* Safari */
89
- -khtml-user-select: none;
90
- /* Konqueror HTML */
91
- -moz-user-select: none;
92
- /* Firefox */
93
- -ms-user-select: none;
94
- /* Internet Explorer/Edge */
95
- user-select: none;
96
- /* Non-prefixed version, currently
97
- supported by Chrome and Opera */
98
- }
1
+ /**
2
+ * Number spinner
3
+ */
4
+ .number-style {
5
+ display: inline-block;
6
+ margin-right: 10px;
7
+ /**
8
+ * Disable text selection on buttons. Seems to help jittery pointers.
9
+ */
10
+ }
11
+ .number-style input {
12
+ margin: 0 5px;
13
+ font-family: Consolas, Monaco, monospace;
14
+ text-align: center;
15
+ width: 4em;
16
+ }
17
+ .number-style > span {
18
+ cursor: pointer;
19
+ }
20
+ .number-style > span.number-minus, .number-style > span.number-plus {
21
+ height: 24px;
22
+ width: 24px;
23
+ display: inline-block;
24
+ text-align: center;
25
+ vertical-align: top;
26
+ border-radius: 3px;
27
+ background: #0085ba;
28
+ border-width: 1px;
29
+ border-style: solid;
30
+ border-color: #0073aa #006799 #006799;
31
+ -webkit-box-shadow: 0 1px 0 #006799;
32
+ box-shadow: 0 1px 0 #006799;
33
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
34
+ color: #FFF;
35
+ }
36
+ .number-style > span.number-minus:hover, .number-style > span.number-plus:hover {
37
+ background: #008ec2;
38
+ }
39
+ .number-style > span.number-minus:active, .number-style > span.number-plus:active {
40
+ background: #0073aa;
41
+ border-color: #006799;
42
+ -webkit-box-shadow: inset 0 2px 0 #006799;
43
+ box-shadow: inset 0 2px 0 #006799;
44
+ -webkit-transform: translateY(1px);
45
+ -ms-transform: translateY(1px);
46
+ transform: translateY(1px);
47
+ outline: none;
48
+ }
49
+ .number-style > span.number-minus.disabled, .number-style > span.number-plus.disabled {
50
+ background: #AAA;
51
+ border-color: #999 #777 #777;
52
+ -webkit-box-shadow: 0 1px 0 #777;
53
+ box-shadow: 0 1px 0 #777;
54
+ text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
55
+ }
56
+ .number-style > span.number-minus::after, .number-style > span.number-plus::after {
57
+ font-family: dashicons;
58
+ font-size: 24px;
59
+ line-height: 24px;
60
+ height: 24px;
61
+ width: 24px;
62
+ display: inline-block;
63
+ color: #FFF;
64
+ text-align: center;
65
+ position: relative;
66
+ left: -1px;
67
+ }
68
+ .number-style > span.number-minus::after {
69
+ content: "\f140";
70
+ }
71
+ .number-style > span.number-plus::after {
72
+ content: "\f142";
73
+ }
74
+ .number-style input[type='number'] {
75
+ -moz-appearance: textfield;
76
+ }
77
+ .number-style input::-webkit-outer-spin-button,
78
+ .number-style input::-webkit-inner-spin-button {
79
+ -webkit-appearance: none;
80
+ }
81
+ .number-style .number-minus,
82
+ .number-style .number-plus,
83
+ .number-style .number-minus::after,
84
+ .number-style .number-plus::after {
85
+ -webkit-touch-callout: none;
86
+ /* iOS Safari */
87
+ -webkit-user-select: none;
88
+ /* Safari */
89
+ -khtml-user-select: none;
90
+ /* Konqueror HTML */
91
+ -moz-user-select: none;
92
+ /* Firefox */
93
+ -ms-user-select: none;
94
+ /* Internet Explorer/Edge */
95
+ user-select: none;
96
+ /* Non-prefixed version, currently
97
+ supported by Chrome and Opera */
98
+ }
admin/css/order.css CHANGED
@@ -1,102 +1,102 @@
1
- /**
2
- * Admin list order
3
- * Strong Testimonials
4
- */
5
-
6
- th.manage-column.column-handle {
7
- width: 3em;
8
- text-align: center;
9
- }
10
-
11
- td.column-handle {
12
- text-align: center;
13
- padding-top: 10px;
14
- }
15
-
16
- #the-list:not(.ui-sortable-disabled) td.column-handle {
17
- cursor: move;
18
- }
19
-
20
- #the-list:not(.ui-sortable-disabled) tr.reorder-hover {
21
- background: #E7F8FD;
22
- }
23
-
24
- td.column-handle .help:before,
25
- td.column-handle .help-in-motion:before {
26
- font-family: FontAwesome;
27
- font-size: 20px;
28
- width: 1em;
29
- margin: 0 auto;
30
- color: #aaa;
31
- }
32
-
33
- td.column-handle .help:before {
34
- content: "\f0c9";
35
- }
36
-
37
- td.column-handle .help-in-motion:before {
38
- content: "\f255";
39
- color: #111;
40
- font-size: 20px;
41
- display: none;
42
- }
43
-
44
- #the-list:not(.ui-sortable-disabled) td.column-handle:not(.refresh):hover .help:before {
45
- content: "\f256";
46
- color: #111;
47
- font-size: 20px;
48
- }
49
-
50
- .ui-sortable tr.ui-sortable-helper {
51
- background: rgba(187,235,250,0.6) !important;
52
- border: 1px solid #DFDFDF;
53
- }
54
-
55
- .ui-sortable tr.ui-sortable-helper .help:before {
56
- display: none;
57
- }
58
-
59
- .ui-sortable tr.ui-sortable-helper .help-in-motion:before {
60
- display: block;
61
- }
62
-
63
- .sortable-placeholder {
64
- background: #E7F8FD;
65
- }
66
-
67
- @-webkit-keyframes spin {
68
- 0% {
69
- -webkit-transform: rotate(0deg);
70
- transform: rotate(0deg);
71
- }
72
-
73
- 100% {
74
- -webkit-transform: rotate(359deg);
75
- transform: rotate(359deg);
76
- }
77
- }
78
-
79
- @keyframes spin {
80
- 0% {
81
- -webkit-transform: rotate(0deg);
82
- -ms-transform: rotate(0deg);
83
- transform: rotate(0deg);
84
- }
85
-
86
- 100% {
87
- -webkit-transform: rotate(359deg);
88
- -ms-transform: rotate(359deg);
89
- transform: rotate(359deg);
90
- }
91
- }
92
-
93
- td.column-handle.refresh .help:before {
94
- content: "\f110";
95
- color: #0073AA;
96
- font-size: 20px;
97
- }
98
-
99
- td.column-handle.refresh .help {
100
- -webkit-animation: spin 1.5s linear infinite;
101
- animation: spin 1.5s linear infinite;
102
- }
1
+ /**
2
+ * Admin list order
3
+ * Strong Testimonials
4
+ */
5
+
6
+ th.manage-column.column-handle {
7
+ width: 3em;
8
+ text-align: center;
9
+ }
10
+
11
+ td.column-handle {
12
+ text-align: center;
13
+ padding-top: 10px;
14
+ }
15
+
16
+ #the-list:not(.ui-sortable-disabled) td.column-handle {
17
+ cursor: move;
18
+ }
19
+
20
+ #the-list:not(.ui-sortable-disabled) tr.reorder-hover {
21
+ background: #E7F8FD;
22
+ }
23
+
24
+ td.column-handle .help:before,
25
+ td.column-handle .help-in-motion:before {
26
+ font-family: FontAwesome;
27
+ font-size: 20px;
28
+ width: 1em;
29
+ margin: 0 auto;
30
+ color: #aaa;
31
+ }
32
+
33
+ td.column-handle .help:before {
34
+ content: "\f0c9";
35
+ }
36
+
37
+ td.column-handle .help-in-motion:before {
38
+ content: "\f255";
39
+ color: #111;
40
+ font-size: 20px;
41
+ display: none;
42
+ }
43
+
44
+ #the-list:not(.ui-sortable-disabled) td.column-handle:not(.refresh):hover .help:before {
45
+ content: "\f256";
46
+ color: #111;
47
+ font-size: 20px;
48
+ }
49
+
50
+ .ui-sortable tr.ui-sortable-helper {
51
+ background: rgba(187,235,250,0.6) !important;
52
+ border: 1px solid #DFDFDF;
53
+ }
54
+
55
+ .ui-sortable tr.ui-sortable-helper .help:before {
56
+ display: none;
57
+ }
58
+
59
+ .ui-sortable tr.ui-sortable-helper .help-in-motion:before {
60
+ display: block;
61
+ }
62
+
63
+ .sortable-placeholder {
64
+ background: #E7F8FD;
65
+ }
66
+
67
+ @-webkit-keyframes spin {
68
+ 0% {
69
+ -webkit-transform: rotate(0deg);
70
+ transform: rotate(0deg);
71
+ }
72
+
73
+ 100% {
74
+ -webkit-transform: rotate(359deg);
75
+ transform: rotate(359deg);
76
+ }
77
+ }
78
+
79
+ @keyframes spin {
80
+ 0% {
81
+ -webkit-transform: rotate(0deg);
82
+ -ms-transform: rotate(0deg);
83
+ transform: rotate(0deg);
84
+ }
85
+
86
+ 100% {
87
+ -webkit-transform: rotate(359deg);
88
+ -ms-transform: rotate(359deg);
89
+ transform: rotate(359deg);
90
+ }
91
+ }
92
+
93
+ td.column-handle.refresh .help:before {
94
+ content: "\f110";
95
+ color: #0073AA;
96
+ font-size: 20px;
97
+ }
98
+
99
+ td.column-handle.refresh .help {
100
+ -webkit-animation: spin 1.5s linear infinite;
101
+ animation: spin 1.5s linear infinite;
102
+ }
admin/css/polylang.css CHANGED
@@ -1,8 +1,8 @@
1
- .wp-list-table.stringstranslations .column-name {
2
- width: 15%;
3
- word-break: normal;
4
- }
5
-
6
- form#string-translation .tablenav .actions select {
7
- max-width: 300px;
8
  }
1
+ .wp-list-table.stringstranslations .column-name {
2
+ width: 15%;
3
+ word-break: normal;
4
+ }
5
+
6
+ form#string-translation .tablenav .actions select {
7
+ max-width: 300px;
8
  }
admin/css/post-editor.css CHANGED
@@ -1,111 +1,111 @@
1
- /* Client details meta box
2
- ------------------------------------------------*/
3
- #details table {
4
- border: none;
5
- width: 100%;
6
- }
7
-
8
- #details th {
9
- font-weight: 400;
10
- text-align: right;
11
- vertical-align: top;
12
- padding-top: 8px;
13
- }
14
-
15
- #details td {
16
- margin: 5px;
17
- padding: 5px;
18
- }
19
-
20
- #details tr:first-child td > p:first-child {
21
- margin-top: 0;
22
- }
23
-
24
- input[type="text"].custom-input,
25
- input[type="email"].custom-input,
26
- input[type="url"].custom-input,
27
- textarea.custom-input {
28
- width: 100%;
29
- }
30
-
31
- div.checkbox {
32
- height: 28px;
33
- padding: 3px 0 5px;
34
- }
35
-
36
- div.checkbox input[type="checkbox"] {
37
- margin: 1px;
38
- padding: 3px 5px;
39
- }
40
-
41
- .input-url,
42
- .input-nofollow {
43
- display: inline-block;
44
- }
45
-
46
- .input-url {
47
- width: calc(100% - 210px);
48
- }
49
-
50
- .input-nofollow {
51
- float: right;
52
- }
53
-
54
- label.nowrap {
55
- word-break: keep-all;
56
- white-space: nowrap;
57
- }
58
-
59
- label.nowrap code {
60
- position: relative;
61
- top: -2px;
62
- }
63
-
64
- /* Post Publish Meta Box
65
- --------------------------------------*/
66
- .wpmtst-pub-section {
67
- padding: 6px 10px 8px;
68
- }
69
-
70
- #submit-timestamp {
71
- padding: 2px 0 1px 0;
72
- }
73
-
74
- #submit-timestamp:before {
75
- content: "\f175";
76
- top: -1px;
77
- color: #82878c;
78
- font: normal 20px/1 dashicons;
79
- display: inline-block;
80
- padding: 0 2px 0 0;
81
- left: -1px;
82
- position: relative;
83
- vertical-align: top;
84
- }
85
-
86
- /* Star rating in post editor
87
- --------------------------------------------------*/
88
- .edit-rating-box {
89
- height: 27px;
90
- line-height: 27px;
91
- }
92
-
93
- .wp-core-ui .edit-rating-box button {
94
- margin-left: 0;
95
- }
96
-
97
- .edit-rating-box .cancel,
98
- .edit-rating-box .zero {
99
- padding: 0;
100
- text-decoration: underline;
101
- color: #0073aa;
102
- }
103
-
104
- .rating .inner,
105
- .edit-rating-buttons-1,
106
- .edit-rating-buttons-2,
107
- .edit-rating-success {
108
- display: inline-block;
109
- margin-left: 5px;
110
- vertical-align: middle;
111
- }
1
+ /* Client details meta box
2
+ ------------------------------------------------*/
3
+ #details table {
4
+ border: none;
5
+ width: 100%;
6
+ }
7
+
8
+ #details th {
9
+ font-weight: 400;
10
+ text-align: right;
11
+ vertical-align: top;
12
+ padding-top: 8px;
13
+ }
14
+
15
+ #details td {
16
+ margin: 5px;
17
+ padding: 5px;
18
+ }
19
+
20
+ #details tr:first-child td > p:first-child {
21
+ margin-top: 0;
22
+ }
23
+
24
+ input[type="text"].custom-input,
25
+ input[type="email"].custom-input,
26
+ input[type="url"].custom-input,
27
+ textarea.custom-input {
28
+ width: 100%;
29
+ }
30
+
31
+ div.checkbox {
32
+ height: 28px;
33
+ padding: 3px 0 5px;
34
+ }
35
+
36
+ div.checkbox input[type="checkbox"] {
37
+ margin: 1px;
38
+ padding: 3px 5px;
39
+ }
40
+
41
+ .input-url,
42
+ .input-nofollow {
43
+ display: inline-block;
44
+ }
45
+
46
+ .input-url {
47
+ width: calc(100% - 210px);
48
+ }
49
+
50
+ .input-nofollow {
51
+ float: right;
52
+ }
53
+
54
+ label.nowrap {
55
+ word-break: keep-all;
56
+ white-space: nowrap;
57
+ }
58
+
59
+ label.nowrap code {
60
+ position: relative;
61
+ top: -2px;
62
+ }
63
+
64
+ /* Post Publish Meta Box
65
+ --------------------------------------*/
66
+ .wpmtst-pub-section {
67
+ padding: 6px 10px 8px;
68
+ }
69
+
70
+ #submit-timestamp {
71
+ padding: 2px 0 1px 0;
72
+ }
73
+
74
+ #submit-timestamp:before {
75
+ content: "\f175";
76
+ top: -1px;
77
+ color: #82878c;
78
+ font: normal 20px/1 dashicons;
79
+ display: inline-block;
80
+ padding: 0 2px 0 0;
81
+ left: -1px;
82
+ position: relative;
83
+ vertical-align: top;
84
+ }
85
+
86
+ /* Star rating in post editor
87
+ --------------------------------------------------*/
88
+ .edit-rating-box {
89
+ height: 27px;
90
+ line-height: 27px;
91
+ }
92
+
93
+ .wp-core-ui .edit-rating-box button {
94
+ margin-left: 0;
95
+ }
96
+
97
+ .edit-rating-box .cancel,
98
+ .edit-rating-box .zero {
99
+ padding: 0;
100
+ text-decoration: underline;
101
+ color: #0073aa;
102
+ }
103
+
104
+ .rating .inner,
105
+ .edit-rating-buttons-1,
106
+ .edit-rating-buttons-2,
107
+ .edit-rating-success {
108
+ display: inline-block;
109
+ margin-left: 5px;
110
+ vertical-align: middle;
111
+ }
admin/css/views.css CHANGED
@@ -1,1009 +1,1009 @@
1
- /* ==================================================
2
- Strong Testimonials View Editor
3
- ================================================== */
4
- /* TODO Consolidate with admin.css */
5
- /*-----------------------------------------------
6
- Structure
7
- -----------------------------------------------*/
8
- .clear {
9
- clear: both; }
10
-
11
- .table {
12
- display: table; }
13
-
14
- .table-row {
15
- display: table-row; }
16
-
17
- .table-cell {
18
- display: table-cell;
19
- vertical-align: top; }
20
-
21
- .option-wrap {
22
- margin-right: 2em; }
23
-
24
- .half-width {
25
- display: inline-block;
26
- box-sizing: border-box;
27
- width: 50%;
28
- float: left; }
29
-
30
- optgroup,
31
- optgroup option {
32
- font-family: inherit; }
33
-
34
- .intro {
35
- margin-bottom: 2em; }
36
-
37
- /* --------------------------------------------------
38
- The view info section at the top
39
- -------------------------------------------------- */
40
- .view-info {
41
- width: 100%;
42
- font-size: 20px;
43
- margin-top: 1em; }
44
- .view-info .table-cell {
45
- padding-bottom: 15px; }
46
- .view-info .table-cell:first-child {
47
- padding-top: 9px;
48
- min-width: 130px; }
49
- .view-info .table-row:last-child .table-cell {
50
- padding-bottom: 0; }
51
- .view-info label {
52
- vertical-align: top;
53
- margin: 0;
54
- display: block; }
55
- .view-info input {
56
- font-size: 20px; }
57
- .view-info input.view-name {
58
- width: 100%;
59
- margin: 0;
60
- padding: 4px 8px; }
61
-
62
- /* -------------------------------------------------
63
- Shortcode read-only input
64
- ------------------------------------------------- */
65
- #view-shortcode {
66
- direction: ltr;
67
- font-family: Consolas, Monaco, monospace;
68
- unicode-bidi: embed;
69
- display: inline-block;
70
- font-size: 18px;
71
- padding: 0 8px;
72
- line-height: 35px;
73
- width: 300px;
74
- color: #777;
75
- background: #FFF; }
76
-
77
- .form-view-shortcode .unsaved {
78
- color: #888;
79
- font-style: italic;
80
- line-height: 37px; }
81
-
82
- /* -------------------------------------------------
83
- Copy shortcode button
84
- ------------------------------------------------- */
85
- #copy-shortcode {
86
- margin: 5px 1em;
87
- line-height: 26px; }
88
-
89
- #copy-message {
90
- opacity: 0;
91
- font-size: 14px;
92
- line-height: 26px;
93
- height: 26px;
94
- padding: 0 10px;
95
- margin: 0;
96
- display: inline-block;
97
- background: #00A4F3;
98
- color: #FFF;
99
- border-radius: 3px;
100
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
101
- position: relative;
102
- top: -1px; }
103
-
104
- #copy-message.copied {
105
- opacity: 0;
106
- will-change: opacity;
107
- animation: showcopied 2s ease; }
108
-
109
- @keyframes showcopied {
110
- 0% {
111
- opacity: 0; }
112
- 70% {
113
- opacity: 1; }
114
- 100% {
115
- opacity: 0; } }
116
- /* -------------------------------------------------
117
- Mode selector
118
- ------------------------------------------------- */
119
- #view-mode {
120
- margin-top: 1em; }
121
- #view-mode label {
122
- display: inline-block;
123
- margin: 0 5px 0 0;
124
- padding: 0.5em 18px 0.5em 12px;
125
- border: 2px solid #ccc;
126
- border-radius: 20px;
127
- color: #888;
128
- position: relative;
129
- background: #fff; }
130
- #view-mode label.checked {
131
- position: relative;
132
- background: #00A4F3;
133
- color: #FFF;
134
- border-color: transparent;
135
- transition: all 0.1s ease; }
136
- #view-mode label:hover {
137
- background: #FFF;
138
- color: #444;
139
- border-color: #00A4F3; }
140
- #view-mode input[type="radio"] {
141
- margin-right: 7px; }
142
-
143
- .mode-list {
144
- display: inline-block; }
145
-
146
- .mode-line {
147
- display: none;
148
- position: absolute;
149
- border-left: 2px solid #00A4F3;
150
- height: 18px;
151
- top: 100%;
152
- left: calc( 50% - 1px );
153
- z-index: -1; }
154
- label.checked .mode-line {
155
- display: block; }
156
-
157
- .mode-description {
158
- box-sizing: border-box;
159
- background: #FFF;
160
- margin: 15px 5px 0 0;
161
- padding: 8px 20px;
162
- border: 2px solid #00A4F3;
163
- color: #00A4F3;
164
- text-align: center;
165
- border-radius: 20px;
166
- font-size: 16px;
167
- line-height: 1.3;
168
- min-height: 40px;
169
- transition: all 0.2s ease; }
170
-
171
- /* --------------------------------------------------
172
- Category filter
173
- -------------------------------------------------- */
174
- .fc-search-wrap {
175
- display: none;
176
- position: relative; }
177
-
178
- .fc-search-field {
179
- margin: 12px 0 4px 0;
180
- width: 100%; }
181
-
182
- .cat-count {
183
- color: #888; }
184
-
185
- .view-category-list-panel {
186
- box-sizing: border-box;
187
- min-height: 42px;
188
- min-width: 220px;
189
- overflow: auto;
190
- padding: 0 10px;
191
- border: 1px solid #DFDFDF;
192
- background-color: #FDFDFD;
193
- transition: all 0.2s ease; }
194
- .view-category-list-panel.short-panel {
195
- max-height: 205px; }
196
- .view-category-list-panel.tall-panel {
197
- max-height: none; }
198
-
199
- .view-category-list {
200
- margin: 7px 0; }
201
- .view-category-list li {
202
- margin-bottom: 0;
203
- line-height: 24px; }
204
- .view-category-list li label {
205
- margin-bottom: 6px;
206
- word-wrap: break-word;
207
- white-space: nowrap; }
208
- .view-category-list ul.children {
209
- margin-left: 21px; }
210
-
211
- /* -------------------------------------------------
212
- Replace checkboxes with icons
213
- ------------------------------------------------- */
214
- input[type=checkbox] {
215
- display: none; }
216
- input[type=checkbox] + label:before {
217
- font-family: FontAwesome;
218
- display: inline-block;
219
- font-size: 18px;
220
- width: 1em;
221
- position: relative;
222
- top: 1px;
223
- /* unchecked icon */
224
- content: "\f096";
225
- color: #00A4F3; }
226
- input[type=checkbox] + label:hover:before {
227
- color: #FF8900; }
228
- input[type=checkbox]:checked + label:before {
229
- /* checked icon */
230
- content: "\f14a"; }
231
- input[type=checkbox]:checked + label:hover:before {
232
- color: #FF8900; }
233
- input[type=checkbox]:disabled + label:before {
234
- /* disabled icon */
235
- content: "\f146";
236
- color: #888; }
237
- input[type=checkbox]:disabled + label:hover:before {
238
- color: #888; }
239
-
240
- /* -------------------------------------------------
241
- Misc.
242
- ------------------------------------------------- */
243
- #wpmtst-views-form input[type="submit"] {
244
- margin-right: 10px; }
245
-
246
- td.column-name strong {
247
- display: block;
248
- margin-bottom: .2em;
249
- font-size: 14px; }
250
-
251
- td.rowspan {
252
- border-left: 1px solid #DDD; }
253
-
254
- .subgroup {
255
- background: #f8f8f8;
256
- border: 1px solid #f1f1f1;
257
- padding: 0.25em 1em;
258
- margin-right: 1em; }
259
-
260
- .subgroup-heading {
261
- font-weight: 600; }
262
-
263
- .subgroup .subgroup-heading + .row-inner {
264
- margin-top: 5px; }
265
-
266
- .subgroup .row-inner {
267
- margin-bottom: 10px; }
268
-
269
- .min-width-1 {
270
- min-width: 152px; }
271
-
272
- .label-not-adjacent {
273
- margin-right: 0.3em; }
274
-
275
- .is-below {
276
- margin-top: 10px; }
277
-
278
- /* -------------------------------------------------
279
- Restore Default Breakpoints button
280
- ------------------------------------------------- */
281
- #restored-message {
282
- opacity: 0;
283
- line-height: 26px;
284
- height: 26px;
285
- padding: 0 10px;
286
- margin: 1px 1em;
287
- display: inline-block;
288
- background: #00A4F3;
289
- color: #FFF;
290
- border-radius: 3px;
291
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
292
- position: relative;
293
- top: -1px; }
294
-
295
- #restored-message.copied {
296
- opacity: 0;
297
- will-change: opacity;
298
- animation: showcopied 2s ease; }
299
-
300
- @keyframes showcopied {
301
- 0% {
302
- opacity: 0; }
303
- 70% {
304
- opacity: 1; }
305
- 100% {
306
- opacity: 0; } }
307
- .screenshot {
308
- margin: 10px; }
309
- .screenshot > div {
310
- display: inline-block;
311
- -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
312
- -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
313
- box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8); }
314
-
315
- /* --------------------------------------------------
316
- Inputs
317
- -------------------------------------------------- */
318
- input[type="text"].long {
319
- width: 25em; }
320
-
321
- input[type="text"].medium {
322
- width: 18em; }
323
-
324
- .input-number {
325
- width: 5em;
326
- text-align: right; }
327
-
328
- .input-incremental {
329
- width: 5em; }
330
-
331
- .input-number-px {
332
- width: 4em;
333
- text-align: right; }
334
-
335
- .form-table select {
336
- vertical-align: baseline; }
337
-
338
- div.radio {
339
- line-height: 1.5em;
340
- padding: 0 5px; }
341
-
342
- label,
343
- .nolabel {
344
- vertical-align: baseline;
345
- display: inline-block; }
346
-
347
- label:hover {
348
- color: #000; }
349
-
350
- option:disabled {
351
- font-style: italic !important; }
352
-
353
- /* -------------------------------------------------
354
- Elements
355
- ------------------------------------------------- */
356
- .wpmtst2 {
357
- max-width: 1200px;
358
- /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
359
- /* views section heading */ }
360
- .wpmtst2 p.wpmtst-submit {
361
- margin-top: 2em; }
362
- .wpmtst2 h3 {
363
- background: #FFF;
364
- color: #00A4F3;
365
- font-weight: 400;
366
- border: 1px solid #DDD;
367
- border-bottom: 0;
368
- padding: 10px 15px;
369
- margin-bottom: 0;
370
- margin-top: 1.5rem; }
371
-
372
- .form-table td p.description {
373
- margin-top: 0;
374
- font-style: italic; }
375
- .form-table td p.description.tall {
376
- line-height: 32px;
377
- margin-top: 0; }
378
- .form-table td p.description.short {
379
- line-height: 22px;
380
- padding: 5px 0; }
381
- .form-table td p.description.solo {
382
- margin-left: 0.3em; }
383
- .form-table td p.description.under-checkbox {
384
- margin-left: 22px; }
385
-
386
- /* Misc positioning */
387
- .inline {
388
- display: inline-block;
389
- margin-right: 1em;
390
- vertical-align: top; }
391
- .inline:last-child {
392
- margin-right: 0; }
393
-
394
- .inline span,
395
- .row span {
396
- display: inline-block;
397
- margin-right: 3px; }
398
-
399
- .inline-middle {
400
- vertical-align: middle; }
401
-
402
- .tight {
403
- margin-right: 0.2em; }
404
-
405
- .tight:last-child,
406
- .last {
407
- margin-right: 0; }
408
-
409
- .checkbox,
410
- .form-table th.checkbox {
411
- line-height: 32px; }
412
-
413
- .field {
414
- position: relative; }
415
- .field div {
416
- display: inline-block;
417
- padding: 0.2em 0.3em; }
418
-
419
- /* -------------------------------------------------
420
- Form table
421
- ------------------------------------------------- */
422
- .form-table {
423
- margin-top: 0;
424
- background: #FEFEFE;
425
- width: 100% !important;
426
- border: 1px solid #DDD; }
427
- .form-table.multiple {
428
- width: auto; }
429
- .form-table tr {
430
- border: 1px solid #DDD; }
431
- .form-table th,
432
- .form-table td {
433
- vertical-align: top; }
434
- .form-table th {
435
- font-weight: 400;
436
- white-space: nowrap;
437
- vertical-align: top;
438
- width: 150px;
439
- padding: 10px 15px; }
440
- .form-table td {
441
- padding: 10px; }
442
- .form-table td.valign-middle {
443
- vertical-align: middle; }
444
- .form-table td.w1 {
445
- width: 185px; }
446
- .form-table td.w2 {
447
- width: 300px; }
448
-
449
- tr.subheading {
450
- font-weight: 600; }
451
- tr.subheading td {
452
- padding: 5px 10px; }
453
- tr.subheading td:first-child {
454
- padding-left: 15px; }
455
- tr.subheading td:last-child {
456
- width: 190px; }
457
-
458
- td.divider {
459
- border-left: 1px dashed #DDD; }
460
-
461
- .wpmtst2 .form-table th,
462
- .wpmtst2 .form-table th label {
463
- line-height: 30px;
464
- margin-top: 0;
465
- margin-bottom: 0; }
466
-
467
- span.title {
468
- display: inline-block;
469
- margin-right: 1em; }
470
-
471
- .row,
472
- .row p {
473
- vertical-align: middle;
474
- line-height: 32px; }
475
-
476
- .row.tall,
477
- .row.tall p {
478
- line-height: 40px; }
479
-
480
- .row.links {
481
- margin-top: 10px; }
482
-
483
- .row:not(:first-child) .row-inner {
484
- margin-top: 10px; }
485
-
486
- /* --------------------------------------------------
487
- Category checkboxes
488
- -------------------------------------------------- */
489
- ul.checkbox-horizontal {
490
- display: inline-block;
491
- list-style: none;
492
- margin: 0; }
493
- ul.checkbox-horizontal li {
494
- display: inline-block;
495
- float: left;
496
- margin: 6px 2em 0 0; }
497
-
498
- .select-cell {
499
- padding-right: 2em; }
500
-
501
- /* -------------------------------------------------
502
- Form table
503
- ------------------------------------------------- */
504
- .form-table {
505
- margin-top: 0;
506
- background: #FEFEFE;
507
- width: 100% !important;
508
- border: 1px solid #DDD; }
509
- .form-table.multiple {
510
- width: auto; }
511
- .form-table tr {
512
- border: 1px solid #DDD; }
513
- .form-table th,
514
- .form-table td {
515
- vertical-align: top; }
516
- .form-table th {
517
- font-weight: 400;
518
- white-space: nowrap;
519
- vertical-align: top;
520
- width: 150px;
521
- padding: 10px 15px; }
522
- .form-table td {
523
- padding: 10px; }
524
- .form-table td.valign-middle {
525
- vertical-align: middle; }
526
- .form-table td.w1 {
527
- width: 185px; }
528
- .form-table td.w2 {
529
- width: 300px; }
530
-
531
- tr.subheading {
532
- font-weight: 600; }
533
- tr.subheading td {
534
- padding: 5px 10px; }
535
- tr.subheading td:first-child {
536
- padding-left: 15px; }
537
- tr.subheading td:last-child {
538
- width: 190px; }
539
-
540
- td.divider {
541
- border-left: 1px dashed #DDD; }
542
-
543
- .wpmtst2 .form-table th,
544
- .wpmtst2 .form-table th label {
545
- line-height: 30px;
546
- margin-top: 0;
547
- margin-bottom: 0; }
548
-
549
- span.title {
550
- display: inline-block;
551
- margin-right: 1em; }
552
-
553
- .row,
554
- .row p {
555
- vertical-align: middle;
556
- line-height: 32px; }
557
-
558
- .row.tall,
559
- .row.tall p {
560
- line-height: 40px; }
561
-
562
- .row.links {
563
- margin-top: 10px; }
564
-
565
- .row:not(:first-child) .row-inner {
566
- margin-top: 10px; }
567
-
568
- /* -------------------------------------------------
569
- List radio buttons
570
- ------------------------------------------------- */
571
- .section-radios {
572
- display: flex;
573
- justify-content: space-between; }
574
- .section-radios > div:first-child {
575
- flex: 0 0 15%; }
576
- .section-radios > div:nth-child(2) {
577
- flex: 1 1 auto;
578
- background: rgba(0, 164, 243, 0.085);
579
- border-radius: 15px; }
580
-
581
- .radio-buttons input[type=radio] {
582
- display: none; }
583
- .radio-buttons input[type=radio] + label {
584
- border-radius: 15px 0 0 15px;
585
- line-height: 30px;
586
- margin-right: 15px; }
587
- .radio-buttons input[type=radio] + label:before {
588
- font-family: FontAwesome;
589
- display: inline-block;
590
- color: #999;
591
- text-align: center;
592
- font-size: 17px;
593
- margin-left: 5px;
594
- margin-right: 1px;
595
- width: 20px;
596
- /* unchecked icon */
597
- content: "\f10c"; }
598
- .radio-buttons input[type=radio] + label:hover:before {
599
- color: #FF8900; }
600
- .radio-buttons input[type=radio]:checked + label:before {
601
- /* checked icon */
602
- content: "\f192";
603
- color: #00A4F3; }
604
- .radio-buttons input[type=radio]:checked + label:hover:before {
605
- color: #FF8900; }
606
- .radio-buttons input[type=radio].error + label, .radio-buttons input[type=radio].error + label:before {
607
- color: red; }
608
- .radio-buttons input[type=radio]:disabled + label {
609
- color: #AAA; }
610
- .radio-buttons input[type=radio]:disabled + label:before {
611
- color: #CCC; }
612
- .radio-buttons input[type=radio]:disabled + label:hover {
613
- background: transparent; }
614
- .radio-buttons input[type=radio]:checked:disabled + label:hover {
615
- background: #EAF7FB; }
616
-
617
- ul.radio-list {
618
- margin: 15px 0; }
619
- ul.radio-list li {
620
- margin: 0; }
621
- ul.radio-list li.current-selection label {
622
- background: rgba(0, 164, 243, 0.085); }
623
- ul.radio-list li label {
624
- width: 100%;
625
- white-space: nowrap; }
626
-
627
- .radio-description {
628
- padding: 0 15px; }
629
- .radio-description p {
630
- margin: 15px 0 15px !important; }
631
-
632
- .options {
633
- margin: 0 10px 15px 0; }
634
- .options > div {
635
- display: inline-block;
636
- display: flex; }
637
- .options > div > div {
638
- display: inline-block;
639
- width: 25%; }
640
-
641
- .description-inner {
642
- margin: 15px 0; }
643
-
644
- /* -------------------------------------------------
645
- Template options
646
- ------------------------------------------------- */
647
- ul.radio-list.template-list li {
648
- display: flex; }
649
- ul.radio-list.template-list li.current-selection .template-description {
650
- background: rgba(0, 164, 243, 0.085); }
651
- ul.radio-list.template-list li > div:first-child {
652
- flex: 0 0 15%;
653
- white-space: nowrap;
654
- align-self: center; }
655
- ul.radio-list.template-list li > div:nth-child(2) {
656
- flex: 1 1 auto; }
657
-
658
- .template-optgroup {
659
- font-weight: 600;
660
- margin: 15px 10px 10px 0; }
661
-
662
- .template-description {
663
- border-radius: 15px;
664
- padding: 15px; }
665
- .template-description p {
666
- margin: 0px 0 15px !important; }
667
- .template-description label {
668
- background: transparent !important; }
669
-
670
- /* -------------------------------------------------
671
- Layout options
672
- ------------------------------------------------- */
673
- .layout-section > div:last-child {
674
- flex: 0 0 auto;
675
- align-self: flex-start;
676
- margin-left: 10px;
677
- padding: 10px; }
678
-
679
- /* --------------------------------------------------
680
- Examples
681
- -------------------------------------------------- */
682
- .example-container {
683
- background: white;
684
- border: 1px solid #ccc;
685
- box-sizing: border-box;
686
- padding: 15px 10px 5px;
687
- width: 170px; }
688
- .example-container .box {
689
- background: #DDD;
690
- width: 100%;
691
- line-height: 30px;
692
- height: 30px;
693
- margin-bottom: 10px;
694
- text-align: center;
695
- /* to prevent overflowing margins */
696
- display: inline-block;
697
- position: relative;
698
- /* multi-column properties */
699
- -webkit-column-break-inside: avoid;
700
- page-break-inside: avoid;
701
- break-inside: avoid; }
702
- .example-container .box span {
703
- display: block;
704
- margin: 0 auto; }
705
- .example-container .box.size2 {
706
- height: 45px; }
707
- .example-container .box.size3 {
708
- height: 60px; }
709
-
710
- /* --------------------------------------------------
711
- Columns
712
- -------------------------------------------------- */
713
- .view-layout-columns .example-container {
714
- padding-bottom: 15px;
715
- text-align: center;
716
- /* a minimum width fallback */
717
- -webkit-column-width: 25px;
718
- -moz-column-width: 25px;
719
- column-width: 25px;
720
- -webkit-column-gap: 10px;
721
- -moz-column-gap: 10px;
722
- column-gap: 10px;
723
- /* chrome does not repaint column-rule when switching classes in js :( */
724
- /*-webkit-column-rule: 1px dashed #999;*/
725
- /*-moz-column-rule: 1px dashed #999;*/
726
- /*column-rule: 1px dashed #999;*/
727
- -webkit-margin-bottom-collapse: separate; }
728
- .view-layout-columns .example-container.col-2 {
729
- -webkit-column-count: 2;
730
- -moz-column-count: 2;
731
- column-count: 2; }
732
- .view-layout-columns .example-container.col-3 {
733
- -webkit-column-count: 3;
734
- -moz-column-count: 3;
735
- column-count: 3; }
736
- .view-layout-columns .example-container.col-4 {
737
- -webkit-column-count: 4;
738
- -moz-column-count: 4;
739
- column-count: 4; }
740
-
741
- /* --------------------------------------------------
742
- Grid
743
- -------------------------------------------------- */
744
- .view-layout-grid .example-container {
745
- display: -webkit-flex;
746
- display: -ms-flexbox;
747
- display: flex;
748
- -webkit-flex-wrap: wrap;
749
- -ms-flex-wrap: wrap;
750
- flex-wrap: wrap;
751
- justify-content: space-between; }
752
- .view-layout-grid .example-container .box {
753
- display: -webkit-flex;
754
- display: -ms-flexbox;
755
- display: flex; }
756
- .view-layout-grid .example-container.col-2 .box {
757
- width: 47%; }
758
- .view-layout-grid .example-container.col-3 .box {
759
- width: 29%; }
760
- .view-layout-grid .example-container.col-4 .box {
761
- width: 21%; }
762
-
763
- /* --------------------------------------------------
764
- Masonry
765
- -------------------------------------------------- */
766
- .view-layout-masonry .example-container .box {
767
- width: 46%; }
768
- .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
769
- width: 46%; }
770
- .view-layout-masonry .example-container.col-3 .grid-sizer {
771
- width: 27.5%; }
772
- .view-layout-masonry .example-container.col-4 .grid-sizer {
773
- width: 19.5%; }
774
-
775
- /* -------------------------------------------------
776
- Background options
777
- ------------------------------------------------- */
778
- .color-picker-wrap {
779
- display: flex; }
780
- .color-picker-wrap > div:first-child {
781
- min-width: 80px; }
782
-
783
- .background-preview-wrap {
784
- background: #FFF;
785
- padding: 2em;
786
- max-width: 300px; }
787
-
788
- #background-preview {
789
- padding: 1em;
790
- text-align: center; }
791
- #background-preview.dark {
792
- color: #333; }
793
- #background-preview.light {
794
- color: #EEE; }
795
-
796
- /* --------------------------------------------------
797
- Custom fields
798
- -------------------------------------------------- */
799
- .fields {
800
- display: inline-block;
801
- min-width: 350px; }
802
- .fields .field2 {
803
- border: 1px solid #DDD;
804
- background: #FFF;
805
- /* for better dragging */
806
- transition: background 0.3s ease, border 0.3s ease; }
807
- .fields .field2.open {
808
- background: #FFF;
809
- border-color: #444; }
810
- .fields .field3 {
811
- flex: 20; }
812
- .fields div.link {
813
- display: inline-block;
814
- cursor: pointer;
815
- padding: 10px 10px 8px;
816
- width: calc(100% - 20px); }
817
-
818
- .controls2 {
819
- /* icons */ }
820
- .controls2 > div {
821
- display: flex; }
822
- .controls2 .icon-wrap {
823
- position: relative;
824
- top: 1px;
825
- color: #999; }
826
- .controls2 .icon-wrap:hover {
827
- cursor: pointer; }
828
- .controls2.left {
829
- float: left; }
830
- .controls2.left .icon-wrap {
831
- margin-right: 5px; }
832
- .controls2.right {
833
- float: right; }
834
- .controls2.right .icon-wrap {
835
- margin-left: 5px; }
836
- .controls2 .handle:before,
837
- .controls2 .delete:before,
838
- .controls2 .toggle:before {
839
- font: normal 20px/1 dashicons;
840
- width: 20px;
841
- height: 20px; }
842
- .controls2 .handle:hover,
843
- .controls2 .delete:hover,
844
- .controls2 .toggle:hover {
845
- cursor: pointer; }
846
- .controls2 .delete:before {
847
- content: "\f335"; }
848
- .controls2 .delete:hover:before {
849
- background: #FF0000;
850
- color: #FFF;
851
- border-radius: 1px; }
852
- .controls2 .handle:before {
853
- content: "\f333"; }
854
- .controls2 .handle:hover {
855
- color: #2ea2cc;
856
- cursor: move; }
857
- .controls2 .toggle:before {
858
- content: "\f140"; }
859
- .controls2 .toggle:hover:before {
860
- color: #2EA2CC; }
861
-
862
- .field-description {
863
- padding: 0 5px;
864
- font-weight: 600;
865
- text-decoration: none;
866
- color: #444; }
867
- .field-description:hover {
868
- color: #444; }
869
-
870
- .field-properties {
871
- padding: 5px 10px;
872
- border-top: 1px dotted #DDD; }
873
-
874
- .field-property,
875
- .field-property-box .flex {
876
- display: flex;
877
- margin: 5px 0; }
878
- .field-property label,
879
- .field-property .nolabel,
880
- .field-property-box .flex label,
881
- .field-property-box .flex .nolabel {
882
- flex: 0 1 80px;
883
- line-height: 28px; }
884
- .field-property select, .field-property input,
885
- .field-property-box .flex select,
886
- .field-property-box .flex input {
887
- flex: 3; }
888
-
889
- .field2.open .toggle:before {
890
- content: "\f142"; }
891
-
892
- .sortable-placeholder {
893
- background: lightyellow !important;
894
- margin: 0; }
895
-
896
- .ui-sortable-helper {
897
- border: 1px solid #444 !important; }
898
-
899
- div.help {
900
- font-style: italic;
901
- padding-bottom: 5px; }
902
-
903
- @-moz-document url-prefix() {
904
- select optgroup {
905
- font-style: normal;
906
- margin-left: 3px; } }
907
- /* --------------------------------------------------
908
- help tab
909
- -------------------------------------------------- */
910
- span.help-links {
911
- display: inline-block;
912
- margin-left: 0.4em; }
913
-
914
- a.open-help-tab {
915
- font-weight: 400; }
916
-
917
- table.wpmtst-help-tab {
918
- border-collapse: collapse;
919
- margin: 20px 0;
920
- width: 100%; }
921
- table.wpmtst-help-tab tr:hover td {
922
- background: #FFFFAA; }
923
- table.wpmtst-help-tab th,
924
- table.wpmtst-help-tab td {
925
- padding: 5px 10px;
926
- text-align: center; }
927
- table.wpmtst-help-tab th {
928
- border-bottom: 1px solid #AAA; }
929
- table.wpmtst-help-tab td {
930
- border-bottom: 1px solid #E1E1E1; }
931
- table.wpmtst-help-tab td:first-child {
932
- text-align: right;
933
- font-weight: 600;
934
- white-space: nowrap; }
935
- table.wpmtst-help-tab td:not(:last-child) {
936
- border-right: 1px dotted #E1E1E1; }
937
-
938
- /* --------------------------------------------------
939
- Views list table sticky
940
- -------------------------------------------------- */
941
- .wp-list-table-wrap {
942
- position: relative; }
943
-
944
- .stickit, .stickit:before {
945
- cursor: pointer;
946
- content: "\f154";
947
- display: inline-block;
948
- width: 20px;
949
- height: 20px;
950
- color: #aaa;
951
- font-size: 20px;
952
- line-height: 1;
953
- font-family: dashicons;
954
- text-decoration: inherit;
955
- font-weight: normal;
956
- font-style: normal;
957
- vertical-align: top;
958
- text-align: center;
959
- -webkit-transition: color .1s ease-in;
960
- transition: color .1s ease-in;
961
- -webkit-font-smoothing: antialiased;
962
- -moz-osx-font-smoothing: grayscale; }
963
-
964
- .stickit.stuck:before {
965
- content: "\f155";
966
- color: #0073aa; }
967
- .stickit:hover:before {
968
- content: "\f155";
969
- color: #0096dd; }
970
-
971
- .overlay {
972
- position: absolute;
973
- top: 0;
974
- left: 0;
975
- bottom: 0;
976
- right: 0;
977
- background: rgba(255, 255, 255, 0.7); }
978
-
979
- /* -------------------------------------------------
980
- Inner table
981
- ------------------------------------------------- */
982
- .inner-table {
983
- display: table; }
984
-
985
- .inner-table-row {
986
- display: table-row; }
987
- .inner-table-row.bordered {
988
- border: 1px solid #DDD; }
989
- .inner-table-row.header .inner-table-cell {
990
- text-align: center;
991
- padding: 0 10px;
992
- background: #f6f6f6; }
993
-
994
- .inner-table-cell {
995
- display: table-cell;
996
- padding: 5px 10px; }
997
- .inner-table-cell:not(:last-child) {
998
- border-right: 1px dashed #e2e2e2; }
999
-
1000
- .form-table td p.description.normal {
1001
- font-style: normal; }
1002
-
1003
- ul.description.normal {
1004
- margin-top: 0;
1005
- font-style: normal; }
1006
-
1007
- ul.description li {
1008
- margin-bottom: 0;
1009
- line-height: 1.5; }
1
+ /* ==================================================
2
+ Strong Testimonials View Editor
3
+ ================================================== */
4
+ /* TODO Consolidate with admin.css */
5
+ /*-----------------------------------------------
6
+ Structure
7
+ -----------------------------------------------*/
8
+ .clear {
9
+ clear: both; }
10
+
11
+ .table {
12
+ display: table; }
13
+
14
+ .table-row {
15
+ display: table-row; }
16
+
17
+ .table-cell {
18
+ display: table-cell;
19
+ vertical-align: top; }
20
+
21
+ .option-wrap {
22
+ margin-right: 2em; }
23
+
24
+ .half-width {
25
+ display: inline-block;
26
+ box-sizing: border-box;
27
+ width: 50%;
28
+ float: left; }
29
+
30
+ optgroup,
31
+ optgroup option {
32
+ font-family: inherit; }
33
+
34
+ .intro {
35
+ margin-bottom: 2em; }
36
+
37
+ /* --------------------------------------------------
38
+ The view info section at the top
39
+ -------------------------------------------------- */
40
+ .view-info {
41
+ width: 100%;
42
+ font-size: 20px;
43
+ margin-top: 1em; }
44
+ .view-info .table-cell {
45
+ padding-bottom: 15px; }
46
+ .view-info .table-cell:first-child {
47
+ padding-top: 9px;
48
+ min-width: 130px; }
49
+ .view-info .table-row:last-child .table-cell {
50
+ padding-bottom: 0; }
51
+ .view-info label {
52
+ vertical-align: top;
53
+ margin: 0;
54
+ display: block; }
55
+ .view-info input {
56
+ font-size: 20px; }
57
+ .view-info input.view-name {
58
+ width: 100%;
59
+ margin: 0;
60
+ padding: 4px 8px; }
61
+
62
+ /* -------------------------------------------------
63
+ Shortcode read-only input
64
+ ------------------------------------------------- */
65
+ #view-shortcode {
66
+ direction: ltr;
67
+ font-family: Consolas, Monaco, monospace;
68
+ unicode-bidi: embed;
69
+ display: inline-block;
70
+ font-size: 18px;
71
+ padding: 0 8px;
72
+ line-height: 35px;
73
+ width: 300px;
74
+ color: #777;
75
+ background: #FFF; }
76
+
77
+ .form-view-shortcode .unsaved {
78
+ color: #888;
79
+ font-style: italic;
80
+ line-height: 37px; }
81
+
82
+ /* -------------------------------------------------
83
+ Copy shortcode button
84
+ ------------------------------------------------- */
85
+ #copy-shortcode {
86
+ margin: 5px 1em;
87
+ line-height: 26px; }
88
+
89
+ #copy-message {
90
+ opacity: 0;
91
+ font-size: 14px;
92
+ line-height: 26px;
93
+ height: 26px;
94
+ padding: 0 10px;
95
+ margin: 0;
96
+ display: inline-block;
97
+ background: #00A4F3;
98
+ color: #FFF;
99
+ border-radius: 3px;
100
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
101
+ position: relative;
102
+ top: -1px; }
103
+
104
+ #copy-message.copied {
105
+ opacity: 0;
106
+ will-change: opacity;
107
+ animation: showcopied 2s ease; }
108
+
109
+ @keyframes showcopied {
110
+ 0% {
111
+ opacity: 0; }
112
+ 70% {
113
+ opacity: 1; }
114
+ 100% {
115
+ opacity: 0; } }
116
+ /* -------------------------------------------------
117
+ Mode selector
118
+ ------------------------------------------------- */
119
+ #view-mode {
120
+ margin-top: 1em; }
121
+ #view-mode label {
122
+ display: inline-block;
123
+ margin: 0 5px 0 0;
124
+ padding: 0.5em 18px 0.5em 12px;
125
+ border: 2px solid #ccc;
126
+ border-radius: 20px;
127
+ color: #888;
128
+ position: relative;
129
+ background: #fff; }
130
+ #view-mode label.checked {
131
+ position: relative;
132
+ background: #00A4F3;
133
+ color: #FFF;
134
+ border-color: transparent;
135
+ transition: all 0.1s ease; }
136
+ #view-mode label:hover {
137
+ background: #FFF;
138
+ color: #444;
139
+ border-color: #00A4F3; }
140
+ #view-mode input[type="radio"] {
141
+ margin-right: 7px; }
142
+
143
+ .mode-list {
144
+ display: inline-block; }
145
+
146
+ .mode-line {
147
+ display: none;
148
+ position: absolute;
149
+ border-left: 2px solid #00A4F3;
150
+ height: 18px;
151
+ top: 100%;
152
+ left: calc( 50% - 1px );
153
+ z-index: -1; }
154
+ label.checked .mode-line {
155
+ display: block; }
156
+
157
+ .mode-description {
158
+ box-sizing: border-box;
159
+ background: #FFF;
160
+ margin: 15px 5px 0 0;
161
+ padding: 8px 20px;
162
+ border: 2px solid #00A4F3;
163
+ color: #00A4F3;
164
+ text-align: center;
165
+ border-radius: 20px;
166
+ font-size: 16px;
167
+ line-height: 1.3;
168
+ min-height: 40px;
169
+ transition: all 0.2s ease; }
170
+
171
+ /* --------------------------------------------------
172
+ Category filter
173
+ -------------------------------------------------- */
174
+ .fc-search-wrap {
175
+ display: none;
176
+ position: relative; }
177
+
178
+ .fc-search-field {
179
+ margin: 12px 0 4px 0;
180
+ width: 100%; }
181
+
182
+ .cat-count {
183
+ color: #888; }
184
+
185
+ .view-category-list-panel {
186
+ box-sizing: border-box;
187
+ min-height: 42px;
188
+ min-width: 220px;
189
+ overflow: auto;
190
+ padding: 0 10px;
191
+ border: 1px solid #DFDFDF;
192
+ background-color: #FDFDFD;
193
+ transition: all 0.2s ease; }
194
+ .view-category-list-panel.short-panel {
195
+ max-height: 205px; }
196
+ .view-category-list-panel.tall-panel {
197
+ max-height: none; }
198
+
199
+ .view-category-list {
200
+ margin: 7px 0; }
201
+ .view-category-list li {
202
+ margin-bottom: 0;
203
+ line-height: 24px; }
204
+ .view-category-list li label {
205
+ margin-bottom: 6px;
206
+ word-wrap: break-word;
207
+ white-space: nowrap; }
208
+ .view-category-list ul.children {
209
+ margin-left: 21px; }
210
+
211
+ /* -------------------------------------------------
212
+ Replace checkboxes with icons
213
+ ------------------------------------------------- */
214
+ input[type=checkbox] {
215
+ display: none; }
216
+ input[type=checkbox] + label:before {
217
+ font-family: FontAwesome;
218
+ display: inline-block;
219
+ font-size: 18px;
220
+ width: 1em;
221
+ position: relative;
222
+ top: 1px;
223
+ /* unchecked icon */
224
+ content: "\f096";
225
+ color: #00A4F3; }
226
+ input[type=checkbox] + label:hover:before {
227
+ color: #FF8900; }
228
+ input[type=checkbox]:checked + label:before {
229
+ /* checked icon */
230
+ content: "\f14a"; }
231
+ input[type=checkbox]:checked + label:hover:before {
232
+ color: #FF8900; }
233
+ input[type=checkbox]:disabled + label:before {
234
+ /* disabled icon */
235
+ content: "\f146";
236
+ color: #888; }
237
+ input[type=checkbox]:disabled + label:hover:before {
238
+ color: #888; }
239
+
240
+ /* -------------------------------------------------
241
+ Misc.
242
+ ------------------------------------------------- */
243
+ #wpmtst-views-form input[type="submit"] {
244
+ margin-right: 10px; }
245
+
246
+ td.column-name strong {
247
+ display: block;
248
+ margin-bottom: .2em;
249
+ font-size: 14px; }
250
+
251
+ td.rowspan {
252
+ border-left: 1px solid #DDD; }
253
+
254
+ .subgroup {
255
+ background: #f8f8f8;
256
+ border: 1px solid #f1f1f1;
257
+ padding: 0.25em 1em;
258
+ margin-right: 1em; }
259
+
260
+ .subgroup-heading {
261
+ font-weight: 600; }
262
+
263
+ .subgroup .subgroup-heading + .row-inner {
264
+ margin-top: 5px; }
265
+
266
+ .subgroup .row-inner {
267
+ margin-bottom: 10px; }
268
+
269
+ .min-width-1 {
270
+ min-width: 152px; }
271
+
272
+ .label-not-adjacent {
273
+ margin-right: 0.3em; }
274
+
275
+ .is-below {
276
+ margin-top: 10px; }
277
+
278
+ /* -------------------------------------------------
279
+ Restore Default Breakpoints button
280
+ ------------------------------------------------- */
281
+ #restored-message {
282
+ opacity: 0;
283
+ line-height: 26px;
284
+ height: 26px;
285
+ padding: 0 10px;
286
+ margin: 1px 1em;
287
+ display: inline-block;
288
+ background: #00A4F3;
289
+ color: #FFF;
290
+ border-radius: 3px;
291
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
292
+ position: relative;
293
+ top: -1px; }
294
+
295
+ #restored-message.copied {
296
+ opacity: 0;
297
+ will-change: opacity;
298
+ animation: showcopied 2s ease; }
299
+
300
+ @keyframes showcopied {
301
+ 0% {
302
+ opacity: 0; }
303
+ 70% {
304
+ opacity: 1; }
305
+ 100% {
306
+ opacity: 0; } }
307
+ .screenshot {
308
+ margin: 10px; }
309
+ .screenshot > div {
310
+ display: inline-block;
311
+ -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
312
+ -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
313
+ box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8); }
314
+
315
+ /* --------------------------------------------------
316
+ Inputs
317
+ -------------------------------------------------- */
318
+ input[type="text"].long {
319
+ width: 25em; }
320
+
321
+ input[type="text"].medium {
322
+ width: 18em; }
323
+
324
+ .input-number {
325
+ width: 5em;
326
+ text-align: right; }
327
+
328
+ .input-incremental {
329
+ width: 5em; }
330
+
331
+ .input-number-px {
332
+ width: 4em;
333
+ text-align: right; }
334
+
335
+ .form-table select {
336
+ vertical-align: baseline; }
337
+
338
+ div.radio {
339
+ line-height: 1.5em;
340
+ padding: 0 5px; }
341
+
342
+ label,
343
+ .nolabel {
344
+ vertical-align: baseline;
345
+ display: inline-block; }
346
+
347
+ label:hover {
348
+ color: #000; }
349
+
350
+ option:disabled {
351
+ font-style: italic !important; }
352
+
353
+ /* -------------------------------------------------
354
+ Elements
355
+ ------------------------------------------------- */
356
+ .wpmtst2 {
357
+ max-width: 1200px;
358
+ /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
359
+ /* views section heading */ }
360
+ .wpmtst2 p.wpmtst-submit {
361
+ margin-top: 2em; }
362
+ .wpmtst2 h3 {
363
+ background: #FFF;
364
+ color: #00A4F3;
365
+ font-weight: 400;
366
+ border: 1px solid #DDD;
367
+ border-bottom: 0;
368
+ padding: 10px 15px;
369
+ margin-bottom: 0;
370
+ margin-top: 1.5rem; }
371
+
372
+ .form-table td p.description {
373
+ margin-top: 0;
374
+ font-style: italic; }
375
+ .form-table td p.description.tall {
376
+ line-height: 32px;
377
+ margin-top: 0; }
378
+ .form-table td p.description.short {
379
+ line-height: 22px;
380
+ padding: 5px 0; }
381
+ .form-table td p.description.solo {
382
+ margin-left: 0.3em; }
383
+ .form-table td p.description.under-checkbox {
384
+ margin-left: 22px; }
385
+
386
+ /* Misc positioning */
387
+ .inline {
388
+ display: inline-block;
389
+ margin-right: 1em;
390
+ vertical-align: top; }
391
+ .inline:last-child {
392
+ margin-right: 0; }
393
+
394
+ .inline span,
395
+ .row span {
396
+ display: inline-block;
397
+ margin-right: 3px; }
398
+
399
+ .inline-middle {
400
+ vertical-align: middle; }
401
+
402
+ .tight {
403
+ margin-right: 0.2em; }
404
+
405
+ .tight:last-child,
406
+ .last {
407
+ margin-right: 0; }
408
+
409
+ .checkbox,
410
+ .form-table th.checkbox {
411
+ line-height: 32px; }
412
+
413
+ .field {
414
+ position: relative; }
415
+ .field div {
416
+ display: inline-block;
417
+ padding: 0.2em 0.3em; }
418
+
419
+ /* -------------------------------------------------
420
+ Form table
421
+ ------------------------------------------------- */
422
+ .form-table {
423
+ margin-top: 0;
424
+ background: #FEFEFE;
425
+ width: 100% !important;
426
+ border: 1px solid #DDD; }
427
+ .form-table.multiple {
428
+ width: auto; }
429
+ .form-table tr {
430
+ border: 1px solid #DDD; }
431
+ .form-table th,
432
+ .form-table td {
433
+ vertical-align: top; }
434
+ .form-table th {
435
+ font-weight: 400;
436
+ white-space: nowrap;
437
+ vertical-align: top;
438
+ width: 150px;
439
+ padding: 10px 15px; }
440
+ .form-table td {
441
+ padding: 10px; }
442
+ .form-table td.valign-middle {
443
+ vertical-align: middle; }
444
+ .form-table td.w1 {
445
+ width: 185px; }
446
+ .form-table td.w2 {
447
+ width: 300px; }
448
+
449
+ tr.subheading {
450
+ font-weight: 600; }
451
+ tr.subheading td {
452
+ padding: 5px 10px; }
453
+ tr.subheading td:first-child {
454
+ padding-left: 15px; }
455
+ tr.subheading td:last-child {
456
+ width: 190px; }
457
+
458
+ td.divider {
459
+ border-left: 1px dashed #DDD; }
460
+
461
+ .wpmtst2 .form-table th,
462
+ .wpmtst2 .form-table th label {
463
+ line-height: 30px;
464
+ margin-top: 0;
465
+ margin-bottom: 0; }
466
+
467
+ span.title {
468
+ display: inline-block;
469
+ margin-right: 1em; }
470
+
471
+ .row,
472
+ .row p {
473
+ vertical-align: middle;
474
+ line-height: 32px; }
475
+
476
+ .row.tall,
477
+ .row.tall p {
478
+ line-height: 40px; }
479
+
480
+ .row.links {
481
+ margin-top: 10px; }
482
+
483
+ .row:not(:first-child) .row-inner {
484
+ margin-top: 10px; }
485
+
486
+ /* --------------------------------------------------
487
+ Category checkboxes
488
+ -------------------------------------------------- */
489
+ ul.checkbox-horizontal {
490
+ display: inline-block;
491
+ list-style: none;
492
+ margin: 0; }
493
+ ul.checkbox-horizontal li {
494
+ display: inline-block;
495
+ float: left;
496
+ margin: 6px 2em 0 0; }
497
+
498
+ .select-cell {
499
+ padding-right: 2em; }
500
+
501
+ /* -------------------------------------------------
502
+ Form table
503
+ ------------------------------------------------- */
504
+ .form-table {
505
+ margin-top: 0;
506
+ background: #FEFEFE;
507
+ width: 100% !important;
508
+ border: 1px solid #DDD; }
509
+ .form-table.multiple {
510
+ width: auto; }
511
+ .form-table tr {
512
+ border: 1px solid #DDD; }
513
+ .form-table th,
514
+ .form-table td {
515
+ vertical-align: top; }
516
+ .form-table th {
517
+ font-weight: 400;
518
+ white-space: nowrap;
519
+ vertical-align: top;
520
+ width: 150px;
521
+ padding: 10px 15px; }
522
+ .form-table td {
523
+ padding: 10px; }
524
+ .form-table td.valign-middle {
525
+ vertical-align: middle; }
526
+ .form-table td.w1 {
527
+ width: 185px; }
528
+ .form-table td.w2 {
529
+ width: 300px; }
530
+
531
+ tr.subheading {
532
+ font-weight: 600; }
533
+ tr.subheading td {
534
+ padding: 5px 10px; }
535
+ tr.subheading td:first-child {
536
+ padding-left: 15px; }
537
+ tr.subheading td:last-child {
538
+ width: 190px; }
539
+
540
+ td.divider {
541
+ border-left: 1px dashed #DDD; }
542
+
543
+ .wpmtst2 .form-table th,
544
+ .wpmtst2 .form-table th label {
545
+ line-height: 30px;
546
+ margin-top: 0;
547
+ margin-bottom: 0; }
548
+
549
+ span.title {
550
+ display: inline-block;
551
+ margin-right: 1em; }
552
+
553
+ .row,
554
+ .row p {
555
+ vertical-align: middle;
556
+ line-height: 32px; }
557
+
558
+ .row.tall,
559
+ .row.tall p {
560
+ line-height: 40px; }
561
+
562
+ .row.links {
563
+ margin-top: 10px; }
564
+
565
+ .row:not(:first-child) .row-inner {
566
+ margin-top: 10px; }
567
+
568
+ /* -------------------------------------------------
569
+ List radio buttons
570
+ ------------------------------------------------- */
571
+ .section-radios {
572
+ display: flex;
573
+ justify-content: space-between; }
574
+ .section-radios > div:first-child {
575
+ flex: 0 0 15%; }
576
+ .section-radios > div:nth-child(2) {
577
+ flex: 1 1 auto;
578
+ background: rgba(0, 164, 243, 0.085);
579
+ border-radius: 15px; }
580
+
581
+ .radio-buttons input[type=radio] {
582
+ display: none; }
583
+ .radio-buttons input[type=radio] + label {
584
+ border-radius: 15px 0 0 15px;
585
+ line-height: 30px;
586
+ margin-right: 15px; }
587
+ .radio-buttons input[type=radio] + label:before {
588
+ font-family: FontAwesome;
589
+ display: inline-block;
590
+ color: #999;
591
+ text-align: center;
592
+ font-size: 17px;
593
+ margin-left: 5px;
594
+ margin-right: 1px;
595
+ width: 20px;
596
+ /* unchecked icon */
597
+ content: "\f10c"; }
598
+ .radio-buttons input[type=radio] + label:hover:before {
599
+ color: #FF8900; }
600
+ .radio-buttons input[type=radio]:checked + label:before {
601
+ /* checked icon */
602
+ content: "\f192";
603
+ color: #00A4F3; }
604
+ .radio-buttons input[type=radio]:checked + label:hover:before {
605
+ color: #FF8900; }
606
+ .radio-buttons input[type=radio].error + label, .radio-buttons input[type=radio].error + label:before {
607
+ color: red; }
608
+ .radio-buttons input[type=radio]:disabled + label {
609
+ color: #AAA; }
610
+ .radio-buttons input[type=radio]:disabled + label:before {
611
+ color: #CCC; }
612
+ .radio-buttons input[type=radio]:disabled + label:hover {
613
+ background: transparent; }
614
+ .radio-buttons input[type=radio]:checked:disabled + label:hover {
615
+ background: #EAF7FB; }
616
+
617
+ ul.radio-list {
618
+ margin: 15px 0; }
619
+ ul.radio-list li {
620
+ margin: 0; }
621
+ ul.radio-list li.current-selection label {
622
+ background: rgba(0, 164, 243, 0.085); }
623
+ ul.radio-list li label {
624
+ width: 100%;
625
+ white-space: nowrap; }
626
+
627
+ .radio-description {
628
+ padding: 0 15px; }
629
+ .radio-description p {
630
+ margin: 15px 0 15px !important; }
631
+
632
+ .options {
633
+ margin: 0 10px 15px 0; }
634
+ .options > div {
635
+ display: inline-block;
636
+ display: flex; }
637
+ .options > div > div {
638
+ display: inline-block;
639
+ width: 25%; }
640
+
641
+ .description-inner {
642
+ margin: 15px 0; }
643
+
644
+ /* -------------------------------------------------
645
+ Template options
646
+ ------------------------------------------------- */
647
+ ul.radio-list.template-list li {
648
+ display: flex; }
649
+ ul.radio-list.template-list li.current-selection .template-description {
650
+ background: rgba(0, 164, 243, 0.085); }
651
+ ul.radio-list.template-list li > div:first-child {
652
+ flex: 0 0 15%;
653
+ white-space: nowrap;
654
+ align-self: center; }
655
+ ul.radio-list.template-list li > div:nth-child(2) {
656
+ flex: 1 1 auto; }
657
+
658
+ .template-optgroup {
659
+ font-weight: 600;
660
+ margin: 15px 10px 10px 0; }
661
+
662
+ .template-description {
663
+ border-radius: 15px;
664
+ padding: 15px; }
665
+ .template-description p {
666
+ margin: 0px 0 15px !important; }
667
+ .template-description label {
668
+ background: transparent !important; }
669
+
670
+ /* -------------------------------------------------
671
+ Layout options
672
+ ------------------------------------------------- */
673
+ .layout-section > div:last-child {
674
+ flex: 0 0 auto;
675
+ align-self: flex-start;
676
+ margin-left: 10px;
677
+ padding: 10px; }
678
+
679
+ /* --------------------------------------------------
680
+ Examples
681
+ -------------------------------------------------- */
682
+ .example-container {
683
+ background: white;
684
+ border: 1px solid #ccc;
685
+ box-sizing: border-box;
686
+ padding: 15px 10px 5px;
687
+ width: 170px; }
688
+ .example-container .box {
689
+ background: #DDD;
690
+ width: 100%;
691
+ line-height: 30px;
692
+ height: 30px;
693
+ margin-bottom: 10px;
694
+ text-align: center;
695
+ /* to prevent overflowing margins */
696
+ display: inline-block;
697
+ position: relative;
698
+ /* multi-column properties */
699
+ -webkit-column-break-inside: avoid;
700
+ page-break-inside: avoid;
701
+ break-inside: avoid; }
702
+ .example-container .box span {
703
+ display: block;
704
+ margin: 0 auto; }
705
+ .example-container .box.size2 {
706
+ height: 45px; }
707
+ .example-container .box.size3 {
708
+ height: 60px; }
709
+
710
+ /* --------------------------------------------------
711
+ Columns
712
+ -------------------------------------------------- */
713
+ .view-layout-columns .example-container {
714
+ padding-bottom: 15px;
715
+ text-align: center;
716
+ /* a minimum width fallback */
717
+ -webkit-column-width: 25px;
718
+ -moz-column-width: 25px;
719
+ column-width: 25px;
720
+ -webkit-column-gap: 10px;
721
+ -moz-column-gap: 10px;
722
+ column-gap: 10px;
723
+ /* chrome does not repaint column-rule when switching classes in js :( */
724
+ /*-webkit-column-rule: 1px dashed #999;*/
725
+ /*-moz-column-rule: 1px dashed #999;*/
726
+ /*column-rule: 1px dashed #999;*/
727
+ -webkit-margin-bottom-collapse: separate; }
728
+ .view-layout-columns .example-container.col-2 {
729
+ -webkit-column-count: 2;
730
+ -moz-column-count: 2;
731
+ column-count: 2; }
732
+ .view-layout-columns .example-container.col-3 {
733
+ -webkit-column-count: 3;
734
+ -moz-column-count: 3;
735
+ column-count: 3; }
736
+ .view-layout-columns .example-container.col-4 {
737
+ -webkit-column-count: 4;
738
+ -moz-column-count: 4;
739
+ column-count: 4; }
740
+
741
+ /* --------------------------------------------------
742
+ Grid
743
+ -------------------------------------------------- */
744
+ .view-layout-grid .example-container {
745
+ display: -webkit-flex;
746
+ display: -ms-flexbox;
747
+ display: flex;
748
+ -webkit-flex-wrap: wrap;
749
+ -ms-flex-wrap: wrap;
750
+ flex-wrap: wrap;
751
+ justify-content: space-between; }
752
+ .view-layout-grid .example-container .box {
753
+ display: -webkit-flex;
754
+ display: -ms-flexbox;
755
+ display: flex; }
756
+ .view-layout-grid .example-container.col-2 .box {
757
+ width: 47%; }
758
+ .view-layout-grid .example-container.col-3 .box {
759
+ width: 29%; }
760
+ .view-layout-grid .example-container.col-4 .box {
761
+ width: 21%; }
762
+
763
+ /* --------------------------------------------------
764
+ Masonry
765
+ -------------------------------------------------- */
766
+ .view-layout-masonry .example-container .box {
767
+ width: 46%; }
768
+ .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
769
+ width: 46%; }
770
+ .view-layout-masonry .example-container.col-3 .grid-sizer {
771
+ width: 27.5%; }
772
+ .view-layout-masonry .example-container.col-4 .grid-sizer {
773
+ width: 19.5%; }
774
+
775
+ /* -------------------------------------------------
776
+ Background options
777
+ ------------------------------------------------- */
778
+ .color-picker-wrap {
779
+ display: flex; }
780
+ .color-picker-wrap > div:first-child {
781
+ min-width: 80px; }
782
+
783
+ .background-preview-wrap {
784
+ background: #FFF;
785
+ padding: 2em;
786
+ max-width: 300px; }
787
+
788
+ #background-preview {
789
+ padding: 1em;
790
+ text-align: center; }
791
+ #background-preview.dark {
792
+ color: #333; }
793
+ #background-preview.light {
794
+ color: #EEE; }
795
+
796
+ /* --------------------------------------------------
797
+ Custom fields
798
+ -------------------------------------------------- */
799
+ .fields {
800
+ display: inline-block;
801
+ min-width: 350px; }
802
+ .fields .field2 {
803
+ border: 1px solid #DDD;
804
+ background: #FFF;
805
+ /* for better dragging */
806
+ transition: background 0.3s ease, border 0.3s ease; }
807
+ .fields .field2.open {
808
+ background: #FFF;
809
+ border-color: #444; }
810
+ .fields .field3 {
811
+ flex: 20; }
812
+ .fields div.link {
813
+ display: inline-block;
814
+ cursor: pointer;
815
+ padding: 10px 10px 8px;
816
+ width: calc(100% - 20px); }
817
+
818
+ .controls2 {
819
+ /* icons */ }
820
+ .controls2 > div {
821
+ display: flex; }
822
+ .controls2 .icon-wrap {
823
+ position: relative;
824
+ top: 1px;
825
+ color: #999; }
826
+ .controls2 .icon-wrap:hover {
827
+ cursor: pointer; }
828
+ .controls2.left {
829
+ float: left; }
830
+ .controls2.left .icon-wrap {
831
+ margin-right: 5px; }
832
+ .controls2.right {
833
+ float: right; }
834
+ .controls2.right .icon-wrap {
835
+ margin-left: 5px; }
836
+ .controls2 .handle:before,
837
+ .controls2 .delete:before,
838
+ .controls2 .toggle:before {
839
+ font: normal 20px/1 dashicons;
840
+ width: 20px;
841
+ height: 20px; }
842
+ .controls2 .handle:hover,
843
+ .controls2 .delete:hover,
844
+ .controls2 .toggle:hover {
845
+ cursor: pointer; }
846
+ .controls2 .delete:before {
847
+ content: "\f335"; }
848
+ .controls2 .delete:hover:before {
849
+ background: #FF0000;
850
+ color: #FFF;
851
+ border-radius: 1px; }
852
+ .controls2 .handle:before {
853
+ content: "\f333"; }
854
+ .controls2 .handle:hover {
855
+ color: #2ea2cc;
856
+ cursor: move; }
857
+ .controls2 .toggle:before {
858
+ content: "\f140"; }
859
+ .controls2 .toggle:hover:before {
860
+ color: #2EA2CC; }
861
+
862
+ .field-description {
863
+ padding: 0 5px;
864
+ font-weight: 600;
865
+ text-decoration: none;
866
+ color: #444; }
867
+ .field-description:hover {
868
+ color: #444; }
869
+
870
+ .field-properties {
871
+ padding: 5px 10px;
872
+ border-top: 1px dotted #DDD; }
873
+
874
+ .field-property,
875
+ .field-property-box .flex {
876
+ display: flex;
877
+ margin: 5px 0; }
878
+ .field-property label,
879
+ .field-property .nolabel,
880
+ .field-property-box .flex label,
881
+ .field-property-box .flex .nolabel {
882
+ flex: 0 1 80px;
883
+ line-height: 28px; }
884
+ .field-property select, .field-property input,
885
+ .field-property-box .flex select,
886
+ .field-property-box .flex input {
887
+ flex: 3; }
888
+
889
+ .field2.open .toggle:before {
890
+ content: "\f142"; }
891
+
892
+ .sortable-placeholder {
893
+ background: lightyellow !important;
894
+ margin: 0; }
895
+
896
+ .ui-sortable-helper {
897
+ border: 1px solid #444 !important; }
898
+
899
+ div.help {
900
+ font-style: italic;
901
+ padding-bottom: 5px; }
902
+
903
+ @-moz-document url-prefix() {
904
+ select optgroup {
905
+ font-style: normal;
906
+ margin-left: 3px; } }
907
+ /* --------------------------------------------------
908
+ help tab
909
+ -------------------------------------------------- */
910
+ span.help-links {
911
+ display: inline-block;
912
+ margin-left: 0.4em; }
913
+
914
+ a.open-help-tab {
915
+ font-weight: 400; }
916
+
917
+ table.wpmtst-help-tab {
918
+ border-collapse: collapse;
919
+ margin: 20px 0;
920
+ width: 100%; }
921
+ table.wpmtst-help-tab tr:hover td {
922
+ background: #FFFFAA; }
923
+ table.wpmtst-help-tab th,
924
+ table.wpmtst-help-tab td {
925
+ padding: 5px 10px;
926
+ text-align: center; }
927
+ table.wpmtst-help-tab th {
928
+ border-bottom: 1px solid #AAA; }
929
+ table.wpmtst-help-tab td {
930
+ border-bottom: 1px solid #E1E1E1; }
931
+ table.wpmtst-help-tab td:first-child {
932
+ text-align: right;
933
+ font-weight: 600;
934
+ white-space: nowrap; }
935
+ table.wpmtst-help-tab td:not(:last-child) {
936
+ border-right: 1px dotted #E1E1E1; }
937
+
938
+ /* --------------------------------------------------
939
+ Views list table sticky
940
+ -------------------------------------------------- */
941
+ .wp-list-table-wrap {
942
+ position: relative; }
943
+
944
+ .stickit, .stickit:before {
945
+ cursor: pointer;
946
+ content: "\f154";
947
+ display: inline-block;
948
+ width: 20px;
949
+ height: 20px;
950
+ color: #aaa;
951
+ font-size: 20px;
952
+ line-height: 1;
953
+ font-family: dashicons;
954
+ text-decoration: inherit;
955
+ font-weight: normal;
956
+ font-style: normal;
957
+ vertical-align: top;
958
+ text-align: center;
959
+ -webkit-transition: color .1s ease-in;
960
+ transition: color .1s ease-in;
961
+ -webkit-font-smoothing: antialiased;
962
+ -moz-osx-font-smoothing: grayscale; }
963
+
964
+ .stickit.stuck:before {
965
+ content: "\f155";
966
+ color: #0073aa; }
967
+ .stickit:hover:before {
968
+ content: "\f155";
969
+ color: #0096dd; }
970
+
971
+ .overlay {
972
+ position: absolute;
973
+ top: 0;
974
+ left: 0;
975
+ bottom: 0;
976
+ right: 0;
977
+ background: rgba(255, 255, 255, 0.7); }
978
+
979
+ /* -------------------------------------------------
980
+ Inner table
981
+ ------------------------------------------------- */
982
+ .inner-table {
983
+ display: table; }
984
+
985
+ .inner-table-row {
986
+ display: table-row; }
987
+ .inner-table-row.bordered {
988
+ border: 1px solid #DDD; }
989
+ .inner-table-row.header .inner-table-cell {
990
+ text-align: center;
991
+ padding: 0 10px;
992
+ background: #f6f6f6; }
993
+
994
+ .inner-table-cell {
995
+ display: table-cell;
996
+ padding: 5px 10px; }
997
+ .inner-table-cell:not(:last-child) {
998
+ border-right: 1px dashed #e2e2e2; }
999
+
1000
+ .form-table td p.description.normal {
1001
+ font-style: normal; }
1002
+
1003
+ ul.description.normal {
1004
+ margin-top: 0;
1005
+ font-style: normal; }
1006
+
1007
+ ul.description li {
1008
+ margin-bottom: 0;
1009
+ line-height: 1.5; }
admin/css/wpml.css CHANGED
@@ -1,31 +1,31 @@
1
- /* The String Translation screen
2
- -----------------------------------------------*/
3
-
4
- /* word break */
5
- .wrap .wpml-st-col-domain, .wpml-st-col-name {
6
- word-break: normal;
7
- }
8
-
9
- /* striping */
10
- #icl_string_translations > tbody > *:nth-child(2n+1) {
11
- background-color: #f9f9f9;
12
- }
13
-
14
- /* the languages links under Bulk Actions on the Categories screen */
15
- #icl_subsubsub {
16
- display: block;
17
- padding: 5px 8px 8px;
18
- }
19
-
20
- /* the textareas */
21
- .icl-st-table textarea {
22
- font-size: 13px;
23
- }
24
-
25
- /* match the header/footer checkbox to standard post list table */
26
- .widefat thead td.check-column,
27
- .widefat thead th.check-column,
28
- .widefat tfoot td.check-column,
29
- .widefat tfoot th.check-column {
30
- padding: 10px 0 0 2px;
31
- }
1
+ /* The String Translation screen
2
+ -----------------------------------------------*/
3
+
4
+ /* word break */
5
+ .wrap .wpml-st-col-domain, .wpml-st-col-name {
6
+ word-break: normal;
7
+ }
8
+
9
+ /* striping */
10
+ #icl_string_translations > tbody > *:nth-child(2n+1) {
11
+ background-color: #f9f9f9;
12
+ }
13
+
14
+ /* the languages links under Bulk Actions on the Categories screen */
15
+ #icl_subsubsub {
16
+ display: block;
17
+ padding: 5px 8px 8px;
18
+ }
19
+
20
+ /* the textareas */
21
+ .icl-st-table textarea {
22
+ font-size: 13px;
23
+ }
24
+
25
+ /* match the header/footer checkbox to standard post list table */
26
+ .widefat thead td.check-column,
27
+ .widefat thead th.check-column,
28
+ .widefat tfoot td.check-column,
29
+ .widefat tfoot th.check-column {
30
+ padding: 10px 0 0 2px;
31
+ }
admin/custom-fields-ajax.php CHANGED
@@ -1,99 +1,99 @@
1
- <?php
2
- /**
3
- * Ajax Functions
4
- */
5
-
6
-
7
- /**
8
- * [Add New Field] Ajax receiver
9
- */
10
- function wpmtst_add_field_function() {
11
- check_ajax_referer( 'wpmtst-admin', 'security', false );
12
-
13
- // when adding, leave Name empty so it will be populated from Label
14
- $empty_field = array(
15
- 'name' => 'new_field',
16
- 'name_mutable' => 1,
17
- 'record_type' => 'custom',
18
- 'input_type' => 'text',
19
- 'label' => __( 'New Field', 'strong-testimonials' ),
20
- 'show_label' => 1,
21
- );
22
- echo wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true );
23
- wp_die();
24
- }
25
- add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
26
-
27
-
28
- /**
29
- * [Add New Field 2] Ajax receiver
30
- */
31
- function wpmtst_add_field_2_function() {
32
- check_ajax_referer( 'wpmtst-admin', 'security', false );
33
-
34
- $new_field_type = $_REQUEST['fieldType'];
35
- $new_field_class = $_REQUEST['fieldClass'];
36
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
-
38
- $empty_field = array_merge(
39
- $fields['field_types'][$new_field_class][$new_field_type],
40
- array( 'record_type' => $new_field_class )
41
- );
42
- echo wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field );
43
- wp_die();
44
- }
45
- add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
46
-
47
-
48
- /**
49
- * [Add New Field 3] Ajax receiver
50
- */
51
- function wpmtst_add_field_3_function() {
52
- check_ajax_referer( 'wpmtst-admin', 'security', false );
53
-
54
- $new_field_type = $_REQUEST['fieldType'];
55
- $new_field_class = $_REQUEST['fieldClass'];
56
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
57
-
58
- $empty_field = array_merge(
59
- $fields['field_types'][$new_field_class][$new_field_type],
60
- array( 'record_type' => $new_field_class )
61
- );
62
- echo wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field );
63
- wp_die();
64
- }
65
- add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
66
-
67
-
68
- /**
69
- * [Add New Field 4] Ajax receiver
70
- */
71
- function wpmtst_add_field_4_function() {
72
- check_ajax_referer( 'wpmtst-admin', 'security', false );
73
-
74
- $new_field_type = $_REQUEST['fieldType'];
75
- $new_field_class = $_REQUEST['fieldClass'];
76
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
77
- $empty_field = array();
78
- if ( isset( $fields['field_types'][$new_field_class][$new_field_type] ) ) {
79
- $empty_field = array_merge(
80
- $fields['field_types'][ $new_field_class ][ $new_field_type ],
81
- array( 'record_type' => $new_field_class )
82
- );
83
- }
84
- echo wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field );
85
- wp_die();
86
- }
87
- add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
88
-
89
-
90
- /**
91
- * Return the category count.
92
- */
93
- function wpmtst_ajax_cat_count() {
94
- check_ajax_referer( 'wpmtst-admin', 'security', false );
95
-
96
- echo wpmtst_get_cat_count();
97
- wp_die();
98
- }
99
- add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
1
+ <?php
2
+ /**
3
+ * Ajax Functions
4
+ */
5
+
6
+
7
+ /**
8
+ * [Add New Field] Ajax receiver
9
+ */
10
+ function wpmtst_add_field_function() {
11
+ check_ajax_referer( 'wpmtst-admin', 'security', false );
12
+
13
+ // when adding, leave Name empty so it will be populated from Label
14
+ $empty_field = array(
15
+ 'name' => 'new_field',
16
+ 'name_mutable' => 1,
17
+ 'record_type' => 'custom',
18
+ 'input_type' => 'text',
19
+ 'label' => __( 'New Field', 'strong-testimonials' ),
20
+ 'show_label' => 1,
21
+ );
22
+ echo wpmtst_show_field( intval( $_REQUEST['nextKey'] ), $empty_field, true );
23
+ wp_die();
24
+ }
25
+ add_action( 'wp_ajax_wpmtst_add_field', 'wpmtst_add_field_function' );
26
+
27
+
28
+ /**
29
+ * [Add New Field 2] Ajax receiver
30
+ */
31
+ function wpmtst_add_field_2_function() {
32
+ check_ajax_referer( 'wpmtst-admin', 'security', false );
33
+
34
+ $new_field_type = $_REQUEST['fieldType'];
35
+ $new_field_class = $_REQUEST['fieldClass'];
36
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
+
38
+ $empty_field = array_merge(
39
+ $fields['field_types'][$new_field_class][$new_field_type],
40
+ array( 'record_type' => $new_field_class )
41
+ );
42
+ echo wpmtst_show_field_secondary( intval( $_REQUEST['nextKey'] ), $empty_field );
43
+ wp_die();
44
+ }
45
+ add_action( 'wp_ajax_wpmtst_add_field_2', 'wpmtst_add_field_2_function' );
46
+
47
+
48
+ /**
49
+ * [Add New Field 3] Ajax receiver
50
+ */
51
+ function wpmtst_add_field_3_function() {
52
+ check_ajax_referer( 'wpmtst-admin', 'security', false );
53
+
54
+ $new_field_type = $_REQUEST['fieldType'];
55
+ $new_field_class = $_REQUEST['fieldClass'];
56
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
57
+
58
+ $empty_field = array_merge(
59
+ $fields['field_types'][$new_field_class][$new_field_type],
60
+ array( 'record_type' => $new_field_class )
61
+ );
62
+ echo wpmtst_show_field_hidden( intval( $_REQUEST['nextKey'] ), $empty_field );
63
+ wp_die();
64
+ }
65
+ add_action( 'wp_ajax_wpmtst_add_field_3', 'wpmtst_add_field_3_function' );
66
+
67
+
68
+ /**
69
+ * [Add New Field 4] Ajax receiver
70
+ */
71
+ function wpmtst_add_field_4_function() {
72
+ check_ajax_referer( 'wpmtst-admin', 'security', false );
73
+
74
+ $new_field_type = $_REQUEST['fieldType'];
75
+ $new_field_class = $_REQUEST['fieldClass'];
76
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
77
+ $empty_field = array();
78
+ if ( isset( $fields['field_types'][$new_field_class][$new_field_type] ) ) {
79
+ $empty_field = array_merge(
80
+ $fields['field_types'][ $new_field_class ][ $new_field_type ],
81
+ array( 'record_type' => $new_field_class )
82
+ );
83
+ }
84
+ echo wpmtst_show_field_admin_table( intval( $_REQUEST['nextKey'] ), $empty_field );
85
+ wp_die();
86
+ }
87
+ add_action( 'wp_ajax_wpmtst_add_field_4', 'wpmtst_add_field_4_function' );
88
+
89
+
90
+ /**
91
+ * Return the category count.
92
+ */
93
+ function wpmtst_ajax_cat_count() {
94
+ check_ajax_referer( 'wpmtst-admin', 'security', false );
95
+
96
+ echo wpmtst_get_cat_count();
97
+ wp_die();
98
+ }
99
+ add_action( 'wp_ajax_wpmtst_get_cat_count', 'wpmtst_ajax_cat_count' );
admin/custom-fields.php CHANGED
@@ -1,517 +1,517 @@
1
- <?php
2
- /**
3
- * Strong Testimonials - Custom fields admin functions
4
- */
5
-
6
- function wpmtst_form_admin() {
7
- do_action( 'wpmtst_form_admin' );
8
- }
9
-
10
- function wpmtst_form_admin2() {
11
- wpmtst_settings_custom_fields( 1 );
12
- }
13
-
14
- add_action( 'wpmtst_form_admin', 'wpmtst_form_admin2' );
15
-
16
- /**
17
- * Save changes to custom fields.
18
- *
19
- * @since 2.28.5 As separate function on custom action.
20
- */
21
- function wpmtst_update_custom_fields() {
22
- $goback = wp_get_referer();
23
-
24
- if ( ! isset( $_POST['wpmtst_form_submitted'] ) ) {
25
- wp_redirect( $goback );
26
- exit;
27
- }
28
-
29
- if ( ! wp_verify_nonce( $_POST['wpmtst_form_submitted'], 'wpmtst_custom_fields_form' ) ) {
30
- wp_redirect( $goback );
31
- exit;
32
- }
33
-
34
- $form_id = $_POST['form_id'];
35
- $forms = get_option( 'wpmtst_custom_forms' );
36
- $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
-
38
- if ( isset( $_POST['reset'] ) ) {
39
-
40
- // Undo changes
41
- wpmtst_add_admin_notice( 'changes-cancelled' );
42
-
43
- }
44
- elseif ( isset( $_POST['restore-defaults'] ) ) {
45
-
46
- // Restore defaults
47
- $default_forms = Strong_Testimonials_Defaults::get_base_forms();
48
- $fields = $default_forms['default']['fields'];
49
- $forms[ $form_id ]['fields'] = $fields;
50
- update_option( 'wpmtst_custom_forms', $forms );
51
- do_action( 'wpmtst_fields_updated', $fields );
52
-
53
- wpmtst_add_admin_notice( 'defaults-restored' );
54
-
55
- }
56
- else {
57
-
58
- // Save changes
59
- $fields = array();
60
- $new_key = 0;
61
-
62
- /**
63
- * Strip the dang slashes from the dang magic quotes.
64
- *
65
- * @since 2.0.0
66
- */
67
- $post_fields = stripslashes_deep( $_POST['fields'] );
68
-
69
- foreach ( $post_fields as $key => $field ) {
70
-
71
- /*
72
- * Before merging onto base field, catch fields that are "off"
73
- * which the form does not submit. Otherwise, the default "on"
74
- * would override the requested (but not submitted) "off".
75
- */
76
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
77
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
78
-
79
- $field = array_merge( $field_options['field_base'], $field );
80
-
81
- $field['name'] = sanitize_text_field( $field['name'] );
82
- $field['label'] = sanitize_text_field( $field['label'] );
83
-
84
- // TODO Replace this special handling
85
- if ( 'checkbox' == $field['input_type'] ) {
86
- $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
87
- } else {
88
- $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
89
- }
90
- $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
91
- $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
92
-
93
- $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
94
-
95
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
96
-
97
- if ( isset( $field['text'] ) ) {
98
- $field['text'] = wp_filter_post_kses( $field['text'] );
99
- }
100
- $field['before'] = sanitize_text_field( $field['before'] );
101
- $field['after'] = sanitize_text_field( $field['after'] );
102
-
103
- $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
104
- $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
105
- $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
106
-
107
- // Hidden options (no need to check if isset)
108
- $field['admin_table'] = $field['admin_table'] ? 1 : 0;
109
- $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
- $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
- $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
- $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
-
114
- $field = apply_filters( 'wpmtst_sanitize_form_field_options', $field );
115
-
116
- // add to fields array in display order
117
- $fields[ $new_key++ ] = $field;
118
-
119
- }
120
-
121
- $forms[ $form_id ]['fields'] = $fields;
122
-
123
- if ( isset( $_POST['field_group_label'] ) ) {
124
- // TODO Catch if empty.
125
- $new_label = sanitize_text_field( $_POST['field_group_label'] );
126
- $forms[ $form_id ]['label'] = $new_label;
127
- }
128
-
129
- update_option( 'wpmtst_custom_forms', $forms );
130
- do_action( 'wpmtst_fields_updated', $fields );
131
-
132
- wpmtst_add_admin_notice( 'fields-saved' );
133
-
134
- }
135
-
136
- wp_redirect( $goback );
137
- exit;
138
- }
139
-
140
- add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
141
-
142
- /**
143
- * Custom Fields form
144
- *
145
- * @param int $form_id
146
- */
147
- function wpmtst_settings_custom_fields( $form_id = 1 ) {
148
- if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
149
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'strong-testimonials' ) );
150
- }
151
-
152
- if ( ! $form_id ) {
153
- echo '<div class="wrap wpmtst"><p>' . __( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
154
- return;
155
- }
156
-
157
- $forms = get_option( 'wpmtst_custom_forms' );
158
- $fields = $forms[$form_id]['fields'];
159
- ?>
160
-
161
- <div class="wrap wpmtst">
162
- <h1 class="wp-heading-inline"><?php esc_html_e( 'Fields', 'strong-testimonials' ); ?></h1>
163
- <hr class="wp-header-end">
164
- <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
165
-
166
- <div id="left-col">
167
- <div>
168
- <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
169
- <p>
170
- <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
171
- <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
172
- </p>
173
- <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
174
- </div>
175
-
176
- <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
177
- <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
178
- <input type="hidden" name="action" value="wpmtst_update_custom_fields">
179
- <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
180
-
181
- <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
182
-
183
- <ul id="custom-field-list">
184
- <?php
185
- foreach ( $fields as $key => $field ) {
186
- echo '<li id="field-' . esc_attr( $key ) . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
187
- }
188
- ?>
189
- </ul>
190
-
191
- <div id="add-field-bar">
192
- <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
193
- </div>
194
-
195
- <?php do_action( 'wpmtst_admin_after_form_fields' ); ?>
196
-
197
- <div id="field-group-actions">
198
- <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
199
- <div><?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
200
- <div><?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
201
- </div>
202
- </form>
203
- </div><!-- #left-col -->
204
-
205
- <div id="right-col">
206
- <div class="intro">
207
- <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
208
- <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
209
- </div>
210
- <?php do_action( 'wpmtst_fields_before_fields_editor_preview' ); ?>
211
- <div id="fields-editor-preview">
212
- <div><!-- placeholder --></div>
213
- </div>
214
- </div><!-- #right-col -->
215
-
216
- </div><!-- .wrap -->
217
- <?php
218
- }
219
-
220
- /**
221
- * Add a field to the form
222
- *
223
- * @param $key
224
- * @param $field
225
- * @param $adding
226
- *
227
- * @return string
228
- */
229
- function wpmtst_show_field( $key, $field, $adding ) {
230
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
231
- $field_types = $fields['field_types'];
232
-
233
- ob_start();
234
-
235
- include 'partials/fields/field-header.php';
236
- ?>
237
- <div class="custom-field" style="display: none;">
238
-
239
- <table class="field-table">
240
- <?php
241
- include 'partials/fields/field-type.php';
242
- include 'partials/fields/field-label.php';
243
- include 'partials/fields/field-name.php';
244
-
245
- if ( ! $adding ) {
246
- echo wpmtst_show_field_secondary( $key, $field );
247
- echo wpmtst_show_field_admin_table( $key, $field );
248
- }
249
-
250
- ?>
251
- </table>
252
-
253
- <?php
254
- if ( ! $adding ) {
255
- echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
256
- }
257
- include 'partials/fields/field-controls.php';
258
- ?>
259
- </div><!-- .custom-field -->
260
-
261
- <?php
262
- $html = ob_get_contents();
263
- ob_end_clean();
264
-
265
- return $html;
266
- }
267
-
268
-
269
- /**
270
- * Create the secondary inputs for a new custom field.
271
- * Called after field type is chosen (Post or Custom).
272
- *
273
- * @param $key
274
- * @param $field
275
- *
276
- * @return string
277
- */
278
- function wpmtst_show_field_secondary( $key, $field ) {
279
- $html = '';
280
-
281
- /*
282
- * Required
283
- */
284
- if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
285
- // Disable option if this is a core field like post_content.
286
- if ( isset( $field['core'] ) && $field['core'] ) {
287
- $disabled = ' disabled="disabled"';
288
- } else {
289
- $disabled = '';
290
- }
291
-
292
- $html .= '<tr class="field-secondary">' . "\n";
293
- $html .= '<th>' . esc_html__( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
294
- $html .= '<td>' . "\n";
295
- if ( $disabled ) {
296
- $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][required]" value="' . esc_attr( $field['required'] ) . '">';
297
- $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
298
- } else {
299
- $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][required]" ' . checked( $field['required'], true, false ) . '>';
300
- }
301
- $html .= '</td>' . "\n";
302
- $html .= '</tr>' . "\n";
303
- }
304
-
305
- /*
306
- * Placeholder
307
- */
308
- if ( $field['show_placeholder_option'] ) {
309
- if ( isset( $field['placeholder'] ) ) {
310
- $html .= '<tr class="field-secondary">' . "\n";
311
- $html .= '<th>' . esc_html__( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
312
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
313
- $html .= '</tr>' . "\n";
314
- }
315
- }
316
-
317
- /**
318
- * Text (checkbox, radio)
319
- *
320
- * @since 2.23.0
321
- */
322
- if ( $field['show_text_option'] ) {
323
- if ( isset( $field['text'] ) ) {
324
- $html .= '<tr class="field-secondary">' . "\n";
325
- $html .= '<th>' . esc_html__( 'Text', 'strong-testimonials' ) . '</th>' . "\n";
326
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . esc_html__( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
327
- $html .= '</tr>' . "\n";
328
- }
329
- }
330
-
331
- /*
332
- * Before
333
- */
334
- $html .= '<tr class="field-secondary">' . "\n";
335
- $html .= '<th>' . esc_html__( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
336
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
337
- $html .= '</tr>' . "\n";
338
-
339
- /*
340
- * After
341
- */
342
- $html .= '<tr class="field-secondary">' . "\n";
343
- $html .= '<th>' . esc_html__( 'After', 'strong-testimonials' ) . '</th>' . "\n";
344
- $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
345
- $html .= '</tr>' . "\n";
346
-
347
- /*
348
- * Default Form Value
349
- */
350
- if ( $field['show_default_options'] ) {
351
- if ( isset( $field['default_form_value'] ) ) {
352
- $html .= '<tr class="field-secondary">' . "\n";
353
- $html .= '<th>' . esc_html__( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
354
- $html .= '<td>' . "\n";
355
-
356
- // TODO Replace this special handling
357
- if ( 'rating' == $field['input_type'] ) {
358
-
359
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
360
- $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
361
- $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
362
-
363
- } elseif ( 'checkbox' == $field['input_type'] ) {
364
-
365
- $html .= '<label>';
366
- $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
367
- $html .= '<span class="help inline">' . esc_html__( 'Checked by default.', 'strong-testimonials' ) . '</span>';
368
- $html .= '</label>';
369
-
370
- } else {
371
-
372
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
373
- $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
374
-
375
- }
376
-
377
- $html .= '</td>' . "\n";
378
- $html .= '</tr>' . "\n";
379
- }
380
- }
381
-
382
- /*
383
- * Default Display Value
384
- */
385
- if ( $field['show_default_options'] ) {
386
- // TODO Replace this special handling for checkbox type
387
- if ( 'checkbox' != $field['input_type'] ) {
388
- if ( isset( $field['default_display_value'] ) ) {
389
- $html .= '<tr class="field-secondary">' . "\n";
390
- $html .= '<th>' . esc_html__( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
391
- $html .= '<td>' . "\n";
392
-
393
- // TODO Replace this special handling
394
- if ( 'rating' == $field['input_type'] ) {
395
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
396
- $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
397
- } else {
398
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
399
- }
400
-
401
- $html .= '<span class="help">' . esc_html__( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
402
- $html .= '</td>' . "\n";
403
- $html .= '</tr>' . "\n";
404
- }
405
- }
406
- }
407
-
408
- /*
409
- * Shortcode Options
410
- */
411
- if ( $field['show_shortcode_options'] ) {
412
- if ( isset( $field['shortcode_on_form'] ) ) {
413
- $html .= '<tr class="field-secondary">' . "\n";
414
- $html .= '<th>' . esc_html__( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
415
- $html .= '<td>' . "\n";
416
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
417
- $html .= '</td>' . "\n";
418
- $html .= '</tr>' . "\n";
419
- }
420
- if ( isset( $field['shortcode_on_display'] ) ) {
421
- $html .= '<tr class="field-secondary">' . "\n";
422
- $html .= '<th>' . esc_html__( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
423
- $html .= '<td>' . "\n";
424
- $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
425
- $html .= '</td>' . "\n";
426
- $html .= '</tr>' . "\n";
427
- }
428
- }
429
-
430
- $html = apply_filters( 'wpmtst_fields_secondary', $html, $key, $field );
431
-
432
- return $html;
433
- }
434
-
435
-
436
- /**
437
- * Add type-specific [Admin Table] setting to form.
438
- */
439
- function wpmtst_show_field_admin_table( $key, $field ) {
440
- // -------------------
441
- // Show in Admin Table
442
- // -------------------
443
- if ( ! $field['show_admin_table_option'] ) {
444
- $html = '<input type="hidden" name="fields[' . esc_attr( $key ) . '][show_admin_table_option]" value="' . esc_attr( $field['show_admin_table_option'] ) . '">';
445
- return $html;
446
- }
447
-
448
- $html = '<tr class="field-admin-table">' . "\n";
449
- $html .= '<th>' . esc_html__( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
450
- $html .= '<td>' . "\n";
451
- if ( $field['admin_table_option'] ) {
452
- $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . esc_attr( $key ) . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
453
- } else {
454
- $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . esc_html__( 'required', 'strong-testimonials' ) . '</em>';
455
- $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][admin_table]" value="' . esc_attr( $field['admin_table'] ) . '">';
456
- }
457
- $html .= '<span class="help inline">' . esc_html__( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
458
- $html .= '</label>';
459
- $html .= '</td>' . "\n";
460
- $html .= '</tr>' . "\n";
461
-
462
- return $html;
463
- }
464
-
465
-
466
- /**
467
- * Add type-specific select options field
468
- */
469
- function wpmtst_show_field_select_options( $key, $field ) {
470
-
471
- if( $field['input_type'] !== 'select' ) {
472
- return;
473
- }
474
-
475
- ob_start();
476
- include 'partials/fields/field-select-options.php';
477
- return ob_get_clean();
478
- }
479
-
480
-
481
- /**
482
- * Add hidden fields to form.
483
- *
484
- * @param $key
485
- * @param $field
486
- *
487
- * @return string
488
- */
489
- function wpmtst_show_field_hidden( $key, $field ) {
490
- $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
491
-
492
- $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
493
- $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
494
- if ( isset( $field['action_input'] ) ) {
495
- $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
496
- }
497
- if ( isset( $field['action_output'] ) ) {
498
- $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
499
- }
500
- $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
501
- $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
502
- $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
503
- $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
504
- $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
505
- $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
506
- $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
507
-
508
- if ( isset( $field['map'] ) ) {
509
- $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
510
- }
511
-
512
- if ( isset( $field['core'] ) ) {
513
- $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
514
- }
515
-
516
- return $html;
517
- }
1
+ <?php
2
+ /**
3
+ * Strong Testimonials - Custom fields admin functions
4
+ */
5
+
6
+ function wpmtst_form_admin() {
7
+ do_action( 'wpmtst_form_admin' );
8
+ }
9
+
10
+ function wpmtst_form_admin2() {
11
+ wpmtst_settings_custom_fields( 1 );
12
+ }
13
+
14
+ add_action( 'wpmtst_form_admin', 'wpmtst_form_admin2' );
15
+
16
+ /**
17
+ * Save changes to custom fields.
18
+ *
19
+ * @since 2.28.5 As separate function on custom action.
20
+ */
21
+ function wpmtst_update_custom_fields() {
22
+ $goback = wp_get_referer();
23
+
24
+ if ( ! isset( $_POST['wpmtst_form_submitted'] ) ) {
25
+ wp_redirect( $goback );
26
+ exit;
27
+ }
28
+
29
+ if ( ! wp_verify_nonce( $_POST['wpmtst_form_submitted'], 'wpmtst_custom_fields_form' ) ) {
30
+ wp_redirect( $goback );
31
+ exit;
32
+ }
33
+
34
+ $form_id = $_POST['form_id'];
35
+ $forms = get_option( 'wpmtst_custom_forms' );
36
+ $field_options = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
37
+
38
+ if ( isset( $_POST['reset'] ) ) {
39
+
40
+ // Undo changes
41
+ wpmtst_add_admin_notice( 'changes-cancelled' );
42
+
43
+ }
44
+ elseif ( isset( $_POST['restore-defaults'] ) ) {
45
+
46
+ // Restore defaults
47
+ $default_forms = Strong_Testimonials_Defaults::get_base_forms();
48
+ $fields = $default_forms['default']['fields'];
49
+ $forms[ $form_id ]['fields'] = $fields;
50
+ update_option( 'wpmtst_custom_forms', $forms );
51
+ do_action( 'wpmtst_fields_updated', $fields );
52
+
53
+ wpmtst_add_admin_notice( 'defaults-restored' );
54
+
55
+ }
56
+ else {
57
+
58
+ // Save changes
59
+ $fields = array();
60
+ $new_key = 0;
61
+
62
+ /**
63
+ * Strip the dang slashes from the dang magic quotes.
64
+ *
65
+ * @since 2.0.0
66
+ */
67
+ $post_fields = stripslashes_deep( $_POST['fields'] );
68
+
69
+ foreach ( $post_fields as $key => $field ) {
70
+
71
+ /*
72
+ * Before merging onto base field, catch fields that are "off"
73
+ * which the form does not submit. Otherwise, the default "on"
74
+ * would override the requested (but not submitted) "off".
75
+ */
76
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
77
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
78
+
79
+ $field = array_merge( $field_options['field_base'], $field );
80
+
81
+ $field['name'] = sanitize_text_field( $field['name'] );
82
+ $field['label'] = sanitize_text_field( $field['label'] );
83
+
84
+ // TODO Replace this special handling
85
+ if ( 'checkbox' == $field['input_type'] ) {
86
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
87
+ } else {
88
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
89
+ }
90
+ $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
91
+ $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
92
+
93
+ $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
94
+
95
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
96
+
97
+ if ( isset( $field['text'] ) ) {
98
+ $field['text'] = wp_filter_post_kses( $field['text'] );
99
+ }
100
+ $field['before'] = sanitize_text_field( $field['before'] );
101
+ $field['after'] = sanitize_text_field( $field['after'] );
102
+
103
+ $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
104
+ $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
105
+ $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
106
+
107
+ // Hidden options (no need to check if isset)
108
+ $field['admin_table'] = $field['admin_table'] ? 1 : 0;
109
+ $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
+ $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
+ $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
+ $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
+
114
+ $field = apply_filters( 'wpmtst_sanitize_form_field_options', $field );
115
+
116
+ // add to fields array in display order
117
+ $fields[ $new_key++ ] = $field;
118
+
119
+ }
120
+
121
+ $forms[ $form_id ]['fields'] = $fields;
122
+
123
+ if ( isset( $_POST['field_group_label'] ) ) {
124
+ // TODO Catch if empty.
125
+ $new_label = sanitize_text_field( $_POST['field_group_label'] );
126
+ $forms[ $form_id ]['label'] = $new_label;
127
+ }
128
+
129
+ update_option( 'wpmtst_custom_forms', $forms );
130
+ do_action( 'wpmtst_fields_updated', $fields );
131
+
132
+ wpmtst_add_admin_notice( 'fields-saved' );
133
+
134
+ }
135
+
136
+ wp_redirect( $goback );
137
+ exit;
138
+ }
139
+
140
+ add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
141
+
142
+ /**
143
+ * Custom Fields form
144
+ *
145
+ * @param int $form_id
146
+ */
147
+ function wpmtst_settings_custom_fields( $form_id = 1 ) {
148
+ if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
149
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'strong-testimonials' ) );
150
+ }
151
+
152
+ if ( ! $form_id ) {
153
+ echo '<div class="wrap wpmtst"><p>' . __( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
154
+ return;
155
+ }
156
+
157
+ $forms = get_option( 'wpmtst_custom_forms' );
158
+ $fields = $forms[$form_id]['fields'];
159
+ ?>
160
+
161
+ <div class="wrap wpmtst">
162
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Fields', 'strong-testimonials' ); ?></h1>
163
+ <hr class="wp-header-end">
164
+ <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
165
+
166
+ <div id="left-col">
167
+ <div>
168
+ <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
169
+ <p>
170
+ <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
171
+ <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
172
+ </p>
173
+ <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
174
+ </div>
175
+
176
+ <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
177
+ <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
178
+ <input type="hidden" name="action" value="wpmtst_update_custom_fields">
179
+ <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
180
+
181
+ <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
182
+
183
+ <ul id="custom-field-list">
184
+ <?php
185
+ foreach ( $fields as $key => $field ) {
186
+ echo '<li id="field-' . esc_attr( $key ) . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
187
+ }
188
+ ?>
189
+ </ul>
190
+
191
+ <div id="add-field-bar">
192
+ <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
193
+ </div>
194
+
195
+ <?php do_action( 'wpmtst_admin_after_form_fields' ); ?>
196
+
197
+ <div id="field-group-actions">
198
+ <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
199
+ <div><?php submit_button( esc_html__( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
200
+ <div><?php submit_button( esc_html__( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
201
+ </div>
202
+ </form>
203
+ </div><!-- #left-col -->
204
+
205
+ <div id="right-col">
206
+ <div class="intro">
207
+ <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
208
+ <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
209
+ </div>
210
+ <?php do_action( 'wpmtst_fields_before_fields_editor_preview' ); ?>
211
+ <div id="fields-editor-preview">
212
+ <div><!-- placeholder --></div>
213
+ </div>
214
+ </div><!-- #right-col -->
215
+
216
+ </div><!-- .wrap -->
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Add a field to the form
222
+ *
223
+ * @param $key
224
+ * @param $field
225
+ * @param $adding
226
+ *
227
+ * @return string
228
+ */
229
+ function wpmtst_show_field( $key, $field, $adding ) {
230
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
231
+ $field_types = $fields['field_types'];
232
+
233
+ ob_start();
234
+
235
+ include 'partials/fields/field-header.php';
236
+ ?>
237
+ <div class="custom-field" style="display: none;">
238
+
239
+ <table class="field-table">
240
+ <?php
241
+ include 'partials/fields/field-type.php';
242
+ include 'partials/fields/field-label.php';
243
+ include 'partials/fields/field-name.php';
244
+
245
+ if ( ! $adding ) {
246
+ echo wpmtst_show_field_secondary( $key, $field );
247
+ echo wpmtst_show_field_admin_table( $key, $field );
248
+ }
249
+
250
+ ?>
251
+ </table>
252
+
253
+ <?php
254
+ if ( ! $adding ) {
255
+ echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
256
+ }
257
+ include 'partials/fields/field-controls.php';
258
+ ?>
259
+ </div><!-- .custom-field -->
260
+
261
+ <?php
262
+ $html = ob_get_contents();
263
+ ob_end_clean();
264
+
265
+ return $html;
266
+ }
267
+
268
+
269
+ /**
270
+ * Create the secondary inputs for a new custom field.
271
+ * Called after field type is chosen (Post or Custom).
272
+ *
273
+ * @param $key
274
+ * @param $field
275
+ *
276
+ * @return string
277
+ */
278
+ function wpmtst_show_field_secondary( $key, $field ) {
279
+ $html = '';
280
+
281
+ /*
282
+ * Required
283
+ */
284
+ if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
285
+ // Disable option if this is a core field like post_content.
286
+ if ( isset( $field['core'] ) && $field['core'] ) {
287
+ $disabled = ' disabled="disabled"';
288
+ } else {
289
+ $disabled = '';
290
+ }
291
+
292
+ $html .= '<tr class="field-secondary">' . "\n";
293
+ $html .= '<th>' . esc_html__( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
294
+ $html .= '<td>' . "\n";
295
+ if ( $disabled ) {
296
+ $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][required]" value="' . esc_attr( $field['required'] ) . '">';
297
+ $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
298
+ } else {
299
+ $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][required]" ' . checked( $field['required'], true, false ) . '>';
300
+ }
301
+ $html .= '</td>' . "\n";
302
+ $html .= '</tr>' . "\n";
303
+ }
304
+
305
+ /*
306
+ * Placeholder
307
+ */
308
+ if ( $field['show_placeholder_option'] ) {
309
+ if ( isset( $field['placeholder'] ) ) {
310
+ $html .= '<tr class="field-secondary">' . "\n";
311
+ $html .= '<th>' . esc_html__( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
312
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
313
+ $html .= '</tr>' . "\n";
314
+ }
315
+ }
316
+
317
+ /**
318
+ * Text (checkbox, radio)
319
+ *
320
+ * @since 2.23.0
321
+ */
322
+ if ( $field['show_text_option'] ) {
323
+ if ( isset( $field['text'] ) ) {
324
+ $html .= '<tr class="field-secondary">' . "\n";
325
+ $html .= '<th>' . esc_html__( 'Text', 'strong-testimonials' ) . '</th>' . "\n";
326
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . esc_html__( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
327
+ $html .= '</tr>' . "\n";
328
+ }
329
+ }
330
+
331
+ /*
332
+ * Before
333
+ */
334
+ $html .= '<tr class="field-secondary">' . "\n";
335
+ $html .= '<th>' . esc_html__( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
336
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
337
+ $html .= '</tr>' . "\n";
338
+
339
+ /*
340
+ * After
341
+ */
342
+ $html .= '<tr class="field-secondary">' . "\n";
343
+ $html .= '<th>' . esc_html__( 'After', 'strong-testimonials' ) . '</th>' . "\n";
344
+ $html .= '<td><input type="text" name="fields[' . esc_attr( $key ) . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
345
+ $html .= '</tr>' . "\n";
346
+
347
+ /*
348
+ * Default Form Value
349
+ */
350
+ if ( $field['show_default_options'] ) {
351
+ if ( isset( $field['default_form_value'] ) ) {
352
+ $html .= '<tr class="field-secondary">' . "\n";
353
+ $html .= '<th>' . esc_html__( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
354
+ $html .= '<td>' . "\n";
355
+
356
+ // TODO Replace this special handling
357
+ if ( 'rating' == $field['input_type'] ) {
358
+
359
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
360
+ $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
361
+ $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
362
+
363
+ } elseif ( 'checkbox' == $field['input_type'] ) {
364
+
365
+ $html .= '<label>';
366
+ $html .= '<input type="checkbox" name="fields[' . esc_attr( $key ) . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
367
+ $html .= '<span class="help inline">' . esc_html__( 'Checked by default.', 'strong-testimonials' ) . '</span>';
368
+ $html .= '</label>';
369
+
370
+ } else {
371
+
372
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
373
+ $html .= '<span class="help">' . esc_html__( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
374
+
375
+ }
376
+
377
+ $html .= '</td>' . "\n";
378
+ $html .= '</tr>' . "\n";
379
+ }
380
+ }
381
+
382
+ /*
383
+ * Default Display Value
384
+ */
385
+ if ( $field['show_default_options'] ) {
386
+ // TODO Replace this special handling for checkbox type
387
+ if ( 'checkbox' != $field['input_type'] ) {
388
+ if ( isset( $field['default_display_value'] ) ) {
389
+ $html .= '<tr class="field-secondary">' . "\n";
390
+ $html .= '<th>' . esc_html__( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
391
+ $html .= '<td>' . "\n";
392
+
393
+ // TODO Replace this special handling
394
+ if ( 'rating' == $field['input_type'] ) {
395
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
396
+ $html .= '<span class="help inline">' . esc_html__( 'stars', 'strong-testimonials' ) . '</span>';
397
+ } else {
398
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
399
+ }
400
+
401
+ $html .= '<span class="help">' . esc_html__( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
402
+ $html .= '</td>' . "\n";
403
+ $html .= '</tr>' . "\n";
404
+ }
405
+ }
406
+ }
407
+
408
+ /*
409
+ * Shortcode Options
410
+ */
411
+ if ( $field['show_shortcode_options'] ) {
412
+ if ( isset( $field['shortcode_on_form'] ) ) {
413
+ $html .= '<tr class="field-secondary">' . "\n";
414
+ $html .= '<th>' . esc_html__( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
415
+ $html .= '<td>' . "\n";
416
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
417
+ $html .= '</td>' . "\n";
418
+ $html .= '</tr>' . "\n";
419
+ }
420
+ if ( isset( $field['shortcode_on_display'] ) ) {
421
+ $html .= '<tr class="field-secondary">' . "\n";
422
+ $html .= '<th>' . esc_html__( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
423
+ $html .= '<td>' . "\n";
424
+ $html .= '<input type="text" name="fields[' . esc_attr( $key ) . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
425
+ $html .= '</td>' . "\n";
426
+ $html .= '</tr>' . "\n";
427
+ }
428
+ }
429
+
430
+ $html = apply_filters( 'wpmtst_fields_secondary', $html, $key, $field );
431
+
432
+ return $html;
433
+ }
434
+
435
+
436
+ /**
437
+ * Add type-specific [Admin Table] setting to form.
438
+ */
439
+ function wpmtst_show_field_admin_table( $key, $field ) {
440
+ // -------------------
441
+ // Show in Admin Table
442
+ // -------------------
443
+ if ( ! $field['show_admin_table_option'] ) {
444
+ $html = '<input type="hidden" name="fields[' . esc_attr( $key ) . '][show_admin_table_option]" value="' . esc_attr( $field['show_admin_table_option'] ) . '">';
445
+ return $html;
446
+ }
447
+
448
+ $html = '<tr class="field-admin-table">' . "\n";
449
+ $html .= '<th>' . esc_html__( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
450
+ $html .= '<td>' . "\n";
451
+ if ( $field['admin_table_option'] ) {
452
+ $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . esc_attr( $key ) . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
453
+ } else {
454
+ $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . esc_html__( 'required', 'strong-testimonials' ) . '</em>';
455
+ $html .= '<input type="hidden" name="fields[' . esc_attr( $key ) . '][admin_table]" value="' . esc_attr( $field['admin_table'] ) . '">';
456
+ }
457
+ $html .= '<span class="help inline">' . esc_html__( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
458
+ $html .= '</label>';
459
+ $html .= '</td>' . "\n";
460
+ $html .= '</tr>' . "\n";
461
+
462
+ return $html;
463
+ }
464
+
465
+
466
+ /**
467
+ * Add type-specific select options field
468
+ */
469
+ function wpmtst_show_field_select_options( $key, $field ) {
470
+
471
+ if( $field['input_type'] !== 'select' ) {
472
+ return;
473
+ }
474
+
475
+ ob_start();
476
+ include 'partials/fields/field-select-options.php';
477
+ return ob_get_clean();
478
+ }
479
+
480
+
481
+ /**
482
+ * Add hidden fields to form.
483
+ *
484
+ * @param $key
485
+ * @param $field
486
+ *
487
+ * @return string
488
+ */
489
+ function wpmtst_show_field_hidden( $key, $field ) {
490
+ $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
491
+
492
+ $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
493
+ $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
494
+ if ( isset( $field['action_input'] ) ) {
495
+ $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
496
+ }
497
+ if ( isset( $field['action_output'] ) ) {
498
+ $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
499
+ }
500
+ $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
501
+ $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
502
+ $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
503
+ $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
504
+ $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
505
+ $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
506
+ $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
507
+
508
+ if ( isset( $field['map'] ) ) {
509
+ $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
510
+ }
511
+
512
+ if ( isset( $field['core'] ) ) {
513
+ $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
514
+ }
515
+
516
+ return $html;
517
+ }
admin/form-preview.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
-
3
- function wpmtst_get_form_preview() {
4
- if ( ! isset( $_POST['fields'] ) ) exit;
5
-
6
- // parse_str decodes too; no need to use urldecode
7
- parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
-
9
- $new_fields = array();
10
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
-
12
- foreach ( $preview['fields'] as $key => $field ) {
13
- /*
14
- * Before merging onto base field, catch fields that are "off"
15
- * which the form does not submit. Otherwise, the default "on"
16
- * would override the requested (but not submitted) "off".
17
- */
18
- $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19
- $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
-
21
- $field = array_merge( $fields['field_base'], $field );
22
-
23
- if ( 'none' == $field['input_type'] ) {
24
- $field['input_type'] = 'text';
25
- }
26
-
27
- $field['name'] = sanitize_text_field( $field['name'] );
28
- $field['label'] = sanitize_text_field( $field['label'] );
29
- // TODO Replace this special handling
30
- if ( 'checkbox' == $field['input_type'] ) {
31
- $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32
- } else {
33
- $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34
- }
35
- $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36
- $field['before'] = sanitize_text_field( $field['before'] );
37
- $field['after'] = sanitize_text_field( $field['after'] );
38
-
39
- // add to fields array in display order
40
- $new_fields[] = $field;
41
- }
42
-
43
- ob_start();
44
- include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45
- $html = ob_get_contents();
46
- ob_end_clean();
47
- echo $html;
48
-
49
- exit;
50
- }
51
- add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
1
+ <?php
2
+
3
+ function wpmtst_get_form_preview() {
4
+ if ( ! isset( $_POST['fields'] ) ) exit;
5
+
6
+ // parse_str decodes too; no need to use urldecode
7
+ parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
8
+
9
+ $new_fields = array();
10
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
11
+
12
+ foreach ( $preview['fields'] as $key => $field ) {
13
+ /*
14
+ * Before merging onto base field, catch fields that are "off"
15
+ * which the form does not submit. Otherwise, the default "on"
16
+ * would override the requested (but not submitted) "off".
17
+ */
18
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
19
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
20
+
21
+ $field = array_merge( $fields['field_base'], $field );
22
+
23
+ if ( 'none' == $field['input_type'] ) {
24
+ $field['input_type'] = 'text';
25
+ }
26
+
27
+ $field['name'] = sanitize_text_field( $field['name'] );
28
+ $field['label'] = sanitize_text_field( $field['label'] );
29
+ // TODO Replace this special handling
30
+ if ( 'checkbox' == $field['input_type'] ) {
31
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
32
+ } else {
33
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
34
+ }
35
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
36
+ $field['before'] = sanitize_text_field( $field['before'] );
37
+ $field['after'] = sanitize_text_field( $field['after'] );
38
+
39
+ // add to fields array in display order
40
+ $new_fields[] = $field;
41
+ }
42
+
43
+ ob_start();
44
+ include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
45
+ $html = ob_get_contents();
46
+ ob_end_clean();
47
+ echo $html;
48
+
49
+ exit;
50
+ }
51
+ add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
admin/img/logo-long.svg CHANGED
@@ -1,91 +1,91 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="-59 183.8 7819.5 475.1" style="enable-background:new -59 183.8 7819.5 475.1;" xml:space="preserve">
5
- <g>
6
- <g>
7
- <path d="M105.4,403.1h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1c0-20.2,7.1-37.4,21.4-51.7
8
- c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5c0-4.9-1.8-9.2-5.4-12.8
9
- c-3.6-3.6-7.9-5.4-12.8-5.4H87.2c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3c-13.1,13.1-23.6,28.7-31.3,46.7
10
- c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6c15.2,0,28.2-5.3,38.8-16
11
- c10.7-10.7,16-23.6,16-38.8V457.9c0-15.2-5.3-28.2-16-38.8C133.6,408.4,120.7,403.1,105.4,403.1z"/>
12
- <path d="M400.1,419.1c-10.7-10.7-23.6-16-38.8-16h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1
13
- c0-20.2,7.1-37.4,21.4-51.7c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5
14
- c0-4.9-1.8-9.2-5.4-12.8c-3.6-3.6-7.9-5.4-12.8-5.4H343c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3
15
- c-13.1,13.1-23.6,28.7-31.3,46.7c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6
16
- c15.2,0,28.2-5.3,38.8-16c10.7-10.7,16-23.6,16-38.8V457.9C416.1,442.7,410.8,429.7,400.1,419.1z"/>
17
- </g>
18
- </g>
19
- <g>
20
- <path d="M852.4,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
21
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
22
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
23
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
24
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
25
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
26
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
27
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
28
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
29
- C891.6,617.3,872.9,620,852.4,620z"/>
30
- <path d="M1151,313.2h-115v-76.7h313.2v76.7h-115v301.3H1151V313.2z"/>
31
- <path d="M1412.9,236.6h172.8c47.9,0,84.6,12.8,110.2,38.3c21.6,21.6,32.4,50.4,32.4,86.4v1.1c0,30.6-7.5,55.5-22.4,74.8
32
- c-14.9,19.3-34.5,33.4-58.6,42.4l92.3,135h-97.2l-81-121h-1.1H1496v121h-83.2V236.6z M1580.3,420.2c20.5,0,36.3-4.9,47.3-14.6
33
- c11-9.7,16.5-22.7,16.5-38.9v-1.1c0-18-5.8-31.5-17.3-40.5c-11.5-9-27.5-13.5-48.1-13.5H1496v108.5H1580.3z"/>
34
- <path d="M1986.9,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
35
- c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
36
- c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
37
- c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
38
- C2043,615.9,2016.1,621,1986.9,621z M1988,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4c9.9-10.8,17.6-23.3,23.2-37.5
39
- c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8c-10.3-10.8-22.4-19.3-36.4-25.6
40
- c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4c-9.9,10.8-17.6,23.3-23.2,37.5
41
- c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8c10.3,10.8,22.3,19.4,36.2,25.6
42
- C1955.7,541.2,1971.1,544.4,1988,544.4z"/>
43
- <path d="M2262.3,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
44
- <path d="M2870.9,621c-29.5,0-56.4-4.9-80.7-14.6c-24.3-9.7-45.2-23.2-62.6-40.5c-17.5-17.3-31-37.8-40.8-61.6s-14.6-49.7-14.6-77.8
45
- v-1.1c0-27,4.9-52.3,14.8-75.9c9.9-23.6,23.7-44.3,41.3-62.1c17.6-17.8,38.5-31.9,62.6-42.1c24.1-10.3,50.6-15.4,79.4-15.4
46
- c16.9,0,32.3,1.2,46.2,3.5c13.9,2.3,26.7,5.7,38.6,10s23,9.7,33.5,16.2c10.4,6.5,20.5,13.9,30.2,22.1l-52.4,63.2
47
- c-7.2-6.1-14.4-11.5-21.6-16.2c-7.2-4.7-14.7-8.6-22.4-11.9c-7.7-3.2-16.1-5.8-25.1-7.6c-9-1.8-18.9-2.7-29.7-2.7
48
- c-15.1,0-29.3,3.2-42.4,9.5c-13.1,6.3-24.7,14.8-34.6,25.4c-9.9,10.6-17.6,23.1-23.2,37.3c-5.6,14.3-8.4,29.5-8.4,45.7v1.1
49
- c0,17.3,2.8,33.3,8.4,47.9c5.6,14.6,13.5,27.3,23.8,38.2c10.3,10.8,22.3,19.2,36.2,25.2c13.9,6,29.2,8.9,46.2,8.9
50
- c31,0,57.1-7.6,78.3-22.8v-54.4h-83.7v-71.8h164.2v164.2c-19.4,16.6-42.6,30.7-69.4,42.4C2936.1,615.2,2905.4,621,2870.9,621z"/>
51
- <path d="M3524.3,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
52
- <path d="M3786.2,236.6h284.6v74h-202.5v76.7h178.2v74h-178.2v79.4h205.2v74h-287.3V236.6z"/>
53
- <path d="M4283,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
54
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
55
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
56
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
57
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
58
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
59
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
60
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
61
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
62
- C4322.2,617.3,4303.5,620,4283,620z"/>
63
- <path d="M4581.6,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
64
- <path d="M4847.3,236.6h83.2v378h-83.2V236.6z"/>
65
- <path d="M5024.9,236.6h89.6l99.4,159.8l99.4-159.8h89.6v378h-82.1V367.8l-106.4,161.5h-2.2L5107,369.4v245.2h-82.1V236.6z"/>
66
- <path d="M5677.2,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
67
- c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
68
- c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
69
- c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
70
- C5733.3,615.9,5706.4,621,5677.2,621z M5678.3,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4
71
- c9.9-10.8,17.6-23.3,23.2-37.5c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8
72
- c-10.3-10.8-22.4-19.3-36.4-25.6c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4
73
- c-9.9,10.8-17.6,23.3-23.2,37.5c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8
74
- c10.3,10.8,22.3,19.4,36.2,25.6C5646,541.2,5661.4,544.4,5678.3,544.4z"/>
75
- <path d="M5952.6,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
76
- <path d="M6383,236.6h83.2v378H6383V236.6z"/>
77
- <path d="M6690.3,233.9h76.7l162,380.7H6842l-34.6-84.8h-159.8l-34.6,84.8h-84.8L6690.3,233.9z M6777.7,456.3l-50.2-122.6
78
- l-50.2,122.6H6777.7z"/>
79
- <path d="M6987.3,236.6h83.2v302.9h188.5v75.1h-271.6V236.6z"/>
80
- <path d="M7456.5,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
81
- c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
82
- c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
83
- c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
84
- c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
85
- c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
86
- c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
87
- c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
88
- c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
89
- C7495.7,617.3,7477,620,7456.5,620z"/>
90
- </g>
91
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="-59 183.8 7819.5 475.1" style="enable-background:new -59 183.8 7819.5 475.1;" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <path d="M105.4,403.1h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1c0-20.2,7.1-37.4,21.4-51.7
8
+ c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5c0-4.9-1.8-9.2-5.4-12.8
9
+ c-3.6-3.6-7.9-5.4-12.8-5.4H87.2c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3c-13.1,13.1-23.6,28.7-31.3,46.7
10
+ c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6c15.2,0,28.2-5.3,38.8-16
11
+ c10.7-10.7,16-23.6,16-38.8V457.9c0-15.2-5.3-28.2-16-38.8C133.6,408.4,120.7,403.1,105.4,403.1z"/>
12
+ <path d="M400.1,419.1c-10.7-10.7-23.6-16-38.8-16h-64c-7.6,0-14.1-2.7-19.4-8c-5.3-5.3-8-11.8-8-19.4v-9.1
13
+ c0-20.2,7.1-37.4,21.4-51.7c14.3-14.3,31.5-21.4,51.7-21.4h18.3c4.9,0,9.2-1.8,12.8-5.4c3.6-3.6,5.4-7.9,5.4-12.8v-36.5
14
+ c0-4.9-1.8-9.2-5.4-12.8c-3.6-3.6-7.9-5.4-12.8-5.4H343c-19.8,0-38.7,3.9-56.7,11.6c-18,7.7-33.5,18.1-46.7,31.3
15
+ c-13.1,13.1-23.6,28.7-31.3,46.7c-7.7,18-11.6,36.9-11.6,56.7v201c0,15.2,5.3,28.2,16,38.8c10.7,10.7,23.6,16,38.8,16h109.6
16
+ c15.2,0,28.2-5.3,38.8-16c10.7-10.7,16-23.6,16-38.8V457.9C416.1,442.7,410.8,429.7,400.1,419.1z"/>
17
+ </g>
18
+ </g>
19
+ <g>
20
+ <path d="M852.4,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
21
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
22
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
23
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
24
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
25
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
26
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
27
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
28
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
29
+ C891.6,617.3,872.9,620,852.4,620z"/>
30
+ <path d="M1151,313.2h-115v-76.7h313.2v76.7h-115v301.3H1151V313.2z"/>
31
+ <path d="M1412.9,236.6h172.8c47.9,0,84.6,12.8,110.2,38.3c21.6,21.6,32.4,50.4,32.4,86.4v1.1c0,30.6-7.5,55.5-22.4,74.8
32
+ c-14.9,19.3-34.5,33.4-58.6,42.4l92.3,135h-97.2l-81-121h-1.1H1496v121h-83.2V236.6z M1580.3,420.2c20.5,0,36.3-4.9,47.3-14.6
33
+ c11-9.7,16.5-22.7,16.5-38.9v-1.1c0-18-5.8-31.5-17.3-40.5c-11.5-9-27.5-13.5-48.1-13.5H1496v108.5H1580.3z"/>
34
+ <path d="M1986.9,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
35
+ c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
36
+ c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
37
+ c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
38
+ C2043,615.9,2016.1,621,1986.9,621z M1988,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4c9.9-10.8,17.6-23.3,23.2-37.5
39
+ c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8c-10.3-10.8-22.4-19.3-36.4-25.6
40
+ c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4c-9.9,10.8-17.6,23.3-23.2,37.5
41
+ c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8c10.3,10.8,22.3,19.4,36.2,25.6
42
+ C1955.7,541.2,1971.1,544.4,1988,544.4z"/>
43
+ <path d="M2262.3,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
44
+ <path d="M2870.9,621c-29.5,0-56.4-4.9-80.7-14.6c-24.3-9.7-45.2-23.2-62.6-40.5c-17.5-17.3-31-37.8-40.8-61.6s-14.6-49.7-14.6-77.8
45
+ v-1.1c0-27,4.9-52.3,14.8-75.9c9.9-23.6,23.7-44.3,41.3-62.1c17.6-17.8,38.5-31.9,62.6-42.1c24.1-10.3,50.6-15.4,79.4-15.4
46
+ c16.9,0,32.3,1.2,46.2,3.5c13.9,2.3,26.7,5.7,38.6,10s23,9.7,33.5,16.2c10.4,6.5,20.5,13.9,30.2,22.1l-52.4,63.2
47
+ c-7.2-6.1-14.4-11.5-21.6-16.2c-7.2-4.7-14.7-8.6-22.4-11.9c-7.7-3.2-16.1-5.8-25.1-7.6c-9-1.8-18.9-2.7-29.7-2.7
48
+ c-15.1,0-29.3,3.2-42.4,9.5c-13.1,6.3-24.7,14.8-34.6,25.4c-9.9,10.6-17.6,23.1-23.2,37.3c-5.6,14.3-8.4,29.5-8.4,45.7v1.1
49
+ c0,17.3,2.8,33.3,8.4,47.9c5.6,14.6,13.5,27.3,23.8,38.2c10.3,10.8,22.3,19.2,36.2,25.2c13.9,6,29.2,8.9,46.2,8.9
50
+ c31,0,57.1-7.6,78.3-22.8v-54.4h-83.7v-71.8h164.2v164.2c-19.4,16.6-42.6,30.7-69.4,42.4C2936.1,615.2,2905.4,621,2870.9,621z"/>
51
+ <path d="M3524.3,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
52
+ <path d="M3786.2,236.6h284.6v74h-202.5v76.7h178.2v74h-178.2v79.4h205.2v74h-287.3V236.6z"/>
53
+ <path d="M4283,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
54
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
55
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
56
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
57
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
58
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
59
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
60
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
61
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
62
+ C4322.2,617.3,4303.5,620,4283,620z"/>
63
+ <path d="M4581.6,313.2h-115v-76.7h313.2v76.7h-115v301.3h-83.2V313.2z"/>
64
+ <path d="M4847.3,236.6h83.2v378h-83.2V236.6z"/>
65
+ <path d="M5024.9,236.6h89.6l99.4,159.8l99.4-159.8h89.6v378h-82.1V367.8l-106.4,161.5h-2.2L5107,369.4v245.2h-82.1V236.6z"/>
66
+ <path d="M5677.2,621c-29.2,0-56-5.1-80.5-15.4c-24.5-10.3-45.6-24.1-63.5-41.6c-17.8-17.5-31.7-38-41.6-61.6
67
+ c-9.9-23.6-14.8-48.9-14.8-75.9v-1.1c0-27,5-52.3,15.1-75.9c10.1-23.6,24-44.3,41.8-62.1c17.8-17.8,39.1-31.9,63.7-42.1
68
+ c24.7-10.3,51.6-15.4,80.7-15.4s56,5.1,80.5,15.4c24.5,10.3,45.6,24.1,63.5,41.6c17.8,17.5,31.7,38,41.6,61.6
69
+ c9.9,23.6,14.8,48.9,14.8,75.9v1.1c0,27-5,52.3-15.1,75.9c-10.1,23.6-24,44.3-41.8,62.1c-17.8,17.8-39.1,31.9-63.7,42.1
70
+ C5733.3,615.9,5706.4,621,5677.2,621z M5678.3,544.4c16.6,0,31.9-3.1,45.9-9.2c14-6.1,26-14.6,35.9-25.4
71
+ c9.9-10.8,17.6-23.3,23.2-37.5c5.6-14.2,8.4-29.4,8.4-45.6v-1.1c0-16.2-2.8-31.5-8.4-45.9c-5.6-14.4-13.5-27-23.8-37.8
72
+ c-10.3-10.8-22.4-19.3-36.4-25.6c-14-6.3-29.3-9.4-45.9-9.4c-16.9,0-32.3,3.1-46.2,9.2c-13.9,6.1-25.7,14.6-35.6,25.4
73
+ c-9.9,10.8-17.6,23.3-23.2,37.5c-5.6,14.2-8.4,29.4-8.4,45.6v1.1c0,16.2,2.8,31.5,8.4,45.9c5.6,14.4,13.5,27,23.8,37.8
74
+ c10.3,10.8,22.3,19.4,36.2,25.6C5646,541.2,5661.4,544.4,5678.3,544.4z"/>
75
+ <path d="M5952.6,236.6h76.7l177.1,232.7V236.6h82.1v378h-70.7l-183.1-240.3v240.3h-82.1V236.6z"/>
76
+ <path d="M6383,236.6h83.2v378H6383V236.6z"/>
77
+ <path d="M6690.3,233.9h76.7l162,380.7H6842l-34.6-84.8h-159.8l-34.6,84.8h-84.8L6690.3,233.9z M6777.7,456.3l-50.2-122.6
78
+ l-50.2,122.6H6777.7z"/>
79
+ <path d="M6987.3,236.6h83.2v302.9h188.5v75.1h-271.6V236.6z"/>
80
+ <path d="M7456.5,620c-28.8,0-57.1-5-84.8-14.9c-27.7-9.9-52.9-25.1-75.6-45.6l49.1-58.9c17.3,14,35,25.2,53.2,33.5
81
+ c18.2,8.3,38.1,12.4,59.7,12.4c17.3,0,30.7-3.1,40.2-9.5c9.5-6.3,14.3-15,14.3-26.2v-1.1c0-5.4-1-10.2-3-14.3
82
+ c-2-4.1-5.8-8-11.4-11.6c-5.6-3.6-13.4-7.2-23.3-10.8c-9.9-3.6-22.8-7.4-38.7-11.3c-19.1-4.7-36.5-9.9-52-15.7
83
+ c-15.5-5.8-28.7-12.9-39.5-21.3c-10.8-8.5-19.2-19-25.2-31.6c-6-12.6-8.9-28.3-8.9-47v-1.1c0-17.3,3.2-32.8,9.7-46.7
84
+ c6.4-13.9,15.5-25.8,27.1-35.9c11.6-10.1,25.5-17.8,41.6-23.2c16.1-5.4,33.9-8.1,53.4-8.1c27.7,0,53.2,4.1,76.4,12.4
85
+ c23.2,8.3,44.5,20.2,64,35.6l-43.2,62.6c-16.9-11.5-33.5-20.6-49.7-27.3c-16.2-6.7-32.4-10-48.6-10s-28.4,3.2-36.5,9.5
86
+ c-8.1,6.3-12.2,14.1-12.2,23.5v1.1c0,6.1,1.2,11.4,3.5,15.9c2.3,4.5,6.6,8.6,12.7,12.1c6.1,3.6,14.5,7,25.2,10.3
87
+ c10.6,3.2,24.1,7,40.3,11.3c19.1,5,36.2,10.7,51.2,17c15,6.3,27.6,13.9,37.9,22.7c10.3,8.8,18,19.2,23.3,31.1
88
+ c5.2,11.9,7.9,26.1,7.9,42.7v1.1c0,18.7-3.4,35.4-10.2,50c-6.8,14.6-16.3,26.8-28.4,36.7c-12.2,9.9-26.7,17.5-43.5,22.7
89
+ C7495.7,617.3,7477,620,7456.5,620z"/>
90
+ </g>
91
+ </svg>
admin/js/addon-licenses.js CHANGED
@@ -1,79 +1,79 @@
1
- /**
2
- * Add-on License Activation
3
- */
4
- (function ($) {
5
-
6
- $.fn.showInlineBlock = function () {
7
- return this.css('display', 'inline-block');
8
- };
9
-
10
- $("td.status").on("click", function () {
11
- $(this).children(".ajax-done").hide();
12
- $(this).children(".indicator").addClass("doing-ajax");
13
- });
14
-
15
- /**
16
- * Activate license
17
- */
18
- $(".activator").on("click", function () {
19
-
20
- var parent = $(this).closest("td");
21
- var status = parent.parent().find("input[name$='[license][status]']");
22
- parent.find(".response").html("").removeClass("activation-error");
23
-
24
- $.get(ajaxurl, {
25
- 'action': 'wpmtst_activate_license',
26
- 'plugin': parent.data("addon"),
27
- 'security': strongAddonAdmin.ajax_nonce
28
- },
29
- function (response) {
30
- parent.find(".indicator").removeClass("doing-ajax");
31
- if (0 == response) {
32
- response = {failure: true, data: strongAddonAdmin.errorMessage};
33
- }
34
- if (response.success) {
35
- parent.find(".addon-inactive").hide();
36
- parent.find(".addon-active").showInlineBlock();
37
- status.val(response.data);
38
- } else {
39
- parent.find(".addon-active").hide();
40
- parent.find(".addon-inactive").showInlineBlock();
41
- parent.find(".response").html(response.data).addClass("activation-error");
42
- status.val('');
43
- }
44
- });
45
-
46
- });
47
-
48
-
49
- /**
50
- * Deactivate license
51
- */
52
- $(".deactivator").on("click", function () {
53
-
54
- var parent = $(this).closest("td");
55
- parent.find(".response").html("").removeClass("activation-error");
56
-
57
- $.get(ajaxurl, {
58
- 'action': 'wpmtst_deactivate_license',
59
- 'plugin': parent.data("addon"),
60
- 'security': strongAddonAdmin.ajax_nonce
61
- },
62
- function (response) {
63
- parent.find(".indicator").removeClass("doing-ajax");
64
- if (0 == response) {
65
- response = {failure: true, data: strongAddonAdmin.errorMessage};
66
- }
67
- if (response.success) {
68
- parent.find(".addon-active").hide();
69
- parent.find(".addon-inactive").showInlineBlock();
70
- } else {
71
- parent.find(".addon-inactive").hide();
72
- parent.find(".addon-active").showInlineBlock();
73
- parent.find(".response").html(response.data).addClass("activation-error");
74
- }
75
- });
76
-
77
- });
78
-
79
- })(jQuery);
1
+ /**
2
+ * Add-on License Activation
3
+ */
4
+ (function ($) {
5
+
6
+ $.fn.showInlineBlock = function () {
7
+ return this.css('display', 'inline-block');
8
+ };
9
+
10
+ $("td.status").on("click", function () {
11
+ $(this).children(".ajax-done").hide();
12
+ $(this).children(".indicator").addClass("doing-ajax");
13
+ });
14
+
15
+ /**
16
+ * Activate license
17
+ */
18
+ $(".activator").on("click", function () {
19
+
20
+ var parent = $(this).closest("td");
21
+ var status = parent.parent().find("input[name$='[license][status]']");
22
+ parent.find(".response").html("").removeClass("activation-error");
23
+
24
+ $.get(ajaxurl, {
25
+ 'action': 'wpmtst_activate_license',
26
+ 'plugin': parent.data("addon"),
27
+ 'security': strongAddonAdmin.ajax_nonce
28
+ },
29
+ function (response) {
30
+ parent.find(".indicator").removeClass("doing-ajax");
31
+ if (0 == response) {
32
+ response = {failure: true, data: strongAddonAdmin.errorMessage};
33
+ }
34
+ if (response.success) {
35
+ parent.find(".addon-inactive").hide();
36
+ parent.find(".addon-active").showInlineBlock();
37
+ status.val(response.data);
38
+ } else {
39
+ parent.find(".addon-active").hide();
40
+ parent.find(".addon-inactive").showInlineBlock();
41
+ parent.find(".response").html(response.data).addClass("activation-error");
42
+ status.val('');
43
+ }
44
+ });
45
+
46
+ });
47
+
48
+
49
+ /**
50
+ * Deactivate license
51
+ */
52
+ $(".deactivator").on("click", function () {
53
+
54
+ var parent = $(this).closest("td");
55
+ parent.find(".response").html("").removeClass("activation-error");
56
+
57
+ $.get(ajaxurl, {
58
+ 'action': 'wpmtst_deactivate_license',
59
+ 'plugin': parent.data("addon"),
60
+ 'security': strongAddonAdmin.ajax_nonce
61
+ },
62
+ function (response) {
63
+ parent.find(".indicator").removeClass("doing-ajax");
64
+ if (0 == response) {
65
+ response = {failure: true, data: strongAddonAdmin.errorMessage};
66
+ }
67
+ if (response.success) {
68
+ parent.find(".addon-active").hide();
69
+ parent.find(".addon-inactive").showInlineBlock();
70
+ } else {
71
+ parent.find(".addon-inactive").hide();
72
+ parent.find(".addon-active").showInlineBlock();
73
+ parent.find(".response").html(response.data).addClass("activation-error");
74
+ }
75
+ });
76
+
77
+ });
78
+
79
+ })(jQuery);
admin/js/admin-compat.js CHANGED
@@ -1,130 +1,130 @@
1
- /**
2
- * Compatibility settings tab
3
- */
4
-
5
- ;(function ($) {
6
-
7
- var currentSettings = {}
8
- var quick = 200
9
-
10
- // Store current setting(s)
11
- function saveCurrentSettings () {
12
- $('[data-radio-group]').each(function (index, el) {
13
- var radioGroup = $(this).data('radioGroup')
14
- currentSettings[radioGroup] = {
15
- value: $(this).find(':checked').val(),
16
- forced: false
17
- }
18
- })
19
- }
20
-
21
- // Update display based on current selections
22
- function updateDisplay () {
23
- // matchMethodSetting()
24
- highlightRadioLabel()
25
- toggle()
26
- }
27
-
28
- // Toggle dependent inputs
29
- function toggle () {
30
- $('[data-group]').each(function (index, el) {
31
- var group = $(this).data('group')
32
- var $sub = $("[data-sub='" + group + "']")
33
- if ($(this).is(':checked')) {
34
- $sub.fadeIn()
35
- } else {
36
- $sub.fadeOut(quick)
37
- }
38
- })
39
- }
40
-
41
- // Update available options --- not currently used
42
- /*
43
- function matchMethodSetting () {
44
- if ($('#prerender-current').is(':checked')) {
45
- saveCurrentSettings()
46
- $('#method-none').prop('checked', true)
47
- $('#method-universal').prop('disabled', true)
48
- $('#method-observer').prop('disabled', true)
49
- $('#method-event').prop('disabled', true)
50
- $('#method-script').prop('disabled', true)
51
- currentSettings['method'].forced = true
52
- } else {
53
- if (currentSettings['method'].forced) {
54
- $('#method-' + currentSettings['method'].value).prop('checked', true)
55
- $('#method-universal').prop('disabled', false)
56
- $('#method-observer').prop('disabled', false)
57
- $('#method-event').prop('disabled', false)
58
- $('#method-script').prop('disabled', false)
59
- currentSettings['method'].forced = false
60
- }
61
- }
62
- }
63
- */
64
-
65
- // UI
66
- function highlightRadioLabel () {
67
- $('input:radio:checked').closest('label').addClass('current')
68
- $('input:radio:not(:checked)').closest('label').removeClass('current')
69
- }
70
-
71
- // Number spinner
72
- function initSpinner () {
73
- $("input[type='number']").each(function () {
74
- $(this).number();
75
- });
76
- }
77
-
78
- // Presets
79
- function setScenario1() {
80
- $('#page-loading-general').click()
81
- $('#prerender-all').click().prop('checked', true)
82
- $('#method-universal').click().prop('checked', true)
83
- }
84
-
85
- function setScenarioDefault() {
86
- $('#prerender-current').click()
87
- $('#method-none').click()
88
- }
89
-
90
- // Listen for change
91
- $('.form-table').on('change', function (e) {
92
- updateDisplay()
93
- var currentType = $("input[name='wpmtst_compat_options[page_loading]']:checked").val()
94
- switch (currentType) {
95
- case 'general':
96
- setScenario1()
97
- break;
98
- case 'advanced':
99
- break;
100
- default:
101
- setScenarioDefault()
102
- }
103
- })
104
-
105
- // Listen for presets
106
- $('#set-scenario-1').on('click', function(e) {
107
- $(this).blur()
108
- setScenario1()
109
- e.preventDefault()
110
- })
111
-
112
- // Listen for [Add Row]
113
- $('#add-pair').on('click', function (e) {
114
- var $this = $(this);
115
- var key = $this.closest('.lazyload-pairs').find('.pair').length;
116
- var data = {
117
- 'action': 'wpmtst_add_lazyload_pair',
118
- 'key': key,
119
- };
120
- $.get(ajaxurl, data, function (response) {
121
- $this.parent().before(response.data).prev().find('input').first().focus();
122
- });
123
- });
124
-
125
- // Start
126
- saveCurrentSettings()
127
- updateDisplay()
128
- initSpinner()
129
-
130
- })(jQuery)
1
+ /**
2
+ * Compatibility settings tab
3
+ */
4
+
5
+ ;(function ($) {
6
+
7
+ var currentSettings = {}
8
+ var quick = 200
9
+
10
+ // Store current setting(s)
11
+ function saveCurrentSettings () {
12
+ $('[data-radio-group]').each(function (index, el) {
13
+ var radioGroup = $(this).data('radioGroup')
14
+ currentSettings[radioGroup] = {
15
+ value: $(this).find(':checked').val(),
16
+ forced: false
17
+ }
18
+ })
19
+ }
20
+
21
+ // Update display based on current selections
22
+ function updateDisplay () {
23
+ // matchMethodSetting()
24
+ highlightRadioLabel()
25
+ toggle()
26
+ }
27
+
28
+ // Toggle dependent inputs
29
+ function toggle () {
30
+ $('[data-group]').each(function (index, el) {
31
+ var group = $(this).data('group')
32
+ var $sub = $("[data-sub='" + group + "']")
33
+ if ($(this).is(':checked')) {
34
+ $sub.fadeIn()
35
+ } else {
36
+ $sub.fadeOut(quick)
37
+ }
38
+ })
39
+ }
40
+
41
+ // Update available options --- not currently used
42
+ /*
43
+ function matchMethodSetting () {
44
+ if ($('#prerender-current').is(':checked')) {
45
+ saveCurrentSettings()
46
+ $('#method-none').prop('checked', true)
47
+ $('#method-universal').prop('disabled', true)
48
+ $('#method-observer').prop('disabled', true)
49
+ $('#method-event').prop('disabled', true)
50
+ $('#method-script').prop('disabled', true)
51
+ currentSettings['method'].forced = true
52
+ } else {
53
+ if (currentSettings['method'].forced) {
54
+ $('#method-' + currentSettings['method'].value).prop('checked', true)
55
+ $('#method-universal').prop('disabled', false)
56
+ $('#method-observer').prop('disabled', false)
57
+ $('#method-event').prop('disabled', false)
58
+ $('#method-script').prop('disabled', false)
59
+ currentSettings['method'].forced = false
60
+ }
61
+ }
62
+ }
63
+ */
64
+
65
+ // UI
66
+ function highlightRadioLabel () {
67
+ $('input:radio:checked').closest('label').addClass('current')
68
+ $('input:radio:not(:checked)').closest('label').removeClass('current')
69
+ }
70
+
71
+ // Number spinner
72
+ function initSpinner () {
73
+ $("input[type='number']").each(function () {
74
+ $(this).number();
75
+ });
76
+ }
77
+
78
+ // Presets
79
+ function setScenario1() {
80
+ $('#page-loading-general').click()
81
+ $('#prerender-all').click().prop('checked', true)
82
+ $('#method-universal').click().prop('checked', true)
83
+ }
84
+
85
+ function setScenarioDefault() {
86
+ $('#prerender-current').click()
87
+ $('#method-none').click()
88
+ }
89
+
90
+ // Listen for change
91
+ $('.form-table').on('change', function (e) {
92
+ updateDisplay()
93
+ var currentType = $("input[name='wpmtst_compat_options[page_loading]']:checked").val()
94
+ switch (currentType) {
95
+ case 'general':
96
+ setScenario1()
97
+ break;
98
+ case 'advanced':
99
+ break;
100
+ default:
101
+ setScenarioDefault()
102
+ }
103
+ })
104
+
105
+ // Listen for presets
106
+ $('#set-scenario-1').on('click', function(e) {
107
+ $(this).blur()
108
+ setScenario1()
109
+ e.preventDefault()
110
+ })
111
+
112
+ // Listen for [Add Row]
113
+ $('#add-pair').on('click', function (e) {
114
+ var $this = $(this);
115
+ var key = $this.closest('.lazyload-pairs').find('.pair').length;
116
+ var data = {
117
+ 'action': 'wpmtst_add_lazyload_pair',
118
+ 'key': key,
119
+ };
120
+ $.get(ajaxurl, data, function (response) {
121
+ $this.parent().before(response.data).prev().find('input').first().focus();
122
+ });
123
+ });
124
+
125
+ // Start
126
+ saveCurrentSettings()
127
+ updateDisplay()
128
+ initSpinner()
129
+
130
+ })(jQuery)
admin/js/admin-fields.js CHANGED
@@ -1,603 +1,603 @@
1
- /**
2
- * Strong Testimonials Custom Fields Editor
3
- *
4
- * @namespace wpmtstAdmin
5
- * @namespace wpmtstAdmin.newField
6
- */
7
-
8
- // Function to get the Max value in Array
9
- Array.max = function (array) {
10
- return Math.max.apply(Math, array);
11
- };
12
-
13
- // Convert "A String" to "a_string"
14
- function sanitizeName(label) {
15
- return label.trim().replace(/\W/g, " ").replace(/\s+/g, "_").toLowerCase();
16
- }
17
-
18
- (function ($) {
19
-
20
- /**
21
- * If open, scroll field into view.
22
- * If closed, scroll all the way up.
23
- *
24
- * @returns {jQuery}
25
- */
26
- $.fn.scrollUp = function () {
27
- var containerOffset;
28
- this.each(function () {
29
- containerOffset = 0;
30
- if ($(this).hasClass("open")) {
31
- containerOffset = parseInt($(this).offset().top) - 72;
32
- }
33
- $("html, body").animate({scrollTop: containerOffset}, 800);
34
- });
35
-
36
- return this;
37
- };
38
-
39
- /**
40
- * Replace the field type selector with its value. Better than readonly.
41
- *
42
- * @returns {jQuery}
43
- */
44
- $.fn.replaceSelect = function () {
45
- this.each(function () {
46
- if ($(this).hasClass("open")) {
47
- $(this).find("select.field-type").each(function (index, el) {
48
- $(el).replaceWith(el.value);
49
- });
50
- }
51
- });
52
-
53
- return this;
54
- }
55
-
56
- /**
57
- * Initialize
58
- */
59
- var catCount = 0;
60
- getCatCount();
61
-
62
- var $theForm = $("#wpmtst-custom-fields-form");
63
- var $fieldList = $("#custom-field-list");
64
-
65
- formPreview();
66
- toggleCategoryFields();
67
-
68
- /**
69
- * Sortable
70
- */
71
- $fieldList.sortable({
72
- placeholder: "sortable-placeholder",
73
- forcePlaceholderSize: true,
74
- handle: ".handle",
75
- cursor: "move",
76
- update: function (event, ui) {
77
- dismissNotice();
78
- formPreview();
79
- }
80
- });
81
-
82
- /**
83
- * ------------------------------------------------------------
84
- * Events
85
- * ------------------------------------------------------------
86
- */
87
-
88
- /**
89
- * Any changes.
90
- */
91
- $theForm.on("change", "input", function () {
92
- dismissNotice();
93
- formPreview();
94
- });
95
-
96
- /**
97
- * Disable buttons on submit.
98
- * Thanks https://stackoverflow.com/a/25651260/51600
99
- */
100
- $theForm.submit(function(){
101
- $('#field-group-actions').find('.button').each(function (index) {
102
- // Create a disabled clone of the submit button
103
- $(this).clone(false).removeAttr('id').prop('disabled', true).insertBefore($(this));
104
- // Hide the actual submit button and move it to the beginning of the form
105
- $(this).hide();
106
- });
107
- });
108
-
109
- /**
110
- * Save Changes
111
- */
112
- $('#submit-form').on('click',function(e){
113
-
114
- // Validate field type
115
- $("select.field-type").each(function (index) {
116
- if ('none' === this.value) {
117
- $(this).closest('tr').addClass('form-error');
118
- $(this).parent().find('.form-error-text').show();
119
- var $parent = $(this).closest("li");
120
- if (!$parent.hasClass("open")) {
121
- $parent.find("a.field").click();
122
- }
123
- $(this).focus();
124
- e.preventDefault();
125
- } else {
126
- $(this).closest('tr').removeClass('form-error');
127
- $(this).parent().find('.form-error-text').hide();
128
- }
129
- });
130
-
131
- // Validate field name
132
- $("input.field-name").each(function (index) {
133
- if ('name' === $(this).val() || 'date' === $(this).val()) {
134
- $(this).closest('tr').addClass('form-error');
135
- $(this).parent().find('.field-name-help.important').addClass('form-error-text');
136
- var $parent = $(this).closest("li");
137
- if (!$parent.hasClass("open")) {
138
- $parent.find("a.field").click();
139
- }
140
- $(this).focus();
141
- e.preventDefault();
142
- } else {
143
- $(this).closest('tr').removeClass('form-error');
144
- $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
145
- }
146
- });
147
-
148
- });
149
-
150
- /**
151
- * Cancel Changes
152
- */
153
- $('#reset').on('click',function(e){
154
- $theForm.submit();
155
- });
156
-
157
- /**
158
- * Restore Defaults
159
- */
160
- $('#restore-defaults').on('click',function(e){
161
- if (confirm("Restore the default fields?")) {
162
- $theForm.submit();
163
- } else {
164
- $(this).blur();
165
- return false;
166
- }
167
- });
168
-
169
- /**
170
- * Prevent single click on handle from opening accordion
171
- */
172
- $fieldList.on("click", "span.handle", function (e) {
173
- e.stopImmediatePropagation();
174
- e.preventDefault();
175
- });
176
-
177
- /**
178
- * Open/close
179
- */
180
- $fieldList.on("click", "span.link", function () {
181
- toggleField($(this).closest("li"));
182
- return false;
183
- });
184
-
185
- /**
186
- * Validate field label
187
- */
188
- $fieldList.on("change blur", "input.field-label", function () {
189
- var newLabel = $(this).val().trim();
190
- // fill in blank label
191
- if ('' === newLabel) {
192
- newLabel = wpmtstAdmin.newField;
193
- }
194
- $(this).val(newLabel);
195
-
196
- var $parent = $(this).closest("li");
197
- var fieldIndex = $parent.index();
198
-
199
- // update parent list item
200
- $parent.find("a.field").html(newLabel);
201
-
202
- // fill in blank field name
203
- var $fieldName = $parent.find("input.field-name");
204
- if ('new_field' === $fieldName.val()) {
205
- $fieldName.val(getUniqueName(newLabel, fieldIndex)).change();
206
- }
207
- });
208
-
209
- /**
210
- * Validate field name
211
- */
212
- $fieldList.on("change", "input.field-name", function () {
213
- var fieldName = $(this).val();
214
- var $parent = $(this).closest("li");
215
- var fieldIndex = $parent.index();
216
-
217
- if (fieldName) {
218
- $(this).val(getUniqueName(fieldName, fieldIndex));
219
- } else {
220
- var fieldLabel = $(this).closest(".field-table").find(".field-label").val();
221
- $(this).val(getUniqueName(fieldLabel, fieldIndex));
222
- }
223
-
224
- // Check new name, not initial value
225
- if ('name' === $(this).val() || 'date' === $(this).val()) {
226
- $(this).closest('tr').addClass('form-error');
227
- $(this).parent().find('.field-name-help.important').addClass('form-error-text');
228
- $(this).focus()
229
- return false;
230
- } else {
231
- $(this).closest('tr').removeClass('form-error');
232
- $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
233
- }
234
- });
235
-
236
- /**
237
- * Delete field
238
- */
239
- $fieldList.on("click", ".delete-field", function () {
240
- $(this).blur();
241
- dismissNotice();
242
- var thisField = $(this).closest("li");
243
- var thisLabel = thisField.find(".field").text();
244
- if (confirm('Delete "' + thisLabel + '"?')) {
245
- thisField.fadeOut(function () {
246
- $.when(thisField.remove()).then(function () {
247
- formPreview();
248
- toggleCategoryFields();
249
- $("#add-field, #submit").removeAttr("disabled");
250
- })
251
- });
252
- }
253
- });
254
-
255
- /**
256
- * Close field
257
- */
258
- $fieldList.on("click", "span.close-field a", function () {
259
- toggleField($(this).closest("li"));
260
- return false;
261
- });
262
-
263
- /**
264
- * Add new field
265
- */
266
- $("#add-field").click(function () {
267
- dismissNotice();
268
- var keys = $fieldList.find("li").map(function () {
269
- var key_id = $(this).attr("id");
270
- return key_id.substr(key_id.lastIndexOf("-") + 1);
271
- }).get();
272
- var nextKey = Array.max(keys) + 1;
273
-
274
- var data = {
275
- 'action': 'wpmtst_add_field',
276
- 'nextKey': nextKey,
277
- 'fieldClass': null,
278
- 'fieldType': null,
279
- 'security': wpmtstAdmin.ajax_nonce
280
- };
281
- $.get(ajaxurl, data, function (response) {
282
- $("#add-field, #submit").attr("disabled", "disabled");
283
-
284
- // create list item
285
- var $li = $('<li id="field-' + nextKey + '" data-status="new">').append(response);
286
-
287
- // hide elements until Type is selected
288
- $li.find('.field-label-row').hide();
289
- $li.find('.field-name-row').hide();
290
- $li.find("span.close-field").hide();
291
-
292
- // append to list
293
- $.when($fieldList.append($li)).then(function () {
294
- formPreview();
295
- togglePostFields();
296
- toggleCategoryFields();
297
-
298
- // click it to open
299
- $li.find("span.link").click();
300
- });
301
- });
302
- });
303
-
304
- /**
305
- * Field type change
306
- */
307
- $fieldList.on("change", ".field-type", function (e) {
308
- var fieldType = $(this).val();
309
- var $table = $(this).closest("table");
310
- var $parent = $(this).closest('li');
311
-
312
- if ($parent.data('status') !== 'new') {
313
- $table.find(".field-secondary, .field-admin-table").remove();
314
- }
315
-
316
- if ('none' === fieldType) {
317
- $parent.find('.field-label-row').hide();
318
- $parent.find('.field-name-row').hide();
319
-
320
- // Hide "Close" link
321
- $parent.find("span.close-field").hide();
322
- $("#add-field, #submit").attr("disabled", "disabled");
323
- return;
324
- }
325
- $parent.find('tr').removeClass('form-error');
326
- $parent.find('.form-error-text').hide();
327
-
328
- var key_id = $parent.attr("id");
329
- var key = key_id.substr(key_id.lastIndexOf("-") + 1);
330
-
331
- var $fieldLabel = $parent.find('input.field-label');
332
- var $fieldName = $parent.find('input.field-name');
333
- var fieldIndex = $parent.index();
334
-
335
- // get type of field from its optgroup
336
- var fieldOption = $(this).find("option[value='" + fieldType + "']");
337
- var fieldClass = fieldOption.closest("optgroup").attr("class");
338
-
339
- switch (fieldClass) {
340
-
341
- case 'post':
342
- $parent.find('.field-label-row').show();
343
- $parent.find('.field-name-row').show();
344
-
345
- // Force values if selecting a Post field.
346
- if (fieldType === 'post_title') {
347
- $fieldLabel.val('Testimonial Title');
348
- $fieldName.val('post_title').attr('disabled', 'disabled');
349
- }
350
- else if (fieldType === 'featured_image') {
351
- $fieldLabel.val('Photo');
352
- $fieldName.val('featured_image').attr('disabled', 'disabled');
353
- }
354
- else if (fieldType === 'post_content') {
355
- $fieldLabel.val('Testimonial');
356
- $fieldName.val('post_content').attr('disabled', 'disabled');
357
- }
358
- // move value to hidden input
359
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
360
- // hide help message
361
- $parent.find(".field-name-help").hide();
362
- break;
363
-
364
- case 'optional':
365
- $parent.find('.field-label-row').show();
366
- $parent.find('.field-name-row').show();
367
-
368
- if ('category' === fieldType.split('-')[0]) {
369
- $fieldName.val('category').attr('disabled', 'disabled');
370
- // move value to hidden input
371
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
372
- // hide help message
373
- $parent.find(".field-name-help").hide();
374
- }
375
- var forceName = fieldOption.data('force-name');
376
- if (forceName) {
377
- $fieldName.val(forceName).attr('disabled', 'disabled');
378
- // move value to hidden input
379
- $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
380
- // hide help message
381
- $parent.find(".field-name-help").hide();
382
- }
383
- $fieldLabel.val(wpmtstAdmin.newField).focus().select();
384
- break;
385
-
386
- default:
387
- $parent.find('.field-label-row').show();
388
- $parent.find('.field-name-row').show();
389
-
390
- // TODO DRY
391
- $fieldLabel.val(wpmtstAdmin.newField).focus().select();
392
- $fieldName.val(getUniqueName($fieldLabel.val(), fieldIndex));
393
- $fieldName.removeAttr('disabled');
394
- $parent.find(".field-name-help").show();
395
- }
396
-
397
- // secondary form fields
398
- var data1 = {
399
- 'action': 'wpmtst_add_field_2',
400
- 'nextKey': key,
401
- 'fieldClass': fieldClass,
402
- 'fieldType': fieldType,
403
- 'security': wpmtstAdmin.ajax_nonce
404
- };
405
-
406
- var ajax1 = $.get(ajaxurl, data1, function (response) {
407
- $table.append(response);
408
- $( document ).trigger( "st-done-loading-secondary-fields", [ $table ] );
409
- });
410
-
411
-
412
- // admin-table field
413
- var data2 = {
414
- 'action': 'wpmtst_add_field_4',
415
- 'nextKey': key,
416
- 'fieldClass': fieldClass,
417
- 'fieldType': fieldType,
418
- 'security': wpmtstAdmin.ajax_nonce
419
- };
420
-
421
- var ajax2 = ajax1.then(function () {
422
- return $.get(ajaxurl, data2, function (response) {
423
- $table.append(response);
424
- });
425
- });
426
-
427
-
428
- // hidden inputs
429
- var data3 = {
430
- 'action': 'wpmtst_add_field_3',
431
- 'nextKey': key,
432
- 'fieldClass': fieldClass,
433
- 'fieldType': fieldType,
434
- 'security': wpmtstAdmin.ajax_nonce
435
- };
436
-
437
- var ajax3 = ajax2.then(function () {
438
- return $.get(ajaxurl, data3, function (response) {
439
- $table.parent().append(response);
440
- });
441
- });
442
-
443
- ajax3.done(function () {
444
-
445
- formPreview();
446
- $("#add-field, #submit").removeAttr("disabled");
447
-
448
- // Successfully added so show "Close" link
449
- $("span.close-field").show();
450
-
451
- $parent
452
- // Reset temporary status
453
- .removeData("status").removeAttr("data-status")
454
- // update parent list item
455
- .find(".custom-field-header a.field").html($fieldLabel.val()).end()
456
- // update hidden [record_type] input
457
- .find('input[name$="[record_type]"]').val(fieldClass);
458
-
459
- });
460
-
461
- });
462
-
463
- /**
464
- * ------------------------------------------------------------
465
- * Functions
466
- * ------------------------------------------------------------
467
- */
468
-
469
- function getCatCount() {
470
- $.get(ajaxurl, {
471
- 'action': 'wpmtst_get_cat_count',
472
- 'security': wpmtstAdmin.ajax_nonce
473
- },
474
- function (response) {
475
- catCount = parseInt(response);
476
- });
477
- }
478
-
479
- // Preview
480
- function formPreview() {
481
- var formFields = $theForm.find("[name^='fields']");
482
- if (!formFields.length) return;
483
-
484
- var data = {
485
- 'action': 'wpmtst_get_form_preview',
486
- 'fields': formFields.serialize()
487
- };
488
- $.post(ajaxurl, data, function (response) {
489
- var newDiv = $("<div></div>").hide().html(response)
490
- $("#fields-editor-preview")
491
- .children().first()
492
- .after(newDiv)
493
- .fadeOut(300, function () {
494
- newDiv.show();
495
- $(this).remove();
496
- });
497
- });
498
- }
499
-
500
- /*
501
- * Disable any Post fields already in use.
502
- *
503
- * Doing this client-side so a Post field can be added
504
- * but not saved before adding more fields;
505
- * i.e. add multiple fields of either type without risk
506
- * of duplicating single Post fields before clicking "Save".
507
- */
508
- function togglePostFields() {
509
- $fieldList.find('input[name$="[record_type]"]').each(function () {
510
- var $parent = $(this).closest("li");
511
- var value = $(this).val();
512
- if ("post" === value) {
513
- var name = $parent.find(".field-name").val();
514
- $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
515
- }
516
- });
517
- }
518
-
519
- // Only allow one category field
520
- function toggleCategoryFields() {
521
- var categoryInUse = false;
522
-
523
- $fieldList.find('input[name$="[record_type]"]').each(function () {
524
- var $parent = $(this).closest("li");
525
- var value = $(this).val();
526
- if ('optional' === value) {
527
- var fieldType = $parent.find('input[name$="[input_type]"]').val();
528
- if (!categoryInUse) {
529
- categoryInUse = ( 'category' === fieldType.split('-')[0] );
530
- }
531
- }
532
- });
533
-
534
- var $options = $fieldList.find('option[value^="category"]');
535
- if (categoryInUse) {
536
- $options.each(function () {
537
- var text = $(this).text();
538
- $(this)
539
- .attr("disabled", "disabled")
540
- .text(text + ' ' + wpmtstAdmin.inUse)
541
- .data('origText', text);
542
- });
543
- }
544
- else if (0 === catCount) {
545
- $options.each(function () {
546
- var text = $(this).text();
547
- $(this)
548
- .attr("disabled", "disabled")
549
- .text(text + ' ' + wpmtstAdmin.noneFound)
550
- .data('origText', text);
551
- });
552
- } else {
553
- $options.each(function () {
554
- $(this)
555
- .removeAttr("disabled")
556
- .text($(this).data('origText'));
557
- });
558
- }
559
- }
560
-
561
- // Actions on opening/closing the field
562
- function toggleField($field) {
563
- $field.replaceSelect()
564
- .toggleClass("open")
565
- .scrollUp()
566
- .find("span.link")
567
- .toggleClass("open")
568
- .end()
569
- .find(".custom-field")
570
- .toggleClass("open")
571
- .slideToggle()
572
- .find(".first-field")
573
- .focus();
574
- }
575
-
576
- // Build a unique name
577
- function getUniqueName(fieldName, fieldIndex) {
578
- fieldName = sanitizeName(fieldName);
579
-
580
- // Get names of *other* fields
581
- var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
582
- return this.value;
583
- }).get();
584
-
585
- names = names.filter(function (x) {
586
- return (x !== (undefined || ''));
587
- });
588
-
589
- var uniqueName = fieldName;
590
- var i = 2;
591
-
592
- while ($.inArray(uniqueName, names) >= 1) {
593
- uniqueName = fieldName + '_' + i++;
594
- }
595
- return uniqueName;
596
- }
597
-
598
- // Dismiss the "Fields saved" notice.
599
- function dismissNotice() {
600
- $('.wpmtst.notice').find(".notice-dismiss").click();
601
- }
602
-
603
- })(jQuery);
1
+ /**
2
+ * Strong Testimonials Custom Fields Editor
3
+ *
4
+ * @namespace wpmtstAdmin
5
+ * @namespace wpmtstAdmin.newField
6
+ */
7
+
8
+ // Function to get the Max value in Array
9
+ Array.max = function (array) {
10
+ return Math.max.apply(Math, array);
11
+ };
12
+
13
+ // Convert "A String" to "a_string"
14
+ function sanitizeName(label) {
15
+ return label.trim().replace(/\W/g, " ").replace(/\s+/g, "_").toLowerCase();
16
+ }
17
+
18
+ (function ($) {
19
+
20
+ /**
21
+ * If open, scroll field into view.
22
+ * If closed, scroll all the way up.
23
+ *
24
+ * @returns {jQuery}
25
+ */
26
+ $.fn.scrollUp = function () {
27
+ var containerOffset;
28
+ this.each(function () {
29
+ containerOffset = 0;
30
+ if ($(this).hasClass("open")) {
31
+ containerOffset = parseInt($(this).offset().top) - 72;
32
+ }
33
+ $("html, body").animate({scrollTop: containerOffset}, 800);
34
+ });
35
+
36
+ return this;
37
+ };
38
+
39
+ /**
40
+ * Replace the field type selector with its value. Better than readonly.
41
+ *
42
+ * @returns {jQuery}
43
+ */
44
+ $.fn.replaceSelect = function () {
45
+ this.each(function () {
46
+ if ($(this).hasClass("open")) {
47
+ $(this).find("select.field-type").each(function (index, el) {
48
+ $(el).replaceWith(el.value);
49
+ });
50
+ }
51
+ });
52
+
53
+ return this;
54
+ }
55
+
56
+ /**
57
+ * Initialize
58
+ */
59
+ var catCount = 0;
60
+ getCatCount();
61
+
62
+ var $theForm = $("#wpmtst-custom-fields-form");
63
+ var $fieldList = $("#custom-field-list");
64
+
65
+ formPreview();
66
+ toggleCategoryFields();
67
+
68
+ /**
69
+ * Sortable
70
+ */
71
+ $fieldList.sortable({
72
+ placeholder: "sortable-placeholder",
73
+ forcePlaceholderSize: true,
74
+ handle: ".handle",
75
+ cursor: "move",
76
+ update: function (event, ui) {
77
+ dismissNotice();
78
+ formPreview();
79
+ }
80
+ });
81
+
82
+ /**
83
+ * ------------------------------------------------------------
84
+ * Events
85
+ * ------------------------------------------------------------
86
+ */
87
+
88
+ /**
89
+ * Any changes.
90
+ */
91
+ $theForm.on("change", "input", function () {
92
+ dismissNotice();
93
+ formPreview();
94
+ });
95
+
96
+ /**
97
+ * Disable buttons on submit.
98
+ * Thanks https://stackoverflow.com/a/25651260/51600
99
+ */
100
+ $theForm.submit(function(){
101
+ $('#field-group-actions').find('.button').each(function (index) {
102
+ // Create a disabled clone of the submit button
103
+ $(this).clone(false).removeAttr('id').prop('disabled', true).insertBefore($(this));
104
+ // Hide the actual submit button and move it to the beginning of the form
105
+ $(this).hide();
106
+ });
107
+ });
108
+
109
+ /**
110
+ * Save Changes
111
+ */
112
+ $('#submit-form').on('click',function(e){
113
+
114
+ // Validate field type
115
+ $("select.field-type").each(function (index) {
116
+ if ('none' === this.value) {
117
+ $(this).closest('tr').addClass('form-error');
118
+ $(this).parent().find('.form-error-text').show();
119
+ var $parent = $(this).closest("li");
120
+ if (!$parent.hasClass("open")) {
121
+ $parent.find("a.field").click();
122
+ }
123
+ $(this).focus();
124
+ e.preventDefault();
125
+ } else {
126
+ $(this).closest('tr').removeClass('form-error');
127
+ $(this).parent().find('.form-error-text').hide();
128
+ }
129
+ });
130
+
131
+ // Validate field name
132
+ $("input.field-name").each(function (index) {
133
+ if ('name' === $(this).val() || 'date' === $(this).val()) {
134
+ $(this).closest('tr').addClass('form-error');
135
+ $(this).parent().find('.field-name-help.important').addClass('form-error-text');
136
+ var $parent = $(this).closest("li");
137
+ if (!$parent.hasClass("open")) {
138
+ $parent.find("a.field").click();
139
+ }
140
+ $(this).focus();
141
+ e.preventDefault();
142
+ } else {
143
+ $(this).closest('tr').removeClass('form-error');
144
+ $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
145
+ }
146
+ });
147
+
148
+ });
149
+
150
+ /**
151
+ * Cancel Changes
152
+ */
153
+ $('#reset').on('click',function(e){
154
+ $theForm.submit();
155
+ });
156
+
157
+ /**
158
+ * Restore Defaults
159
+ */
160
+ $('#restore-defaults').on('click',function(e){
161
+ if (confirm("Restore the default fields?")) {
162
+ $theForm.submit();
163
+ } else {
164
+ $(this).blur();
165
+ return false;
166
+ }
167
+ });
168
+
169
+ /**
170
+ * Prevent single click on handle from opening accordion
171
+ */
172
+ $fieldList.on("click", "span.handle", function (e) {
173
+ e.stopImmediatePropagation();
174
+ e.preventDefault();
175
+ });
176
+
177
+ /**
178
+ * Open/close
179
+ */
180
+ $fieldList.on("click", "span.link", function () {
181
+ toggleField($(this).closest("li"));
182
+ return false;
183
+ });
184
+
185
+ /**
186
+ * Validate field label
187
+ */
188
+ $fieldList.on("change blur", "input.field-label", function () {
189
+ var newLabel = $(this).val().trim();
190
+ // fill in blank label
191
+ if ('' === newLabel) {
192
+ newLabel = wpmtstAdmin.newField;
193
+ }
194
+ $(this).val(newLabel);
195
+
196
+ var $parent = $(this).closest("li");
197
+ var fieldIndex = $parent.index();
198
+
199
+ // update parent list item
200
+ $parent.find("a.field").html(newLabel);
201
+
202
+ // fill in blank field name
203
+ var $fieldName = $parent.find("input.field-name");
204
+ if ('new_field' === $fieldName.val()) {
205
+ $fieldName.val(getUniqueName(newLabel, fieldIndex)).change();
206
+ }
207
+ });
208
+
209
+ /**
210
+ * Validate field name
211
+ */
212
+ $fieldList.on("change", "input.field-name", function () {
213
+ var fieldName = $(this).val();
214
+ var $parent = $(this).closest("li");
215
+ var fieldIndex = $parent.index();
216
+
217
+ if (fieldName) {
218
+ $(this).val(getUniqueName(fieldName, fieldIndex));
219
+ } else {
220
+ var fieldLabel = $(this).closest(".field-table").find(".field-label").val();
221
+ $(this).val(getUniqueName(fieldLabel, fieldIndex));
222
+ }
223
+
224
+ // Check new name, not initial value
225
+ if ('name' === $(this).val() || 'date' === $(this).val()) {
226
+ $(this).closest('tr').addClass('form-error');
227
+ $(this).parent().find('.field-name-help.important').addClass('form-error-text');
228
+ $(this).focus()
229
+ return false;
230
+ } else {
231
+ $(this).closest('tr').removeClass('form-error');
232
+ $(this).parent().find('.field-name-help.important').removeClass('form-error-text');
233
+ }
234
+ });
235
+
236
+ /**
237
+ * Delete field
238
+ */
239
+ $fieldList.on("click", ".delete-field", function () {
240
+ $(this).blur();
241
+ dismissNotice();
242
+ var thisField = $(this).closest("li");
243
+ var thisLabel = thisField.find(".field").text();
244
+ if (confirm('Delete "' + thisLabel + '"?')) {
245
+ thisField.fadeOut(function () {
246
+ $.when(thisField.remove()).then(function () {
247
+ formPreview();
248
+ toggleCategoryFields();
249
+ $("#add-field, #submit").removeAttr("disabled");
250
+ })
251
+ });
252
+ }
253
+ });
254
+
255
+ /**
256
+ * Close field
257
+ */
258
+ $fieldList.on("click", "span.close-field a", function () {
259
+ toggleField($(this).closest("li"));
260
+ return false;
261
+ });
262
+
263
+ /**
264
+ * Add new field
265
+ */
266
+ $("#add-field").click(function () {
267
+ dismissNotice();
268
+ var keys = $fieldList.find("li").map(function () {
269
+ var key_id = $(this).attr("id");
270
+ return key_id.substr(key_id.lastIndexOf("-") + 1);
271
+ }).get();
272
+ var nextKey = Array.max(keys) + 1;
273
+
274
+ var data = {
275
+ 'action': 'wpmtst_add_field',
276
+ 'nextKey': nextKey,
277
+ 'fieldClass': null,
278
+ 'fieldType': null,
279
+ 'security': wpmtstAdmin.ajax_nonce
280
+ };
281
+ $.get(ajaxurl, data, function (response) {
282
+ $("#add-field, #submit").attr("disabled", "disabled");
283
+
284
+ // create list item
285
+ var $li = $('<li id="field-' + nextKey + '" data-status="new">').append(response);
286
+
287
+ // hide elements until Type is selected
288
+ $li.find('.field-label-row').hide();
289
+ $li.find('.field-name-row').hide();
290
+ $li.find("span.close-field").hide();
291
+
292
+ // append to list
293
+ $.when($fieldList.append($li)).then(function () {
294
+ formPreview();
295
+ togglePostFields();
296
+ toggleCategoryFields();
297
+
298
+ // click it to open
299
+ $li.find("span.link").click();
300
+ });
301
+ });
302
+ });
303
+
304
+ /**
305
+ * Field type change
306
+ */
307
+ $fieldList.on("change", ".field-type", function (e) {
308
+ var fieldType = $(this).val();
309
+ var $table = $(this).closest("table");
310
+ var $parent = $(this).closest('li');
311
+
312
+ if ($parent.data('status') !== 'new') {
313
+ $table.find(".field-secondary, .field-admin-table").remove();
314
+ }
315
+
316
+ if ('none' === fieldType) {
317
+ $parent.find('.field-label-row').hide();
318
+ $parent.find('.field-name-row').hide();
319
+
320
+ // Hide "Close" link
321
+ $parent.find("span.close-field").hide();
322
+ $("#add-field, #submit").attr("disabled", "disabled");
323
+ return;
324
+ }
325
+ $parent.find('tr').removeClass('form-error');
326
+ $parent.find('.form-error-text').hide();
327
+
328
+ var key_id = $parent.attr("id");
329
+ var key = key_id.substr(key_id.lastIndexOf("-") + 1);
330
+
331
+ var $fieldLabel = $parent.find('input.field-label');
332
+ var $fieldName = $parent.find('input.field-name');
333
+ var fieldIndex = $parent.index();
334
+
335
+ // get type of field from its optgroup
336
+ var fieldOption = $(this).find("option[value='" + fieldType + "']");
337
+ var fieldClass = fieldOption.closest("optgroup").attr("class");
338
+
339
+ switch (fieldClass) {
340
+
341
+ case 'post':
342
+ $parent.find('.field-label-row').show();
343
+ $parent.find('.field-name-row').show();
344
+
345
+ // Force values if selecting a Post field.
346
+ if (fieldType === 'post_title') {
347
+ $fieldLabel.val('Testimonial Title');
348
+ $fieldName.val('post_title').attr('disabled', 'disabled');
349
+ }
350
+ else if (fieldType === 'featured_image') {
351
+ $fieldLabel.val('Photo');
352
+ $fieldName.val('featured_image').attr('disabled', 'disabled');
353
+ }
354
+ else if (fieldType === 'post_content') {
355
+ $fieldLabel.val('Testimonial');
356
+ $fieldName.val('post_content').attr('disabled', 'disabled');
357
+ }
358
+ // move value to hidden input
359
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
360
+ // hide help message
361
+ $parent.find(".field-name-help").hide();
362
+ break;
363
+
364
+ case 'optional':
365
+ $parent.find('.field-label-row').show();
366
+ $parent.find('.field-name-row').show();
367
+
368
+ if ('category' === fieldType.split('-')[0]) {
369
+ $fieldName.val('category').attr('disabled', 'disabled');
370
+ // move value to hidden input
371
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
372
+ // hide help message
373
+ $parent.find(".field-name-help").hide();
374
+ }
375
+ var forceName = fieldOption.data('force-name');
376
+ if (forceName) {
377
+ $fieldName.val(forceName).attr('disabled', 'disabled');
378
+ // move value to hidden input
379
+ $fieldName.after('<input type="hidden" name="' + $fieldName.attr("name") + '" value="' + $fieldName.val() + '" />');
380
+ // hide help message
381
+ $parent.find(".field-name-help").hide();
382
+ }
383
+ $fieldLabel.val(wpmtstAdmin.newField).focus().select();
384
+ break;
385
+
386
+ default:
387
+ $parent.find('.field-label-row').show();
388
+ $parent.find('.field-name-row').show();
389
+
390
+ // TODO DRY
391
+ $fieldLabel.val(wpmtstAdmin.newField).focus().select();
392
+ $fieldName.val(getUniqueName($fieldLabel.val(), fieldIndex));
393
+ $fieldName.removeAttr('disabled');
394
+ $parent.find(".field-name-help").show();
395
+ }
396
+
397
+ // secondary form fields
398
+ var data1 = {
399
+ 'action': 'wpmtst_add_field_2',
400
+ 'nextKey': key,
401
+ 'fieldClass': fieldClass,
402
+ 'fieldType': fieldType,
403
+ 'security': wpmtstAdmin.ajax_nonce
404
+ };
405
+
406
+ var ajax1 = $.get(ajaxurl, data1, function (response) {
407
+ $table.append(response);
408
+ $( document ).trigger( "st-done-loading-secondary-fields", [ $table ] );
409
+ });
410
+
411
+
412
+ // admin-table field
413
+ var data2 = {
414
+ 'action': 'wpmtst_add_field_4',
415
+ 'nextKey': key,
416
+ 'fieldClass': fieldClass,
417
+ 'fieldType': fieldType,
418
+ 'security': wpmtstAdmin.ajax_nonce
419
+ };
420
+
421
+ var ajax2 = ajax1.then(function () {
422
+ return $.get(ajaxurl, data2, function (response) {
423
+ $table.append(response);
424
+ });
425
+ });
426
+
427
+
428
+ // hidden inputs
429
+ var data3 = {
430
+ 'action': 'wpmtst_add_field_3',
431
+ 'nextKey': key,
432
+ 'fieldClass': fieldClass,
433
+ 'fieldType': fieldType,
434
+ 'security': wpmtstAdmin.ajax_nonce
435
+ };
436
+
437
+ var ajax3 = ajax2.then(function () {
438
+ return $.get(ajaxurl, data3, function (response) {
439
+ $table.parent().append(response);
440
+ });
441
+ });
442
+
443
+ ajax3.done(function () {
444
+
445
+ formPreview();
446
+ $("#add-field, #submit").removeAttr("disabled");
447
+
448
+ // Successfully added so show "Close" link
449
+ $("span.close-field").show();
450
+
451
+ $parent
452
+ // Reset temporary status
453
+ .removeData("status").removeAttr("data-status")
454
+ // update parent list item
455
+ .find(".custom-field-header a.field").html($fieldLabel.val()).end()
456
+ // update hidden [record_type] input
457
+ .find('input[name$="[record_type]"]').val(fieldClass);
458
+
459
+ });
460
+
461
+ });
462
+
463
+ /**
464
+ * ------------------------------------------------------------
465
+ * Functions
466
+ * ------------------------------------------------------------
467
+ */
468
+
469
+ function getCatCount() {
470
+ $.get(ajaxurl, {
471
+ 'action': 'wpmtst_get_cat_count',
472
+ 'security': wpmtstAdmin.ajax_nonce
473
+ },
474
+ function (response) {
475
+ catCount = parseInt(response);
476
+ });
477
+ }
478
+
479
+ // Preview
480
+ function formPreview() {
481
+ var formFields = $theForm.find("[name^='fields']");
482
+ if (!formFields.length) return;
483
+
484
+ var data = {
485
+ 'action': 'wpmtst_get_form_preview',
486
+ 'fields': formFields.serialize()
487
+ };
488
+ $.post(ajaxurl, data, function (response) {
489
+ var newDiv = $("<div></div>").hide().html(response)
490
+ $("#fields-editor-preview")
491
+ .children().first()
492
+ .after(newDiv)
493
+ .fadeOut(300, function () {
494
+ newDiv.show();
495
+ $(this).remove();
496
+ });
497
+ });
498
+ }
499
+
500
+ /*
501
+ * Disable any Post fields already in use.
502
+ *
503
+ * Doing this client-side so a Post field can be added
504
+ * but not saved before adding more fields;
505
+ * i.e. add multiple fields of either type without risk
506
+ * of duplicating single Post fields before clicking "Save".
507
+ */
508
+ function togglePostFields() {
509
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
510
+ var $parent = $(this).closest("li");
511
+ var value = $(this).val();
512
+ if ("post" === value) {
513
+ var name = $parent.find(".field-name").val();
514
+ $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
515
+ }
516
+ });
517
+ }
518
+
519
+ // Only allow one category field
520
+ function toggleCategoryFields() {
521
+ var categoryInUse = false;
522
+
523
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
524
+ var $parent = $(this).closest("li");
525
+ var value = $(this).val();
526
+ if ('optional' === value) {
527
+ var fieldType = $parent.find('input[name$="[input_type]"]').val();
528
+ if (!categoryInUse) {
529
+ categoryInUse = ( 'category' === fieldType.split('-')[0] );
530
+ }
531
+ }
532
+ });
533
+
534
+ var $options = $fieldList.find('option[value^="category"]');
535
+ if (categoryInUse) {
536
+ $options.each(function () {
537
+ var text = $(this).text();
538
+ $(this)
539
+ .attr("disabled", "disabled")
540
+ .text(text + ' ' + wpmtstAdmin.inUse)
541
+ .data('origText', text);
542
+ });
543
+ }
544
+ else if (0 === catCount) {
545
+ $options.each(function () {
546
+ var text = $(this).text();
547
+ $(this)
548
+ .attr("disabled", "disabled")
549
+ .text(text + ' ' + wpmtstAdmin.noneFound)
550
+ .data('origText', text);
551
+ });
552
+ } else {
553
+ $options.each(function () {
554
+ $(this)
555
+ .removeAttr("disabled")
556
+ .text($(this).data('origText'));
557
+ });
558
+ }
559
+ }
560
+
561
+ // Actions on opening/closing the field
562
+ function toggleField($field) {
563
+ $field.replaceSelect()
564
+ .toggleClass("open")
565
+ .scrollUp()
566
+ .find("span.link")
567
+ .toggleClass("open")
568
+ .end()
569
+ .find(".custom-field")
570
+ .toggleClass("open")
571
+ .slideToggle()
572
+ .find(".first-field")
573
+ .focus();
574
+ }
575
+
576
+ // Build a unique name
577
+ function getUniqueName(fieldName, fieldIndex) {
578
+ fieldName = sanitizeName(fieldName);
579
+
580
+ // Get names of *other* fields
581
+ var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
582
+ return this.value;
583
+ }).get();
584
+
585
+ names = names.filter(function (x) {
586
+ return (x !== (undefined || ''));
587
+ });
588
+
589
+ var uniqueName = fieldName;
590
+ var i = 2;
591
+
592
+ while ($.inArray(uniqueName, names) >= 1) {
593
+ uniqueName = fieldName + '_' + i++;
594
+ }
595
+ return uniqueName;
596
+ }
597
+
598
+ // Dismiss the "Fields saved" notice.
599
+ function dismissNotice() {
600
+ $('.wpmtst.notice').find(".notice-dismiss").click();
601
+ }
602
+
603
+ })(jQuery);
admin/js/admin-form.js CHANGED
@@ -1,164 +1,164 @@
1
- /**
2
- * Strong Testimonials admin
3
- *
4
- * @namespace jQuery
5
- */
6
-
7
- jQuery(document).ready(function ($) {
8
-
9
- /**
10
- * ----------------------------------------
11
- * Admin notification email events
12
- * ----------------------------------------
13
- */
14
-
15
- var $notifyAdmin = $('#wpmtst-options-admin-notify');
16
- var $notifyFields = $('#admin-notify-fields');
17
-
18
- if ($notifyAdmin.is(':checked')) {
19
- $notifyFields.slideDown();
20
- }
21
-
22
- $notifyAdmin.change(function (e) {
23
- if ($(this).is(':checked')) {
24
- $notifyFields.slideDown();
25
- $(this).blur();
26
- }
27
- else {
28
- $notifyFields.slideUp();
29
- }
30
- });
31
-
32
- $('#add-recipient').click(function (e) {
33
- var $this = $(this);
34
- var key = $this.parent().siblings('.recipient').length;
35
- var data = {
36
- 'action': 'wpmtst_add_recipient',
37
- 'key': key,
38
- };
39
- $.get(ajaxurl, data, function (response) {
40
- $this.parent().before(response).prev().find('.admin_name').first().focus();
41
- });
42
- });
43
-
44
- $notifyFields.on('click', '.delete-recipient', function (e) {
45
- $(this).closest('.email-option.recipient').remove();
46
- });
47
-
48
- /**
49
- * ----------------------------------------
50
- * Admin notification email tags
51
- *
52
- * Thanks http://skfox.com/2008/11/26/jquery-example-inserting-text-with-drag-n-drop/
53
- * ----------------------------------------
54
- */
55
-
56
- var $tagListItems = $('#wpmtst-tags-list li');
57
-
58
- $tagListItems.attr('title', wpmtst_admin.templateTagTitle);
59
-
60
- $tagListItems.on('click', function () {
61
- $('#wpmtst-option-email-message').insertAtCaret($(this).text());
62
- return false;
63
- });
64
-
65
- $.fn.insertAtCaret = function (myValue) {
66
- return this.each(function () {
67
- var sel;
68
- //IE support
69
- if (document.selection) {
70
- this.focus();
71
- sel = document.selection.createRange();
72
- sel.text = myValue;
73
- this.focus();
74
- }
75
- //MOZILLA / NETSCAPE support
76
- else if (this.selectionStart || this.selectionStart === '0') {
77
- var startPos = this.selectionStart;
78
- var endPos = this.selectionEnd;
79
- var scrollTop = this.scrollTop;
80
- this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
81
- this.focus();
82
- this.selectionStart = startPos + myValue.length;
83
- this.selectionEnd = startPos + myValue.length;
84
- this.scrollTop = scrollTop;
85
- } else {
86
- this.value += myValue;
87
- this.focus();
88
- }
89
- });
90
- };
91
-
92
- /**
93
- * Autosize textarea
94
- */
95
- var ta = document.getElementsByClassName('autosize');
96
- autosize(ta);
97
-
98
- /**
99
- * ----------------------------------------
100
- * Form Settings
101
- * ----------------------------------------
102
- */
103
-
104
- /**
105
- * Restore all default messages
106
- */
107
- $('#restore-default-messages').click(function (e) {
108
- var data = {
109
- 'action': 'wpmtst_restore_default_messages'
110
- };
111
-
112
- $.get(ajaxurl, data, function (response) {
113
-
114
- var object = JSON.parse(response);
115
-
116
- for (var key in object) {
117
-
118
- if (object.hasOwnProperty(key)) {
119
-
120
- var targetId = key.replace(/-/g, '_');
121
- var el = $('[id=\'' + targetId + '\']');
122
- el.val(object[key]['text']);
123
-
124
- if ('submission_success' === targetId) {
125
- var editor = tinyMCE.activeEditor;
126
- if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
127
- tinyMCE.activeEditor.setContent(object[key]['text']);
128
- }
129
- }
130
-
131
- }
132
-
133
- }
134
-
135
- });
136
- });
137
-
138
- /**
139
- * Restore a single default message
140
- */
141
- $('.restore-default-message').click(function (e) {
142
- var targetId = $(e.target).data('targetId');
143
- var data = {
144
- 'action': 'wpmtst_restore_default_message',
145
- 'field': targetId
146
- };
147
-
148
- $.get(ajaxurl, data, function (response) {
149
-
150
- var object = JSON.parse(response);
151
-
152
- $('[id=\'' + targetId + '\']').val(object['text']);
153
-
154
- if ('submission_success' === targetId) {
155
- var editor = tinyMCE.activeEditor;
156
- if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
157
- tinyMCE.activeEditor.setContent(object['text']);
158
- }
159
- }
160
- });
161
-
162
- });
163
-
164
- });
1
+ /**
2
+ * Strong Testimonials admin
3
+ *
4
+ * @namespace jQuery
5
+ */
6
+
7
+ jQuery(document).ready(function ($) {
8
+
9
+ /**
10
+ * ----------------------------------------
11
+ * Admin notification email events
12
+ * ----------------------------------------
13
+ */
14
+
15
+ var $notifyAdmin = $('#wpmtst-options-admin-notify');
16
+ var $notifyFields = $('#admin-notify-fields');
17
+
18
+ if ($notifyAdmin.is(':checked')) {
19
+ $notifyFields.slideDown();
20
+ }
21
+
22
+ $notifyAdmin.change(function (e) {
23
+ if ($(this).is(':checked')) {
24
+ $notifyFields.slideDown();
25
+ $(this).blur();
26
+ }
27
+ else {
28
+ $notifyFields.slideUp();
29
+ }
30
+ });
31
+
32
+ $('#add-recipient').click(function (e) {
33
+ var $this = $(this);
34
+ var key = $this.parent().siblings('.recipient').length;
35
+ var data = {
36
+ 'action': 'wpmtst_add_recipient',
37
+ 'key': key,
38
+ };
39
+ $.get(ajaxurl, data, function (response) {
40
+ $this.parent().before(response).prev().find('.admin_name').first().focus();
41
+ });
42
+ });
43
+
44
+ $notifyFields.on('click', '.delete-recipient', function (e) {
45
+ $(this).closest('.email-option.recipient').remove();
46
+ });
47
+
48
+ /**
49
+ * ----------------------------------------
50
+ * Admin notification email tags
51
+ *
52
+ * Thanks http://skfox.com/2008/11/26/jquery-example-inserting-text-with-drag-n-drop/
53
+ * ----------------------------------------
54
+ */
55
+
56
+ var $tagListItems = $('#wpmtst-tags-list li');
57
+
58
+ $tagListItems.attr('title', wpmtst_admin.templateTagTitle);
59
+
60
+ $tagListItems.on('click', function () {
61
+ $('#wpmtst-option-email-message').insertAtCaret($(this).text());
62
+ return false;
63
+ });
64
+
65
+ $.fn.insertAtCaret = function (myValue) {
66
+ return this.each(function () {
67
+ var sel;
68
+ //IE support
69
+ if (document.selection) {
70
+ this.focus();
71
+ sel = document.selection.createRange();
72
+ sel.text = myValue;
73
+ this.focus();
74
+ }
75
+ //MOZILLA / NETSCAPE support
76
+ else if (this.selectionStart || this.selectionStart === '0') {
77
+ var startPos = this.selectionStart;
78
+ var endPos = this.selectionEnd;
79
+ var scrollTop = this.scrollTop;
80
+ this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
81
+ this.focus();
82
+ this.selectionStart = startPos + myValue.length;
83
+ this.selectionEnd = startPos + myValue.length;
84
+ this.scrollTop = scrollTop;
85
+ } else {
86
+ this.value += myValue;
87
+ this.focus();
88
+ }
89
+ });
90
+ };
91
+
92
+ /**
93
+ * Autosize textarea
94
+ */
95
+ var ta = document.getElementsByClassName('autosize');
96
+ autosize(ta);
97
+
98
+ /**
99
+ * ----------------------------------------
100
+ * Form Settings
101
+ * ----------------------------------------
102
+ */
103
+
104
+ /**
105
+ * Restore all default messages
106
+ */
107
+ $('#restore-default-messages').click(function (e) {
108
+ var data = {
109
+ 'action': 'wpmtst_restore_default_messages'
110
+ };
111
+
112
+ $.get(ajaxurl, data, function (response) {
113
+
114
+ var object = JSON.parse(response);
115
+
116
+ for (var key in object) {
117
+
118
+ if (object.hasOwnProperty(key)) {
119
+
120
+ var targetId = key.replace(/-/g, '_');
121
+ var el = $('[id=\'' + targetId + '\']');
122
+ el.val(object[key]['text']);
123
+
124
+ if ('submission_success' === targetId) {
125
+ var editor = tinyMCE.activeEditor;
126
+ if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
127
+ tinyMCE.activeEditor.setContent(object[key]['text']);
128
+ }
129
+ }
130
+
131
+ }
132
+
133
+ }
134
+
135
+ });
136
+ });
137
+
138
+ /**
139
+ * Restore a single default message
140
+ */
141
+ $('.restore-default-message').click(function (e) {
142
+ var targetId = $(e.target).data('targetId');
143
+ var data = {
144
+ 'action': 'wpmtst_restore_default_message',
145
+ 'field': targetId
146
+ };
147
+
148
+ $.get(ajaxurl, data, function (response) {
149
+
150
+ var object = JSON.parse(response);
151
+
152
+ $('[id=\'' + targetId + '\']').val(object['text']);
153
+
154
+ if ('submission_success' === targetId) {
155
+ var editor = tinyMCE.activeEditor;
156
+ if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
157
+ tinyMCE.activeEditor.setContent(object['text']);
158
+ }
159
+ }
160
+ });
161
+
162
+ });
163
+
164
+ });
admin/js/admin-global.js CHANGED
@@ -1,26 +1,26 @@
1
- /**
2
- * Strong Testimonials admin
3
- *
4
- * @namespace wpmtst_admin
5
- */
6
-
7
- jQuery(document).ready(function ($) {
8
- /**
9
- * ----------------------------------------
10
- * Persistent admin notices.
11
- * Dismissible from any page.
12
- * ----------------------------------------
13
- */
14
- $('.wpmtst.notice.is-dismissible').on('click', '.notice-dismiss', function (event) {
15
- event.preventDefault()
16
- var $this = $(this)
17
- if ('undefined' === $this.parent().attr('data-key')) {
18
- return
19
- }
20
- $.post(ajaxurl, {
21
- action: 'wpmtst_dismiss_notice',
22
- key: $this.parent().attr('data-key'),
23
- nonce: wpmtst_admin.nonce
24
- })
25
- })
26
- })
1
+ /**
2
+ * Strong Testimonials admin
3
+ *
4
+ * @namespace wpmtst_admin
5
+ */
6
+
7
+ jQuery(document).ready(function ($) {
8
+ /**
9
+ * ----------------------------------------
10
+ * Persistent admin notices.
11
+ * Dismissible from any page.
12
+ * ----------------------------------------
13
+ */
14
+ $('.wpmtst.notice.is-dismissible').on('click', '.notice-dismiss', function (event) {
15
+ event.preventDefault()
16
+ var $this = $(this)
17
+ if ('undefined' === $this.parent().attr('data-key')) {
18
+ return
19
+ }
20
+ $.post(ajaxurl, {
21
+ action: 'wpmtst_dismiss_notice',
22
+ key: $this.parent().attr('data-key'),
23
+ nonce: wpmtst_admin.nonce
24
+ })
25
+ })
26
+ })
admin/js/admin-order.js CHANGED
@@ -1,128 +1,128 @@
1
- /**
2
- * Admin list order
3
- * Strong Testimonials
4
- */
5
-
6
- // set cell widths to prevent shrinkage
7
- function setCellWidths() {
8
- jQuery('td, th', 'table.posts').each(function () {
9
- var cell = jQuery(this);
10
- cell.width(cell.width());
11
- });
12
- };
13
-
14
- // reset cell widths
15
- function resetCellWidths(reset) {
16
- jQuery('td, th', 'table.posts').each(function () {
17
- var cell = jQuery(this);
18
- cell.width('');
19
- }).promise().done(setCellWidths);
20
- };
21
-
22
- // Returns a function, that, as long as it continues to be invoked, will not
23
- // be triggered. The function will be called after it stops being called for
24
- // N milliseconds. If `immediate` is passed, trigger the function on the
25
- // leading edge, instead of the trailing.
26
- // Thanks http://davidwalsh.name/javascript-debounce-function
27
- function debounce(func, wait, immediate) {
28
- var timeout;
29
- return function () {
30
- var context = this, args = arguments;
31
- var later = function () {
32
- timeout = null;
33
- if (!immediate) func.apply(context, args);
34
- };
35
- var callNow = immediate && !timeout;
36
- clearTimeout(timeout);
37
- timeout = setTimeout(later, wait);
38
- if (callNow) func.apply(context, args);
39
- };
40
- };
41
-
42
- // window resize listener
43
- var myEfficientFn = debounce(resetCellWidths, 100);
44
- window.addEventListener('resize', myEfficientFn);
45
-
46
-
47
- jQuery(document).ready(function ($) {
48
-
49
- $.fn.strongSort = function (options) {
50
-
51
- var $this = this;
52
- var $handles = $(options.handles);
53
-
54
- var toggleReorder = function () {
55
- $this.sortable("enable");
56
- $handles.show();
57
- }
58
-
59
- this.sortable({
60
- disabled: true, // initially disabled
61
- items: 'tr',
62
- axis: 'y',
63
- handle: options.handles,
64
- forcePlaceholderSize: true,
65
- placeholder: "sortable-placeholder",
66
- start: function (e, ui) {
67
- // set height of placeholder to match current dragged element
68
- ui.placeholder.height(ui.helper.height());
69
- ui.helper.css("cursor", "move");
70
- },
71
- helper: function (e, ui) {
72
- var $originals = ui.children();
73
- var $helper = ui.clone();
74
- $helper.children().each(function (index) {
75
- // set helper cell sizes to match the original sizes
76
- $(this).width($originals.eq(index).width());
77
- });
78
- return $helper;
79
- },
80
- update: function (e, ui) {
81
- ui.item.find(".column-handle").addClass("refresh");
82
- $.post(ajaxurl, {
83
- action: 'update-menu-order',
84
- order: $('#the-list').sortable('serialize'),
85
- },
86
- function (data) {
87
- // update menu order shown
88
- var $orders = $(".menu-order");
89
- var obj = JSON.parse(data);
90
- var orderArray = $.map(obj, function (val, i) {
91
- $orders.eq(i).html(val);
92
- });
93
- })
94
- .done(function () {
95
- // update zebra striping
96
- $("#the-list").find("tr:even").removeClass("alternate");
97
- ui.item.effect('highlight', {}, 2000);
98
- ui.item.find(".column-handle").removeClass("refresh");
99
- })
100
-
101
- }
102
- });
103
-
104
- toggleReorder();
105
-
106
- return this;
107
- }
108
-
109
- // Init
110
-
111
- setCellWidths();
112
-
113
- $("#screen-meta").on("change", ".metabox-prefs", resetCellWidths);
114
-
115
- $("#the-list").strongSort({
116
- handles: 'td.column-handle'
117
- });
118
-
119
- $("td.column-handle").hover(
120
- function () {
121
- $(this).closest("tr").addClass("reorder-hover");
122
- },
123
- function () {
124
- $(this).closest("tr").removeClass("reorder-hover");
125
- }
126
- );
127
-
128
- });
1
+ /**
2
+ * Admin list order
3
+ * Strong Testimonials
4
+ */
5
+
6
+ // set cell widths to prevent shrinkage
7
+ function setCellWidths() {
8
+ jQuery('td, th', 'table.posts').each(function () {
9
+ var cell = jQuery(this);
10
+ cell.width(cell.width());
11
+ });
12
+ };
13
+
14
+ // reset cell widths
15
+ function resetCellWidths(reset) {
16
+ jQuery('td, th', 'table.posts').each(function () {
17
+ var cell = jQuery(this);
18
+ cell.width('');
19
+ }).promise().done(setCellWidths);
20
+ };
21
+
22
+ // Returns a function, that, as long as it continues to be invoked, will not
23
+ // be triggered. The function will be called after it stops being called for
24
+ // N milliseconds. If `immediate` is passed, trigger the function on the
25
+ // leading edge, instead of the trailing.
26
+ // Thanks http://davidwalsh.name/javascript-debounce-function
27
+ function debounce(func, wait, immediate) {
28
+ var timeout;
29
+ return function () {
30
+ var context = this, args = arguments;
31
+ var later = function () {
32
+ timeout = null;
33
+ if (!immediate) func.apply(context, args);
34
+ };
35
+ var callNow = immediate && !timeout;
36
+ clearTimeout(timeout);
37
+ timeout = setTimeout(later, wait);
38
+ if (callNow) func.apply(context, args);
39
+ };
40
+ };
41
+
42
+ // window resize listener
43
+ var myEfficientFn = debounce(resetCellWidths, 100);
44
+ window.addEventListener('resize', myEfficientFn);
45
+
46
+
47
+ jQuery(document).ready(function ($) {
48
+
49
+ $.fn.strongSort = function (options) {
50
+
51
+ var $this = this;
52
+ var $handles = $(options.handles);
53
+
54
+ var toggleReorder = function () {
55
+ $this.sortable("enable");
56
+ $handles.show();
57
+ }
58
+
59
+ this.sortable({
60
+ disabled: true, // initially disabled
61
+ items: 'tr',
62
+ axis: 'y',
63
+ handle: options.handles,
64
+ forcePlaceholderSize: true,
65
+ placeholder: "sortable-placeholder",
66
+ start: function (e, ui) {
67
+ // set height of placeholder to match current dragged element
68
+ ui.placeholder.height(ui.helper.height());
69
+ ui.helper.css("cursor", "move");
70
+ },
71
+ helper: function (e, ui) {
72
+ var $originals = ui.children();
73
+ var $helper = ui.clone();
74
+ $helper.children().each(function (index) {
75
+ // set helper cell sizes to match the original sizes
76
+ $(this).width($originals.eq(index).width());
77
+ });
78
+ return $helper;
79
+ },
80
+ update: function (e, ui) {
81
+ ui.item.find(".column-handle").addClass("refresh");
82
+ $.post(ajaxurl, {
83
+ action: 'update-menu-order',
84
+ order: $('#the-list').sortable('serialize'),
85
+ },
86
+ function (data) {
87
+ // update menu order shown
88
+ var $orders = $(".menu-order");
89
+ var obj = JSON.parse(data);
90
+ var orderArray = $.map(obj, function (val, i) {
91
+ $orders.eq(i).html(val);
92
+ });
93
+ })
94
+ .done(function () {
95
+ // update zebra striping
96
+ $("#the-list").find("tr:even").removeClass("alternate");
97
+ ui.item.effect('highlight', {}, 2000);
98
+ ui.item.find(".column-handle").removeClass("refresh");
99
+ })
100
+
101
+ }
102
+ });
103
+
104
+ toggleReorder();
105
+
106
+ return this;
107
+ }
108
+
109
+ // Init
110
+
111
+ setCellWidths();
112
+
113
+ $("#screen-meta").on("change", ".metabox-prefs", resetCellWidths);
114
+
115
+ $("#the-list").strongSort({
116
+ handles: 'td.column-handle'
117
+ });
118
+
119
+ $("td.column-handle").hover(
120
+ function () {
121
+ $(this).closest("tr").addClass("reorder-hover");
122
+ },
123
+ function () {
124
+ $(this).closest("tr").removeClass("reorder-hover");
125
+ }
126
+ );
127
+
128
+ });
admin/js/custom-spinner.js CHANGED
@@ -1,81 +1,81 @@
1
- /**
2
- * Custom Number Spinner
3
- *
4
- * Courtesy of
5
- * http://www.jqueryscript.net/form/Custom-Number-InputSpinner-Plugin-jQuery-number.html
6
- * with help from
7
- * https://stackoverflow.com/a/7343013/51600
8
- */
9
- ;(function ($) {
10
- $.fn.number = function (customOptions) {
11
- function round(value, precision) {
12
- var multiplier = Math.pow(10, precision || 0);
13
- return Math.round(value * multiplier) / multiplier;
14
- }
15
-
16
- var options = {
17
- 'containerClass': 'number-style noselect',
18
- 'minus': 'number-minus',
19
- 'plus': 'number-plus',
20
- 'containerTag': 'div',
21
- 'btnTag': 'span'
22
- }
23
- options = $.extend(true, options, customOptions)
24
-
25
- var input = this
26
- input.wrap('<' + options.containerTag + ' class="' + options.containerClass + '">')
27
-
28
- var wrapper = input.parent()
29
- wrapper.prepend('<' + options.btnTag + ' class="' + options.minus + '"></' + options.btnTag + '>')
30
- wrapper.append('<' + options.btnTag + ' class="' + options.plus + '"></' + options.btnTag + '>')
31
-
32
- var minus = wrapper.find('.' + options.minus)
33
- var plus = wrapper.find('.' + options.plus)
34
-
35
- var min = round(input.attr('min'),1)
36
- var max = round(input.attr('max'),1)
37
- var step = 1
38
- if(input.attr('step')){
39
- step = +round(input.attr('step'),1)
40
- }
41
-
42
- if (+input.val() <= +min) {
43
- minus.addClass('disabled')
44
- }
45
- if (+input.val() >= +max) {
46
- plus.addClass('disabled')
47
- }
48
-
49
- minus.click(function () {
50
- var input = $(this).parent().find('input')
51
- var value = +round(input.val(),1)
52
- if (+value > +min) {
53
- input.val(round(+value - step,1))
54
- if (+input.val() === +min) {
55
- input.prev('.' + options.minus).addClass('disabled')
56
- }
57
- if (input.next('.' + options.plus).hasClass('disabled')) {
58
- input.next('.' + options.plus).removeClass('disabled')
59
- }
60
- } else if (!min) {
61
- input.val(round(+value - step,1))
62
- }
63
- })
64
-
65
- plus.click(function () {
66
- var input = $(this).parent().find('input')
67
- var value = +round(input.val(),2)
68
- if (+value < +max) {
69
- input.val(round(+value + step,1))
70
- if (+input.val() === +max) {
71
- input.next('.' + options.plus).addClass('disabled')
72
- }
73
- if (input.prev('.' + options.minus).hasClass('disabled')) {
74
- input.prev('.' + options.minus).removeClass('disabled')
75
- }
76
- } else if (!max) {
77
- input.val(round(+value + step,1))
78
- }
79
- })
80
- }
81
- })(jQuery)
1
+ /**
2
+ * Custom Number Spinner
3
+ *
4
+ * Courtesy of
5
+ * http://www.jqueryscript.net/form/Custom-Number-InputSpinner-Plugin-jQuery-number.html
6
+ * with help from
7
+ * https://stackoverflow.com/a/7343013/51600
8
+ */
9
+ ;(function ($) {
10
+ $.fn.number = function (customOptions) {
11
+ function round(value, precision) {
12
+ var multiplier = Math.pow(10, precision || 0);
13
+ return Math.round(value * multiplier) / multiplier;
14
+ }
15
+
16
+ var options = {
17
+ 'containerClass': 'number-style noselect',
18
+ 'minus': 'number-minus',
19
+ 'plus': 'number-plus',
20
+ 'containerTag': 'div',
21
+ 'btnTag': 'span'
22
+ }
23
+ options = $.extend(true, options, customOptions)
24
+
25
+ var input = this
26
+ input.wrap('<' + options.containerTag + ' class="' + options.containerClass + '">')
27
+
28
+ var wrapper = input.parent()
29
+ wrapper.prepend('<' + options.btnTag + ' class="' + options.minus + '"></' + options.btnTag + '>')
30
+ wrapper.append('<' + options.btnTag + ' class="' + options.plus + '"></' + options.btnTag + '>')
31
+
32
+ var minus = wrapper.find('.' + options.minus)
33
+ var plus = wrapper.find('.' + options.plus)
34
+
35
+ var min = round(input.attr('min'),1)
36
+ var max = round(input.attr('max'),1)
37
+ var step = 1
38
+ if(input.attr('step')){
39
+ step = +round(input.attr('step'),1)
40
+ }
41
+
42
+ if (+input.val() <= +min) {
43
+ minus.addClass('disabled')
44
+ }
45
+ if (+input.val() >= +max) {
46
+ plus.addClass('disabled')
47
+ }
48
+
49
+ minus.click(function () {
50
+ var input = $(this).parent().find('input')
51
+ var value = +round(input.val(),1)
52
+ if (+value > +min) {
53
+ input.val(round(+value - step,1))
54
+ if (+input.val() === +min) {
55
+ input.prev('.' + options.minus).addClass('disabled')
56
+ }
57
+ if (input.next('.' + options.plus).hasClass('disabled')) {
58
+ input.next('.' + options.plus).removeClass('disabled')
59
+ }
60
+ } else if (!min) {
61
+ input.val(round(+value - step,1))
62
+ }
63
+ })
64
+
65
+ plus.click(function () {
66
+ var input = $(this).parent().find('input')
67
+ var value = +round(input.val(),2)
68
+ if (+value < +max) {
69
+ input.val(round(+value + step,1))
70
+ if (+input.val() === +max) {
71
+ input.next('.' + options.plus).addClass('disabled')
72
+ }
73
+ if (input.prev('.' + options.minus).hasClass('disabled')) {
74
+ input.prev('.' + options.minus).removeClass('disabled')
75
+ }
76
+ } else if (!max) {
77
+ input.val(round(+value + step,1))
78
+ }
79
+ })
80
+ }
81
+ })(jQuery)
admin/js/help.js CHANGED
@@ -1,22 +1,22 @@
1
- (function ($) {
2
- 'use strict'
3
-
4
- $('.open-help-tab').on('click', function () {
5
-
6
- var tab = this.hash
7
-
8
- // Find the tab in the Help container
9
- var tabLink = $('#contextual-help-columns').find('a[href="' + tab + '"]')
10
-
11
- if ($('#screen-meta').is(':hidden')) {
12
- // If Help container is closed, open it, then select tab
13
- $('#contextual-help-link').click().promise().done(function () {
14
- tabLink.click()
15
- })
16
- }
17
-
18
- $('html, body').animate({scrollTop: 0}, 800)
19
-
20
- return false
21
- })
22
- })(jQuery)
1
+ (function ($) {
2
+ 'use strict'
3
+
4
+ $('.open-help-tab').on('click', function () {
5
+
6
+ var tab = this.hash
7
+
8
+ // Find the tab in the Help container
9
+ var tabLink = $('#contextual-help-columns').find('a[href="' + tab + '"]')
10
+
11
+ if ($('#screen-meta').is(':hidden')) {
12
+ // If Help container is closed, open it, then select tab
13
+ $('#contextual-help-link').click().promise().done(function () {
14
+ tabLink.click()
15
+ })
16
+ }
17
+
18
+ $('html, body').animate({scrollTop: 0}, 800)
19
+
20
+ return false
21
+ })
22
+ })(jQuery)
admin/js/lib/are-you-sure/jquery.are-you-sure.js CHANGED
@@ -1,192 +1,192 @@
1
- /*!
2
- * jQuery Plugin: Are-You-Sure (Dirty Form Detection)
3
- * https://github.com/codedance/jquery.AreYouSure/
4
- *
5
- * Copyright (c) 2012-2014, Chris Dance and PaperCut Software http://www.papercut.com/
6
- * Dual licensed under the MIT or GPL Version 2 licenses.
7
- * http://jquery.org/license
8
- *
9
- * Author: chris.dance@papercut.com
10
- * Version: 1.9.0
11
- * Date: 13th August 2014
12
- */
13
- (function($) {
14
-
15
- $.fn.areYouSure = function(options) {
16
-
17
- var settings = $.extend(
18
- {
19
- 'message' : 'You have unsaved changes!',
20
- 'dirtyClass' : 'dirty',
21
- 'change' : null,
22
- 'silent' : false,
23
- 'addRemoveFieldsMarksDirty' : false,
24
- 'fieldEvents' : 'change keyup propertychange input',
25
- 'fieldSelector': ":input:not(input[type=submit]):not(input[type=button])"
26
- }, options);
27
-
28
- var getValue = function($field) {
29
- if ($field.hasClass('ays-ignore')
30
- || $field.hasClass('aysIgnore')
31
- || $field.attr('data-ays-ignore')
32
- || $field.attr('name') === undefined) {
33
- return null;
34
- }
35
-
36
- if ($field.is(':disabled')) {
37
- return 'ays-disabled';
38
- }
39
-
40
- var val;
41
- var type = $field.attr('type');
42
- if ($field.is('select')) {
43
- type = 'select';
44
- }
45
-
46
- switch (type) {
47
- case 'checkbox':
48
- case 'radio':
49
- val = $field.is(':checked');
50
- break;
51
- case 'select':
52
- val = '';
53
- $field.find('option').each(function(o) {
54
- var $option = $(this);
55
- if ($option.is(':selected')) {
56
- val += $option.val();
57
- }
58
- });
59
- break;
60
- default:
61
- val = $field.val();
62
- }
63
-
64
- return val;
65
- };
66
-
67
- var storeOrigValue = function($field) {
68
- $field.data('ays-orig', getValue($field));
69
- };
70
-
71
- var checkForm = function(evt) {
72
-
73
- var isFieldDirty = function($field) {
74
- var origValue = $field.data('ays-orig');
75
- if (undefined === origValue) {
76
- return false;
77
- }
78
- return (getValue($field) != origValue);
79
- };
80
-
81
- var $form = ($(this).is('form'))
82
- ? $(this)
83
- : $(this).parents('form');
84
-
85
- // Test on the target first as it's the most likely to be dirty
86
- if (isFieldDirty($(evt.target))) {
87
- setDirtyStatus($form, true);
88
- return;
89
- }
90
-
91
- $fields = $form.find(settings.fieldSelector);
92
-
93
- if (settings.addRemoveFieldsMarksDirty) {
94
- // Check if field count has changed
95
- var origCount = $form.data("ays-orig-field-count");
96
- if (origCount != $fields.length) {
97
- setDirtyStatus($form, true);
98
- return;
99
- }
100
- }
101
-
102
- // Brute force - check each field
103
- var isDirty = false;
104
- $fields.each(function() {
105
- $field = $(this);
106
- if (isFieldDirty($field)) {
107
- isDirty = true;
108
- return false; // break
109
- }
110
- });
111
-
112
- setDirtyStatus($form, isDirty);
113
- };
114
-
115
- var initForm = function($form) {
116
- var fields = $form.find(settings.fieldSelector);
117
- $(fields).each(function() { storeOrigValue($(this)); });
118
- $(fields).unbind(settings.fieldEvents, checkForm);
119
- $(fields).bind(settings.fieldEvents, checkForm);
120
- $form.data("ays-orig-field-count", $(fields).length);
121
- setDirtyStatus($form, false);
122
- };
123
-
124
- var setDirtyStatus = function($form, isDirty) {
125
- var changed = isDirty != $form.hasClass(settings.dirtyClass);
126
- $form.toggleClass(settings.dirtyClass, isDirty);
127
-
128
- // Fire change event if required
129
- if (changed) {
130
- if (settings.change) settings.change.call($form, $form);
131
-
132
- if (isDirty) $form.trigger('dirty.areYouSure', [$form]);
133
- if (!isDirty) $form.trigger('clean.areYouSure', [$form]);
134
- $form.trigger('change.areYouSure', [$form]);
135
- }
136
- };
137
-
138
- var rescan = function() {
139
- var $form = $(this);
140
- var fields = $form.find(settings.fieldSelector);
141
- $(fields).each(function() {
142
- var $field = $(this);
143
- if (!$field.data('ays-orig')) {
144
- storeOrigValue($field);
145
- $field.bind(settings.fieldEvents, checkForm);
146
- }
147
- });
148
- // Check for changes while we're here
149
- $form.trigger('checkform.areYouSure');
150
- };
151
-
152
- var reinitialize = function() {
153
- initForm($(this));
154
- }
155
-
156
- if (!settings.silent && !window.aysUnloadSet) {
157
- window.aysUnloadSet = true;
158
- $(window).bind('beforeunload', function() {
159
- $dirtyForms = $("form").filter('.' + settings.dirtyClass);
160
- if ($dirtyForms.length == 0) {
161
- return;
162
- }
163
- // Prevent multiple prompts - seen on Chrome and IE
164
- if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) {
165
- if (window.aysHasPrompted) {
166
- return;
167
- }
168
- window.aysHasPrompted = true;
169
- window.setTimeout(function() {window.aysHasPrompted = false;}, 900);
170
- }
171
- return settings.message;
172
- });
173
- }
174
-
175
- return this.each(function(elem) {
176
- if (!$(this).is('form')) {
177
- return;
178
- }
179
- var $form = $(this);
180
-
181
- $form.submit(function() {
182
- $form.removeClass(settings.dirtyClass);
183
- });
184
- $form.bind('reset', function() { setDirtyStatus($form, false); });
185
- // Add a custom events
186
- $form.bind('rescan.areYouSure', rescan);
187
- $form.bind('reinitialize.areYouSure', reinitialize);
188
- $form.bind('checkform.areYouSure', checkForm);
189
- initForm($form);
190
- });
191
- };
192
- })(jQuery);
1
+ /*!
2
+ * jQuery Plugin: Are-You-Sure (Dirty Form Detection)
3
+ * https://github.com/codedance/jquery.AreYouSure/
4
+ *
5
+ * Copyright (c) 2012-2014, Chris Dance and PaperCut Software http://www.papercut.com/
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Author: chris.dance@papercut.com
10
+ * Version: 1.9.0
11
+ * Date: 13th August 2014
12
+ */
13
+ (function($) {
14
+
15
+ $.fn.areYouSure = function(options) {
16
+
17
+ var settings = $.extend(
18
+ {
19
+ 'message' : 'You have unsaved changes!',
20
+ 'dirtyClass' : 'dirty',
21
+ 'change' : null,
22
+ 'silent' : false,
23
+ 'addRemoveFieldsMarksDirty' : false,
24
+ 'fieldEvents' : 'change keyup propertychange input',
25
+ 'fieldSelector': ":input:not(input[type=submit]):not(input[type=button])"
26
+ }, options);
27
+
28
+ var getValue = function($field) {
29
+ if ($field.hasClass('ays-ignore')
30
+ || $field.hasClass('aysIgnore')
31
+ || $field.attr('data-ays-ignore')
32
+ || $field.attr('name') === undefined) {
33
+ return null;
34
+ }
35
+
36
+ if ($field.is(':disabled')) {
37
+ return 'ays-disabled';
38
+ }
39
+
40
+ var val;
41
+ var type = $field.attr('type');
42
+ if ($field.is('select')) {
43
+ type = 'select';
44
+ }
45
+
46
+ switch (type) {
47
+ case 'checkbox':
48
+ case 'radio':
49
+ val = $field.is(':checked');
50
+ break;
51
+ case 'select':
52
+ val = '';
53
+ $field.find('option').each(function(o) {
54
+ var $option = $(this);
55
+ if ($option.is(':selected')) {
56
+ val += $option.val();
57
+ }
58
+ });
59
+ break;
60
+ default:
61
+ val = $field.val();
62
+ }
63
+
64
+ return val;
65
+ };
66
+
67
+ var storeOrigValue = function($field) {
68
+ $field.data('ays-orig', getValue($field));
69
+ };
70
+
71
+ var checkForm = function(evt) {
72
+
73
+ var isFieldDirty = function($field) {
74
+ var origValue = $field.data('ays-orig');
75
+ if (undefined === origValue) {
76
+ return false;
77
+ }
78
+ return (getValue($field) != origValue);
79
+ };
80
+
81
+ var $form = ($(this).is('form'))
82
+ ? $(this)
83
+ : $(this).parents('form');
84
+
85
+ // Test on the target first as it's the most likely to be dirty
86
+ if (isFieldDirty($(evt.target))) {
87
+ setDirtyStatus($form, true);
88
+ return;
89
+ }
90
+
91
+ $fields = $form.find(settings.fieldSelector);
92
+
93
+ if (settings.addRemoveFieldsMarksDirty) {
94
+ // Check if field count has changed
95
+ var origCount = $form.data("ays-orig-field-count");
96
+ if (origCount != $fields.length) {
97
+ setDirtyStatus($form, true);
98
+ return;
99
+ }
100
+ }
101
+
102
+ // Brute force - check each field
103
+ var isDirty = false;
104
+ $fields.each(function() {
105
+ $field = $(this);
106
+ if (isFieldDirty($field)) {
107
+ isDirty = true;
108
+ return false; // break
109
+ }
110
+ });
111
+
112
+ setDirtyStatus($form, isDirty);
113
+ };
114
+
115
+ var initForm = function($form) {
116
+ var fields = $form.find(settings.fieldSelector);
117
+ $(fields).each(function() { storeOrigValue($(this)); });
118
+ $(fields).unbind(settings.fieldEvents, checkForm);
119
+ $(fields).bind(settings.fieldEvents, checkForm);
120
+ $form.data("ays-orig-field-count", $(fields).length);
121
+ setDirtyStatus($form, false);
122
+ };
123
+
124
+ var setDirtyStatus = function($form, isDirty) {
125
+ var changed = isDirty != $form.hasClass(settings.dirtyClass);
126
+ $form.toggleClass(settings.dirtyClass, isDirty);
127
+
128
+ // Fire change event if required
129
+ if (changed) {
130
+ if (settings.change) settings.change.call($form, $form);
131
+
132
+ if (isDirty) $form.trigger('dirty.areYouSure', [$form]);
133
+ if (!isDirty) $form.trigger('clean.areYouSure', [$form]);
134
+ $form.trigger('change.areYouSure', [$form]);
135
+ }
136
+ };
137
+
138
+ var rescan = function() {
139
+ var $form = $(this);
140
+ var fields = $form.find(settings.fieldSelector);
141
+ $(fields).each(function() {
142
+ var $field = $(this);
143
+ if (!$field.data('ays-orig')) {
144
+ storeOrigValue($field);
145
+ $field.bind(settings.fieldEvents, checkForm);
146
+ }
147
+ });
148
+ // Check for changes while we're here
149
+ $form.trigger('checkform.areYouSure');
150
+ };
151
+
152
+ var reinitialize = function() {
153
+ initForm($(this));
154
+ }
155
+
156
+ if (!settings.silent && !window.aysUnloadSet) {
157
+ window.aysUnloadSet = true;
158
+ $(window).bind('beforeunload', function() {
159
+ $dirtyForms = $("form").filter('.' + settings.dirtyClass);
160
+ if ($dirtyForms.length == 0) {
161
+ return;
162
+ }
163
+ // Prevent multiple prompts - seen on Chrome and IE
164
+ if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) {
165
+ if (window.aysHasPrompted) {
166
+ return;
167
+ }
168
+ window.aysHasPrompted = true;
169
+ window.setTimeout(function() {window.aysHasPrompted = false;}, 900);
170
+ }
171
+ return settings.message;
172
+ });
173
+ }
174
+
175
+ return this.each(function(elem) {
176
+ if (!$(this).is('form')) {
177
+ return;
178
+ }
179
+ var $form = $(this);
180
+
181
+ $form.submit(function() {
182
+ $form.removeClass(settings.dirtyClass);
183
+ });
184
+ $form.bind('reset', function() { setDirtyStatus($form, false); });
185
+ // Add a custom events
186
+ $form.bind('rescan.areYouSure', rescan);
187
+ $form.bind('reinitialize.areYouSure', reinitialize);
188
+ $form.bind('checkform.areYouSure', checkForm);
189
+ initForm($form);
190
+ });
191
+ };
192
+ })(jQuery);
admin/js/lib/autosize/autosize.min.js CHANGED
@@ -1,6 +1,6 @@
1
- /*!
2
- autosize 4.0.1
3
- license: MIT
4
- http://www.jacklmoore.com/autosize
5
- */
6
  !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1<n.indexOf(e)},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);-1<t&&(n.splice(t,1),o.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(r){if(r&&r.nodeName&&"TEXTAREA"===r.nodeName&&!p.has(r)){var e,n=null,o=null,i=null,d=function(){r.clientWidth!==o&&a()},l=function(t){window.removeEventListener("resize",d,!1),r.removeEventListener("input",a,!1),r.removeEventListener("keyup",a,!1),r.removeEventListener("autosize:destroy",l,!1),r.removeEventListener("autosize:update",a,!1),Object.keys(t).forEach(function(e){r.style[e]=t[e]}),p.delete(r)}.bind(r,{height:r.style.height,resize:r.style.resize,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",l,!1),"onpropertychange"in r&&"oninput"in r&&r.addEventListener("keyup",a,!1),window.addEventListener("resize",d,!1),r.addEventListener("input",a,!1),r.addEventListener("autosize:update",a,!1),r.style.overflowX="hidden",r.style.wordWrap="break-word",p.set(r,{destroy:l,update:a}),"vertical"===(e=window.getComputedStyle(r,null)).resize?r.style.resize="none":"both"===e.resize&&(r.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),a()}function s(e){var t=r.style.width;r.style.width="0px",r.offsetWidth,r.style.width=t,r.style.overflowY=e}function u(){if(0!==r.scrollHeight){var e=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(r),t=document.documentElement&&document.documentElement.scrollTop;r.style.height="",r.style.height=r.scrollHeight+n+"px",o=r.clientWidth,e.forEach(function(e){e.node.scrollTop=e.scrollTop}),t&&(document.documentElement.scrollTop=t)}}function a(){u();var e=Math.round(parseFloat(r.style.height)),t=window.getComputedStyle(r,null),n="content-box"===t.boxSizing?Math.round(parseFloat(t.height)):r.offsetHeight;if(n!==e?"hidden"===t.overflowY&&(s("scroll"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight):"hidden"!==t.overflowY&&(s("hidden"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight),i!==n){i=n;var o=c("autosize:resized");try{r.dispatchEvent(o)}catch(e){}}}}function i(e){var t=p.get(e);t&&t.destroy()}function d(e){var t=p.get(e);t&&t.update()}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return r(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e}),t.default=l,e.exports=t.default});
1
+ /*!
2
+ autosize 4.0.1
3
+ license: MIT
4
+ http://www.jacklmoore.com/autosize
5
+ */
6
  !function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1<n.indexOf(e)},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);-1<t&&(n.splice(t,1),o.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(r){if(r&&r.nodeName&&"TEXTAREA"===r.nodeName&&!p.has(r)){var e,n=null,o=null,i=null,d=function(){r.clientWidth!==o&&a()},l=function(t){window.removeEventListener("resize",d,!1),r.removeEventListener("input",a,!1),r.removeEventListener("keyup",a,!1),r.removeEventListener("autosize:destroy",l,!1),r.removeEventListener("autosize:update",a,!1),Object.keys(t).forEach(function(e){r.style[e]=t[e]}),p.delete(r)}.bind(r,{height:r.style.height,resize:r.style.resize,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",l,!1),"onpropertychange"in r&&"oninput"in r&&r.addEventListener("keyup",a,!1),window.addEventListener("resize",d,!1),r.addEventListener("input",a,!1),r.addEventListener("autosize:update",a,!1),r.style.overflowX="hidden",r.style.wordWrap="break-word",p.set(r,{destroy:l,update:a}),"vertical"===(e=window.getComputedStyle(r,null)).resize?r.style.resize="none":"both"===e.resize&&(r.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),a()}function s(e){var t=r.style.width;r.style.width="0px",r.offsetWidth,r.style.width=t,r.style.overflowY=e}function u(){if(0!==r.scrollHeight){var e=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(r),t=document.documentElement&&document.documentElement.scrollTop;r.style.height="",r.style.height=r.scrollHeight+n+"px",o=r.clientWidth,e.forEach(function(e){e.node.scrollTop=e.scrollTop}),t&&(document.documentElement.scrollTop=t)}}function a(){u();var e=Math.round(parseFloat(r.style.height)),t=window.getComputedStyle(r,null),n="content-box"===t.boxSizing?Math.round(parseFloat(t.height)):r.offsetHeight;if(n!==e?"hidden"===t.overflowY&&(s("scroll"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight):"hidden"!==t.overflowY&&(s("hidden"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight),i!==n){i=n;var o=c("autosize:resized");try{r.dispatchEvent(o)}catch(e){}}}}function i(e){var t=p.get(e);t&&t.destroy()}function d(e){var t=p.get(e);t&&t.update()}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return r(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e}),t.default=l,e.exports=t.default});
admin/js/rating-edit.js CHANGED
@@ -1,85 +1,85 @@
1
- /**
2
- * Edit rating
3
- */
4
-
5
- jQuery(document).ready(function ($) {
6
-
7
- var editRating = function () {
8
- var ratingBox = $(this).closest(".edit-rating-box"),
9
- ratingField = ratingBox.data("field"),
10
- ratingForm = ratingBox.find('.rating-form'),
11
- ratingDisplay = ratingBox.find('.rating-display'),
12
- box = ratingBox.find('.edit-rating-success'),
13
- revert_e = ratingBox.find('.current-rating').val(),
14
- postId = $('#post_ID').val() || 0,
15
- buttons2 = ratingBox.find('.edit-rating-buttons-2');
16
-
17
- ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
18
-
19
- //TODO Refactor so "off" isn't necssary!
20
- buttons2.children('.save').off("click");
21
- buttons2.children('.cancel').off("click");
22
-
23
- ratingDisplay.hide();
24
- ratingForm.showInlineBlock();
25
-
26
- box.html('');
27
-
28
- buttons2.children('.save').on("click", function () {
29
- var new_rating = ratingForm.find("input:checked").val();
30
- var name_on_form = ratingForm.find("input:checked").attr("name");
31
- var field_name = name_on_form.match(/\[(.*)\]/).pop();
32
-
33
- if (new_rating === revert_e) {
34
- buttons2.children('.cancel').click();
35
- return;
36
- }
37
-
38
- $.post(ajaxurl, {
39
- action: 'wpmtst_edit_rating',
40
- post_id: postId,
41
- field_name: field_name,
42
- rating: new_rating,
43
- editratingnonce: $('#edit-' + ratingField + '-nonce').val()
44
- }, function (data) {
45
- var obj = JSON.parse(data);
46
-
47
- var stars = ratingDisplay.find(".inner");
48
- stars.html(obj.display);
49
-
50
- box.html(obj.message);
51
-
52
- ratingForm.find("input[value=" + new_rating + "]").prop("checked", true);
53
-
54
- if (box.hasClass('hidden')) {
55
- box.fadeIn('fast', function () {
56
- box.removeClass('hidden');
57
- });
58
- }
59
-
60
- revert_e = new_rating;
61
- ratingBox.find('.current-rating').val(new_rating);
62
- ratingForm.hide();
63
- ratingDisplay.showInlineBlock();
64
- });
65
- return false;
66
- });
67
-
68
- buttons2.children('.cancel').on("click", function () {
69
- ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
70
- ratingForm.hide();
71
- ratingDisplay.showInlineBlock();
72
- return false;
73
- });
74
-
75
- buttons2.children('.zero').on("click", function () {
76
- ratingForm.find("input[value=0]").prop("checked", true);
77
- $(this).blur();
78
- return false;
79
- });
80
-
81
- }
82
-
83
- $(".edit-rating").on('click', editRating);
84
-
85
- });
1
+ /**
2
+ * Edit rating
3
+ */
4
+
5
+ jQuery(document).ready(function ($) {
6
+
7
+ var editRating = function () {
8
+ var ratingBox = $(this).closest(".edit-rating-box"),
9
+ ratingField = ratingBox.data("field"),
10
+ ratingForm = ratingBox.find('.rating-form'),
11
+ ratingDisplay = ratingBox.find('.rating-display'),
12
+ box = ratingBox.find('.edit-rating-success'),
13
+ revert_e = ratingBox.find('.current-rating').val(),
14
+ postId = $('#post_ID').val() || 0,
15
+ buttons2 = ratingBox.find('.edit-rating-buttons-2');
16
+
17
+ ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
18
+
19
+ //TODO Refactor so "off" isn't necssary!
20
+ buttons2.children('.save').off("click");
21
+ buttons2.children('.cancel').off("click");
22
+
23
+ ratingDisplay.hide();
24
+ ratingForm.showInlineBlock();
25
+
26
+ box.html('');
27
+
28
+ buttons2.children('.save').on("click", function () {
29
+ var new_rating = ratingForm.find("input:checked").val();
30
+ var name_on_form = ratingForm.find("input:checked").attr("name");
31
+ var field_name = name_on_form.match(/\[(.*)\]/).pop();
32
+
33
+ if (new_rating === revert_e) {
34
+ buttons2.children('.cancel').click();
35
+ return;
36
+ }
37
+
38
+ $.post(ajaxurl, {
39
+ action: 'wpmtst_edit_rating',
40
+ post_id: postId,
41
+ field_name: field_name,
42
+ rating: new_rating,
43
+ editratingnonce: $('#edit-' + ratingField + '-nonce').val()
44
+ }, function (data) {
45
+ var obj = JSON.parse(data);
46
+
47
+ var stars = ratingDisplay.find(".inner");
48
+ stars.html(obj.display);
49
+
50
+ box.html(obj.message);
51
+
52
+ ratingForm.find("input[value=" + new_rating + "]").prop("checked", true);
53
+
54
+ if (box.hasClass('hidden')) {
55
+ box.fadeIn('fast', function () {
56
+ box.removeClass('hidden');
57
+ });
58
+ }
59
+
60
+ revert_e = new_rating;
61
+ ratingBox.find('.current-rating').val(new_rating);
62
+ ratingForm.hide();
63
+ ratingDisplay.showInlineBlock();
64
+ });
65
+ return false;
66
+ });
67
+
68
+ buttons2.children('.cancel').on("click", function () {
69
+ ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
70
+ ratingForm.hide();
71
+ ratingDisplay.showInlineBlock();
72
+ return false;
73
+ });
74
+
75
+ buttons2.children('.zero').on("click", function () {
76
+ ratingForm.find("input[value=0]").prop("checked", true);
77
+ $(this).blur();
78
+ return false;
79
+ });
80
+
81
+ }
82
+
83
+ $(".edit-rating").on('click', editRating);
84
+
85
+ });
admin/js/view-category-filter.js CHANGED
@@ -1,47 +1,47 @@
1
- /**
2
- * View Category Filter
3
- *
4
- * Adapted from the excellent:
5
- *
6
- * Plugin Name: Post Category Filter
7
- * Plugin URI: http://www.jahvi.com
8
- * Description: Filter post categories and taxonomies live in the WordPress admin area
9
- * Version: 1.2.4
10
- * Author: Javier Villanueva
11
- * Author URI: http://www.jahvi.com
12
- * License: GPL-2.0+
13
- * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14
- */
15
-
16
- (function ($) {
17
-
18
- 'use strict';
19
-
20
- var $categoryDivs = $('.view-category-list-panel');
21
-
22
- $(function () {
23
-
24
- $(".fc-search-wrap").show();
25
-
26
- $categoryDivs.on('keyup search', '.fc-search-field', function (event) {
27
-
28
- var searchTerm = event.target.value,
29
- $listItems = $(this).closest(".view-category-list-panel").find('.view-category-list li');
30
-
31
- if ($.trim(searchTerm)) {
32
-
33
- $listItems.hide().filter(function () {
34
- return $(this).text().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1;
35
- }).show();
36
-
37
- } else {
38
-
39
- $listItems.show();
40
-
41
- }
42
-
43
- });
44
-
45
- });
46
-
47
- }(jQuery));
1
+ /**
2
+ * View Category Filter
3
+ *
4
+ * Adapted from the excellent:
5
+ *
6
+ * Plugin Name: Post Category Filter
7
+ * Plugin URI: http://www.jahvi.com
8
+ * Description: Filter post categories and taxonomies live in the WordPress admin area
9
+ * Version: 1.2.4
10
+ * Author: Javier Villanueva
11
+ * Author URI: http://www.jahvi.com
12
+ * License: GPL-2.0+
13
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14
+ */
15
+
16
+ (function ($) {
17
+
18
+ 'use strict';
19
+
20
+ var $categoryDivs = $('.view-category-list-panel');
21
+
22
+ $(function () {
23
+
24
+ $(".fc-search-wrap").show();
25
+
26
+ $categoryDivs.on('keyup search', '.fc-search-field', function (event) {
27
+
28
+ var searchTerm = event.target.value,
29
+ $listItems = $(this).closest(".view-category-list-panel").find('.view-category-list li');
30
+
31
+ if ($.trim(searchTerm)) {
32
+
33
+ $listItems.hide().filter(function () {
34
+ return $(this).text().toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1;
35
+ }).show();
36
+
37
+ } else {
38
+
39
+ $listItems.show();
40
+
41
+ }
42
+
43
+ });
44
+
45
+ });
46
+
47
+ }(jQuery));
admin/js/views.js CHANGED
@@ -1,1346 +1,1354 @@
1
- /**
2
- * Strong Testimonials - Views
3
- */
4
-
5
- // Function to get the Max value in Array
6
- Array.max = function (array) {
7
- return Math.max.apply(Math, array);
8
- };
9
-
10
- (function ($) {
11
- $.fn.showInlineBlock = function () {
12
- return this.css('display', 'inline-block');
13
- };
14
- })(jQuery);
15
-
16
- /**
17
- * jQuery alterClass plugin
18
- *
19
- * Remove element classes with wildcard matching. Optionally add classes:
20
- * $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
21
- *
22
- * https://gist.github.com/peteboere/1517285
23
- *
24
- * Copyright (c) 2011 Pete Boere (the-echoplex.net)
25
- * Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
26
- */
27
- (function ($) {
28
- $.fn.alterClass = function (removals, additions) {
29
-
30
- var self = this;
31
-
32
- if (removals.indexOf('*') === -1) {
33
- // Use native jQuery methods if there is no wildcard matching
34
- self.removeClass(removals);
35
- return !additions ? self : self.addClass(additions);
36
- }
37
-
38
- var patt = new RegExp('\\s' +
39
- removals.replace(/\*/g, '[A-Za-z0-9-_]+').split(' ').join('\\s|\\s') +
40
- '\\s', 'g');
41
-
42
- self.each(function (i, it) {
43
- var cn = ' ' + it.className + ' ';
44
- while (patt.test(cn)) {
45
- cn = cn.replace(patt, ' ');
46
- }
47
- it.className = $.trim(cn);
48
- });
49
-
50
- return !additions ? self : self.addClass(additions);
51
- };
52
- })(jQuery);
53
-
54
- /**
55
- * Special handling after toggling certain options.
56
- */
57
- (function ($) {
58
- // custom handling
59
- $.fn.afterToggle = function () {
60
-
61
- // Category selector
62
- var $categoryDivs = $('.view-category-list-panel');
63
- // Set initial width to compensate for narrowed box due to checkbox being hidden first
64
- // and to prevent horizontal jumpiness as filter is applied.
65
- if (!$categoryDivs.hasClass('fixed')) {
66
- $categoryDivs.width($categoryDivs.outerWidth(true)).addClass('fixed');
67
- }
68
-
69
- // Slideshow controls
70
- var $controls = $('#view-slideshow_controls_type');
71
- var $pager = $('#view-slideshow_pager_type');
72
- var controlsValue = $controls.val();
73
- var pagerValue = $pager.val();
74
-
75
- if ('full' === controlsValue) {
76
- $('.then_has-pager').fadeOut();
77
- $pager.val('none');
78
- $('option[value="text"]', '#view-slideshow_controls_style').prop('disabled', false);
79
- }
80
- else if ('sides' === controlsValue) {
81
- $('.then_has-pager').fadeIn();
82
- var $style = $('#view-slideshow_controls_style');
83
- if ('text' === $style.val()) {
84
- $('option:first', $style).prop('selected', true);
85
- }
86
- $('option[value="text"]', $style).prop('disabled', true);
87
- }
88
- else {
89
- $('.then_has-pager').fadeIn();
90
- $('option[value="text"]', '#view-slideshow_controls_style').prop('disabled', false);
91
- }
92
-
93
- if ('none' === pagerValue && ('none' === controlsValue || 'sides' === controlsValue)) {
94
- $('.then_has-position').fadeOut();
95
- }
96
- else {
97
- $('.then_has-position').fadeIn();
98
- }
99
-
100
- // If no navigation, must start automatically.
101
- if ('none' === pagerValue && 'none' === controlsValue) {
102
- $('#view-auto_start').val('1').prop('checked', true);
103
- }
104
-
105
- return this;
106
- };
107
- }(jQuery));
108
-
109
- /**
110
- * Remove 'result' query argument.
111
- */
112
- removeResultArg = function () {
113
- var urlParams = new URLSearchParams(window.location.search);
114
- if (urlParams.has('result')) {
115
- urlParams.delete('result');
116
- var newURL = window.location.pathname;
117
- if (urlParams.toString()) {
118
- newURL = newURL + '?' + urlParams.toString();
119
- }
120
- window.history.replaceState({}, document.title, newURL);
121
- }
122
- };
123
-
124
- /**
125
- * Initial actions on document.ready
126
- */
127
- jQuery(document).ready(function ($) {
128
-
129
- // Masonry in the Layout section
130
- $('.view-layout-masonry .example-container')
131
- .find('.box')
132
- .width(jQuery('.grid-sizer').width())
133
- .end()
134
- .masonry();
135
-
136
- // Category select width
137
- $.fn.afterToggle();
138
-
139
- removeResultArg();
140
- });
141
-
142
- (function ($) {
143
- 'use strict';
144
-
145
- // the shortcode code
146
- $('#view-shortcode').on('focus', function () {
147
- $(this).select();
148
- });
149
-
150
- $('.expand-cats').on('click', function () {
151
- // TODO i18n
152
- var $categoryDivs = $('.view-category-list-panel');
153
- if ($categoryDivs.hasClass('tall-panel')) {
154
- $categoryDivs.addClass('short-panel').removeClass('tall-panel');
155
- $(this).val('expand list');
156
- } else {
157
- $categoryDivs.removeClass('short-panel').addClass('tall-panel');
158
- $(this).val('collapse list');
159
- }
160
- $(this).blur();
161
- });
162
-
163
- // Masonry example
164
- var masonryExample = $('.view-layout-masonry .example-container');
165
- masonryExample.find('.box').width($('.grid-sizer').width()).end().masonry({
166
- columnWidth: '.grid-sizer',
167
- gutter: 10,
168
- itemSelector: '.box',
169
- percentPosition: true
170
- });
171
-
172
- // Column count selector
173
- var columnCount = $('#view-column-count');
174
- var columnCountChange = function () {
175
- var col = columnCount.val();
176
- $('.example-container').alterClass('col-*', 'col-' + col);
177
- masonryExample.find('.box').width($('.grid-sizer').width()).end().masonry();
178
- };
179
-
180
- columnCountChange();
181
- columnCount.on('change', columnCountChange);
182
- $('input[name=\'view[data][layout]\']').on('change', function () {
183
- if ('masonry' === $(this).val()) {
184
- setTimeout(columnCountChange, 200);
185
- }
186
- });
187
-
188
- // Color pickers
189
- var myOptions = {
190
- // you can declare a default color here, or in the data-default-color attribute on the input
191
- //defaultColor: '#FFFFFF',
192
- // a callback to fire whenever the color changes to a valid color
193
- change: function (event, ui) {
194
- setTimeout(function () {
195
- updateBackgroundPreview();
196
- }, 250);
197
- },
198
- // a callback to fire when the input is emptied or an invalid color
199
- clear: function (event, ui) {
200
- setTimeout(function () {
201
- updateBackgroundPreview();
202
- }, 250);
203
- },
204
- // hide the color picker controls on load
205
- //hide: true,
206
- // show a group of common colors beneath the square
207
- // or, supply an array of colors to customize further
208
- palettes: true
209
- };
210
- $('.wp-color-picker-field').wpColorPicker(myOptions);
211
-
212
- /**
213
- * Restore defaults
214
- */
215
- // TODO i18n
216
- $('#restore-defaults').on('click', function () {
217
- return confirm('Restore the default settings?');
218
- });
219
-
220
- /**
221
- * -----------------
222
- * Dependent options
223
- * -----------------
224
- */
225
-
226
- /**
227
- * Special handling
228
- * TODO Use a technique similar to if-then for adding/removing classes
229
- */
230
-
231
- /*
232
- var viewContent = $('#view-content');
233
- var viewContentChange = function () {
234
- var thisValue = viewContent.val();
235
- viewContent.closest('td').find('.highlight2').each(function (index, el) {
236
- if ('excerpt' === thisValue) {
237
- $(el).addClass('highlight-on');
238
- } else {
239
- $(el).removeClass('highlight-on');
240
- }
241
- });
242
- };
243
- viewContentChange();
244
- viewContent.on('change', viewContentChange);
245
- */
246
-
247
- /**
248
- * Update option for [adding read-more to excerpts] based on setting
249
- * for [read-more type] (link to post or expand in place).
250
- */
251
- var viewHybrid = $('#view-more_post_in_place');
252
-
253
- var viewHybridChange = function () {
254
-
255
- var thisValue = viewHybrid.val();
256
-
257
- // var viewMoreFullPost = $('#view-more_full_post');
258
- // if ('1' === thisValue) {
259
- // viewMoreFullPost.prop('disabled', true).find('option[value=\'1\']').prop('selected', true);
260
- // } else {
261
- // viewMoreFullPost.removeProp('disabled');
262
- // }
263
-
264
- var viewDefaultMore = $('#view-use_default_more');
265
- if ('1' === thisValue) {
266
- viewDefaultMore.prop('disabled', true).find('option[value=\'0\']').prop('selected', true);
267
- } else {
268
- viewDefaultMore.removeProp('disabled');
269
- }
270
- viewDefaultMore.change();
271
-
272
- };
273
-
274
- viewHybridChange();
275
-
276
- viewHybrid.on('change', viewHybridChange);
277
-
278
- /**
279
- * Plugin: Show/Hide parts based on current Mode
280
- */
281
- $.fn.updateScreen = function (mode, speed) {
282
- speed = speed || 400;
283
- if (!mode)
284
- return;
285
-
286
- var modeDesc = $('.mode-description');
287
- modeDesc.html('');
288
- $('.then_' + mode).fadeIn(speed);
289
- $('.then_not_' + mode).fadeOut(speed);
290
-
291
- /**
292
- * Special handling
293
- */
294
- switch (mode) {
295
- case 'form':
296
- // hack
297
- setTimeout(formTemplateDescriptions, 500);
298
- break;
299
- case 'slideshow':
300
- break;
301
- case 'display':
302
- // update single/multiple selector ONLY
303
- $.fn.selectPerOption($('#view-single_or_multiple'));
304
- break;
305
- case 'single_template':
306
- break;
307
- default:
308
- }
309
-
310
- /**
311
- * Update description
312
- *
313
- * @since 2.22.0
314
- */
315
- var data = {
316
- 'action': 'wpmtst_view_get_mode_description',
317
- 'mode': mode
318
- };
319
- $.get(ajaxurl, data, function (response) {
320
- if (response) {
321
- modeDesc.html(response);
322
- }
323
- });
324
-
325
- return this;
326
- };
327
-
328
- /**
329
- * Plugin: Toggle dependent options for checkboxes.
330
- *
331
- * Show/hide other option groups when checkbox is "on".
332
- * Single value
333
- */
334
- $.fn.toggleOption = function (el, speed) {
335
- speed = speed || 400;
336
- var option = $(el).attr('id').split('-').pop();
337
- var checked = $(el).prop('checked');
338
- var deps = '.then_' + option;
339
- var indeps = '.then_not_' + option;
340
- if (checked) {
341
- $(deps).fadeIn(speed);
342
- $(indeps).fadeOut(speed);
343
- }
344
- else {
345
- $(deps).fadeOut(speed);
346
- $(indeps).fadeIn(speed);
347
- }
348
- return this;
349
- };
350
-
351
- /**
352
- * Plugin: Toggle dependent options for checkboxes.
353
- *
354
- * Show/hide other option groups when checkbox is "on".
355
- * Multiple values
356
- *
357
- * @since 1.20.0
358
- */
359
- $.fn.selectPerOption = function (el, speed) {
360
- speed = speed || 400;
361
- var fast = 0;
362
- //var option = $(el).attr("id").split("-").pop();
363
- var currentValue = $(el).val();
364
- var deps = '.then_' + currentValue;
365
- var depsFast = deps + '.fast';
366
- var indeps = '.then_not_' + currentValue;
367
- var indepsFast = indeps + '.fast';
368
- if (currentValue) {
369
-
370
- $(depsFast).not('.then_not_' + currentMode).fadeIn(fast);
371
- $(deps).not('.fast, .then_not_' + currentMode).fadeIn(speed);
372
-
373
- $(indepsFast).fadeOut(fast);
374
- $(indeps).not('.fast').fadeOut(speed);
375
-
376
- } else {
377
-
378
- $(indepsFast).fadeIn(fast);
379
- $(indeps).not('.fast').fadeIn(speed);
380
-
381
- $(depsFast).fadeOut(fast);
382
- $(deps).not('.fast').fadeOut(speed);
383
-
384
- }
385
- return this;
386
- };
387
-
388
- /**
389
- * Plugin: Toggle dependent options for selects.
390
- *
391
- * Show/hide other option groups when one and only one *specific* option is selected.
392
- * class="if select"
393
- * ~TRIP~
394
- */
395
- $.fn.selectOption = function (el, speed) {
396
- speed = speed || 400;
397
- var currentValue = $(el).val();
398
- var tripValue = $(el).find('.trip').val();
399
- var option = $(el).attr('id').split('-').pop();
400
- var deps = '.then_' + option;
401
- if (currentValue === tripValue) {
402
- $(deps).fadeIn(speed);
403
- }
404
- else {
405
- $(deps).fadeOut(speed);
406
- }
407
- return this;
408
- };
409
-
410
- /**
411
- * Plugin: Toggle dependent options for selects.
412
- *
413
- * Show/hide other option groups when one and only one *specific* option is selected.
414
- * class="if selectnot"
415
- * ~TRIP~
416
- */
417
- $.fn.selectNotOption = function (el, speed) {
418
- speed = speed || 400;
419
- var currentValue = $(el).val();
420
- var tripValue = $(el).find('.trip').val();
421
- var option = $(el).attr('id').split('-').pop();
422
- var deps = '.then_' + option;
423
- if (currentValue === tripValue) {
424
- $(deps).fadeOut(speed);
425
- }
426
- else {
427
- $(deps).fadeIn(speed);
428
- }
429
- return this;
430
- };
431
-
432
- /**
433
- * Plugin: Toggle dependent options for selects.
434
- *
435
- * Show/hide other option groups when any *non-empty (initial)* option is selected.
436
- * class="if selectany"
437
- */
438
- $.fn.selectAnyOption = function (el, speed) {
439
- speed = speed || 400;
440
- var currentValue = $(el).val();
441
- var option = $(el).attr('id').split('-').pop();
442
- var deps = '.then_' + option + '.then_' + currentValue;
443
- var indeps = '.then_not_' + option + '.then_' + currentValue;
444
- if (currentValue) {
445
- $(deps).fadeIn(speed);
446
- $(indeps).fadeOut(speed);
447
- }
448
- else {
449
- $(deps).fadeOut(speed);
450
- $(indeps).fadeIn(speed);
451
- }
452
- return this;
453
- };
454
-
455
- /**
456
- * Plugin: Toggle dependent options.
457
- *
458
- * Show/hide other option groups depending on value (1:1 relationshsip).
459
- * Using both option and value, which is different method than other functions.
460
- * class="if selectgroup"
461
- *
462
- * @since 1.20.0
463
- */
464
- $.fn.selectGroupOption = function (el) {
465
- var speed = 400,
466
- fastOut = 0,
467
- fastIn = 100;
468
- var option = $(el).attr('id').split('-').pop();
469
- var currentValue = $(el).val();
470
- var deps = '.then_' + option + '.then_' + currentValue;
471
- var depsFast = deps + '.fast';
472
- var indeps = '.then_' + option + '.then_not_' + currentValue;
473
- var indepsFast = indeps + '.fast';
474
- if (currentValue) {
475
- $(depsFast).fadeIn(fastIn);
476
- $(deps).not('.fast').fadeIn(speed);
477
- $(indepsFast).fadeOut(fastOut);
478
- $(indeps).not('.fast').fadeOut(speed);
479
- }
480
- else {
481
- $(indepsFast).fadeIn(fastIn);
482
- $(indeps).not('.fast').fadeIn(speed);
483
- $(depsFast).fadeOut(fastOut);
484
- $(deps).not('.fast').fadeOut(speed);
485
- }
486
- return this;
487
- };
488
-
489
- /**
490
- * Initial state
491
- */
492
- var $mode = $('#view-mode');
493
- var currentMode = $mode.find('input:checked').val();
494
- $mode.find('input:checked').closest('label').addClass('checked');
495
- $.fn.updateScreen(currentMode);
496
-
497
- /**
498
- * Mode listener
499
- */
500
- $mode.find('input').on('change', function () {
501
- currentMode = $(this).val();
502
- $mode.find('input').not(':checked').closest('label').removeClass('checked');
503
- $mode.find('input:checked').closest('label').addClass('checked');
504
- $.fn.updateScreen(currentMode);
505
-
506
- // Force default template since we have more than one group of templates.
507
- $('input[type=radio][name=\'view[data][template]\'][value=\'default\']').prop('checked', true);
508
- templateRadios.change();
509
- $('input[type=radio][name=\'view[data][form-template]\'][value=\'default-form\']').prop('checked', true);
510
- // formTemplateRadios.change();
511
- layoutRadios.change();
512
- backgroundRadios.change();
513
- });
514
-
515
- /**
516
- * Initial state & Change listeners
517
- */
518
- function initialize () {
519
- $('.if.toggle').each(function (index, el) {
520
- $.fn.toggleOption(this);
521
- $(this).on('change', function () {
522
- $.fn.toggleOption(this);
523
- });
524
- });
525
-
526
- $('.if.select').each(function (index, el) {
527
- $.fn.selectOption(this);
528
- $(this).on('change', function () {
529
- $.fn.selectOption(this);
530
- });
531
- });
532
-
533
- $('.if.selectnot').each(function (index, el) {
534
- $.fn.selectNotOption(this);
535
- $(this).on('change', function () {
536
- $.fn.selectNotOption(this).afterToggle();
537
- });
538
- });
539
-
540
- $('.if.selectany').each(function (index, el) {
541
- $.fn.selectAnyOption(this);
542
- $(this).on('change', function () {
543
- $.fn.selectAnyOption(this);
544
- });
545
- });
546
-
547
- $('.if.selectper').each(function (index, el) {
548
- $.fn.selectPerOption(this);
549
- $(this).on('change', function () {
550
- $.fn.selectPerOption(this).afterToggle();
551
- });
552
- });
553
-
554
- $('.if.selectgroup').each(function (index, el) {
555
- $.fn.selectGroupOption(this);
556
- $(this).on('change', function () {
557
- $.fn.selectGroupOption(this);
558
- });
559
- });
560
-
561
- $('.field-name select').each(function () {
562
- var $el = $(this);
563
- var $elParent = $el.closest('.field3');
564
- var fieldValue = $el.val();
565
- var fieldType = $el.find('option:selected').data('type');
566
- var key = $elParent.data('key');
567
- var typeSelectParent = $elParent.find('td.field-type');
568
- var typeSelect = typeSelectParent.find('select');
569
-
570
- if (fieldValue === 'post_date') {
571
- typeSelect.prop('disabled', true);
572
- typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
573
- }
574
- else if (fieldValue === 'submit_date') {
575
- typeSelect.prop('disabled', true);
576
- typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
577
- }
578
- else if (fieldValue === 'category') {
579
- typeSelect.prop('disabled', true);
580
- typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
581
- }
582
- else if (fieldType === 'rating') { /* --- type! --- */
583
- typeSelect.prop('disabled', true);
584
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
585
- }
586
- else {
587
- $(typeSelect).prop('disabled', false);
588
- $(typeSelect).parent().find('input.save-type').remove();
589
- }
590
- });
591
-
592
- }
593
-
594
- initialize();
595
-
596
- /**
597
- * Link field text change listener
598
- */
599
- function textChangeListener () {
600
- $('select[id^="view-fieldtext"]').on('change', function () {
601
- if ($(this).val() === 'custom') {
602
- var key = $(this).closest('.field3').data('key');
603
- $('#view-fieldtext' + key + '-custom').focus();
604
- }
605
- });
606
- }
607
-
608
- textChangeListener();
609
-
610
- /**
611
- * Template change listener
612
- */
613
- // TODO Use ID
614
- var templateRadios = $('input[type=radio][name=\'view[data][template]\']');
615
-
616
- function templateDescriptions () {
617
- var templateRadioOff, templateRadioOn, template;
618
-
619
- templateRadioOff = templateRadios.filter(':not(:checked)');
620
- templateRadioOff.closest('li').removeClass('current-selection').find('.template-description').children(':not(:first-child)').hide();
621
-
622
- templateRadioOn = templateRadios.filter(':checked');
623
- template = templateRadioOn.val();
624
- templateRadioOn.closest('li').addClass('current-selection').find('.template-description').children(':not(:first-child)').show();
625
-
626
- // Check for forced options
627
- if (template) {
628
- $('input.forced').removeProp('disabled').removeClass('forced');
629
- var data = {
630
- 'action': 'wpmtst_force_check',
631
- 'template': template
632
- };
633
- $.get(ajaxurl, data, function (response) {
634
- if (response.success) {
635
- var arrayLength, $el, inputName;
636
- arrayLength = response.data.length;
637
- for (var i = 0; i < arrayLength; i++) {
638
- $el = $('#' + response.data[i]);
639
- $el.prop('checked', true).change();
640
- inputName = $el.prop('name');
641
- $('input[name=\'' + inputName + '\']').prop('disabled', true).addClass('forced');
642
- }
643
- }
644
- });
645
-
646
- // Special handling
647
- if ('unstyled' === template) {
648
- $('input[name=\'view[data][background][type]\']').prop('disabled', true);
649
- $('input[name=\'view[data][font-color][type]\']').prop('disabled', true);
650
- } else {
651
- $('input[name=\'view[data][background][type]\']').prop('disabled', false);
652
- $('input[name=\'view[data][font-color][type]\']').prop('disabled', false);
653
- }
654
-
655
- // Special handling for Lucid add-on until I can incorporate a template group config file
656
- if ('lucid' === template.substr(0, 5) || 'single_template' === currentMode) {
657
- $('.then_lucid').show();
658
- } else {
659
- $('.then_lucid').hide();
660
- }
661
- }
662
- }
663
-
664
- templateDescriptions();
665
-
666
- templateRadios.on('change', templateDescriptions);
667
-
668
- /**
669
- * Form template change listener
670
- */
671
- var formTemplateRadios = $('input[type=radio][name=\'view[data][form-template]\']');
672
-
673
- function formTemplateDescriptions () {
674
- var formTemplateRadioOff, formTemplateRadioOn, formTemplate;
675
-
676
- formTemplateRadioOff = formTemplateRadios.filter(':not(:checked)');
677
- formTemplateRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
678
-
679
- formTemplateRadioOn = formTemplateRadios.filter(':checked');
680
- formTemplate = formTemplateRadioOn.val();
681
- formTemplateRadioOn.closest('li').addClass('current-selection').find('.options').show();
682
- }
683
-
684
- formTemplateDescriptions();
685
-
686
- formTemplateRadios.on('change', formTemplateDescriptions);
687
-
688
- /**
689
- * Layout change listener
690
- */
691
- // TODO Use ID instead.
692
- var layoutRadios = $('input[type=radio][name=\'view[data][layout]\']');
693
-
694
- function layoutDescriptions () {
695
- var layoutRadioOff, layoutRadioOn, layout;
696
-
697
- layoutRadioOff = layoutRadios.filter(':not(:checked)');
698
- layoutRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
699
-
700
- layoutRadioOn = layoutRadios.filter(':checked');
701
- layout = layoutRadioOn.attr('id');
702
- layoutRadioOn.closest('li').addClass('current-selection').find('.options').show();
703
-
704
- $('.layout-description, .layout-example').hide();
705
- $('.' + layout).show();
706
-
707
- // Special handling
708
-
709
- if ('view-layout-normal' === layout)
710
- $('#column-count-wrapper').fadeOut();
711
- else
712
- $('#column-count-wrapper').fadeIn();
713
-
714
- if ('view-layout-masonry' === layout) {
715
- if ($('#view-pagination').is(':checked')) {
716
- alert('Masonry is incompatible with pagination. Please disable pagination first.');
717
- $('#view-layout-normal').prop('checked', true).change();
718
- }
719
- }
720
- }
721
-
722
- layoutDescriptions();
723
-
724
- layoutRadios.on('change', layoutDescriptions);
725
-
726
- /**
727
- * Pagination change listener
728
- */
729
- function paginationChangeListener () {
730
- // Pagination is incompatible with Masonry
731
- // TODO DRY
732
- if ($(this).is(':checked') && 'masonry' === layoutRadios.filter(':checked').val()) {
733
- alert('Pagination is incompatible with Masonry. Please select another layout first.');
734
- $(this).prop('checked', false).change();
735
- }
736
- }
737
-
738
- $('#view-pagination').on('change', paginationChangeListener);
739
-
740
- /**
741
- * Disallow standard pagination with query limit.
742
- */
743
- var $viewQuantity = $('#view-all'),
744
- $viewPaginationType = $('#view-pagination_type');
745
-
746
- function paginationTypeChangeListener () {
747
- if (this.value === 'standard' && $viewQuantity.val() === '0' && $('#view-pagination').is(':checked')) {
748
- alert('Standard pagination is incompatible with Count.');
749
- $(this).val('simple').change();
750
- }
751
- }
752
-
753
- function quantityChangeListener () {
754
- if (this.value === '0' && $viewPaginationType.val() === 'standard' && $('#view-pagination').is(':checked')) {
755
- alert('Count is incompatible with Standard pagination.');
756
- $(this).val(1).change();
757
- }
758
- }
759
-
760
- $viewPaginationType.on('change', paginationTypeChangeListener);
761
- $viewQuantity.on('change', quantityChangeListener);
762
-
763
- /**
764
- * ----------------------------------------------------------------------
765
- * Background and Font colors
766
- * ----------------------------------------------------------------------
767
- */
768
- function updateBackgroundPreview () {
769
- var c1,
770
- c2,
771
- c3,
772
- background = backgroundRadios.filter(':checked').val(),
773
- fontColor = fontColorRadios.filter(':checked').val();
774
-
775
- if ('custom' === fontColor) {
776
- c3 = document.getElementById('fc-color').value;
777
- backgroundPreview.css('color', c3);
778
- } else {
779
- backgroundPreview.css('color', 'inherit');
780
- }
781
- switch (background) {
782
- case '':
783
- backgroundPreview.css('background', 'transparent');
784
- break;
785
- case 'single':
786
- c1 = document.getElementById('bg-color').value;
787
- backgroundPreview.css('background', c1);
788
- break;
789
- case 'gradient':
790
- c1 = document.getElementById('bg-gradient1').value;
791
- c2 = document.getElementById('bg-gradient2').value;
792
- backgroundPreview.css(constructGradientCSS(c1, c2));
793
- break;
794
- case 'preset':
795
- backgroundPreset(backgroundPresetSelector.val());
796
- break;
797
- default:
798
- }
799
-
800
- }
801
-
802
- var backgroundRadios = $('input[type=radio][name=\'view[data][background][type]\']'),
803
- backgroundPreview = $('#background-preview'),
804
- backgroundPresetSelector = $('#view-background-preset');
805
-
806
- /**
807
- * Font-color change listener
808
- */
809
- // TODO Use ID instead.
810
- var fontColorRadios = $('input[type=radio][name=\'view[data][font-color][type]\']');
811
-
812
- function fontColorDescriptions () {
813
- var fontColorRadioOff, fontColorRadioOn, fontColorID;
814
-
815
- fontColorRadioOff = fontColorRadios.filter(':not(:checked)');
816
- fontColorRadioOff.closest('li').removeClass('current-selection');
817
-
818
- fontColorRadioOn = fontColorRadios.filter(':checked');
819
- fontColorID = fontColorRadioOn.filter(':checked').attr('id');
820
- fontColorRadioOn.closest('li').addClass('current-selection');
821
-
822
- $('#view-font-color-info')
823
- .find('.font-color-description:visible')
824
- .hide()
825
- .end()
826
- .find('.' + fontColorID)
827
- .show();
828
-
829
- updateBackgroundPreview();
830
- }
831
-
832
- fontColorDescriptions();
833
-
834
- fontColorRadios.on('change', fontColorDescriptions);
835
-
836
- /**
837
- * Background change listener
838
- */
839
- function backgroundDescriptions () {
840
- var backgroundRadioOff, backgroundRadioOn, backgroundID;
841
-
842
- backgroundRadioOff = backgroundRadios.filter(':not(:checked)');
843
- backgroundRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
844
-
845
- backgroundRadioOn = backgroundRadios.filter(':checked');
846
- backgroundID = backgroundRadioOn.filter(':checked').attr('id');
847
- backgroundRadioOn.closest('li').addClass('current-selection').find('.options').show();
848
-
849
- $('#view-background-info')
850
- .find('.background-description:visible')
851
- .hide()
852
- .end()
853
- .find('.' + backgroundID)
854
- .show();
855
-
856
- updateBackgroundPreview();
857
- }
858
-
859
- backgroundDescriptions();
860
-
861
- backgroundRadios.on('change', backgroundDescriptions);
862
-
863
- backgroundPresetSelector.on('change', function () {
864
- backgroundPreset($(this).val());
865
- });
866
-
867
- function backgroundPreset (preset) {
868
- if (!preset) {
869
- backgroundPreview.css('background', 'transparent');
870
- return;
871
- }
872
-
873
- var data = {
874
- 'action': 'wpmtst_get_background_preset_colors',
875
- 'key': preset,
876
- };
877
- $.get(ajaxurl, data, function (response) {
878
- var presetObj = JSON.parse(response);
879
- if (presetObj.color && presetObj.color2) {
880
- backgroundPreview.css(constructGradientCSS(presetObj.color, presetObj.color2));
881
- }
882
- else if (presetObj.color) {
883
- backgroundPreview.css('background', presetObj.color);
884
- }
885
- else {
886
- backgroundPreview.css('background', 'transparent');
887
- }
888
- });
889
- }
890
-
891
- function constructGradientCSS (c1, c2) {
892
- return {
893
- 'background': 'linear-gradient(to bottom, ' + c1 + ' 0%, ' + c2 + ' 100%)'
894
- };
895
- }
896
-
897
- //$.fn.updateScreen(currentMode);
898
-
899
- /**
900
- * -------------
901
- * Client fields
902
- * -------------
903
- */
904
-
905
- /**
906
- * Make client fields sortable
907
- */
908
-
909
- var customFieldList = $('#custom-field-list2');
910
-
911
- // Prevent single click on handle from opening accordion
912
- customFieldList.on('click', 'span.handle', function (e) {
913
- e.stopImmediatePropagation();
914
- e.preventDefault();
915
- });
916
-
917
- // customFieldList.find(".field-properties").hide();
918
-
919
- customFieldList.sortable({
920
- placeholder: 'sortable-placeholder',
921
- // forcePlaceholderSize: true,
922
- handle: '.handle',
923
- cursor: 'move',
924
- helper: 'clone',
925
- start: function (e, ui) {
926
- ui.placeholder.height(ui.item.height());
927
- }
928
- });
929
- //}).disableSelection(); // <-- this breaks Firefox
930
-
931
- /**
932
- * Add client field
933
- */
934
- $('#add-field').on('click', function (e) {
935
- var keys = $('.field3').map(function () {
936
- return $(this).data('key');
937
- }).get();
938
- var nextKey = Array.max(keys) + 1;
939
- var data = {
940
- 'action': 'wpmtst_view_add_field',
941
- 'key': nextKey,
942
- };
943
- $.get(ajaxurl, data, function (response) {
944
- $.when(customFieldList.append(response)).then(function () {
945
- var $newField = customFieldList.find('#field-' + nextKey);
946
- $newField
947
- .find('div.link').click().end()
948
- .find('.field-dep').hide().end()
949
- .find('.first-field').focus();
950
- });
951
- });
952
- });
953
-
954
- /**
955
- * Field type change listener
956
- */
957
- customFieldList.on('change', '.field-type select', function () {
958
- var $el = $(this);
959
- var $elParent = $el.closest('.field3');
960
- var fieldType = $el.val();
961
- var fieldName = $elParent.find('.field-name').find('select').val();
962
- // var key = $elParent.attr("id").split('-').slice(-1)[0];
963
- var key = $elParent.data('key');
964
- var data;
965
-
966
- switch (fieldType) {
967
-
968
- case 'link2':
969
- case 'link':
970
- // if changing to [link], add link fields
971
- data = {
972
- 'action': 'wpmtst_view_add_field_link',
973
- 'fieldName': fieldName,
974
- 'fieldType': fieldType,
975
- 'key': key,
976
- };
977
- $.get(ajaxurl, data, function (response) {
978
- // insert into placeholder div
979
- $elParent.find('.field-property-box').html(response);
980
-
981
- // Trigger conditional select
982
- var $newFieldSelect = $elParent.find('.if.selectgroup');
983
- $.fn.selectGroupOption($newFieldSelect);
984
- $newFieldSelect.on('change', function () {
985
- $.fn.selectGroupOption($newFieldSelect);
986
- });
987
- textChangeListener();
988
-
989
- // Get field name --> Get field label --> Populate link_text label
990
- var fieldName = $elParent.find('.field-name').find('select').val();
991
- var data2 = {
992
- 'action': 'wpmtst_view_get_label',
993
- 'name': fieldName,
994
- };
995
- $.get(ajaxurl, data2, function (response) {
996
- // var key = $elParent.attr("id").split('-').slice(-1)[0];
997
- $('#view-fieldtext' + key + '-label').val(response);
998
- });
999
-
1000
- });
1001
- break;
1002
-
1003
- case 'date':
1004
- // if changing to [date], add date fields
1005
- data = {
1006
- 'action': 'wpmtst_view_add_field_date',
1007
- 'key': key,
1008
- };
1009
- $.get(ajaxurl, data, function (response) {
1010
- // insert into placeholder div
1011
- $elParent.find('.field-property-box').html(response);
1012
- });
1013
- break;
1014
-
1015
- case 'text':
1016
- // if changing to [text], remove meta fields
1017
- $elParent.find('.field-property-box').empty();
1018
- break;
1019
-
1020
- default:
1021
-
1022
- }
1023
- });
1024
-
1025
- /**
1026
- * Field name change listener.
1027
- */
1028
- customFieldList.on('change', '.field-name select', function () {
1029
- var $el = $(this);
1030
- var $elParent = $el.closest('.field3');
1031
- var fieldType = $el.find('option:selected').data('type');
1032
- var fieldValue = $el.val();
1033
- var key = $elParent.data('key');
1034
- var typeSelectParent = $elParent.find('.field-type');
1035
- var typeSelect = typeSelectParent.find('select');
1036
- var data;
1037
-
1038
- $elParent.not('.open').addClass('open').find('.field-properties').addClass('open').slideDown();
1039
-
1040
- if ('' === fieldValue) {
1041
- $elParent.find('.field-description').html('');
1042
- // Hide dependent inputs if nothing has been selected
1043
- $elParent.find('.field-dep').hide();
1044
- }
1045
- else {
1046
- // Update field label
1047
- data = {
1048
- 'action': 'wpmtst_view_get_label',
1049
- 'name': fieldValue,
1050
- 'key': key,
1051
- };
1052
- $.get(ajaxurl, data, function (response) {
1053
- if (response) {
1054
- $elParent.find('.field-description').html(response);
1055
-
1056
- //trigger custom event
1057
- var event = document.createEvent('Event');
1058
- event.initEvent('wpmtst_custom_field_changed', true, true);
1059
- document.dispatchEvent(event);
1060
- }
1061
- });
1062
-
1063
- // Show dependent inputs
1064
- $elParent.find('.field-dep').show();
1065
- }
1066
-
1067
- switch (fieldValue) {
1068
- // First, the immutables
1069
- case 'post_date':
1070
- case 'submit_date':
1071
- // Disable type selector
1072
- typeSelect.val('date').prop('disabled', true);
1073
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
1074
-
1075
- // add format field
1076
- data = {
1077
- 'action': 'wpmtst_view_add_field_date',
1078
- 'key': key,
1079
- };
1080
- $.get(ajaxurl, data, function (response) {
1081
- // Insert into placeholder div. Add hidden field because we are
1082
- // disabling the <select> so its value will not be submitted.
1083
- $elParent.find('.field-property-box').html(response); // .find("input").focus();
1084
- $el.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][type]" value="date">');
1085
- });
1086
- break;
1087
-
1088
- case 'link2':
1089
- case 'link':
1090
- // Get field name --> Get field label --> Populate link_text label
1091
- var fieldName = $elParent.find('.field-name').find('select').val();
1092
- var data2 = {
1093
- 'action': 'wpmtst_view_get_label',
1094
- 'name': fieldName,
1095
- };
1096
- $.get(ajaxurl, data2, function (response) {
1097
- var key = $elParent.attr('id').split('-').slice(-1)[0];
1098
- $('#view-fieldtext' + key + '-label').val(response);
1099
- });
1100
- break;
1101
-
1102
- case 'category':
1103
- $(typeSelect).val('category').prop('disabled', true);
1104
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
1105
- $elParent.find('.field-property-box').empty();
1106
- break;
1107
-
1108
- default:
1109
- // Special handling
1110
- if ('rating' === fieldType) {
1111
- typeSelect.val('rating').prop('disabled', true);
1112
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
1113
- $elParent.find('.field-property-box').empty();
1114
- break;
1115
- }
1116
-
1117
- $(typeSelect).val('text').prop('disabled', false);
1118
- // remove meta field
1119
- $elParent.find('.field-property-box').empty();
1120
- // remove the saved type that's only necessary when we disable the input (above)
1121
- $el.parent().find('input.save-type').remove();
1122
- }
1123
- });
1124
-
1125
- /**
1126
- * Delete a client field
1127
- */
1128
- customFieldList.on('click', 'span.delete', function (e) {
1129
- var thisField = $(this).closest('.field2');
1130
- var yesno = confirm('Remove this field?');
1131
- if (yesno) {
1132
- thisField.fadeOut(function () {
1133
- $(this).remove();
1134
-
1135
- //trigger custom event
1136
- var event = document.createEvent('Event');
1137
- event.initEvent('wpmtst_custom_field_deleted', true, true);
1138
- document.dispatchEvent(event);
1139
- });
1140
- }
1141
- // Prevent click from expanding accordion
1142
- e.stopImmediatePropagation();
1143
- e.preventDefault();
1144
- });
1145
-
1146
- customFieldList.on('click', 'div.link', function (e) {
1147
- $(this)
1148
- .closest('.field2')
1149
- .toggleClass('open')
1150
- .find('.field-properties')
1151
- .slideToggle(100);
1152
- return false;
1153
- });
1154
-
1155
- /**
1156
- * Slider|Carousel change listener
1157
- */
1158
- var $sliderType = $('#view-slider_type');
1159
- var $effect = $('#view-effect');
1160
- var $position = $('view-slideshow_nav_position');
1161
-
1162
- var sliderTypeUpdate = function () {
1163
- if ($sliderType.val() === 'show_multiple') {
1164
- $effect.find('option[value=\'horizontal\']').prop('selected', true);
1165
- $position.find('option[value=\'outside\']').prop('selected', true);
1166
-
1167
- $sliderType.parent().siblings('.option-desc.singular').hide();
1168
- $sliderType.parent().siblings('.option-desc.plural').showInlineBlock();
1169
- } else {
1170
- $sliderType.parent().siblings('.option-desc.singular').showInlineBlock();
1171
- $sliderType.parent().siblings('.option-desc.plural').hide();
1172
- }
1173
-
1174
- $effect.change();
1175
- $position.change();
1176
- };
1177
-
1178
- sliderTypeUpdate();
1179
-
1180
- $sliderType.on('change', sliderTypeUpdate);
1181
-
1182
- /**
1183
- * MaxSlides change listener
1184
- */
1185
- var $maxSlides = $('[id^=\'view-max_slides\']');
1186
-
1187
- // Update display
1188
- var maxSlidesUpdateValue = function (el) {
1189
- var $el = $(el);
1190
- var maxSlidesValue = parseInt($el.val());
1191
- if (maxSlidesValue > 1) {
1192
- $el.parent().siblings('.option-desc.singular').hide();
1193
- $el.parent().siblings('.option-desc.plural').showInlineBlock();
1194
- } else {
1195
- $el.parent().siblings('.option-desc.singular').showInlineBlock();
1196
- $el.parent().siblings('.option-desc.plural').hide();
1197
- }
1198
- };
1199
-
1200
- // Initial display
1201
- $maxSlides.each( function (index, el) {
1202
- maxSlidesUpdateValue(el);
1203
- });
1204
-
1205
- // Update on change
1206
- var maxSlidesUpdate = function (e) {
1207
- maxSlidesUpdateValue( $(e.target) );
1208
- };
1209
-
1210
- // Event listener
1211
- $maxSlides.each( function (index, el) {
1212
- $(el).on('change', maxSlidesUpdate);
1213
- });
1214
-
1215
- /**
1216
- * MoveSlides change listener
1217
- */
1218
- var $moveSlides = $('[id^=\'view-move_slides\']');
1219
-
1220
- // Update display
1221
- var moveSlidesUpdateValue = function (el) {
1222
- var $el = $(el);
1223
- var moveSlidesValue = parseInt($el.val());
1224
- if (moveSlidesValue > 1) {
1225
- $el.parent().siblings('.option-desc.singular').hide();
1226
- $el.parent().siblings('.option-desc.plural').showInlineBlock();
1227
- } else {
1228
- $el.parent().siblings('.option-desc.singular').showInlineBlock();
1229
- $el.parent().siblings('.option-desc.plural').hide();
1230
- }
1231
- };
1232
-
1233
- // Initial display
1234
- $moveSlides.each( function (index, el) {
1235
- moveSlidesUpdateValue(el);
1236
- });
1237
-
1238
- // Update on change
1239
- var moveSlidesUpdate = function (e) {
1240
- moveSlidesUpdateValue( $(e.target) );
1241
- };
1242
-
1243
- // Event listener
1244
- $moveSlides.each( function (index, el) {
1245
- $(el).on('change', moveSlidesUpdate);
1246
- });
1247
-
1248
- /**
1249
- * Restore default breakpoints
1250
- */
1251
- $('#restore-default-breakpoints').click(function (e) {
1252
- var data = {
1253
- 'action': 'wpmtst_restore_default_breakpoints'
1254
- };
1255
-
1256
- $.get(ajaxurl, data, function (response) {
1257
-
1258
- var object = JSON.parse(response);
1259
- var targetId;
1260
- var el;
1261
-
1262
- for (var key in object) {
1263
-
1264
- if (object.hasOwnProperty(key)) {
1265
-
1266
- // width
1267
- targetId = 'view-breakpoint_' + key;
1268
- el = $('[id="' + targetId + '"]');
1269
- el.val(parseInt(object[key].width));
1270
-
1271
- // max_slides
1272
- targetId = 'view-max_slides_' + key;
1273
- el = $('[id="' + targetId + '"]');
1274
- el.val(parseInt(object[key].max_slides));
1275
-
1276
- // margin
1277
- targetId = 'view-margin_' + key;
1278
- el = $('[id="' + targetId + '"]');
1279
- el.val(parseInt(object[key].margin));
1280
-
1281
- // move_slides
1282
- targetId = 'view-move_slides_' + key;
1283
- el = $('[id="' + targetId + '"]');
1284
- el.val(parseInt(object[key].move_slides));
1285
-
1286
- }
1287
-
1288
- }
1289
-
1290
- document.getElementById('restored-message').classList.add('copied');
1291
- setTimeout(function () {
1292
- document.getElementById('restored-message').classList.remove('copied');
1293
- }, 2000);
1294
-
1295
- });
1296
- });
1297
-
1298
- })(jQuery);
1299
-
1300
- /**
1301
- * Click to copy to keyboard
1302
- * Thanks https://www.sitepoint.com/javascript-copy-to-clipboard/
1303
- */
1304
- (function () {
1305
-
1306
- 'use strict';
1307
-
1308
- // click events
1309
- document.body.addEventListener('click', copy, true);
1310
-
1311
- // event handler
1312
- function copy (e) {
1313
-
1314
- // find target element
1315
- var
1316
- t = e.target,
1317
- c = t.dataset.copytarget,
1318
- inp = (c ? document.querySelector(c) : null);
1319
-
1320
- // is element selectable?
1321
- if (inp && inp.select) {
1322
-
1323
- // select text
1324
- inp.select();
1325
-
1326
- try {
1327
- // copy text
1328
- document.execCommand('copy');
1329
- inp.blur();
1330
-
1331
- //t.classList.add('copied');
1332
- //setTimeout(function() { t.classList.remove('copied'); }, 1500);
1333
- document.getElementById('copy-message').classList.add('copied');
1334
- setTimeout(function () {
1335
- document.getElementById('copy-message').classList.remove('copied');
1336
- }, 2000);
1337
- }
1338
- catch (err) {
1339
- alert('Sorry, please press Ctrl/Cmd+C to copy instead.');
1340
- }
1341
-
1342
- }
1343
-
1344
- }
1345
-
1346
- })();
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Strong Testimonials - Views
3
+ */
4
+
5
+ // Function to get the Max value in Array
6
+ Array.max = function (array) {
7
+ return Math.max.apply(Math, array);
8
+ };
9
+
10
+ (function ($) {
11
+ $.fn.showInlineBlock = function () {
12
+ return this.css('display', 'inline-block');
13
+ };
14
+ })(jQuery);
15
+
16
+ /**
17
+ * jQuery alterClass plugin
18
+ *
19
+ * Remove element classes with wildcard matching. Optionally add classes:
20
+ * $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
21
+ *
22
+ * https://gist.github.com/peteboere/1517285
23
+ *
24
+ * Copyright (c) 2011 Pete Boere (the-echoplex.net)
25
+ * Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
26
+ */
27
+ (function ($) {
28
+ $.fn.alterClass = function (removals, additions) {
29
+
30
+ var self = this;
31
+
32
+ if (removals.indexOf('*') === -1) {
33
+ // Use native jQuery methods if there is no wildcard matching
34
+ self.removeClass(removals);
35
+ return !additions ? self : self.addClass(additions);
36
+ }
37
+
38
+ var patt = new RegExp('\\s' +
39
+ removals.replace(/\*/g, '[A-Za-z0-9-_]+').split(' ').join('\\s|\\s') +
40
+ '\\s', 'g');
41
+
42
+ self.each(function (i, it) {
43
+ var cn = ' ' + it.className + ' ';
44
+ while (patt.test(cn)) {
45
+ cn = cn.replace(patt, ' ');
46
+ }
47
+ it.className = $.trim(cn);
48
+ });
49
+
50
+ return !additions ? self : self.addClass(additions);
51
+ };
52
+ })(jQuery);
53
+
54
+ /**
55
+ * Special handling after toggling certain options.
56
+ */
57
+ (function ($) {
58
+ // custom handling
59
+ $.fn.afterToggle = function () {
60
+
61
+ // Category selector
62
+ var $categoryDivs = $('.view-category-list-panel');
63
+ // Set initial width to compensate for narrowed box due to checkbox being hidden first
64
+ // and to prevent horizontal jumpiness as filter is applied.
65
+ if (!$categoryDivs.hasClass('fixed')) {
66
+ $categoryDivs.width($categoryDivs.outerWidth(true)).addClass('fixed');
67
+ }
68
+
69
+ // Slideshow controls
70
+ var $controls = $('#view-slideshow_controls_type');
71
+ var $pager = $('#view-slideshow_pager_type');
72
+ var controlsValue = $controls.val();
73
+ var pagerValue = $pager.val();
74
+
75
+ if ('full' === controlsValue) {
76
+ $('.then_has-pager').fadeOut();
77
+ $pager.val('none');
78
+ $('option[value="text"]', '#view-slideshow_controls_style').prop('disabled', false);
79
+ }
80
+ else if ('sides' === controlsValue) {
81
+ $('.then_has-pager').fadeIn();
82
+ var $style = $('#view-slideshow_controls_style');
83
+ if ('text' === $style.val()) {
84
+ $('option:first', $style).prop('selected', true);
85
+ }
86
+ $('option[value="text"]', $style).prop('disabled', true);
87
+ }
88
+ else {
89
+ $('.then_has-pager').fadeIn();
90
+ $('option[value="text"]', '#view-slideshow_controls_style').prop('disabled', false);
91
+ }
92
+
93
+ if ('none' === pagerValue && ('none' === controlsValue || 'sides' === controlsValue)) {
94
+ $('.then_has-position').fadeOut();
95
+ }
96
+ else {
97
+ $('.then_has-position').fadeIn();
98
+ }
99
+
100
+ // If no navigation, must start automatically.
101
+ if ('none' === pagerValue && 'none' === controlsValue) {
102
+ $('#view-auto_start').val('1').prop('checked', true);
103
+ }
104
+
105
+ return this;
106
+ };
107
+ }(jQuery));
108
+
109
+ /**
110
+ * Remove 'result' query argument.
111
+ */
112
+ removeResultArg = function () {
113
+ var urlParams = new URLSearchParams(window.location.search);
114
+ if (urlParams.has('result')) {
115
+ urlParams.delete('result');
116
+ var newURL = window.location.pathname;
117
+ if (urlParams.toString()) {
118
+ newURL = newURL + '?' + urlParams.toString();
119
+ }
120
+ window.history.replaceState({}, document.title, newURL);
121
+ }
122
+ };
123
+
124
+ /**
125
+ * Initial actions on document.ready
126
+ */
127
+ jQuery(document).ready(function ($) {
128
+
129
+ // Masonry in the Layout section
130
+ $('.view-layout-masonry .example-container')
131
+ .find('.box')
132
+ .width(jQuery('.grid-sizer').width())
133
+ .end()
134
+ .masonry();
135
+
136
+ // Category select width
137
+ $.fn.afterToggle();
138
+
139
+ removeResultArg();
140
+ });
141
+
142
+ (function ($) {
143
+ 'use strict';
144
+
145
+ // the shortcode code
146
+ $('#view-shortcode').on('focus', function () {
147
+ $(this).select();
148
+ });
149
+
150
+ $('.expand-cats').on('click', function () {
151
+ // TODO i18n
152
+ var $categoryDivs = $('.view-category-list-panel');
153
+ if ($categoryDivs.hasClass('tall-panel')) {
154
+ $categoryDivs.addClass('short-panel').removeClass('tall-panel');
155
+ $(this).val('expand list');
156
+ } else {
157
+ $categoryDivs.removeClass('short-panel').addClass('tall-panel');
158
+ $(this).val('collapse list');
159
+ }
160
+ $(this).blur();
161
+ });
162
+
163
+ // Masonry example
164
+ var masonryExample = $('.view-layout-masonry .example-container');
165
+ masonryExample.find('.box').width($('.grid-sizer').width()).end().masonry({
166
+ columnWidth: '.grid-sizer',
167
+ gutter: 10,
168
+ itemSelector: '.box',
169
+ percentPosition: true
170
+ });
171
+
172
+ // Column count selector
173
+ var columnCount = $('#view-column-count');
174
+ var columnCountChange = function () {
175
+ var col = columnCount.val();
176
+ $('.example-container').alterClass('col-*', 'col-' + col);
177
+ masonryExample.find('.box').width($('.grid-sizer').width()).end().masonry();
178
+ };
179
+
180
+ columnCountChange();
181
+ columnCount.on('change', columnCountChange);
182
+ $('input[name=\'view[data][layout]\']').on('change', function () {
183
+ if ('masonry' === $(this).val()) {
184
+ setTimeout(columnCountChange, 200);
185
+ }
186
+ });
187
+
188
+ // Color pickers
189
+ var myOptions = {
190
+ // you can declare a default color here, or in the data-default-color attribute on the input
191
+ //defaultColor: '#FFFFFF',
192
+ // a callback to fire whenever the color changes to a valid color
193
+ change: function (event, ui) {
194
+ setTimeout(function () {
195
+ updateBackgroundPreview();
196
+ }, 250);
197
+ },
198
+ // a callback to fire when the input is emptied or an invalid color
199
+ clear: function (event, ui) {
200
+ setTimeout(function () {
201
+ updateBackgroundPreview();
202
+ }, 250);
203
+ },
204
+ // hide the color picker controls on load
205
+ //hide: true,
206
+ // show a group of common colors beneath the square
207
+ // or, supply an array of colors to customize further
208
+ palettes: true
209
+ };
210
+ $('.wp-color-picker-field').wpColorPicker(myOptions);
211
+
212
+ /**
213
+ * Restore defaults
214
+ */
215
+ // TODO i18n
216
+ $('#restore-defaults').on('click', function () {
217
+ return confirm('Restore the default settings?');
218
+ });
219
+
220
+ /**
221
+ * -----------------
222
+ * Dependent options
223
+ * -----------------
224
+ */
225
+
226
+ /**
227
+ * Special handling
228
+ * TODO Use a technique similar to if-then for adding/removing classes
229
+ */
230
+
231
+ /*
232
+ var viewContent = $('#view-content');
233
+ var viewContentChange = function () {
234
+ var thisValue = viewContent.val();
235
+ viewContent.closest('td').find('.highlight2').each(function (index, el) {
236
+ if ('excerpt' === thisValue) {
237
+ $(el).addClass('highlight-on');
238
+ } else {
239
+ $(el).removeClass('highlight-on');
240
+ }
241
+ });
242
+ };
243
+ viewContentChange();
244
+ viewContent.on('change', viewContentChange);
245
+ */
246
+
247
+ /**
248
+ * Update option for [adding read-more to excerpts] based on setting
249
+ * for [read-more type] (link to post or expand in place).
250
+ */
251
+ var viewHybrid = $('#view-more_post_in_place');
252
+
253
+ var viewHybridChange = function () {
254
+
255
+ var thisValue = viewHybrid.val();
256
+
257
+ // var viewMoreFullPost = $('#view-more_full_post');
258
+ // if ('1' === thisValue) {
259
+ // viewMoreFullPost.prop('disabled', true).find('option[value=\'1\']').prop('selected', true);
260
+ // } else {
261
+ // viewMoreFullPost.removeProp('disabled');
262
+ // }
263
+
264
+ var viewDefaultMore = $('#view-use_default_more');
265
+ if ('1' === thisValue) {
266
+ viewDefaultMore.prop('disabled', true).find('option[value=\'0\']').prop('selected', true);
267
+ } else {
268
+ viewDefaultMore.removeProp('disabled');
269
+ }
270
+ viewDefaultMore.change();
271
+
272
+ };
273
+
274
+ viewHybridChange();
275
+
276
+ viewHybrid.on('change', viewHybridChange);
277
+
278
+ /**
279
+ * Plugin: Show/Hide parts based on current Mode
280
+ */
281
+ $.fn.updateScreen = function (mode, speed) {
282
+ speed = speed || 400;
283
+ if (!mode)
284
+ return;
285
+
286
+ var modeDesc = $('.mode-description');
287
+ modeDesc.html('');
288
+ $('.then_' + mode).fadeIn(speed);
289
+ $('.then_not_' + mode).fadeOut(speed);
290
+
291
+ /**
292
+ * Special handling
293
+ */
294
+ switch (mode) {
295
+ case 'form':
296
+ // hack
297
+ setTimeout(formTemplateDescriptions, 500);
298
+ break;
299
+ case 'slideshow':
300
+ break;
301
+ case 'display':
302
+ // update single/multiple selector ONLY
303
+ $.fn.selectPerOption($('#view-single_or_multiple'));
304
+ break;
305
+ case 'single_template':
306
+ break;
307
+ default:
308
+ }
309
+
310
+ /**
311
+ * Update description
312
+ *
313
+ * @since 2.22.0
314
+ */
315
+ var data = {
316
+ 'action': 'wpmtst_view_get_mode_description',
317
+ 'mode': mode
318
+ };
319
+ $.get(ajaxurl, data, function (response) {
320
+ if (response) {
321
+ modeDesc.html(response);
322
+ }
323
+ });
324
+
325
+ return this;
326
+ };
327
+
328
+ /**
329
+ * Plugin: Toggle dependent options for checkboxes.
330
+ *
331
+ * Show/hide other option groups when checkbox is "on".
332
+ * Single value
333
+ */
334
+ $.fn.toggleOption = function (el, speed) {
335
+ speed = speed || 400;
336
+ var option = $(el).attr('id').split('-').pop();
337
+ var checked = $(el).prop('checked');
338
+ var deps = '.then_' + option;
339
+ var indeps = '.then_not_' + option;
340
+ if (checked) {
341
+ $(deps).fadeIn(speed);
342
+ $(indeps).fadeOut(speed);
343
+ }
344
+ else {
345
+ $(deps).fadeOut(speed);
346
+ $(indeps).fadeIn(speed);
347
+ }
348
+ return this;
349
+ };
350
+
351
+ /**
352
+ * Plugin: Toggle dependent options for checkboxes.
353
+ *
354
+ * Show/hide other option groups when checkbox is "on".
355
+ * Multiple values
356
+ *
357
+ * @since 1.20.0
358
+ */
359
+ $.fn.selectPerOption = function (el, speed) {
360
+ speed = speed || 400;
361
+ var fast = 0;
362
+ //var option = $(el).attr("id").split("-").pop();
363
+ var currentValue = $(el).val();
364
+ var deps = '.then_' + currentValue;
365
+ var depsFast = deps + '.fast';
366
+ var indeps = '.then_not_' + currentValue;
367
+ var indepsFast = indeps + '.fast';
368
+ if (currentValue) {
369
+
370
+ $(depsFast).not('.then_not_' + currentMode).fadeIn(fast);
371
+ $(deps).not('.fast, .then_not_' + currentMode).fadeIn(speed);
372
+
373
+ $(indepsFast).fadeOut(fast);
374
+ $(indeps).not('.fast').fadeOut(speed);
375
+
376
+ } else {
377
+
378
+ $(indepsFast).fadeIn(fast);
379
+ $(indeps).not('.fast').fadeIn(speed);
380
+
381
+ $(depsFast).fadeOut(fast);
382
+ $(deps).not('.fast').fadeOut(speed);
383
+
384
+ }
385
+ return this;
386
+ };
387
+
388
+ /**
389
+ * Plugin: Toggle dependent options for selects.
390
+ *
391
+ * Show/hide other option groups when one and only one *specific* option is selected.
392
+ * class="if select"
393
+ * ~TRIP~
394
+ */
395
+ $.fn.selectOption = function (el, speed) {
396
+ speed = speed || 400;
397
+ var currentValue = $(el).val();
398
+ var tripValue = $(el).find('.trip').val();
399
+ var option = $(el).attr('id').split('-').pop();
400
+ var deps = '.then_' + option;
401
+ if (currentValue === tripValue) {
402
+ $(deps).fadeIn(speed);
403
+ }
404
+ else {
405
+ $(deps).fadeOut(speed);
406
+ }
407
+ return this;
408
+ };
409
+
410
+ /**
411
+ * Plugin: Toggle dependent options for selects.
412
+ *
413
+ * Show/hide other option groups when one and only one *specific* option is selected.
414
+ * class="if selectnot"
415
+ * ~TRIP~
416
+ */
417
+ $.fn.selectNotOption = function (el, speed) {
418
+ speed = speed || 400;
419
+ var currentValue = $(el).val();
420
+ var tripValue = $(el).find('.trip').val();
421
+ var option = $(el).attr('id').split('-').pop();
422
+ var deps = '.then_' + option;
423
+ if (currentValue === tripValue) {
424
+ $(deps).fadeOut(speed);
425
+ }
426
+ else {
427
+ $(deps).fadeIn(speed);
428
+ }
429
+ return this;
430
+ };
431
+
432
+ /**
433
+ * Plugin: Toggle dependent options for selects.
434
+ *
435
+ * Show/hide other option groups when any *non-empty (initial)* option is selected.
436
+ * class="if selectany"
437
+ */
438
+ $.fn.selectAnyOption = function (el, speed) {
439
+ speed = speed || 400;
440
+ var currentValue = $(el).val();
441
+ var option = $(el).attr('id').split('-').pop();
442
+ var deps = '.then_' + option + '.then_' + currentValue;
443
+ var indeps = '.then_not_' + option + '.then_' + currentValue;
444
+ if (currentValue) {
445
+ $(deps).fadeIn(speed);
446
+ $(indeps).fadeOut(speed);
447
+ }
448
+ else {
449
+ $(deps).fadeOut(speed);
450
+ $(indeps).fadeIn(speed);
451
+ }
452
+ return this;
453
+ };
454
+
455
+ /**
456
+ * Plugin: Toggle dependent options.
457
+ *
458
+ * Show/hide other option groups depending on value (1:1 relationshsip).
459
+ * Using both option and value, which is different method than other functions.
460
+ * class="if selectgroup"
461
+ *
462
+ * @since 1.20.0
463
+ */
464
+ $.fn.selectGroupOption = function (el) {
465
+ var speed = 400,
466
+ fastOut = 0,
467
+ fastIn = 100;
468
+ var option = $(el).attr('id').split('-').pop();
469
+ var currentValue = $(el).val();
470
+ var deps = '.then_' + option + '.then_' + currentValue;
471
+ var depsFast = deps + '.fast';
472
+ var indeps = '.then_' + option + '.then_not_' + currentValue;
473
+ var indepsFast = indeps + '.fast';
474
+ if (currentValue) {
475
+ $(depsFast).fadeIn(fastIn);
476
+ $(deps).not('.fast').fadeIn(speed);
477
+ $(indepsFast).fadeOut(fastOut);
478
+ $(indeps).not('.fast').fadeOut(speed);
479
+ }
480
+ else {
481
+ $(indepsFast).fadeIn(fastIn);
482
+ $(indeps).not('.fast').fadeIn(speed);
483
+ $(depsFast).fadeOut(fastOut);
484
+ $(deps).not('.fast').fadeOut(speed);
485
+ }
486
+ return this;
487
+ };
488
+
489
+ /**
490
+ * Initial state
491
+ */
492
+ var $mode = $('#view-mode');
493
+ var currentMode = $mode.find('input:checked').val();
494
+ $mode.find('input:checked').closest('label').addClass('checked');
495
+ $.fn.updateScreen(currentMode);
496
+
497
+ /**
498
+ * Mode listener
499
+ */
500
+ $mode.find('input').on('change', function () {
501
+ currentMode = $(this).val();
502
+ $mode.find('input').not(':checked').closest('label').removeClass('checked');
503
+ $mode.find('input:checked').closest('label').addClass('checked');
504
+ $.fn.updateScreen(currentMode);
505
+
506
+ // Force default template since we have more than one group of templates.
507
+ $('input[type=radio][name=\'view[data][template]\'][value=\'default\']').prop('checked', true);
508
+ templateRadios.change();
509
+ $('input[type=radio][name=\'view[data][form-template]\'][value=\'default-form\']').prop('checked', true);
510
+ // formTemplateRadios.change();
511
+ layoutRadios.change();
512
+ backgroundRadios.change();
513
+ });
514
+
515
+ /**
516
+ * Initial state & Change listeners
517
+ */
518
+ function initialize () {
519
+ $('.if.toggle').each(function (index, el) {
520
+ $.fn.toggleOption(this);
521
+ $(this).on('change', function () {
522
+ $.fn.toggleOption(this);
523
+ });
524
+ });
525
+
526
+ $('.if.select').each(function (index, el) {
527
+ $.fn.selectOption(this);
528
+ $(this).on('change', function () {
529
+ $.fn.selectOption(this);
530
+ });
531
+ });
532
+
533
+ $('.if.selectnot').each(function (index, el) {
534
+ $.fn.selectNotOption(this);
535
+ $(this).on('change', function () {
536
+ $.fn.selectNotOption(this).afterToggle();
537
+ });
538
+ });
539
+
540
+ $('.if.selectany').each(function (index, el) {
541
+ $.fn.selectAnyOption(this);
542
+ $(this).on('change', function () {
543
+ $.fn.selectAnyOption(this);
544
+ });
545
+ });
546
+
547
+ $('.if.selectper').each(function (index, el) {
548
+ $.fn.selectPerOption(this);
549
+ $(this).on('change', function () {
550
+ $.fn.selectPerOption(this).afterToggle();
551
+ });
552
+ });
553
+
554
+ $('.if.selectgroup').each(function (index, el) {
555
+ $.fn.selectGroupOption(this);
556
+ $(this).on('change', function () {
557
+ $.fn.selectGroupOption(this);
558
+ });
559
+ });
560
+
561
+ $('.field-name select').each(function () {
562
+ var $el = $(this);
563
+ var $elParent = $el.closest('.field3');
564
+ var fieldValue = $el.val();
565
+ var fieldType = $el.find('option:selected').data('type');
566
+ var key = $elParent.data('key');
567
+ var typeSelectParent = $elParent.find('td.field-type');
568
+ var typeSelect = typeSelectParent.find('select');
569
+
570
+ if (fieldValue === 'post_date') {
571
+ typeSelect.prop('disabled', true);
572
+ typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
573
+ }
574
+ else if (fieldValue === 'submit_date') {
575
+ typeSelect.prop('disabled', true);
576
+ typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
577
+ }
578
+ else if (fieldValue === 'category') {
579
+ typeSelect.prop('disabled', true);
580
+ typeSelect.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
581
+ }
582
+ else if (fieldType === 'rating') { /* --- type! --- */
583
+ typeSelect.prop('disabled', true);
584
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
585
+ }
586
+ else {
587
+ $(typeSelect).prop('disabled', false);
588
+ $(typeSelect).parent().find('input.save-type').remove();
589
+ }
590
+ });
591
+
592
+ }
593
+
594
+ initialize();
595
+
596
+ /**
597
+ * Link field text change listener
598
+ */
599
+ function textChangeListener () {
600
+ $('select[id^="view-fieldtext"]').on('change', function () {
601
+ if ($(this).val() === 'custom') {
602
+ var key = $(this).closest('.field3').data('key');
603
+ $('#view-fieldtext' + key + '-custom').focus();
604
+ }
605
+ });
606
+ }
607
+
608
+ textChangeListener();
609
+
610
+ /**
611
+ * Template change listener
612
+ */
613
+ // TODO Use ID
614
+ var templateRadios = $('input[type=radio][name=\'view[data][template]\']');
615
+
616
+ function templateDescriptions () {
617
+ var templateRadioOff, templateRadioOn, template;
618
+
619
+ templateRadioOff = templateRadios.filter(':not(:checked)');
620
+ templateRadioOff.closest('li').removeClass('current-selection').find('.template-description').children(':not(:first-child)').hide();
621
+
622
+ templateRadioOn = templateRadios.filter(':checked');
623
+ template = templateRadioOn.val();
624
+ templateRadioOn.closest('li').addClass('current-selection').find('.template-description').children(':not(:first-child)').show();
625
+
626
+ // Check for forced options
627
+ if (template) {
628
+ $('input.forced').removeProp('disabled').removeClass('forced');
629
+ var data = {
630
+ 'action': 'wpmtst_force_check',
631
+ 'template': template
632
+ };
633
+ $.get(ajaxurl, data, function (response) {
634
+ if (response.success) {
635
+ var arrayLength, $el, inputName;
636
+ arrayLength = response.data.length;
637
+ for (var i = 0; i < arrayLength; i++) {
638
+ $el = $('#' + response.data[i]);
639
+ $el.prop('checked', true).change();
640
+ inputName = $el.prop('name');
641
+ $('input[name=\'' + inputName + '\']').prop('disabled', true).addClass('forced');
642
+ }
643
+ }
644
+ });
645
+
646
+ // Special handling
647
+ if ('unstyled' === template) {
648
+ $('input[name=\'view[data][background][type]\']').prop('disabled', true);
649
+ $('input[name=\'view[data][font-color][type]\']').prop('disabled', true);
650
+ } else {
651
+ $('input[name=\'view[data][background][type]\']').prop('disabled', false);
652
+ $('input[name=\'view[data][font-color][type]\']').prop('disabled', false);
653
+ }
654
+
655
+ // Special handling for Lucid add-on until I can incorporate a template group config file
656
+ if ('lucid' === template.substr(0, 5) || 'single_template' === currentMode) {
657
+ $('.then_lucid').show();
658
+ } else {
659
+ $('.then_lucid').hide();
660
+ }
661
+ }
662
+ }
663
+
664
+ templateDescriptions();
665
+
666
+ templateRadios.on('change', templateDescriptions);
667
+
668
+ /**
669
+ * Form template change listener
670
+ */
671
+ var formTemplateRadios = $('input[type=radio][name=\'view[data][form-template]\']');
672
+
673
+ function formTemplateDescriptions () {
674
+ var formTemplateRadioOff, formTemplateRadioOn, formTemplate;
675
+
676
+ formTemplateRadioOff = formTemplateRadios.filter(':not(:checked)');
677
+ formTemplateRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
678
+
679
+ formTemplateRadioOn = formTemplateRadios.filter(':checked');
680
+ formTemplate = formTemplateRadioOn.val();
681
+ formTemplateRadioOn.closest('li').addClass('current-selection').find('.options').show();
682
+ }
683
+
684
+ formTemplateDescriptions();
685
+
686
+ formTemplateRadios.on('change', formTemplateDescriptions);
687
+
688
+ /**
689
+ * Layout change listener
690
+ */
691
+ // TODO Use ID instead.
692
+ var layoutRadios = $('input[type=radio][name=\'view[data][layout]\']');
693
+
694
+ function layoutDescriptions () {
695
+ var layoutRadioOff, layoutRadioOn, layout;
696
+
697
+ layoutRadioOff = layoutRadios.filter(':not(:checked)');
698
+ layoutRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
699
+
700
+ layoutRadioOn = layoutRadios.filter(':checked');
701
+ layout = layoutRadioOn.attr('id');
702
+ layoutRadioOn.closest('li').addClass('current-selection').find('.options').show();
703
+
704
+ $('.layout-description, .layout-example').hide();
705
+ $('.' + layout).show();
706
+
707
+ // Special handling
708
+
709
+ if ('view-layout-normal' === layout)
710
+ $('#column-count-wrapper').fadeOut();
711
+ else
712
+ $('#column-count-wrapper').fadeIn();
713
+
714
+ if ('view-layout-masonry' === layout) {
715
+ if ($('#view-pagination').is(':checked')) {
716
+ alert('Masonry is incompatible with pagination. Please disable pagination first.');
717
+ $('#view-layout-normal').prop('checked', true).change();
718
+ }
719
+ }
720
+ }
721
+
722
+ layoutDescriptions();
723
+
724
+ layoutRadios.on('change', layoutDescriptions);
725
+
726
+ /**
727
+ * Pagination change listener
728
+ */
729
+ function paginationChangeListener () {
730
+ // Pagination is incompatible with Masonry
731
+ // TODO DRY
732
+ if ($(this).is(':checked') && 'masonry' === layoutRadios.filter(':checked').val()) {
733
+ alert('Pagination is incompatible with Masonry. Please select another layout first.');
734
+ $(this).prop('checked', false).change();
735
+ }
736
+ }
737
+
738
+ $('#view-pagination').on('change', paginationChangeListener);
739
+
740
+ /**
741
+ * Disallow standard pagination with query limit.
742
+ */
743
+ var $viewQuantity = $('#view-all'),
744
+ $viewPaginationType = $('#view-pagination_type');
745
+
746
+ function paginationTypeChangeListener () {
747
+ if (this.value === 'standard' && $viewQuantity.val() === '0' && $('#view-pagination').is(':checked')) {
748
+ alert('Standard pagination is incompatible with Count.');
749
+ $(this).val('simple').change();
750
+ }
751
+ }
752
+
753
+ function quantityChangeListener () {
754
+ if (this.value === '0' && $viewPaginationType.val() === 'standard' && $('#view-pagination').is(':checked')) {
755
+ alert('Count is incompatible with Standard pagination.');
756
+ $(this).val(1).change();
757
+ }
758
+ }
759
+
760
+ $viewPaginationType.on('change', paginationTypeChangeListener);
761
+ $viewQuantity.on('change', quantityChangeListener);
762
+
763
+ /**
764
+ * ----------------------------------------------------------------------
765
+ * Background and Font colors
766
+ * ----------------------------------------------------------------------
767
+ */
768
+ function updateBackgroundPreview () {
769
+ var c1,
770
+ c2,
771
+ c3,
772
+ background = backgroundRadios.filter(':checked').val(),
773
+ fontColor = fontColorRadios.filter(':checked').val();
774
+
775
+ if ('custom' === fontColor) {
776
+ c3 = document.getElementById('fc-color').value;
777
+ backgroundPreview.css('color', c3);
778
+ } else {
779
+ backgroundPreview.css('color', 'inherit');
780
+ }
781
+ switch (background) {
782
+ case '':
783
+ backgroundPreview.css('background', 'transparent');
784
+ break;
785
+ case 'single':
786
+ c1 = document.getElementById('bg-color').value;
787
+ backgroundPreview.css('background', c1);
788
+ break;
789
+ case 'gradient':
790
+ c1 = document.getElementById('bg-gradient1').value;
791
+ c2 = document.getElementById('bg-gradient2').value;
792
+ backgroundPreview.css(constructGradientCSS(c1, c2));
793
+ break;
794
+ case 'preset':
795
+ backgroundPreset(backgroundPresetSelector.val());
796
+ break;
797
+ default:
798
+ }
799
+
800
+ }
801
+
802
+ var backgroundRadios = $('input[type=radio][name=\'view[data][background][type]\']'),
803
+ backgroundPreview = $('#background-preview'),
804
+ backgroundPresetSelector = $('#view-background-preset');
805
+
806
+ /**
807
+ * Font-color change listener
808
+ */
809
+ // TODO Use ID instead.
810
+ var fontColorRadios = $('input[type=radio][name=\'view[data][font-color][type]\']');
811
+
812
+ function fontColorDescriptions () {
813
+ var fontColorRadioOff, fontColorRadioOn, fontColorID;
814
+
815
+ fontColorRadioOff = fontColorRadios.filter(':not(:checked)');
816
+ fontColorRadioOff.closest('li').removeClass('current-selection');
817
+
818
+ fontColorRadioOn = fontColorRadios.filter(':checked');
819
+ fontColorID = fontColorRadioOn.filter(':checked').attr('id');
820
+ fontColorRadioOn.closest('li').addClass('current-selection');
821
+
822
+ $('#view-font-color-info')
823
+ .find('.font-color-description:visible')
824
+ .hide()
825
+ .end()
826
+ .find('.' + fontColorID)
827
+ .show();
828
+
829
+ updateBackgroundPreview();
830
+ }
831
+
832
+ fontColorDescriptions();
833
+
834
+ fontColorRadios.on('change', fontColorDescriptions);
835
+
836
+ /**
837
+ * Background change listener
838
+ */
839
+ function backgroundDescriptions () {
840
+ var backgroundRadioOff, backgroundRadioOn, backgroundID;
841
+
842
+ backgroundRadioOff = backgroundRadios.filter(':not(:checked)');
843
+ backgroundRadioOff.closest('li').removeClass('current-selection').find('.options').hide();
844
+
845
+ backgroundRadioOn = backgroundRadios.filter(':checked');
846
+ backgroundID = backgroundRadioOn.filter(':checked').attr('id');
847
+ backgroundRadioOn.closest('li').addClass('current-selection').find('.options').show();
848
+
849
+ $('#view-background-info')
850
+ .find('.background-description:visible')
851
+ .hide()
852
+ .end()
853
+ .find('.' + backgroundID)
854
+ .show();
855
+
856
+ updateBackgroundPreview();
857
+ }
858
+
859
+ backgroundDescriptions();
860
+
861
+ backgroundRadios.on('change', backgroundDescriptions);
862
+
863
+ backgroundPresetSelector.on('change', function () {
864
+ backgroundPreset($(this).val());
865
+ });
866
+
867
+ function backgroundPreset (preset) {
868
+ if (!preset) {
869
+ backgroundPreview.css('background', 'transparent');
870
+ return;
871
+ }
872
+
873
+ var data = {
874
+ 'action': 'wpmtst_get_background_preset_colors',
875
+ 'key': preset,
876
+ };
877
+ $.get(ajaxurl, data, function (response) {
878
+ var presetObj = JSON.parse(response);
879
+ if (presetObj.color && presetObj.color2) {
880
+ backgroundPreview.css(constructGradientCSS(presetObj.color, presetObj.color2));
881
+ }
882
+ else if (presetObj.color) {
883
+ backgroundPreview.css('background', presetObj.color);
884
+ }
885
+ else {
886
+ backgroundPreview.css('background', 'transparent');
887
+ }
888
+ });
889
+ }
890
+
891
+ function constructGradientCSS (c1, c2) {
892
+ return {
893
+ 'background': 'linear-gradient(to bottom, ' + c1 + ' 0%, ' + c2 + ' 100%)'
894
+ };
895
+ }
896
+
897
+ //$.fn.updateScreen(currentMode);
898
+
899
+ /**
900
+ * -------------
901
+ * Client fields
902
+ * -------------
903
+ */
904
+
905
+ /**
906
+ * Make client fields sortable
907
+ */
908
+
909
+ var customFieldList = $('#custom-field-list2');
910
+
911
+ // Prevent single click on handle from opening accordion
912
+ customFieldList.on('click', 'span.handle', function (e) {
913
+ e.stopImmediatePropagation();
914
+ e.preventDefault();
915
+ });
916
+
917
+ // customFieldList.find(".field-properties").hide();
918
+
919
+ customFieldList.sortable({
920
+ placeholder: 'sortable-placeholder',
921
+ // forcePlaceholderSize: true,
922
+ handle: '.handle',
923
+ cursor: 'move',
924
+ helper: 'clone',
925
+ start: function (e, ui) {
926
+ ui.placeholder.height(ui.item.height());
927
+ }
928
+ });
929
+ //}).disableSelection(); // <-- this breaks Firefox
930
+
931
+ /**
932
+ * Add client field
933
+ */
934
+ $('#add-field').on('click', function (e) {
935
+ var keys = $('.field3').map(function () {
936
+ return $(this).data('key');
937
+ }).get();
938
+ var nextKey = Array.max(keys) + 1;
939
+ var data = {
940
+ 'action': 'wpmtst_view_add_field',
941
+ 'key': nextKey,
942
+ };
943
+ $.get(ajaxurl, data, function (response) {
944
+ $.when(customFieldList.append(response)).then(function () {
945
+ var $newField = customFieldList.find('#field-' + nextKey);
946
+ $newField
947
+ .find('div.link').click().end()
948
+ .find('.field-dep').hide().end()
949
+ .find('.first-field').focus();
950
+ });
951
+ });
952
+ });
953
+
954
+ /**
955
+ * Field type change listener
956
+ */
957
+ customFieldList.on('change', '.field-type select', function () {
958
+ var $el = $(this);
959
+ var $elParent = $el.closest('.field3');
960
+ var fieldType = $el.val();
961
+ var fieldName = $elParent.find('.field-name').find('select').val();
962
+ // var key = $elParent.attr("id").split('-').slice(-1)[0];
963
+ var key = $elParent.data('key');
964
+ var data;
965
+
966
+ switch (fieldType) {
967
+
968
+ case 'link2':
969
+ case 'link':
970
+ // if changing to [link], add link fields
971
+ data = {
972
+ 'action': 'wpmtst_view_add_field_link',
973
+ 'fieldName': fieldName,
974
+ 'fieldType': fieldType,
975
+ 'key': key,
976
+ };
977
+ $.get(ajaxurl, data, function (response) {
978
+ // insert into placeholder div
979
+ $elParent.find('.field-property-box').html(response);
980
+
981
+ // Trigger conditional select
982
+ var $newFieldSelect = $elParent.find('.if.selectgroup');
983
+ $.fn.selectGroupOption($newFieldSelect);
984
+ $newFieldSelect.on('change', function () {
985
+ $.fn.selectGroupOption($newFieldSelect);
986
+ });
987
+ textChangeListener();
988
+
989
+ // Get field name --> Get field label --> Populate link_text label
990
+ var fieldName = $elParent.find('.field-name').find('select').val();
991
+ var data2 = {
992
+ 'action': 'wpmtst_view_get_label',
993
+ 'name': fieldName,
994
+ };
995
+ $.get(ajaxurl, data2, function (response) {
996
+ // var key = $elParent.attr("id").split('-').slice(-1)[0];
997
+ $('#view-fieldtext' + key + '-label').val(response);
998
+ });
999
+
1000
+ });
1001
+ break;
1002
+
1003
+ case 'date':
1004
+ // if changing to [date], add date fields
1005
+ data = {
1006
+ 'action': 'wpmtst_view_add_field_date',
1007
+ 'key': key,
1008
+ };
1009
+ $.get(ajaxurl, data, function (response) {
1010
+ // insert into placeholder div
1011
+ $elParent.find('.field-property-box').html(response);
1012
+ });
1013
+ break;
1014
+
1015
+ case 'text':
1016
+ // if changing to [text], remove meta fields
1017
+ $elParent.find('.field-property-box').empty();
1018
+ break;
1019
+
1020
+ default:
1021
+
1022
+ }
1023
+ });
1024
+
1025
+ /**
1026
+ * Field name change listener.
1027
+ */
1028
+ customFieldList.on('change', '.field-name select', function () {
1029
+ var $el = $(this);
1030
+ var $elParent = $el.closest('.field3');
1031
+ var fieldType = $el.find('option:selected').data('type');
1032
+ var fieldValue = $el.val();
1033
+ var key = $elParent.data('key');
1034
+ var typeSelectParent = $elParent.find('.field-type');
1035
+ var typeSelect = typeSelectParent.find('select');
1036
+ var data;
1037
+
1038
+ $elParent.not('.open').addClass('open').find('.field-properties').addClass('open').slideDown();
1039
+
1040
+ if ('' === fieldValue) {
1041
+ $elParent.find('.field-description').html('');
1042
+ // Hide dependent inputs if nothing has been selected
1043
+ $elParent.find('.field-dep').hide();
1044
+ }
1045
+ else {
1046
+ // Update field label
1047
+ data = {
1048
+ 'action': 'wpmtst_view_get_label',
1049
+ 'name': fieldValue,
1050
+ 'key': key,
1051
+ };
1052
+ $.get(ajaxurl, data, function (response) {
1053
+ if (response) {
1054
+ $elParent.find('.field-description').html(response);
1055
+
1056
+ //trigger custom event
1057
+ var event = document.createEvent('Event');
1058
+ event.initEvent('wpmtst_custom_field_changed', true, true);
1059
+ document.dispatchEvent(event);
1060
+ }
1061
+ });
1062
+
1063
+ // Show dependent inputs
1064
+ $elParent.find('.field-dep').show();
1065
+ }
1066
+
1067
+ switch (fieldValue) {
1068
+ // First, the immutables
1069
+ case 'post_date':
1070
+ case 'submit_date':
1071
+ // Disable type selector
1072
+ typeSelect.val('date').prop('disabled', true);
1073
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
1074
+
1075
+ // add format field
1076
+ data = {
1077
+ 'action': 'wpmtst_view_add_field_date',
1078
+ 'key': key,
1079
+ };
1080
+ $.get(ajaxurl, data, function (response) {
1081
+ // Insert into placeholder div. Add hidden field because we are
1082
+ // disabling the <select> so its value will not be submitted.
1083
+ $elParent.find('.field-property-box').html(response); // .find("input").focus();
1084
+ $el.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][type]" value="date">');
1085
+ });
1086
+ break;
1087
+
1088
+ case 'link2':
1089
+ case 'link':
1090
+ // Get field name --> Get field label --> Populate link_text label
1091
+ var fieldName = $elParent.find('.field-name').find('select').val();
1092
+ var data2 = {
1093
+ 'action': 'wpmtst_view_get_label',
1094
+ 'name': fieldName,
1095
+ };
1096
+ $.get(ajaxurl, data2, function (response) {
1097
+ var key = $elParent.attr('id').split('-').slice(-1)[0];
1098
+ $('#view-fieldtext' + key + '-label').val(response);
1099
+ });
1100
+ break;
1101
+
1102
+ case 'category':
1103
+ $(typeSelect).val('category').prop('disabled', true);
1104
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
1105
+ $elParent.find('.field-property-box').empty();
1106
+ break;
1107
+
1108
+ default:
1109
+
1110
+ // Special handling
1111
+ if ('rating' === fieldType) {
1112
+ typeSelect.val('rating').prop('disabled', true);
1113
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
1114
+ $elParent.find('.field-property-box').empty();
1115
+ break;
1116
+ }
1117
+
1118
+ if ('platform' === fieldType) {
1119
+ typeSelect.val('platform').prop('disabled', true);
1120
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="platform">');
1121
+ $elParent.find('.field-property-box').empty();
1122
+ break;
1123
+ }
1124
+
1125
+ $(typeSelect).val('text').prop('disabled', false);
1126
+ // remove meta field
1127
+ $elParent.find('.field-property-box').empty();
1128
+ // remove the saved type that's only necessary when we disable the input (above)
1129
+ $el.parent().find('input.save-type').remove();
1130
+ }
1131
+ });
1132
+
1133
+ /**
1134
+ * Delete a client field
1135
+ */
1136
+ customFieldList.on('click', 'span.delete', function (e) {
1137
+ var thisField = $(this).closest('.field2');
1138
+ var yesno = confirm('Remove this field?');
1139
+ if (yesno) {
1140
+ thisField.fadeOut(function () {
1141
+ $(this).remove();
1142
+
1143
+ //trigger custom event
1144
+ var event = document.createEvent('Event');
1145
+ event.initEvent('wpmtst_custom_field_deleted', true, true);
1146
+ document.dispatchEvent(event);
1147
+ });
1148
+ }
1149
+ // Prevent click from expanding accordion
1150
+ e.stopImmediatePropagation();
1151
+ e.preventDefault();
1152
+ });
1153
+
1154
+ customFieldList.on('click', 'div.link', function (e) {
1155
+ $(this)
1156
+ .closest('.field2')
1157
+ .toggleClass('open')
1158
+ .find('.field-properties')
1159
+ .slideToggle(100);
1160
+ return false;
1161
+ });
1162
+
1163
+ /**
1164
+ * Slider|Carousel change listener
1165
+ */
1166
+ var $sliderType = $('#view-slider_type');
1167
+ var $effect = $('#view-effect');
1168
+ var $position = $('view-slideshow_nav_position');
1169
+
1170
+ var sliderTypeUpdate = function () {
1171
+ if ($sliderType.val() === 'show_multiple') {
1172
+ $effect.find('option[value=\'horizontal\']').prop('selected', true);
1173
+ $position.find('option[value=\'outside\']').prop('selected', true);
1174
+
1175
+ $sliderType.parent().siblings('.option-desc.singular').hide();
1176
+ $sliderType.parent().siblings('.option-desc.plural').showInlineBlock();
1177
+ } else {
1178
+ $sliderType.parent().siblings('.option-desc.singular').showInlineBlock();
1179
+ $sliderType.parent().siblings('.option-desc.plural').hide();
1180
+ }
1181
+
1182
+ $effect.change();
1183
+ $position.change();
1184
+ };
1185
+
1186
+ sliderTypeUpdate();
1187
+
1188
+ $sliderType.on('change', sliderTypeUpdate);
1189
+
1190
+ /**
1191
+ * MaxSlides change listener
1192
+ */
1193
+ var $maxSlides = $('[id^=\'view-max_slides\']');
1194
+
1195
+ // Update display
1196
+ var maxSlidesUpdateValue = function (el) {
1197
+ var $el = $(el);
1198
+ var maxSlidesValue = parseInt($el.val());
1199
+ if (maxSlidesValue > 1) {
1200
+ $el.parent().siblings('.option-desc.singular').hide();
1201
+ $el.parent().siblings('.option-desc.plural').showInlineBlock();
1202
+ } else {
1203
+ $el.parent().siblings('.option-desc.singular').showInlineBlock();
1204
+ $el.parent().siblings('.option-desc.plural').hide();
1205
+ }
1206
+ };
1207
+
1208
+ // Initial display
1209
+ $maxSlides.each( function (index, el) {
1210
+ maxSlidesUpdateValue(el);
1211
+ });
1212
+
1213
+ // Update on change
1214
+ var maxSlidesUpdate = function (e) {
1215
+ maxSlidesUpdateValue( $(e.target) );
1216
+ };
1217
+
1218
+ // Event listener
1219
+ $maxSlides.each( function (index, el) {
1220
+ $(el).on('change', maxSlidesUpdate);
1221
+ });
1222
+
1223
+ /**
1224
+ * MoveSlides change listener
1225
+ */
1226
+ var $moveSlides = $('[id^=\'view-move_slides\']');
1227
+
1228
+ // Update display
1229
+ var moveSlidesUpdateValue = function (el) {
1230
+ var $el = $(el);
1231
+ var moveSlidesValue = parseInt($el.val());
1232
+ if (moveSlidesValue > 1) {
1233
+ $el.parent().siblings('.option-desc.singular').hide();
1234
+ $el.parent().siblings('.option-desc.plural').showInlineBlock();
1235
+ } else {
1236
+ $el.parent().siblings('.option-desc.singular').showInlineBlock();
1237
+ $el.parent().siblings('.option-desc.plural').hide();
1238
+ }
1239
+ };
1240
+
1241
+ // Initial display
1242
+ $moveSlides.each( function (index, el) {
1243
+ moveSlidesUpdateValue(el);
1244
+ });
1245
+
1246
+ // Update on change
1247
+ var moveSlidesUpdate = function (e) {
1248
+ moveSlidesUpdateValue( $(e.target) );
1249
+ };
1250
+
1251
+ // Event listener
1252
+ $moveSlides.each( function (index, el) {
1253
+ $(el).on('change', moveSlidesUpdate);
1254
+ });
1255
+
1256
+ /**
1257
+ * Restore default breakpoints
1258
+ */
1259
+ $('#restore-default-breakpoints').click(function (e) {
1260
+ var data = {
1261
+ 'action': 'wpmtst_restore_default_breakpoints'
1262
+ };
1263
+
1264
+ $.get(ajaxurl, data, function (response) {
1265
+
1266
+ var object = JSON.parse(response);
1267
+ var targetId;
1268
+ var el;
1269
+
1270
+ for (var key in object) {
1271
+
1272
+ if (object.hasOwnProperty(key)) {
1273
+
1274
+ // width
1275
+ targetId = 'view-breakpoint_' + key;
1276
+ el = $('[id="' + targetId + '"]');
1277
+ el.val(parseInt(object[key].width));
1278
+
1279
+ // max_slides
1280
+ targetId = 'view-max_slides_' + key;
1281
+ el = $('[id="' + targetId + '"]');
1282
+ el.val(parseInt(object[key].max_slides));
1283
+
1284
+ // margin
1285
+ targetId = 'view-margin_' + key;
1286
+ el = $('[id="' + targetId + '"]');
1287
+ el.val(parseInt(object[key].margin));
1288
+
1289
+ // move_slides
1290
+ targetId = 'view-move_slides_' + key;
1291
+ el = $('[id="' + targetId + '"]');
1292
+ el.val(parseInt(object[key].move_slides));
1293
+
1294
+ }
1295
+
1296
+ }
1297
+
1298
+ document.getElementById('restored-message').classList.add('copied');
1299
+ setTimeout(function () {
1300
+ document.getElementById('restored-message').classList.remove('copied');
1301
+ }, 2000);
1302
+
1303
+ });
1304
+ });
1305
+
1306
+ })(jQuery);
1307
+
1308
+ /**
1309
+ * Click to copy to keyboard
1310
+ * Thanks https://www.sitepoint.com/javascript-copy-to-clipboard/
1311
+ */
1312
+ (function () {
1313
+
1314
+ 'use strict';
1315
+
1316
+ // click events
1317
+ document.body.addEventListener('click', copy, true);
1318
+
1319
+ // event handler
1320
+ function copy (e) {
1321
+
1322
+ // find target element
1323
+ var
1324
+ t = e.target,
1325
+ c = t.dataset.copytarget,
1326
+ inp = (c ? document.querySelector(c) : null);
1327
+
1328
+ // is element selectable?
1329
+ if (inp && inp.select) {
1330
+
1331
+ // select text
1332
+ inp.select();
1333
+
1334
+ try {
1335
+ // copy text
1336
+ document.execCommand('copy');
1337
+ inp.blur();
1338
+
1339
+ //t.classList.add('copied');
1340
+ //setTimeout(function() { t.classList.remove('copied'); }, 1500);
1341
+ document.getElementById('copy-message').classList.add('copied');
1342
+ setTimeout(function () {
1343
+ document.getElementById('copy-message').classList.remove('copied');
1344
+ }, 2000);
1345
+ }
1346
+ catch (err) {
1347
+ alert('Sorry, please press Ctrl/Cmd+C to copy instead.');
1348
+ }
1349
+
1350
+ }
1351
+
1352
+ }
1353
+
1354
+ })();
admin/menu/class-strong-testimonials-menu-fields.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Menu_Fields
4
- */
5
- class Strong_Testimonials_Menu_Fields {
6
-
7
- /**
8
- * Strong_Testimonials_Menu_Fields 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
- }
25
-
26
- /**
27
- * Add submenu page.
28
- *
29
- * @param $pages
30
- *
31
- * @return mixed
32
- */
33
- public static function add_submenu( $pages ) {
34
- $pages[20] = self::get_submenu();
35
- return $pages;
36
- }
37
-
38
- /**
39
- * Return submenu page parameters.
40
- *
41
- * @return array
42
- */
43
- public static function get_submenu() {
44
- return array(
45
- 'page_title' => apply_filters( 'wpmtst_fields_page_title', __( 'Fields', 'strong-testimonials' ) ),
46
- 'menu_title' => apply_filters( 'wpmtst_fields_menu_title', __( 'Fields', 'strong-testimonials' ) ),
47
- 'capability' => 'strong_testimonials_fields',
48
- 'menu_slug' => 'testimonial-fields',
49
- 'function' => 'wpmtst_form_admin',
50
- );
51
- }
52
-
53
- }
54
-
55
- Strong_Testimonials_Menu_Fields::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Menu_Fields
4
+ */
5
+ class Strong_Testimonials_Menu_Fields {
6
+
7
+ /**
8
+ * Strong_Testimonials_Menu_Fields 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
+ }
25
+
26
+ /**
27
+ * Add submenu page.
28
+ *
29
+ * @param $pages
30
+ *
31
+ * @return mixed
32
+ */
33
+ public static function add_submenu( $pages ) {
34
+ $pages[20] = self::get_submenu();
35
+ return $pages;
36
+ }
37
+
38
+ /**
39
+ * Return submenu page parameters.
40
+ *
41
+ * @return array
42
+ */
43
+ public static function get_submenu() {
44
+ return array(
45
+ 'page_title' => apply_filters( 'wpmtst_fields_page_title', __( 'Fields', 'strong-testimonials' ) ),
46
+ 'menu_title' => apply_filters( 'wpmtst_fields_menu_title', __( 'Fields', 'strong-testimonials' ) ),
47
+ 'capability' => 'strong_testimonials_fields',
48
+ 'menu_slug' => 'testimonial-fields',
49
+ 'function' => 'wpmtst_form_admin',
50
+ );
51
+ }
52
+
53
+ }
54
+
55
+ Strong_Testimonials_Menu_Fields::init();
admin/menu/class-strong-testimonials-menu-settings.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Menu_Settings
4
- */
5
- class Strong_Testimonials_Menu_Settings {
6
-
7
- public static $callbacks;
8
-
9
- /**
10
- * Strong_Testimonials_Menu_Settings 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( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
26
- }
27
-
28
- /**
29
- * Add submenu page.
30
- *
31
- * @param $pages
32
- *
33
- * @return mixed
34
- */
35
- public static function add_submenu( $pages ) {
36
- $pages[30] = self::get_submenu();
37
- return $pages;
38
- }
39
-
40
- /**
41
- * Return submenu page parameters.
42
- *
43
- * @return array
44
- */
45
- public static function get_submenu() {
46
- return array(
47
- 'page_title' => __( 'Settings', 'strong-testimonials' ),
48
- 'menu_title' => __( 'Settings', 'strong-testimonials' ),
49
- 'capability' => 'strong_testimonials_options',
50
- 'menu_slug' => 'testimonial-settings',
51
- 'function' => array( 'Strong_Testimonials_Settings', 'settings_page' ),
52
- );
53
- }
54
-
55
- }
56
-
57
- Strong_Testimonials_Menu_Settings::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Menu_Settings
4
+ */
5
+ class Strong_Testimonials_Menu_Settings {
6
+
7
+ public static $callbacks;
8
+
9
+ /**
10
+ * Strong_Testimonials_Menu_Settings 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( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
26
+ }
27
+
28
+ /**
29
+ * Add submenu page.
30
+ *
31
+ * @param $pages
32
+ *
33
+ * @return mixed
34
+ */
35
+ public static function add_submenu( $pages ) {
36
+ $pages[30] = self::get_submenu();
37
+ return $pages;
38
+ }
39
+
40
+ /**
41
+ * Return submenu page parameters.
42
+ *
43
+ * @return array
44
+ */
45
+ public static function get_submenu() {
46
+ return array(
47
+ 'page_title' => __( 'Settings', 'strong-testimonials' ),
48
+ 'menu_title' => __( 'Settings', 'strong-testimonials' ),
49
+ 'capability' => 'strong_testimonials_options',
50
+ 'menu_slug' => 'testimonial-settings',
51
+ 'function' => array( 'Strong_Testimonials_Settings', 'settings_page' ),
52
+ );
53
+ }
54
+
55
+ }
56
+
57
+ Strong_Testimonials_Menu_Settings::init();
admin/menu/class-strong-testimonials-menu-shortcodes.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Menu_Shortcodes
4
- */
5
- class Strong_Testimonials_Menu_Shortcodes {
6
-
7
- /**
8
- * Strong_Testimonials_Menu_Shortcodes 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
- }
25
-
26
- /**
27
- * Add submenu page.
28
- *
29
- * @param $pages
30
- *
31
- * @return mixed
32
- */
33
- public static function add_submenu( $pages ) {
34
- $pages[40] = self::get_submenu();
35
- return $pages;
36
- }
37
-
38
- /**
39
- * Return submenu page parameters.
40
- *
41
- * @return array
42
- */
43
- public static function get_submenu() {
44
- return array(
45
- 'page_title' => apply_filters( 'wpmtst_shortcodes_page_title', __( 'Shortcodes', 'strong-testimonials' ) ),
46
- 'menu_title' => apply_filters( 'wpmtst_shortcodes_menu_title', __( 'Shortcodes', 'strong-testimonials' ) ),
47
- 'capability' => 'strong_testimonials_options',
48
- 'menu_slug' => 'testimonial-shortcodes',
49
- 'function' => array( 'Strong_Testimonials_Page_Shortcodes', 'render_page' ),
50
- );
51
- }
52
-
53
- }
54
-
55
- Strong_Testimonials_Menu_Shortcodes::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Menu_Shortcodes
4
+ */
5
+ class Strong_Testimonials_Menu_Shortcodes {
6
+
7
+ /**
8
+ * Strong_Testimonials_Menu_Shortcodes 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
+ }
25
+
26
+ /**
27
+ * Add submenu page.
28
+ *
29
+ * @param $pages
30
+ *
31
+ * @return mixed
32
+ */
33
+ public static function add_submenu( $pages ) {
34
+ $pages[40] = self::get_submenu();
35
+ return $pages;
36
+ }
37
+
38
+ /**
39
+ * Return submenu page parameters.
40
+ *
41
+ * @return array
42
+ */
43
+ public static function get_submenu() {
44
+ return array(
45
+ 'page_title' => apply_filters( 'wpmtst_shortcodes_page_title', __( 'Shortcodes', 'strong-testimonials' ) ),
46
+ 'menu_title' => apply_filters( 'wpmtst_shortcodes_menu_title', __( 'Shortcodes', 'strong-testimonials' ) ),
47
+ 'capability' => 'strong_testimonials_options',
48
+ 'menu_slug' => 'testimonial-shortcodes',
49
+ 'function' => array( 'Strong_Testimonials_Page_Shortcodes', 'render_page' ),
50
+ );
51
+ }
52
+
53
+ }
54
+
55
+ Strong_Testimonials_Menu_Shortcodes::init();
admin/menu/class-strong-testimonials-menu-views.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Menu_Views
4
- */
5
- class Strong_Testimonials_Menu_Views {
6
-
7
- /**
8
- * Strong_Testimonials_Menu_Views 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
- }
25
-
26
- /**
27
- * Add submenu page.
28
- *
29
- * @param $pages
30
- *
31
- * @return mixed
32
- */
33
- public static function add_submenu( $pages ) {
34
- $pages[10] = self::get_submenu();
35
- return $pages;
36
- }
37
-
38
- /**
39
- * Return submenu page parameters.
40
- *
41
- * @return array
42
- */
43
- public static function get_submenu() {
44
- return array(
45
- 'page_title' => __( 'Views', 'strong-testimonials' ),
46
- 'menu_title' => __( 'Views', 'strong-testimonials' ),
47
- 'capability' => 'strong_testimonials_views',
48
- 'menu_slug' => 'testimonial-views',
49
- 'function' => 'wpmtst_views_admin',
50
- );
51
- }
52
-
53
- }
54
-
55
- Strong_Testimonials_Menu_Views::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Menu_Views
4
+ */
5
+ class Strong_Testimonials_Menu_Views {
6
+
7
+ /**
8
+ * Strong_Testimonials_Menu_Views 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_filter( 'wpmtst_submenu_pages', array( __CLASS__, 'add_submenu' ) );
24
+ }
25
+
26
+ /**
27
+ * Add submenu page.
28
+ *
29
+ * @param $pages
30
+ *
31
+ * @return mixed
32
+ */
33
+ public static function add_submenu( $pages ) {
34
+ $pages[10] = self::get_submenu();
35
+ return $pages;
36
+ }
37
+
38
+ /**
39
+ * Return submenu page parameters.
40
+ *
41
+ * @return array
42
+ */
43
+ public static function get_submenu() {
44
+ return array(
45
+ 'page_title' => __( 'Views', 'strong-testimonials' ),
46
+ 'menu_title' => __( 'Views', 'strong-testimonials' ),
47
+ 'capability' => 'strong_testimonials_views',
48
+ 'menu_slug' => 'testimonial-views',
49
+ 'function' => 'wpmtst_views_admin',
50
+ );
51
+ }
52
+
53
+ }
54
+
55
+ Strong_Testimonials_Menu_Views::init();
admin/menu/class-strong-testimonials-menu.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Menu
4
- */
5
- class Strong_Testimonials_Menu {
6
-
7
- /**
8
- * The common parent slug.
9
- */
10
- const PARENT_SLUG = 'edit.php?post_type=wpm-testimonial';
11
-
12
- /**
13
- * Strong_Testimonials_Menu constructor.
14
- */
15
- public function __construct() {}
16
-
17
- /**
18
- * Initialize.
19
- */
20
- public static function init() {
21
- self::add_actions();
22
- }
23
-
24
- /**
25
- * Add actions and filters.
26
- */
27
- public static function add_actions() {
28
- add_action( 'admin_menu', array( __CLASS__, 'settings_menu' ) );
29
- }
30
-
31
- /**
32
- * Add submenu pages.
33
- */
34
- public static function settings_menu() {
35
- $submenu_pages = apply_filters( 'wpmtst_submenu_pages', array() );
36
- ksort( $submenu_pages );
37
- foreach ( $submenu_pages as $key => $submenu ) {
38
- add_submenu_page(
39
- self::PARENT_SLUG,
40
- $submenu['page_title'],
41
- $submenu['menu_title'],
42
- $submenu['capability'],
43
- $submenu['menu_slug'],
44
- $submenu['function']
45
- );
46
- }
47
- }
48
-
49
- }
50
-
51
- Strong_Testimonials_Menu::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Menu
4
+ */
5
+ class Strong_Testimonials_Menu {
6
+
7
+ /**
8
+ * The common parent slug.
9
+ */
10
+ const PARENT_SLUG = 'edit.php?post_type=wpm-testimonial';
11
+
12
+ /**
13
+ * Strong_Testimonials_Menu constructor.
14
+ */
15
+ public function __construct() {}
16
+
17
+ /**
18
+ * Initialize.
19
+ */
20
+ public static function init() {
21
+ self::add_actions();
22
+ }
23
+
24
+ /**
25
+ * Add actions and filters.
26
+ */
27
+ public static function add_actions() {
28
+ add_action( 'admin_menu', array( __CLASS__, 'settings_menu' ) );
29
+ }
30
+
31
+ /**
32
+ * Add submenu pages.
33
+ */
34
+ public static function settings_menu() {
35
+ $submenu_pages = apply_filters( 'wpmtst_submenu_pages', array() );
36
+ ksort( $submenu_pages );
37
+ foreach ( $submenu_pages as $key => $submenu ) {
38
+ add_submenu_page(
39
+ self::PARENT_SLUG,
40
+ $submenu['page_title'],
41
+ $submenu['menu_title'],
42
+ $submenu['capability'],
43
+ $submenu['menu_slug'],
44
+ $submenu['function']
45
+ );
46
+ }
47
+ }
48
+
49
+ }
50
+
51
+ Strong_Testimonials_Menu::init();
admin/partials/fields/field-controls.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php
2
- /**
3
- * Controls
4
- */
5
- $is_core = ( isset( $field['core'] ) && $field['core'] );
6
- ?>
7
- <div class="controls">
8
- <?php if ( $adding || ! $is_core ) : ?>
9
- <span><a href="#" class="delete-field"><?php esc_html_e( 'Delete', 'strong-testimonials' ); ?></a></span>
10
- <?php endif; ?>
11
- <span class="close-field"><a href="#"><?php _ex( 'Close', 'verb', 'strong-testimonials' ); ?></a></span>
12
- </div>
1
+ <?php
2
+ /**
3
+ * Controls
4
+ */
5
+ $is_core = ( isset( $field['core'] ) && $field['core'] );
6
+ ?>
7
+ <div class="controls">
8
+ <?php if ( $adding || ! $is_core ) : ?>
9
+ <span><a href="#" class="delete-field"><?php esc_html_e( 'Delete', 'strong-testimonials' ); ?></a></span>
10
+ <?php endif; ?>
11
+ <span class="close-field"><a href="#"><?php _ex( 'Close', 'verb', 'strong-testimonials' ); ?></a></span>
12
+ </div>
admin/partials/fields/field-header.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- /**
3
- * Field Header
4
- */
5
- $field_link = $field['label'] ? $field['label'] : ucwords( $field['name'] );
6
- ?>
7
- <div class="custom-field-header">
8
- <span class="link" title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>">
9
- <a class="field" href="#"><?php echo $field_link; ?></a>
10
- <span class="handle" title="<?php _e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
11
- <span class="toggle"></span>
12
- </span>
13
- </div>
1
+ <?php
2
+ /**
3
+ * Field Header
4
+ */
5
+ $field_link = $field['label'] ? $field['label'] : ucwords( $field['name'] );
6
+ ?>
7
+ <div class="custom-field-header">
8
+ <span class="link" title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>">
9
+ <a class="field" href="#"><?php echo $field_link; ?></a>
10
+ <span class="handle" title="<?php _e( 'drag and drop to reorder', 'strong-testimonials' ); ?>"></span>
11
+ <span class="toggle"></span>
12
+ </span>
13
+ </div>
admin/partials/fields/field-label.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
- /**
3
- * Field Label
4
- */
5
- ?>
6
- <tr class="field-label-row">
7
- <th><?php _ex( 'Label', 'noun', 'strong-testimonials' ); ?></th>
8
- <td>
9
- <input class="field-label" type="text" name="fields[<?php echo $key; ?>][label]" value="<?php echo esc_attr( $field['label'] ); ?>">
10
- <label>
11
- <input type="checkbox" name="fields[<?php echo $key; ?>][show_label]" <?php checked( $field['show_label'], true ); ?>>
12
- <span class="help inline"><?php _e( 'Show this label on the form.', 'strong-testimonials' ); ?></span>
13
- </label>
14
- </td>
15
- </tr>
1
+ <?php
2
+ /**
3
+ * Field Label
4
+ */
5
+ ?>
6
+ <tr class="field-label-row">
7
+ <th><?php _ex( 'Label', 'noun', 'strong-testimonials' ); ?></th>
8
+ <td>
9
+ <input class="field-label" type="text" name="fields[<?php echo $key; ?>][label]" value="<?php echo esc_attr( $field['label'] ); ?>">
10
+ <label>
11
+ <input type="checkbox" name="fields[<?php echo $key; ?>][show_label]" <?php checked( $field['show_label'], true ); ?>>
12
+ <span class="help inline"><?php _e( 'Show this label on the form.', 'strong-testimonials' ); ?></span>
13
+ </label>
14
+ </td>
15
+ </tr>
admin/partials/fields/field-name.php CHANGED
@@ -1,22 +1,22 @@
1
- <?php
2
- /**
3
- * Field Name
4
- *
5
- * Disabled inputs are not posted so store the field name in a hidden input.
6
- */
7
- ?>
8
- <tr class="field-name-row">
9
- <th><?php _ex( 'Name', 'noun', 'strong-testimonials' ); ?></th>
10
- <td>
11
- <?php
12
- // Field names for certain types are read-only.
13
- if ( $field['name_mutable'] ) : ?>
14
- <input class="field-name" type="text" name="fields[<?php echo $key; ?>][name]" value="<?php echo isset( $field['name'] ) ? esc_attr( $field['name'] ) : ''; ?>">
15
- <span class="help field-name-help"><?php _e( 'Use only lowercase letters, numbers, and underscores.', 'strong-testimonials' ); ?></span>
16
- <span class="help field-name-help important"><?php _e( 'Cannot be "name" or "date".', 'strong-testimonials' ); ?></span>
17
- <?php else : ?>
18
- <input class="field-name" type="text" value="<?php echo $field['name']; ?>" disabled="disabled">
19
- <input type="hidden" name="fields[<?php echo $key; ?>][name]" value="<?php echo $field['name']; ?>">
20
- <?php endif ?>
21
- </td>
22
- </tr>
1
+ <?php
2
+ /**
3
+ * Field Name
4
+ *
5
+ * Disabled inputs are not posted so store the field name in a hidden input.
6
+ */
7
+ ?>
8
+ <tr class="field-name-row">
9
+ <th><?php _ex( 'Name', 'noun', 'strong-testimonials' ); ?></th>
10
+ <td>
11
+ <?php
12
+ // Field names for certain types are read-only.
13
+ if ( $field['name_mutable'] ) : ?>
14
+ <input class="field-name" type="text" name="fields[<?php echo $key; ?>][name]" value="<?php echo isset( $field['name'] ) ? esc_attr( $field['name'] ) : ''; ?>">
15
+ <span class="help field-name-help"><?php _e( 'Use only lowercase letters, numbers, and underscores.', 'strong-testimonials' ); ?></span>
16
+ <span class="help field-name-help important"><?php _e( 'Cannot be "name" or "date".', 'strong-testimonials' ); ?></span>
17
+ <?php else : ?>
18
+ <input class="field-name" type="text" value="<?php echo $field['name']; ?>" disabled="disabled">
19
+ <input type="hidden" name="fields[<?php echo $key; ?>][name]" value="<?php echo $field['name']; ?>">
20
+ <?php endif ?>
21
+ </td>
22
+ </tr>
admin/partials/fields/field-text.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- /**
3
- * Field text for checkbox and radio.
4
- */
5
- ?>
6
- <tr class="field-label-row">
7
- <th><?php _ex( 'Text', 'noun', 'strong-testimonials' ); ?></th>
8
- <td>
9
- <input type="text" class="field-label"
10
- name="fields[<?php echo $key; ?>][text]"
11
- value="<?php echo esc_attr( $field['text'] ); ?>"
12
- placeholder="<?php _e('next to the checkbox', 'strong-testimonials' ); ?>">
13
- </td>
14
- </tr>
1
+ <?php
2
+ /**
3
+ * Field text for checkbox and radio.
4
+ */
5
+ ?>
6
+ <tr class="field-label-row">
7
+ <th><?php _ex( 'Text', 'noun', 'strong-testimonials' ); ?></th>
8
+ <td>
9
+ <input type="text" class="field-label"
10
+ name="fields[<?php echo $key; ?>][text]"
11
+ value="<?php echo esc_attr( $field['text'] ); ?>"
12
+ placeholder="<?php _e('next to the checkbox', 'strong-testimonials' ); ?>">
13
+ </td>
14
+ </tr>
admin/partials/fields/field-type.php CHANGED
@@ -1,77 +1,77 @@
1
- <?php
2
- /**
3
- * Field Type
4
- *
5
- * If disabled, create <select> with single option and add hidden input with current value.
6
- */
7
- ?>
8
- <tr>
9
- <th><?php _ex( 'Type', 'noun', 'strong-testimonials' ); ?></th>
10
- <td>
11
- <?php
12
- if ( $adding ) :
13
- ?>
14
- <select class="first-field field-type new" name="fields[<?php echo $key; ?>][input_type]">
15
-
16
- <?php /* Start with a blank option with event trigger to update optgroups */ ?>
17
- <option class="no-selection" value="none" name="none">&mdash;</option>
18
-
19
- <?php /* Post fields */ ?>
20
- <optgroup class="post" label="<?php _e( 'Post Fields', 'strong-testimonials' ); ?>">
21
- <?php foreach ( $field_types['post'] as $field_key => $field_parts ) : ?>
22
- <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
23
- <?php endforeach; ?>
24
- </optgroup>
25
-
26
- <?php /* Custom fields */ ?>
27
- <optgroup class="custom" label="<?php _e( 'Custom Fields', 'strong-testimonials' ); ?>">
28
- <?php foreach ( $field_types['custom'] as $field_key => $field_parts ) : ?>
29
- <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
30
- <?php endforeach; ?>
31
- </optgroup>
32
-
33
- <?php /* Special fields */ ?>
34
- <optgroup class="optional" label="<?php _e( 'Special Fields', 'strong-testimonials' ); ?>">
35
- <?php foreach ( $field_types['optional'] as $field_key => $field_parts ) : ?>
36
- <?php $data = ( $field_parts['name'] ) ? ' data-force-name="'.$field_parts['name'].'"' : ''; ?>
37
- <option value="<?php echo $field_key; ?>"<?php echo $data; ?>><?php echo $field_parts['option_label']; ?></option>
38
- <?php endforeach; ?>
39
- </optgroup>
40
-
41
- </select>
42
-
43
- <span class="help form-error-text" style="display: none;"><?php _e( 'Select a field type or delete this field.', 'strong-testimonials' ); ?></span>
44
-
45
- <?php do_action( 'wpmtst_after_form_type_selection' ); ?>
46
-
47
- <?php else : ?>
48
-
49
- <?php
50
- if ( 'post' == $field['record_type'] ) {
51
- foreach ( $field_types['post'] as $field_key => $field_parts ) {
52
- // compare field *name*
53
- if ( $field['name'] == $field_key )
54
- echo $field_parts['option_label'];
55
- }
56
- }
57
- elseif ( 'custom' == $field['record_type'] ) {
58
- foreach ( $field_types['custom'] as $field_key => $field_parts ) {
59
- // compare field *type*
60
- if ( $field['input_type'] == $field_key ) {
61
- echo $field_parts['option_label'];
62
- }
63
- }
64
- }
65
- elseif ( 'optional' == $field['record_type'] ) {
66
- foreach ( $field_types['optional'] as $field_key => $field_parts ) {
67
- // compare field *type*
68
- if ( $field['input_type'] == $field_key ) {
69
- echo $field_parts['option_label'];
70
- }
71
- }
72
- }
73
-
74
- endif; // editing
75
- ?>
76
- </td>
77
- </tr>
1
+ <?php
2
+ /**
3
+ * Field Type
4
+ *
5
+ * If disabled, create <select> with single option and add hidden input with current value.
6
+ */
7
+ ?>
8
+ <tr>
9
+ <th><?php _ex( 'Type', 'noun', 'strong-testimonials' ); ?></th>
10
+ <td>
11
+ <?php
12
+ if ( $adding ) :
13
+ ?>
14
+ <select class="first-field field-type new" name="fields[<?php echo $key; ?>][input_type]">
15
+
16
+ <?php /* Start with a blank option with event trigger to update optgroups */ ?>
17
+ <option class="no-selection" value="none" name="none">&mdash;</option>
18
+
19
+ <?php /* Post fields */ ?>
20
+ <optgroup class="post" label="<?php _e( 'Post Fields', 'strong-testimonials' ); ?>">
21
+ <?php foreach ( $field_types['post'] as $field_key => $field_parts ) : ?>
22
+ <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
23
+ <?php endforeach; ?>
24
+ </optgroup>
25
+
26
+ <?php /* Custom fields */ ?>
27
+ <optgroup class="custom" label="<?php _e( 'Custom Fields', 'strong-testimonials' ); ?>">
28
+ <?php foreach ( $field_types['custom'] as $field_key => $field_parts ) : ?>
29
+ <option value="<?php echo $field_key; ?>"><?php echo $field_parts['option_label']; ?></option>
30
+ <?php endforeach; ?>
31
+ </optgroup>
32
+
33
+ <?php /* Special fields */ ?>
34
+ <optgroup class="optional" label="<?php _e( 'Special Fields', 'strong-testimonials' ); ?>">
35
+ <?php foreach ( $field_types['optional'] as $field_key => $field_parts ) : ?>
36
+ <?php $data = ( $field_parts['name'] ) ? ' data-force-name="'.$field_parts['name'].'"' : ''; ?>
37
+ <option value="<?php echo $field_key; ?>"<?php echo $data; ?>><?php echo $field_parts['option_label']; ?></option>
38
+ <?php endforeach; ?>
39
+ </optgroup>
40
+
41
+ </select>
42
+
43
+ <span class="help form-error-text" style="display: none;"><?php _e( 'Select a field type or delete this field.', 'strong-testimonials' ); ?></span>
44
+
45
+ <?php do_action( 'wpmtst_after_form_type_selection' ); ?>
46
+
47
+ <?php else : ?>
48
+
49
+ <?php
50
+ if ( 'post' == $field['record_type'] ) {
51
+ foreach ( $field_types['post'] as $field_key => $field_parts ) {
52
+ // compare field *name*
53
+ if ( $field['name'] == $field_key )
54
+ echo $field_parts['option_label'];
55
+ }
56
+ }
57
+ elseif ( 'custom' == $field['record_type'] ) {
58
+ foreach ( $field_types['custom'] as $field_key => $field_parts ) {
59
+ // compare field *type*
60
+ if ( $field['input_type'] == $field_key ) {
61
+ echo $field_parts['option_label'];
62
+ }
63
+ }
64
+ }
65
+ elseif ( 'optional' == $field['record_type'] ) {
66
+ foreach ( $field_types['optional'] as $field_key => $field_parts ) {
67
+ // compare field *type*
68
+ if ( $field['input_type'] == $field_key ) {
69
+ echo $field_parts['option_label'];
70
+ }
71
+ }
72
+ }
73
+
74
+ endif; // editing
75
+ ?>
76
+ </td>
77
+ </tr>
admin/partials/templates/form-preview-template.php CHANGED
@@ -1,27 +1,27 @@
1
- <?php
2
- /**
3
- * Template Name: Default Form
4
- * Description: The default form template.
5
- */
6
- ?>
7
- <div class="strong-view strong-form">
8
-
9
- <div id="wpmtst-form">
10
-
11
- <div class="strong-form-inner">
12
-
13
- <?php wpmtst_field_required_notice(); ?>
14
-
15
- <form enctype="multipart/form-data" autocomplete="off">
16
-
17
- <?php wpmtst_all_form_fields( $new_fields ); ?>
18
-
19
- <?php wpmtst_form_submit_button( true ); ?>
20
-
21
- </form>
22
-
23
- </div>
24
-
25
- </div>
26
-
27
  </div>
1
+ <?php
2
+ /**
3
+ * Template Name: Default Form
4
+ * Description: The default form template.
5
+ */
6
+ ?>
7
+ <div class="strong-view strong-form">
8
+
9
+ <div id="wpmtst-form">
10
+
11
+ <div class="strong-form-inner">
12
+
13
+ <?php wpmtst_field_required_notice(); ?>
14
+
15
+ <form enctype="multipart/form-data" autocomplete="off">
16
+
17
+ <?php wpmtst_all_form_fields( $new_fields ); ?>
18
+
19
+ <?php wpmtst_form_submit_button( true ); ?>
20
+
21
+ </form>
22
+
23
+ </div>
24
+
25
+ </div>
26
+
27
  </div>
admin/partials/views/group-compat.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- apply_filters( 'wpmtst_view_section', '', 'compat' ),
5
- );
6
- ?>
7
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
8
- <h3>
9
- <?php /* translators: On the Views admin screen. */ ?>
10
- <?php _e( 'Compatibility', 'strong-testimonials' ); ?>
11
- </h3>
12
- <table class="form-table multiple group-general">
13
- <tr class="then then_display then_form then_slideshow then_not_single_template" style="display: none;">
14
- <?php include( 'option-divi.php' ); ?>
15
- </tr>
16
- </table>
17
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ apply_filters( 'wpmtst_view_section', '', 'compat' ),
5
+ );
6
+ ?>
7
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
8
+ <h3>
9
+ <?php /* translators: On the Views admin screen. */ ?>
10
+ <?php _e( 'Compatibility', 'strong-testimonials' ); ?>
11
+ </h3>
12
+ <table class="form-table multiple group-general">
13
+ <tr class="then then_display then_form then_slideshow then_not_single_template" style="display: none;">
14
+ <?php include( 'option-divi.php' ); ?>
15
+ </tr>
16
+ </table>
17
+ </div>
admin/partials/views/group-extra.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_display',
5
- 'then_not_form',
6
- 'then_slideshow',
7
- 'then_not_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'extra' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: On the Views admin screen. */ ?>
14
- <?php _e( 'Extra', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-layout">
17
- <tr class="then then_display then_not_form then_not_slideshow then_not_single then_multiple" style="display: none;">
18
- <?php include( 'option-pagination.php' ); ?>
19
- </tr>
20
- <tr class="then then_display then_not_form then_slideshow read-more" style="display: none;">
21
- <?php include( 'option-read-more-page.php' ); ?>
22
- </tr>
23
- </table>
24
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_display',
5
+ 'then_not_form',
6
+ 'then_slideshow',
7
+ 'then_not_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'extra' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Extra', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-layout">
17
+ <tr class="then then_display then_not_form then_not_slideshow then_not_single then_multiple" style="display: none;">
18
+ <?php include( 'option-pagination.php' ); ?>
19
+ </tr>
20
+ <tr class="then then_display then_not_form then_slideshow read-more" style="display: none;">
21
+ <?php include( 'option-read-more-page.php' ); ?>
22
+ </tr>
23
+ </table>
24
+ </div>
admin/partials/views/group-fields.php CHANGED
@@ -1,75 +1,75 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_display',
5
- 'then_not_form',
6
- 'then_slideshow',
7
- 'then_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'fields' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: On the Views admin screen. */ ?>
14
- <?php _e( 'Fields', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-show">
17
-
18
- <?php
19
- $then_classes = array(
20
- 'then',
21
- 'then_display',
22
- 'then_not_form',
23
- 'then_slideshow',
24
- 'then_not_single_template',
25
- apply_filters( 'wpmtst_view_section', '', 'title' ),
26
- );
27
- ?>
28
- <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
29
- <?php include( 'option-title.php' ); ?>
30
- </tr>
31
-
32
- <?php
33
- $then_classes = array(
34
- 'then',
35
- 'then_display',
36
- 'then_not_form',
37
- 'then_slideshow',
38
- 'then_not_single_template',
39
- apply_filters( 'wpmtst_view_section', '', 'thumbnail' ),
40
- );
41
- ?>
42
- <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
43
- <?php include( 'option-thumbnail.php' ); ?>
44
- </tr>
45
-
46
- <?php
47
- $then_classes = array(
48
- 'then',
49
- 'then_display',
50
- 'then_not_form',
51
- 'then_slideshow',
52
- 'then_not_single_template',
53
- apply_filters( 'wpmtst_view_section', '', 'content' ),
54
- );
55
- ?>
56
- <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
57
- <?php include( 'option-content.php' ); ?>
58
- </tr>
59
-
60
- <?php
61
- $then_classes = array(
62
- 'then',
63
- 'then_display',
64
- 'then_not_form',
65
- 'then_slideshow',
66
- 'then_single_template',
67
- apply_filters( 'wpmtst_view_section', '', 'client-section' ),
68
- );
69
- ?>
70
- <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
71
- <?php include( 'option-client-section.php' ); ?>
72
- </tr>
73
-
74
- </table>
75
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_display',
5
+ 'then_not_form',
6
+ 'then_slideshow',
7
+ 'then_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'fields' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Fields', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-show">
17
+
18
+ <?php
19
+ $then_classes = array(
20
+ 'then',
21
+ 'then_display',
22
+ 'then_not_form',
23
+ 'then_slideshow',
24
+ 'then_not_single_template',
25
+ apply_filters( 'wpmtst_view_section', '', 'title' ),
26
+ );
27
+ ?>
28
+ <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
29
+ <?php include( 'option-title.php' ); ?>
30
+ </tr>
31
+
32
+ <?php
33
+ $then_classes = array(
34
+ 'then',
35
+ 'then_display',
36
+ 'then_not_form',
37
+ 'then_slideshow',
38
+ 'then_not_single_template',
39
+ apply_filters( 'wpmtst_view_section', '', 'thumbnail' ),
40
+ );
41
+ ?>
42
+ <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
43
+ <?php include( 'option-thumbnail.php' ); ?>
44
+ </tr>
45
+
46
+ <?php
47
+ $then_classes = array(
48
+ 'then',
49
+ 'then_display',
50
+ 'then_not_form',
51
+ 'then_slideshow',
52
+ 'then_not_single_template',
53
+ apply_filters( 'wpmtst_view_section', '', 'content' ),
54
+ );
55
+ ?>
56
+ <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
57
+ <?php include( 'option-content.php' ); ?>
58
+ </tr>
59
+
60
+ <?php
61
+ $then_classes = array(
62
+ 'then',
63
+ 'then_display',
64
+ 'then_not_form',
65
+ 'then_slideshow',
66
+ 'then_single_template',
67
+ apply_filters( 'wpmtst_view_section', '', 'client-section' ),
68
+ );
69
+ ?>
70
+ <tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
71
+ <?php include( 'option-client-section.php' ); ?>
72
+ </tr>
73
+
74
+ </table>
75
+ </div>
admin/partials/views/group-form.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_not_display',
5
- 'then_not_slideshow',
6
- 'then_form',
7
- 'then_not_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'form' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: On the Views admin screen. */ ?>
14
- <?php _e( 'Actions', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-select">
17
- <tr>
18
- <?php include('option-form-category.php'); ?>
19
- </tr>
20
- <tr>
21
- <?php include('option-form-ajax.php'); ?>
22
- </tr>
23
- </table>
24
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_not_display',
5
+ 'then_not_slideshow',
6
+ 'then_form',
7
+ 'then_not_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'form' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Actions', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr>
18
+ <?php include('option-form-category.php'); ?>
19
+ </tr>
20
+ <tr>
21
+ <?php include('option-form-ajax.php'); ?>
22
+ </tr>
23
+ </table>
24
+ </div>
admin/partials/views/group-query.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_display',
5
- 'then_not_form',
6
- 'then_slideshow',
7
- 'then_not_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'select' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: On the Views admin screen. */ ?>
14
- <?php _e( 'Query', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-select">
17
- <tr class="subheading">
18
- <td><?php _e( 'Option', 'strong-testimonials' ); ?></td>
19
- <td><?php _e( 'Setting', 'strong-testimonials' ); ?></td>
20
- <td class="divider" colspan="2">
21
- <?php _e( 'or Shortcode Attribute', 'strong-testimonials' ); ?>
22
- <span class="help-links">
23
- <span class="description">
24
- <a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
25
- </span>
26
- </span>
27
- </td>
28
- <td>Example</td>
29
- </tr>
30
- <tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
31
- <?php include( 'option-select.php' ); ?>
32
- </tr>
33
- <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
34
- <?php include( 'option-category.php' ); ?>
35
- </tr>
36
- <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
37
- <?php include( 'option-order.php' ); ?>
38
- </tr>
39
- <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
40
- <?php include( 'option-limit.php' ); ?>
41
- </tr>
42
- <?php do_action( 'wpmtst_views_group_query', $view ); ?>
43
- </table>
44
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_display',
5
+ 'then_not_form',
6
+ 'then_slideshow',
7
+ 'then_not_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'select' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Query', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr class="subheading">
18
+ <td><?php _e( 'Option', 'strong-testimonials' ); ?></td>
19
+ <td><?php _e( 'Setting', 'strong-testimonials' ); ?></td>
20
+ <td class="divider" colspan="2">
21
+ <?php _e( 'or Shortcode Attribute', 'strong-testimonials' ); ?>
22
+ <span class="help-links">
23
+ <span class="description">
24
+ <a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
25
+ </span>
26
+ </span>
27
+ </td>
28
+ <td>Example</td>
29
+ </tr>
30
+ <tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
31
+ <?php include( 'option-select.php' ); ?>
32
+ </tr>
33
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
34
+ <?php include( 'option-category.php' ); ?>
35
+ </tr>
36
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
37
+ <?php include( 'option-order.php' ); ?>
38
+ </tr>
39
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
40
+ <?php include( 'option-limit.php' ); ?>
41
+ </tr>
42
+ <?php do_action( 'wpmtst_views_group_query', $view ); ?>
43
+ </table>
44
+ </div>
admin/partials/views/group-slideshow.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_not_display',
5
- 'then_not_form',
6
- 'then_slideshow',
7
- 'then_not_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'slideshow' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: In the view editor. */ ?>
14
- <?php _e( 'Slideshow', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-select">
17
- <tr>
18
- <?php include( 'option-slideshow-num.php' ); ?>
19
- </tr>
20
- <tr>
21
- <?php include( 'option-slideshow-transition.php' ); ?>
22
- </tr>
23
- <tr>
24
- <?php include( 'option-slideshow-behavior.php' ); ?>
25
- </tr>
26
- <tr>
27
- <?php include( 'option-slideshow-navigation.php' ); ?>
28
- </tr>
29
- </table>
30
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_not_display',
5
+ 'then_not_form',
6
+ 'then_slideshow',
7
+ 'then_not_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'slideshow' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: In the view editor. */ ?>
14
+ <?php _e( 'Slideshow', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr>
18
+ <?php include( 'option-slideshow-num.php' ); ?>
19
+ </tr>
20
+ <tr>
21
+ <?php include( 'option-slideshow-transition.php' ); ?>
22
+ </tr>
23
+ <tr>
24
+ <?php include( 'option-slideshow-behavior.php' ); ?>
25
+ </tr>
26
+ <tr>
27
+ <?php include( 'option-slideshow-navigation.php' ); ?>
28
+ </tr>
29
+ </table>
30
+ </div>
admin/partials/views/group-style.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
- $then_classes = array(
3
- 'then',
4
- 'then_display',
5
- 'then_form',
6
- 'then_slideshow',
7
- 'then_not_single_template',
8
- apply_filters( 'wpmtst_view_section', '', 'style' ),
9
- );
10
- ?>
11
- <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
- <h3>
13
- <?php /* translators: On the Views admin screen. */ ?>
14
- <?php _e( 'Style', 'strong-testimonials' ); ?>
15
- </h3>
16
- <table class="form-table multiple group-style">
17
- <?php do_action( 'wpmtst_view_editor_before_template_list' ); ?>
18
- <tr class="then then_display then_not_form then_slideshow" style="display: none;">
19
- <?php
20
- $current_mode = 'template';
21
- $current_type = 'display';
22
- include( 'option-template-list.php' );
23
- ?>
24
- </tr>
25
- <tr class="then then_not_display then_form then_not_slideshow" style="display: none;">
26
- <?php
27
- $current_mode = 'form-template';
28
- $current_type = 'form';
29
- include( 'option-template-list.php' );
30
- ?>
31
- </tr>
32
- <?php do_action( 'wpmtst_view_editor_before_layout' ); ?>
33
- <tr class="then then_display then_not_form then_not_slideshow" style="display: none;">
34
- <?php include( 'option-layout.php' ); ?>
35
- </tr>
36
- <?php do_action( 'wpmtst_view_editor_before_background' ); ?>
37
-
38
- <tr id="group-style-option-background" class="then then_display then_form then_slideshow" style="display: none;">
39
- <?php include( 'option-background.php' ); ?>
40
- </tr>
41
- <tr id="group-style-option-color" class="then then_display then_form then_slideshow" style="display: none;">
42
- <?php include( 'option-color.php' ); ?>
43
- </tr>
44
-
45
- <?php do_action( 'wpmtst_view_editor_before_classes' ); ?>
46
- <tr class="then then_display then_form then_slideshow" style="display: none;">
47
- <?php include( 'option-classes.php' ); ?>
48
- </tr>
49
- <?php do_action( 'wpmtst_view_editor_after_style_section' ); ?>
50
- </table>
51
- </div>
1
+ <?php
2
+ $then_classes = array(
3
+ 'then',
4
+ 'then_display',
5
+ 'then_form',
6
+ 'then_slideshow',
7
+ 'then_not_single_template',
8
+ apply_filters( 'wpmtst_view_section', '', 'style' ),
9
+ );
10
+ ?>
11
+ <div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
12
+ <h3>
13
+ <?php /* translators: On the Views admin screen. */ ?>
14
+ <?php _e( 'Style', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-style">
17
+ <?php do_action( 'wpmtst_view_editor_before_template_list' ); ?>
18
+ <tr class="then then_display then_not_form then_slideshow" style="display: none;">
19
+ <?php
20
+ $current_mode = 'template';
21
+ $current_type = 'display';
22
+ include( 'option-template-list.php' );
23
+ ?>
24
+ </tr>
25
+ <tr class="then then_not_display then_form then_not_slideshow" style="display: none;">
26
+ <?php
27
+ $current_mode = 'form-template';
28
+ $current_type = 'form';
29
+ include( 'option-template-list.php' );
30
+ ?>
31
+ </tr>
32
+ <?php do_action( 'wpmtst_view_editor_before_layout' ); ?>
33
+ <tr class="then then_display then_not_form then_not_slideshow" style="display: none;">
34
+ <?php include( 'option-layout.php' ); ?>
35
+ </tr>
36
+ <?php do_action( 'wpmtst_view_editor_before_background' ); ?>
37
+
38
+ <tr id="group-style-option-background" class="then then_display then_form then_slideshow" style="display: none;">
39
+ <?php include( 'option-background.php' ); ?>
40
+ </tr>
41
+ <tr id="group-style-option-color" class="then then_display then_form then_slideshow" style="display: none;">
42
+ <?php include( 'option-color.php' ); ?>
43
+ </tr>
44
+
45
+ <?php do_action( 'wpmtst_view_editor_before_classes' ); ?>
46
+ <tr class="then then_display then_form then_slideshow" style="display: none;">
47
+ <?php include( 'option-classes.php' ); ?>
48
+ </tr>
49
+ <?php do_action( 'wpmtst_view_editor_after_style_section' ); ?>
50
+ </table>
51
+ </div>
admin/partials/views/option-background.php CHANGED
@@ -1,151 +1,151 @@
1
- <th>
2
- <?php _e( 'Background', 'strong-testimonials' ); ?>
3
- </th>
4
- <td>
5
- <div class="section-radios background-section">
6
-
7
- <!-- Inputs -->
8
- <div class="radio-buttons">
9
- <ul class="radio-list background-list">
10
- <li>
11
- <input type="radio"
12
- id="bg-none"
13
- name="view[data][background][type]"
14
- value="" <?php checked( $view['background']['type'], '' ); ?>>
15
- <label for="bg-none">
16
- <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
17
- </label>
18
- </li>
19
- <li>
20
- <input type="radio"
21
- id="bg-single"
22
- name="view[data][background][type]"
23
- value="single" <?php checked( $view['background']['type'], 'single' ); ?>>
24
- <label for="bg-single">
25
- <?php _e( 'single color', 'strong-testimonials' ); ?>
26
- </label>
27
- </li>
28
- <li>
29
- <input type="radio"
30
- id="bg-gradient"
31
- name="view[data][background][type]"
32
- value="gradient" <?php checked( $view['background']['type'], 'gradient' ); ?>>
33
- <label for="bg-gradient">
34
- <?php _e( 'gradient', 'strong-testimonials' ); ?>
35
- </label>
36
- </li>
37
- <li>
38
- <input type="radio"
39
- id="bg-preset"
40
- name="view[data][background][type]"
41
- value="preset" <?php checked( $view['background']['type'], 'preset' ); ?>>
42
- <label for="bg-preset">
43
- <?php _e( 'preset', 'strong-testimonials' ); ?>
44
- </label>
45
- </li>
46
- </ul>
47
- </div>
48
-
49
- <!-- Background info -->
50
- <div class="radio-description" id="view-background-info">
51
-
52
- <div class="background-description bg-none">
53
- <div class="description-inner options">
54
- <div>
55
- <?php _e( 'No options', 'strong-testimonials' ); ?>
56
- </div>
57
- </div>
58
- </div>
59
-
60
- <div class="background-description bg-single">
61
- <div class="description-inner options">
62
- <div>
63
- <label>
64
- <input type="text"
65
- id="bg-color"
66
- name="view[data][background][color]"
67
- value="<?php echo $view['background']['color']; ?>"
68
- class="wp-color-picker-field">
69
- </label>
70
- </div>
71
- </div>
72
- </div>
73
-
74
- <div class="background-description bg-gradient">
75
- <div class="description-inner options">
76
- <div>
77
- <div class="color-picker-wrap">
78
- <div>
79
- <label for="bg-gradient1"><?php _e( 'From top', 'strong-testimonials' ); ?></label>
80
- </div>
81
- <div>
82
- <input type="text"
83
- id="bg-gradient1"
84
- name="view[data][background][gradient1]"
85
- value="<?php echo $view['background']['gradient1']; ?>"
86
- class="wp-color-picker-field gradient">
87
- </div>
88
- </div>
89
- </div>
90
- </div>
91
- <div class="description-inner options">
92
- <div>
93
- <div class="color-picker-wrap">
94
- <div>
95
- <label for ="bg-gradient2"><?php _e( 'To bottom', 'strong-testimonials' ); ?></label>
96
- </div>
97
- <div>
98
- <input type="text"
99
- id="bg-gradient2"
100
- name="view[data][background][gradient2]"
101
- value="<?php echo $view['background']['gradient2']; ?>"
102
- class="wp-color-picker-field gradient">
103
- </div>
104
- </div>
105
- </div>
106
-
107
- </div>
108
- </div>
109
-
110
- <div class="background-description bg-preset">
111
- <div class="description-inner options">
112
- <div>
113
- <label for="view-background-preset">
114
- <select id="view-background-preset" name="view[data][background][preset]">
115
- <?php
116
- $presets = wpmtst_get_background_presets();
117
- $current_preset = ( isset( $view['background']['preset'] ) && $view['background']['preset'] ) ? $view['background']['preset'] : '';
118
- echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
119
- foreach ( $presets as $key => $preset ) {
120
- echo '<option value="' . $key . '" ' . selected( $current_preset, $key, false ) . '>' . $preset['label'] . '</option>';
121
- }
122
- ?>
123
- </select>
124
- </label>
125
- </div>
126
- </div>
127
-
128
- </div>
129
-
130
-
131
- </div>
132
-
133
- </div>
134
-
135
- </td>
136
-
137
- <td rowspan="2" class="rowspan">
138
- <div id="view-color-preview" class="table-cell">
139
-
140
- <div class="background-preview-wrap">
141
-
142
- <div id="background-preview">
143
- Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse maiorum
144
- in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad vidisse
145
- expetendis.
146
- </div>
147
-
148
- </div>
149
-
150
- </div>
151
  </td>
1
+ <th>
2
+ <?php _e( 'Background', 'strong-testimonials' ); ?>
3
+ </th>
4
+ <td>
5
+ <div class="section-radios background-section">
6
+
7
+ <!-- Inputs -->
8
+ <div class="radio-buttons">
9
+ <ul class="radio-list background-list">
10
+ <li>
11
+ <input type="radio"
12
+ id="bg-none"
13
+ name="view[data][background][type]"
14
+ value="" <?php checked( $view['background']['type'], '' ); ?>>
15
+ <label for="bg-none">
16
+ <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
17
+ </label>
18
+ </li>
19
+ <li>
20
+ <input type="radio"
21
+ id="bg-single"
22
+ name="view[data][background][type]"
23
+ value="single" <?php checked( $view['background']['type'], 'single' ); ?>>
24
+ <label for="bg-single">
25
+ <?php _e( 'single color', 'strong-testimonials' ); ?>
26
+ </label>
27
+ </li>
28
+ <li>
29
+ <input type="radio"
30
+ id="bg-gradient"
31
+ name="view[data][background][type]"
32
+ value="gradient" <?php checked( $view['background']['type'], 'gradient' ); ?>>
33
+ <label for="bg-gradient">
34
+ <?php _e( 'gradient', 'strong-testimonials' ); ?>
35
+ </label>
36
+ </li>
37
+ <li>
38
+ <input type="radio"
39
+ id="bg-preset"
40
+ name="view[data][background][type]"
41
+ value="preset" <?php checked( $view['background']['type'], 'preset' ); ?>>
42
+ <label for="bg-preset">
43
+ <?php _e( 'preset', 'strong-testimonials' ); ?>
44
+ </label>
45
+ </li>
46
+ </ul>
47
+ </div>
48
+
49
+ <!-- Background info -->
50
+ <div class="radio-description" id="view-background-info">
51
+
52
+ <div class="background-description bg-none">
53
+ <div class="description-inner options">
54
+ <div>
55
+ <?php _e( 'No options', 'strong-testimonials' ); ?>
56
+ </div>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="background-description bg-single">
61
+ <div class="description-inner options">
62
+ <div>
63
+ <label>
64
+ <input type="text"
65
+ id="bg-color"
66
+ name="view[data][background][color]"
67
+ value="<?php echo $view['background']['color']; ?>"
68
+ class="wp-color-picker-field">
69
+ </label>
70
+ </div>
71
+ </div>
72
+ </div>
73
+
74
+ <div class="background-description bg-gradient">
75
+ <div class="description-inner options">
76
+ <div>
77
+ <div class="color-picker-wrap">
78
+ <div>
79
+ <label for="bg-gradient1"><?php _e( 'From top', 'strong-testimonials' ); ?></label>
80
+ </div>
81
+ <div>
82
+ <input type="text"
83
+ id="bg-gradient1"
84
+ name="view[data][background][gradient1]"
85
+ value="<?php echo $view['background']['gradient1']; ?>"
86
+ class="wp-color-picker-field gradient">
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ <div class="description-inner options">
92
+ <div>
93
+ <div class="color-picker-wrap">
94
+ <div>
95
+ <label for ="bg-gradient2"><?php _e( 'To bottom', 'strong-testimonials' ); ?></label>
96
+ </div>
97
+ <div>
98
+ <input type="text"
99
+ id="bg-gradient2"
100
+ name="view[data][background][gradient2]"
101
+ value="<?php echo $view['background']['gradient2']; ?>"
102
+ class="wp-color-picker-field gradient">
103
+ </div>
104
+ </div>
105
+ </div>
106
+
107
+ </div>
108
+ </div>
109
+
110
+ <div class="background-description bg-preset">
111
+ <div class="description-inner options">
112
+ <div>
113
+ <label for="view-background-preset">
114
+ <select id="view-background-preset" name="view[data][background][preset]">
115
+ <?php
116
+ $presets = wpmtst_get_background_presets();
117
+ $current_preset = ( isset( $view['background']['preset'] ) && $view['background']['preset'] ) ? $view['background']['preset'] : '';
118
+ echo '<option value="" ' . selected( $current_preset, '', false ) . '>&mdash;</option>';
119
+ foreach ( $presets as $key => $preset ) {
120
+ echo '<option value="' . $key . '" ' . selected( $current_preset, $key, false ) . '>' . $preset['label'] . '</option>';
121
+ }
122
+ ?>
123
+ </select>
124
+ </label>
125
+ </div>
126
+ </div>
127
+
128
+ </div>
129
+
130
+
131
+ </div>
132
+
133
+ </div>
134
+
135
+ </td>
136
+
137
+ <td rowspan="2" class="rowspan">
138
+ <div id="view-color-preview" class="table-cell">
139
+
140
+ <div class="background-preview-wrap">
141
+
142
+ <div id="background-preview">
143
+ Lorem ipsum dolor sit amet, accusam complectitur an eos. No vix perpetua adolescens, vix vidisse maiorum
144
+ in. No erat falli scripta qui, vis ubique scripta electram ad. Vix prompta adipisci no, ad vidisse
145
+ expetendis.
146
+ </div>
147
+
148
+ </div>
149
+
150
+ </div>
151
  </td>
admin/partials/views/option-boilerplate.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-option">
4
- <?php _e( 'Option Name', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <td>
8
- <div class="inline">
9
- <select id="view-option" class="if selectper" name="view[data][option]">
10
- <option value="yes" <?php selected( 'yes', $view['option'] ); ?>>
11
- <?php _e( 'yes', 'strong-testimonials' ); ?>
12
- </option>
13
- <option value="no" <?php selected( 'no', $view['option'] ); ?>>
14
- <?php _e( 'no', 'strong-testimonials' ); ?>
15
- </option>
16
- <option value="maybe" <?php selected( 'maybe', $view['option'] ); ?>>
17
- <?php _e( 'maybe', 'strong-testimonials' ); ?>
18
- </option>
19
- </select>
20
- </div>
21
-
22
- <div class="inline then fast then_yes then_not_no then_not_maybe" style="display: none;">
23
- <p class="description tall">
24
- <?php _e( 'Yes', 'strong-testimonials' ); ?><br>
25
- </p>
26
- </div>
27
-
28
- <div class="inline then fast then_not_yes then_no then_not_maybe" style="display: none;">
29
- <p class="description tall">
30
- <?php _e( 'No', 'strong-testimonials' ); ?><br>
31
- </p>
32
- </div>
33
-
34
- <div class="inline then fast then_not_yes then_not_no then_maybe" style="display: none;">
35
- <p class="description tall">
36
- <?php _e( 'Maybe', 'strong-testimonials' ); ?><br>
37
- </p>
38
- </div>
39
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-option">
4
+ <?php _e( 'Option Name', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td>
8
+ <div class="inline">
9
+ <select id="view-option" class="if selectper" name="view[data][option]">
10
+ <option value="yes" <?php selected( 'yes', $view['option'] ); ?>>
11
+ <?php _e( 'yes', 'strong-testimonials' ); ?>
12
+ </option>
13
+ <option value="no" <?php selected( 'no', $view['option'] ); ?>>
14
+ <?php _e( 'no', 'strong-testimonials' ); ?>
15
+ </option>
16
+ <option value="maybe" <?php selected( 'maybe', $view['option'] ); ?>>
17
+ <?php _e( 'maybe', 'strong-testimonials' ); ?>
18
+ </option>
19
+ </select>
20
+ </div>
21
+
22
+ <div class="inline then fast then_yes then_not_no then_not_maybe" style="display: none;">
23
+ <p class="description tall">
24
+ <?php _e( 'Yes', 'strong-testimonials' ); ?><br>
25
+ </p>
26
+ </div>
27
+
28
+ <div class="inline then fast then_not_yes then_no then_not_maybe" style="display: none;">
29
+ <p class="description tall">
30
+ <?php _e( 'No', 'strong-testimonials' ); ?><br>
31
+ </p>
32
+ </div>
33
+
34
+ <div class="inline then fast then_not_yes then_not_no then_maybe" style="display: none;">
35
+ <p class="description tall">
36
+ <?php _e( 'Maybe', 'strong-testimonials' ); ?><br>
37
+ </p>
38
+ </div>
39
+ </td>
admin/partials/views/option-category.php CHANGED
@@ -1,56 +1,56 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-category-select">
4
- <?php _e( 'Categories', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <?php if ( $cat_count ) : ?>
8
- <td>
9
- <div id="view-category" class="row">
10
- <div class="table inline">
11
- <div class="table-row">
12
- <div class="table-cell select-cell then_display then_slideshow then_not_form">
13
- <select id="view-category-select" class="if selectper" name="view[data][category_all]">
14
- <option value="allcats" <?php selected( $view['category'], 'all' ); ?>><?php _e( 'all', 'strong-testimonials' ); ?></option>
15
- <option value="somecats" <?php echo( 'all' != $view['category'] ? 'selected' : '' ); ?>><?php _ex( 'select', 'verb', 'strong-testimonials' ); ?></option>
16
- </select>
17
- </div>
18
- <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
19
- <div class="table">
20
- <?php if ( $cat_count > 5 ) : ?>
21
- <div class="table-row">
22
- <div class="table-cell">
23
- <div class="row" style="text-align: right; padding-bottom: 5px;">
24
- <input type="button" class="expand-cats button" value="expand list"/>
25
- </div>
26
- </div>
27
- </div>
28
- <?php endif; ?>
29
- <div class="table-row">
30
- <div class="table-cell">
31
- <?php wpmtst_category_checklist( $view_cats_array ); ?>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- </td>
40
- <?php else : ?>
41
- <td>
42
- <div id="view-category" class="row">
43
- <input type="hidden" name="view[data][category_all]" value="all">
44
- <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
45
- </div>
46
- </td>
47
- <?php endif; ?>
48
- <td class="divider">
49
- <p><?php echo wp_kses_post( '<code>category</code>' ); ?></p>
50
- </td>
51
- <td>
52
- <p><?php _e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
53
- </td>
54
- <td>
55
- <p><?php echo wp_kses_post( '<code>category="accounting"</code>' ); ?></p>
56
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-category-select">
4
+ <?php _e( 'Categories', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <?php if ( $cat_count ) : ?>
8
+ <td>
9
+ <div id="view-category" class="row">
10
+ <div class="table inline">
11
+ <div class="table-row">
12
+ <div class="table-cell select-cell then_display then_slideshow then_not_form">
13
+ <select id="view-category-select" class="if selectper" name="view[data][category_all]">
14
+ <option value="allcats" <?php selected( $view['category'], 'all' ); ?>><?php _e( 'all', 'strong-testimonials' ); ?></option>
15
+ <option value="somecats" <?php echo( 'all' != $view['category'] ? 'selected' : '' ); ?>><?php _ex( 'select', 'verb', 'strong-testimonials' ); ?></option>
16
+ </select>
17
+ </div>
18
+ <div class="table-cell then then_not_allcats then_somecats" style="display: none;">
19
+ <div class="table">
20
+ <?php if ( $cat_count > 5 ) : ?>
21
+ <div class="table-row">
22
+ <div class="table-cell">
23
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
24
+ <input type="button" class="expand-cats button" value="expand list"/>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <?php endif; ?>
29
+ <div class="table-row">
30
+ <div class="table-cell">
31
+ <?php wpmtst_category_checklist( $view_cats_array ); ?>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </td>
40
+ <?php else : ?>
41
+ <td>
42
+ <div id="view-category" class="row">
43
+ <input type="hidden" name="view[data][category_all]" value="all">
44
+ <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
45
+ </div>
46
+ </td>
47
+ <?php endif; ?>
48
+ <td class="divider">
49
+ <p><?php echo wp_kses_post( '<code>category</code>' ); ?></p>
50
+ </td>
51
+ <td>
52
+ <p><?php _e( 'a comma-separated list of category slugs or ID\'s', 'strong-testimonials' ); ?></p>
53
+ </td>
54
+ <td>
55
+ <p><?php echo wp_kses_post( '<code>category="accounting"</code>' ); ?></p>
56
+ </td>
admin/partials/views/option-classes.php CHANGED
@@ -1,14 +1,14 @@
1
- <th>
2
- <label for="view-class">
3
- <?php _e( 'CSS Classes', 'strong-testimonials' ); ?>
4
- </label>
5
- </th>
6
- <td colspan="2">
7
- <div class="then then_display then_form then_slideshow input" style="display: none;">
8
- <input type="text" id="view-class" class="long inline" name="view[data][class]" value="<?php echo $view['class']; ?>">
9
- <p class="inline description tall">
10
- <?php _e( 'For advanced users.', 'strong-testimonials' ); ?>
11
- <?php _e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
12
- </p>
13
- </div>
14
- </td>
1
+ <th>
2
+ <label for="view-class">
3
+ <?php _e( 'CSS Classes', 'strong-testimonials' ); ?>
4
+ </label>
5
+ </th>
6
+ <td colspan="2">
7
+ <div class="then then_display then_form then_slideshow input" style="display: none;">
8
+ <input type="text" id="view-class" class="long inline" name="view[data][class]" value="<?php echo $view['class']; ?>">
9
+ <p class="inline description tall">
10
+ <?php _e( 'For advanced users.', 'strong-testimonials' ); ?>
11
+ <?php _e( 'Separate class names by spaces.', 'strong-testimonials' ); ?>
12
+ </p>
13
+ </div>
14
+ </td>
admin/partials/views/option-client-section.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <?php _e( 'Custom Fields', 'strong-testimonials' ); ?>
4
- </th>
5
- <td colspan="2">
6
-
7
- <div id="client-section-table">
8
-
9
- <div id="custom-field-list2" class="fields">
10
- <?php
11
- if ( isset( $view['client_section'] ) ) {
12
- foreach ( $view['client_section'] as $key => $field ) {
13
- wpmtst_view_field_inputs( $key, $field );
14
- }
15
- }
16
- ?>
17
- </div>
18
-
19
- </div>
20
-
21
- <div id="add-field-bar" class="is-below">
22
- <input id="add-field"
23
- type="button"
24
- name="add-field"
25
- value="<?php _e( 'Add Field', 'strong-testimonials' ); ?>"
26
- class="button-secondary" />
27
- </div>
28
-
29
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <?php _e( 'Custom Fields', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td colspan="2">
6
+
7
+ <div id="client-section-table">
8
+
9
+ <div id="custom-field-list2" class="fields">
10
+ <?php
11
+ if ( isset( $view['client_section'] ) ) {
12
+ foreach ( $view['client_section'] as $key => $field ) {
13
+ wpmtst_view_field_inputs( $key, $field );
14
+ }
15
+ }
16
+ ?>
17
+ </div>
18
+
19
+ </div>
20
+
21
+ <div id="add-field-bar" class="is-below">
22
+ <input id="add-field"
23
+ type="button"
24
+ name="add-field"
25
+ value="<?php _e( 'Add Field', 'strong-testimonials' ); ?>"
26
+ class="button-secondary" />
27
+ </div>
28
+
29
+ </td>
admin/partials/views/option-color.php CHANGED
@@ -1,57 +1,57 @@
1
- <th>
2
- <?php _e( 'Font Color', 'strong-testimonials' ); ?>
3
- </th>
4
- <td>
5
- <div class="section-radios font-color-section">
6
-
7
- <div class="radio-buttons">
8
- <ul class="radio-list font-folor-list">
9
- <li>
10
- <input type="radio"
11
- id="fc-none"
12
- name="view[data][font-color][type]"
13
- value="" <?php checked( $view['font-color']['type'], '' ); ?>>
14
- <label for="fc-none">
15
- <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
16
- </label>
17
- </li>
18
- <li>
19
- <input type="radio"
20
- id="fc-custom"
21
- name="view[data][font-color][type]"
22
- value="custom" <?php checked( $view['font-color']['type'], 'custom' ); ?>>
23
- <label for="fc-custom">
24
- <?php _e( 'custom', 'strong-testimonials' ); ?>
25
- </label>
26
- </li>
27
- </ul>
28
- </div>
29
-
30
- <div class="radio-description" id="view-font-color-info">
31
- <div class="font-color-description fc-none">
32
- <div class="description-inner options">
33
- <div>
34
- <?php _e( 'No options', 'strong-testimonials' ); ?>
35
- </div>
36
- </div>
37
- </div>
38
-
39
- <div class="font-color-description fc-custom">
40
- <div class="description-inner options">
41
- <div>
42
- <label>
43
- <input type="text"
44
- id="fc-color"
45
- name="view[data][font-color][color]"
46
- value="<?php echo $view['font-color']['color']; ?>"
47
- class="wp-color-picker-field">
48
- </label>
49
- </div>
50
- </div>
51
-
52
- </div>
53
-
54
- </div>
55
-
56
- </div>
57
- </td>
1
+ <th>
2
+ <?php _e( 'Font Color', 'strong-testimonials' ); ?>
3
+ </th>
4
+ <td>
5
+ <div class="section-radios font-color-section">
6
+
7
+ <div class="radio-buttons">
8
+ <ul class="radio-list font-folor-list">
9
+ <li>
10
+ <input type="radio"
11
+ id="fc-none"
12
+ name="view[data][font-color][type]"
13
+ value="" <?php checked( $view['font-color']['type'], '' ); ?>>
14
+ <label for="fc-none">
15
+ <?php _e( 'inherit from theme', 'strong-testimonials' ); ?>
16
+ </label>
17
+ </li>
18
+ <li>
19
+ <input type="radio"
20
+ id="fc-custom"
21
+ name="view[data][font-color][type]"
22
+ value="custom" <?php checked( $view['font-color']['type'], 'custom' ); ?>>
23
+ <label for="fc-custom">
24
+ <?php _e( 'custom', 'strong-testimonials' ); ?>
25
+ </label>
26
+ </li>
27
+ </ul>
28
+ </div>
29
+
30
+ <div class="radio-description" id="view-font-color-info">
31
+ <div class="font-color-description fc-none">
32
+ <div class="description-inner options">
33
+ <div>
34
+ <?php _e( 'No options', 'strong-testimonials' ); ?>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="font-color-description fc-custom">
40
+ <div class="description-inner options">
41
+ <div>
42
+ <label>
43
+ <input type="text"
44
+ id="fc-color"
45
+ name="view[data][font-color][color]"
46
+ value="<?php echo $view['font-color']['color']; ?>"
47
+ class="wp-color-picker-field">
48
+ </label>
49
+ </div>
50
+ </div>
51
+
52
+ </div>
53
+
54
+ </div>
55
+
56
+ </div>
57
+ </td>
admin/partials/views/option-content.php CHANGED
@@ -1,226 +1,226 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-content">
4
- <?php _e( 'Content', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <td colspan="2">
8
-
9
- <!-- Content type -->
10
- <div id="option-content" class="row">
11
- <div class="row-inner">
12
-
13
- <!-- select -->
14
- <div class="inline">
15
- <select id="view-content" class="if selectper min-width-1 label-not-adjacent" name="view[data][content]">
16
- <option value="entire" <?php selected( 'entire', $view['content'] ); ?>>
17
- <?php _ex( 'entire content', 'display setting', 'strong-testimonials' ); ?>
18
- </option>
19
- <option value="truncated" <?php selected( 'truncated', $view['content'] ); ?>>
20
- <?php _ex( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?>
21
- </option>
22
- <option value="excerpt" <?php selected( 'excerpt', $view['content'] ); ?>>
23
- <?php _ex( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?>
24
- </option>
25
- </select>
26
- </div>
27
-
28
- <!-- info & screenshot -->
29
- <div class="inline then fast then_truncated then_not_entire then_not_excerpt" style="display: none;">
30
- <p class="description">
31
- <?php _e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?>
32
- </p>
33
- </div>
34
- <div class="inline then fast then_not_truncated then_not_entire then_excerpt" style="display: none;">
35
- <p class="description">
36
- <?php printf( __( 'To create manual excerpts, you may need to enable them in the post editor like in this <a href="%s" class="thickbox">screenshot</a>.', 'strong-testimonials' ), esc_url( '#TB_inline?width=&height=210&inlineId=screenshot-screen-options' ) ); ?>
37
- <span class="screenshot" id="screenshot-screen-options" style="display: none;">
38
- <img src="<?php echo WPMTST_ADMIN_URL; ?>img/screen-options.png" width="600">
39
- </span>
40
- </p>
41
- </div>
42
-
43
- </div>
44
- </div>
45
-
46
- <!-- Excerpt length -->
47
- <div id="option-content-length" class="row then then_not_entire then_excerpt then_truncated" style="display: none;">
48
-
49
- <div class="row-inner">
50
-
51
- <!-- info -->
52
- <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
53
- <span>
54
- <?php _e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?>
55
- </span>
56
- </div>
57
-
58
- <!-- default or custom? -->
59
- <div class="inline">
60
- <label>
61
- <select id="view-use_default_length" class="if selectgroup min-width-1" name="view[data][use_default_length]">
62
- <option value="1" <?php selected( $view['use_default_length'] ); ?>>
63
- <?php _ex( 'default length', 'display setting', 'strong-testimonials' ); ?>
64
- </option>
65
- <option value="0" <?php selected( ! $view['use_default_length'] ); ?>>
66
- <?php _ex( 'custom length', 'display setting', 'strong-testimonials' ); ?>
67
- </option>
68
- </select>
69
- </label>
70
- </div>
71
-
72
- <!-- 1st option: default -->
73
- <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
74
- <label for="view-use_default_length" class="inline-middle"><?php // Because partner option has <label>, this prevents micro-bounce ?>
75
- <p class="description tall"><?php _e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
76
- </label>
77
- </div>
78
-
79
- <!-- 2nd option: length -->
80
- <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
81
- <label class="inline-middle">
82
- <?php printf( _x( 'the first %s words', 'the excerpt length', 'strong-testimonials' ), '<input id="view-excerpt_length" class="input-incremental" type="number" min="1" max="999" name="view[data][excerpt_length]" value="' . $view['excerpt_length'] . '">' ); ?>
83
- </label>
84
- </div>
85
-
86
- </div>
87
-
88
- </div><!-- #option-content-length -->
89
-
90
- <!-- Read-more link -->
91
- <div id="option-content-read-more" class="row then then_not_entire then_excerpt then_truncated" style="display: none;">
92
-
93
- <div class="row-inner subgroup">
94
-
95
- <!-- action: full post or in place -->
96
- <div class="row-inner">
97
- <div class="inline">
98
- <?php _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ); ?>
99
- </div>
100
- <div class="inline tight">
101
- <label>
102
- <select id="view-more_post_in_place"
103
- class="if selectgroup"
104
- name="view[data][more_post_in_place]">
105
- <option value="0" <?php selected( ! $view['more_post_in_place'] ); ?>>
106
- <?php // TODO Get label from Properties ?>
107
- <?php _e( 'the full testimonial', 'strong-testimonials' ); ?>
108
- </option>
109
- <option value="1" <?php selected( $view['more_post_in_place'] ); ?>>
110
- <?php _e( 'expand content in place', 'strong-testimonials' ); ?>
111
- </option>
112
- </select>
113
- </label>
114
- </div>
115
- </div>
116
-
117
- <!-- ellipsis -->
118
- <div class="row-inner">
119
- <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
120
- <div class="inline">
121
- <label>
122
- <select id="view-more_post_ellipsis"
123
- class="if selectgroup"
124
- name="view[data][more_post_ellipsis]">
125
- <option value="1" <?php selected( $view['more_post_ellipsis'] ); ?>>
126
- <?php _e( 'with an ellipsis', 'strong-testimonials' ); ?>
127
- </option>
128
- <option value="0" <?php selected( ! $view['more_post_ellipsis'] ); ?>>
129
- <?php _e( 'without an ellipsis', 'strong-testimonials' ); ?>
130
- </option>
131
- </select>
132
- </label>
133
- </div>
134
- <div class="inline then then_excerpt then_not_truncated" style="display: none;">
135
- <p class="description">
136
- <?php _e( 'Automatic excerpt only.', 'strong-testimonials' ); ?>
137
- </p>
138
- </div>
139
- </div>
140
- </div>
141
-
142
- <!-- default or custom -->
143
- <div class="row-inner">
144
- <div class="inline tight then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
145
- <?php _e( 'with link text to read more', 'strong-testimonials' ); ?>
146
- </div>
147
- <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
148
- <label>
149
- <select id="view-use_default_more"
150
- class="if selectgroup min-width-1"
151
- name="view[data][use_default_more]">
152
- <option value="1" <?php selected( $view['use_default_more'] ); ?>>
153
- <?php _ex( 'with default link text', 'display setting', 'strong-testimonials' ); ?>
154
- </option>
155
- <option value="0" <?php selected( ! $view['use_default_more'] ); ?>>
156
- <?php _ex( 'with custom link text', 'display setting', 'strong-testimonials' ); ?>
157
- </option>
158
- </select>
159
- </label>
160
- </div>
161
- <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
162
- <p class="description"><?php _e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
163
- </div>
164
- <!-- read more -->
165
- <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
166
- <span id="option-link-text" class="inline-span">
167
- <label for="view-more_post_text">
168
- <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
169
- value="<?php echo $view['more_post_text']; ?>" size="22"
170
- placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
171
- </label>
172
- </span>
173
- </div>
174
- </div>
175
-
176
- <!-- read less -->
177
- <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
178
- <div class="inline tight">
179
- <?php _e( 'and link text to read less', 'strong-testimonials' ); ?>
180
- </div>
181
- <div class="inline tight">
182
- <span id="option-link-text-less" class="inline-span">
183
- <label for="view-less_post_text">
184
- <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
185
- value="<?php echo $view['less_post_text']; ?>" size="22"
186
- placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
187
- </label>
188
- </span>
189
- <p class="inline description"><?php _e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
190
- </div>
191
- </div>
192
-
193
- <!-- automatic or both -->
194
- <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
195
- <div class="inline">
196
- <label>
197
- <select id="view-more_full_post" class="if selectgroup" name="view[data][more_full_post]">
198
- <option value="0" <?php selected( $view['more_full_post'], 0 ); ?>>
199
- <?php _ex( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?>
200
- </option>
201
- <option value="1" <?php selected( $view['more_full_post'], 1 ); ?>>
202
- <?php _ex( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?>
203
- </option>
204
- </select>
205
- </label>
206
- </div>
207
- </div>
208
- </div>
209
- </div>
210
-
211
- <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
212
- <p class="description tall solo">
213
- <?php
214
- printf(
215
- esc_html__( '%s about WordPress excerpts', 'strong-testimonials' ),
216
- sprintf(
217
- '<a href="%s" target="_blank">%s</a>',
218
- esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ),
219
- esc_html__( 'Learn more', 'strong-testimonials' )
220
- )
221
- );
222
- ?>
223
- </p>
224
- </div>
225
-
226
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-content">
4
+ <?php _e( 'Content', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td colspan="2">
8
+
9
+ <!-- Content type -->
10
+ <div id="option-content" class="row">
11
+ <div class="row-inner">
12
+
13
+ <!-- select -->
14
+ <div class="inline">
15
+ <select id="view-content" class="if selectper min-width-1 label-not-adjacent" name="view[data][content]">
16
+ <option value="entire" <?php selected( 'entire', $view['content'] ); ?>>
17
+ <?php _ex( 'entire content', 'display setting', 'strong-testimonials' ); ?>
18
+ </option>
19
+ <option value="truncated" <?php selected( 'truncated', $view['content'] ); ?>>
20
+ <?php _ex( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?>
21
+ </option>
22
+ <option value="excerpt" <?php selected( 'excerpt', $view['content'] ); ?>>
23
+ <?php _ex( 'manual excerpt', 'display setting', 'strong-testimonials' ); ?>
24
+ </option>
25
+ </select>
26
+ </div>
27
+
28
+ <!-- info & screenshot -->
29
+ <div class="inline then fast then_truncated then_not_entire then_not_excerpt" style="display: none;">
30
+ <p class="description">
31
+ <?php _e( 'This will strip tags like &lt;em&gt; and &lt;strong&gt;.', 'strong-testimonials' ); ?>
32
+ </p>
33
+ </div>
34
+ <div class="inline then fast then_not_truncated then_not_entire then_excerpt" style="display: none;">
35
+ <p class="description">
36
+ <?php printf( __( 'To create manual excerpts, you may need to enable them in the post editor like in this <a href="%s" class="thickbox">screenshot</a>.', 'strong-testimonials' ), esc_url( '#TB_inline?width=&height=210&inlineId=screenshot-screen-options' ) ); ?>
37
+ <span class="screenshot" id="screenshot-screen-options" style="display: none;">
38
+ <img src="<?php echo WPMTST_ADMIN_URL; ?>img/screen-options.png" width="600">
39
+ </span>
40
+ </p>
41
+ </div>
42
+
43
+ </div>
44
+ </div>
45
+
46
+ <!-- Excerpt length -->
47
+ <div id="option-content-length" class="row then then_not_entire then_excerpt then_truncated" style="display: none;">
48
+
49
+ <div class="row-inner">
50
+
51
+ <!-- info -->
52
+ <div class="inline tight then then_excerpt then_not_truncated" style="display: none;">
53
+ <span>
54
+ <?php _e( 'If no manual excerpt, create an excerpt using', 'strong-testimonials' ); ?>
55
+ </span>
56
+ </div>
57
+
58
+ <!-- default or custom? -->
59
+ <div class="inline">
60
+ <label>
61
+ <select id="view-use_default_length" class="if selectgroup min-width-1" name="view[data][use_default_length]">
62
+ <option value="1" <?php selected( $view['use_default_length'] ); ?>>
63
+ <?php _ex( 'default length', 'display setting', 'strong-testimonials' ); ?>
64
+ </option>
65
+ <option value="0" <?php selected( ! $view['use_default_length'] ); ?>>
66
+ <?php _ex( 'custom length', 'display setting', 'strong-testimonials' ); ?>
67
+ </option>
68
+ </select>
69
+ </label>
70
+ </div>
71
+
72
+ <!-- 1st option: default -->
73
+ <div class="inline then fast then_use_default_length then_1 then_not_0" style="display: none;">
74
+ <label for="view-use_default_length" class="inline-middle"><?php // Because partner option has <label>, this prevents micro-bounce ?>
75
+ <p class="description tall"><?php _e( 'The default length is 55 words but your theme may override that.', 'strong-testimonials' ); ?></p>
76
+ </label>
77
+ </div>
78
+
79
+ <!-- 2nd option: length -->
80
+ <div class="inline then fast then_use_default_length then_0 then_not_1" style="display: none;">
81
+ <label class="inline-middle">
82
+ <?php printf( _x( 'the first %s words', 'the excerpt length', 'strong-testimonials' ), '<input id="view-excerpt_length" class="input-incremental" type="number" min="1" max="999" name="view[data][excerpt_length]" value="' . $view['excerpt_length'] . '">' ); ?>
83
+ </label>
84
+ </div>
85
+
86
+ </div>
87
+
88
+ </div><!-- #option-content-length -->
89
+
90
+ <!-- Read-more link -->
91
+ <div id="option-content-read-more" class="row then then_not_entire then_excerpt then_truncated" style="display: none;">
92
+
93
+ <div class="row-inner subgroup">
94
+
95
+ <!-- action: full post or in place -->
96
+ <div class="row-inner">
97
+ <div class="inline">
98
+ <?php _e( 'Add a <strong>Read more</strong> link to', 'strong-testimonials' ); ?>
99
+ </div>
100
+ <div class="inline tight">
101
+ <label>
102
+ <select id="view-more_post_in_place"
103
+ class="if selectgroup"
104
+ name="view[data][more_post_in_place]">
105
+ <option value="0" <?php selected( ! $view['more_post_in_place'] ); ?>>
106
+ <?php // TODO Get label from Properties ?>
107
+ <?php _e( 'the full testimonial', 'strong-testimonials' ); ?>
108
+ </option>
109
+ <option value="1" <?php selected( $view['more_post_in_place'] ); ?>>
110
+ <?php _e( 'expand content in place', 'strong-testimonials' ); ?>
111
+ </option>
112
+ </select>
113
+ </label>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- ellipsis -->
118
+ <div class="row-inner">
119
+ <div class="then then_use_default_more then_0 then_not_1" style="display: none;">
120
+ <div class="inline">
121
+ <label>
122
+ <select id="view-more_post_ellipsis"
123
+ class="if selectgroup"
124
+ name="view[data][more_post_ellipsis]">
125
+ <option value="1" <?php selected( $view['more_post_ellipsis'] ); ?>>
126
+ <?php _e( 'with an ellipsis', 'strong-testimonials' ); ?>
127
+ </option>
128
+ <option value="0" <?php selected( ! $view['more_post_ellipsis'] ); ?>>
129
+ <?php _e( 'without an ellipsis', 'strong-testimonials' ); ?>
130
+ </option>
131
+ </select>
132
+ </label>
133
+ </div>
134
+ <div class="inline then then_excerpt then_not_truncated" style="display: none;">
135
+ <p class="description">
136
+ <?php _e( 'Automatic excerpt only.', 'strong-testimonials' ); ?>
137
+ </p>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <!-- default or custom -->
143
+ <div class="row-inner">
144
+ <div class="inline tight then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
145
+ <?php _e( 'with link text to read more', 'strong-testimonials' ); ?>
146
+ </div>
147
+ <div class="inline then fast then_more_post_in_place then_0 then_not_1" style="display: none;">
148
+ <label>
149
+ <select id="view-use_default_more"
150
+ class="if selectgroup min-width-1"
151
+ name="view[data][use_default_more]">
152
+ <option value="1" <?php selected( $view['use_default_more'] ); ?>>
153
+ <?php _ex( 'with default link text', 'display setting', 'strong-testimonials' ); ?>
154
+ </option>
155
+ <option value="0" <?php selected( ! $view['use_default_more'] ); ?>>
156
+ <?php _ex( 'with custom link text', 'display setting', 'strong-testimonials' ); ?>
157
+ </option>
158
+ </select>
159
+ </label>
160
+ </div>
161
+ <div class="inline then fast then_use_default_more then_1 then_not_0" style="display: none;">
162
+ <p class="description"><?php _e( 'If you only see [&hellip;] without a link then use the custom link text instead.', 'strong-testimonials' ); ?></p>
163
+ </div>
164
+ <!-- read more -->
165
+ <div class="inline then fast then_use_default_more then_0 then_not_1" style="display: none;">
166
+ <span id="option-link-text" class="inline-span">
167
+ <label for="view-more_post_text">
168
+ <input type="text" id="view-more_post_text" name="view[data][more_post_text]"
169
+ value="<?php echo $view['more_post_text']; ?>" size="22"
170
+ placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
171
+ </label>
172
+ </span>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- read less -->
177
+ <div class="row-inner then fast then_more_post_in_place then_1 then_not_0" style="display: none;">
178
+ <div class="inline tight">
179
+ <?php _e( 'and link text to read less', 'strong-testimonials' ); ?>
180
+ </div>
181
+ <div class="inline tight">
182
+ <span id="option-link-text-less" class="inline-span">
183
+ <label for="view-less_post_text">
184
+ <input type="text" id="view-less_post_text" name="view[data][less_post_text]"
185
+ value="<?php echo $view['less_post_text']; ?>" size="22"
186
+ placeholder="<?php _e( 'enter a phrase', 'strong-testimonials' ); ?>">
187
+ </label>
188
+ </span>
189
+ <p class="inline description"><?php _e( 'Leave blank to leave content expanded without a link.', 'strong-testimonials' ); ?></p>
190
+ </div>
191
+ </div>
192
+
193
+ <!-- automatic or both -->
194
+ <div class="row-inner then then_excerpt then_not_truncated" style="display: none;">
195
+ <div class="inline">
196
+ <label>
197
+ <select id="view-more_full_post" class="if selectgroup" name="view[data][more_full_post]">
198
+ <option value="0" <?php selected( $view['more_full_post'], 0 ); ?>>
199
+ <?php _ex( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?>
200
+ </option>
201
+ <option value="1" <?php selected( $view['more_full_post'], 1 ); ?>>
202
+ <?php _ex( 'for both automatic and manual excerpts', 'display setting', 'strong-testimonials' ); ?>
203
+ </option>
204
+ </select>
205
+ </label>
206
+ </div>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <div class="row links then then_not_entire then_truncated then_excerpt" style="display: none;">
212
+ <p class="description tall solo">
213
+ <?php
214
+ printf(
215
+ esc_html__( '%s about WordPress excerpts', 'strong-testimonials' ),
216
+ sprintf(
217
+ '<a href="%s" target="_blank">%s</a>',
218
+ esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ),
219
+ esc_html__( 'Learn more', 'strong-testimonials' )
220
+ )
221
+ );
222
+ ?>
223
+ </p>
224
+ </div>
225
+
226
+ </td>
admin/partials/views/option-divi.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- /* translators: On the Views admin screen. */
3
- global $view;
4
- ?>
5
- <th>
6
- <label for="view-divi_builder"><?php _e( 'Divi Builder', 'strong-testimonials' ); ?></label>
7
- </th>
8
- <td>
9
- <div class="row">
10
- <div class="row-inner">
11
- <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
12
- name="view[data][divi_builder]" value="1" <?php checked( $view['divi_builder'] ); ?>/>
13
- <label for="view-divi_builder">
14
- <?php _e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?>
15
- </label>
16
- <p class="description short">
17
- <?php _e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?>
18
- </p>
19
- <p class="description short">
20
- <?php _e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?>
21
- </p>
22
- </div>
23
- </div>
24
- </td>
1
+ <?php
2
+ /* translators: On the Views admin screen. */
3
+ global $view;
4
+ ?>
5
+ <th>
6
+ <label for="view-divi_builder"><?php _e( 'Divi Builder', 'strong-testimonials' ); ?></label>
7
+ </th>
8
+ <td>
9
+ <div class="row">
10
+ <div class="row-inner">
11
+ <input type="checkbox" id="view-divi_builder" class="if toggle checkbox"
12
+ name="view[data][divi_builder]" value="1" <?php checked( $view['divi_builder'] ); ?>/>
13
+ <label for="view-divi_builder">
14
+ <?php _e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in <b>Divi Builder version 2</b>.', 'strong-testimonials' ); ?>
15
+ </label>
16
+ <p class="description short">
17
+ <?php _e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?>
18
+ </p>
19
+ <p class="description short">
20
+ <?php _e( 'Not required if simply adding this view in the <b>Divi theme</b> using either the default editor or Divi Builder.', 'strong-testimonials' ); ?>
21
+ </p>
22
+ </div>
23
+ </div>
24
+ </td>
admin/partials/views/option-form-ajax.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <input type="checkbox" id="view-form_ajax" class="checkbox if toggle"
4
- name="view[data][form_ajax]" value="1" <?php checked( $view['form_ajax'] ); ?>>
5
- <label for="view-form_ajax">
6
- <?php _e( 'Submit form without reloading the page (Ajax)', 'strong-testimonials' ); ?>
7
- </label>
8
- </th>
9
- <td>
10
- <p class="description tall">
11
- <?php _e( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ); ?>
12
- </p>
13
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <input type="checkbox" id="view-form_ajax" class="checkbox if toggle"
4
+ name="view[data][form_ajax]" value="1" <?php checked( $view['form_ajax'] ); ?>>
5
+ <label for="view-form_ajax">
6
+ <?php _e( 'Submit form without reloading the page (Ajax)', 'strong-testimonials' ); ?>
7
+ </label>
8
+ </th>
9
+ <td>
10
+ <p class="description tall">
11
+ <?php _e( 'This will override the <strong>Success Redirect</strong> setting.', 'strong-testimonials' ); ?>
12
+ </p>
13
+ </td>
admin/partials/views/option-form-category.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <?php _e( 'Assign to a category', 'strong-testimonials' ); ?>
4
- </th>
5
- <?php if ( $cat_count ) : ?>
6
- <td>
7
- <div class="table">
8
- <?php if ( $cat_count > 5 ) : ?>
9
- <div class="table-row">
10
- <div class="table-cell">
11
- <div class="row" style="text-align: right; padding-bottom: 5px;">
12
- <input type="button" class="expand-cats button" value="expand list"/>
13
- </div>
14
- </div>
15
- </div>
16
- <?php endif; ?>
17
- <div class="table-row">
18
- <div class="table-cell">
19
- <?php wpmtst_form_category_checklist( $view_cats_array ); ?>
20
- </div>
21
- </div>
22
- </div>
23
- </td>
24
- <?php else : ?>
25
- <td>
26
- <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
27
- </td>
28
- <?php endif; ?>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <?php _e( 'Assign to a category', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <?php if ( $cat_count ) : ?>
6
+ <td>
7
+ <div class="table">
8
+ <?php if ( $cat_count > 5 ) : ?>
9
+ <div class="table-row">
10
+ <div class="table-cell">
11
+ <div class="row" style="text-align: right; padding-bottom: 5px;">
12
+ <input type="button" class="expand-cats button" value="expand list"/>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ <?php endif; ?>
17
+ <div class="table-row">
18
+ <div class="table-cell">
19
+ <?php wpmtst_form_category_checklist( $view_cats_array ); ?>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </td>
24
+ <?php else : ?>
25
+ <td>
26
+ <p class="description tall"><?php _e( 'No categories found', 'strong-testimonials' ); ?></p>
27
+ </td>
28
+ <?php endif; ?>
admin/partials/views/option-id.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <div class="then then_not_slideshow then_single then_not_multiple" style="display: none;">
3
-
4
- <div class="row-inner">
5
- <label>
6
- <select id="view-id" name="view[data][id]">
7
- <option value="0"><?php _e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
8
- <?php foreach ( $testimonials_list as $post ) : ?>
9
- <option value="<?php echo $post->ID; ?>" <?php selected( $view['id'], $post->ID ); ?>>
10
- <?php echo $post->post_title ? $post->post_title : __( '(untitled)', 'strong-testimonials' ); ?>
11
- </option>
12
- <?php endforeach; ?>
13
- </select>
14
- </label>
15
- </div>
16
- <div class="row-inner">
17
- <label for="view-post_id">
18
- <?php _ex( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
19
- </label>
20
- <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
21
- </div>
22
-
23
- </div>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <div class="then then_not_slideshow then_single then_not_multiple" style="display: none;">
3
+
4
+ <div class="row-inner">
5
+ <label>
6
+ <select id="view-id" name="view[data][id]">
7
+ <option value="0"><?php _e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
8
+ <?php foreach ( $testimonials_list as $post ) : ?>
9
+ <option value="<?php echo $post->ID; ?>" <?php selected( $view['id'], $post->ID ); ?>>
10
+ <?php echo $post->post_title ? $post->post_title : __( '(untitled)', 'strong-testimonials' ); ?>
11
+ </option>
12
+ <?php endforeach; ?>
13
+ </select>
14
+ </label>
15
+ </div>
16
+ <div class="row-inner">
17
+ <label for="view-post_id">
18
+ <?php _ex( 'or enter its ID or slug', 'to select a testimonial', 'strong-testimonials' ); ?>
19
+ </label>
20
+ <input type="text" id="view-post_id" name="view[data][post_id]" size="30">
21
+ </div>
22
+
23
+ </div>
admin/partials/views/option-layout.php CHANGED
@@ -1,147 +1,147 @@
1
- <th>
2
- <?php _e( 'Layout', 'strong-testimonials' ); ?>
3
- </th>
4
- <td colspan="2">
5
- <div class="section-radios layout-section">
6
-
7
- <!-- Inputs -->
8
- <div class="radio-buttons">
9
- <ul class="radio-list layout-list">
10
- <li>
11
- <input type="radio"
12
- id="view-layout-normal"
13
- name="view[data][layout]"
14
- value="" <?php checked( false, $view['layout'] ); ?>>
15
- <label for="view-layout-normal">
16
- <?php _e( 'normal', 'strong-testimonials' ); ?>
17
- </label>
18
- </li>
19
- <li>
20
- <input type="radio"
21
- id="view-layout-masonry"
22
- name="view[data][layout]"
23
- value="masonry" <?php checked( 'masonry', $view['layout'] ); ?>>
24
- <label for="view-layout-masonry">
25
- <?php _e( 'Masonry', 'strong-testimonials' ); ?>
26
- </label>
27
- </li>
28
- <li>
29
- <input type="radio"
30
- id="view-layout-columns"
31
- name="view[data][layout]"
32
- value="columns" <?php checked( 'columns', $view['layout'] ); ?>>
33
- <label for="view-layout-columns">
34
- <?php _e( 'columns', 'strong-testimonials' ); ?>
35
- </label>
36
- </li>
37
- <li>
38
- <input type="radio"
39
- id="view-layout-grid"
40
- name="view[data][layout]"
41
- value="grid" <?php checked( 'grid', $view['layout'] ); ?>>
42
- <label for="view-layout-grid">
43
- <?php _e( 'grid', 'strong-testimonials' ); ?>
44
- </label>
45
- </li>
46
- </ul>
47
- </div>
48
-
49
- <!-- Layout Info -->
50
- <div>
51
- <div class="radio-description" id="view-layout-info">
52
-
53
- <div class="layout-description view-layout-normal">
54
- <p><?php _e( 'A single column.', 'strong-testimonials' ); ?></p>
55
- </div>
56
-
57
- <div class="layout-description view-layout-masonry">
58
- <p><?php printf( __( 'A cascading, responsive grid using the jQuery plugin <a href="%s" target="_blank">Masonry</a>.', 'strong-testimonials' ), esc_url( 'http://masonry.desandro.com/' ) ); ?></p>
59
- <p><?php _e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
60
- <p><?php _e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
61
- </div>
62
-
63
- <div class="layout-description view-layout-columns">
64
- <p><?php printf( __( 'Using <a href="%s" target="_blank">CSS multi-column</a>. Fill from top to bottom, then over to next column.', 'strong-testimonials' ), esc_url( 'https://css-tricks.com/guide-responsive-friendly-css-columns/' ) ); ?></p>
65
- <p><?php _e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
66
- <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
67
- </div>
68
-
69
- <div class="layout-description view-layout-grid">
70
- <p><?php
71
- $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
72
- printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) );
73
- ?></p>
74
- <p><?php _e( 'Testimonials will be equal height so this works best when they are about the same length either naturally or using excerpts.', 'strong-testimonials' ); ?></p>
75
- <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
76
- </div>
77
-
78
- </div>
79
-
80
- <!-- Column selector -->
81
- <div class="radio-description options" id="column-count-wrapper">
82
- <div>
83
- <label for="view-column-count"><?php _e( 'Number of columns', 'strong-testimonials' ); ?></label>
84
- <select id="view-column-count" name="view[data][column_count]">
85
- <option value="2" <?php selected( $view['column_count'], 2 ); ?>>2</option>
86
- <option value="3" <?php selected( $view['column_count'], 3 ); ?>>3</option>
87
- <option value="4" <?php selected( $view['column_count'], 4 ); ?>>4</option>
88
- </select>
89
- </div>
90
- </div>
91
- </div>
92
-
93
- <!-- Examples -->
94
- <div>
95
- <div class="layout-example view-layout-normal">
96
- <div class="example-container">
97
- <div class="box"><span>1</span></div>
98
- <div class="box size2"><span>2</span></div>
99
- <div class="box"><span>3</span></div>
100
- <div class="box size2"><span>4</span></div>
101
- <div class="box"><span>5</span></div>
102
- </div>
103
- </div>
104
- <div class="layout-example view-layout-masonry">
105
- <div class="example-container col-2">
106
- <div class="grid-sizer"></div>
107
- <div class="box"><span>1</span></div>
108
- <div class="box size2"><span>2</span></div>
109
- <div class="box"><span>3</span></div>
110
- <div class="box size3"><span>4</span></div>
111
- <div class="box"><span>5</span></div>
112
- <div class="box size2"><span>6</span></div>
113
- <div class="box"><span>7</span></div>
114
- <div class="box size3"><span>8</span></div>
115
- <div class="box"><span>9</span></div>
116
- </div>
117
- </div>
118
- <div class="layout-example view-layout-columns">
119
- <div class="example-container col-2">
120
- <div class="box"><span>1</span></div>
121
- <div class="box size2"><span>2</span></div>
122
- <div class="box"><span>3</span></div>
123
- <div class="box size3"><span>4</span></div>
124
- <div class="box"><span>5</span></div>
125
- <div class="box size2"><span>6</span></div>
126
- <div class="box"><span>7</span></div>
127
- <div class="box size3"><span>8</span></div>
128
- <div class="box"><span>9</span></div>
129
- </div>
130
- </div>
131
- <div class="layout-example view-layout-grid">
132
- <div class="example-container col-2">
133
- <div class="box"><span>1</span></div>
134
- <div class="box"><span>2</span></div>
135
- <div class="box"><span>3</span></div>
136
- <div class="box"><span>4</span></div>
137
- <div class="box"><span>5</span></div>
138
- <div class="box"><span>6</span></div>
139
- <div class="box"><span>7</span></div>
140
- <div class="box"><span>8</span></div>
141
- <div class="box"><span>9</span></div>
142
- </div>
143
- </div>
144
- </div>
145
-
146
- </div>
147
- </td>
1
+ <th>
2
+ <?php _e( 'Layout', 'strong-testimonials' ); ?>
3
+ </th>
4
+ <td colspan="2">
5
+ <div class="section-radios layout-section">
6
+
7
+ <!-- Inputs -->
8
+ <div class="radio-buttons">
9
+ <ul class="radio-list layout-list">
10
+ <li>
11
+ <input type="radio"
12
+ id="view-layout-normal"
13
+ name="view[data][layout]"
14
+ value="" <?php checked( false, $view['layout'] ); ?>>
15
+ <label for="view-layout-normal">
16
+ <?php _e( 'normal', 'strong-testimonials' ); ?>
17
+ </label>
18
+ </li>
19
+ <li>
20
+ <input type="radio"
21
+ id="view-layout-masonry"
22
+ name="view[data][layout]"
23
+ value="masonry" <?php checked( 'masonry', $view['layout'] ); ?>>
24
+ <label for="view-layout-masonry">
25
+ <?php _e( 'Masonry', 'strong-testimonials' ); ?>
26
+ </label>
27
+ </li>
28
+ <li>
29
+ <input type="radio"
30
+ id="view-layout-columns"
31
+ name="view[data][layout]"
32
+ value="columns" <?php checked( 'columns', $view['layout'] ); ?>>
33
+ <label for="view-layout-columns">
34
+ <?php _e( 'columns', 'strong-testimonials' ); ?>
35
+ </label>
36
+ </li>
37
+ <li>
38
+ <input type="radio"
39
+ id="view-layout-grid"
40
+ name="view[data][layout]"
41
+ value="grid" <?php checked( 'grid', $view['layout'] ); ?>>
42
+ <label for="view-layout-grid">
43
+ <?php _e( 'grid', 'strong-testimonials' ); ?>
44
+ </label>
45
+ </li>
46
+ </ul>
47
+ </div>
48
+
49
+ <!-- Layout Info -->
50
+ <div>
51
+ <div class="radio-description" id="view-layout-info">
52
+
53
+ <div class="layout-description view-layout-normal">
54
+ <p><?php _e( 'A single column.', 'strong-testimonials' ); ?></p>
55
+ </div>
56
+
57
+ <div class="layout-description view-layout-masonry">
58
+ <p><?php printf( __( 'A cascading, responsive grid using the jQuery plugin <a href="%s" target="_blank">Masonry</a>.', 'strong-testimonials' ), esc_url( 'http://masonry.desandro.com/' ) ); ?></p>
59
+ <p><?php _e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
60
+ <p><?php _e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
61
+ </div>
62
+
63
+ <div class="layout-description view-layout-columns">
64
+ <p><?php printf( __( 'Using <a href="%s" target="_blank">CSS multi-column</a>. Fill from top to bottom, then over to next column.', 'strong-testimonials' ), esc_url( 'https://css-tricks.com/guide-responsive-friendly-css-columns/' ) ); ?></p>
65
+ <p><?php _e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
66
+ <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
67
+ </div>
68
+
69
+ <div class="layout-description view-layout-grid">
70
+ <p><?php
71
+ $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
72
+ printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) );
73
+ ?></p>
74
+ <p><?php _e( 'Testimonials will be equal height so this works best when they are about the same length either naturally or using excerpts.', 'strong-testimonials' ); ?></p>
75
+ <p><?php _e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
76
+ </div>
77
+
78
+ </div>
79
+
80
+ <!-- Column selector -->
81
+ <div class="radio-description options" id="column-count-wrapper">
82
+ <div>
83
+ <label for="view-column-count"><?php _e( 'Number of columns', 'strong-testimonials' ); ?></label>
84
+ <select id="view-column-count" name="view[data][column_count]">
85
+ <option value="2" <?php selected( $view['column_count'], 2 ); ?>>2</option>
86
+ <option value="3" <?php selected( $view['column_count'], 3 ); ?>>3</option>
87
+ <option value="4" <?php selected( $view['column_count'], 4 ); ?>>4</option>
88
+ </select>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <!-- Examples -->
94
+ <div>
95
+ <div class="layout-example view-layout-normal">
96
+ <div class="example-container">
97
+ <div class="box"><span>1</span></div>
98
+ <div class="box size2"><span>2</span></div>
99
+ <div class="box"><span>3</span></div>
100
+ <div class="box size2"><span>4</span></div>
101
+ <div class="box"><span>5</span></div>
102
+ </div>
103
+ </div>
104
+ <div class="layout-example view-layout-masonry">
105
+ <div class="example-container col-2">
106
+ <div class="grid-sizer"></div>
107
+ <div class="box"><span>1</span></div>
108
+ <div class="box size2"><span>2</span></div>
109
+ <div class="box"><span>3</span></div>
110
+ <div class="box size3"><span>4</span></div>
111
+ <div class="box"><span>5</span></div>
112
+ <div class="box size2"><span>6</span></div>
113
+ <div class="box"><span>7</span></div>
114
+ <div class="box size3"><span>8</span></div>
115
+ <div class="box"><span>9</span></div>
116
+ </div>
117
+ </div>
118
+ <div class="layout-example view-layout-columns">
119
+ <div class="example-container col-2">
120
+ <div class="box"><span>1</span></div>
121
+ <div class="box size2"><span>2</span></div>
122
+ <div class="box"><span>3</span></div>
123
+ <div class="box size3"><span>4</span></div>
124
+ <div class="box"><span>5</span></div>
125
+ <div class="box size2"><span>6</span></div>
126
+ <div class="box"><span>7</span></div>
127
+ <div class="box size3"><span>8</span></div>
128
+ <div class="box"><span>9</span></div>
129
+ </div>
130
+ </div>
131
+ <div class="layout-example view-layout-grid">
132
+ <div class="example-container col-2">
133
+ <div class="box"><span>1</span></div>
134
+ <div class="box"><span>2</span></div>
135
+ <div class="box"><span>3</span></div>
136
+ <div class="box"><span>4</span></div>
137
+ <div class="box"><span>5</span></div>
138
+ <div class="box"><span>6</span></div>
139
+ <div class="box"><span>7</span></div>
140
+ <div class="box"><span>8</span></div>
141
+ <div class="box"><span>9</span></div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ </div>
147
+ </td>
admin/partials/views/option-limit.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-all">
4
- <?php _e( 'Quantity', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <td>
8
- <div class="row">
9
- <div class="inline">
10
- <select class="if select" id="view-all" name="view[data][all]">
11
- <option value="1" <?php selected( -1, $view['count'] ); ?>>
12
- <?php _e( 'all', 'strong-testimonials' ); ?>
13
- </option>
14
- <option class="trip" value="0" <?php selected( $view['count'] > 0 ); ?>>
15
- <?php _ex( 'count', 'noun', 'strong-testimonials' ); ?>
16
- </option>
17
- </select>
18
- &nbsp;
19
- <label>
20
- <input class="input-incremental then_all" type="number" id="view-count"
21
- name="view[data][count]" value="<?php echo ( -1 == $view['count'] ) ? 1 : $view['count']; ?>"
22
- min="1" size="5" style="display: none;">
23
- </label>
24
- </div>
25
- </div>
26
- </td>
27
- <td class="divider">
28
- <p><?php echo wp_kses_post( '<code>count</code>' ); ?></p>
29
- </td>
30
- <td></td>
31
- <td>
32
- <p><?php echo wp_kses_post( '<code>count=5</code>' ); ?></p>
33
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-all">
4
+ <?php _e( 'Quantity', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td>
8
+ <div class="row">
9
+ <div class="inline">
10
+ <select class="if select" id="view-all" name="view[data][all]">
11
+ <option value="1" <?php selected( -1, $view['count'] ); ?>>
12
+ <?php _e( 'all', 'strong-testimonials' ); ?>
13
+ </option>
14
+ <option class="trip" value="0" <?php selected( $view['count'] > 0 ); ?>>
15
+ <?php _ex( 'count', 'noun', 'strong-testimonials' ); ?>
16
+ </option>
17
+ </select>
18
+ &nbsp;
19
+ <label>
20
+ <input class="input-incremental then_all" type="number" id="view-count"
21
+ name="view[data][count]" value="<?php echo ( -1 == $view['count'] ) ? 1 : $view['count']; ?>"
22
+ min="1" size="5" style="display: none;">
23
+ </label>
24
+ </div>
25
+ </div>
26
+ </td>
27
+ <td class="divider">
28
+ <p><?php echo wp_kses_post( '<code>count</code>' ); ?></p>
29
+ </td>
30
+ <td></td>
31
+ <td>
32
+ <p><?php echo wp_kses_post( '<code>count=5</code>' ); ?></p>
33
+ </td>
admin/partials/views/option-order.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-order">
4
- <?php _ex( 'Order', 'noun', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <td>
8
- <div class="row">
9
- <div class="inline">
10
- <select id="view-order" name="view[data][order]">
11
- <?php foreach ( $view_options['order'] as $order => $order_label ) : ?>
12
- <option value="<?php echo $order; ?>" <?php selected( $order, $view['order'] ); ?>><?php echo $order_label; ?></option>
13
- <?php endforeach; ?>
14
- </select>
15
- </div>
16
- </div>
17
- </td>
18
- <td class="divider">
19
- <p><?php echo wp_kses_post( '<code>order</code>' ); ?></p>
20
- </td>
21
- <td>
22
- <p><?php echo wp_kses_post( 'oldest | newest | random | menu_order' ); ?></p>
23
- </td>
24
- <td>
25
- <p><?php echo wp_kses_post( '<code>order="random"</code>' ); ?></p>
26
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-order">
4
+ <?php _ex( 'Order', 'noun', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td>
8
+ <div class="row">
9
+ <div class="inline">
10
+ <select id="view-order" name="view[data][order]">
11
+ <?php foreach ( $view_options['order'] as $order => $order_label ) : ?>
12
+ <option value="<?php echo $order; ?>" <?php selected( $order, $view['order'] ); ?>><?php echo $order_label; ?></option>
13
+ <?php endforeach; ?>
14
+ </select>
15
+ </div>
16
+ </div>
17
+ </td>
18
+ <td class="divider">
19
+ <p><?php echo wp_kses_post( '<code>order</code>' ); ?></p>
20
+ </td>
21
+ <td>
22
+ <p><?php echo wp_kses_post( 'oldest | newest | random | menu_order' ); ?></p>
23
+ </td>
24
+ <td>
25
+ <p><?php echo wp_kses_post( '<code>order="random"</code>' ); ?></p>
26
+ </td>
admin/partials/views/option-pagination.php CHANGED
@@ -1,166 +1,166 @@
1
- <?php
2
-
3
- $links = '<span class="help-links">';
4
- $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a>';
5
- $links .= '</span>';
6
- ?>
7
- <?php /* translators: On the Views admin screen. */ ?>
8
- <th>
9
- <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
10
- type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
11
- <label for="view-pagination">
12
- <?php _e( 'Pagination', 'strong-testimonials' ); ?>
13
- </label>
14
- </th>
15
- <td>
16
- <div class="row then then_pagination" style="display: none;">
17
- <div class="row-inner">
18
- <div class="inline">
19
- <label for="view-pagination_type">
20
- <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
21
- <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
22
- <?php _e( 'simple', 'strong-testimonials' ); ?>
23
- </option>
24
- <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
25
- <?php _e( 'WordPress standard', 'strong-testimonials' ); ?>
26
- </option>
27
- </select>
28
- </label>
29
- </div>
30
- <div class="inline then fast then_simple then_not_standard" style="display: none;">
31
- <p class="description">
32
- <?php _e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
33
- <?php echo $links; ?>
34
- </p>
35
- </div>
36
- <div class="inline then fast then_not_simple then_standard" style="display: none;">
37
- <p class="description">
38
- <?php _e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
39
- <?php echo $links; ?>
40
- </p>
41
- </div>
42
- </div>
43
- </div>
44
-
45
- <div class="row then then_pagination" style="display: none;">
46
- <div class="row-inner">
47
- <div class="inline">
48
- <label for="view-per_page">
49
- <?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?>
50
- </label>
51
- <input class="input-incremental" id="view-per_page"
52
- name="view[data][pagination_settings][per_page]"
53
- type="number" min="1" step="1"
54
- value="<?php echo $view['pagination_settings']['per_page']; ?>"/>
55
- </div>
56
-
57
- <div class="inline">
58
- <label for="view-nav">
59
- <?php _e( 'Navigation', 'strong-testimonials' ); ?>
60
- </label>
61
- <select id="view-nav" name="view[data][pagination_settings][nav]">
62
- <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
63
- <?php _e( 'before', 'strong-testimonials' ); ?>
64
- </option>
65
- <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
66
- <?php _e( 'after', 'strong-testimonials' ); ?>
67
- </option>
68
- <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
69
- <?php _e( 'before & after', 'strong-testimonials' ); ?>
70
- </option>
71
- </select>
72
- </div>
73
- </div>
74
-
75
- <div class="row then then_not_simple then_standard" style="display: none;">
76
- <div class="row-inner">
77
- <div class="inline">
78
- <label for="view-pagination-show_all">
79
- <select class="if select" id="view-pagination-show_all"
80
- name="view[data][pagination_settings][show_all]">
81
- <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
82
- <?php _e( 'Show all page numbers', 'strong-testimonials' ); ?>
83
- </option>
84
- <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?>
85
- class="trip">
86
- <?php _e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
87
- </option>
88
- </select>
89
- </label>
90
- </div>
91
- <div class="inline then then_show_all" style="display: none;">
92
- <div class="inline">
93
- <label for="view-pagination-end_size">
94
- <?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?>
95
- </label>
96
- <input class="input-incremental" id="view-pagination-end_size"
97
- name="view[data][pagination_settings][end_size]"
98
- type="number" min="1" step="1"
99
- value="<?php echo $view['pagination_settings']['end_size']; ?>"/>
100
- </div>
101
- <div class="inline">
102
- <label for="view-pagination-mid_size">
103
- <?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
104
- </label>
105
- <input class="input-incremental" id="view-pagination-mid_size"
106
- name="view[data][pagination_settings][mid_size]"
107
- type="number" min="1" step="1"
108
- value="<?php echo $view['pagination_settings']['mid_size']; ?>"/>
109
- </div>
110
- </div>
111
- </div>
112
- </div>
113
-
114
- <div class="row then then_not_simple then_standard" style="display: none;">
115
- <div class="row-inner">
116
- <div class="inline inline-middle">
117
- <input class="if toggle checkbox" id="view-pagination-prev_next"
118
- name="view[data][pagination_settings][prev_next]"
119
- type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
120
- <label for="view-pagination-prev_next">
121
- <?php _e( 'Show previous/next links', 'strong-testimonials' ); ?>
122
- </label>
123
- </div>
124
- <div class="then then_prev_next inline inline-middle">
125
- <label for="view-pagination-prev_text">
126
- <?php _e( 'Previous text', 'strong-testimonials' ); ?>
127
- </label>
128
- <input class="code" id="view-pagination-prev_text"
129
- name="view[data][pagination_settings][prev_text]"
130
- type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
131
- </div>
132
- <div class="then then_prev_next inline inline-middle">
133
- <label for="view-pagination-next_text">
134
- <?php _e( 'Next text', 'strong-testimonials' ); ?>
135
- </label>
136
- <input class="code" id="view-pagination-next_text"
137
- name="view[data][pagination_settings][next_text]"
138
- type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
139
- </div>
140
- </div>
141
- </div>
142
-
143
- <div class="row then then_not_simple then_standard" style="display: none;">
144
- <div class="row-inner">
145
- <div class="inline">
146
- <label for="view-pagination-before_page_number">
147
- <?php _e( 'Before page number', 'strong-testimonials' ); ?>
148
- </label>
149
- <input class="small-text" id="view-pagination-before_page_number"
150
- name="view[data][pagination_settings][before_page_number]"
151
- type="text" value="<?php echo $view['pagination_settings']['before_page_number']; ?>">
152
- </div>
153
- <div class="inline">
154
- <label for="view-pagination-after_page_number">
155
- <?php _e( 'After page number', 'strong-testimonials' ); ?>
156
- </label>
157
- <input class="small-text" id="view-pagination-after_page_number"
158
- name="view[data][pagination_settings][after_page_number]"
159
- type="text" value="<?php echo $view['pagination_settings']['after_page_number']; ?>">
160
- </div>
161
- </div>
162
- </div>
163
- </div>
164
-
165
- <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
166
- </td>
1
+ <?php
2
+
3
+ $links = '<span class="help-links">';
4
+ $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help', 'strong-testimonials' ) . '</a>';
5
+ $links .= '</span>';
6
+ ?>
7
+ <?php /* translators: On the Views admin screen. */ ?>
8
+ <th>
9
+ <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
10
+ type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
11
+ <label for="view-pagination">
12
+ <?php _e( 'Pagination', 'strong-testimonials' ); ?>
13
+ </label>
14
+ </th>
15
+ <td>
16
+ <div class="row then then_pagination" style="display: none;">
17
+ <div class="row-inner">
18
+ <div class="inline">
19
+ <label for="view-pagination_type">
20
+ <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
21
+ <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
22
+ <?php _e( 'simple', 'strong-testimonials' ); ?>
23
+ </option>
24
+ <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
25
+ <?php _e( 'WordPress standard', 'strong-testimonials' ); ?>
26
+ </option>
27
+ </select>
28
+ </label>
29
+ </div>
30
+ <div class="inline then fast then_simple then_not_standard" style="display: none;">
31
+ <p class="description">
32
+ <?php _e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
33
+ <?php echo $links; ?>
34
+ </p>
35
+ </div>
36
+ <div class="inline then fast then_not_simple then_standard" style="display: none;">
37
+ <p class="description">
38
+ <?php _e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
39
+ <?php echo $links; ?>
40
+ </p>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="row then then_pagination" style="display: none;">
46
+ <div class="row-inner">
47
+ <div class="inline">
48
+ <label for="view-per_page">
49
+ <?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?>
50
+ </label>
51
+ <input class="input-incremental" id="view-per_page"
52
+ name="view[data][pagination_settings][per_page]"
53
+ type="number" min="1" step="1"
54
+ value="<?php echo $view['pagination_settings']['per_page']; ?>"/>
55
+ </div>
56
+
57
+ <div class="inline">
58
+ <label for="view-nav">
59
+ <?php _e( 'Navigation', 'strong-testimonials' ); ?>
60
+ </label>
61
+ <select id="view-nav" name="view[data][pagination_settings][nav]">
62
+ <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
63
+ <?php _e( 'before', 'strong-testimonials' ); ?>
64
+ </option>
65
+ <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
66
+ <?php _e( 'after', 'strong-testimonials' ); ?>
67
+ </option>
68
+ <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
69
+ <?php _e( 'before & after', 'strong-testimonials' ); ?>
70
+ </option>
71
+ </select>
72
+ </div>
73
+ </div>
74
+
75
+ <div class="row then then_not_simple then_standard" style="display: none;">
76
+ <div class="row-inner">
77
+ <div class="inline">
78
+ <label for="view-pagination-show_all">
79
+ <select class="if select" id="view-pagination-show_all"
80
+ name="view[data][pagination_settings][show_all]">
81
+ <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
82
+ <?php _e( 'Show all page numbers', 'strong-testimonials' ); ?>
83
+ </option>
84
+ <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?>
85
+ class="trip">
86
+ <?php _e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
87
+ </option>
88
+ </select>
89
+ </label>
90
+ </div>
91
+ <div class="inline then then_show_all" style="display: none;">
92
+ <div class="inline">
93
+ <label for="view-pagination-end_size">
94
+ <?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?>
95
+ </label>
96
+ <input class="input-incremental" id="view-pagination-end_size"
97
+ name="view[data][pagination_settings][end_size]"
98
+ type="number" min="1" step="1"
99
+ value="<?php echo $view['pagination_settings']['end_size']; ?>"/>
100
+ </div>
101
+ <div class="inline">
102
+ <label for="view-pagination-mid_size">
103
+ <?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
104
+ </label>
105
+ <input class="input-incremental" id="view-pagination-mid_size"
106
+ name="view[data][pagination_settings][mid_size]"
107
+ type="number" min="1" step="1"
108
+ value="<?php echo $view['pagination_settings']['mid_size']; ?>"/>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <div class="row then then_not_simple then_standard" style="display: none;">
115
+ <div class="row-inner">
116
+ <div class="inline inline-middle">
117
+ <input class="if toggle checkbox" id="view-pagination-prev_next"
118
+ name="view[data][pagination_settings][prev_next]"
119
+ type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
120
+ <label for="view-pagination-prev_next">
121
+ <?php _e( 'Show previous/next links', 'strong-testimonials' ); ?>
122
+ </label>
123
+ </div>
124
+ <div class="then then_prev_next inline inline-middle">
125
+ <label for="view-pagination-prev_text">
126
+ <?php _e( 'Previous text', 'strong-testimonials' ); ?>
127
+ </label>
128
+ <input class="code" id="view-pagination-prev_text"
129
+ name="view[data][pagination_settings][prev_text]"
130
+ type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
131
+ </div>
132
+ <div class="then then_prev_next inline inline-middle">
133
+ <label for="view-pagination-next_text">
134
+ <?php _e( 'Next text', 'strong-testimonials' ); ?>
135
+ </label>
136
+ <input class="code" id="view-pagination-next_text"
137
+ name="view[data][pagination_settings][next_text]"
138
+ type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <div class="row then then_not_simple then_standard" style="display: none;">
144
+ <div class="row-inner">
145
+ <div class="inline">
146
+ <label for="view-pagination-before_page_number">
147
+ <?php _e( 'Before page number', 'strong-testimonials' ); ?>
148
+ </label>
149
+ <input class="small-text" id="view-pagination-before_page_number"
150
+ name="view[data][pagination_settings][before_page_number]"
151
+ type="text" value="<?php echo $view['pagination_settings']['before_page_number']; ?>">
152
+ </div>
153
+ <div class="inline">
154
+ <label for="view-pagination-after_page_number">
155
+ <?php _e( 'After page number', 'strong-testimonials' ); ?>
156
+ </label>
157
+ <input class="small-text" id="view-pagination-after_page_number"
158
+ name="view[data][pagination_settings][after_page_number]"
159
+ type="text" value="<?php echo $view['pagination_settings']['after_page_number']; ?>">
160
+ </div>
161
+ </div>
162
+ </div>
163
+ </div>
164
+
165
+ <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
166
+ </td>
admin/partials/views/option-read-more-page.php CHANGED
@@ -1,88 +1,88 @@
1
- <?php
2
- /* translators: On the Views admin screen. */
3
- ?>
4
- <!-- Read more > page -->
5
- <th>
6
- <div class="checkbox">
7
- <input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"
8
- <?php checked( isset( $view['more_page'] ) && $view['more_page'] );?> class="checkbox">
9
- <label for="view-more_page">
10
- <?php _e( '"Read more" link to a page or post', 'strong-testimonials' ); ?>
11
- </label>
12
- </div>
13
- </th>
14
- <td>
15
- <div class="row then then_more_page" style="display: none;">
16
-
17
- <!-- Select page -->
18
- <div class="row then then_more_page" style="display: none;">
19
- <div class="row-inner">
20
- <label>
21
- <select id="view-page" name="view[data][more_page_id]">
22
-
23
- <option value=""><?php _e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
24
- <?php
25
- do_action( 'wpmtst_readmore_page_list', $view );
26
- if ( $custom_list ) {
27
- ?>
28
- <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
29
- <?php
30
- foreach ( $custom_list as $page ) {
31
- echo wp_kses_post( $page );
32
- }
33
- ?>
34
- </optgroup>
35
- <?php
36
- }
37
- ?>
38
- <optgroup label="<?php esc_attr_e( 'Pages', 'strong-testimonials' ); ?>">
39
- <?php foreach ( $pages_list as $pages ) : ?>
40
- <option value="<?php echo $pages->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $pages->ID ); ?>><?php echo $pages->post_title; ?></option>
41
- <?php endforeach; ?>
42
- </optgroup>
43
- <optgroup label="<?php esc_attr_e( 'Posts', 'strong-testimonials' ); ?>">
44
- <?php foreach ( $posts_list as $posts ) : ?>
45
- <option value="<?php echo $posts->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $posts->ID ); ?>><?php echo $posts->post_title; ?></option>
46
- <?php endforeach; ?>
47
- </optgroup>
48
- </select>
49
- </label>
50
- <label for="view-page_id2">
51
- <?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
52
- </label>
53
- <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
54
- </div>
55
- </div>
56
-
57
- <!-- Link text -->
58
- <div class="row">
59
- <div class="row-inner">
60
- <div class="inline">
61
- <label for="view-more_page_text">
62
- <?php _e( 'with link text', 'strong-testimonials' ); ?>
63
- </label>
64
- <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
65
- value="<?php echo $view['more_page_text']; ?>" size="50">
66
- </div>
67
- </div>
68
- </div>
69
-
70
- <!-- location -->
71
- <div class="row">
72
- <div class="row-inner">
73
- <label>
74
- <select id="view-more_page_hook" name="view[data][more_page_hook]">
75
- <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
76
- <?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
77
- </option>
78
- <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
79
- <?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
80
- </option>
81
- </select>
82
- </label>
83
- </div>
84
- </div>
85
-
86
- </div>
87
-
88
- </td>
1
+ <?php
2
+ /* translators: On the Views admin screen. */
3
+ ?>
4
+ <!-- Read more > page -->
5
+ <th>
6
+ <div class="checkbox">
7
+ <input type="checkbox" id="view-more_page" class="if toggle" name="view[data][more_page]" value="1"
8
+ <?php checked( isset( $view['more_page'] ) && $view['more_page'] );?> class="checkbox">
9
+ <label for="view-more_page">
10
+ <?php _e( '"Read more" link to a page or post', 'strong-testimonials' ); ?>
11
+ </label>
12
+ </div>
13
+ </th>
14
+ <td>
15
+ <div class="row then then_more_page" style="display: none;">
16
+
17
+ <!-- Select page -->
18
+ <div class="row then then_more_page" style="display: none;">
19
+ <div class="row-inner">
20
+ <label>
21
+ <select id="view-page" name="view[data][more_page_id]">
22
+
23
+ <option value=""><?php _e( '&mdash; select &mdash;', 'strong-testimonials' ); ?></option>
24
+ <?php
25
+ do_action( 'wpmtst_readmore_page_list', $view );
26
+ if ( $custom_list ) {
27
+ ?>
28
+ <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
29
+ <?php
30
+ foreach ( $custom_list as $page ) {
31
+ echo wp_kses_post( $page );
32
+ }
33
+ ?>
34
+ </optgroup>
35
+ <?php
36
+ }
37
+ ?>
38
+ <optgroup label="<?php esc_attr_e( 'Pages', 'strong-testimonials' ); ?>">
39
+ <?php foreach ( $pages_list as $pages ) : ?>
40
+ <option value="<?php echo $pages->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $pages->ID ); ?>><?php echo $pages->post_title; ?></option>
41
+ <?php endforeach; ?>
42
+ </optgroup>
43
+ <optgroup label="<?php esc_attr_e( 'Posts', 'strong-testimonials' ); ?>">
44
+ <?php foreach ( $posts_list as $posts ) : ?>
45
+ <option value="<?php echo $posts->ID; ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $posts->ID ); ?>><?php echo $posts->post_title; ?></option>
46
+ <?php endforeach; ?>
47
+ </optgroup>
48
+ </select>
49
+ </label>
50
+ <label for="view-page_id2">
51
+ <?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
52
+ </label>
53
+ <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
54
+ </div>
55
+ </div>
56
+
57
+ <!-- Link text -->
58
+ <div class="row">
59
+ <div class="row-inner">
60
+ <div class="inline">
61
+ <label for="view-more_page_text">
62
+ <?php _e( 'with link text', 'strong-testimonials' ); ?>
63
+ </label>
64
+ <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
65
+ value="<?php echo $view['more_page_text']; ?>" size="50">
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <!-- location -->
71
+ <div class="row">
72
+ <div class="row-inner">
73
+ <label>
74
+ <select id="view-more_page_hook" name="view[data][more_page_hook]">
75
+ <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
76
+ <?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
77
+ </option>
78
+ <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
79
+ <?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
80
+ </option>
81
+ </select>
82
+ </label>
83
+ </div>
84
+ </div>
85
+
86
+ </div>
87
+
88
+ </td>
admin/partials/views/option-select.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <label for="view-single_or_multiple"><?php _ex( 'Select', 'verb', 'strong-testimonials' ); ?></label>
4
- </th>
5
- <td>
6
-
7
- <div class="row">
8
- <div class="row-inner">
9
- <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
10
- <option value="multiple" <?php echo (int) $view['id'] == 0 ? 'selected' : ''; ?>><?php _e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
11
- <option value="single" <?php echo (int) $view['id'] >= 1 ? 'selected' : ''; ?>><?php _e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
12
- </select>
13
- </div>
14
- </div>
15
-
16
- <div class="row">
17
- <?php include( 'option-id.php' ); ?>
18
- </div>
19
-
20
- </td>
21
- <td class="divider">
22
- <p><?php echo wp_kses_post( '<code>post_ids</code>' ); ?></p>
23
- </td>
24
- <td>
25
- <p><?php _e( 'a comma-separated list of post ID\'s' , 'strong-testimonials' ); ?></p>
26
- </td>
27
- <td>
28
- <p><?php echo wp_kses_post( '<code>post_ids="123,456"</code>' ); ?></p>
29
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-single_or_multiple"><?php _ex( 'Select', 'verb', 'strong-testimonials' ); ?></label>
4
+ </th>
5
+ <td>
6
+
7
+ <div class="row">
8
+ <div class="row-inner">
9
+ <select id="view-single_or_multiple" class="if selectper" name="view[data][select]">
10
+ <option value="multiple" <?php echo (int) $view['id'] == 0 ? 'selected' : ''; ?>><?php _e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
11
+ <option value="single" <?php echo (int) $view['id'] >= 1 ? 'selected' : ''; ?>><?php _e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
12
+ </select>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <?php include( 'option-id.php' ); ?>
18
+ </div>
19
+
20
+ </td>
21
+ <td class="divider">
22
+ <p><?php echo wp_kses_post( '<code>post_ids</code>' ); ?></p>
23
+ </td>
24
+ <td>
25
+ <p><?php _e( 'a comma-separated list of post ID\'s' , 'strong-testimonials' ); ?></p>
26
+ </td>
27
+ <td>
28
+ <p><?php echo wp_kses_post( '<code>post_ids="123,456"</code>' ); ?></p>
29
+ </td>
admin/partials/views/option-slideshow-behavior.php CHANGED
@@ -1,93 +1,93 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <th>
3
- <?php _e( 'Behavior', 'strong-testimonials' ); ?>
4
- </th>
5
- <td>
6
-
7
- <div class="row">
8
- <div class="inline inline-middle">
9
- <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]" value="0"
10
- <?php checked( $view['slideshow_settings']['auto_start'] ); ?> class="checkbox">
11
- <label for="view-auto_start">
12
- <?php _ex( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?>
13
- </label>
14
- </div>
15
- </div>
16
-
17
- <div class="row">
18
- <div class="inline inline-middle">
19
- <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]" value="0"
20
- <?php checked( $view['slideshow_settings']['auto_hover'] ); ?> class="checkbox">
21
- <label for="view-auto_hover">
22
- <?php _ex( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?>
23
- </label>
24
- </div>
25
- </div>
26
-
27
- <div class="row">
28
- <div class="inline inline-middle">
29
- <input type="checkbox" id="view-stop_auto_on_click"
30
- name="view[data][slideshow_settings][stop_auto_on_click]" value="0"
31
- <?php checked( $view['slideshow_settings']['stop_auto_on_click'] ); ?> class="checkbox">
32
- <label for="view-stop_auto_on_click">
33
- <?php _ex( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?>
34
- </label>
35
- </div>
36
- <div class="inline inline-middle">
37
- <p class="description"><?php _e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
38
- </div>
39
- </div>
40
-
41
- <?php
42
- if ( $view['slideshow_settings']['adapt_height'] ) {
43
- $height = 'dynamic';
44
- } else {
45
- $height = 'static';
46
- }
47
- ?>
48
- <div class="row">
49
- <div class="row-inner">
50
-
51
- <div class="inline">
52
- <label for="view-slideshow_height">
53
- <select id="view-slideshow_height" name="view[data][slideshow_settings][height]" class="if selectgroup">
54
- <?php foreach ( $view_options['slideshow_height'] as $key => $type ) : ?>
55
- <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
- <?php selected( $height, $key ); ?>>
57
- <?php echo $type; ?>
58
- </option>
59
- <?php endforeach; ?>
60
- </select>
61
- </label>
62
- </div>
63
-
64
- <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
65
- <label for="view-adapt_height_speed">
66
- <?php _e( 'Duration', 'strong-testimonials' ); ?>
67
- </label>
68
- <input type="number" id="view-adapt_height_speed" class="input-incremental"
69
- name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
70
- value="<?php echo $view['slideshow_settings']['adapt_height_speed']; ?>" size="3"/>
71
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
72
- </div>
73
-
74
- <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
75
- <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]" value="1"
76
- <?php checked( $view['slideshow_settings']['stretch'] ); ?> class="checkbox">
77
- <label for="view-stretch">
78
- <?php _e( 'Stretch slides vertically', 'strong-testimonials' ); ?>
79
- </label>
80
-
81
- <div class="inline description">
82
- <a href="#tab-panel-wpmtst-help-stretch" class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
83
- </div>
84
- </div>
85
-
86
- </div>
87
- </div>
88
-
89
- <div class="row tall">
90
- <p class="description"><?php _e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
91
- </div>
92
-
93
- </td>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <th>
3
+ <?php _e( 'Behavior', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td>
6
+
7
+ <div class="row">
8
+ <div class="inline inline-middle">
9
+ <input type="checkbox" id="view-auto_start" name="view[data][slideshow_settings][auto_start]" value="0"
10
+ <?php checked( $view['slideshow_settings']['auto_start'] ); ?> class="checkbox">
11
+ <label for="view-auto_start">
12
+ <?php _ex( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?>
13
+ </label>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="row">
18
+ <div class="inline inline-middle">
19
+ <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]" value="0"
20
+ <?php checked( $view['slideshow_settings']['auto_hover'] ); ?> class="checkbox">
21
+ <label for="view-auto_hover">
22
+ <?php _ex( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?>
23
+ </label>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="row">
28
+ <div class="inline inline-middle">
29
+ <input type="checkbox" id="view-stop_auto_on_click"
30
+ name="view[data][slideshow_settings][stop_auto_on_click]" value="0"
31
+ <?php checked( $view['slideshow_settings']['stop_auto_on_click'] ); ?> class="checkbox">
32
+ <label for="view-stop_auto_on_click">
33
+ <?php _ex( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?>
34
+ </label>
35
+ </div>
36
+ <div class="inline inline-middle">
37
+ <p class="description"><?php _e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
38
+ </div>
39
+ </div>
40
+
41
+ <?php
42
+ if ( $view['slideshow_settings']['adapt_height'] ) {
43
+ $height = 'dynamic';
44
+ } else {
45
+ $height = 'static';
46
+ }
47
+ ?>
48
+ <div class="row">
49
+ <div class="row-inner">
50
+
51
+ <div class="inline">
52
+ <label for="view-slideshow_height">
53
+ <select id="view-slideshow_height" name="view[data][slideshow_settings][height]" class="if selectgroup">
54
+ <?php foreach ( $view_options['slideshow_height'] as $key => $type ) : ?>
55
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
+ <?php selected( $height, $key ); ?>>
57
+ <?php echo $type; ?>
58
+ </option>
59
+ <?php endforeach; ?>
60
+ </select>
61
+ </label>
62
+ </div>
63
+
64
+ <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
65
+ <label for="view-adapt_height_speed">
66
+ <?php _e( 'Duration', 'strong-testimonials' ); ?>
67
+ </label>
68
+ <input type="number" id="view-adapt_height_speed" class="input-incremental"
69
+ name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1"
70
+ value="<?php echo $view['slideshow_settings']['adapt_height_speed']; ?>" size="3"/>
71
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
72
+ </div>
73
+
74
+ <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
75
+ <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]" value="1"
76
+ <?php checked( $view['slideshow_settings']['stretch'] ); ?> class="checkbox">
77
+ <label for="view-stretch">
78
+ <?php _e( 'Stretch slides vertically', 'strong-testimonials' ); ?>
79
+ </label>
80
+
81
+ <div class="inline description">
82
+ <a href="#tab-panel-wpmtst-help-stretch" class="open-help-tab"><?php esc_html_e( 'Help', 'strong-testimonials' ); ?></a>
83
+ </div>
84
+ </div>
85
+
86
+ </div>
87
+ </div>
88
+
89
+ <div class="row tall">
90
+ <p class="description"><?php _e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
91
+ </div>
92
+
93
+ </td>
admin/partials/views/option-slideshow-breakpoints.php CHANGED
@@ -1,95 +1,95 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
3
- <div class="row">
4
-
5
- <div class="inner-table is-below">
6
- <div class="inner-table-row bordered header">
7
- <div class="inner-table-cell">
8
- <?php _e( 'minimum screen width', 'strong-testimonials' ); ?>
9
- </div>
10
- <div class="inner-table-cell">
11
- <?php _e( 'show', 'strong-testimonials' ); ?>
12
- </div>
13
- <div class="inner-table-cell">
14
- <?php _e( 'margin', 'strong-testimonials' ); ?>
15
- </div>
16
- <div class="inner-table-cell">
17
- <?php _e( 'move', 'strong-testimonials' ); ?>
18
- </div>
19
- </div>
20
-
21
- <?php foreach ( $view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
22
- <div class="inner-table-row bordered">
23
-
24
- <div class="inner-table-cell">
25
- <label>
26
- <input id="view-breakpoint_<?php echo $key; ?>"
27
- name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][width]"
28
- value="<?php echo $breakpoint['width']; ?>"
29
- type="number"
30
- class="input-incremental"> px
31
- </label>
32
- </div>
33
-
34
- <div class="inner-table-cell">
35
- <label>
36
- <select id="view-max_slides_<?php echo $key; ?>"
37
- name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][max_slides]"
38
- class="if selectgroup">
39
- <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1</option>
40
- <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2</option>
41
- <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3</option>
42
- <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4</option>
43
- </select>
44
- </label>
45
- <div class="option-desc singular" style="display: none;">
46
- <?php _e( 'slide', 'strong-testimonials' ); ?>
47
- </div>
48
- <div class="option-desc plural" style="display: none;">
49
- <?php _e( 'slides', 'strong-testimonials' ); ?>
50
- </div>
51
- </div>
52
-
53
- <div class="inner-table-cell">
54
- <input id="view-margin_<?php echo $key; ?>"
55
- name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][margin]"
56
- value="<?php echo $breakpoint['margin']; ?>"
57
- type="number" min="1" step="1" size="3"
58
- class="input-incremental"/> px
59
- </div>
60
-
61
- <div class="inner-table-cell">
62
- <label>
63
- <select id="view-move_slides_<?php echo $key; ?>"
64
- name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][move_slides]"
65
- class="if selectgroup">
66
- <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1</option>
67
- <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2</option>
68
- <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3</option>
69
- <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4</option>
70
- </select>
71
- </label>
72
- <div class="option-desc singular" style="display: none;">
73
- <?php _e( 'slide', 'strong-testimonials' ); ?>
74
- </div>
75
- <div class="option-desc plural" style="display: none;">
76
- <?php _e( 'slides', 'strong-testimonials' ); ?>
77
- </div>
78
- </div>
79
-
80
- </div>
81
-
82
- <?php endforeach; ?>
83
- </div>
84
-
85
- </div>
86
-
87
- <div class="is-below">
88
- <input id="restore-default-breakpoints"
89
- type="button"
90
- name="restore-default-breakpoints"
91
- value="<?php _e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
92
- class="button-secondary" />
93
- <span id="restored-message"><?php _e( 'defaults restored', 'strong-testimonials' ); ?></span>
94
- </div>
95
- </div>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <div class="inline then then_slider_type then_not_show_single then_show_multiple" style="display: none;">
3
+ <div class="row">
4
+
5
+ <div class="inner-table is-below">
6
+ <div class="inner-table-row bordered header">
7
+ <div class="inner-table-cell">
8
+ <?php _e( 'minimum screen width', 'strong-testimonials' ); ?>
9
+ </div>
10
+ <div class="inner-table-cell">
11
+ <?php _e( 'show', 'strong-testimonials' ); ?>
12
+ </div>
13
+ <div class="inner-table-cell">
14
+ <?php _e( 'margin', 'strong-testimonials' ); ?>
15
+ </div>
16
+ <div class="inner-table-cell">
17
+ <?php _e( 'move', 'strong-testimonials' ); ?>
18
+ </div>
19
+ </div>
20
+
21
+ <?php foreach ( $view['slideshow_settings']['breakpoints'] as $key => $breakpoint ) : ?>
22
+ <div class="inner-table-row bordered">
23
+
24
+ <div class="inner-table-cell">
25
+ <label>
26
+ <input id="view-breakpoint_<?php echo $key; ?>"
27
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][width]"
28
+ value="<?php echo $breakpoint['width']; ?>"
29
+ type="number"
30
+ class="input-incremental"> px
31
+ </label>
32
+ </div>
33
+
34
+ <div class="inner-table-cell">
35
+ <label>
36
+ <select id="view-max_slides_<?php echo $key; ?>"
37
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][max_slides]"
38
+ class="if selectgroup">
39
+ <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1</option>
40
+ <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2</option>
41
+ <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3</option>
42
+ <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4</option>
43
+ </select>
44
+ </label>
45
+ <div class="option-desc singular" style="display: none;">
46
+ <?php _e( 'slide', 'strong-testimonials' ); ?>
47
+ </div>
48
+ <div class="option-desc plural" style="display: none;">
49
+ <?php _e( 'slides', 'strong-testimonials' ); ?>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="inner-table-cell">
54
+ <input id="view-margin_<?php echo $key; ?>"
55
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][margin]"
56
+ value="<?php echo $breakpoint['margin']; ?>"
57
+ type="number" min="1" step="1" size="3"
58
+ class="input-incremental"/> px
59
+ </div>
60
+
61
+ <div class="inner-table-cell">
62
+ <label>
63
+ <select id="view-move_slides_<?php echo $key; ?>"
64
+ name="view[data][slideshow_settings][breakpoints][<?php echo $key; ?>][move_slides]"
65
+ class="if selectgroup">
66
+ <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1</option>
67
+ <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2</option>
68
+ <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3</option>
69
+ <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4</option>
70
+ </select>
71
+ </label>
72
+ <div class="option-desc singular" style="display: none;">
73
+ <?php _e( 'slide', 'strong-testimonials' ); ?>
74
+ </div>
75
+ <div class="option-desc plural" style="display: none;">
76
+ <?php _e( 'slides', 'strong-testimonials' ); ?>
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+
82
+ <?php endforeach; ?>
83
+ </div>
84
+
85
+ </div>
86
+
87
+ <div class="is-below">
88
+ <input id="restore-default-breakpoints"
89
+ type="button"
90
+ name="restore-default-breakpoints"
91
+ value="<?php _e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>"
92
+ class="button-secondary" />
93
+ <span id="restored-message"><?php _e( 'defaults restored', 'strong-testimonials' ); ?></span>
94
+ </div>
95
+ </div>
admin/partials/views/option-slideshow-navigation.php CHANGED
@@ -1,104 +1,104 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <th>
3
- <label for="view-slideshow_nav">
4
- <?php _e( 'Navigation', 'strong-testimonials' ); ?>
5
- </label>
6
- </th>
7
- <td>
8
-
9
- <?php /* ----- CONTROLS ----- */ ?>
10
- <div class="row">
11
- <div class="row-inner">
12
-
13
- <?php /* ----- TYPE ----- */ ?>
14
- <div class="inline">
15
- <label for="view-slideshow_controls_type"><?php _e( 'Controls', 'strong-testimonials' ); ?></label>
16
- <select id="view-slideshow_controls_type"
17
- name="view[data][slideshow_settings][controls_type]"
18
- class="if selectnot">
19
- <?php foreach ( $view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
20
- <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
21
- <?php selected( $view['slideshow_settings']['controls_type'], $key ); ?>
22
- <?php if ( 'none' == $key ) {
23
- echo ' class="trip"';
24
- } ?>>
25
- <?php echo $type['label']; ?>
26
- </option>
27
- <?php endforeach; ?>
28
- </select>
29
- </div>
30
-
31
- <?php /* ----- STYLE ----- */ ?>
32
- <div class="inline then then_slideshow_controls_type" style="display: none;">
33
- <label for="view-slideshow_controls_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
34
- <select id="view-slideshow_controls_style" name="view[data][slideshow_settings][controls_style]">
35
- <?php foreach ( $view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
36
- <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['controls_style'], $key ); ?>><?php echo $style['label']; ?></option>
37
- <?php endforeach; ?>
38
- </select>
39
- </div>
40
-
41
- </div>
42
- </div>
43
-
44
- <?php /* ----- PAGER ----- */ ?>
45
- <div class="row">
46
- <div class="row-inner then then_has-pager">
47
-
48
- <?php /* ----- TYPE ----- */ ?>
49
- <div class="inline">
50
- <label for="view-slideshow_pager_type"><?php _e( 'Pagination', 'strong-testimonials' ); ?></label>
51
- <select id="view-slideshow_pager_type"
52
- name="view[data][slideshow_settings][pager_type]"
53
- class="if selectnot">
54
- <?php foreach ( $view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
55
- <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
- <?php selected( $view['slideshow_settings']['pager_type'], $key ); ?>
57
- <?php if ( 'none' == $key ) {
58
- echo ' class="trip"';
59
- } ?>>
60
- <?php echo $type['label']; ?>
61
- </option>
62
- <?php endforeach; ?>
63
- </select>
64
- </div>
65
-
66
- <?php /* ----- STYLE ----- */ ?>
67
- <div class="inline then then_slideshow_pager_type" style="display: none;">
68
- <label for="view-slideshow_pager_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
69
- <select id="view-slideshow_pager_style"
70
- name="view[data][slideshow_settings][pager_style]"
71
- class="if selectnot">
72
- <?php foreach ( $view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
73
- <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['pager_style'], $key ); ?>><?php echo $style['label']; ?></option>
74
- <?php endforeach; ?>
75
- </select>
76
- </div>
77
-
78
- </div>
79
- </div>
80
-
81
- <?php /* ----- POSITION ----- */ ?>
82
- <div class="row">
83
- <div class="row-inner">
84
-
85
- <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
86
- <div class="inline then then_has-position" style="display: none;">
87
- <label for="view-slideshow_nav_position"><?php _e( 'Position', 'strong-testimonials' ); ?></label>
88
-
89
- <select id="view-slideshow_nav_position" name="view[data][slideshow_settings][nav_position]">
90
- <?php foreach ( $view_options['slideshow_nav_position'] as $key => $label ) : ?>
91
- <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['nav_position'], $key ); ?>><?php echo $label; ?></option>
92
- <?php endforeach; ?>
93
- </select>
94
-
95
- <?php //_e( 'outside', 'strong-testimonials' ); ?>
96
-
97
- <?php _e( 'the testimonial frame', 'strong-testimonials' ); ?>
98
- </div>
99
- </div>
100
-
101
- </div>
102
- </div>
103
-
104
- </td>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <th>
3
+ <label for="view-slideshow_nav">
4
+ <?php _e( 'Navigation', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td>
8
+
9
+ <?php /* ----- CONTROLS ----- */ ?>
10
+ <div class="row">
11
+ <div class="row-inner">
12
+
13
+ <?php /* ----- TYPE ----- */ ?>
14
+ <div class="inline">
15
+ <label for="view-slideshow_controls_type"><?php _e( 'Controls', 'strong-testimonials' ); ?></label>
16
+ <select id="view-slideshow_controls_type"
17
+ name="view[data][slideshow_settings][controls_type]"
18
+ class="if selectnot">
19
+ <?php foreach ( $view_options['slideshow_nav_method']['controls'] as $key => $type ) : ?>
20
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
21
+ <?php selected( $view['slideshow_settings']['controls_type'], $key ); ?>
22
+ <?php if ( 'none' == $key ) {
23
+ echo ' class="trip"';
24
+ } ?>>
25
+ <?php echo $type['label']; ?>
26
+ </option>
27
+ <?php endforeach; ?>
28
+ </select>
29
+ </div>
30
+
31
+ <?php /* ----- STYLE ----- */ ?>
32
+ <div class="inline then then_slideshow_controls_type" style="display: none;">
33
+ <label for="view-slideshow_controls_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
34
+ <select id="view-slideshow_controls_style" name="view[data][slideshow_settings][controls_style]">
35
+ <?php foreach ( $view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
36
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['controls_style'], $key ); ?>><?php echo $style['label']; ?></option>
37
+ <?php endforeach; ?>
38
+ </select>
39
+ </div>
40
+
41
+ </div>
42
+ </div>
43
+
44
+ <?php /* ----- PAGER ----- */ ?>
45
+ <div class="row">
46
+ <div class="row-inner then then_has-pager">
47
+
48
+ <?php /* ----- TYPE ----- */ ?>
49
+ <div class="inline">
50
+ <label for="view-slideshow_pager_type"><?php _e( 'Pagination', 'strong-testimonials' ); ?></label>
51
+ <select id="view-slideshow_pager_type"
52
+ name="view[data][slideshow_settings][pager_type]"
53
+ class="if selectnot">
54
+ <?php foreach ( $view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
55
+ <option value="<?php echo $key; ?>" id="<?php echo $key; ?>"
56
+ <?php selected( $view['slideshow_settings']['pager_type'], $key ); ?>
57
+ <?php if ( 'none' == $key ) {
58
+ echo ' class="trip"';
59
+ } ?>>
60
+ <?php echo $type['label']; ?>
61
+ </option>
62
+ <?php endforeach; ?>
63
+ </select>
64
+ </div>
65
+
66
+ <?php /* ----- STYLE ----- */ ?>
67
+ <div class="inline then then_slideshow_pager_type" style="display: none;">
68
+ <label for="view-slideshow_pager_style"><?php _e( 'Style', 'strong-testimonials' ); ?></label>
69
+ <select id="view-slideshow_pager_style"
70
+ name="view[data][slideshow_settings][pager_style]"
71
+ class="if selectnot">
72
+ <?php foreach ( $view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
73
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['pager_style'], $key ); ?>><?php echo $style['label']; ?></option>
74
+ <?php endforeach; ?>
75
+ </select>
76
+ </div>
77
+
78
+ </div>
79
+ </div>
80
+
81
+ <?php /* ----- POSITION ----- */ ?>
82
+ <div class="row">
83
+ <div class="row-inner">
84
+
85
+ <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
86
+ <div class="inline then then_has-position" style="display: none;">
87
+ <label for="view-slideshow_nav_position"><?php _e( 'Position', 'strong-testimonials' ); ?></label>
88
+
89
+ <select id="view-slideshow_nav_position" name="view[data][slideshow_settings][nav_position]">
90
+ <?php foreach ( $view_options['slideshow_nav_position'] as $key => $label ) : ?>
91
+ <option value="<?php echo $key; ?>" <?php selected( $view['slideshow_settings']['nav_position'], $key ); ?>><?php echo $label; ?></option>
92
+ <?php endforeach; ?>
93
+ </select>
94
+
95
+ <?php //_e( 'outside', 'strong-testimonials' ); ?>
96
+
97
+ <?php _e( 'the testimonial frame', 'strong-testimonials' ); ?>
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+ </div>
103
+
104
+ </td>
admin/partials/views/option-slideshow-num.php CHANGED
@@ -1,8 +1,8 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <th>
3
- <?php _e( 'Show', 'strong-testimonials' ); ?>
4
- </th>
5
- <td>
6
- <?php include( 'option-slideshow-type.php' ); ?>
7
- <?php include( 'option-slideshow-breakpoints.php' ); ?>
8
- </td>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <th>
3
+ <?php _e( 'Show', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td>
6
+ <?php include( 'option-slideshow-type.php' ); ?>
7
+ <?php include( 'option-slideshow-breakpoints.php' ); ?>
8
+ </td>
admin/partials/views/option-slideshow-transition.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <th>
3
- <?php _e( 'Transition', 'strong-testimonials' ); ?>
4
- </th>
5
- <td>
6
- <div class="row">
7
-
8
- <div class="inline inline-middle">
9
- <label for="view-pause">
10
- <?php _ex( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?>
11
- </label>
12
- <input type="number" id="view-pause" class="input-incremental"
13
- name="view[data][slideshow_settings][pause]" min=".1" step=".1"
14
- value="<?php echo $view['slideshow_settings']['pause']; ?>" size="3"/>
15
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
16
- </div>
17
-
18
- <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast" style="display: none;">
19
- <label for="view-effect">
20
- <?php _e( 'then', 'strong-testimonials' ); ?>
21
- </label>
22
- <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
23
- <?php foreach ( $view_options['slideshow_effect'] as $key => $label ) : ?>
24
- <option value="<?php echo $key; ?>"
25
- <?php selected( $view['slideshow_settings']['effect'], $key ); ?>
26
- <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo $label; ?></option>
27
- <?php endforeach; ?>
28
- </select>
29
- </div>
30
-
31
- <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast" style="display: none;">
32
- <?php _e( 'then', 'strong-testimonials' ); ?> <?php _ex( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
33
- </div>
34
-
35
- <div class="inline inline-middle then then_effect then_none">
36
- <label for="view-speed">
37
- <?php _e( 'for', 'strong-testimonials' ); ?>
38
- </label>
39
- <input type="number" id="view-speed" class="input-incremental"
40
- name="view[data][slideshow_settings][speed]" min=".1" step=".1"
41
- value="<?php echo $view['slideshow_settings']['speed']; ?>" size="3"/>
42
- <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
43
- </div>
44
-
45
- </div>
46
- </td>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <th>
3
+ <?php _e( 'Transition', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td>
6
+ <div class="row">
7
+
8
+ <div class="inline inline-middle">
9
+ <label for="view-pause">
10
+ <?php _ex( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?>
11
+ </label>
12
+ <input type="number" id="view-pause" class="input-incremental"
13
+ name="view[data][slideshow_settings][pause]" min=".1" step=".1"
14
+ value="<?php echo $view['slideshow_settings']['pause']; ?>" size="3"/>
15
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
16
+ </div>
17
+
18
+ <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast" style="display: none;">
19
+ <label for="view-effect">
20
+ <?php _e( 'then', 'strong-testimonials' ); ?>
21
+ </label>
22
+ <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
23
+ <?php foreach ( $view_options['slideshow_effect'] as $key => $label ) : ?>
24
+ <option value="<?php echo $key; ?>"
25
+ <?php selected( $view['slideshow_settings']['effect'], $key ); ?>
26
+ <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo $label; ?></option>
27
+ <?php endforeach; ?>
28
+ </select>
29
+ </div>
30
+
31
+ <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast" style="display: none;">
32
+ <?php _e( 'then', 'strong-testimonials' ); ?> <?php _ex( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
33
+ </div>
34
+
35
+ <div class="inline inline-middle then then_effect then_none">
36
+ <label for="view-speed">
37
+ <?php _e( 'for', 'strong-testimonials' ); ?>
38
+ </label>
39
+ <input type="number" id="view-speed" class="input-incremental"
40
+ name="view[data][slideshow_settings][speed]" min=".1" step=".1"
41
+ value="<?php echo $view['slideshow_settings']['speed']; ?>" size="3"/>
42
+ <?php _ex( 'seconds', 'time setting', 'strong-testimonials' ); ?>
43
+ </div>
44
+
45
+ </div>
46
+ </td>
admin/partials/views/option-slideshow-type.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php /* translators: In the view editor. */ ?>
2
- <div class="row">
3
-
4
- <div class="inline inline-middle">
5
- <label>
6
- <select id="view-slider_type" name="view[data][slideshow_settings][type]" class="if selectgroup">
7
- <option value="show_single" <?php selected( $view['slideshow_settings']['type'], 'show_single' ); ?>><?php _e( 'single', 'strong-testimonials' ); ?></option>
8
- <option value="show_multiple" <?php selected( $view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php _e( 'multiple', 'strong-testimonials' ); ?></option>
9
- </select>
10
- </label>
11
- <div class="option-desc singular" style="display: none;">
12
- <?php _e( 'slide at a time', 'strong-testimonials' ); ?>
13
- </div>
14
- <div class="option-desc plural" style="display: none;">
15
- <?php _e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
16
- </div>
17
- </div>
18
-
19
- </div>
1
+ <?php /* translators: In the view editor. */ ?>
2
+ <div class="row">
3
+
4
+ <div class="inline inline-middle">
5
+ <label>
6
+ <select id="view-slider_type" name="view[data][slideshow_settings][type]" class="if selectgroup">
7
+ <option value="show_single" <?php selected( $view['slideshow_settings']['type'], 'show_single' ); ?>><?php _e( 'single', 'strong-testimonials' ); ?></option>
8
+ <option value="show_multiple" <?php selected( $view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php _e( 'multiple', 'strong-testimonials' ); ?></option>
9
+ </select>
10
+ </label>
11
+ <div class="option-desc singular" style="display: none;">
12
+ <?php _e( 'slide at a time', 'strong-testimonials' ); ?>
13
+ </div>
14
+ <div class="option-desc plural" style="display: none;">
15
+ <?php _e( 'slides at a time with these responsive breakpoints:', 'strong-testimonials' ); ?>
16
+ </div>
17
+ </div>
18
+
19
+ </div>
admin/partials/views/option-template-list.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <?php _e( 'Template', 'strong-testimonials' ); ?>
4
- </th>
5
- <td colspan="2">
6
- <div id="view-template-list">
7
- <div class="radio-buttons">
8
-
9
- <?php include 'template-not-found.php'; ?>
10
-
11
- <ul class="radio-list template-list">
12
- <?php foreach ( $templates[ $current_type ] as $key => $template ) : ?>
13
- <li>
14
- <?php include 'template-input.php'; ?>
15
- <?php include 'template-options.php'; ?>
16
- </li>
17
- <?php endforeach; ?>
18
- </ul>
19
-
20
- </div>
21
-
22
-
23
-
24
- </div>
25
-
26
- <?php do_action('wpmtst_views_after_template_list' ); ?>
27
-
28
  </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <?php _e( 'Template', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td colspan="2">
6
+ <div id="view-template-list">
7
+ <div class="radio-buttons">
8
+
9
+ <?php include 'template-not-found.php'; ?>
10
+
11
+ <ul class="radio-list template-list">
12
+ <?php foreach ( $templates[ $current_type ] as $key => $template ) : ?>
13
+ <li>
14
+ <?php include 'template-input.php'; ?>
15
+ <?php include 'template-options.php'; ?>
16
+ </li>
17
+ <?php endforeach; ?>
18
+ </ul>
19
+
20
+ </div>
21
+
22
+
23
+
24
+ </div>
25
+
26
+ <?php do_action('wpmtst_views_after_template_list' ); ?>
27
+
28
  </td>
admin/partials/views/option-thumbnail.php CHANGED
@@ -1,91 +1,91 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <th>
3
- <input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1" <?php checked( $view['thumbnail'] ); ?>>
4
- <label for="view-images">
5
- <?php _e( 'Featured Image', 'strong-testimonials' ); ?>
6
- </label>
7
- </th>
8
- <td colspan="2">
9
-
10
- <div class="then then_images" style="display: none;">
11
-
12
- <div class="row">
13
- <div class="row-inner">
14
- <div class="inline">
15
- <label for="view-thumbnail_size">
16
- Size
17
- </label>
18
- <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
19
- <?php foreach ( $image_sizes as $key => $size ) : ?>
20
- <option<?php if ( 'custom' == $key ) echo ' class="trip"'; ?> value="<?php echo $key; ?>"<?php selected( $key, $view['thumbnail_size'] ); ?>><?php echo $size['label']; ?></option>
21
- <?php endforeach; ?>
22
- </select>
23
- </div>
24
- <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
25
- <label for="thumbnail_width">
26
- <?php _e( 'width', 'strong-testimonials' ); ?>
27
- </label>
28
- <input id="thumbnail_width" class="input-number-px" type="text" name="view[data][thumbnail_width]" value="<?php echo $view['thumbnail_width']; ?>"> px
29
- <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
30
- <label for="thumbnail_height">
31
- <?php _e( 'height', 'strong-testimonials' ); ?>
32
- </label>
33
- <input id="thumbnail_height" class="input-number-px" type="text" name="view[data][thumbnail_height]" value="<?php echo $view['thumbnail_height']; ?>"> px
34
- </div>
35
- </div>
36
- </div>
37
-
38
- <div class="row">
39
- <div class="row-inner">
40
- <div class="inline">
41
- <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
42
- value="1" <?php checked( $view['lightbox'] ); ?> class="checkbox">
43
- <label for="view-lightbox">
44
- <?php _e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?>
45
- </label>
46
- </div>
47
- <div class="inline then then_lightbox">
48
- <p class="description"><?php _e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
49
- </div>
50
- </div>
51
- </div>
52
-
53
- <div class="row">
54
- <div class="row-inner">
55
- <div class="inline then then_lightbox input" style="display: none;">
56
- <label for="view-lightbox_class">
57
- <?php _e( 'CSS class', 'strong-testimonials' ); ?>
58
- </label>
59
- <input type="text" id="view-lightbox_class" class="medium inline" name="view[data][lightbox_class]" value="<?php echo $view['lightbox_class']; ?>">
60
- <p class="inline description tall">
61
- <?php _e( 'To add a class to the image link.', 'strong-testimonials' ); ?>
62
- </p>
63
- </div>
64
- </div>
65
- </div>
66
-
67
- <div class="row">
68
- <div class="row-inner">
69
- <div class="inline">
70
- <label for="view-gravatar">
71
- <?php _e( 'If no Featured Image', 'strong-testimonials' ); ?>
72
- </label>
73
- <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
74
- <option value="no" <?php selected( $view['gravatar'], 'no' ); ?>><?php _e( 'show nothing', 'strong-testimonials' ); ?></option>
75
- <option value="yes" <?php selected( $view['gravatar'], 'yes' ); ?>><?php _e( 'show Gravatar', 'strong-testimonials' ); ?></option>
76
- <option value="if" <?php selected( $view['gravatar'], 'if' ); ?>><?php _e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
77
- </select>
78
- </div>
79
- <div class="inline">
80
- <div class="then fast then_not_no then_yes then_if" style="display: none;">
81
- <p class="description tall">
82
- <a href="<?php echo admin_url( 'options-discussion.php' ); ?>"><?php _e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
83
- </p>
84
- </div>
85
- </div>
86
- </div>
87
- </div>
88
-
89
- </div><!-- .then_images -->
90
-
91
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <input type="checkbox" id="view-images" class="checkbox if toggle" name="view[data][thumbnail]" value="1" <?php checked( $view['thumbnail'] ); ?>>
4
+ <label for="view-images">
5
+ <?php _e( 'Featured Image', 'strong-testimonials' ); ?>
6
+ </label>
7
+ </th>
8
+ <td colspan="2">
9
+
10
+ <div class="then then_images" style="display: none;">
11
+
12
+ <div class="row">
13
+ <div class="row-inner">
14
+ <div class="inline">
15
+ <label for="view-thumbnail_size">
16
+ Size
17
+ </label>
18
+ <select id="view-thumbnail_size" class="if select" name="view[data][thumbnail_size]">
19
+ <?php foreach ( $image_sizes as $key => $size ) : ?>
20
+ <option<?php if ( 'custom' == $key ) echo ' class="trip"'; ?> value="<?php echo $key; ?>"<?php selected( $key, $view['thumbnail_size'] ); ?>><?php echo $size['label']; ?></option>
21
+ <?php endforeach; ?>
22
+ </select>
23
+ </div>
24
+ <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
25
+ <label for="thumbnail_width">
26
+ <?php _e( 'width', 'strong-testimonials' ); ?>
27
+ </label>
28
+ <input id="thumbnail_width" class="input-number-px" type="text" name="view[data][thumbnail_width]" value="<?php echo $view['thumbnail_width']; ?>"> px
29
+ <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
30
+ <label for="thumbnail_height">
31
+ <?php _e( 'height', 'strong-testimonials' ); ?>
32
+ </label>
33
+ <input id="thumbnail_height" class="input-number-px" type="text" name="view[data][thumbnail_height]" value="<?php echo $view['thumbnail_height']; ?>"> px
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="row">
39
+ <div class="row-inner">
40
+ <div class="inline">
41
+ <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
42
+ value="1" <?php checked( $view['lightbox'] ); ?> class="checkbox">
43
+ <label for="view-lightbox">
44
+ <?php _e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?>
45
+ </label>
46
+ </div>
47
+ <div class="inline then then_lightbox">
48
+ <p class="description"><?php _e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
49
+ </div>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="row">
54
+ <div class="row-inner">
55
+ <div class="inline then then_lightbox input" style="display: none;">
56
+ <label for="view-lightbox_class">
57
+ <?php _e( 'CSS class', 'strong-testimonials' ); ?>
58
+ </label>
59
+ <input type="text" id="view-lightbox_class" class="medium inline" name="view[data][lightbox_class]" value="<?php echo $view['lightbox_class']; ?>">
60
+ <p class="inline description tall">
61
+ <?php _e( 'To add a class to the image link.', 'strong-testimonials' ); ?>
62
+ </p>
63
+ </div>
64
+ </div>
65
+ </div>
66
+
67
+ <div class="row">
68
+ <div class="row-inner">
69
+ <div class="inline">
70
+ <label for="view-gravatar">
71
+ <?php _e( 'If no Featured Image', 'strong-testimonials' ); ?>
72
+ </label>
73
+ <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
74
+ <option value="no" <?php selected( $view['gravatar'], 'no' ); ?>><?php _e( 'show nothing', 'strong-testimonials' ); ?></option>
75
+ <option value="yes" <?php selected( $view['gravatar'], 'yes' ); ?>><?php _e( 'show Gravatar', 'strong-testimonials' ); ?></option>
76
+ <option value="if" <?php selected( $view['gravatar'], 'if' ); ?>><?php _e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
77
+ </select>
78
+ </div>
79
+ <div class="inline">
80
+ <div class="then fast then_not_no then_yes then_if" style="display: none;">
81
+ <p class="description tall">
82
+ <a href="<?php echo admin_url( 'options-discussion.php' ); ?>"><?php _e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
83
+ </p>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ </div><!-- .then_images -->
90
+
91
+ </td>
admin/partials/views/option-title.php CHANGED
@@ -1,20 +1,20 @@
1
- <th>
2
- <input type="checkbox" id="view-title" name="view[data][title]" value="1" <?php checked( $view['title'] ); ?>
3
- class="checkbox if toggle">
4
- <label for="view-title">
5
- <?php _e( 'Title', 'strong-testimonials' ); ?>
6
- </label>
7
- </th>
8
- <td colspan="2">
9
- <div class="row">
10
- <div class="row-inner">
11
- <div class="then then_title" style="display: none;">
12
- <input type="checkbox" id="view-title_link" name="view[data][title_link]"
13
- value="1" <?php checked( $view['title_link'] ); ?> class="checkbox">
14
- <label for="view-title_link">
15
- <?php printf( _x( 'Link to full %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
16
- </label>
17
- </div>
18
- </div>
19
- </div>
20
- </td>
1
+ <th>
2
+ <input type="checkbox" id="view-title" name="view[data][title]" value="1" <?php checked( $view['title'] ); ?>
3
+ class="checkbox if toggle">
4
+ <label for="view-title">
5
+ <?php _e( 'Title', 'strong-testimonials' ); ?>
6
+ </label>
7
+ </th>
8
+ <td colspan="2">
9
+ <div class="row">
10
+ <div class="row-inner">
11
+ <div class="then then_title" style="display: none;">
12
+ <input type="checkbox" id="view-title_link" name="view[data][title_link]"
13
+ value="1" <?php checked( $view['title_link'] ); ?> class="checkbox">
14
+ <label for="view-title_link">
15
+ <?php printf( _x( 'Link to full %s', 'The name of this post type. "Testimonial" by default.', 'strong-testimonials' ), strtolower( apply_filters( 'wpmtst_cpt_singular_name', __( 'Testimonial', 'strong-testimonials' ) ) ) ); ?>
16
+ </label>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </td>
admin/partials/views/template-input.php CHANGED
@@ -1,8 +1,8 @@
1
- <div>
2
- <input type="radio" id="template-<?php echo esc_attr( $key ); ?>"
3
- name="view[data][<?php echo esc_attr( $current_mode ); ?>]"
4
- value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
5
- <label for="template-<?php echo esc_attr( $key ); ?>">
6
- <?php echo $template['config']['name']; ?>
7
- </label>
8
- </div>
1
+ <div>
2
+ <input type="radio" id="template-<?php echo esc_attr( $key ); ?>"
3
+ name="view[data][<?php echo esc_attr( $current_mode ); ?>]"
4
+ value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
5
+ <label for="template-<?php echo esc_attr( $key ); ?>">
6
+ <?php echo $template['config']['name']; ?>
7
+ </label>
8
+ </div>
admin/partials/views/template-not-found.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- // Indicate if template not found; for example, after switching themes or deactivating add-ons.
3
- /* translators: On the Views admin screen. */
4
- ?>
5
- <?php if ( ! $template_found ) : ?>
6
- <ul class="radio-list template-list">
7
- <li>
8
- <div>
9
- <input class="error" type="radio" id="<?php echo esc_attr( $view['template'] ); ?>"
10
- name="view[data][<?php echo esc_attr( $current_mode ); ?>]"
11
- value="<?php echo esc_attr( $view['template'] ); ?>" checked>
12
- <label for="<?php echo esc_attr( $view['template'] ); ?>">
13
- <?php echo $view['template']; ?>
14
- </label>
15
- </div>
16
- <div class="template-description">
17
- <p>
18
- <span class="dashicons dashicons-warning error"></span>&nbsp;
19
- <span class="error"><?php _e( 'not found', 'strong-testimonials' ); ?></span>
20
- </p>
21
- <?php // TODO Explain: Add template key and explain this could be due to switching themes or deactivating a template plugin. It's OK to leave this setting as is if testing or troubleshooting. ?>
22
- </div>
23
- </li>
24
- </ul>
25
- <?php endif;
1
+ <?php
2
+ // Indicate if template not found; for example, after switching themes or deactivating add-ons.
3
+ /* translators: On the Views admin screen. */
4
+ ?>
5
+ <?php if ( ! $template_found ) : ?>
6
+ <ul class="radio-list template-list">
7
+ <li>
8
+ <div>
9
+ <input class="error" type="radio" id="<?php echo esc_attr( $view['template'] ); ?>"
10
+ name="view[data][<?php echo esc_attr( $current_mode ); ?>]"
11
+ value="<?php echo esc_attr( $view['template'] ); ?>" checked>
12
+ <label for="<?php echo esc_attr( $view['template'] ); ?>">
13
+ <?php echo $view['template']; ?>
14
+ </label>
15
+ </div>
16
+ <div class="template-description">
17
+ <p>
18
+ <span class="dashicons dashicons-warning error"></span>&nbsp;
19
+ <span class="error"><?php _e( 'not found', 'strong-testimonials' ); ?></span>
20
+ </p>
21
+ <?php // TODO Explain: Add template key and explain this could be due to switching themes or deactivating a template plugin. It's OK to leave this setting as is if testing or troubleshooting. ?>
22
+ </div>
23
+ </li>
24
+ </ul>
25
+ <?php endif;
admin/partials/views/template-options.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php /* translators: On the Views admin screen. */ ?>
2
- <div class="template-description">
3
- <p>
4
- <?php
5
- if ( isset( $template['config']['description'] ) && $template['config']['description'] ) {
6
- echo $template['config']['description'];
7
- }
8
- else {
9
- _e( 'no description', 'strong-testimonials' );
10
- }
11
- ?>
12
- </p>
13
- <div class="options">
14
- <div>
15
- <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
16
- <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
17
- <?php else : ?>
18
- <?php foreach ( $template['config']['options'] as $option ) : ?>
19
- <div style="margin-bottom: 10px;">
20
- <?php
21
- $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
22
- $id = $key . '-' . $option->name;
23
- switch ( $option->type ) {
24
- case 'select':
25
- // Get default if not set
26
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
27
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
28
- }
29
-
30
- if ( $option->label ) {
31
- printf( '<label for="%s">%s</label>', $id, $option->label );
32
- }
33
-
34
- printf( '<select id="%s" name="%s">', $id, $name );
35
-
36
- foreach ( $option->values as $value ) {
37
- $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
38
- printf( '<option value="%s" %s>%s</option>', $value->value, $selected, $value->description );
39
- }
40
-
41
- echo '</select>';
42
- break;
43
-
44
- case 'radio':
45
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
46
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
47
- }
48
-
49
- foreach ( $option->values as $value ) {
50
- $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
51
- printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', $id, $name, $value->value, $checked );
52
- printf( '<label for="%s">%s</label>', $id, $value->description );
53
- }
54
- break;
55
-
56
- case 'colorpicker':
57
- if ( $option->label ) {
58
- printf( '<label for="%s">%s</label>', $id, $option->label );
59
- }
60
-
61
- $value = isset( $view['template_settings'][ $key ][ $option->name ] ) ? $view['template_settings'][ $key ][ $option->name ] : $option->default;
62
-
63
- printf( '<input type="text" class="wp-color-picker-field" data-alpha="true" id="%s" name="%s" value="%s">', $id, $name, $value );
64
- break;
65
-
66
- default:
67
- do_action( 'wpmtst_views_render_template_option_' . $option->type, $view, $key, $option );
68
- break;
69
- }
70
- ?>
71
- </div>
72
- <?php endforeach; ?>
73
-
74
- <?php endif; ?>
75
- </div>
76
- </div>
77
-
78
- <?php do_action('wpmtst_views_after_template_options', $view, $template, $key ); ?>
79
-
80
- </div>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <div class="template-description">
3
+ <p>
4
+ <?php
5
+ if ( isset( $template['config']['description'] ) && $template['config']['description'] ) {
6
+ echo $template['config']['description'];
7
+ }
8
+ else {
9
+ _e( 'no description', 'strong-testimonials' );
10
+ }
11
+ ?>
12
+ </p>
13
+ <div class="options">
14
+ <div>
15
+ <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
16
+ <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
17
+ <?php else : ?>
18
+ <?php foreach ( $template['config']['options'] as $option ) : ?>
19
+ <div style="margin-bottom: 10px;">
20
+ <?php
21
+ $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
22
+ $id = $key . '-' . $option->name;
23
+ switch ( $option->type ) {
24
+ case 'select':
25
+ // Get default if not set
26
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
27
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
28
+ }
29
+
30
+ if ( $option->label ) {
31
+ printf( '<label for="%s">%s</label>', $id, $option->label );
32
+ }
33
+
34
+ printf( '<select id="%s" name="%s">', $id, $name );
35
+
36
+ foreach ( $option->values as $value ) {
37
+ $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
38
+ printf( '<option value="%s" %s>%s</option>', $value->value, $selected, $value->description );
39
+ }
40
+
41
+ echo '</select>';
42
+ break;
43
+
44
+ case 'radio':
45
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
46
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
47
+ }
48
+
49
+ foreach ( $option->values as $value ) {
50
+ $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
51
+ printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', $id, $name, $value->value, $checked );
52
+ printf( '<label for="%s">%s</label>', $id, $value->description );
53
+ }
54
+ break;
55
+
56
+ case 'colorpicker':
57
+ if ( $option->label ) {
58
+ printf( '<label for="%s">%s</label>', $id, $option->label );
59
+ }
60
+
61
+ $value = isset( $view['template_settings'][ $key ][ $option->name ] ) ? $view['template_settings'][ $key ][ $option->name ] : $option->default;
62
+
63
+ printf( '<input type="text" class="wp-color-picker-field" data-alpha="true" id="%s" name="%s" value="%s">', $id, $name, $value );
64
+ break;
65
+
66
+ default:
67
+ do_action( 'wpmtst_views_render_template_option_' . $option->type, $view, $key, $option );
68
+ break;
69
+ }
70
+ ?>
71
+ </div>
72
+ <?php endforeach; ?>
73
+
74
+ <?php endif; ?>
75
+ </div>
76
+ </div>
77
+
78
+ <?php do_action('wpmtst_views_after_template_options', $view, $template, $key ); ?>
79
+
80
+ </div>
admin/partials/views/view-mode.php CHANGED
@@ -1,18 +1,18 @@
1
- <div id="view-mode" class="table-row mode-select">
2
- <div class="table-cell">
3
- <?php _e( 'Mode', 'strong-testimonials' ); ?>
4
- </div>
5
- <div class="table-cell">
6
- <div class="mode-list">
7
- <?php foreach ( $view_options['mode'] as $mode ) : ?>
8
- <label>
9
- <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
10
- value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
11
- <?php echo $mode['label']; ?>
12
- <div class="mode-line"></div>
13
- </label>
14
- <?php endforeach; ?>
15
- </div>
16
- <div class="mode-description"></div>
17
- </div>
18
- </div>
1
+ <div id="view-mode" class="table-row mode-select">
2
+ <div class="table-cell">
3
+ <?php _e( 'Mode', 'strong-testimonials' ); ?>
4
+ </div>
5
+ <div class="table-cell">
6
+ <div class="mode-list">
7
+ <?php foreach ( $view_options['mode'] as $mode ) : ?>
8
+ <label>
9
+ <input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
10
+ value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
11
+ <?php echo $mode['label']; ?>
12
+ <div class="mode-line"></div>
13
+ </label>
14
+ <?php endforeach; ?>
15
+ </div>
16
+ <div class="mode-description"></div>
17
+ </div>
18
+ </div>
admin/partials/views/view-name.php CHANGED
@@ -1,17 +1,17 @@
1
- <div class="table-row form-view-name">
2
- <?php
3
- /**
4
- * Using htmlspecialchars and stripslashes on $view_name to handle quotes, etc. in database.
5
- * @since 2.11.14
6
- */
7
- ?>
8
- <div class="table-cell">
9
- <label for="view-name">
10
- <?php _e( 'Name', 'strong-testimonials' ); ?>
11
- </label>
12
- </div>
13
- <div class="table-cell">
14
- <input type="text" id="view-name" class="view-name" name="view[name]"
15
- value="<?php echo htmlspecialchars( stripslashes( $view_name ) ); ?>" tabindex="1">
16
- </div>
17
- </div>
1
+ <div class="table-row form-view-name">
2
+ <?php
3
+ /**
4
+ * Using htmlspecialchars and stripslashes on $view_name to handle quotes, etc. in database.
5
+ * @since 2.11.14
6
+ */
7
+ ?>
8
+ <div class="table-cell">
9
+ <label for="view-name">
10
+ <?php _e( 'Name', 'strong-testimonials' ); ?>
11
+ </label>
12
+ </div>
13
+ <div class="table-cell">
14
+ <input type="text" id="view-name" class="view-name" name="view[name]"
15
+ value="<?php echo htmlspecialchars( stripslashes( $view_name ) ); ?>" tabindex="1">
16
+ </div>
17
+ </div>
admin/partials/views/view-shortcode.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
- // avoiding the tab character before the shortcode for better copy-n-paste
3
- if ( 'edit' == $action ) {
4
- $shortcode = '<div class="saved">';
5
- $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $view_id ) . '&quot;]" readonly />';
6
- $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
7
- $shortcode .= '<span id="copy-message">copied</span>';
8
- $shortcode .= '</div>';
9
- } else {
10
- $shortcode = '<div class="unsaved">' . _x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
11
- }
12
-
13
- $then_classes = array(
14
- 'then',
15
- 'then_display',
16
- 'then_form',
17
- 'then_slideshow',
18
- 'then_not_single_template',
19
- apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
20
- );
21
- ?>
22
-
23
- <div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
24
- <div class="table-cell">
25
- <label for="view-shortcode">
26
- <?php _e( 'Shortcode', 'strong-testimonials' ); ?>
27
- </label>
28
- </div>
29
- <div class="table-cell">
30
- <?php echo $shortcode; ?>
31
- </div>
32
- </div>
1
+ <?php
2
+ // avoiding the tab character before the shortcode for better copy-n-paste
3
+ if ( 'edit' == $action ) {
4
+ $shortcode = '<div class="saved">';
5
+ $shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id=&quot;' . esc_attr( $view_id ) . '&quot;]" readonly />';
6
+ $shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
7
+ $shortcode .= '<span id="copy-message">copied</span>';
8
+ $shortcode .= '</div>';
9
+ } else {
10
+ $shortcode = '<div class="unsaved">' . _x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
11
+ }
12
+
13
+ $then_classes = array(
14
+ 'then',
15
+ 'then_display',
16
+ 'then_form',
17
+ 'then_slideshow',
18
+ 'then_not_single_template',
19
+ apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
20
+ );
21
+ ?>
22
+
23
+ <div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
24
+ <div class="table-cell">
25
+ <label for="view-shortcode">
26
+ <?php _e( 'Shortcode', 'strong-testimonials' ); ?>
27
+ </label>
28
+ </div>
29
+ <div class="table-cell">
30
+ <?php echo $shortcode; ?>
31
+ </div>
32
+ </div>
admin/scss/_partials/_background.scss CHANGED
@@ -1,30 +1,30 @@
1
- /* -------------------------------------------------
2
- Background options
3
- ------------------------------------------------- */
4
-
5
- .color-picker-wrap {
6
- display: flex;
7
-
8
- > div:first-child {
9
- min-width: 80px;
10
- }
11
- }
12
-
13
- .background-preview-wrap {
14
- background: #FFF;
15
- padding: 2em;
16
- max-width: 300px;
17
- }
18
-
19
- #background-preview {
20
- padding: 1em;
21
- text-align: center;
22
-
23
- &.dark {
24
- color: #333;
25
- }
26
-
27
- &.light {
28
- color: #EEE;
29
- }
30
- }
1
+ /* -------------------------------------------------
2
+ Background options
3
+ ------------------------------------------------- */
4
+
5
+ .color-picker-wrap {
6
+ display: flex;
7
+
8
+ > div:first-child {
9
+ min-width: 80px;
10
+ }
11
+ }
12
+
13
+ .background-preview-wrap {
14
+ background: #FFF;
15
+ padding: 2em;
16
+ max-width: 300px;
17
+ }
18
+
19
+ #background-preview {
20
+ padding: 1em;
21
+ text-align: center;
22
+
23
+ &.dark {
24
+ color: #333;
25
+ }
26
+
27
+ &.light {
28
+ color: #EEE;
29
+ }
30
+ }
admin/scss/_partials/_category-checkboxes.scss CHANGED
@@ -1,19 +1,19 @@
1
- /* --------------------------------------------------
2
- Category checkboxes
3
- -------------------------------------------------- */
4
-
5
- ul.checkbox-horizontal {
6
- display: inline-block;
7
- list-style: none;
8
- margin: 0;
9
-
10
- li {
11
- display: inline-block;
12
- float: left;
13
- margin: 6px 2em 0 0;
14
- }
15
- }
16
-
17
- .select-cell {
18
- padding-right: 2em;
19
- }
1
+ /* --------------------------------------------------
2
+ Category checkboxes
3
+ -------------------------------------------------- */
4
+
5
+ ul.checkbox-horizontal {
6
+ display: inline-block;
7
+ list-style: none;
8
+ margin: 0;
9
+
10
+ li {
11
+ display: inline-block;
12
+ float: left;
13
+ margin: 6px 2em 0 0;
14
+ }
15
+ }
16
+
17
+ .select-cell {
18
+ padding-right: 2em;
19
+ }
admin/scss/_partials/_category-filter.scss CHANGED
@@ -1,58 +1,58 @@
1
- /* --------------------------------------------------
2
- Category filter
3
- -------------------------------------------------- */
4
-
5
- // search filter
6
- .fc-search-wrap {
7
- display: none;
8
- position: relative;
9
- }
10
-
11
- .fc-search-field {
12
- margin: 12px 0 4px 0;
13
- width: 100%;
14
- }
15
-
16
- // dim the category count next to the category name
17
- .cat-count {
18
- color: #888;
19
- }
20
-
21
- // copying style from native post category list
22
- .view-category-list-panel {
23
- box-sizing: border-box;
24
- min-height: 42px;
25
- min-width: 220px;
26
- overflow: auto;
27
- padding: 0 10px;
28
- border: 1px solid #DFDFDF;
29
- background-color: #FDFDFD;
30
- transition: all 0.2s ease;
31
-
32
- &.short-panel {
33
- max-height: 205px;
34
- }
35
-
36
- &.tall-panel {
37
- max-height: none;
38
- }
39
- }
40
-
41
- .view-category-list {
42
- margin: 7px 0;
43
-
44
- li {
45
- margin-bottom: 0;
46
- line-height: 24px;
47
-
48
- label {
49
- margin-bottom: 6px;
50
- word-wrap: break-word;
51
- white-space: nowrap;
52
- }
53
- }
54
-
55
- ul.children {
56
- margin-left: 21px;
57
- }
58
- }
1
+ /* --------------------------------------------------
2
+ Category filter
3
+ -------------------------------------------------- */
4
+
5
+ // search filter
6
+ .fc-search-wrap {
7
+ display: none;
8
+ position: relative;
9
+ }
10
+
11
+ .fc-search-field {
12
+ margin: 12px 0 4px 0;
13
+ width: 100%;
14
+ }
15
+
16
+ // dim the category count next to the category name
17
+ .cat-count {
18
+ color: #888;
19
+ }
20
+
21
+ // copying style from native post category list
22
+ .view-category-list-panel {
23
+ box-sizing: border-box;
24
+ min-height: 42px;
25
+ min-width: 220px;
26
+ overflow: auto;
27
+ padding: 0 10px;
28
+ border: 1px solid #DFDFDF;
29
+ background-color: #FDFDFD;
30
+ transition: all 0.2s ease;
31
+
32
+ &.short-panel {
33
+ max-height: 205px;
34
+ }
35
+
36
+ &.tall-panel {
37
+ max-height: none;
38
+ }
39
+ }
40
+
41
+ .view-category-list {
42
+ margin: 7px 0;
43
+
44
+ li {
45
+ margin-bottom: 0;
46
+ line-height: 24px;
47
+
48
+ label {
49
+ margin-bottom: 6px;
50
+ word-wrap: break-word;
51
+ white-space: nowrap;
52
+ }
53
+ }
54
+
55
+ ul.children {
56
+ margin-left: 21px;
57
+ }
58
+ }
admin/scss/_partials/_checkbox-icons.scss CHANGED
@@ -1,52 +1,52 @@
1
- /* -------------------------------------------------
2
- Replace checkboxes with icons
3
- ------------------------------------------------- */
4
-
5
- input[type=checkbox] {
6
- display: none;
7
-
8
- // keep the inherited margins, adjust width if more space is necessary
9
- + label {
10
- &:before {
11
- font-family: FontAwesome;
12
- display: inline-block;
13
- font-size: 18px;
14
- width: 1em;
15
- position: relative;
16
- top: 1px;
17
-
18
- /* unchecked icon */
19
- content: "\f096";
20
- color: $blue;
21
- }
22
-
23
- &:hover:before {
24
- color: $orange;
25
- }
26
-
27
- }
28
-
29
- &:checked + label {
30
- &:before {
31
- /* checked icon */
32
- content: "\f14a";
33
- }
34
-
35
- &:hover:before {
36
- color: $orange;
37
- }
38
- }
39
-
40
- &:disabled + label {
41
- &:before {
42
- /* disabled icon */
43
- content: "\f146";
44
- color: $grayedout;
45
- }
46
-
47
- &:hover:before {
48
- color: $grayedout;
49
- }
50
- }
51
-
52
- }
1
+ /* -------------------------------------------------
2
+ Replace checkboxes with icons
3
+ ------------------------------------------------- */
4
+
5
+ input[type=checkbox] {
6
+ display: none;
7
+
8
+ // keep the inherited margins, adjust width if more space is necessary
9
+ + label {
10
+ &:before {
11
+ font-family: FontAwesome;
12
+ display: inline-block;
13
+ font-size: 18px;
14
+ width: 1em;
15
+ position: relative;
16
+ top: 1px;
17
+
18
+ /* unchecked icon */
19
+ content: "\f096";
20
+ color: $blue;
21
+ }
22
+
23
+ &:hover:before {
24
+ color: $orange;
25
+ }
26
+
27
+ }
28
+
29
+ &:checked + label {
30
+ &:before {
31
+ /* checked icon */
32
+ content: "\f14a";
33
+ }
34
+
35
+ &:hover:before {
36
+ color: $orange;
37
+ }
38
+ }
39
+
40
+ &:disabled + label {
41
+ &:before {
42
+ /* disabled icon */
43
+ content: "\f146";
44
+ color: $grayedout;
45
+ }
46
+
47
+ &:hover:before {
48
+ color: $grayedout;
49
+ }
50
+ }
51
+
52
+ }
admin/scss/_partials/_custom-fields.scss CHANGED
@@ -1,169 +1,169 @@
1
- /* --------------------------------------------------
2
- Custom fields
3
- -------------------------------------------------- */
4
-
5
- .fields {
6
- display: inline-block;
7
- min-width: 350px;
8
-
9
- .field2 {
10
- border: 1px solid #DDD;
11
- background: #FFF; /* for better dragging */
12
- transition: background 0.3s ease, border 0.3s ease;
13
-
14
- &.open {
15
- background: #FFF;
16
- border-color: #444;
17
- }
18
-
19
- }
20
-
21
- .field3 {
22
- flex: 20;
23
- }
24
-
25
- div.link {
26
- display: inline-block;
27
- cursor: pointer;
28
- padding: 10px 10px 8px;
29
- width: calc(100% - 20px);
30
- }
31
- }
32
-
33
- .controls2 {
34
- > div {
35
- display: flex;
36
- }
37
-
38
- .icon-wrap {
39
- position: relative;
40
- top: 1px;
41
- color: #999;
42
-
43
- &:hover {
44
- cursor: pointer;
45
- }
46
- }
47
-
48
- &.left {
49
- float: left;
50
-
51
- .icon-wrap {
52
- margin-right: 5px;
53
- }
54
- }
55
-
56
- &.right {
57
- float: right;
58
-
59
- .icon-wrap {
60
- margin-left: 5px;
61
- }
62
- }
63
-
64
- /* icons */
65
- .handle,
66
- .delete,
67
- .toggle {
68
- &:before {
69
- font: normal 20px/1 dashicons;
70
- width: 20px;
71
- height: 20px;
72
- }
73
-
74
- &:hover {
75
- cursor: pointer;
76
- }
77
- }
78
-
79
- .delete {
80
- &:before {
81
- content: "\f335";
82
- }
83
-
84
- &:hover:before {
85
- background: #FF0000;
86
- color: #FFF;
87
- border-radius: 1px;
88
- }
89
- }
90
-
91
- .handle {
92
- &:before {
93
- content: "\f333";
94
- }
95
-
96
- &:hover {
97
- color: #2ea2cc;
98
- cursor: move;
99
- }
100
- }
101
-
102
- .toggle {
103
- &:before {
104
- content: "\f140";
105
- }
106
-
107
- &:hover:before {
108
- color: #2EA2CC;
109
- }
110
- }
111
- }
112
-
113
- .field-description {
114
- padding: 0 5px;
115
- font-weight: 600;
116
- text-decoration: none;
117
- color: #444;
118
-
119
- &:hover {
120
- color: #444;
121
- }
122
- }
123
-
124
- .field-properties {
125
- padding: 5px 10px;
126
- border-top: 1px dotted #DDD;
127
- }
128
-
129
- .field-property,
130
- .field-property-box .flex {
131
- display: flex;
132
- margin: 5px 0;
133
-
134
- label,
135
- .nolabel {
136
- flex: 0 1 80px;
137
- line-height: 28px;
138
- }
139
-
140
- select, input {
141
- flex: 3;
142
- }
143
- }
144
-
145
- .field2.open .toggle:before {
146
- content: "\f142";
147
- }
148
-
149
- .sortable-placeholder {
150
- background: lightyellow !important;
151
- margin: 0;
152
- }
153
-
154
- .ui-sortable-helper {
155
- border: 1px solid #444 !important;
156
- }
157
-
158
- div.help {
159
- font-style: italic;
160
- padding-bottom: 5px;
161
- }
162
-
163
- @-moz-document url-prefix() {
164
- select optgroup {
165
- font-style: normal;
166
- margin-left: 3px;
167
- }
168
- }
169
-
1
+ /* --------------------------------------------------
2
+ Custom fields
3
+ -------------------------------------------------- */
4
+
5
+ .fields {
6
+ display: inline-block;
7
+ min-width: 350px;
8
+
9
+ .field2 {
10
+ border: 1px solid #DDD;
11
+ background: #FFF; /* for better dragging */
12
+ transition: background 0.3s ease, border 0.3s ease;
13
+
14
+ &.open {
15
+ background: #FFF;
16
+ border-color: #444;
17
+ }
18
+
19
+ }
20
+
21
+ .field3 {
22
+ flex: 20;
23
+ }
24
+
25
+ div.link {
26
+ display: inline-block;
27
+ cursor: pointer;
28
+ padding: 10px 10px 8px;
29
+ width: calc(100% - 20px);
30
+ }
31
+ }
32
+
33
+ .controls2 {
34
+ > div {
35
+ display: flex;
36
+ }
37
+
38
+ .icon-wrap {
39
+ position: relative;
40
+ top: 1px;
41
+ color: #999;
42
+
43
+ &:hover {
44
+ cursor: pointer;
45
+ }
46
+ }
47
+
48
+ &.left {
49
+ float: left;
50
+
51
+ .icon-wrap {
52
+ margin-right: 5px;
53
+ }
54
+ }
55
+
56
+ &.right {
57
+ float: right;
58
+
59
+ .icon-wrap {
60
+ margin-left: 5px;
61
+ }
62
+ }
63
+
64
+ /* icons */
65
+ .handle,
66
+ .delete,
67
+ .toggle {
68
+ &:before {
69
+ font: normal 20px/1 dashicons;
70
+ width: 20px;
71
+ height: 20px;
72
+ }
73
+
74
+ &:hover {
75
+ cursor: pointer;
76
+ }
77
+ }
78
+
79
+ .delete {
80
+ &:before {
81
+ content: "\f335";
82
+ }
83
+
84
+ &:hover:before {
85
+ background: #FF0000;
86
+ color: #FFF;
87
+ border-radius: 1px;
88
+ }
89
+ }
90
+
91
+ .handle {
92
+ &:before {
93
+ content: "\f333";
94
+ }
95
+
96
+ &:hover {
97
+ color: #2ea2cc;
98
+ cursor: move;
99
+ }
100
+ }
101
+
102
+ .toggle {
103
+ &:before {
104
+ content: "\f140";
105
+ }
106
+
107
+ &:hover:before {
108
+ color: #2EA2CC;
109
+ }
110
+ }
111
+ }
112
+
113
+ .field-description {
114
+ padding: 0 5px;
115
+ font-weight: 600;
116
+ text-decoration: none;
117
+ color: #444;
118
+
119
+ &:hover {
120
+ color: #444;
121
+ }
122
+ }
123
+
124
+ .field-properties {
125
+ padding: 5px 10px;
126
+ border-top: 1px dotted #DDD;
127
+ }
128
+
129
+ .field-property,
130
+ .field-property-box .flex {
131
+ display: flex;
132
+ margin: 5px 0;
133
+
134
+ label,
135
+ .nolabel {
136
+ flex: 0 1 80px;
137
+ line-height: 28px;
138
+ }
139
+
140
+ select, input {
141
+ flex: 3;
142
+ }
143
+ }
144
+
145
+ .field2.open .toggle:before {
146
+ content: "\f142";
147
+ }
148
+
149
+ .sortable-placeholder {
150
+ background: lightyellow !important;
151
+ margin: 0;
152
+ }
153
+
154
+ .ui-sortable-helper {
155
+ border: 1px solid #444 !important;
156
+ }
157
+
158
+ div.help {
159
+ font-style: italic;
160
+ padding-bottom: 5px;
161
+ }
162
+
163
+ @-moz-document url-prefix() {
164
+ select optgroup {
165
+ font-style: normal;
166
+ margin-left: 3px;
167
+ }
168
+ }
169
+
admin/scss/_partials/_elements.scss CHANGED
@@ -1,93 +1,93 @@
1
- /* -------------------------------------------------
2
- Elements
3
- ------------------------------------------------- */
4
-
5
- .wpmtst2 {
6
- max-width: 1200px;
7
-
8
- /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
9
- p.wpmtst-submit {
10
- margin-top: 2em;
11
- }
12
-
13
- /* views section heading */
14
- h3 {
15
- background: #FFF;
16
- color: $blue;
17
- font-weight: 400;
18
- border: 1px solid #DDD;
19
- border-bottom: 0;
20
- padding: 10px 15px;
21
- margin-bottom: 0;
22
- margin-top: 1.5rem;
23
- }
24
- }
25
-
26
- .form-table td p.description {
27
- margin-top: 0;
28
- font-style: italic;
29
-
30
- &.tall {
31
- line-height: 32px;
32
- margin-top: 0;
33
- }
34
-
35
- &.short {
36
- line-height: 22px;
37
- padding: 5px 0;
38
- }
39
-
40
- &.solo {
41
- margin-left: 0.3em;
42
- }
43
-
44
- &.under-checkbox {
45
- margin-left: 22px;
46
- }
47
- }
48
-
49
- /* Misc positioning */
50
-
51
- .inline {
52
- display: inline-block;
53
- margin-right: 1em;
54
- vertical-align: top;
55
-
56
- &:last-child {
57
- margin-right: 0;
58
- }
59
- }
60
-
61
- .inline span,
62
- .row span {
63
- display: inline-block;
64
- margin-right: 3px;
65
- }
66
-
67
- .inline-middle {
68
- vertical-align: middle;
69
- }
70
-
71
- .tight {
72
- margin-right: 0.2em;
73
- }
74
-
75
- .tight:last-child,
76
- .last {
77
- margin-right: 0;
78
- }
79
-
80
- .checkbox,
81
- .form-table th.checkbox {
82
- line-height: 32px;
83
- }
84
-
85
- .field {
86
- position: relative;
87
-
88
- & div {
89
- display: inline-block;
90
- padding: 0.2em 0.3em;
91
- }
92
- }
93
-
1
+ /* -------------------------------------------------
2
+ Elements
3
+ ------------------------------------------------- */
4
+
5
+ .wpmtst2 {
6
+ max-width: 1200px;
7
+
8
+ /* The generic classname `submit` conflicts with an unknown plugin or theme overzealous style. */
9
+ p.wpmtst-submit {
10
+ margin-top: 2em;
11
+ }
12
+
13
+ /* views section heading */
14
+ h3 {
15
+ background: #FFF;
16
+ color: $blue;
17
+ font-weight: 400;
18
+ border: 1px solid #DDD;
19
+ border-bottom: 0;
20
+ padding: 10px 15px;
21
+ margin-bottom: 0;
22
+ margin-top: 1.5rem;
23
+ }
24
+ }
25
+
26
+ .form-table td p.description {
27
+ margin-top: 0;
28
+ font-style: italic;
29
+
30
+ &.tall {
31
+ line-height: 32px;
32
+ margin-top: 0;
33
+ }
34
+
35
+ &.short {
36
+ line-height: 22px;
37
+ padding: 5px 0;
38
+ }
39
+
40
+ &.solo {
41
+ margin-left: 0.3em;
42
+ }
43
+
44
+ &.under-checkbox {
45
+ margin-left: 22px;
46
+ }
47
+ }
48
+
49
+ /* Misc positioning */
50
+
51
+ .inline {
52
+ display: inline-block;
53
+ margin-right: 1em;
54
+ vertical-align: top;
55
+
56
+ &:last-child {
57
+ margin-right: 0;
58
+ }
59
+ }
60
+
61
+ .inline span,
62
+ .row span {
63
+ display: inline-block;
64
+ margin-right: 3px;
65
+ }
66
+
67
+ .inline-middle {
68
+ vertical-align: middle;
69
+ }
70
+
71
+ .tight {
72
+ margin-right: 0.2em;
73
+ }
74
+
75
+ .tight:last-child,
76
+ .last {
77
+ margin-right: 0;
78
+ }
79
+
80
+ .checkbox,
81
+ .form-table th.checkbox {
82
+ line-height: 32px;
83
+ }
84
+
85
+ .field {
86
+ position: relative;
87
+
88
+ & div {
89
+ display: inline-block;
90
+ padding: 0.2em 0.3em;
91
+ }
92
+ }
93
+
admin/scss/_partials/_form-table.scss CHANGED
@@ -1,98 +1,98 @@
1
- /* -------------------------------------------------
2
- Form table
3
- ------------------------------------------------- */
4
-
5
- .form-table {
6
- margin-top: 0;
7
- background: #FEFEFE;
8
- width: 100% !important;
9
- border: 1px solid #DDD;
10
-
11
- &.multiple {
12
- width: auto;
13
- }
14
-
15
- tr {
16
- border: 1px solid #DDD;
17
- }
18
-
19
- th,
20
- td {
21
- vertical-align: top;
22
- }
23
-
24
- th {
25
- font-weight: 400;
26
- white-space: nowrap;
27
- vertical-align: top;
28
- width: 150px;
29
- padding: 10px 15px;
30
- }
31
-
32
- td {
33
- padding: 10px;
34
-
35
- &.valign-middle {
36
- vertical-align: middle;
37
- }
38
-
39
- &.w1 {
40
- width: 185px;
41
- }
42
-
43
- &.w2 {
44
- width: 300px;
45
- }
46
- }
47
- }
48
-
49
- tr.subheading {
50
- font-weight: 600;
51
-
52
- td {
53
- padding: 5px 10px;
54
-
55
- &:first-child {
56
- padding-left: 15px;
57
- }
58
-
59
- &:last-child {
60
- width: 190px;
61
- }
62
- }
63
- }
64
-
65
- td.divider {
66
- border-left: 1px dashed #DDD;
67
- }
68
-
69
- .wpmtst2 .form-table th,
70
- .wpmtst2 .form-table th label {
71
- line-height: 30px;
72
- margin-top: 0;
73
- margin-bottom: 0;
74
- }
75
-
76
- span.title {
77
- display: inline-block;
78
- margin-right: 1em;
79
- }
80
-
81
- .row,
82
- .row p {
83
- vertical-align: middle;
84
- line-height: 32px;
85
- }
86
-
87
- .row.tall,
88
- .row.tall p {
89
- line-height: 40px;
90
- }
91
-
92
- .row.links {
93
- margin-top: 10px;
94
- }
95
-
96
- .row:not(:first-child) .row-inner {
97
- margin-top: 10px;
98
- }
1
+ /* -------------------------------------------------
2
+ Form table
3
+ ------------------------------------------------- */
4
+
5
+ .form-table {
6
+ margin-top: 0;
7
+ background: #FEFEFE;
8
+ width: 100% !important;
9
+ border: 1px solid #DDD;
10
+
11
+ &.multiple {
12
+ width: auto;
13
+ }
14
+
15
+ tr {
16
+ border: 1px solid #DDD;
17
+ }
18
+
19
+ th,
20
+ td {
21
+ vertical-align: top;
22
+ }
23
+
24
+ th {
25
+ font-weight: 400;
26
+ white-space: nowrap;
27
+ vertical-align: top;
28
+ width: 150px;
29
+ padding: 10px 15px;
30
+ }
31
+
32
+ td {
33
+ padding: 10px;
34
+
35
+ &.valign-middle {
36
+ vertical-align: middle;
37
+ }
38
+
39
+ &.w1 {
40
+ width: 185px;
41
+ }
42
+
43
+ &.w2 {
44
+ width: 300px;
45
+ }
46
+ }
47
+ }
48
+
49
+ tr.subheading {
50
+ font-weight: 600;
51
+
52
+ td {
53
+ padding: 5px 10px;
54
+
55
+ &:first-child {
56
+ padding-left: 15px;
57
+ }
58
+
59
+ &:last-child {
60
+ width: 190px;
61
+ }
62
+ }
63
+ }
64
+
65
+ td.divider {
66
+ border-left: 1px dashed #DDD;
67
+ }
68
+
69
+ .wpmtst2 .form-table th,
70
+ .wpmtst2 .form-table th label {
71
+ line-height: 30px;
72
+ margin-top: 0;
73
+ margin-bottom: 0;
74
+ }
75
+
76
+ span.title {
77
+ display: inline-block;
78
+ margin-right: 1em;
79
+ }
80
+
81
+ .row,
82
+ .row p {
83
+ vertical-align: middle;
84
+ line-height: 32px;
85
+ }
86
+
87
+ .row.tall,
88
+ .row.tall p {
89
+ line-height: 40px;
90
+ }
91
+
92
+ .row.links {
93
+ margin-top: 10px;
94
+ }
95
+
96
+ .row:not(:first-child) .row-inner {
97
+ margin-top: 10px;
98
+ }
admin/scss/_partials/_help-tab.scss CHANGED
@@ -1,50 +1,50 @@
1
- /* --------------------------------------------------
2
- help tab
3
- -------------------------------------------------- */
4
-
5
- span.help-links {
6
- display: inline-block;
7
- margin-left: 0.4em;
8
- }
9
-
10
- a.open-help-tab {
11
- font-weight: 400;
12
- }
13
-
14
- table.wpmtst-help-tab {
15
- border-collapse: collapse;
16
- margin: 20px 0;
17
- width: 100%;
18
-
19
- tr {
20
- &:hover {
21
- td {
22
- background: #FFFFAA;
23
- }
24
- }
25
- }
26
-
27
- th,
28
- td {
29
- padding: 5px 10px;
30
- text-align: center;
31
- }
32
-
33
- th {
34
- border-bottom: 1px solid #AAA;
35
- }
36
-
37
- td {
38
- border-bottom: 1px solid #E1E1E1;
39
-
40
- &:first-child {
41
- text-align: right;
42
- font-weight: 600;
43
- white-space: nowrap;
44
- }
45
- &:not(:last-child) {
46
- border-right: 1px dotted #E1E1E1;
47
- }
48
- }
49
- }
50
-
1
+ /* --------------------------------------------------
2
+ help tab
3
+ -------------------------------------------------- */
4
+
5
+ span.help-links {
6
+ display: inline-block;
7
+ margin-left: 0.4em;
8
+ }
9
+
10
+ a.open-help-tab {
11
+ font-weight: 400;
12
+ }
13
+
14
+ table.wpmtst-help-tab {
15
+ border-collapse: collapse;
16
+ margin: 20px 0;
17
+ width: 100%;
18
+
19
+ tr {
20
+ &:hover {
21
+ td {
22
+ background: #FFFFAA;
23
+ }
24
+ }
25
+ }
26
+
27
+ th,
28
+ td {
29
+ padding: 5px 10px;
30
+ text-align: center;
31
+ }
32
+
33
+ th {
34
+ border-bottom: 1px solid #AAA;
35
+ }
36
+
37
+ td {
38
+ border-bottom: 1px solid #E1E1E1;
39
+
40
+ &:first-child {
41
+ text-align: right;
42
+ font-weight: 600;
43
+ white-space: nowrap;
44
+ }
45
+ &:not(:last-child) {
46
+ border-right: 1px dotted #E1E1E1;
47
+ }
48
+ }
49
+ }
50
+
admin/scss/_partials/_inner-table.scss CHANGED
@@ -1,32 +1,32 @@
1
- /* -------------------------------------------------
2
- Inner table
3
- ------------------------------------------------- */
4
-
5
- .inner-table {
6
- display: table;
7
- }
8
-
9
- .inner-table-row {
10
- display: table-row;
11
-
12
- &.bordered {
13
- border: 1px solid #DDD;
14
- }
15
-
16
- &.header {
17
- .inner-table-cell {
18
- text-align: center;
19
- padding: 0 10px;
20
- background: #f6f6f6;
21
- }
22
- }
23
- }
24
-
25
- .inner-table-cell {
26
- display: table-cell;
27
- padding: 5px 10px;
28
-
29
- &:not(:last-child) {
30
- border-right: 1px dashed #e2e2e2;
31
- }
32
  }
1
+ /* -------------------------------------------------
2
+ Inner table
3
+ ------------------------------------------------- */
4
+
5
+ .inner-table {
6
+ display: table;
7
+ }
8
+
9
+ .inner-table-row {
10
+ display: table-row;
11
+
12
+ &.bordered {
13
+ border: 1px solid #DDD;
14
+ }
15
+
16
+ &.header {
17
+ .inner-table-cell {
18
+ text-align: center;
19
+ padding: 0 10px;
20
+ background: #f6f6f6;
21
+ }
22
+ }
23
+ }
24
+
25
+ .inner-table-cell {
26
+ display: table-cell;
27
+ padding: 5px 10px;
28
+
29
+ &:not(:last-child) {
30
+ border-right: 1px dashed #e2e2e2;
31
+ }
32
  }
admin/scss/_partials/_inputs.scss CHANGED
@@ -1,48 +1,48 @@
1
- /* --------------------------------------------------
2
- Inputs
3
- -------------------------------------------------- */
4
-
5
- input[type="text"].long {
6
- width: 25em;
7
- }
8
-
9
- input[type="text"].medium {
10
- width: 18em;
11
- }
12
-
13
- .input-number {
14
- width: 5em;
15
- text-align: right;
16
- }
17
-
18
- .input-incremental {
19
- width: 5em;
20
- }
21
-
22
- .input-number-px {
23
- width: 4em;
24
- text-align: right;
25
- }
26
-
27
- .form-table select {
28
- vertical-align: baseline;
29
- }
30
-
31
- div.radio {
32
- line-height: 1.5em;
33
- padding: 0 5px;
34
- }
35
-
36
- label,
37
- .nolabel {
38
- vertical-align: baseline;
39
- display: inline-block;
40
- }
41
-
42
- label:hover {
43
- color: #000;
44
- }
45
-
46
- option:disabled {
47
- font-style: italic !important;
48
- }
1
+ /* --------------------------------------------------
2
+ Inputs
3
+ -------------------------------------------------- */
4
+
5
+ input[type="text"].long {
6
+ width: 25em;
7
+ }
8
+
9
+ input[type="text"].medium {
10
+ width: 18em;
11
+ }
12
+
13
+ .input-number {
14
+ width: 5em;
15
+ text-align: right;
16
+ }
17
+
18
+ .input-incremental {
19
+ width: 5em;
20
+ }
21
+
22
+ .input-number-px {
23
+ width: 4em;
24
+ text-align: right;
25
+ }
26
+
27
+ .form-table select {
28
+ vertical-align: baseline;
29
+ }
30
+
31
+ div.radio {
32
+ line-height: 1.5em;
33
+ padding: 0 5px;
34
+ }
35
+
36
+ label,
37
+ .nolabel {
38
+ vertical-align: baseline;
39
+ display: inline-block;
40
+ }
41
+
42
+ label:hover {
43
+ color: #000;
44
+ }
45
+
46
+ option:disabled {
47
+ font-style: italic !important;
48
+ }
admin/scss/_partials/_layout-example-columns.scss CHANGED
@@ -1,42 +1,42 @@
1
- /* --------------------------------------------------
2
- Columns
3
- -------------------------------------------------- */
4
-
5
- .view-layout-columns .example-container {
6
- padding-bottom: 15px;
7
- text-align: center;
8
-
9
- /* a minimum width fallback */
10
- -webkit-column-width: 25px;
11
- -moz-column-width: 25px;
12
- column-width: 25px;
13
-
14
- -webkit-column-gap: 10px;
15
- -moz-column-gap: 10px;
16
- column-gap: 10px;
17
-
18
- /* chrome does not repaint column-rule when switching classes in js :( */
19
- /*-webkit-column-rule: 1px dashed #999;*/
20
- /*-moz-column-rule: 1px dashed #999;*/
21
- /*column-rule: 1px dashed #999;*/
22
-
23
- -webkit-margin-bottom-collapse: separate;
24
-
25
- &.col-2 {
26
- -webkit-column-count: 2;
27
- -moz-column-count: 2;
28
- column-count: 2;
29
- }
30
-
31
- &.col-3 {
32
- -webkit-column-count: 3;
33
- -moz-column-count: 3;
34
- column-count: 3;
35
- }
36
-
37
- &.col-4 {
38
- -webkit-column-count: 4;
39
- -moz-column-count: 4;
40
- column-count: 4;
41
- }
42
- }
1
+ /* --------------------------------------------------
2
+ Columns
3
+ -------------------------------------------------- */
4
+
5
+ .view-layout-columns .example-container {
6
+ padding-bottom: 15px;
7
+ text-align: center;
8
+
9
+ /* a minimum width fallback */
10
+ -webkit-column-width: 25px;
11
+ -moz-column-width: 25px;
12
+ column-width: 25px;
13
+
14
+ -webkit-column-gap: 10px;
15
+ -moz-column-gap: 10px;
16
+ column-gap: 10px;
17
+
18
+ /* chrome does not repaint column-rule when switching classes in js :( */
19
+ /*-webkit-column-rule: 1px dashed #999;*/
20
+ /*-moz-column-rule: 1px dashed #999;*/
21
+ /*column-rule: 1px dashed #999;*/
22
+
23
+ -webkit-margin-bottom-collapse: separate;
24
+
25
+ &.col-2 {
26
+ -webkit-column-count: 2;
27
+ -moz-column-count: 2;
28
+ column-count: 2;
29
+ }
30
+
31
+ &.col-3 {
32
+ -webkit-column-count: 3;
33
+ -moz-column-count: 3;
34
+ column-count: 3;
35
+ }
36
+
37
+ &.col-4 {
38
+ -webkit-column-count: 4;
39
+ -moz-column-count: 4;
40
+ column-count: 4;
41
+ }
42
+ }
admin/scss/_partials/_layout-example-grid.scss CHANGED
@@ -1,33 +1,33 @@
1
- /* --------------------------------------------------
2
- Grid
3
- -------------------------------------------------- */
4
-
5
- .view-layout-grid .example-container {
6
- display: -webkit-flex;
7
- display: -ms-flexbox;
8
- display: flex;
9
-
10
- -webkit-flex-wrap: wrap;
11
- -ms-flex-wrap: wrap;
12
- flex-wrap: wrap;
13
-
14
- justify-content: space-between;
15
-
16
- .box {
17
- display: -webkit-flex;
18
- display: -ms-flexbox;
19
- display: flex;
20
- }
21
-
22
- &.col-2 .box {
23
- width: 47%;
24
- }
25
-
26
- &.col-3 .box {
27
- width: 29%;
28
- }
29
-
30
- &.col-4 .box {
31
- width: 21%;
32
- }
33
- }
1
+ /* --------------------------------------------------
2
+ Grid
3
+ -------------------------------------------------- */
4
+
5
+ .view-layout-grid .example-container {
6
+ display: -webkit-flex;
7
+ display: -ms-flexbox;
8
+ display: flex;
9
+
10
+ -webkit-flex-wrap: wrap;
11
+ -ms-flex-wrap: wrap;
12
+ flex-wrap: wrap;
13
+
14
+ justify-content: space-between;
15
+
16
+ .box {
17
+ display: -webkit-flex;
18
+ display: -ms-flexbox;
19
+ display: flex;
20
+ }
21
+
22
+ &.col-2 .box {
23
+ width: 47%;
24
+ }
25
+
26
+ &.col-3 .box {
27
+ width: 29%;
28
+ }
29
+
30
+ &.col-4 .box {
31
+ width: 21%;
32
+ }
33
+ }
admin/scss/_partials/_layout-example-masonry.scss CHANGED
@@ -1,22 +1,22 @@
1
- /* --------------------------------------------------
2
- Masonry
3
- -------------------------------------------------- */
4
-
5
- .view-layout-masonry .example-container {
6
- .box {
7
- width: 46%;
8
- }
9
-
10
- .grid-sizer,
11
- &.col-2 .grid-sizer {
12
- width: 46%;
13
- }
14
-
15
- &.col-3 .grid-sizer {
16
- width: 27.5%;
17
- }
18
-
19
- &.col-4 .grid-sizer {
20
- width: 19.5%;
21
- }
22
- }
1
+ /* --------------------------------------------------
2
+ Masonry
3
+ -------------------------------------------------- */
4
+
5
+ .view-layout-masonry .example-container {
6
+ .box {
7
+ width: 46%;
8
+ }
9
+
10
+ .grid-sizer,
11
+ &.col-2 .grid-sizer {
12
+ width: 46%;
13
+ }
14
+
15
+ &.col-3 .grid-sizer {
16
+ width: 27.5%;
17
+ }
18
+
19
+ &.col-4 .grid-sizer {
20
+ width: 19.5%;
21
+ }
22
+ }
admin/scss/_partials/_layout-examples.scss CHANGED
@@ -1,40 +1,40 @@
1
- /* --------------------------------------------------
2
- Examples
3
- -------------------------------------------------- */
4
-
5
- .example-container {
6
- background: white;
7
- border: 1px solid #ccc;
8
- box-sizing: border-box;
9
- padding: 15px 10px 5px;
10
- width: 170px;
11
-
12
- .box {
13
- background: #DDD;
14
- width: 100%;
15
- line-height: 30px;
16
- height: 30px;
17
- margin-bottom: 10px;
18
- text-align: center;
19
- /* to prevent overflowing margins */
20
- display: inline-block;
21
- position: relative;
22
- /* multi-column properties */
23
- -webkit-column-break-inside: avoid;
24
- page-break-inside: avoid;
25
- break-inside: avoid;
26
-
27
- span {
28
- display: block;
29
- margin: 0 auto;
30
- }
31
-
32
- &.size2 {
33
- height: 45px;
34
- }
35
-
36
- &.size3 {
37
- height: 60px;
38
- }
39
- }
40
- }
1
+ /* --------------------------------------------------
2
+ Examples
3
+ -------------------------------------------------- */
4
+
5
+ .example-container {
6
+ background: white;
7
+ border: 1px solid #ccc;
8
+ box-sizing: border-box;
9
+ padding: 15px 10px 5px;
10
+ width: 170px;
11
+
12
+ .box {
13
+ background: #DDD;
14
+ width: 100%;
15
+ line-height: 30px;
16
+ height: 30px;
17
+ margin-bottom: 10px;
18
+ text-align: center;
19
+ /* to prevent overflowing margins */
20
+ display: inline-block;
21
+ position: relative;
22
+ /* multi-column properties */
23
+ -webkit-column-break-inside: avoid;
24
+ page-break-inside: avoid;
25
+ break-inside: avoid;
26
+
27
+ span {
28
+ display: block;
29
+ margin: 0 auto;
30
+ }
31
+
32
+ &.size2 {
33
+ height: 45px;
34
+ }
35
+
36
+ &.size3 {
37
+ height: 60px;
38
+ }
39
+ }
40
+ }
admin/scss/_partials/_layout.scss CHANGED
@@ -1,15 +1,15 @@
1
- /* -------------------------------------------------
2
- Layout options
3
- ------------------------------------------------- */
4
-
5
- .layout-section {
6
- > div {
7
- // the examples
8
- &:last-child {
9
- flex: 0 0 auto;
10
- align-self: flex-start;
11
- margin-left: 10px;
12
- padding: 10px;
13
- }
14
- }
15
- }
1
+ /* -------------------------------------------------
2
+ Layout options
3
+ ------------------------------------------------- */
4
+
5
+ .layout-section {
6
+ > div {
7
+ // the examples
8
+ &:last-child {
9
+ flex: 0 0 auto;
10
+ align-self: flex-start;
11
+ margin-left: 10px;
12
+ padding: 10px;
13
+ }
14
+ }
15
+ }
admin/scss/_partials/_list-radio-buttons.scss CHANGED
@@ -1,133 +1,133 @@
1
- /* -------------------------------------------------
2
- List radio buttons
3
- ------------------------------------------------- */
4
-
5
- .section-radios {
6
- display: flex;
7
- justify-content: space-between;
8
-
9
- > div {
10
- &:first-child {
11
- flex: 0 0 15%;
12
- }
13
-
14
- &:nth-child(2) {
15
- flex: 1 1 auto; // magic
16
- background: $blue_bg;
17
- border-radius: 15px;
18
- }
19
- }
20
- }
21
-
22
-
23
- .radio-buttons {
24
- input[type=radio] {
25
- display: none;
26
-
27
- + label {
28
- border-radius: 15px 0 0 15px;
29
- line-height: 30px;
30
- margin-right: 15px;
31
-
32
- &:before {
33
- font-family: FontAwesome;
34
- display: inline-block;
35
- color: #999;
36
- text-align: center;
37
- // 30px wide would make it square and provide enough space before the test,
38
- // but we get 4px from new line in html,
39
- // so 20 wide + 5 left margin + 1 right margin + 4 new line = 30px
40
- font-size: 17px;
41
- margin-left: 5px;
42
- margin-right: 1px;
43
- width: 20px;
44
-
45
- /* unchecked icon */
46
- content: "\f10c";
47
- }
48
-
49
- &:hover:before {
50
- color: #FF8900;
51
- }
52
- }
53
-
54
- &:checked + label {
55
- &:before {
56
- /* checked icon */
57
- content: "\f192";
58
- color: $blue;
59
- }
60
-
61
- &:hover:before {
62
- color: $orange;
63
- }
64
- }
65
-
66
- &.error + label,
67
- &.error + label:before {
68
- color: red;
69
- }
70
-
71
- &:disabled + label {
72
- color: #AAA;
73
-
74
- &:before {
75
- color: #CCC;
76
- }
77
-
78
- &:hover {
79
- background: transparent;
80
- }
81
- }
82
-
83
- &:checked:disabled + label:hover {
84
- background: #EAF7FB;
85
- }
86
- }
87
- }
88
-
89
- ul.radio-list {
90
- margin: 15px 0;
91
-
92
- li {
93
- margin: 0;
94
-
95
- &.current-selection {
96
- label {
97
- background: $blue_bg;
98
- }
99
- }
100
-
101
- label {
102
- width: 100%;
103
- white-space: nowrap;
104
- }
105
- }
106
- }
107
-
108
- .radio-description {
109
- padding: 0 15px;
110
-
111
- p {
112
- margin: 15px 0 15px !important;
113
- }
114
- }
115
-
116
- .options {
117
- margin: 0 10px 15px 0;
118
-
119
- // inner div required
120
- > div {
121
- display: inline-block;
122
-
123
- > div {
124
- display: inline-block;
125
- width: 25%;
126
- }
127
- }
128
- }
129
-
130
- // Add margin to match <p>. Must be after `.options` rules.
131
- .description-inner {
132
- margin: 15px 0;
133
- }
1
+ /* -------------------------------------------------
2
+ List radio buttons
3
+ ------------------------------------------------- */
4
+
5
+ .section-radios {
6
+ display: flex;
7
+ justify-content: space-between;
8
+
9
+ > div {
10
+ &:first-child {
11
+ flex: 0 0 15%;
12
+ }
13
+
14
+ &:nth-child(2) {
15
+ flex: 1 1 auto; // magic
16
+ background: $blue_bg;
17
+ border-radius: 15px;
18
+ }
19
+ }
20
+ }
21
+
22
+
23
+ .radio-buttons {
24
+ input[type=radio] {
25
+ display: none;
26
+
27
+ + label {
28
+ border-radius: 15px 0 0 15px;
29
+ line-height: 30px;
30
+ margin-right: 15px;
31
+
32
+ &:before {
33
+ font-family: FontAwesome;
34
+ display: inline-block;
35
+ color: #999;
36
+ text-align: center;
37
+ // 30px wide would make it square and provide enough space before the test,
38
+ // but we get 4px from new line in html,
39
+ // so 20 wide + 5 left margin + 1 right margin + 4 new line = 30px
40
+ font-size: 17px;
41
+ margin-left: 5px;
42
+ margin-right: 1px;
43
+ width: 20px;
44
+
45
+ /* unchecked icon */
46
+ content: "\f10c";
47
+ }
48
+
49
+ &:hover:before {
50
+ color: #FF8900;
51
+ }
52
+ }
53
+
54
+ &:checked + label {
55
+ &:before {
56
+ /* checked icon */
57
+ content: "\f192";
58
+ color: $blue;
59
+ }
60
+
61
+ &:hover:before {
62
+ color: $orange;
63
+ }
64
+ }
65
+
66
+ &.error + label,
67
+ &.error + label:before {
68
+ color: red;
69
+ }
70
+
71
+ &:disabled + label {
72
+ color: #AAA;
73
+
74
+ &:before {
75
+ color: #CCC;
76
+ }
77
+
78
+ &:hover {
79
+ background: transparent;
80
+ }
81
+ }
82
+
83
+ &:checked:disabled + label:hover {
84
+ background: #EAF7FB;
85
+ }
86
+ }
87
+ }
88
+
89
+ ul.radio-list {
90
+ margin: 15px 0;
91
+
92
+ li {
93
+ margin: 0;
94
+
95
+ &.current-selection {
96
+ label {
97
+ background: $blue_bg;
98
+ }
99
+ }
100
+
101
+ label {
102
+ width: 100%;
103
+ white-space: nowrap;
104
+ }
105
+ }
106
+ }
107
+
108
+ .radio-description {
109
+ padding: 0 15px;
110
+
111
+ p {
112
+ margin: 15px 0 15px !important;
113
+ }
114
+ }
115
+
116
+ .options {
117
+ margin: 0 10px 15px 0;
118
+
119
+ // inner div required
120
+ > div {
121
+ display: inline-block;
122
+
123
+ > div {
124
+ display: inline-block;
125
+ width: 25%;
126
+ }
127
+ }
128
+ }
129
+
130
+ // Add margin to match <p>. Must be after `.options` rules.
131
+ .description-inner {
132
+ margin: 15px 0;
133
+ }
admin/scss/_partials/_misc.scss CHANGED
@@ -1,88 +1,88 @@
1
- /* -------------------------------------------------
2
- Misc.
3
- ------------------------------------------------- */
4
-
5
- #wpmtst-views-form input[type="submit"] {
6
- margin-right: 10px;
7
- }
8
-
9
- td.column-name strong {
10
- display: block;
11
- margin-bottom: .2em;
12
- font-size: 14px;
13
- }
14
-
15
- td.rowspan {
16
- border-left: 1px solid #DDD;
17
- }
18
-
19
- .subgroup {
20
- background: #f8f8f8;
21
- border: 1px solid #f1f1f1;
22
- padding: 0.25em 1em;
23
- margin-right: 1em;
24
- }
25
-
26
- .subgroup-heading {
27
- font-weight: 600;
28
- }
29
-
30
- .subgroup .subgroup-heading + .row-inner {
31
- margin-top: 5px;
32
- }
33
-
34
- .subgroup .row-inner {
35
- margin-bottom: 10px;
36
- }
37
-
38
- .min-width-1 {
39
- min-width: 152px;
40
- }
41
-
42
- .label-not-adjacent {
43
- margin-right: 0.3em;
44
- }
45
-
46
- .is-below {
47
- margin-top: 10px;
48
- }
49
-
50
- /* -------------------------------------------------
51
- Restore Default Breakpoints button
52
- ------------------------------------------------- */
53
-
54
- #restore-default-breakpoints {
55
- }
56
-
57
- #restored-message {
58
- opacity: 0;
59
- line-height: 26px;
60
- height: 26px;
61
- padding: 0 10px;
62
- margin: 1px 1em;
63
- display: inline-block;
64
- background: #00A4F3;
65
- color: #FFF;
66
- border-radius: 3px;
67
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
68
- position: relative;
69
- top: -1px;
70
- }
71
-
72
- #restored-message.copied {
73
- opacity: 0;
74
- will-change: opacity;
75
- animation: showcopied 2s ease;
76
- }
77
-
78
- @keyframes showcopied {
79
- 0% {
80
- opacity: 0;
81
- }
82
- 70% {
83
- opacity: 1;
84
- }
85
- 100% {
86
- opacity: 0;
87
- }
88
- }
1
+ /* -------------------------------------------------
2
+ Misc.
3
+ ------------------------------------------------- */
4
+
5
+ #wpmtst-views-form input[type="submit"] {
6
+ margin-right: 10px;
7
+ }
8
+
9
+ td.column-name strong {
10
+ display: block;
11
+ margin-bottom: .2em;
12
+ font-size: 14px;
13
+ }
14
+
15
+ td.rowspan {
16
+ border-left: 1px solid #DDD;
17
+ }
18
+
19
+ .subgroup {
20
+ background: #f8f8f8;
21
+ border: 1px solid #f1f1f1;
22
+ padding: 0.25em 1em;
23
+ margin-right: 1em;
24
+ }
25
+
26
+ .subgroup-heading {
27
+ font-weight: 600;
28
+ }
29
+
30
+ .subgroup .subgroup-heading + .row-inner {
31
+ margin-top: 5px;
32
+ }
33
+
34
+ .subgroup .row-inner {
35
+ margin-bottom: 10px;
36
+ }
37
+
38
+ .min-width-1 {
39
+ min-width: 152px;
40
+ }
41
+
42
+ .label-not-adjacent {
43
+ margin-right: 0.3em;
44
+ }
45
+
46
+ .is-below {
47
+ margin-top: 10px;
48
+ }
49
+
50
+ /* -------------------------------------------------
51
+ Restore Default Breakpoints button
52
+ ------------------------------------------------- */
53
+
54
+ #restore-default-breakpoints {
55
+ }
56
+
57
+ #restored-message {
58
+ opacity: 0;
59
+ line-height: 26px;
60
+ height: 26px;
61
+ padding: 0 10px;
62
+ margin: 1px 1em;
63
+ display: inline-block;
64
+ background: #00A4F3;
65
+ color: #FFF;
66
+ border-radius: 3px;
67
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
68
+ position: relative;
69
+ top: -1px;
70
+ }
71
+
72
+ #restored-message.copied {
73
+ opacity: 0;
74
+ will-change: opacity;
75
+ animation: showcopied 2s ease;
76
+ }
77
+
78
+ @keyframes showcopied {
79
+ 0% {
80
+ opacity: 0;
81
+ }
82
+ 70% {
83
+ opacity: 1;
84
+ }
85
+ 100% {
86
+ opacity: 0;
87
+ }
88
+ }
admin/scss/_partials/_screenshots.scss CHANGED
@@ -1,10 +1,10 @@
1
- .screenshot {
2
- margin: 10px;
3
-
4
- > div {
5
- display: inline-block;
6
- -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
7
- -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
8
- box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
9
- }
10
- }
1
+ .screenshot {
2
+ margin: 10px;
3
+
4
+ > div {
5
+ display: inline-block;
6
+ -webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
7
+ -moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
8
+ box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
9
+ }
10
+ }
admin/scss/_partials/_sticky-views.scss CHANGED
@@ -1,48 +1,48 @@
1
- /* --------------------------------------------------
2
- Views list table sticky
3
- -------------------------------------------------- */
4
-
5
- .wp-list-table-wrap {
6
- position: relative;
7
- }
8
-
9
- .stickit, .stickit:before {
10
- cursor: pointer;
11
- content: "\f154";
12
- display: inline-block;
13
- width: 20px;
14
- height: 20px;
15
- color: #aaa;
16
- font-size: 20px;
17
- line-height: 1;
18
- font-family: dashicons;
19
- text-decoration: inherit;
20
- font-weight: normal;
21
- font-style: normal;
22
- vertical-align: top;
23
- text-align: center;
24
- -webkit-transition: color .1s ease-in;
25
- transition: color .1s ease-in;
26
- -webkit-font-smoothing: antialiased;
27
- -moz-osx-font-smoothing: grayscale;
28
- }
29
-
30
- .stickit {
31
- &.stuck:before {
32
- content: "\f155";
33
- color: #0073aa;
34
- }
35
- &:hover:before {
36
- content: "\f155";
37
- color: #0096dd;
38
- }
39
- }
40
-
41
- .overlay {
42
- position: absolute;
43
- top: 0;
44
- left: 0;
45
- bottom: 0;
46
- right: 0;
47
- background: rgba(255, 255, 255, 0.7);
48
- }
1
+ /* --------------------------------------------------
2
+ Views list table sticky
3
+ -------------------------------------------------- */
4
+
5
+ .wp-list-table-wrap {
6
+ position: relative;
7
+ }
8
+
9
+ .stickit, .stickit:before {
10
+ cursor: pointer;
11
+ content: "\f154";
12
+ display: inline-block;
13
+ width: 20px;
14
+ height: 20px;
15
+ color: #aaa;
16
+ font-size: 20px;
17
+ line-height: 1;
18
+ font-family: dashicons;
19
+ text-decoration: inherit;
20
+ font-weight: normal;
21
+ font-style: normal;
22
+ vertical-align: top;
23
+ text-align: center;
24
+ -webkit-transition: color .1s ease-in;
25
+ transition: color .1s ease-in;
26
+ -webkit-font-smoothing: antialiased;
27
+ -moz-osx-font-smoothing: grayscale;
28
+ }
29
+
30
+ .stickit {
31
+ &.stuck:before {
32
+ content: "\f155";
33
+ color: #0073aa;
34
+ }
35
+ &:hover:before {
36
+ content: "\f155";
37
+ color: #0096dd;
38
+ }
39
+ }
40
+
41
+ .overlay {
42
+ position: absolute;
43
+ top: 0;
44
+ left: 0;
45
+ bottom: 0;
46
+ right: 0;
47
+ background: rgba(255, 255, 255, 0.7);
48
+ }
admin/scss/_partials/_structure.scss CHANGED
@@ -1,41 +1,41 @@
1
- /*-----------------------------------------------
2
- Structure
3
- -----------------------------------------------*/
4
-
5
- .clear {
6
- clear: both;
7
- }
8
-
9
- .table {
10
- display: table;
11
- }
12
-
13
- .table-row {
14
- display: table-row;
15
- }
16
-
17
- .table-cell {
18
- display: table-cell;
19
- vertical-align: top;
20
- }
21
-
22
- .option-wrap {
23
- margin-right: 2em;
24
- }
25
-
26
- .half-width {
27
- display: inline-block;
28
- box-sizing: border-box;
29
- width: 50%;
30
- float: left;
31
- }
32
-
33
- optgroup,
34
- optgroup option {
35
- font-family: inherit; // Firefox
36
- }
37
-
38
- .intro {
39
- margin-bottom: 2em;
40
- }
41
-
1
+ /*-----------------------------------------------
2
+ Structure
3
+ -----------------------------------------------*/
4
+
5
+ .clear {
6
+ clear: both;
7
+ }
8
+
9
+ .table {
10
+ display: table;
11
+ }
12
+
13
+ .table-row {
14
+ display: table-row;
15
+ }
16
+
17
+ .table-cell {
18
+ display