Strong Testimonials - Version 2.34

Version Description

Download this release

Release Info

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

Code changes from version 2.33 to 2.34

Files changed (130) hide show
  1. .gitignore +0 -26
  2. admin/about/addons.php +23 -31
  3. admin/about/class-strong-testimonials-about.php +100 -100
  4. admin/about/how-to.php +41 -41
  5. admin/about/links.php +17 -76
  6. admin/about/privacy.php +13 -13
  7. admin/about/whats-new.php +107 -107
  8. admin/admin-notices.php +182 -177
  9. admin/admin.php +297 -329
  10. admin/class-strong-testimonials-admin-category-list.php +69 -69
  11. admin/class-strong-testimonials-admin-list.php +323 -331
  12. admin/class-strong-testimonials-admin-scripts.php +443 -395
  13. admin/class-strong-testimonials-defaults.php +885 -882
  14. admin/class-strong-testimonials-help.php +277 -227
  15. admin/class-strong-testimonials-list-table.php +1212 -1147
  16. admin/class-strong-testimonials-page-shortcodes.php +336 -336
  17. admin/class-strong-testimonials-post-editor.php +367 -354
  18. admin/class-strong-testimonials-updater.php +1328 -1345
  19. admin/class-strong-views-list-table.php +231 -228
  20. admin/class-walker-strong-category-checklist.php +129 -127
  21. admin/class-walker-strong-form-category-checklist.php +129 -127
  22. admin/compat.php +117 -116
  23. admin/css/about.css +53 -53
  24. admin/css/admin-compat.css +178 -178
  25. admin/css/admin-form.css +138 -138
  26. admin/css/admin.css +822 -822
  27. admin/css/fields.css +317 -317
  28. admin/css/form-preview.css +135 -135
  29. admin/css/number-spinner.css +98 -98
  30. admin/css/order.css +102 -102
  31. admin/css/polylang.css +7 -7
  32. admin/css/post-editor.css +110 -110
  33. admin/css/views.css +1010 -1010
  34. admin/css/wpml.css +31 -31
  35. admin/custom-fields-ajax.php +99 -99
  36. admin/custom-fields.php +490 -492
  37. admin/form-preview.php +53 -51
  38. admin/js/addon-licenses.js +79 -79
  39. admin/js/admin-compat.js +130 -130
  40. admin/js/admin-fields.js +602 -602
  41. admin/js/admin-form.js +164 -164
  42. admin/js/admin-global.js +26 -26
  43. admin/js/admin-order.js +128 -128
  44. admin/js/admin.js +106 -106
  45. admin/js/custom-spinner.js +81 -81
  46. admin/js/help.js +22 -22
  47. admin/js/lib/are-you-sure/jquery.are-you-sure.js +192 -192
  48. admin/js/lib/autosize/autosize.min.js +5 -5
  49. admin/js/rating-edit.js +85 -85
  50. admin/js/view-category-filter.js +47 -47
  51. admin/js/views.js +1336 -1336
  52. admin/menu/class-strong-testimonials-menu-fields.php +55 -55
  53. admin/menu/class-strong-testimonials-menu-settings.php +57 -57
  54. admin/menu/class-strong-testimonials-menu-shortcodes.php +55 -55
  55. admin/menu/class-strong-testimonials-menu-views.php +55 -55
  56. admin/menu/class-strong-testimonials-menu.php +51 -51
  57. admin/partials/fields/field-controls.php +12 -12
  58. admin/partials/fields/field-header.php +13 -13
  59. admin/partials/fields/field-label.php +15 -15
  60. admin/partials/fields/field-name.php +23 -22
  61. admin/partials/fields/field-text.php +11 -14
  62. admin/partials/fields/field-type.php +74 -75
  63. admin/partials/templates/form-preview-template.php +27 -27
  64. admin/partials/views/group-compat.php +17 -17
  65. admin/partials/views/group-extra.php +24 -24
  66. admin/partials/views/group-fields.php +75 -75
  67. admin/partials/views/group-form.php +24 -24
  68. admin/partials/views/group-query.php +44 -44
  69. admin/partials/views/group-slideshow.php +30 -30
  70. admin/partials/views/group-style.php +51 -51
  71. admin/partials/views/option-background.php +151 -151
  72. admin/partials/views/option-boilerplate.php +39 -39
  73. admin/partials/views/option-category.php +56 -56
  74. admin/partials/views/option-classes.php +14 -14
  75. admin/partials/views/option-client-section.php +25 -29
  76. admin/partials/views/option-color.php +47 -57
  77. admin/partials/views/option-content.php +217 -217
  78. admin/partials/views/option-divi.php +23 -24
  79. admin/partials/views/option-form-ajax.php +12 -13
  80. admin/partials/views/option-form-category.php +28 -28
  81. admin/partials/views/option-id.php +23 -23
  82. admin/partials/views/option-layout.php +146 -147
  83. admin/partials/views/option-limit.php +31 -33
  84. admin/partials/views/option-order.php +26 -26
  85. admin/partials/views/option-pagination.php +145 -167
  86. admin/partials/views/option-read-more-page.php +86 -87
  87. admin/partials/views/option-select.php +29 -29
  88. admin/partials/views/option-slideshow-behavior.php +87 -93
  89. admin/partials/views/option-slideshow-breakpoints.php +81 -95
  90. admin/partials/views/option-slideshow-navigation.php +108 -104
  91. admin/partials/views/option-slideshow-num.php +8 -8
  92. admin/partials/views/option-slideshow-transition.php +42 -46
  93. admin/partials/views/option-slideshow-type.php +19 -19
  94. admin/partials/views/option-template-list.php +22 -22
  95. admin/partials/views/option-thumbnail.php +96 -91
  96. admin/partials/views/option-title.php +18 -20
  97. admin/partials/views/template-input.php +6 -8
  98. admin/partials/views/template-not-found.php +24 -25
  99. admin/partials/views/template-options.php +77 -78
  100. admin/partials/views/view-mode.php +17 -18
  101. admin/partials/views/view-name.php +16 -17
  102. admin/partials/views/view-shortcode.php +32 -32
  103. admin/scss/_partials/_background.scss +30 -30
  104. admin/scss/_partials/_category-checkboxes.scss +19 -19
  105. admin/scss/_partials/_category-filter.scss +58 -58
  106. admin/scss/_partials/_checkbox-icons.scss +52 -52
  107. admin/scss/_partials/_custom-fields.scss +169 -169
  108. admin/scss/_partials/_elements.scss +93 -93
  109. admin/scss/_partials/_form-table.scss +98 -98
  110. admin/scss/_partials/_help-tab.scss +50 -50
  111. admin/scss/_partials/_inner-table.scss +31 -31
  112. admin/scss/_partials/_inputs.scss +48 -48
  113. admin/scss/_partials/_layout-example-columns.scss +42 -42
  114. admin/scss/_partials/_layout-example-grid.scss +33 -33
  115. admin/scss/_partials/_layout-example-masonry.scss +22 -22
  116. admin/scss/_partials/_layout-examples.scss +40 -40
  117. admin/scss/_partials/_layout.scss +15 -15
  118. admin/scss/_partials/_list-radio-buttons.scss +139 -139
  119. admin/scss/_partials/_misc.scss +88 -88
  120. admin/scss/_partials/_screenshots.scss +10 -10
  121. admin/scss/_partials/_sticky-views.scss +48 -48
  122. admin/scss/_partials/_structure.scss +41 -41
  123. admin/scss/_partials/_template.scss +43 -43
  124. admin/scss/_partials/_view-info.scss +178 -178
  125. admin/scss/about.scss +76 -76
  126. admin/scss/admin-compat.scss +166 -166
  127. admin/scss/number-spinner.scss +107 -107
  128. admin/scss/post-editor.scss +111 -111
  129. admin/scss/views.scss +47 -47
  130. admin/settings/class-strong-testimonials-settings-compat.php +0 -54
.gitignore DELETED
@@ -1,26 +0,0 @@
1
- #################
2
- ## PhpStorm
3
- #################
4
-
5
- .idea
6
-
7
- #############
8
- ## Windows detritus
9
- #############
10
-
11
- # Windows image file caches
12
- Thumbs.db
13
- ehthumbs.db
14
-
15
- # Folder config file
16
- Desktop.ini
17
-
18
- # Recycle Bin used on file shares
19
- $RECYCLE.BIN/
20
-
21
- # Mac crap
22
- .DS_Store
23
-
24
- # Plugin logs
25
- strong-debug.log
26
- strong-testimonials.log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/about/addons.php CHANGED
@@ -1,31 +1,23 @@
1
- <hr />
2
-
3
- <h2><?php _e( 'Get More Features With Free Add-ons', 'strong-testimonials' ); ?></h2>
4
-
5
- <div id="addons" class="feature-section three-col">
6
- <div class="col sidebar-block sidebar-news addon multiple-forms">
7
- <h3>Multiple Forms</h3>
8
- <p>Need more forms for different products or services? No problem. Create unlimited forms.</p>
9
- <div class="actions">
10
- <a href="https://strongplugins.com/plugins/strong-testimonials-multiple-forms?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
11
- </div>
12
- </div>
13
- <div class="col sidebar-block sidebar-news addon properties">
14
- <h3>Properties</h3>
15
- <p>Want to rebrand 'testimonials' as 'reviews'? Want to completely customize the permalink structure? Gain maximum control.</p>
16
- <div class="actions">
17
- <a href="https://strongplugins.com/plugins/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
18
- &nbsp;&bull;&nbsp;
19
- <a href="https://strongdemos.com/strong-testimonials-properties/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
20
- </div>
21
- </div>
22
- <div class="col sidebar-block sidebar-news addon assignment">
23
- <h3>Assignment</h3>
24
- <p>Assign testimonials to any content type with features designed to simplify your workflow. Works well with portfolio, directory and service business themes.</p>
25
- <div class="actions">
26
- <a href="https://strongplugins.com/plugins/strong-testimonials-assignment?utm_source=plugin&utm_medium=about" target="_blank">Learn more</a>
27
- &nbsp;&bull;&nbsp;
28
- <a href="https://strongdemos.com/strong-testimonials-assignment/?utm_source=plugin&utm_medium=about" target="_blank">Go demo</a>
29
- </div>
30
- </div>
31
- </div>
1
+ <hr />
2
+
3
+ <!-- <div id="addons" class="feature-section three-col">
4
+ <div class="col sidebar-block sidebar-news addon multiple-forms">
5
+ <h3></h3>
6
+ <p></p>
7
+ <div class="actions">
8
+ <a href="" target="_blank">Learn more</a>
9
+ </div>
10
+ </div>
11
+ <div class="col sidebar-block sidebar-news addon properties">
12
+ <h3></h3>
13
+ <p></p>
14
+ <div class="actions">
15
+ </div>
16
+ </div>
17
+ <div class="col sidebar-block sidebar-news addon assignment">
18
+ <h3></h3>
19
+ <p></p>
20
+ <div class="actions">
21
+ </div>
22
+ </div>
23
+ </div> -->
 
 
 
 
 
 
 
 
admin/about/class-strong-testimonials-about.php CHANGED
@@ -1,100 +1,100 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_About
4
- *
5
- * @since 2.27.0
6
- */
7
- class Strong_Testimonials_About {
8
-
9
- /**
10
- * Strong_Testimonials_About constructor.
11
- */
12
- public function __construct() {
13
- $this->add_actions();
14
- }
15
-
16
- /**
17
- * Add actions and filters.
18
- */
19
- public function add_actions() {
20
- add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
- }
22
-
23
- /**
24
- * Add submenu page.
25
- *
26
- * @param $pages
27
- *
28
- * @return mixed
29
- */
30
- public function add_submenu( $pages ) {
31
- $pages[90] = $this->get_submenu();
32
- return $pages;
33
- }
34
-
35
- /**
36
- * Return submenu page parameters.
37
- *
38
- * @return array
39
- */
40
- public function get_submenu() {
41
- return array(
42
- 'page_title' => __( 'About' ),
43
- 'menu_title' => __( 'About' ),
44
- 'capability' => 'strong_testimonials_about',
45
- 'menu_slug' => 'about-strong-testimonials',
46
- 'function' => array( $this, 'about_page' ),
47
- );
48
- }
49
-
50
- /**
51
- * Print the About page.
52
- */
53
- public function about_page() {
54
- $major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
55
- $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
56
- $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
57
- ?>
58
- <div class="wrap about-wrap">
59
-
60
- <?php /* translators: %s is the plugin version number */ ?>
61
- <h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), $major_minor ); ?></h1>
62
-
63
- <p class="about-text">
64
- <?php _e( 'Thank you for updating to the latest version!' ); ?>
65
- <?php /* translators: %s is the plugin version number */ ?>
66
- </p>
67
-
68
- <div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
69
-
70
- <h2 class="nav-tab-wrapper wp-clearfix">
71
-
72
- <a href="<?php echo add_query_arg( 'tab', 'how-to', $url ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php _e( 'How To', 'strong-testimonials' ); ?></a>
73
-
74
- <a href="<?php echo add_query_arg( 'tab', 'privacy', $url ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Privacy' ); ?></a>
75
-
76
- </h2>
77
-
78
-
79
- <?php
80
- switch( $active_tab ) {
81
- case 'privacy':
82
- include WPMTST_ADMIN . 'about/privacy.php';
83
- break;
84
- default:
85
- include WPMTST_ADMIN . 'about/how-to.php';
86
- break;
87
- }
88
-
89
- include WPMTST_ADMIN. 'about/links.php';
90
- include WPMTST_ADMIN. 'about/addons.php';
91
- ?>
92
-
93
- </div>
94
- <?php
95
- }
96
-
97
-
98
- }
99
-
100
- new Strong_Testimonials_About();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_About
4
+ *
5
+ * @since 2.27.0
6
+ */
7
+ class Strong_Testimonials_About {
8
+
9
+ /**
10
+ * Strong_Testimonials_About constructor.
11
+ */
12
+ public function __construct() {
13
+ $this->add_actions();
14
+ }
15
+
16
+ /**
17
+ * Add actions and filters.
18
+ */
19
+ public function add_actions() {
20
+ add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );
21
+ }
22
+
23
+ /**
24
+ * Add submenu page.
25
+ *
26
+ * @param $pages
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function add_submenu( $pages ) {
31
+ $pages[90] = $this->get_submenu();
32
+ return $pages;
33
+ }
34
+
35
+ /**
36
+ * Return submenu page parameters.
37
+ *
38
+ * @return array
39
+ */
40
+ public function get_submenu() {
41
+ return array(
42
+ 'page_title' => __( 'About' ),
43
+ 'menu_title' => __( 'About' ),
44
+ 'capability' => 'strong_testimonials_about',
45
+ 'menu_slug' => 'about-strong-testimonials',
46
+ 'function' => array( $this, 'about_page' ),
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Print the About page.
52
+ */
53
+ public function about_page() {
54
+ $major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
55
+ $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
56
+ $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
57
+ ?>
58
+ <div class="wrap about-wrap">
59
+
60
+ <?php /* translators: %s is the plugin version number */ ?>
61
+ <h1><?php printf( esc_html__( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), esc_html( $major_minor ) ); ?></h1>
62
+
63
+ <p class="about-text">
64
+ <?php esc_html_e( 'Thank you for updating to the latest version!' ); ?>
65
+ <?php /* translators: %s is the plugin version number */ ?>
66
+ </p>
67
+
68
+ <div class="wp-badge strong-testimonials"><?php printf( esc_html__( 'Version %s' ), esc_html( $major_minor ) ); ?></div>
69
+
70
+ <h2 class="nav-tab-wrapper wp-clearfix">
71
+
72
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'how-to', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'how-to' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'How To', 'strong-testimonials' ); ?></a>
73
+
74
+ <a href="<?php echo esc_url( add_query_arg( 'tab', 'privacy', $url ) ); ?>" class="nav-tab <?php echo $active_tab == 'privacy' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Privacy' ); ?></a>
75
+
76
+ </h2>
77
+
78
+
79
+ <?php
80
+ switch ( $active_tab ) {
81
+ case 'privacy':
82
+ include WPMTST_ADMIN . 'about/privacy.php';
83
+ break;
84
+ default:
85
+ include WPMTST_ADMIN . 'about/how-to.php';
86
+ break;
87
+ }
88
+
89
+ include WPMTST_ADMIN . 'about/links.php';
90
+ include WPMTST_ADMIN . 'about/addons.php';
91
+ ?>
92
+
93
+ </div>
94
+ <?php
95
+ }
96
+
97
+
98
+ }
99
+
100
+ new Strong_Testimonials_About();
admin/about/how-to.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
- ?>
4
- <h2><?php _e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
- <p class="lead-description"><?php _e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
-
7
- <div class="feature-section two-col">
8
- <div class="col">
9
- <h3><?php _e('How to Add the Form', 'strong-testimonials' ); ?></h3>
10
- <p>1. <?php printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ); ?>
11
- </p>
12
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
13
- <?php _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ); ?>
14
- </p>
15
- <p>3. <?php echo $add_the_view; ?></p>
16
- </div>
17
-
18
- <div class="col">
19
- <h3><?php _e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
21
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
22
- <?php _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ); ?>
23
- </p>
24
- <p>3. <?php echo $add_the_view; ?></p>
25
- </div>
26
-
27
- <div class="col">
28
- <h3><?php _e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
- <p>1. <?php printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial' ) ); ?></p>
30
- <p>2. <?php printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ); ?>
31
- <?php _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ); ?>
32
- </p>
33
- <p>3. <?php echo $add_the_view; ?></p>
34
- </div>
35
-
36
- <div class="col">
37
- <h3><?php _e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
- <p><?php _e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
- <p><?php _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ); ?></p>
40
- </div>
41
- </div>
1
+ <?php
2
+ $add_the_view = __( 'Add the view to a page or sidebar using its unique shortcode or the Strong Testimonials widget.', 'strong-testimonials' );
3
+ ?>
4
+ <h2><?php esc_html_e( 'Let\'s Get Started', 'strong-testimonials' ); ?></h2>
5
+ <p class="lead-description"><?php esc_html_e( 'This plugin is different than others you may have tried.', 'strong-testimonials' ); ?></p>
6
+
7
+ <div class="feature-section two-col">
8
+ <div class="col">
9
+ <h3><?php esc_html_e( 'How to Add the Form', 'strong-testimonials' ); ?></h3>
10
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Check the custom fields</a>. The default set of fields are designed to suit most situations. Add or remove fields as you see fit.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' ) ) ) ); ?>
11
+ </p>
12
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
13
+ <?php wp_kses_post( _e( 'Select <strong>Form</strong> mode.', 'strong-testimonials' ) ); ?>
14
+ </p>
15
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
16
+ </div>
17
+
18
+ <div class="col">
19
+ <h3><?php esc_html_e( 'How to Display Your Testimonials', 'strong-testimonials' ); ?></h3>
20
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
21
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
22
+ <?php wp_kses_post( _e( 'Select <strong>Display</strong> mode.', 'strong-testimonials' ) ); ?>
23
+ </p>
24
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
25
+ </div>
26
+
27
+ <div class="col">
28
+ <h3><?php esc_html_e( 'How to Add a Slideshow', 'strong-testimonials' ); ?></h3>
29
+ <p>1. <?php wp_kses_post( printf( __( '<a href="%s">Enter your testimonials</a> if necessary. The plugin will not read existing testimonials from another plugin or theme. It will not import testimonials.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial' ) ) ) ); ?></p>
30
+ <p>2. <?php wp_kses_post( printf( __( 'Create a <a href="%s">view</a>.', 'strong-testimonials' ), esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ) ) ); ?>
31
+ <?php wp_kses_post( _e( 'Select <strong>Slideshow</strong> mode.', 'strong-testimonials' ) ); ?>
32
+ </p>
33
+ <p>3. <?php echo esc_html( $add_the_view ); ?></p>
34
+ </div>
35
+
36
+ <div class="col">
37
+ <h3><?php esc_html_e( 'How to Translate', 'strong-testimonials' ); ?></h3>
38
+ <p><?php esc_html_e( 'Strong Testimonials is compatible with WPML, Polylang and WP Globus.', 'strong-testimonials' ); ?></p>
39
+ <p><?php wp_kses_post( _e( 'In WPML and Polylang, domains are added to the <strong>String Translation</strong> pages. Those domains encompass the form fields, the form messages, the notification email, and the "Read more" link text in your views. They are updated automatically when any of those settings change.', 'strong-testimonials' ) ); ?></p>
40
+ </div>
41
+ </div>
admin/about/links.php CHANGED
@@ -1,76 +1,17 @@
1
- <hr />
2
-
3
- <div class="feature-section three-col">
4
- <div class="col">
5
- <h3><?php _e( 'Support', 'strong-testimonials' ); ?></h3>
6
- <?php
7
- $links = array();
8
-
9
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
10
- esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ),
11
- __( 'Use the community support forum', 'strong-testimonials' ) );
12
-
13
- ?>
14
- <ul>
15
- <?php foreach ( $links as $link ) : ?>
16
- <li><?php echo $link; ?></li>
17
- <?php endforeach; ?>
18
- </ul>
19
- </div>
20
-
21
- <div class="col">
22
- <h3><?php _e( 'Tutorials', 'strong-testimonials' ); ?></h3>
23
- <?php
24
- $links = array();
25
-
26
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
27
- esc_url( 'https://strongplugins.com/document/strong-testimonials/troubleshooting/' ),
28
- __( 'Troubleshooting', 'strong-testimonials' ) );
29
-
30
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
31
- esc_url( 'https://strongplugins.com/document/strong-testimonials/embed-social-media/' ),
32
- __( 'How to add YouTube or Twitter', 'strong-testimonials' ) );
33
-
34
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
35
- esc_url( 'https://strongplugins.com/document/strong-testimonials/custom-css/' ),
36
- __( 'Using custom CSS', 'strong-testimonials' ) );
37
-
38
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
39
- esc_url( 'https://strongplugins.com/document/strong-testimonials/enable-comments/' ),
40
- __( 'How to enable comments', 'strong-testimonials' ) );
41
-
42
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
43
- esc_url( 'https://strongplugins.com/document/strong-testimonials/complete-example-customizing-form/' ),
44
- __( 'How to customize the form', 'strong-testimonials' ) );
45
- ?>
46
- <ul>
47
- <?php foreach ( $links as $link ) : ?>
48
- <li><?php echo $link; ?></li>
49
- <?php endforeach; ?>
50
- </ul>
51
- </div>
52
-
53
- <div class="col">
54
- <h3><?php _e( 'Demos', 'strong-testimonials' ); ?></h3>
55
- <?php
56
- $links = array();
57
-
58
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
59
- esc_url( 'https://strongdemos.com/strong-testimonials/display-examples/' ),
60
- __( 'Display examples', 'strong-testimonials' ) );
61
-
62
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
63
- esc_url( 'https://strongdemos.com/strong-testimonials/slideshow-examples/' ),
64
- __( 'Slideshow examples', 'strong-testimonials' ) );
65
-
66
- $links[] = sprintf( '<a href="%s" target="_blank">%s</a>',
67
- esc_url( 'https://strongdemos.com/strong-testimonials/form-examples/' ),
68
- __( 'Form examples', 'strong-testimonials' ) );
69
- ?>
70
- <ul>
71
- <?php foreach ( $links as $link ) : ?>
72
- <li><?php echo $link; ?></li>
73
- <?php endforeach; ?>
74
- </ul>
75
- </div>
76
- </div>
1
+ <hr />
2
+
3
+ <div class="feature-section three-col">
4
+ <div class="col">
5
+ <h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
6
+ <?php
7
+ $links = array();
8
+ $links[] = sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( 'http://wordpress.org/support/plugin/strong-testimonials' ), __( 'Use the community support forum', 'strong-testimonials' ) );
9
+ ?>
10
+ <ul>
11
+ <?php foreach ( $links as $link ) : ?>
12
+ <li><?php echo wp_kses_post( $link ); ?></li>
13
+ <?php endforeach; ?>
14
+ </ul>
15
+ </div>
16
+
17
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/about/privacy.php CHANGED
@@ -1,13 +1,13 @@
1
- <h2><?php _e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
- <p class="lead-description"><?php _e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
- <div class="feature-section one-col">
4
- <div class="col">
5
- <p><?php _e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
- <p><?php _e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
- <p><strong><?php _e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
- <p><?php _e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
- <p><?php _e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
- <p><?php _e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
- <p><?php _e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
- </div>
13
- </div>
1
+ <h2><?php esc_html_e( 'Privacy and GDPR', 'strong-testimonials' ); ?></h2>
2
+ <p class="lead-description"><?php esc_html_e( 'Compliance is entirely in your control.', 'strong-testimonials' ); ?></p>
3
+ <div class="feature-section one-col">
4
+ <div class="col">
5
+ <p><?php esc_html_e( 'By default, this plugin does not store any user or visitor data, does not send any data to remote servers, act as a service or embed content, does not edit the comments form in any way.', 'strong-testimonials' ); ?></p>
6
+ <p><?php esc_html_e( 'The plugin also prevents displaying email addresses in your testimonials on the front end.', 'strong-testimonials' ); ?></p>
7
+ <p><strong><?php esc_html_e( 'However, this plugin provides features that may involve private data.', 'strong-testimonials' ); ?></strong></p>
8
+ <p><?php esc_html_e( 'If you use the testimonial submission form, the data collected on that form will be stored in your database.', 'strong-testimonials' ); ?></p>
9
+ <p><?php esc_html_e( 'If you enable the administrator notification email upon new testimonial submission, the data collected on your form, at your selection, may be included in that notification email.', 'strong-testimonials' ); ?></p>
10
+ <p><?php esc_html_e( 'If you enable comments on testimonials, the plugin will use your theme\'s single post template and comment form.', 'strong-testimonials' ); ?></p>
11
+ <p><?php esc_html_e( 'If you embed third-party posts such as Twitter, YouTube and FaceBook in your testimonials, you will be agreeing to the Terms of Use of those third-party sites.', 'strong-testimonials' ); ?></p>
12
+ </div>
13
+ </div>
admin/about/whats-new.php CHANGED
@@ -1,107 +1,107 @@
1
-
2
- <h2>Now Even Stronger</h2>
3
-
4
- <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
-
6
- <div class="feature-section one-col">
7
- <div class="col">
8
- <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
- </div>
10
- </div>
11
-
12
- <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
-
14
- <div class="feature-section one-col">
15
- <div class="col">
16
- <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
- <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
- <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
- <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
- <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
- <div class="feature-section-sub">
22
-
23
- <h3 class="heading">Point Releases</h3>
24
-
25
- <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
-
27
- <ul>
28
- <li>Version 2.31.1</li>
29
- <li>Version 2.31.2</li>
30
- <li>Version 2.31.3</li>
31
- <li>Version 2.31.4</li>
32
- <li>Version 2.31.5</li>
33
- <li>Version 2.31.6</li>
34
- <li>Version 2.31.7</li>
35
- <li>Version 2.31.8</li>
36
- <li>Version 2.31.9</li>
37
- <li>Version 2.31.10</li>
38
- </ul>
39
-
40
- </div>
41
- </div>
42
- </div>
43
-
44
- <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
-
46
- <div class="feature-section one-col">
47
- <div class="col">
48
- <p>NEW: Option to select the font color in views. Finally!</p>
49
- <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
- <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
- <p>NEW: Using the WordPress email validation function for increased security.</p>
52
- <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
- <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
- <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
- <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
- <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
-
58
- <div class="feature-section-sub">
59
-
60
- <h3 class="heading">Point Releases</h3>
61
-
62
- <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
-
64
- <ul>
65
- <li>Version 2.30.1</li>
66
- <li>Version 2.30.2</li>
67
- <li>Version 2.30.3</li>
68
- <li>Version 2.30.4</li>
69
- <li>Version 2.30.5</li>
70
- <li>Version 2.30.6</li>
71
- <li>Version 2.30.7</li>
72
- <li>Version 2.30.8</li>
73
- <li>Version 2.30.9</li>
74
- </ul>
75
-
76
- </div>
77
- </div>
78
- </div>
79
-
80
- <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
-
82
- <div class="feature-section one-col">
83
- <div class="col">
84
- <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
- <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
- <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
- <p>FIXED: The notification email now displays a category name properly.</p>
88
- <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
- <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
- <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
- </div>
92
- </div>
93
-
94
- <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
-
96
- <div class="feature-section one-col">
97
- <div class="col">
98
- <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
- <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
- <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
- <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
- <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
- <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
- <p>FIXED: Capabilities check in multisite.</p>
105
- <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
- </div>
107
- </div>
1
+
2
+ <h2>Now Even Stronger</h2>
3
+
4
+ <p class="lead-description">Version 2.32 adds the number one requested feature: Carousel</p>
5
+
6
+ <div class="feature-section one-col">
7
+ <div class="col">
8
+ <p>NEW: Show 2 or 3 slides at the same time. Finally!</p>
9
+ </div>
10
+ </div>
11
+
12
+ <p class="lead-description">Version 2.31 adds a highly requested feature and improves compatibility.</p>
13
+
14
+ <div class="feature-section one-col">
15
+ <div class="col">
16
+ <p>NEW: Display your average rating with the <code>&#91;testimonial_average_rating&#93;</code> shortcode. Finally!</p>
17
+ <p>NEW: Use the Load Event option to potentially fix problems with sliders and Masonry in complex themes.</p>
18
+ <p>NEW: Use the Lazy Loading option to potentially fix problems with testimonial images being cut off.</p>
19
+ <p>IMPROVED: The star ratings now use an empty star instead of a gray full star. This is the more popular approach.</p>
20
+ <p>IMPROVED: Minor style tweaks in both admin and some templates for small screens.</p>
21
+ <div class="feature-section-sub">
22
+
23
+ <h3 class="heading">Point Releases</h3>
24
+
25
+ <p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
26
+
27
+ <ul>
28
+ <li>Version 2.31.1</li>
29
+ <li>Version 2.31.2</li>
30
+ <li>Version 2.31.3</li>
31
+ <li>Version 2.31.4</li>
32
+ <li>Version 2.31.5</li>
33
+ <li>Version 2.31.6</li>
34
+ <li>Version 2.31.7</li>
35
+ <li>Version 2.31.8</li>
36
+ <li>Version 2.31.9</li>
37
+ <li>Version 2.31.10</li>
38
+ </ul>
39
+
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <p class="lead-description">Version 2.30 adds highly requested features, improves compatibility and fixes bugs.</p>
45
+
46
+ <div class="feature-section one-col">
47
+ <div class="col">
48
+ <p>NEW: Option to select the font color in views. Finally!</p>
49
+ <p>NEW: Option to add a CSS class to the image for lightboxes.</p>
50
+ <p>NEW: Certain shortcode attributes will override view settings. This allows views to serve as reusable patterns.</p>
51
+ <p>NEW: Using the WordPress email validation function for increased security.</p>
52
+ <p>NEW: Using the WordPress number format function in the &#91;testimonial_count&#93; shortcode so the thousands separator will be properly localized.</p>
53
+ <p>IMPROVED: Templates were completely reorganized to consolidate options and prepare for future features.</p>
54
+ <p>IMPROVED: Simplified slideshow CSS will make adding custom CSS simpler.</p>
55
+ <p>NEW: Option to disable touch swipe navigation to improve slideshow behavior on mobile devices.</p>
56
+ <p>FIXED: An intermittent bug in the slideshow in Chrome.</p>
57
+
58
+ <div class="feature-section-sub">
59
+
60
+ <h3 class="heading">Point Releases</h3>
61
+
62
+ <p>Bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
63
+
64
+ <ul>
65
+ <li>Version 2.30.1</li>
66
+ <li>Version 2.30.2</li>
67
+ <li>Version 2.30.3</li>
68
+ <li>Version 2.30.4</li>
69
+ <li>Version 2.30.5</li>
70
+ <li>Version 2.30.6</li>
71
+ <li>Version 2.30.7</li>
72
+ <li>Version 2.30.8</li>
73
+ <li>Version 2.30.9</li>
74
+ </ul>
75
+
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <p class="lead-description">Version 2.29 improves Captcha options and fixes two bugs.</p>
81
+
82
+ <div class="feature-section one-col">
83
+ <div class="col">
84
+ <p>NEW: Integration with Google Captcha by BestWebSoft. This allows use of either Invisible reCaptcha and reCatpcha V2, both excellent choices for modern spam warfare.</p>
85
+ <p>REMOVED: Integration with the plugin Captcha due to security issues.</p>
86
+ <p>REMOVED: Integration with the plugin Advanced noCaptcha reCaptcha due to compatibility issues and inadequate maintenance.</p>
87
+ <p>FIXED: The notification email now displays a category name properly.</p>
88
+ <p>IMPROVED: The notification settings UI was improved to make it easier to add your custom fields to the notification email.</p>
89
+ <p>NEW: A new filter on the "Read more" page for total control over that link.</p>
90
+ <p>FIXED: A conflict with Cherry Slider that made the slideshow invisible.</p>
91
+ </div>
92
+ </div>
93
+
94
+ <p class="lead-description">Version 2.28 improves compatibility and adds some new features.</p>
95
+
96
+ <div class="feature-section one-col">
97
+ <div class="col">
98
+ <p>NEW: Compatibility settings for sites that use Ajax page loading via theme or plugin.</p>
99
+ <p>NEW: Views using simple pagination now provide a subtle transition effect.</p>
100
+ <p>NEW: Standard pagination options including Previous/Next links and condensed navigation.</p>
101
+ <p>IMPROVED: A JavaScript controller to coordinate multiple components like slideshows and paginated views.</p>
102
+ <p>IMPROVED: The slider and pager scripts were refactored to improve performance. <strong style="color: #8224E3;">Clear your caches!</strong></p>
103
+ <p>FIXED: Bug where standard pagination failed to include a trailing slash.</p>
104
+ <p>FIXED: Capabilities check in multisite.</p>
105
+ <p>IMPROVED: Many functions were refactored into classes to improve performance and future development.</p>
106
+ </div>
107
+ </div>
admin/admin-notices.php CHANGED
@@ -1,177 +1,182 @@
1
- <?php
2
- /**
3
- * Admin notices
4
- */
5
-
6
-
7
- /**
8
- * Dismiss persistent notices.
9
- *
10
- * @since 2.29.0
11
- */
12
- function wpmtst_dismiss_notice_ajax() {
13
- if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
- echo 0;
15
- wp_die();
16
- }
17
-
18
- check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
- wpmtst_delete_admin_notice( $_POST['key'] );
20
- wp_die();
21
- }
22
-
23
- add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
-
25
- /**
26
- * Print admin notices.
27
- *
28
- * @since 2.24.0
29
- */
30
- function wpmtst_admin_notices() {
31
- $notices = get_option( 'wpmtst_admin_notices' );
32
- if ( ! $notices ) {
33
- return;
34
- }
35
-
36
- foreach ( $notices as $key => $notice ) {
37
- $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
- if ( $message ) {
39
- echo $message;
40
- }
41
- if ( ! $notice['persist'] ) {
42
- wpmtst_delete_admin_notice( $key );
43
- }
44
- }
45
- }
46
- add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
-
48
-
49
- /**
50
- * Return specific admin notice text.
51
- *
52
- * @since 2.28.5
53
- * @param string $html
54
- * @param $key
55
- *
56
- * @return string
57
- */
58
- function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
-
60
- switch ( $key ) {
61
- case 'defaults-restored' :
62
- ob_start();
63
- ?>
64
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
65
- <p>
66
- <?php _e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
- </p>
68
- </div>
69
- <?php
70
- $html = ob_get_clean();
71
- break;
72
-
73
- case 'fields-saved' :
74
- ob_start();
75
- ?>
76
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
77
- <p>
78
- <?php _e( 'Fields saved.', 'strong-testimonials' ); ?>
79
- </p>
80
- </div>
81
- <?php
82
- $html = ob_get_clean();
83
- break;
84
-
85
- case 'changes-cancelled' :
86
- ob_start();
87
- ?>
88
- <div class="wpmtst notice notice-success is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
89
- <p>
90
- <?php _e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
- </p>
92
- </div>
93
- <?php
94
- $html = ob_get_clean();
95
- break;
96
-
97
- case 'captcha-options-changed' :
98
- $tags = array( 'a' => array( 'class' => array(), 'href' => array() ) );
99
- //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
100
- $settings_url = admin_url( '?action=captcha-options-changed' );
101
- $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%s">%s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
102
-
103
- ob_start();
104
- ?>
105
- <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php esc_attr_e( $key ); ?>">
106
- <p>
107
- <?php _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ); ?>
108
- <?php echo $settings_link; ?>
109
- </p>
110
- </div>
111
- <?php
112
- $html = ob_get_clean();
113
- break;
114
-
115
- default :
116
- // nothing
117
- }
118
-
119
- return $html;
120
- }
121
- add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
122
-
123
-
124
- /**
125
- * Add admin notice to queue.
126
- *
127
- * @since 2.24.0
128
- *
129
- * @param $key
130
- * @param $persist
131
- */
132
- function wpmtst_add_admin_notice( $key, $persist = false ) {
133
- $notices = get_option( 'wpmtst_admin_notices', array() );
134
- $notices[ $key ] = array( 'persist' => $persist );
135
- update_option( 'wpmtst_admin_notices', $notices );
136
- }
137
-
138
-
139
- /**
140
- * Delete admin notice from queue.
141
- *
142
- * @since 2.24.0
143
- *
144
- * @param $key
145
- */
146
- function wpmtst_delete_admin_notice( $key ) {
147
- $notices = get_option( 'wpmtst_admin_notices', array() );
148
- unset( $notices[ $key ] );
149
- update_option( 'wpmtst_admin_notices', $notices );
150
- }
151
-
152
-
153
- /**
154
- * Automatically dismiss specific notices when settings are saved.
155
- *
156
- * @since 2.29.0
157
- * @param $option
158
- * @param $old_value
159
- * @param $value
160
- */
161
- function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
162
- if ( ! function_exists( 'get_current_screen' ) ) {
163
- return;
164
- }
165
-
166
- $screen = get_current_screen();
167
- if ( $screen && 'options' == $screen->base ) {
168
- if ( 'wpmtst_form_options' == $option ) {
169
- $notices = get_option( 'wpmtst_admin_notices', array() );
170
- if ( isset( $notices['captcha-options-changed'] ) ) {
171
- unset( $notices['captcha-options-changed'] );
172
- update_option( 'wpmtst_admin_notices', $notices );
173
- }
174
- }
175
- }
176
- }
177
- add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin notices
4
+ */
5
+
6
+
7
+ /**
8
+ * Dismiss persistent notices.
9
+ *
10
+ * @since 2.29.0
11
+ */
12
+ function wpmtst_dismiss_notice_ajax() {
13
+ if ( ! isset( $_POST['key'] ) || ! $_POST['key'] ) {
14
+ echo 0;
15
+ wp_die();
16
+ }
17
+
18
+ check_ajax_referer( 'wpmtst-admin', 'nonce' );
19
+ wpmtst_delete_admin_notice( $_POST['key'] );
20
+ wp_die();
21
+ }
22
+
23
+ add_action( 'wp_ajax_wpmtst_dismiss_notice', 'wpmtst_dismiss_notice_ajax' );
24
+
25
+ /**
26
+ * Print admin notices.
27
+ *
28
+ * @since 2.24.0
29
+ */
30
+ function wpmtst_admin_notices() {
31
+ $notices = get_option( 'wpmtst_admin_notices' );
32
+ if ( ! $notices ) {
33
+ return;
34
+ }
35
+
36
+ foreach ( $notices as $key => $notice ) {
37
+ $message = apply_filters( 'wpmtst_admin_notice', '', $key );
38
+ if ( $message ) {
39
+ echo wp_kses_post( $message );
40
+ }
41
+ if ( ! $notice['persist'] ) {
42
+ wpmtst_delete_admin_notice( $key );
43
+ }
44
+ }
45
+ }
46
+ add_action( 'admin_notices', 'wpmtst_admin_notices' );
47
+
48
+
49
+ /**
50
+ * Return specific admin notice text.
51
+ *
52
+ * @since 2.28.5
53
+ * @param string $html
54
+ * @param $key
55
+ *
56
+ * @return string
57
+ */
58
+ function wpmtst_admin_notice_text( $html = '', $key, $persist = false ) {
59
+
60
+ switch ( $key ) {
61
+ case 'defaults-restored':
62
+ ob_start();
63
+ ?>
64
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
65
+ <p>
66
+ <?php esc_html_e( 'Defaults restored.', 'strong-testimonials' ); ?>
67
+ </p>
68
+ </div>
69
+ <?php
70
+ $html = ob_get_clean();
71
+ break;
72
+
73
+ case 'fields-saved':
74
+ ob_start();
75
+ ?>
76
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
77
+ <p>
78
+ <?php esc_html_e( 'Fields saved.', 'strong-testimonials' ); ?>
79
+ </p>
80
+ </div>
81
+ <?php
82
+ $html = ob_get_clean();
83
+ break;
84
+
85
+ case 'changes-cancelled':
86
+ ob_start();
87
+ ?>
88
+ <div class="wpmtst notice notice-success is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
89
+ <p>
90
+ <?php esc_html_e( 'Changes cancelled.', 'strong-testimonials' ); ?>
91
+ </p>
92
+ </div>
93
+ <?php
94
+ $html = ob_get_clean();
95
+ break;
96
+
97
+ case 'captcha-options-changed':
98
+ $tags = array(
99
+ 'a' => array(
100
+ 'class' => array(),
101
+ 'href' => array(),
102
+ ),
103
+ );
104
+ //$settings_url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' );
105
+ $settings_url = admin_url( '?action=captcha-options-changed' );
106
+ $settings_link = sprintf( wp_kses( __( 'Please check your <a href="%1$s">%2$s</a>.', 'strong-testimonials' ), $tags ), esc_url( $settings_url ), __( 'settings', 'strong-testimonials' ) );
107
+
108
+ ob_start();
109
+ ?>
110
+ <div class="wpmtst notice notice-warning is-dismissible" data-key="<?php echo esc_attr( $key ); ?>">
111
+ <p>
112
+ <?php echo wp_kses_post( _e( 'Captcha options have changed in <strong>Strong Testimonials</strong>.', 'strong-testimonials' ) ); ?>
113
+ <?php echo wp_kses_post( $settings_link ); ?>
114
+ </p>
115
+ </div>
116
+ <?php
117
+ $html = ob_get_clean();
118
+ break;
119
+
120
+ default:
121
+ // nothing
122
+ }
123
+
124
+ return $html;
125
+ }
126
+ add_filter( 'wpmtst_admin_notice', 'wpmtst_admin_notice_text', 10, 2 );
127
+
128
+
129
+ /**
130
+ * Add admin notice to queue.
131
+ *
132
+ * @since 2.24.0
133
+ *
134
+ * @param $key
135
+ * @param $persist
136
+ */
137
+ function wpmtst_add_admin_notice( $key, $persist = false ) {
138
+ $notices = get_option( 'wpmtst_admin_notices', array() );
139
+ $notices[ $key ] = array( 'persist' => $persist );
140
+ update_option( 'wpmtst_admin_notices', $notices );
141
+ }
142
+
143
+
144
+ /**
145
+ * Delete admin notice from queue.
146
+ *
147
+ * @since 2.24.0
148
+ *
149
+ * @param $key
150
+ */
151
+ function wpmtst_delete_admin_notice( $key ) {
152
+ $notices = get_option( 'wpmtst_admin_notices', array() );
153
+ unset( $notices[ $key ] );
154
+ update_option( 'wpmtst_admin_notices', $notices );
155
+ }
156
+
157
+
158
+ /**
159
+ * Automatically dismiss specific notices when settings are saved.
160
+ *
161
+ * @since 2.29.0
162
+ * @param $option
163
+ * @param $old_value
164
+ * @param $value
165
+ */
166
+ function wpmtst_auto_dismiss_notices( $option, $old_value, $value ) {
167
+ if ( ! function_exists( 'get_current_screen' ) ) {
168
+ return;
169
+ }
170
+
171
+ $screen = get_current_screen();
172
+ if ( $screen && 'options' == $screen->base ) {
173
+ if ( 'wpmtst_form_options' == $option ) {
174
+ $notices = get_option( 'wpmtst_admin_notices', array() );
175
+ if ( isset( $notices['captcha-options-changed'] ) ) {
176
+ unset( $notices['captcha-options-changed'] );
177
+ update_option( 'wpmtst_admin_notices', $notices );
178
+ }
179
+ }
180
+ }
181
+ }
182
+ add_action( 'update_option', 'wpmtst_auto_dismiss_notices', 10, 3 );
admin/admin.php CHANGED
@@ -1,329 +1,297 @@
1
- <?php
2
- /**
3
- * Strong Testimonials admin functions.
4
- *
5
- * 1. Check for required WordPress version.
6
- * 2. Check for plugin update.
7
- * 3. Initialize.
8
- */
9
-
10
- /**
11
- * Check for required WordPress version.
12
- */
13
- function wpmtst_version_check() {
14
- global $wp_version;
15
- $require_wp_version = "3.7";
16
-
17
- if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
- deactivate_plugins( WPMTST_PLUGIN );
19
- /* translators: %s is the name of the plugin. */
20
- $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
- /* translators: %s is a WordPress version number. */
22
- $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
- $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
- $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
- wp_die( $message );
26
- }
27
- }
28
-
29
- add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
-
31
- /**
32
- * Check for plugin update.
33
- *
34
- * @since 2.28.4 Before other admin_init actions.
35
- */
36
- function wpmtst_update_check() {
37
- $version = get_option( 'wpmtst_plugin_version', false );
38
- if ( $version == WPMTST_VERSION ) {
39
- return;
40
- }
41
- // Redirect to About page afterwards. On new install or (de)activation only.
42
- if ( false === $version ) {
43
- add_option( 'wpmtst_do_activation_redirect', true );
44
- }
45
-
46
- require_once WPMTST_ADMIN . 'class-strong-testimonials-updater.php';
47
- $updater = new Strong_Testimonials_Updater();
48
- $updater->update();
49
- }
50
-
51
- add_action( 'admin_init', 'wpmtst_update_check', 5 );
52
-
53
- /**
54
- * Initialize.
55
- */
56
- function wpmtst_admin_init() {
57
- /**
58
- * Redirect to About page for new installs only
59
- *
60
- * @since 2.28.4
61
- */
62
- wpmtst_activation_redirect();
63
-
64
- /**
65
- * Custom action hooks
66
- *
67
- * @since 1.18.4
68
- */
69
- if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
70
- do_action( 'wpmtst_' . $_REQUEST['action'] );
71
- }
72
- }
73
-
74
- add_action( 'admin_init', 'wpmtst_admin_init' );
75
-
76
- /**
77
- * Custom action link in admin notice.
78
- *
79
- * @since 2.29.0
80
- */
81
- function wpmtst_action_captcha_options_changed() {
82
- wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
- exit;
85
- }
86
-
87
- add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
88
-
89
- /**
90
- * Redirect to About page.
91
- *
92
- * @since 2.28.4
93
- */
94
- function wpmtst_activation_redirect() {
95
- if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
96
- delete_option( 'wpmtst_do_activation_redirect' );
97
- wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
98
- exit;
99
- }
100
- }
101
-
102
- /**
103
- * Are we on a testimonial admin screen?
104
- *
105
- * Used by add-ons too!
106
- *
107
- * @return bool
108
- */
109
- function wpmtst_is_testimonial_screen() {
110
- $screen = get_current_screen();
111
- return ( $screen && 'wpm-testimonial' == $screen->post_type );
112
- }
113
-
114
- /**
115
- * Add pending numbers to post types on admin menu.
116
- * Thanks http://wordpress.stackexchange.com/a/105470/32076
117
- *
118
- * @param $menu
119
- *
120
- * @return mixed
121
- */
122
- function wpmtst_pending_indicator( $menu ) {
123
- if ( ! current_user_can( 'edit_posts' ) )
124
- return $menu;
125
-
126
- $options = get_option( 'wpmtst_options' );
127
- if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] )
128
- return $menu;
129
-
130
- $types = array( 'wpm-testimonial' );
131
- $status = 'pending';
132
- foreach ( $types as $type ) {
133
- $num_posts = wp_count_posts( $type, 'readable' );
134
- $pending_count = 0;
135
- if ( ! empty( $num_posts->$status ) )
136
- $pending_count = $num_posts->$status;
137
-
138
- if ( $type == 'post' )
139
- $menu_str = 'edit.php';
140
- else
141
- $menu_str = 'edit.php?post_type=' . $type;
142
-
143
- foreach ( $menu as $menu_key => $menu_data ) {
144
- if ( $menu_str != $menu_data[2] )
145
- continue;
146
- $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
147
- }
148
- }
149
-
150
- return $menu;
151
- }
152
- add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
153
-
154
- /**
155
- * The [restore default] icon.
156
- *
157
- * @param $for
158
- *
159
- * @since 2.18.0
160
- */
161
- function wpmtst_restore_default_icon( $for ) {
162
- if ( !$for ) return;
163
- ?>
164
- <input type="button" class="button secondary restore-default"
165
- title="<?php _e( 'restore default', 'strong-testimonials' ); ?>"
166
- value="&#xf171"
167
- data-for="<?php echo $for; ?>"/>
168
- <?php
169
- }
170
-
171
- /**
172
- * Add plugin links.
173
- *
174
- * @param $plugin_meta
175
- * @param $plugin_file
176
- * @param array $plugin_data
177
- * @param string $status
178
- *
179
- * @return array
180
- */
181
- function wpmtst_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data = array(), $status = '' ) {
182
-
183
- if ( $plugin_file == WPMTST_PLUGIN ) {
184
-
185
- $plugin_meta[] = sprintf(
186
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
187
- 'https://strongplugins.com/documents/',
188
- __( 'For guides and tutorials', 'strong-testimonials' ),
189
- __( 'Documentation', 'strong-testimonials' ) );
190
-
191
- $plugin_meta[] = sprintf(
192
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
193
- 'https://support.strongplugins.com/',
194
- __( 'For direct support requests', 'strong-testimonials' ),
195
- __( 'Support', 'strong-testimonials' ) );
196
-
197
- $plugin_meta[] = sprintf(
198
- '<a class="strong-plugin-link" href="%s" target="_blank" title="%s">%s</a>',
199
- 'https://strongplugins.com/',
200
- __( 'Get more features with premium add-ons', 'strong-testimonials' ),
201
- __( 'Add-ons', 'strong-testimonials' ) );
202
-
203
- }
204
-
205
- return $plugin_meta;
206
- }
207
- //add_filter( 'plugin_row_meta', 'wpmtst_plugin_row_meta' , 10, 4 );
208
-
209
-
210
- /**
211
- * Check for configuration issues when options are updated.
212
- *
213
- * @since 2.24.0
214
- * @param $option
215
- * @param $old_value
216
- * @param $value
217
- */
218
- function wpmtst_updated_option( $option, $old_value, $value ) {
219
- if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
220
- do_action( 'wpmtst_check_config' );
221
- }
222
- }
223
- add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
224
-
225
-
226
- /**
227
- * Store configuration error.
228
- *
229
- * @since 2.24.0
230
- * @param $key
231
- */
232
- function wpmtst_add_config_error( $key ) {
233
- $errors = get_option( 'wpmtst_config_errors', array() );
234
- $errors[] = $key;
235
- update_option( 'wpmtst_config_errors', array_unique( $errors ) );
236
-
237
- wpmtst_add_admin_notice( $key, true );
238
- }
239
-
240
-
241
- /**
242
- * Delete configuration error.
243
- *
244
- * @since 2.24.0
245
- * @param $key
246
- */
247
- function wpmtst_delete_config_error( $key ) {
248
- $errors = get_option( 'wpmtst_config_errors', array() );
249
- $errors = array_diff( $errors, array ( $key ) );
250
- update_option( 'wpmtst_config_errors', $errors );
251
-
252
- wpmtst_delete_admin_notice( $key );
253
- }
254
-
255
-
256
- /**
257
- * Save a View.
258
- *
259
- * @param $view
260
- * @param string $action
261
- * @usedby Strong_Testimonials_Update:update_views
262
- *
263
- * @return bool|false|int
264
- */
265
- function wpmtst_save_view( $view, $action = 'edit' ) {
266
- global $wpdb;
267
-
268
- if ( ! $view ) return false;
269
-
270
- $table_name = $wpdb->prefix . 'strong_views';
271
- $serialized = serialize( $view['data'] );
272
-
273
- if ( 'add' == $action || 'duplicate' == $action ) {
274
- $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
275
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
276
- $wpdb->query( $sql );
277
- $view['id'] = $wpdb->insert_id;
278
- $return = $view['id'];
279
- }
280
- else {
281
- $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
282
- $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
283
- $wpdb->query( $sql );
284
- $return = $wpdb->last_error ? 0 : 1;
285
- }
286
-
287
- do_action( 'wpmtst_view_saved', $view );
288
-
289
- return $return;
290
- }
291
-
292
-
293
- /**
294
- * @param $field
295
- *
296
- * @return mixed
297
- */
298
- function wpmtst_get_field_label( $field ) {
299
- if ( isset( $field['field'] ) ) {
300
- $custom_fields = wpmtst_get_custom_fields();
301
- if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
302
- return $custom_fields[ $field['field'] ]['label'];
303
- }
304
- $builtin_fields = wpmtst_get_builtin_fields();
305
- if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
306
- return $builtin_fields[ $field['field'] ]['label'];
307
- }
308
- }
309
-
310
- return '';
311
- }
312
-
313
-
314
- /**
315
- * @param string $field_name
316
- *
317
- * @return mixed
318
- */
319
- function wpmtst_get_field_by_name( $field_name = '' ) {
320
- if ( $field_name ) {
321
- $custom_fields = wpmtst_get_custom_fields();
322
- if ( isset( $custom_fields[ $field_name ] ) ) {
323
- return $custom_fields[ $field_name ];
324
- }
325
- }
326
-
327
- return '';
328
- }
329
-
1
+ <?php
2
+ /**
3
+ * Strong Testimonials admin functions.
4
+ *
5
+ * 1. Check for required WordPress version.
6
+ * 2. Check for plugin update.
7
+ * 3. Initialize.
8
+ */
9
+
10
+ /**
11
+ * Check for required WordPress version.
12
+ */
13
+ function wpmtst_version_check() {
14
+ global $wp_version;
15
+ $require_wp_version = '3.7';
16
+
17
+ if ( version_compare( $wp_version, $require_wp_version ) == -1 ) {
18
+ deactivate_plugins( WPMTST_PLUGIN );
19
+ /* translators: %s is the name of the plugin. */
20
+ $message = '<h2>' . sprintf( _x( 'Unable to load %s', 'installation', 'strong-testimonials' ), 'Strong Testimonials' ) . '</h2>';
21
+ /* translators: %s is a WordPress version number. */
22
+ $message .= '<p>' . sprintf( _x( 'This plugin requires <strong>WordPress %s</strong> or higher so it has been deactivated.', 'installation', 'strong-testimonials' ), $require_wp_version ) . '</p>';
23
+ $message .= '<p>' . _x( 'Please upgrade WordPress and try again.', 'installation', 'strong-testimonials' ) . '</p>';
24
+ $message .= '<p>' . sprintf( _x( 'Back to the WordPress <a href="%s">Plugins page</a>', 'installation', 'strong-testimonials' ), get_admin_url( null, 'plugins.php' ) ) . '</p>';
25
+ wp_die( wp_kses_post( $message ) );
26
+ }
27
+ }
28
+
29
+ add_action( 'admin_init', 'wpmtst_version_check', 1 );
30
+
31
+ /**
32
+ * Check for plugin update.
33
+ *
34
+ * @since 2.28.4 Before other admin_init actions.
35
+ */
36
+ function wpmtst_update_check() {
37
+ $version = get_option( 'wpmtst_plugin_version', false );
38
+ if ( $version == WPMTST_VERSION ) {
39
+ return;
40
+ }
41
+ // Redirect to About page afterwards. On new install or (de)activation only.
42
+ if ( false === $version ) {
43
+ add_option( 'wpmtst_do_activation_redirect', true );
44
+ }
45
+
46
+ require_once WPMTST_ADMIN . 'class-strong-testimonials-updater.php';
47
+ $updater = new Strong_Testimonials_Updater();
48
+ $updater->update();
49
+ }
50
+
51
+ add_action( 'admin_init', 'wpmtst_update_check', 5 );
52
+
53
+ /**
54
+ * Initialize.
55
+ */
56
+ function wpmtst_admin_init() {
57
+ /**
58
+ * Redirect to About page for new installs only
59
+ *
60
+ * @since 2.28.4
61
+ */
62
+ wpmtst_activation_redirect();
63
+
64
+ /**
65
+ * Custom action hooks
66
+ *
67
+ * @since 1.18.4
68
+ */
69
+ if ( isset( $_REQUEST['action'] ) && '' != $_REQUEST['action'] ) {
70
+ do_action( 'wpmtst_' . $_REQUEST['action'] );
71
+ }
72
+ }
73
+
74
+ add_action( 'admin_init', 'wpmtst_admin_init' );
75
+
76
+ /**
77
+ * Custom action link in admin notice.
78
+ *
79
+ * @since 2.29.0
80
+ */
81
+ function wpmtst_action_captcha_options_changed() {
82
+ wpmtst_delete_admin_notice( 'captcha-options-changed' );
83
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form#captcha-section' ) );
84
+ exit;
85
+ }
86
+
87
+ add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );
88
+
89
+ /**
90
+ * Redirect to About page.
91
+ *
92
+ * @since 2.28.4
93
+ */
94
+ function wpmtst_activation_redirect() {
95
+ if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
96
+ delete_option( 'wpmtst_do_activation_redirect' );
97
+ wp_redirect( admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' ) );
98
+ exit;
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Are we on a testimonial admin screen?
104
+ *
105
+ * Used by add-ons too!
106
+ *
107
+ * @return bool
108
+ */
109
+ function wpmtst_is_testimonial_screen() {
110
+ $screen = get_current_screen();
111
+ return ( $screen && 'wpm-testimonial' == $screen->post_type );
112
+ }
113
+
114
+ /**
115
+ * Add pending numbers to post types on admin menu.
116
+ * Thanks http://wordpress.stackexchange.com/a/105470/32076
117
+ *
118
+ * @param $menu
119
+ *
120
+ * @return mixed
121
+ */
122
+ function wpmtst_pending_indicator( $menu ) {
123
+ if ( ! current_user_can( 'edit_posts' ) ) {
124
+ return $menu;
125
+ }
126
+
127
+ $options = get_option( 'wpmtst_options' );
128
+ if ( ! isset( $options['pending_indicator'] ) || ! $options['pending_indicator'] ) {
129
+ return $menu;
130
+ }
131
+
132
+ $types = array( 'wpm-testimonial' );
133
+ $status = 'pending';
134
+ foreach ( $types as $type ) {
135
+ $num_posts = wp_count_posts( $type, 'readable' );
136
+ $pending_count = 0;
137
+ if ( ! empty( $num_posts->$status ) ) {
138
+ $pending_count = $num_posts->$status;
139
+ }
140
+
141
+ if ( $type == 'post' ) {
142
+ $menu_str = 'edit.php';
143
+ } else {
144
+ $menu_str = 'edit.php?post_type=' . $type;
145
+ }
146
+
147
+ foreach ( $menu as $menu_key => $menu_data ) {
148
+ if ( $menu_str != $menu_data[2] ) {
149
+ continue;
150
+ }
151
+ $menu[ $menu_key ][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
152
+ }
153
+ }
154
+
155
+ return $menu;
156
+ }
157
+ add_filter( 'add_menu_classes', 'wpmtst_pending_indicator' );
158
+
159
+ /**
160
+ * The [restore default] icon.
161
+ *
162
+ * @param $for
163
+ *
164
+ * @since 2.18.0
165
+ */
166
+ function wpmtst_restore_default_icon( $for ) {
167
+ if ( ! $for ) {
168
+ return;
169
+ }
170
+ ?>
171
+ <input type="button" class="button secondary restore-default" title="<?php esc_attr_e( 'restore default', 'strong-testimonials' ); ?>" value="&#xf171" data-for="<?php echo esc_attr( $for ); ?>"/>
172
+ <?php
173
+ }
174
+
175
+
176
+
177
+ /**
178
+ * Check for configuration issues when options are updated.
179
+ *
180
+ * @since 2.24.0
181
+ * @param $option
182
+ * @param $old_value
183
+ * @param $value
184
+ */
185
+ function wpmtst_updated_option( $option, $old_value, $value ) {
186
+ if ( 'wpmtst_' == substr( $option, 0, 7 ) ) {
187
+ do_action( 'wpmtst_check_config' );
188
+ }
189
+ }
190
+ add_action( 'updated_option', 'wpmtst_updated_option', 10, 3 );
191
+
192
+
193
+ /**
194
+ * Store configuration error.
195
+ *
196
+ * @since 2.24.0
197
+ * @param $key
198
+ */
199
+ function wpmtst_add_config_error( $key ) {
200
+ $errors = get_option( 'wpmtst_config_errors', array() );
201
+ $errors[] = $key;
202
+ update_option( 'wpmtst_config_errors', array_unique( $errors ) );
203
+
204
+ wpmtst_add_admin_notice( $key, true );
205
+ }
206
+
207
+
208
+ /**
209
+ * Delete configuration error.
210
+ *
211
+ * @since 2.24.0
212
+ * @param $key
213
+ */
214
+ function wpmtst_delete_config_error( $key ) {
215
+ $errors = get_option( 'wpmtst_config_errors', array() );
216
+ $errors = array_diff( $errors, array( $key ) );
217
+ update_option( 'wpmtst_config_errors', $errors );
218
+
219
+ wpmtst_delete_admin_notice( $key );
220
+ }
221
+
222
+
223
+ /**
224
+ * Save a View.
225
+ *
226
+ * @param $view
227
+ * @param string $action
228
+ * @usedby Strong_Testimonials_Update:update_views
229
+ *
230
+ * @return bool|false|int
231
+ */
232
+ function wpmtst_save_view( $view, $action = 'edit' ) {
233
+ global $wpdb;
234
+
235
+ if ( ! $view ) {
236
+ return false;
237
+ }
238
+
239
+ $table_name = $wpdb->prefix . 'strong_views';
240
+ $serialized = serialize( $view['data'] );
241
+
242
+ if ( 'add' == $action || 'duplicate' == $action ) {
243
+ $sql = "INSERT INTO {$table_name} (name, value) VALUES (%s, %s)";
244
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized );
245
+ $wpdb->query( $sql );
246
+ $view['id'] = $wpdb->insert_id;
247
+ $return = $view['id'];
248
+ } else {
249
+ $sql = "UPDATE {$table_name} SET name = %s, value = %s WHERE id = %d";
250
+ $sql = $wpdb->prepare( $sql, $view['name'], $serialized, intval( $view['id'] ) );
251
+ $wpdb->query( $sql );
252
+ $return = $wpdb->last_error ? 0 : 1;
253
+ }
254
+
255
+ do_action( 'wpmtst_view_saved', $view );
256
+
257
+ return $return;
258
+ }
259
+
260
+
261
+ /**
262
+ * @param $field
263
+ *
264
+ * @return mixed
265
+ */
266
+ function wpmtst_get_field_label( $field ) {
267
+ if ( isset( $field['field'] ) ) {
268
+ $custom_fields = wpmtst_get_custom_fields();
269
+ if ( isset( $custom_fields[ $field['field'] ]['label'] ) ) {
270
+ return $custom_fields[ $field['field'] ]['label'];
271
+ }
272
+ $builtin_fields = wpmtst_get_builtin_fields();
273
+ if ( isset( $builtin_fields[ $field['field'] ]['label'] ) ) {
274
+ return $builtin_fields[ $field['field'] ]['label'];
275
+ }
276
+ }
277
+
278
+ return '';
279
+ }
280
+
281
+
282
+ /**
283
+ * @param string $field_name
284
+ *
285
+ * @return mixed
286
+ */
287
+ function wpmtst_get_field_by_name( $field_name = '' ) {
288
+ if ( $field_name ) {
289
+ $custom_fields = wpmtst_get_custom_fields();
290
+ if ( isset( $custom_fields[ $field_name ] ) ) {
291
+ return $custom_fields[ $field_name ];
292
+ }
293
+ }
294
+
295
+ return '';
296
+ }
297
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-strong-testimonials-admin-category-list.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_Category_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_Category_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_list constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
- add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
- }
28
-
29
- /**
30
- * Add columns to the testimonials categories screen
31
- *
32
- * @param $columns
33
- *
34
- * @return array
35
- */
36
- public static function manage_categories( $columns ) {
37
- $new_columns = array(
38
- 'cb' => '<input type="checkbox">',
39
- 'ID' => __( 'ID', 'strong-testimonials' ),
40
- 'name' => __( 'Name', 'strong-testimonials' ),
41
- 'slug' => __( 'Slug', 'strong-testimonials' ),
42
- 'posts' => __( 'Posts', 'strong-testimonials' ),
43
- );
44
-
45
- return $new_columns;
46
- }
47
-
48
- /**
49
- * Show custom column
50
- *
51
- * @param $out
52
- * @param $column_name
53
- * @param $id
54
- *
55
- * @return string
56
- */
57
- public static function manage_columns( $out, $column_name, $id ) {
58
- if ( 'ID' == $column_name ) {
59
- $output = $id;
60
- } else {
61
- $output = '';
62
- }
63
-
64
- return $output;
65
- }
66
-
67
- }
68
-
69
- Strong_Testimonials_Admin_Category_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_Category_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_Category_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_list constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_filter( 'manage_edit-wpm-testimonial-category_columns', array( __CLASS__, 'manage_categories' ) );
26
+ add_filter( 'manage_wpm-testimonial-category_custom_column', array( __CLASS__, 'manage_columns' ), 10, 3 );
27
+ }
28
+
29
+ /**
30
+ * Add columns to the testimonials categories screen
31
+ *
32
+ * @param $columns
33
+ *
34
+ * @return array
35
+ */
36
+ public static function manage_categories( $columns ) {
37
+ $new_columns = array(
38
+ 'cb' => '<input type="checkbox">',
39
+ 'ID' => __( 'ID', 'strong-testimonials' ),
40
+ 'name' => __( 'Name', 'strong-testimonials' ),
41
+ 'slug' => __( 'Slug', 'strong-testimonials' ),
42
+ 'posts' => __( 'Posts', 'strong-testimonials' ),
43
+ );
44
+
45
+ return $new_columns;
46
+ }
47
+
48
+ /**
49
+ * Show custom column
50
+ *
51
+ * @param $out
52
+ * @param $column_name
53
+ * @param $id
54
+ *
55
+ * @return string
56
+ */
57
+ public static function manage_columns( $out, $column_name, $id ) {
58
+ if ( 'ID' == $column_name ) {
59
+ $output = $id;
60
+ } else {
61
+ $output = '';
62
+ }
63
+
64
+ return $output;
65
+ }
66
+
67
+ }
68
+
69
+ Strong_Testimonials_Admin_Category_List::init();
admin/class-strong-testimonials-admin-list.php CHANGED
@@ -1,331 +1,323 @@
1
- <?php
2
- /**
3
- * Class Strong_Testimonials_Admin_List
4
- *
5
- * @since 2.28.0
6
- */
7
- class Strong_Testimonials_Admin_List {
8
-
9
- /**
10
- * Strong_Testimonials_Admin_List constructor.
11
- */
12
- public function __construct() {}
13
-
14
- /**
15
- * Initialize.
16
- */
17
- public static function init() {
18
- self::add_actions();
19
- }
20
-
21
- /**
22
- * Add actions and filters.
23
- */
24
- public static function add_actions() {
25
- add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
- add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
- add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
- add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
- add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
- add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
- add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
- }
33
-
34
- /**
35
- * Add post ID to post row actions.
36
- *
37
- * @param $actions
38
- * @param $post
39
- * @since 2.32.2
40
- *
41
- * @return array
42
- */
43
- public static function post_row_actions( $actions, $post ) {
44
- if ( 'wpm-testimonial' == $post->post_type ) {
45
- $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
- }
47
-
48
- return $actions;
49
- }
50
-
51
- /**
52
- * Add custom columns to the admin list.
53
- *
54
- * @param $columns
55
- *
56
- * @since 1.4.0
57
- * @since 2.5.1 Added comments column.
58
- *
59
- * @return array
60
- */
61
- public static function edit_columns( $columns ) {
62
- $fields = wpmtst_get_all_fields();
63
-
64
- $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
-
66
- /*
67
- INCOMING COLUMNS = Array (
68
- [cb] => <input type="checkbox" />
69
- [title] => Title
70
- [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
- [date] => Date
72
- [search_exclude] => Search Exclude // other plugin
73
- [strong_thumbnail] => Thumbnail
74
- )
75
- */
76
-
77
- // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
- unset( $columns['strong_thumbnail'], $columns['date'] );
79
-
80
- if ( $comments ) {
81
- unset( $columns['comments'] );
82
- }
83
-
84
- // 2. insert [order] after [cb]
85
- if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
- $columns = array_merge(
87
- array_slice( $columns, 0, 1 ),
88
- array( 'handle' => 'Order' ),
89
- array_slice( $columns, 1, null )
90
- );
91
- }
92
-
93
- // 3. insert [excerpt] after [title]
94
- $key = 'title';
95
- $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
- $fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
97
-
98
- // 4. add custom fields
99
- foreach ( $fields as $key => $field ) {
100
-
101
- if ( $field['admin_table'] ) {
102
-
103
- if ( 'post_title' == $field['name'] ) {
104
- continue;
105
- } elseif ( 'featured_image' == $field['name'] ) {
106
- $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
- } elseif ( 'rating' == $field['input_type'] ) {
108
- $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
- } else {
110
- $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
- }
112
-
113
- }
114
-
115
- }
116
-
117
- // 5. add [category], [comments] and [date]
118
- // The slug "categories" slug is reserved by WordPress.
119
- if ( wpmtst_get_cat_count() ) {
120
- $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
121
- }
122
-
123
- if ( $comments ) {
124
- $fields_to_add['comments'] = $comments;
125
- }
126
-
127
- $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
128
-
129
- // Push other added columns like [search_exclude] to the end.
130
- $columns = array_merge(
131
- array_slice( $columns, 0, $offset ),
132
- $fields_to_add,
133
- array_slice( $columns, $offset, null )
134
- );
135
-
136
- return $columns;
137
- }
138
-
139
- /**
140
- * Show custom values
141
- *
142
- * @param $column
143
- */
144
- public static function custom_columns( $column ) {
145
- global $post;
146
-
147
- switch ( $column ) {
148
-
149
- case 'post_id' :
150
- echo $post->ID;
151
- break;
152
-
153
- case 'post_content' :
154
- echo substr( $post->post_content, 0, 100 ) . '&hellip;';
155
- break;
156
-
157
- case 'post_excerpt' :
158
- echo $post->post_excerpt;
159
- break;
160
-
161
- case 'strong_thumbnail' :
162
- echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
163
- break;
164
-
165
- case 'category' :
166
- $categories = get_the_terms( 0, 'wpm-testimonial-category' );
167
- if ( $categories && ! is_wp_error( $categories ) ) {
168
- $list = array();
169
- foreach ( $categories as $cat ) {
170
- $list[] = $cat->name;
171
- }
172
- echo join( ", ", $list );
173
- }
174
- break;
175
-
176
- case 'handle' :
177
- if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
178
- echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
179
- }
180
- break;
181
-
182
- default :
183
- // custom field?
184
- $custom = get_post_custom();
185
- $fields = wpmtst_get_custom_fields();
186
-
187
- if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
188
-
189
- if ( isset( $fields[ $column ] ) ) {
190
-
191
- switch ( $fields[ $column ]['input_type'] ) {
192
- case 'rating' :
193
- wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
194
- break;
195
- case 'checkbox' :
196
- echo $custom[ $column ][0] ? 'yes' : 'no';
197
- break;
198
- default :
199
- echo $custom[ $column ][0];
200
- }
201
-
202
- }
203
-
204
- } else {
205
-
206
- if ( isset( $fields[ $column ] ) ) {
207
-
208
- if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
209
- echo 'no';
210
- } else {
211
- // display nothing
212
- }
213
-
214
- }
215
- }
216
-
217
- }
218
- }
219
-
220
- /**
221
- * Add thumbnail column to admin list
222
- *
223
- * @param $columns
224
- *
225
- * @return array
226
- */
227
- public static function add_thumbnail_column( $columns ) {
228
- $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
229
-
230
- return $columns;
231
- }
232
-
233
- /**
234
- * Make columns sortable.
235
- *
236
- * @param $columns
237
- *
238
- * @since 1.12.0
239
- * @since 2.2.0 category
240
- *
241
- * @return mixed
242
- */
243
- public static function manage_sortable_columns( $columns ) {
244
- $columns['client_name'] = 'client_name';
245
- $columns['category'] = 'categories';
246
- $columns['date'] = 'date';
247
-
248
- return $columns;
249
- }
250
-
251
- /**
252
- * Add category filter to testimonial list table.
253
- *
254
- * @since 2.2.0
255
- */
256
- public static function add_taxonomy_filters() {
257
- global $typenow;
258
-
259
- if ( $typenow != 'wpm-testimonial' ) {
260
- return;
261
- }
262
-
263
- $taxonomies = array( 'wpm-testimonial-category' );
264
-
265
- foreach ( $taxonomies as $tax ) {
266
- $tax_obj = get_taxonomy( $tax );
267
- $args = array(
268
- 'show_option_all' => $tax_obj->labels->all_items,
269
- 'show_option_none' => '',
270
- 'option_none_value' => '-1',
271
- 'orderby' => 'NAME',
272
- 'order' => 'ASC',
273
- 'show_count' => 1,
274
- 'hide_empty' => 1,
275
- 'child_of' => 0,
276
- 'exclude' => '',
277
- 'echo' => 1,
278
- 'selected' => isset( $_GET[ $tax ] ) ? $_GET[ $tax ] : '',
279
- 'hierarchical' => 1,
280
- 'name' => $tax,
281
- 'id' => $tax,
282
- 'class' => 'postform',
283
- 'depth' => 0,
284
- 'tab_index' => 0,
285
- 'taxonomy' => $tax,
286
- 'hide_if_empty' => true,
287
- 'value_field' => 'slug',
288
- );
289
-
290
- wp_dropdown_categories( $args );
291
- }
292
- }
293
-
294
- /**
295
- * Sort columns.
296
- *
297
- * @since 1.12.0
298
- *
299
- * @param $query
300
- */
301
- public static function pre_get_posts( $query ) {
302
- // Only in main WP query AND if an orderby query variable is designated.
303
- if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
304
- if ( 'client_name' == $query->get( 'orderby' ) ) {
305
- $query->set( 'meta_key', 'client_name' );
306
- $query->set( 'orderby', 'meta_value' );
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * Check if we are viewing the Trash.
313
- *
314
- * @since 1.16.0
315
- */
316
- public static function is_viewing_trash() {
317
- return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
318
- }
319
-
320
- /**
321
- * Check if a column in admin list table is sorted.
322
- *
323
- * @since 1.16.0
324
- */
325
- public static function is_column_sorted() {
326
- return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
327
- }
328
-
329
- }
330
-
331
- Strong_Testimonials_Admin_List::init();
1
+ <?php
2
+ /**
3
+ * Class Strong_Testimonials_Admin_List
4
+ *
5
+ * @since 2.28.0
6
+ */
7
+ class Strong_Testimonials_Admin_List {
8
+
9
+ /**
10
+ * Strong_Testimonials_Admin_List constructor.
11
+ */
12
+ public function __construct() {}
13
+
14
+ /**
15
+ * Initialize.
16
+ */
17
+ public static function init() {
18
+ self::add_actions();
19
+ }
20
+
21
+ /**
22
+ * Add actions and filters.
23
+ */
24
+ public static function add_actions() {
25
+ add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
26
+ add_filter( 'manage_wpm-testimonial_posts_columns', array( __CLASS__, 'add_thumbnail_column' ) );
27
+ add_filter( 'manage_edit-wpm-testimonial_columns', array( __CLASS__, 'edit_columns' ) );
28
+ add_action( 'restrict_manage_posts', array( __CLASS__, 'add_taxonomy_filters' ) );
29
+ add_filter( 'manage_edit-wpm-testimonial_sortable_columns', array( __CLASS__, 'manage_sortable_columns' ) );
30
+ add_action( 'manage_wpm-testimonial_posts_custom_column', array( __CLASS__, 'custom_columns' ) );
31
+ add_filter( 'post_row_actions', array( __CLASS__, 'post_row_actions' ), 10, 2 );
32
+ }
33
+
34
+ /**
35
+ * Add post ID to post row actions.
36
+ *
37
+ * @param $actions
38
+ * @param $post
39
+ * @since 2.32.2
40
+ *
41
+ * @return array
42
+ */
43
+ public static function post_row_actions( $actions, $post ) {
44
+ if ( 'wpm-testimonial' == $post->post_type ) {
45
+ $actions = array( 'id' => '<span>ID: ' . $post->ID . '</span>' ) + $actions;
46
+ }
47
+
48
+ return $actions;
49
+ }
50
+
51
+ /**
52
+ * Add custom columns to the admin list.
53
+ *
54
+ * @param $columns
55
+ *
56
+ * @since 1.4.0
57
+ * @since 2.5.1 Added comments column.
58
+ *
59
+ * @return array
60
+ */
61
+ public static function edit_columns( $columns ) {
62
+ $fields = wpmtst_get_all_fields();
63
+
64
+ $comments = isset( $columns['comments'] ) ? $columns['comments'] : '';
65
+
66
+ /*
67
+ INCOMING COLUMNS = Array (
68
+ [cb] => <input type="checkbox" />
69
+ [title] => Title
70
+ [comments] => <span class="vers comment-grey-bubble" title="Comments"><span class="screen-reader-text">Comments</span></span>
71
+ [date] => Date
72
+ [search_exclude] => Search Exclude // other plugin
73
+ [strong_thumbnail] => Thumbnail
74
+ )
75
+ */
76
+
77
+ // 1. remove [thumbnail] (may be re-added in custom field loop) and [date]
78
+ unset( $columns['strong_thumbnail'], $columns['date'] );
79
+
80
+ if ( $comments ) {
81
+ unset( $columns['comments'] );
82
+ }
83
+
84
+ // 2. insert [order] after [cb]
85
+ if ( ! self::is_column_sorted() && ! self::is_viewing_trash() && class_exists( 'Strong_Testimonials_Order' ) ) {
86
+ $columns = array_merge(
87
+ array_slice( $columns, 0, 1 ),
88
+ array( 'handle' => 'Order' ),
89
+ array_slice( $columns, 1, null )
90
+ );
91
+ }
92
+
93
+ // 3. insert [excerpt] after [title]
94
+ $key = 'title';
95
+ $offset = array_search( $key, array_keys( $columns ) ) + 1;
96
+ $fields_to_add = array( 'post_excerpt' => __( 'Excerpt', 'strong-testimonials' ) );
97
+
98
+ // 4. add custom fields
99
+ foreach ( $fields as $key => $field ) {
100
+
101
+ if ( $field['admin_table'] ) {
102
+
103
+ if ( 'post_title' == $field['name'] ) {
104
+ continue;
105
+ } elseif ( 'featured_image' == $field['name'] ) {
106
+ $fields_to_add['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
107
+ } elseif ( 'rating' == $field['input_type'] ) {
108
+ $fields_to_add[ $field['name'] ] = __( 'Rating', 'strong-testimonials' );
109
+ } else {
110
+ $fields_to_add[ $field['name'] ] = apply_filters( 'wpmtst_l10n', $field['label'], 'strong-testimonials-form-fields', $field['name'] . ' : label' );
111
+ }
112
+ }
113
+ }
114
+
115
+ // 5. add [category], [comments] and [date]
116
+ // The slug "categories" slug is reserved by WordPress.
117
+ if ( wpmtst_get_cat_count() ) {
118
+ $fields_to_add['category'] = __( 'Categories', 'strong-testimonials' );
119
+ }
120
+
121
+ if ( $comments ) {
122
+ $fields_to_add['comments'] = $comments;
123
+ }
124
+
125
+ $fields_to_add['date'] = __( 'Date', 'strong-testimonials' );
126
+
127
+ // Push other added columns like [search_exclude] to the end.
128
+ $columns = array_merge(
129
+ array_slice( $columns, 0, $offset ),
130
+ $fields_to_add,
131
+ array_slice( $columns, $offset, null )
132
+ );
133
+
134
+ return $columns;
135
+ }
136
+
137
+ /**
138
+ * Show custom values
139
+ *
140
+ * @param $column
141
+ */
142
+ public static function custom_columns( $column ) {
143
+ global $post;
144
+
145
+ switch ( $column ) {
146
+
147
+ case 'post_id':
148
+ echo wp_kses_post( $post->ID );
149
+ break;
150
+
151
+ case 'post_content':
152
+ echo wp_kses_post( substr( $post->post_content, 0, 100 ) ) . '&hellip;';
153
+ break;
154
+
155
+ case 'post_excerpt':
156
+ echo wp_kses_post( $post->post_excerpt );
157
+ break;
158
+
159
+ case 'strong_thumbnail':
160
+ echo get_the_post_thumbnail( $post->ID, array( 75, 75 ) );
161
+ break;
162
+
163
+ case 'category':
164
+ $categories = get_the_terms( 0, 'wpm-testimonial-category' );
165
+ if ( $categories && ! is_wp_error( $categories ) ) {
166
+ $list = array();
167
+ foreach ( $categories as $cat ) {
168
+ $list[] = $cat->name;
169
+ }
170
+ echo wp_kses_post( join( ', ', $list ) );
171
+ }
172
+ break;
173
+
174
+ case 'handle':
175
+ if ( current_user_can( 'edit_post', $post->ID ) && ! self::is_column_sorted() && ! self::is_viewing_trash() ) {
176
+ echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>';
177
+ }
178
+ break;
179
+
180
+ default:
181
+ // custom field?
182
+ $custom = get_post_custom();
183
+ $fields = wpmtst_get_custom_fields();
184
+
185
+ if ( isset( $custom[ $column ] ) && $custom[ $column ][0] ) {
186
+
187
+ if ( isset( $fields[ $column ] ) ) {
188
+
189
+ switch ( $fields[ $column ]['input_type'] ) {
190
+ case 'rating':
191
+ wpmtst_star_rating_display( $custom[ $column ][0], 'in-table-list' );
192
+ break;
193
+ case 'checkbox':
194
+ echo $custom[ $column ][0] ? 'yes' : 'no';
195
+ break;
196
+ default:
197
+ echo wp_kses_post( $custom[ $column ][0] );
198
+ }
199
+ }
200
+ } else {
201
+
202
+ if ( isset( $fields[ $column ] ) ) {
203
+
204
+ if ( 'checkbox' == $fields[ $column ]['input_type'] ) {
205
+ echo 'no';
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Add thumbnail column to admin list
214
+ *
215
+ * @param $columns
216
+ *
217
+ * @return array
218
+ */
219
+ public static function add_thumbnail_column( $columns ) {
220
+ $columns['strong_thumbnail'] = __( 'Thumbnail', 'strong-testimonials' );
221
+
222
+ return $columns;
223
+ }
224
+
225
+ /**
226
+ * Make columns sortable.
227
+ *
228
+ * @param $columns
229
+ *
230
+ * @since 1.12.0
231
+ * @since 2.2.0 category
232
+ *
233
+ * @return mixed
234
+ */
235
+ public static function manage_sortable_columns( $columns ) {
236
+ $columns['client_name'] = 'client_name';
237
+ $columns['category'] = 'categories';
238
+ $columns['date'] = 'date';
239
+
240
+ return $columns;
241
+ }
242
+
243
+ /**
244
+ * Add category filter to testimonial list table.
245
+ *
246
+ * @since 2.2.0
247
+ */
248
+ public static function add_taxonomy_filters() {
249
+ global $typenow;
250
+
251
+ if ( $typenow != 'wpm-testimonial' ) {
252
+ return;
253
+ }
254
+
255
+ $taxonomies = array( 'wpm-testimonial-category' );
256
+
257
+ foreach ( $taxonomies as $tax ) {
258
+ $tax_obj = get_taxonomy( $tax );
259
+ $args = array(
260
+ 'show_option_all' => $tax_obj->labels->all_items,
261
+ 'show_option_none' => '',
262
+ 'option_none_value' => '-1',
263
+ 'orderby' => 'NAME',
264
+ 'order' => 'ASC',
265
+ 'show_count' => 1,
266
+ 'hide_empty' => 1,
267
+ 'child_of' => 0,
268
+ 'exclude' => '',
269
+ 'echo' => 1,
270
+ 'selected' => isset( $_GET[ $tax ] ) ? $_GET[ $tax ] : '',
271
+ 'hierarchical' => 1,
272
+ 'name' => $tax,
273
+ 'id' => $tax,
274
+ 'class' => 'postform',
275
+ 'depth' => 0,
276
+ 'tab_index' => 0,
277
+ 'taxonomy' => $tax,
278
+ 'hide_if_empty' => true,
279
+ 'value_field' => 'slug',
280
+ );
281
+
282
+ wp_dropdown_categories( $args );
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Sort columns.
288
+ *
289
+ * @since 1.12.0
290
+ *
291
+ * @param $query
292
+ */
293
+ public static function pre_get_posts( $query ) {
294
+ // Only in main WP query AND if an orderby query variable is designated.
295
+ if ( is_admin() && $query->is_main_query() && 'wpm-testimonial' == $query->get( 'post_type' ) ) {
296
+ if ( 'client_name' == $query->get( 'orderby' ) ) {
297
+ $query->set( 'meta_key', 'client_name' );
298
+ $query->set( 'orderby', 'meta_value' );
299
+ }
300
+ }
301
+ }
302
+
303
+ /**
304
+ * Check if we are viewing the Trash.
305
+ *
306
+ * @since 1.16.0
307
+ */
308
+ public static function is_viewing_trash() {
309
+ return isset( $_GET['post_status'] ) && 'trash' == $_GET['post_status'];
310
+ }
311
+
312
+ /**
313
+ * Check if a column in admin list table is sorted.
314
+ *
315
+ * @since 1.16.0
316
+ */
317
+ public static function is_column_sorted() {
318
+ return isset( $_GET['orderby'] ) || strstr( $_SERVER['REQUEST_URI'], 'action=edit' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' );
319
+ }
320
+
321
+ }
322
+
323
+ Strong_Testimonials_Admin_List::init();
 
 
 
 
 
 
 
 
admin/class-strong-testimonials-admin-scripts.php CHANGED
@@ -1,395 +1,443 @@
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
- wp_register_script( 'wpmtst-admin-script',
60
- WPMTST_ADMIN_URL . 'js/admin.js',
61
- array( 'jquery', 'underscore' ),
62
- $plugin_version,
63
- true );
64
-
65
- wp_register_style( 'wpmtst-admin-style',
66
- WPMTST_ADMIN_URL . 'css/admin.css',
67
- array( 'wpmtst-font-awesome' ),
68
- $plugin_version );
69
-
70
- wp_register_style( 'wpmtst-post-editor',
71
- WPMTST_ADMIN_URL . 'css/post-editor.css',
72
- array( 'wpmtst-font-awesome' ),
73
- $plugin_version );
74
-
75
- wp_register_script( 'wpmtst-custom-spinner',
76
- WPMTST_ADMIN_URL . 'js/custom-spinner.js',
77
- array( 'jquery' ),
78
- $plugin_version,
79
- true );
80
-
81
- wp_register_script( 'autosize',
82
- WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
83
- array(),
84
- '4.0.1',
85
- true );
86
-
87
- /**
88
- * Form tab
89
- */
90
- wp_register_style( 'wpmtst-admin-form-style',
91
- WPMTST_ADMIN_URL . 'css/admin-form.css',
92
- array( 'wpmtst-admin-style' ),
93
- $plugin_version );
94
-
95
- wp_register_script( 'wpmtst-admin-form-script',
96
- WPMTST_ADMIN_URL . 'js/admin-form.js',
97
- array( 'wpmtst-admin-script', 'autosize' ),
98
- $plugin_version,
99
- true );
100
-
101
- /**
102
- * Compatibility tab
103
- */
104
- wp_register_style( 'wpmtst-admin-compat-style',
105
- WPMTST_ADMIN_URL . 'css/admin-compat.css',
106
- array(),
107
- $plugin_version );
108
-
109
- wp_register_script( 'wpmtst-admin-compat-script',
110
- WPMTST_ADMIN_URL . 'js/admin-compat.js',
111
- array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
112
- $plugin_version,
113
- true );
114
-
115
- /**
116
- * Fields
117
- */
118
- wp_register_style( 'wpmtst-admin-fields-style',
119
- WPMTST_ADMIN_URL . 'css/fields.css',
120
- array(),
121
- $plugin_version );
122
-
123
- wp_register_style( 'wpmtst-admin-form-preview',
124
- WPMTST_ADMIN_URL . 'css/form-preview.css',
125
- array(),
126
- $plugin_version );
127
-
128
- wp_register_script( 'wpmtst-admin-fields-script',
129
- WPMTST_ADMIN_URL . 'js/admin-fields.js',
130
- array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
131
- $plugin_version,
132
- true );
133
-
134
- $params = array(
135
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
136
- 'newField' => _x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
137
- 'inUse' => _x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
138
- 'noneFound' => _x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
139
- );
140
- wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
141
-
142
- /**
143
- * Ratings
144
- */
145
- wp_register_style( 'wpmtst-rating-display',
146
- WPMTST_PUBLIC_URL . 'css/rating-display.css',
147
- array( 'wpmtst-font-awesome' ),
148
- $plugin_version );
149
-
150
- wp_register_style( 'wpmtst-rating-form',
151
- WPMTST_PUBLIC_URL . 'css/rating-form.css',
152
- array( 'wpmtst-font-awesome' ),
153
- $plugin_version );
154
-
155
- wp_register_script( 'wpmtst-rating-script',
156
- WPMTST_ADMIN_URL . 'js/rating-edit.js',
157
- array( 'jquery' ),
158
- $plugin_version,
159
- true );
160
-
161
- /**
162
- * Views
163
- */
164
- wp_register_style( 'wpmtst-admin-views-style',
165
- WPMTST_ADMIN_URL . 'css/views.css',
166
- array(),
167
- $plugin_version );
168
-
169
- wp_register_script( 'wpmtst-admin-views-script',
170
- WPMTST_ADMIN_URL . 'js/views.js',
171
- array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
172
- $plugin_version,
173
- true );
174
-
175
- /**
176
- * Category filter in View editor.
177
- *
178
- * JavaScript adapted under GPL-2.0+ license
179
- * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
180
- *
181
- * @since 2.2.0
182
- */
183
- wp_register_script( 'wpmtst-view-category-filter-script',
184
- WPMTST_ADMIN_URL . 'js/view-category-filter.js',
185
- array( 'jquery' ),
186
- $plugin_version,
187
- true );
188
-
189
- wp_register_style( 'wpmtst-about-style',
190
- WPMTST_ADMIN_URL . 'css/about.css',
191
- array(),
192
- $plugin_version );
193
-
194
- /**
195
- * Add-on licenses
196
- *
197
- * @since 2.18
198
- */
199
- wp_register_script( 'wpmtst-addons-script',
200
- WPMTST_ADMIN_URL . 'js/addon-licenses.js',
201
- array( 'jquery' ),
202
- $plugin_version,
203
- true );
204
-
205
- $params = array(
206
- 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
207
- 'requiredField' => __( 'This field is required.', 'strong-testimonials' ),
208
- 'errorMessage' => __( 'An error occurred, please try again.', 'strong-testimonials' ),
209
- 'restoreDefault' => __( 'Restore the default settings?', 'strong-testimonials' ),
210
- );
211
- wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
212
-
213
- /**
214
- * Are You Sure? for dirty forms
215
- *
216
- * @since 2.18
217
- */
218
- wp_register_script( 'wpmtst-ays-script',
219
- WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
220
- array( 'jquery' ),
221
- $plugin_version,
222
- true );
223
- }
224
-
225
- /**
226
- * Enqueue global admin scripts.
227
- */
228
- public static function admin_enqueue_scripts() {
229
- $plugin_version = get_option( 'wpmtst_plugin_version' );
230
-
231
- wp_enqueue_script( 'wpmtst-admin-global',
232
- WPMTST_ADMIN_URL . 'js/admin-global.js',
233
- array( 'jquery' ),
234
- $plugin_version,
235
- true );
236
-
237
- wp_localize_script(
238
- 'wpmtst-admin-global',
239
- 'wpmtst_admin',
240
- array(
241
- 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
242
- 'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
243
- )
244
- );
245
- }
246
-
247
- /**
248
- * Enqueue specific styles and scripts.
249
- *
250
- * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
251
- *
252
- * @since 2.12.0
253
- */
254
-
255
- /**
256
- * Views
257
- */
258
- public static function admin_views() {
259
- wp_enqueue_style( 'wpmtst-admin-style' );
260
- wp_enqueue_script( 'wpmtst-admin-script' );
261
-
262
- wp_enqueue_style( 'wpmtst-admin-views-style' );
263
- wp_enqueue_script( 'wpmtst-admin-views-script' );
264
- wp_enqueue_script( 'wpmtst-view-category-filter-script' );
265
-
266
- wp_enqueue_style( 'wp-color-picker' );
267
- }
268
-
269
- /**
270
- * Fields
271
- */
272
- public static function admin_fields() {
273
- wp_enqueue_style( 'wpmtst-admin-style' );
274
- wp_enqueue_script( 'wpmtst-admin-script' );
275
-
276
- wp_enqueue_style( 'wpmtst-admin-fields-style' );
277
- wp_enqueue_script( 'wpmtst-admin-fields-script' );
278
-
279
- wp_enqueue_style( 'wpmtst-admin-form-preview' );
280
- wp_enqueue_style( 'wpmtst-rating-form' );
281
- }
282
-
283
- /**
284
- * Settings
285
- */
286
- public static function admin_settings() {
287
- $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
288
-
289
- switch ( $tab ) {
290
- case 'form':
291
- wp_enqueue_style( 'wpmtst-admin-form-style' );
292
- wp_enqueue_script( 'wpmtst-admin-form-script' );
293
- break;
294
- case 'compat':
295
- wp_enqueue_style( 'wpmtst-admin-compat-style' );
296
- wp_enqueue_script( 'wpmtst-admin-compat-script' );
297
- break;
298
- case 'licenses':
299
- wp_enqueue_style( 'wpmtst-admin-style' );
300
- wp_enqueue_script( 'wpmtst-addons-script' );
301
- break;
302
- default:
303
- wp_enqueue_style( 'wpmtst-admin-style' );
304
- wp_enqueue_script( 'wpmtst-admin-script' );
305
- }
306
- }
307
-
308
- /**
309
- * About
310
- */
311
- public static function admin_about() {
312
- wp_enqueue_style( 'wpmtst-admin-style' );
313
- wp_enqueue_script( 'wpmtst-admin-script' );
314
- wp_enqueue_style( 'wpmtst-about-style' );
315
- }
316
-
317
- /**
318
- * Shortcodes
319
- *
320
- * @since 2.31.0
321
- */
322
- public static function admin_shortcodes() {
323
- wp_enqueue_style( 'wpmtst-admin-style' );
324
- wp_enqueue_style( 'wpmtst-rating-display' );
325
- }
326
-
327
- /**
328
- * List table
329
- */
330
- public static function admin_load_edit() {
331
- if ( wpmtst_is_testimonial_screen() ) {
332
- wp_enqueue_style( 'wpmtst-admin-style' );
333
- wp_enqueue_script( 'wpmtst-admin-script' );
334
- wp_enqueue_style( 'wpmtst-rating-display' );
335
- }
336
- }
337
-
338
- /**
339
- * Categories
340
- */
341
- public static function admin_load_edit_tags() {
342
- if ( wpmtst_is_testimonial_screen() ) {
343
- wp_enqueue_style( 'wpmtst-admin-style' );
344
- }
345
- }
346
-
347
- /**
348
- * Edit post
349
- */
350
- public static function admin_load_post() {
351
- if ( wpmtst_is_testimonial_screen() ) {
352
- wp_enqueue_style( 'wpmtst-post-editor' );
353
- wp_enqueue_script( 'wpmtst-admin-script' );
354
-
355
- wp_enqueue_style( 'wpmtst-rating-display' );
356
- wp_enqueue_style( 'wpmtst-rating-form' );
357
- wp_enqueue_script( 'wpmtst-rating-script' );
358
- }
359
- }
360
-
361
- /**
362
- * Known theme and plugin conflicts.
363
- *
364
- * @param $hook
365
- */
366
- public static function admin_dequeue_scripts( $hook ) {
367
- if ( wp_style_is( 'CPTStyleSheets' ) ) {
368
- wp_dequeue_style( 'CPTStyleSheets' );
369
- }
370
-
371
- $hooks_to_script = array(
372
- 'wpm-testimonial_page_testimonial-views',
373
- 'wpm-testimonial_page_testimonial-fields',
374
- 'wpm-testimonial_page_testimonial-settings',
375
- 'wpm-testimonial_page_about-strong-testimonials',
376
- );
377
-
378
- if ( wpmtst_is_testimonial_screen() ) {
379
- $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
380
- }
381
-
382
- /**
383
- * Block RT Themes and their overzealous JavaScript on our admin pages.
384
- * @since 2.2.12.1
385
- */
386
- if ( in_array( $hook, $hooks_to_script ) ) {
387
- if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
388
- wp_dequeue_script( 'admin-scripts' );
389
- }
390
- }
391
- }
392
-
393
- }
394
-
395
- 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(
49
+ 'wpmtst-font-awesome',
50
+ WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
51
+ array(),
52
+ '4.6.3'
53
+ );
54
+
55
+ wp_register_script(
56
+ 'wpmtst-help',
57
+ WPMTST_ADMIN_URL . 'js/help.js',
58
+ array( 'jquery' ),
59
+ $plugin_version,
60
+ true
61
+ );
62
+
63
+ wp_register_script(
64
+ 'wpmtst-admin-script',
65
+ WPMTST_ADMIN_URL . 'js/admin.js',
66
+ array( 'jquery', 'underscore' ),
67
+ $plugin_version,
68
+ true
69
+ );
70
+
71
+ wp_register_style(
72
+ 'wpmtst-admin-style',
73
+ WPMTST_ADMIN_URL . 'css/admin.css',
74
+ array( 'wpmtst-font-awesome' ),
75
+ $plugin_version
76
+ );
77
+
78
+ wp_register_style(
79
+ 'wpmtst-post-editor',
80
+ WPMTST_ADMIN_URL . 'css/post-editor.css',
81
+ array( 'wpmtst-font-awesome' ),
82
+ $plugin_version
83
+ );
84
+
85
+ wp_register_script(
86
+ 'wpmtst-custom-spinner',
87
+ WPMTST_ADMIN_URL . 'js/custom-spinner.js',
88
+ array( 'jquery' ),
89
+ $plugin_version,
90
+ true
91
+ );
92
+
93
+ wp_register_script(
94
+ 'autosize',
95
+ WPMTST_ADMIN_URL . 'js/lib/autosize/autosize.min.js',
96
+ array(),
97
+ '4.0.1',
98
+ true
99
+ );
100
+
101
+ /**
102
+ * Form tab
103
+ */
104
+ wp_register_style(
105
+ 'wpmtst-admin-form-style',
106
+ WPMTST_ADMIN_URL . 'css/admin-form.css',
107
+ array( 'wpmtst-admin-style' ),
108
+ $plugin_version
109
+ );
110
+
111
+ wp_register_script(
112
+ 'wpmtst-admin-form-script',
113
+ WPMTST_ADMIN_URL . 'js/admin-form.js',
114
+ array( 'wpmtst-admin-script', 'autosize' ),
115
+ $plugin_version,
116
+ true
117
+ );
118
+
119
+ /**
120
+ * Compatibility tab
121
+ */
122
+ wp_register_style(
123
+ 'wpmtst-admin-compat-style',
124
+ WPMTST_ADMIN_URL . 'css/admin-compat.css',
125
+ array(),
126
+ $plugin_version
127
+ );
128
+
129
+ wp_register_script(
130
+ 'wpmtst-admin-compat-script',
131
+ WPMTST_ADMIN_URL . 'js/admin-compat.js',
132
+ array( 'jquery', 'wpmtst-custom-spinner', 'wpmtst-help' ),
133
+ $plugin_version,
134
+ true
135
+ );
136
+
137
+ /**
138
+ * Fields
139
+ */
140
+ wp_register_style(
141
+ 'wpmtst-admin-fields-style',
142
+ WPMTST_ADMIN_URL . 'css/fields.css',
143
+ array(),
144
+ $plugin_version
145
+ );
146
+
147
+ wp_register_style(
148
+ 'wpmtst-admin-form-preview',
149
+ WPMTST_ADMIN_URL . 'css/form-preview.css',
150
+ array(),
151
+ $plugin_version
152
+ );
153
+
154
+ wp_register_script(
155
+ 'wpmtst-admin-fields-script',
156
+ WPMTST_ADMIN_URL . 'js/admin-fields.js',
157
+ array( 'jquery', 'jquery-ui-sortable', 'wpmtst-help' ),
158
+ $plugin_version,
159
+ true
160
+ );
161
+
162
+ $params = array(
163
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
164
+ 'newField' => _x( 'New Field', 'Field editor: The default label for new fields', 'strong-testimonials' ),
165
+ 'inUse' => _x( '(in use)', 'Fields editor: To indicate when a field type can only be used once.', 'strong-testimonials' ),
166
+ 'noneFound' => _x( '(none found)', 'Fields editor: To indicate when no categories have been found.', 'strong-testimonials' ),
167
+ );
168
+ wp_localize_script( 'wpmtst-admin-fields-script', 'wpmtstAdmin', $params );
169
+
170
+ /**
171
+ * Ratings
172
+ */
173
+ wp_register_style(
174
+ 'wpmtst-rating-display',
175
+ WPMTST_PUBLIC_URL . 'css/rating-display.css',
176
+ array( 'wpmtst-font-awesome' ),
177
+ $plugin_version
178
+ );
179
+
180
+ wp_register_style(
181
+ 'wpmtst-rating-form',
182
+ WPMTST_PUBLIC_URL . 'css/rating-form.css',
183
+ array( 'wpmtst-font-awesome' ),
184
+ $plugin_version
185
+ );
186
+
187
+ wp_register_script(
188
+ 'wpmtst-rating-script',
189
+ WPMTST_ADMIN_URL . 'js/rating-edit.js',
190
+ array( 'jquery' ),
191
+ $plugin_version,
192
+ true
193
+ );
194
+
195
+ /**
196
+ * Views
197
+ */
198
+ wp_register_style(
199
+ 'wpmtst-admin-views-style',
200
+ WPMTST_ADMIN_URL . 'css/views.css',
201
+ array(),
202
+ $plugin_version
203
+ );
204
+
205
+ wp_register_script(
206
+ 'wpmtst-admin-views-script',
207
+ WPMTST_ADMIN_URL . 'js/views.js',
208
+ array( 'jquery', 'jquery-ui-sortable', 'wp-color-picker', 'jquery-masonry', 'wpmtst-help' ),
209
+ $plugin_version,
210
+ true
211
+ );
212
+
213
+ /**
214
+ * Category filter in View editor.
215
+ *
216
+ * JavaScript adapted under GPL-2.0+ license
217
+ * from Post Category Filter plugin by Javier Villanueva (http://www.jahvi.com)
218
+ *
219
+ * @since 2.2.0
220
+ */
221
+ wp_register_script(
222
+ 'wpmtst-view-category-filter-script',
223
+ WPMTST_ADMIN_URL . 'js/view-category-filter.js',
224
+ array( 'jquery' ),
225
+ $plugin_version,
226
+ true
227
+ );
228
+
229
+ wp_register_style(
230
+ 'wpmtst-about-style',
231
+ WPMTST_ADMIN_URL . 'css/about.css',
232
+ array(),
233
+ $plugin_version
234
+ );
235
+
236
+ /**
237
+ * Add-on licenses
238
+ *
239
+ * @since 2.18
240
+ */
241
+ wp_register_script(
242
+ 'wpmtst-addons-script',
243
+ WPMTST_ADMIN_URL . 'js/addon-licenses.js',
244
+ array( 'jquery' ),
245
+ $plugin_version,
246
+ true
247
+ );
248
+
249
+ $params = array(
250
+ 'ajax_nonce' => wp_create_nonce( 'wpmtst-admin' ),
251
+ 'requiredField' => __( 'This field is required.', 'strong-testimonials' ),
252
+ 'errorMessage' => __( 'An error occurred, please try again.', 'strong-testimonials' ),
253
+ 'restoreDefault' => __( 'Restore the default settings?', 'strong-testimonials' ),
254
+ );
255
+ wp_localize_script( 'wpmtst-addons-script', 'strongAddonAdmin', $params );
256
+
257
+ /**
258
+ * Are You Sure? for dirty forms
259
+ *
260
+ * @since 2.18
261
+ */
262
+ wp_register_script(
263
+ 'wpmtst-ays-script',
264
+ WPMTST_ADMIN_URL . "js/lib/are-you-sure/jquery.are-you-sure{$min}.js",
265
+ array( 'jquery' ),
266
+ $plugin_version,
267
+ true
268
+ );
269
+ }
270
+
271
+ /**
272
+ * Enqueue global admin scripts.
273
+ */
274
+ public static function admin_enqueue_scripts() {
275
+ $plugin_version = get_option( 'wpmtst_plugin_version' );
276
+
277
+ wp_enqueue_script(
278
+ 'wpmtst-admin-global',
279
+ WPMTST_ADMIN_URL . 'js/admin-global.js',
280
+ array( 'jquery' ),
281
+ $plugin_version,
282
+ true
283
+ );
284
+
285
+ wp_localize_script(
286
+ 'wpmtst-admin-global',
287
+ 'wpmtst_admin',
288
+ array(
289
+ 'nonce' => wp_create_nonce( 'wpmtst-admin' ),
290
+ 'templateTagTitle' => __( 'click to insert into message at caret', 'strong-testimonials' ),
291
+ )
292
+ );
293
+ }
294
+
295
+ /**
296
+ * Enqueue specific styles and scripts.
297
+ *
298
+ * Using separate hooks for readability, troubleshooting, and future refactoring. Focus on _where_.
299
+ *
300
+ * @since 2.12.0
301
+ */
302
+
303
+ /**
304
+ * Views
305
+ */
306
+ public static function admin_views() {
307
+ wp_enqueue_style( 'wpmtst-admin-style' );
308
+ wp_enqueue_script( 'wpmtst-admin-script' );
309
+
310
+ wp_enqueue_style( 'wpmtst-admin-views-style' );
311
+ wp_enqueue_script( 'wpmtst-admin-views-script' );
312
+ wp_enqueue_script( 'wpmtst-view-category-filter-script' );
313
+
314
+ wp_enqueue_style( 'wp-color-picker' );
315
+ }
316
+
317
+ /**
318
+ * Fields
319
+ */
320
+ public static function admin_fields() {
321
+ wp_enqueue_style( 'wpmtst-admin-style' );
322
+ wp_enqueue_script( 'wpmtst-admin-script' );
323
+
324
+ wp_enqueue_style( 'wpmtst-admin-fields-style' );
325
+ wp_enqueue_script( 'wpmtst-admin-fields-script' );
326
+
327
+ wp_enqueue_style( 'wpmtst-admin-form-preview' );
328
+ wp_enqueue_style( 'wpmtst-rating-form' );
329
+ }
330
+
331
+ /**
332
+ * Settings
333
+ */
334
+ public static function admin_settings() {
335
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
336
+
337
+ switch ( $tab ) {
338
+ case 'form':
339
+ wp_enqueue_style( 'wpmtst-admin-form-style' );
340
+ wp_enqueue_script( 'wpmtst-admin-form-script' );
341
+ break;
342
+ case 'compat':
343
+ wp_enqueue_style( 'wpmtst-admin-compat-style' );
344
+ wp_enqueue_script( 'wpmtst-admin-compat-script' );
345
+ break;
346
+ case 'licenses':
347
+ wp_enqueue_style( 'wpmtst-admin-style' );
348
+ wp_enqueue_script( 'wpmtst-addons-script' );
349
+ break;
350
+ default:
351
+ wp_enqueue_style( 'wpmtst-admin-style' );
352
+ wp_enqueue_script( 'wpmtst-admin-script' );
353
+ }
354
+ }
355
+
356
+ /**
357
+ * About
358
+ */
359
+ public static function admin_about() {
360
+ wp_enqueue_style( 'wpmtst-admin-style' );
361
+ wp_enqueue_script( 'wpmtst-admin-script' );
362
+ wp_enqueue_style( 'wpmtst-about-style' );
363
+ }
364
+
365
+ /**
366
+ * Shortcodes
367
+ *
368
+ * @since 2.31.0
369
+ */
370
+ public static function admin_shortcodes() {
371
+ wp_enqueue_style( 'wpmtst-admin-style' );
372
+ wp_enqueue_style( 'wpmtst-rating-display' );
373
+ }
374
+
375
+ /**
376
+ * List table
377
+ */
378
+ public static function admin_load_edit() {
379
+ if ( wpmtst_is_testimonial_screen() ) {
380
+ wp_enqueue_style( 'wpmtst-admin-style' );
381
+ wp_enqueue_script( 'wpmtst-admin-script' );
382
+ wp_enqueue_style( 'wpmtst-rating-display' );
383
+ }
384
+ }
385
+
386
+ /**
387
+ * Categories
388
+ */
389
+ public static function admin_load_edit_tags() {
390
+ if ( wpmtst_is_testimonial_screen() ) {
391
+ wp_enqueue_style( 'wpmtst-admin-style' );
392
+ }
393
+ }
394
+
395
+ /**
396
+ * Edit post
397
+ */
398
+ public static function admin_load_post() {
399
+ if ( wpmtst_is_testimonial_screen() ) {
400
+ wp_enqueue_style( 'wpmtst-post-editor' );
401
+ wp_enqueue_script( 'wpmtst-admin-script' );
402
+
403
+ wp_enqueue_style( 'wpmtst-rating-display' );
404
+ wp_enqueue_style( 'wpmtst-rating-form' );
405
+ wp_enqueue_script( 'wpmtst-rating-script' );
406
+ }
407
+ }
408
+
409
+ /**
410
+ * Known theme and plugin conflicts.
411
+ *
412
+ * @param $hook
413
+ */
414
+ public static function admin_dequeue_scripts( $hook ) {
415
+ if ( wp_style_is( 'CPTStyleSheets' ) ) {
416
+ wp_dequeue_style( 'CPTStyleSheets' );
417
+ }
418
+
419
+ $hooks_to_script = array(
420
+ 'wpm-testimonial_page_testimonial-views',
421
+ 'wpm-testimonial_page_testimonial-fields',
422
+ 'wpm-testimonial_page_testimonial-settings',
423
+ 'wpm-testimonial_page_about-strong-testimonials',
424
+ );
425
+
426
+ if ( wpmtst_is_testimonial_screen() ) {
427
+ $hooks_to_script = array_merge( $hooks_to_script, array( 'edit.php' ) );
428
+ }
429
+
430
+ /**
431
+ * Block RT Themes and their overzealous JavaScript on our admin pages.
432
+ * @since 2.2.12.1
433
+ */
434
+ if ( in_array( $hook, $hooks_to_script ) ) {
435
+ if ( class_exists( 'RTThemeAdmin' ) && wp_script_is( 'admin-scripts' ) ) {
436
+ wp_dequeue_script( 'admin-scripts' );
437
+ }
438
+ }
439
+ }
440
+
441
+ }
442
+
443
+ Strong_Testimonials_Admin_Scripts::init();
admin/class-strong-testimonials-defaults.php CHANGED
@@ -1,882 +1,885 @@
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
- 'scrolltop' => true,
41
- 'scrolltop_offset' => 80,
42
- 'no_lazyload' => true,
43
- 'touch_enabled' => true,
44
- );
45
-
46
- return $default_options;
47
- }
48
-
49
- /**
50
- * Custom field base.
51
- *
52
- * @since 2.28.0 Use 'action' to register a callback.
53
- *
54
- * @return array
55
- */
56
- public static function get_field_base() {
57
- return apply_filters( 'wpmtst_field_base', array(
58
- 'name' => '',
59
- 'name_mutable' => 1,
60
- 'label' => '',
61
- 'show_label' => 1,
62
- 'input_type' => '',
63
- 'action_input' => '',
64
- 'action_output' => '',
65
- 'text' => '',
66
- 'show_text_option' => 0,
67
- 'required' => 0,
68
- 'show_required_option' => 1,
69
- 'default_form_value' => '',
70
- 'default_display_value' => '',
71
- 'show_default_options' => 1,
72
- 'error' => __( 'This field is required.', 'strong-testimonials' ),
73
- 'placeholder' => '',
74
- 'show_placeholder_option' => 1,
75
- 'before' => '',
76
- 'after' => '',
77
- 'admin_table' => 0,
78
- 'admin_table_option' => 1,
79
- 'show_admin_table_option' => 1,
80
- 'shortcode_on_form' => '',
81
- 'shortcode_on_display' => '',
82
- 'show_shortcode_options' => 0,
83
- ) );
84
- }
85
-
86
- /**
87
- * Custom fields.
88
- *
89
- * @return array
90
- */
91
- public static function get_fields() {
92
- $field_base = self::get_field_base();
93
- $field_types = array();
94
-
95
- /*
96
- * Assemble post field types
97
- */
98
- $field_types['post'] = array(
99
- 'post_title' => array(
100
- 'input_type' => 'text',
101
- 'option_label' => __( 'Testimonial Title', 'strong-testimonials' ),
102
- 'map' => 'post_title',
103
- 'show_default_options' => 0,
104
- 'admin_table' => 1,
105
- 'admin_table_option' => 0,
106
- 'show_admin_table_option' => 0,
107
- 'name_mutable' => 0,
108
- ),
109
- 'post_content' => array(
110
- 'input_type' => 'textarea',
111
- 'option_label' => __( 'Testimonial Content', 'strong-testimonials' ),
112
- 'map' => 'post_content',
113
- 'required' => 1,
114
- 'show_default_options' => 0,
115
- 'core' => 0,
116
- 'admin_table' => 0,
117
- 'show_admin_table_option' => 0,
118
- 'name_mutable' => 0,
119
- ),
120
- 'featured_image' => array(
121
- 'input_type' => 'file',
122
- 'option_label' => __( 'Featured Image', 'strong-testimonials' ),
123
- 'map' => 'featured_image',
124
- 'show_default_options' => 0,
125
- 'show_placeholder_option' => 0,
126
- 'admin_table' => 0,
127
- 'name_mutable' => 0,
128
- ),
129
- );
130
- foreach ( $field_types['post'] as $key => $array ) {
131
- $field_types['post'][ $key ] = array_merge( $field_base, $array );
132
- }
133
-
134
- /*
135
- * Assemble custom field types
136
- */
137
- $field_types['custom'] = array(
138
- 'text' => array(
139
- 'input_type' => 'text',
140
- 'option_label' => __( 'text', 'strong-testimonials' ),
141
- ),
142
- 'email' => array(
143
- 'input_type' => 'email',
144
- 'option_label' => __( 'email', 'strong-testimonials' ),
145
- 'show_default_options' => 0,
146
- ),
147
- 'url' => array(
148
- 'input_type' => 'url',
149
- 'option_label' => __( 'URL', 'strong-testimonials' ),
150
- 'show_default_options' => 0,
151
- ),
152
- 'checkbox' => array(
153
- 'input_type' => 'checkbox',
154
- 'option_label' => __( 'checkbox', 'strong-testimonials' ),
155
- 'show_text_option' => 1,
156
- 'show_placeholder_option' => 0,
157
- ),
158
- );
159
- foreach ( $field_types['custom'] as $key => $array ) {
160
- $field_types['custom'][ $key ] = array_merge( $field_base, $array );
161
- }
162
-
163
- /*
164
- * Assemble special field types (FKA Optional)
165
- *
166
- * @since 1.18
167
- * @since 2.2.2 Fix bug caused by localizing 'categories'
168
- */
169
- $field_types['optional'] = array(
170
- 'category-selector' => array(
171
- 'input_type' => 'category-selector',
172
- 'option_label' => __( 'category selector', 'strong-testimonials' ),
173
- 'show_default_options' => 0,
174
- 'show_placeholder_option' => 0,
175
- 'show_admin_table_option' => 0,
176
- 'name_mutable' => 0,
177
- ),
178
- 'category-checklist' => array(
179
- 'input_type' => 'category-checklist',
180
- 'option_label' => __( 'category checklist', 'strong-testimonials' ),
181
- 'show_default_options' => 0,
182
- 'show_placeholder_option' => 0,
183
- 'show_admin_table_option' => 0,
184
- 'name_mutable' => 0,
185
- ),
186
- 'shortcode' => array(
187
- 'input_type' => 'shortcode',
188
- 'option_label' => __( 'shortcode', 'strong-testimonials' ),
189
- 'show_label' => 0,
190
- 'required' => 0,
191
- 'show_required_option' => 0,
192
- 'show_default_options' => 0,
193
- 'show_placeholder_option' => 0,
194
- 'show_admin_table_option' => 0,
195
- 'show_shortcode_options' => 1,
196
- ),
197
- 'rating' => array(
198
- 'input_type' => 'rating',
199
- 'option_label' => __( 'star rating', 'strong-testimonials' ),
200
- 'show_placeholder_option' => 0,
201
- 'admin_table' => 1,
202
- 'admin_table_option' => 1,
203
- 'show_admin_table_option' => 1,
204
- ),
205
- );
206
-
207
- /*
208
- * Merge each one onto base field
209
- */
210
- foreach ( $field_types['optional'] as $key => $array ) {
211
- $field_types['optional'][ $key ] = array_merge( $field_base, $array );
212
- }
213
-
214
- /*
215
- * Assemble all fields
216
- */
217
- $default_fields = array(
218
- 'field_base' => $field_base,
219
- 'field_types' => $field_types,
220
- );
221
-
222
- return apply_filters( 'wpmtst_default_fields', $default_fields );
223
- }
224
-
225
- /**
226
- * Default forms.
227
- *
228
- * @return array
229
- */
230
- public static function get_base_forms() {
231
- $default_fields = self::get_fields();
232
-
233
- // Assemble field groups.
234
- $forms = array(
235
- 'default' => array(
236
- 'name' => 'default',
237
- 'label' => __( 'Default Form', 'strong-testimonials' ),
238
- 'readonly' => 1,
239
- 'fields' => array(
240
- // ------
241
- // CUSTOM
242
- // ------
243
- 0 => array(
244
- 'record_type' => 'custom',
245
- 'name' => 'client_name',
246
- 'label' => __( 'Full Name', 'strong-testimonials' ),
247
- 'input_type' => 'text',
248
- 'required' => 1,
249
- 'after' => __( 'What is your full name?', 'strong-testimonials' ),
250
- 'admin_table' => 1,
251
- ),
252
- 1 => array(
253
- 'record_type' => 'custom',
254
- 'name' => 'email',
255
- 'label' => __( 'Email', 'strong-testimonials' ),
256
- 'input_type' => 'email',
257
- 'required' => 1,
258
- 'after' => __( 'What is your email address?', 'strong-testimonials' ),
259
- ),
260
- 3 => array(
261
- 'record_type' => 'custom',
262
- 'name' => 'company_name',
263
- 'label' => __( 'Company Name', 'strong-testimonials' ),
264
- 'input_type' => 'text',
265
- 'after' => __( 'What is your company name?', 'strong-testimonials' ),
266
- ),
267
- 4 => array(
268
- 'record_type' => 'custom',
269
- 'name' => 'company_website',
270
- 'label' => __( 'Company Website', 'strong-testimonials' ),
271
- 'input_type' => 'url',
272
- 'after' => __( 'Does your company have a website?', 'strong-testimonials' ),
273
- ),
274
- // ----
275
- // POST
276
- // ----
277
- 5 => array(
278
- 'record_type' => 'post',
279
- 'name' => 'post_title',
280
- 'label' => __( 'Heading', 'strong-testimonials' ),
281
- 'input_type' => 'text',
282
- 'required' => 0,
283
- 'after' => __( 'A headline for your testimonial.', 'strong-testimonials' ),
284
- ),
285
- 6 => array(
286
- 'record_type' => 'post',
287
- 'name' => 'post_content',
288
- 'label' => __( 'Testimonial', 'strong-testimonials' ),
289
- 'input_type' => 'textarea',
290
- 'required' => 1,
291
- 'after' => __( 'What do you think about us?', 'strong-testimonials' ),
292
- ),
293
- 7 => array(
294
- 'record_type' => 'post',
295
- 'name' => 'featured_image',
296
- 'label' => __( 'Photo', 'strong-testimonials' ),
297
- 'input_type' => 'file',
298
- 'after' => __( 'Would you like to include a photo?', 'strong-testimonials' ),
299
- 'admin_table' => 1,
300
- ),
301
- ),
302
- ),
303
- );
304
-
305
- $forms['minimal'] = array(
306
- 'name' => 'minimal',
307
- 'label' => __( 'Minimal Form', 'strong-testimonials' ),
308
- 'readonly' => 1,
309
- 'fields' => array(
310
- // ------
311
- // CUSTOM
312
- // ------
313
- 0 => array(
314
- 'record_type' => 'custom',
315
- 'name' => 'client_name',
316
- 'label' => __( 'Name', 'strong-testimonials' ),
317
- 'input_type' => 'text',
318
- 'required' => 1,
319
- 'after' => '',
320
- 'admin_table' => 1,
321
- ),
322
- 1 => array(
323
- 'record_type' => 'custom',
324
- 'name' => 'email',
325
- 'label' => __( 'Email', 'strong-testimonials' ),
326
- 'input_type' => 'email',
327
- 'required' => 1,
328
- 'after' => '',
329
- ),
330
- // ----
331
- // POST
332
- // ----
333
- 2 => array(
334
- 'record_type' => 'post',
335
- 'name' => 'post_content',
336
- 'label' => __( 'Testimonial', 'strong-testimonials' ),
337
- 'input_type' => 'textarea',
338
- 'required' => 1,
339
- 'after' => '',
340
- ),
341
- ),
342
- );
343
-
344
- foreach ( $forms as $form_name => $form ) {
345
- foreach ( $form['fields'] as $key => $array ) {
346
- if ( 'post' == $array['record_type'] ) {
347
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
348
- } else {
349
- $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
350
- }
351
- }
352
- }
353
-
354
- return $forms;
355
- }
356
-
357
- /**
358
- * Custom forms.
359
- *
360
- * @return array
361
- */
362
- public static function get_custom_forms() {
363
-
364
- $base_forms = self::get_base_forms();
365
-
366
- // Copy default fields to custom fields.
367
- $forms[1] = array(
368
- 'name' => 'custom',
369
- 'label' => __( 'Custom Form', 'strong-testimonials' ),
370
- 'readonly' => 0,
371
- 'fields' => $base_forms['default']['fields'],
372
- );
373
-
374
- return $forms;
375
- }
376
-
377
- /**
378
- * Form options.
379
- *
380
- * @return array
381
- */
382
- public static function get_form_options() {
383
- /**
384
- * Messages
385
- *
386
- * @since 1.13
387
- */
388
- $default_messages = array(
389
- 'required-field' => array(
390
- 'order' => 1,
391
- /* translators: Settings > Form > Messages tab */
392
- 'description' => _x( 'Required', 'setting description', 'strong-testimonials' ),
393
- 'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
394
- 'enabled' => 1,
395
- ),
396
- 'captcha' => array(
397
- 'order' => 2,
398
- /* translators: Settings > Form > Messages tab */
399
- 'description' => _x( 'Captcha Label', 'description', 'strong-testimonials' ),
400
- 'text' => _x( 'Captcha', 'Default label for Captcha field on submission form.', 'strong-testimonials' ),
401
- 'required' => false,
402
- ),
403
- 'form-submit-button' => array(
404
- 'order' => 3,
405
- /* translators: Settings > Form > Messages tab */
406
- 'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
407
- /* translators: Default label for the Submit button on testimonial form. */
408
- 'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
409
- ),
410
- 'submission-error' => array(
411
- 'order' => 4,
412
- /* translators: Settings > Form > Messages tab */
413
- 'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
414
- /* translators: Default message for submission form error. */
415
- 'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
416
- ),
417
- 'submission-success' => array(
418
- 'order' => 5,
419
- /* translators: Settings > Form > Messages tab */
420
- 'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
421
- /* translators: Default message for submission form success message. */
422
- 'text' => _x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
423
- ),
424
- );
425
-
426
- uasort( $default_messages, 'wpmtst_uasort' );
427
-
428
- $default_form_options = array(
429
- 'post_status' => 'pending',
430
- 'admin_notify' => false,
431
- 'mail_queue' => false,
432
- 'sender_name' => get_bloginfo( 'name' ),
433
- 'sender_site_email' => true,
434
- 'sender_email' => '',
435
- 'recipients' => array(
436
- array(
437
- 'admin_name' => '',
438
- 'admin_email' => '',
439
- 'admin_site_email' => true,
440
- 'primary' => true, // cannot be deleted
441
- ),
442
- ),
443
- 'default_recipient' => array(
444
- 'admin_name' => '',
445
- 'admin_email' => '',
446
- ),
447
- /* translators: Default subject line for new testimonial notification email. */
448
- 'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
449
- /* translators: Default message for new testimonial notification email. */
450
- 'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
451
- 'captcha' => '',
452
- 'honeypot_before' => false,
453
- 'honeypot_after' => false,
454
- 'messages' => $default_messages,
455
- 'scrolltop_success' => true,
456
- 'scrolltop_success_offset' => 80,
457
- 'scrolltop_error' => true,
458
- 'scrolltop_error_offset' => 80,
459
- 'success_action' => 'message', // message | id | url
460
- 'success_redirect_id' => '',
461
- 'success_redirect_url' => '',
462
- );
463
-
464
- return $default_form_options;
465
- }
466
-
467
- /**
468
- * Default view options.
469
- *
470
- * @since 1.21.0
471
- *
472
- * @return array
473
- */
474
- public static function get_view_options() {
475
- $default_view_options = array(
476
-
477
- 'mode' => array(
478
- 'display' => array(
479
- 'name' => 'display',
480
- 'label' => __( 'Display', 'strong-testimonials' ),
481
- 'description' => __( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
482
- ),
483
- 'slideshow' => array(
484
- 'name' => 'slideshow',
485
- 'label' => __( 'Slideshow', 'strong-testimonials' ),
486
- 'description' => __( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
487
- ),
488
- 'form' => array(
489
- 'name' => 'form',
490
- 'label' => __( 'Form', 'strong-testimonials' ),
491
- 'description' => __( 'Display a testimonial submission form.', 'strong-testimonials' ),
492
- ),
493
- 'single_template' => array(
494
- 'name' => 'single_template',
495
- 'label' => __( 'Single Template', 'strong-testimonials' ),
496
- 'description' => __( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
497
- ),
498
- ),
499
-
500
- 'order' => array(
501
- 'random' => _x( 'random', 'display order', 'strong-testimonials' ),
502
- 'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
503
- 'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
504
- 'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
505
- ),
506
-
507
- 'slideshow_effect' => array(
508
- 'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
509
- 'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
510
- 'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
511
- 'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
512
- ),
513
-
514
- 'slideshow_height' => array(
515
- 'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
516
- 'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
517
- ),
518
-
519
- 'slideshow_nav_method' => array(
520
- 'controls' => array(
521
- 'none' => array(
522
- 'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
523
- 'args' => array( // base args; style will add more args
524
- 'controls' => 0,
525
- 'pager' => 0,
526
- 'autoControls' => 0,
527
- ),
528
- ),
529
- 'full' => array(
530
- 'label' => _x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
531
- 'class' => 'controls-type-full',
532
- 'add_position_class' => 1,
533
- 'args' => array(
534
- 'pager' => 0,
535
- 'autoControls' => 1,
536
- 'autoControlsCombine' => 1,
537
- 'fullSetButtons' => 1,
538
- 'fullSetText' => 1,
539
- ),
540
- ),
541
- 'simple' => array(
542
- 'label' => _x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
543
- 'class' => 'controls-type-simple',
544
- 'add_position_class' => 1,
545
- 'args' => array(
546
- 'controls' => 1,
547
- 'autoControls' => 0,
548
- ),
549
- ),
550
- 'sides' => array(
551
- 'label' => _x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
552
- 'class' => 'controls-type-sides',
553
- 'add_position_class' => 0,
554
- 'args' => array(
555
- 'controls' => 1,
556
- 'autoControls' => 0,
557
- 'prevText' => '',
558
- 'nextText' => '',
559
- ),
560
- ),
561
- ),
562
- 'pager' => array(
563
- 'none' => array(
564
- 'label' => _x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
565
- 'args' => array(),
566
- ),
567
- 'full' => array(
568
- 'label' => _x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
569
- //'class' => 'controls-pager-full',
570
- 'class' => 'pager-type-full',
571
- 'args' => array(
572
- 'pager' => 1,
573
- ),
574
- ),
575
- ),
576
- ),
577
-
578
- 'slideshow_nav_style' => array(
579
- 'controls' => array(
580
- 'buttons' => array(
581
- 'label' => _x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
582
- 'class' => 'controls-style-buttons',
583
- 'args' => array(
584
- 'startText' => '',
585
- 'stopText' => '',
586
- 'prevText' => '',
587
- 'nextText' => '',
588
- ),
589
- ),
590
- 'buttons2' => array(
591
- 'label' => _x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
592
- 'class' => 'controls-style-buttons2',
593
- 'args' => array(
594
- 'startText' => '',
595
- 'stopText' => '',
596
- 'prevText' => '',
597
- 'nextText' => '',
598
- ),
599
- ),
600
- 'buttons3' => array(
601
- 'label' => _x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
602
- 'class' => 'controls-style-buttons3',
603
- 'args' => array(
604
- 'startText' => '',
605
- 'stopText' => '',
606
- 'prevText' => '',
607
- 'nextText' => '',
608
- ),
609
- ),
610
- 'text' => array(
611
- 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
612
- 'class' => 'controls-style-text',
613
- 'args' => array(
614
- 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
615
- 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
616
- 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
617
- 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
618
- ),
619
- ),
620
- ),
621
- 'pager' => array(
622
- 'buttons' => array(
623
- 'label' => _x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
624
- 'class' => 'pager-style-buttons',
625
- 'args' => array(
626
- 'buildPager' => 'icons',
627
- 'simpleSetPager' => 1,
628
- ),
629
- ),
630
- 'text' => array(
631
- 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
632
- 'class' => 'pager-style-text',
633
- 'args' => array(
634
- 'buildPager' => null,
635
- 'simpleSetText' => 1,
636
- ),
637
- ),
638
- ),
639
- ),
640
-
641
- // Position is shared by Controls and Pagination.
642
- 'slideshow_nav_position' => array(
643
- 'inside' => _x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
644
- 'outside' => _x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
645
- ),
646
- );
647
-
648
- return $default_view_options;
649
- }
650
-
651
- /**
652
- * Default view configuration.
653
- *
654
- * @since 1.21.0
655
- *
656
- * @return array
657
- */
658
- public static function get_default_view() {
659
- $default_view = array(
660
- 'background' => array(
661
- 'color' => '',
662
- 'type' => '',
663
- 'preset' => '',
664
- 'gradient1' => '',
665
- 'gradient2' => '',
666
- ),
667
- 'category' => 'all',
668
- 'class' => '',
669
- 'client_section' => array(
670
- 0 => array(
671
- 'field' => 'client_name',
672
- 'type' => 'text',
673
- 'before' => '',
674
- 'class' => 'testimonial-name',
675
- ),
676
- 1 => array(
677
- 'field' => 'company_name',
678
- 'type' => 'link',
679
- 'before' => '',
680
- 'url' => 'company_website',
681
- 'class' => 'testimonial-company',
682
- 'new_tab' => true,
683
- ),
684
- ),
685
- 'column_count' => 2,
686
- 'container_class' => '',
687
- 'container_data' => '',
688
- 'content' => 'entire',
689
- 'count' => -1,
690
- 'divi_builder' => 0,
691
- 'excerpt_length' => 55,
692
- 'font-color' => array(
693
- 'color' => '',
694
- 'type' => '',
695
- ),
696
- 'form_ajax' => 0,
697
- 'form_id' => 1,
698
- 'gravatar' => 'no',
699
- 'id' => '',
700
- 'layout' => '',
701
- 'lightbox' => '',
702
- 'lightbox_class' => '',
703
- 'mode' => 'display',
704
- 'more_full_post' => false,
705
- 'more_post' => true,
706
- 'more_post_ellipsis' => true,
707
- 'more_post_text' => _x( 'Read more', 'link', 'strong-testimonials' ),
708
- 'more_post_in_place' => false,
709
- 'less_post' => false,
710
- 'less_post_text' => __( 'Show less', 'strong-testimonials' ),
711
- 'more_page' => false,
712
- 'more_page_hook' => 'wpmtst_view_footer',
713
- 'more_page_id' => 0,
714
- 'more_page_text' => _x( 'Read more testimonials', 'link', 'strong-testimonials' ),
715
- 'note' => '',
716
- 'order' => 'oldest',
717
- 'page' => '',
718
- 'pagination' => false,
719
- 'pagination_settings' => array(
720
- 'type' => 'simple',
721
- 'nav' => 'after',
722
- 'per_page' => 5,
723
- 'show_all' => 0,
724
- 'end_size' => 1,
725
- 'mid_size' => 2,
726
- 'prev_next' => 1,
727
- 'prev_text' => __( '&laquo; Previous', 'strong-testimonials' ),
728
- 'next_text' => __( 'Next &raquo;', 'strong-testimonials' ),
729
- 'before_page_number' => '',
730
- 'after_page_number' => '',
731
- ),
732
- 'slideshow_settings' => array(
733
- 'type' => 'show_single', // or show_multiple
734
- 'show_single' => array(
735
- 'max_slides' => 1,
736
- 'move_slides' => 1,
737
- 'margin' => 1,
738
- ),
739
- 'breakpoints' => array(
740
- 'desktop' => array(
741
- 'description' => 'Desktop',
742
- 'width' => 1200,
743
- 'max_slides' => 2,
744
- 'move_slides' => 1,
745
- 'margin' => 20,
746
- ),
747
- 'large' => array(
748
- 'description' => 'Large',
749
- 'width' => 1024,
750
- 'max_slides' => 2,
751
- 'move_slides' => 1,
752
- 'margin' => 20,
753
- ),
754
- 'medium' => array(
755
- 'description' => 'Medium',
756
- 'width' => 640,
757
- 'max_slides' => 1,
758
- 'move_slides' => 1,
759
- 'margin' => 10,
760
- ),
761
- 'small' => array(
762
- 'description' => 'Small',
763
- 'width' => 480,
764
- 'max_slides' => 1,
765
- 'move_slides' => 1,
766
- 'margin' => 1,
767
- ),
768
- ),
769
- 'effect' => 'fade',
770
- 'speed' => 1,
771
- 'pause' => 8,
772
- 'auto_start' => true,
773
- 'auto_hover' => true,
774
- 'adapt_height' => true,
775
- 'adapt_height_speed' => .5,
776
- 'stretch' => 0,
777
- 'stop_auto_on_click' => true,
778
- 'controls_type' => 'none',
779
- 'controls_style' => 'buttons',
780
- 'pager_type' => 'none',
781
- 'pager_style' => 'buttons',
782
- 'nav_position' => 'inside',
783
- ),
784
- 'template' => 'default',
785
- 'template_settings' => array(),
786
- 'thumbnail' => true,
787
- 'thumbnail_size' => 'thumbnail',
788
- 'thumbnail_height' => null,
789
- 'thumbnail_width' => null,
790
- 'title' => true,
791
- 'title_link' => false,
792
- 'use_default_length' => true,
793
- 'use_default_more' => false,
794
- 'view' => '',
795
- );
796
- ksort( $default_view );
797
-
798
- return $default_view;
799
- }
800
-
801
- /**
802
- * Compatibility options.
803
- *
804
- * @since 2.28.0
805
- * @since 2.31.0 controller
806
- * @since 2.31.0 lazyload
807
- * @return array
808
- */
809
- public static function get_compat_options() {
810
- $options = array(
811
- 'page_loading' => '', // (blank) | general | advanced
812
- 'prerender' => 'current', // current | all | none
813
- 'ajax' => array(
814
- 'method' => '', // (blank) | universal | observer | event | script
815
- 'universal_timer' => 0.5,
816
- 'observer_timer' => 0.5,
817
- 'container_id' => 'page', // = what we listen to (try page > content > primary)
818
- 'addednode_id' => 'content', // = what we listen for
819
- 'event' => '',
820
- 'script' => '',
821
- ),
822
- 'controller' => array(
823
- 'initialize_on' => 'documentReady', // or windowLoad
824
- ),
825
- 'lazyload' => array(
826
- 'enabled' => '',
827
- 'classes' => array( // may be multiple pairs
828
- array(
829
- 'start' => '',
830
- 'finish' => '',
831
- )
832
- ),
833
- ),
834
- );
835
-
836
- return $options;
837
- }
838
-
839
- /**
840
- * Build list of supported Captcha plugins.
841
- *
842
- * @since 2.28.5 In this class.
843
- */
844
- public static function get_captcha_plugins() {
845
- $plugins = array(
846
- 'google-captcha' => array(
847
- 'name' => 'Google Captcha by BestWebSoft (free)',
848
- 'desc' => __( '<strong>Recommended.</strong> The best choice for both Invisible reCAPTCHA and reCAPTCHA V2 ("I\'m not a robot" checkbox).', 'strong-testimonials' ),
849
- 'class' => 'Google_Captcha',
850
- 'file' => 'google-captcha/google-captcha.php',
851
- 'settings' => 'admin.php?page=google-captcha.php',
852
- 'search' => 'plugin-install.php?tab=search&s=Google+Captcha',
853
- 'url' => 'https://wordpress.org/plugins/google-captcha',
854
- 'installed' => false,
855
- 'active' => false,
856
- ),
857
- 'captcha-pro' => array(
858
- 'name' => 'Captcha Pro by BestWebSoft (premium)',
859
- 'desc' => __( 'An excellent plugin for math- and image-based captchas.', 'strong-testimonials' ),
860
- 'class' => 'Captcha_Pro',
861
- 'file' => 'captcha-pro/captcha_pro.php',
862
- 'settings' => 'admin.php?page=captcha_pro.php',
863
- 'search' => '',
864
- 'url' => 'https://bestwebsoft.com/products/wordpress/plugins/captcha/',
865
- 'installed' => false,
866
- 'active' => false,
867
- ),
868
- 'really-simple-captcha' => array(
869
- 'name' => 'Really Simple Captcha by Takayuki Miyoshi (free)',
870
- 'class' => 'Really_Simple_Captcha',
871
- 'file' => 'really-simple-captcha/really-simple-captcha.php',
872
- 'search' => 'plugin-install.php?tab=search&s=Really+Simple+Captcha',
873
- 'url' => 'https://wordpress.org/plugins/really-simple-captcha/',
874
- 'installed' => false,
875
- 'active' => false,
876
- ),
877
- );
878
-
879
- return $plugins;
880
- }
881
-
882
- }
 
 
 
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
+ 'scrolltop' => true,
41
+ 'scrolltop_offset' => 80,
42
+ 'no_lazyload' => true,
43
+ 'touch_enabled' => true,
44
+ );
45
+
46
+ return $default_options;
47
+ }
48
+
49
+ /**
50
+ * Custom field base.
51
+ *
52
+ * @since 2.28.0 Use 'action' to register a callback.
53
+ *
54
+ * @return array
55
+ */
56
+ public static function get_field_base() {
57
+ return apply_filters(
58
+ 'wpmtst_field_base',
59
+ array(
60
+ 'name' => '',
61
+ 'name_mutable' => 1,
62
+ 'label' => '',
63
+ 'show_label' => 1,
64
+ 'input_type' => '',
65
+ 'action_input' => '',
66
+ 'action_output' => '',
67
+ 'text' => '',
68
+ 'show_text_option' => 0,
69
+ 'required' => 0,
70
+ 'show_required_option' => 1,
71
+ 'default_form_value' => '',
72
+ 'default_display_value' => '',
73
+ 'show_default_options' => 1,
74
+ 'error' => __( 'This field is required.', 'strong-testimonials' ),
75
+ 'placeholder' => '',
76
+ 'show_placeholder_option' => 1,
77
+ 'before' => '',
78
+ 'after' => '',
79
+ 'admin_table' => 0,
80
+ 'admin_table_option' => 1,
81
+ 'show_admin_table_option' => 1,
82
+ 'shortcode_on_form' => '',
83
+ 'shortcode_on_display' => '',
84
+ 'show_shortcode_options' => 0,
85
+ )
86
+ );
87
+ }
88
+
89
+ /**
90
+ * Custom fields.
91
+ *
92
+ * @return array
93
+ */
94
+ public static function get_fields() {
95
+ $field_base = self::get_field_base();
96
+ $field_types = array();
97
+
98
+ /*
99
+ * Assemble post field types
100
+ */
101
+ $field_types['post'] = array(
102
+ 'post_title' => array(
103
+ 'input_type' => 'text',
104
+ 'option_label' => __( 'Testimonial Title', 'strong-testimonials' ),
105
+ 'map' => 'post_title',
106
+ 'show_default_options' => 0,
107
+ 'admin_table' => 1,
108
+ 'admin_table_option' => 0,
109
+ 'show_admin_table_option' => 0,
110
+ 'name_mutable' => 0,
111
+ ),
112
+ 'post_content' => array(
113
+ 'input_type' => 'textarea',
114
+ 'option_label' => __( 'Testimonial Content', 'strong-testimonials' ),
115
+ 'map' => 'post_content',
116
+ 'required' => 1,
117
+ 'show_default_options' => 0,
118
+ 'core' => 0,
119
+ 'admin_table' => 0,
120
+ 'show_admin_table_option' => 0,
121
+ 'name_mutable' => 0,
122
+ ),
123
+ 'featured_image' => array(
124
+ 'input_type' => 'file',
125
+ 'option_label' => __( 'Featured Image', 'strong-testimonials' ),
126
+ 'map' => 'featured_image',
127
+ 'show_default_options' => 0,
128
+ 'show_placeholder_option' => 0,
129
+ 'admin_table' => 0,
130
+ 'name_mutable' => 0,
131
+ ),
132
+ );
133
+ foreach ( $field_types['post'] as $key => $array ) {
134
+ $field_types['post'][ $key ] = array_merge( $field_base, $array );
135
+ }
136
+
137
+ /*
138
+ * Assemble custom field types
139
+ */
140
+ $field_types['custom'] = array(
141
+ 'text' => array(
142
+ 'input_type' => 'text',
143
+ 'option_label' => __( 'text', 'strong-testimonials' ),
144
+ ),
145
+ 'email' => array(
146
+ 'input_type' => 'email',
147
+ 'option_label' => __( 'email', 'strong-testimonials' ),
148
+ 'show_default_options' => 0,
149
+ ),
150
+ 'url' => array(
151
+ 'input_type' => 'url',
152
+ 'option_label' => __( 'URL', 'strong-testimonials' ),
153
+ 'show_default_options' => 0,
154
+ ),
155
+ 'checkbox' => array(
156
+ 'input_type' => 'checkbox',
157
+ 'option_label' => __( 'checkbox', 'strong-testimonials' ),
158
+ 'show_text_option' => 1,
159
+ 'show_placeholder_option' => 0,
160
+ ),
161
+ );
162
+ foreach ( $field_types['custom'] as $key => $array ) {
163
+ $field_types['custom'][ $key ] = array_merge( $field_base, $array );
164
+ }
165
+
166
+ /*
167
+ * Assemble special field types (FKA Optional)
168
+ *
169
+ * @since 1.18
170
+ * @since 2.2.2 Fix bug caused by localizing 'categories'
171
+ */
172
+ $field_types['optional'] = array(
173
+ 'category-selector' => array(
174
+ 'input_type' => 'category-selector',
175
+ 'option_label' => __( 'category selector', 'strong-testimonials' ),
176
+ 'show_default_options' => 0,
177
+ 'show_placeholder_option' => 0,
178
+ 'show_admin_table_option' => 0,
179
+ 'name_mutable' => 0,
180
+ ),
181
+ 'category-checklist' => array(
182
+ 'input_type' => 'category-checklist',
183
+ 'option_label' => __( 'category checklist', 'strong-testimonials' ),
184
+ 'show_default_options' => 0,
185
+ 'show_placeholder_option' => 0,
186
+ 'show_admin_table_option' => 0,
187
+ 'name_mutable' => 0,
188
+ ),
189
+ 'shortcode' => array(
190
+ 'input_type' => 'shortcode',
191
+ 'option_label' => __( 'shortcode', 'strong-testimonials' ),
192
+ 'show_label' => 0,
193
+ 'required' => 0,
194
+ 'show_required_option' => 0,
195
+ 'show_default_options' => 0,
196
+ 'show_placeholder_option' => 0,
197
+ 'show_admin_table_option' => 0,
198
+ 'show_shortcode_options' => 1,
199
+ ),
200
+ 'rating' => array(
201
+ 'input_type' => 'rating',
202
+ 'option_label' => __( 'star rating', 'strong-testimonials' ),
203
+ 'show_placeholder_option' => 0,
204
+ 'admin_table' => 1,
205
+ 'admin_table_option' => 1,
206
+ 'show_admin_table_option' => 1,
207
+ ),
208
+ );
209
+
210
+ /*
211
+ * Merge each one onto base field
212
+ */
213
+ foreach ( $field_types['optional'] as $key => $array ) {
214
+ $field_types['optional'][ $key ] = array_merge( $field_base, $array );
215
+ }
216
+
217
+ /*
218
+ * Assemble all fields
219
+ */
220
+ $default_fields = array(
221
+ 'field_base' => $field_base,
222
+ 'field_types' => $field_types,
223
+ );
224
+
225
+ return apply_filters( 'wpmtst_default_fields', $default_fields );
226
+ }
227
+
228
+ /**
229
+ * Default forms.
230
+ *
231
+ * @return array
232
+ */
233
+ public static function get_base_forms() {
234
+ $default_fields = self::get_fields();
235
+
236
+ // Assemble field groups.
237
+ $forms = array(
238
+ 'default' => array(
239
+ 'name' => 'default',
240
+ 'label' => __( 'Default Form', 'strong-testimonials' ),
241
+ 'readonly' => 1,
242
+ 'fields' => array(
243
+ // ------
244
+ // CUSTOM
245
+ // ------
246
+ 0 => array(
247
+ 'record_type' => 'custom',
248
+ 'name' => 'client_name',
249
+ 'label' => __( 'Full Name', 'strong-testimonials' ),
250
+ 'input_type' => 'text',
251
+ 'required' => 1,
252
+ 'after' => __( 'What is your full name?', 'strong-testimonials' ),
253
+ 'admin_table' => 1,
254
+ ),
255
+ 1 => array(
256
+ 'record_type' => 'custom',
257
+ 'name' => 'email',
258
+ 'label' => __( 'Email', 'strong-testimonials' ),
259
+ 'input_type' => 'email',
260
+ 'required' => 1,
261
+ 'after' => __( 'What is your email address?', 'strong-testimonials' ),
262
+ ),
263
+ 3 => array(
264
+ 'record_type' => 'custom',
265
+ 'name' => 'company_name',
266
+ 'label' => __( 'Company Name', 'strong-testimonials' ),
267
+ 'input_type' => 'text',
268
+ 'after' => __( 'What is your company name?', 'strong-testimonials' ),
269
+ ),
270
+ 4 => array(
271
+ 'record_type' => 'custom',
272
+ 'name' => 'company_website',
273
+ 'label' => __( 'Company Website', 'strong-testimonials' ),
274
+ 'input_type' => 'url',
275
+ 'after' => __( 'Does your company have a website?', 'strong-testimonials' ),
276
+ ),
277
+ // ----
278
+ // POST
279
+ // ----
280
+ 5 => array(
281
+ 'record_type' => 'post',
282
+ 'name' => 'post_title',
283
+ 'label' => __( 'Heading', 'strong-testimonials' ),
284
+ 'input_type' => 'text',
285
+ 'required' => 0,
286
+ 'after' => __( 'A headline for your testimonial.', 'strong-testimonials' ),
287
+ ),
288
+ 6 => array(
289
+ 'record_type' => 'post',
290
+ 'name' => 'post_content',
291
+ 'label' => __( 'Testimonial', 'strong-testimonials' ),
292
+ 'input_type' => 'textarea',
293
+ 'required' => 1,
294
+ 'after' => __( 'What do you think about us?', 'strong-testimonials' ),
295
+ ),
296
+ 7 => array(
297
+ 'record_type' => 'post',
298
+ 'name' => 'featured_image',
299
+ 'label' => __( 'Photo', 'strong-testimonials' ),
300
+ 'input_type' => 'file',
301
+ 'after' => __( 'Would you like to include a photo?', 'strong-testimonials' ),
302
+ 'admin_table' => 1,
303
+ ),
304
+ ),
305
+ ),
306
+ );
307
+
308
+ $forms['minimal'] = array(
309
+ 'name' => 'minimal',
310
+ 'label' => __( 'Minimal Form', 'strong-testimonials' ),
311
+ 'readonly' => 1,
312
+ 'fields' => array(
313
+ // ------
314
+ // CUSTOM
315
+ // ------
316
+ 0 => array(
317
+ 'record_type' => 'custom',
318
+ 'name' => 'client_name',
319
+ 'label' => __( 'Name', 'strong-testimonials' ),
320
+ 'input_type' => 'text',
321
+ 'required' => 1,
322
+ 'after' => '',
323
+ 'admin_table' => 1,
324
+ ),
325
+ 1 => array(
326
+ 'record_type' => 'custom',
327
+ 'name' => 'email',
328
+ 'label' => __( 'Email', 'strong-testimonials' ),
329
+ 'input_type' => 'email',
330
+ 'required' => 1,
331
+ 'after' => '',
332
+ ),
333
+ // ----
334
+ // POST
335
+ // ----
336
+ 2 => array(
337
+ 'record_type' => 'post',
338
+ 'name' => 'post_content',
339
+ 'label' => __( 'Testimonial', 'strong-testimonials' ),
340
+ 'input_type' => 'textarea',
341
+ 'required' => 1,
342
+ 'after' => '',
343
+ ),
344
+ ),
345
+ );
346
+
347
+ foreach ( $forms as $form_name => $form ) {
348
+ foreach ( $form['fields'] as $key => $array ) {
349
+ if ( 'post' == $array['record_type'] ) {
350
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array );
351
+ } else {
352
+ $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array );
353
+ }
354
+ }
355
+ }
356
+
357
+ return $forms;
358
+ }
359
+
360
+ /**
361
+ * Custom forms.
362
+ *
363
+ * @return array
364
+ */
365
+ public static function get_custom_forms() {
366
+
367
+ $base_forms = self::get_base_forms();
368
+
369
+ // Copy default fields to custom fields.
370
+ $forms[1] = array(
371
+ 'name' => 'custom',
372
+ 'label' => __( 'Custom Form', 'strong-testimonials' ),
373
+ 'readonly' => 0,
374
+ 'fields' => $base_forms['default']['fields'],
375
+ );
376
+
377
+ return $forms;
378
+ }
379
+
380
+ /**
381
+ * Form options.
382
+ *
383
+ * @return array
384
+ */
385
+ public static function get_form_options() {
386
+ /**
387
+ * Messages
388
+ *
389
+ * @since 1.13
390
+ */
391
+ $default_messages = array(
392
+ 'required-field' => array(
393
+ 'order' => 1,
394
+ /* translators: Settings > Form > Messages tab */
395
+ 'description' => _x( 'Required', 'setting description', 'strong-testimonials' ),
396
+ 'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
397
+ 'enabled' => 1,
398
+ ),
399
+ 'captcha' => array(
400
+ 'order' => 2,
401
+ /* translators: Settings > Form > Messages tab */
402
+ 'description' => _x( 'Captcha Label', 'description', 'strong-testimonials' ),
403
+ 'text' => _x( 'Captcha', 'Default label for Captcha field on submission form.', 'strong-testimonials' ),
404
+ 'required' => false,
405
+ ),
406
+ 'form-submit-button' => array(
407
+ 'order' => 3,
408
+ /* translators: Settings > Form > Messages tab */
409
+ 'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
410
+ /* translators: Default label for the Submit button on testimonial form. */
411
+ 'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
412
+ ),
413
+ 'submission-error' => array(
414
+ 'order' => 4,
415
+ /* translators: Settings > Form > Messages tab */
416
+ 'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
417
+ /* translators: Default message for submission form error. */
418
+ 'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
419
+ ),
420
+ 'submission-success' => array(
421
+ 'order' => 5,
422
+ /* translators: Settings > Form > Messages tab */
423
+ 'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
424
+ /* translators: Default message for submission form success message. */
425
+ 'text' => _x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ),
426
+ ),
427
+ );
428
+
429
+ uasort( $default_messages, 'wpmtst_uasort' );
430
+
431
+ $default_form_options = array(
432
+ 'post_status' => 'pending',
433
+ 'admin_notify' => false,
434
+ 'mail_queue' => false,
435
+ 'sender_name' => get_bloginfo( 'name' ),
436
+ 'sender_site_email' => true,
437
+ 'sender_email' => '',
438
+ 'recipients' => array(
439
+ array(
440
+ 'admin_name' => '',
441
+ 'admin_email' => '',
442
+ 'admin_site_email' => true,
443
+ 'primary' => true, // cannot be deleted
444
+ ),
445
+ ),
446
+ 'default_recipient' => array(
447
+ 'admin_name' => '',
448
+ 'admin_email' => '',
449
+ ),
450
+ /* translators: Default subject line for new testimonial notification email. */
451
+ 'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
452
+ /* translators: Default message for new testimonial notification email. */
453
+ 'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
454
+ 'captcha' => '',
455
+ 'honeypot_before' => false,
456
+ 'honeypot_after' => false,
457
+ 'messages' => $default_messages,
458
+ 'scrolltop_success' => true,
459
+ 'scrolltop_success_offset' => 80,
460
+ 'scrolltop_error' => true,
461
+ 'scrolltop_error_offset' => 80,
462
+ 'success_action' => 'message', // message | id | url
463
+ 'success_redirect_id' => '',
464
+ 'success_redirect_url' => '',
465
+ );
466
+
467
+ return $default_form_options;
468
+ }
469
+
470
+ /**
471
+ * Default view options.
472
+ *
473
+ * @since 1.21.0
474
+ *
475
+ * @return array
476
+ */
477
+ public static function get_view_options() {
478
+ $default_view_options = array(
479
+
480
+ 'mode' => array(
481
+ 'display' => array(
482
+ 'name' => 'display',
483
+ 'label' => __( 'Display', 'strong-testimonials' ),
484
+ 'description' => __( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ),
485
+ ),
486
+ 'slideshow' => array(
487
+ 'name' => 'slideshow',
488
+ 'label' => __( 'Slideshow', 'strong-testimonials' ),
489
+ 'description' => __( 'Create a slideshow of your testimonials.', 'strong-testimonials' ),
490
+ ),
491
+ 'form' => array(
492
+ 'name' => 'form',
493
+ 'label' => __( 'Form', 'strong-testimonials' ),
494
+ 'description' => __( 'Display a testimonial submission form.', 'strong-testimonials' ),
495
+ ),
496
+ 'single_template' => array(
497
+ 'name' => 'single_template',
498
+ 'label' => __( 'Single Template', 'strong-testimonials' ),
499
+ 'description' => __( 'When viewing the testimonial using a theme\'s single post template.', 'strong-testimonials' ),
500
+ ),
501
+ ),
502
+
503
+ 'order' => array(
504
+ 'random' => _x( 'random', 'display order', 'strong-testimonials' ),
505
+ 'menu_order' => _x( 'menu order', 'display order', 'strong-testimonials' ),
506
+ 'newest' => _x( 'newest first', 'display order', 'strong-testimonials' ),
507
+ 'oldest' => _x( 'oldest first', 'display order', 'strong-testimonials' ),
508
+ ),
509
+
510
+ 'slideshow_effect' => array(
511
+ 'none' => _x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ),
512
+ 'fade' => _x( 'fade', 'slideshow transition option', 'strong-testimonials' ),
513
+ 'horizontal' => _x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ),
514
+ 'vertical' => _x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ),
515
+ ),
516
+
517
+ 'slideshow_height' => array(
518
+ 'dynamic' => _x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ),
519
+ 'static' => _x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ),
520
+ ),
521
+
522
+ 'slideshow_nav_method' => array(
523
+ 'controls' => array(
524
+ 'none' => array(
525
+ 'label' => _x( 'none', 'slideshow controls option', 'strong-testimonials' ),
526
+ 'args' => array( // base args; style will add more args
527
+ 'controls' => 0,
528
+ 'pager' => 0,
529
+ 'autoControls' => 0,
530
+ ),
531
+ ),
532
+ 'full' => array(
533
+ 'label' => _x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ),
534
+ 'class' => 'controls-type-full',
535
+ 'add_position_class' => 1,
536
+ 'args' => array(
537
+ 'pager' => 0,
538
+ 'autoControls' => 1,
539
+ 'autoControlsCombine' => 1,
540
+ 'fullSetButtons' => 1,
541
+ 'fullSetText' => 1,
542
+ ),
543
+ ),
544
+ 'simple' => array(
545
+ 'label' => _x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ),
546
+ 'class' => 'controls-type-simple',
547
+ 'add_position_class' => 1,
548
+ 'args' => array(
549
+ 'controls' => 1,
550
+ 'autoControls' => 0,
551
+ ),
552
+ ),
553
+ 'sides' => array(
554
+ 'label' => _x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ),
555
+ 'class' => 'controls-type-sides',
556
+ 'add_position_class' => 0,
557
+ 'args' => array(
558
+ 'controls' => 1,
559
+ 'autoControls' => 0,
560
+ 'prevText' => '',
561
+ 'nextText' => '',
562
+ ),
563
+ ),
564
+ ),
565
+ 'pager' => array(
566
+ 'none' => array(
567
+ 'label' => _x( 'none', 'slideshow navigation option', 'strong-testimonials' ),
568
+ 'args' => array(),
569
+ ),
570
+ 'full' => array(
571
+ 'label' => _x( 'full', 'slideshow navigation option', 'strong-testimonials' ),
572
+ //'class' => 'controls-pager-full',
573
+ 'class' => 'pager-type-full',
574
+ 'args' => array(
575
+ 'pager' => 1,
576
+ ),
577
+ ),
578
+ ),
579
+ ),
580
+
581
+ 'slideshow_nav_style' => array(
582
+ 'controls' => array(
583
+ 'buttons' => array(
584
+ 'label' => _x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ),
585
+ 'class' => 'controls-style-buttons',
586
+ 'args' => array(
587
+ 'startText' => '',
588
+ 'stopText' => '',
589
+ 'prevText' => '',
590
+ 'nextText' => '',
591
+ ),
592
+ ),
593
+ 'buttons2' => array(
594
+ 'label' => _x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ),
595
+ 'class' => 'controls-style-buttons2',
596
+ 'args' => array(
597
+ 'startText' => '',
598
+ 'stopText' => '',
599
+ 'prevText' => '',
600
+ 'nextText' => '',
601
+ ),
602
+ ),
603
+ 'buttons3' => array(
604
+ 'label' => _x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ),
605
+ 'class' => 'controls-style-buttons3',
606
+ 'args' => array(
607
+ 'startText' => '',
608
+ 'stopText' => '',
609
+ 'prevText' => '',
610
+ 'nextText' => '',
611
+ ),
612
+ ),
613
+ 'text' => array(
614
+ 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
615
+ 'class' => 'controls-style-text',
616
+ 'args' => array(
617
+ 'startText' => _x( 'Play', 'slideshow control', 'strong-testimonials' ),
618
+ 'stopText' => _x( 'Pause', 'slideshow control', 'strong-testimonials' ),
619
+ 'prevText' => _x( 'Previous', 'slideshow_control', 'strong-testimonials' ),
620
+ 'nextText' => _x( 'Next', 'slideshow_control', 'strong-testimonials' ),
621
+ ),
622
+ ),
623
+ ),
624
+ 'pager' => array(
625
+ 'buttons' => array(
626
+ 'label' => _x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ),
627
+ 'class' => 'pager-style-buttons',
628
+ 'args' => array(
629
+ 'buildPager' => 'icons',
630
+ 'simpleSetPager' => 1,
631
+ ),
632
+ ),
633
+ 'text' => array(
634
+ 'label' => _x( 'text', 'slideshow navigation option', 'strong-testimonials' ),
635
+ 'class' => 'pager-style-text',
636
+ 'args' => array(
637
+ 'buildPager' => null,
638
+ 'simpleSetText' => 1,
639
+ ),
640
+ ),
641
+ ),
642
+ ),
643
+
644
+ // Position is shared by Controls and Pagination.
645
+ 'slideshow_nav_position' => array(
646
+ 'inside' => _x( 'inside', 'slideshow navigation option', 'strong-testimonials' ),
647
+ 'outside' => _x( 'outside', 'slideshow navigation option', 'strong-testimonials' ),
648
+ ),
649
+ );
650
+
651
+ return $default_view_options;
652
+ }
653
+
654
+ /**
655
+ * Default view configuration.
656
+ *
657
+ * @since 1.21.0
658
+ *
659
+ * @return array
660
+ */
661
+ public static function get_default_view() {
662
+ $default_view = array(
663
+ 'background' => array(
664
+ 'color' => '',
665
+ 'type' => '',
666
+ 'preset' => '',
667
+ 'gradient1' => '',
668
+ 'gradient2' => '',
669
+ ),
670
+ 'category' => 'all',
671
+ 'class' => '',
672
+ 'client_section' => array(
673
+ 0 => array(
674
+ 'field' => 'client_name',
675
+ 'type' => 'text',
676
+ 'before' => '',
677
+ 'class' => 'testimonial-name',
678
+ ),
679
+ 1 => array(
680
+ 'field' => 'company_name',
681
+ 'type' => 'link',
682
+ 'before' => '',
683
+ 'url' => 'company_website',
684
+ 'class' => 'testimonial-company',
685
+ 'new_tab' => true,
686
+ ),
687
+ ),
688
+ 'column_count' => 2,
689
+ 'container_class' => '',
690
+ 'container_data' => '',
691
+ 'content' => 'entire',
692
+ 'count' => -1,
693
+ 'divi_builder' => 0,
694
+ 'excerpt_length' => 55,
695
+ 'font-color' => array(
696
+ 'color' => '',
697
+ 'type' => '',
698
+ ),
699
+ 'form_ajax' => 0,
700
+ 'form_id' => 1,
701
+ 'gravatar' => 'no',
702
+ 'id' => '',
703
+ 'layout' => '',
704
+ 'lightbox' => '',
705
+ 'lightbox_class' => '',
706
+ 'mode' => 'display',
707
+ 'more_full_post' => false,
708
+ 'more_post' => true,
709
+ 'more_post_ellipsis' => true,
710
+ 'more_post_text' => _x( 'Read more', 'link', 'strong-testimonials' ),
711
+ 'more_post_in_place' => false,
712
+ 'less_post' => false,
713
+ 'less_post_text' => __( 'Show less', 'strong-testimonials' ),
714
+ 'more_page' => false,
715
+ 'more_page_hook' => 'wpmtst_view_footer',
716
+ 'more_page_id' => 0,
717
+ 'more_page_text' => _x( 'Read more testimonials', 'link', 'strong-testimonials' ),
718
+ 'note' => '',
719
+ 'order' => 'oldest',
720
+ 'page' => '',
721
+ 'pagination' => false,
722
+ 'pagination_settings' => array(
723
+ 'type' => 'simple',
724
+ 'nav' => 'after',
725
+ 'per_page' => 5,
726
+ 'show_all' => 0,
727
+ 'end_size' => 1,
728
+ 'mid_size' => 2,
729
+ 'prev_next' => 1,
730
+ 'prev_text' => __( '&laquo; Previous', 'strong-testimonials' ),
731
+ 'next_text' => __( 'Next &raquo;', 'strong-testimonials' ),
732
+ 'before_page_number' => '',
733
+ 'after_page_number' => '',
734
+ ),
735
+ 'slideshow_settings' => array(
736
+ 'type' => 'show_single', // or show_multiple
737
+ 'show_single' => array(
738
+ 'max_slides' => 1,
739
+ 'move_slides' => 1,
740
+ 'margin' => 1,
741
+ ),
742
+ 'breakpoints' => array(
743
+ 'desktop' => array(
744
+ 'description' => 'Desktop',
745
+ 'width' => 1200,
746
+ 'max_slides' => 2,
747
+ 'move_slides' => 1,
748
+ 'margin' => 20,
749
+ ),
750
+ 'large' => array(
751
+ 'description' => 'Large',
752
+ 'width' => 1024,
753
+ 'max_slides' => 2,
754
+ 'move_slides' => 1,
755
+ 'margin' => 20,
756
+ ),
757
+ 'medium' => array(
758
+ 'description' => 'Medium',
759
+ 'width' => 640,
760
+ 'max_slides' => 1,
761
+ 'move_slides' => 1,
762
+ 'margin' => 10,
763
+ ),
764
+ 'small' => array(
765
+ 'description' => 'Small',
766
+ 'width' => 480,
767
+ 'max_slides' => 1,
768
+ 'move_slides' => 1,
769
+ 'margin' => 1,
770
+ ),
771
+ ),
772
+ 'effect' => 'fade',
773
+ 'speed' => 1,
774
+ 'pause' => 8,
775
+ 'auto_start' => true,
776
+ 'auto_hover' => true,
777
+ 'adapt_height' => true,
778
+ 'adapt_height_speed' => .5,
779
+ 'stretch' => 0,
780
+ 'stop_auto_on_click' => true,
781
+ 'controls_type' => 'none',
782
+ 'controls_style' => 'buttons',
783
+ 'pager_type' => 'none',
784
+ 'pager_style' => 'buttons',
785
+ 'nav_position' => 'inside',
786
+ ),
787
+ 'template' => 'default',
788
+ 'template_settings' => array(),
789
+ 'thumbnail' => true,
790
+ 'thumbnail_size' => 'thumbnail',
791
+ 'thumbnail_height' => null,
792
+ 'thumbnail_width' => null,
793
+ 'title' => true,
794
+ 'title_link' => false,
795
+ 'use_default_length' => true,
796
+ 'use_default_more' => false,
797
+ 'view' => '',
798
+ );
799
+ ksort( $default_view );
800
+
801
+ return $default_view;
802
+ }
803
+
804
+ /**
805
+ * Compatibility options.
806
+ *
807
+ * @since 2.28.0
808
+ * @since 2.31.0 controller
809
+ * @since 2.31.0 lazyload
810
+ * @return array
811
+ */
812
+ public static function get_compat_options() {
813
+ $options = array(
814
+ 'page_loading' => '', // (blank) | general | advanced
815
+ 'prerender' => 'current', // current | all | none
816
+ 'ajax' => array(
817
+ 'method' => '', // (blank) | universal | observer | event | script
818
+ 'universal_timer' => 0.5,
819
+ 'observer_timer' => 0.5,
820
+ 'container_id' => 'page', // = what we listen to (try page > content > primary)
821
+ 'addednode_id' => 'content', // = what we listen for
822
+ 'event' => '',
823
+ 'script' => '',
824
+ ),
825
+ 'controller' => array(
826
+ 'initialize_on' => 'documentReady', // or windowLoad
827
+ ),
828
+ 'lazyload' => array(
829
+ 'enabled' => '',
830
+ 'classes' => array( // may be multiple pairs
831
+ array(
832
+ 'start' => '',
833
+ 'finish' => '',
834
+ ),
835
+ ),
836
+ ),
837
+ );
838
+
839
+ return $options;
840
+ }
841
+
842
+ /**
843
+ * Build list of supported Captcha plugins.
844
+ *
845
+ * @since 2.28.5 In this class.
846
+ */
847
+ public static function get_captcha_plugins() {
848
+ $plugins = array(
849
+ 'google-captcha' => array(
850
+ 'name' => 'Google Captcha by BestWebSoft (free)',
851
+ 'desc' => __( '<strong>Recommended.</strong> The best choice for both Invisible reCAPTCHA and reCAPTCHA V2 ("I\'m not a robot" checkbox).', 'strong-testimonials' ),
852
+ 'class' => 'Google_Captcha',
853
+ 'file' => 'google-captcha/google-captcha.php',
854
+ 'settings' => 'admin.php?page=google-captcha.php',
855
+ 'search' => 'plugin-install.php?tab=search&s=Google+Captcha',
856
+ 'url' => 'https://wordpress.org/plugins/google-captcha',
857
+ 'installed' => false,
858
+ 'active' => false,
859
+ ),
860
+ 'captcha-pro' => array(
861
+ 'name' => 'Captcha Pro by BestWebSoft (premium)',
862
+ 'desc' => __( 'An excellent plugin for math- and image-based captchas.', 'strong-testimonials' ),
863
+ 'class' => 'Captcha_Pro',
864
+ 'file' => 'captcha-pro/captcha_pro.php',
865
+ 'settings' => 'admin.php?page=captcha_pro.php',
866
+ 'search' => '',
867
+ 'url' => 'https://bestwebsoft.com/products/wordpress/plugins/captcha/',
868
+ 'installed' => false,
869
+ 'active' => false,
870
+ ),
871
+ 'really-simple-captcha' => array(
872
+ 'name' => 'Really Simple Captcha by Takayuki Miyoshi (free)',
873
+ 'class' => 'Really_Simple_Captcha',
874
+ 'file' => 'really-simple-captcha/really-simple-captcha.php',
875
+ 'search' => 'plugin-install.php?tab=search&s=Really+Simple+Captcha',
876
+ 'url' => 'https://wordpress.org/plugins/really-simple-captcha/',
877
+ 'installed' => false,
878
+ 'active' => false,
879
+ ),
880
+ );
881
+
882
+ return $plugins;
883
+ }
884
+
885
+ }
admin/class-strong-testimonials-help.php CHANGED
@@ -1,227 +1,277 @@
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="https://strongplugins.com/document/strong-testimonials/complete-example-customizing-form/" target="_blank">' . __( 'Tutorial', 'strong-testimonials' ) . '</a>',
69
- '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
70
- );
71
-
72
- $content .= '<p>' . implode( ' | ', $links ) . '</p>';
73
-
74
- get_current_screen()->add_help_tab( array(
75
- 'id' => 'wpmtst-help',
76
- 'title' => __( 'Form Fields', 'strong-testimonials' ),
77
- 'content' => $content,
78
- ) );
79
- }
80
-
81
- /**
82
- * About views.
83
- */
84
- public static function views_list() {
85
- ob_start();
86
- ?>
87
- <div>
88
- <p><?php _e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
89
- <p><?php _e( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ); ?></p>
90
- <p><?php _e( 'For example:', 'strong-testimonials' ); ?></p>
91
- <ul class="standard">
92
- <li><?php _e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
93
- <li><?php _e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
94
- <li><?php _e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
95
- <?php do_action( 'wpmtst_views_intro_list' ); ?>
96
- </ul>
97
- <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>
98
- </div>
99
- <?php
100
- $content = ob_get_clean();
101
-
102
- get_current_screen()->add_help_tab( array(
103
- 'id' => 'wpmtst-help-views',
104
- 'title' => __( 'About Views', 'strong-testimonials' ),
105
- 'content' => $content,
106
- ) );
107
- }
108
-
109
- /**
110
- * Shortcode attributes.
111
- */
112
- public static function shortcode_attributes() {
113
- if ( ! isset( $_GET['action'] ) ) {
114
- return;
115
- }
116
-
117
- ob_start();
118
- ?>
119
- <div>
120
- <p><?php _e( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ); ?>
121
- <p><?php _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ); ?>
122
- <p><?php _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' ); ?>
123
- <p><?php _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' ); ?>
124
- <p>
125
- <?php _e( '<code>[testimonial_view id="1" category="service-1"]</code>', 'strong-testimonials' ); ?>,
126
- <?php _e( '<code>[testimonial_view id="1" category="service-2"]</code>', 'strong-testimonials' ); ?>, etc.
127
- </p>
128
- <p>
129
- <?php _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ); ?>
130
- <?php _e( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>', 'strong-testimonials' ); ?>
131
- </p>
132
- <p><?php _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>
133
- </div>
134
- <?php
135
- $content = ob_get_clean();
136
-
137
- get_current_screen()->add_help_tab( array(
138
- 'id' => 'wpmtst-help-shortcode',
139
- 'title' => __( 'Shortcode Attributes', 'strong-testimonials' ),
140
- 'content' => $content,
141
- ) );
142
- }
143
-
144
- /**
145
- * Pagination comparison.
146
- */
147
- public static function view_editor_pagination() {
148
- if ( ! isset( $_GET['action'] ) ) {
149
- return;
150
- }
151
-
152
- ob_start();
153
- ?>
154
- <p><?php _e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
155
-
156
- <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
157
- <thead>
158
- <tr>
159
- <th></th>
160
- <th><?php _e( 'Simple', 'strong-testimonials' ); ?></th>
161
- <th><?php _e( 'Standard', 'strong-testimonials' ); ?></th>
162
- </tr>
163
- </thead>
164
- <tbody>
165
- <tr>
166
- <td><?php _e( 'best use', 'strong-testimonials' ); ?></td>
167
- <td><?php _e( 'ten pages or less', 'strong-testimonials' ); ?></td>
168
- <td><?php _e( 'more than ten pages', 'strong-testimonials' ); ?></td>
169
- </tr>
170
- <tr>
171
- <td><?php _e( 'URLs', 'strong-testimonials' ); ?></td>
172
- <td><?php _e( 'does not change the URL', 'strong-testimonials' ); ?></td>
173
- <td><?php _e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
174
- </tr>
175
- <tr>
176
- <td><?php _e( 'the Back button', 'strong-testimonials' ); ?></td>
177
- <td><?php _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>
178
- <td><?php _e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td>
179
- </tr>
180
- <tr>
181
- <td><?php _e( 'works with random order option', 'strong-testimonials' ); ?></td>
182
- <td><?php _e( 'yes' ); ?></td>
183
- <td><?php _e( 'no' ); ?></td>
184
- </tr>
185
- <tr>
186
- <td><?php _e( 'works in a widget', 'strong-testimonials' ); ?></td>
187
- <td><?php _e( 'yes' ); ?></td>
188
- <td><?php _e( 'no' ); ?></td>
189
- </tr>
190
- </tbody>
191
- </table>
192
- <?php
193
- $content = ob_get_clean();
194
-
195
- get_current_screen()->add_help_tab( array(
196
- 'id' => 'wpmtst-help-pagination',
197
- 'title' => __( 'Pagination', 'strong-testimonials' ),
198
- 'content' => $content,
199
- ) );
200
- }
201
-
202
- /**
203
- * Slideshow stretch explanation.
204
- */
205
- public static function view_editor_stretch() {
206
- if ( ! isset( $_GET['action'] ) ) {
207
- return;
208
- }
209
-
210
- ob_start();
211
- ?>
212
- <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>
213
- <p><?php _e( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
214
- <p><?php _e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
215
- <?php
216
- $content = ob_get_clean();
217
-
218
- get_current_screen()->add_help_tab( array(
219
- 'id' => 'wpmtst-help-stretch',
220
- 'title' => __( 'Stretch', 'strong-testimonials' ),
221
- 'content' => $content,
222
- ) );
223
- }
224
-
225
- }
226
-
227
- 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 esc_html_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 esc_html_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
34
+ printf(
35
+ wp_kses(
36
+ __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ),
37
+ array(
38
+ 'a' => array(
39
+ 'href' => array(),
40
+ 'target' => array(),
41
+ ),
42
+ )
43
+ ),
44
+ esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' )
45
+ );
46
+ ?>
47
+ |
48
+ <?php
49
+ printf(
50
+ wp_kses(
51
+ __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ),
52
+ array(
53
+ 'a' => array(
54
+ 'href' => array(),
55
+ 'target' => array(),
56
+ ),
57
+ )
58
+ ),
59
+ esc_url( 'https://codepen.io/micikato/full/JroPNm/' )
60
+ );
61
+ ?>
62
+ |
63
+ <?php
64
+ printf(
65
+ wp_kses(
66
+ __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ),
67
+ array(
68
+ 'a' => array(
69
+ 'href' => array(),
70
+ 'target' => array(),
71
+ ),
72
+ )
73
+ ),
74
+ esc_url( 'https://css-tricks.com/fout-foit-foft/' )
75
+ );
76
+ ?>
77
+ </p>
78
+ <p><?php esc_html_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>
79
+ <p><?php esc_html_e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p>
80
+ <?php
81
+ $content = ob_get_clean();
82
+
83
+ get_current_screen()->add_help_tab(
84
+ array(
85
+ 'id' => 'wpmtst-help-prerender',
86
+ 'title' => __( 'Prerender', 'strong-testimonials' ),
87
+ 'content' => $content,
88
+ )
89
+ );
90
+ }
91
+
92
+ /**
93
+ * Custom fields editor.
94
+ */
95
+ public static function fields_editor() {
96
+ ob_start();
97
+ ?>
98
+ <p><?php esc_html_e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p>
99
+ <p><?php esc_html_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>
100
+ <p><?php esc_html_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>
101
+ <p><?php esc_html_e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> <?php printf( esc_html__( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
102
+ <p><?php esc_html_e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p>
103
+ <?php
104
+ $content = ob_get_clean();
105
+
106
+ // Links
107
+
108
+ $links = array(
109
+ '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>',
110
+ );
111
+
112
+ $content .= '<p>' . implode( ' | ', $links ) . '</p>';
113
+
114
+ get_current_screen()->add_help_tab(
115
+ array(
116
+ 'id' => 'wpmtst-help',
117
+ 'title' => __( 'Form Fields', 'strong-testimonials' ),
118
+ 'content' => $content,
119
+ )
120
+ );
121
+ }
122
+
123
+ /**
124
+ * About views.
125
+ */
126
+ public static function views_list() {
127
+ ob_start();
128
+ ?>
129
+ <div>
130
+ <p><?php esc_html_e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?>
131
+ <p><?php esc_html_e( 'You can create an unlimited number of views.', 'strong-testimonials' ); ?></p>
132
+ <p><?php esc_html_e( 'For example:', 'strong-testimonials' ); ?></p>
133
+ <ul class="standard">
134
+ <li><?php esc_html_e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li>
135
+ <li><?php esc_html_e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li>
136
+ <li><?php esc_html_e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li>
137
+ <?php do_action( 'wpmtst_views_intro_list' ); ?>
138
+ </ul>
139
+ <p><?php esc_html_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>
140
+ </div>
141
+ <?php
142
+ $content = ob_get_clean();
143
+
144
+ get_current_screen()->add_help_tab(
145
+ array(
146
+ 'id' => 'wpmtst-help-views',
147
+ 'title' => __( 'About Views', 'strong-testimonials' ),
148
+ 'content' => $content,
149
+ )
150
+ );
151
+ }
152
+
153
+ /**
154
+ * Shortcode attributes.
155
+ */
156
+ public static function shortcode_attributes() {
157
+ if ( ! isset( $_GET['action'] ) ) {
158
+ return;
159
+ }
160
+
161
+ ob_start();
162
+ ?>
163
+ <div>
164
+ <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' ) ); ?>
165
+ <p><?php echo wp_kses_post( _e( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?>
166
+ <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' ) ); ?>
167
+ <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' ) ); ?>
168
+ <p>
169
+ <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-1"]</code>', 'strong-testimonials' ) ); ?>,
170
+ <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-2"]</code>', 'strong-testimonials' ) ); ?>, etc.
171
+ </p>
172
+ <p>
173
+ <?php echo wp_kses_post( _e( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?>
174
+ <?php echo wp_kses_post( _e( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>', 'strong-testimonials' ) ); ?>
175
+ </p>
176
+ <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>
177
+ </div>
178
+ <?php
179
+ $content = ob_get_clean();
180
+
181
+ get_current_screen()->add_help_tab(
182
+ array(
183
+ 'id' => 'wpmtst-help-shortcode',
184
+ 'title' => __( 'Shortcode Attributes', 'strong-testimonials' ),
185
+ 'content' => $content,
186
+ )
187
+ );
188
+ }
189
+
190
+ /**
191
+ * Pagination comparison.
192
+ */
193
+ public static function view_editor_pagination() {
194
+ if ( ! isset( $_GET['action'] ) ) {
195
+ return;
196
+ }
197
+
198
+ ob_start();
199
+ ?>
200
+ <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p>
201
+
202
+ <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0">
203
+ <thead>
204
+ <tr>
205
+ <th></th>
206
+ <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th>
207
+ <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th>
208
+ </tr>
209
+ </thead>
210
+ <tbody>
211
+ <tr>
212
+ <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td>
213
+ <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td>
214
+ <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td>
215
+ </tr>
216
+ <tr>
217
+ <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td>
218
+ <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td>
219
+ <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td>
220
+ </tr>
221
+ <tr>
222
+ <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td>
223
+ <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>
224
+ <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>
225
+ </tr>
226
+ <tr>
227
+ <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td>
228
+ <td><?php esc_html_e( 'yes' ); ?></td>
229
+ <td><?php esc_html_e( 'no' ); ?></td>
230
+ </tr>
231
+ <tr>
232
+ <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td>
233
+ <td><?php esc_html_e( 'yes' ); ?></td>
234
+ <td><?php esc_html_e( 'no' ); ?></td>
235
+ </tr>
236
+ </tbody>
237
+ </table>
238
+ <?php
239
+ $content = ob_get_clean();
240
+
241
+ get_current_screen()->add_help_tab(
242
+ array(
243
+ 'id' => 'wpmtst-help-pagination',
244
+ 'title' => __( 'Pagination', 'strong-testimonials' ),
245
+ 'content' => $content,
246
+ )
247
+ );
248
+ }
249
+
250
+ /**
251
+ * Slideshow stretch explanation.
252
+ */
253
+ public static function view_editor_stretch() {
254
+ if ( ! isset( $_GET['action'] ) ) {
255
+ return;
256
+ }
257
+
258
+ ob_start();
259
+ ?>
260
+ <p><?php esc_html_e( 'This will set the height of the slideshow container 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>
261
+ <p><?php esc_html_e( 'Select the Stretch option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ); ?></p>
262
+ <p><?php esc_html_e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p>
263
+ <?php
264
+ $content = ob_get_clean();
265
+
266
+ get_current_screen()->add_help_tab(
267
+ array(
268
+ 'id' => 'wpmtst-help-stretch',
269
+ 'title' => __( 'Stretch', 'strong-testimonials' ),
270
+ 'content' => $content,
271
+ )
272
+ );
273
+ }
274
+
275
+ }
276
+
277
+ Strong_Testimonials_Help::init();
admin/class-strong-testimonials-list-table.php CHANGED
@@ -1,1147 +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( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
89
- 'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
90
- 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
91
- 'single_row_columns' );
92
-
93
- /**
94
- * Constructor.
95
- *
96
- * The child class should call this constructor from its own constructor to override
97
- * the default $args.
98
- *
99
- * @since 3.1.0
100
- * @access public
101
- *
102
- * @param array|string $args {
103
- * Array or string of arguments.
104
- *
105
- * @type string $plural Plural value used for labels and the objects being listed.
106
- * This affects things such as CSS class-names and nonces used
107
- * in the list table, e.g. 'posts'. Default empty.
108
- * @type string $singular Singular label for an object being listed, e.g. 'post'.
109
- * Default empty
110
- * @type bool $ajax Whether the list table supports AJAX. This includes loading
111
- * and sorting data, for example. If true, the class will call
112
- * the {@see _js_vars()} method in the footer to provide variables
113
- * to any scripts handling AJAX events. Default false.
114
- * @type string $screen String containing the hook name used to determine the current
115
- * screen. If left null, the current screen will be automatically set.
116
- * Default null.
117
- * }
118
- */
119
- public function __construct( $args = array() ) {
120
- $args = wp_parse_args( $args, array(
121
- 'plural' => '',
122
- 'singular' => '',
123
- 'ajax' => false,
124
- 'screen' => null,
125
- ) );
126
-
127
- $this->screen = convert_to_screen( $args['screen'] );
128
-
129
- add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
130
-
131
- if ( !$args['plural'] )
132
- $args['plural'] = $this->screen->base;
133
-
134
- $args['plural'] = sanitize_key( $args['plural'] );
135
- $args['singular'] = sanitize_key( $args['singular'] );
136
-
137
- $this->_args = $args;
138
-
139
- if ( $args['ajax'] ) {
140
- // wp_enqueue_script( 'list-table' );
141
- add_action( 'admin_footer', array( $this, '_js_vars' ) );
142
- }
143
-
144
- if ( empty( $this->modes ) ) {
145
- $this->modes = array(
146
- 'list' => __( 'List View' ),
147
- 'excerpt' => __( 'Excerpt View' )
148
- );
149
- }
150
- }
151
-
152
- /**
153
- * Make private properties readable for backwards compatibility.
154
- *
155
- * @since 4.0.0
156
- * @access public
157
- *
158
- * @param string $name Property to get.
159
- * @return mixed Property.
160
- */
161
- public function __get( $name ) {
162
- if ( in_array( $name, $this->compat_fields ) ) {
163
- return $this->$name;
164
- }
165
- }
166
-
167
- /**
168
- * Make private properties settable for backwards compatibility.
169
- *
170
- * @since 4.0.0
171
- * @access public
172
- *
173
- * @param string $name Property to check if set.
174
- * @param mixed $value Property value.
175
- * @return mixed Newly-set property.
176
- */
177
- public function __set( $name, $value ) {
178
- if ( in_array( $name, $this->compat_fields ) ) {
179
- return $this->$name = $value;
180
- }
181
- }
182
-
183
- /**
184
- * Make private properties checkable for backwards compatibility.
185
- *
186
- * @since 4.0.0
187
- * @access public
188
- *
189
- * @param string $name Property to check if set.
190
- * @return bool Whether the property is set.
191
- */
192
- public function __isset( $name ) {
193
- if ( in_array( $name, $this->compat_fields ) ) {
194
- return isset( $this->$name );
195
- }
196
- }
197
-
198
- /**
199
- * Make private properties un-settable for backwards compatibility.
200
- *
201
- * @since 4.0.0
202
- * @access public
203
- *
204
- * @param string $name Property to unset.
205
- */
206
- public function __unset( $name ) {
207
- if ( in_array( $name, $this->compat_fields ) ) {
208
- unset( $this->$name );
209
- }
210
- }
211
-
212
- /**
213
- * Make private/protected methods readable for backwards compatibility.
214
- *
215
- * @since 4.0.0
216
- * @access public
217
- *
218
- * @param callable $name Method to call.
219
- * @param array $arguments Arguments to pass when calling.
220
- * @return mixed|bool Return value of the callback, false otherwise.
221
- */
222
- public function __call( $name, $arguments ) {
223
- if ( in_array( $name, $this->compat_methods ) ) {
224
- return call_user_func_array( array( $this, $name ), $arguments );
225
- }
226
- return false;
227
- }
228
-
229
- /**
230
- * Checks the current user's permissions
231
- *
232
- * @since 3.1.0
233
- * @access public
234
- * @abstract
235
- */
236
- public function ajax_user_can() {
237
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
238
- }
239
-
240
- /**
241
- * Prepares the list of items for displaying.
242
- * @uses WP_List_Table::set_pagination_args()
243
- *
244
- * @since 3.1.0
245
- * @access public
246
- * @abstract
247
- */
248
- public function prepare_items() {
249
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
250
- }
251
-
252
- /**
253
- * An internal method that sets all the necessary pagination arguments
254
- *
255
- * @param array $args An associative array with information about the pagination
256
- * @access protected
257
- */
258
- protected function set_pagination_args( $args ) {
259
- $args = wp_parse_args( $args, array(
260
- 'total_items' => 0,
261
- 'total_pages' => 0,
262
- 'per_page' => 0,
263
- ) );
264
-
265
- if ( !$args['total_pages'] && $args['per_page'] > 0 )
266
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
267
-
268
- // Redirect if page number is invalid and headers are not already sent.
269
- if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
270
- wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
271
- exit;
272
- }
273
-
274
- $this->_pagination_args = $args;
275
- }
276
-
277
- /**
278
- * Access the pagination args.
279
- *
280
- * @since 3.1.0
281
- * @access public
282
- *
283
- * @param string $key Pagination argument to retrieve. Common values include 'total_items',
284
- * 'total_pages', 'per_page', or 'infinite_scroll'.
285
- * @return int Number of items that correspond to the given pagination argument.
286
- */
287
- public function get_pagination_arg( $key ) {
288
- if ( 'page' == $key )
289
- return $this->get_pagenum();
290
-
291
- if ( isset( $this->_pagination_args[$key] ) )
292
- return $this->_pagination_args[$key];
293
- }
294
-
295
- /**
296
- * Whether the table has items to display or not
297
- *
298
- * @since 3.1.0
299
- * @access public
300
- *
301
- * @return bool
302
- */
303
- public function has_items() {
304
- return !empty( $this->items );
305
- }
306
-
307
- /**
308
- * Message to be displayed when there are no items
309
- *
310
- * @since 3.1.0
311
- * @access public
312
- */
313
- public function no_items() {
314
- _e( 'No items found.' );
315
- }
316
-
317
- /**
318
- * Display the search box.
319
- *
320
- * @since 3.1.0
321
- * @access public
322
- *
323
- * @param string $text The search button text
324
- * @param string $input_id The search input id
325
- */
326
- public function search_box( $text, $input_id ) {
327
- if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
328
- return;
329
-
330
- $input_id = $input_id . '-search-input';
331
-
332
- if ( ! empty( $_REQUEST['orderby'] ) )
333
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '">';
334
- if ( ! empty( $_REQUEST['order'] ) )
335
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '">';
336
- if ( ! empty( $_REQUEST['post_mime_type'] ) )
337
- echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '">';
338
- if ( ! empty( $_REQUEST['detached'] ) )
339
- echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '">';
340
- ?>
341
- <p class="search-box">
342
- <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
343
- <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>">
344
- <?php submit_button( $text, 'button', '', false, array('id' => 'search-submit') ); ?>
345
- </p>
346
- <?php
347
- }
348
-
349
- /**
350
- * Get an associative array ( id => link ) with the list
351
- * of views available on this table.
352
- *
353
- * @since 3.1.0
354
- * @access protected
355
- *
356
- * @return array
357
- */
358
- protected function get_views() {
359
- return array();
360
- }
361
-
362
- /**
363
- * Display the list of views available on this table.
364
- *
365
- * @since 3.1.0
366
- * @access public
367
- */
368
- public function views() {
369
- $views = $this->get_views();
370
- /**
371
- * Filter the list of available list table views.
372
- *
373
- * The dynamic portion of the hook name, `$this->screen->id`, refers
374
- * to the ID of the current screen, usually a string.
375
- *
376
- * @since 3.5.0
377
- *
378
- * @param array $views An array of available list table views.
379
- */
380
- $views = apply_filters( "views_{$this->screen->id}", $views );
381
-
382
- if ( empty( $views ) )
383
- return;
384
-
385
- echo "<ul class='subsubsub'>\n";
386
- foreach ( $views as $class => $view ) {
387
- $views[ $class ] = "\t<li class='$class'>$view";
388
- }
389
- echo implode( " |</li>\n", $views ) . "</li>\n";
390
- echo "</ul>";
391
- }
392
-
393
- /**
394
- * Get an associative array ( option_name => option_title ) with the list
395
- * of bulk actions available on this table.
396
- *
397
- * @since 3.1.0
398
- * @access protected
399
- *
400
- * @return array
401
- */
402
- protected function get_bulk_actions() {
403
- return array();
404
- }
405
-
406
- /**
407
- * Display the bulk actions dropdown.
408
- *
409
- * @since 3.1.0
410
- * @access protected
411
- *
412
- * @param string $which The location of the bulk actions: 'top' or 'bottom'.
413
- * This is designated as optional for backwards-compatibility.
414
- */
415
- protected function bulk_actions( $which = '' ) {
416
- if ( is_null( $this->_actions ) ) {
417
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
418
- /**
419
- * Filter the list table Bulk Actions drop-down.
420
- *
421
- * The dynamic portion of the hook name, `$this->screen->id`, refers
422
- * to the ID of the current screen, usually a string.
423
- *
424
- * This filter can currently only be used to remove bulk actions.
425
- *
426
- * @since 3.5.0
427
- *
428
- * @param array $actions An array of the available bulk actions.
429
- */
430
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
431
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
432
- $two = '';
433
- } else {
434
- $two = '2';
435
- }
436
-
437
- if ( empty( $this->_actions ) )
438
- return;
439
-
440
- echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
441
- echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
442
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
443
-
444
- foreach ( $this->_actions as $name => $title ) {
445
- $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
446
-
447
- echo "\t<option value='$name'$class>$title</option>\n";
448
- }
449
-
450
- echo "</select>\n";
451
-
452
- submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
453
- echo "\n";
454
- }
455
-
456
- /**
457
- * Get the current action selected from the bulk actions dropdown.
458
- *
459
- * @since 3.1.0
460
- * @access public
461
- *
462
- * @return string|bool The action name or False if no action was selected
463
- */
464
- public function current_action() {
465
- if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) )
466
- return false;
467
-
468
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
469
- return $_REQUEST['action'];
470
-
471
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
472
- return $_REQUEST['action2'];
473
-
474
- return false;
475
- }
476
-
477
- /**
478
- * Generate row actions div
479
- *
480
- * @since 3.1.0
481
- * @access protected
482
- *
483
- * @param array $actions The list of actions
484
- * @param bool $always_visible Whether the actions should be always visible
485
- * @return string
486
- */
487
- protected function row_actions( $actions, $always_visible = false ) {
488
- $action_count = count( $actions );
489
- $i = 0;
490
-
491
- if ( !$action_count )
492
- return '';
493
-
494
- $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
495
- foreach ( $actions as $action => $link ) {
496
- ++$i;
497
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
498
- $out .= "<span class='$action'>$link$sep</span>";
499
- }
500
- $out .= '</div>';
501
-
502
- return $out;
503
- }
504
-
505
- /**
506
- * Display a monthly dropdown for filtering items
507
- *
508
- * @since 3.1.0
509
- * @access protected
510
- *
511
- * @param string $post_type
512
- */
513
- protected function months_dropdown( $post_type ) {
514
- global $wpdb, $wp_locale;
515
-
516
- /**
517
- * Filter whether to remove the 'Months' drop-down from the post list table.
518
- *
519
- * @since 4.2.0
520
- *
521
- * @param bool $disable Whether to disable the drop-down. Default false.
522
- * @param string $post_type The post type.
523
- */
524
- if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
525
- return;
526
- }
527
-
528
- $months = $wpdb->get_results( $wpdb->prepare( "
529
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
530
- FROM $wpdb->posts
531
- WHERE post_type = %s
532
- ORDER BY post_date DESC
533
- ", $post_type ) );
534
-
535
- /**
536
- * Filter the 'Months' drop-down results.
537
- *
538
- * @since 3.7.0
539
- *
540
- * @param object $months The months drop-down query results.
541
- * @param string $post_type The post type.
542
- */
543
- $months = apply_filters( 'months_dropdown_results', $months, $post_type );
544
-
545
- $month_count = count( $months );
546
-
547
- if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
548
- return;
549
-
550
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
551
- ?>
552
- <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
553
- <select name="m" id="filter-by-date">
554
- <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
555
- <?php
556
- foreach ( $months as $arc_row ) {
557
- if ( 0 == $arc_row->year )
558
- continue;
559
-
560
- $month = zeroise( $arc_row->month, 2 );
561
- $year = $arc_row->year;
562
-
563
- printf( "<option %s value='%s'>%s</option>\n",
564
- selected( $m, $year . $month, false ),
565
- esc_attr( $arc_row->year . $month ),
566
- /* translators: 1: month name, 2: 4-digit year */
567
- sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
568
- );
569
- }
570
- ?>
571
- </select>
572
- <?php
573
- }
574
-
575
- /**
576
- * Display a view switcher
577
- *
578
- * @since 3.1.0
579
- * @access protected
580
- *
581
- * @param string $current_mode
582
- */
583
- protected function view_switcher( $current_mode ) {
584
- ?>
585
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>">
586
- <div class="view-switch">
587
- <?php
588
- foreach ( $this->modes as $mode => $title ) {
589
- $classes = array( 'view-' . $mode );
590
- if ( $current_mode == $mode )
591
- $classes[] = 'current';
592
- printf(
593
- "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
594
- esc_url( add_query_arg( 'mode', $mode ) ),
595
- implode( ' ', $classes ),
596
- $title
597
- );
598
- }
599
- ?>
600
- </div>
601
- <?php
602
- }
603
-
604
- /**
605
- * Display a comment count bubble
606
- *
607
- * @since 3.1.0
608
- * @access protected
609
- *
610
- * @param int $post_id The post ID.
611
- * @param int $pending_comments Number of pending comments.
612
- */
613
- protected function comments_bubble( $post_id, $pending_comments ) {
614
- $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
615
-
616
- if ( $pending_comments )
617
- echo '<strong>';
618
-
619
- 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>";
620
-
621
- if ( $pending_comments )
622
- echo '</strong>';
623
- }
624
-
625
- /**
626
- * Get the current page number
627
- *
628
- * @since 3.1.0
629
- * @access public
630
- *
631
- * @return int
632
- */
633
- public function get_pagenum() {
634
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
635
-
636
- if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
637
- $pagenum = $this->_pagination_args['total_pages'];
638
-
639
- return max( 1, $pagenum );
640
- }
641
-
642
- /**
643
- * Get number of items to display on a single page
644
- *
645
- * @since 3.1.0
646
- * @access protected
647
- *
648
- * @param string $option
649
- * @param int $default
650
- * @return int
651
- */
652
- protected function get_items_per_page( $option, $default = 20 ) {
653
- $per_page = (int) get_user_option( $option );
654
- if ( empty( $per_page ) || $per_page < 1 )
655
- $per_page = $default;
656
-
657
- /**
658
- * Filter the number of items to be displayed on each page of the list table.
659
- *
660
- * The dynamic hook name, $option, refers to the `per_page` option depending
661
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
662
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
663
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
664
- * 'edit_{$post_type}_per_page', etc.
665
- *
666
- * @since 2.9.0
667
- *
668
- * @param int $per_page Number of items to be displayed. Default 20.
669
- */
670
- return (int) apply_filters( $option, $per_page );
671
- }
672
-
673
- /**
674
- * Display the pagination.
675
- *
676
- * @since 3.1.0
677
- * @access protected
678
- *
679
- * @param string $which
680
- */
681
- protected function pagination( $which ) {
682
- if ( empty( $this->_pagination_args ) ) {
683
- return;
684
- }
685
-
686
- $total_items = $this->_pagination_args['total_items'];
687
- $total_pages = $this->_pagination_args['total_pages'];
688
- $infinite_scroll = false;
689
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
690
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
691
- }
692
-
693
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
694
-
695
- $current = $this->get_pagenum();
696
-
697
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
698
-
699
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
700
-
701
- $page_links = array();
702
-
703
- $disable_first = $disable_last = '';
704
- if ( $current == 1 ) {
705
- $disable_first = ' disabled';
706
- }
707
- if ( $current == $total_pages ) {
708
- $disable_last = ' disabled';
709
- }
710
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
711
- 'first-page' . $disable_first,
712
- esc_attr__( 'Go to the first page' ),
713
- esc_url( remove_query_arg( 'paged', $current_url ) ),
714
- '&laquo;'
715
- );
716
-
717
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
718
- 'prev-page' . $disable_first,
719
- esc_attr__( 'Go to the previous page' ),
720
- esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
721
- '&lsaquo;'
722
- );
723
-
724
- if ( 'bottom' == $which ) {
725
- $html_current_page = $current;
726
- } else {
727
- $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d'>",
728
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page' ) . '</label>',
729
- esc_attr__( 'Current page' ),
730
- $current,
731
- strlen( $total_pages )
732
- );
733
- }
734
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
735
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
736
-
737
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
738
- 'next-page' . $disable_last,
739
- esc_attr__( 'Go to the next page' ),
740
- esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
741
- '&rsaquo;'
742
- );
743
-
744
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
745
- 'last-page' . $disable_last,
746
- esc_attr__( 'Go to the last page' ),
747
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
748
- '&raquo;'
749
- );
750
-
751
- $pagination_links_class = 'pagination-links';
752
- if ( ! empty( $infinite_scroll ) ) {
753
- $pagination_links_class = ' hide-if-js';
754
- }
755
- $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
756
-
757
- if ( $total_pages ) {
758
- $page_class = $total_pages < 2 ? ' one-page' : '';
759
- } else {
760
- $page_class = ' no-pages';
761
- }
762
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
763
-
764
- echo $this->_pagination;
765
- }
766
-
767
- /**
768
- * Get a list of columns. The format is:
769
- * 'internal-name' => 'Title'
770
- *
771
- * @since 3.1.0
772
- * @access public
773
- * @abstract
774
- *
775
- * @return array
776
- */
777
- public function get_columns() {
778
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
779
- }
780
-
781
- /**
782
- * Get a list of sortable columns. The format is:
783
- * 'internal-name' => 'orderby'
784
- * or
785
- * 'internal-name' => array( 'orderby', true )
786
- *
787
- * The second format will make the initial sorting order be descending
788
- *
789
- * @since 3.1.0
790
- * @access protected
791
- *
792
- * @return array
793
- */
794
- protected function get_sortable_columns() {
795
- return array();
796
- }
797
-
798
- /**
799
- * Get a list of all, hidden and sortable columns, with filter applied
800
- *
801
- * @since 3.1.0
802
- * @access protected
803
- *
804
- * @return array
805
- */
806
- protected function get_column_info() {
807
- if ( isset( $this->_column_headers ) )
808
- return $this->_column_headers;
809
-
810
- $columns = get_column_headers( $this->screen );
811
- $hidden = get_hidden_columns( $this->screen );
812
-
813
- $sortable_columns = $this->get_sortable_columns();
814
- /**
815
- * Filter the list table sortable columns for a specific screen.
816
- *
817
- * The dynamic portion of the hook name, `$this->screen->id`, refers
818
- * to the ID of the current screen, usually a string.
819
- *
820
- * @since 3.5.0
821
- *
822
- * @param array $sortable_columns An array of sortable columns.
823
- */
824
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
825
-
826
- $sortable = array();
827
- foreach ( $_sortable as $id => $data ) {
828
- if ( empty( $data ) )
829
- continue;
830
-
831
- $data = (array) $data;
832
- if ( !isset( $data[1] ) )
833
- $data[1] = false;
834
-
835
- $sortable[$id] = $data;
836
- }
837
-
838
- $this->_column_headers = array( $columns, $hidden, $sortable );
839
-
840
- return $this->_column_headers;
841
- }
842
-
843
- /**
844
- * Return number of visible columns
845
- *
846
- * @since 3.1.0
847
- * @access public
848
- *
849
- * @return int
850
- */
851
- public function get_column_count() {
852
- list ( $columns, $hidden ) = $this->get_column_info();
853
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
854
- return count( $columns ) - count( $hidden );
855
- }
856
-
857
- /**
858
- * Print column headers, accounting for hidden and sortable columns.
859
- *
860
- * @since 3.1.0
861
- * @access public
862
- *
863
- * @param bool $with_id Whether to set the id attribute or not
864
- */
865
- public function print_column_headers( $with_id = true ) {
866
- list( $columns, $hidden, $sortable ) = $this->get_column_info();
867
-
868
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
869
- $current_url = remove_query_arg( 'paged', $current_url );
870
-
871
- if ( isset( $_GET['orderby'] ) )
872
- $current_orderby = $_GET['orderby'];
873
- else
874
- $current_orderby = '';
875
-
876
- if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
877
- $current_order = 'desc';
878
- else
879
- $current_order = 'asc';
880
-
881
- if ( ! empty( $columns['cb'] ) ) {
882
- static $cb_counter = 1;
883
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
884
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox">';
885
- $cb_counter++;
886
- }
887
-
888
- foreach ( $columns as $column_key => $column_display_name ) {
889
- $class = array( 'manage-column', "column-$column_key" );
890
-
891
- $style = '';
892
- if ( in_array( $column_key, $hidden ) )
893
- $style = 'display:none;';
894
-
895
- $style = ' style="' . $style . '"';
896
-
897
- if ( 'cb' == $column_key )
898
- $class[] = 'check-column';
899
- elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
900
- $class[] = 'num';
901
-
902
- if ( isset( $sortable[$column_key] ) ) {
903
- list( $orderby, $desc_first ) = $sortable[$column_key];
904
-
905
- if ( $current_orderby == $orderby ) {
906
- $order = 'asc' == $current_order ? 'desc' : 'asc';
907
- $class[] = 'sorted';
908
- $class[] = $current_order;
909
- } else {
910
- $order = $desc_first ? 'desc' : 'asc';
911
- $class[] = 'sortable';
912
- $class[] = $desc_first ? 'asc' : 'desc';
913
- }
914
-
915
- $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>';
916
- }
917
-
918
- $id = $with_id ? "id='$column_key'" : '';
919
-
920
- if ( !empty( $class ) )
921
- $class = "class='" . join( ' ', $class ) . "'";
922
-
923
- echo "<th scope='col' $id $class $style>$column_display_name</th>";
924
- }
925
- }
926
-
927
- /**
928
- * Display the table
929
- *
930
- * @since 3.1.0
931
- * @access public
932
- */
933
- public function display() {
934
- $singular = $this->_args['singular'];
935
-
936
- $this->display_tablenav( 'top' );
937
-
938
- ?>
939
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
940
- <thead>
941
- <tr>
942
- <?php $this->print_column_headers(); ?>
943
- </tr>
944
- </thead>
945
-
946
- <tbody id="the-list"<?php
947
- if ( $singular ) {
948
- echo " data-wp-lists='list:$singular'";
949
- } ?>>
950
- <?php $this->display_rows_or_placeholder(); ?>
951
- </tbody>
952
-
953
- <tfoot>
954
- <tr>
955
- <?php $this->print_column_headers( false ); ?>
956
- </tr>
957
- </tfoot>
958
-
959
- </table>
960
- <?php
961
- $this->display_tablenav( 'bottom' );
962
- }
963
-
964
- /**
965
- * Get a list of CSS classes for the list table table tag.
966
- *
967
- * @since 3.1.0
968
- * @access protected
969
- *
970
- * @return array List of CSS classes for the table tag.
971
- */
972
- protected function get_table_classes() {
973
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
974
- }
975
-
976
- /**
977
- * Generate the table navigation above or below the table
978
- *
979
- * @since 3.1.0
980
- * @access protected
981
- * @param string $which
982
- */
983
- protected function display_tablenav( $which ) {
984
- if ( 'top' == $which )
985
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
986
- ?>
987
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
988
-
989
- <div class="alignleft actions bulkactions">
990
- <?php $this->bulk_actions( $which ); ?>
991
- </div>
992
- <?php
993
- $this->extra_tablenav( $which );
994
- $this->pagination( $which );
995
- ?>
996
-
997
- <br class="clear">
998
- </div>
999
- <?php
1000
- }
1001
-
1002
- /**
1003
- * Extra controls to be displayed between bulk actions and pagination
1004
- *
1005
- * @since 3.1.0
1006
- * @access protected
1007
- *
1008
- * @param string $which
1009
- */
1010
- protected function extra_tablenav( $which ) {}
1011
-
1012
- /**
1013
- * Generate the tbody element for the list table.
1014
- *
1015
- * @since 3.1.0
1016
- * @access public
1017
- */
1018
- public function display_rows_or_placeholder() {
1019
- if ( $this->has_items() ) {
1020
- $this->display_rows();
1021
- } else {
1022
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1023
- $this->no_items();
1024
- echo '</td></tr>';
1025
- }
1026
- }
1027
-
1028
- /**
1029
- * Generate the table rows
1030
- *
1031
- * @since 3.1.0
1032
- * @access public
1033
- */
1034
- public function display_rows() {
1035
- foreach ( $this->items as $item )
1036
- $this->single_row( $item );
1037
- }
1038
-
1039
- /**
1040
- * Generates content for a single row of the table
1041
- *
1042
- * @since 3.1.0
1043
- * @access public
1044
- *
1045
- * @param object $item The current item
1046
- */
1047
- public function single_row( $item ) {
1048
- echo '<tr>';
1049
- $this->single_row_columns( $item );
1050
- echo '</tr>';
1051
- }
1052
-
1053
- protected function column_default( $item, $column_name ) {}
1054
-
1055
- protected function column_cb( $item ) {}
1056
-
1057
- /**
1058
- * Generates the columns for a single row of the table
1059
- *
1060
- * @since 3.1.0
1061
- * @access protected
1062
- *
1063
- * @param object $item The current item
1064
- */
1065
- protected function single_row_columns( $item ) {
1066
- list( $columns, $hidden ) = $this->get_column_info();
1067
-
1068
- foreach ( $columns as $column_name => $column_display_name ) {
1069
- $class = "class='$column_name column-$column_name'";
1070
-
1071
- $style = '';
1072
- if ( in_array( $column_name, $hidden ) )
1073
- $style = ' style="display:none;"';
1074
-
1075
- $attributes = "$class$style";
1076
-
1077
- if ( 'cb' == $column_name ) {
1078
- echo '<th scope="row" class="check-column">';
1079
- echo $this->column_cb( $item );
1080
- echo '</th>';
1081
- }
1082
- elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1083
- echo "<td $attributes>";
1084
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1085
- echo "</td>";
1086
- }
1087
- else {
1088
- echo "<td $attributes>";
1089
- echo $this->column_default( $item, $column_name );
1090
- echo "</td>";
1091
- }
1092
- }
1093
- }
1094
-
1095
- /**
1096
- * Handle an incoming ajax request (called from admin-ajax.php)
1097
- *
1098
- * @since 3.1.0
1099
- * @access public
1100
- */
1101
- public function ajax_response() {
1102
- $this->prepare_items();
1103
-
1104
- ob_start();
1105
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1106
- $this->display_rows();
1107
- } else {
1108
- $this->display_rows_or_placeholder();
1109
- }
1110
-
1111
- $rows = ob_get_clean();
1112
-
1113
- $response = array( 'rows' => $rows );
1114
-
1115
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1116
- $response['total_items_i18n'] = sprintf(
1117
- _n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
1118
- number_format_i18n( $this->_pagination_args['total_items'] )
1119
- );
1120
- }
1121
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1122
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1123
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1124
- }
1125
-
1126
- die( wp_json_encode( $response ) );
1127
- }
1128
-
1129
- /**
1130
- * Send required variables to JavaScript land
1131
- *
1132
- * @access public
1133
- */
1134
- public function _js_vars() {
1135
- $args = array(
1136
- 'class' => get_class( $this ),
1137
- 'screen' => array(
1138
- 'id' => $this->screen->id,
1139
- 'base' => $this->screen->base,
1140
- )
1141
- );
1142
-
1143
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1144
- }
1145
- }
1146
-
1147
- 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' ),
165
+ 'excerpt' => __( 'Excerpt View' ),
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.' );
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' ) . '</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' ) . "</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' ), '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 _e( 'Filter by date' ); ?></label>
594
+ <select name="m" id="filter-by-date">
595
+ <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></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' ), 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 ), 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' ),
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' ),
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' ) . '</label>',
780
+ esc_attr__( 'Current page' ),
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' ), $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' ),
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' ),
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' ) . '</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'] ),
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 _e( 'Each view has a unique shortcode like <code>&#91;testimonial_view id="1"&#93;</code>.', 'strong-testimonials' ); ?>
38
- <?php printf( '<a href="%s">%s</a>', esc_url( admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-views' ) ), __( '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 esc_html_e( 'Shortcodes', 'strong-testimonials' ); ?></h1>
33
+
34
+ <h2><?php esc_html_e( 'Testimonial Views', 'strong-testimonials' ); ?></h2>
35
+
36
+ <p>
37
+ <?php echo wp_kses_post( _e( 'Each view has a unique shortcode like <code>&#91;testimonial_view id="1"&#93;</code>.', 'strong-testimonials' ) ); ?>
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 esc_html_e( 'Testimonial Count', 'strong-testimonials' ); ?></h2>
42
+
43
+ <p><?php printf( esc_html__( '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 esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
49
+ </td>
50
+ <td class="shortcode">
51
+ <?php /* translators: %s is a shortcode */ ?>
52
+ <p>
53
+ <?php printf( esc_html__( '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( esc_html__( '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( esc_html__( '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 esc_html_e( 'Average Rating', 'strong-testimonials' ); ?></h2>
72
+
73
+ <p>
74
+ <?php /* translators: %s is a shortcode */ ?>
75
+ <?php echo wp_kses_post( 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 esc_html_e( 'Default', 'strong-testimonials' ); ?></p>
82
+ <p class="description"><?php echo wp_kses_post( _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 wp_kses_post( $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 esc_html_e( 'Customize using content tags.', 'strong-testimonials' ); ?></p>
107
+ <p><?php esc_html_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 wp_kses_post( $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 esc_html_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 wp_kses_post( $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 esc_html_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 wp_kses_post( $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 wp_kses_post( $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 wp_kses_post( $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 wp_kses_post( $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 wp_kses_post( $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 echo wp_kses_post( _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 wp_kses_post( $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,354 +1,367 @@
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 esc_attr_e( $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 esc_attr_e( $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
- default :
123
- self::meta_option__text( $field, $post, $is_new );
124
- }
125
- }
126
- }
127
-
128
- /**
129
- * Custom action callback.
130
- *
131
- * @param $field
132
- * @param $post
133
- * @param $is_new
134
- */
135
- private static function meta_option__action( $field, $post, $is_new ) {
136
- if ( isset( $field['action_input'] ) && $field['action_input'] ) {
137
- do_action( $field['action_input'], $field, $post->{$field['name']} );
138
- }
139
- }
140
-
141
- /**
142
- * Text input.
143
- *
144
- * @param $field
145
- * @param $post
146
- * @param $is_new
147
- */
148
- private static function meta_option__text( $field, $post, $is_new ) {
149
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
150
- $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
151
- }
152
-
153
- /**
154
- * URL input.
155
- *
156
- * @param $field
157
- * @param $post
158
- * @param $is_new
159
- */
160
- private static function meta_option__url( $field, $post, $is_new ) {
161
- ?>
162
- <div class="input-url">
163
- <?php printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
164
- $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) ); ?>
165
- </div>
166
- <div class="input-nofollow">
167
- <label for="custom_nofollow"><code>rel="nofollow"</code></label>
168
- <select id="custom_nofollow" name="custom[nofollow]">
169
- <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php _e( 'default', 'strong-testimonials' ); ?></option>
170
- <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php _e( 'yes', 'strong-testimonials' ); ?></option>
171
- <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php _e( 'no', 'strong-testimonials' ); ?></option>
172
- </select>
173
- </div>
174
- <?php
175
- }
176
-
177
- /**
178
- * Checkbox input.
179
- *
180
- * @param $field
181
- * @param $post
182
- * @param $is_new
183
- */
184
- private static function meta_option__checkbox( $field, $post, $is_new ) {
185
- printf( '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
186
- $field['input_type'], $field['name'], 1, checked( $post->{$field['name']}, 1, false ) );
187
- }
188
-
189
- /**
190
- * Rating input.
191
- *
192
- * @param $field
193
- * @param $post
194
- * @param $is_new
195
- */
196
- private static function meta_option__rating( $field, $post, $is_new ) {
197
- $rating = get_post_meta( $post->ID, $field['name'], true );
198
- if ( ! $rating || $is_new ) {
199
- $rating = 0;
200
- }
201
- ?>
202
- <div class="edit-rating-box hide-if-no-js" data-field="<?php echo $field['name']; ?>">
203
-
204
- <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
205
- <input type="hidden" class="current-rating" value="<?php echo $rating; ?>">
206
-
207
- <!-- form -->
208
- <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
209
- <span class="inner">
210
- <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
211
- </span>
212
- <?php if ( ! $is_new ) : ?>
213
- <span class="edit-rating-buttons-2">
214
- <button type="button"
215
- class="zero button-link"><?php _e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
216
- <button type="button" class="save button button-small"><?php _e( 'OK' ); ?></button>&nbsp;
217
- <button type="button" class="cancel button-link"><?php _e( 'Cancel' ); ?></button>
218
- </span>
219
- <?php endif; ?>
220
- </div>
221
-
222
- <!-- display -->
223
- <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
224
- <span class="inner">
225
- <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
226
- </span>
227
-
228
- <?php if ( ! $is_new ) : ?>
229
- <span class="edit-rating-buttons-1">
230
- <button type="button"
231
- id=""
232
- class="edit-rating button button-small hide-if-no-js"
233
- aria-label="Edit rating"><?php _e( 'Edit' ); ?></button>
234
- </span>
235
- <?php endif; ?>
236
- </div>
237
-
238
- <span class="edit-rating-success"></span>
239
-
240
- </div>
241
- <?php
242
- }
243
-
244
- /**
245
- * Shortcode for custom input.
246
- *
247
- * @param $field
248
- * @param $post
249
- * @param $is_new
250
- */
251
- public static function meta_option__shortcode( $field, $post, $is_new ) {
252
- $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
253
- if ( shortcode_exists( $shortcode ) ) {
254
- echo do_shortcode( $field['shortcode_on_display'] );
255
- } else {
256
- echo '<div class="custom-input not-found">' . sprintf( __( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . $field['shortcode_on_display'] . '</code>' ) . '</div>';
257
- }
258
- }
259
-
260
- /**
261
- * Save custom fields.
262
- *
263
- * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
264
- */
265
- public static function save_details() {
266
- if ( ! isset( $_POST['custom'] ) ) {
267
- return;
268
- }
269
-
270
- $custom = $_POST['custom'];
271
-
272
- $custom_fields = wpmtst_get_custom_fields();
273
-
274
- // Construct array of checkbox empty values because blank checkboxes are not POSTed.
275
- $checkboxes = array();
276
- foreach ( $custom_fields as $key => $field ) {
277
- if ( 'checkbox' == $field['input_type'] ) {
278
- $checkboxes[ $key ] = 0;
279
- }
280
- }
281
- if ( $checkboxes ) {
282
- $custom = array_merge( $checkboxes, $custom );
283
- }
284
-
285
- // Determine whether to update or delete.
286
- // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
287
- foreach ( $custom as $key => $value ) {
288
- $action = 'update';
289
-
290
- if ( isset( $custom_fields[ $key ] ) ) {
291
- if ( 'rating' == $custom_fields[ $key ]['input_type'] && !$value ) {
292
- $action = 'delete';
293
- }
294
- }
295
-
296
- if ( 'update' == $action ) {
297
- // empty values replace existing values
298
- update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
299
- }
300
- else {
301
- // delete value; e.g. zero rating
302
- delete_post_meta( $_POST['post_ID'], $key );
303
- }
304
- }
305
- }
306
-
307
- /**
308
- * Prevent use of this plugin's shortcode in a testimonial.
309
- *
310
- * @since 2.32.2
311
- * @param $data
312
- * @param $postarr
313
- *
314
- * @return mixed
315
- */
316
- public static function prevent_shortcode( $data, $postarr ) {
317
- if ( 'wpm-testimonial' == $data['post_type'] ) {
318
- $data['post_content'] = preg_replace( "/\[testimonial_view (.*)\]/", '', $data['post_content'] );
319
- }
320
-
321
- return $data;
322
- }
323
-
324
- /**
325
- * Ajax handler to edit a rating.
326
- *
327
- * @since 2.12.0
328
- */
329
- public static function edit_rating() {
330
- $message = '';
331
- $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
332
- $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
333
- $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
334
-
335
- check_ajax_referer( 'editrating', 'editratingnonce' );
336
-
337
- if ( $post_id ) {
338
- if ( $rating ) {
339
- update_post_meta( $post_id, $name, $rating );
340
- } else {
341
- delete_post_meta( $post_id, $name );
342
- }
343
- $message = 'New rating saved';
344
- }
345
-
346
- $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
347
- $response = array( 'display' => $display, 'message' => $message );
348
- echo json_encode( $response );
349
- wp_die();
350
- }
351
-
352
- }
353
-
354
- 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 echo esc_html_x( '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 wp_kses_post( 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
+ default:
123
+ self::meta_option__text( $field, $post, $is_new );
124
+ }
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Custom action callback.
130
+ *
131
+ * @param $field
132
+ * @param $post
133
+ * @param $is_new
134
+ */
135
+ private static function meta_option__action( $field, $post, $is_new ) {
136
+ if ( isset( $field['action_input'] ) && $field['action_input'] ) {
137
+ do_action( $field['action_input'], $field, $post->{$field['name']} );
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Text input.
143
+ *
144
+ * @param $field
145
+ * @param $post
146
+ * @param $is_new
147
+ */
148
+ private static function meta_option__text( $field, $post, $is_new ) {
149
+ printf(
150
+ '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s">',
151
+ esc_attr( $field['input_type'] ),
152
+ esc_attr( $field['name'] ),
153
+ esc_attr( $post->{$field['name']} )
154
+ );
155
+ }
156
+
157
+ /**
158
+ * URL input.
159
+ *
160
+ * @param $field
161
+ * @param $post
162
+ * @param $is_new
163
+ */
164
+ private static function meta_option__url( $field, $post, $is_new ) {
165
+ ?>
166
+ <div class="input-url">
167
+ <?php
168
+ printf(
169
+ '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" size="">',
170
+ esc_attr( $field['input_type'] ),
171
+ esc_attr( $field['name'] ),
172
+ esc_attr( $post->{$field['name']} )
173
+ );
174
+ ?>
175
+ </div>
176
+ <div class="input-nofollow">
177
+ <label for="custom_nofollow"><code>rel="nofollow"</code></label>
178
+ <select id="custom_nofollow" name="custom[nofollow]">
179
+ <option value="default" <?php selected( $post->nofollow, 'default' ); ?>><?php esc_html_e( 'default', 'strong-testimonials' ); ?></option>
180
+ <option value="yes" <?php selected( $post->nofollow, 'yes' ); ?>><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></option>
181
+ <option value="no" <?php selected( $post->nofollow, 'no' ); ?>><?php esc_html_e( 'no', 'strong-testimonials' ); ?></option>
182
+ </select>
183
+ </div>
184
+ <?php
185
+ }
186
+
187
+ /**
188
+ * Checkbox input.
189
+ *
190
+ * @param $field
191
+ * @param $post
192
+ * @param $is_new
193
+ */
194
+ private static function meta_option__checkbox( $field, $post, $is_new ) {
195
+ printf(
196
+ '<input id="%2$s" type="%1$s" class="custom-input" name="custom[%2$s]" value="%3$s" %4$s>',
197
+ esc_attr( $field['input_type'] ),
198
+ esc_attr( $field['name'] ),
199
+ 1,
200
+ checked( $post->{$field['name']}, 1, false )
201
+ );
202
+ }
203
+
204
+ /**
205
+ * Rating input.
206
+ *
207
+ * @param $field
208
+ * @param $post
209
+ * @param $is_new
210
+ */
211
+ private static function meta_option__rating( $field, $post, $is_new ) {
212
+ $rating = get_post_meta( $post->ID, $field['name'], true );
213
+ if ( ! $rating || $is_new ) {
214
+ $rating = 0;
215
+ }
216
+ ?>
217
+ <div class="edit-rating-box hide-if-no-js" data-field="<?php echo esc_attr( $field['name'] ); ?>">
218
+
219
+ <?php wp_nonce_field( 'editrating', "edit-{$field['name']}-nonce", false ); ?>
220
+ <input type="hidden" class="current-rating" value="<?php echo esc_attr( $rating ); ?>">
221
+
222
+ <!-- form -->
223
+ <div class="rating-form" style="<?php echo ( $is_new ) ? 'display: inline-block;' : 'display: none;'; ?>">
224
+ <span class="inner">
225
+ <?php wpmtst_star_rating_form( $field, $rating, 'in-metabox', true, 'custom' ); ?>
226
+ </span>
227
+ <?php if ( ! $is_new ) : ?>
228
+ <span class="edit-rating-buttons-2">
229
+ <button type="button" class="zero button-link"><?php esc_html_e( 'Zero', 'strong-testimonials' ); ?></button>&nbsp;
230
+ <button type="button" class="save button button-small"><?php esc_html_e( 'OK' ); ?></button>&nbsp;
231
+ <button type="button" class="cancel button-link"><?php esc_html_e( 'Cancel' ); ?></button>
232
+ </span>
233
+ <?php endif; ?>
234
+ </div>
235
+
236
+ <!-- display -->
237
+ <div class="rating-display" style="<?php echo $is_new ? 'display: none;' : 'display: inline-block;'; ?>">
238
+ <span class="inner">
239
+ <?php wpmtst_star_rating_display( $rating, 'in-metabox' ); ?>
240
+ </span>
241
+
242
+ <?php if ( ! $is_new ) : ?>
243
+ <span class="edit-rating-buttons-1">
244
+ <button type="button" id="" class="edit-rating button button-small hide-if-no-js" aria-label="Edit rating"><?php esc_html_e( 'Edit' ); ?></button>
245
+ </span>
246
+ <?php endif; ?>
247
+ </div>
248
+
249
+ <span class="edit-rating-success"></span>
250
+
251
+ </div>
252
+ <?php
253
+ }
254
+
255
+ /**
256
+ * Shortcode for custom input.
257
+ *
258
+ * @param $field
259
+ * @param $post
260
+ * @param $is_new
261
+ */
262
+ public static function meta_option__shortcode( $field, $post, $is_new ) {
263
+ $shortcode = str_replace( array( '[', ']' ), array( '', '' ), $field['shortcode_on_display'] );
264
+ if ( shortcode_exists( $shortcode ) ) {
265
+ echo do_shortcode( $field['shortcode_on_display'] );
266
+ } else {
267
+ echo '<div class="custom-input not-found">' . sprintf( esc_html__( 'shortcode %s not found', 'strong-testimonials' ), '<code>' . esc_html( $field['shortcode_on_display'] ) . '</code>' ) . '</div>';
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Save custom fields.
273
+ *
274
+ * @since 2.23.2 Delete meta record when rating is zero to allow default display value.
275
+ */
276
+ public static function save_details() {
277
+ if ( ! isset( $_POST['custom'] ) ) {
278
+ return;
279
+ }
280
+
281
+ $custom = $_POST['custom'];
282
+
283
+ $custom_fields = wpmtst_get_custom_fields();
284
+
285
+ // Construct array of checkbox empty values because blank checkboxes are not POSTed.
286
+ $checkboxes = array();
287
+ foreach ( $custom_fields as $key => $field ) {
288
+ if ( 'checkbox' == $field['input_type'] ) {
289
+ $checkboxes[ $key ] = 0;
290
+ }
291
+ }
292
+ if ( $checkboxes ) {
293
+ $custom = array_merge( $checkboxes, $custom );
294
+ }
295
+
296
+ // Determine whether to update or delete.
297
+ // Similar to wpmtst_ajax_edit_rating() in admin-ajax.php.
298
+ foreach ( $custom as $key => $value ) {
299
+ $action = 'update';
300
+
301
+ if ( isset( $custom_fields[ $key ] ) ) {
302
+ if ( 'rating' == $custom_fields[ $key ]['input_type'] && ! $value ) {
303
+ $action = 'delete';
304
+ }
305
+ }
306
+
307
+ if ( 'update' == $action ) {
308
+ // empty values replace existing values
309
+ update_post_meta( $_POST['post_ID'], $key, stripslashes( $value ) );
310
+ } else {
311
+ // delete value; e.g. zero rating
312
+ delete_post_meta( $_POST['post_ID'], $key );
313
+ }
314
+ }
315
+ }
316
+
317
+ /**
318
+ * Prevent use of this plugin's shortcode in a testimonial.
319
+ *
320
+ * @since 2.32.2
321
+ * @param $data
322
+ * @param $postarr
323
+ *
324
+ * @return mixed
325
+ */
326
+ public static function prevent_shortcode( $data, $postarr ) {
327
+ if ( 'wpm-testimonial' == $data['post_type'] ) {
328
+ $data['post_content'] = preg_replace( '/\[testimonial_view (.*)\]/', '', $data['post_content'] );
329
+ }
330
+
331
+ return $data;
332
+ }
333
+
334
+ /**
335
+ * Ajax handler to edit a rating.
336
+ *
337
+ * @since 2.12.0
338
+ */
339
+ public static function edit_rating() {
340
+ $message = '';
341
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
342
+ $rating = isset( $_POST['rating'] ) ? (int) $_POST['rating'] : 0;
343
+ $name = isset( $_POST['field_name'] ) ? $_POST['field_name'] : 'rating';
344
+
345
+ check_ajax_referer( 'editrating', 'editratingnonce' );
346
+
347
+ if ( $post_id ) {
348
+ if ( $rating ) {
349
+ update_post_meta( $post_id, $name, $rating );
350
+ } else {
351
+ delete_post_meta( $post_id, $name );
352
+ }
353
+ $message = 'New rating saved';
354
+ }
355
+
356
+ $display = wpmtst_star_rating_display( $rating, 'in-metabox', false );
357
+ $response = array(
358
+ 'display' => $display,
359
+ 'message' => $message,
360
+ );
361
+ echo json_encode( $response );
362
+ wp_die();
363
+ }
364
+
365
+ }
366
+
367
+ Strong_Testimonials_Post_Editor::init();
admin/class-strong-testimonials-updater.php CHANGED
@@ -1,1345 +1,1328 @@
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 $old_version;
16
-
17
- /**
18
- * Log steps during update process.
19
- *
20
- * @var array
21
- */
22
- private $new_log;
23
-
24
- /**
25
- * Strong_Testimonials_Updater constructor.
26
- */
27
- public function __construct() {
28
- $this->new_log = array();
29
- $this->old_version = get_option( 'wpmtst_plugin_version', false );
30
- if ( $this->old_version ) {
31
- $this->log( __CLASS__, 'old: ' . $this->old_version . ' --> new: ' . WPMTST_VERSION );
32
- }
33
- else {
34
- $this->log( __CLASS__, 'NEW INSTALL', WPMTST_VERSION );
35
- }
36
- }
37
-
38
- /**
39
- * Add a log entry.
40
- *
41
- * @param $name
42
- * @param string $entry
43
- * @param string $var
44
- */
45
- private function log( $name, $entry = '', $var = '' ) {
46
- if ( $name ) {
47
- $x = $name;
48
- if ( $entry ) {
49
- $x .= ' : ' . $entry;
50
- if ( $var ) {
51
- $x .= ' = ';
52
- if ( is_array( $var ) || is_object( $var ) ) {
53
- // log the text
54
- $this->new_log[] = $x;
55
- // then log the variable
56
- $this->new_log[] = $var;
57
- }
58
- else {
59
- $this->new_log[] = $x . $var;
60
- }
61
- }
62
- else {
63
- $this->new_log[] = $x;
64
- }
65
- }
66
- else {
67
- $this->new_log[] = $x;
68
- }
69
- }
70
- }
71
-
72
- /**
73
- * Plugin activation and update.
74
- *
75
- * ---------
76
- * REMEMBER!
77
- * ---------
78
- * If you are changing the value of a default field property,
79
- * then you need to unset that value in the current field
80
- * before merging in the new default values.
81
- *
82
- * For example, when changing a rating field property from
83
- * disabled (0) to enabled (1) in order for the property to
84
- * be displayed in the form editor.
85
- */
86
- public function update() {
87
- if ( get_transient( 'wpmtst_update_in_progress' ) ) {
88
- return;
89
- }
90
-
91
- set_transient( 'wpmtst_update_in_progress', 1, 10 );
92
-
93
- /**
94
- * Add custom capablities.
95
- *
96
- * @since 2.27.1
97
- */
98
- $this->add_caps();
99
-
100
- /**
101
- * Check DB version.
102
- */
103
- $this->update_db_check();
104
-
105
- /**
106
- * Let's start updating.
107
- */
108
- $history = get_option( 'wpmtst_history', array() );
109
-
110
- /**
111
- * Options.
112
- */
113
- update_option( 'wpmtst_options', $this->update_options() );
114
-
115
- /**
116
- * Custom fields.
117
- */
118
- update_option( 'wpmtst_fields', $this->update_fields() );
119
-
120
- /**
121
- * Forms.
122
- */
123
- update_option( 'wpmtst_base_forms', $this->update_base_forms() );
124
- update_option( 'wpmtst_custom_forms', $this->update_custom_forms() );
125
- update_option( 'wpmtst_form_options', $this->update_form_options() );
126
-
127
- /**
128
- * Compatibility options.
129
- *
130
- * @since 2.28.0
131
- */
132
- update_option( 'wpmtst_compat_options', $this->update_compat_options() );
133
-
134
- /**
135
- * Overwrite default view options.
136
- *
137
- * @since 2.15.0
138
- */
139
- update_option( 'wpmtst_view_options', $this->update_view_options() );
140
-
141
- /**
142
- * Overwrite default view settings.
143
- *
144
- * @since 2.15.0
145
- */
146
- update_option( 'wpmtst_view_default', $this->update_default_view() );
147
-
148
- /**
149
- * Update views.
150
- */
151
- $this->update_views();
152
-
153
- /**
154
- * Convert nofollow
155
- */
156
- if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
157
- $this->convert_nofollow();
158
- $this->update_history_log( '2.23.0_convert_nofollow' );
159
- }
160
-
161
- /**
162
- * Captcha plugin integrations.
163
- *
164
- * @since 2.29.0
165
- */
166
- update_option( 'wpmtst_captcha_plugins', $this->update_captcha_plugins() );
167
-
168
- /**
169
- * Legacy stuff.
170
- */
171
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
172
- // Upgrade from version 1.x
173
- delete_option( 'wpmtst_cycle' );
174
-
175
- // L10n context no longer used.
176
- delete_option( 'wpmtst_l10n_contexts' );
177
-
178
- // Remove older attempts at admin notices.
179
- delete_option( 'wpmtst_news_flag' );
180
-
181
- $this->update_history_log( '2.28_new_update_process' );
182
- }
183
-
184
- /**
185
- * Fix add-ons.
186
- */
187
- $this->update_addons();
188
-
189
- /**
190
- * Update the plugin version.
191
- */
192
- update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
193
-
194
- /**
195
- * Update log.
196
- */
197
- $this->update_log();
198
-
199
- delete_transient( 'wpmtst_update_in_progress' );
200
- }
201
-
202
- /**
203
- * Fix add-on file names.
204
- *
205
- * @since 2.30.9
206
- */
207
- public function update_addons() {
208
- $addons = get_option( 'wpmtst_addons' );
209
- if ( $addons ) {
210
- foreach ( $addons as $addon => $data ) {
211
- if ( isset( $addons[ $addon ]['file'] ) ) {
212
- $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
213
- }
214
- }
215
- update_option( 'wpmtst_addons', $addons );
216
- }
217
- }
218
-
219
- /**
220
- * Update the log in options table.
221
- */
222
- public function update_log() {
223
- $log = get_option( 'wpmtst_update_log', array() );
224
- $log[ current_time( 'mysql' ) ] = $this->new_log;
225
- update_option( 'wpmtst_update_log', $log );
226
- }
227
-
228
- /**
229
- * Return admin role.
230
- *
231
- * @since 2.27.0
232
- *
233
- * @return bool|null|WP_Role
234
- */
235
- public function get_admins() {
236
- return get_role( 'administrator' );
237
- }
238
-
239
- /**
240
- * Add custom capabilities.
241
- *
242
- * @since 2.27.1
243
- */
244
- public function add_caps() {
245
- $admins = $this->get_admins();
246
- if ( $admins ) {
247
- $admins->add_cap( 'strong_testimonials_views' );
248
- $admins->add_cap( 'strong_testimonials_fields' );
249
- $admins->add_cap( 'strong_testimonials_options' );
250
- $admins->add_cap( 'strong_testimonials_about' );
251
- }
252
- else {
253
- $this->log( __FUNCTION__, 'failed' );
254
- }
255
- }
256
-
257
- /**
258
- * Remove custom capabilities.
259
- *
260
- * Was part of uninstall process but cannot be run from static class.
261
- *
262
- * @todo Move to Leave No Trace.
263
- *
264
- * @since 2.27.1
265
- */
266
- public function remove_caps() {
267
- if ( $admins = $this->get_admins() ) {
268
- $admins->remove_cap( 'strong_testimonials_views' );
269
- $admins->remove_cap( 'strong_testimonials_fields' );
270
- $admins->remove_cap( 'strong_testimonials_options' );
271
- $admins->remove_cap( 'strong_testimonials_about' );
272
- }
273
- }
274
-
275
- /**
276
- * Update tables.
277
- *
278
- * @since 1.21.0 Checking for new table version.
279
- */
280
- public function update_db_check() {
281
- if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
282
- wpmtst_update_tables();
283
- $this->log( __FUNCTION__, 'tables updated' );
284
- }
285
- }
286
-
287
- /**
288
- * Update history log.
289
- *
290
- * @param $event
291
- */
292
- public function update_history_log( $event ) {
293
- $history = get_option( 'wpmtst_history', array() );
294
- $history[ $event ] = current_time( 'mysql' );
295
- update_option( 'wpmtst_history', $history );
296
- }
297
-
298
- /**
299
- * Update options.
300
- *
301
- * @return array
302
- */
303
- public function update_options() {
304
- $options = get_option( 'wpmtst_options' );
305
- if ( ! $options ) {
306
- return Strong_Testimonials_Defaults::get_options();
307
- }
308
-
309
- /**
310
- * Remove version 1 options
311
- */
312
- if ( version_compare( '2.0', $this->old_version ) ) {
313
-
314
- if ( isset( $options['captcha'] ) ) {
315
- unset( $options['captcha'] );
316
- }
317
-
318
- if ( isset( $options['plugin_version'] ) ) {
319
- unset( $options['plugin_version'] );
320
- }
321
-
322
- if ( isset( $options['per_page'] ) ) {
323
- unset( $options['per_page'] );
324
- }
325
-
326
- if ( isset( $options['load_page_style'] ) ) {
327
- unset( $options['load_page_style'] );
328
- }
329
-
330
- if ( isset( $options['load_widget_style'] ) ) {
331
- unset( $options['load_widget_style'] );
332
- }
333
-
334
- if ( isset( $options['load_form_style'] ) ) {
335
- unset( $options['load_form_style'] );
336
- }
337
-
338
- if ( isset( $options['load_rtl_style'] ) ) {
339
- unset( $options['load_rtl_style'] );
340
- }
341
-
342
- if ( isset( $options['shortcode'] ) ) {
343
- unset( $options['shortcode'] );
344
- }
345
-
346
- if ( isset( $options['default_template'] ) ) {
347
- unset( $options['default_template'] );
348
- }
349
-
350
- if ( isset( $options['client_section'] ) ) {
351
- unset( $options['client_section'] );
352
- }
353
-
354
- }
355
-
356
- /**
357
- * Remove slideshow z-index (Cycle)
358
- *
359
- * @since 2.15.0
360
- */
361
- if ( isset( $options['slideshow_zindex'] ) ) {
362
- unset( $options['slideshow_zindex'] );
363
- }
364
-
365
- /**
366
- * Replace zero embed_width with empty value.
367
- *
368
- * @since 2.27.0
369
- */
370
- if ( 0 === $options['embed_width'] ) {
371
- $options['embed_width'] = '';
372
- }
373
-
374
- /**
375
- * Remove email logging.
376
- *
377
- * @since 2.28.4
378
- */
379
- if ( isset( $options['email_log_level'] ) ) {
380
- unset( $options['email_log_level'] );
381
- }
382
-
383
- // Merge in new options
384
- $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
385
-
386
- return $options;
387
- }
388
-
389
- /**
390
- * Default custom fields.
391
- *
392
- * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
393
- * Overwrite existing fields on every update to auto-repair.
394
- *
395
- * @return array
396
- */
397
- public function update_fields() {
398
- return Strong_Testimonials_Defaults::get_fields();
399
- }
400
-
401
- /**
402
- * Base forms.
403
- *
404
- * @return array
405
- */
406
- public function update_base_forms() {
407
- return Strong_Testimonials_Defaults::get_base_forms();
408
- }
409
-
410
- /**
411
- * Custom forms.
412
- *
413
- * @return array
414
- */
415
- public function update_custom_forms() {
416
- $custom_forms = get_option( 'wpmtst_custom_forms' );
417
- if ( ! $custom_forms ) {
418
- return Strong_Testimonials_Defaults::get_custom_forms();
419
- }
420
-
421
- foreach ( $custom_forms as $form_id => $form_properties ) {
422
- foreach ( $form_properties['fields'] as $key => $form_field ) {
423
-
424
- /*
425
- * Convert categories to category-selector.
426
- * @since 2.17.0
427
- */
428
- if ( 'categories' == $form_field['input_type'] ) {
429
- $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
430
- }
431
-
432
- /*
433
- * Unset `show_default_options` for rating field. Going from 0 to 1.
434
- * @since 2.21.0
435
- */
436
- if ( 'rating' == $form_field['input_type'] ) {
437
- unset( $form_field['show_default_options'] );
438
- }
439
-
440
- /*
441
- * Add `show_required_option` to shortcode field. Initial value is false.
442
- * @since 2.22.0
443
- */
444
- if ( 'shortcode' == $form_field['input_type'] ) {
445
- $form_field['show_required_option'] = false;
446
- }
447
-
448
- /*
449
- * Add `show_default_options` to checkbox field.
450
- *
451
- * @since 2.27.0
452
- */
453
- if ( 'checkbox' == $form_field['input_type'] ) {
454
- $form_field['show_default_options'] = 1;
455
- }
456
-
457
- /*
458
- * Merge in new default.
459
- * Custom fields are in display order (not associative) so we must find them by `input_type`.
460
- * @since 2.21.0 Using default fields instead of default form as source
461
- */
462
- $new_default = array();
463
- $fields = get_option( 'wpmtst_fields', array() );
464
-
465
- foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
466
- foreach ( $field_type_group as $field_type_key => $field_type_field ) {
467
- if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
468
- $new_default = $field_type_field;
469
- break;
470
- }
471
- }
472
- }
473
-
474
- if ( $new_default ) {
475
- $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
476
- }
477
-
478
- }
479
- }
480
-
481
- return $custom_forms;
482
- }
483
-
484
- /**
485
- * Form options.
486
- *
487
- * @return array
488
- */
489
- public function update_form_options() {
490
- $form_options = get_option( 'wpmtst_form_options' );
491
- if ( ! $form_options ) {
492
- return Strong_Testimonials_Defaults::get_form_options();
493
- }
494
-
495
- $options = get_option( 'wpmtst_options', array() );
496
- $history = get_option( 'wpmtst_history', array() );
497
-
498
- /**
499
- * Move existing options.
500
- */
501
- if ( isset( $options['admin_notify'] ) ) {
502
- $form_options['admin_notify'] = $options['admin_notify'];
503
- unset( $options['admin_notify'] );
504
-
505
- $form_options['admin_email'] = $options['admin_email'];
506
- unset( $options['admin_email'] );
507
-
508
- $form_options['captcha'] = $options['captcha'];
509
- unset( $options['captcha'] );
510
-
511
- $form_options['honeypot_before'] = $options['honeypot_before'];
512
- unset( $options['honeypot_before'] );
513
-
514
- $form_options['honeypot_after'] = $options['honeypot_after'];
515
- unset( $options['honeypot_after'] );
516
-
517
- update_option( 'wpmtst_options', $options );
518
- }
519
-
520
- /**
521
- * Update single email recipient to multiple.
522
- *
523
- * @since 1.18
524
- */
525
- if ( ! isset( $form_options['recipients'] ) ) {
526
- $form_options['recipients'] = array(
527
- array(
528
- 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
529
- 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
530
- 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
531
- 'primary' => 1, // cannot be deleted
532
- ),
533
- );
534
-
535
- unset( $form_options['admin_name'] );
536
- unset( $form_options['admin_site_email'] );
537
- unset( $form_options['admin_email'] );
538
- }
539
-
540
- /**
541
- * Add default required-notice setting
542
- *
543
- * @since 2.24.1
544
- */
545
- if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
546
- $form_options['messages']['required-field']['enabled'] = 1;
547
- }
548
-
549
- /**
550
- * Merge in new options.
551
- */
552
- $defaults = Strong_Testimonials_Defaults::get_form_options();
553
-
554
- $form_options = array_merge( $defaults, $form_options );
555
-
556
- // Merge nested arrays individually. Don't use array_merge_recursive.
557
-
558
- $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
559
-
560
- foreach ( $defaults['messages'] as $key => $message ) {
561
- $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
562
- }
563
-
564
- /**
565
- * Convert Captcha plugin name.
566
- *
567
- * @since 2.28.5
568
- */
569
- switch ( $form_options['captcha'] ) {
570
-
571
- case 'gglcptch' :
572
- // Google Captcha by BestWebSoft
573
- $form_options['captcha'] = 'google-captcha';
574
- $notice = false;
575
- break;
576
-
577
- case 'bwsmathpro' :
578
- // Captcha Pro by BestWebSoft
579
- $form_options['captcha'] = 'captcha-pro';
580
- $notice = false;
581
- break;
582
-
583
- case 'miyoshi' :
584
- // Really Simple Captcha by Takayuki Miyoshi
585
- $form_options['captcha'] = 'really-simple-captcha';
586
- $notice = false;
587
- break;
588
-
589
- case 'advnore' :
590
- // Advanced noCaptcha reCaptcha by Shamim Hasan
591
- // Integration dropped @since 2.29.0
592
- $form_options['captcha'] = '';
593
- $notice = true;
594
- break;
595
-
596
- case 'bwsmath' :
597
- // Craptcha by simplywordpress
598
- // Integration dropped @since 2.29.0
599
- $form_options['captcha'] = '';
600
- $notice = true;
601
- break;
602
-
603
- default :
604
- $notice = false;
605
- }
606
-
607
- if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
608
- $this->update_history_log( '2.29_captcha_options_changed' );
609
- if ( $notice ) {
610
- wpmtst_add_admin_notice( 'captcha-options-changed', true );
611
- }
612
- }
613
-
614
- return $form_options;
615
- }
616
-
617
- /**
618
- * Compatibility options.
619
- *
620
- * @since 2.28.0
621
- *
622
- * @return array
623
- */
624
- public function update_compat_options() {
625
- $options = get_option( 'wpmtst_compat_options' );
626
- if ( ! $options ) {
627
- return Strong_Testimonials_Defaults::get_compat_options();
628
- }
629
-
630
- // Merge in new options.
631
- $defaults = Strong_Testimonials_Defaults::get_compat_options();
632
-
633
- // Merge nested arrays individually. Don't use array_merge_recursive.
634
-
635
- if ( isset( $options['controller'] ) ) {
636
- $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
637
- } else {
638
- $options['ajax'] = $defaults['ajax'];
639
- }
640
-
641
- /**
642
- * Controller
643
- *
644
- * @since 2.31.0
645
- */
646
- if ( isset( $options['controller'] ) ) {
647
- $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
648
- } else {
649
- $options['controller'] = $defaults['controller'];
650
- }
651
-
652
- /**
653
- * Lazy load
654
- *
655
- * @since 2.31.0
656
- */
657
- if ( isset( $options['lazyload'] ) ) {
658
- // first level only: enabled, classes (array)
659
- $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
660
- } else {
661
- $options['lazyload'] = $defaults['lazyload'];
662
- }
663
-
664
- $options = array_merge( $defaults, $options );
665
-
666
- return $options;
667
- }
668
-
669
- /**
670
- * View options.
671
- *
672
- * @return array
673
- */
674
- public function update_captcha_plugins() {
675
- return Strong_Testimonials_Defaults::get_captcha_plugins();
676
- }
677
-
678
- /**
679
- * View options.
680
- *
681
- * @return array
682
- */
683
- public function update_view_options() {
684
- return Strong_Testimonials_Defaults::get_view_options();
685
- }
686
-
687
- /**
688
- * Default view.
689
- *
690
- * @return array
691
- */
692
- public function update_default_view() {
693
- return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
694
- }
695
-
696
- /**
697
- * Update views.
698
- *
699
- * @uses wpmtst_save_view
700
- */
701
- public function update_views() {
702
- $views = wpmtst_get_views();
703
-
704
- if ( ! $views ) {
705
- return;
706
- }
707
-
708
- $default_view = wpmtst_get_view_default();
709
- $history = get_option( 'wpmtst_history', array() );
710
-
711
- foreach ( $views as $key => $view ) {
712
-
713
- $view_data = unserialize( $view['value'] );
714
- if ( ! is_array( $view_data ) ) {
715
- $this->log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
716
- continue;
717
- }
718
-
719
- /**
720
- * For version 2.28.
721
- */
722
- if ( ! isset( $history['2.28_new_update_process'] ) ) {
723
- /**
724
- * Compat mode no longer needed.
725
- *
726
- * @since 2.22.0
727
- */
728
- unset( $view_data['compat'] );
729
-
730
- $view_data = $this->convert_template_name( $view_data );
731
- $view_data = $this->convert_background_color( $view_data );
732
- $view_data = $this->convert_form_ajax( $view_data );
733
- $view_data = $this->convert_layout( $view_data );
734
- $view_data = $this->convert_word_count( $view_data );
735
- $view_data = $this->convert_excerpt_length( $view_data );
736
- $view_data = $this->convert_more_text( $view_data );
737
- $view_data = $this->convert_modern_title( $view_data );
738
- $view_data = $this->convert_slideshow( $view_data );
739
- $view_data = $this->convert_title_link( $view_data );
740
- $view_data = $this->convert_pagination_type( $view_data );
741
- }
742
-
743
- /**
744
- * For version 2.30.
745
- */
746
- if ( ! isset( $history['2.30_new_template_structure'] ) ) {
747
- $view_data = $this->convert_template_structure( $view_data );
748
- $view_data = $this->convert_count( $view_data );
749
- if ( isset( $view_data['background']['example-font-color'] ) ) {
750
- unset( $view_data['background']['example-font-color'] );
751
- }
752
-
753
- $this->update_history_log( '2.30_new_template_structure' );
754
- }
755
-
756
- /**
757
- * Add carousel breakpoints.
758
- *
759
- * @since 2.32.2
760
- */
761
- if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
762
- $view['data'] = $this->add_carousel_breakpoints( $view_data );
763
- $this->update_history_log( '2.32.2_carousel_breakpoints' );
764
- }
765
-
766
- /**
767
- * Merge in new default values.
768
- * Merge nested arrays individually. Don't use array_merge_recursive.
769
- */
770
- $view['data'] = array_merge( $default_view, $view_data );
771
-
772
- /**
773
- * Background defaults.
774
- */
775
- $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
776
-
777
- /**
778
- * Pagination defaults.
779
- * Attempt to repair bug from 2.28.2
780
- *
781
- * @since 2.28.3
782
- */
783
- if ( isset( $view_data['pagination_settings'] ) ) {
784
- $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
785
-
786
- if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
787
- $view['data']['pagination_settings']['end_size'] = 1;
788
- }
789
- if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
790
- $view['data']['pagination_settings']['mid_size'] = 2;
791
- }
792
- if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
793
- $view['data']['pagination_settings']['per_page'] = 5;
794
- }
795
- } else {
796
- $view['data']['pagination_settings'] = $default_view['pagination_settings'];
797
- }
798
-
799
- /**
800
- * Slideshow defaults.
801
- */
802
- if ( isset( $view_data['slideshow_settings'] ) ) {
803
- $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
804
- } else {
805
- $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
806
- }
807
- ksort( $view['data']['slideshow_settings'] );
808
-
809
- /**
810
- * Save it.
811
- */
812
- wpmtst_save_view( $view );
813
-
814
- } // foreach $view
815
- }
816
-
817
- /**
818
- * Add carousel breakpoints.
819
- *
820
- * @param array $view_data
821
- * @since 2.32.2
822
- *
823
- * @return array
824
- */
825
- public function add_carousel_breakpoints( $view_data ) {
826
- if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
827
- return $view_data;
828
- }
829
-
830
- if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
831
-
832
- // Convert to single
833
- $view_data['slideshow_settings']['type'] = 'show_single';
834
-
835
- $view_data['slideshow_settings']['show_single'] = array(
836
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
837
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
838
- 'margin' => 1,
839
- );
840
-
841
- } else {
842
-
843
- // Convert to multiple
844
- $view_data['slideshow_settings']['type'] = 'show_multiple';
845
-
846
- $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
847
- 'max_slides' => $view_data['slideshow_settings']['max_slides'],
848
- 'move_slides' => $view_data['slideshow_settings']['move_slides'],
849
- 'margin' => 1,
850
- );
851
-
852
- }
853
-
854
- // Remove old values
855
- unset(
856
- $view_data['slideshow_settings']['max_slides'],
857
- $view_data['slideshow_settings']['move_slides'],
858
- $view_data['slideshow_settings']['margin']
859
- );
860
-
861
- return $view_data;
862
- }
863
-
864
- /**
865
- * Convert template naming structure.
866
- *
867
- * @since 2.30.0
868
- *
869
- * @param $view_data
870
- *
871
- * @return array
872
- */
873
- public function convert_template_structure( $view_data ) {
874
- /*
875
- Array
876
- (
877
- [0] => default:content
878
- [1] => default-dark:form
879
- [2] => default-dark:content
880
- [3] => default:form
881
- [4] => image-right:content
882
- [5] => no-quotes:content
883
- [6] => large:widget
884
- [7] => modern:content
885
- [8] => simple:content
886
- [9] => simple:form
887
- [10] => unstyled:content
888
- [11] => unstyled:form
889
- [12] => default:widget
890
- [13] => image-right:widget
891
- )
892
- */
893
- switch ( $view_data['template'] ) {
894
- case 'default:content' :
895
- $view_data['template'] = 'default';
896
- break;
897
- case 'default-dark:form' :
898
- $view_data['template'] = 'default-form';
899
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
900
- break;
901
- case 'default-dark:content' :
902
- $view_data['template'] = 'default';
903
- $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
904
- break;
905
- case 'default:form' :
906
- $view_data['template'] = 'default-form';
907
- break;
908
- case 'image-right:content' :
909
- $view_data['template'] = 'default';
910
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
911
- break;
912
- case 'no-quotes:content' :
913
- $view_data['template'] = 'default';
914
- $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
915
- break;
916
- case 'large:widget' :
917
- $view_data['template'] = 'bold';
918
- break;
919
- case 'modern:content' :
920
- $view_data['template'] = 'modern';
921
- break;
922
- case 'simple:content' :
923
- $view_data['template'] = 'simple';
924
- break;
925
- case 'simple:form' :
926
- $view_data['template'] = 'simple-form';
927
- break;
928
- case 'unstyled:content' :
929
- $view_data['template'] = 'unstyled';
930
- break;
931
- case 'unstyled:form' :
932
- $view_data['template'] = 'unstyled-form';
933
- break;
934
- case 'default:widget' :
935
- $view_data['template'] = 'small-widget';
936
- break;
937
- case 'image-right:widget' :
938
- $view_data['template'] = 'small-widget';
939
- $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
940
- break;
941
- default:
942
- // Keep existing value; it's probably a custom template.
943
- }
944
-
945
- return $view_data;
946
- }
947
-
948
- /**
949
- * Update template naming structure.
950
- *
951
- * @param $view_data
952
- *
953
- * @return array
954
- */
955
- public function convert_template_name( $view_data ) {
956
- // Change default template from empty to 'default:{type}'
957
- if ( ! $view_data['template'] ) {
958
- if ( 'form' == $view_data['mode'] ) {
959
- $type = 'form';
960
- }
961
- else {
962
- $type = 'content';
963
- }
964
-
965
- $view_data['template'] = "default:$type";
966
- }
967
- else {
968
- // Convert name; e.g. 'simple/testimonials.php'
969
- if ( 'widget/testimonials.php' == $view_data['template'] ) {
970
- $view_data['template'] = 'default:widget';
971
- }
972
- else {
973
- $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
974
- $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
975
- $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
976
- }
977
- }
978
-
979
- return $view_data;
980
- }
981
-
982
- /**
983
- * Convert length (characters).
984
- *
985
- * @since 2.10.0 word_count (deprecated)
986
- * @since 2.11.4 excerpt_length
987
- *
988
- * @param $view_data
989
- *
990
- * @return array
991
- */
992
- public function convert_excerpt_length( $view_data ) {
993
- if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
994
- $default_view = Strong_Testimonials_Defaults::get_default_view();
995
- $average_word_length = $this->get_average_word_length();
996
-
997
- if ( isset( $view_data['length'] ) && $view_data['length'] ) {
998
- $word_count = round( $view_data['length'] / $average_word_length );
999
- $word_count = $word_count < 5 ? 5 : $word_count;
1000
- $word_count = $word_count > 300 ? 300 : $word_count;
1001
- $view_data['excerpt_length'] = $word_count;
1002
- }
1003
- else {
1004
- $view_data['excerpt_length'] = $default_view['excerpt_length'];
1005
- }
1006
-
1007
- unset( $view_data['length'] );
1008
- }
1009
-
1010
- return $view_data;
1011
- }
1012
-
1013
- /**
1014
- * Convert more_text to post or page.
1015
- *
1016
- * @since 2.10.0
1017
- *
1018
- * @param $view_data
1019
- *
1020
- * @return array
1021
- */
1022
- public function convert_more_text( $view_data ) {
1023
- if ( isset( $view_data['more_text'] ) ) {
1024
- if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
1025
- // convert more_page to toggle and move page id to more_page_id
1026
- $view_data['more_page_id'] = $view_data['more_page'];
1027
- $view_data['more_page'] = 1;
1028
- $view_data['more_page_text'] = $view_data['more_text'];
1029
- }
1030
- elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
1031
- $view_data['more_post_text'] = $view_data['more_text'];
1032
- }
1033
- unset( $view_data['more_text'] );
1034
- }
1035
-
1036
- return $view_data;
1037
- }
1038
-
1039
- /**
1040
- * Convert slideshow settings.
1041
- *
1042
- * @since 2.15.0
1043
- *
1044
- * @param $view_data
1045
- *
1046
- * @return array
1047
- */
1048
- public function convert_slideshow( $view_data ) {
1049
- if ( isset( $view_data['slideshow_settings'] ) ) {
1050
- return $view_data;
1051
- }
1052
-
1053
- if ( 'scrollHorz' == $view_data['effect'] ) {
1054
- $view_data['effect'] = 'horizontal';
1055
- }
1056
-
1057
- $view_data['slideshow_settings'] = array(
1058
- 'effect' => $view_data['effect'],
1059
- 'speed' => $view_data['effect_for'],
1060
- 'pause' => $view_data['show_for'],
1061
- 'auto_hover' => ! $view_data['no_pause'],
1062
- 'adapt_height' => false,
1063
- 'adapt_height_speed' => .5,
1064
- 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1065
- );
1066
-
1067
- unset(
1068
- $view_data['effect'],
1069
- $view_data['effect_for'],
1070
- $view_data['no_pause'],
1071
- $view_data['show_for'],
1072
- $view_data['stretch']
1073
- );
1074
-
1075
- if ( isset( $view_data['slideshow_nav'] ) ) {
1076
- switch ( $view_data['slideshow_nav'] ) {
1077
- case 'simple':
1078
- $view_data['slideshow_settings']['controls_type'] = 'none';
1079
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1080
- $view_data['slideshow_settings']['pager_type'] = 'full';
1081
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1082
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1083
- break;
1084
- case 'buttons1':
1085
- $view_data['slideshow_settings']['controls_type'] = 'sides';
1086
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1087
- $view_data['slideshow_settings']['pager_type'] = 'none';
1088
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1089
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1090
- break;
1091
- case 'buttons2':
1092
- $view_data['slideshow_settings']['controls_type'] = 'simple';
1093
- $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1094
- $view_data['slideshow_settings']['pager_type'] = 'none';
1095
- $view_data['slideshow_settings']['pager_style'] = 'buttons';
1096
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1097
- break;
1098
- case 'indexed':
1099
- $view_data['slideshow_settings']['controls_type'] = 'none';
1100
- $view_data['slideshow_settings']['controls_style'] = 'buttons';
1101
- $view_data['slideshow_settings']['pager_type'] = 'full';
1102
- $view_data['slideshow_settings']['pager_style'] = 'text';
1103
- $view_data['slideshow_settings']['nav_position'] = 'inside';
1104
- break;
1105
- default:
1106
- // none
1107
- }
1108
- unset( $view_data['slideshow_nav'] );
1109
- }
1110
-
1111
- return $view_data;
1112
- }
1113
-
1114
- /**
1115
- * Convert 'all' to 'count'.
1116
- *
1117
- * @param $view_data
1118
- *
1119
- * @return array
1120
- */
1121
- public function convert_count( $view_data ) {
1122
- if ( isset( $view_data['all'] ) ) {
1123
- if ( $view_data['all'] ) {
1124
- $view_data['count'] = -1;
1125
- }
1126
- unset( $view_data['all'] );
1127
- }
1128
-
1129
- return $view_data;
1130
- }
1131
-
1132
- /**
1133
- * Convert background color.
1134
- *
1135
- * @param $view_data
1136
- *
1137
- * @return array
1138
- */
1139
- public function convert_background_color( $view_data ) {
1140
- if ( ! is_array( $view_data['background'] ) ) {
1141
- $view_data['background'] = array(
1142
- 'color' => $view_data['background'],
1143
- 'type' => 'single',
1144
- );
1145
- }
1146
-
1147
- return $view_data;
1148
- }
1149
-
1150
- /**
1151
- * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1152
- *
1153
- * @param $view_data
1154
- *
1155
- * @return array
1156
- */
1157
- public function convert_form_ajax( $view_data ) {
1158
- if ( isset( $view_data['form-ajax'] ) ) {
1159
- $view_data['form_ajax'] = $view_data['form-ajax'];
1160
- unset( $view_data['form-ajax'] );
1161
- }
1162
-
1163
- return $view_data;
1164
- }
1165
-
1166
- /**
1167
- * Prevent incompatible layouts.
1168
- *
1169
- * @param $view_data
1170
- *
1171
- * @return array
1172
- */
1173
- public function convert_layout( $view_data ) {
1174
- if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1175
- if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1176
- $view_data['layout'] = '';
1177
- }
1178
- }
1179
-
1180
- return $view_data;
1181
- }
1182
-
1183
- /**
1184
- * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1185
- *
1186
- * @since 2.11.4
1187
- *
1188
- * @param $view_data
1189
- *
1190
- * @return array
1191
- */
1192
- public function convert_word_count( $view_data ) {
1193
- if ( isset( $view_data['word_count'] ) ) {
1194
- $view_data['excerpt_length'] = $view_data['word_count'];
1195
- unset( $view_data['word_count'] );
1196
- }
1197
-
1198
- return $view_data;
1199
- }
1200
-
1201
- /**
1202
- * Disable title on Modern template because new version of template has the title.
1203
- * Only if updating from version earlier than 2.12.4.
1204
- *
1205
- * @param $view_data
1206
- *
1207
- * @return array
1208
- */
1209
- public function convert_modern_title( $view_data ) {
1210
- if ( 'modern:content' == $view_data['template'] ) {
1211
- if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1212
- $view_data['title'] = 0;
1213
- $this->update_history_log( '2.12.4_convert_modern_template' );
1214
- }
1215
- }
1216
-
1217
- return $view_data;
1218
- }
1219
-
1220
- /**
1221
- * Title link
1222
- *
1223
- * @since 2.26.0
1224
- *
1225
- * @param $view_data
1226
- *
1227
- * @return array
1228
- */
1229
- public function convert_title_link( $view_data ) {
1230
- if ( ! isset( $view_data['title_link'] ) ) {
1231
- $view_data['title_link'] = 0;
1232
- }
1233
-
1234
- return $view_data;
1235
- }
1236
-
1237
- /**
1238
- * Convert nofollow from (on|off) to (1|0).
1239
- *
1240
- * @since 2.23.0
1241
- */
1242
- public function convert_nofollow() {
1243
- $args = array(
1244
- 'posts_per_page' => - 1,
1245
- 'post_type' => 'wpm-testimonial',
1246
- 'post_status' => 'publish',
1247
- 'suppress_filters' => true,
1248
- );
1249
- $posts = get_posts( $args );
1250
- if ( ! $posts ) {
1251
- return;
1252
- }
1253
-
1254
- /**
1255
- * Remove the equivocation. There is no false.
1256
- */
1257
- foreach ( $posts as $post ) {
1258
- $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1259
- $new_value = 'default';
1260
-
1261
- if ( 'on' == $nofollow ) {
1262
- $new_value = 'yes';
1263
- }
1264
- elseif ( 1 === $nofollow ) {
1265
- $new_value = 'yes';
1266
- }
1267
- elseif ( 'off' == $nofollow ) {
1268
- $new_value = 'no';
1269
- }
1270
- elseif ( 0 === $nofollow ) {
1271
- $new_value = 'no';
1272
- }
1273
- elseif ( is_bool( $nofollow ) ) {
1274
- if ( $nofollow ) {
1275
- $new_value = 'yes';
1276
- }
1277
- else {
1278
- $new_value = 'default';
1279
- }
1280
- }
1281
-
1282
- update_post_meta( $post->ID, 'nofollow', $new_value );
1283
- }
1284
- }
1285
-
1286
- /**
1287
- * Convert pagination settings.
1288
- *
1289
- * @since 2.28.0
1290
- *
1291
- * @param $view_data
1292
- *
1293
- * @return mixed
1294
- */
1295
- public function convert_pagination_type( $view_data ) {
1296
- if ( isset( $view_data['pagination_type'] ) ) {
1297
- $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1298
- unset( $view_data['pagination_type'] );
1299
- }
1300
-
1301
- if ( isset( $view_data['nav'] ) ) {
1302
- $view_data['pagination_settings']['nav'] = $view_data['nav'];
1303
- unset( $view_data['nav'] );
1304
- }
1305
-
1306
- if ( isset( $view_data['per_page'] ) ) {
1307
- $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1308
- unset( $view_data['per_page'] );
1309
- }
1310
-
1311
- return $view_data;
1312
- }
1313
-
1314
- /**
1315
- * Convert length to excerpt_length.
1316
- *
1317
- * @since 2.10.0
1318
- */
1319
- public function get_average_word_length() {
1320
- $args = array(
1321
- 'posts_per_page' => - 1,
1322
- 'post_type' => 'wpm-testimonial',
1323
- 'post_status' => 'publish',
1324
- 'suppress_filters' => true,
1325
- );
1326
- $posts = get_posts( $args );
1327
- if ( ! $posts ) {
1328
- return 5;
1329
- }
1330
-
1331
- $allwords = array();
1332
-
1333
- foreach ( $posts as $post ) {
1334
- $words = explode( ' ', $post->post_content );
1335
- if ( count( $words ) > 5 ) {
1336
- $allwords = $allwords + $words;
1337
- }
1338
- }
1339
-
1340
- $wordstring = join( '', $allwords );
1341
-
1342
- return round( strlen( $wordstring ) / count( $allwords ) );
1343
- }
1344
-
1345
- }
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 $old_version;
16
+
17
+ /**
18
+ * Log steps during update process.
19
+ *
20
+ * @var array
21
+ */
22
+ private $new_log;
23
+
24
+ /**
25
+ * Strong_Testimonials_Updater constructor.
26
+ */
27
+ public function __construct() {
28
+ $this->new_log = array();
29
+ $this->old_version = get_option( 'wpmtst_plugin_version', false );
30
+ if ( $this->old_version ) {
31
+ $this->log( __CLASS__, 'old: ' . $this->old_version . ' --> new: ' . WPMTST_VERSION );
32
+ } else {
33
+ $this->log( __CLASS__, 'NEW INSTALL', WPMTST_VERSION );
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Add a log entry.
39
+ *
40
+ * @param $name
41
+ * @param string $entry
42
+ * @param string $var
43
+ */
44
+ private function log( $name, $entry = '', $var = '' ) {
45
+ if ( $name ) {
46
+ $x = $name;
47
+ if ( $entry ) {
48
+ $x .= ' : ' . $entry;
49
+ if ( $var ) {
50
+ $x .= ' = ';
51
+ if ( is_array( $var ) || is_object( $var ) ) {
52
+ // log the text
53
+ $this->new_log[] = $x;
54
+ // then log the variable
55
+ $this->new_log[] = $var;
56
+ } else {
57
+ $this->new_log[] = $x . $var;
58
+ }
59
+ } else {
60
+ $this->new_log[] = $x;
61
+ }
62
+ } else {
63
+ $this->new_log[] = $x;
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Plugin activation and update.
70
+ *
71
+ * ---------
72
+ * REMEMBER!
73
+ * ---------
74
+ * If you are changing the value of a default field property,
75
+ * then you need to unset that value in the current field
76
+ * before merging in the new default values.
77
+ *
78
+ * For example, when changing a rating field property from
79
+ * disabled (0) to enabled (1) in order for the property to
80
+ * be displayed in the form editor.
81
+ */
82
+ public function update() {
83
+ if ( get_transient( 'wpmtst_update_in_progress' ) ) {
84
+ return;
85
+ }
86
+
87
+ set_transient( 'wpmtst_update_in_progress', 1, 10 );
88
+
89
+ /**
90
+ * Add custom capablities.
91
+ *
92
+ * @since 2.27.1
93
+ */
94
+ $this->add_caps();
95
+
96
+ /**
97
+ * Check DB version.
98
+ */
99
+ $this->update_db_check();
100
+
101
+ /**
102
+ * Let's start updating.
103
+ */
104
+ $history = get_option( 'wpmtst_history', array() );
105
+
106
+ /**
107
+ * Options.
108
+ */
109
+ update_option( 'wpmtst_options', $this->update_options() );
110
+
111
+ /**
112
+ * Custom fields.
113
+ */
114
+ update_option( 'wpmtst_fields', $this->update_fields() );
115
+
116
+ /**
117
+ * Forms.
118
+ */
119
+ update_option( 'wpmtst_base_forms', $this->update_base_forms() );
120
+ update_option( 'wpmtst_custom_forms', $this->update_custom_forms() );
121
+ update_option( 'wpmtst_form_options', $this->update_form_options() );
122
+
123
+ /**
124
+ * Compatibility options.
125
+ *
126
+ * @since 2.28.0
127
+ */
128
+ update_option( 'wpmtst_compat_options', $this->update_compat_options() );
129
+
130
+ /**
131
+ * Overwrite default view options.
132
+ *
133
+ * @since 2.15.0
134
+ */
135
+ update_option( 'wpmtst_view_options', $this->update_view_options() );
136
+
137
+ /**
138
+ * Overwrite default view settings.
139
+ *
140
+ * @since 2.15.0
141
+ */
142
+ update_option( 'wpmtst_view_default', $this->update_default_view() );
143
+
144
+ /**
145
+ * Update views.
146
+ */
147
+ $this->update_views();
148
+
149
+ /**
150
+ * Convert nofollow
151
+ */
152
+ if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
153
+ $this->convert_nofollow();
154
+ $this->update_history_log( '2.23.0_convert_nofollow' );
155
+ }
156
+
157
+ /**
158
+ * Captcha plugin integrations.
159
+ *
160
+ * @since 2.29.0
161
+ */
162
+ update_option( 'wpmtst_captcha_plugins', $this->update_captcha_plugins() );
163
+
164
+ /**
165
+ * Legacy stuff.
166
+ */
167
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
168
+ // Upgrade from version 1.x
169
+ delete_option( 'wpmtst_cycle' );
170
+
171
+ // L10n context no longer used.
172
+ delete_option( 'wpmtst_l10n_contexts' );
173
+
174
+ // Remove older attempts at admin notices.
175
+ delete_option( 'wpmtst_news_flag' );
176
+
177
+ $this->update_history_log( '2.28_new_update_process' );
178
+ }
179
+
180
+ /**
181
+ * Fix add-ons.
182
+ */
183
+ $this->update_addons();
184
+
185
+ /**
186
+ * Update the plugin version.
187
+ */
188
+ update_option( 'wpmtst_plugin_version', WPMTST_VERSION );
189
+
190
+ /**
191
+ * Update log.
192
+ */
193
+ $this->update_log();
194
+
195
+ delete_transient( 'wpmtst_update_in_progress' );
196
+ }
197
+
198
+ /**
199
+ * Fix add-on file names.
200
+ *
201
+ * @since 2.30.9
202
+ */
203
+ public function update_addons() {
204
+ $addons = get_option( 'wpmtst_addons' );
205
+ if ( $addons ) {
206
+ foreach ( $addons as $addon => $data ) {
207
+ if ( isset( $addons[ $addon ]['file'] ) ) {
208
+ $addons[ $addon ]['file'] = plugin_basename( basename( $data['file'], '.php' ) . '/' . basename( $data['file'] ) );
209
+ }
210
+ }
211
+ update_option( 'wpmtst_addons', $addons );
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Update the log in options table.
217
+ */
218
+ public function update_log() {
219
+ $log = get_option( 'wpmtst_update_log', array() );
220
+ $log[ current_time( 'mysql' ) ] = $this->new_log;
221
+ update_option( 'wpmtst_update_log', $log );
222
+ }
223
+
224
+ /**
225
+ * Return admin role.
226
+ *
227
+ * @since 2.27.0
228
+ *
229
+ * @return bool|null|WP_Role
230
+ */
231
+ public function get_admins() {
232
+ return get_role( 'administrator' );
233
+ }
234
+
235
+ /**
236
+ * Add custom capabilities.
237
+ *
238
+ * @since 2.27.1
239
+ */
240
+ public function add_caps() {
241
+ $admins = $this->get_admins();
242
+ if ( $admins ) {
243
+ $admins->add_cap( 'strong_testimonials_views' );
244
+ $admins->add_cap( 'strong_testimonials_fields' );
245
+ $admins->add_cap( 'strong_testimonials_options' );
246
+ $admins->add_cap( 'strong_testimonials_about' );
247
+ } else {
248
+ $this->log( __FUNCTION__, 'failed' );
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Remove custom capabilities.
254
+ *
255
+ * Was part of uninstall process but cannot be run from static class.
256
+ *
257
+ * @todo Move to Leave No Trace.
258
+ *
259
+ * @since 2.27.1
260
+ */
261
+ public function remove_caps() {
262
+ if ( $admins = $this->get_admins() ) {
263
+ $admins->remove_cap( 'strong_testimonials_views' );
264
+ $admins->remove_cap( 'strong_testimonials_fields' );
265
+ $admins->remove_cap( 'strong_testimonials_options' );
266
+ $admins->remove_cap( 'strong_testimonials_about' );
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Update tables.
272
+ *
273
+ * @since 1.21.0 Checking for new table version.
274
+ */
275
+ public function update_db_check() {
276
+ if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
277
+ wpmtst_update_tables();
278
+ $this->log( __FUNCTION__, 'tables updated' );
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Update history log.
284
+ *
285
+ * @param $event
286
+ */
287
+ public function update_history_log( $event ) {
288
+ $history = get_option( 'wpmtst_history', array() );
289
+ $history[ $event ] = current_time( 'mysql' );
290
+ update_option( 'wpmtst_history', $history );
291
+ }
292
+
293
+ /**
294
+ * Update options.
295
+ *
296
+ * @return array
297
+ */
298
+ public function update_options() {
299
+ $options = get_option( 'wpmtst_options' );
300
+ if ( ! $options ) {
301
+ return Strong_Testimonials_Defaults::get_options();
302
+ }
303
+
304
+ /**
305
+ * Remove version 1 options
306
+ */
307
+ if ( version_compare( '2.0', $this->old_version ) ) {
308
+
309
+ if ( isset( $options['captcha'] ) ) {
310
+ unset( $options['captcha'] );
311
+ }
312
+
313
+ if ( isset( $options['plugin_version'] ) ) {
314
+ unset( $options['plugin_version'] );
315
+ }
316
+
317
+ if ( isset( $options['per_page'] ) ) {
318
+ unset( $options['per_page'] );
319
+ }
320
+
321
+ if ( isset( $options['load_page_style'] ) ) {
322
+ unset( $options['load_page_style'] );
323
+ }
324
+
325
+ if ( isset( $options['load_widget_style'] ) ) {
326
+ unset( $options['load_widget_style'] );
327
+ }
328
+
329
+ if ( isset( $options['load_form_style'] ) ) {
330
+ unset( $options['load_form_style'] );
331
+ }
332
+
333
+ if ( isset( $options['load_rtl_style'] ) ) {
334
+ unset( $options['load_rtl_style'] );
335
+ }
336
+
337
+ if ( isset( $options['shortcode'] ) ) {
338
+ unset( $options['shortcode'] );
339
+ }
340
+
341
+ if ( isset( $options['default_template'] ) ) {
342
+ unset( $options['default_template'] );
343
+ }
344
+
345
+ if ( isset( $options['client_section'] ) ) {
346
+ unset( $options['client_section'] );
347
+ }
348
+ }
349
+
350
+ /**
351
+ * Remove slideshow z-index (Cycle)
352
+ *
353
+ * @since 2.15.0
354
+ */
355
+ if ( isset( $options['slideshow_zindex'] ) ) {
356
+ unset( $options['slideshow_zindex'] );
357
+ }
358
+
359
+ /**
360
+ * Replace zero embed_width with empty value.
361
+ *
362
+ * @since 2.27.0
363
+ */
364
+ if ( 0 === $options['embed_width'] ) {
365
+ $options['embed_width'] = '';
366
+ }
367
+
368
+ /**
369
+ * Remove email logging.
370
+ *
371
+ * @since 2.28.4
372
+ */
373
+ if ( isset( $options['email_log_level'] ) ) {
374
+ unset( $options['email_log_level'] );
375
+ }
376
+
377
+ // Merge in new options
378
+ $options = array_merge( Strong_Testimonials_Defaults::get_options(), $options );
379
+
380
+ return $options;
381
+ }
382
+
383
+ /**
384
+ * Default custom fields.
385
+ *
386
+ * @since 2.31.0 There is a rare bug/conflict where the default fields are incomplete.
387
+ * Overwrite existing fields on every update to auto-repair.
388
+ *
389
+ * @return array
390
+ */
391
+ public function update_fields() {
392
+ return Strong_Testimonials_Defaults::get_fields();
393
+ }
394
+
395
+ /**
396
+ * Base forms.
397
+ *
398
+ * @return array
399
+ */
400
+ public function update_base_forms() {
401
+ return Strong_Testimonials_Defaults::get_base_forms();
402
+ }
403
+
404
+ /**
405
+ * Custom forms.
406
+ *
407
+ * @return array
408
+ */
409
+ public function update_custom_forms() {
410
+ $custom_forms = get_option( 'wpmtst_custom_forms' );
411
+ if ( ! $custom_forms ) {
412
+ return Strong_Testimonials_Defaults::get_custom_forms();
413
+ }
414
+
415
+ foreach ( $custom_forms as $form_id => $form_properties ) {
416
+ foreach ( $form_properties['fields'] as $key => $form_field ) {
417
+
418
+ /*
419
+ * Convert categories to category-selector.
420
+ * @since 2.17.0
421
+ */
422
+ if ( 'categories' == $form_field['input_type'] ) {
423
+ $custom_forms[ $form_id ]['fields'][ $key ]['input_type'] = 'category-selector';
424
+ }
425
+
426
+ /*
427
+ * Unset `show_default_options` for rating field. Going from 0 to 1.
428
+ * @since 2.21.0
429
+ */
430
+ if ( 'rating' == $form_field['input_type'] ) {
431
+ unset( $form_field['show_default_options'] );
432
+ }
433
+
434
+ /*
435
+ * Add `show_required_option` to shortcode field. Initial value is false.
436
+ * @since 2.22.0
437
+ */
438
+ if ( 'shortcode' == $form_field['input_type'] ) {
439
+ $form_field['show_required_option'] = false;
440
+ }
441
+
442
+ /*
443
+ * Add `show_default_options` to checkbox field.
444
+ *
445
+ * @since 2.27.0
446
+ */
447
+ if ( 'checkbox' == $form_field['input_type'] ) {
448
+ $form_field['show_default_options'] = 1;
449
+ }
450
+
451
+ /*
452
+ * Merge in new default.
453
+ * Custom fields are in display order (not associative) so we must find them by `input_type`.
454
+ * @since 2.21.0 Using default fields instead of default form as source
455
+ */
456
+ $new_default = array();
457
+ $fields = get_option( 'wpmtst_fields', array() );
458
+
459
+ foreach ( $fields['field_types'] as $field_type_group_key => $field_type_group ) {
460
+ foreach ( $field_type_group as $field_type_key => $field_type_field ) {
461
+ if ( $field_type_field['input_type'] == $form_field['input_type'] ) {
462
+ $new_default = $field_type_field;
463
+ break;
464
+ }
465
+ }
466
+ }
467
+
468
+ if ( $new_default ) {
469
+ $custom_forms[ $form_id ]['fields'][ $key ] = array_merge( $new_default, $form_field );
470
+ }
471
+ }
472
+ }
473
+
474
+ return $custom_forms;
475
+ }
476
+
477
+ /**
478
+ * Form options.
479
+ *
480
+ * @return array
481
+ */
482
+ public function update_form_options() {
483
+ $form_options = get_option( 'wpmtst_form_options' );
484
+ if ( ! $form_options ) {
485
+ return Strong_Testimonials_Defaults::get_form_options();
486
+ }
487
+
488
+ $options = get_option( 'wpmtst_options', array() );
489
+ $history = get_option( 'wpmtst_history', array() );
490
+
491
+ /**
492
+ * Move existing options.
493
+ */
494
+ if ( isset( $options['admin_notify'] ) ) {
495
+ $form_options['admin_notify'] = $options['admin_notify'];
496
+ unset( $options['admin_notify'] );
497
+
498
+ $form_options['admin_email'] = $options['admin_email'];
499
+ unset( $options['admin_email'] );
500
+
501
+ $form_options['captcha'] = $options['captcha'];
502
+ unset( $options['captcha'] );
503
+
504
+ $form_options['honeypot_before'] = $options['honeypot_before'];
505
+ unset( $options['honeypot_before'] );
506
+
507
+ $form_options['honeypot_after'] = $options['honeypot_after'];
508
+ unset( $options['honeypot_after'] );
509
+
510
+ update_option( 'wpmtst_options', $options );
511
+ }
512
+
513
+ /**
514
+ * Update single email recipient to multiple.
515
+ *
516
+ * @since 1.18
517
+ */
518
+ if ( ! isset( $form_options['recipients'] ) ) {
519
+ $form_options['recipients'] = array(
520
+ array(
521
+ 'admin_name' => isset( $form_options['admin_name'] ) ? $form_options['admin_name'] : '',
522
+ 'admin_site_email' => isset( $form_options['admin_site_email'] ) ? $form_options['admin_site_email'] : 1,
523
+ 'admin_email' => isset( $form_options['admin_email'] ) ? $form_options['admin_email'] : '',
524
+ 'primary' => 1, // cannot be deleted
525
+ ),
526
+ );
527
+
528
+ unset( $form_options['admin_name'] );
529
+ unset( $form_options['admin_site_email'] );
530
+ unset( $form_options['admin_email'] );
531
+ }
532
+
533
+ /**
534
+ * Add default required-notice setting
535
+ *
536
+ * @since 2.24.1
537
+ */
538
+ if ( ! isset( $form_options['messages']['required-field']['enabled'] ) ) {
539
+ $form_options['messages']['required-field']['enabled'] = 1;
540
+ }
541
+
542
+ /**
543
+ * Merge in new options.
544
+ */
545
+ $defaults = Strong_Testimonials_Defaults::get_form_options();
546
+
547
+ $form_options = array_merge( $defaults, $form_options );
548
+
549
+ // Merge nested arrays individually. Don't use array_merge_recursive.
550
+
551
+ $form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
552
+
553
+ foreach ( $defaults['messages'] as $key => $message ) {
554
+ $form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
555
+ }
556
+
557
+ /**
558
+ * Convert Captcha plugin name.
559
+ *
560
+ * @since 2.28.5
561
+ */
562
+ switch ( $form_options['captcha'] ) {
563
+
564
+ case 'gglcptch':
565
+ // Google Captcha by BestWebSoft
566
+ $form_options['captcha'] = 'google-captcha';
567
+ $notice = false;
568
+ break;
569
+
570
+ case 'bwsmathpro':
571
+ // Captcha Pro by BestWebSoft
572
+ $form_options['captcha'] = 'captcha-pro';
573
+ $notice = false;
574
+ break;
575
+
576
+ case 'miyoshi':
577
+ // Really Simple Captcha by Takayuki Miyoshi
578
+ $form_options['captcha'] = 'really-simple-captcha';
579
+ $notice = false;
580
+ break;
581
+
582
+ case 'advnore':
583
+ // Advanced noCaptcha reCaptcha by Shamim Hasan
584
+ // Integration dropped @since 2.29.0
585
+ $form_options['captcha'] = '';
586
+ $notice = true;
587
+ break;
588
+
589
+ case 'bwsmath':
590
+ // Craptcha by simplywordpress
591
+ // Integration dropped @since 2.29.0
592
+ $form_options['captcha'] = '';
593
+ $notice = true;
594
+ break;
595
+
596
+ default:
597
+ $notice = false;
598
+ }
599
+
600
+ if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
601
+ $this->update_history_log( '2.29_captcha_options_changed' );
602
+ if ( $notice ) {
603
+ wpmtst_add_admin_notice( 'captcha-options-changed', true );
604
+ }
605
+ }
606
+
607
+ return $form_options;
608
+ }
609
+
610
+ /**
611
+ * Compatibility options.
612
+ *
613
+ * @since 2.28.0
614
+ *
615
+ * @return array
616
+ */
617
+ public function update_compat_options() {
618
+ $options = get_option( 'wpmtst_compat_options' );
619
+ if ( ! $options ) {
620
+ return Strong_Testimonials_Defaults::get_compat_options();
621
+ }
622
+
623
+ // Merge in new options.
624
+ $defaults = Strong_Testimonials_Defaults::get_compat_options();
625
+
626
+ // Merge nested arrays individually. Don't use array_merge_recursive.
627
+
628
+ if ( isset( $options['controller'] ) ) {
629
+ $options['ajax'] = array_merge( $defaults['ajax'], $options['ajax'] );
630
+ } else {
631
+ $options['ajax'] = $defaults['ajax'];
632
+ }
633
+
634
+ /**
635
+ * Controller
636
+ *
637
+ * @since 2.31.0
638
+ */
639
+ if ( isset( $options['controller'] ) ) {
640
+ $options['controller'] = array_merge( $defaults['controller'], $options['controller'] );
641
+ } else {
642
+ $options['controller'] = $defaults['controller'];
643
+ }
644
+
645
+ /**
646
+ * Lazy load
647
+ *
648
+ * @since 2.31.0
649
+ */
650
+ if ( isset( $options['lazyload'] ) ) {
651
+ // first level only: enabled, classes (array)
652
+ $options['lazyload'] = array_merge( $defaults['lazyload'], $options['lazyload'] );
653
+ } else {
654
+ $options['lazyload'] = $defaults['lazyload'];
655
+ }
656
+
657
+ $options = array_merge( $defaults, $options );
658
+
659
+ return $options;
660
+ }
661
+
662
+ /**
663
+ * View options.
664
+ *
665
+ * @return array
666
+ */
667
+ public function update_captcha_plugins() {
668
+ return Strong_Testimonials_Defaults::get_captcha_plugins();
669
+ }
670
+
671
+ /**
672
+ * View options.
673
+ *
674
+ * @return array
675
+ */
676
+ public function update_view_options() {
677
+ return Strong_Testimonials_Defaults::get_view_options();
678
+ }
679
+
680
+ /**
681
+ * Default view.
682
+ *
683
+ * @return array
684
+ */
685
+ public function update_default_view() {
686
+ return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
687
+ }
688
+
689
+ /**
690
+ * Update views.
691
+ *
692
+ * @uses wpmtst_save_view
693
+ */
694
+ public function update_views() {
695
+ $views = wpmtst_get_views();
696
+
697
+ if ( ! $views ) {
698
+ return;
699
+ }
700
+
701
+ $default_view = wpmtst_get_view_default();
702
+ $history = get_option( 'wpmtst_history', array() );
703
+
704
+ foreach ( $views as $key => $view ) {
705
+
706
+ $view_data = unserialize( $view['value'] );
707
+ if ( ! is_array( $view_data ) ) {
708
+ $this->log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
709
+ continue;
710
+ }
711
+
712
+ /**
713
+ * For version 2.28.
714
+ */
715
+ if ( ! isset( $history['2.28_new_update_process'] ) ) {
716
+ /**
717
+ * Compat mode no longer needed.
718
+ *
719
+ * @since 2.22.0
720
+ */
721
+ unset( $view_data['compat'] );
722
+
723
+ $view_data = $this->convert_template_name( $view_data );
724
+ $view_data = $this->convert_background_color( $view_data );
725
+ $view_data = $this->convert_form_ajax( $view_data );
726
+ $view_data = $this->convert_layout( $view_data );
727
+ $view_data = $this->convert_word_count( $view_data );
728
+ $view_data = $this->convert_excerpt_length( $view_data );
729
+ $view_data = $this->convert_more_text( $view_data );
730
+ $view_data = $this->convert_modern_title( $view_data );
731
+ $view_data = $this->convert_slideshow( $view_data );
732
+ $view_data = $this->convert_title_link( $view_data );
733
+ $view_data = $this->convert_pagination_type( $view_data );
734
+ }
735
+
736
+ /**
737
+ * For version 2.30.
738
+ */
739
+ if ( ! isset( $history['2.30_new_template_structure'] ) ) {
740
+ $view_data = $this->convert_template_structure( $view_data );
741
+ $view_data = $this->convert_count( $view_data );
742
+ if ( isset( $view_data['background']['example-font-color'] ) ) {
743
+ unset( $view_data['background']['example-font-color'] );
744
+ }
745
+
746
+ $this->update_history_log( '2.30_new_template_structure' );
747
+ }
748
+
749
+ /**
750
+ * Add carousel breakpoints.
751
+ *
752
+ * @since 2.32.2
753
+ */
754
+ if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
755
+ $view['data'] = $this->add_carousel_breakpoints( $view_data );
756
+ $this->update_history_log( '2.32.2_carousel_breakpoints' );
757
+ }
758
+
759
+ /**
760
+ * Merge in new default values.
761
+ * Merge nested arrays individually. Don't use array_merge_recursive.
762
+ */
763
+ $view['data'] = array_merge( $default_view, $view_data );
764
+
765
+ /**
766
+ * Background defaults.
767
+ */
768
+ $view['data']['background'] = array_merge( $default_view['background'], $view_data['background'] );
769
+
770
+ /**
771
+ * Pagination defaults.
772
+ * Attempt to repair bug from 2.28.2
773
+ *
774
+ * @since 2.28.3
775
+ */
776
+ if ( isset( $view_data['pagination_settings'] ) ) {
777
+ $view['data']['pagination_settings'] = array_merge( $default_view['pagination_settings'], $view_data['pagination_settings'] );
778
+
779
+ if ( ! isset( $view['data']['pagination_settings']['end_size'] ) || ! $view['data']['pagination_settings']['end_size'] ) {
780
+ $view['data']['pagination_settings']['end_size'] = 1;
781
+ }
782
+ if ( ! isset( $view['data']['pagination_settings']['mid_size'] ) || ! $view['data']['pagination_settings']['mid_size'] ) {
783
+ $view['data']['pagination_settings']['mid_size'] = 2;
784
+ }
785
+ if ( ! isset( $view['data']['pagination_settings']['per_page'] ) || ! $view['data']['pagination_settings']['per_page'] ) {
786
+ $view['data']['pagination_settings']['per_page'] = 5;
787
+ }
788
+ } else {
789
+ $view['data']['pagination_settings'] = $default_view['pagination_settings'];
790
+ }
791
+
792
+ /**
793
+ * Slideshow defaults.
794
+ */
795
+ if ( isset( $view_data['slideshow_settings'] ) ) {
796
+ $view['data']['slideshow_settings'] = array_merge( $default_view['slideshow_settings'], $view_data['slideshow_settings'] );
797
+ } else {
798
+ $view['data']['slideshow_settings'] = $default_view['slideshow_settings'];
799
+ }
800
+ ksort( $view['data']['slideshow_settings'] );
801
+
802
+ /**
803
+ * Save it.
804
+ */
805
+ wpmtst_save_view( $view );
806
+
807
+ } // foreach $view
808
+ }
809
+
810
+ /**
811
+ * Add carousel breakpoints.
812
+ *
813
+ * @param array $view_data
814
+ * @since 2.32.2
815
+ *
816
+ * @return array
817
+ */
818
+ public function add_carousel_breakpoints( $view_data ) {
819
+ if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
820
+ return $view_data;
821
+ }
822
+
823
+ if ( 1 == $view_data['slideshow_settings']['max_slides'] ) {
824
+
825
+ // Convert to single
826
+ $view_data['slideshow_settings']['type'] = 'show_single';
827
+
828
+ $view_data['slideshow_settings']['show_single'] = array(
829
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
830
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
831
+ 'margin' => 1,
832
+ );
833
+
834
+ } else {
835
+
836
+ // Convert to multiple
837
+ $view_data['slideshow_settings']['type'] = 'show_multiple';
838
+
839
+ $view_data['slideshow_settings']['breakpoints']['desktop'] = array(
840
+ 'max_slides' => $view_data['slideshow_settings']['max_slides'],
841
+ 'move_slides' => $view_data['slideshow_settings']['move_slides'],
842
+ 'margin' => 1,
843
+ );
844
+
845
+ }
846
+
847
+ // Remove old values
848
+ unset(
849
+ $view_data['slideshow_settings']['max_slides'],
850
+ $view_data['slideshow_settings']['move_slides'],
851
+ $view_data['slideshow_settings']['margin']
852
+ );
853
+
854
+ return $view_data;
855
+ }
856
+
857
+ /**
858
+ * Convert template naming structure.
859
+ *
860
+ * @since 2.30.0
861
+ *
862
+ * @param $view_data
863
+ *
864
+ * @return array
865
+ */
866
+ public function convert_template_structure( $view_data ) {
867
+ /*
868
+ Array
869
+ (
870
+ [0] => default:content
871
+ [1] => default-dark:form
872
+ [2] => default-dark:content
873
+ [3] => default:form
874
+ [4] => image-right:content
875
+ [5] => no-quotes:content
876
+ [6] => large:widget
877
+ [7] => modern:content
878
+ [8] => simple:content
879
+ [9] => simple:form
880
+ [10] => unstyled:content
881
+ [11] => unstyled:form
882
+ [12] => default:widget
883
+ [13] => image-right:widget
884
+ )
885
+ */
886
+ switch ( $view_data['template'] ) {
887
+ case 'default:content':
888
+ $view_data['template'] = 'default';
889
+ break;
890
+ case 'default-dark:form':
891
+ $view_data['template'] = 'default-form';
892
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
893
+ break;
894
+ case 'default-dark:content':
895
+ $view_data['template'] = 'default';
896
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'theme' => 'dark' );
897
+ break;
898
+ case 'default:form':
899
+ $view_data['template'] = 'default-form';
900
+ break;
901
+ case 'image-right:content':
902
+ $view_data['template'] = 'default';
903
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
904
+ break;
905
+ case 'no-quotes:content':
906
+ $view_data['template'] = 'default';
907
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'quotes' => 'off' );
908
+ break;
909
+ case 'large:widget':
910
+ $view_data['template'] = 'bold';
911
+ break;
912
+ case 'modern:content':
913
+ $view_data['template'] = 'modern';
914
+ break;
915
+ case 'simple:content':
916
+ $view_data['template'] = 'simple';
917
+ break;
918
+ case 'simple:form':
919
+ $view_data['template'] = 'simple-form';
920
+ break;
921
+ case 'unstyled:content':
922
+ $view_data['template'] = 'unstyled';
923
+ break;
924
+ case 'unstyled:form':
925
+ $view_data['template'] = 'unstyled-form';
926
+ break;
927
+ case 'default:widget':
928
+ $view_data['template'] = 'small-widget';
929
+ break;
930
+ case 'image-right:widget':
931
+ $view_data['template'] = 'small-widget';
932
+ $view_data['template_settings'][ $view_data['template'] ] = array( 'image_position' => 'right' );
933
+ break;
934
+ default:
935
+ // Keep existing value; it's probably a custom template.
936
+ }
937
+
938
+ return $view_data;
939
+ }
940
+
941
+ /**
942
+ * Update template naming structure.
943
+ *
944
+ * @param $view_data
945
+ *
946
+ * @return array
947
+ */
948
+ public function convert_template_name( $view_data ) {
949
+ // Change default template from empty to 'default:{type}'
950
+ if ( ! $view_data['template'] ) {
951
+ if ( 'form' == $view_data['mode'] ) {
952
+ $type = 'form';
953
+ } else {
954
+ $type = 'content';
955
+ }
956
+
957
+ $view_data['template'] = "default:$type";
958
+ } else {
959
+ // Convert name; e.g. 'simple/testimonials.php'
960
+ if ( 'widget/testimonials.php' == $view_data['template'] ) {
961
+ $view_data['template'] = 'default:widget';
962
+ } else {
963
+ $view_data['template'] = str_replace( '/', ':', $view_data['template'] );
964
+ $view_data['template'] = str_replace( 'testimonials.php', 'content', $view_data['template'] );
965
+ $view_data['template'] = str_replace( 'testimonial-form.php', 'form', $view_data['template'] );
966
+ }
967
+ }
968
+
969
+ return $view_data;
970
+ }
971
+
972
+ /**
973
+ * Convert length (characters).
974
+ *
975
+ * @since 2.10.0 word_count (deprecated)
976
+ * @since 2.11.4 excerpt_length
977
+ *
978
+ * @param $view_data
979
+ *
980
+ * @return array
981
+ */
982
+ public function convert_excerpt_length( $view_data ) {
983
+ if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
984
+ $default_view = Strong_Testimonials_Defaults::get_default_view();
985
+ $average_word_length = $this->get_average_word_length();
986
+
987
+ if ( isset( $view_data['length'] ) && $view_data['length'] ) {
988
+ $word_count = round( $view_data['length'] / $average_word_length );
989
+ $word_count = $word_count < 5 ? 5 : $word_count;
990
+ $word_count = $word_count > 300 ? 300 : $word_count;
991
+ $view_data['excerpt_length'] = $word_count;
992
+ } else {
993
+ $view_data['excerpt_length'] = $default_view['excerpt_length'];
994
+ }
995
+
996
+ unset( $view_data['length'] );
997
+ }
998
+
999
+ return $view_data;
1000
+ }
1001
+
1002
+ /**
1003
+ * Convert more_text to post or page.
1004
+ *
1005
+ * @since 2.10.0
1006
+ *
1007
+ * @param $view_data
1008
+ *
1009
+ * @return array
1010
+ */
1011
+ public function convert_more_text( $view_data ) {
1012
+ if ( isset( $view_data['more_text'] ) ) {
1013
+ if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
1014
+ // convert more_page to toggle and move page id to more_page_id
1015
+ $view_data['more_page_id'] = $view_data['more_page'];
1016
+ $view_data['more_page'] = 1;
1017
+ $view_data['more_page_text'] = $view_data['more_text'];
1018
+ } elseif ( isset( $view_data['more_post'] ) && $view_data['more_post'] ) {
1019
+ $view_data['more_post_text'] = $view_data['more_text'];
1020
+ }
1021
+ unset( $view_data['more_text'] );
1022
+ }
1023
+
1024
+ return $view_data;
1025
+ }
1026
+
1027
+ /**
1028
+ * Convert slideshow settings.
1029
+ *
1030
+ * @since 2.15.0
1031
+ *
1032
+ * @param $view_data
1033
+ *
1034
+ * @return array
1035
+ */
1036
+ public function convert_slideshow( $view_data ) {
1037
+ if ( isset( $view_data['slideshow_settings'] ) ) {
1038
+ return $view_data;
1039
+ }
1040
+
1041
+ if ( 'scrollHorz' == $view_data['effect'] ) {
1042
+ $view_data['effect'] = 'horizontal';
1043
+ }
1044
+
1045
+ $view_data['slideshow_settings'] = array(
1046
+ 'effect' => $view_data['effect'],
1047
+ 'speed' => $view_data['effect_for'],
1048
+ 'pause' => $view_data['show_for'],
1049
+ 'auto_hover' => ! $view_data['no_pause'],
1050
+ 'adapt_height' => false,
1051
+ 'adapt_height_speed' => .5,
1052
+ 'stretch' => isset( $view_data['stretch'] ) ? 1 : 0,
1053
+ );
1054
+
1055
+ unset(
1056
+ $view_data['effect'],
1057
+ $view_data['effect_for'],
1058
+ $view_data['no_pause'],
1059
+ $view_data['show_for'],
1060
+ $view_data['stretch']
1061
+ );
1062
+
1063
+ if ( isset( $view_data['slideshow_nav'] ) ) {
1064
+ switch ( $view_data['slideshow_nav'] ) {
1065
+ case 'simple':
1066
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1067
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1068
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1069
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1070
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1071
+ break;
1072
+ case 'buttons1':
1073
+ $view_data['slideshow_settings']['controls_type'] = 'sides';
1074
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1075
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1076
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1077
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1078
+ break;
1079
+ case 'buttons2':
1080
+ $view_data['slideshow_settings']['controls_type'] = 'simple';
1081
+ $view_data['slideshow_settings']['controls_style'] = 'buttons2';
1082
+ $view_data['slideshow_settings']['pager_type'] = 'none';
1083
+ $view_data['slideshow_settings']['pager_style'] = 'buttons';
1084
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1085
+ break;
1086
+ case 'indexed':
1087
+ $view_data['slideshow_settings']['controls_type'] = 'none';
1088
+ $view_data['slideshow_settings']['controls_style'] = 'buttons';
1089
+ $view_data['slideshow_settings']['pager_type'] = 'full';
1090
+ $view_data['slideshow_settings']['pager_style'] = 'text';
1091
+ $view_data['slideshow_settings']['nav_position'] = 'inside';
1092
+ break;
1093
+ default:
1094
+ // none
1095
+ }
1096
+ unset( $view_data['slideshow_nav'] );
1097
+ }
1098
+
1099
+ return $view_data;
1100
+ }
1101
+
1102
+ /**
1103
+ * Convert 'all' to 'count'.
1104
+ *
1105
+ * @param $view_data
1106
+ *
1107
+ * @return array
1108
+ */
1109
+ public function convert_count( $view_data ) {
1110
+ if ( isset( $view_data['all'] ) ) {
1111
+ if ( $view_data['all'] ) {
1112
+ $view_data['count'] = -1;
1113
+ }
1114
+ unset( $view_data['all'] );
1115
+ }
1116
+
1117
+ return $view_data;
1118
+ }
1119
+
1120
+ /**
1121
+ * Convert background color.
1122
+ *
1123
+ * @param $view_data
1124
+ *
1125
+ * @return array
1126
+ */
1127
+ public function convert_background_color( $view_data ) {
1128
+ if ( ! is_array( $view_data['background'] ) ) {
1129
+ $view_data['background'] = array(
1130
+ 'color' => $view_data['background'],
1131
+ 'type' => 'single',
1132
+ );
1133
+ }
1134
+
1135
+ return $view_data;
1136
+ }
1137
+
1138
+ /**
1139
+ * Convert 'form-ajax' (hyphen) to 'form_ajax' (underscore).
1140
+ *
1141
+ * @param $view_data
1142
+ *
1143
+ * @return array
1144
+ */
1145
+ public function convert_form_ajax( $view_data ) {
1146
+ if ( isset( $view_data['form-ajax'] ) ) {
1147
+ $view_data['form_ajax'] = $view_data['form-ajax'];
1148
+ unset( $view_data['form-ajax'] );
1149
+ }
1150
+
1151
+ return $view_data;
1152
+ }
1153
+
1154
+ /**
1155
+ * Prevent incompatible layouts.
1156
+ *
1157
+ * @param $view_data
1158
+ *
1159
+ * @return array
1160
+ */
1161
+ public function convert_layout( $view_data ) {
1162
+ if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
1163
+ if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
1164
+ $view_data['layout'] = '';
1165
+ }
1166
+ }
1167
+
1168
+ return $view_data;
1169
+ }
1170
+
1171
+ /**
1172
+ * Move word_count to excerpt_length for versions 2.10.0 to 2.11.3.
1173
+ *
1174
+ * @since 2.11.4
1175
+ *
1176
+ * @param $view_data
1177
+ *
1178
+ * @return array
1179
+ */
1180
+ public function convert_word_count( $view_data ) {
1181
+ if ( isset( $view_data['word_count'] ) ) {
1182
+ $view_data['excerpt_length'] = $view_data['word_count'];
1183
+ unset( $view_data['word_count'] );
1184
+ }
1185
+
1186
+ return $view_data;
1187
+ }
1188
+
1189
+ /**
1190
+ * Disable title on Modern template because new version of template has the title.
1191
+ * Only if updating from version earlier than 2.12.4.
1192
+ *
1193
+ * @param $view_data
1194
+ *
1195
+ * @return array
1196
+ */
1197
+ public function convert_modern_title( $view_data ) {
1198
+ if ( 'modern:content' == $view_data['template'] ) {
1199
+ if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
1200
+ $view_data['title'] = 0;
1201
+ $this->update_history_log( '2.12.4_convert_modern_template' );
1202
+ }
1203
+ }
1204
+
1205
+ return $view_data;
1206
+ }
1207
+
1208
+ /**
1209
+ * Title link
1210
+ *
1211
+ * @since 2.26.0
1212
+ *
1213
+ * @param $view_data
1214
+ *
1215
+ * @return array
1216
+ */
1217
+ public function convert_title_link( $view_data ) {
1218
+ if ( ! isset( $view_data['title_link'] ) ) {
1219
+ $view_data['title_link'] = 0;
1220
+ }
1221
+
1222
+ return $view_data;
1223
+ }
1224
+
1225
+ /**
1226
+ * Convert nofollow from (on|off) to (1|0).
1227
+ *
1228
+ * @since 2.23.0
1229
+ */
1230
+ public function convert_nofollow() {
1231
+ $args = array(
1232
+ 'posts_per_page' => - 1,
1233
+ 'post_type' => 'wpm-testimonial',
1234
+ 'post_status' => 'publish',
1235
+ 'suppress_filters' => true,
1236
+ );
1237
+ $posts = get_posts( $args );
1238
+ if ( ! $posts ) {
1239
+ return;
1240
+ }
1241
+
1242
+ /**
1243
+ * Remove the equivocation. There is no false.
1244
+ */
1245
+ foreach ( $posts as $post ) {
1246
+ $nofollow = get_post_meta( $post->ID, 'nofollow', true );
1247
+ $new_value = 'default';
1248
+
1249
+ if ( 'on' == $nofollow ) {
1250
+ $new_value = 'yes';
1251
+ } elseif ( 1 === $nofollow ) {
1252
+ $new_value = 'yes';
1253
+ } elseif ( 'off' == $nofollow ) {
1254
+ $new_value = 'no';
1255
+ } elseif ( 0 === $nofollow ) {
1256
+ $new_value = 'no';
1257
+ } elseif ( is_bool( $nofollow ) ) {
1258
+ if ( $nofollow ) {
1259
+ $new_value = 'yes';
1260
+ } else {
1261
+ $new_value = 'default';
1262
+ }
1263
+ }
1264
+
1265
+ update_post_meta( $post->ID, 'nofollow', $new_value );
1266
+ }
1267
+ }
1268
+
1269
+ /**
1270
+ * Convert pagination settings.
1271
+ *
1272
+ * @since 2.28.0
1273
+ *
1274
+ * @param $view_data
1275
+ *
1276
+ * @return mixed
1277
+ */
1278
+ public function convert_pagination_type( $view_data ) {
1279
+ if ( isset( $view_data['pagination_type'] ) ) {
1280
+ $view_data['pagination_settings']['type'] = $view_data['pagination_type'];
1281
+ unset( $view_data['pagination_type'] );
1282
+ }
1283
+
1284
+ if ( isset( $view_data['nav'] ) ) {
1285
+ $view_data['pagination_settings']['nav'] = $view_data['nav'];
1286
+ unset( $view_data['nav'] );
1287
+ }
1288
+
1289
+ if ( isset( $view_data['per_page'] ) ) {
1290
+ $view_data['pagination_settings']['per_page'] = $view_data['per_page'];
1291
+ unset( $view_data['per_page'] );
1292
+ }
1293
+
1294
+ return $view_data;
1295
+ }
1296
+
1297
+ /**
1298
+ * Convert length to excerpt_length.
1299
+ *
1300
+ * @since 2.10.0
1301
+ */
1302
+ public function get_average_word_length() {
1303
+ $args = array(
1304
+ 'posts_per_page' => - 1,
1305
+ 'post_type' => 'wpm-testimonial',
1306
+ 'post_status' => 'publish',
1307
+ 'suppress_filters' => true,
1308
+ );
1309
+ $posts = get_posts( $args );
1310
+ if ( ! $posts ) {
1311
+ return 5;
1312
+ }
1313
+
1314
+ $allwords = array();
1315
+
1316
+ foreach ( $posts as $post ) {
1317
+ $words = explode( ' ', $post->post_content );
1318
+ if ( count( $words ) > 5 ) {
1319
+ $allwords = $allwords + $words;
1320
+ }
1321
+ }
1322
+
1323
+ $wordstring = join( '', $allwords );
1324
+
1325
+ return round( strlen( $wordstring ) / count( $allwords ) );
1326
+ }
1327
+
1328
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-strong-views-list-table.php CHANGED
@@ -1,228 +1,231 @@
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
- $actions = array();
127
- $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
128
- $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate' ) . '</a>';
129
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "Delete \"%s\"?" ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete' ) . "</a>";
130
-
131
- echo $this->row_actions( $actions );
132
- }
133
-
134
- public function column_default( $item, $column_name ) {
135
- switch ( $column_name ) {
136
- case 'id':
137
- $text = $item['id'];
138
- break;
139
- case 'sticky':
140
- $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
141
- $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
142
- break;
143
- case 'name':
144
- $text = $item['name'];
145
- break;
146
- case 'mode':
147
- $mode = $item['data']['mode'];
148
- $text = $mode;
149
- $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
150
- if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
151
- $text = $view_options['mode'][ $mode ]['label'];
152
- }
153
- break;
154
- case 'template':
155
- if ( 'single_template' == $item['data']['mode'] ) {
156
- $text = __( 'theme single post template', 'strong-testimonials' );
157
- } else {
158
- $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
159
- }
160
- break;
161
- case 'shortcode':
162
- if ( 'single_template' == $item['data']['mode'] ) {
163
- $text = '';
164
- } else {
165
- $text = '[testimonial_view id="' . $item['id'] . '"]';
166
- }
167
- break;
168
- default:
169
- $text = print_r( $item, true );
170
- }
171
-
172
- return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
173
- }
174
-
175
- public function is_stuck( $id ) {
176
- $stickies = get_option( 'wpmtst_sticky_views', array() );
177
- return ( $stickies && in_array( $id, $stickies ) );
178
- }
179
-
180
- public function find_template( $atts = '' ) {
181
- $name = WPMST()->templates->get_template_config( $atts, 'name', false );
182
- return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'not found', 'strong-testimonials' ) . '</span>';
183
- }
184
-
185
- /**
186
- * Display the table
187
- *
188
- * @since 3.1.0
189
- * @access public
190
- */
191
- public function display() {
192
- $singular = $this->_args['singular'];
193
-
194
- // Disabling the table nav options to regain some real estate.
195
- //$this->display_tablenav( 'top' );
196
-
197
- ?>
198
- <div class="wp-list-table-wrap">
199
- <div class="overlay" style="display: none;"></div>
200
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
201
- <thead>
202
- <tr>
203
- <?php $this->print_column_headers(); ?>
204
- </tr>
205
- </thead>
206
-
207
- <tbody id="the-list"<?php
208
- if ( $singular ) {
209
- echo " data-wp-lists='list:$singular'";
210
- } ?>>
211
- <?php $this->display_rows_or_placeholder(); ?>
212
- </tbody>
213
-
214
- <tfoot>
215
- <tr>
216
- <?php $this->print_column_headers( false ); ?>
217
- </tr>
218
- </tfoot>
219
-
220
- </table>
221
- <?php
222
- //$this->display_tablenav( 'bottom' );
223
- ?>
224
- </div>
225
- <?php
226
- }
227
-
228
- }
 
 
 
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
+ esc_html_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="' . esc_url( $edit_link ) . '">' . esc_html( $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
+ $actions = array();
127
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
128
+ $actions['duplicate'] = '<a href="' . $duplicate_link . '">' . __( 'Duplicate' ) . '</a>';
129
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( $delete_link, 'delete-strong-view_' . $item['id'] ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( 'Delete "%s"?' ), $item['name'] ) ) . "' ) ) { return true;} return false;\">" . __( 'Delete' ) . '</a>';
130
+
131
+ echo wp_kses_post( $this->row_actions( $actions ) );
132
+ }
133
+
134
+ public function column_default( $item, $column_name ) {
135
+ switch ( $column_name ) {
136
+ case 'id':
137
+ $text = $item['id'];
138
+ break;
139
+ case 'sticky':
140
+ $stuck = $this->is_stuck( $item['id'] ) ? 'stuck' : '';
141
+ $text = '<a href="#" class="stickit ' . $stuck . '" title="' . __( 'stick to top of list', 'strong-testimonials' ) . '"></>';
142
+ break;
143
+ case 'name':
144
+ $text = $item['name'];
145
+ break;
146
+ case 'mode':
147
+ $mode = $item['data']['mode'];
148
+ $text = $mode;
149
+ $view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
150
+ if ( isset( $view_options['mode'][ $mode ]['label'] ) ) {
151
+ $text = $view_options['mode'][ $mode ]['label'];
152
+ }
153
+ break;
154
+ case 'template':
155
+ if ( 'single_template' == $item['data']['mode'] ) {
156
+ $text = __( 'theme single post template', 'strong-testimonials' );
157
+ } else {
158
+ $text = $this->find_template( array( 'template' => $item['data']['template'] ) );
159
+ }
160
+ break;
161
+ case 'shortcode':
162
+ if ( 'single_template' == $item['data']['mode'] ) {
163
+ $text = '';
164
+ } else {
165
+ $text = '[testimonial_view id="' . $item['id'] . '"]';
166
+ }
167
+ break;
168
+ default:
169
+ $text = print_r( $item, true );
170
+ }
171
+
172
+ return apply_filters( "wpmtst_view_list_column_$column_name", $text, $item );
173
+ }
174
+
175
+ public function is_stuck( $id ) {
176
+ $stickies = get_option( 'wpmtst_sticky_views', array() );
177
+ return ( $stickies && in_array( $id, $stickies ) );
178
+ }
179
+
180
+ public function find_template( $atts = '' ) {
181
+ $name = WPMST()->templates->get_template_config( $atts, 'name', false );
182
+ return $name ? $name : '<span class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'not found', 'strong-testimonials' ) . '</span>';
183
+ }
184
+
185
+ /**
186
+ * Display the table
187
+ *
188
+ * @since 3.1.0
189
+ * @access public
190
+ */
191
+ public function display() {
192
+ $singular = $this->_args['singular'];
193
+
194
+ // Disabling the table nav options to regain some real estate.
195
+ //$this->display_tablenav( 'top' );
196
+
197
+ ?>
198
+ <div class="wp-list-table-wrap">
199
+ <div class="overlay" style="display: none;"></div>
200
+ <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>">
201
+ <thead>
202
+ <tr>
203
+ <?php $this->print_column_headers(); ?>
204
+ </tr>
205
+ </thead>
206
+
207
+ <tbody id="the-list"
208
+ <?php
209
+ if ( $singular ) {
210
+ echo " data-wp-lists='list:" . esc_attr( $singular ) . "'";
211
+ }
212
+ ?>
213
+ >
214
+ <?php $this->display_rows_or_placeholder(); ?>
215
+ </tbody>
216
+
217
+ <tfoot>
218
+ <tr>
219
+ <?php $this->print_column_headers( false ); ?>
220
+ </tr>
221
+ </tfoot>
222
+
223
+ </table>
224
+ <?php
225
+ //$this->display_tablenav( 'bottom' );
226
+ ?>
227
+ </div>
228
+ <?php
229
+ }
230
+
231
+ }
admin/class-walker-strong-category-checklist.php CHANGED
@@ -1,127 +1,129 @@
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(
20
+ 'parent' => 'parent',
21
+ 'id' => 'term_id',
22
+ ); //TODO: decouple this
23
+
24
+ /**
25
+ * Starts the list before the elements are added.
26
+ *
27
+ * @see Walker:start_lvl()
28
+ *
29
+ * @since 2.5.1
30
+ *
31
+ * @param string $output Passed by reference. Used to append additional content.
32
+ * @param int $depth Depth of category. Used for tab indentation.
33
+ * @param array $args An array of arguments. @see wp_terms_checklist()
34
+ */
35
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
36
+ $indent = str_repeat( "\t", $depth );
37
+ $output .= "$indent<ul class='children'>\n";
38
+ }
39
+
40
+ /**
41
+ * Ends the list of after the elements are added.
42
+ *
43
+ * @see Walker::end_lvl()
44
+ *
45
+ * @since 2.5.1
46
+ *
47
+ * @param string $output Passed by reference. Used to append additional content.
48
+ * @param int $depth Depth of category. Used for tab indentation.
49
+ * @param array $args An array of arguments. @see wp_terms_checklist()
50
+ */
51
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
52
+ $indent = str_repeat( "\t", $depth );
53
+ $output .= "$indent</ul>\n";
54
+ }
55
+
56
+ /**
57
+ * Start the element output.
58
+ *
59
+ * @see Walker::start_el()
60
+ *
61
+ * @since 2.5.1
62
+ *
63
+ * @param string $output Passed by reference. Used to append additional content.
64
+ * @param object $category The current term object.
65
+ * @param int $depth Depth of the term in reference to parents. Default 0.
66
+ * @param array $args An array of arguments. @see wp_terms_checklist()
67
+ * @param int $id ID of the current term.
68
+ */
69
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
70
+ if ( empty( $args['taxonomy'] ) ) {
71
+ $taxonomy = 'wpm-testimonial-category';
72
+ } else {
73
+ $taxonomy = $args['taxonomy'];
74
+ }
75
+
76
+ $name = 'view[data][category]';
77
+
78
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
79
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
80
+
81
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
82
+
83
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
84
+
85
+ if ( ! empty( $args['list_only'] ) ) {
86
+ $aria_cheched = 'false';
87
+ $inner_class = 'category';
88
+
89
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
90
+ $inner_class .= ' selected';
91
+ $aria_cheched = 'true';
92
+ }
93
+
94
+ /** This filter is documented in wp-includes/category-template.php */
95
+ $output .= "\n" . '<li' . $class . '>' .
96
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
97
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
98
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
99
+ } else {
100
+ /** This filter is documented in wp-includes/category-template.php */
101
+ // newlines make for consistent spacing without extra CSS
102
+ $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
103
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
104
+ . ' id="category-' . $category->term_id . '"'
105
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
106
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
107
+ $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
108
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
109
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
110
+ $output .= '</label>';
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Ends the element output, if needed.
116
+ *
117
+ * @see Walker::end_el()
118
+ *
119
+ * @since 2.5.1
120
+ *
121
+ * @param string $output Passed by reference. Used to append additional content.
122
+ * @param object $category The current term object.
123
+ * @param int $depth Depth of the term in reference to parents. Default 0.
124
+ * @param array $args An array of arguments. @see wp_terms_checklist()
125
+ */
126
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
127
+ $output .= "</li>\n";
128
+ }
129
+ }
admin/class-walker-strong-form-category-checklist.php CHANGED
@@ -1,127 +1,129 @@
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(
20
+ 'parent' => 'parent',
21
+ 'id' => 'term_id',
22
+ ); //TODO: decouple this
23
+
24
+ /**
25
+ * Starts the list before the elements are added.
26
+ *
27
+ * @see Walker:start_lvl()
28
+ *
29
+ * @since 2.5.1
30
+ *
31
+ * @param string $output Passed by reference. Used to append additional content.
32
+ * @param int $depth Depth of category. Used for tab indentation.
33
+ * @param array $args An array of arguments. @see wp_terms_checklist()
34
+ */
35
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
36
+ $indent = str_repeat( "\t", $depth );
37
+ $output .= "$indent<ul class='children'>\n";
38
+ }
39
+
40
+ /**
41
+ * Ends the list of after the elements are added.
42
+ *
43
+ * @see Walker::end_lvl()
44
+ *
45
+ * @since 2.5.1
46
+ *
47
+ * @param string $output Passed by reference. Used to append additional content.
48
+ * @param int $depth Depth of category. Used for tab indentation.
49
+ * @param array $args An array of arguments. @see wp_terms_checklist()
50
+ */
51
+ public function end_lvl( &$output, $depth = 0, $args = array() ) {
52
+ $indent = str_repeat( "\t", $depth );
53
+ $output .= "$indent</ul>\n";
54
+ }
55
+
56
+ /**
57
+ * Start the element output.
58
+ *
59
+ * @see Walker::start_el()
60
+ *
61
+ * @since 2.5.1
62
+ *
63
+ * @param string $output Passed by reference. Used to append additional content.
64
+ * @param object $category The current term object.
65
+ * @param int $depth Depth of the term in reference to parents. Default 0.
66
+ * @param array $args An array of arguments. @see wp_terms_checklist()
67
+ * @param int $id ID of the current term.
68
+ */
69
+ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
70
+ if ( empty( $args['taxonomy'] ) ) {
71
+ $taxonomy = 'wpm-testimonial-category';
72
+ } else {
73
+ $taxonomy = $args['taxonomy'];
74
+ }
75
+
76
+ $name = 'view[data][category-form]';
77
+
78
+ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
79
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
80
+
81
+ $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
82
+
83
+ $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
84
+
85
+ if ( ! empty( $args['list_only'] ) ) {
86
+ $aria_cheched = 'false';
87
+ $inner_class = 'category';
88
+
89
+ if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
90
+ $inner_class .= ' selected';
91
+ $aria_cheched = 'true';
92
+ }
93
+
94
+ /** This filter is documented in wp-includes/category-template.php */
95
+ $output .= "\n" . '<li' . $class . '>' .
96
+ '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
97
+ ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
98
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
99
+ } else {
100
+ /** This filter is documented in wp-includes/category-template.php */
101
+ // newlines make for consistent spacing without extra CSS
102
+ $output .= "\n" . '<li id="li-category-form-' . $category->term_id . '"' . $class . '>' . "\n";
103
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
104
+ . ' id="category-form-' . $category->term_id . '"'
105
+ . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
106
+ . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
107
+ $output .= '<label class="selectit" for="category-form-' . $category->term_id . '">' . "\n";
108
+ $output .= esc_html( apply_filters( 'the_category', $category->name ) )
109
+ . ' <span class="cat-count">(' . $category->count . ')</span>';
110
+ $output .= '</label>';
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Ends the element output, if needed.
116
+ *
117
+ * @see Walker::end_el()
118
+ *
119
+ * @since 2.5.1
120
+ *
121
+ * @param string $output Passed by reference. Used to append additional content.
122
+ * @param object $category The current term object.
123
+ * @param int $depth Depth of the term in reference to parents. Default 0.
124
+ * @param array $args An array of arguments. @see wp_terms_checklist()
125
+ */
126
+ public function end_el( &$output, $category, $depth = 0, $args = array() ) {
127
+ $output .= "</li>\n";
128
+ }
129
+ }
admin/compat.php CHANGED
@@ -1,116 +1,117 @@
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
+ add_action( 'admin_init', 'wpmtst_compat_admin_init', 1 );
55
+
56
+
57
+ /**
58
+ * Prevent other post ordering plugins, in admin_init hook.
59
+ *
60
+ * @since 1.16.0
61
+ */
62
+ function wpmtst_deny_plugins_init() {
63
+
64
+ /**
65
+ * Intuitive Custom Post Order
66
+ */
67
+ if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) {
68
+ $options = get_option( 'hicpo_options' );
69
+ $update = false;
70
+
71
+ if ( isset( $options['objects'] ) && is_array( $options['objects'] ) ) {
72
+ if ( in_array( 'wpm-testimonial', $options['objects'] ) ) {
73
+ $options['objects'] = array_diff( $options['objects'], array( 'wpm-testimonial' ) );
74
+ $update = true;
75
+ }
76
+ }
77
+
78
+ if ( isset( $options['tags'] ) && is_array( $options['tags'] ) ) {
79
+ if ( in_array( 'wpm-testimonial-category', $options['tags'] ) ) {
80
+ $options['tags'] = array_diff( $options['tags'], array( 'wpm-testimonial-category' ) );
81
+ $update = true;
82
+ }
83
+ }
84
+
85
+ if ( $update ) {
86
+ update_option( 'hicpo_options', $options );
87
+ }
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
+ }
117
+ 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/admin.css CHANGED
@@ -1,823 +1,823 @@
1
- /**
2
- * Strong Testimonials admin stylesheet
3
- */
4
-
5
- .icon-blue {
6
- color: #0073aa;
7
- }
8
-
9
- .error {
10
- color: red !important;
11
- }
12
-
13
- .required-phrase {
14
- color: red;
15
- font-style: normal;
16
- font-weight: 400;
17
- font-size: 0.9em;
18
- }
19
-
20
- .required-phrase:before,
21
- label.required:after {
22
- content: '*';
23
- display: inline-block;
24
- color: red;
25
- font-size: 27px;
26
- line-height: 19px;
27
- height: 19px;
28
- font-weight: 600;
29
- vertical-align: middle;
30
- position: relative;
31
- top: 1px;
32
- }
33
-
34
- .has-input {
35
- display: inline-block;
36
- }
37
-
38
- .error-message {
39
- display: inline-block;
40
- margin-left: 0.5em;
41
- }
42
-
43
- button.nogo {
44
- margin: 0 3px;
45
- }
46
-
47
- li.warning {
48
- background: lightyellow;
49
- }
50
-
51
- .between-inputs {
52
- margin-left: 0.3em;
53
- margin-right: 0.3em;
54
- }
55
-
56
- .intro p {
57
- font-size: 14px;
58
- }
59
-
60
- .wrap.wpmtst h2 {
61
- margin: 2em 0 1em;
62
- }
63
-
64
- .wrap.wpmtst p {
65
- font-size: 14px;
66
- }
67
-
68
- .wrap.wpmtst .notice p {
69
- font-size: 13px;
70
- }
71
-
72
- .wpmtst .list-wrap {
73
- padding: .5em;
74
- }
75
-
76
- .wp-core-ui .button-primary.active,
77
- .wp-core-ui .button-primary.active:hover,
78
- .wp-core-ui .button-primary.active:focus,
79
- .wp-core-ui .button-primary:active {
80
- vertical-align: baseline;
81
- }
82
-
83
- /* Firefox fix */
84
- a.widget-action:focus {
85
- outline: none;
86
- }
87
-
88
- /* Slug field */
89
- input#post_name {
90
- width: 98%;
91
- }
92
-
93
- fieldset > div {
94
- min-height: 30px;
95
- }
96
-
97
- /* Help sections
98
- ---------------------------------------------------------*/
99
-
100
- div.help {
101
- margin-left: 0;
102
- }
103
-
104
- div.help.minor {
105
- font-size: 0.9em;
106
- text-align: left;
107
- }
108
-
109
- /* Settings table
110
- ---------------------------------------------------------*/
111
-
112
- .wpmtst i.fa.example {
113
- color: #0073aa;
114
- }
115
-
116
- .stackem ul {
117
- margin: 14px 0 0 0;
118
- }
119
-
120
- .stackem li {
121
- margin-top: 16px;
122
- margin-bottom: 16px;
123
- }
124
-
125
- .stackem label {
126
- display: inline-block;
127
- line-height: 28px;
128
- margin-right: 0.5em;
129
- vertical-align: baseline;
130
- }
131
-
132
- .stackem label.inline {
133
- display: inline-block;
134
- }
135
-
136
- .stackem p.description {
137
- margin-top: 0;
138
- margin-left: 22px;
139
- }
140
-
141
- .stackem p.description.warning {
142
- color: #CD0000;
143
- }
144
-
145
- .stackem .notice {
146
- background: none;
147
- border: none;
148
- box-shadow: none;
149
- display: inline-block;
150
- font-size: .9em;
151
- font-style: italic;
152
- margin: 0 .2em;
153
- padding: 0;
154
- color: #868686;
155
- }
156
-
157
- .stackem span.link {
158
- display: inline-block;
159
- margin: 0 .3em;
160
- font-size: .9em;
161
- line-height: 28px;
162
- }
163
-
164
- .stackem label.disabled {
165
- color: #888;
166
- }
167
-
168
- div.radio {
169
- line-height: 1.5em;
170
- }
171
-
172
- div.radio:hover {
173
- color: #000;
174
- }
175
-
176
- #screenshot-screen-options,
177
- #help-section {
178
- display: none;
179
- }
180
-
181
- .screenshot > div {
182
- display: inline-block;
183
- -webkit-box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
184
- -moz-box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
185
- box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
186
- }
187
-
188
- .help-text {
189
- padding: 0.5em 0;
190
- }
191
-
192
- /* form table */
193
-
194
- .wpmtst .form-table {
195
- vertical-align: middle;
196
- }
197
-
198
- .wpmtst .form-table .actions {
199
- /*vertical-align: top;*/
200
- }
201
-
202
- .wpmtst .form-table td {
203
- padding-top: 15px; /* override PopupMaker's override */
204
- }
205
-
206
- .wpmtst .form-table td:nth-child(1) {
207
- width: 200px;
208
- }
209
-
210
- .wpmtst .form-table .parent {
211
- border-bottom: 0;
212
- vertical-align: top;
213
- }
214
-
215
- .wpmtst .form-table th.parent + td {
216
- }
217
-
218
- .wpmtst .form-table .child {
219
- border-top: 0;
220
- }
221
-
222
- .wpmtst .form-table p {
223
- /*margin-bottom: 1em;*/
224
- }
225
-
226
- .wpmtst .form-table td p:last-child {
227
- margin-bottom: 0;
228
- }
229
-
230
- .wpmtst .form-table input,
231
- .wpmtst .form-table select,
232
- .wpmtst .form-table textarea {
233
- /*line-height: 1.5em;*/
234
- }
235
-
236
- .wpmtst .form-table input[type="button"] {
237
- line-height: 26px;
238
- height: 28px;
239
- }
240
-
241
- .wpmtst select {
242
- min-width: 120px;
243
- }
244
-
245
- .wpmtst option {
246
- padding-left: 5px;
247
- }
248
-
249
- .wpmtst .form-table div.box {
250
- border: 1px solid #DDD;
251
- display: inline-block;
252
- padding: 10px;
253
- }
254
-
255
- .wpmtst .form-table .row {
256
- line-height: 2.5em;
257
- }
258
-
259
- .wpmtst .form-table .alpha {
260
- width: 120px;
261
- }
262
-
263
- .wpmtst .form-table .alpha.alpha-110 {
264
- width: 110px;
265
- }
266
-
267
- .wpmtst .form-table .alpha + div {
268
- display: inline-block;
269
- }
270
-
271
- .wpmtst label.success-action {
272
- display: inline-block;
273
- width: 11em;
274
- padding: 10px 0;
275
- }
276
-
277
- /* compact */
278
-
279
- .wpmtst .form-table.compact th {
280
- vertical-align: top;
281
- }
282
-
283
- .wpmtst .form-table.compact td {
284
- vertical-align: middle;
285
- }
286
-
287
- /*.wpmtst .form-table.compact td:nth-child(3) {*/
288
- .wpmtst .form-table.compact td.actions {
289
- width: 100px;
290
- vertical-align: bottom;
291
- }
292
-
293
- /*.wpmtst .form-table.compact td:nth-child(3) input.button {*/
294
- .wpmtst .form-table.compact td.actions input.button {
295
- margin-right: 0;
296
- margin-bottom: 3px;
297
- }
298
-
299
- .wpmtst .form-table.compact input[type="text"] {
300
- width: 100%;
301
- }
302
-
303
- .wpmtst .form-table.compact input.error {
304
- border-color: red;
305
- border-radius: 2px;
306
- box-shadow: none;
307
- }
308
-
309
- .wpmtst .form-table.compact label.error {
310
- color: red;
311
- display: block;
312
- }
313
-
314
- /* end: form-table */
315
-
316
- .code {
317
- background: #FFF;
318
- }
319
-
320
- .code.wide {
321
- padding: 2px 5px;
322
- margin: 3px;
323
- border-radius: 2px;
324
- }
325
-
326
- .submit-buttons input.button {
327
- margin-right: 10px;
328
- }
329
-
330
- .custom-input {
331
- line-height: 1.3em;
332
- }
333
-
334
- .indent {
335
- margin-left: 2em;
336
- }
337
-
338
- .outdent {
339
- margin-left: -2em;
340
- }
341
-
342
- .hilite {
343
- background: lightyellow;
344
- border-radius: 4px;
345
- display: inline-block;
346
- padding: .25em .75em;
347
- -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
348
- -moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
349
- box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
350
- }
351
-
352
- p.description.hilite {
353
- margin-bottom: 2em;
354
- }
355
-
356
- ul.compact {
357
- margin: 0;
358
- }
359
-
360
- ul.compact li {
361
- display: inline-block;
362
- margin: 6px 30px 6px 0;
363
- }
364
-
365
- /* Add-on license table
366
- ------------------------------------------------*/
367
-
368
- #licenses-form .form-table {
369
- width: auto;
370
- max-width: 1024px;
371
- }
372
-
373
- #licenses-form .form-table label {
374
- /* to match text inputs */
375
- line-height: 27px;
376
- }
377
-
378
- #licenses-form .form-table th,
379
- #licenses-form .form-table td {
380
- vertical-align: top;
381
- }
382
-
383
- #licenses-form th.for-license-key,
384
- #licenses-form th.for-license-status {
385
- width: 350px;
386
- }
387
-
388
- #licenses-form .form-table th {
389
- padding: 15px;
390
- }
391
-
392
- #licenses-form .form-table td {
393
- white-space: nowrap;
394
- padding: 15px;
395
- }
396
-
397
- #licenses-form .form-table th:first-child,
398
- #licenses-form .form-table td:first-child {
399
- padding-left: 0;
400
- }
401
-
402
- #licenses-form .form-table input[type="text"] {
403
- font-family: Consolas, Monaco, monospace;
404
- width: 100%;
405
- }
406
-
407
- #licenses-form .form-table label {
408
- padding-left: 0;
409
- text-indent: 0;
410
- }
411
-
412
- #licenses-form .doing-ajax:before {
413
- display: inline-block;
414
- font: normal 22px/29px dashicons;
415
- content: "\f463";
416
- text-align: center;
417
- vertical-align: middle;
418
-
419
- -webkit-animation-name: rotate;
420
- -webkit-animation-duration: 1.5s;
421
- -webkit-animation-iteration-count: infinite;
422
- -webkit-animation-timing-function: linear;
423
- -moz-animation-name: rotate;
424
- -moz-animation-duration: 1.5s;
425
- -moz-animation-iteration-count: infinite;
426
- -moz-animation-timing-function: linear;
427
- animation-name: rotate;
428
- animation-duration: 1.5s;
429
- animation-iteration-count: infinite;
430
- animation-timing-function: linear;
431
- }
432
-
433
- #licenses-form span.license-status {
434
- display: inline-block;
435
- font-size: 0.9em;
436
- line-height: 28px;
437
- height: 27px;
438
- margin: 1px 10px 1px 0;
439
- padding: 0 8px;
440
- text-transform: uppercase;
441
- border-radius: 3px;
442
- vertical-align: middle;
443
- }
444
-
445
- #licenses-form span.active {
446
- background: green;
447
- color: #FFF;
448
- }
449
-
450
- #licenses-form span.inactive {
451
- background: #999;
452
- color: #FFF;
453
- }
454
-
455
- #licenses-form span.ib {
456
- display: inline-block;
457
- vertical-align: middle;
458
- }
459
-
460
- .activation-error {
461
- color: red;
462
- }
463
-
464
- /* Descriptions
465
- ------------------------------------------------*/
466
-
467
- .form-table th .description,
468
- .form-table td .description {
469
- font-size: 14px;
470
- font-style: italic;
471
- /*text-indent: 24px;*/
472
- }
473
-
474
- .description.inline {
475
- display: inline-block;
476
- margin-left: 1em;
477
- }
478
-
479
- .description a {
480
- text-decoration: underline;
481
- }
482
-
483
- .description a:hover {
484
- text-decoration: none;
485
- }
486
-
487
- .radio .description {
488
- padding-left: 20px;
489
- }
490
-
491
- li.checkbox {
492
- margin-bottom: 10px;
493
- }
494
-
495
- .checkbox .description {
496
- padding-left: 24px;
497
- }
498
-
499
- ul.description {
500
- font-style: italic;
501
- color: #666;
502
- margin-top: 4px;
503
- list-style-type: disc;
504
- margin-left: 21px;
505
- margin-bottom: 0;
506
- }
507
-
508
- /* Widget
509
- ------------------------------------------------*/
510
- .wpmtst-widget-form {
511
- margin-bottom: 1em;
512
- }
513
-
514
- .widget-inside p {
515
- margin: .5em 0;
516
- }
517
-
518
- input[disabled],
519
- input[readonly] {
520
- color: #999;
521
- background: rgba(0, 0, 0, 0.04);
522
- }
523
-
524
- /* Categories admin list
525
- ------------------------------------------------*/
526
- .widefat th.column-ID {
527
- width: 2.2em;
528
- }
529
-
530
- /* Post list table
531
- ------------------------------------------------*/
532
- td.column-shortcode,
533
- td.column-id {
534
- white-space: nowrap;
535
- font-family: Consolas, Monaco, monospace;
536
- }
537
-
538
- th.sortable.column-id a span {
539
- float: right;
540
- }
541
-
542
- td.column-id {
543
- text-align: right;
544
- }
545
-
546
- /* Star rating in list table
547
- --------------------------------------------------*/
548
- .column-rating {
549
- width: auto !important;
550
- }
551
-
552
- /* Views list table
553
- --------------------------------------------------*/
554
- .wp-list-table.fixed.wpm-testimonial_page_testimonial-views {
555
- table-layout: auto;
556
- }
557
-
558
- .wpmtst2 > h1 {
559
- margin-bottom: 15px;
560
- }
561
-
562
- /* WordPress fixes
563
- --------------------------------------------------*/
564
-
565
- /* settings page */
566
- @media screen and (max-width: 782px) {
567
- .wpm-testimonial_page_testimonial-settings .form-table td input[type="text"] {
568
- display: inline-block;
569
- width: auto;
570
- }
571
- }
572
-
573
- /* Animation
574
- --------------------------------------------------*/
575
-
576
- @-webkit-keyframes rotate {
577
- from {
578
- -webkit-transform: rotate(0deg);
579
- }
580
- to {
581
- -webkit-transform: rotate(360deg);
582
- }
583
- }
584
-
585
- @-moz-keyframes rotate {
586
- from {
587
- -moz-transform: rotate(0deg);
588
- }
589
- to {
590
- -moz-transform: rotate(360deg);
591
- }
592
- }
593
-
594
- @keyframes rotate {
595
- from {
596
- transform: rotate(0deg);
597
- }
598
- to {
599
- transform: rotate(360deg);
600
- }
601
- }
602
-
603
- /* Admin > Shortcode example table
604
- --------------------------------------------------*/
605
- .form-table.shortcodes tbody tr:hover {
606
- background: #FFF;
607
- }
608
-
609
- .form-table.shortcodes th {
610
- padding-left: 10px;
611
- width: auto;
612
- }
613
-
614
- .form-table.shortcodes td {
615
- border: 1px solid #DDD;
616
- }
617
-
618
- .form-table.shortcodes td.shortcode {
619
- font-family: Consolas, Monaco, monospace;
620
- }
621
-
622
- .form-table.shortcodes td p {
623
- margin: 1em 0;
624
- }
625
-
626
- .form-table.shortcodes td p:first-child {
627
- margin-top: 0;
628
- }
629
-
630
- .form-table.shortcodes td p:last-child {
631
- margin-bottom: 0;
632
- }
633
-
634
- /* special */
635
-
636
- .form-table.shortcodes tr.important {
637
- background: #FFF;
638
- }
639
-
640
- .form-table.shortcodes tr.important td {
641
- border: 1px solid #CCC;
642
- }
643
-
644
- /* Misc
645
- --------------------------------------------------*/
646
- .slug-example {
647
- font-weight: bold;
648
- color: #0073aa;
649
- }
650
-
651
- .form-table.width-auto {
652
- width: auto;
653
- }
654
-
655
- .form-table td p:first-child {
656
- margin-top: 6px;
657
- }
658
-
659
- .current-dashicon {
660
- display: inline-block;
661
- background: #0073aa;
662
- color: #FFF;
663
- border-radius: 2px;
664
- text-align: center;
665
- vertical-align: middle;
666
- width: 28px;
667
- height: 28px;
668
- position: relative;
669
- top: -3px;
670
- }
671
-
672
- .current-dashicon .dashicons {
673
- vertical-align: middle;
674
- line-height: 1.3;
675
- }
676
-
677
- /*
678
- Back these out to have normal "reset" buttons
679
- */
680
-
681
- /* wp-includes/css/buttons.css:109 */
682
- /*
683
- .wp-core-ui input[type="reset"],
684
- .wp-core-ui input[type="reset"]:hover,
685
- .wp-core-ui input[type="reset"]:active,
686
- .wp-core-ui input[type="reset"]:focus {
687
- background: none;
688
- border: none;
689
- -webkit-box-shadow: none;
690
- box-shadow: none;
691
- padding: 0 2px 1px;
692
- width: auto;
693
- }
694
- */
695
- .wp-core-ui input[type="reset"],
696
- .wp-core-ui input[type="reset"]:hover,
697
- .wp-core-ui input[type="reset"]:active,
698
- .wp-core-ui input[type="reset"]:focus {
699
- background: #F7F7F7;
700
- border: 1px solid #CCC;
701
- -webkit-box-shadow: 0 1px 0 #CCC;
702
- box-shadow: 0 1px 0 #CCC;
703
- padding: 0 10px 1px;
704
- width: auto;
705
- }
706
-
707
- /* wp-admin/css/forms.css:102 */
708
- /*
709
- .wp-core-ui input[type="reset"]:hover,
710
- .wp-core-ui input[type="reset"]:active {
711
- color: #00a0d2;
712
- }
713
- */
714
- /* Based on section 2.0 in wp-includes/css/buttons.css:125 */
715
- .wp-core-ui input[type="reset"]:hover,
716
- .wp-core-ui input[type="reset"]:focus {
717
- background: #fafafa;
718
- border-color: #999;
719
- color: #23282d;
720
- }
721
-
722
- .wp-core-ui input[type="reset"]:focus {
723
- border-color: #5b9dd9;
724
- -webkit-box-shadow: 0 0 3px rgba(0, 115, 170, .8);
725
- box-shadow: 0 0 3px rgba(0, 115, 170, .8);
726
- }
727
-
728
- .wp-core-ui input[type="reset"]:active {
729
- background: #eee;
730
- border-color: #999;
731
- -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
732
- box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
733
- -webkit-transform: translateY(1px);
734
- -ms-transform: translateY(1px);
735
- transform: translateY(1px);
736
- }
737
-
738
- input.button.restore-default {
739
- font: normal 20px/1 dashicons;
740
- padding: 1px 3px;
741
- }
742
-
743
- .wpmtst .subsubsub {
744
- float: none;
745
- margin-left: 16px;
746
- }
747
-
748
- .regular-text.half {
749
- width: 12.5em;
750
- }
751
-
752
- .regular-text.third {
753
- width: 20em;
754
- }
755
-
756
- input.code {
757
- font-size: 13px;
758
- font-family: Consolas, Monaco, monospace;
759
- }
760
-
761
- .wrap h2.nav-tab-wrapper {
762
- margin-top: 6px;
763
- }
764
-
765
- .tab-header {
766
- padding: 1em 0;
767
- }
768
-
769
- .striped > tbody > tr.readonly {
770
- background: lightyellow;
771
- }
772
-
773
- ul.standard {
774
- list-style: disc;
775
- padding-left: 1.5em;
776
- }
777
-
778
- .form-table p.error {
779
- margin: 0.5em 0;
780
- }
781
-
782
- /* shortcodes page */
783
- .wpmtst.shortcode {
784
- vertical-align: middle;
785
- }
786
- .wpmtst.shortcodes.has-stars table {
787
- margin-bottom: 1em;
788
- }
789
- .wpmtst.shortcodes.has-stars td:nth-child(2) {
790
- width: 70%;
791
- /*white-space: nowrap;*/
792
- }
793
- .wpmtst.shortcodes td {
794
- padding: 10px;
795
- }
796
- .wpmtst.shortcodes tr.important td {
797
- border: 1px solid #DDD;
798
- }
799
- .wpmtst.shortcodes tr:hover {
800
- background: #FFF;
801
- }
802
-
803
- /* inner table */
804
- .wpmtst.shortcodes td.has-inner {
805
- padding: 0;
806
- }
807
- .wpmtst.shortcodes table.inner {
808
- margin: 0;
809
- vertical-align: middle;
810
- width: 100%;
811
- }
812
- .wpmtst.shortcodes table.inner,
813
- .wpmtst.shortcodes table.inner tr,
814
- .wpmtst.shortcodes table.inner td {
815
- border: 0;
816
- }
817
- .wpmtst.shortcodes table.inner tr:first-child td {
818
- border-bottom: 1px solid #DDD;
819
- }
820
-
821
- .wp-list-table .type-wpm-testimonial .row-actions span.id span {
822
- color: #777;
823
  }
1
+ /**
2
+ * Strong Testimonials admin stylesheet
3
+ */
4
+
5
+ .icon-blue {
6
+ color: #0073aa;
7
+ }
8
+
9
+ .error {
10
+ color: red !important;
11
+ }
12
+
13
+ .required-phrase {
14
+ color: red;
15
+ font-style: normal;
16
+ font-weight: 400;
17
+ font-size: 0.9em;
18
+ }
19
+
20
+ .required-phrase:before,
21
+ label.required:after {
22
+ content: '*';
23
+ display: inline-block;
24
+ color: red;
25
+ font-size: 27px;
26
+ line-height: 19px;
27
+ height: 19px;
28
+ font-weight: 600;
29
+ vertical-align: middle;
30
+ position: relative;
31
+ top: 1px;
32
+ }
33
+
34
+ .has-input {
35
+ display: inline-block;
36
+ }
37
+
38
+ .error-message {
39
+ display: inline-block;
40
+ margin-left: 0.5em;
41
+ }
42
+
43
+ button.nogo {
44
+ margin: 0 3px;
45
+ }
46
+
47
+ li.warning {
48
+ background: lightyellow;
49
+ }
50
+
51
+ .between-inputs {
52
+ margin-left: 0.3em;
53
+ margin-right: 0.3em;
54
+ }
55
+
56
+ .intro p {
57
+ font-size: 14px;
58
+ }
59
+
60
+ .wrap.wpmtst h2 {
61
+ margin: 2em 0 1em;
62
+ }
63
+
64
+ .wrap.wpmtst p {
65
+ font-size: 14px;
66
+ }
67
+
68
+ .wrap.wpmtst .notice p {
69
+ font-size: 13px;
70
+ }
71
+
72
+ .wpmtst .list-wrap {
73
+ padding: .5em;
74
+ }
75
+
76
+ .wp-core-ui .button-primary.active,
77
+ .wp-core-ui .button-primary.active:hover,
78
+ .wp-core-ui .button-primary.active:focus,
79
+ .wp-core-ui .button-primary:active {
80
+ vertical-align: baseline;
81
+ }
82
+
83
+ /* Firefox fix */
84
+ a.widget-action:focus {
85
+ outline: none;
86
+ }
87
+
88
+ /* Slug field */
89
+ input#post_name {
90
+ width: 98%;
91
+ }
92
+
93
+ fieldset > div {
94
+ min-height: 30px;
95
+ }
96
+
97
+ /* Help sections
98
+ ---------------------------------------------------------*/
99
+
100
+ div.help {
101
+ margin-left: 0;
102
+ }
103
+
104
+ div.help.minor {
105
+ font-size: 0.9em;
106
+ text-align: left;
107
+ }
108
+
109
+ /* Settings table
110
+ ---------------------------------------------------------*/
111
+
112
+ .wpmtst i.fa.example {
113
+ color: #0073aa;
114
+ }
115
+
116
+ .stackem ul {
117
+ margin: 14px 0 0 0;
118
+ }
119
+
120
+ .stackem li {
121
+ margin-top: 16px;
122
+ margin-bottom: 16px;
123
+ }
124
+
125
+ .stackem label {
126
+ display: inline-block;
127
+ line-height: 28px;
128
+ margin-right: 0.5em;
129
+ vertical-align: baseline;
130
+ }
131
+
132
+ .stackem label.inline {
133
+ display: inline-block;
134
+ }
135
+
136
+ .stackem p.description {
137
+ margin-top: 0;
138
+ margin-left: 22px;
139
+ }
140
+
141
+ .stackem p.description.warning {
142
+ color: #CD0000;
143
+ }
144
+
145
+ .stackem .notice {
146
+ background: none;
147
+ border: none;
148
+ box-shadow: none;
149
+ display: inline-block;
150
+ font-size: .9em;
151
+ font-style: italic;
152
+ margin: 0 .2em;
153
+ padding: 0;
154
+ color: #868686;
155
+ }
156
+
157
+ .stackem span.link {
158
+ display: inline-block;
159
+ margin: 0 .3em;
160
+ font-size: .9em;
161
+ line-height: 28px;
162
+ }
163
+
164
+ .stackem label.disabled {
165
+ color: #888;
166
+ }
167
+
168
+ div.radio {
169
+ line-height: 1.5em;
170
+ }
171
+
172
+ div.radio:hover {
173
+ color: #000;
174
+ }
175
+
176
+ #screenshot-screen-options,
177
+ #help-section {
178
+ display: none;
179
+ }
180
+
181
+ .screenshot > div {
182
+ display: inline-block;
183
+ -webkit-box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
184
+ -moz-box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
185
+ box-shadow: inset 0px 0px 40px rgba(0, 0, 0, 0.8);
186
+ }
187
+
188
+ .help-text {
189
+ padding: 0.5em 0;
190
+ }
191
+
192
+ /* form table */
193
+
194
+ .wpmtst .form-table {
195
+ vertical-align: middle;
196
+ }
197
+
198
+ .wpmtst .form-table .actions {
199
+ /*vertical-align: top;*/
200
+ }
201
+
202
+ .wpmtst .form-table td {
203
+ padding-top: 15px; /* override PopupMaker's override */
204
+ }
205
+
206
+ .wpmtst .form-table td:nth-child(1) {
207
+ width: 200px;
208
+ }
209
+
210
+ .wpmtst .form-table .parent {
211
+ border-bottom: 0;
212
+ vertical-align: top;
213
+ }
214
+
215
+ .wpmtst .form-table th.parent + td {
216
+ }
217
+
218
+ .wpmtst .form-table .child {
219
+ border-top: 0;
220
+ }
221
+
222
+ .wpmtst .form-table p {
223
+ /*margin-bottom: 1em;*/
224
+ }
225
+
226
+ .wpmtst .form-table td p:last-child {
227
+ margin-bottom: 0;
228
+ }
229
+
230
+ .wpmtst .form-table input,
231
+ .wpmtst .form-table select,
232
+ .wpmtst .form-table textarea {
233
+ /*line-height: 1.5em;*/
234
+ }
235
+
236
+ .wpmtst .form-table input[type="button"] {
237
+ line-height: 26px;
238
+ height: 28px;
239
+ }
240
+
241
+ .wpmtst select {
242
+ min-width: 120px;
243
+ }
244
+
245
+ .wpmtst option {
246
+ padding-left: 5px;
247
+ }
248
+
249
+ .wpmtst .form-table div.box {
250
+ border: 1px solid #DDD;
251
+ display: inline-block;
252
+ padding: 10px;
253
+ }
254
+
255
+ .wpmtst .form-table .row {
256
+ line-height: 2.5em;
257
+ }
258
+
259
+ .wpmtst .form-table .alpha {
260
+ width: 120px;
261
+ }
262
+
263
+ .wpmtst .form-table .alpha.alpha-110 {
264
+ width: 110px;
265
+ }
266
+
267
+ .wpmtst .form-table .alpha + div {
268
+ display: inline-block;
269
+ }
270
+
271
+ .wpmtst label.success-action {
272
+ display: inline-block;
273
+ width: 11em;
274
+ padding: 10px 0;
275
+ }
276
+
277
+ /* compact */
278
+
279
+ .wpmtst .form-table.compact th {
280
+ vertical-align: top;
281
+ }
282
+
283
+ .wpmtst .form-table.compact td {
284
+ vertical-align: middle;
285
+ }
286
+
287
+ /*.wpmtst .form-table.compact td:nth-child(3) {*/
288
+ .wpmtst .form-table.compact td.actions {
289
+ width: 100px;
290
+ vertical-align: bottom;
291
+ }
292
+
293
+ /*.wpmtst .form-table.compact td:nth-child(3) input.button {*/
294
+ .wpmtst .form-table.compact td.actions input.button {
295
+ margin-right: 0;
296
+ margin-bottom: 3px;
297
+ }
298
+
299
+ .wpmtst .form-table.compact input[type="text"] {
300
+ width: 100%;
301
+ }
302
+
303
+ .wpmtst .form-table.compact input.error {
304
+ border-color: red;
305
+ border-radius: 2px;
306
+ box-shadow: none;
307
+ }
308
+
309
+ .wpmtst .form-table.compact label.error {
310
+ color: red;
311
+ display: block;
312
+ }
313
+
314
+ /* end: form-table */
315
+
316
+ .code {
317
+ background: #FFF;
318
+ }
319
+
320
+ .code.wide {
321
+ padding: 2px 5px;
322
+ margin: 3px;
323
+ border-radius: 2px;
324
+ }
325
+
326
+ .submit-buttons input.button {
327
+ margin-right: 10px;
328
+ }
329
+
330
+ .custom-input {
331
+ line-height: 1.3em;
332
+ }
333
+
334
+ .indent {
335
+ margin-left: 2em;
336
+ }
337
+
338
+ .outdent {
339
+ margin-left: -2em;
340
+ }
341
+
342
+ .hilite {
343
+ background: lightyellow;
344
+ border-radius: 4px;
345
+ display: inline-block;
346
+ padding: .25em .75em;
347
+ -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
348
+ -moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
349
+ box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
350
+ }
351
+
352
+ p.description.hilite {
353
+ margin-bottom: 2em;
354
+ }
355
+
356
+ ul.compact {
357
+ margin: 0;
358
+ }
359
+
360
+ ul.compact li {
361
+ display: inline-block;
362
+ margin: 6px 30px 6px 0;
363
+ }
364
+
365
+ /* Add-on license table
366
+ ------------------------------------------------*/
367
+
368
+ #licenses-form .form-table {
369
+ width: auto;
370
+ max-width: 1024px;
371
+ }
372
+
373
+ #licenses-form .form-table label {
374
+ /* to match text inputs */
375
+ line-height: 27px;
376
+ }
377
+
378
+ #licenses-form .form-table th,
379
+ #licenses-form .form-table td {
380
+ vertical-align: top;
381
+ }
382
+
383
+ #licenses-form th.for-license-key,
384
+ #licenses-form th.for-license-status {
385
+ width: 350px;
386
+ }
387
+
388
+ #licenses-form .form-table th {
389
+ padding: 15px;
390
+ }
391
+
392
+ #licenses-form .form-table td {
393
+ white-space: nowrap;
394
+ padding: 15px;
395
+ }
396
+
397
+ #licenses-form .form-table th:first-child,
398
+ #licenses-form .form-table td:first-child {
399
+ padding-left: 0;
400
+ }
401
+
402
+ #licenses-form .form-table input[type="text"] {
403
+ font-family: Consolas, Monaco, monospace;
404
+ width: 100%;
405
+ }
406
+
407
+ #licenses-form .form-table label {
408
+ padding-left: 0;
409
+ text-indent: 0;
410
+ }
411
+
412
+ #licenses-form .doing-ajax:before {
413
+ display: inline-block;
414
+ font: normal 22px/29px dashicons;
415
+ content: "\f463";
416
+ text-align: center;
417
+ vertical-align: middle;
418
+
419
+ -webkit-animation-name: rotate;
420
+ -webkit-animation-duration: 1.5s;
421
+ -webkit-animation-iteration-count: infinite;
422
+ -webkit-animation-timing-function: linear;
423
+ -moz-animation-name: rotate;
424
+ -moz-animation-duration: 1.5s;
425
+ -moz-animation-iteration-count: infinite;
426
+ -moz-animation-timing-function: linear;
427
+ animation-name: rotate;
428
+ animation-duration: 1.5s;
429
+ animation-iteration-count: infinite;
430
+ animation-timing-function: linear;
431
+ }
432
+
433
+ #licenses-form span.license-status {
434
+ display: inline-block;
435
+ font-size: 0.9em;
436
+ line-height: 28px;
437
+ height: 27px;
438
+ margin: 1px 10px 1px 0;
439
+ padding: 0 8px;
440
+ text-transform: uppercase;
441
+ border-radius: 3px;
442
+ vertical-align: middle;
443
+ }
444
+
445
+ #licenses-form span.active {
446
+ background: green;
447
+ color: #FFF;
448
+ }
449
+
450
+ #licenses-form span.inactive {
451
+ background: #999;
452
+ color: #FFF;
453
+ }
454
+
455
+ #licenses-form span.ib {
456
+ display: inline-block;
457
+ vertical-align: middle;
458
+ }
459
+
460
+ .activation-error {
461
+ color: red;
462
+ }
463
+
464
+ /* Descriptions
465
+ ------------------------------------------------*/
466
+
467
+ .form-table th .description,
468
+ .form-table td .description {
469
+ font-size: 14px;
470
+ font-style: italic;
471
+ /*text-indent: 24px;*/
472
+ }
473
+
474
+ .description.inline {
475
+ display: inline-block;
476
+ margin-left: 1em;
477
+ }
478
+
479
+ .description a {
480
+ text-decoration: underline;
481
+ }
482
+
483
+ .description a:hover {
484
+ text-decoration: none;
485
+ }
486
+
487
+ .radio .description {
488
+ padding-left: 20px;
489
+ }
490
+
491
+ li.checkbox {
492
+ margin-bottom: 10px;
493
+ }
494
+
495
+ .checkbox .description {
496
+ padding-left: 24px;
497
+ }
498
+
499
+ ul.description {
500
+ font-style: italic;
501
+ color: #666;
502
+ margin-top: 4px;
503
+ list-style-type: disc;
504
+ margin-left: 21px;
505
+ margin-bottom: 0;
506
+ }
507
+
508
+ /* Widget
509
+ ------------------------------------------------*/
510
+ .wpmtst-widget-form {
511
+ margin-bottom: 1em;
512
+ }
513
+
514
+ .widget-inside p {
515
+ margin: .5em 0;
516
+ }
517
+
518
+ input[disabled],
519
+ input[readonly] {
520
+ color: #999;
521
+ background: rgba(0, 0, 0, 0.04);
522
+ }
523
+
524
+ /* Categories admin list
525
+ ------------------------------------------------*/
526
+ .widefat th.column-ID {
527
+ width: 2.2em;
528
+ }
529
+
530
+ /* Post list table
531
+ ------------------------------------------------*/
532
+ td.column-shortcode,
533
+ td.column-id {
534
+ white-space: nowrap;
535
+ font-family: Consolas, Monaco, monospace;
536
+ }
537
+
538
+ th.sortable.column-id a span {
539
+ float: right;
540
+ }
541
+
542
+ td.column-id {
543
+ text-align: right;
544
+ }
545
+
546
+ /* Star rating in list table
547
+ --------------------------------------------------*/
548
+ .column-rating {
549
+ width: auto !important;
550
+ }
551
+
552
+ /* Views list table
553
+ --------------------------------------------------*/
554
+ .wp-list-table.fixed.wpm-testimonial_page_testimonial-views {
555
+ table-layout: auto;
556
+ }
557
+
558
+ .wpmtst2 > h1 {
559
+ margin-bottom: 15px;
560
+ }
561
+
562
+ /* WordPress fixes
563
+ --------------------------------------------------*/
564
+
565
+ /* settings page */
566
+ @media screen and (max-width: 782px) {
567
+ .wpm-testimonial_page_testimonial-settings .form-table td input[type="text"] {
568
+ display: inline-block;
569
+ width: auto;
570
+ }
571
+ }
572
+
573
+ /* Animation
574
+ --------------------------------------------------*/
575
+
576
+ @-webkit-keyframes rotate {
577
+ from {
578
+ -webkit-transform: rotate(0deg);
579
+ }
580
+ to {
581
+ -webkit-transform: rotate(360deg);
582
+ }
583
+ }
584
+
585
+ @-moz-keyframes rotate {
586
+ from {
587
+ -moz-transform: rotate(0deg);
588
+ }
589
+ to {
590
+ -moz-transform: rotate(360deg);
591
+ }
592
+ }
593
+
594
+ @keyframes rotate {
595
+ from {
596
+ transform: rotate(0deg);
597
+ }
598
+ to {
599
+ transform: rotate(360deg);
600
+ }
601
+ }
602
+
603
+ /* Admin > Shortcode example table
604
+ --------------------------------------------------*/
605
+ .form-table.shortcodes tbody tr:hover {
606
+ background: #FFF;
607
+ }
608
+
609
+ .form-table.shortcodes th {
610
+ padding-left: 10px;
611
+ width: auto;
612
+ }
613
+
614
+ .form-table.shortcodes td {
615
+ border: 1px solid #DDD;
616
+ }
617
+
618
+ .form-table.shortcodes td.shortcode {
619
+ font-family: Consolas, Monaco, monospace;
620
+ }
621
+
622
+ .form-table.shortcodes td p {
623
+ margin: 1em 0;
624
+ }
625
+
626
+ .form-table.shortcodes td p:first-child {
627
+ margin-top: 0;
628
+ }
629
+
630
+ .form-table.shortcodes td p:last-child {
631
+ margin-bottom: 0;
632
+ }
633
+
634
+ /* special */
635
+
636
+ .form-table.shortcodes tr.important {
637
+ background: #FFF;
638
+ }
639
+
640
+ .form-table.shortcodes tr.important td {
641
+ border: 1px solid #CCC;
642
+ }
643
+
644
+ /* Misc
645
+ --------------------------------------------------*/
646
+ .slug-example {
647
+ font-weight: bold;
648
+ color: #0073aa;
649
+ }
650
+
651
+ .form-table.width-auto {
652
+ width: auto;
653
+ }
654
+
655
+ .form-table td p:first-child {
656
+ margin-top: 6px;
657
+ }
658
+
659
+ .current-dashicon {
660
+ display: inline-block;
661
+ background: #0073aa;
662
+ color: #FFF;
663
+ border-radius: 2px;
664
+ text-align: center;
665
+ vertical-align: middle;
666
+ width: 28px;
667
+ height: 28px;
668
+ position: relative;
669
+ top: -3px;
670
+ }
671
+
672
+ .current-dashicon .dashicons {
673
+ vertical-align: middle;
674
+ line-height: 1.3;
675
+ }
676
+
677
+ /*
678
+ Back these out to have normal "reset" buttons
679
+ */
680
+
681
+ /* wp-includes/css/buttons.css:109 */
682
+ /*
683
+ .wp-core-ui input[type="reset"],
684
+ .wp-core-ui input[type="reset"]:hover,
685
+ .wp-core-ui input[type="reset"]:active,
686
+ .wp-core-ui input[type="reset"]:focus {
687
+ background: none;
688
+ border: none;
689
+ -webkit-box-shadow: none;
690
+ box-shadow: none;
691
+ padding: 0 2px 1px;
692
+ width: auto;
693
+ }
694
+ */
695
+ .wp-core-ui input[type="reset"],
696
+ .wp-core-ui input[type="reset"]:hover,
697
+ .wp-core-ui input[type="reset"]:active,
698
+ .wp-core-ui input[type="reset"]:focus {
699
+ background: #F7F7F7;
700
+ border: 1px solid #CCC;
701
+ -webkit-box-shadow: 0 1px 0 #CCC;
702
+ box-shadow: 0 1px 0 #CCC;
703
+ padding: 0 10px 1px;
704
+ width: auto;
705
+ }
706
+
707
+ /* wp-admin/css/forms.css:102 */
708
+ /*
709
+ .wp-core-ui input[type="reset"]:hover,
710
+ .wp-core-ui input[type="reset"]:active {
711
+ color: #00a0d2;
712
+ }
713
+ */
714
+ /* Based on section 2.0 in wp-includes/css/buttons.css:125 */
715
+ .wp-core-ui input[type="reset"]:hover,
716
+ .wp-core-ui input[type="reset"]:focus {
717
+ background: #fafafa;
718
+ border-color: #999;
719
+ color: #23282d;
720
+ }
721
+
722
+ .wp-core-ui input[type="reset"]:focus {
723
+ border-color: #5b9dd9;
724
+ -webkit-box-shadow: 0 0 3px rgba(0, 115, 170, .8);
725
+ box-shadow: 0 0 3px rgba(0, 115, 170, .8);
726
+ }
727
+
728
+ .wp-core-ui input[type="reset"]:active {
729
+ background: #eee;
730
+ border-color: #999;
731
+ -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
732
+ box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
733
+ -webkit-transform: translateY(1px);
734
+ -ms-transform: translateY(1px);
735
+ transform: translateY(1px);
736
+ }
737
+
738
+ input.button.restore-default {
739
+ font: normal 20px/1 dashicons;
740
+ padding: 1px 3px;
741
+ }
742
+
743
+ .wpmtst .subsubsub {
744
+ float: none;
745
+ margin-left: 16px;
746
+ }
747
+
748
+ .regular-text.half {
749
+ width: 12.5em;
750
+ }
751
+
752
+ .regular-text.third {
753
+ width: 20em;
754
+ }
755
+
756
+ input.code {
757
+ font-size: 13px;
758
+ font-family: Consolas, Monaco, monospace;
759
+ }
760
+
761
+ .wrap h2.nav-tab-wrapper {
762
+ margin-top: 6px;
763
+ }
764
+
765
+ .tab-header {
766
+ padding: 1em 0;
767
+ }
768
+
769
+ .striped > tbody > tr.readonly {
770
+ background: lightyellow;
771
+ }
772
+
773
+ ul.standard {
774
+ list-style: disc;
775
+ padding-left: 1.5em;
776
+ }
777
+
778
+ .form-table p.error {
779
+ margin: 0.5em 0;
780
+ }
781
+
782
+ /* shortcodes page */
783
+ .wpmtst.shortcode {
784
+ vertical-align: middle;
785
+ }
786
+ .wpmtst.shortcodes.has-stars table {
787
+ margin-bottom: 1em;
788
+ }
789
+ .wpmtst.shortcodes.has-stars td:nth-child(2) {
790
+ width: 70%;
791
+ /*white-space: nowrap;*/
792
+ }
793
+ .wpmtst.shortcodes td {
794
+ padding: 10px;
795
+ }
796
+ .wpmtst.shortcodes tr.important td {
797
+ border: 1px solid #DDD;
798
+ }
799
+ .wpmtst.shortcodes tr:hover {
800
+ background: #FFF;
801
+ }
802
+
803
+ /* inner table */
804
+ .wpmtst.shortcodes td.has-inner {
805
+ padding: 0;
806
+ }
807
+ .wpmtst.shortcodes table.inner {
808
+ margin: 0;
809
+ vertical-align: middle;
810
+ width: 100%;
811
+ }
812
+ .wpmtst.shortcodes table.inner,
813
+ .wpmtst.shortcodes table.inner tr,
814
+ .wpmtst.shortcodes table.inner td {
815
+ border: 0;
816
+ }
817
+ .wpmtst.shortcodes table.inner tr:first-child td {
818
+ border-bottom: 1px solid #DDD;
819
+ }
820
+
821
+ .wp-list-table .type-wpm-testimonial .row-actions span.id span {
822
+ color: #777;
823
  }
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,110 +1,110 @@
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
- width: 100%;
28
- }
29
-
30
- div.checkbox {
31
- height: 28px;
32
- padding: 3px 0 5px;
33
- }
34
-
35
- div.checkbox input[type="checkbox"] {
36
- margin: 1px;
37
- padding: 3px 5px;
38
- }
39
-
40
- .input-url,
41
- .input-nofollow {
42
- display: inline-block;
43
- }
44
-
45
- .input-url {
46
- width: calc(100% - 210px);
47
- }
48
-
49
- .input-nofollow {
50
- float: right;
51
- }
52
-
53
- label.nowrap {
54
- word-break: keep-all;
55
- white-space: nowrap;
56
- }
57
-
58
- label.nowrap code {
59
- position: relative;
60
- top: -2px;
61
- }
62
-
63
- /* Post Publish Meta Box
64
- --------------------------------------*/
65
- .wpmtst-pub-section {
66
- padding: 6px 10px 8px;
67
- }
68
-
69
- #submit-timestamp {
70
- padding: 2px 0 1px 0;
71
- }
72
-
73
- #submit-timestamp:before {
74
- content: "\f175";
75
- top: -1px;
76
- color: #82878c;
77
- font: normal 20px/1 dashicons;
78
- display: inline-block;
79
- padding: 0 2px 0 0;
80
- left: -1px;
81
- position: relative;
82
- vertical-align: top;
83
- }
84
-
85
- /* Star rating in post editor
86
- --------------------------------------------------*/
87
- .edit-rating-box {
88
- height: 27px;
89
- line-height: 27px;
90
- }
91
-
92
- .wp-core-ui .edit-rating-box button {
93
- margin-left: 0;
94
- }
95
-
96
- .edit-rating-box .cancel,
97
- .edit-rating-box .zero {
98
- padding: 0;
99
- text-decoration: underline;
100
- color: #0073aa;
101
- }
102
-
103
- .rating .inner,
104
- .edit-rating-buttons-1,
105
- .edit-rating-buttons-2,
106
- .edit-rating-success {
107
- display: inline-block;
108
- margin-left: 5px;
109
- vertical-align: middle;
110
- }
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
+ width: 100%;
28
+ }
29
+
30
+ div.checkbox {
31
+ height: 28px;
32
+ padding: 3px 0 5px;
33
+ }
34
+
35
+ div.checkbox input[type="checkbox"] {
36
+ margin: 1px;
37
+ padding: 3px 5px;
38
+ }
39
+
40
+ .input-url,
41
+ .input-nofollow {
42
+ display: inline-block;
43
+ }
44
+
45
+ .input-url {
46
+ width: calc(100% - 210px);
47
+ }
48
+
49
+ .input-nofollow {
50
+ float: right;
51
+ }
52
+
53
+ label.nowrap {
54
+ word-break: keep-all;
55
+ white-space: nowrap;
56
+ }
57
+
58
+ label.nowrap code {
59
+ position: relative;
60
+ top: -2px;
61
+ }
62
+
63
+ /* Post Publish Meta Box
64
+ --------------------------------------*/
65
+ .wpmtst-pub-section {
66
+ padding: 6px 10px 8px;
67
+ }
68
+
69
+ #submit-timestamp {
70
+ padding: 2px 0 1px 0;
71
+ }
72
+
73
+ #submit-timestamp:before {
74
+ content: "\f175";
75
+ top: -1px;
76
+ color: #82878c;
77
+ font: normal 20px/1 dashicons;
78
+ display: inline-block;
79
+ padding: 0 2px 0 0;
80
+ left: -1px;
81
+ position: relative;
82
+ vertical-align: top;
83
+ }
84
+
85
+ /* Star rating in post editor
86
+ --------------------------------------------------*/
87
+ .edit-rating-box {
88
+ height: 27px;
89
+ line-height: 27px;
90
+ }
91
+
92
+ .wp-core-ui .edit-rating-box button {
93
+ margin-left: 0;
94
+ }
95
+
96
+ .edit-rating-box .cancel,
97
+ .edit-rating-box .zero {
98
+ padding: 0;
99
+ text-decoration: underline;
100
+ color: #0073aa;
101
+ }
102
+
103
+ .rating .inner,
104
+ .edit-rating-buttons-1,
105
+ .edit-rating-buttons-2,
106
+ .edit-rating-success {
107
+ display: inline-block;
108
+ margin-left: 5px;
109
+ vertical-align: middle;
110
+ }
admin/css/views.css CHANGED
@@ -1,1010 +1,1010 @@
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.5em; }
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
- background: #FFF;
637
- border-radius: 4px;
638
- padding: 10px; }
639
- .options > div > span {
640
- display: inline-block; }
641
- .options > div > span:not(:last-child) {
642
- margin-right: 6px; }
643
-
644
- .description-inner {
645
- margin: 15px 0; }
646
-
647
- /* -------------------------------------------------
648
- Template options
649
- ------------------------------------------------- */
650
- ul.radio-list.template-list li {
651
- display: flex; }
652
- ul.radio-list.template-list li.current-selection .template-description {
653
- background: rgba(0, 164, 243, 0.085); }
654
- ul.radio-list.template-list li > div:first-child {
655
- flex: 0 0 15%;
656
- white-space: nowrap;
657
- align-self: center; }
658
- ul.radio-list.template-list li > div:nth-child(2) {
659
- flex: 1 1 auto; }
660
-
661
- .template-optgroup {
662
- font-weight: 600;
663
- margin: 15px 10px 10px 0; }
664
-
665
- .template-description {
666
- border-radius: 15px;
667
- padding: 0 15px; }
668
- .template-description p {
669
- margin: 15px 0 15px !important; }
670
-
671
- /* -------------------------------------------------
672
- Layout options
673
- ------------------------------------------------- */
674
- .layout-section > div:last-child {
675
- flex: 0 0 auto;
676
- align-self: flex-start;
677
- margin-left: 10px;
678
- padding: 10px; }
679
-
680
- /* --------------------------------------------------
681
- Examples
682
- -------------------------------------------------- */
683
- .example-container {
684
- background: white;
685
- border: 1px solid #ccc;
686
- box-sizing: border-box;
687
- padding: 15px 10px 5px;
688
- width: 170px; }
689
- .example-container .box {
690
- background: #DDD;
691
- width: 100%;
692
- line-height: 30px;
693
- height: 30px;
694
- margin-bottom: 10px;
695
- text-align: center;
696
- /* to prevent overflowing margins */
697
- display: inline-block;
698
- position: relative;
699
- /* multi-column properties */
700
- -webkit-column-break-inside: avoid;
701
- page-break-inside: avoid;
702
- break-inside: avoid; }
703
- .example-container .box span {
704
- display: block;
705
- margin: 0 auto; }
706
- .example-container .box.size2 {
707
- height: 45px; }
708
- .example-container .box.size3 {
709
- height: 60px; }
710
-
711
- /* --------------------------------------------------
712
- Columns
713
- -------------------------------------------------- */
714
- .view-layout-columns .example-container {
715
- padding-bottom: 15px;
716
- text-align: center;
717
- /* a minimum width fallback */
718
- -webkit-column-width: 25px;
719
- -moz-column-width: 25px;
720
- column-width: 25px;
721
- -webkit-column-gap: 10px;
722
- -moz-column-gap: 10px;
723
- column-gap: 10px;
724
- /* chrome does not repaint column-rule when switching classes in js :( */
725
- /*-webkit-column-rule: 1px dashed #999;*/
726
- /*-moz-column-rule: 1px dashed #999;*/
727
- /*column-rule: 1px dashed #999;*/
728
- -webkit-margin-bottom-collapse: separate; }
729
- .view-layout-columns .example-container.col-2 {
730
- -webkit-column-count: 2;
731
- -moz-column-count: 2;
732
- column-count: 2; }
733
- .view-layout-columns .example-container.col-3 {
734
- -webkit-column-count: 3;
735
- -moz-column-count: 3;
736
- column-count: 3; }
737
- .view-layout-columns .example-container.col-4 {
738
- -webkit-column-count: 4;
739
- -moz-column-count: 4;
740
- column-count: 4; }
741
-
742
- /* --------------------------------------------------
743
- Grid
744
- -------------------------------------------------- */
745
- .view-layout-grid .example-container {
746
- display: -webkit-flex;
747
- display: -ms-flexbox;
748
- display: flex;
749
- -webkit-flex-wrap: wrap;
750
- -ms-flex-wrap: wrap;
751
- flex-wrap: wrap;
752
- justify-content: space-between; }
753
- .view-layout-grid .example-container .box {
754
- display: -webkit-flex;
755
- display: -ms-flexbox;
756
- display: flex; }
757
- .view-layout-grid .example-container.col-2 .box {
758
- width: 47%; }
759
- .view-layout-grid .example-container.col-3 .box {
760
- width: 29%; }
761
- .view-layout-grid .example-container.col-4 .box {
762
- width: 21%; }
763
-
764
- /* --------------------------------------------------
765
- Masonry
766
- -------------------------------------------------- */
767
- .view-layout-masonry .example-container .box {
768
- width: 46%; }
769
- .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
770
- width: 46%; }
771
- .view-layout-masonry .example-container.col-3 .grid-sizer {
772
- width: 27.5%; }
773
- .view-layout-masonry .example-container.col-4 .grid-sizer {
774
- width: 19.5%; }
775
-
776
- /* -------------------------------------------------
777
- Background options
778
- ------------------------------------------------- */
779
- .color-picker-wrap {
780
- display: flex; }
781
- .color-picker-wrap > div:first-child {
782
- min-width: 80px; }
783
-
784
- .background-preview-wrap {
785
- background: #FFF;
786
- padding: 2em;
787
- max-width: 300px; }
788
-
789
- #background-preview {
790
- padding: 1em;
791
- text-align: center; }
792
- #background-preview.dark {
793
- color: #333; }
794
- #background-preview.light {
795
- color: #EEE; }
796
-
797
- /* --------------------------------------------------
798
- Custom fields
799
- -------------------------------------------------- */
800
- .fields {
801
- display: inline-block;
802
- min-width: 350px; }
803
- .fields .field2 {
804
- border: 1px solid #DDD;
805
- background: #FFF;
806
- /* for better dragging */
807
- transition: background 0.3s ease, border 0.3s ease; }
808
- .fields .field2.open {
809
- background: #FFF;
810
- border-color: #444; }
811
- .fields .field3 {
812
- flex: 20; }
813
- .fields div.link {
814
- display: inline-block;
815
- cursor: pointer;
816
- padding: 10px 10px 8px;
817
- width: calc(100% - 20px); }
818
-
819
- .controls2 {
820
- /* icons */ }
821
- .controls2 > div {
822
- display: flex; }
823
- .controls2 .icon-wrap {
824
- position: relative;
825
- top: 1px;
826
- color: #999; }
827
- .controls2 .icon-wrap:hover {
828
- cursor: pointer; }
829
- .controls2.left {
830
- float: left; }
831
- .controls2.left .icon-wrap {
832
- margin-right: 5px; }
833
- .controls2.right {
834
- float: right; }
835
- .controls2.right .icon-wrap {
836
- margin-left: 5px; }
837
- .controls2 .handle:before,
838
- .controls2 .delete:before,
839
- .controls2 .toggle:before {
840
- font: normal 20px/1 dashicons;
841
- width: 20px;
842
- height: 20px; }
843
- .controls2 .handle:hover,
844
- .controls2 .delete:hover,
845
- .controls2 .toggle:hover {
846
- cursor: pointer; }
847
- .controls2 .delete:before {
848
- content: "\f335"; }
849
- .controls2 .delete:hover:before {
850
- background: #FF0000;
851
- color: #FFF;
852
- border-radius: 1px; }
853
- .controls2 .handle:before {
854
- content: "\f333"; }
855
- .controls2 .handle:hover {
856
- color: #2ea2cc;
857
- cursor: move; }
858
- .controls2 .toggle:before {
859
- content: "\f140"; }
860
- .controls2 .toggle:hover:before {
861
- color: #2EA2CC; }
862
-
863
- .field-description {
864
- padding: 0 5px;
865
- font-weight: 600;
866
- text-decoration: none;
867
- color: #444; }
868
- .field-description:hover {
869
- color: #444; }
870
-
871
- .field-properties {
872
- padding: 5px 10px;
873
- border-top: 1px dotted #DDD; }
874
-
875
- .field-property,
876
- .field-property-box .flex {
877
- display: flex;
878
- margin: 5px 0; }
879
- .field-property label,
880
- .field-property .nolabel,
881
- .field-property-box .flex label,
882
- .field-property-box .flex .nolabel {
883
- flex: 0 1 80px;
884
- line-height: 28px; }
885
- .field-property select, .field-property input,
886
- .field-property-box .flex select,
887
- .field-property-box .flex input {
888
- flex: 3; }
889
-
890
- .field2.open .toggle:before {
891
- content: "\f142"; }
892
-
893
- .sortable-placeholder {
894
- background: lightyellow !important;
895
- margin: 0; }
896
-
897
- .ui-sortable-helper {
898
- border: 1px solid #444 !important; }
899
-
900
- div.help {
901
- font-style: italic;
902
- padding-bottom: 5px; }
903
-
904
- @-moz-document url-prefix() {
905
- select optgroup {
906
- font-style: normal;
907
- margin-left: 3px; } }
908
- /* --------------------------------------------------
909
- help tab
910
- -------------------------------------------------- */
911
- span.help-links {
912
- display: inline-block;
913
- margin-left: 0.4em; }
914
-
915
- a.open-help-tab {
916
- font-weight: 400; }
917
-
918
- table.wpmtst-help-tab {
919
- border-collapse: collapse;
920
- margin: 20px 0;
921
- width: 100%; }
922
- table.wpmtst-help-tab tr:hover td {
923
- background: #FFFFAA; }
924
- table.wpmtst-help-tab th,
925
- table.wpmtst-help-tab td {
926
- padding: 5px 10px;
927
- text-align: center; }
928
- table.wpmtst-help-tab th {
929
- border-bottom: 1px solid #AAA; }
930
- table.wpmtst-help-tab td {
931
- border-bottom: 1px solid #E1E1E1; }
932
- table.wpmtst-help-tab td:first-child {
933
- text-align: right;
934
- font-weight: 600;
935
- white-space: nowrap; }
936
- table.wpmtst-help-tab td:not(:last-child) {
937
- border-right: 1px dotted #E1E1E1; }
938
-
939
- /* --------------------------------------------------
940
- Views list table sticky
941
- -------------------------------------------------- */
942
- .wp-list-table-wrap {
943
- position: relative; }
944
-
945
- .stickit, .stickit:before {
946
- cursor: pointer;
947
- content: "\f154";
948
- display: inline-block;
949
- width: 20px;
950
- height: 20px;
951
- color: #aaa;
952
- font-size: 20px;
953
- line-height: 1;
954
- font-family: dashicons;
955
- text-decoration: inherit;
956
- font-weight: normal;
957
- font-style: normal;
958
- vertical-align: top;
959
- text-align: center;
960
- -webkit-transition: color .1s ease-in;
961
- transition: color .1s ease-in;
962
- -webkit-font-smoothing: antialiased;
963
- -moz-osx-font-smoothing: grayscale; }
964
-
965
- .stickit.stuck:before {
966
- content: "\f155";
967
- color: #0073aa; }
968
- .stickit:hover:before {
969
- content: "\f155";
970
- color: #0096dd; }
971
-
972
- .overlay {
973
- position: absolute;
974
- top: 0;
975
- left: 0;
976
- bottom: 0;
977
- right: 0;
978
- background: rgba(255, 255, 255, 0.7); }
979
-
980
- /* -------------------------------------------------
981
- Inner table
982
- ------------------------------------------------- */
983
- .inner-table {
984
- display: table; }
985
-
986
- .inner-table-row {
987
- display: table-row; }
988
- .inner-table-row.bordered {
989
- border: 1px solid #DDD; }
990
- .inner-table-row.header .inner-table-cell {
991
- text-align: center;
992
- padding: 0 10px;
993
- background: #f6f6f6; }
994
-
995
- .inner-table-cell {
996
- display: table-cell;
997
- padding: 5px 10px; }
998
- .inner-table-cell:not(:last-child) {
999
- border-right: 1px dashed #e2e2e2; }
1000
-
1001
- .form-table td p.description.normal {
1002
- font-style: normal; }
1003
-
1004
- ul.description.normal {
1005
- margin-top: 0;
1006
- font-style: normal; }
1007
-
1008
- ul.description li {
1009
- margin-bottom: 0;
1010
- 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.5em; }
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
+ background: #FFF;
637
+ border-radius: 4px;
638
+ padding: 10px; }
639
+ .options > div > span {
640
+ display: inline-block; }
641
+ .options > div > span:not(:last-child) {
642
+ margin-right: 6px; }
643
+
644
+ .description-inner {
645
+ margin: 15px 0; }
646
+
647
+ /* -------------------------------------------------
648
+ Template options
649
+ ------------------------------------------------- */
650
+ ul.radio-list.template-list li {
651
+ display: flex; }
652
+ ul.radio-list.template-list li.current-selection .template-description {
653
+ background: rgba(0, 164, 243, 0.085); }
654
+ ul.radio-list.template-list li > div:first-child {
655
+ flex: 0 0 15%;
656
+ white-space: nowrap;
657
+ align-self: center; }
658
+ ul.radio-list.template-list li > div:nth-child(2) {
659
+ flex: 1 1 auto; }
660
+
661
+ .template-optgroup {
662
+ font-weight: 600;
663
+ margin: 15px 10px 10px 0; }
664
+
665
+ .template-description {
666
+ border-radius: 15px;
667
+ padding: 0 15px; }
668
+ .template-description p {
669
+ margin: 15px 0 15px !important; }
670
+
671
+ /* -------------------------------------------------
672
+ Layout options
673
+ ------------------------------------------------- */
674
+ .layout-section > div:last-child {
675
+ flex: 0 0 auto;
676
+ align-self: flex-start;
677
+ margin-left: 10px;
678
+ padding: 10px; }
679
+
680
+ /* --------------------------------------------------
681
+ Examples
682
+ -------------------------------------------------- */
683
+ .example-container {
684
+ background: white;
685
+ border: 1px solid #ccc;
686
+ box-sizing: border-box;
687
+ padding: 15px 10px 5px;
688
+ width: 170px; }
689
+ .example-container .box {
690
+ background: #DDD;
691
+ width: 100%;
692
+ line-height: 30px;
693
+ height: 30px;
694
+ margin-bottom: 10px;
695
+ text-align: center;
696
+ /* to prevent overflowing margins */
697
+ display: inline-block;
698
+ position: relative;
699
+ /* multi-column properties */
700
+ -webkit-column-break-inside: avoid;
701
+ page-break-inside: avoid;
702
+ break-inside: avoid; }
703
+ .example-container .box span {
704
+ display: block;
705
+ margin: 0 auto; }
706
+ .example-container .box.size2 {
707
+ height: 45px; }
708
+ .example-container .box.size3 {
709
+ height: 60px; }
710
+
711
+ /* --------------------------------------------------
712
+ Columns
713
+ -------------------------------------------------- */
714
+ .view-layout-columns .example-container {
715
+ padding-bottom: 15px;
716
+ text-align: center;
717
+ /* a minimum width fallback */
718
+ -webkit-column-width: 25px;
719
+ -moz-column-width: 25px;
720
+ column-width: 25px;
721
+ -webkit-column-gap: 10px;
722
+ -moz-column-gap: 10px;
723
+ column-gap: 10px;
724
+ /* chrome does not repaint column-rule when switching classes in js :( */
725
+ /*-webkit-column-rule: 1px dashed #999;*/
726
+ /*-moz-column-rule: 1px dashed #999;*/
727
+ /*column-rule: 1px dashed #999;*/
728
+ -webkit-margin-bottom-collapse: separate; }
729
+ .view-layout-columns .example-container.col-2 {
730
+ -webkit-column-count: 2;
731
+ -moz-column-count: 2;
732
+ column-count: 2; }
733
+ .view-layout-columns .example-container.col-3 {
734
+ -webkit-column-count: 3;
735
+ -moz-column-count: 3;
736
+ column-count: 3; }
737
+ .view-layout-columns .example-container.col-4 {
738
+ -webkit-column-count: 4;
739
+ -moz-column-count: 4;
740
+ column-count: 4; }
741
+
742
+ /* --------------------------------------------------
743
+ Grid
744
+ -------------------------------------------------- */
745
+ .view-layout-grid .example-container {
746
+ display: -webkit-flex;
747
+ display: -ms-flexbox;
748
+ display: flex;
749
+ -webkit-flex-wrap: wrap;
750
+ -ms-flex-wrap: wrap;
751
+ flex-wrap: wrap;
752
+ justify-content: space-between; }
753
+ .view-layout-grid .example-container .box {
754
+ display: -webkit-flex;
755
+ display: -ms-flexbox;
756
+ display: flex; }
757
+ .view-layout-grid .example-container.col-2 .box {
758
+ width: 47%; }
759
+ .view-layout-grid .example-container.col-3 .box {
760
+ width: 29%; }
761
+ .view-layout-grid .example-container.col-4 .box {
762
+ width: 21%; }
763
+
764
+ /* --------------------------------------------------
765
+ Masonry
766
+ -------------------------------------------------- */
767
+ .view-layout-masonry .example-container .box {
768
+ width: 46%; }
769
+ .view-layout-masonry .example-container .grid-sizer, .view-layout-masonry .example-container.col-2 .grid-sizer {
770
+ width: 46%; }
771
+ .view-layout-masonry .example-container.col-3 .grid-sizer {
772
+ width: 27.5%; }
773
+ .view-layout-masonry .example-container.col-4 .grid-sizer {
774
+ width: 19.5%; }
775
+
776
+ /* -------------------------------------------------
777
+ Background options
778
+ ------------------------------------------------- */
779
+ .color-picker-wrap {
780
+ display: flex; }
781
+ .color-picker-wrap > div:first-child {
782
+ min-width: 80px; }
783
+
784
+ .background-preview-wrap {
785
+ background: #FFF;
786
+ padding: 2em;
787
+ max-width: 300px; }
788
+
789
+ #background-preview {
790
+ padding: 1em;
791
+ text-align: center; }
792
+ #background-preview.dark {
793
+ color: #333; }
794
+ #background-preview.light {
795
+ color: #EEE; }
796
+
797
+ /* --------------------------------------------------
798
+ Custom fields
799
+ -------------------------------------------------- */
800
+ .fields {
801
+ display: inline-block;
802
+ min-width: 350px; }
803
+ .fields .field2 {
804
+ border: 1px solid #DDD;
805
+ background: #FFF;
806
+ /* for better dragging */
807
+ transition: background 0.3s ease, border 0.3s ease; }
808
+ .fields .field2.open {
809
+ background: #FFF;
810
+ border-color: #444; }
811
+ .fields .field3 {
812
+ flex: 20; }
813
+ .fields div.link {
814
+ display: inline-block;
815
+ cursor: pointer;
816
+ padding: 10px 10px 8px;
817
+ width: calc(100% - 20px); }
818
+
819
+ .controls2 {
820
+ /* icons */ }
821
+ .controls2 > div {
822
+ display: flex; }
823
+ .controls2 .icon-wrap {
824
+ position: relative;
825
+ top: 1px;
826
+ color: #999; }
827
+ .controls2 .icon-wrap:hover {
828
+ cursor: pointer; }
829
+ .controls2.left {
830
+ float: left; }
831
+ .controls2.left .icon-wrap {
832
+ margin-right: 5px; }
833
+ .controls2.right {
834
+ float: right; }
835
+ .controls2.right .icon-wrap {
836
+ margin-left: 5px; }
837
+ .controls2 .handle:before,
838
+ .controls2 .delete:before,
839
+ .controls2 .toggle:before {
840
+ font: normal 20px/1 dashicons;
841
+ width: 20px;
842
+ height: 20px; }
843
+ .controls2 .handle:hover,
844
+ .controls2 .delete:hover,
845
+ .controls2 .toggle:hover {
846
+ cursor: pointer; }
847
+ .controls2 .delete:before {
848
+ content: "\f335"; }
849
+ .controls2 .delete:hover:before {
850
+ background: #FF0000;
851
+ color: #FFF;
852
+ border-radius: 1px; }
853
+ .controls2 .handle:before {
854
+ content: "\f333"; }
855
+ .controls2 .handle:hover {
856
+ color: #2ea2cc;
857
+ cursor: move; }
858
+ .controls2 .toggle:before {
859
+ content: "\f140"; }
860
+ .controls2 .toggle:hover:before {
861
+ color: #2EA2CC; }
862
+
863
+ .field-description {
864
+ padding: 0 5px;
865
+ font-weight: 600;
866
+ text-decoration: none;
867
+ color: #444; }
868
+ .field-description:hover {
869
+ color: #444; }
870
+
871
+ .field-properties {
872
+ padding: 5px 10px;
873
+ border-top: 1px dotted #DDD; }
874
+
875
+ .field-property,
876
+ .field-property-box .flex {
877
+ display: flex;
878
+ margin: 5px 0; }
879
+ .field-property label,
880
+ .field-property .nolabel,
881
+ .field-property-box .flex label,
882
+ .field-property-box .flex .nolabel {
883
+ flex: 0 1 80px;
884
+ line-height: 28px; }
885
+ .field-property select, .field-property input,
886
+ .field-property-box .flex select,
887
+ .field-property-box .flex input {
888
+ flex: 3; }
889
+
890
+ .field2.open .toggle:before {
891
+ content: "\f142"; }
892
+
893
+ .sortable-placeholder {
894
+ background: lightyellow !important;
895
+ margin: 0; }
896
+
897
+ .ui-sortable-helper {
898
+ border: 1px solid #444 !important; }
899
+
900
+ div.help {
901
+ font-style: italic;
902
+ padding-bottom: 5px; }
903
+
904
+ @-moz-document url-prefix() {
905
+ select optgroup {
906
+ font-style: normal;
907
+ margin-left: 3px; } }
908
+ /* --------------------------------------------------
909
+ help tab
910
+ -------------------------------------------------- */
911
+ span.help-links {
912
+ display: inline-block;
913
+ margin-left: 0.4em; }
914
+
915
+ a.open-help-tab {
916
+ font-weight: 400; }
917
+
918
+ table.wpmtst-help-tab {
919
+ border-collapse: collapse;
920
+ margin: 20px 0;
921
+ width: 100%; }
922
+ table.wpmtst-help-tab tr:hover td {
923
+ background: #FFFFAA; }
924
+ table.wpmtst-help-tab th,
925
+ table.wpmtst-help-tab td {
926
+ padding: 5px 10px;
927
+ text-align: center; }
928
+ table.wpmtst-help-tab th {
929
+ border-bottom: 1px solid #AAA; }
930
+ table.wpmtst-help-tab td {
931
+ border-bottom: 1px solid #E1E1E1; }
932
+ table.wpmtst-help-tab td:first-child {
933
+ text-align: right;
934
+ font-weight: 600;
935
+ white-space: nowrap; }
936
+ table.wpmtst-help-tab td:not(:last-child) {
937
+ border-right: 1px dotted #E1E1E1; }
938
+
939
+ /* --------------------------------------------------
940
+ Views list table sticky
941
+ -------------------------------------------------- */
942
+ .wp-list-table-wrap {
943
+ position: relative; }
944
+
945
+ .stickit, .stickit:before {
946
+ cursor: pointer;
947
+ content: "\f154";
948
+ display: inline-block;
949
+ width: 20px;
950
+ height: 20px;
951
+ color: #aaa;
952
+ font-size: 20px;
953
+ line-height: 1;
954
+ font-family: dashicons;
955
+ text-decoration: inherit;
956
+ font-weight: normal;
957
+ font-style: normal;
958
+ vertical-align: top;
959
+ text-align: center;
960
+ -webkit-transition: color .1s ease-in;
961
+ transition: color .1s ease-in;
962
+ -webkit-font-smoothing: antialiased;
963
+ -moz-osx-font-smoothing: grayscale; }
964
+
965
+ .stickit.stuck:before {
966
+ content: "\f155";
967
+ color: #0073aa; }
968
+ .stickit:hover:before {
969
+ content: "\f155";
970
+ color: #0096dd; }
971
+
972
+ .overlay {
973
+ position: absolute;
974
+ top: 0;
975
+ left: 0;
976
+ bottom: 0;
977
+ right: 0;
978
+ background: rgba(255, 255, 255, 0.7); }
979
+
980
+ /* -------------------------------------------------
981
+ Inner table
982
+ ------------------------------------------------- */
983
+ .inner-table {
984
+ display: table; }
985
+
986
+ .inner-table-row {
987
+ display: table-row; }
988
+ .inner-table-row.bordered {
989
+ border: 1px solid #DDD; }
990
+ .inner-table-row.header .inner-table-cell {
991
+ text-align: center;
992
+ padding: 0 10px;
993
+ background: #f6f6f6; }
994
+
995
+ .inner-table-cell {
996
+ display: table-cell;
997
+ padding: 5px 10px; }
998
+ .inner-table-cell:not(:last-child) {
999
+ border-right: 1px dashed #e2e2e2; }
1000
+
1001
+ .form-table td p.description.normal {
1002
+ font-style: normal; }
1003
+
1004
+ ul.description.normal {
1005
+ margin-top: 0;
1006
+ font-style: normal; }
1007
+
1008
+ ul.description li {
1009
+ margin-bottom: 0;
1010
+ 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 wp_kses_post( 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 wp_kses_post( 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 wp_kses_post( 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 wp_kses_post( 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 wp_kses_post( 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,492 +1,490 @@
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_kses_post( $field['text'] );
99
- }
100
- $field['before'] = wp_kses_post( $field['before'] );
101
- $field['after'] = wp_kses_post( $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
- // add to fields array in display order
115
- $fields[ $new_key++ ] = $field;
116
-
117
- }
118
-
119
- $forms[ $form_id ]['fields'] = $fields;
120
-
121
- if ( isset( $_POST['field_group_label'] ) ) {
122
- // TODO Catch if empty.
123
- $new_label = sanitize_text_field( $_POST['field_group_label'] );
124
- $forms[ $form_id ]['label'] = $new_label;
125
- }
126
-
127
- update_option( 'wpmtst_custom_forms', $forms );
128
- do_action( 'wpmtst_fields_updated', $fields );
129
-
130
- wpmtst_add_admin_notice( 'fields-saved' );
131
-
132
- }
133
-
134
- wp_redirect( $goback );
135
- exit;
136
- }
137
-
138
- add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
139
-
140
- /**
141
- * Custom Fields form
142
- *
143
- * @param int $form_id
144
- */
145
- function wpmtst_settings_custom_fields( $form_id = 1 ) {
146
- if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
147
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
148
- }
149
-
150
- if ( ! $form_id ) {
151
- echo '<div class="wrap wpmtst"><p>' . __( 'No fields selected.', 'strong-testimonials' ) .'</p></div>';
152
- return;
153
- }
154
-
155
- $forms = get_option( 'wpmtst_custom_forms' );
156
- $fields = $forms[$form_id]['fields'];
157
- ?>
158
- <div class="wrap wpmtst">
159
- <h1 class="wp-heading-inline"><?php _e( 'Fields', 'strong-testimonials' ); ?></h1>
160
- <hr class="wp-header-end">
161
- <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
162
-
163
- <div id="left-col">
164
- <div>
165
- <h3><?php _e( 'Editor', 'strong-testimonials' ); ?></h3>
166
- <p>
167
- <?php _e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
168
- <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php _e( 'Help' ); ?></a>
169
- </p>
170
- <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
171
- </div>
172
-
173
- <form id="wpmtst-custom-fields-form" method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>" autocomplete="off">
174
- <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
175
- <input type="hidden" name="action" value="wpmtst_update_custom_fields">
176
- <input type="hidden" name="form_id" value="<?php echo $form_id; ?>">
177
-
178
- <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
179
-
180
- <ul id="custom-field-list">
181
- <?php
182
- foreach ( $fields as $key => $field ) {
183
- echo '<li id="field-' . $key . '">' . wpmtst_show_field( $key, $field, false ) . '</li>' . "\n";
184
- }
185
- ?>
186
- </ul>
187
-
188
- <div id="add-field-bar">
189
- <input id="add-field" type="button" class="button" name="add-field" value="<?php _e( 'Add New Field', 'strong-testimonials' ); ?>">
190
- </div>
191
-
192
- <div id="field-group-actions">
193
- <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
194
- <div><?php submit_button( __( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
195
- <div><?php submit_button( __( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
196
- </div>
197
- </form>
198
- </div><!-- #left-col -->
199
-
200
- <div id="right-col">
201
- <div class="intro">
202
- <h3><?php _e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
203
- <p><?php _e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
204
- </div>
205
- <div id="fields-editor-preview">
206
- <div><!-- placeholder --></div>
207
- </div>
208
- </div><!-- #right-col -->
209
-
210
- </div><!-- .wrap -->
211
- <?php
212
- }
213
-
214
- /**
215
- * Add a field to the form
216
- *
217
- * @param $key
218
- * @param $field
219
- * @param $adding
220
- *
221
- * @return string
222
- */
223
- function wpmtst_show_field( $key, $field, $adding ) {
224
- $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
225
- $field_types = $fields['field_types'];
226
-
227
- ob_start();
228
-
229
- include 'partials/fields/field-header.php';
230
- ?>
231
- <div class="custom-field" style="display: none;">
232
- <table class="field-table">
233
- <?php
234
- include 'partials/fields/field-type.php';
235
- include 'partials/fields/field-label.php';
236
- include 'partials/fields/field-name.php';
237
-
238
- if ( ! $adding ) {
239
- echo wpmtst_show_field_secondary( $key, $field );
240
- echo wpmtst_show_field_admin_table( $key, $field );
241
- }
242
- ?>
243
- </table>
244
-
245
- <?php
246
- if ( ! $adding ) {
247
- echo wpmtst_show_field_hidden( $key, $field );
248
- }
249
- include 'partials/fields/field-controls.php';
250
- ?>
251
- </div><!-- .custom-field -->
252
-
253
- <?php
254
- $html = ob_get_contents();
255
- ob_end_clean();
256
-
257
- return $html;
258
- }
259
-
260
-
261
- /**
262
- * Create the secondary inputs for a new custom field.
263
- * Called after field type is chosen (Post or Custom).
264
- *
265
- * @param $key
266
- * @param $field
267
- *
268
- * @return string
269
- */
270
- function wpmtst_show_field_secondary( $key, $field ) {
271
- $html = '';
272
-
273
- /*
274
- * Required
275
- */
276
- if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
277
- // Disable option if this is a core field like post_content.
278
- if ( isset( $field['core'] ) && $field['core'] ) {
279
- $disabled = ' disabled="disabled"';
280
- } else {
281
- $disabled = false;
282
- }
283
-
284
- $html .= '<tr class="field-secondary">' . "\n";
285
- $html .= '<th>' . __( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
286
- $html .= '<td>' . "\n";
287
- if ( $disabled ) {
288
- $html .= '<input type="hidden" name="fields[' . $key . '][required]" value="' . $field['required'] . '">';
289
- $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
290
- } else {
291
- $html .= '<input type="checkbox" name="fields[' . $key . '][required]" ' . checked( $field['required'], true, false ) . '>';
292
- }
293
- $html .= '</td>' . "\n";
294
- $html .= '</tr>' . "\n";
295
- }
296
-
297
- /*
298
- * Placeholder
299
- */
300
- if ( $field['show_placeholder_option'] ) {
301
- if ( isset( $field['placeholder'] ) ) {
302
- $html .= '<tr class="field-secondary">' . "\n";
303
- $html .= '<th>' . __( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
304
- $html .= '<td><input type="text" name="fields[' . $key . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
305
- $html .= '</tr>' . "\n";
306
- }
307
- }
308
-
309
- /**
310
- * Text (checkbox, radio)
311
- *
312
- * @since 2.23.0
313
- */
314
- if ( $field['show_text_option'] ) {
315
- if ( isset( $field['text'] ) ) {
316
- $html .= '<tr class="field-secondary">' . "\n";
317
- $html .= '<th>' . __( 'Text', 'strong-testimonials' ) . '</th>' . "\n";
318
- $html .= '<td><input type="text" name="fields[' . $key . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . __( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
319
- $html .= '</tr>' . "\n";
320
- }
321
- }
322
-
323
- /*
324
- * Before
325
- */
326
- $html .= '<tr class="field-secondary">' . "\n";
327
- $html .= '<th>' . __( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
328
- $html .= '<td><input type="text" name="fields[' . $key . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
329
- $html .= '</tr>' . "\n";
330
-
331
- /*
332
- * After
333
- */
334
- $html .= '<tr class="field-secondary">' . "\n";
335
- $html .= '<th>' . __( 'After', 'strong-testimonials' ) . '</th>' . "\n";
336
- $html .= '<td><input type="text" name="fields[' . $key . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
337
- $html .= '</tr>' . "\n";
338
-
339
- /*
340
- * Default Form Value
341
- */
342
- if ( $field['show_default_options'] ) {
343
- if ( isset( $field['default_form_value'] ) ) {
344
- $html .= '<tr class="field-secondary">' . "\n";
345
- $html .= '<th>' . __( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
346
- $html .= '<td>' . "\n";
347
-
348
- // TODO Replace this special handling
349
- if ( 'rating' == $field['input_type'] ) {
350
-
351
- $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
352
- $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
353
- $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
354
-
355
- } elseif ( 'checkbox' == $field['input_type'] ) {
356
-
357
- $html .= '<label>';
358
- $html .= '<input type="checkbox" name="fields[' . $key . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
359
- $html .= '<span class="help inline">' . __( 'Checked by default.', 'strong-testimonials' ) . '</span>';
360
- $html .= '</label>';
361
-
362
- } else {
363
-
364
- $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
365
- $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
366
-
367
- }
368
-
369
- $html .= '</td>' . "\n";
370
- $html .= '</tr>' . "\n";
371
- }
372
- }
373
-
374
- /*
375
- * Default Display Value
376
- */
377
- if ( $field['show_default_options'] ) {
378
- // TODO Replace this special handling for checkbox type
379
- if ( 'checkbox' != $field['input_type'] ) {
380
- if ( isset( $field['default_display_value'] ) ) {
381
- $html .= '<tr class="field-secondary">' . "\n";
382
- $html .= '<th>' . __( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
383
- $html .= '<td>' . "\n";
384
-
385
- // TODO Replace this special handling
386
- if ( 'rating' == $field['input_type'] ) {
387
- $html .= '<input type="text" name="fields[' . $key . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
388
- $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
389
- } else {
390
- $html .= '<input type="text" name="fields[' . $key . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
391
- }
392
-
393
- $html .= '<span class="help">' . __( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
394
- $html .= '</td>' . "\n";
395
- $html .= '</tr>' . "\n";
396
- }
397
- }
398
- }
399
-
400
- /*
401
- * Shortcode Options
402
- */
403
- if ( $field['show_shortcode_options'] ) {
404
- if ( isset( $field['shortcode_on_form'] ) ) {
405
- $html .= '<tr class="field-secondary">' . "\n";
406
- $html .= '<th>' . __( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
407
- $html .= '<td>' . "\n";
408
- $html .= '<input type="text" name="fields[' . $key . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
409
- $html .= '</td>' . "\n";
410
- $html .= '</tr>' . "\n";
411
- }
412
- if ( isset( $field['shortcode_on_display'] ) ) {
413
- $html .= '<tr class="field-secondary">' . "\n";
414
- $html .= '<th>' . __( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
415
- $html .= '<td>' . "\n";
416
- $html .= '<input type="text" name="fields[' . $key . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
417
- $html .= '</td>' . "\n";
418
- $html .= '</tr>' . "\n";
419
- }
420
- }
421
-
422
- return $html;
423
- }
424
-
425
-
426
- /**
427
- * Add type-specific [Admin Table] setting to form.
428
- */
429
- function wpmtst_show_field_admin_table( $key, $field ) {
430
- // -------------------
431
- // Show in Admin Table
432
- // -------------------
433
- if ( ! $field['show_admin_table_option'] ) {
434
- $html = '<input type="hidden" name="fields[' . $key . '][show_admin_table_option]" value="' . $field['show_admin_table_option'] . '">';
435
- return $html;
436
- }
437
-
438
- $html = '<tr class="field-admin-table">' . "\n";
439
- $html .= '<th>' . __( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
440
- $html .= '<td>' . "\n";
441
- if ( $field['admin_table_option'] ) {
442
- $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . $key . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
443
- } else {
444
- $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . __( 'required', 'strong-testimonials' ) . '</em>';
445
- $html .= '<input type="hidden" name="fields[' . $key . '][admin_table]" value="' . $field['admin_table'] . '">';
446
- }
447
- $html .= '<span class="help inline">' . __( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
448
- $html .= '</label>';
449
- $html .= '</td>' . "\n";
450
- $html .= '</tr>' . "\n";
451
-
452
- return $html;
453
- }
454
-
455
-
456
- /**
457
- * Add hidden fields to form.
458
- *
459
- * @param $key
460
- * @param $field
461
- *
462
- * @return string
463
- */
464
- function wpmtst_show_field_hidden( $key, $field ) {
465
- $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
466
-
467
- $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
468
- $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
469
- if ( isset( $field['action_input'] ) ) {
470
- $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
471
- }
472
- if ( isset( $field['action_output'] ) ) {
473
- $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
474
- }
475
- $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
476
- $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
477
- $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
478
- $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
479
- $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
480
- $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
481
- $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
482
-
483
- if ( isset( $field['map'] ) ) {
484
- $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
485
- }
486
-
487
- if ( isset( $field['core'] ) ) {
488
- $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
489
- }
490
-
491
- return $html;
492
- }
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
+ } elseif ( isset( $_POST['restore-defaults'] ) ) {
44
+
45
+ // Restore defaults
46
+ $default_forms = Strong_Testimonials_Defaults::get_base_forms();
47
+ $fields = $default_forms['default']['fields'];
48
+ $forms[ $form_id ]['fields'] = $fields;
49
+ update_option( 'wpmtst_custom_forms', $forms );
50
+ do_action( 'wpmtst_fields_updated', $fields );
51
+
52
+ wpmtst_add_admin_notice( 'defaults-restored' );
53
+
54
+ } else {
55
+
56
+ // Save changes
57
+ $fields = array();
58
+ $new_key = 0;
59
+
60
+ /**
61
+ * Strip the dang slashes from the dang magic quotes.
62
+ *
63
+ * @since 2.0.0
64
+ */
65
+ $post_fields = stripslashes_deep( $_POST['fields'] );
66
+
67
+ foreach ( $post_fields as $key => $field ) {
68
+
69
+ /*
70
+ * Before merging onto base field, catch fields that are "off"
71
+ * which the form does not submit. Otherwise, the default "on"
72
+ * would override the requested (but not submitted) "off".
73
+ */
74
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
75
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
76
+
77
+ $field = array_merge( $field_options['field_base'], $field );
78
+
79
+ $field['name'] = sanitize_text_field( $field['name'] );
80
+ $field['label'] = sanitize_text_field( $field['label'] );
81
+
82
+ // TODO Replace this special handling
83
+ if ( 'checkbox' == $field['input_type'] ) {
84
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
85
+ } else {
86
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
87
+ }
88
+ $field['action_input'] = isset( $field['action_input'] ) ? sanitize_text_field( $field['action_input'] ) : '';
89
+ $field['action_output'] = isset( $field['action_output'] ) ? sanitize_text_field( $field['action_output'] ) : '';
90
+
91
+ $field['default_display_value'] = sanitize_text_field( $field['default_display_value'] );
92
+
93
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
94
+
95
+ if ( isset( $field['text'] ) ) {
96
+ $field['text'] = wp_kses_post( $field['text'] );
97
+ }
98
+ $field['before'] = wp_kses_post( $field['before'] );
99
+ $field['after'] = wp_kses_post( $field['after'] );
100
+
101
+ $field['shortcode_on_form'] = sanitize_text_field( $field['shortcode_on_form'] );
102
+ $field['shortcode_on_display'] = sanitize_text_field( $field['shortcode_on_display'] );
103
+ $field['show_shortcode_options'] = $field['show_shortcode_options'] ? 1 : 0;
104
+
105
+ // Hidden options (no need to check if isset)
106
+ $field['admin_table'] = $field['admin_table'] ? 1 : 0;
107
+ $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
108
+ $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
109
+ $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
110
+ $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
111
+
112
+ // add to fields array in display order
113
+ $fields[ $new_key++ ] = $field;
114
+
115
+ }
116
+
117
+ $forms[ $form_id ]['fields'] = $fields;
118
+
119
+ if ( isset( $_POST['field_group_label'] ) ) {
120
+ // TODO Catch if empty.
121
+ $new_label = sanitize_text_field( $_POST['field_group_label'] );
122
+ $forms[ $form_id ]['label'] = $new_label;
123
+ }
124
+
125
+ update_option( 'wpmtst_custom_forms', $forms );
126
+ do_action( 'wpmtst_fields_updated', $fields );
127
+
128
+ wpmtst_add_admin_notice( 'fields-saved' );
129
+
130
+ }
131
+
132
+ wp_redirect( $goback );
133
+ exit;
134
+ }
135
+
136
+ add_action( 'admin_post_wpmtst_update_custom_fields', 'wpmtst_update_custom_fields' );
137
+
138
+ /**
139
+ * Custom Fields form
140
+ *
141
+ * @param int $form_id
142
+ */
143
+ function wpmtst_settings_custom_fields( $form_id = 1 ) {
144
+ if ( ! current_user_can( 'strong_testimonials_fields' ) ) {
145
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) );
146
+ }
147
+
148
+ if ( ! $form_id ) {
149
+ echo '<div class="wrap wpmtst"><p>' . esc_html__( 'No fields selected.', 'strong-testimonials' ) . '</p></div>';
150
+ return;
151
+ }
152
+
153
+ $forms = get_option( 'wpmtst_custom_forms' );
154
+ $fields = $forms[ $form_id ]['fields'];
155
+ ?>
156
+ <div class="wrap wpmtst">
157
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Fields', 'strong-testimonials' ); ?></h1>
158
+ <hr class="wp-header-end">
159
+ <?php do_action( 'wpmtst_fields_editor_before_fields_intro' ); ?>
160
+
161
+ <div id="left-col">
162
+ <div>
163
+ <h3><?php esc_html_e( 'Editor', 'strong-testimonials' ); ?></h3>
164
+ <p>
165
+ <?php esc_html_e( 'Click a field to open its options panel.', 'strong-testimonials' ); ?>
166
+ <a class="open-help-tab" href="#tab-panel-wpmtst-help"><?php esc_html_e( 'Help' ); ?></a>
167
+ </p>
168
+ <?php do_action( 'wpmtst_before_fields_settings', 'form-fields' ); ?>
169
+ </div>
170
+
171
+ <form id="wpmtst-custom-fields-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" autocomplete="off">
172
+ <?php wp_nonce_field( 'wpmtst_custom_fields_form', 'wpmtst_form_submitted' ); ?>
173
+ <input type="hidden" name="action" value="wpmtst_update_custom_fields">
174
+ <input type="hidden" name="form_id" value="<?php echo esc_attr( $form_id ); ?>">
175
+
176
+ <?php do_action( 'wpmtst_fields_editor_before_fields_editor', $forms[ $form_id ] ); ?>
177
+
178
+ <ul id="custom-field-list">
179
+ <?php
180
+ foreach ( $fields as $key => $field ) {
181
+ echo '<li id="field-' . esc_attr( $key ) . '">' . wp_kses_post( wpmtst_show_field( $key, $field, false ) ) . '</li>' . "\n";
182
+ }
183
+ ?>
184
+ </ul>
185
+
186
+ <div id="add-field-bar">
187
+ <input id="add-field" type="button" class="button" name="add-field" value="<?php esc_attr_e( 'Add New Field', 'strong-testimonials' ); ?>">
188
+ </div>
189
+
190
+ <div id="field-group-actions">
191
+ <div><?php submit_button( '', 'primary', 'submit-form', false ); ?></div>
192
+ <div><?php submit_button( __( 'Cancel Changes', 'strong-testimonials' ), 'secondary', 'reset', false ); ?></div>
193
+ <div><?php submit_button( __( 'Restore Defaults', 'strong-testimonials' ), 'secondary', 'restore-defaults', false ); ?></div>
194
+ </div>
195
+ </form>
196
+ </div><!-- #left-col -->
197
+
198
+ <div id="right-col">
199
+ <div class="intro">
200
+ <h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
201
+ <p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
202
+ </div>
203
+ <div id="fields-editor-preview">
204
+ <div><!-- placeholder --></div>
205
+ </div>
206
+ </div><!-- #right-col -->
207
+
208
+ </div><!-- .wrap -->
209
+ <?php
210
+ }
211
+
212
+ /**
213
+ * Add a field to the form
214
+ *
215
+ * @param $key
216
+ * @param $field
217
+ * @param $adding
218
+ *
219
+ * @return string
220
+ */
221
+ function wpmtst_show_field( $key, $field, $adding ) {
222
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
223
+ $field_types = $fields['field_types'];
224
+
225
+ ob_start();
226
+
227
+ include 'partials/fields/field-header.php';
228
+ ?>
229
+ <div class="custom-field" style="display: none;">
230
+ <table class="field-table">
231
+ <?php
232
+ include 'partials/fields/field-type.php';
233
+ include 'partials/fields/field-label.php';
234
+ include 'partials/fields/field-name.php';
235
+
236
+ if ( ! $adding ) {
237
+ echo wp_kses_post( wpmtst_show_field_secondary( $key, $field ) );
238
+ echo wp_kses_post( wpmtst_show_field_admin_table( $key, $field ) );
239
+ }
240
+ ?>
241
+ </table>
242
+
243
+ <?php
244
+ if ( ! $adding ) {
245
+ echo wp_kses_post( wpmtst_show_field_hidden( $key, $field ) );
246
+ }
247
+ include 'partials/fields/field-controls.php';
248
+ ?>
249
+ </div><!-- .custom-field -->
250
+
251
+ <?php
252
+ $html = ob_get_contents();
253
+ ob_end_clean();
254
+
255
+ return $html;
256
+ }
257
+
258
+
259
+ /**
260
+ * Create the secondary inputs for a new custom field.
261
+ * Called after field type is chosen (Post or Custom).
262
+ *
263
+ * @param $key
264
+ * @param $field
265
+ *
266
+ * @return string
267
+ */
268
+ function wpmtst_show_field_secondary( $key, $field ) {
269
+ $html = '';
270
+
271
+ /*
272
+ * Required
273
+ */
274
+ if ( isset( $field['show_required_option'] ) && $field['show_required_option'] ) {
275
+ // Disable option if this is a core field like post_content.
276
+ if ( isset( $field['core'] ) && $field['core'] ) {
277
+ $disabled = ' disabled="disabled"';
278
+ } else {
279
+ $disabled = false;
280
+ }
281
+
282
+ $html .= '<tr class="field-secondary">' . "\n";
283
+ $html .= '<th>' . __( 'Required', 'strong-testimonials' ) . '</th>' . "\n";
284
+ $html .= '<td>' . "\n";
285
+ if ( $disabled ) {
286
+ $html .= '<input type="hidden" name="fields[' . $key . '][required]" value="' . $field['required'] . '">';
287
+ $html .= '<input type="checkbox" ' . checked( $field['required'], true, false ) . $disabled . '>';
288
+ } else {
289
+ $html .= '<input type="checkbox" name="fields[' . $key . '][required]" ' . checked( $field['required'], true, false ) . '>';
290
+ }
291
+ $html .= '</td>' . "\n";
292
+ $html .= '</tr>' . "\n";
293
+ }
294
+
295
+ /*
296
+ * Placeholder
297
+ */
298
+ if ( $field['show_placeholder_option'] ) {
299
+ if ( isset( $field['placeholder'] ) ) {
300
+ $html .= '<tr class="field-secondary">' . "\n";
301
+ $html .= '<th>' . __( 'Placeholder', 'strong-testimonials' ) . '</th>' . "\n";
302
+ $html .= '<td><input type="text" name="fields[' . $key . '][placeholder]" value="' . esc_attr( $field['placeholder'] ) . '"></td>' . "\n";
303
+ $html .= '</tr>' . "\n";
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Text (checkbox, radio)
309
+ *
310
+ * @since 2.23.0
311
+ */
312
+ if ( $field['show_text_option'] ) {
313
+ if ( isset( $field['text'] ) ) {
314
+ $html .= '<tr class="field-secondary">' . "\n";
315
+ $html .= '<th>' . __( 'Text', 'strong-testimonials' ) . '</th>' . "\n";
316
+ $html .= '<td><input type="text" name="fields[' . $key . '][text]" value="' . esc_attr( $field['text'] ) . '" placeholder="' . __( 'next to the checkbox', 'strong-testimonials' ) . '"></td>' . "\n";
317
+ $html .= '</tr>' . "\n";
318
+ }
319
+ }
320
+
321
+ /*
322
+ * Before
323
+ */
324
+ $html .= '<tr class="field-secondary">' . "\n";
325
+ $html .= '<th>' . __( 'Before', 'strong-testimonials' ) . '</th>' . "\n";
326
+ $html .= '<td><input type="text" name="fields[' . $key . '][before]" value="' . esc_attr( $field['before'] ) . '"></td>' . "\n";
327
+ $html .= '</tr>' . "\n";
328
+
329
+ /*
330
+ * After
331
+ */
332
+ $html .= '<tr class="field-secondary">' . "\n";
333
+ $html .= '<th>' . __( 'After', 'strong-testimonials' ) . '</th>' . "\n";
334
+ $html .= '<td><input type="text" name="fields[' . $key . '][after]" value="' . esc_attr( $field['after'] ) . '"></td>' . "\n";
335
+ $html .= '</tr>' . "\n";
336
+
337
+ /*
338
+ * Default Form Value
339
+ */
340
+ if ( $field['show_default_options'] ) {
341
+ if ( isset( $field['default_form_value'] ) ) {
342
+ $html .= '<tr class="field-secondary">' . "\n";
343
+ $html .= '<th>' . __( 'Default Form Value', 'strong-testimonials' ) . '</th>' . "\n";
344
+ $html .= '<td>' . "\n";
345
+
346
+ // TODO Replace this special handling
347
+ if ( 'rating' == $field['input_type'] ) {
348
+
349
+ $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '" class="as-number">';
350
+ $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
351
+ $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
352
+
353
+ } elseif ( 'checkbox' == $field['input_type'] ) {
354
+
355
+ $html .= '<label>';
356
+ $html .= '<input type="checkbox" name="fields[' . $key . '][default_form_value]" ' . checked( $field['default_form_value'], true, false ) . '>';
357
+ $html .= '<span class="help inline">' . __( 'Checked by default.', 'strong-testimonials' ) . '</span>';
358
+ $html .= '</label>';
359
+
360
+ } else {
361
+
362
+ $html .= '<input type="text" name="fields[' . $key . '][default_form_value]" value="' . esc_attr( $field['default_form_value'] ) . '">';
363
+ $html .= '<span class="help">' . __( 'Populate the field with this value.', 'strong-testimonials' ) . '</span>';
364
+
365
+ }
366
+
367
+ $html .= '</td>' . "\n";
368
+ $html .= '</tr>' . "\n";
369
+ }
370
+ }
371
+
372
+ /*
373
+ * Default Display Value
374
+ */
375
+ if ( $field['show_default_options'] ) {
376
+ // TODO Replace this special handling for checkbox type
377
+ if ( 'checkbox' != $field['input_type'] ) {
378
+ if ( isset( $field['default_display_value'] ) ) {
379
+ $html .= '<tr class="field-secondary">' . "\n";
380
+ $html .= '<th>' . __( 'Default Display Value', 'strong-testimonials' ) . '</th>' . "\n";
381
+ $html .= '<td>' . "\n";
382
+
383
+ // TODO Replace this special handling
384
+ if ( 'rating' == $field['input_type'] ) {
385
+ $html .= '<input type="text" name="fields[' . $key . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '" class="as-number">';
386
+ $html .= '<span class="help inline">' . __( 'stars', 'strong-testimonials' ) . '</span>';
387
+ } else {
388
+ $html .= '<input type="text" name="fields[' . $key . '][default_display_value]" value="' . esc_attr( $field['default_display_value'] ) . '">';
389
+ }
390
+
391
+ $html .= '<span class="help">' . __( 'Display this on the testimonial if no value is submitted.', 'strong-testimonials' ) . '</span>';
392
+ $html .= '</td>' . "\n";
393
+ $html .= '</tr>' . "\n";
394
+ }
395
+ }
396
+ }
397
+
398
+ /*
399
+ * Shortcode Options
400
+ */
401
+ if ( $field['show_shortcode_options'] ) {
402
+ if ( isset( $field['shortcode_on_form'] ) ) {
403
+ $html .= '<tr class="field-secondary">' . "\n";
404
+ $html .= '<th>' . __( 'Shortcode on form', 'strong-testimonials' ) . '</th>' . "\n";
405
+ $html .= '<td>' . "\n";
406
+ $html .= '<input type="text" name="fields[' . $key . '][shortcode_on_form]" value="' . esc_attr( $field['shortcode_on_form'] ) . '">';
407
+ $html .= '</td>' . "\n";
408
+ $html .= '</tr>' . "\n";
409
+ }
410
+ if ( isset( $field['shortcode_on_display'] ) ) {
411
+ $html .= '<tr class="field-secondary">' . "\n";
412
+ $html .= '<th>' . __( 'Shortcode on display', 'strong-testimonials' ) . '</th>' . "\n";
413
+ $html .= '<td>' . "\n";
414
+ $html .= '<input type="text" name="fields[' . $key . '][shortcode_on_display]" value="' . esc_attr( $field['shortcode_on_display'] ) . '">';
415
+ $html .= '</td>' . "\n";
416
+ $html .= '</tr>' . "\n";
417
+ }
418
+ }
419
+
420
+ return $html;
421
+ }
422
+
423
+
424
+ /**
425
+ * Add type-specific [Admin Table] setting to form.
426
+ */
427
+ function wpmtst_show_field_admin_table( $key, $field ) {
428
+ // -------------------
429
+ // Show in Admin Table
430
+ // -------------------
431
+ if ( ! $field['show_admin_table_option'] ) {
432
+ $html = '<input type="hidden" name="fields[' . $key . '][show_admin_table_option]" value="' . $field['show_admin_table_option'] . '">';
433
+ return $html;
434
+ }
435
+
436
+ $html = '<tr class="field-admin-table">' . "\n";
437
+ $html .= '<th>' . __( 'Admin List', 'strong-testimonials' ) . '</th>' . "\n";
438
+ $html .= '<td>' . "\n";
439
+ if ( $field['admin_table_option'] ) {
440
+ $html .= '<label><input type="checkbox" class="field-admin-table" name="fields[' . $key . '][admin_table]" ' . checked( $field['admin_table'], 1, false ) . '>';
441
+ } else {
442
+ $html .= '<input type="checkbox" ' . checked( $field['admin_table'], 1, false ) . ' disabled="disabled"> <em>' . __( 'required', 'strong-testimonials' ) . '</em>';
443
+ $html .= '<input type="hidden" name="fields[' . $key . '][admin_table]" value="' . $field['admin_table'] . '">';
444
+ }
445
+ $html .= '<span class="help inline">' . __( 'Show this field in the admin list table.', 'strong-testimonials' ) . '</span>';
446
+ $html .= '</label>';
447
+ $html .= '</td>' . "\n";
448
+ $html .= '</tr>' . "\n";
449
+
450
+ return $html;
451
+ }
452
+
453
+
454
+ /**
455
+ * Add hidden fields to form.
456
+ *
457
+ * @param $key
458
+ * @param $field
459
+ *
460
+ * @return string
461
+ */
462
+ function wpmtst_show_field_hidden( $key, $field ) {
463
+ $pattern = '<input type="hidden" name="fields[%s][%s]" value="%s">';
464
+
465
+ $html = sprintf( $pattern, $key, 'record_type', $field['record_type'] ) . "\n";
466
+ $html .= sprintf( $pattern, $key, 'input_type', $field['input_type'] ) . "\n";
467
+ if ( isset( $field['action_input'] ) ) {
468
+ $html .= sprintf( $pattern, $key, 'action_input', $field['action_input'] ) . "\n";
469
+ }
470
+ if ( isset( $field['action_output'] ) ) {
471
+ $html .= sprintf( $pattern, $key, 'action_output', $field['action_output'] ) . "\n";
472
+ }
473
+ $html .= sprintf( $pattern, $key, 'name_mutable', $field['name_mutable'] ) . "\n";
474
+ $html .= sprintf( $pattern, $key, 'show_text_option', $field['show_text_option'] ) . "\n";
475
+ $html .= sprintf( $pattern, $key, 'show_placeholder_option', $field['show_placeholder_option'] ) . "\n";
476
+ $html .= sprintf( $pattern, $key, 'show_default_options', $field['show_default_options'] ) . "\n";
477
+ $html .= sprintf( $pattern, $key, 'admin_table_option', $field['admin_table_option'] ) . "\n";
478
+ $html .= sprintf( $pattern, $key, 'show_admin_table_option', $field['show_admin_table_option'] ) . "\n";
479
+ $html .= sprintf( $pattern, $key, 'show_shortcode_options', $field['show_shortcode_options'] ) . "\n";
480
+
481
+ if ( isset( $field['map'] ) ) {
482
+ $html .= sprintf( $pattern, $key, 'map', $field['map'] ) . "\n";
483
+ }
484
+
485
+ if ( isset( $field['core'] ) ) {
486
+ $html .= sprintf( $pattern, $key, 'core', $field['core'] ) . "\n";
487
+ }
488
+
489
+ return $html;
490
+ }
 
 
admin/form-preview.php CHANGED
@@ -1,51 +1,53 @@
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'] ) ) {
5
+ exit;
6
+ }
7
+
8
+ // parse_str decodes too; no need to use urldecode
9
+ parse_str( stripslashes_deep( $_POST['fields'] ), $preview );
10
+
11
+ $new_fields = array();
12
+ $fields = apply_filters( 'wpmtst_fields', get_option( 'wpmtst_fields' ) );
13
+
14
+ foreach ( $preview['fields'] as $key => $field ) {
15
+ /*
16
+ * Before merging onto base field, catch fields that are "off"
17
+ * which the form does not submit. Otherwise, the default "on"
18
+ * would override the requested (but not submitted) "off".
19
+ */
20
+ $field['show_label'] = isset( $field['show_label'] ) ? 1 : 0;
21
+ $field['required'] = isset( $field['required'] ) ? 1 : 0;
22
+
23
+ $field = array_merge( $fields['field_base'], $field );
24
+
25
+ if ( 'none' == $field['input_type'] ) {
26
+ $field['input_type'] = 'text';
27
+ }
28
+
29
+ $field['name'] = sanitize_text_field( $field['name'] );
30
+ $field['label'] = sanitize_text_field( $field['label'] );
31
+ // TODO Replace this special handling
32
+ if ( 'checkbox' == $field['input_type'] ) {
33
+ $field['default_form_value'] = wpmtst_sanitize_checkbox( $field, 'default_form_value' );
34
+ } else {
35
+ $field['default_form_value'] = sanitize_text_field( $field['default_form_value'] );
36
+ }
37
+ $field['placeholder'] = sanitize_text_field( $field['placeholder'] );
38
+ $field['before'] = sanitize_text_field( $field['before'] );
39
+ $field['after'] = sanitize_text_field( $field['after'] );
40
+
41
+ // add to fields array in display order
42
+ $new_fields[] = $field;
43
+ }
44
+
45
+ ob_start();
46
+ include WPMTST_ADMIN . 'partials/templates/form-preview-template.php';
47
+ $html = ob_get_contents();
48
+ ob_end_clean();
49
+ echo wp_kses_post( $html );
50
+
51
+ exit;
52
+ }
53
+ add_action( 'wp_ajax_wpmtst_get_form_preview', 'wpmtst_get_form_preview' );
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,602 +1,602 @@
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
- });
409
-
410
-
411
- // admin-table field
412
- var data2 = {
413
- 'action': 'wpmtst_add_field_4',
414
- 'nextKey': key,
415
- 'fieldClass': fieldClass,
416
- 'fieldType': fieldType,
417
- 'security': wpmtstAdmin.ajax_nonce
418
- };
419
-
420
- var ajax2 = ajax1.then(function () {
421
- return $.get(ajaxurl, data2, function (response) {
422
- $table.append(response);
423
- });
424
- });
425
-
426
-
427
- // hidden inputs
428
- var data3 = {
429
- 'action': 'wpmtst_add_field_3',
430
- 'nextKey': key,
431
- 'fieldClass': fieldClass,
432
- 'fieldType': fieldType,
433
- 'security': wpmtstAdmin.ajax_nonce
434
- };
435
-
436
- var ajax3 = ajax2.then(function () {
437
- return $.get(ajaxurl, data3, function (response) {
438
- $table.parent().append(response);
439
- });
440
- });
441
-
442
- ajax3.done(function () {
443
-
444
- formPreview();
445
- $("#add-field, #submit").removeAttr("disabled");
446
-
447
- // Successfully added so show "Close" link
448
- $("span.close-field").show();
449
-
450
- $parent
451
- // Reset temporary status
452
- .removeData("status").removeAttr("data-status")
453
- // update parent list item
454
- .find(".custom-field-header a.field").html($fieldLabel.val()).end()
455
- // update hidden [record_type] input
456
- .find('input[name$="[record_type]"]').val(fieldClass);
457
-
458
- });
459
-
460
- });
461
-
462
- /**
463
- * ------------------------------------------------------------
464
- * Functions
465
- * ------------------------------------------------------------
466
- */
467
-
468
- function getCatCount() {
469
- $.get(ajaxurl, {
470
- 'action': 'wpmtst_get_cat_count',
471
- 'security': wpmtstAdmin.ajax_nonce
472
- },
473
- function (response) {
474
- catCount = parseInt(response);
475
- });
476
- }
477
-
478
- // Preview
479
- function formPreview() {
480
- var formFields = $theForm.find("[name^='fields']");
481
- if (!formFields.length) return;
482
-
483
- var data = {
484
- 'action': 'wpmtst_get_form_preview',
485
- 'fields': formFields.serialize()
486
- };
487
- $.post(ajaxurl, data, function (response) {
488
- var newDiv = $("<div></div>").hide().html(response)
489
- $("#fields-editor-preview")
490
- .children().first()
491
- .after(newDiv)
492
- .fadeOut(300, function () {
493
- newDiv.show();
494
- $(this).remove();
495
- });
496
- });
497
- }
498
-
499
- /*
500
- * Disable any Post fields already in use.
501
- *
502
- * Doing this client-side so a Post field can be added
503
- * but not saved before adding more fields;
504
- * i.e. add multiple fields of either type without risk
505
- * of duplicating single Post fields before clicking "Save".
506
- */
507
- function togglePostFields() {
508
- $fieldList.find('input[name$="[record_type]"]').each(function () {
509
- var $parent = $(this).closest("li");
510
- var value = $(this).val();
511
- if ("post" === value) {
512
- var name = $parent.find(".field-name").val();
513
- $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
514
- }
515
- });
516
- }
517
-
518
- // Only allow one category field
519
- function toggleCategoryFields() {
520
- var categoryInUse = false;
521
-
522
- $fieldList.find('input[name$="[record_type]"]').each(function () {
523
- var $parent = $(this).closest("li");
524
- var value = $(this).val();
525
- if ('optional' === value) {
526
- var fieldType = $parent.find('input[name$="[input_type]"]').val();
527
- if (!categoryInUse) {
528
- categoryInUse = ( 'category' === fieldType.split('-')[0] );
529
- }
530
- }
531
- });
532
-
533
- var $options = $fieldList.find('option[value^="category"]');
534
- if (categoryInUse) {
535
- $options.each(function () {
536
- var text = $(this).text();
537
- $(this)
538
- .attr("disabled", "disabled")
539
- .text(text + ' ' + wpmtstAdmin.inUse)
540
- .data('origText', text);
541
- });
542
- }
543
- else if (0 === catCount) {
544
- $options.each(function () {
545
- var text = $(this).text();
546
- $(this)
547
- .attr("disabled", "disabled")
548
- .text(text + ' ' + wpmtstAdmin.noneFound)
549
- .data('origText', text);
550
- });
551
- } else {
552
- $options.each(function () {
553
- $(this)
554
- .removeAttr("disabled")
555
- .text($(this).data('origText'));
556
- });
557
- }
558
- }
559
-
560
- // Actions on opening/closing the field
561
- function toggleField($field) {
562
- $field.replaceSelect()
563
- .toggleClass("open")
564
- .scrollUp()
565
- .find("span.link")
566
- .toggleClass("open")
567
- .end()
568
- .find(".custom-field")
569
- .toggleClass("open")
570
- .slideToggle()
571
- .find(".first-field")
572
- .focus();
573
- }
574
-
575
- // Build a unique name
576
- function getUniqueName(fieldName, fieldIndex) {
577
- fieldName = sanitizeName(fieldName);
578
-
579
- // Get names of *other* fields
580
- var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
581
- return this.value;
582
- }).get();
583
-
584
- names = names.filter(function (x) {
585
- return (x !== (undefined || ''));
586
- });
587
-
588
- var uniqueName = fieldName;
589
- var i = 2;
590
-
591
- while ($.inArray(uniqueName, names) >= 1) {
592
- uniqueName = fieldName + '_' + i++;
593
- }
594
- return uniqueName;
595
- }
596
-
597
- // Dismiss the "Fields saved" notice.
598
- function dismissNotice() {
599
- $('.wpmtst.notice').find(".notice-dismiss").click();
600
- }
601
-
602
- })(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
+ });
409
+
410
+
411
+ // admin-table field
412
+ var data2 = {
413
+ 'action': 'wpmtst_add_field_4',
414
+ 'nextKey': key,
415
+ 'fieldClass': fieldClass,
416
+ 'fieldType': fieldType,
417
+ 'security': wpmtstAdmin.ajax_nonce
418
+ };
419
+
420
+ var ajax2 = ajax1.then(function () {
421
+ return $.get(ajaxurl, data2, function (response) {
422
+ $table.append(response);
423
+ });
424
+ });
425
+
426
+
427
+ // hidden inputs
428
+ var data3 = {
429
+ 'action': 'wpmtst_add_field_3',
430
+ 'nextKey': key,
431
+ 'fieldClass': fieldClass,
432
+ 'fieldType': fieldType,
433
+ 'security': wpmtstAdmin.ajax_nonce
434
+ };
435
+
436
+ var ajax3 = ajax2.then(function () {
437
+ return $.get(ajaxurl, data3, function (response) {
438
+ $table.parent().append(response);
439
+ });
440
+ });
441
+
442
+ ajax3.done(function () {
443
+
444
+ formPreview();
445
+ $("#add-field, #submit").removeAttr("disabled");
446
+
447
+ // Successfully added so show "Close" link
448
+ $("span.close-field").show();
449
+
450
+ $parent
451
+ // Reset temporary status
452
+ .removeData("status").removeAttr("data-status")
453
+ // update parent list item
454
+ .find(".custom-field-header a.field").html($fieldLabel.val()).end()
455
+ // update hidden [record_type] input
456
+ .find('input[name$="[record_type]"]').val(fieldClass);
457
+
458
+ });
459
+
460
+ });
461
+
462
+ /**
463
+ * ------------------------------------------------------------
464
+ * Functions
465
+ * ------------------------------------------------------------
466
+ */
467
+
468
+ function getCatCount() {
469
+ $.get(ajaxurl, {
470
+ 'action': 'wpmtst_get_cat_count',
471
+ 'security': wpmtstAdmin.ajax_nonce
472
+ },
473
+ function (response) {
474
+ catCount = parseInt(response);
475
+ });
476
+ }
477
+
478
+ // Preview
479
+ function formPreview() {
480
+ var formFields = $theForm.find("[name^='fields']");
481
+ if (!formFields.length) return;
482
+
483
+ var data = {
484
+ 'action': 'wpmtst_get_form_preview',
485
+ 'fields': formFields.serialize()
486
+ };
487
+ $.post(ajaxurl, data, function (response) {
488
+ var newDiv = $("<div></div>").hide().html(response)
489
+ $("#fields-editor-preview")
490
+ .children().first()
491
+ .after(newDiv)
492
+ .fadeOut(300, function () {
493
+ newDiv.show();
494
+ $(this).remove();
495
+ });
496
+ });
497
+ }
498
+
499
+ /*
500
+ * Disable any Post fields already in use.
501
+ *
502
+ * Doing this client-side so a Post field can be added
503
+ * but not saved before adding more fields;
504
+ * i.e. add multiple fields of either type without risk
505
+ * of duplicating single Post fields before clicking "Save".
506
+ */
507
+ function togglePostFields() {
508
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
509
+ var $parent = $(this).closest("li");
510
+ var value = $(this).val();
511
+ if ("post" === value) {
512
+ var name = $parent.find(".field-name").val();
513
+ $fieldList.find("select.field-type.new").find('option[value="' + name + '"]').attr("disabled", "disabled");
514
+ }
515
+ });
516
+ }
517
+
518
+ // Only allow one category field
519
+ function toggleCategoryFields() {
520
+ var categoryInUse = false;
521
+
522
+ $fieldList.find('input[name$="[record_type]"]').each(function () {
523
+ var $parent = $(this).closest("li");
524
+ var value = $(this).val();
525
+ if ('optional' === value) {
526
+ var fieldType = $parent.find('input[name$="[input_type]"]').val();
527
+ if (!categoryInUse) {
528
+ categoryInUse = ( 'category' === fieldType.split('-')[0] );
529
+ }
530
+ }
531
+ });
532
+
533
+ var $options = $fieldList.find('option[value^="category"]');
534
+ if (categoryInUse) {
535
+ $options.each(function () {
536
+ var text = $(this).text();
537
+ $(this)
538
+ .attr("disabled", "disabled")
539
+ .text(text + ' ' + wpmtstAdmin.inUse)
540
+ .data('origText', text);
541
+ });
542
+ }
543
+ else if (0 === catCount) {
544
+ $options.each(function () {
545
+ var text = $(this).text();
546
+ $(this)
547
+ .attr("disabled", "disabled")
548
+ .text(text + ' ' + wpmtstAdmin.noneFound)
549
+ .data('origText', text);
550
+ });
551
+ } else {
552
+ $options.each(function () {
553
+ $(this)
554
+ .removeAttr("disabled")
555
+ .text($(this).data('origText'));
556
+ });
557
+ }
558
+ }
559
+
560
+ // Actions on opening/closing the field
561
+ function toggleField($field) {
562
+ $field.replaceSelect()
563
+ .toggleClass("open")
564
+ .scrollUp()
565
+ .find("span.link")
566
+ .toggleClass("open")
567
+ .end()
568
+ .find(".custom-field")
569
+ .toggleClass("open")
570
+ .slideToggle()
571
+ .find(".first-field")
572
+ .focus();
573
+ }
574
+
575
+ // Build a unique name
576
+ function getUniqueName(fieldName, fieldIndex) {
577
+ fieldName = sanitizeName(fieldName);
578
+
579
+ // Get names of *other* fields
580
+ var names = $theForm.find("input.field-name").not(":eq(" + fieldIndex + ")").map(function () {
581
+ return this.value;
582
+ }).get();
583
+
584
+ names = names.filter(function (x) {
585
+ return (x !== (undefined || ''));
586
+ });
587
+
588
+ var uniqueName = fieldName;
589
+ var i = 2;
590
+
591
+ while ($.inArray(uniqueName, names) >= 1) {
592
+ uniqueName = fieldName + '_' + i++;
593
+ }
594
+ return uniqueName;
595
+ }
596
+
597
+ // Dismiss the "Fields saved" notice.
598
+ function dismissNotice() {
599
+ $('.wpmtst.notice').find(".notice-dismiss").click();
600
+ }
601
+
602
+ })(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/admin.js CHANGED
@@ -1,106 +1,106 @@
1
- /**
2
- * Strong Testimonials admin
3
- *
4
- * @namespace jQuery
5
- */
6
-
7
- // Function to get the Max value in Array
8
- Array.max = function (array) {
9
- return Math.max.apply(Math, array);
10
- };
11
-
12
- jQuery(document).ready(function ($) {
13
-
14
- // Convert "A String" to "a_string"
15
- function convertLabel (label) {
16
- return label.replace(/\s+/g, '_').replace(/\W/g, '').toLowerCase();
17
- }
18
-
19
- // Remove invalid characters
20
- function removeSpaces (word) {
21
- //return word.replace(/\s+/g, "_");
22
- return word.replace(/[^\w\s(?!\-)]/gi, '');
23
- }
24
-
25
- $.fn.showInlineBlock = function () {
26
- return this.css('display', 'inline-block');
27
- };
28
-
29
- /**
30
- * ----------------------------------------
31
- * General events
32
- * ----------------------------------------
33
- */
34
-
35
- // Add protocol if missing
36
- // Thanks http://stackoverflow.com/a/36429927/51600
37
- $('input[type=url]').change(function () {
38
- if (this.value.length && !/^https*:\/\//.test(this.value)) {
39
- this.value = 'http://' + this.value;
40
- }
41
- });
42
-
43
- $('ul.ui-tabs-nav li a').click(function () {
44
- $(this).blur();
45
- });
46
-
47
- $('.focus-next-field').change(function (e) {
48
- if ($(e.target).is(':checked')) {
49
- $(e.target).parent().next().find('input').focus().select();
50
- }
51
- });
52
-
53
- // toggle screenshots
54
- $('#toggle-screen-options').add('#screenshot-screen-options').click(function (e) {
55
- $(this).blur();
56
- $('#screenshot-screen-options').slideToggle();
57
- });
58
-
59
- // toggle screenshots
60
- $('#toggle-help').click(function (e) {
61
- $(this).toggleClass('closed open').blur();
62
- $('#help-section').slideToggle();
63
- });
64
-
65
- /**
66
- * ----------------------------------------
67
- * View List Table
68
- * ----------------------------------------
69
- */
70
-
71
- /**
72
- * Save sort order
73
- */
74
- $('table.wpm-testimonial_page_testimonial-views th.manage-column').on('click', function (e) {
75
- var columnName = $(this).attr('id');
76
- // get the opposite class
77
- var columnOrder = $(this).hasClass('asc') ? 'desc' : $(this).hasClass('desc') ? 'asc' : '';
78
- var data = {
79
- 'action': 'wpmtst_save_view_list_order',
80
- 'name': columnName,
81
- 'order': columnOrder
82
- };
83
- $.get(ajaxurl, data, function (response) {
84
- });
85
- });
86
-
87
- /**
88
- * Sticky views
89
- */
90
- $('table.wpm-testimonial_page_testimonial-views').on('click', '.stickit', function (e) {
91
- var icon = $(this);
92
- icon.closest('.wp-list-table-wrap').find('.overlay').fadeIn(200);
93
- icon.blur().toggleClass('stuck');
94
- var id = $(this).closest('tr').find('td.id').html();
95
- var data = {
96
- 'action': 'wpmtst_save_view_sticky',
97
- 'id': id
98
- };
99
- $.get(ajaxurl, data, function (response) {
100
- if (response) {
101
- window.location.reload();
102
- }
103
- });
104
- });
105
-
106
- });
1
+ /**
2
+ * Strong Testimonials admin
3
+ *
4
+ * @namespace jQuery
5
+ */
6
+
7
+ // Function to get the Max value in Array
8
+ Array.max = function (array) {
9
+ return Math.max.apply(Math, array);
10
+ };
11
+
12
+ jQuery(document).ready(function ($) {
13
+
14
+ // Convert "A String" to "a_string"
15
+ function convertLabel (label) {
16
+ return label.replace(/\s+/g, '_').replace(/\W/g, '').toLowerCase();
17
+ }
18
+
19
+ // Remove invalid characters
20
+ function removeSpaces (word) {
21
+ //return word.replace(/\s+/g, "_");
22
+ return word.replace(/[^\w\s(?!\-)]/gi, '');
23
+ }
24
+
25
+ $.fn.showInlineBlock = function () {
26
+ return this.css('display', 'inline-block');
27
+ };
28
+
29
+ /**
30
+ * ----------------------------------------
31
+ * General events
32
+ * ----------------------------------------
33
+ */
34
+
35
+ // Add protocol if missing
36
+ // Thanks http://stackoverflow.com/a/36429927/51600
37
+ $('input[type=url]').change(function () {
38
+ if (this.value.length && !/^https*:\/\//.test(this.value)) {
39
+ this.value = 'http://' + this.value;
40
+ }
41
+ });
42
+
43
+ $('ul.ui-tabs-nav li a').click(function () {
44
+ $(this).blur();
45
+ });
46
+
47
+ $('.focus-next-field').change(function (e) {
48
+ if ($(e.target).is(':checked')) {
49
+ $(e.target).parent().next().find('input').focus().select();
50
+ }
51
+ });
52
+
53
+ // toggle screenshots
54
+ $('#toggle-screen-options').add('#screenshot-screen-options').click(function (e) {
55
+ $(this).blur();
56
+ $('#screenshot-screen-options').slideToggle();
57
+ });
58
+
59
+ // toggle screenshots
60
+ $('#toggle-help').click(function (e) {
61
+ $(this).toggleClass('closed open').blur();
62
+ $('#help-section').slideToggle();
63
+ });
64
+
65
+ /**
66
+ * ----------------------------------------
67
+ * View List Table
68
+ * ----------------------------------------
69
+ */
70
+
71
+ /**
72
+ * Save sort order
73
+ */
74
+ $('table.wpm-testimonial_page_testimonial-views th.manage-column').on('click', function (e) {
75
+ var columnName = $(this).attr('id');
76
+ // get the opposite class
77
+ var columnOrder = $(this).hasClass('asc') ? 'desc' : $(this).hasClass('desc') ? 'asc' : '';
78
+ var data = {
79
+ 'action': 'wpmtst_save_view_list_order',
80
+ 'name': columnName,
81
+ 'order': columnOrder
82
+ };
83
+ $.get(ajaxurl, data, function (response) {
84
+ });
85
+ });
86
+
87
+ /**
88
+ * Sticky views
89
+ */
90
+ $('table.wpm-testimonial_page_testimonial-views').on('click', '.stickit', function (e) {
91
+ var icon = $(this);
92
+ icon.closest('.wp-list-table-wrap').find('.overlay').fadeIn(200);
93
+ icon.blur().toggleClass('stuck');
94
+ var id = $(this).closest('tr').find('td.id').html();
95
+ var data = {
96
+ 'action': 'wpmtst_save_view_sticky',
97
+ 'id': id
98
+ };
99
+ $.get(ajaxurl, data, function (response) {
100
+ if (response) {
101
+ window.location.reload();
102
+ }
103
+ });
104
+ });
105
+
106
+ });
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,1336 +1,1336 @@
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('.options').hide();
621
-
622
- templateRadioOn = templateRadios.filter(':checked');
623
- template = templateRadioOn.val();
624
- templateRadioOn.closest('li').addClass('current-selection').find('.options').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
- });
1057
-
1058
- // Show dependent inputs
1059
- $elParent.find('.field-dep').show();
1060
- }
1061
-
1062
- switch (fieldValue) {
1063
- // First, the immutables
1064
- case 'post_date':
1065
- case 'submit_date':
1066
- // Disable type selector
1067
- typeSelect.val('date').prop('disabled', true);
1068
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
1069
-
1070
- // add format field
1071
- data = {
1072
- 'action': 'wpmtst_view_add_field_date',
1073
- 'key': key,
1074
- };
1075
- $.get(ajaxurl, data, function (response) {
1076
- // Insert into placeholder div. Add hidden field because we are
1077
- // disabling the <select> so its value will not be submitted.
1078
- $elParent.find('.field-property-box').html(response); // .find("input").focus();
1079
- $el.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][type]" value="date">');
1080
- });
1081
- break;
1082
-
1083
- case 'link2':
1084
- case 'link':
1085
- // Get field name --> Get field label --> Populate link_text label
1086
- var fieldName = $elParent.find('.field-name').find('select').val();
1087
- var data2 = {
1088
- 'action': 'wpmtst_view_get_label',
1089
- 'name': fieldName,
1090
- };
1091
- $.get(ajaxurl, data2, function (response) {
1092
- var key = $elParent.attr('id').split('-').slice(-1)[0];
1093
- $('#view-fieldtext' + key + '-label').val(response);
1094
- });
1095
- break;
1096
-
1097
- case 'category':
1098
- $(typeSelect).val('category').prop('disabled', true);
1099
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
1100
- $elParent.find('.field-property-box').empty();
1101
- break;
1102
-
1103
- default:
1104
- // Special handling
1105
- if ('rating' === fieldType) {
1106
- typeSelect.val('rating').prop('disabled', true);
1107
- typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
1108
- $elParent.find('.field-property-box').empty();
1109
- break;
1110
- }
1111
-
1112
- $(typeSelect).val('text').prop('disabled', false);
1113
- // remove meta field
1114
- $elParent.find('.field-property-box').empty();
1115
- // remove the saved type that's only necessary when we disable the input (above)
1116
- $el.parent().find('input.save-type').remove();
1117
- }
1118
- });
1119
-
1120
- /**
1121
- * Delete a client field
1122
- */
1123
- customFieldList.on('click', 'span.delete', function (e) {
1124
- var thisField = $(this).closest('.field2');
1125
- var yesno = confirm('Remove this field?');
1126
- if (yesno) {
1127
- thisField.fadeOut(function () {
1128
- $(this).remove();
1129
- });
1130
- }
1131
- // Prevent click from expanding accordion
1132
- e.stopImmediatePropagation();
1133
- e.preventDefault();
1134
- });
1135
-
1136
- customFieldList.on('click', 'div.link', function (e) {
1137
- $(this)
1138
- .closest('.field2')
1139
- .toggleClass('open')
1140
- .find('.field-properties')
1141
- .slideToggle(100);
1142
- return false;
1143
- });
1144
-
1145
- /**
1146
- * Slider|Carousel change listener
1147
- */
1148
- var $sliderType = $('#view-slider_type');
1149
- var $effect = $('#view-effect');
1150
- var $position = $('view-slideshow_nav_position');
1151
-
1152
- var sliderTypeUpdate = function () {
1153
- if ($sliderType.val() === 'show_multiple') {
1154
- $effect.find('option[value=\'horizontal\']').prop('selected', true);
1155
- $position.find('option[value=\'outside\']').prop('selected', true);
1156
-
1157
- $sliderType.parent().siblings('.option-desc.singular').hide();
1158
- $sliderType.parent().siblings('.option-desc.plural').showInlineBlock();
1159
- } else {
1160
- $sliderType.parent().siblings('.option-desc.singular').showInlineBlock();
1161
- $sliderType.parent().siblings('.option-desc.plural').hide();
1162
- }
1163
-
1164
- $effect.change();
1165
- $position.change();
1166
- };
1167
-
1168
- sliderTypeUpdate();
1169
-
1170
- $sliderType.on('change', sliderTypeUpdate);
1171
-
1172
- /**
1173
- * MaxSlides change listener
1174
- */
1175
- var $maxSlides = $('[id^=\'view-max_slides\']');
1176
-
1177
- // Update display
1178
- var maxSlidesUpdateValue = function (el) {
1179
- var $el = $(el);
1180
- var maxSlidesValue = parseInt($el.val());
1181
- if (maxSlidesValue > 1) {
1182
- $el.parent().siblings('.option-desc.singular').hide();
1183
- $el.parent().siblings('.option-desc.plural').showInlineBlock();
1184
- } else {
1185
- $el.parent().siblings('.option-desc.singular').showInlineBlock();
1186
- $el.parent().siblings('.option-desc.plural').hide();
1187
- }
1188
- };
1189
-
1190
- // Initial display
1191
- $maxSlides.each( function (index, el) {
1192
- maxSlidesUpdateValue(el);
1193
- });
1194
-
1195
- // Update on change
1196
- var maxSlidesUpdate = function (e) {
1197
- maxSlidesUpdateValue( $(e.target) );
1198
- };
1199
-
1200
- // Event listener
1201
- $maxSlides.each( function (index, el) {
1202
- $(el).on('change', maxSlidesUpdate);
1203
- });
1204
-
1205
- /**
1206
- * MoveSlides change listener
1207
- */
1208
- var $moveSlides = $('[id^=\'view-move_slides\']');
1209
-
1210
- // Update display
1211
- var moveSlidesUpdateValue = function (el) {
1212
- var $el = $(el);
1213
- var moveSlidesValue = parseInt($el.val());
1214
- if (moveSlidesValue > 1) {
1215
- $el.parent().siblings('.option-desc.singular').hide();
1216
- $el.parent().siblings('.option-desc.plural').showInlineBlock();
1217
- } else {
1218
- $el.parent().siblings('.option-desc.singular').showInlineBlock();
1219
- $el.parent().siblings('.option-desc.plural').hide();
1220
- }
1221
- };
1222
-
1223
- // Initial display
1224
- $moveSlides.each( function (index, el) {
1225
- moveSlidesUpdateValue(el);
1226
- });
1227
-
1228
- // Update on change
1229
- var moveSlidesUpdate = function (e) {
1230
- moveSlidesUpdateValue( $(e.target) );
1231
- };
1232
-
1233
- // Event listener
1234
- $moveSlides.each( function (index, el) {
1235
- $(el).on('change', moveSlidesUpdate);
1236
- });
1237
-
1238
- /**
1239
- * Restore default breakpoints
1240
- */
1241
- $('#restore-default-breakpoints').click(function (e) {
1242
- var data = {
1243
- 'action': 'wpmtst_restore_default_breakpoints'
1244
- };
1245
-
1246
- $.get(ajaxurl, data, function (response) {
1247
-
1248
- var object = JSON.parse(response);
1249
- var targetId;
1250
- var el;
1251
-
1252
- for (var key in object) {
1253
-
1254
- if (object.hasOwnProperty(key)) {
1255
-
1256
- // width
1257
- targetId = 'view-breakpoint_' + key;
1258
- el = $('[id="' + targetId + '"]');
1259
- el.val(parseInt(object[key].width));
1260
-
1261
- // max_slides
1262
- targetId = 'view-max_slides_' + key;
1263
- el = $('[id="' + targetId + '"]');
1264
- el.val(parseInt(object[key].max_slides));
1265
-
1266
- // margin
1267
- targetId = 'view-margin_' + key;
1268
- el = $('[id="' + targetId + '"]');
1269
- el.val(parseInt(object[key].margin));
1270
-
1271
- // move_slides
1272
- targetId = 'view-move_slides_' + key;
1273
- el = $('[id="' + targetId + '"]');
1274
- el.val(parseInt(object[key].move_slides));
1275
-
1276
- }
1277
-
1278
- }
1279
-
1280
- document.getElementById('restored-message').classList.add('copied');
1281
- setTimeout(function () {
1282
- document.getElementById('restored-message').classList.remove('copied');
1283
- }, 2000);
1284
-
1285
- });
1286
- });
1287
-
1288
- })(jQuery);
1289
-
1290
- /**
1291
- * Click to copy to keyboard
1292
- * Thanks https://www.sitepoint.com/javascript-copy-to-clipboard/
1293
- */
1294
- (function () {
1295
-
1296
- 'use strict';
1297
-
1298
- // click events
1299
- document.body.addEventListener('click', copy, true);
1300
-
1301
- // event handler
1302
- function copy (e) {
1303
-
1304
- // find target element
1305
- var
1306
- t = e.target,
1307
- c = t.dataset.copytarget,
1308
- inp = (c ? document.querySelector(c) : null);
1309
-
1310
- // is element selectable?
1311
- if (inp && inp.select) {
1312
-
1313
- // select text
1314
- inp.select();
1315
-
1316
- try {
1317
- // copy text
1318
- document.execCommand('copy');
1319
- inp.blur();
1320
-
1321
- //t.classList.add('copied');
1322
- //setTimeout(function() { t.classList.remove('copied'); }, 1500);
1323
- document.getElementById('copy-message').classList.add('copied');
1324
- setTimeout(function () {
1325
- document.getElementById('copy-message').classList.remove('copied');
1326
- }, 2000);
1327
- }
1328
- catch (err) {
1329
- alert('Sorry, please press Ctrl/Cmd+C to copy instead.');
1330
- }
1331
-
1332
- }
1333
-
1334
- }
1335
-
1336
- })();
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('.options').hide();
621
+
622
+ templateRadioOn = templateRadios.filter(':checked');
623
+ template = templateRadioOn.val();
624
+ templateRadioOn.closest('li').addClass('current-selection').find('.options').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
+ });
1057
+
1058
+ // Show dependent inputs
1059
+ $elParent.find('.field-dep').show();
1060
+ }
1061
+
1062
+ switch (fieldValue) {
1063
+ // First, the immutables
1064
+ case 'post_date':
1065
+ case 'submit_date':
1066
+ // Disable type selector
1067
+ typeSelect.val('date').prop('disabled', true);
1068
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="date">');
1069
+
1070
+ // add format field
1071
+ data = {
1072
+ 'action': 'wpmtst_view_add_field_date',
1073
+ 'key': key,
1074
+ };
1075
+ $.get(ajaxurl, data, function (response) {
1076
+ // Insert into placeholder div. Add hidden field because we are
1077
+ // disabling the <select> so its value will not be submitted.
1078
+ $elParent.find('.field-property-box').html(response); // .find("input").focus();
1079
+ $el.parent().append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][type]" value="date">');
1080
+ });
1081
+ break;
1082
+
1083
+ case 'link2':
1084
+ case 'link':
1085
+ // Get field name --> Get field label --> Populate link_text label
1086
+ var fieldName = $elParent.find('.field-name').find('select').val();
1087
+ var data2 = {
1088
+ 'action': 'wpmtst_view_get_label',
1089
+ 'name': fieldName,
1090
+ };
1091
+ $.get(ajaxurl, data2, function (response) {
1092
+ var key = $elParent.attr('id').split('-').slice(-1)[0];
1093
+ $('#view-fieldtext' + key + '-label').val(response);
1094
+ });
1095
+ break;
1096
+
1097
+ case 'category':
1098
+ $(typeSelect).val('category').prop('disabled', true);
1099
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="category">');
1100
+ $elParent.find('.field-property-box').empty();
1101
+ break;
1102
+
1103
+ default:
1104
+ // Special handling
1105
+ if ('rating' === fieldType) {
1106
+ typeSelect.val('rating').prop('disabled', true);
1107
+ typeSelectParent.append('<input type="hidden" class="save-type" name="view[data][client_section][' + key + '][save-type]" value="rating">');
1108
+ $elParent.find('.field-property-box').empty();
1109
+ break;
1110
+ }
1111
+
1112
+ $(typeSelect).val('text').prop('disabled', false);
1113
+ // remove meta field
1114
+ $elParent.find('.field-property-box').empty();
1115
+ // remove the saved type that's only necessary when we disable the input (above)
1116
+ $el.parent().find('input.save-type').remove();
1117
+ }
1118
+ });
1119
+
1120
+ /**
1121
+ * Delete a client field
1122
+ */
1123
+ customFieldList.on('click', 'span.delete', function (e) {
1124
+ var thisField = $(this).closest('.field2');
1125
+ var yesno = confirm('Remove this field?');
1126
+ if (yesno) {
1127
+ thisField.fadeOut(function () {
1128
+ $(this).remove();
1129
+ });
1130
+ }
1131
+ // Prevent click from expanding accordion
1132
+ e.stopImmediatePropagation();
1133
+ e.preventDefault();
1134
+ });
1135
+
1136
+ customFieldList.on('click', 'div.link', function (e) {
1137
+ $(this)
1138
+ .closest('.field2')
1139
+ .toggleClass('open')
1140
+ .find('.field-properties')
1141
+ .slideToggle(100);
1142
+ return false;
1143
+ });
1144
+
1145
+ /**
1146
+ * Slider|Carousel change listener
1147
+ */
1148
+ var $sliderType = $('#view-slider_type');
1149
+ var $effect = $('#view-effect');
1150
+ var $position = $('view-slideshow_nav_position');
1151
+
1152
+ var sliderTypeUpdate = function () {
1153
+ if ($sliderType.val() === 'show_multiple') {
1154
+ $effect.find('option[value=\'horizontal\']').prop('selected', true);
1155
+ $position.find('option[value=\'outside\']').prop('selected', true);
1156
+
1157
+ $sliderType.parent().siblings('.option-desc.singular').hide();
1158
+ $sliderType.parent().siblings('.option-desc.plural').showInlineBlock();
1159
+ } else {
1160
+ $sliderType.parent().siblings('.option-desc.singular').showInlineBlock();
1161
+ $sliderType.parent().siblings('.option-desc.plural').hide();
1162
+ }
1163
+
1164
+ $effect.change();
1165
+ $position.change();
1166
+ };
1167
+
1168
+ sliderTypeUpdate();
1169
+
1170
+ $sliderType.on('change', sliderTypeUpdate);
1171
+
1172
+ /**
1173
+ * MaxSlides change listener
1174
+ */
1175
+ var $maxSlides = $('[id^=\'view-max_slides\']');
1176
+
1177
+ // Update display
1178
+ var maxSlidesUpdateValue = function (el) {
1179
+ var $el = $(el);
1180
+ var maxSlidesValue = parseInt($el.val());
1181
+ if (maxSlidesValue > 1) {
1182
+ $el.parent().siblings('.option-desc.singular').hide();
1183
+ $el.parent().siblings('.option-desc.plural').showInlineBlock();
1184
+ } else {
1185
+ $el.parent().siblings('.option-desc.singular').showInlineBlock();
1186
+ $el.parent().siblings('.option-desc.plural').hide();
1187
+ }
1188
+ };
1189
+
1190
+ // Initial display
1191
+ $maxSlides.each( function (index, el) {
1192
+ maxSlidesUpdateValue(el);
1193
+ });
1194
+
1195
+ // Update on change
1196
+ var maxSlidesUpdate = function (e) {
1197
+ maxSlidesUpdateValue( $(e.target) );
1198
+ };
1199
+
1200
+ // Event listener
1201
+ $maxSlides.each( function (index, el) {
1202
+ $(el).on('change', maxSlidesUpdate);
1203
+ });
1204
+
1205
+ /**
1206
+ * MoveSlides change listener
1207
+ */
1208
+ var $moveSlides = $('[id^=\'view-move_slides\']');
1209
+
1210
+ // Update display
1211
+ var moveSlidesUpdateValue = function (el) {
1212
+ var $el = $(el);
1213
+ var moveSlidesValue = parseInt($el.val());
1214
+ if (moveSlidesValue > 1) {
1215
+ $el.parent().siblings('.option-desc.singular').hide();
1216
+ $el.parent().siblings('.option-desc.plural').showInlineBlock();
1217
+ } else {
1218
+ $el.parent().siblings('.option-desc.singular').showInlineBlock();
1219
+ $el.parent().siblings('.option-desc.plural').hide();
1220
+ }
1221
+ };
1222
+
1223
+ // Initial display
1224
+ $moveSlides.each( function (index, el) {
1225
+ moveSlidesUpdateValue(el);
1226
+ });
1227
+
1228
+ // Update on change
1229
+ var moveSlidesUpdate = function (e) {
1230
+ moveSlidesUpdateValue( $(e.target) );
1231
+ };
1232
+
1233
+ // Event listener
1234
+ $moveSlides.each( function (index, el) {
1235
+ $(el).on('change', moveSlidesUpdate);
1236
+ });
1237
+
1238
+ /**
1239
+ * Restore default breakpoints
1240
+ */
1241
+ $('#restore-default-breakpoints').click(function (e) {
1242
+ var data = {
1243
+ 'action': 'wpmtst_restore_default_breakpoints'
1244
+ };
1245
+
1246
+ $.get(ajaxurl, data, function (response) {
1247
+
1248
+ var object = JSON.parse(response);
1249
+ var targetId;
1250
+ var el;
1251
+
1252
+ for (var key in object) {
1253
+
1254
+ if (object.hasOwnProperty(key)) {
1255
+
1256
+ // width
1257
+ targetId = 'view-breakpoint_' + key;
1258
+ el = $('[id="' + targetId + '"]');
1259
+ el.val(parseInt(object[key].width));
1260
+
1261
+ // max_slides
1262
+ targetId = 'view-max_slides_' + key;
1263
+ el = $('[id="' + targetId + '"]');
1264
+ el.val(parseInt(object[key].max_slides));
1265
+
1266
+ // margin
1267
+ targetId = 'view-margin_' + key;
1268
+ el = $('[id="' + targetId + '"]');
1269
+ el.val(parseInt(object[key].margin));
1270
+
1271
+ // move_slides
1272
+ targetId = 'view-move_slides_' + key;
1273
+ el = $('[id="' + targetId + '"]');
1274
+ el.val(parseInt(object[key].move_slides));
1275
+
1276
+ }
1277
+
1278
+ }
1279
+
1280
+ document.getElementById('restored-message').classList.add('copied');
1281
+ setTimeout(function () {
1282
+ document.getElementById('restored-message').classList.remove('copied');
1283
+ }, 2000);
1284
+
1285
+ });
1286
+ });
1287
+
1288
+ })(jQuery);
1289
+
1290
+ /**
1291
+ * Click to copy to keyboard
1292
+ * Thanks https://www.sitepoint.com/javascript-copy-to-clipboard/
1293
+ */
1294
+ (function () {
1295
+
1296
+ 'use strict';
1297
+
1298
+ // click events
1299
+ document.body.addEventListener('click', copy, true);
1300
+
1301
+ // event handler
1302
+ function copy (e) {
1303
+
1304
+ // find target element
1305
+ var
1306
+ t = e.target,
1307
+ c = t.dataset.copytarget,
1308
+ inp = (c ? document.querySelector(c) : null);
1309
+
1310
+ // is element selectable?
1311
+ if (inp && inp.select) {
1312
+
1313
+ // select text
1314
+ inp.select();
1315
+
1316
+ try {
1317
+ // copy text
1318
+ document.execCommand('copy');
1319
+ inp.blur();
1320
+
1321
+ //t.classList.add('copied');
1322
+ //setTimeout(function() { t.classList.remove('copied'); }, 1500);
1323
+ document.getElementById('copy-message').classList.add('copied');
1324
+ setTimeout(function () {
1325
+ document.getElementById('copy-message').classList.remove('copied');
1326
+ }, 2000);
1327
+ }
1328
+ catch (err) {
1329
+ alert('Sorry, please press Ctrl/Cmd+C to copy instead.');
1330
+ }
1331
+
1332
+ }
1333
+
1334
+ }
1335
+
1336
+ })();
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 _e( 'Delete' ); ?></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' ); ?></a></span>
10
+ <?php endif; ?>
11
+ <span class="close-field"><a href="#"><?php echo esc_html_x( '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 esc_html_e( 'click to open or close', 'strong-testimonials' ); ?>">
9
+ <a class="field" href="#"><?php echo esc_html( $field_link ); ?></a>
10
+ <span class="handle" title="<?php esc_html_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 echo esc_html_x( 'Label', 'noun', 'strong-testimonials' ); ?></th>
8
+ <td>
9
+ <input class="field-label" type="text" name="fields[<?php echo esc_attr( $key ); ?>][label]" value="<?php echo esc_attr( $field['label'] ); ?>">
10
+ <label>
11
+ <input type="checkbox" name="fields[<?php echo esc_attr( $key ); ?>][show_label]" <?php checked( $field['show_label'], true ); ?>>
12
+ <span class="help inline"><?php esc_html_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,23 @@
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 echo esc_html_x( 'Name', 'noun', 'strong-testimonials' ); ?></th>
10
+ <td>
11
+ <?php
12
+ // Field names for certain types are read-only.
13
+ if ( $field['name_mutable'] ) :
14
+ ?>
15
+ <input class="field-name" type="text" name="fields[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo isset( $field['name'] ) ? esc_attr( $field['name'] ) : ''; ?>">
16
+ <span class="help field-name-help"><?php esc_html_e( 'Use only lowercase letters, numbers, and underscores.', 'strong-testimonials' ); ?></span>
17
+ <span class="help field-name-help important"><?php esc_html_e( 'Cannot be "name" or "date".', 'strong-testimonials' ); ?></span>
18
+ <?php else : ?>
19
+ <input class="field-name" type="text" value="<?php echo esc_attr( $field['name'] ); ?>" disabled="disabled">
20
+ <input type="hidden" name="fields[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo esc_attr( $field['name'] ); ?>">
21
+ <?php endif ?>
22
+ </td>
23
+ </tr>
admin/partials/fields/field-text.php CHANGED
@@ -1,14 +1,11 @@
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 echo esc_html_x( 'Text', 'noun', 'strong-testimonials' ); ?></th>
8
+ <td>
9
+ <input type="text" class="field-label" name="fields[<?php echo esc_attr( $key ); ?>][text]" value="<?php echo esc_attr( $field['text'] ); ?>" placeholder="<?php esc_html_e( 'next to the checkbox', 'strong-testimonials' ); ?>">
10
+ </td>
11
+ </tr>
 
 
 
admin/partials/fields/field-type.php CHANGED
@@ -1,75 +1,74 @@
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 else : ?>
46
-
47
- <?php
48
- if ( 'post' == $field['record_type'] ) {
49
- foreach ( $field_types['post'] as $field_key => $field_parts ) {
50
- // compare field *name*
51
- if ( $field['name'] == $field_key )
52
- echo $field_parts['option_label'];
53
- }
54
- }
55
- elseif ( 'custom' == $field['record_type'] ) {
56
- foreach ( $field_types['custom'] as $field_key => $field_parts ) {
57
- // compare field *type*
58
- if ( $field['input_type'] == $field_key ) {
59
- echo $field_parts['option_label'];
60
- }
61
- }
62
- }
63
- elseif ( 'optional' == $field['record_type'] ) {
64
- foreach ( $field_types['optional'] as $field_key => $field_parts ) {
65
- // compare field *type*
66
- if ( $field['input_type'] == $field_key ) {
67
- echo $field_parts['option_label'];
68
- }
69
- }
70
- }
71
-
72
- endif; // editing
73
- ?>
74
- </td>
75
- </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 echo esc_html_x( '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 esc_attr( $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 esc_attr_e( 'Post Fields', 'strong-testimonials' ); ?>">
21
+ <?php foreach ( $field_types['post'] as $field_key => $field_parts ) : ?>
22
+ <option value="<?php echo esc_attr( $field_key ); ?>"><?php echo esc_html( $field_parts['option_label'] ); ?></option>
23
+ <?php endforeach; ?>
24
+ </optgroup>
25
+
26
+ <?php /* Custom fields */ ?>
27
+ <optgroup class="custom" label="<?php esc_attr_e( 'Custom Fields', 'strong-testimonials' ); ?>">
28
+ <?php foreach ( $field_types['custom'] as $field_key => $field_parts ) : ?>
29
+ <option value="<?php echo esc_attr( $field_key ); ?>"><?php echo esc_html( $field_parts['option_label'] ); ?></option>
30
+ <?php endforeach; ?>
31
+ </optgroup>
32
+
33
+ <?php /* Special fields */ ?>
34
+ <optgroup class="optional" label="<?php esc_attr_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="' . esc_attr( $field_parts['name'] ) . '"' : ''; ?>
37
+ <option value="<?php echo esc_attr( $field_key ); ?>"<?php echo $data; ?>><?php echo esc_html( $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 esc_html_e( 'Select a field type or delete this field.', 'strong-testimonials' ); ?></span>
44
+
45
+ <?php else : ?>
46
+
47
+ <?php
48
+ if ( 'post' == $field['record_type'] ) {
49
+ foreach ( $field_types['post'] as $field_key => $field_parts ) {
50
+ // compare field *name*
51
+ if ( $field['name'] == $field_key ) {
52
+ echo wp_kses_post( $field_parts['option_label'] );
53
+ }
54
+ }
55
+ } elseif ( 'custom' == $field['record_type'] ) {
56
+ foreach ( $field_types['custom'] as $field_key => $field_parts ) {
57
+ // compare field *type*
58
+ if ( $field['input_type'] == $field_key ) {
59
+ echo wp_kses_post( $field_parts['option_label'] );
60
+ }
61
+ }
62
+ } elseif ( 'optional' == $field['record_type'] ) {
63
+ foreach ( $field_types['optional'] as $field_key => $field_parts ) {
64
+ // compare field *type*
65
+ if ( $field['input_type'] == $field_key ) {
66
+ echo wp_kses_post( $field_parts['option_label'] );
67
+ }
68
+ }
69
+ }
70
+
71
+ endif; // editing
72
+ ?>
73
+ </td>
74
+ </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 esc_html_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 require '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 esc_html_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 require 'option-pagination.php'; ?>
19
+ </tr>
20
+ <tr class="then then_display then_not_form then_slideshow read-more" style="display: none;">
21
+ <?php require '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 esc_html_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 require '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 require '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 require '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 require '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 esc_html_e( 'Actions', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr>
18
+ <?php require 'option-form-category.php'; ?>
19
+ </tr>
20
+ <tr>
21
+ <?php require '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 _e( 'Help' ); ?></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 // TODO Add hook here ?>
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 esc_html_e( 'Query', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr class="subheading">
18
+ <td><?php esc_html_e( 'Option', 'strong-testimonials' ); ?></td>
19
+ <td><?php esc_html_e( 'Setting', 'strong-testimonials' ); ?></td>
20
+ <td class="divider" colspan="2">
21
+ <?php esc_html_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' ); ?></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 require 'option-select.php'; ?>
32
+ </tr>
33
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
34
+ <?php require 'option-category.php'; ?>
35
+ </tr>
36
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
37
+ <?php require 'option-order.php'; ?>
38
+ </tr>
39
+ <tr class="then then_slideshow then_not_single then_multiple" style="display: none;">
40
+ <?php require 'option-limit.php'; ?>
41
+ </tr>
42
+ <?php // TODO Add hook here ?>
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 esc_html_e( 'Slideshow', 'strong-testimonials' ); ?>
15
+ </h3>
16
+ <table class="form-table multiple group-select">
17
+ <tr>
18
+ <?php require 'option-slideshow-num.php'; ?>
19
+ </tr>
20
+ <tr>
21
+ <?php require 'option-slideshow-transition.php'; ?>
22
+ </tr>
23
+ <tr>
24
+ <?php require 'option-slideshow-behavior.php'; ?>
25
+ </tr>
26
+ <tr>
27
+ <?php require '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 esc_html_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
+ require '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
+ require '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 require '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 require '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 require '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 require '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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_html_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 esc_attr( $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 esc_html_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 esc_attr( $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 esc_html_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 esc_attr( $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="' . esc_attr( $key ) . '" ' . selected( $current_preset, $key, false ) . '>' . esc_html( $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 esc_html_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 esc_html_e( 'yes', 'strong-testimonials' ); ?>
12
+ </option>
13
+ <option value="no" <?php selected( 'no', $view['option'] ); ?>>
14
+ <?php esc_html_e( 'no', 'strong-testimonials' ); ?>
15
+ </option>
16
+ <option value="maybe" <?php selected( 'maybe', $view['option'] ); ?>>
17
+ <?php esc_html_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 esc_html_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 esc_html_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 esc_html_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 _e( '<code>category</code>', 'strong-testimonials' ); ?></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 _e( '<code>category="accounting"</code>', 'strong-testimonials' ); ?></p>
56
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-category-select">
4
+ <?php esc_html_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 esc_html_e( 'all', 'strong-testimonials' ); ?></option>
15
+ <option value="somecats" <?php echo( 'all' != $view['category'] ? 'selected' : '' ); ?>><?php echo esc_html_x( '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 esc_html_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( _e( '<code>category</code>', 'strong-testimonials' ) ); ?></p>
50
+ </td>
51
+ <td>
52
+ <p><?php echo wp_kses_post( _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( _e( '<code>category="accounting"</code>', 'strong-testimonials' ) ); ?></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 esc_html_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 esc_attr( $view['class'] ); ?>">
9
+ <p class="inline description tall">
10
+ <?php esc_html_e( 'For advanced users.', 'strong-testimonials' ); ?>
11
+ <?php esc_html_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,25 @@
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 esc_html_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" type="button" name="add-field" value="<?php esc_attr_e( 'Add Field', 'strong-testimonials' ); ?>" class="button-secondary" />
23
+ </div>
24
+
25
+ </td>
 
 
 
 
admin/partials/views/option-color.php CHANGED
@@ -1,57 +1,47 @@
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 esc_html_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" id="fc-none" name="view[data][font-color][type]" value="" <?php checked( $view['font-color']['type'], '' ); ?>>
11
+ <label for="fc-none">
12
+ <?php esc_html_e( 'inherit from theme', 'strong-testimonials' ); ?>
13
+ </label>
14
+ </li>
15
+ <li>
16
+ <input type="radio" id="fc-custom" name="view[data][font-color][type]" value="custom" <?php checked( $view['font-color']['type'], 'custom' ); ?>>
17
+ <label for="fc-custom">
18
+ <?php esc_html_e( 'custom', 'strong-testimonials' ); ?>
19
+ </label>
20
+ </li>
21
+ </ul>
22
+ </div>
23
+
24
+ <div class="radio-description" id="view-font-color-info">
25
+ <div class="font-color-description fc-none">
26
+ <div class="description-inner options">
27
+ <div>
28
+ <?php esc_html_e( 'No options', 'strong-testimonials' ); ?>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="font-color-description fc-custom">
34
+ <div class="description-inner options">
35
+ <div>
36
+ <label>
37
+ <input type="text" id="fc-color" name="view[data][font-color][color]" value="<?php echo esc_attr( $view['font-color']['color'] ); ?>" class="wp-color-picker-field">
38
+ </label>
39
+ </div>
40
+ </div>
41
+
42
+ </div>
43
+
44
+ </div>
45
+
46
+ </div>
47
+ </td>
 
 
 
 
 
 
 
 
 
 
admin/partials/views/option-content.php CHANGED
@@ -1,217 +1,217 @@
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 printf( __( '<a href="%s" target="_blank">Learn more about WordPress excerpts</a>', 'strong-testimonials' ), esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ) ); ?>
214
- </p>
215
- </div>
216
-
217
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-content">
4
+ <?php esc_html_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 echo esc_html_x( 'entire content', 'display setting', 'strong-testimonials' ); ?>
18
+ </option>
19
+ <option value="truncated" <?php selected( 'truncated', $view['content'] ); ?>>
20
+ <?php echo esc_html_x( 'automatic excerpt', 'display setting', 'strong-testimonials' ); ?>
21
+ </option>
22
+ <option value="excerpt" <?php selected( 'excerpt', $view['content'] ); ?>>
23
+ <?php echo esc_html_x( '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 esc_html_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 echo wp_kses_post( 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 esc_url( 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 esc_html_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 echo esc_html_x( 'default length', 'display setting', 'strong-testimonials' ); ?>
64
+ </option>
65
+ <option value="0" <?php selected( ! $view['use_default_length'] ); ?>>
66
+ <?php echo esc_html_x( '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 esc_html_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( esc_html_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="' . esc_attr( $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 echo wp_kses_post( _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 esc_html_e( 'the full testimonial', 'strong-testimonials' ); ?>
108
+ </option>
109
+ <option value="1" <?php selected( $view['more_post_in_place'] ); ?>>
110
+ <?php esc_html_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 esc_html_e( 'with an ellipsis', 'strong-testimonials' ); ?>
127
+ </option>
128
+ <option value="0" <?php selected( ! $view['more_post_ellipsis'] ); ?>>
129
+ <?php esc_html_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 esc_html_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 esc_html_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 echo esc_html_x( 'with default link text', 'display setting', 'strong-testimonials' ); ?>
154
+ </option>
155
+ <option value="0" <?php selected( ! $view['use_default_more'] ); ?>>
156
+ <?php echo esc_html_x( '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 echo wp_kses_post( _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 esc_attr( $view['more_post_text'] ); ?>" size="22"
170
+ placeholder="<?php esc_attr_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 esc_html_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 esc_attr( $view['less_post_text'] ); ?>" size="22"
186
+ placeholder="<?php esc_attr_e( 'enter a phrase', 'strong-testimonials' ); ?>">
187
+ </label>
188
+ </span>
189
+ <p class="inline description"><?php esc_html_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 echo esc_html_x( 'for automatic excerpt only', 'display setting', 'strong-testimonials' ); ?>
200
+ </option>
201
+ <option value="1" <?php selected( $view['more_full_post'], 1 ); ?>>
202
+ <?php echo esc_html_x( '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 echo wp_kses_post( printf( __( '<a href="%s" target="_blank">Learn more about WordPress excerpts</a>', 'strong-testimonials' ), esc_url( 'http://buildwpyourself.com/wordpress-manual-excerpts-more-tag/' ) ) ); ?>
214
+ </p>
215
+ </div>
216
+
217
+ </td>
admin/partials/views/option-divi.php CHANGED
@@ -1,24 +1,23 @@
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 esc_html_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" name="view[data][divi_builder]" value="1" <?php checked( $view['divi_builder'] ); ?>/>
12
+ <label for="view-divi_builder">
13
+ <?php esc_html_e( 'Check this if adding this view (via shortcode or widget) using the Visual Builder in Divi Builder version 2.', 'strong-testimonials' ); ?>
14
+ </label>
15
+ <p class="description short">
16
+ <?php esc_html_e( 'Not required if simply adding this view in the default editor.', 'strong-testimonials' ); ?>
17
+ </p>
18
+ <p class="description short">
19
+ <?php esc_html_e( 'Not required if simply adding this view in the Divi theme using either the default editor or Divi Builder.', 'strong-testimonials' ); ?>
20
+ </p>
21
+ </div>
22
+ </div>
23
+ </td>
 
admin/partials/views/option-form-ajax.php CHANGED
@@ -1,13 +1,12 @@
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" name="view[data][form_ajax]" value="1" <?php checked( $view['form_ajax'] ); ?>>
4
+ <label for="view-form_ajax">
5
+ <?php esc_html_e( 'Submit form without reloading the page (Ajax)', 'strong-testimonials' ); ?>
6
+ </label>
7
+ </th>
8
+ <td>
9
+ <p class="description tall">
10
+ <?php esc_html_e( 'This will override the Success Redirect setting.', 'strong-testimonials' ); ?>
11
+ </p>
12
+ </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 esc_html_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 esc_html_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;' ); ?></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;' ); ?></option>
8
+ <?php foreach ( $testimonials_list as $post ) : ?>
9
+ <option value="<?php echo esc_attr( $post->ID ); ?>" <?php selected( $view['id'], $post->ID ); ?>>
10
+ <?php echo $post->post_title ? esc_html( $post->post_title ) : esc_html__( '(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 echo esc_html_x( '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,146 @@
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 esc_html_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" id="view-layout-normal" name="view[data][layout]" value="" <?php checked( false, $view['layout'] ); ?>>
12
+ <label for="view-layout-normal">
13
+ <?php esc_html_e( 'normal', 'strong-testimonials' ); ?>
14
+ </label>
15
+ </li>
16
+ <li>
17
+ <input type="radio"
18
+ id="view-layout-masonry"
19
+ name="view[data][layout]"
20
+ value="masonry" <?php checked( 'masonry', $view['layout'] ); ?>>
21
+ <label for="view-layout-masonry">
22
+ <?php esc_html_e( 'Masonry', 'strong-testimonials' ); ?>
23
+ </label>
24
+ </li>
25
+ <li>
26
+ <input type="radio"
27
+ id="view-layout-columns"
28
+ name="view[data][layout]"
29
+ value="columns" <?php checked( 'columns', $view['layout'] ); ?>>
30
+ <label for="view-layout-columns">
31
+ <?php esc_html_e( 'columns', 'strong-testimonials' ); ?>
32
+ </label>
33
+ </li>
34
+ <li>
35
+ <input type="radio"
36
+ id="view-layout-grid"
37
+ name="view[data][layout]"
38
+ value="grid" <?php checked( 'grid', $view['layout'] ); ?>>
39
+ <label for="view-layout-grid">
40
+ <?php esc_html_e( 'grid', 'strong-testimonials' ); ?>
41
+ </label>
42
+ </li>
43
+ </ul>
44
+ </div>
45
+
46
+ <!-- Layout Info -->
47
+ <div>
48
+ <div class="radio-description" id="view-layout-info">
49
+
50
+ <div class="layout-description view-layout-normal">
51
+ <p><?php esc_html_e( 'A single column.', 'strong-testimonials' ); ?></p>
52
+ </div>
53
+
54
+ <div class="layout-description view-layout-masonry">
55
+ <p><?php echo wp_kses_post( 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>
56
+ <p><?php esc_html_e( 'The universal solution that works well regardless of testimonial lengths.', 'strong-testimonials' ); ?></p>
57
+ <p><?php esc_html_e( 'Not compatible with pagination.', 'strong-testimonials' ); ?></p>
58
+ </div>
59
+
60
+ <div class="layout-description view-layout-columns">
61
+ <p><?php echo wp_kses_post( 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>
62
+ <p><?php esc_html_e( 'Works well with both long and short testimonials.', 'strong-testimonials' ); ?></p>
63
+ <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
64
+ </div>
65
+
66
+ <div class="layout-description view-layout-grid">
67
+ <p>
68
+ <?php
69
+ $url = 'https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties';
70
+ echo wp_kses_post( printf( __( 'Using <a href="%s" target="_blank">CSS flexbox</a>.', 'strong-testimonials' ), esc_url( $url ) ) );
71
+ ?>
72
+ </p>
73
+ <p><?php esc_html_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>
74
+ <p><?php esc_html_e( 'Compatible with pagination.', 'strong-testimonials' ); ?></p>
75
+ </div>
76
+
77
+ </div>
78
+
79
+ <!-- Column selector -->
80
+ <div class="radio-description options" id="column-count-wrapper">
81
+ <div>
82
+ <label for="view-column-count"><?php esc_html_e( 'Number of columns', 'strong-testimonials' ); ?></label>
83
+ <select id="view-column-count" name="view[data][column_count]">
84
+ <option value="2" <?php selected( $view['column_count'], 2 ); ?>>2</option>
85
+ <option value="3" <?php selected( $view['column_count'], 3 ); ?>>3</option>
86
+ <option value="4" <?php selected( $view['column_count'], 4 ); ?>>4</option>
87
+ </select>
88
+ </div>
89
+ </div>
90
+ </div>
91
+
92
+ <!-- Examples -->
93
+ <div>
94
+ <div class="layout-example view-layout-normal">
95
+ <div class="example-container">
96
+ <div class="box"><span>1</span></div>
97
+ <div class="box size2"><span>2</span></div>
98
+ <div class="box"><span>3</span></div>
99
+ <div class="box size2"><span>4</span></div>
100
+ <div class="box"><span>5</span></div>
101
+ </div>
102
+ </div>
103
+ <div class="layout-example view-layout-masonry">
104
+ <div class="example-container col-2">
105
+ <div class="grid-sizer"></div>
106
+ <div class="box"><span>1</span></div>
107
+ <div class="box size2"><span>2</span></div>
108
+ <div class="box"><span>3</span></div>
109
+ <div class="box size3"><span>4</span></div>
110
+ <div class="box"><span>5</span></div>
111
+ <div class="box size2"><span>6</span></div>
112
+ <div class="box"><span>7</span></div>
113
+ <div class="box size3"><span>8</span></div>
114
+ <div class="box"><span>9</span></div>
115
+ </div>
116
+ </div>
117
+ <div class="layout-example view-layout-columns">
118
+ <div class="example-container col-2">
119
+ <div class="box"><span>1</span></div>
120
+ <div class="box size2"><span>2</span></div>
121
+ <div class="box"><span>3</span></div>
122
+ <div class="box size3"><span>4</span></div>
123
+ <div class="box"><span>5</span></div>
124
+ <div class="box size2"><span>6</span></div>
125
+ <div class="box"><span>7</span></div>
126
+ <div class="box size3"><span>8</span></div>
127
+ <div class="box"><span>9</span></div>
128
+ </div>
129
+ </div>
130
+ <div class="layout-example view-layout-grid">
131
+ <div class="example-container col-2">
132
+ <div class="box"><span>1</span></div>
133
+ <div class="box"><span>2</span></div>
134
+ <div class="box"><span>3</span></div>
135
+ <div class="box"><span>4</span></div>
136
+ <div class="box"><span>5</span></div>
137
+ <div class="box"><span>6</span></div>
138
+ <div class="box"><span>7</span></div>
139
+ <div class="box"><span>8</span></div>
140
+ <div class="box"><span>9</span></div>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+ </div>
146
+ </td>
 
admin/partials/views/option-limit.php CHANGED
@@ -1,33 +1,31 @@
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 _e( '<code>count</code>', 'strong-testimonials' ); ?></p>
29
- </td>
30
- <td></td>
31
- <td>
32
- <p><?php _e( '<code>count=5</code>', 'strong-testimonials' ); ?></p>
33
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-all">
4
+ <?php esc_html_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 esc_html_e( 'all', 'strong-testimonials' ); ?>
13
+ </option>
14
+ <option class="trip" value="0" <?php selected( $view['count'] > 0 ); ?>>
15
+ <?php echo esc_html_x( 'count', 'noun', 'strong-testimonials' ); ?>
16
+ </option>
17
+ </select>
18
+ &nbsp;
19
+ <label>
20
+ <input class="input-incremental then_all" type="number" id="view-count" name="view[data][count]" value="<?php echo ( -1 == $view['count'] ) ? 1 : esc_attr( $view['count'] ); ?>" min="1" size="5" style="display: none;">
21
+ </label>
22
+ </div>
23
+ </div>
24
+ </td>
25
+ <td class="divider">
26
+ <p><?php echo wp_kses_post( _e( '<code>count</code>', 'strong-testimonials' ) ); ?></p>
27
+ </td>
28
+ <td></td>
29
+ <td>
30
+ <p><?php echo wp_kses_post( _e( '<code>count=5</code>', 'strong-testimonials' ) ); ?></p>
31
+ </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 _e( '<code>order</code>', 'strong-testimonials' ); ?></p>
20
- </td>
21
- <td>
22
- <p><?php _e( 'oldest | newest | random | menu_order', 'strong-testimonials' ); ?></p>
23
- </td>
24
- <td>
25
- <p><?php _e( '<code>order="random"</code>', 'strong-testimonials' ); ?></p>
26
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-order">
4
+ <?php echo esc_html_x( '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 esc_attr( $order ); ?>" <?php selected( $order, $view['order'] ); ?>><?php echo esc_html( $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( _e( '<code>order</code>', 'strong-testimonials' ) ); ?></p>
20
+ </td>
21
+ <td>
22
+ <p><?php echo wp_kses_post( _e( 'oldest | newest | random | menu_order', 'strong-testimonials' ) ); ?></p>
23
+ </td>
24
+ <td>
25
+ <p><?php echo wp_kses_post( _e( '<code>order="random"</code>', 'strong-testimonials' ) ); ?></p>
26
+ </td>
admin/partials/views/option-pagination.php CHANGED
@@ -1,167 +1,145 @@
1
- <?php
2
- $links = '<span class="help-links">';
3
- $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help' ) . '</a>';
4
- $links .= ' | ';
5
- $links .= '<a href="https://strongplugins.com/document/strong-testimonials/pagination-methods/" target="_blank">' . __( 'Compare methods', 'strong-testimonials' ) . '</a>';
6
- $links .= '</span>';
7
- ?>
8
- <?php /* translators: On the Views admin screen. */ ?>
9
- <th>
10
- <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
11
- type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
12
- <label for="view-pagination">
13
- <?php _e( 'Pagination', 'strong-testimonials' ); ?>
14
- </label>
15
- </th>
16
- <td>
17
- <div class="row then then_pagination" style="display: none;">
18
- <div class="row-inner">
19
- <div class="inline">
20
- <label for="view-pagination_type">
21
- <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
22
- <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
23
- <?php _e( 'simple', 'strong-testimonials' ); ?>
24
- </option>
25
- <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
26
- <?php _e( 'WordPress standard', 'strong-testimonials' ); ?>
27
- </option>
28
- </select>
29
- </label>
30
- </div>
31
- <div class="inline then fast then_simple then_not_standard" style="display: none;">
32
- <p class="description">
33
- <?php _e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
34
- <?php echo $links; ?>
35
- </p>
36
- </div>
37
- <div class="inline then fast then_not_simple then_standard" style="display: none;">
38
- <p class="description">
39
- <?php _e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
40
- <?php echo $links; ?>
41
- </p>
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <div class="row then then_pagination" style="display: none;">
47
- <div class="row-inner">
48
- <div class="inline">
49
- <label for="view-per_page">
50
- <?php _ex( 'Per page', 'quantity', 'strong-testimonials' ); ?>
51
- </label>
52
- <input class="input-incremental" id="view-per_page"
53
- name="view[data][pagination_settings][per_page]"
54
- type="number" min="1" step="1"
55
- value="<?php echo $view['pagination_settings']['per_page']; ?>"/>
56
- </div>
57
-
58
- <div class="inline">
59
- <label for="view-nav">
60
- <?php _e( 'Navigation', 'strong-testimonials' ); ?>
61
- </label>
62
- <select id="view-nav" name="view[data][pagination_settings][nav]">
63
- <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
64
- <?php _e( 'before', 'strong-testimonials' ); ?>
65
- </option>
66
- <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
67
- <?php _e( 'after', 'strong-testimonials' ); ?>
68
- </option>
69
- <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
70
- <?php _e( 'before & after', 'strong-testimonials' ); ?>
71
- </option>
72
- </select>
73
- </div>
74
- </div>
75
-
76
- <div class="row then then_not_simple then_standard" style="display: none;">
77
- <div class="row-inner">
78
- <div class="inline">
79
- <label for="view-pagination-show_all">
80
- <select class="if select" id="view-pagination-show_all"
81
- name="view[data][pagination_settings][show_all]">
82
- <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
83
- <?php _e( 'Show all page numbers', 'strong-testimonials' ); ?>
84
- </option>
85
- <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?>
86
- class="trip">
87
- <?php _e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
88
- </option>
89
- </select>
90
- </label>
91
- </div>
92
- <div class="inline then then_show_all" style="display: none;">
93
- <div class="inline">
94
- <label for="view-pagination-end_size">
95
- <?php _ex( 'End size', 'quantity', 'strong-testimonials' ); ?>
96
- </label>
97
- <input class="input-incremental" id="view-pagination-end_size"
98
- name="view[data][pagination_settings][end_size]"
99
- type="number" min="1" step="1"
100
- value="<?php echo $view['pagination_settings']['end_size']; ?>"/>
101
- </div>
102
- <div class="inline">
103
- <label for="view-pagination-mid_size">
104
- <?php _ex( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
105
- </label>
106
- <input class="input-incremental" id="view-pagination-mid_size"
107
- name="view[data][pagination_settings][mid_size]"
108
- type="number" min="1" step="1"
109
- value="<?php echo $view['pagination_settings']['mid_size']; ?>"/>
110
- </div>
111
- </div>
112
- </div>
113
- </div>
114
-
115
- <div class="row then then_not_simple then_standard" style="display: none;">
116
- <div class="row-inner">
117
- <div class="inline inline-middle">
118
- <input class="if toggle checkbox" id="view-pagination-prev_next"
119
- name="view[data][pagination_settings][prev_next]"
120
- type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
121
- <label for="view-pagination-prev_next">
122
- <?php _e( 'Show previous/next links', 'strong-testimonials' ); ?>
123
- </label>
124
- </div>
125
- <div class="then then_prev_next inline inline-middle">
126
- <label for="view-pagination-prev_text">
127
- <?php _e( 'Previous text', 'strong-testimonials' ); ?>
128
- </label>
129
- <input class="code" id="view-pagination-prev_text"
130
- name="view[data][pagination_settings][prev_text]"
131
- type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
132
- </div>
133
- <div class="then then_prev_next inline inline-middle">
134
- <label for="view-pagination-next_text">
135
- <?php _e( 'Next text', 'strong-testimonials' ); ?>
136
- </label>
137
- <input class="code" id="view-pagination-next_text"
138
- name="view[data][pagination_settings][next_text]"
139
- type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
140
- </div>
141
- </div>
142
- </div>
143
-
144
- <div class="row then then_not_simple then_standard" style="display: none;">
145
- <div class="row-inner">
146
- <div class="inline">
147
- <label for="view-pagination-before_page_number">
148
- <?php _e( 'Before page number', 'strong-testimonials' ); ?>
149
- </label>
150
- <input class="small-text" id="view-pagination-before_page_number"
151
- name="view[data][pagination_settings][before_page_number]"
152
- type="text" value="<?php echo $view['pagination_settings']['before_page_number']; ?>">
153
- </div>
154
- <div class="inline">
155
- <label for="view-pagination-after_page_number">
156
- <?php _e( 'After page number', 'strong-testimonials' ); ?>
157
- </label>
158
- <input class="small-text" id="view-pagination-after_page_number"
159
- name="view[data][pagination_settings][after_page_number]"
160
- type="text" value="<?php echo $view['pagination_settings']['after_page_number']; ?>">
161
- </div>
162
- </div>
163
- </div>
164
- </div>
165
-
166
- <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
167
- </td>
1
+ <?php
2
+ $links = '<span class="help-links">';
3
+ $links .= '<a href="#tab-panel-wpmtst-help-pagination" class="open-help-tab">' . __( 'Help' ) . '</a>';
4
+ $links .= '</span>';
5
+ ?>
6
+ <?php /* translators: On the Views admin screen. */ ?>
7
+ <th>
8
+ <input class="if toggle checkbox" id="view-pagination" name="view[data][pagination]"
9
+ type="checkbox" value="1" <?php checked( $view['pagination'] ); ?>/>
10
+ <label for="view-pagination">
11
+ <?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?>
12
+ </label>
13
+ </th>
14
+ <td>
15
+ <div class="row then then_pagination" style="display: none;">
16
+ <div class="row-inner">
17
+ <div class="inline">
18
+ <label for="view-pagination_type">
19
+ <select class="if selectper" id="view-pagination_type" name="view[data][pagination_settings][type]">
20
+ <option value="simple" <?php selected( 'simple', $view['pagination_settings']['type'] ); ?>>
21
+ <?php esc_html_e( 'simple', 'strong-testimonials' ); ?>
22
+ </option>
23
+ <option value="standard" <?php selected( 'standard', $view['pagination_settings']['type'] ); ?>>
24
+ <?php esc_html_e( 'WordPress standard', 'strong-testimonials' ); ?>
25
+ </option>
26
+ </select>
27
+ </label>
28
+ </div>
29
+ <div class="inline then fast then_simple then_not_standard" style="display: none;">
30
+ <p class="description">
31
+ <?php esc_html_e( 'Using JavaScript. Intended for small scale.', 'strong-testimonials' ); ?>
32
+ <?php echo wp_kses_post( $links ); ?>
33
+ </p>
34
+ </div>
35
+ <div class="inline then fast then_not_simple then_standard" style="display: none;">
36
+ <p class="description">
37
+ <?php esc_html_e( 'Using paged URLs: /page/2, /page/3, etc. Best for large scale.', 'strong-testimonials' ); ?>
38
+ <?php echo wp_kses_post( $links ); ?>
39
+ </p>
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="row then then_pagination" style="display: none;">
45
+ <div class="row-inner">
46
+ <div class="inline">
47
+ <label for="view-per_page">
48
+ <?php echo esc_html_x( 'Per page', 'quantity', 'strong-testimonials' ); ?>
49
+ </label>
50
+ <input class="input-incremental" id="view-per_page" name="view[data][pagination_settings][per_page]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['per_page'] ); ?>"/>
51
+ </div>
52
+
53
+ <div class="inline">
54
+ <label for="view-nav">
55
+ <?php esc_html_e( 'Navigation', 'strong-testimonials' ); ?>
56
+ </label>
57
+ <select id="view-nav" name="view[data][pagination_settings][nav]">
58
+ <option value="before" <?php selected( $view['pagination_settings']['nav'], 'before' ); ?>>
59
+ <?php esc_html_e( 'before', 'strong-testimonials' ); ?>
60
+ </option>
61
+ <option value="after" <?php selected( $view['pagination_settings']['nav'], 'after' ); ?>>
62
+ <?php esc_html_e( 'after', 'strong-testimonials' ); ?>
63
+ </option>
64
+ <option value="before,after" <?php selected( $view['pagination_settings']['nav'], 'before,after' ); ?>>
65
+ <?php esc_html_e( 'before & after', 'strong-testimonials' ); ?>
66
+ </option>
67
+ </select>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="row then then_not_simple then_standard" style="display: none;">
72
+ <div class="row-inner">
73
+ <div class="inline">
74
+ <label for="view-pagination-show_all">
75
+ <select class="if select" id="view-pagination-show_all"
76
+ name="view[data][pagination_settings][show_all]">
77
+ <option value="on" <?php selected( $view['pagination_settings']['show_all'] ); ?>>
78
+ <?php esc_html_e( 'Show all page numbers', 'strong-testimonials' ); ?>
79
+ </option>
80
+ <option value="off" <?php selected( ! $view['pagination_settings']['show_all'] ); ?> class="trip">
81
+ <?php esc_html_e( 'Show condensed page numbers', 'strong-testimonials' ); ?>
82
+ </option>
83
+ </select>
84
+ </label>
85
+ </div>
86
+ <div class="inline then then_show_all" style="display: none;">
87
+ <div class="inline">
88
+ <label for="view-pagination-end_size">
89
+ <?php echo esc_html_x( 'End size', 'quantity', 'strong-testimonials' ); ?>
90
+ </label>
91
+ <input class="input-incremental" id="view-pagination-end_size" name="view[data][pagination_settings][end_size]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['end_size'] ); ?>"/>
92
+ </div>
93
+ <div class="inline">
94
+ <label for="view-pagination-mid_size">
95
+ <?php echo esc_html_x( 'Middle size', 'quantity', 'strong-testimonials' ); ?>
96
+ </label>
97
+ <input class="input-incremental" id="view-pagination-mid_size" name="view[data][pagination_settings][mid_size]" type="number" min="1" step="1" value="<?php echo esc_attr( $view['pagination_settings']['mid_size'] ); ?>"/>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
103
+ <div class="row then then_not_simple then_standard" style="display: none;">
104
+ <div class="row-inner">
105
+ <div class="inline inline-middle">
106
+ <input class="if toggle checkbox" id="view-pagination-prev_next" name="view[data][pagination_settings][prev_next]" type="checkbox" value="1" <?php checked( $view['pagination_settings']['prev_next'] ); ?>>
107
+ <label for="view-pagination-prev_next">
108
+ <?php esc_html_e( 'Show previous/next links', 'strong-testimonials' ); ?>
109
+ </label>
110
+ </div>
111
+ <div class="then then_prev_next inline inline-middle">
112
+ <label for="view-pagination-prev_text">
113
+ <?php esc_html_e( 'Previous text', 'strong-testimonials' ); ?>
114
+ </label>
115
+ <input class="code" id="view-pagination-prev_text" name="view[data][pagination_settings][prev_text]" type="text" value="<?php echo htmlentities( $view['pagination_settings']['prev_text'] ); ?>">
116
+ </div>
117
+ <div class="then then_prev_next inline inline-middle">
118
+ <label for="view-pagination-next_text">
119
+ <?php esc_html_e( 'Next text', 'strong-testimonials' ); ?>
120
+ </label>
121
+ <input class="code" id="view-pagination-next_text" name="view[data][pagination_settings][next_text]" type="text" value="<?php echo htmlentities( $view['pagination_settings']['next_text'] ); ?>">
122
+ </div>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="row then then_not_simple then_standard" style="display: none;">
127
+ <div class="row-inner">
128
+ <div class="inline">
129
+ <label for="view-pagination-before_page_number">
130
+ <?php esc_html_e( 'Before page number', 'strong-testimonials' ); ?>
131
+ </label>
132
+ <input class="small-text" id="view-pagination-before_page_number" name="view[data][pagination_settings][before_page_number]" type="text" value="<?php echo esc_attr( $view['pagination_settings']['before_page_number'] ); ?>">
133
+ </div>
134
+ <div class="inline">
135
+ <label for="view-pagination-after_page_number">
136
+ <?php esc_html_e( 'After page number', 'strong-testimonials' ); ?>
137
+ </label>
138
+ <input class="small-text" id="view-pagination-after_page_number" name="view[data][pagination_settings][after_page_number]" type="text" value="<?php echo esc_attr( $view['pagination_settings']['after_page_number'] ); ?>">
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <?php do_action( 'wpmtst_view_editor_pagination_row_end' ); ?>
145
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/partials/views/option-read-more-page.php CHANGED
@@ -1,87 +1,86 @@
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
- <option value=""><?php _e( '&mdash; select &mdash;' ); ?></option>
23
- <?php
24
- do_action( 'wpmtst_readmore_page_list', $view );
25
- if ( $custom_list ) {
26
- ?>
27
- <optgroup label="<?php _e( 'Custom', 'strong-testimonials' ); ?>">
28
- <?php
29
- foreach ( $custom_list as $page ) {
30
- echo $page;
31
- }
32
- ?>
33
- </optgroup>
34
- <?php
35
- }
36
- ?>
37
- <optgroup label="<?php _e( 'Pages' ); ?>">
38
- <?php foreach ( $pages_list as $pages ) : ?>
39
- <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>
40
- <?php endforeach; ?>
41
- </optgroup>
42
- <optgroup label="<?php _e( 'Posts' ); ?>">
43
- <?php foreach ( $posts_list as $posts ) : ?>
44
- <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>
45
- <?php endforeach; ?>
46
- </optgroup>
47
- </select>
48
- </label>
49
- <label for="view-page_id2">
50
- <?php _ex( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
51
- </label>
52
- <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
53
- </div>
54
- </div>
55
-
56
- <!-- Link text -->
57
- <div class="row">
58
- <div class="row-inner">
59
- <div class="inline">
60
- <label for="view-more_page_text">
61
- <?php _e( 'with link text', 'strong-testimonials' ); ?>
62
- </label>
63
- <input type="text" id="view-more_page_text" name="view[data][more_page_text]"
64
- value="<?php echo $view['more_page_text']; ?>" size="50">
65
- </div>
66
- </div>
67
- </div>
68
-
69
- <!-- location -->
70
- <div class="row">
71
- <div class="row-inner">
72
- <label>
73
- <select id="view-more_page_hook" name="view[data][more_page_hook]">
74
- <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
75
- <?php _ex( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
76
- </option>
77
- <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
78
- <?php _ex( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
79
- </option>
80
- </select>
81
- </label>
82
- </div>
83
- </div>
84
-
85
- </div>
86
-
87
- </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 esc_html_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
+ <option value=""><?php _e( '&mdash; select &mdash;' ); ?></option>
23
+ <?php
24
+ do_action( 'wpmtst_readmore_page_list', $view );
25
+ if ( $custom_list ) {
26
+ ?>
27
+ <optgroup label="<?php esc_html_e( 'Custom', 'strong-testimonials' ); ?>">
28
+ <?php
29
+ foreach ( $custom_list as $page ) {
30
+ echo wp_kses_post( $page );
31
+ }
32
+ ?>
33
+ </optgroup>
34
+ <?php
35
+ }
36
+ ?>
37
+ <optgroup label="<?php esc_attr_e( 'Pages' ); ?>">
38
+ <?php foreach ( $pages_list as $pages ) : ?>
39
+ <option value="<?php echo esc_attr( $pages->ID ); ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $pages->ID ); ?>><?php echo esc_html( $pages->post_title ); ?></option>
40
+ <?php endforeach; ?>
41
+ </optgroup>
42
+ <optgroup label="<?php esc_attr_e( 'Posts' ); ?>">
43
+ <?php foreach ( $posts_list as $posts ) : ?>
44
+ <option value="<?php echo esc_attr( $posts->ID ); ?>" <?php selected( isset( $view['more_page_id'] ) ? $view['more_page_id'] : 0, $posts->ID ); ?>><?php echo esc_html( $posts->post_title ); ?></option>
45
+ <?php endforeach; ?>
46
+ </optgroup>
47
+ </select>
48
+ </label>
49
+ <label for="view-page_id2">
50
+ <?php echo esc_html_x( 'or enter its ID or slug', 'to select a target page', 'strong-testimonials' ); ?>
51
+ </label>
52
+ <input type="text" id="view-page_id2" name="view[data][more_page_id2]" size="30">
53
+ </div>
54
+ </div>
55
+
56
+ <!-- Link text -->
57
+ <div class="row">
58
+ <div class="row-inner">
59
+ <div class="inline">
60
+ <label for="view-more_page_text">
61
+ <?php esc_html_e( 'with link text', 'strong-testimonials' ); ?>
62
+ </label>
63
+ <input type="text" id="view-more_page_text" name="view[data][more_page_text]" value="<?php echo esc_attr( $view['more_page_text'] ); ?>" size="50">
64
+ </div>
65
+ </div>
66
+ </div>
67
+
68
+ <!-- location -->
69
+ <div class="row">
70
+ <div class="row-inner">
71
+ <label>
72
+ <select id="view-more_page_hook" name="view[data][more_page_hook]">
73
+ <option value="wpmtst_view_footer" <?php selected( 'wpmtst_view_footer', $view['more_page_hook'] ); ?>>
74
+ <?php echo esc_html_x( 'after the last testimonial', 'display setting', 'strong-testimonials' ); ?>
75
+ </option>
76
+ <option value="wpmtst_after_testimonial" <?php selected( 'wpmtst_after_testimonial', $view['more_page_hook'] ); ?>>
77
+ <?php echo esc_html_x( 'in each testimonial', 'display setting', 'strong-testimonials' ); ?>
78
+ </option>
79
+ </select>
80
+ </label>
81
+ </div>
82
+ </div>
83
+
84
+ </div>
85
+
86
+ </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 _e( '<code>post_ids</code>' , 'strong-testimonials' ); ?></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 _e( '<code>post_ids="123,456"</code>', 'strong-testimonials' ); ?></p>
29
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <label for="view-single_or_multiple"><?php echo esc_html_x( '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 esc_html_e( 'one or more testimonials', 'strong-testimonials' ); ?></option>
11
+ <option value="single" <?php echo (int) $view['id'] >= 1 ? 'selected' : ''; ?>><?php esc_html_e( 'a specific testimonial', 'strong-testimonials' ); ?></option>
12
+ </select>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <?php require 'option-id.php'; ?>
18
+ </div>
19
+
20
+ </td>
21
+ <td class="divider">
22
+ <p><?php echo wp_kses_post( _e( '<code>post_ids</code>', 'strong-testimonials' ) ); ?></p>
23
+ </td>
24
+ <td>
25
+ <p><?php echo wp_kses_post( _e( 'a comma-separated list of post ID\'s', 'strong-testimonials' ) ); ?></p>
26
+ </td>
27
+ <td>
28
+ <p><?php echo wp_kses_post( _e( '<code>post_ids="123,456"</code>', 'strong-testimonials' ) ); ?></p>
29
+ </td>
admin/partials/views/option-slideshow-behavior.php CHANGED
@@ -1,93 +1,87 @@
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 _e( 'Help' ); ?></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 esc_html_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" <?php checked( $view['slideshow_settings']['auto_start'] ); ?> class="checkbox">
10
+ <label for="view-auto_start">
11
+ <?php echo esc_html_x( 'Start automatically', 'slideshow setting', 'strong-testimonials' ); ?>
12
+ </label>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <div class="inline inline-middle">
18
+ <input type="checkbox" id="view-auto_hover" name="view[data][slideshow_settings][auto_hover]" value="0" <?php checked( $view['slideshow_settings']['auto_hover'] ); ?> class="checkbox">
19
+ <label for="view-auto_hover">
20
+ <?php echo esc_html_x( 'Pause on hover', 'slideshow setting', 'strong-testimonials' ); ?>
21
+ </label>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="row">
26
+ <div class="inline inline-middle">
27
+ <input type="checkbox" id="view-stop_auto_on_click"
28
+ name="view[data][slideshow_settings][stop_auto_on_click]" value="0"
29
+ <?php checked( $view['slideshow_settings']['stop_auto_on_click'] ); ?> class="checkbox">
30
+ <label for="view-stop_auto_on_click">
31
+ <?php echo esc_html_x( 'Stop on interaction', 'slideshow setting', 'strong-testimonials' ); ?>
32
+ </label>
33
+ </div>
34
+ <div class="inline inline-middle">
35
+ <p class="description"><?php esc_html_e( 'Recommended if using navigation.', 'strong-testimonials' ); ?></p>
36
+ </div>
37
+ </div>
38
+
39
+ <?php
40
+ if ( $view['slideshow_settings']['adapt_height'] ) {
41
+ $height = 'dynamic';
42
+ } else {
43
+ $height = 'static';
44
+ }
45
+ ?>
46
+ <div class="row">
47
+ <div class="row-inner">
48
+
49
+ <div class="inline">
50
+ <label for="view-slideshow_height">
51
+ <select id="view-slideshow_height" name="view[data][slideshow_settings][height]" class="if selectgroup">
52
+ <?php foreach ( $view_options['slideshow_height'] as $key => $type ) : ?>
53
+ <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" <?php selected( $height, $key ); ?>>
54
+ <?php echo esc_html( $type ); ?>
55
+ </option>
56
+ <?php endforeach; ?>
57
+ </select>
58
+ </label>
59
+ </div>
60
+
61
+ <div class="inline then then_slideshow_height then_dynamic then_not_static" style="display: none;">
62
+ <label for="view-adapt_height_speed">
63
+ <?php esc_html_e( 'Duration', 'strong-testimonials' ); ?>
64
+ </label>
65
+ <input type="number" id="view-adapt_height_speed" class="input-incremental" name="view[data][slideshow_settings][adapt_height_speed]" min="0" step="0.1" value="<?php echo esc_attr( $view['slideshow_settings']['adapt_height_speed'] ); ?>" size="3"/>
66
+ <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
67
+ </div>
68
+
69
+ <div class="inline then then_slideshow_height then_not_dynamic then_static" style="display: none;">
70
+ <input type="checkbox" id="view-stretch" name="view[data][slideshow_settings][stretch]" value="1" <?php checked( $view['slideshow_settings']['stretch'] ); ?> class="checkbox">
71
+ <label for="view-stretch">
72
+ <?php esc_html_e( 'Stretch slides vertically', 'strong-testimonials' ); ?>
73
+ </label>
74
+
75
+ <div class="inline description">
76
+ <a href="#tab-panel-wpmtst-help-stretch" class="open-help-tab"><?php esc_html_e( 'Help' ); ?></a>
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div class="row tall">
84
+ <p class="description"><?php esc_html_e( 'The slideshow will pause if the browser window becomes inactive.', 'strong-testimonials' ); ?></p>
85
+ </div>
86
+
87
+ </td>
 
 
 
 
 
 
admin/partials/views/option-slideshow-breakpoints.php CHANGED
@@ -1,95 +1,81 @@
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 esc_html_e( 'minimum screen width', 'strong-testimonials' ); ?>
9
+ </div>
10
+ <div class="inner-table-cell">
11
+ <?php esc_html_e( 'show', 'strong-testimonials' ); ?>
12
+ </div>
13
+ <div class="inner-table-cell">
14
+ <?php esc_html_e( 'margin', 'strong-testimonials' ); ?>
15
+ </div>
16
+ <div class="inner-table-cell">
17
+ <?php esc_html_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 esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][width]" value="<?php echo esc_attr( $breakpoint['width'] ); ?>" type="number" class="input-incremental">
27
+ px
28
+ </label>
29
+ </div>
30
+
31
+ <div class="inner-table-cell">
32
+ <label>
33
+ <select id="view-max_slides_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][max_slides]" class="if selectgroup">
34
+ <option value="1" <?php selected( $breakpoint['max_slides'], 1 ); ?>>1</option>
35
+ <option value="2" <?php selected( $breakpoint['max_slides'], 2 ); ?>>2</option>
36
+ <option value="3" <?php selected( $breakpoint['max_slides'], 3 ); ?>>3</option>
37
+ <option value="4" <?php selected( $breakpoint['max_slides'], 4 ); ?>>4</option>
38
+ </select>
39
+ </label>
40
+ <div class="option-desc singular" style="display: none;">
41
+ <?php esc_html_e( 'slide', 'strong-testimonials' ); ?>
42
+ </div>
43
+ <div class="option-desc plural" style="display: none;">
44
+ <?php esc_html_e( 'slides', 'strong-testimonials' ); ?>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="inner-table-cell">
49
+ <input id="view-margin_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][margin]" value="<?php echo esc_attr( $breakpoint['margin'] ); ?>" type="number" min="1" step="1" size="3" class="input-incremental"/>
50
+ px
51
+ </div>
52
+
53
+ <div class="inner-table-cell">
54
+ <label>
55
+ <select id="view-move_slides_<?php echo esc_attr( $key ); ?>" name="view[data][slideshow_settings][breakpoints][<?php echo esc_attr( $key ); ?>][move_slides]" class="if selectgroup">
56
+ <option value="1" <?php selected( $breakpoint['move_slides'], 1 ); ?>>1</option>
57
+ <option value="2" <?php selected( $breakpoint['move_slides'], 2 ); ?>>2</option>
58
+ <option value="3" <?php selected( $breakpoint['move_slides'], 3 ); ?>>3</option>
59
+ <option value="4" <?php selected( $breakpoint['move_slides'], 4 ); ?>>4</option>
60
+ </select>
61
+ </label>
62
+ <div class="option-desc singular" style="display: none;">
63
+ <?php esc_html_e( 'slide', 'strong-testimonials' ); ?>
64
+ </div>
65
+ <div class="option-desc plural" style="display: none;">
66
+ <?php esc_html_e( 'slides', 'strong-testimonials' ); ?>
67
+ </div>
68
+ </div>
69
+
70
+ </div>
71
+
72
+ <?php endforeach; ?>
73
+ </div>
74
+
75
+ </div>
76
+
77
+ <div class="is-below">
78
+ <input id="restore-default-breakpoints" type="button" name="restore-default-breakpoints" value="<?php esc_attr_e( 'Restore Default Breakpoints', 'strong-testimonials' ); ?>" class="button-secondary" />
79
+ <span id="restored-message"><?php esc_html_e( 'defaults restored', 'strong-testimonials' ); ?></span>
80
+ </div>
81
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/partials/views/option-slideshow-navigation.php CHANGED
@@ -1,104 +1,108 @@
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 esc_html_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 esc_html_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 esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
21
+ <?php selected( $view['slideshow_settings']['controls_type'], $key ); ?>
22
+ <?php
23
+ if ( 'none' == $key ) {
24
+ echo ' class="trip"';
25
+ }
26
+ ?>
27
+ >
28
+ <?php echo esc_html( $type['label'] ); ?>
29
+ </option>
30
+ <?php endforeach; ?>
31
+ </select>
32
+ </div>
33
+
34
+ <?php /* ----- STYLE ----- */ ?>
35
+ <div class="inline then then_slideshow_controls_type" style="display: none;">
36
+ <label for="view-slideshow_controls_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
37
+ <select id="view-slideshow_controls_style" name="view[data][slideshow_settings][controls_style]">
38
+ <?php foreach ( $view_options['slideshow_nav_style']['controls'] as $key => $style ) : ?>
39
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['controls_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
40
+ <?php endforeach; ?>
41
+ </select>
42
+ </div>
43
+
44
+ </div>
45
+ </div>
46
+
47
+ <?php /* ----- PAGER ----- */ ?>
48
+ <div class="row">
49
+ <div class="row-inner then then_has-pager">
50
+
51
+ <?php /* ----- TYPE ----- */ ?>
52
+ <div class="inline">
53
+ <label for="view-slideshow_pager_type"><?php esc_html_e( 'Pagination', 'strong-testimonials' ); ?></label>
54
+ <select id="view-slideshow_pager_type"
55
+ name="view[data][slideshow_settings][pager_type]"
56
+ class="if selectnot">
57
+ <?php foreach ( $view_options['slideshow_nav_method']['pager'] as $key => $type ) : ?>
58
+ <option value="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>"
59
+ <?php selected( $view['slideshow_settings']['pager_type'], $key ); ?>
60
+ <?php
61
+ if ( 'none' == $key ) {
62
+ echo ' class="trip"';
63
+ }
64
+ ?>
65
+ >
66
+ <?php echo esc_html( $type['label'] ); ?>
67
+ </option>
68
+ <?php endforeach; ?>
69
+ </select>
70
+ </div>
71
+
72
+ <?php /* ----- STYLE ----- */ ?>
73
+ <div class="inline then then_slideshow_pager_type" style="display: none;">
74
+ <label for="view-slideshow_pager_style"><?php esc_html_e( 'Style', 'strong-testimonials' ); ?></label>
75
+ <select id="view-slideshow_pager_style" name="view[data][slideshow_settings][pager_style]" class="if selectnot">
76
+ <?php foreach ( $view_options['slideshow_nav_style']['pager'] as $key => $style ) : ?>
77
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['pager_style'], $key ); ?>><?php echo esc_html( $style['label'] ); ?></option>
78
+ <?php endforeach; ?>
79
+ </select>
80
+ </div>
81
+
82
+ </div>
83
+ </div>
84
+
85
+ <?php /* ----- POSITION ----- */ ?>
86
+ <div class="row">
87
+ <div class="row-inner">
88
+
89
+ <div class="then then_slider_type then_show_single then_not_show_multiple" style="display: none;">
90
+ <div class="inline then then_has-position" style="display: none;">
91
+ <label for="view-slideshow_nav_position"><?php esc_html_e( 'Position', 'strong-testimonials' ); ?></label>
92
+
93
+ <select id="view-slideshow_nav_position" name="view[data][slideshow_settings][nav_position]">
94
+ <?php foreach ( $view_options['slideshow_nav_position'] as $key => $label ) : ?>
95
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $view['slideshow_settings']['nav_position'], $key ); ?>><?php echo esc_html( $label ); ?></option>
96
+ <?php endforeach; ?>
97
+ </select>
98
+
99
+ <?php //_e( 'outside', 'strong-testimonials' ); ?>
100
+
101
+ <?php esc_html_e( 'the testimonial frame', 'strong-testimonials' ); ?>
102
+ </div>
103
+ </div>
104
+
105
+ </div>
106
+ </div>
107
+
108
+ </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 esc_html_e( 'Show', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td>
6
+ <?php require 'option-slideshow-type.php'; ?>
7
+ <?php require 'option-slideshow-breakpoints.php'; ?>
8
+ </td>
admin/partials/views/option-slideshow-transition.php CHANGED
@@ -1,46 +1,42 @@
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 esc_html_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 echo esc_html_x( 'Show slides for', 'slideshow setting', 'strong-testimonials' ); ?>
11
+ </label>
12
+ <input type="number" id="view-pause" class="input-incremental" name="view[data][slideshow_settings][pause]" min=".1" step=".1" value="<?php echo esc_attr( $view['slideshow_settings']['pause'] ); ?>" size="3"/>
13
+ <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
14
+ </div>
15
+
16
+ <div class="inline inline-middle then then_slider_type then_show_single then_not_show_multiple fast" style="display: none;">
17
+ <label for="view-effect">
18
+ <?php esc_html_e( 'then', 'strong-testimonials' ); ?>
19
+ </label>
20
+ <select id="view-effect" name="view[data][slideshow_settings][effect]" class="if selectnot">
21
+ <?php foreach ( $view_options['slideshow_effect'] as $key => $label ) : ?>
22
+ <option value="<?php echo esc_attr( $key ); ?>"
23
+ <?php selected( $view['slideshow_settings']['effect'], $key ); ?>
24
+ <?php echo 'none' == $key ? 'class="trip"' : ''; ?>><?php echo esc_html( $label ); ?></option>
25
+ <?php endforeach; ?>
26
+ </select>
27
+ </div>
28
+
29
+ <div class="inline inline-middle then then_slider_type then_not_show_single then_show_multiple fast" style="display: none;">
30
+ <?php esc_html_e( 'then', 'strong-testimonials' ); ?> <?php echo esc_html_x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ); ?>
31
+ </div>
32
+
33
+ <div class="inline inline-middle then then_effect then_none">
34
+ <label for="view-speed">
35
+ <?php esc_html_e( 'for', 'strong-testimonials' ); ?>
36
+ </label>
37
+ <input type="number" id="view-speed" class="input-incremental" name="view[data][slideshow_settings][speed]" min=".1" step=".1" value="<?php echo esc_attr( $view['slideshow_settings']['speed'] ); ?>" size="3"/>
38
+ <?php echo esc_html_x( 'seconds', 'time setting', 'strong-testimonials' ); ?>
39
+ </div>
40
+
41
+ </div>
42
+ </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 esc_html_e( 'single', 'strong-testimonials' ); ?></option>
8
+ <option value="show_multiple" <?php selected( $view['slideshow_settings']['type'], 'show_multiple' ); ?>><?php esc_html_e( 'multiple', 'strong-testimonials' ); ?></option>
9
+ </select>
10
+ </label>
11
+ <div class="option-desc singular" style="display: none;">
12
+ <?php esc_html_e( 'slide at a time', 'strong-testimonials' ); ?>
13
+ </div>
14
+ <div class="option-desc plural" style="display: none;">
15
+ <?php esc_html_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,22 +1,22 @@
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
- </div>
22
- </td>
1
+ <?php /* translators: On the Views admin screen. */ ?>
2
+ <th>
3
+ <?php esc_html_e( 'Template', 'strong-testimonials' ); ?>
4
+ </th>
5
+ <td colspan="2">
6
+ <div id="view-template-list">
7
+ <div class="radio-buttons">
8
+
9
+ <?php require '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
+ </div>
22
+ </td>
admin/partials/views/option-thumbnail.php CHANGED
@@ -1,91 +1,96 @@
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 esc_html_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
21
+ <?php
22
+ if ( 'custom' == $key ) {
23
+ echo ' class="trip"';}
24
+ ?>
25
+ value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $view['thumbnail_size'] ); ?>><?php echo esc_html( $size['label'] ); ?></option>
26
+ <?php endforeach; ?>
27
+ </select>
28
+ </div>
29
+ <div class="inline then then_thumbnail_size" style="margin-left: 1em;">
30
+ <label for="thumbnail_width">
31
+ <?php esc_html_e( 'width', 'strong-testimonials' ); ?>
32
+ </label>
33
+ <input id="thumbnail_width" class="input-number-px" type="text" name="view[data][thumbnail_width]" value="<?php echo esc_attr( $view['thumbnail_width'] ); ?>"> px
34
+ <span style="display: inline-block; color: #BBB; margin: 0 1em;">|</span>
35
+ <label for="thumbnail_height">
36
+ <?php esc_html_e( 'height', 'strong-testimonials' ); ?>
37
+ </label>
38
+ <input id="thumbnail_height" class="input-number-px" type="text" name="view[data][thumbnail_height]" value="<?php echo esc_attr( $view['thumbnail_height'] ); ?>"> px
39
+ </div>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="row">
44
+ <div class="row-inner">
45
+ <div class="inline">
46
+ <input type="checkbox" id="view-lightbox" class="if toggle" name="view[data][lightbox]"
47
+ value="1" <?php checked( $view['lightbox'] ); ?> class="checkbox">
48
+ <label for="view-lightbox">
49
+ <?php esc_html_e( 'Open full-size image in a lightbox', 'strong-testimonials' ); ?>
50
+ </label>
51
+ </div>
52
+ <div class="inline then then_lightbox">
53
+ <p class="description"><?php esc_html_e( 'Requires a lightbox provided by your theme or another plugin.', 'strong-testimonials' ); ?></p>
54
+ </div>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="row">
59
+ <div class="row-inner">
60
+ <div class="inline then then_lightbox input" style="display: none;">
61
+ <label for="view-lightbox_class">
62
+ <?php esc_html_e( 'CSS class', 'strong-testimonials' ); ?>
63
+ </label>
64
+ <input type="text" id="view-lightbox_class" class="medium inline" name="view[data][lightbox_class]" value="<?php echo esc_attr( $view['lightbox_class'] ); ?>">
65
+ <p class="inline description tall">
66
+ <?php esc_html_e( 'To add a class to the image link.', 'strong-testimonials' ); ?>
67
+ </p>
68
+ </div>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="row">
73
+ <div class="row-inner">
74
+ <div class="inline">
75
+ <label for="view-gravatar">
76
+ <?php esc_html_e( 'If no Featured Image', 'strong-testimonials' ); ?>
77
+ </label>
78
+ <select id="view-gravatar" class="if select selectper" name="view[data][gravatar]">
79
+ <option value="no" <?php selected( $view['gravatar'], 'no' ); ?>><?php esc_html_e( 'show nothing', 'strong-testimonials' ); ?></option>
80
+ <option value="yes" <?php selected( $view['gravatar'], 'yes' ); ?>><?php esc_html_e( 'show Gravatar', 'strong-testimonials' ); ?></option>
81
+ <option value="if" <?php selected( $view['gravatar'], 'if' ); ?>><?php esc_html_e( 'show Gravatar only if found', 'strong-testimonials' ); ?></option>
82
+ </select>
83
+ </div>
84
+ <div class="inline">
85
+ <div class="then fast then_not_no then_yes then_if" style="display: none;">
86
+ <p class="description tall">
87
+ <a href="<?php echo esc_url( admin_url( 'options-discussion.php' ) ); ?>"><?php esc_html_e( 'Gravatar settings', 'strong-testimonials' ); ?></a>
88
+ </p>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ </div><!-- .then_images -->
95
+
96
+ </td>
admin/partials/views/option-title.php CHANGED
@@ -1,20 +1,18 @@
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'] ); ?> class="checkbox if toggle">
3
+ <label for="view-title">
4
+ <?php esc_html_e( 'Title', 'strong-testimonials' ); ?>
5
+ </label>
6
+ </th>
7
+ <td colspan="2">
8
+ <div class="row">
9
+ <div class="row-inner">
10
+ <div class="then then_title" style="display: none;">
11
+ <input type="checkbox" id="view-title_link" name="view[data][title_link]" value="1" <?php checked( $view['title_link'] ); ?> class="checkbox">
12
+ <label for="view-title_link">
13
+ <?php printf( esc_html_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' ) ) ) ); ?>
14
+ </label>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </td>
 
 
admin/partials/views/template-input.php CHANGED
@@ -1,8 +1,6 @@
1
- <div>
2
- <input type="radio" id="template-<?php esc_attr_e( $key ); ?>"
3
- name="view[data][<?php esc_attr_e( $current_mode ); ?>]"
4
- value="<?php esc_attr_e( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
5
- <label for="template-<?php esc_attr_e( $key ); ?>">
6
- <?php echo $template['config']['name']; ?>
7
- </label>
8
- </div>
1
+ <div>
2
+ <input type="radio" id="template-<?php echo esc_attr( $key ); ?>" name="view[data][<?php echo esc_attr( $current_mode ); ?>]" value="<?php echo esc_attr( $key ); ?>" <?php checked( $key, $view['template'] ); ?>>
3
+ <label for="template-<?php echo esc_attr( $key ); ?>">
4
+ <?php echo wp_kses_post( $template['config']['name'] ); ?>
5
+ </label>
6
+ </div>
 
 
admin/partials/views/template-not-found.php CHANGED
@@ -1,25 +1,24 @@
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 esc_attr_e( $view['template'] ); ?>"
10
- name="view[data][<?php esc_attr_e( $current_mode ); ?>]"
11
- value="<?php esc_attr_e( $view['template'] ); ?>" checked>
12
- <label for="<?php esc_attr_e( $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'] ); ?>" name="view[data][<?php echo esc_attr( $current_mode ); ?>]" value="<?php echo esc_attr( $view['template'] ); ?>" checked>
10
+ <label for="<?php echo esc_attr( $view['template'] ); ?>">
11
+ <?php echo esc_html( $view['template'] ); ?>
12
+ </label>
13
+ </div>
14
+ <div class="template-description">
15
+ <p>
16
+ <span class="dashicons dashicons-warning error"></span>&nbsp;
17
+ <span class="error"><?php esc_html_e( 'not found', 'strong-testimonials' ); ?></span>
18
+ </p>
19
+ <?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. ?>
20
+ </div>
21
+ </li>
22
+ </ul>
23
+ <?php
24
+ endif;
 
admin/partials/views/template-options.php CHANGED
@@ -1,78 +1,77 @@
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 _e( 'No options', 'strong-testimonials' ); ?></span>
17
- <?php else : ?>
18
- <span><?php _e( 'Options', 'strong-testimonials' ); ?></span>
19
-
20
- <?php foreach ( $template['config']['options'] as $option ) : ?>
21
- <span>
22
- <?php
23
- $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
24
- $id = $key . '-' . $option->name;
25
- switch ( $option->type ) {
26
- case 'select':
27
- // Get default if not set
28
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
29
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
30
- }
31
-
32
- if ( $option->label ) {
33
- printf( '<label for="%s">%s</label>', $id, $option->label );
34
- }
35
-
36
- printf( '<select id="%s" name="%s">', $id, $name );
37
-
38
- foreach ( $option->values as $value ) {
39
- $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
40
- printf( '<option value="%s" %s>%s</option>', $value->value, $selected, $value->description );
41
- }
42
-
43
- echo '</select>';
44
- break;
45
-
46
- case 'radio':
47
- if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
48
- $view['template_settings'][ $key ][ $option->name ] = $option->default;
49
- }
50
-
51
- foreach ( $option->values as $value ) {
52
- $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
53
- printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', $id, $name, $value->value, $checked );
54
- printf( '<label for="%s">%s</label>', $id, $value->description );
55
- }
56
- break;
57
-
58
- case 'checkbox':
59
- /** This breaks checkboxes: */
60
- //if ( ! isset( $view['template_settings'][ $option->name ] ) ) {
61
- // $view['template_settings'][ $option->name ] = $option->default;
62
- //}
63
-
64
- $checked = checked( true, $view['template_settings'][ $key ][ $option->name ], false );
65
- printf( '<input type="checkbox" id="%s" name="%s" value="1" %s>', $id, $name, $checked );
66
- printf( '<label for="%s">%s</label>', $id, $option->label );
67
- break;
68
-
69
- default:
70
- }
71
- ?>
72
- </span>
73
- <?php endforeach; ?>
74
-
75
- <?php endif; ?>
76
- </div>
77
- </div>
78
- </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 wp_kses_post( $template['config']['description'] );
7
+ } else {
8
+ esc_html_e( 'no description', 'strong-testimonials' );
9
+ }
10
+ ?>
11
+ </p>
12
+ <div class="options">
13
+ <div>
14
+ <?php if ( ! isset( $template['config']['options'] ) || ! is_array( $template['config']['options'] ) ) : ?>
15
+ <span><?php esc_html_e( 'No options', 'strong-testimonials' ); ?></span>
16
+ <?php else : ?>
17
+ <span><?php esc_html_e( 'Options', 'strong-testimonials' ); ?></span>
18
+
19
+ <?php foreach ( $template['config']['options'] as $option ) : ?>
20
+ <span>
21
+ <?php
22
+ $name = sprintf( 'view[data][template_settings][%s][%s]', $key, $option->name );
23
+ $id = $key . '-' . $option->name;
24
+ switch ( $option->type ) {
25
+ case 'select':
26
+ // Get default if not set
27
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
28
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
29
+ }
30
+
31
+ if ( $option->label ) {
32
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
33
+ }
34
+
35
+ printf( '<select id="%s" name="%s">', esc_attr( $id ), esc_attr( $name ) );
36
+
37
+ foreach ( $option->values as $value ) {
38
+ $selected = selected( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
39
+ printf( '<option value="%s" %s>%s</option>', esc_attr( $value->value ), esc_attr( $selected ), esc_html( $value->description ) );
40
+ }
41
+
42
+ echo '</select>';
43
+ break;
44
+
45
+ case 'radio':
46
+ if ( ! isset( $view['template_settings'][ $key ][ $option->name ] ) ) {
47
+ $view['template_settings'][ $key ][ $option->name ] = $option->default;
48
+ }
49
+
50
+ foreach ( $option->values as $value ) {
51
+ $checked = checked( $value->value, $view['template_settings'][ $key ][ $option->name ], false );
52
+ printf( '<input type="radio" id="%s" name="%s" value="%s" %s>', esc_attr( $id ), esc_attr( $name ), esc_attr( $value->value ), esc_attr( $checked ) );
53
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $value->description ) );
54
+ }
55
+ break;
56
+
57
+ case 'checkbox':
58
+ /** This breaks checkboxes: */
59
+ //if ( ! isset( $view['template_settings'][ $option->name ] ) ) {
60
+ // $view['template_settings'][ $option->name ] = $option->default;
61
+ //}
62
+
63
+ $checked = checked( true, $view['template_settings'][ $key ][ $option->name ], false );
64
+ printf( '<input type="checkbox" id="%s" name="%s" value="1" %s>', esc_attr( $id ), esc_attr( $name ), esc_attr( $checked ) );
65
+ printf( '<label for="%s">%s</label>', esc_attr( $id ), esc_html( $option->label ) );
66
+ break;
67
+
68
+ default:
69
+ }
70
+ ?>
71
+ </span>
72
+ <?php endforeach; ?>
73
+
74
+ <?php endif; ?>
75
+ </div>
76
+ </div>
77
+ </div>
 
admin/partials/views/view-mode.php CHANGED
@@ -1,18 +1,17 @@
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 esc_html_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]" value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
10
+ <?php echo esc_html( $mode['label'] ); ?>
11
+ <div class="mode-line"></div>
12
+ </label>
13
+ <?php endforeach; ?>
14
+ </div>
15
+ <div class="mode-description"></div>
16
+ </div>
17
+ </div>
 
admin/partials/views/view-name.php CHANGED
@@ -1,17 +1,16 @@
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 esc_html_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]" value="<?php echo esc_attr( htmlspecialchars( stripslashes( $view_name ) ) ); ?>" tabindex="1">
15
+ </div>
16
+ </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
+
3
+ $then_classes = array(
4
+ 'then',
5
+ 'then_display',
6
+ 'then_form',
7
+ 'then_slideshow',
8
+ 'then_not_single_template',
9
+ apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
10
+ );
11
+ ?>
12
+
13
+ <div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
14
+ <div class="table-cell">
15
+ <label for="view-shortcode">
16
+ <?php esc_html_e( 'Shortcode', 'strong-testimonials' ); ?>
17
+ </label>
18
+ </div>
19
+ <div class="table-cell">
20
+ <?php if ( 'edit' == $action ) : ?>
21
+ <div class="saved">
22
+ <input id="view-shortcode" type="text" value="[testimonial_view id=&quot;<?php echo esc_attr( $view_id ); ?>&quot;]" readonly />
23
+ <input id="copy-shortcode" class="button small" type="button" value="<?php echo esc_attr__( 'copy to clipboard', 'strong-testimonials' ); ?>" data-copytarget="#view-shortcode" />
24
+ <span id="copy-message">copied</span>
25
+ </div>
26
+ <?php else : ?>
27
+ <div class="unsaved">
28
+ <?php echo esc_html_x( 'will be available after you save this view', 'The shortcode for a new View.', 'strong-testimonials' ); ?>
29
+ </div>
30
+ <?php endif; ?>
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.5em;
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.5em;
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,139 +1,139 @@
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
- background: #FFF;
123
- border-radius: 4px;
124
- padding: 10px;
125
-
126
- > span {
127
- display: inline-block;
128
-
129
- &:not(:last-child) {
130
- margin-right: 6px; // we get 4px from new line in HTML
131
- }
132
- }
133
- }
134
- }
135
-
136
- // Add margin to match <p>. Must be after `.options` rules.
137
- .description-inner {
138
- margin: 15px 0;
139
- }
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
+ background: #FFF;
123
+ border-radius: 4px;
124
+ padding: 10px;
125
+
126
+ > span {
127
+ display: inline-block;
128
+
129
+ &:not(:last-child) {
130
+ margin-right: 6px; // we get 4px from new line in HTML
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ // Add margin to match <p>. Must be after `.options` rules.
137
+ .description-inner {
138
+ margin: 15px 0;
139
+ }
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: 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
+
admin/scss/_partials/_template.scss CHANGED
@@ -1,43 +1,43 @@
1
- /* -------------------------------------------------
2
- Template options
3
- ------------------------------------------------- */
4
-
5
- ul.radio-list {
6
- &.template-list {
7
- li {
8
- display: flex;
9
-
10
- &.current-selection {
11
- .template-description {
12
- background: $blue_bg;
13
- }
14
- }
15
-
16
- > div {
17
- &:first-child {
18
- flex: 0 0 15%;
19
- white-space: nowrap;
20
- align-self: center;
21
- }
22
-
23
- &:nth-child(2) {
24
- flex: 1 1 auto; // magic
25
- }
26
- }
27
- }
28
- }
29
- }
30
-
31
- .template-optgroup {
32
- font-weight: 600;
33
- margin: 15px 10px 10px 0;
34
- }
35
-
36
- .template-description {
37
- border-radius: 15px;
38
- padding: 0 15px;
39
-
40
- p {
41
- margin: 15px 0 15px !important;
42
- }
43
- }
1
+ /* -------------------------------------------------
2
+ Template options
3
+ ------------------------------------------------- */
4
+
5
+ ul.radio-list {
6
+ &.template-list {
7
+ li {
8
+ display: flex;
9
+
10
+ &.current-selection {
11
+ .template-description {
12
+ background: $blue_bg;
13
+ }
14
+ }
15
+
16
+ > div {
17
+ &:first-child {
18
+ flex: 0 0 15%;
19
+ white-space: nowrap;
20
+ align-self: center;
21
+ }
22
+
23
+ &:nth-child(2) {
24
+ flex: 1 1 auto; // magic
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ .template-optgroup {
32
+ font-weight: 600;
33
+ margin: 15px 10px 10px 0;
34
+ }
35
+
36
+ .template-description {
37
+ border-radius: 15px;
38
+ padding: 0 15px;
39
+
40
+ p {
41
+ margin: 15px 0 15px !important;
42
+ }
43
+ }
admin/scss/_partials/_view-info.scss CHANGED
@@ -1,178 +1,178 @@
1
- /* --------------------------------------------------
2
- The view info section at the top
3
- -------------------------------------------------- */
4
-
5
- .view-info {
6
- width: 100%;
7
- font-size: 20px;
8
- margin-top: 1em;
9
-
10
- .table-cell {
11
- padding-bottom: 15px;
12
-
13
- &:first-child {
14
- padding-top: 9px;
15
- min-width: 130px;
16
- }
17
-
18
- }
19
-
20
- .table-row:last-child {
21
- .table-cell {
22
- padding-bottom: 0;
23
- }
24
- }
25
-
26
- label {
27
- vertical-align: top;
28
- margin: 0;
29
- display: block;
30
- }
31
-
32
- input {
33
- font-size: 20px;
34
-
35
- &.view-name {
36
- width: 100%;
37
- margin: 0;
38
- padding: 4px 8px;
39
- }
40
- }
41
- }
42
-
43
- /* -------------------------------------------------
44
- Shortcode read-only input
45
- ------------------------------------------------- */
46
-
47
- #view-shortcode {
48
- direction: ltr;
49
- font-family: Consolas, Monaco, monospace;
50
- unicode-bidi: embed;
51
- display: inline-block;
52
- font-size: 18px;
53
- padding: 0 8px;
54
- line-height: 35px;
55
- width: 300px;
56
- color: #777;
57
- background: #FFF;
58
- }
59
-
60
- .form-view-shortcode .unsaved {
61
- color: #888;
62
- font-style: italic;
63
- line-height: 37px;
64
- }
65
-
66
- /* -------------------------------------------------
67
- Copy shortcode button
68
- ------------------------------------------------- */
69
-
70
- #copy-shortcode {
71
- //display: inline-block;
72
- margin: 5px 1em;
73
- line-height: 26px;
74
- }
75
-
76
- #copy-message {
77
- opacity: 0;
78
- font-size: 14px;
79
- line-height: 26px;
80
- height: 26px;
81
- padding: 0 10px;
82
- margin: 0;
83
- display: inline-block;
84
- background: #00A4F3;
85
- color: #FFF;
86
- border-radius: 3px;
87
- box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
88
- position: relative;
89
- top: -1px;
90
- }
91
-
92
- #copy-message.copied {
93
- opacity: 0;
94
- will-change: opacity;
95
- animation: showcopied 2s ease;
96
- }
97
-
98
- @keyframes showcopied {
99
- 0% {
100
- opacity: 0;
101
- }
102
- 70% {
103
- opacity: 1;
104
- }
105
- 100% {
106
- opacity: 0;
107
- }
108
- }
109
-
110
- /* -------------------------------------------------
111
- Mode selector
112
- ------------------------------------------------- */
113
-
114
- #view-mode {
115
- margin-top: 1em;
116
-
117
- label {
118
- display: inline-block;
119
- margin: 0 5px 0 0;
120
- padding: 0.5em 18px 0.5em 12px;
121
- border: 2px solid #ccc;
122
- border-radius: 20px;
123
- color: #888;
124
- position: relative;
125
- background: #fff;
126
-
127
- &.checked {
128
- position: relative;
129
- background: #00A4F3;
130
- color: #FFF;
131
- border-color: transparent;
132
- transition: all 0.1s ease;
133
- }
134
-
135
- &:hover {
136
- background: #FFF;
137
- color: #444;
138
- border-color: #00A4F3;
139
- }
140
- }
141
-
142
- input[type="radio"] {
143
- margin-right: 7px;
144
- }
145
- }
146
-
147
- .mode-list {
148
- display: inline-block;
149
- }
150
-
151
- .mode-line {
152
- display: none;
153
- position: absolute;
154
- border-left: 2px solid #00A4F3;
155
- height: 18px;
156
- top: 100%;
157
- left: calc( 50% - 1px );
158
- z-index: -1;
159
-
160
- label.checked & {
161
- display: block;
162
- }
163
- }
164
-
165
- .mode-description {
166
- box-sizing: border-box;
167
- background: #FFF;
168
- margin: 15px 5px 0 0;
169
- padding: 8px 20px;
170
- border: 2px solid #00A4F3;
171
- color: #00A4F3;
172
- text-align: center;
173
- border-radius: 20px;
174
- font-size: 16px;
175
- line-height: 1.3;
176
- min-height: 40px;
177
- transition: all 0.2s ease;
178
- }
1
+ /* --------------------------------------------------
2
+ The view info section at the top
3
+ -------------------------------------------------- */
4
+
5
+ .view-info {
6
+ width: 100%;
7
+ font-size: 20px;
8
+ margin-top: 1em;
9
+
10
+ .table-cell {
11
+ padding-bottom: 15px;
12
+
13
+ &:first-child {
14
+ padding-top: 9px;
15
+ min-width: 130px;
16
+ }
17
+
18
+ }
19
+
20
+ .table-row:last-child {
21
+ .table-cell {
22
+ padding-bottom: 0;
23
+ }
24
+ }
25
+
26
+ label {
27
+ vertical-align: top;
28
+ margin: 0;
29
+ display: block;
30
+ }
31
+
32
+ input {
33
+ font-size: 20px;
34
+
35
+ &.view-name {
36
+ width: 100%;
37
+ margin: 0;
38
+ padding: 4px 8px;
39
+ }
40
+ }
41
+ }
42
+
43
+ /* -------------------------------------------------
44
+ Shortcode read-only input
45
+ ------------------------------------------------- */
46
+
47
+ #view-shortcode {
48
+ direction: ltr;
49
+ font-family: Consolas, Monaco, monospace;
50
+ unicode-bidi: embed;
51
+ display: inline-block;
52
+ font-size: 18px;
53
+ padding: 0 8px;
54
+ line-height: 35px;
55
+ width: 300px;
56
+ color: #777;
57
+ background: #FFF;
58
+ }
59
+
60
+ .form-view-shortcode .unsaved {
61
+ color: #888;
62
+ font-style: italic;
63
+ line-height: 37px;
64
+ }
65
+
66
+ /* -------------------------------------------------
67
+ Copy shortcode button
68
+ ------------------------------------------------- */
69
+
70
+ #copy-shortcode {
71
+ //display: inline-block;
72
+ margin: 5px 1em;
73
+ line-height: 26px;
74
+ }
75
+
76
+ #copy-message {
77
+ opacity: 0;
78
+ font-size: 14px;
79
+ line-height: 26px;
80
+ height: 26px;
81
+ padding: 0 10px;
82
+ margin: 0;
83
+ display: inline-block;
84
+ background: #00A4F3;
85
+ color: #FFF;
86
+ border-radius: 3px;
87
+ box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
88
+ position: relative;
89
+ top: -1px;
90
+ }
91
+
92
+ #copy-message.copied {
93
+ opacity: 0;
94
+ will-change: opacity;
95
+ animation: showcopied 2s ease;
96
+ }
97
+
98
+ @keyframes showcopied {
99
+ 0% {
100
+ opacity: 0;
101
+ }
102
+ 70% {
103
+ opacity: 1;
104
+ }
105
+ 100% {
106
+ opacity: 0;
107
+ }
108
+ }
109
+
110
+ /* -------------------------------------------------
111
+ Mode selector
112
+ ------------------------------------------------- */
113
+
114
+ #view-mode {
115
+ margin-top: 1em;
116
+
117
+ label {
118
+ display: inline-block;
119
+ margin: 0 5px 0 0;
120
+ padding: 0.5em 18px 0.5em 12px;
121
+ border: 2px solid #ccc;
122
+ border-radius: 20px;
123
+ color: #888;
124
+ position: relative;
125
+ background: #fff;
126
+
127
+ &.checked {
128
+ position: relative;
129
+ background: #00A4F3;
130
+ color: #FFF;
131
+ border-color: transparent;
132
+ transition: all 0.1s ease;
133
+ }
134
+
135
+ &:hover {
136
+ background: #FFF;
137
+ color: #444;
138
+ border-color: #00A4F3;
139
+ }
140
+ }
141
+
142
+ input[type="radio"] {
143
+ margin-right: 7px;
144
+ }
145
+ }
146
+
147
+ .mode-list {
148
+ display: inline-block;
149
+ }
150
+
151
+ .mode-line {
152
+ display: none;
153
+ position: absolute;
154
+ border-left: 2px solid #00A4F3;
155
+ height: 18px;
156
+ top: 100%;
157
+ left: calc( 50% - 1px );
158
+ z-index: -1;
159
+
160
+ label.checked & {
161
+ display: block;
162
+ }
163
+ }
164
+
165
+ .mode-description {
166
+ box-sizing: border-box;
167
+ background: #FFF;
168
+ margin: 15px 5px 0 0;
169
+ padding: 8px 20px;
170
+ border: 2px solid #00A4F3;
171
+ color: #00A4F3;
172
+ text-align: center;
173
+ border-radius: 20px;
174
+ font-size: 16px;
175
+ line-height: 1.3;
176
+ min-height: 40px;
177
+ transition: all 0.2s ease;
178
+ }
admin/scss/about.scss CHANGED
@@ -1,76 +1,76 @@
1
- /**
2
- * About Strong Testimonials page
3
- */
4
-
5
- //$blue: #3063A5;
6
- //$gold: #FB8139;
7
- //$green: #25A383;
8
-
9
- /* == Elements
10
- --------------------------------------------------*/
11
-
12
- .highlight {
13
- background: #FFFF99;
14
- border: 1px solid #EEEE00;
15
- display: inline-block;
16
- padding: 3px 6px 2px;
17
- }
18
-
19
- .code {
20
- display: inline-block;
21
- font-family: Consolas, Monaco, monospace;
22
- font-size: 13px;
23
- background: white;
24
- padding: 4px 8px;
25
- box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
26
- max-width: 90%;
27
- }
28
-
29
- .highlight {
30
- background: rgba(#FFE587, 0.5);
31
- border: 1px solid #FFDC5D;
32
- border-radius: 3px;
33
- color: #1E1800;
34
- padding: 5px 15px;
35
- }
36
-
37
- .feature-section-sub {
38
- margin-top: 2em;
39
-
40
- h3.heading {
41
- font-size: 1.2em;
42
- }
43
-
44
- ul {
45
- font-size: 14px;
46
- list-style: square;
47
- margin-left: 1em;
48
-
49
- li {
50
- margin-left: 1em;
51
- text-indent: 4px;
52
- }
53
- }
54
- }
55
-
56
- /* == Extending WordPress about.css
57
- --------------------------------------------------*/
58
-
59
- .about-wrap [class$="-col"] .col {
60
- align-self: flex-start;
61
- }
62
-
63
- .wp-badge {
64
- color: #FFF;
65
- }
66
-
67
- .wp-badge.strong-testimonials {
68
- background-image: url(../img/strong-testimonials-badge.png);
69
- background-color: #8224E3;
70
- }
71
-
72
- .feature-section {
73
- code {
74
- font-size: 13px;
75
- }
76
- }
1
+ /**
2
+ * About Strong Testimonials page
3
+ */
4
+
5
+ //$blue: #3063A5;
6
+ //$gold: #FB8139;
7
+ //$green: #25A383;
8
+
9
+ /* == Elements
10
+ --------------------------------------------------*/
11
+
12
+ .highlight {
13
+ background: #FFFF99;
14
+ border: 1px solid #EEEE00;
15
+ display: inline-block;
16
+ padding: 3px 6px 2px;
17
+ }
18
+
19
+ .code {
20
+ display: inline-block;
21
+ font-family: Consolas, Monaco, monospace;
22
+ font-size: 13px;
23
+ background: white;
24
+ padding: 4px 8px;
25
+ box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
26
+ max-width: 90%;
27
+ }
28
+
29
+ .highlight {
30
+ background: rgba(#FFE587, 0.5);
31
+ border: 1px solid #FFDC5D;
32
+ border-radius: 3px;
33
+ color: #1E1800;
34
+ padding: 5px 15px;
35
+ }
36
+
37
+ .feature-section-sub {
38
+ margin-top: 2em;
39
+
40
+ h3.heading {
41
+ font-size: 1.2em;
42
+ }
43
+
44
+ ul {
45
+ font-size: 14px;
46
+ list-style: square;
47
+ margin-left: 1em;
48
+
49
+ li {
50
+ margin-left: 1em;
51
+ text-indent: 4px;
52
+ }
53
+ }
54
+ }
55
+
56
+ /* == Extending WordPress about.css
57
+ --------------------------------------------------*/
58
+
59
+ .about-wrap [class$="-col"] .col {
60
+ align-self: flex-start;
61
+ }
62
+
63
+ .wp-badge {
64
+ color: #FFF;
65
+ }
66
+
67
+ .wp-badge.strong-testimonials {
68
+ background-image: url(../img/strong-testimonials-badge.png);
69
+ background-color: #8224E3;
70
+ }
71
+
72
+ .feature-section {
73
+ code {
74
+ font-size: 13px;
75
+ }
76
+ }
admin/scss/admin-compat.scss CHANGED
@@ -1,166 +1,166 @@
1
- /**
2
- * Compatibility settings tab
3
- */
4
-
5
- /**
6
- * Basic structure
7
- */
8
- div.row {
9
- display: table-row;
10
-
11
- > div {
12
- display: table-cell;
13
-
14
- &:first-child {
15
- width: 200px;
16
- }
17
- }
18
-
19
- &:not(:last-child) > div {
20
- padding-bottom: 0.5em;
21
- }
22
-
23
- p {
24
- margin-bottom: 0.5em;
25
- }
26
-
27
- &.header {
28
- p {
29
- margin-bottom: 1em;
30
- }
31
- }
32
- }
33
-
34
- /**
35
- * Elements
36
- */
37
- .wrap.wpmtst {
38
- h2 {
39
- margin: 2em 0 1em;
40
-
41
- &.nav-tab-wrapper {
42
- margin-top: 6px;
43
- }
44
- }
45
- }
46
-
47
- input {
48
- &.element {
49
- width: 15em;
50
- }
51
- }
52
-
53
- /**
54
- * Behavior
55
- */
56
- .hidden {
57
- display: none;
58
- }
59
-
60
- // Dependent inputs are initially hidden.
61
- [data-sub] {
62
- display: none;
63
- }
64
-
65
- /**
66
- * Common scenarios table
67
- */
68
- div.scenarios {
69
- div.row {
70
- border: 1px solid #DDD;
71
-
72
- > div {
73
- padding: 1em;
74
-
75
- &:first-child {
76
- width: 35%;
77
- border-right: 1px dotted #DDD;
78
- }
79
- &:last-child {
80
- width: 30%;
81
- border-left: 1px dotted #DDD;
82
- }
83
- }
84
-
85
- p {
86
- font-size: 14px;
87
- margin: 0;
88
- &:not(:last-child) {
89
- margin-bottom: 1em;
90
- }
91
- }
92
-
93
- &.header {
94
- > div {
95
- font-weight: 600;
96
- padding: 0.5em 1em;
97
- }
98
- }
99
-
100
- }
101
- }
102
-
103
- /**
104
- * Settings table
105
- */
106
- div.row {
107
-
108
- &:not(:last-child) > div:nth-child(2) {
109
- padding-bottom: 0.5em;
110
- }
111
-
112
- > div {
113
-
114
- &:first-child {
115
- }
116
-
117
- &.radio-sub {
118
- label {
119
- text-indent: 24px;
120
- width: 200px;
121
- }
122
- }
123
- }
124
-
125
- p {
126
- &.about {
127
- display: inline-block;
128
- vertical-align: middle;
129
-
130
- &.adjacent {
131
- margin-left: 0.5em;
132
- }
133
- }
134
-
135
- &.description {
136
- display: inline-block;
137
- font-size: 14px;
138
- }
139
- }
140
-
141
- label.current {
142
- font-weight: 600;
143
- }
144
- }
145
-
146
- /**
147
- * Lazy load class name pairs
148
- */
149
- .pair-actions {
150
- margin-top: 10px;
151
- }
152
-
153
- .pair-sep {
154
- margin-right: 1em;
155
- }
156
-
157
- @media only screen and (max-width: 1024px) {
158
- .lazyload-pairs {
159
- .pair {
160
- border: 1px solid #DDD;
161
- padding: 5px 10px;
162
- }
163
- }
164
- }
165
-
166
- @import "number-spinner.scss";
1
+ /**
2
+ * Compatibility settings tab
3
+ */
4
+
5
+ /**
6
+ * Basic structure
7
+ */
8
+ div.row {
9
+ display: table-row;
10
+
11
+ > div {
12
+ display: table-cell;
13
+
14
+ &:first-child {
15
+ width: 200px;
16
+ }
17
+ }
18
+
19
+ &:not(:last-child) > div {
20
+ padding-bottom: 0.5em;
21
+ }
22
+
23
+ p {
24
+ margin-bottom: 0.5em;
25
+ }
26
+
27
+ &.header {
28
+ p {
29
+ margin-bottom: 1em;
30
+ }
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Elements
36
+ */
37
+ .wrap.wpmtst {
38
+ h2 {
39
+ margin: 2em 0 1em;
40
+
41
+ &.nav-tab-wrapper {
42
+ margin-top: 6px;
43
+ }
44
+ }
45
+ }
46
+
47
+ input {
48
+ &.element {
49
+ width: 15em;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Behavior
55
+ */
56
+ .hidden {
57
+ display: none;
58
+ }
59
+
60
+ // Dependent inputs are initially hidden.
61
+ [data-sub] {
62
+ display: none;
63
+ }
64
+
65
+ /**
66
+ * Common scenarios table
67
+ */
68
+ div.scenarios {
69
+ div.row {
70
+ border: 1px solid #DDD;
71
+
72
+ > div {
73
+ padding: 1em;
74
+
75
+ &:first-child {
76
+ width: 35%;
77
+ border-right: 1px dotted #DDD;
78
+ }
79
+ &:last-child {
80
+ width: 30%;
81
+ border-left: 1px dotted #DDD;
82
+ }
83
+ }
84
+
85
+ p {
86
+ font-size: 14px;
87
+ margin: 0;
88
+ &:not(:last-child) {
89
+ margin-bottom: 1em;
90
+ }
91
+ }
92
+
93
+ &.header {
94
+ > div {
95
+ font-weight: 600;
96
+ padding: 0.5em 1em;
97
+ }
98
+ }
99
+
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Settings table
105
+ */
106
+ div.row {
107
+
108
+ &:not(:last-child) > div:nth-child(2) {
109
+ padding-bottom: 0.5em;
110
+ }
111
+
112
+ > div {
113
+
114
+ &:first-child {
115
+ }
116
+
117
+ &.radio-sub {
118
+ label {
119
+ text-indent: 24px;
120
+ width: 200px;
121
+ }
122
+ }
123
+ }
124
+
125
+ p {
126
+ &.about {
127
+ display: inline-block;
128
+ vertical-align: middle;
129
+
130
+ &.adjacent {
131
+ margin-left: 0.5em;
132
+ }
133
+ }
134
+
135
+ &.description {
136
+ display: inline-block;
137
+ font-size: 14px;
138
+ }
139
+ }
140
+
141
+ label.current {
142
+ font-weight: 600;
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Lazy load class name pairs
148
+ */
149
+ .pair-actions {
150
+ margin-top: 10px;
151
+ }
152
+
153
+ .pair-sep {
154
+ margin-right: 1em;
155
+ }
156
+
157
+ @media only screen and (max-width: 1024px) {
158
+ .lazyload-pairs {
159
+ .pair {
160
+ border: 1px solid #DDD;
161
+ padding: 5px 10px;
162
+ }
163
+ }
164
+ }
165
+
166
+ @import "number-spinner.scss";
admin/scss/number-spinner.scss CHANGED
@@ -1,107 +1,107 @@
1
- /**
2
- * Number spinner
3
- */
4
- .number-style {
5
- display: inline-block;
6
- margin-right: 10px;
7
-
8
- input {
9
- margin: 0 5px;
10
- font-family: Consolas, Monaco, monospace;
11
- text-align: center;
12
- width: 4em;
13
- }
14
-
15
- > span {
16
- cursor: pointer;
17
-
18
- &.number-minus,
19
- &.number-plus {
20
- height: 24px;
21
- width: 24px;
22
- display: inline-block;
23
- text-align: center;
24
- vertical-align: top;
25
- // to match WordPress:
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
- &:hover {
37
- background: #008ec2;
38
- }
39
-
40
- &:active {
41
- background: #0073aa;
42
- border-color: #006799;
43
- -webkit-box-shadow: inset 0 2px 0 #006799;
44
- box-shadow: inset 0 2px 0 #006799;
45
- -webkit-transform: translateY(1px);
46
- -ms-transform: translateY(1px);
47
- transform: translateY(1px);
48
- outline: none;
49
- }
50
-
51
- &.disabled {
52
- background: #AAA;
53
- border-color: #999 #777 #777;
54
- -webkit-box-shadow: 0 1px 0 #777;
55
- box-shadow: 0 1px 0 #777;
56
- text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
57
- }
58
- }
59
-
60
- &.number-minus::after,
61
- &.number-plus::after {
62
- font-family: dashicons;
63
- font-size: 24px;
64
- line-height: 24px;
65
- height: 24px;
66
- width: 24px;
67
- display: inline-block;
68
- color: #FFF;
69
- text-align: center;
70
- position: relative;
71
- left: -1px;
72
- }
73
-
74
- &.number-minus::after {
75
- content: "\f140";
76
- }
77
-
78
- &.number-plus::after {
79
- content: "\f142";
80
- }
81
- }
82
-
83
- input[type='number'] {
84
- -moz-appearance: textfield;
85
- }
86
-
87
- input::-webkit-outer-spin-button,
88
- input::-webkit-inner-spin-button {
89
- -webkit-appearance: none;
90
- }
91
-
92
- /**
93
- * Disable text selection on buttons. Seems to help jittery pointers.
94
- */
95
- .number-minus,
96
- .number-plus,
97
- .number-minus::after,
98
- .number-plus::after {
99
- -webkit-touch-callout: none; /* iOS Safari */
100
- -webkit-user-select: none; /* Safari */
101
- -khtml-user-select: none; /* Konqueror HTML */
102
- -moz-user-select: none; /* Firefox */
103
- -ms-user-select: none; /* Internet Explorer/Edge */
104
- user-select: none; /* Non-prefixed version, currently
105
- supported by Chrome and Opera */
106
- }
107
- }
1
+ /**
2
+ * Number spinner
3
+ */
4
+ .number-style {
5
+ display: inline-block;
6
+ margin-right: 10px;
7
+
8
+ input {
9
+ margin: 0 5px;
10
+ font-family: Consolas, Monaco, monospace;
11
+ text-align: center;
12
+ width: 4em;
13
+ }
14
+
15
+ > span {
16
+ cursor: pointer;
17
+
18
+ &.number-minus,
19
+ &.number-plus {
20
+ height: 24px;
21
+ width: 24px;
22
+ display: inline-block;
23
+ text-align: center;
24
+ vertical-align: top;
25
+ // to match WordPress:
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
+ &:hover {
37
+ background: #008ec2;
38
+ }
39
+
40
+ &:active {
41
+ background: #0073aa;
42
+ border-color: #006799;
43
+ -webkit-box-shadow: inset 0 2px 0 #006799;
44
+ box-shadow: inset 0 2px 0 #006799;
45
+ -webkit-transform: translateY(1px);
46
+ -ms-transform: translateY(1px);
47
+ transform: translateY(1px);
48
+ outline: none;
49
+ }
50
+
51
+ &.disabled {
52
+ background: #AAA;
53
+ border-color: #999 #777 #777;
54
+ -webkit-box-shadow: 0 1px 0 #777;
55
+ box-shadow: 0 1px 0 #777;
56
+ text-shadow: 0 -1px 1px #777, 1px 0 1px #777, 0 1px 1px #777, -1px 0 1px #777;
57
+ }
58
+ }
59
+
60
+ &.number-minus::after,
61
+ &.number-plus::after {
62
+ font-family: dashicons;
63
+ font-size: 24px;
64
+ line-height: 24px;
65
+ height: 24px;
66
+ width: 24px;
67
+ display: inline-block;
68
+ color: #FFF;
69
+ text-align: center;
70
+ position: relative;
71
+ left: -1px;
72
+ }
73
+
74
+ &.number-minus::after {
75
+ content: "\f140";
76
+ }
77
+
78
+ &.number-plus::after {
79
+ content: "\f142";
80
+ }
81
+ }
82
+
83
+ input[type='number'] {
84
+ -moz-appearance: textfield;
85
+ }
86
+
87
+ input::-webkit-outer-spin-button,
88
+ input::-webkit-inner-spin-button {
89
+ -webkit-appearance: none;
90
+ }
91
+
92
+ /**
93
+ * Disable text selection on buttons. Seems to help jittery pointers.
94
+ */
95
+ .number-minus,
96
+ .number-plus,
97
+ .number-minus::after,
98
+ .number-plus::after {
99
+ -webkit-touch-callout: none; /* iOS Safari */
100
+ -webkit-user-select: none; /* Safari */
101
+ -khtml-user-select: none; /* Konqueror HTML */
102
+ -moz-user-select: none; /* Firefox */
103
+ -ms-user-select: none; /* Internet Explorer/Edge */
104
+ user-select: none; /* Non-prefixed version, currently
105
+ supported by Chrome and Opera */
106
+ }
107
+ }
admin/scss/post-editor.scss CHANGED
@@ -1,111 +1,111 @@
1
- /* Client details meta box
2
- ------------------------------------------------*/
3
-
4
- #details table {
5
- border: none;
6
- width: 100%;
7
- }
8
-
9
- #details th {
10
- font-weight: 400;
11
- text-align: right;
12
- vertical-align: top;
13
- padding-top: 8px;
14
- }
15
-
16
- #details td {
17
- margin: 5px;
18
- padding: 5px;
19
- }
20
-
21
- #details tr:first-child td > p:first-child {
22
- margin-top: 0;
23
- }
24
-
25
- input[type="text"].custom-input,
26
- input[type="email"].custom-input,
27
- input[type="url"].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
+
4
+ #details table {
5
+ border: none;
6
+ width: 100%;
7
+ }
8
+
9
+ #details th {
10
+ font-weight: 400;
11
+ text-align: right;
12
+ vertical-align: top;
13
+ padding-top: 8px;
14
+ }
15
+
16
+ #details td {
17
+ margin: 5px;
18
+ padding: 5px;
19
+ }
20
+
21
+ #details tr:first-child td > p:first-child {
22
+ margin-top: 0;
23
+ }
24
+
25
+ input[type="text"].custom-input,
26
+ input[type="email"].custom-input,
27
+ input[type="url"].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/scss/views.scss CHANGED
@@ -1,47 +1,47 @@
1
- /* ==================================================
2
- Strong Testimonials View Editor
3
- ================================================== */
4
-
5
- /* TODO Consolidate with admin.css */
6
-
7
- $blue: #00A4F3;
8
- $blue_bg: rgba($blue, 0.085);
9
- $orange: #FF8900;
10
- $grayedout: #888;
11
-
12
- @import "_partials/structure";
13
- @import "_partials/view-info";
14
- @import "_partials/category-filter";
15
- @import "_partials/checkbox-icons";
16
- @import "_partials/misc";
17
- @import "_partials/screenshots";
18
- @import "_partials/inputs";
19
- @import "_partials/elements";
20
- @import "_partials/form-table";
21
- @import "_partials/category-checkboxes";
22
- @import "_partials/form-table";
23
- @import "_partials/list-radio-buttons";
24
- @import "_partials/template";
25
- @import "_partials/layout";
26
- @import "_partials/layout-examples";
27
- @import "_partials/layout-example-columns";
28
- @import "_partials/layout-example-grid";
29
- @import "_partials/layout-example-masonry";
30
- @import "_partials/background";
31
- @import "_partials/custom-fields";
32
- @import "_partials/help-tab";
33
- @import "_partials/sticky-views";
34
- @import "_partials/inner-table";
35
-
36
- // TODO Find a home for these in partials.
37
- .form-table td p.description.normal {
38
- font-style: normal;
39
- }
40
- ul.description.normal {
41
- margin-top: 0;
42
- font-style: normal;
43
- }
44
- ul.description li {
45
- margin-bottom: 0;
46
- line-height: 1.5;
47
- }
1
+ /* ==================================================
2
+ Strong Testimonials View Editor
3
+ ================================================== */
4
+
5
+ /* TODO Consolidate with admin.css */
6
+
7
+ $blue: #00A4F3;
8
+ $blue_bg: rgba($blue, 0.085);
9
+ $orange: #FF8900;
10
+ $grayedout: #888;
11
+
12
+ @import "_partials/structure";
13
+ @import "_partials/view-info";
14
+ @import "_partials/category-filter";
15
+ @import "_partials/checkbox-icons";
16
+ @import "_partials/misc";
17
+ @import "_partials/screenshots";
18
+ @import "_partials/inputs";
19
+ @import "_partials/elements";
20
+ @import "_partials/form-table";
21
+ @import "_partials/category-checkboxes";
22
+ @import "_partials/form-table";
23
+ @import "_partials/list-radio-buttons";
24
+ @import "_partials/template";
25
+ @import "_partials/layout";
26
+ @import "_partials/layout-examples";
27
+ @import "_partials/layout-example-columns";
28
+ @import "_partials/layout-example-grid";
29
+ @import "_partials/layout-example-masonry";
30
+ @import "_partials/background";
31
+ @import "_partials/custom-fields";
32
+ @import "_partials/help-tab";
33
+ @import "_partials/sticky-views";
34
+ @import "_partials/inner-table";
35
+
36
+ // TODO Find a home for these in partials.
37
+ .form-table td p.description.normal {
38
+ font-style: normal;
39
+ }
40
+ ul.description.normal {
41
+ margin-top: 0;
42
+ font-style: normal;
43
+ }
44
+ ul.description li {
45
+ margin-bottom: 0;
46
+ line-height: 1.5;
47
+ }
admin/settings/class-strong-testimonials-settings-compat.php CHANGED
@@ -1,939 +1,855 @@
1
- <?php
2
-
3
- /**
4
- * Class Strong_Testimonials_Settings_Compat
5
- *
6
- * @since 2.28.0
7
- */
8
- class Strong_Testimonials_Settings_Compat {
9
-
10
- const TAB_NAME = 'compat';
11
-
12
- const OPTION_NAME = 'wpmtst_compat_options';
13
-
14
- const GROUP_NAME = 'wpmtst-compat-group';
15
-
16
- var $options;
17
-
18
- /**
19
- * Strong_Testimonials_Settings_Compat constructor.
20
- */
21
- public function __construct() {
22
- $this->options = get_option( self::OPTION_NAME );
23
- $this->add_actions();
24
- }
25
-
26
- /**
27
- * Add actions and filters.
28
- */
29
- public function add_actions() {
30
- add_action( 'wpmtst_register_settings', array( $this, 'register_settings' ) );
31
- add_action( 'wpmtst_settings_tabs', array( $this, 'register_tab' ), 3, 2 );
32
- add_filter( 'wpmtst_settings_callbacks', array( $this, 'register_settings_page' ) );
33
- add_action( 'wp_ajax_wpmtst_add_lazyload_pair', array( $this, 'add_lazyload_pair' ) );
34
- }
35
-
36
- /**
37
- * Register settings tab.
38
- *
39
- * @param $active_tab
40
- * @param $url
41
- */
42
- public function register_tab( $active_tab, $url ) {
43
- printf( '<a href="%s" class="nav-tab %s">%s</a>',
44
- esc_url( add_query_arg( 'tab', self::TAB_NAME, $url ) ),
45
- esc_attr( $active_tab == self::TAB_NAME ? 'nav-tab-active' : '' ),
46
- __( 'Compatibility', 'strong-testimonials' )
47
- );
48
- }
49
-
50
- /**
51
- * Register settings.
52
- */
53
- public function register_settings() {
54
- register_setting( self::GROUP_NAME, self::OPTION_NAME, array( $this, 'sanitize_opti